Parallel Task Agents
Spawn multiple Claude agents simultaneously to handle independent subtasks. Review 3 papers at once, analyze multiple files in parallel, or run concurrent simulations.
Download this file and place it in your project folder to get started.
# Parallel Agent Protocol
## When to Use Parallel Agents
Use parallel agents when:
- Subtasks are **independent** (don't depend on each other's output)
- Each subtask is substantial (not trivial one-liners)
- Time savings justify the overhead
| Scenario | Sequential (slow) | Parallel (fast) |
|----------|-------------------|-----------------|
| Reviewing 3 files | Review file 1, then 2, then 3 | Review all 3 simultaneously |
| Analyzing 3 papers | Read paper 1, then 2, then 3 | Spawn 3 agents, each reads one |
| Generating 3 reports | Generate report A, B, then C | Spawn agents for each report |
| Testing 3 scenarios | Run test 1, then 2, then 3 | Run all 3 in parallel |
## Requesting Parallel Execution
**Explicit parallel request:**
```
Run these in parallel:
1. Analyze the auth module for security issues
2. Analyze the payments module for security issues
3. Analyze the user module for security issues
Then synthesize the results.
```
**Implicit parallel request:**
```
Analyze all three papers in papers/ folder. Extract key findings from each.
```
When tasks are obviously independent, Claude should parallelize automatically.
## Parallel Execution Rules
1. **3 agents is the sweet spot** — More than 3 increases overhead without proportional speedup
2. **Agents are independent** — They cannot see each other's work in progress
3. **Synthesis happens after** — Wait for all agents, then combine results
4. **Dependencies break parallelism** — If B needs A's output, run A first, then B
## Task Structure for Parallelism
Good (parallel-friendly):
```
Read these 3 files and summarize each:
- src/auth/login.ts
- src/auth/register.ts
- src/auth/logout.ts
```
Bad (has dependencies):
```
1. Read the login code and identify issues
2. Based on the issues found, fix the register code
3. Update logout to match the fixes
```
(Step 2 depends on Step 1, Step 3 depends on Step 2 → must be sequential)
## Synthesis Format
After parallel agents complete:
```
## Parallel Analysis Results
### Agent 1: [Task]
[Summary of findings]
### Agent 2: [Task]
[Summary of findings]
### Agent 3: [Task]
[Summary of findings]
---
## Synthesis
[Combined insights, patterns across all results, prioritized actions]
```
## Cost-Conscious Parallelism
Parallel agents multiply token usage. For cost-sensitive work:
- Run expensive operations (complex analysis) **sequentially**
- Run cheap operations (quick checks) **in parallel**
- Use smaller models for parallel subtasks when possible
What This Does
Claude Code can spawn multiple agents simultaneously using the Task tool. This playbook teaches you how to structure requests so independent work happens in parallel — dramatically speeding up tasks like reviewing multiple files, analyzing several documents, or running independent operations.
Prerequisites
- Claude Code installed and configured
- Tasks with independent subtasks (no dependencies between them)
The CLAUDE.md Template
Copy this into a CLAUDE.md file in your project:
# Parallel Agent Protocol
## When to Use Parallel Agents
Use parallel agents when:
- Subtasks are **independent** (don't depend on each other's output)
- Each subtask is substantial (not trivial one-liners)
- Time savings justify the overhead
| Scenario | Sequential (slow) | Parallel (fast) |
|----------|-------------------|-----------------|
| Reviewing 3 files | Review file 1, then 2, then 3 | Review all 3 simultaneously |
| Analyzing 3 papers | Read paper 1, then 2, then 3 | Spawn 3 agents, each reads one |
| Generating 3 reports | Generate report A, B, then C | Spawn agents for each report |
| Testing 3 scenarios | Run test 1, then 2, then 3 | Run all 3 in parallel |
## Requesting Parallel Execution
**Explicit parallel request:**
Run these in parallel:
- Analyze the auth module for security issues
- Analyze the payments module for security issues
- Analyze the user module for security issues Then synthesize the results.
**Implicit parallel request:**
Analyze all three papers in papers/ folder. Extract key findings from each.
When tasks are obviously independent, Claude should parallelize automatically.
## Parallel Execution Rules
1. **3 agents is the sweet spot** — More than 3 increases overhead without proportional speedup
2. **Agents are independent** — They cannot see each other's work in progress
3. **Synthesis happens after** — Wait for all agents, then combine results
4. **Dependencies break parallelism** — If B needs A's output, run A first, then B
## Task Structure for Parallelism
Good (parallel-friendly):
Read these 3 files and summarize each:
- src/auth/login.ts
- src/auth/register.ts
- src/auth/logout.ts
Bad (has dependencies):
- Read the login code and identify issues
- Based on the issues found, fix the register code
- Update logout to match the fixes
(Step 2 depends on Step 1, Step 3 depends on Step 2 → must be sequential)
## Synthesis Format
After parallel agents complete:
Parallel Analysis Results
Agent 1: [Task]
[Summary of findings]
Agent 2: [Task]
[Summary of findings]
Agent 3: [Task]
[Summary of findings]
Synthesis
[Combined insights, patterns across all results, prioritized actions]
## Cost-Conscious Parallelism
Parallel agents multiply token usage. For cost-sensitive work:
- Run expensive operations (complex analysis) **sequentially**
- Run cheap operations (quick checks) **in parallel**
- Use smaller models for parallel subtasks when possible
Step-by-Step Setup
Step 1: Add to your CLAUDE.md
Add the parallel agent protocol to your project's CLAUDE.md.
Step 2: Test with a simple parallel task
In parallel, count the lines of code in:
1. src/components/
2. src/utils/
3. src/pages/
Report totals for each, then give me the combined total.
Step 3: Use for a real task
Review these 3 pull requests in parallel:
1. PR #123 - Auth refactor
2. PR #124 - Payment integration
3. PR #125 - UI cleanup
For each, identify potential issues and approve/reject recommendation.
Example Usage
User:
"I have 3 research papers in the papers/ folder. Read all 3 in parallel and extract: (1) main hypothesis, (2) methodology, (3) key findings. Then synthesize into a comparison table."
Claude:
Spawning 3 agents to analyze papers in parallel...
Agent 1: paper-smith-2023.pdf
- Hypothesis: Remote work increases productivity for knowledge workers
- Methodology: Survey of 500 workers, 6-month longitudinal
- Key findings: 23% productivity increase, but collaboration scores dropped
Agent 2: paper-jones-2024.pdf
- Hypothesis: Hybrid work optimizes for both productivity and collaboration
- Methodology: A/B test across 12 companies, 3 months
- Key findings: 2-3 days remote is optimal, full remote underperforms
Agent 3: paper-chen-2023.pdf
- Hypothesis: Remote work productivity depends on job type
- Methodology: Meta-analysis of 45 studies
- Key findings: Creative roles suffer remotely, operational roles thrive
Synthesis: Comparison Table
Paper Sample Duration Productivity Finding Caveat Smith 2023 500 workers 6 months +23% Collaboration dropped Jones 2024 12 companies 3 months Hybrid optimal Full remote underperforms Chen 2023 Meta-analysis Various Job-type dependent Creative roles suffer Overall insight: Hybrid (2-3 days remote) appears optimal, but effectiveness varies by role type. Creative roles may need more in-person time.
Tips
- Be explicit about parallelism: "Run these in parallel" is clearer than hoping Claude figures it out.
- Break down large tasks: Instead of "analyze the codebase," specify 3-5 specific areas to analyze in parallel.
- Use for research: Reading multiple documents in parallel is one of the best use cases.
- Synthesis is key: Parallel results are only useful if synthesized well. Ask for comparison tables, priority rankings, or combined insights.
Troubleshooting
Problem: Claude runs tasks sequentially despite "parallel" instruction
Solution: Make the independence explicit: "These tasks have no dependencies on each other. Run them simultaneously."
Problem: Parallel results aren't synthesized well
Solution: Add explicit synthesis instructions: "After all parallel tasks complete, create a comparison table highlighting similarities and differences."
Problem: Parallel tasks seem to take just as long
Solution: Parallelism helps most when each subtask is substantial. For trivial tasks, the overhead may negate the benefit.