cmux-fork-session

cmux-fork-session is a skill for Claude Code, Codex from DJRHails/dotfiles. It costs 137 tokens per session (2,990 once invoked), scanned A, original, MIT.

A skill for creating a new branch of the current coding-agent session in another cmux pane or tab. The new session keeps the earlier conversation and runs alongside the original.

In plain words
What is it for?
Use it when you want to fork the current Claude Code or pi session into a split pane or tab and work on a parallel task.
Why use it?
It lets you explore a separate implementation or line of thought without losing the current work.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/djrhails/dotfiles/cmux-fork-session
Any agent
npx skills add DJRHails/dotfiles --skill cmux-fork-session
Clone the repo
git clone --depth 1 https://github.com/DJRHails/dotfiles

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for cmux-fork-session

README.md
[![agentmods](https://agentmods.dev/badge/skills/djrhails/dotfiles/cmux-fork-session.svg)](https://agentmods.dev/skills/djrhails/dotfiles/cmux-fork-session)
Your own site
<a href="https://agentmods.dev/skills/djrhails/dotfiles/cmux-fork-session"><img src="https://agentmods.dev/badge/skills/djrhails/dotfiles/cmux-fork-session.svg" alt="Measured on agentmods" height="20"></a>
Per session 137 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,990 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00137 $0.02990
Opus 5 $0.00068 $0.01495
Sonnet 5 $0.00027 $0.00598
Haiku 4.5 $0.00014 $0.00299

Measured 4d ago against content hash 00ac2c6d3e87, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

cmux-fork-session scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

The scan reads SKILL.md. This mod also ships 1 executable file (reference/fork-session.sh), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

modules/agents/skills/cmux-fork-session/SKILL.md · 178 lines

How it starts

The opening of the file, as written. The whole thing — 178 lines — stays where its author put it; the contents beside it link to each section on GitHub.

cmux: fork this session into a new split (or tab)

Forks the current agent session into a new cmux split pane (or tab) so you can branch the conversation and keep working in both, side by side. The new surface gets a new session id with the same history up to the fork point, is titled fork: <session-name>, and keeps that title.

Both agents are supported; the flavour is autodetected (override with FORK_AGENT):

agent detected by fork command
Claude Code CLAUDE_CODE_SESSION_ID claude --resume <id> --fork-session
pi PI_CODING_AGENT=true pi --fork <session.jsonl> --provider … --model … --thinking …

pi is checked first: when nested (a pi session launched from Claude Code) pi is the innermost, and is the session the caller is actually talking to.

Usage

Run the reference script — it reads everything from the environment:

bash .../cmux-fork-session/reference/fork-session.sh                 # split right, title "fork: <name>"
bash .../cmux-fork-session/reference/fork-session.sh "branch: " down # split downward, custom prefix
bash .../cmux-fork-session/reference/fork-session.sh "fork: " tab    # new tab instead of a split

Second arg where: right (default) | left | up | down for a split, or tab for a sibling tab. (The skill base directory is printed when the skill loads.)

Env overrides: FORK_AGENT=claude|pi forces the flavour; PI_SESSION_FILE / PI_SESSION_DIR pin pi's session log; CMUX_DURABLE_HOST / CMUX_APP_HOST override the remote and app hosts; CMUX_APP_BIN pins the cmux binary.

What it does

  1. Resolve the session from env, never the process tree: CLAUDE_CODE_SESSION_ID + CLAUDE_CONFIG_DIR, or pi's PI_SESSION_FILE / PI_SESSION_ID. Read the session name and project cwd from $CLAUDE_CONFIG_DIR/sessions/<pid>.json (Claude), or the session JSONL's first session entry plus last session_info entry (pi).
  2. Resolve this session's live cmux surface. Locally, trust the freshly-injected CMUX_SURFACE_ID. On a remote, find the surface whose title contains a match key — see Surface resolution. The resolved id also heals the live-ids sidecar so cmux-session-tab recovers too.
  3. Create the surface: cmux rpc surface.split beside the caller, or surface.create for a tab.
  4. Launch the fork. Claude: cd <cwd> && <launcher> --resume <id> --fork-session, choosing the launcher that matches the session's config dir — ~/.claude-antclaude::ant (sources .env.ant auth + ensure step), ~/.claudeclaude, otherwise CLAUDE_CONFIG_DIR=<cfg> claude. Matching the wrapper matters: a bare CLAUDE_CONFIG_DIR=… claude skips claude::ant's auth and lands "Not logged in". pi: cd <cwd> && pi --fork <session.jsonl> --provider … --model … --thinking … (see pi specifics).
  5. Title the new tab fork: <name> via rpc tab.action.

Read the full file on GitHub · 178 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 178 lines · 137 tokens per session scan A 00ac2c6d3e87

Subscribe to this mod's changes

cmux-fork-session is a skill published in the GitHub repository DJRHails/dotfiles (2 stars, last pushed today), licensed MIT. It adds 137 tokens to every session and 2,990 once invoked, about $0.0007 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

autopilot-batch

Fan out a batch of autopilot-queued issues to parallel background worktree subagents — each runs /autopilot at the build model from its 'model:' label — with a gating review at Opus 5 or above and never below the build (Opus reviews Sonnet and Opus builds, Fable reviews Fable builds).

joshukraine/dotfiles · 75 tokens

todoist-cli

Manage Todoist tasks, projects, labels, filters, sections, comments, reminders, and workspaces via the td CLI. Use when the user wants to view, create, update, complete, or organize Todoist items, or mentions tasks, inbox, today, upcoming, projects, labels, or filters.

joshukraine/dotfiles · 68 tokens

autopilot

Carry a well-scoped GitHub issue through the full dev loop autonomously, stopping at a per-run tier boundary (PR-ready, or merge+deploy for small reversible changes).

joshukraine/dotfiles · 40 tokens

qa-handoff

Generate a hands-on QA testing guide as a self-contained HTML page — for Rails apps or static (Hugo) sites. --publish uploads the HTML to the project's configured QA host.

joshukraine/dotfiles · 41 tokens

walkthrough

Generate a hands-on browser walkthrough of a PR's user-facing changes to exercise before review; --publish posts the final version to the PR for QA.

joshukraine/dotfiles · 33 tokens

dustoff

Assess a project that's been dormant for months and produce a prioritized re-entry plan — lifecycle stage, what's stale or broken, and how far the project's tooling has drifted from current conventions — delegating every fix to the skill that owns it, and optionally capturing the plan as a tracking issue that survives…

joshukraine/dotfiles · 64 tokens