What Are Waves?
Waves are execution groups based on dependencies. Plans in the same wave run in parallel. Waves run sequentially.Key insight: Independent work parallelizes. Dependent work waits. Wave execution maximizes throughput while respecting dependencies.
How Wave Assignment Works
Dependency Declaration
Plans declare dependencies in frontmatter:Wave Calculation Algorithm
Result: Wave 1 has 2 plans (parallel), Wave 2 has 2 plans (parallel), Wave 3 has 1 plan.
Vertical vs Horizontal Slicing
Vertical slices (better parallelization):Execution Orchestration
Wave Execution Flow
Orchestrator Context Efficiency
Problem: If orchestrator reads all code and summaries, context fills up. Solution: Executors read files themselves. Orchestrator only passes paths.Parallel Execution
Enabling Parallelization
Controlled by config:true: Plans within a wave spawn simultaneously.
When false: Plans within a wave run sequentially (one at a time).
Parallel Safety
Parallelization is safe when:- Plans modify different files
- Plans have no shared state
- Plans are truly independent
- Plans modify the same file (git merge conflicts)
- Plans share mutable state (database, global config)
- Plans have implicit dependencies (not declared in frontmatter)
Planner’s responsibility: Ensure plans in the same wave are truly independent. If file conflicts exist, plans must be sequential or merged into one plan.
Handling Conflicts
If parallel execution causes git conflicts:- Prevention (planning stage): Plan-checker validates wave assignments
- Detection (execution stage): Executor detects merge conflicts, reports failure
- Resolution: User re-plans with sequential dependency or merged plans
Wave Execution Example
Phase: User Authentication
Plans:03-01-PLAN.md: User model + database migration03-02-PLAN.md: Password hashing utilities03-03-PLAN.md: Login API endpoint (needs User model)03-04-PLAN.md: Registration API endpoint (needs User model, password utils)03-05-PLAN.md: Login UI (needs Login API)
- Wave 1: 03-01, 03-02 (parallel — independent)
- Wave 2: 03-03, 03-04 (parallel — both depend on Wave 1)
- Wave 3: 03-05 (depends on 03-03)
Execution Timeline
Parallelization saves time proportional to plan independence. More vertical slices = more parallelization = faster execution.
Checkpoints in Waves
Plans can pause at checkpoints for human input:Checkpoint Execution Flow
Checkpoints do NOT block other plans in the wave. Autonomous plans complete while checkpoint plans pause.
Auto-Advance Checkpoint Handling
Whenworkflow.auto_advance is enabled or --auto flag present:
Failure Handling
Mid-Wave Failures
If a plan fails during execution:Dependency Chain Breaks
If Wave 1 fails, dependent Wave 2 plans likely fail:Resuming Execution
Execution is resumable:
Waves recalculated: 03-03 and 03-04 → Wave 1 (parallel), 03-05 → Wave 2
Verification After Waves
After all waves complete:/gsd:plan-phase 3 --gaps→ reads VERIFICATION.md → creates gap plans/gsd:execute-phase 3 --gaps-only→ executes only gap plans- Verifier re-runs → checks if gaps resolved
Performance Characteristics
Execution speed:- Sequential:
N plans × avg_time_per_plan - Wave-based:
W waves × max_time_in_wave
- Orchestrator: 10-15% (constant, regardless of phase size)
- Each executor: Fresh 200K (peak quality)
- Single plan: ~5-10 min execution
- Phase (5 plans, 2 waves): ~15 min execution
- Phase (10 plans, 3 waves): ~25 min execution
Optimizing Wave Execution
Planning for Parallelization
- Vertical slices (features, not layers)
- Minimize cross-plan dependencies (prefer self-contained work)
- Declare dependencies explicitly (in frontmatter)
- File ownership (each plan owns different files)
- 2-3 tasks per plan (atomic, executable in single context)
Example: Bad vs Good Planning
Bad (horizontal layers, forced sequential):Next Steps
Agent System
How agents coordinate wave execution
State Management
How STATE.md tracks wave progress