Parallel Agent Dispatch
Decide when and how to split work across parallel AI agents for more throughput without sacrificing quality.
Audience: Engineers using Claude Code, Codex, or similar agent-based tools.
When to Parallelize
Not every task benefits from parallelization. Use this decision tree:
Is the work decomposable into independent pieces?
│
├── Yes: Are the pieces clearly separable (no shared files)?
│ │
│ ├── Yes: Are there at least 2 pieces worth the coordination overhead?
│ │ │
│ │ ├── Yes ──► PARALLELIZE
│ │ └── No ──► Run sequentially (faster than coordinating)
│ │
│ └── No: Can you isolate with worktrees or separate output files?
│ │
│ ├── Yes ──► PARALLELIZE with isolation strategy
│ └── No ──► Run sequentially
│
└── No: Is there a topological ordering (A before B, B before C)?
│
├── Yes: Are there independent branches in the dependency graph?
│ │
│ ├── Yes ──► PARALLELIZE the independent branches
│ └── No ──► Run sequentially
│
└── No (circular deps): Restructure the work before proceedingThe Independence Test
Before dispatching parallel agents, ask: Can each agent run to completion without waiting on another agent's output?
If yes, parallelize. If no, serialize the dependent steps and parallelize only the independent ones.
Good Candidates for Parallelization
| Task Type | Why It Works |
|---|---|
| Researching multiple competing systems | Each system is independent; no shared state |
| Writing tests for different modules | Each test file is independent |
| Exploring different parts of a codebase | Read-only; no conflicts possible |
| Generating separate components/files | Each agent writes to its own file |
| Running audits on different subsystems | Read-only analysis; results are merged later |
Bad Candidates for Parallelization
| Task Type | Why It Fails |
|---|---|
| Editing the same file from multiple agents | Merge conflicts, lost writes |
| Sequential refactoring (rename then update references then fix tests) | Each step depends on the previous |
| Database migration creation (ordering matters) | Dependencies between migrations |
| Writing a single coherent document | Style/tone inconsistencies, structural conflicts |
Principle Reference
This playbook applies Principle 12: Throughput scales with independence, not parallelism alone and Principle 1: Parallelize research, serialize implementation.
How Many Agents
The right number depends on the type of work, not ambition.
Agent Count by Task Type
| Task Type | Recommended | Proven Max | Rationale |
|---|---|---|---|
| Research / exploration | 1 per topic | 11 | Read-only, no conflicts, scales well |
| Implementation | 2-3 | 4 | Write conflicts increase exponentially with count |
| Code exploration | 2-3 | 5 | Read-only, but synthesis overhead grows |
| Testing | 2-4 | 6 | Independent test files, no shared state |
| Documentation | 2-3 | 5 | Separate files, but consistency matters |
The Core Rule
More agents for read-only work, fewer agents for write work.
Research agents read and report, so they rarely conflict. Implementation agents create and modify files, so every additional agent increases the risk of merge conflicts, inconsistent patterns, and duplicated work.
When 11 Agents Makes Sense
The accreditation systems research dispatched 11 parallel agents, each investigating one competing system (Lengo, Guest Manager, Accredit Solutions, etc.). This worked because:
- Each agent had a single, well-scoped system to research
- Output format was identical (same report template for all 11)
- No agent needed another agent's output
- Results were synthesized only after all agents completed
- All 11 ran simultaneously and completed within minutes
When 2-3 Agents Is the Right Number
For the entitlement system implementation, parallel dispatch was limited because:
- Migrations depend on each other (participants before entitlements before transactions)
- Models reference each other (Entitlement belongs to Participant)
- A pattern established in one file must be followed in the next
The parallelism came at natural seams: writing enum classes while writing migration files, or writing model unit tests while writing controller integration tests.
Agent Scoping
Each agent must receive a clear, unambiguous scope. A poorly scoped agent wastes time, produces off-target results, and may conflict with other agents.
The Four Requirements
Every parallel agent must receive:
- Clear objective — What does this agent produce? One sentence.
- Output format — Exactly what the output should look like (template, file path, structure).
- Relevant context — What the agent needs to know to do its work (but not everything you know).
- File boundaries — Which files this agent may read, which it may write.
Scoping Template
markdown
## Agent [N]: [Name]
**Objective:** [One sentence describing what this agent produces]
**Output:** [File path or format specification]
**Context:**
- [Relevant background fact 1]
- [Relevant background fact 2]
**Boundaries:**
- READ: [files/directories this agent should read]
- WRITE: [files this agent should create or modify]
- DO NOT: [explicit exclusions to prevent overlap]Real Example: Research Agent Scoping
## Agent 5: Lengo
**Objective:** Research the Lengo accreditation management system and answer
all 9 design questions from the research brief.
**Output:** Write findings to `reports/05-lengo.md` using the per-system
report template.
**Context:**
- Lengo is a cloud-based accreditation and access management platform
for events and venues.
- Primary URL: https://lengo.com
- Focus on: data model, access control, rule engine, credential lifecycle
**Boundaries:**
- READ: The research brief at `BRIEF.md` for the 9 design questions
and report template
- WRITE: `reports/05-lengo.md` only
- DO NOT: Write to any other file. Do not duplicate work from other agents.Real Example: Implementation Agent Scoping
## Agent 2: HTML/CSS Animation Components
**Objective:** Implement the 4 HTML/CSS-based gallery components:
FadeGallery, SlideGallery, GridGallery, MasonryGallery.
**Output:** One file per component in `src/components/gallery/`:
- FadeGallery.jsx
- SlideGallery.jsx
- GridGallery.jsx
- MasonryGallery.jsx
**Context:**
- Each component receives `items: GalleryItem[]` as props
- Use CSS transitions (not JS animation libraries)
- Follow the pattern established in `src/components/gallery/BaseGallery.jsx`
**Boundaries:**
- READ: `src/components/gallery/BaseGallery.jsx` (reference pattern),
`src/types/gallery.ts` (type definitions)
- WRITE: The 4 files listed above only
- DO NOT: Modify BaseGallery.jsx, gallery.ts, or the main gallery index fileAvoiding Overlapping Writes
The most common failure mode is two agents writing to the same file. Prevent it by:
- Assign separate output files — each agent writes to its own file(s)
- Defer integration — the orchestrator (you or a merge agent) handles imports, index files, and wiring
- Use append-only semantics — if multiple agents must contribute to one file (like DISCOVERY.md), use append-only writes
- Designate a merge agent — a dedicated agent that reads all outputs and combines them
┌─────────┐
│ Agent 1 │──► component-a.jsx
└─────────┘
┌─────────┐
Orchestrator ──│ Agent 2 │──► component-b.jsx
└─────────┘
┌─────────┐
│ Agent 3 │──► component-c.jsx
└─────────┘
│
▼
Orchestrator merges:
adds imports to index.jsxMerge Strategy
How you integrate agent outputs depends on the type of work.
Research: Reports to Synthesis
Each agent produces a structured report. The orchestrator reads all reports and synthesizes:
Step 1: All agents write reports ──► reports/01-system-a.md
reports/02-system-b.md
reports/03-system-c.md
...
Step 2: Orchestrator reads all reports
Step 3: Orchestrator produces:
- Feature comparison matrix (per capability per system)
- Cross-cutting analysis (how systems answer each design question)
- Gap analysis (what NO system does well = opportunity areas)
- Executive summary with ranked recommendationsReal example: The accreditation research produced a 24-capability x 11-system matrix. The key insight — "no system has a true rule engine" — only emerged by comparing across all 11 reports. No single agent could have produced this finding.
Deep Dive
For detailed guidance on structuring synthesis and applying confidence markers to merged findings, see the Knowledge Synthesis Playbook.
Code: Separate Files to Integration
Each agent writes separate files. The orchestrator wires them together:
Step 1: All agents write components ──► CanvasEffects.jsx
DomAnimations.jsx
SvgPatterns.jsx
Step 2: Orchestrator adds to gallery.jsx:
import { CanvasEffects } from './CanvasEffects'
import { DomAnimations } from './DomAnimations'
import { SvgPatterns } from './SvgPatterns'
Step 3: Orchestrator verifies all components build and renderThe orchestrator reviews for consistency before integrating:
- Naming conventions match across all agent outputs?
- Import paths correct?
- Shared interfaces aligned?
- No duplicate code?
Mixed: Reports Feeding into Code
Sometimes research agents inform implementation agents:
Phase 1 (parallel): Research agents investigate patterns
Phase 2 (sequential): Orchestrator synthesizes findings into a plan
Phase 3 (parallel): Implementation agents execute the planTest Suite Merge
If 3 agents each wrote test files for different subsystems:
Agent 1 ──► tests/Feature/EntitlementRuleTest.php (12 scenarios)
Agent 2 ──► tests/Feature/CheckpointScanTest.php (15 scenarios)
Agent 3 ──► tests/Feature/CredentialManagementTest.php (8 scenarios)The merge step is:
- Verify all three use the same test helper setup (factories, seeders)
- Verify no conflicting test database state
- Run the full suite together to catch interaction bugs
- Fix any shared fixture conflicts
Worktree Isolation
When multiple agents need to modify code in the same repository, use git worktrees to give each agent its own working directory and branch.
When to Use Worktrees
| Situation | Use Worktrees? |
|---|---|
| Agents write to completely separate files | No — file boundary ownership is sufficient |
| Agents might affect shared state (package.json, lock files) | Yes |
| Agents run tests that modify database state | Yes |
| Agents need different dependency versions or branch states | Yes |
| Long-running parallel tasks (hours) | Yes — avoids blocking the main worktree |
| Quick parallel tasks (minutes) | Usually not worth the overhead |
| Read-only research agents | No |
How to Set Up
bash
# Create worktrees for each agent
git worktree add ../project-agent-1 -b feature/agent-1-work
git worktree add ../project-agent-2 -b feature/agent-2-work
git worktree add ../project-agent-3 -b feature/agent-3-work
# Each agent works in its own directory
# Agent 1 works in ../project-agent-1/
# Agent 2 works in ../project-agent-2/
# Agent 3 works in ../project-agent-3/
# After agents complete, switch to integration branch and merge
git checkout feature/entitlements
git merge feature/agent-1-work --no-ff -m "Merge agent 1: models and migrations"
git merge feature/agent-2-work --no-ff -m "Merge agent 2: services"
git merge feature/agent-3-work --no-ff -m "Merge agent 3: test suite"
# Clean up worktrees
git worktree remove ../project-agent-1
git worktree remove ../project-agent-2
git worktree remove ../project-agent-3Merge Order
Merge the agent with the most foundational changes first (e.g., the agent that wrote shared types or base classes). This reduces merge conflicts for subsequent merges.
Conflict Resolution
When worktree merges conflict:
- Read both versions of the conflicting file
- Determine which agent's version is correct (usually the one closer to the plan)
- Resolve manually — do not auto-merge conflicting logic
- Run the test suite after resolution
Failure Handling
Context Limit Reached
Symptom: Agent stops mid-task or produces truncated output.
Solution: Split the agent's work further. If an agent was researching 5 systems and hit the context limit at system 3, split into two agents and re-run the incomplete batch.
Original: Agent A researches systems 1-5 ──► hits context limit at 3
Recovery: Agent A1 researches systems 1-3 ──► completes
Agent A2 researches systems 4-5 ──► completesConflicting Outputs
Symptom: Two agents produce incompatible results (different type definitions, conflicting architectural decisions).
Solution: Flag for human resolution. Do not attempt to automatically merge conflicting design decisions. Present both approaches to the stakeholder with trade-offs.
Agent 1 chose: Centralized event bus for component communication
Agent 2 chose: Direct prop drilling for component communication
These are incompatible. Options:
A) Use Agent 1's approach (more flexible, more complex)
B) Use Agent 2's approach (simpler, less flexible)
C) Hybrid (event bus for cross-tree, props for parent-child)Agent Produces Wrong Output
Symptom: Agent writes to wrong files, uses wrong format, or misunderstands the objective.
Solution: Improve the scoping. This almost always means the objective, output format, or boundaries were ambiguous. Fix the scope and re-run.
One Agent Blocks Others
Symptom: Agent B needs Agent A's output, but Agent A is still running.
Solution: This is a dependency you should have caught during the "When to Parallelize" decision tree. Options:
- Wait for Agent A, then dispatch Agent B (sequential for this pair)
- Give Agent B a reasonable assumption about Agent A's output format, then reconcile after both complete
- Restructure the work to eliminate the dependency
The Split-Further Strategy
When an agent fails on a task, the task is probably too large or too vague. Split it:
Failed: "Implement the entitlement service layer"
│
▼
Split into:
Agent A: "Implement RuleEvaluationService — evaluate() and sync() methods"
Agent B: "Implement ScanningService — processScan() for each item type"
Agent C: "Implement EntitlementService — CRUD operations and bulk assignment"Each sub-agent gets a narrower objective, making success more likely.
Human Escalation Points
Some failures require human intervention. Do not let agents resolve these autonomously:
- Architectural disagreements between agents (different assumptions about the design)
- Merge conflicts in critical business logic (not just formatting)
- Missing context that no agent can discover (undocumented business rules)
- Security-sensitive decisions (auth model, data access patterns)
Real Examples
Example 1: Website Gallery (3 Implementation Agents)
Task: Build a component gallery with 11 interactive components.
Decomposition:
- Agent 1: Canvas-based components (CanvasEffects, ParticleSystem, WaveGenerator, FluidSimulation)
- Agent 2: HTML/CSS components (FadeGallery, SlideGallery, GridGallery, MasonryGallery)
- Agent 3: SVG components (SvgPatterns, PathAnimations, MorphTransitions)
Scoping: Each agent received the shared type definitions and the BaseComponent pattern. Each wrote to its own files. The orchestrator added imports to the main gallery index after all three completed.
Result: 11 components delivered in the time it would have taken to write 4 sequentially.
Example 2: Accreditation Research (11 Research Agents)
Task: Research 11 competing accreditation/access management systems.
Decomposition: One agent per system, each answering the same 9 design questions using the same report template.
Scoping: Each agent received the research brief (design questions + report template) and the name/URL of its assigned system. Each wrote to reports/NN-system-name.md.
Synthesis: The orchestrator read all 11 reports and produced:
- A 24-capability feature matrix
- Cross-cutting analysis per design question
- 5 ranked design recommendations, including the key insight: "no system has a true rule engine"
Result: 11 deep-dive reports (each ~2000 words) completed in parallel. The synthesis identified patterns no single report could have revealed.
Example 3: Agentic Tools Discovery (4 Discovery Agents)
Task: Survey the landscape of AI agent tools, frameworks, and platforms.
Decomposition: By search strategy (not by topic):
- Agent A: GitHub (topics, trending, awesome lists, keyword search)
- Agent B: Review sites (G2, Capterra, Product Hunt, comparison articles)
- Agent C: Academic/technical (papers, conference talks, documentation)
- Agent D: Community (Reddit, HN, Twitter/X, YouTube, Discord)
Why strategy-based, not topic-based: Topic-based splitting would miss tools that span categories. Strategy-based splitting maximizes coverage because each agent uses different source types.
Result: 300+ tools discovered across all agents. After deduplication: ~250 unique entries. Each agent contributed unique finds that others missed, validating the multi-strategy approach.
Example 4: Codebase Exploration (3 Explore Agents)
Task: Understand the existing codebase structure before planning the entitlements feature.
Decomposition:
- Agent 1: Data layer (models, migrations, relationships)
- Agent 2: API layer (controllers, routes, middleware)
- Agent 3: Business logic (services, events, observers, policies)
Result: Comprehensive codebase map produced in minutes. Critical finding from Agent 1: Festival has no users() method — must use festivalInvites() instead. This would have caused a cascade of errors if discovered during implementation instead of during exploration.
Example Prompt Sequences
Example prompt sequences (click to expand)
Dispatching Research Agents
I need to research 5 competing systems for [domain]. Dispatch 5 parallel
agents, one per system. Each agent should:
1. Read the system's API docs and help center
2. Answer these design questions: [list]
3. Output a report following this template: [template]
4. Mark confidence on every finding (confirmed/inferred/unknown)
Systems:
- System A: https://...
- System B: https://...
- System C: https://...
- System D: https://...
- System E: https://...
Each agent writes to reports/[system-name].md using this template:
# [System Name]
## Overview
[1 paragraph summary]
## Data Model
[Answer to Q1]
## Access Control
[Answer to Q2]
## Rule Engine
[Answer to Q3]
## Credential Lifecycle
[Answer to Q4]
## Integrations
[Answer to Q5]
## Confidence Notes
[Which findings are confirmed vs inferred vs unknown]
After all 5 agents complete, I will synthesize the findings into a
comparison matrix.Dispatching Implementation Agents
The implementation plan has 3 independent sections that can be built
in parallel:
Agent 1: Build the Zone model and migration (section 2.4 of the plan)
- Write to: app/Models/Entitlements/Zone.php,
database/migrations/xxxx_create_zones_table.php
- Follow existing model patterns (SoftDeletes, UUID boot)
Agent 2: Build the Credential model and migration (section 2.8)
- Write to: app/Models/Entitlements/Credential.php,
database/migrations/xxxx_create_credentials_table.php
- Same conventions as Agent 1
Agent 3: Write test scenarios for checkpoint scanning (section 7)
- Write to: tests/Feature/CheckpointScanTest.php
- Reference TEST-SCENARIOS.md for scenario definitions 1.1-1.12
- Do not implement the scanning service — only write the test file
After all agents complete, I will integrate and run the test suite.Dispatching Exploration Agents
I need to understand how the existing codebase handles [domain]. Dispatch
3 exploration agents:
Agent 1: Read all models in app/Models/ related to [domain].
Map: model name, table, relationships, traits, key methods.
Agent 2: Read all controllers in app/Http/Controllers/Api/ related to [domain].
Map: endpoint, HTTP method, auth pattern, request shape, response shape.
Agent 3: Read all migrations related to [domain].
Map: table, columns, types, indexes, FK conventions.
Each agent reports back with a structured summary. I will synthesize
the findings before writing the implementation plan.Checklist
Pre-Dispatch
- [ ] Tasks are genuinely independent (pass the independence test)
- [ ] Each agent has a scoped brief (objective, output format, context, file boundaries)
- [ ] No two agents write to the same file
- [ ] Agent count matches task type (research: up to 11, implementation: 2-3)
- [ ] Merge strategy decided before dispatch (synthesis agent, manual merge, worktree merge)
- [ ] Failure recovery plan exists (what if an agent fails or hits context limits)
During Execution
- [ ] Monitor for agents that get stuck or exceed scope
- [ ] Do not start synthesis/merge until all agents complete
- [ ] Kill and re-dispatch agents that are spinning, rather than waiting
Post-Merge
- [ ] All outputs reviewed for consistency (naming, conventions, imports)
- [ ] Integration commit created
- [ ] Full test suite passes after merge
- [ ] Out-of-scope changes reverted
- [ ] Worktrees cleaned up (if used)
Superpowers Skills Mapping
| Skill | Role in This Playbook |
|---|---|
dispatching-parallel-agents | Core skill for scoping and launching agents |
subagent-driven-development | Implementation-focused parallelization |
agentic-research | Research-focused parallelization with confidence scoring |
brainstorming | Pre-dispatch: identifying which tasks are independent and parallelizable |
writing-plans | Pre-dispatch: creating the agent briefs with clear boundaries |