Execute the validated plan in an isolated worktree. Spawn per-task agents, verify quality, create and merge the PR. Handles everything through to cleanup.
Run /clear before this command.
A validated plan must exist at docs/plans/plan-{name}.md with all issues resolved (output of /plan-pipeline:validate).
Create an isolated git worktree:
git worktree add .worktrees/{plan-name} -b feature/{plan-name}
All execution happens inside the worktree. Main branch remains clean throughout.
Only for tasks marked as TDD in the plan.
For each TDD task, before any implementation:
Do not write implementation code in this step.
Parse the task list from the plan. Group tasks by layer (Layer 1 = foundation, Layer 2 = depends on Layer 1, etc.).
For each layer:
.claude/tasks/<id>/output.log via Read (TaskOutput is deprecated since v2.1.83)git commit -m "feat: {task-description}"
Drift detection: after each layer, diff the actual changes against the plan spec. If implementation deviates significantly from the plan (new files not in plan, plan files not touched), flag and ask how to proceed. Do not silently continue on drift.
Agent instructions for each task:
You are implementing one task from a validated plan.
Task: {description}
Files to modify: {file list}
Acceptance criteria: {criteria}
Relevant ADRs: {adr list}
First principles:
- Build state-of-the-art. No workarounds, no legacy patterns.
- Fix at the correct architectural level, never with component-level hacks.
- If you discover that the plan is wrong or missing context, stop and report. Do not improvise architecture.
Commit your changes when complete with message: "feat: {task-description}"
Run in parallel:
If all pass: proceed to smoke test.
If any fail: spawn a quality-fixer debug agent with the failure output. It gets up to 3 auto-fix attempts. After each attempt, re-run the quality gate. If still failing after 3 attempts: stop, report the failure with the full error output, and wait for human intervention.
Integration smoke test (skip for pure frontend or docs-only plans):
Run the smoke commands defined in the plan's ## Integration Verification section. Additionally:
Smoke test failures are debugged by a quality-fixer-smoke agent with the same 3-attempt limit.
In the worktree, before creating the PR.
PRD Reconciliation: compare the implemented behavior against the original PRD. Note any deviations or additions discovered during implementation. Update the PRD with actuals. These updates ship in the same PR as the feature.
Plan Archival: move docs/plans/plan-{name}.md to docs/plans/completed/plan-{name}.md. Update the status header.
Commit documentation updates: docs: reconcile PRD and archive plan for {feature-name}.
Push the worktree branch and create the PR:
git push origin feature/{plan-name}
gh pr create \
--title "{feature-name}: {one-line summary from plan}" \
--body "$(cat .pr-body.md)"
PR body template:
## Summary
{plan summary paragraph}
## Changes
{auto-generated from task list: bullet per task with files affected}
## ADRs
{list of ADRs created during this plan}
## Test Plan
{from plan test plan section}
## Smoke Test Results
{output from integration verification}
Merge using squash:
gh pr merge --squash --delete-branch
Switch back to develop/main. Update docs/plans/metrics/{name}.json with execution data:
Commit metrics update.
git worktree remove .worktrees/{plan-name}
/plan-pipeline:execute
Picks up the most recent validated plan. Or specify:
/plan-pipeline:execute plan-user-authentication
Setting up worktree: .worktrees/user-authentication
Branch: feature/user-authentication
TDD scaffolding: 2 tasks marked TDD
✓ Written failing tests for: auth-token-validation
✓ Written failing tests for: refresh-token-rotation
Committed: "test: failing tests for auth pipeline (TDD)"
Executing Layer 1 (3 tasks, parallel)...
[agent-1] Implementing: JWT token generation service
[agent-2] Implementing: User session model
[agent-3] Implementing: Auth middleware
✓ Layer 1 complete. 3 commits.
Drift check: Layer 1... ✓ No drift detected.
Executing Layer 2 (2 tasks, parallel)...
[agent-4] Implementing: Login endpoint
[agent-5] Implementing: Refresh endpoint
✓ Layer 2 complete. 2 commits.
Quality gate...
✓ Lint passed
✓ Type check passed
✓ Tests: 47 passed, 0 failed
Smoke test...
✓ GraphQL introspection: OK
✓ POST /api/auth/login: 200
✓ POST /api/auth/refresh: 200
Pre-PR docs...
✓ PRD reconciled (1 minor deviation noted)
✓ Plan archived to docs/plans/completed/
PR created: #142 "user-authentication: JWT auth with refresh token rotation"
PR merged (squash). Branch deleted.
Metrics committed. Worktree cleaned.
✅ Feature complete.
After /plan-pipeline:validate confirms all issues are resolved. Never skip validation: executing an unvalidated plan skips the independent review that catches ~18 issues on average.
/plan-pipeline:ceo-review → product direction locked
/plan-pipeline:eng-review → architecture locked
/plan-pipeline:start → produce implementation plan
/plan-pipeline:validate → validate before execution
/plan-pipeline:execute → execute to merged PR ← you are here