@howlil/ez-agents 3.4.1 → 3.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (162) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +84 -20
  3. package/agents/ez-observer-agent.md +260 -0
  4. package/agents/ez-release-agent.md +333 -0
  5. package/agents/ez-requirements-agent.md +377 -0
  6. package/agents/ez-scrum-master-agent.md +242 -0
  7. package/agents/ez-tech-lead-agent.md +267 -0
  8. package/bin/install.js +3221 -3230
  9. package/commands/ez/arch-review.md +102 -0
  10. package/commands/ez/execute-phase.md +11 -0
  11. package/commands/ez/export-session.md +79 -0
  12. package/commands/ez/gather-requirements.md +117 -0
  13. package/commands/ez/git-workflow.md +72 -0
  14. package/commands/ez/hotfix.md +120 -0
  15. package/commands/ez/import-session.md +82 -0
  16. package/commands/ez/join-discord.md +18 -18
  17. package/commands/ez/list-sessions.md +96 -0
  18. package/commands/ez/package-manager.md +316 -0
  19. package/commands/ez/plan-phase.md +9 -1
  20. package/commands/ez/preflight.md +79 -0
  21. package/commands/ez/progress.md +13 -1
  22. package/commands/ez/release.md +153 -0
  23. package/commands/ez/resume.md +107 -0
  24. package/commands/ez/standup.md +85 -0
  25. package/ez-agents/bin/ez-tools.cjs +1095 -716
  26. package/ez-agents/bin/lib/assistant-adapter.cjs +264 -264
  27. package/ez-agents/bin/lib/audit-exec.cjs +7 -2
  28. package/ez-agents/bin/lib/bdd-validator.cjs +622 -0
  29. package/ez-agents/bin/lib/circuit-breaker.cjs +118 -118
  30. package/ez-agents/bin/lib/config.cjs +190 -190
  31. package/ez-agents/bin/lib/content-scanner.cjs +238 -0
  32. package/ez-agents/bin/lib/context-cache.cjs +154 -0
  33. package/ez-agents/bin/lib/context-errors.cjs +71 -0
  34. package/ez-agents/bin/lib/context-manager.cjs +220 -0
  35. package/ez-agents/bin/lib/discussion-synthesizer.cjs +458 -0
  36. package/ez-agents/bin/lib/file-access.cjs +207 -0
  37. package/ez-agents/bin/lib/file-lock.cjs +236 -236
  38. package/ez-agents/bin/lib/frontmatter.cjs +299 -299
  39. package/ez-agents/bin/lib/fs-utils.cjs +153 -153
  40. package/ez-agents/bin/lib/git-errors.cjs +83 -0
  41. package/ez-agents/bin/lib/git-utils.cjs +118 -0
  42. package/ez-agents/bin/lib/git-workflow-engine.cjs +1157 -0
  43. package/ez-agents/bin/lib/index.cjs +157 -113
  44. package/ez-agents/bin/lib/init.cjs +757 -757
  45. package/ez-agents/bin/lib/lockfile-validator.cjs +227 -0
  46. package/ez-agents/bin/lib/logger.cjs +124 -124
  47. package/ez-agents/bin/lib/memory-compression.cjs +256 -0
  48. package/ez-agents/bin/lib/metrics-tracker.cjs +406 -0
  49. package/ez-agents/bin/lib/milestone.cjs +241 -241
  50. package/ez-agents/bin/lib/model-provider.cjs +241 -241
  51. package/ez-agents/bin/lib/package-manager-detector.cjs +203 -0
  52. package/ez-agents/bin/lib/package-manager-executor.cjs +385 -0
  53. package/ez-agents/bin/lib/package-manager-service.cjs +216 -0
  54. package/ez-agents/bin/lib/phase.cjs +925 -925
  55. package/ez-agents/bin/lib/planning-write.cjs +107 -107
  56. package/ez-agents/bin/lib/release-validator.cjs +614 -0
  57. package/ez-agents/bin/lib/retry.cjs +119 -119
  58. package/ez-agents/bin/lib/roadmap.cjs +306 -306
  59. package/ez-agents/bin/lib/safe-exec.cjs +128 -128
  60. package/ez-agents/bin/lib/safe-path.cjs +130 -130
  61. package/ez-agents/bin/lib/session-chain.cjs +304 -0
  62. package/ez-agents/bin/lib/session-errors.cjs +81 -0
  63. package/ez-agents/bin/lib/session-export.cjs +251 -0
  64. package/ez-agents/bin/lib/session-import.cjs +262 -0
  65. package/ez-agents/bin/lib/session-manager.cjs +280 -0
  66. package/ez-agents/bin/lib/state.cjs +736 -736
  67. package/ez-agents/bin/lib/temp-file.cjs +239 -239
  68. package/ez-agents/bin/lib/template.cjs +223 -223
  69. package/ez-agents/bin/lib/test-file-lock.cjs +112 -112
  70. package/ez-agents/bin/lib/test-graceful.cjs +93 -93
  71. package/ez-agents/bin/lib/test-logger.cjs +60 -60
  72. package/ez-agents/bin/lib/test-safe-exec.cjs +38 -38
  73. package/ez-agents/bin/lib/test-safe-path.cjs +33 -33
  74. package/ez-agents/bin/lib/test-temp-file.cjs +125 -125
  75. package/ez-agents/bin/lib/tier-manager.cjs +428 -0
  76. package/ez-agents/bin/lib/timeout-exec.cjs +63 -63
  77. package/ez-agents/bin/lib/url-fetch.cjs +170 -0
  78. package/ez-agents/bin/lib/verify.cjs +15 -1
  79. package/ez-agents/references/checkpoints.md +776 -776
  80. package/ez-agents/references/continuation-format.md +249 -249
  81. package/ez-agents/references/metrics-schema.md +118 -0
  82. package/ez-agents/references/planning-config.md +140 -0
  83. package/ez-agents/references/questioning.md +162 -162
  84. package/ez-agents/references/tdd.md +263 -263
  85. package/ez-agents/references/tier-strategy.md +103 -0
  86. package/ez-agents/templates/bdd-feature.md +173 -0
  87. package/ez-agents/templates/codebase/concerns.md +310 -310
  88. package/ez-agents/templates/codebase/conventions.md +307 -307
  89. package/ez-agents/templates/codebase/integrations.md +280 -280
  90. package/ez-agents/templates/codebase/stack.md +186 -186
  91. package/ez-agents/templates/codebase/testing.md +480 -480
  92. package/ez-agents/templates/config.json +37 -37
  93. package/ez-agents/templates/continue-here.md +78 -78
  94. package/ez-agents/templates/discussion.md +68 -0
  95. package/ez-agents/templates/incident-runbook.md +205 -0
  96. package/ez-agents/templates/milestone-archive.md +123 -123
  97. package/ez-agents/templates/milestone.md +115 -115
  98. package/ez-agents/templates/release-checklist.md +133 -0
  99. package/ez-agents/templates/requirements.md +231 -231
  100. package/ez-agents/templates/research-project/ARCHITECTURE.md +204 -204
  101. package/ez-agents/templates/research-project/FEATURES.md +147 -147
  102. package/ez-agents/templates/research-project/PITFALLS.md +200 -200
  103. package/ez-agents/templates/research-project/STACK.md +120 -120
  104. package/ez-agents/templates/research-project/SUMMARY.md +170 -170
  105. package/ez-agents/templates/retrospective.md +54 -54
  106. package/ez-agents/templates/roadmap.md +202 -202
  107. package/ez-agents/templates/rollback-plan.md +201 -0
  108. package/ez-agents/templates/summary-minimal.md +41 -41
  109. package/ez-agents/templates/summary-standard.md +48 -48
  110. package/ez-agents/templates/summary.md +248 -248
  111. package/ez-agents/templates/user-setup.md +311 -311
  112. package/ez-agents/templates/verification-report.md +322 -322
  113. package/ez-agents/workflows/add-phase.md +112 -112
  114. package/ez-agents/workflows/add-tests.md +351 -351
  115. package/ez-agents/workflows/add-todo.md +158 -158
  116. package/ez-agents/workflows/arch-review.md +54 -0
  117. package/ez-agents/workflows/audit-milestone.md +332 -332
  118. package/ez-agents/workflows/autonomous.md +131 -30
  119. package/ez-agents/workflows/check-todos.md +177 -177
  120. package/ez-agents/workflows/cleanup.md +152 -152
  121. package/ez-agents/workflows/complete-milestone.md +766 -766
  122. package/ez-agents/workflows/diagnose-issues.md +219 -219
  123. package/ez-agents/workflows/discovery-phase.md +289 -289
  124. package/ez-agents/workflows/discuss-phase.md +762 -762
  125. package/ez-agents/workflows/execute-phase.md +513 -468
  126. package/ez-agents/workflows/execute-plan.md +483 -483
  127. package/ez-agents/workflows/export-session.md +255 -0
  128. package/ez-agents/workflows/gather-requirements.md +206 -0
  129. package/ez-agents/workflows/health.md +159 -159
  130. package/ez-agents/workflows/help.md +584 -492
  131. package/ez-agents/workflows/hotfix.md +291 -0
  132. package/ez-agents/workflows/import-session.md +303 -0
  133. package/ez-agents/workflows/insert-phase.md +130 -130
  134. package/ez-agents/workflows/list-phase-assumptions.md +178 -178
  135. package/ez-agents/workflows/map-codebase.md +316 -316
  136. package/ez-agents/workflows/new-milestone.md +339 -10
  137. package/ez-agents/workflows/new-project.md +293 -299
  138. package/ez-agents/workflows/node-repair.md +92 -92
  139. package/ez-agents/workflows/pause-work.md +122 -122
  140. package/ez-agents/workflows/plan-milestone-gaps.md +274 -274
  141. package/ez-agents/workflows/plan-phase.md +673 -651
  142. package/ez-agents/workflows/progress.md +372 -382
  143. package/ez-agents/workflows/quick.md +610 -610
  144. package/ez-agents/workflows/release.md +253 -0
  145. package/ez-agents/workflows/remove-phase.md +155 -155
  146. package/ez-agents/workflows/research-phase.md +74 -74
  147. package/ez-agents/workflows/resume-project.md +307 -307
  148. package/ez-agents/workflows/resume-session.md +215 -0
  149. package/ez-agents/workflows/set-profile.md +81 -81
  150. package/ez-agents/workflows/settings.md +242 -242
  151. package/ez-agents/workflows/standup.md +64 -0
  152. package/ez-agents/workflows/stats.md +57 -57
  153. package/ez-agents/workflows/transition.md +544 -544
  154. package/ez-agents/workflows/ui-phase.md +290 -290
  155. package/ez-agents/workflows/ui-review.md +157 -157
  156. package/ez-agents/workflows/update.md +320 -320
  157. package/ez-agents/workflows/validate-phase.md +167 -167
  158. package/ez-agents/workflows/verify-phase.md +243 -243
  159. package/ez-agents/workflows/verify-work.md +584 -584
  160. package/package.json +10 -4
  161. package/scripts/build-hooks.js +43 -43
  162. package/scripts/run-tests.cjs +29 -29
@@ -1,468 +1,513 @@
1
- <purpose>
2
- Execute all plans in a phase using wave-based parallel execution. Orchestrator stays lean — delegates plan execution to subagents.
3
- </purpose>
4
-
5
- <core_principle>
6
- Orchestrator coordinates, not executes. Each subagent loads the full execute-plan context. Orchestrator: discover plans → analyze deps → group waves → spawn agents → handle checkpoints → collect results.
7
- </core_principle>
8
-
9
- <required_reading>
10
- Read STATE.md before any operation to load project context.
11
- </required_reading>
12
-
13
- <process>
14
-
15
- <step name="initialize" priority="first">
16
- Load all context in one call:
17
-
18
- ```bash
19
- INIT=$(node "$HOME/.claude/ez-agents/bin/ez-tools.cjs" init execute-phase "${PHASE_ARG}")
20
- if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi
21
- ```
22
-
23
- Parse JSON for: `executor_model`, `verifier_model`, `commit_docs`, `parallelization`, `branching_strategy`, `branch_name`, `phase_found`, `phase_dir`, `phase_number`, `phase_name`, `phase_slug`, `plans`, `incomplete_plans`, `plan_count`, `incomplete_count`, `state_exists`, `roadmap_exists`, `phase_req_ids`.
24
-
25
- **If `phase_found` is false:** Error — phase directory not found.
26
- **If `plan_count` is 0:** Error no plans found in phase.
27
- **If `state_exists` is false but `.planning/` exists:** Offer reconstruct or continue.
28
-
29
- When `parallelization` is false, plans within a wave execute sequentially.
30
-
31
- **REQUIRED — Sync chain flag with intent.** If user invoked manually (no `--auto`), clear the ephemeral chain flag from any previous interrupted `--auto` chain. This prevents stale `_auto_chain_active: true` from causing unwanted auto-advance. This does NOT touch `workflow.auto_advance` (the user's persistent settings preference). You MUST execute this bash block before any config reads:
32
- ```bash
33
- # REQUIRED: prevents stale auto-chain from previous --auto runs
34
- if [[ ! "$ARGUMENTS" =~ --auto ]]; then
35
- node "$HOME/.claude/ez-agents/bin/ez-tools.cjs" config-set workflow._auto_chain_active false 2>/dev/null
36
- fi
37
- ```
38
- </step>
39
-
40
- <step name="handle_branching">
41
- Check `branching_strategy` from init:
42
-
43
- **"none":** Skip, continue on current branch.
44
-
45
- **"phase" or "milestone":** Use pre-computed `branch_name` from init:
46
- ```bash
47
- git checkout -b "$BRANCH_NAME" 2>/dev/null || git checkout "$BRANCH_NAME"
48
- ```
49
-
50
- All subsequent commits go to this branch. User handles merging.
51
- </step>
52
-
53
- <step name="validate_phase">
54
- From init JSON: `phase_dir`, `plan_count`, `incomplete_count`.
55
-
56
- Report: "Found {plan_count} plans in {phase_dir} ({incomplete_count} incomplete)"
57
- </step>
58
-
59
- <step name="discover_and_group_plans">
60
- Load plan inventory with wave grouping in one call:
61
-
62
- ```bash
63
- PLAN_INDEX=$(node "$HOME/.claude/ez-agents/bin/ez-tools.cjs" phase-plan-index "${PHASE_NUMBER}")
64
- ```
65
-
66
- Parse JSON for: `phase`, `plans[]` (each with `id`, `wave`, `autonomous`, `objective`, `files_modified`, `task_count`, `has_summary`), `waves` (map of wave number → plan IDs), `incomplete`, `has_checkpoints`.
67
-
68
- **Filtering:** Skip plans where `has_summary: true`. If `--gaps-only`: also skip non-gap_closure plans. If all filtered: "No matching incomplete plans" → exit.
69
-
70
- Report:
71
- ```
72
- ## Execution Plan
73
-
74
- **Phase {X}: {Name}** — {total_plans} plans across {wave_count} waves
75
-
76
- | Wave | Plans | What it builds |
77
- |------|-------|----------------|
78
- | 1 | 01-01, 01-02 | {from plan objectives, 3-8 words} |
79
- | 2 | 01-03 | ... |
80
- ```
81
- </step>
82
-
83
- <step name="execute_waves">
84
- Execute each wave in sequence. Within a wave: parallel if `PARALLELIZATION=true`, sequential if `false`.
85
-
86
- **For each wave:**
87
-
88
- 1. **Describe what's being built (BEFORE spawning):**
89
-
90
- Read each plan's `<objective>`. Extract what's being built and why.
91
-
92
- ```
93
- ---
94
- ## Wave {N}
95
-
96
- **{Plan ID}: {Plan Name}**
97
- {2-3 sentences: what this builds, technical approach, why it matters}
98
-
99
- Spawning {count} agent(s)...
100
- ---
101
- ```
102
-
103
- - Bad: "Executing terrain generation plan"
104
- - Good: "Procedural terrain generator using Perlin noise — creates height maps, biome zones, and collision meshes. Required before vehicle physics can interact with ground."
105
-
106
- 2. **Spawn executor agents:**
107
-
108
- Pass paths only — executors read files themselves with their fresh 200k context.
109
- This keeps orchestrator context lean (~10-15%).
110
-
111
- ```
112
- Task(
113
- subagent_type="ez-executor",
114
- model="{executor_model}",
115
- prompt="
116
- <objective>
117
- Execute plan {plan_number} of phase {phase_number}-{phase_name}.
118
- Commit each task atomically. Create SUMMARY.md. Update STATE.md and ROADMAP.md.
119
- </objective>
120
-
121
- <execution_context>
122
- @~/.claude/ez-agents/workflows/execute-plan.md
123
- @~/.claude/ez-agents/templates/summary.md
124
- @~/.claude/ez-agents/references/checkpoints.md
125
- @~/.claude/ez-agents/references/tdd.md
126
- </execution_context>
127
-
128
- <files_to_read>
129
- Read these files at execution start using the Read tool:
130
- - {phase_dir}/{plan_file} (Plan)
131
- - .planning/STATE.md (State)
132
- - .planning/config.json (Config, if exists)
133
- - ./CLAUDE.md (Project instructions, if exists — follow project-specific guidelines and coding conventions)
134
- - .claude/skills/ or .agents/skills/ (Project skills, if either exists — list skills, read SKILL.md for each, follow relevant rules during implementation)
135
- </files_to_read>
136
-
137
- <success_criteria>
138
- - [ ] All tasks executed
139
- - [ ] Each task committed individually
140
- - [ ] SUMMARY.md created in plan directory
141
- - [ ] STATE.md updated with position and decisions
142
- - [ ] ROADMAP.md updated with plan progress (via `roadmap update-plan-progress`)
143
- </success_criteria>
144
- "
145
- )
146
- ```
147
-
148
- 3. **Wait for all agents in wave to complete.**
149
-
150
- 4. **Report completion — spot-check claims first:**
151
-
152
- For each SUMMARY.md:
153
- - Verify first 2 files from `key-files.created` exist on disk
154
- - Check `git log --oneline --all --grep="{phase}-{plan}"` returns ≥1 commit
155
- - Check for `## Self-Check: FAILED` marker
156
-
157
- If ANY spot-check fails: report which plan failed, route to failure handler — ask "Retry plan?" or "Continue with remaining waves?"
158
-
159
- If pass:
160
- ```
161
- ---
162
- ## Wave {N} Complete
163
-
164
- **{Plan ID}: {Plan Name}**
165
- {What was built — from SUMMARY.md}
166
- {Notable deviations, if any}
167
-
168
- {If more waves: what this enables for next wave}
169
- ---
170
- ```
171
-
172
- - Bad: "Wave 2 complete. Proceeding to Wave 3."
173
- - Good: "Terrain system complete — 3 biome types, height-based texturing, physics collision meshes. Vehicle physics (Wave 3) can now reference ground surfaces."
174
-
175
- 5. **Handle failures:**
176
-
177
- **Known Claude Code bug (classifyHandoffIfNeeded):** If an agent reports "failed" with error containing `classifyHandoffIfNeeded is not defined`, this is a Claude Code runtime bug — not an EZ or agent issue. The error fires in the completion handler AFTER all tool calls finish. In this case: run the same spot-checks as step 4 (SUMMARY.md exists, git commits present, no Self-Check: FAILED). If spot-checks PASS → treat as **successful**. If spot-checks FAIL → treat as real failure below.
178
-
179
- For real failures: report which plan failed → ask "Continue?" or "Stop?" → if continue, dependent plans may also fail. If stop, partial completion report.
180
-
181
- 6. **Execute checkpoint plans between waves** see `<checkpoint_handling>`.
182
-
183
- 7. **Proceed to next wave.**
184
- </step>
185
-
186
- <step name="checkpoint_handling">
187
- Plans with `autonomous: false` require user interaction.
188
-
189
- **Auto-mode checkpoint handling:**
190
-
191
- Read auto-advance config (chain flag + user preference):
192
- ```bash
193
- AUTO_CHAIN=$(node "$HOME/.claude/ez-agents/bin/ez-tools.cjs" config-get workflow._auto_chain_active 2>/dev/null || echo "false")
194
- AUTO_CFG=$(node "$HOME/.claude/ez-agents/bin/ez-tools.cjs" config-get workflow.auto_advance 2>/dev/null || echo "false")
195
- ```
196
-
197
- When executor returns a checkpoint AND (`AUTO_CHAIN` is `"true"` OR `AUTO_CFG` is `"true"`):
198
- - **human-verify** → Auto-spawn continuation agent with `{user_response}` = `"approved"`. Log `⚡ Auto-approved checkpoint`.
199
- - **decision** → Auto-spawn continuation agent with `{user_response}` = first option from checkpoint details. Log `⚡ Auto-selected: [option]`.
200
- - **human-action** Present to user (existing behavior below). Auth gates cannot be automated.
201
-
202
- **Standard flow (not auto-mode, or human-action type):**
203
-
204
- 1. Spawn agent for checkpoint plan
205
- 2. Agent runs until checkpoint task or auth gatereturns structured state
206
- 3. Agent return includes: completed tasks table, current task + blocker, checkpoint type/details, what's awaited
207
- 4. **Present to user:**
208
- ```
209
- ## Checkpoint: [Type]
210
-
211
- **Plan:** 03-03 Dashboard Layout
212
- **Progress:** 2/3 tasks complete
213
-
214
- [Checkpoint Details from agent return]
215
- [Awaiting section from agent return]
216
- ```
217
- 5. User responds: "approved"/"done" | issue description | decision selection
218
- 6. **Spawn continuation agent (NOT resume)** using continuation-prompt.md template:
219
- - `{completed_tasks_table}`: From checkpoint return
220
- - `{resume_task_number}` + `{resume_task_name}`: Current task
221
- - `{user_response}`: What user provided
222
- - `{resume_instructions}`: Based on checkpoint type
223
- 7. Continuation agent verifies previous commits, continues from resume point
224
- 8. Repeat until plan completes or user stops
225
-
226
- **Why fresh agent, not resume:** Resume relies on internal serialization that breaks with parallel tool calls. Fresh agents with explicit state are more reliable.
227
-
228
- **Checkpoints in parallel waves:** Agent pauses and returns while other parallel agents may complete. Present checkpoint, spawn continuation, wait for all before next wave.
229
- </step>
230
-
231
- <step name="aggregate_results">
232
- After all waves:
233
-
234
- ```markdown
235
- ## Phase {X}: {Name} Execution Complete
236
-
237
- **Waves:** {N} | **Plans:** {M}/{total} complete
238
-
239
- | Wave | Plans | Status |
240
- |------|-------|--------|
241
- | 1 | plan-01, plan-02 | ✓ Complete |
242
- | CP | plan-03 | ✓ Verified |
243
- | 2 | plan-04 | ✓ Complete |
244
-
245
- ### Plan Details
246
- 1. **03-01**: [one-liner from SUMMARY.md]
247
- 2. **03-02**: [one-liner from SUMMARY.md]
248
-
249
- ### Issues Encountered
250
- [Aggregate from SUMMARYs, or "None"]
251
- ```
252
- </step>
253
-
254
- <step name="close_parent_artifacts">
255
- **For decimal/polish phases only (X.Y pattern):** Close the feedback loop by resolving parent UAT and debug artifacts.
256
-
257
- **Skip if** phase number has no decimal (e.g., `3`, `04`) — only applies to gap-closure phases like `4.1`, `03.1`.
258
-
259
- **1. Detect decimal phase and derive parent:**
260
- ```bash
261
- # Check if phase_number contains a decimal
262
- if [[ "$PHASE_NUMBER" == *.* ]]; then
263
- PARENT_PHASE="${PHASE_NUMBER%%.*}"
264
- fi
265
- ```
266
-
267
- **2. Find parent UAT file:**
268
- ```bash
269
- PARENT_INFO=$(node "$HOME/.claude/ez-agents/bin/ez-tools.cjs" find-phase "${PARENT_PHASE}" --raw)
270
- # Extract directory from PARENT_INFO JSON, then find UAT file in that directory
271
- ```
272
-
273
- **If no parent UAT found:** Skip this step (gap-closure may have been triggered by VERIFICATION.md instead).
274
-
275
- **3. Update UAT gap statuses:**
276
-
277
- Read the parent UAT file's `## Gaps` section. For each gap entry with `status: failed`:
278
- - Update to `status: resolved`
279
-
280
- **4. Update UAT frontmatter:**
281
-
282
- If all gaps now have `status: resolved`:
283
- - Update frontmatter `status: diagnosed` `status: resolved`
284
- - Update frontmatter `updated:` timestamp
285
-
286
- **5. Resolve referenced debug sessions:**
287
-
288
- For each gap that has a `debug_session:` field:
289
- - Read the debug session file
290
- - Update frontmatter `status:` `resolved`
291
- - Update frontmatter `updated:` timestamp
292
- - Move to resolved directory:
293
- ```bash
294
- mkdir -p .planning/debug/resolved
295
- mv .planning/debug/{slug}.md .planning/debug/resolved/
296
- ```
297
-
298
- **6. Commit updated artifacts:**
299
- ```bash
300
- node "$HOME/.claude/ez-agents/bin/ez-tools.cjs" commit "docs(phase-${PARENT_PHASE}): resolve UAT gaps and debug sessions after ${PHASE_NUMBER} gap closure" --files .planning/phases/*${PARENT_PHASE}*/*-UAT.md .planning/debug/resolved/*.md
301
- ```
302
- </step>
303
-
304
- <step name="verify_phase_goal">
305
- Verify phase achieved its GOAL, not just completed tasks.
306
-
307
- ```
308
- Task(
309
- prompt="Verify phase {phase_number} goal achievement.
310
- Phase directory: {phase_dir}
311
- Phase goal: {goal from ROADMAP.md}
312
- Phase requirement IDs: {phase_req_ids}
313
- Check must_haves against actual codebase.
314
- Cross-reference requirement IDs from PLAN frontmatter against REQUIREMENTS.md every ID MUST be accounted for.
315
- Create VERIFICATION.md.",
316
- subagent_type="ez-verifier",
317
- model="{verifier_model}"
318
- )
319
- ```
320
-
321
- Read status:
322
- ```bash
323
- grep "^status:" "$PHASE_DIR"/*-VERIFICATION.md | cut -d: -f2 | tr -d ' '
324
- ```
325
-
326
- | Status | Action |
327
- |--------|--------|
328
- | `passed` | update_roadmap |
329
- | `human_needed` | Present items for human testing, get approval or feedback |
330
- | `gaps_found` | Present gap summary, offer `/ez:plan-phase {phase} --gaps` |
331
-
332
- **If human_needed:**
333
- ```
334
- ## ✓ Phase {X}: {Name} — Human Verification Required
335
-
336
- All automated checks passed. {N} items need human testing:
337
-
338
- {From VERIFICATION.md human_verification section}
339
-
340
- "approved" continue | Report issues → gap closure
341
- ```
342
-
343
- **If gaps_found:**
344
- ```
345
- ## ⚠ Phase {X}: {Name} — Gaps Found
346
-
347
- **Score:** {N}/{M} must-haves verified
348
- **Report:** {phase_dir}/{phase_num}-VERIFICATION.md
349
-
350
- ### What's Missing
351
- {Gap summaries from VERIFICATION.md}
352
-
353
- ---
354
- ## Next Up
355
-
356
- `/ez:plan-phase {X} --gaps`
357
-
358
- <sub>`/clear` first fresh context window</sub>
359
-
360
- Also: `cat {phase_dir}/{phase_num}-VERIFICATION.md` — full report
361
- Also: `/ez:verify-work {X}` — manual testing first
362
- ```
363
-
364
- Gap closure cycle: `/ez:plan-phase {X} --gaps` reads VERIFICATION.md → creates gap plans with `gap_closure: true` → user runs `/ez:execute-phase {X} --gaps-only` → verifier re-runs.
365
- </step>
366
-
367
- <step name="update_roadmap">
368
- **Mark phase complete and update all tracking files:**
369
-
370
- ```bash
371
- COMPLETION=$(node "$HOME/.claude/ez-agents/bin/ez-tools.cjs" phase complete "${PHASE_NUMBER}")
372
- ```
373
-
374
- The CLI handles:
375
- - Marking phase checkbox `[x]` with completion date
376
- - Updating Progress table (Status → Complete, date)
377
- - Updating plan count to final
378
- - Advancing STATE.md to next phase
379
- - Updating REQUIREMENTS.md traceability
380
-
381
- Extract from result: `next_phase`, `next_phase_name`, `is_last_phase`.
382
-
383
- ```bash
384
- node "$HOME/.claude/ez-agents/bin/ez-tools.cjs" commit "docs(phase-{X}): complete phase execution" --files .planning/ROADMAP.md .planning/STATE.md .planning/REQUIREMENTS.md {phase_dir}/*-VERIFICATION.md
385
- ```
386
- </step>
387
-
388
- <step name="offer_next">
389
-
390
- **Exception:** If `gaps_found`, the `verify_phase_goal` step already presents the gap-closure path (`/ez:plan-phase {X} --gaps`). No additional routing needed — skip auto-advance.
391
-
392
- **No-transition check (spawned by auto-advance chain):**
393
-
394
- Parse `--no-transition` flag from $ARGUMENTS.
395
-
396
- **If `--no-transition` flag present:**
397
-
398
- Execute-phase was spawned by plan-phase's auto-advance. Do NOT run transition.md.
399
- After verification passes and roadmap is updated, return completion status to parent:
400
-
401
- ```
402
- ## PHASE COMPLETE
403
-
404
- Phase: ${PHASE_NUMBER} - ${PHASE_NAME}
405
- Plans: ${completed_count}/${total_count}
406
- Verification: {Passed | Gaps Found}
407
-
408
- [Include aggregate_results output]
409
- ```
410
-
411
- STOP. Do not proceed to auto-advance or transition.
412
-
413
- **If `--no-transition` flag is NOT present:**
414
-
415
- **Auto-advance detection:**
416
-
417
- 1. Parse `--auto` flag from $ARGUMENTS
418
- 2. Read both the chain flag and user preference (chain flag already synced in init step):
419
- ```bash
420
- AUTO_CHAIN=$(node "$HOME/.claude/ez-agents/bin/ez-tools.cjs" config-get workflow._auto_chain_active 2>/dev/null || echo "false")
421
- AUTO_CFG=$(node "$HOME/.claude/ez-agents/bin/ez-tools.cjs" config-get workflow.auto_advance 2>/dev/null || echo "false")
422
- ```
423
-
424
- **If `--auto` flag present OR `AUTO_CHAIN` is true OR `AUTO_CFG` is true (AND verification passed with no gaps):**
425
-
426
- ```
427
- ╔══════════════════════════════════════════╗
428
- ║ AUTO-ADVANCING → TRANSITION ║
429
- ║ Phase {X} verified, continuing chain ║
430
- ╚══════════════════════════════════════════╝
431
- ```
432
-
433
- Execute the transition workflow inline (do NOT use Task — orchestrator context is ~10-15%, transition needs phase completion data already in context):
434
-
435
- Read and follow `~/.claude/ez-agents/workflows/transition.md`, passing through the `--auto` flag so it propagates to the next phase invocation.
436
-
437
- **If none of `--auto`, `AUTO_CHAIN`, or `AUTO_CFG` is true:**
438
-
439
- **STOP. Do not auto-advance. Do not execute transition. Do not plan next phase. Present options to the user and wait.**
440
-
441
- ```
442
- ## ✓ Phase {X}: {Name} Complete
443
-
444
- /ez:progress — see updated roadmap
445
- /ez:transition plan next phase transition
446
- /ez:execute-phase {next} execute next phase
447
- ```
448
- </step>
449
-
450
- </process>
451
-
452
- <context_efficiency>
453
- Orchestrator: ~10-15% context. Subagents: fresh 200k each. No polling (Task blocks). No context bleed.
454
- </context_efficiency>
455
-
456
- <failure_handling>
457
- - **classifyHandoffIfNeeded false failure:** Agent reports "failed" but error is `classifyHandoffIfNeeded is not defined` → Claude Code bug, not EZ. Spot-check (SUMMARY exists, commits present) → if pass, treat as success
458
- - **Agent fails mid-plan:** Missing SUMMARY.md → report, ask user how to proceed
459
- - **Dependency chain breaks:** Wave 1 fails → Wave 2 dependents likely fail → user chooses attempt or skip
460
- - **All agents in wave fail:** Systemic issue → stop, report for investigation
461
- - **Checkpoint unresolvable:** "Skip this plan?" or "Abort phase execution?" record partial progress in STATE.md
462
- </failure_handling>
463
-
464
- <resumption>
465
- Re-run `/ez:execute-phase {phase}` discover_plans finds completed SUMMARYs → skips them → resumes from first incomplete plan → continues wave execution.
466
-
467
- STATE.md tracks: last completed plan, current wave, pending checkpoints.
468
- </resumption>
1
+ <purpose>
2
+ Execute all plans in a phase using wave-based parallel execution. Orchestrator stays lean — delegates plan execution to subagents.
3
+ </purpose>
4
+
5
+ <core_principle>
6
+ Orchestrator coordinates, not executes. Each subagent loads the full execute-plan context. Orchestrator: discover plans → analyze deps → group waves → spawn agents → handle checkpoints → collect results.
7
+ </core_principle>
8
+
9
+ <required_reading>
10
+ Read STATE.md before any operation to load project context.
11
+ </required_reading>
12
+
13
+ <process>
14
+
15
+ <auto_invoke>
16
+ Run BEFORE the initialize step. Check flags from ARGUMENTS:
17
+
18
+ **Flag handling:**
19
+ - If ARGUMENTS contains `--no-auto`: skip all auto_invoke blocks, proceed directly to initialize.
20
+ - If ARGUMENTS contains `--verbose`: display detail for every auto_invoke step.
21
+
22
+ **Pre-flight health check (always, unless --no-auto):**
23
+ ```bash
24
+ SMART_ORCH=$(node "$HOME/.claude/ez-agents/bin/ez-tools.cjs" config-get smart_orchestration.enabled 2>/dev/null || echo "true")
25
+ ```
26
+ If `SMART_ORCH` is `"false"`: skip all auto_invoke, proceed to initialize.
27
+
28
+ ```bash
29
+ HEALTH=$(node "$HOME/.claude/ez-agents/bin/ez-tools.cjs" health --json 2>/dev/null)
30
+ ```
31
+ - If output shows status FAIL: display error, STOP execution.
32
+ - If PASS: display `[auto] ✅ health check passed` only when `--verbose` flag is present; otherwise silent.
33
+
34
+ **Conditional discuss-phase:**
35
+ Read tier from `.planning/config.json` (`release.tier`). If tier is `medium` or `enterprise` AND no CONTEXT.md exists in the phase directory AND `--skip-discussion` is not in ARGUMENTS:
36
+ → Display: `[auto] Running pre-flight discussion...`
37
+ → Invoke: Skill(ez:discuss-phase, args: phase_number + " --auto")
38
+ → Continue to initialize.
39
+
40
+ If conditions are not met: skip silently.
41
+ </auto_invoke>
42
+
43
+ <step name="initialize" priority="first">
44
+ Load all context in one call:
45
+
46
+ ```bash
47
+ INIT=$(node "$HOME/.claude/ez-agents/bin/ez-tools.cjs" init execute-phase "${PHASE_ARG}")
48
+ if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi
49
+ ```
50
+
51
+ Parse JSON for: `executor_model`, `verifier_model`, `commit_docs`, `parallelization`, `branching_strategy`, `branch_name`, `phase_found`, `phase_dir`, `phase_number`, `phase_name`, `phase_slug`, `plans`, `incomplete_plans`, `plan_count`, `incomplete_count`, `state_exists`, `roadmap_exists`, `phase_req_ids`.
52
+
53
+ **If `phase_found` is false:** Error — phase directory not found.
54
+ **If `plan_count` is 0:** Error — no plans found in phase.
55
+ **If `state_exists` is false but `.planning/` exists:** Offer reconstruct or continue.
56
+
57
+ When `parallelization` is false, plans within a wave execute sequentially.
58
+
59
+ **REQUIRED — Sync chain flag with intent.** If user invoked manually (no `--auto`), clear the ephemeral chain flag from any previous interrupted `--auto` chain. This prevents stale `_auto_chain_active: true` from causing unwanted auto-advance. This does NOT touch `workflow.auto_advance` (the user's persistent settings preference). You MUST execute this bash block before any config reads:
60
+ ```bash
61
+ # REQUIRED: prevents stale auto-chain from previous --auto runs
62
+ if [[ ! "$ARGUMENTS" =~ --auto ]]; then
63
+ node "$HOME/.claude/ez-agents/bin/ez-tools.cjs" config-set workflow._auto_chain_active false 2>/dev/null
64
+ fi
65
+ ```
66
+ </step>
67
+
68
+ <step name="handle_branching">
69
+ Check `branching_strategy` from init:
70
+
71
+ **"none":** Skip, continue on current branch.
72
+
73
+ **"phase" or "milestone":** Use pre-computed `branch_name` from init:
74
+ ```bash
75
+ git checkout -b "$BRANCH_NAME" 2>/dev/null || git checkout "$BRANCH_NAME"
76
+ ```
77
+
78
+ All subsequent commits go to this branch. User handles merging.
79
+ </step>
80
+
81
+ <step name="validate_phase">
82
+ From init JSON: `phase_dir`, `plan_count`, `incomplete_count`.
83
+
84
+ Report: "Found {plan_count} plans in {phase_dir} ({incomplete_count} incomplete)"
85
+ </step>
86
+
87
+ <step name="discover_and_group_plans">
88
+ Load plan inventory with wave grouping in one call:
89
+
90
+ ```bash
91
+ PLAN_INDEX=$(node "$HOME/.claude/ez-agents/bin/ez-tools.cjs" phase-plan-index "${PHASE_NUMBER}")
92
+ ```
93
+
94
+ Parse JSON for: `phase`, `plans[]` (each with `id`, `wave`, `autonomous`, `objective`, `files_modified`, `task_count`, `has_summary`), `waves` (map of wave number → plan IDs), `incomplete`, `has_checkpoints`.
95
+
96
+ **Filtering:** Skip plans where `has_summary: true`. If `--gaps-only`: also skip non-gap_closure plans. If all filtered: "No matching incomplete plans" → exit.
97
+
98
+ Report:
99
+ ```
100
+ ## Execution Plan
101
+
102
+ **Phase {X}: {Name}** — {total_plans} plans across {wave_count} waves
103
+
104
+ | Wave | Plans | What it builds |
105
+ |------|-------|----------------|
106
+ | 1 | 01-01, 01-02 | {from plan objectives, 3-8 words} |
107
+ | 2 | 01-03 | ... |
108
+ ```
109
+ </step>
110
+
111
+ <step name="execute_waves">
112
+ Execute each wave in sequence. Within a wave: parallel if `PARALLELIZATION=true`, sequential if `false`.
113
+
114
+ **For each wave:**
115
+
116
+ 1. **Describe what's being built (BEFORE spawning):**
117
+
118
+ Read each plan's `<objective>`. Extract what's being built and why.
119
+
120
+ ```
121
+ ---
122
+ ## Wave {N}
123
+
124
+ **{Plan ID}: {Plan Name}**
125
+ {2-3 sentences: what this builds, technical approach, why it matters}
126
+
127
+ Spawning {count} agent(s)...
128
+ ---
129
+ ```
130
+
131
+ - Bad: "Executing terrain generation plan"
132
+ - Good: "Procedural terrain generator using Perlin noise — creates height maps, biome zones, and collision meshes. Required before vehicle physics can interact with ground."
133
+
134
+ 2. **Spawn executor agents:**
135
+
136
+ Pass paths only — executors read files themselves with their fresh 200k context.
137
+ This keeps orchestrator context lean (~10-15%).
138
+
139
+ ```
140
+ Task(
141
+ subagent_type="ez-executor",
142
+ model="{executor_model}",
143
+ prompt="
144
+ <objective>
145
+ Execute plan {plan_number} of phase {phase_number}-{phase_name}.
146
+ Commit each task atomically. Create SUMMARY.md. Update STATE.md and ROADMAP.md.
147
+ </objective>
148
+
149
+ <execution_context>
150
+ @~/.claude/ez-agents/workflows/execute-plan.md
151
+ @~/.claude/ez-agents/templates/summary.md
152
+ @~/.claude/ez-agents/references/checkpoints.md
153
+ @~/.claude/ez-agents/references/tdd.md
154
+ </execution_context>
155
+
156
+ <files_to_read>
157
+ Read these files at execution start using the Read tool:
158
+ - {phase_dir}/{plan_file} (Plan)
159
+ - .planning/STATE.md (State)
160
+ - .planning/config.json (Config, if exists)
161
+ - ./CLAUDE.md (Project instructions, if exists — follow project-specific guidelines and coding conventions)
162
+ - .claude/skills/ or .agents/skills/ (Project skills, if either exists — list skills, read SKILL.md for each, follow relevant rules during implementation)
163
+ </files_to_read>
164
+
165
+ <success_criteria>
166
+ - [ ] All tasks executed
167
+ - [ ] Each task committed individually
168
+ - [ ] SUMMARY.md created in plan directory
169
+ - [ ] STATE.md updated with position and decisions
170
+ - [ ] ROADMAP.md updated with plan progress (via `roadmap update-plan-progress`)
171
+ </success_criteria>
172
+ "
173
+ )
174
+ ```
175
+
176
+ 3. **Wait for all agents in wave to complete.**
177
+
178
+ 4. **Report completion — spot-check claims first:**
179
+
180
+ For each SUMMARY.md:
181
+ - Verify first 2 files from `key-files.created` exist on disk
182
+ - Check `git log --oneline --all --grep="{phase}-{plan}"` returns ≥1 commit
183
+ - Check for `## Self-Check: FAILED` marker
184
+
185
+ If ANY spot-check fails: report which plan failed, route to failure handler — ask "Retry plan?" or "Continue with remaining waves?"
186
+
187
+ If pass:
188
+ ```
189
+ ---
190
+ ## Wave {N} Complete
191
+
192
+ **{Plan ID}: {Plan Name}**
193
+ {What was built from SUMMARY.md}
194
+ {Notable deviations, if any}
195
+
196
+ {If more waves: what this enables for next wave}
197
+ ---
198
+ ```
199
+
200
+ - Bad: "Wave 2 complete. Proceeding to Wave 3."
201
+ - Good: "Terrain system complete — 3 biome types, height-based texturing, physics collision meshes. Vehicle physics (Wave 3) can now reference ground surfaces."
202
+
203
+ 5. **Handle failures:**
204
+
205
+ **Known Claude Code bug (classifyHandoffIfNeeded):** If an agent reports "failed" with error containing `classifyHandoffIfNeeded is not defined`, this is a Claude Code runtime bug — not an EZ or agent issue. The error fires in the completion handler AFTER all tool calls finish. In this case: run the same spot-checks as step 4 (SUMMARY.md exists, git commits present, no Self-Check: FAILED). If spot-checks PASS treat as **successful**. If spot-checks FAIL → treat as real failure below.
206
+
207
+ For real failures: report which plan failed → ask "Continue?" or "Stop?" → if continue, dependent plans may also fail. If stop, partial completion report.
208
+
209
+ 6. **Execute checkpoint plans between waves** — see `<checkpoint_handling>`.
210
+
211
+ 7. **Proceed to next wave.**
212
+ </step>
213
+
214
+ <step name="checkpoint_handling">
215
+ Plans with `autonomous: false` require user interaction.
216
+
217
+ **Auto-mode checkpoint handling:**
218
+
219
+ Read auto-advance config (chain flag + user preference):
220
+ ```bash
221
+ AUTO_CHAIN=$(node "$HOME/.claude/ez-agents/bin/ez-tools.cjs" config-get workflow._auto_chain_active 2>/dev/null || echo "false")
222
+ AUTO_CFG=$(node "$HOME/.claude/ez-agents/bin/ez-tools.cjs" config-get workflow.auto_advance 2>/dev/null || echo "false")
223
+ ```
224
+
225
+ When executor returns a checkpoint AND (`AUTO_CHAIN` is `"true"` OR `AUTO_CFG` is `"true"`):
226
+ - **human-verify** Auto-spawn continuation agent with `{user_response}` = `"approved"`. Log `⚡ Auto-approved checkpoint`.
227
+ - **decision** → Auto-spawn continuation agent with `{user_response}` = first option from checkpoint details. Log `⚡ Auto-selected: [option]`.
228
+ - **human-action** Present to user (existing behavior below). Auth gates cannot be automated.
229
+
230
+ **Standard flow (not auto-mode, or human-action type):**
231
+
232
+ 1. Spawn agent for checkpoint plan
233
+ 2. Agent runs until checkpoint task or auth gate → returns structured state
234
+ 3. Agent return includes: completed tasks table, current task + blocker, checkpoint type/details, what's awaited
235
+ 4. **Present to user:**
236
+ ```
237
+ ## Checkpoint: [Type]
238
+
239
+ **Plan:** 03-03 Dashboard Layout
240
+ **Progress:** 2/3 tasks complete
241
+
242
+ [Checkpoint Details from agent return]
243
+ [Awaiting section from agent return]
244
+ ```
245
+ 5. User responds: "approved"/"done" | issue description | decision selection
246
+ 6. **Spawn continuation agent (NOT resume)** using continuation-prompt.md template:
247
+ - `{completed_tasks_table}`: From checkpoint return
248
+ - `{resume_task_number}` + `{resume_task_name}`: Current task
249
+ - `{user_response}`: What user provided
250
+ - `{resume_instructions}`: Based on checkpoint type
251
+ 7. Continuation agent verifies previous commits, continues from resume point
252
+ 8. Repeat until plan completes or user stops
253
+
254
+ **Why fresh agent, not resume:** Resume relies on internal serialization that breaks with parallel tool calls. Fresh agents with explicit state are more reliable.
255
+
256
+ **Checkpoints in parallel waves:** Agent pauses and returns while other parallel agents may complete. Present checkpoint, spawn continuation, wait for all before next wave.
257
+ </step>
258
+
259
+ <step name="aggregate_results">
260
+ After all waves:
261
+
262
+ ```markdown
263
+ ## Phase {X}: {Name} Execution Complete
264
+
265
+ **Waves:** {N} | **Plans:** {M}/{total} complete
266
+
267
+ | Wave | Plans | Status |
268
+ |------|-------|--------|
269
+ | 1 | plan-01, plan-02 | ✓ Complete |
270
+ | CP | plan-03 | Verified |
271
+ | 2 | plan-04 | ✓ Complete |
272
+
273
+ ### Plan Details
274
+ 1. **03-01**: [one-liner from SUMMARY.md]
275
+ 2. **03-02**: [one-liner from SUMMARY.md]
276
+
277
+ ### Issues Encountered
278
+ [Aggregate from SUMMARYs, or "None"]
279
+ ```
280
+ </step>
281
+
282
+ <step name="close_parent_artifacts">
283
+ **For decimal/polish phases only (X.Y pattern):** Close the feedback loop by resolving parent UAT and debug artifacts.
284
+
285
+ **Skip if** phase number has no decimal (e.g., `3`, `04`) — only applies to gap-closure phases like `4.1`, `03.1`.
286
+
287
+ **1. Detect decimal phase and derive parent:**
288
+ ```bash
289
+ # Check if phase_number contains a decimal
290
+ if [[ "$PHASE_NUMBER" == *.* ]]; then
291
+ PARENT_PHASE="${PHASE_NUMBER%%.*}"
292
+ fi
293
+ ```
294
+
295
+ **2. Find parent UAT file:**
296
+ ```bash
297
+ PARENT_INFO=$(node "$HOME/.claude/ez-agents/bin/ez-tools.cjs" find-phase "${PARENT_PHASE}" --raw)
298
+ # Extract directory from PARENT_INFO JSON, then find UAT file in that directory
299
+ ```
300
+
301
+ **If no parent UAT found:** Skip this step (gap-closure may have been triggered by VERIFICATION.md instead).
302
+
303
+ **3. Update UAT gap statuses:**
304
+
305
+ Read the parent UAT file's `## Gaps` section. For each gap entry with `status: failed`:
306
+ - Update to `status: resolved`
307
+
308
+ **4. Update UAT frontmatter:**
309
+
310
+ If all gaps now have `status: resolved`:
311
+ - Update frontmatter `status: diagnosed` `status: resolved`
312
+ - Update frontmatter `updated:` timestamp
313
+
314
+ **5. Resolve referenced debug sessions:**
315
+
316
+ For each gap that has a `debug_session:` field:
317
+ - Read the debug session file
318
+ - Update frontmatter `status:` → `resolved`
319
+ - Update frontmatter `updated:` timestamp
320
+ - Move to resolved directory:
321
+ ```bash
322
+ mkdir -p .planning/debug/resolved
323
+ mv .planning/debug/{slug}.md .planning/debug/resolved/
324
+ ```
325
+
326
+ **6. Commit updated artifacts:**
327
+ ```bash
328
+ node "$HOME/.claude/ez-agents/bin/ez-tools.cjs" commit "docs(phase-${PARENT_PHASE}): resolve UAT gaps and debug sessions after ${PHASE_NUMBER} gap closure" --files .planning/phases/*${PARENT_PHASE}*/*-UAT.md .planning/debug/resolved/*.md
329
+ ```
330
+ </step>
331
+
332
+ <step name="verify_phase_goal">
333
+ Verify phase achieved its GOAL, not just completed tasks.
334
+
335
+ ```
336
+ Task(
337
+ prompt="Verify phase {phase_number} goal achievement.
338
+ Phase directory: {phase_dir}
339
+ Phase goal: {goal from ROADMAP.md}
340
+ Phase requirement IDs: {phase_req_ids}
341
+ Check must_haves against actual codebase.
342
+ Cross-reference requirement IDs from PLAN frontmatter against REQUIREMENTS.md — every ID MUST be accounted for.
343
+ Create VERIFICATION.md.",
344
+ subagent_type="ez-verifier",
345
+ model="{verifier_model}"
346
+ )
347
+ ```
348
+
349
+ Read status:
350
+ ```bash
351
+ grep "^status:" "$PHASE_DIR"/*-VERIFICATION.md | cut -d: -f2 | tr -d ' '
352
+ ```
353
+
354
+ | Status | Action |
355
+ |--------|--------|
356
+ | `passed` | → update_roadmap |
357
+ | `human_needed` | Present items for human testing, get approval or feedback |
358
+ | `gaps_found` | Present gap summary, offer `/ez:plan-phase {phase} --gaps` |
359
+
360
+ **If human_needed:**
361
+ ```
362
+ ## ✓ Phase {X}: {Name} — Human Verification Required
363
+
364
+ All automated checks passed. {N} items need human testing:
365
+
366
+ {From VERIFICATION.md human_verification section}
367
+
368
+ "approved" continue | Report issues gap closure
369
+ ```
370
+
371
+ **If gaps_found:**
372
+ ```
373
+ ## ⚠ Phase {X}: {Name} — Gaps Found
374
+
375
+ **Score:** {N}/{M} must-haves verified
376
+ **Report:** {phase_dir}/{phase_num}-VERIFICATION.md
377
+
378
+ ### What's Missing
379
+ {Gap summaries from VERIFICATION.md}
380
+
381
+ ---
382
+ ## ▶ Next Up
383
+
384
+ `/ez:plan-phase {X} --gaps`
385
+
386
+ <sub>`/clear` first → fresh context window</sub>
387
+
388
+ Also: `cat {phase_dir}/{phase_num}-VERIFICATION.md` — full report
389
+ Also: `/ez:verify-work {X}` — manual testing first
390
+ ```
391
+
392
+ Gap closure cycle: `/ez:plan-phase {X} --gaps` reads VERIFICATION.md → creates gap plans with `gap_closure: true` → user runs `/ez:execute-phase {X} --gaps-only` → verifier re-runs.
393
+ </step>
394
+
395
+ <step name="update_roadmap">
396
+ **Mark phase complete and update all tracking files:**
397
+
398
+ ```bash
399
+ COMPLETION=$(node "$HOME/.claude/ez-agents/bin/ez-tools.cjs" phase complete "${PHASE_NUMBER}")
400
+ ```
401
+
402
+ The CLI handles:
403
+ - Marking phase checkbox `[x]` with completion date
404
+ - Updating Progress table (Status → Complete, date)
405
+ - Updating plan count to final
406
+ - Advancing STATE.md to next phase
407
+ - Updating REQUIREMENTS.md traceability
408
+
409
+ Extract from result: `next_phase`, `next_phase_name`, `is_last_phase`.
410
+
411
+ ```bash
412
+ node "$HOME/.claude/ez-agents/bin/ez-tools.cjs" commit "docs(phase-{X}): complete phase execution" --files .planning/ROADMAP.md .planning/STATE.md .planning/REQUIREMENTS.md {phase_dir}/*-VERIFICATION.md
413
+ ```
414
+ </step>
415
+
416
+ <step name="offer_next">
417
+
418
+ **Exception:** If `gaps_found`, the `verify_phase_goal` step already presents the gap-closure path (`/ez:plan-phase {X} --gaps`). No additional routing needed — skip auto-advance.
419
+
420
+ **No-transition check (spawned by auto-advance chain):**
421
+
422
+ Parse `--no-transition` flag from $ARGUMENTS.
423
+
424
+ **If `--no-transition` flag present:**
425
+
426
+ Execute-phase was spawned by plan-phase's auto-advance. Do NOT run transition.md.
427
+ After verification passes and roadmap is updated, return completion status to parent:
428
+
429
+ ```
430
+ ## PHASE COMPLETE
431
+
432
+ Phase: ${PHASE_NUMBER} - ${PHASE_NAME}
433
+ Plans: ${completed_count}/${total_count}
434
+ Verification: {Passed | Gaps Found}
435
+
436
+ [Include aggregate_results output]
437
+ ```
438
+
439
+ STOP. Do not proceed to auto-advance or transition.
440
+
441
+ **If `--no-transition` flag is NOT present:**
442
+
443
+ **Auto-advance detection:**
444
+
445
+ 1. Parse `--auto` flag from $ARGUMENTS
446
+ 2. Read both the chain flag and user preference (chain flag already synced in init step):
447
+ ```bash
448
+ AUTO_CHAIN=$(node "$HOME/.claude/ez-agents/bin/ez-tools.cjs" config-get workflow._auto_chain_active 2>/dev/null || echo "false")
449
+ AUTO_CFG=$(node "$HOME/.claude/ez-agents/bin/ez-tools.cjs" config-get workflow.auto_advance 2>/dev/null || echo "false")
450
+ ```
451
+
452
+ **If `--auto` flag present OR `AUTO_CHAIN` is true OR `AUTO_CFG` is true (AND verification passed with no gaps):**
453
+
454
+ ```
455
+ ╔══════════════════════════════════════════╗
456
+ ║ AUTO-ADVANCING → TRANSITION ║
457
+ ║ Phase {X} verified, continuing chain ║
458
+ ╚══════════════════════════════════════════╝
459
+ ```
460
+
461
+ Execute the transition workflow inline (do NOT use Task orchestrator context is ~10-15%, transition needs phase completion data already in context):
462
+
463
+ Read and follow `~/.claude/ez-agents/workflows/transition.md`, passing through the `--auto` flag so it propagates to the next phase invocation.
464
+
465
+ **If none of `--auto`, `AUTO_CHAIN`, or `AUTO_CFG` is true:**
466
+
467
+ **STOP. Do not auto-advance. Do not execute transition. Do not plan next phase. Present options to the user and wait.**
468
+
469
+ ```
470
+ ## ✓ Phase {X}: {Name} Complete
471
+
472
+ /ez:progress — see updated roadmap
473
+ /ez:transition — plan next phase transition
474
+ /ez:execute-phase {next} — execute next phase
475
+ ```
476
+ </step>
477
+
478
+ <auto_invoke_post>
479
+ Run AFTER all waves complete. Skip if --no-auto is in ARGUMENTS or `smart_orchestration.enabled` is false.
480
+
481
+ **Post-execution verify-work:**
482
+ Display: `[auto] Running verification...`
483
+ Invoke: Skill(ez:verify-work, args: phase_number)
484
+ - If PASS: display `[auto] ✅ Verification passed`
485
+ - If FAIL: display `⚠️ Verification warnings (non-blocking)` — show details, do NOT block
486
+
487
+ **Scope creep detection:**
488
+ Check if there is scope creep from DISCUSSION.md (if it exists):
489
+ ```bash
490
+ grep -i "scope creep\|out of scope\|BLOCKER" .planning/phases/${PHASE_DIR}/DISCUSSION.md 2>/dev/null
491
+ ```
492
+ If any match found: display `[auto] Scope creep detected — creating todos...` → Invoke: Skill(ez:add-todo)
493
+ </auto_invoke_post>
494
+
495
+ </process>
496
+
497
+ <context_efficiency>
498
+ Orchestrator: ~10-15% context. Subagents: fresh 200k each. No polling (Task blocks). No context bleed.
499
+ </context_efficiency>
500
+
501
+ <failure_handling>
502
+ - **classifyHandoffIfNeeded false failure:** Agent reports "failed" but error is `classifyHandoffIfNeeded is not defined` → Claude Code bug, not EZ. Spot-check (SUMMARY exists, commits present) → if pass, treat as success
503
+ - **Agent fails mid-plan:** Missing SUMMARY.md → report, ask user how to proceed
504
+ - **Dependency chain breaks:** Wave 1 fails → Wave 2 dependents likely fail → user chooses attempt or skip
505
+ - **All agents in wave fail:** Systemic issue → stop, report for investigation
506
+ - **Checkpoint unresolvable:** "Skip this plan?" or "Abort phase execution?" → record partial progress in STATE.md
507
+ </failure_handling>
508
+
509
+ <resumption>
510
+ Re-run `/ez:execute-phase {phase}` → discover_plans finds completed SUMMARYs → skips them → resumes from first incomplete plan → continues wave execution.
511
+
512
+ STATE.md tracks: last completed plan, current wave, pending checkpoints.
513
+ </resumption>