cmux-fork
Skill3 starsChanged 9 days agoMITView on GitHub
Fork the current Claude Code conversation into a new cmux pane or workspace. Default: split right. Supports down and new workspace via natural language.
In this repository24 other files it gives its agents.
- AGENTS.mdAGENTS.md
- agent-delegateSkill
- cmux-delegateSkill
- cmux-second-opinionSkill
- handoverSkill
- harness-initSkill
- harness-loopSkill
- harness-planSkill
- ja-humanizerSkill
- magiSkill
- mcp-convertSkill
- skill-suggestSkill
- spec-codeSkill
- spec-evaluateSkill
- spec-generatorSkill
- spec-implementSkill
- spec-inspectSkill
- spec-orchestrateSkill
- spec-reviewSkill
- spec-rules-initSkill
- spec-testSkill
- spec-to-issueSkill
- spec-workflow-initSkill
- spec-writingSkill
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 4 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 38
If empty or unset → stop with error:
- Distinctive: line 73
Run the appropriate cmux command based on direction:
- Distinctive: line 117
Wait briefly, then read the new surface to confirm Claude Code started:
- Distinctive: line 124
Check the output for:
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
cmux-fork — Fork Conversation into New Pane
Fork the current Claude Code session into a new cmux pane or workspace, preserving full conversation context.
Language Rules
- Auto-detect input language → output in the same language
- Japanese input → Japanese output, use
references/fork-guide.ja.md - English input → English output, use
references/fork-guide.md - Explicit override takes priority
Prerequisites
BEFORE forking, verify cmux environment:
echo $CMUX_SOCKET_PATH- If empty or unset → stop with error:
- EN: "Error: Not running inside a cmux session. Please start Claude Code from within cmux."
- JA: "エラー: cmux セッション内で実行されていません。cmux 内で Claude Code を起動してください。"
- If set → proceed
Permission Mode
By default, fork with --dangerously-skip-permissions to avoid re-approving every tool in the forked session. Use interactive mode only when explicitly requested.
| User Input Pattern | Mode | Flag |
| (default) | skip permissions | --dangerously-skip-permissions |
| "interactive", "対話モード", "承認あり", "with permissions" | interactive | (none) |
Direction Mapping
Parse the user's request to determine fork direction. Use the first match from the table below. If no direction keyword is found, use the default (right).
| User Input Pattern | Direction | cmux Command |
| (no direction specified) | right | cmux new-split right |
| "right", "右に", "右方向" | right | cmux new-split right |
| "down", "below", "下に", "下方向" | down | cmux new-split down |
| "new workspace", "workspace", "新しいワークスペース", "別ワークスペース", "新WS" | workspace | cmux new-workspace |
Execution Steps
Step 1: Determine Direction and Permission Mode
Parse the user's input against the Direction Mapping and Permission Mode tables above.
- Direction default:
right - Permission default:
--dangerously-skip-permissions
Step 2: Create Surface
Run the appropriate cmux command based on direction:
For pane split (right or down):
cmux new-split right
# or
cmux new-split downThe command outputs: OK surface:{N} workspace:{N}
Extract the surface handle (e.g., surface:31) from the output.
For new workspace:
cmux new-workspaceThe command outputs: OK surface:{N} workspace:{N}
Extract both the surface and workspace handles from the output.
Step 3: Launch Forked Claude Code
Send the fork command to the new surface. Default includes --dangerously-skip-permissions to avoid re-approving tools:
Default (auto-approve — recommended):
cmux send --surface surface:{N} "claude --continue --fork-session --dangerously-skip-permissions\n"Interactive mode (if user explicitly requested):
cmux send --surface surface:{N} "claude --continue --fork-session\n"Where surface:{N} is the handle extracted in Step 2.
Step 4: Verify Launch
Wait briefly, then read the new surface to confirm Claude Code started:
sleep 3
cmux read-screen --surface surface:{N}Check the output for:
- Claude Code startup message or prompt → success
- Error messages or empty screen → may need more time; retry once after
sleep 3
Step 5: Report Result
On success, report to the user:
- EN: "Forked session to
surface:{N}. The new session has your full conversation context." - JA: "
surface:{N}にセッションをフォークしました。会話コンテキストが引き継がれています。"
On failure, report the error:
- EN: "Failed to start forked session. Check the new pane for errors."
- JA: "フォークしたセッションの起動に失敗しました。新しいペインのエラーを確認してください。"
Error Handling
| Situation | Response |
CMUX_SOCKET_PATH not set | Error: not in cmux session |
cmux new-split fails | Report error; cmux may not be running |
claude --continue --fork-session fails | Report error; session history may be empty (first launch) |
| No prompt detected after retry | Warn user; suggest checking the new pane manually |
Notes
- By default,
--dangerously-skip-permissionsis used so the forked session doesn't require re-approving every tool. Use interactive mode if you want manual approval. - This skill only forks Claude Code sessions. To launch other agents (Codex, Gemini CLI), use
cmux-delegateinstead. - For detailed cmux command reference and troubleshooting, see the reference guide.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

