agentleFS
anyoneandersonanyoneanderson/agent-skills/skills/cmux-fork/SKILL.md

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.

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
  1. Distinctive:

    If empty or unset → stop with error:

    line 38
  2. Distinctive:

    Run the appropriate cmux command based on direction:

    line 73
  3. Distinctive:

    Wait briefly, then read the new surface to confirm Claude Code started:

    line 117
  4. Distinctive:

    Check the output for:

    line 124

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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

  1. Auto-detect input language → output in the same language
  2. Japanese input → Japanese output, use references/fork-guide.ja.md
  3. English input → English output, use references/fork-guide.md
  4. 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 PatternModeFlag
(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 PatternDirectioncmux Command
(no direction specified)rightcmux new-split right
"right", "右に", "右方向"rightcmux new-split right
"down", "below", "下に", "下方向"downcmux new-split down
"new workspace", "workspace", "新しいワークスペース", "別ワークスペース", "新WS"workspacecmux 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 down

The command outputs: OK surface:{N} workspace:{N}

Extract the surface handle (e.g., surface:31) from the output.

For new workspace:

cmux new-workspace

The 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

SituationResponse
CMUX_SOCKET_PATH not setError: not in cmux session
cmux new-split failsReport error; cmux may not be running
claude --continue --fork-session failsReport error; session history may be empty (first launch)
No prompt detected after retryWarn user; suggest checking the new pane manually

Notes

  • By default, --dangerously-skip-permissions is 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-delegate instead.
  • For detailed cmux command reference and troubleshooting, see the reference guide.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.