Six Orchestration Patterns
- Entity ID:
ent-20260410-6817f0c3751b - Type:
concept - Scope:
shared - Status:
active
Description
Claude Code's source implements several of the six community-cataloged orchestration patterns -- Orchestrator, Fan-Out/Fan-In, Validation Chain, Specialist Routing, Progressive Refinement, and Watchdog -- though the codebase does not name them using this taxonomy. The patterns emerge from the coordinator system prompt in coordinatorMode.ts, the built-in agent definitions under tools/AgentTool/built-in/, the team-creation workflow in TeamCreateTool/prompt.ts, and the fork-subagent system in forkSubagent.ts.
The Orchestrator pattern is the most explicit: the coordinator system prompt in coordinatorMode.ts states "You are a coordinator. Your job is to: Help the user achieve their goal, Direct workers to research, implement and verify code changes, Synthesize results and communicate with the user." The coordinator never writes code itself -- it spawns workers via the Agent tool, receives results via <task-notification> XML messages, synthesizes findings, and directs follow-up work. Fan-Out/Fan-In is codified in the coordinator's concurrency guidance: "Parallelism is your superpower. Workers are async. Launch independent workers concurrently whenever possible" and "To launch workers in parallel, make multiple tool calls in a single message." The fork system (forkSubagent.ts) also supports this: "If research can be broken into independent questions, launch parallel forks in one message." Specialist Routing appears through built-in agent types with distinct capabilities: Explore (read-only search specialist, uses Haiku model for speed), Plan (architecture specialist, read-only), and verification (adversarial testing specialist with explicit anti-modification rules). The TeamCreateTool prompt further distinguishes "Read-only agents" from "Full-capability agents" and "Custom agents." Validation Chain is the builder-validator separation enforced structurally: the verification agent in verificationAgent.ts has disallowedTools set to [AGENT_TOOL_NAME, FILE_EDIT_TOOL_NAME, FILE_WRITE_TOOL_NAME, NOTEBOOK_EDIT_TOOL_NAME], preventing it from modifying project files. Its system prompt states "You are STRICTLY PROHIBITED from: Creating, modifying, or deleting any files IN THE PROJECT DIRECTORY." The coordinator workflow tables show verification as a distinct phase: "Research -> Synthesis -> Implementation -> Verification."
Key claims
clm-20260410-c1: The Orchestrator pattern is implemented via coordinator mode, where the coordinator has only three tools (Agent,SendMessage,TaskStop) and explicitly does not write code. Evidence:coordinatorMode.tsgetCoordinatorSystemPrompt()-- "Your Tools: Agent - Spawn a new worker, SendMessage - Continue an existing worker, TaskStop - Stop a running worker."clm-20260410-c2: Fan-Out/Fan-In is explicitly supported with the directive to launch parallel agents in a single message. The coordinator prompt shows a worked example of launching "Investigate auth bug" and "Research auth tests" workers concurrently, then synthesizing both results. Evidence:coordinatorMode.tsSection 4 Concurrency -- "Launch independent workers concurrently whenever possible -- don't serialize work that can run simultaneously."clm-20260410-c3: The Validation Chain (builder-validator constraint) is enforced at the tool level, not just via prompt instructions: the verification agent'sdisallowedToolsarray physically removes Edit, Write, and NotebookEdit tools. Evidence:verificationAgent.ts--disallowedTools: [AGENT_TOOL_NAME, EXIT_PLAN_MODE_TOOL_NAME, FILE_EDIT_TOOL_NAME, FILE_WRITE_TOOL_NAME, NOTEBOOK_EDIT_TOOL_NAME].clm-20260410-c4: Specialist Routing is implemented through distinct agent types with different model selections, tool restrictions, and system prompts. The Explore agent uses Haiku for speed while Plan and verification agents usemodel: 'inherit'for the main agent's model. Evidence:exploreAgent.ts--model: process.env.USER_TYPE === 'ant' ? 'inherit' : 'haiku';planAgent.ts--model: 'inherit'.clm-20260410-c5: The verification agent implements an adversarial probe protocol rather than a confirmation protocol, requiring every check to have a "Command run" block with actual terminal output. The prompt explicitly lists rationalizations to guard against ("The code looks correct based on my reading" -- "reading is not verification. Run it."). Evidence:verificationAgent.tsVERIFICATION_SYSTEM_PROMPT -- "Your job is not to confirm the implementation works -- it's to try to break it."
Relations
rel-20260410-c1: ent-20260410-6817f0c3751b --[instantiated_in]-->src/coordinator/coordinatorMode.ts(Orchestrator + Fan-Out)rel-20260410-c2: ent-20260410-6817f0c3751b --[instantiated_in]-->src/tools/AgentTool/built-in/verificationAgent.ts(Validation Chain)rel-20260410-c3: ent-20260410-6817f0c3751b --[instantiated_in]-->src/tools/AgentTool/built-in/exploreAgent.ts(Specialist Routing)rel-20260410-c4: ent-20260410-6817f0c3751b --[instantiated_in]-->src/tools/AgentTool/built-in/planAgent.ts(Specialist Routing)rel-20260410-c5: ent-20260410-6817f0c3751b --[instantiated_in]-->src/tools/AgentTool/forkSubagent.ts(Fan-Out)rel-20260410-c6: ent-20260410-6817f0c3751b --[related_to]--> ent-20260410-156856275f20 (Spec-Driven Delegation -- the prompt quality pattern that makes orchestration effective)
Sources
src-20260410-orch-patterns-a: src/coordinator/coordinatorMode.ts, src/tools/AgentTool/built-in/verificationAgent.ts, src/tools/AgentTool/built-in/exploreAgent.ts, src/tools/AgentTool/built-in/planAgent.ts, src/tools/AgentTool/forkSubagent.ts, src/tools/TeamCreateTool/prompt.ts