Skip to content
Flows
Tier 1 · Claude Code internals Claude Code internals · fetched 2026-07-08

Deep Dive: Multi-Agent Dispatch - Spawn, Fork, Direct

Source-level analysis of the three ways Claude Code dispatches work: Spawn (a named sub-agent with a fresh context, its own tool pool, permission mode, and model), Fork (a synthetic agent that inherits the parent conversation byte-for-byte so parallel workers share the prompt cache), and Direct (the main agent just does the task itself). Covers sync-to-background promotion via a promise race, recursion guards on forking, git-worktree isolation, and a decision matrix for picking a strategy per task.

View source on GitHub

Key takeaways

  • 01

    Spawned agents start from zero context - the dispatch prompt must carry all necessary background

  • 02

    Fork exists to share the prompt cache: byte-identical request prefixes make parallel workers dramatically cheaper

  • 03

    Fork workers run under strict rules: no further spawning, no chatting, commit before reporting, bounded report size

  • 04

    Sub-agents get independent tool pools and permission modes, not a copy of the parent's

  • 05

    Rule of thumb: specialist skills need spawn; splittable research suits fork; simple steps are best done directly

Flows built on this research