Skip to main content
Mythos

Claude Code Forked Sub-Agents — Quick Reference

What Fork Mode Is

Forked sub-agents are a Claude Code feature (introduced in v2.1) that clones the current session's full context into a child agent rather than spawning a fresh one. The fork inherits the parent's system prompt, tool definitions, and conversation history — then executes independently and returns only a summary.

The key differentiation from standard sub-agents: a standard sub-agent starts fresh, receiving only its own system prompt, the delegation message, CLAUDE.md files, and any preloaded skills — none of the parent's conversation. A fork gets the entire uncompressed parent context, cache-included.

How It Works

Since Claude Code v2.1.232 (August 2026), fork mode is on by default in interactive sessions. Claude requests a fork by asking for the fork subagent type, and a user starts one by hand with /subtask <task>. With agent view on (the default), /fork now does something different: it copies the whole session into a new background session that runs alongside the original; with agent view turned off, /fork remains the in-session fork. Omitting subagent_type from the Agent tool call launches the general-purpose subagent, not a fork. Skills and commands can still run forked by setting context: fork in their YAML frontmatter.

Each fork child gets an injected XML tag that tells it: "You ARE the fork. Do NOT spawn sub-agents." This prevents recursive forking. A fork cannot spawn further forks.

Fork mode also makes every subagent Claude spawns run in the background. Setting CLAUDE_CODE_FORK_SUBAGENT=0 turns fork mode off so Claude can wait on subagent results in the foreground.

Prompt Cache Economics

Because a fork's system prompt and tool definitions are identical to the parent, its first request reuses the parent's prompt cache. This makes forking significantly cheaper than spawning a fresh sub-agent when the same context is needed. In a parallel fan-out of five agents, children 2–5 share the parent's cached prefix — the total shared-context cost drops to roughly one additional child's worth of tokens.

Worktree Isolation

When spawning a sub-agent through the Agent tool, passing isolation: "worktree" routes its file edits to a separate git worktree instead of the active checkout. This enables parallel implementation branches without filesystem conflicts.

Fork vs. Standard Sub-Agent

Standard sub-agents run in their own context window with a custom system prompt and receive only the delegation message, not the parent's history. They're the right tool when the task is genuinely isolated and doesn't need the full parent context.

Forked sub-agents copy the full parent context at cache-discounted rates. They're the right tool when the task depends on session-accumulated understanding — long sessions where re-explaining would lose critical details.

For the full range of delegation options — subagents, workflows, agent view, agent teams, and Projects — see 📝Claude Code Multi-Agent Orchestration.

Policy Islands Pattern

The policy islands pattern (from Claude Code 2.1) pairs forked context with pre-declared permissions. A command with context: fork and agent: <name> in its frontmatter spawns an isolated sub-agent that can only use the tools in that agent's allowed_tools list. The sub-agent runs without mid-workflow approval prompts and returns only a summary. The parent never sees intermediate tool calls.

This eliminates approval fatigue on repeatable workflows while maintaining a security boundary — permissions travel with the agent definition, not negotiated per step.

Key Use Cases

Parallel evaluation — spawn two or three forks simultaneously to evaluate design variations, API structures, or copy alternatives. Each fork works from the same full context; comparisons are meaningful because the foundation is identical.

Context-heavy implementation — when deep session context is load-bearing (e.g., 180K tokens in, referencing middleware decisions made 90K tokens ago), forking preserves that context for the implementer agent instead of making the parent re-explain it.

Isolate noisy work — implementer and QA agents doing test loops, large diffs, and iterative debugging generate enormous output. Forking them keeps that noise out of the orchestrator's context, returning only a clean summary.

Side-channel exploration — fork a tangent question without derailing the main session thread. The fork resolves the question independently; the main session stays clean.

Foreground control — interactive sessions fork and background subagents by default; set CLAUDE_CODE_FORK_SUBAGENT=0 where the parent must block on each result before continuing.

Limitations

  • Fork mode only works in interactive sessions. It is disabled in non-interactive mode, including the Agent SDK.
  • A fork cannot spawn further forks.
  • Incompatible with --print mode. Fork uses permissionMode: 'bubble', which surfaces prompts to a parent terminal.
  • A fork is requested by name (the fork subagent type) or with /subtask; omitting subagent_type no longer forks.

Configuration Reference

# Skill or command frontmatter
context: fork
agent: <agent-name>   # optional — assigns a named agent's allowed_tools
# Fork mode is on by default in interactive sessions (v2.1.232+); turn it off
CLAUDE_CODE_FORK_SUBAGENT=0

Reflective Notes

Fork mode is the answer to the "compression tax" problem that plagues long agentic sessions — the progressive loss of nuanced context as sub-agents receive summarized rather than raw history. For MythOS workflows (where session context accumulated over a long run is often the most valuable thing in the window), this feature has direct architectural relevance. The policy islands pattern is also worth integrating into any Claude Code-based orchestration work — it's a clean primitive for zero-prompt governed automation.

Contexts

MythOS is a product of Cooperating Citizens of One, Inc.

TermsPrivacyRefundsContact

© 2026 Cooperating Citizens of One, Inc. · MythOS since 2017 · Not affiliated with Anthropic.