## Definition
**Parallel agents via worktrees** is the practice of running independent AI coding sessions in parallel using `git worktree` to give each agent its own working directory while sharing the same `.git` data. Recommended by Anthropic's Claude Code documentation and adopted by Cursor's "Parallel Agents" feature.
## Setup
```bash
git worktree add ../app-experiment-a -b experiment/a
git worktree add ../app-experiment-b -b experiment/b
git worktree add ../app-experiment-c -b experiment/c
( cd ../app-experiment-a && claude "implement approach A from plan.md" ) &
( cd ../app-experiment-b && claude "implement approach B from plan.md" ) &
( cd ../app-experiment-c && claude "implement approach C from plan.md" ) &
wait
```
## Three Benefits
1. **Isolation.** Each agent has its own working tree; no file conflicts.
2. **A/B comparison.** Compare implementations against the same spec.
3. **Time leverage.** Three 20-minute runs in 20 minutes total, not 60.
## When to Use
- True architectural alternatives where comparison is the point.
- A spec where you genuinely don't know which approach is best.
- High-stakes changes where redundancy is cheap insurance.
## When NOT to Use
- Sequential dependencies (frontend needs the backend shape first).
- Tasks where the right answer is obvious — you're burning tokens.
- Anything touching shared external state (databases, queues) — isolation is filesystem-level, not database-level.
## Practical Limits
- **Disk usage.** A 20-minute session on a ~2GB codebase has been observed to use ~10GB of worktree storage.
- **Cognitive overhead.** Most teams find 2–4 parallel agents the practical ceiling; beyond that, coordinating outputs outweighs the parallelism.
- **Merge conflicts with yourself.** Worktrees can create conflicts you don't notice until merge time.
## Related
- [[Specialized Agent]]
- [[Sequential Pipeline]]
- [[Builder-Critic Pattern]]