Skip to content

Wave Patterns

A wave is a cycle of parallel work followed by synthesis. Instead of one agent grinding through a task sequentially, you decompose work into independent chunks, assign them to agents in separate tmux panes, and iterate until done.

Wave 1: Research Wave 2: Build Wave 3: Integrate
┌─────┬─────┐ ┌─────┬─────┬─────┐ ┌─────┬─────┐
│ A1 │ A2 │ → │ A1 │ A2 │ A3 │ → │ A1 │ A2 │
│scan │scan │ │model│routes│ UI │ │wire │tests│
└─────┴─────┘ └─────┴─────┴─────┘ └─────┴─────┘
↓ synthesize ↓ synthesize ↓ done

The Wave Cycle

Each wave follows four steps:

  1. Assess — What did the previous wave accomplish? What failed?
  2. Decompose — What can be done in parallel now?
  3. Spawn — Launch agents in tmux panes for each independent task
  4. Synthesize — Gather results, update state, plan next wave

File-Based State

Track progress through a markdown state file instead of keeping everything in agent memory. This survives compactions, context resets, and lets any agent pick up where others left off.

State file: .claude/team-state.local.md

---
wave: 2
status: in_progress
goal: "Build user auth with JWT"
---
## Completed
- [x] Scanned existing auth patterns
- [x] Built User model
## In Progress
- [ ] JWT route handlers
- [ ] React login components
## Blocked
- Integration tests blocked on route completion

Agent outputs: .claude/team-outputs/*.md

Each agent writes its findings/results to a file in this directory. The team lead reads all outputs between waves.

Five Wave Patterns

Feature Implementation

Waves: 3-4 | Agents: 2-3

Build multi-component features using iterative parallel waves.

WaveGoalAgents
1Research existing patternsbackend + frontend
2Parallel implementationbackend + frontend + tests
3Integration & validationbackend + tests
4Polish (if needed)single agent

Key principle: Partition files strictly. Before Wave 2, explicitly tell each agent which directories they own.

Research & Exploration

Waves: 2-3 | Agents: 2-3

Understand a codebase or problem space using parallel exploration.

WaveGoalAgents
1Broad scan — map territorystructure + patterns + deps
2Deep dives into specific areas2 focused investigators
3Synthesis into architecture docteam lead only

Key principle: Use haiku for Wave 1 (broad scanning is simple work), sonnet or opus for Wave 2 deep dives.

Test Generation

Waves: 3-4+ | Agents: 2-3

Build comprehensive test coverage using parallel test writers.

WaveGoalAgents
1Discover gaps, learn patternsscanner + patterns
2Generate tests in parallelunit + integration + edge-cases
3Validate & fix failuresfixers
4+Iterate until greenas needed

Key principle: Each agent writes tests in different files. Partition by directory or test type.

Refactoring

Waves: 3-4 | Agents: 2

Large-scale code transformations with strict file ownership.

WaveGoalAgents
1Map all instances, understand depsrefactorer + consumers
2Transform leaf nodes firstrefactorer + consumers
3Transform core modulesrefactorer + consumers
4+Fix breakage until greenas needed

Key principle: Transform leaf nodes (no dependents) first to keep the test suite green between waves.

Bug Hunt

Waves: 3-4 | Agents: 2-3

Track down complex bugs using parallel hypothesis testing.

WaveGoalAgents
1Gather evidence from multiple angleslogs + code + history
2Test hypotheses in parallelone agent per hypothesis
3Implement fixsingle fixer
4Verify fix & write regression testregression + verify

Key principle: The team lead forms hypotheses from evidence — agents test them. One hypothesis per agent.

Key Principles

  1. Parallel everything — If two tasks don’t depend on each other, run them at the same time
  2. Synthesize between waves — The team lead reads all outputs and adjusts the plan
  3. Iterate until done — Each wave builds on the last. Set a max of 5-10 waves
  4. File-based state is truth — The state file tracks what’s done, pending, and blocked
  5. Keep teams small — 2-3 agents. More creates coordination overhead

Anti-Patterns

Don’tInstead
Spawn 5+ agents per wave2-3 agents per wave
Skip synthesis between wavesAlways read outputs and update state
Give vague task descriptionsBe specific: files, functions, acceptance criteria
Let agents touch overlapping filesPartition files by agent
Keep iterating when stuckAfter 3 failed attempts, rethink the approach

Model Selection

Task TypeRecommended Model
File search, simple lookupshaiku
Implementation, clear requirementssonnet
Architecture decisions, complex debuggingopus
Test generationsonnet
Documentation, reportssonnet