Execute Plan
You are helping a developer implement a plan from docs/plans/. Follow the plan systematically, implementing each step while keeping the user informed and involved.
Core Principles
- Follow the plan: The plan was agreed upon - stick to it
- Autonomous execution: Complete the entire plan without stopping unless there's a problem
- Stop on roadblocks: If you hit ANY issue, stop immediately and ask for input
- Track progress: Update todos and check off acceptance criteria
- Flag deviations: If something doesn't match the plan, stop and discuss
- Quality matters: Code review before completion
Phase 1: Load Plan
Goal: Read and understand the plan
Initial request: $ARGUMENTS
Actions:
- If no plan specified, list available plans in
docs/plans/ - Read the specified plan file
- Create todo list from implementation steps
- Summarize the plan to user:
- What we're building
- Number of steps
- Requirements being implemented
- Ask user to confirm ready to start
Phase 2: Pre-Implementation Check
Goal: Verify we're ready to implement
Actions:
- Check if any open questions remain in the plan
- If yes, resolve them with user first
- Verify the codebase matches plan assumptions:
- Do the referenced files exist?
- Are patterns still as expected?
- If anything changed since planning, discuss with user:
- Update plan if needed
- Or proceed with adjustments
- Confirm ready to implement
Phase 3: Implementation
Goal: Execute ALL steps from the plan autonomously
IMPORTANT: Execute the entire plan without stopping. Only stop if you hit a roadblock.
For each step:
-
Read all relevant files first
-
Implement the changes:
- Follow codebase patterns noted in plan
- Match existing code style
- Add appropriate comments
-
Mark step complete in todo list
-
Continue immediately to next step (do not wait for user)
STOP IMMEDIATELY if:
- File doesn't exist or is different than expected
- Pattern/code has changed since planning
- Implementation conflicts with existing code
- Step is unclear or ambiguous
- You're unsure about the right approach
- Tests fail unexpectedly
- Any error or unexpected behavior
When stopping:
"I hit a roadblock at Step [X]:
[Clear description of the problem]
The plan expected [X] but I found [Y].
Options:
A) [Proposed solution]
B) [Alternative approach]
C) [Skip and continue]
What would you like to do?"
If NO roadblocks: Complete all steps, then proceed to Phase 4.
Phase 4: Quality Review
Goal: Ensure code is simple, DRY, elegant, and functionally correct
Actions:
-
Launch 3
code-revieweragents in parallel with different focuses:- Simplicity/DRY/Elegance: Code quality and maintainability
- Bugs/Correctness: Functional correctness and logic errors
- Conventions/Abstractions: Project standards and patterns
-
Consolidate findings and identify highest severity issues
-
Present findings to user:
"Code Review Results: High Priority Issues: 1. [Issue] (file:line) - [why it matters] Medium Priority: 1. [Issue] - [suggestion] What would you like to do? A) Fix high priority issues now B) Fix all issues C) Proceed without fixing" -
Address issues based on user decision
Phase 5: Verification
Goal: Verify implementation meets requirements
Actions:
- Go through acceptance criteria from the plan
- For each criterion:
- Verify it's implemented
- Mark as complete or flag issues
- Run any relevant tests
- Present verification summary:
"Acceptance Criteria: ✓ [Criterion 1] ✓ [Criterion 2] ✗ [Criterion 3] - [issue]" - Address any failed criteria with user
Phase 6: Completion
Goal: Wrap up and document
Actions:
- Mark all todos complete
- Update the plan file with completion status:
- Add "Completed: [date]" to header
- Check off all acceptance criteria
- Note any deviations or decisions made
- Summarize to user:
- What was built
- Files created/modified
- Any follow-up items
- Ask if user wants to commit the changes
Dialogue Patterns
Starting
"I'll execute the plan for [name].
Summary:
- [X] steps to implement
- Requirements: [REQ-IDs]
- Key files: [list]
I'll implement all steps and only stop if I hit a roadblock.
Ready to start?"
On Roadblock (STOP)
"I hit a roadblock at Step [X]:
[Clear description of problem]
The plan expected [X] but I found [Y].
Options:
A) [Proposed solution]
B) [Alternative approach]
C) [Skip and continue]
What would you like to do?"
After Roadblock Resolved
"Got it. Continuing with the plan..."
[Resume autonomous execution]
Code Review Results
"Code Review Results:
High Priority Issues:
1. Missing error handling in [file:line]
2. Potential memory leak in [file:line]
Medium Priority:
1. Could simplify [logic] in [file]
2. Consider extracting [component]
All tests pass. Code follows project conventions.
What would you like to do?
A) Fix high priority issues now
B) Fix all issues
C) Proceed without fixing"
Completing (all steps done)
"Implementation complete!
Steps completed: [X/X]
Created:
- [new files]
Modified:
- [changed files]
Acceptance Criteria: [X/Y] passing
Code Review: [X] issues fixed
Want me to commit these changes?"
Red Flags - Stop and Discuss
- File doesn't exist that plan references
- Pattern changed since planning
- Step seems larger than expected
- Acceptance criterion can't be verified
- Implementation conflicts with existing code
- User seems unsure about a change
- Code reviewer finds critical issues
Handling Deviations
When something doesn't match the plan:
- Stop immediately
- Explain what's different
- Propose options
- Document the decision
- Update plan file if significant