Choosing the right tool: Independent work →
/batch. Report-back only → subagents. Agents need to coordinate → Agent Teams.Fan-Out / Fan-In
The simplest parallel pattern. Spawn N agents, each handling an independent slice, then synthesize results. How it works:- Break work into independent units (by file, module, or concern)
- Spawn one agent per unit with
run_in_background: true - Each agent works autonomously and returns results
- The parent synthesizes when all complete
Pipeline Chains
Sequential stages where each phase’s output feeds the next, with context reset between stages. How it works:- Create tasks with dependencies: the validator task is blocked by the builder task
- Each handoff resets context — research noise doesn’t leak into implementation
- Each stage writes structured output that the next stage consumes
Builder-Validator Pairs
The highest-impact pattern for quality. A builder implements changes; a validator with read-only tools checks the work. How it works:- The builder agent has full tool access and implements changes
- The validator agent has only read-only tools (
Read,Grep,Glob,Bash) — it cannot write or edit code - When the validator flags issues, it creates a fix task for a new builder
- The cycle repeats, progressively narrowing scope until the work is correct
Supervisor / Team Lead
The main session focuses exclusively on coordination while teammates do the implementation. How it works:- Enable delegate mode so the lead can only coordinate
- The lead creates tasks, monitors progress, and redirects approaches that aren’t working
- Teammates implement, report back, and the lead synthesizes
Background Workers with Notification
Fire-and-forget agents for tasks that don’t block your current work. How it works:- Spawn an agent with
run_in_background: true(or setbackground: truein agent frontmatter) - Continue working in your main session
- When the background agent completes, you receive a notification
- Press Ctrl+B during a foreground agent’s execution to move it to background on the fly
Contract Chains / Wave Execution
The pattern for parallel work that must integrate cleanly. Run work in waves — each wave’s concrete outputs become the contracts for the next wave’s agents. How it works:- Wave 1 (sequential): Build the foundation — database schema, API contracts, shared types
- Extract concrete artifacts from Wave 1 output (the actual interface, not assumptions about it)
- Wave 2+ (parallel): Spawn agents that receive the upstream contracts injected into their prompts, plus their own file ownership boundaries
- Each agent also gets downstream obligations — “your component must export these props”
← Prev: Subagent Patterns · Next: Permutation Frameworks →