@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,762 @@
1
+ <purpose>
2
+ Extract implementation decisions that downstream agents need. Analyze the phase to identify gray areas, let the user choose what to discuss, then deep-dive each selected area until satisfied.
3
+
4
+ You are a thinking partner, not an interviewer. The user is the visionary — you are the builder. Your job is to capture decisions that will guide research and planning, not to figure out implementation yourself.
5
+ </purpose>
6
+
7
+ <downstream_awareness>
8
+ **CONTEXT.md feeds into:**
9
+
10
+ 1. **gsd-phase-researcher** — Reads CONTEXT.md to know WHAT to research
11
+ - "User wants card-based layout" → researcher investigates card component patterns
12
+ - "Infinite scroll decided" → researcher looks into virtualization libraries
13
+
14
+ 2. **gsd-planner** — Reads CONTEXT.md to know WHAT decisions are locked
15
+ - "Pull-to-refresh on mobile" → planner includes that in task specs
16
+ - "Claude's Discretion: loading skeleton" → planner can decide approach
17
+
18
+ **Your job:** Capture decisions clearly enough that downstream agents can act on them without asking the user again.
19
+
20
+ **Not your job:** Figure out HOW to implement. That's what research and planning do with the decisions you capture.
21
+ </downstream_awareness>
22
+
23
+ <philosophy>
24
+ **User = founder/visionary. Claude = builder.**
25
+
26
+ The user knows:
27
+ - How they imagine it working
28
+ - What it should look/feel like
29
+ - What's essential vs nice-to-have
30
+ - Specific behaviors or references they have in mind
31
+
32
+ The user doesn't know (and shouldn't be asked):
33
+ - Codebase patterns (researcher reads the code)
34
+ - Technical risks (researcher identifies these)
35
+ - Implementation approach (planner figures this out)
36
+ - Success metrics (inferred from the work)
37
+
38
+ Ask about vision and implementation choices. Capture decisions for downstream agents.
39
+ </philosophy>
40
+
41
+ <scope_guardrail>
42
+ **CRITICAL: No scope creep.**
43
+
44
+ The phase boundary comes from ROADMAP.md and is FIXED. Discussion clarifies HOW to implement what's scoped, never WHETHER to add new capabilities.
45
+
46
+ **Allowed (clarifying ambiguity):**
47
+ - "How should posts be displayed?" (layout, density, info shown)
48
+ - "What happens on empty state?" (within the feature)
49
+ - "Pull to refresh or manual?" (behavior choice)
50
+
51
+ **Not allowed (scope creep):**
52
+ - "Should we also add comments?" (new capability)
53
+ - "What about search/filtering?" (new capability)
54
+ - "Maybe include bookmarking?" (new capability)
55
+
56
+ **The heuristic:** Does this clarify how we implement what's already in the phase, or does it add a new capability that could be its own phase?
57
+
58
+ **When user suggests scope creep:**
59
+ ```
60
+ "[Feature X] would be a new capability — that's its own phase.
61
+ Want me to note it for the roadmap backlog?
62
+
63
+ For now, let's focus on [phase domain]."
64
+ ```
65
+
66
+ Capture the idea in a "Deferred Ideas" section. Don't lose it, don't act on it.
67
+ </scope_guardrail>
68
+
69
+ <gray_area_identification>
70
+ Gray areas are **implementation decisions the user cares about** — things that could go multiple ways and would change the result.
71
+
72
+ **How to identify gray areas:**
73
+
74
+ 1. **Read the phase goal** from ROADMAP.md
75
+ 2. **Understand the domain** — What kind of thing is being built?
76
+ - Something users SEE → visual presentation, interactions, states matter
77
+ - Something users CALL → interface contracts, responses, errors matter
78
+ - Something users RUN → invocation, output, behavior modes matter
79
+ - Something users READ → structure, tone, depth, flow matter
80
+ - Something being ORGANIZED → criteria, grouping, handling exceptions matter
81
+ 3. **Generate phase-specific gray areas** — Not generic categories, but concrete decisions for THIS phase
82
+
83
+ **Don't use generic category labels** (UI, UX, Behavior). Generate specific gray areas:
84
+
85
+ ```
86
+ Phase: "User authentication"
87
+ → Session handling, Error responses, Multi-device policy, Recovery flow
88
+
89
+ Phase: "Organize photo library"
90
+ → Grouping criteria, Duplicate handling, Naming convention, Folder structure
91
+
92
+ Phase: "CLI for database backups"
93
+ → Output format, Flag design, Progress reporting, Error recovery
94
+
95
+ Phase: "API documentation"
96
+ → Structure/navigation, Code examples depth, Versioning approach, Interactive elements
97
+ ```
98
+
99
+ **The key question:** What decisions would change the outcome that the user should weigh in on?
100
+
101
+ **Claude handles these (don't ask):**
102
+ - Technical implementation details
103
+ - Architecture patterns
104
+ - Performance optimization
105
+ - Scope (roadmap defines this)
106
+ </gray_area_identification>
107
+
108
+ <answer_validation>
109
+ **IMPORTANT: Answer validation** — After every AskUserQuestion call, check if the response is empty or whitespace-only. If so:
110
+ 1. Retry the question once with the same parameters
111
+ 2. If still empty, present the options as a plain-text numbered list and ask the user to type their choice number
112
+ Never proceed with an empty answer.
113
+ </answer_validation>
114
+
115
+ <process>
116
+
117
+ **Express path available:** If you already have a PRD or acceptance criteria document, use `/ez:plan-phase {phase} --prd path/to/prd.md` to skip this discussion and go straight to planning.
118
+
119
+ <step name="initialize" priority="first">
120
+ Phase number from argument (required).
121
+
122
+ ```bash
123
+ INIT=$(node "$HOME/.claude/ez-agents/bin/ez-tools.cjs" init phase-op "${PHASE}")
124
+ if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi
125
+ ```
126
+
127
+ Parse JSON for: `commit_docs`, `phase_found`, `phase_dir`, `phase_number`, `phase_name`, `phase_slug`, `padded_phase`, `has_research`, `has_context`, `has_plans`, `has_verification`, `plan_count`, `roadmap_exists`, `planning_exists`.
128
+
129
+ **If `phase_found` is false:**
130
+ ```
131
+ Phase [X] not found in roadmap.
132
+
133
+ Use /ez:progress to see available phases.
134
+ ```
135
+ Exit workflow.
136
+
137
+ **If `phase_found` is true:** Continue to check_existing.
138
+
139
+ **Auto mode** — If `--auto` is present in ARGUMENTS:
140
+ - In `check_existing`: auto-select "Skip" (if context exists) or continue without prompting (if no context/plans)
141
+ - In `present_gray_areas`: auto-select ALL gray areas without asking the user
142
+ - In `discuss_areas`: for each discussion question, choose the recommended option (first option, or the one marked "recommended") without using AskUserQuestion
143
+ - Log each auto-selected choice inline so the user can review decisions in the context file
144
+ - After discussion completes, auto-advance to plan-phase (existing behavior)
145
+ </step>
146
+
147
+ <step name="check_existing">
148
+ Check if CONTEXT.md already exists using `has_context` from init.
149
+
150
+ ```bash
151
+ ls ${phase_dir}/*-CONTEXT.md 2>/dev/null
152
+ ```
153
+
154
+ **If exists:**
155
+
156
+ **If `--auto`:** Auto-select "Update it" — load existing context and continue to analyze_phase. Log: `[auto] Context exists — updating with auto-selected decisions.`
157
+
158
+ **Otherwise:** Use AskUserQuestion:
159
+ - header: "Context"
160
+ - question: "Phase [X] already has context. What do you want to do?"
161
+ - options:
162
+ - "Update it" — Review and revise existing context
163
+ - "View it" — Show me what's there
164
+ - "Skip" — Use existing context as-is
165
+
166
+ If "Update": Load existing, continue to analyze_phase
167
+ If "View": Display CONTEXT.md, then offer update/skip
168
+ If "Skip": Exit workflow
169
+
170
+ **If doesn't exist:**
171
+
172
+ Check `has_plans` and `plan_count` from init. **If `has_plans` is true:**
173
+
174
+ **If `--auto`:** Auto-select "Continue and replan after". Log: `[auto] Plans exist — continuing with context capture, will replan after.`
175
+
176
+ **Otherwise:** Use AskUserQuestion:
177
+ - header: "Plans exist"
178
+ - question: "Phase [X] already has {plan_count} plan(s) created without user context. Your decisions here won't affect existing plans unless you replan."
179
+ - options:
180
+ - "Continue and replan after" — Capture context, then run /ez:plan-phase {X} to replan
181
+ - "View existing plans" — Show plans before deciding
182
+ - "Cancel" — Skip discuss-phase
183
+
184
+ If "Continue and replan after": Continue to analyze_phase.
185
+ If "View existing plans": Display plan files, then offer "Continue" / "Cancel".
186
+ If "Cancel": Exit workflow.
187
+
188
+ **If `has_plans` is false:** Continue to load_prior_context.
189
+ </step>
190
+
191
+ <step name="load_prior_context">
192
+ Read project-level and prior phase context to avoid re-asking decided questions and maintain consistency.
193
+
194
+ **Step 1: Read project-level files**
195
+ ```bash
196
+ # Core project files
197
+ cat .planning/PROJECT.md 2>/dev/null
198
+ cat .planning/REQUIREMENTS.md 2>/dev/null
199
+ cat .planning/STATE.md 2>/dev/null
200
+ ```
201
+
202
+ Extract from these:
203
+ - **PROJECT.md** — Vision, principles, non-negotiables, user preferences
204
+ - **REQUIREMENTS.md** — Acceptance criteria, constraints, must-haves vs nice-to-haves
205
+ - **STATE.md** — Current progress, any flags or session notes
206
+
207
+ **Step 2: Read all prior CONTEXT.md files**
208
+ ```bash
209
+ # Find all CONTEXT.md files from phases before current
210
+ find .planning/phases -name "*-CONTEXT.md" 2>/dev/null | sort
211
+ ```
212
+
213
+ For each CONTEXT.md where phase number < current phase:
214
+ - Read the `<decisions>` section — these are locked preferences
215
+ - Read `<specifics>` — particular references or "I want it like X" moments
216
+ - Note any patterns (e.g., "user consistently prefers minimal UI", "user rejected single-key shortcuts")
217
+
218
+ **Step 3: Build internal `<prior_decisions>` context**
219
+
220
+ Structure the extracted information:
221
+ ```
222
+ <prior_decisions>
223
+ ## Project-Level
224
+ - [Key principle or constraint from PROJECT.md]
225
+ - [Requirement that affects this phase from REQUIREMENTS.md]
226
+
227
+ ## From Prior Phases
228
+ ### Phase N: [Name]
229
+ - [Decision that may be relevant to current phase]
230
+ - [Preference that establishes a pattern]
231
+
232
+ ### Phase M: [Name]
233
+ - [Another relevant decision]
234
+ </prior_decisions>
235
+ ```
236
+
237
+ **Usage in subsequent steps:**
238
+ - `analyze_phase`: Skip gray areas already decided in prior phases
239
+ - `present_gray_areas`: Annotate options with prior decisions ("You chose X in Phase 5")
240
+ - `discuss_areas`: Pre-fill answers or flag conflicts ("This contradicts Phase 3 — same here or different?")
241
+
242
+ **If no prior context exists:** Continue without — this is expected for early phases.
243
+ </step>
244
+
245
+ <step name="scout_codebase">
246
+ Lightweight scan of existing code to inform gray area identification and discussion. Uses ~10% context — acceptable for an interactive session.
247
+
248
+ **Step 1: Check for existing codebase maps**
249
+ ```bash
250
+ ls .planning/codebase/*.md 2>/dev/null
251
+ ```
252
+
253
+ **If codebase maps exist:** Read the most relevant ones (CONVENTIONS.md, STRUCTURE.md, STACK.md based on phase type). Extract:
254
+ - Reusable components/hooks/utilities
255
+ - Established patterns (state management, styling, data fetching)
256
+ - Integration points (where new code would connect)
257
+
258
+ Skip to Step 3 below.
259
+
260
+ **Step 2: If no codebase maps, do targeted grep**
261
+
262
+ Extract key terms from the phase goal (e.g., "feed" → "post", "card", "list"; "auth" → "login", "session", "token").
263
+
264
+ ```bash
265
+ # Find files related to phase goal terms
266
+ grep -rl "{term1}\|{term2}" src/ app/ --include="*.ts" --include="*.tsx" --include="*.js" --include="*.jsx" 2>/dev/null | head -10
267
+
268
+ # Find existing components/hooks
269
+ ls src/components/ 2>/dev/null
270
+ ls src/hooks/ 2>/dev/null
271
+ ls src/lib/ src/utils/ 2>/dev/null
272
+ ```
273
+
274
+ Read the 3-5 most relevant files to understand existing patterns.
275
+
276
+ **Step 3: Build internal codebase_context**
277
+
278
+ From the scan, identify:
279
+ - **Reusable assets** — existing components, hooks, utilities that could be used in this phase
280
+ - **Established patterns** — how the codebase does state management, styling, data fetching
281
+ - **Integration points** — where new code would connect (routes, nav, providers)
282
+ - **Creative options** — approaches the existing architecture enables or constrains
283
+
284
+ Store as internal `<codebase_context>` for use in analyze_phase and present_gray_areas. This is NOT written to a file — it's used within this session only.
285
+ </step>
286
+
287
+ <step name="analyze_phase">
288
+ Analyze the phase to identify gray areas worth discussing. **Use both `prior_decisions` and `codebase_context` to ground the analysis.**
289
+
290
+ **Read the phase description from ROADMAP.md and determine:**
291
+
292
+ 1. **Domain boundary** — What capability is this phase delivering? State it clearly.
293
+
294
+ 1b. **Initialize canonical refs accumulator** — Start building the `<canonical_refs>` list for CONTEXT.md. This accumulates throughout the entire discussion, not just this step.
295
+
296
+ **Source 1 (now):** Copy `Canonical refs:` from ROADMAP.md for this phase. Expand each to a full relative path.
297
+ **Source 2 (now):** Check REQUIREMENTS.md and PROJECT.md for any specs/ADRs referenced for this phase.
298
+ **Source 3 (scout_codebase):** If existing code references docs (e.g., comments citing ADRs), add those.
299
+ **Source 4 (discuss_areas):** When the user says "read X", "check Y", or references any doc/spec/ADR during discussion — add it immediately. These are often the MOST important refs because they represent docs the user specifically wants followed.
300
+
301
+ This list is MANDATORY in CONTEXT.md. Every ref must have a full relative path so downstream agents can read it directly. If no external docs exist, note that explicitly.
302
+
303
+ 2. **Check prior decisions** — Before generating gray areas, check if any were already decided:
304
+ - Scan `<prior_decisions>` for relevant choices (e.g., "Ctrl+C only, no single-key shortcuts")
305
+ - These are **pre-answered** — don't re-ask unless this phase has conflicting needs
306
+ - Note applicable prior decisions for use in presentation
307
+
308
+ 3. **Gray areas by category** — For each relevant category (UI, UX, Behavior, Empty States, Content), identify 1-2 specific ambiguities that would change implementation. **Annotate with code context where relevant** (e.g., "You already have a Card component" or "No existing pattern for this").
309
+
310
+ 4. **Skip assessment** — If no meaningful gray areas exist (pure infrastructure, clear-cut implementation, or all already decided in prior phases), the phase may not need discussion.
311
+
312
+ **Output your analysis internally, then present to user.**
313
+
314
+ Example analysis for "Post Feed" phase (with code and prior context):
315
+ ```
316
+ Domain: Displaying posts from followed users
317
+ Existing: Card component (src/components/ui/Card.tsx), useInfiniteQuery hook, Tailwind CSS
318
+ Prior decisions: "Minimal UI preferred" (Phase 2), "No pagination — always infinite scroll" (Phase 4)
319
+ Gray areas:
320
+ - UI: Layout style (cards vs timeline vs grid) — Card component exists with shadow/rounded variants
321
+ - UI: Information density (full posts vs previews) — no existing density patterns
322
+ - Behavior: Loading pattern — ALREADY DECIDED: infinite scroll (Phase 4)
323
+ - Empty State: What shows when no posts exist — EmptyState component exists in ui/
324
+ - Content: What metadata displays (time, author, reactions count)
325
+ ```
326
+ </step>
327
+
328
+ <step name="present_gray_areas">
329
+ Present the domain boundary, prior decisions, and gray areas to user.
330
+
331
+ **First, state the boundary and any prior decisions that apply:**
332
+ ```
333
+ Phase [X]: [Name]
334
+ Domain: [What this phase delivers — from your analysis]
335
+
336
+ We'll clarify HOW to implement this.
337
+ (New capabilities belong in other phases.)
338
+
339
+ [If prior decisions apply:]
340
+ **Carrying forward from earlier phases:**
341
+ - [Decision from Phase N that applies here]
342
+ - [Decision from Phase M that applies here]
343
+ ```
344
+
345
+ **If `--auto`:** Auto-select ALL gray areas. Log: `[auto] Selected all gray areas: [list area names].` Skip the AskUserQuestion below and continue directly to discuss_areas with all areas selected.
346
+
347
+ **Otherwise, use AskUserQuestion (multiSelect: true):**
348
+ - header: "Discuss"
349
+ - question: "Which areas do you want to discuss for [phase name]?"
350
+ - options: Generate 3-4 phase-specific gray areas, each with:
351
+ - "[Specific area]" (label) — concrete, not generic
352
+ - [1-2 questions this covers + code context annotation] (description)
353
+ - **Highlight the recommended choice with brief explanation why**
354
+
355
+ **Prior decision annotations:** When a gray area was already decided in a prior phase, annotate it:
356
+ ```
357
+ ☐ Exit shortcuts — How should users quit?
358
+ (You decided "Ctrl+C only, no single-key shortcuts" in Phase 5 — revisit or keep?)
359
+ ```
360
+
361
+ **Code context annotations:** When the scout found relevant existing code, annotate the gray area description:
362
+ ```
363
+ ☐ Layout style — Cards vs list vs timeline?
364
+ (You already have a Card component with shadow/rounded variants. Reusing it keeps the app consistent.)
365
+ ```
366
+
367
+ **Combining both:** When both prior decisions and code context apply:
368
+ ```
369
+ ☐ Loading behavior — Infinite scroll or pagination?
370
+ (You chose infinite scroll in Phase 4. useInfiniteQuery hook already set up.)
371
+ ```
372
+
373
+ **Do NOT include a "skip" or "you decide" option.** User ran this command to discuss — give them real choices.
374
+
375
+ **Examples by domain (with code context):**
376
+
377
+ For "Post Feed" (visual feature):
378
+ ```
379
+ ☐ Layout style — Cards vs list vs timeline? (Card component exists with variants)
380
+ ☐ Loading behavior — Infinite scroll or pagination? (useInfiniteQuery hook available)
381
+ ☐ Content ordering — Chronological, algorithmic, or user choice?
382
+ ☐ Post metadata — What info per post? Timestamps, reactions, author?
383
+ ```
384
+
385
+ For "Database backup CLI" (command-line tool):
386
+ ```
387
+ ☐ Output format — JSON, table, or plain text? Verbosity levels?
388
+ ☐ Flag design — Short flags, long flags, or both? Required vs optional?
389
+ ☐ Progress reporting — Silent, progress bar, or verbose logging?
390
+ ☐ Error recovery — Fail fast, retry, or prompt for action?
391
+ ```
392
+
393
+ For "Organize photo library" (organization task):
394
+ ```
395
+ ☐ Grouping criteria — By date, location, faces, or events?
396
+ ☐ Duplicate handling — Keep best, keep all, or prompt each time?
397
+ ☐ Naming convention — Original names, dates, or descriptive?
398
+ ☐ Folder structure — Flat, nested by year, or by category?
399
+ ```
400
+
401
+ Continue to discuss_areas with selected areas.
402
+ </step>
403
+
404
+ <step name="discuss_areas">
405
+ For each selected area, conduct a focused discussion loop.
406
+
407
+ **Batch mode support:** Parse optional `--batch` from `$ARGUMENTS`.
408
+ - Accept `--batch`, `--batch=N`, or `--batch N`
409
+ - Default to 4 questions per batch when no number is provided
410
+ - Clamp explicit sizes to 2-5 so a batch stays answerable
411
+ - If `--batch` is absent, keep the existing one-question-at-a-time flow
412
+
413
+ **Philosophy:** stay adaptive, but let the user choose the pacing.
414
+ - Default mode: 4 single-question turns, then check whether to continue
415
+ - `--batch` mode: 1 grouped turn with 2-5 numbered questions, then check whether to continue
416
+
417
+ Each answer (or answer set, in batch mode) should reveal the next question or next batch.
418
+
419
+ **Auto mode (`--auto`):** For each area, Claude selects the recommended option (first option, or the one explicitly marked "recommended") for every question without using AskUserQuestion. Log each auto-selected choice:
420
+ ```
421
+ [auto] [Area] — Q: "[question text]" → Selected: "[chosen option]" (recommended default)
422
+ ```
423
+ After all areas are auto-resolved, skip the "Explore more gray areas" prompt and proceed directly to write_context.
424
+
425
+ **Interactive mode (no `--auto`):**
426
+
427
+ **For each area:**
428
+
429
+ 1. **Announce the area:**
430
+ ```
431
+ Let's talk about [Area].
432
+ ```
433
+
434
+ 2. **Ask questions using the selected pacing:**
435
+
436
+ **Default (no `--batch`): Ask 4 questions using AskUserQuestion**
437
+ - header: "[Area]" (max 12 chars — abbreviate if needed)
438
+ - question: Specific decision for this area
439
+ - options: 2-3 concrete choices (AskUserQuestion adds "Other" automatically), with the recommended choice highlighted and brief explanation why
440
+ - **Annotate options with code context** when relevant:
441
+ ```
442
+ "How should posts be displayed?"
443
+ - Cards (reuses existing Card component — consistent with Messages)
444
+ - List (simpler, would be a new pattern)
445
+ - Timeline (needs new Timeline component — none exists yet)
446
+ ```
447
+ - Include "You decide" as an option when reasonable — captures Claude discretion
448
+ - **Context7 for library choices:** When a gray area involves library selection (e.g., "magic links" → query next-auth docs) or API approach decisions, use `mcp__context7__*` tools to fetch current documentation and inform the options. Don't use Context7 for every question — only when library-specific knowledge improves the options.
449
+
450
+ **Batch mode (`--batch`): Ask 2-5 numbered questions in one plain-text turn**
451
+ - Group closely related questions for the current area into a single message
452
+ - Keep each question concrete and answerable in one reply
453
+ - When options are helpful, include short inline choices per question rather than a separate AskUserQuestion for every item
454
+ - After the user replies, reflect back the captured decisions, note any unanswered items, and ask only the minimum follow-up needed before moving on
455
+ - Preserve adaptiveness between batches: use the full set of answers to decide the next batch or whether the area is sufficiently clear
456
+
457
+ 3. **After the current set of questions, check:**
458
+ - header: "[Area]" (max 12 chars)
459
+ - question: "More questions about [area], or move to next?"
460
+ - options: "More questions" / "Next area"
461
+
462
+ If "More questions" → ask another 4 single questions, or another 2-5 question batch when `--batch` is active, then check again
463
+ If "Next area" → proceed to next selected area
464
+ If "Other" (free text) → interpret intent: continuation phrases ("chat more", "keep going", "yes", "more") map to "More questions"; advancement phrases ("done", "move on", "next", "skip") map to "Next area". If ambiguous, ask: "Continue with more questions about [area], or move to the next area?"
465
+
466
+ 4. **After all initially-selected areas complete:**
467
+ - Summarize what was captured from the discussion so far
468
+ - AskUserQuestion:
469
+ - header: "Done"
470
+ - question: "We've discussed [list areas]. Which gray areas remain unclear?"
471
+ - options: "Explore more gray areas" / "I'm ready for context"
472
+ - If "Explore more gray areas":
473
+ - Identify 2-4 additional gray areas based on what was learned
474
+ - Return to present_gray_areas logic with these new areas
475
+ - Loop: discuss new areas, then prompt again
476
+ - If "I'm ready for context": Proceed to write_context
477
+
478
+ **Canonical ref accumulation during discussion:**
479
+ When the user references a doc, spec, or ADR during any answer — e.g., "read adr-014", "check the MCP spec", "per browse-spec.md" — immediately:
480
+ 1. Read the referenced doc (or confirm it exists)
481
+ 2. Add it to the canonical refs accumulator with full relative path
482
+ 3. Use what you learned from the doc to inform subsequent questions
483
+
484
+ These user-referenced docs are often MORE important than ROADMAP.md refs because they represent docs the user specifically wants downstream agents to follow. Never drop them.
485
+
486
+ **Question design:**
487
+ - Options should be concrete, not abstract ("Cards" not "Option A")
488
+ - Each answer should inform the next question or next batch
489
+ - If user picks "Other" to provide freeform input (e.g., "let me describe it", "something else", or an open-ended reply), ask your follow-up as plain text — NOT another AskUserQuestion. Wait for them to type at the normal prompt, then reflect their input back and confirm before resuming AskUserQuestion or the next numbered batch.
490
+
491
+ **Scope creep handling:**
492
+ If user mentions something outside the phase domain:
493
+ ```
494
+ "[Feature] sounds like a new capability — that belongs in its own phase.
495
+ I'll note it as a deferred idea.
496
+
497
+ Back to [current area]: [return to current question]"
498
+ ```
499
+
500
+ Track deferred ideas internally.
501
+ </step>
502
+
503
+ <step name="write_context">
504
+ Create CONTEXT.md capturing decisions made.
505
+
506
+ **Find or create phase directory:**
507
+
508
+ Use values from init: `phase_dir`, `phase_slug`, `padded_phase`.
509
+
510
+ If `phase_dir` is null (phase exists in roadmap but no directory):
511
+ ```bash
512
+ mkdir -p ".planning/phases/${padded_phase}-${phase_slug}"
513
+ ```
514
+
515
+ **File location:** `${phase_dir}/${padded_phase}-CONTEXT.md`
516
+
517
+ **Structure the content by what was discussed:**
518
+
519
+ ```markdown
520
+ # Phase [X]: [Name] - Context
521
+
522
+ **Gathered:** [date]
523
+ **Status:** Ready for planning
524
+
525
+ <domain>
526
+ ## Phase Boundary
527
+
528
+ [Clear statement of what this phase delivers — the scope anchor]
529
+
530
+ </domain>
531
+
532
+ <decisions>
533
+ ## Implementation Decisions
534
+
535
+ ### [Category 1 that was discussed]
536
+ - [Decision or preference captured]
537
+ - [Another decision if applicable]
538
+
539
+ ### [Category 2 that was discussed]
540
+ - [Decision or preference captured]
541
+
542
+ ### Claude's Discretion
543
+ [Areas where user said "you decide" — note that Claude has flexibility here]
544
+
545
+ </decisions>
546
+
547
+ <canonical_refs>
548
+ ## Canonical References
549
+
550
+ **Downstream agents MUST read these before planning or implementing.**
551
+
552
+ [MANDATORY section. Write the FULL accumulated canonical refs list here.
553
+ Sources: ROADMAP.md refs + REQUIREMENTS.md refs + user-referenced docs during
554
+ discussion + any docs discovered during codebase scout. Group by topic area.
555
+ Every entry needs a full relative path — not just a name.]
556
+
557
+ ### [Topic area 1]
558
+ - `path/to/adr-or-spec.md` — [What it decides/defines that's relevant]
559
+ - `path/to/doc.md` §N — [Specific section reference]
560
+
561
+ ### [Topic area 2]
562
+ - `path/to/feature-doc.md` — [What this doc defines]
563
+
564
+ [If no external specs: "No external specs — requirements fully captured in decisions above"]
565
+
566
+ </canonical_refs>
567
+
568
+ <code_context>
569
+ ## Existing Code Insights
570
+
571
+ ### Reusable Assets
572
+ - [Component/hook/utility]: [How it could be used in this phase]
573
+
574
+ ### Established Patterns
575
+ - [Pattern]: [How it constrains/enables this phase]
576
+
577
+ ### Integration Points
578
+ - [Where new code connects to existing system]
579
+
580
+ </code_context>
581
+
582
+ <specifics>
583
+ ## Specific Ideas
584
+
585
+ [Any particular references, examples, or "I want it like X" moments from discussion]
586
+
587
+ [If none: "No specific requirements — open to standard approaches"]
588
+
589
+ </specifics>
590
+
591
+ <deferred>
592
+ ## Deferred Ideas
593
+
594
+ [Ideas that came up but belong in other phases. Don't lose them.]
595
+
596
+ [If none: "None — discussion stayed within phase scope"]
597
+
598
+ </deferred>
599
+
600
+ ---
601
+
602
+ *Phase: XX-name*
603
+ *Context gathered: [date]*
604
+ ```
605
+
606
+ Write file.
607
+ </step>
608
+
609
+ <step name="confirm_creation">
610
+ Present summary and next steps:
611
+
612
+ ```
613
+ Created: .planning/phases/${PADDED_PHASE}-${SLUG}/${PADDED_PHASE}-CONTEXT.md
614
+
615
+ ## Decisions Captured
616
+
617
+ ### [Category]
618
+ - [Key decision]
619
+
620
+ ### [Category]
621
+ - [Key decision]
622
+
623
+ [If deferred ideas exist:]
624
+ ## Noted for Later
625
+ - [Deferred idea] — future phase
626
+
627
+ ---
628
+
629
+ ## ▶ Next Up
630
+
631
+ **Phase ${PHASE}: [Name]** — [Goal from ROADMAP.md]
632
+
633
+ `/ez:plan-phase ${PHASE}`
634
+
635
+ <sub>`/clear` first → fresh context window</sub>
636
+
637
+ ---
638
+
639
+ **Also available:**
640
+ - `/ez:plan-phase ${PHASE} --skip-research` — plan without research
641
+ - `/ez:ui-phase ${PHASE}` — generate UI design contract before planning (if phase has frontend work)
642
+ - Review/edit CONTEXT.md before continuing
643
+
644
+ ---
645
+ ```
646
+ </step>
647
+
648
+ <step name="git_commit">
649
+ Commit phase context (uses `commit_docs` from init internally):
650
+
651
+ ```bash
652
+ node "$HOME/.claude/ez-agents/bin/ez-tools.cjs" commit "docs(${padded_phase}): capture phase context" --files "${phase_dir}/${padded_phase}-CONTEXT.md"
653
+ ```
654
+
655
+ Confirm: "Committed: docs(${padded_phase}): capture phase context"
656
+ </step>
657
+
658
+ <step name="update_state">
659
+ Update STATE.md with session info:
660
+
661
+ ```bash
662
+ node "$HOME/.claude/ez-agents/bin/ez-tools.cjs" state record-session \
663
+ --stopped-at "Phase ${PHASE} context gathered" \
664
+ --resume-file "${phase_dir}/${padded_phase}-CONTEXT.md"
665
+ ```
666
+
667
+ Commit STATE.md:
668
+
669
+ ```bash
670
+ node "$HOME/.claude/ez-agents/bin/ez-tools.cjs" commit "docs(state): record phase ${PHASE} context session" --files .planning/STATE.md
671
+ ```
672
+ </step>
673
+
674
+ <step name="auto_advance">
675
+ Check for auto-advance trigger:
676
+
677
+ 1. Parse `--auto` flag from $ARGUMENTS
678
+ 2. **Sync chain flag with intent** — if user invoked manually (no `--auto`), clear the ephemeral chain flag from any previous interrupted `--auto` chain. This does NOT touch `workflow.auto_advance` (the user's persistent settings preference):
679
+ ```bash
680
+ if [[ ! "$ARGUMENTS" =~ --auto ]]; then
681
+ node "$HOME/.claude/ez-agents/bin/ez-tools.cjs" config-set workflow._auto_chain_active false 2>/dev/null
682
+ fi
683
+ ```
684
+ 3. Read both the chain flag and user preference:
685
+ ```bash
686
+ AUTO_CHAIN=$(node "$HOME/.claude/ez-agents/bin/ez-tools.cjs" config-get workflow._auto_chain_active 2>/dev/null || echo "false")
687
+ AUTO_CFG=$(node "$HOME/.claude/ez-agents/bin/ez-tools.cjs" config-get workflow.auto_advance 2>/dev/null || echo "false")
688
+ ```
689
+
690
+ **If `--auto` flag present AND `AUTO_CHAIN` is not true:** Persist chain flag to config (handles direct `--auto` usage without new-project):
691
+ ```bash
692
+ node "$HOME/.claude/ez-agents/bin/ez-tools.cjs" config-set workflow._auto_chain_active true
693
+ ```
694
+
695
+ **If `--auto` flag present OR `AUTO_CHAIN` is true OR `AUTO_CFG` is true:**
696
+
697
+ Display banner:
698
+ ```
699
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
700
+ GSD ► AUTO-ADVANCING TO PLAN
701
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
702
+
703
+ Context captured. Launching plan-phase...
704
+ ```
705
+
706
+ Launch plan-phase using the Skill tool to avoid nested Task sessions (which cause runtime freezes due to deep agent nesting — see #686):
707
+ ```
708
+ Skill(skill="gsd:plan-phase", args="${PHASE} --auto")
709
+ ```
710
+
711
+ This keeps the auto-advance chain flat — discuss, plan, and execute all run at the same nesting level rather than spawning increasingly deep Task agents.
712
+
713
+ **Handle plan-phase return:**
714
+ - **PHASE COMPLETE** → Full chain succeeded. Display:
715
+ ```
716
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
717
+ GSD ► PHASE ${PHASE} COMPLETE
718
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
719
+
720
+ Auto-advance pipeline finished: discuss → plan → execute
721
+
722
+ Next: /ez:discuss-phase ${NEXT_PHASE} --auto
723
+ <sub>/clear first → fresh context window</sub>
724
+ ```
725
+ - **PLANNING COMPLETE** → Planning done, execution didn't complete:
726
+ ```
727
+ Auto-advance partial: Planning complete, execution did not finish.
728
+ Continue: /ez:execute-phase ${PHASE}
729
+ ```
730
+ - **PLANNING INCONCLUSIVE / CHECKPOINT** → Stop chain:
731
+ ```
732
+ Auto-advance stopped: Planning needs input.
733
+ Continue: /ez:plan-phase ${PHASE}
734
+ ```
735
+ - **GAPS FOUND** → Stop chain:
736
+ ```
737
+ Auto-advance stopped: Gaps found during execution.
738
+ Continue: /ez:plan-phase ${PHASE} --gaps
739
+ ```
740
+
741
+ **If neither `--auto` nor config enabled:**
742
+ Route to `confirm_creation` step (existing behavior — show manual next steps).
743
+ </step>
744
+
745
+ </process>
746
+
747
+ <success_criteria>
748
+ - Phase validated against roadmap
749
+ - Prior context loaded (PROJECT.md, REQUIREMENTS.md, STATE.md, prior CONTEXT.md files)
750
+ - Already-decided questions not re-asked (carried forward from prior phases)
751
+ - Codebase scouted for reusable assets, patterns, and integration points
752
+ - Gray areas identified through intelligent analysis with code and prior decision annotations
753
+ - User selected which areas to discuss
754
+ - Each selected area explored until user satisfied (with code-informed and prior-decision-informed options)
755
+ - Scope creep redirected to deferred ideas
756
+ - CONTEXT.md captures actual decisions, not vague vision
757
+ - CONTEXT.md includes canonical_refs section with full file paths to every spec/ADR/doc downstream agents need (MANDATORY — never omit)
758
+ - CONTEXT.md includes code_context section with reusable assets and patterns
759
+ - Deferred ideas preserved for future phases
760
+ - STATE.md updated with session info
761
+ - User knows next steps
762
+ </success_criteria>