@howlil/ez-agents 2.0.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 (183) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +845 -0
  3. package/README.zh-CN.md +702 -0
  4. package/agents/ez-codebase-mapper.md +770 -0
  5. package/agents/ez-debugger.md +1255 -0
  6. package/agents/ez-executor.md +487 -0
  7. package/agents/ez-integration-checker.md +443 -0
  8. package/agents/ez-nyquist-auditor.md +176 -0
  9. package/agents/ez-phase-researcher.md +553 -0
  10. package/agents/ez-plan-checker.md +706 -0
  11. package/agents/ez-planner.md +1307 -0
  12. package/agents/ez-project-researcher.md +629 -0
  13. package/agents/ez-research-synthesizer.md +247 -0
  14. package/agents/ez-roadmapper.md +650 -0
  15. package/agents/ez-ui-auditor.md +441 -0
  16. package/agents/ez-ui-checker.md +302 -0
  17. package/agents/ez-ui-researcher.md +355 -0
  18. package/agents/ez-verifier.md +579 -0
  19. package/bin/install.js +2862 -0
  20. package/bin/update.js +214 -0
  21. package/commands/ez/add-phase.md +43 -0
  22. package/commands/ez/add-tests.md +41 -0
  23. package/commands/ez/add-todo.md +47 -0
  24. package/commands/ez/audit-milestone.md +36 -0
  25. package/commands/ez/autonomous.md +41 -0
  26. package/commands/ez/check-todos.md +45 -0
  27. package/commands/ez/cleanup.md +18 -0
  28. package/commands/ez/complete-milestone.md +136 -0
  29. package/commands/ez/debug.md +168 -0
  30. package/commands/ez/discuss-phase.md +90 -0
  31. package/commands/ez/execute-phase.md +41 -0
  32. package/commands/ez/health.md +22 -0
  33. package/commands/ez/help.md +22 -0
  34. package/commands/ez/insert-phase.md +32 -0
  35. package/commands/ez/join-discord.md +18 -0
  36. package/commands/ez/list-phase-assumptions.md +46 -0
  37. package/commands/ez/map-codebase.md +71 -0
  38. package/commands/ez/new-milestone.md +44 -0
  39. package/commands/ez/new-project.md +42 -0
  40. package/commands/ez/pause-work.md +38 -0
  41. package/commands/ez/plan-milestone-gaps.md +34 -0
  42. package/commands/ez/plan-phase.md +45 -0
  43. package/commands/ez/progress.md +24 -0
  44. package/commands/ez/quick.md +45 -0
  45. package/commands/ez/reapply-patches.md +124 -0
  46. package/commands/ez/remove-phase.md +31 -0
  47. package/commands/ez/research-phase.md +190 -0
  48. package/commands/ez/resume-work.md +40 -0
  49. package/commands/ez/set-profile.md +34 -0
  50. package/commands/ez/settings.md +36 -0
  51. package/commands/ez/stats.md +18 -0
  52. package/commands/ez/ui-phase.md +34 -0
  53. package/commands/ez/ui-review.md +32 -0
  54. package/commands/ez/update.md +37 -0
  55. package/commands/ez/validate-phase.md +35 -0
  56. package/commands/ez/verify-work.md +38 -0
  57. package/get-shit-done/bin/ez-tools.cjs +598 -0
  58. package/get-shit-done/bin/lib/assistant-adapter.cjs +205 -0
  59. package/get-shit-done/bin/lib/audit-exec.cjs +150 -0
  60. package/get-shit-done/bin/lib/auth.cjs +175 -0
  61. package/get-shit-done/bin/lib/circuit-breaker.cjs +118 -0
  62. package/get-shit-done/bin/lib/commands.cjs +666 -0
  63. package/get-shit-done/bin/lib/config.cjs +183 -0
  64. package/get-shit-done/bin/lib/core.cjs +495 -0
  65. package/get-shit-done/bin/lib/file-lock.cjs +236 -0
  66. package/get-shit-done/bin/lib/frontmatter.cjs +299 -0
  67. package/get-shit-done/bin/lib/fs-utils.cjs +153 -0
  68. package/get-shit-done/bin/lib/git-utils.cjs +203 -0
  69. package/get-shit-done/bin/lib/health-check.cjs +163 -0
  70. package/get-shit-done/bin/lib/index.cjs +113 -0
  71. package/get-shit-done/bin/lib/init.cjs +710 -0
  72. package/get-shit-done/bin/lib/logger.cjs +117 -0
  73. package/get-shit-done/bin/lib/milestone.cjs +241 -0
  74. package/get-shit-done/bin/lib/model-provider.cjs +146 -0
  75. package/get-shit-done/bin/lib/phase.cjs +908 -0
  76. package/get-shit-done/bin/lib/retry.cjs +119 -0
  77. package/get-shit-done/bin/lib/roadmap.cjs +305 -0
  78. package/get-shit-done/bin/lib/safe-exec.cjs +128 -0
  79. package/get-shit-done/bin/lib/safe-path.cjs +130 -0
  80. package/get-shit-done/bin/lib/state.cjs +721 -0
  81. package/get-shit-done/bin/lib/temp-file.cjs +239 -0
  82. package/get-shit-done/bin/lib/template.cjs +222 -0
  83. package/get-shit-done/bin/lib/test-file-lock.cjs +112 -0
  84. package/get-shit-done/bin/lib/test-graceful.cjs +93 -0
  85. package/get-shit-done/bin/lib/test-logger.cjs +60 -0
  86. package/get-shit-done/bin/lib/test-safe-exec.cjs +38 -0
  87. package/get-shit-done/bin/lib/test-safe-path.cjs +33 -0
  88. package/get-shit-done/bin/lib/test-temp-file.cjs +125 -0
  89. package/get-shit-done/bin/lib/timeout-exec.cjs +62 -0
  90. package/get-shit-done/bin/lib/verify.cjs +820 -0
  91. package/get-shit-done/references/checkpoints.md +776 -0
  92. package/get-shit-done/references/continuation-format.md +249 -0
  93. package/get-shit-done/references/decimal-phase-calculation.md +65 -0
  94. package/get-shit-done/references/git-integration.md +248 -0
  95. package/get-shit-done/references/git-planning-commit.md +38 -0
  96. package/get-shit-done/references/model-profile-resolution.md +34 -0
  97. package/get-shit-done/references/model-profiles.md +93 -0
  98. package/get-shit-done/references/phase-argument-parsing.md +61 -0
  99. package/get-shit-done/references/planning-config.md +200 -0
  100. package/get-shit-done/references/questioning.md +162 -0
  101. package/get-shit-done/references/tdd.md +263 -0
  102. package/get-shit-done/references/ui-brand.md +160 -0
  103. package/get-shit-done/references/verification-patterns.md +612 -0
  104. package/get-shit-done/templates/DEBUG.md +164 -0
  105. package/get-shit-done/templates/UAT.md +247 -0
  106. package/get-shit-done/templates/UI-SPEC.md +100 -0
  107. package/get-shit-done/templates/VALIDATION.md +76 -0
  108. package/get-shit-done/templates/codebase/architecture.md +255 -0
  109. package/get-shit-done/templates/codebase/concerns.md +310 -0
  110. package/get-shit-done/templates/codebase/conventions.md +307 -0
  111. package/get-shit-done/templates/codebase/integrations.md +280 -0
  112. package/get-shit-done/templates/codebase/stack.md +186 -0
  113. package/get-shit-done/templates/codebase/structure.md +285 -0
  114. package/get-shit-done/templates/codebase/testing.md +480 -0
  115. package/get-shit-done/templates/config.json +37 -0
  116. package/get-shit-done/templates/context.md +352 -0
  117. package/get-shit-done/templates/continue-here.md +78 -0
  118. package/get-shit-done/templates/copilot-instructions.md +7 -0
  119. package/get-shit-done/templates/debug-subagent-prompt.md +91 -0
  120. package/get-shit-done/templates/discovery.md +146 -0
  121. package/get-shit-done/templates/milestone-archive.md +123 -0
  122. package/get-shit-done/templates/milestone.md +115 -0
  123. package/get-shit-done/templates/phase-prompt.md +610 -0
  124. package/get-shit-done/templates/planner-subagent-prompt.md +117 -0
  125. package/get-shit-done/templates/project.md +184 -0
  126. package/get-shit-done/templates/requirements.md +231 -0
  127. package/get-shit-done/templates/research-project/ARCHITECTURE.md +204 -0
  128. package/get-shit-done/templates/research-project/FEATURES.md +147 -0
  129. package/get-shit-done/templates/research-project/PITFALLS.md +200 -0
  130. package/get-shit-done/templates/research-project/STACK.md +120 -0
  131. package/get-shit-done/templates/research-project/SUMMARY.md +170 -0
  132. package/get-shit-done/templates/research.md +552 -0
  133. package/get-shit-done/templates/retrospective.md +54 -0
  134. package/get-shit-done/templates/roadmap.md +202 -0
  135. package/get-shit-done/templates/state.md +176 -0
  136. package/get-shit-done/templates/summary-complex.md +59 -0
  137. package/get-shit-done/templates/summary-minimal.md +41 -0
  138. package/get-shit-done/templates/summary-standard.md +48 -0
  139. package/get-shit-done/templates/summary.md +248 -0
  140. package/get-shit-done/templates/user-setup.md +311 -0
  141. package/get-shit-done/templates/verification-report.md +322 -0
  142. package/get-shit-done/workflows/add-phase.md +112 -0
  143. package/get-shit-done/workflows/add-tests.md +351 -0
  144. package/get-shit-done/workflows/add-todo.md +158 -0
  145. package/get-shit-done/workflows/audit-milestone.md +332 -0
  146. package/get-shit-done/workflows/autonomous.md +743 -0
  147. package/get-shit-done/workflows/check-todos.md +177 -0
  148. package/get-shit-done/workflows/cleanup.md +152 -0
  149. package/get-shit-done/workflows/complete-milestone.md +766 -0
  150. package/get-shit-done/workflows/diagnose-issues.md +219 -0
  151. package/get-shit-done/workflows/discovery-phase.md +289 -0
  152. package/get-shit-done/workflows/discuss-phase.md +762 -0
  153. package/get-shit-done/workflows/execute-phase.md +468 -0
  154. package/get-shit-done/workflows/execute-plan.md +483 -0
  155. package/get-shit-done/workflows/health.md +159 -0
  156. package/get-shit-done/workflows/help.md +492 -0
  157. package/get-shit-done/workflows/insert-phase.md +130 -0
  158. package/get-shit-done/workflows/list-phase-assumptions.md +178 -0
  159. package/get-shit-done/workflows/map-codebase.md +316 -0
  160. package/get-shit-done/workflows/new-milestone.md +384 -0
  161. package/get-shit-done/workflows/new-project.md +1111 -0
  162. package/get-shit-done/workflows/node-repair.md +92 -0
  163. package/get-shit-done/workflows/pause-work.md +122 -0
  164. package/get-shit-done/workflows/plan-milestone-gaps.md +274 -0
  165. package/get-shit-done/workflows/plan-phase.md +651 -0
  166. package/get-shit-done/workflows/progress.md +382 -0
  167. package/get-shit-done/workflows/quick.md +610 -0
  168. package/get-shit-done/workflows/remove-phase.md +155 -0
  169. package/get-shit-done/workflows/research-phase.md +74 -0
  170. package/get-shit-done/workflows/resume-project.md +307 -0
  171. package/get-shit-done/workflows/set-profile.md +81 -0
  172. package/get-shit-done/workflows/settings.md +242 -0
  173. package/get-shit-done/workflows/stats.md +57 -0
  174. package/get-shit-done/workflows/transition.md +544 -0
  175. package/get-shit-done/workflows/ui-phase.md +290 -0
  176. package/get-shit-done/workflows/ui-review.md +157 -0
  177. package/get-shit-done/workflows/update.md +320 -0
  178. package/get-shit-done/workflows/validate-phase.md +167 -0
  179. package/get-shit-done/workflows/verify-phase.md +243 -0
  180. package/get-shit-done/workflows/verify-work.md +584 -0
  181. package/package.json +55 -0
  182. package/scripts/build-hooks.js +43 -0
  183. package/scripts/run-tests.cjs +29 -0
@@ -0,0 +1,468 @@
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/get-shit-done/workflows/execute-plan.md
123
+ @~/.claude/get-shit-done/templates/summary.md
124
+ @~/.claude/get-shit-done/references/checkpoints.md
125
+ @~/.claude/get-shit-done/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 a GSD 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 gate → returns 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/get-shit-done/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 GSD. 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>