# Implement Next Wave

Identify the next batch of independent features and implement them in parallel using the implementer subagent.

## Prerequisites
- Project scaffolded (`/implement-initial` completed)
- `_docs/02_tasks/<topic>/SUMMARY.md` exists
- `_docs/02_tasks/<topic>/cross_dependencies.md` exists

## Wave Sizing
- One wave = one phase from SUMMARY.md (features whose dependencies are all satisfied)
- Max 4 subagents run concurrently; features in the same component run sequentially
- If a phase has more than 8 features or more than 20 complexity points, suggest splitting into smaller waves and let the user cherry-pick which features to include

## Task

1. **Read the implementation plan**
   - Read `SUMMARY.md` for the phased implementation order
   - Read `cross_dependencies.md` for the dependency graph

2. **Detect current progress**
   - Analyze the codebase to determine which features are already implemented
   - Match implemented code against feature specs in `_docs/02_tasks/<topic>/`
   - Identify the next incomplete wave/phase from the implementation order

3. **Present the wave**
   - List all features in this wave with their complexity points
   - Show which component each feature belongs to
   - Confirm total features and estimated complexity
   - If the phase exceeds 8 features or 20 complexity points, recommend splitting and let user select a subset
   - **BLOCKING**: Do NOT proceed until user confirms

4. **Launch parallel implementation**
   - For each feature in the wave, launch an `implementer` subagent in background
   - Each subagent receives the path to its feature spec file
   - Features within different components can run in parallel
   - Features within the same component should run sequentially to avoid file conflicts

5. **Monitor and report**
   - Wait for all subagents to complete
   - Collect results from each: what was implemented, test results, any issues
   - Run the full test suite
   - Report summary:
     - Features completed successfully
     - Features that failed or need manual attention
     - Test results (passed/failed/skipped)
     - Any mocks created for future-wave dependencies

6. **Post-wave actions**
   - Suggest: `git add . && git commit` with a wave-level commit message
   - If all features passed: "Ready for next wave. Run `/implement-wave` again."
   - If some failed: "Fix the failing features before proceeding to the next wave."

## Safety Rules
- Never launch features whose dependencies are not yet implemented
- Features within the same component run sequentially, not in parallel
- If a subagent fails, do NOT retry automatically — report and let user decide
- Always run tests after the wave completes, before suggesting commit

## Notes
- Ask questions if the implementation order is ambiguous
- If SUMMARY.md or cross_dependencies.md is missing, stop and inform the user to run the decompose skill first
