@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,483 @@
1
+ <purpose>
2
+ Execute a phase prompt (PLAN.md) and create the outcome summary (SUMMARY.md).
3
+ </purpose>
4
+
5
+ <required_reading>
6
+ Read STATE.md before any operation to load project context.
7
+ Read config.json for planning behavior settings.
8
+
9
+ @~/.claude/get-shit-done/references/git-integration.md
10
+ </required_reading>
11
+
12
+ <process>
13
+
14
+ <step name="init_context" priority="first">
15
+ Load execution context (paths only to minimize orchestrator context):
16
+
17
+ ```bash
18
+ INIT=$(node "$HOME/.claude/ez-agents/bin/ez-tools.cjs" init execute-phase "${PHASE}")
19
+ if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi
20
+ ```
21
+
22
+ Extract from init JSON: `executor_model`, `commit_docs`, `phase_dir`, `phase_number`, `plans`, `summaries`, `incomplete_plans`, `state_path`, `config_path`.
23
+
24
+ If `.planning/` missing: error.
25
+ </step>
26
+
27
+ <step name="identify_plan">
28
+ ```bash
29
+ # Use plans/summaries from INIT JSON, or list files
30
+ ls .planning/phases/XX-name/*-PLAN.md 2>/dev/null | sort
31
+ ls .planning/phases/XX-name/*-SUMMARY.md 2>/dev/null | sort
32
+ ```
33
+
34
+ Find first PLAN without matching SUMMARY. Decimal phases supported (`01.1-hotfix/`):
35
+
36
+ ```bash
37
+ PHASE=$(echo "$PLAN_PATH" | grep -oE '[0-9]+(\.[0-9]+)?-[0-9]+')
38
+ # config settings can be fetched via gsd-tools config-get if needed
39
+ ```
40
+
41
+ <if mode="yolo">
42
+ Auto-approve: `⚡ Execute {phase}-{plan}-PLAN.md [Plan X of Y for Phase Z]` → parse_segments.
43
+ </if>
44
+
45
+ <if mode="interactive" OR="custom with gates.execute_next_plan true">
46
+ Present plan identification, wait for confirmation.
47
+ </if>
48
+ </step>
49
+
50
+ <step name="record_start_time">
51
+ ```bash
52
+ PLAN_START_TIME=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
53
+ PLAN_START_EPOCH=$(date +%s)
54
+ ```
55
+ </step>
56
+
57
+ <step name="parse_segments">
58
+ ```bash
59
+ grep -n "type=\"checkpoint" .planning/phases/XX-name/{phase}-{plan}-PLAN.md
60
+ ```
61
+
62
+ **Routing by checkpoint type:**
63
+
64
+ | Checkpoints | Pattern | Execution |
65
+ |-------------|---------|-----------|
66
+ | None | A (autonomous) | Single subagent: full plan + SUMMARY + commit |
67
+ | Verify-only | B (segmented) | Segments between checkpoints. After none/human-verify → SUBAGENT. After decision/human-action → MAIN |
68
+ | Decision | C (main) | Execute entirely in main context |
69
+
70
+ **Pattern A:** init_agent_tracking → spawn Task(subagent_type="ez-executor", model=executor_model) with prompt: execute plan at [path], autonomous, all tasks + SUMMARY + commit, follow deviation/auth rules, report: plan name, tasks, SUMMARY path, commit hash → track agent_id → wait → update tracking → report.
71
+
72
+ **Pattern B:** Execute segment-by-segment. Autonomous segments: spawn subagent for assigned tasks only (no SUMMARY/commit). Checkpoints: main context. After all segments: aggregate, create SUMMARY, commit. See segment_execution.
73
+
74
+ **Pattern C:** Execute in main using standard flow (step name="execute").
75
+
76
+ Fresh context per subagent preserves peak quality. Main context stays lean.
77
+ </step>
78
+
79
+ <step name="init_agent_tracking">
80
+ ```bash
81
+ if [ ! -f .planning/agent-history.json ]; then
82
+ echo '{"version":"1.0","max_entries":50,"entries":[]}' > .planning/agent-history.json
83
+ fi
84
+ rm -f .planning/current-agent-id.txt
85
+ if [ -f .planning/current-agent-id.txt ]; then
86
+ INTERRUPTED_ID=$(cat .planning/current-agent-id.txt)
87
+ echo "Found interrupted agent: $INTERRUPTED_ID"
88
+ fi
89
+ ```
90
+
91
+ If interrupted: ask user to resume (Task `resume` parameter) or start fresh.
92
+
93
+ **Tracking protocol:** On spawn: write agent_id to `current-agent-id.txt`, append to agent-history.json: `{"agent_id":"[id]","task_description":"[desc]","phase":"[phase]","plan":"[plan]","segment":[num|null],"timestamp":"[ISO]","status":"spawned","completion_timestamp":null}`. On completion: status → "completed", set completion_timestamp, delete current-agent-id.txt. Prune: if entries > max_entries, remove oldest "completed" (never "spawned").
94
+
95
+ Run for Pattern A/B before spawning. Pattern C: skip.
96
+ </step>
97
+
98
+ <step name="segment_execution">
99
+ Pattern B only (verify-only checkpoints). Skip for A/C.
100
+
101
+ 1. Parse segment map: checkpoint locations and types
102
+ 2. Per segment:
103
+ - Subagent route: spawn gsd-executor for assigned tasks only. Prompt: task range, plan path, read full plan for context, execute assigned tasks, track deviations, NO SUMMARY/commit. Track via agent protocol.
104
+ - Main route: execute tasks using standard flow (step name="execute")
105
+ 3. After ALL segments: aggregate files/deviations/decisions → create SUMMARY.md → commit → self-check:
106
+ - Verify key-files.created exist on disk with `[ -f ]`
107
+ - Check `git log --oneline --all --grep="{phase}-{plan}"` returns ≥1 commit
108
+ - Append `## Self-Check: PASSED` or `## Self-Check: FAILED` to SUMMARY
109
+
110
+ **Known Claude Code bug (classifyHandoffIfNeeded):** If any segment agent reports "failed" with `classifyHandoffIfNeeded is not defined`, this is a Claude Code runtime bug — not a real failure. Run spot-checks; if they pass, treat as successful.
111
+
112
+
113
+
114
+
115
+ </step>
116
+
117
+ <step name="load_prompt">
118
+ ```bash
119
+ cat .planning/phases/XX-name/{phase}-{plan}-PLAN.md
120
+ ```
121
+ This IS the execution instructions. Follow exactly. If plan references CONTEXT.md: honor user's vision throughout.
122
+
123
+ **If plan contains `<interfaces>` block:** These are pre-extracted type definitions and contracts. Use them directly — do NOT re-read the source files to discover types. The planner already extracted what you need.
124
+ </step>
125
+
126
+ <step name="previous_phase_check">
127
+ ```bash
128
+ node "$HOME/.claude/ez-agents/bin/ez-tools.cjs" phases list --type summaries --raw
129
+ # Extract the second-to-last summary from the JSON result
130
+ ```
131
+ If previous SUMMARY has unresolved "Issues Encountered" or "Next Phase Readiness" blockers: AskUserQuestion(header="Previous Issues", options: "Proceed anyway" | "Address first" | "Review previous").
132
+ </step>
133
+
134
+ <step name="execute">
135
+ Deviations are normal — handle via rules below.
136
+
137
+ 1. Read @context files from prompt
138
+ 2. Per task:
139
+ - **MANDATORY read_first gate:** If the task has a `<read_first>` field, you MUST read every listed file BEFORE making any edits. This is not optional. Do not skip files because you "already know" what's in them — read them. The read_first files establish ground truth for the task.
140
+ - `type="auto"`: if `tdd="true"` → TDD execution. Implement with deviation rules + auth gates. Verify done criteria. Commit (see task_commit). Track hash for Summary.
141
+ - `type="checkpoint:*"`: STOP → checkpoint_protocol → wait for user → continue only after confirmation.
142
+ - **MANDATORY acceptance_criteria check:** After completing each task, if it has `<acceptance_criteria>`, verify EVERY criterion before moving to the next task. Use grep, file reads, or CLI commands to confirm each criterion. If any criterion fails, fix the implementation before proceeding. Do not skip criteria or mark them as "will verify later".
143
+ 3. Run `<verification>` checks
144
+ 4. Confirm `<success_criteria>` met
145
+ 5. Document deviations in Summary
146
+ </step>
147
+
148
+ <authentication_gates>
149
+
150
+ ## Authentication Gates
151
+
152
+ Auth errors during execution are NOT failures — they're expected interaction points.
153
+
154
+ **Indicators:** "Not authenticated", "Unauthorized", 401/403, "Please run {tool} login", "Set {ENV_VAR}"
155
+
156
+ **Protocol:**
157
+ 1. Recognize auth gate (not a bug)
158
+ 2. STOP task execution
159
+ 3. Create dynamic checkpoint:human-action with exact auth steps
160
+ 4. Wait for user to authenticate
161
+ 5. Verify credentials work
162
+ 6. Retry original task
163
+ 7. Continue normally
164
+
165
+ **Example:** `vercel --yes` → "Not authenticated" → checkpoint asking user to `vercel login` → verify with `vercel whoami` → retry deploy → continue
166
+
167
+ **In Summary:** Document as normal flow under "## Authentication Gates", not as deviations.
168
+
169
+ </authentication_gates>
170
+
171
+ <deviation_rules>
172
+
173
+ ## Deviation Rules
174
+
175
+ You WILL discover unplanned work. Apply automatically, track all for Summary.
176
+
177
+ | Rule | Trigger | Action | Permission |
178
+ |------|---------|--------|------------|
179
+ | **1: Bug** | Broken behavior, errors, wrong queries, type errors, security vulns, race conditions, leaks | Fix → test → verify → track `[Rule 1 - Bug]` | Auto |
180
+ | **2: Missing Critical** | Missing essentials: error handling, validation, auth, CSRF/CORS, rate limiting, indexes, logging | Add → test → verify → track `[Rule 2 - Missing Critical]` | Auto |
181
+ | **3: Blocking** | Prevents completion: missing deps, wrong types, broken imports, missing env/config/files, circular deps | Fix blocker → verify proceeds → track `[Rule 3 - Blocking]` | Auto |
182
+ | **4: Architectural** | Structural change: new DB table, schema change, new service, switching libs, breaking API, new infra | STOP → present decision (below) → track `[Rule 4 - Architectural]` | Ask user |
183
+
184
+ **Rule 4 format:**
185
+ ```
186
+ ⚠️ Architectural Decision Needed
187
+
188
+ Current task: [task name]
189
+ Discovery: [what prompted this]
190
+ Proposed change: [modification]
191
+ Why needed: [rationale]
192
+ Impact: [what this affects]
193
+ Alternatives: [other approaches]
194
+
195
+ Proceed with proposed change? (yes / different approach / defer)
196
+ ```
197
+
198
+ **Priority:** Rule 4 (STOP) > Rules 1-3 (auto) > unsure → Rule 4
199
+ **Edge cases:** missing validation → R2 | null crash → R1 | new table → R4 | new column → R1/2
200
+ **Heuristic:** Affects correctness/security/completion? → R1-3. Maybe? → R4.
201
+
202
+ </deviation_rules>
203
+
204
+ <deviation_documentation>
205
+
206
+ ## Documenting Deviations
207
+
208
+ Summary MUST include deviations section. None? → `## Deviations from Plan\n\nNone - plan executed exactly as written.`
209
+
210
+ Per deviation: **[Rule N - Category] Title** — Found during: Task X | Issue | Fix | Files modified | Verification | Commit hash
211
+
212
+ End with: **Total deviations:** N auto-fixed (breakdown). **Impact:** assessment.
213
+
214
+ </deviation_documentation>
215
+
216
+ <tdd_plan_execution>
217
+ ## TDD Execution
218
+
219
+ For `type: tdd` plans — RED-GREEN-REFACTOR:
220
+
221
+ 1. **Infrastructure** (first TDD plan only): detect project, install framework, config, verify empty suite
222
+ 2. **RED:** Read `<behavior>` → failing test(s) → run (MUST fail) → commit: `test({phase}-{plan}): add failing test for [feature]`
223
+ 3. **GREEN:** Read `<implementation>` → minimal code → run (MUST pass) → commit: `feat({phase}-{plan}): implement [feature]`
224
+ 4. **REFACTOR:** Clean up → tests MUST pass → commit: `refactor({phase}-{plan}): clean up [feature]`
225
+
226
+ Errors: RED doesn't fail → investigate test/existing feature. GREEN doesn't pass → debug, iterate. REFACTOR breaks → undo.
227
+
228
+ See `~/.claude/get-shit-done/references/tdd.md` for structure.
229
+ </tdd_plan_execution>
230
+
231
+ <precommit_failure_handling>
232
+ ## Pre-commit Hook Failure Handling
233
+
234
+ Your commits may trigger pre-commit hooks. Auto-fix hooks handle themselves transparently — files get fixed and re-staged automatically.
235
+
236
+ If a commit is BLOCKED by a hook:
237
+
238
+ 1. The `git commit` command fails with hook error output
239
+ 2. Read the error — it tells you exactly which hook and what failed
240
+ 3. Fix the issue (type error, lint violation, secret leak, etc.)
241
+ 4. `git add` the fixed files
242
+ 5. Retry the commit
243
+ 6. Do NOT use `--no-verify`
244
+
245
+ This is normal and expected. Budget 1-2 retry cycles per commit.
246
+ </precommit_failure_handling>
247
+
248
+ <task_commit>
249
+ ## Task Commit Protocol
250
+
251
+ After each task (verification passed, done criteria met), commit immediately.
252
+
253
+ **1. Check:** `git status --short`
254
+
255
+ **2. Stage individually** (NEVER `git add .` or `git add -A`):
256
+ ```bash
257
+ git add src/api/auth.ts
258
+ git add src/types/user.ts
259
+ ```
260
+
261
+ **3. Commit type:**
262
+
263
+ | Type | When | Example |
264
+ |------|------|---------|
265
+ | `feat` | New functionality | feat(08-02): create user registration endpoint |
266
+ | `fix` | Bug fix | fix(08-02): correct email validation regex |
267
+ | `test` | Test-only (TDD RED) | test(08-02): add failing test for password hashing |
268
+ | `refactor` | No behavior change (TDD REFACTOR) | refactor(08-02): extract validation to helper |
269
+ | `perf` | Performance | perf(08-02): add database index |
270
+ | `docs` | Documentation | docs(08-02): add API docs |
271
+ | `style` | Formatting | style(08-02): format auth module |
272
+ | `chore` | Config/deps | chore(08-02): add bcrypt dependency |
273
+
274
+ **4. Format:** `{type}({phase}-{plan}): {description}` with bullet points for key changes.
275
+
276
+ **5. Record hash:**
277
+ ```bash
278
+ TASK_COMMIT=$(git rev-parse --short HEAD)
279
+ TASK_COMMITS+=("Task ${TASK_NUM}: ${TASK_COMMIT}")
280
+ ```
281
+
282
+ </task_commit>
283
+
284
+ <step name="checkpoint_protocol">
285
+ On `type="checkpoint:*"`: automate everything possible first. Checkpoints are for verification/decisions only.
286
+
287
+ Display: `CHECKPOINT: [Type]` box → Progress {X}/{Y} → Task name → type-specific content → `YOUR ACTION: [signal]`
288
+
289
+ | Type | Content | Resume signal |
290
+ |------|---------|---------------|
291
+ | human-verify (90%) | What was built + verification steps (commands/URLs) | "approved" or describe issues |
292
+ | decision (9%) | Decision needed + context + options with pros/cons | "Select: option-id" |
293
+ | human-action (1%) | What was automated + ONE manual step + verification plan | "done" |
294
+
295
+ After response: verify if specified. Pass → continue. Fail → inform, wait. WAIT for user — do NOT hallucinate completion.
296
+
297
+ See ~/.claude/get-shit-done/references/checkpoints.md for details.
298
+ </step>
299
+
300
+ <step name="checkpoint_return_for_orchestrator">
301
+ When spawned via Task and hitting checkpoint: return structured state (cannot interact with user directly).
302
+
303
+ **Required return:** 1) Completed Tasks table (hashes + files) 2) Current Task (what's blocking) 3) Checkpoint Details (user-facing content) 4) Awaiting (what's needed from user)
304
+
305
+ Orchestrator parses → presents to user → spawns fresh continuation with your completed tasks state. You will NOT be resumed. In main context: use checkpoint_protocol above.
306
+ </step>
307
+
308
+ <step name="verification_failure_gate">
309
+ If verification fails:
310
+
311
+ **Check if node repair is enabled** (default: on):
312
+ ```bash
313
+ NODE_REPAIR=$(node "./.claude/ez-agents/bin/ez-tools.cjs" config-get workflow.node_repair 2>/dev/null || echo "true")
314
+ ```
315
+
316
+ If `NODE_REPAIR` is `true`: invoke `@./.claude/get-shit-done/workflows/node-repair.md` with:
317
+ - FAILED_TASK: task number, name, done-criteria
318
+ - ERROR: expected vs actual result
319
+ - PLAN_CONTEXT: adjacent task names + phase goal
320
+ - REPAIR_BUDGET: `workflow.node_repair_budget` from config (default: 2)
321
+
322
+ Node repair will attempt RETRY, DECOMPOSE, or PRUNE autonomously. Only reaches this gate again if repair budget is exhausted (ESCALATE).
323
+
324
+ If `NODE_REPAIR` is `false` OR repair returns ESCALATE: STOP. Present: "Verification failed for Task [X]: [name]. Expected: [criteria]. Actual: [result]. Repair attempted: [summary of what was tried]." Options: Retry | Skip (mark incomplete) | Stop (investigate). If skipped → SUMMARY "Issues Encountered".
325
+ </step>
326
+
327
+ <step name="record_completion_time">
328
+ ```bash
329
+ PLAN_END_TIME=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
330
+ PLAN_END_EPOCH=$(date +%s)
331
+
332
+ DURATION_SEC=$(( PLAN_END_EPOCH - PLAN_START_EPOCH ))
333
+ DURATION_MIN=$(( DURATION_SEC / 60 ))
334
+
335
+ if [[ $DURATION_MIN -ge 60 ]]; then
336
+ HRS=$(( DURATION_MIN / 60 ))
337
+ MIN=$(( DURATION_MIN % 60 ))
338
+ DURATION="${HRS}h ${MIN}m"
339
+ else
340
+ DURATION="${DURATION_MIN} min"
341
+ fi
342
+ ```
343
+ </step>
344
+
345
+ <step name="generate_user_setup">
346
+ ```bash
347
+ grep -A 50 "^user_setup:" .planning/phases/XX-name/{phase}-{plan}-PLAN.md | head -50
348
+ ```
349
+
350
+ If user_setup exists: create `{phase}-USER-SETUP.md` using template `~/.claude/get-shit-done/templates/user-setup.md`. Per service: env vars table, account setup checklist, dashboard config, local dev notes, verification commands. Status "Incomplete". Set `USER_SETUP_CREATED=true`. If empty/missing: skip.
351
+ </step>
352
+
353
+ <step name="create_summary">
354
+ Create `{phase}-{plan}-SUMMARY.md` at `.planning/phases/XX-name/`. Use `~/.claude/get-shit-done/templates/summary.md`.
355
+
356
+ **Frontmatter:** phase, plan, subsystem, tags | requires/provides/affects | tech-stack.added/patterns | key-files.created/modified | key-decisions | requirements-completed (**MUST** copy `requirements` array from PLAN.md frontmatter verbatim) | duration ($DURATION), completed ($PLAN_END_TIME date).
357
+
358
+ Title: `# Phase [X] Plan [Y]: [Name] Summary`
359
+
360
+ One-liner SUBSTANTIVE: "JWT auth with refresh rotation using jose library" not "Authentication implemented"
361
+
362
+ Include: duration, start/end times, task count, file count.
363
+
364
+ Next: more plans → "Ready for {next-plan}" | last → "Phase complete, ready for transition".
365
+ </step>
366
+
367
+ <step name="update_current_position">
368
+ Update STATE.md using gsd-tools:
369
+
370
+ ```bash
371
+ # Advance plan counter (handles last-plan edge case)
372
+ node "$HOME/.claude/ez-agents/bin/ez-tools.cjs" state advance-plan
373
+
374
+ # Recalculate progress bar from disk state
375
+ node "$HOME/.claude/ez-agents/bin/ez-tools.cjs" state update-progress
376
+
377
+ # Record execution metrics
378
+ node "$HOME/.claude/ez-agents/bin/ez-tools.cjs" state record-metric \
379
+ --phase "${PHASE}" --plan "${PLAN}" --duration "${DURATION}" \
380
+ --tasks "${TASK_COUNT}" --files "${FILE_COUNT}"
381
+ ```
382
+ </step>
383
+
384
+ <step name="extract_decisions_and_issues">
385
+ From SUMMARY: Extract decisions and add to STATE.md:
386
+
387
+ ```bash
388
+ # Add each decision from SUMMARY key-decisions
389
+ # Prefer file inputs for shell-safe text (preserves `$`, `*`, etc. exactly)
390
+ node "$HOME/.claude/ez-agents/bin/ez-tools.cjs" state add-decision \
391
+ --phase "${PHASE}" --summary-file "${DECISION_TEXT_FILE}" --rationale-file "${RATIONALE_FILE}"
392
+
393
+ # Add blockers if any found
394
+ node "$HOME/.claude/ez-agents/bin/ez-tools.cjs" state add-blocker --text-file "${BLOCKER_TEXT_FILE}"
395
+ ```
396
+ </step>
397
+
398
+ <step name="update_session_continuity">
399
+ Update session info using gsd-tools:
400
+
401
+ ```bash
402
+ node "$HOME/.claude/ez-agents/bin/ez-tools.cjs" state record-session \
403
+ --stopped-at "Completed ${PHASE}-${PLAN}-PLAN.md" \
404
+ --resume-file "None"
405
+ ```
406
+
407
+ Keep STATE.md under 150 lines.
408
+ </step>
409
+
410
+ <step name="issues_review_gate">
411
+ If SUMMARY "Issues Encountered" ≠ "None": yolo → log and continue. Interactive → present issues, wait for acknowledgment.
412
+ </step>
413
+
414
+ <step name="update_roadmap">
415
+ ```bash
416
+ node "$HOME/.claude/ez-agents/bin/ez-tools.cjs" roadmap update-plan-progress "${PHASE}"
417
+ ```
418
+ Counts PLAN vs SUMMARY files on disk. Updates progress table row with correct count and status (`In Progress` or `Complete` with date).
419
+ </step>
420
+
421
+ <step name="update_requirements">
422
+ Mark completed requirements from the PLAN.md frontmatter `requirements:` field:
423
+
424
+ ```bash
425
+ node "$HOME/.claude/ez-agents/bin/ez-tools.cjs" requirements mark-complete ${REQ_IDS}
426
+ ```
427
+
428
+ Extract requirement IDs from the plan's frontmatter (e.g., `requirements: [AUTH-01, AUTH-02]`). If no requirements field, skip.
429
+ </step>
430
+
431
+ <step name="git_commit_metadata">
432
+ Task code already committed per-task. Commit plan metadata:
433
+
434
+ ```bash
435
+ node "$HOME/.claude/ez-agents/bin/ez-tools.cjs" commit "docs({phase}-{plan}): complete [plan-name] plan" --files .planning/phases/XX-name/{phase}-{plan}-SUMMARY.md .planning/STATE.md .planning/ROADMAP.md .planning/REQUIREMENTS.md
436
+ ```
437
+ </step>
438
+
439
+ <step name="update_codebase_map">
440
+ If .planning/codebase/ doesn't exist: skip.
441
+
442
+ ```bash
443
+ FIRST_TASK=$(git log --oneline --grep="feat({phase}-{plan}):" --grep="fix({phase}-{plan}):" --grep="test({phase}-{plan}):" --reverse | head -1 | cut -d' ' -f1)
444
+ git diff --name-only ${FIRST_TASK}^..HEAD 2>/dev/null
445
+ ```
446
+
447
+ Update only structural changes: new src/ dir → STRUCTURE.md | deps → STACK.md | file pattern → CONVENTIONS.md | API client → INTEGRATIONS.md | config → STACK.md | renamed → update paths. Skip code-only/bugfix/content changes.
448
+
449
+ ```bash
450
+ node "$HOME/.claude/ez-agents/bin/ez-tools.cjs" commit "" --files .planning/codebase/*.md --amend
451
+ ```
452
+ </step>
453
+
454
+ <step name="offer_next">
455
+ If `USER_SETUP_CREATED=true`: display `⚠️ USER SETUP REQUIRED` with path + env/config tasks at TOP.
456
+
457
+ ```bash
458
+ ls -1 .planning/phases/[current-phase-dir]/*-PLAN.md 2>/dev/null | wc -l
459
+ ls -1 .planning/phases/[current-phase-dir]/*-SUMMARY.md 2>/dev/null | wc -l
460
+ ```
461
+
462
+ | Condition | Route | Action |
463
+ |-----------|-------|--------|
464
+ | summaries < plans | **A: More plans** | Find next PLAN without SUMMARY. Yolo: auto-continue. Interactive: show next plan, suggest `/ez:execute-phase {phase}` + `/ez:verify-work`. STOP here. |
465
+ | summaries = plans, current < highest phase | **B: Phase done** | Show completion, suggest `/ez:plan-phase {Z+1}` + `/ez:verify-work {Z}` + `/ez:discuss-phase {Z+1}` |
466
+ | summaries = plans, current = highest phase | **C: Milestone done** | Show banner, suggest `/ez:complete-milestone` + `/ez:verify-work` + `/ez:add-phase` |
467
+
468
+ All routes: `/clear` first for fresh context.
469
+ </step>
470
+
471
+ </process>
472
+
473
+ <success_criteria>
474
+
475
+ - All tasks from PLAN.md completed
476
+ - All verifications pass
477
+ - USER-SETUP.md generated if user_setup in frontmatter
478
+ - SUMMARY.md created with substantive content
479
+ - STATE.md updated (position, decisions, issues, session)
480
+ - ROADMAP.md updated
481
+ - If codebase map exists: map updated with execution changes (or skipped if no significant changes)
482
+ - If USER-SETUP.md created: prominently surfaced in completion output
483
+ </success_criteria>
@@ -0,0 +1,159 @@
1
+ <purpose>
2
+ Validate `.planning/` directory integrity and report actionable issues. Checks for missing files, invalid configurations, inconsistent state, and orphaned plans. Optionally repairs auto-fixable issues.
3
+ </purpose>
4
+
5
+ <required_reading>
6
+ Read all files referenced by the invoking prompt's execution_context before starting.
7
+ </required_reading>
8
+
9
+ <process>
10
+
11
+ <step name="parse_args">
12
+ **Parse arguments:**
13
+
14
+ Check if `--repair` flag is present in the command arguments.
15
+
16
+ ```
17
+ REPAIR_FLAG=""
18
+ if arguments contain "--repair"; then
19
+ REPAIR_FLAG="--repair"
20
+ fi
21
+ ```
22
+ </step>
23
+
24
+ <step name="run_health_check">
25
+ **Run health validation:**
26
+
27
+ ```bash
28
+ node "$HOME/.claude/ez-agents/bin/ez-tools.cjs" validate health $REPAIR_FLAG
29
+ ```
30
+
31
+ Parse JSON output:
32
+ - `status`: "healthy" | "degraded" | "broken"
33
+ - `errors[]`: Critical issues (code, message, fix, repairable)
34
+ - `warnings[]`: Non-critical issues
35
+ - `info[]`: Informational notes
36
+ - `repairable_count`: Number of auto-fixable issues
37
+ - `repairs_performed[]`: Actions taken if --repair was used
38
+ </step>
39
+
40
+ <step name="format_output">
41
+ **Format and display results:**
42
+
43
+ ```
44
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
45
+ GSD Health Check
46
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
47
+
48
+ Status: HEALTHY | DEGRADED | BROKEN
49
+ Errors: N | Warnings: N | Info: N
50
+ ```
51
+
52
+ **If repairs were performed:**
53
+ ```
54
+ ## Repairs Performed
55
+
56
+ - ✓ config.json: Created with defaults
57
+ - ✓ STATE.md: Regenerated from roadmap
58
+ ```
59
+
60
+ **If errors exist:**
61
+ ```
62
+ ## Errors
63
+
64
+ - [E001] config.json: JSON parse error at line 5
65
+ Fix: Run /ez:health --repair to reset to defaults
66
+
67
+ - [E002] PROJECT.md not found
68
+ Fix: Run /ez:new-project to create
69
+ ```
70
+
71
+ **If warnings exist:**
72
+ ```
73
+ ## Warnings
74
+
75
+ - [W001] STATE.md references phase 5, but only phases 1-3 exist
76
+ Fix: Run /ez:health --repair to regenerate
77
+
78
+ - [W005] Phase directory "1-setup" doesn't follow NN-name format
79
+ Fix: Rename to match pattern (e.g., 01-setup)
80
+ ```
81
+
82
+ **If info exists:**
83
+ ```
84
+ ## Info
85
+
86
+ - [I001] 02-implementation/02-01-PLAN.md has no SUMMARY.md
87
+ Note: May be in progress
88
+ ```
89
+
90
+ **Footer (if repairable issues exist and --repair was NOT used):**
91
+ ```
92
+ ---
93
+ N issues can be auto-repaired. Run: /ez:health --repair
94
+ ```
95
+ </step>
96
+
97
+ <step name="offer_repair">
98
+ **If repairable issues exist and --repair was NOT used:**
99
+
100
+ Ask user if they want to run repairs:
101
+
102
+ ```
103
+ Would you like to run /ez:health --repair to fix N issues automatically?
104
+ ```
105
+
106
+ If yes, re-run with --repair flag and display results.
107
+ </step>
108
+
109
+ <step name="verify_repairs">
110
+ **If repairs were performed:**
111
+
112
+ Re-run health check without --repair to confirm issues are resolved:
113
+
114
+ ```bash
115
+ node "$HOME/.claude/ez-agents/bin/ez-tools.cjs" validate health
116
+ ```
117
+
118
+ Report final status.
119
+ </step>
120
+
121
+ </process>
122
+
123
+ <error_codes>
124
+
125
+ | Code | Severity | Description | Repairable |
126
+ |------|----------|-------------|------------|
127
+ | E001 | error | .planning/ directory not found | No |
128
+ | E002 | error | PROJECT.md not found | No |
129
+ | E003 | error | ROADMAP.md not found | No |
130
+ | E004 | error | STATE.md not found | Yes |
131
+ | E005 | error | config.json parse error | Yes |
132
+ | W001 | warning | PROJECT.md missing required section | No |
133
+ | W002 | warning | STATE.md references invalid phase | Yes |
134
+ | W003 | warning | config.json not found | Yes |
135
+ | W004 | warning | config.json invalid field value | No |
136
+ | W005 | warning | Phase directory naming mismatch | No |
137
+ | W006 | warning | Phase in ROADMAP but no directory | No |
138
+ | W007 | warning | Phase on disk but not in ROADMAP | No |
139
+ | W008 | warning | config.json: workflow.nyquist_validation absent (defaults to enabled but agents may skip) | Yes |
140
+ | W009 | warning | Phase has Validation Architecture in RESEARCH.md but no VALIDATION.md | No |
141
+ | I001 | info | Plan without SUMMARY (may be in progress) | No |
142
+
143
+ </error_codes>
144
+
145
+ <repair_actions>
146
+
147
+ | Action | Effect | Risk |
148
+ |--------|--------|------|
149
+ | createConfig | Create config.json with defaults | None |
150
+ | resetConfig | Delete + recreate config.json | Loses custom settings |
151
+ | regenerateState | Create STATE.md from ROADMAP structure | Loses session history |
152
+ | addNyquistKey | Add workflow.nyquist_validation: true to config.json | None — matches existing default |
153
+
154
+ **Not repairable (too risky):**
155
+ - PROJECT.md, ROADMAP.md content
156
+ - Phase directory renaming
157
+ - Orphaned plan cleanup
158
+
159
+ </repair_actions>