Wave Coding

Execute feature development in sequential waves using a single AI agent, with each wave focusing on one main task group.

bluewings1211 updated 1y ago
Claude CodeGeneric
View source ↗
# /wave_coding

Execute feature development in sequential waves using a single AI agent, with each wave focusing on one main task group.

## Variables

FEATURE_NAME: $ARGUMENTS

## Task File Discovery and Task Group Parsing

**Task File Location:** I will locate the task file at `tasks/tasks-prd-{FEATURE_NAME}.md`.

**Validation Steps:**
1. Verify that `tasks/tasks-prd-{FEATURE_NAME}.md` exists
2. Confirm the file contains a valid task list structure
3. If the file doesn't exist, I will exit with an error message: "Task file not found: tasks/tasks-prd-{FEATURE_NAME}.md. Please generate the task list first using @ai_docs/generate-tasks.mdc"

**Task Group Detection:**
I will parse the task file to identify main task groups (e.g., 1.0, 2.0, 3.0, etc.) and their associated subtasks. Each task group will be executed in a separate wave.

**Task File Contents:** The discovered task file will serve as the implementation plan, executed wave by wave.

## Execute Phase 1: Environment Setup

**Parameter Validation:** Before proceeding, I will validate:
1. `FEATURE_NAME` is provided and not empty
2. Task file `tasks/tasks-prd-{FEATURE_NAME}.md` exists and is readable
3. The `progress/` directory exists (create if it doesn't)

**Safety Check:** I will check for any uncommitted changes in the current directory. If changes are found, I will exit with an error, prompting you to commit or stash them.

**Directory Setup:** I will ensure the `trees/` directory exists at the project root.

**Single Worktree Creation:**
I will create one persistent worktree that will be used across all waves:

1. **Create Worktree:** `git worktree add -b <FEATURE_NAME>-wave ./trees/<FEATURE_NAME>-wave`
2. **Copy Environment:** Copy the `.env` file to `./trees/<FEATURE_NAME>-wave/.env` if it exists.
3. **Setup Task Directory:** 
   - Create `./trees/<FEATURE_NAME>-wave/tasks/` directory
   - Copy the task file from `tasks/tasks-prd-{FEATURE_NAME}.md` to `./trees/<FEATURE_NAME>-wave/tasks/tasks-prd-{FEATURE_NAME}.md`
4. **Setup Progress Tracking:**
   - Ensure `progress/` directory exists at project root
   - Create symlink in worktree: `ln -s ../../progress ./trees/<FEATURE_NAME>-wave/progress`
   - Initialize progress JSON file: `progress/<FEATURE_NAME>-wave.json` with initial status
5. **Install Dependencies:** Change directory to `./trees/<FEATURE_NAME>-wave` and run dependency installation if package files exist.

**Verification:** After setup, I will run `git worktree list` to confirm the worktree was created successfully.

## Execute Phase 2: Wave-by-Wave Development

I will execute development in sequential waves, with each wave focusing on one main task group. After each wave completes, the subagent will report back to the main agent, which will then launch the next wave.

**Wave Orchestration Protocol:**

1. **Parse Task Groups:** Extract all main task groups from the task file (e.g., 1.0, 2.0, 3.0, etc.)
2. **Execute Waves Sequentially:** For each task group:
   - Launch subagent for that specific task group
   - Wait for wave completion
   - Review progress and results
   - Launch next wave for the next task group
3. **Continue Until Complete:** Repeat until all task groups are finished

**Wave Execution Details:**

For each wave, I will:
1. **Identify Current Task Group:** Determine the next incomplete task group (e.g., "2.0 YouTube Transcript Extraction System")
2. **Launch Wave Agent:** Create a focused subagent to work on only that task group
3. **Monitor Progress:** Track completion through progress files
4. **Validate Wave Completion:** Ensure all subtasks in the group are completed
5. **Prepare Next Wave:** Update overall progress and prepare for the next task group

**Working Directory:** 
The subagent will operate in: `trees/<FEATURE_NAME>-wave/`

## Subagent Wave Instructions

**CRITICAL WAVE MISSION:** You are a wave-focused agent working on ONE specific task group within the {FEATURE_NAME} project.

**Your Current Assignment:**
- **Task Group:** {CURRENT_TASK_GROUP} (e.g., "1.0 Project Setup and Dependencies")
- **Subtasks:** {SUBTASK_LIST} (e.g., "1.1, 1.2, 1.3, 1.4, 1.5")
- **Working Directory:** /Users/jeff/Documents/personal/testproject/trees/{FEATURE_NAME}-wave

**MANDATORY WAVE WORKFLOW:**
You MUST complete ALL subtasks within your assigned task group following this exact protocol:

1. **Project Understanding Phase (REQUIRED FIRST STEP):**
   - **Check for Codebase RAG MCP Tool:** First, check if the `mcp__codebase-rag-mcp__*` tools are available
   - **If Available, Index the Project:**
     - Run `mcp__codebase-rag-mcp__index_directory` with `incremental: true` to index the entire project
     - This ensures you have comprehensive knowledge of the codebase structure and existing implementations
   - **Analyze Project Structure:** After indexing (or if no RAG tool available):
     - Use `mcp__codebase-rag-mcp__search` to understand key components relevant to your task group
     - Review project architecture, existing patterns, and dependencies
     - Identify files and modules that will be affected by your wave's implementation
   - **Document Understanding:** Create a brief project context note in your first subtask report

2. **Focus Only on Your Task Group:** Work ONLY on the assigned task group and its subtasks. Do NOT work on other task groups.

3. **Complete All Subtasks in Order:** Work through each subtask in the assigned group:
   - Read the subtask from `tasks/tasks-prd-{FEATURE_NAME}.md`
   - Implement the subtask completely
   - Update `tasks/tasks-prd-{FEATURE_NAME}.md` (mark subtask as `[x]`)
   - Update progress JSON file
   - Create detailed subtask report
   - Git commit changes
   - Move to next subtask in the group

4. **Wave Progress Reporting:**
After completing each subtask, you MUST write to TWO files:

**A. Wave Progress Status File:** `progress/{FEATURE_NAME}-wave.json`
```json
{
  "agent": "{FEATURE_NAME}-wave",
  "current_wave": "1.0",
  "wave_description": "Project Set

Maintain Wave Coding?

Let people know it's listed here — add the badge (live metrics, light/dark aware) or a plain link to your README or docs.

[Wave Coding on getagentictools](https://getagentictools.com/loops/bluewings1211-wave-coding?ref=badge)
npx agentictools info loops/bluewings1211-wave-coding

The second line is the CLI lookup for this page — handy in READMEs and docs.