Plan Orchestrator
Coordinate execution of structured implementation plans by delegating phases to subagents while maintaining oversight, tracking progress, and ensuring quality.
Plan Structure Recognition
Plans follow this hierarchy:
code
Parent Plan (e.g., 043_MODEL_ALIGNMENT.md) ├── Overview, Goals, Non-Goals ├── Sub-Plan references (043A, 043B, 043C, 043D) ├── Execution order / dependency graph ├── Breaking changes / rollback strategy └── Master checklist Sub-Plan (e.g., 043A_CONFIG_AND_STUBS.md) ├── Overview with prereqs and blockers ├── Phases with numbered sections (0.1, 1.1, 1.2...) ├── File summaries (CREATE/MODIFY/VERIFY actions) ├── Verification commands └── Phase checklists
Orchestration Workflow
1. Plan Analysis
When given a plan to execute:
- •Read the parent plan to understand scope, goals, and sub-plan order
- •Build dependency graph from prereqs/blockers in each sub-plan
- •Identify the current state (check which checklist items are done)
- •Present execution plan to user for approval
Output format:
code
## Execution Plan: [Plan Name] **Goal:** [One-line summary] **Sub-plans in order:** 1. 043A: Config & Stubs (no blockers) 2. 043B: Shared Models (blocked by: 043A) 3. 043C: Backend Services (blocked by: 043B) 4. 043D: Frontend Alignment (blocked by: 043C) **Current state:** [X of Y checklist items complete] Ready to begin with 043A?
2. Subagent Delegation
For each sub-plan or phase, spawn a subagent with:
code
claude --dangerously-skip-permissions "Execute phase [X.Y] of [sub-plan]: CONTEXT: - Parent plan: [name] - This sub-plan: [name] - Phase goal: [from plan] - Prereqs verified: [list] TASK: [Paste the specific phase section from the plan] CONSTRAINTS: - Only modify files listed in the phase - Run verification commands before reporting complete - Report blockers immediately OUTPUT: When done, provide: 1. Files changed (with brief description) 2. Verification results 3. Any issues or deviations from plan 4. Checklist items completed"
3. Progress Tracking
Maintain a progress file during execution:
markdown
# Progress: [Plan Name] Started: [timestamp] Status: IN_PROGRESS ## 043A: Config & Stubs - [x] Phase 0: Configuration (completed [time]) - [x] Phase 1: WireMock Stubs (completed [time]) - Verification: PASSED ## 043B: Shared Models - [x] Phase 2: Extend Shared Models (completed [time]) - [ ] Phase 3: Update Service DTOs (in progress) ## Blockers - None currently ## Notes - [Any deviations or decisions made]
4. Review Checkpoints
After each sub-plan completes:
- •Verify outputs - Run the verification commands from the plan
- •Check for regressions - Run
pnpm nx run-many -t buildandpnpm nx run-many -t test - •Review changes - Use
git diffto review what changed - •Update progress - Mark checklist items complete
- •Decide continuation - Ask user before proceeding to next sub-plan if significant
5. Handling Failures
When a subagent reports issues:
- •Analyze the failure - Is it a blocker or recoverable?
- •Check dependencies - Did a prerequisite actually complete?
- •Determine action:
- •Minor issue → Fix and continue
- •Plan deviation needed → Propose modification, get approval
- •Blocker → Stop, report status, suggest rollback if needed
Subagent Prompt Templates
For Phase Execution
code
You are executing Phase [X.Y]: [Phase Name] of [Sub-Plan Name]. ## Context Parent plan: [parent] Prerequisites completed: [list] Your phase goal: [goal from plan] ## Your Task [Paste exact phase content from plan including file list and implementation details] ## Rules 1. Only touch files listed in this phase 2. Follow the implementation guidance exactly 3. Run verification commands before completing 4. If you encounter unexpected issues, STOP and report ## Completion Report Provide when done: - Files modified: [list with 1-line descriptions] - Tests run: [results] - Verification: [PASSED/FAILED with details] - Checklist items done: [list] - Issues: [any problems or deviations]
For Review/Verification
code
Review the changes made in Phase [X.Y] of [Sub-Plan]. ## Expected Changes [List from plan's file summary] ## Verification Steps [From plan's verification section] ## Your Task 1. Verify all expected files were modified 2. Run the verification commands 3. Check for unintended changes 4. Confirm the phase checklist is satisfiable Report: APPROVED or NEEDS_REVISION with specifics.
Execution Modes
Full Auto Mode
Execute all sub-plans sequentially with minimal user interaction:
code
Execute plan 043 in auto mode
- •Runs all phases
- •Only stops on failures or user-defined checkpoints
- •Provides summary at end
Supervised Mode (Default)
Pause for approval between sub-plans:
code
Execute plan 043
- •Presents each sub-plan before execution
- •Shows changes after each sub-plan
- •Asks for approval to continue
Single Sub-Plan Mode
Execute just one sub-plan:
code
Execute only 043B from plan 043
- •Verifies prerequisites are met
- •Executes just that sub-plan
- •Reports completion
Resume Mode
Continue from where execution stopped:
code
Resume plan 043
- •Reads progress file
- •Identifies next incomplete phase
- •Continues from there
Commands Reference
| Command | Description |
|---|---|
execute plan [name] | Start supervised execution |
execute plan [name] --auto | Full auto mode |
execute [sub-plan] only | Single sub-plan |
resume plan [name] | Continue from progress |
status plan [name] | Show current progress |
verify plan [name] | Run all verification steps |
rollback plan [name] | Revert all changes |
Best Practices
- •Always read the full plan first - Understand scope before executing
- •Verify prerequisites - Don't skip dependency checks
- •Commit between sub-plans -
git commitafter each sub-plan for easy rollback - •Keep progress updated - Track in real-time for resume capability
- •Run tests frequently - Catch issues early
- •Document deviations - Note any changes from the original plan
Integration with Git
After each sub-plan:
bash
git add -A git commit -m "feat: complete [sub-plan name] - [brief description]"
If rollback needed:
bash
git log --oneline # Find commit before plan started git reset --hard [commit]