@bhargavvc/sdd-cc 1.30.1 → 1.35.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 (242) hide show
  1. package/README.ja-JP.md +144 -110
  2. package/README.ko-KR.md +143 -107
  3. package/README.md +183 -112
  4. package/README.pt-BR.md +90 -52
  5. package/README.zh-CN.md +141 -101
  6. package/agents/sdd-advisor-researcher.md +23 -0
  7. package/agents/sdd-ai-researcher.md +133 -0
  8. package/agents/sdd-code-fixer.md +516 -0
  9. package/agents/sdd-code-reviewer.md +355 -0
  10. package/agents/sdd-codebase-mapper.md +3 -3
  11. package/agents/sdd-debugger.md +17 -5
  12. package/agents/sdd-doc-verifier.md +201 -0
  13. package/agents/sdd-doc-writer.md +602 -0
  14. package/agents/sdd-domain-researcher.md +153 -0
  15. package/agents/sdd-eval-auditor.md +164 -0
  16. package/agents/sdd-eval-planner.md +154 -0
  17. package/agents/sdd-executor.md +87 -4
  18. package/agents/sdd-framework-selector.md +160 -0
  19. package/agents/sdd-intel-updater.md +314 -0
  20. package/agents/sdd-nyquist-auditor.md +1 -1
  21. package/agents/sdd-phase-researcher.md +71 -4
  22. package/agents/sdd-plan-checker.md +100 -6
  23. package/agents/sdd-planner.md +145 -206
  24. package/agents/sdd-project-researcher.md +25 -2
  25. package/agents/sdd-research-synthesizer.md +3 -3
  26. package/agents/sdd-roadmapper.md +6 -6
  27. package/agents/sdd-security-auditor.md +128 -0
  28. package/agents/sdd-ui-auditor.md +43 -3
  29. package/agents/sdd-ui-checker.md +5 -5
  30. package/agents/sdd-ui-researcher.md +27 -4
  31. package/agents/sdd-user-profiler.md +2 -2
  32. package/agents/sdd-verifier.md +142 -22
  33. package/bin/install.js +2145 -545
  34. package/commands/sdd/add-backlog.md +5 -5
  35. package/commands/sdd/add-tests.md +2 -2
  36. package/commands/sdd/ai-integration-phase.md +36 -0
  37. package/commands/sdd/analyze-dependencies.md +34 -0
  38. package/commands/sdd/audit-fix.md +33 -0
  39. package/commands/sdd/autonomous.md +7 -2
  40. package/commands/sdd/cleanup.md +5 -0
  41. package/commands/sdd/code-review-fix.md +52 -0
  42. package/commands/sdd/code-review.md +55 -0
  43. package/commands/sdd/complete-milestone.md +6 -6
  44. package/commands/sdd/debug.md +22 -9
  45. package/commands/sdd/discuss-phase.md +7 -2
  46. package/commands/sdd/do.md +1 -1
  47. package/commands/sdd/docs-update.md +48 -0
  48. package/commands/sdd/eval-review.md +32 -0
  49. package/commands/sdd/execute-phase.md +4 -0
  50. package/commands/sdd/explore.md +27 -0
  51. package/commands/sdd/fast.md +2 -2
  52. package/commands/sdd/from-sdd2.md +45 -0
  53. package/commands/sdd/help.md +2 -0
  54. package/commands/sdd/import.md +36 -0
  55. package/commands/sdd/intel.md +179 -0
  56. package/commands/sdd/join-discord.md +2 -1
  57. package/commands/sdd/manager.md +1 -0
  58. package/commands/sdd/map-codebase.md +3 -3
  59. package/commands/sdd/new-milestone.md +1 -1
  60. package/commands/sdd/new-project.md +5 -1
  61. package/commands/sdd/new-workspace.md +1 -1
  62. package/commands/sdd/next.md +2 -0
  63. package/commands/sdd/plan-milestone-gaps.md +2 -2
  64. package/commands/sdd/plan-phase.md +6 -1
  65. package/commands/sdd/plant-seed.md +1 -1
  66. package/commands/sdd/profile-user.md +1 -1
  67. package/commands/sdd/quick.md +5 -3
  68. package/commands/sdd/reapply-patches.md +230 -42
  69. package/commands/sdd/research-phase.md +3 -3
  70. package/commands/sdd/review-backlog.md +1 -0
  71. package/commands/sdd/review.md +6 -3
  72. package/commands/sdd/scan.md +26 -0
  73. package/commands/sdd/secure-phase.md +35 -0
  74. package/commands/sdd/ship.md +1 -1
  75. package/commands/sdd/thread.md +5 -5
  76. package/commands/sdd/undo.md +34 -0
  77. package/commands/sdd/verify-work.md +1 -1
  78. package/commands/sdd/workstreams.md +17 -11
  79. package/hooks/dist/sdd-check-update.js +33 -8
  80. package/hooks/dist/sdd-context-monitor.js +17 -8
  81. package/hooks/dist/sdd-phase-boundary.sh +27 -0
  82. package/hooks/dist/sdd-prompt-guard.js +1 -0
  83. package/hooks/dist/sdd-read-guard.js +82 -0
  84. package/hooks/dist/sdd-session-state.sh +33 -0
  85. package/hooks/dist/sdd-statusline.js +137 -15
  86. package/hooks/dist/sdd-validate-commit.sh +47 -0
  87. package/hooks/dist/sdd-workflow-guard.js +4 -4
  88. package/hooks/sdd-check-update.js +139 -0
  89. package/hooks/sdd-context-monitor.js +165 -0
  90. package/hooks/sdd-phase-boundary.sh +27 -0
  91. package/hooks/sdd-prompt-guard.js +97 -0
  92. package/hooks/sdd-read-guard.js +82 -0
  93. package/hooks/sdd-session-state.sh +33 -0
  94. package/hooks/sdd-statusline.js +241 -0
  95. package/hooks/sdd-validate-commit.sh +47 -0
  96. package/hooks/sdd-workflow-guard.js +94 -0
  97. package/package.json +3 -3
  98. package/scripts/build-hooks.js +18 -7
  99. package/scripts/prompt-injection-scan.sh +1 -0
  100. package/scripts/rebrand-gsd-to-sdd.sh +221 -220
  101. package/scripts/run-tests.cjs +5 -1
  102. package/scripts/sync-upstream.sh +1 -1
  103. package/sdd/bin/lib/commands.cjs +79 -17
  104. package/sdd/bin/lib/config.cjs +90 -48
  105. package/sdd/bin/lib/core.cjs +452 -87
  106. package/sdd/bin/lib/docs.cjs +267 -0
  107. package/sdd/bin/lib/frontmatter.cjs +381 -336
  108. package/sdd/bin/lib/init.cjs +110 -16
  109. package/sdd/bin/lib/intel.cjs +660 -0
  110. package/sdd/bin/lib/learnings.cjs +378 -0
  111. package/sdd/bin/lib/milestone.cjs +42 -11
  112. package/sdd/bin/lib/model-profiles.cjs +17 -15
  113. package/sdd/bin/lib/phase.cjs +367 -288
  114. package/sdd/bin/lib/profile-output.cjs +106 -10
  115. package/sdd/bin/lib/roadmap.cjs +146 -115
  116. package/sdd/bin/lib/schema-detect.cjs +238 -0
  117. package/sdd/bin/lib/sdd2-import.cjs +511 -0
  118. package/sdd/bin/lib/security.cjs +124 -3
  119. package/sdd/bin/lib/state.cjs +648 -264
  120. package/sdd/bin/lib/template.cjs +8 -4
  121. package/sdd/bin/lib/verify.cjs +209 -28
  122. package/sdd/bin/lib/workstream.cjs +7 -3
  123. package/sdd/bin/sdd-tools.cjs +184 -12
  124. package/sdd/contexts/dev.md +21 -0
  125. package/sdd/contexts/research.md +22 -0
  126. package/sdd/contexts/review.md +22 -0
  127. package/sdd/references/agent-contracts.md +79 -0
  128. package/sdd/references/ai-evals.md +156 -0
  129. package/sdd/references/ai-frameworks.md +186 -0
  130. package/sdd/references/artifact-types.md +113 -0
  131. package/sdd/references/common-bug-patterns.md +114 -0
  132. package/sdd/references/context-budget.md +49 -0
  133. package/sdd/references/continuation-format.md +25 -25
  134. package/sdd/references/domain-probes.md +125 -0
  135. package/sdd/references/few-shot-examples/plan-checker.md +73 -0
  136. package/sdd/references/few-shot-examples/verifier.md +109 -0
  137. package/sdd/references/gate-prompts.md +100 -0
  138. package/sdd/references/gates.md +70 -0
  139. package/sdd/references/git-integration.md +1 -1
  140. package/sdd/references/ios-scaffold.md +123 -0
  141. package/sdd/references/model-profile-resolution.md +2 -0
  142. package/sdd/references/model-profiles.md +24 -18
  143. package/sdd/references/planner-gap-closure.md +62 -0
  144. package/sdd/references/planner-reviews.md +39 -0
  145. package/sdd/references/planner-revision.md +87 -0
  146. package/sdd/references/planning-config.md +252 -0
  147. package/sdd/references/revision-loop.md +97 -0
  148. package/sdd/references/thinking-models-debug.md +44 -0
  149. package/sdd/references/thinking-models-execution.md +50 -0
  150. package/sdd/references/thinking-models-planning.md +62 -0
  151. package/sdd/references/thinking-models-research.md +50 -0
  152. package/sdd/references/thinking-models-verification.md +55 -0
  153. package/sdd/references/thinking-partner.md +96 -0
  154. package/sdd/references/ui-brand.md +4 -4
  155. package/sdd/references/universal-anti-patterns.md +63 -0
  156. package/sdd/references/verification-overrides.md +227 -0
  157. package/sdd/references/workstream-flag.md +56 -3
  158. package/sdd/templates/AI-SPEC.md +246 -0
  159. package/sdd/templates/DEBUG.md +1 -1
  160. package/sdd/templates/SECURITY.md +61 -0
  161. package/sdd/templates/UAT.md +4 -4
  162. package/sdd/templates/VALIDATION.md +4 -4
  163. package/sdd/templates/claude-md.md +32 -9
  164. package/sdd/templates/config.json +4 -0
  165. package/sdd/templates/debug-subagent-prompt.md +1 -1
  166. package/sdd/templates/dev-preferences.md +1 -1
  167. package/sdd/templates/discovery.md +2 -2
  168. package/sdd/templates/phase-prompt.md +1 -1
  169. package/sdd/templates/planner-subagent-prompt.md +3 -3
  170. package/sdd/templates/project.md +1 -1
  171. package/sdd/templates/research.md +1 -1
  172. package/sdd/templates/state.md +2 -2
  173. package/sdd/workflows/add-phase.md +8 -8
  174. package/sdd/workflows/add-tests.md +12 -9
  175. package/sdd/workflows/add-todo.md +5 -3
  176. package/sdd/workflows/ai-integration-phase.md +284 -0
  177. package/sdd/workflows/analyze-dependencies.md +96 -0
  178. package/sdd/workflows/audit-fix.md +157 -0
  179. package/sdd/workflows/audit-milestone.md +11 -11
  180. package/sdd/workflows/audit-uat.md +2 -2
  181. package/sdd/workflows/autonomous.md +195 -27
  182. package/sdd/workflows/check-todos.md +12 -10
  183. package/sdd/workflows/cleanup.md +2 -0
  184. package/sdd/workflows/code-review-fix.md +497 -0
  185. package/sdd/workflows/code-review.md +515 -0
  186. package/sdd/workflows/complete-milestone.md +56 -22
  187. package/sdd/workflows/diagnose-issues.md +10 -3
  188. package/sdd/workflows/discovery-phase.md +5 -3
  189. package/sdd/workflows/discuss-phase-assumptions.md +24 -6
  190. package/sdd/workflows/discuss-phase-power.md +291 -0
  191. package/sdd/workflows/discuss-phase.md +173 -21
  192. package/sdd/workflows/do.md +23 -21
  193. package/sdd/workflows/docs-update.md +1155 -0
  194. package/sdd/workflows/eval-review.md +155 -0
  195. package/sdd/workflows/execute-phase.md +594 -38
  196. package/sdd/workflows/execute-plan.md +67 -96
  197. package/sdd/workflows/explore.md +139 -0
  198. package/sdd/workflows/fast.md +5 -5
  199. package/sdd/workflows/forensics.md +2 -2
  200. package/sdd/workflows/health.md +4 -4
  201. package/sdd/workflows/help.md +122 -119
  202. package/sdd/workflows/import.md +276 -0
  203. package/sdd/workflows/inbox.md +387 -0
  204. package/sdd/workflows/insert-phase.md +7 -7
  205. package/sdd/workflows/list-phase-assumptions.md +4 -4
  206. package/sdd/workflows/list-workspaces.md +2 -2
  207. package/sdd/workflows/manager.md +35 -32
  208. package/sdd/workflows/map-codebase.md +7 -5
  209. package/sdd/workflows/milestone-summary.md +2 -2
  210. package/sdd/workflows/new-milestone.md +17 -9
  211. package/sdd/workflows/new-project.md +50 -25
  212. package/sdd/workflows/new-workspace.md +7 -5
  213. package/sdd/workflows/next.md +67 -11
  214. package/sdd/workflows/note.md +9 -7
  215. package/sdd/workflows/pause-work.md +75 -12
  216. package/sdd/workflows/plan-milestone-gaps.md +8 -8
  217. package/sdd/workflows/plan-phase.md +294 -42
  218. package/sdd/workflows/plant-seed.md +6 -3
  219. package/sdd/workflows/pr-branch.md +42 -14
  220. package/sdd/workflows/profile-user.md +9 -7
  221. package/sdd/workflows/progress.md +45 -45
  222. package/sdd/workflows/quick.md +195 -47
  223. package/sdd/workflows/remove-phase.md +6 -6
  224. package/sdd/workflows/remove-workspace.md +3 -1
  225. package/sdd/workflows/research-phase.md +2 -2
  226. package/sdd/workflows/resume-project.md +12 -12
  227. package/sdd/workflows/review.md +109 -9
  228. package/sdd/workflows/scan.md +102 -0
  229. package/sdd/workflows/secure-phase.md +166 -0
  230. package/sdd/workflows/session-report.md +2 -2
  231. package/sdd/workflows/settings.md +38 -12
  232. package/sdd/workflows/ship.md +21 -9
  233. package/sdd/workflows/stats.md +1 -1
  234. package/sdd/workflows/transition.md +23 -23
  235. package/sdd/workflows/ui-phase.md +15 -7
  236. package/sdd/workflows/ui-review.md +29 -4
  237. package/sdd/workflows/undo.md +314 -0
  238. package/sdd/workflows/update.md +171 -20
  239. package/sdd/workflows/validate-phase.md +6 -4
  240. package/sdd/workflows/verify-phase.md +210 -6
  241. package/sdd/workflows/verify-work.md +83 -9
  242. package/sdd/commands/sdd/workstreams.md +0 -63
@@ -4,6 +4,12 @@ Extract implementation decisions that downstream agents need. Analyze the phase
4
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
5
  </purpose>
6
6
 
7
+ <required_reading>
8
+ @~/.claude/sdd/references/domain-probes.md
9
+ @~/.claude/sdd/references/gate-prompts.md
10
+ @~/.claude/sdd/references/universal-anti-patterns.md
11
+ </required_reading>
12
+
7
13
  <downstream_awareness>
8
14
  **CONTEXT.md feeds into:**
9
15
 
@@ -118,7 +124,7 @@ This is required for Claude Code remote sessions (`/rc` mode) where the Claude A
118
124
  cannot forward TUI menu selections back to the host.
119
125
 
120
126
  Enable text mode:
121
- - Per-session: pass `--text` flag to any command (e.g., `/sdd:discuss-phase --text`)
127
+ - Per-session: pass `--text` flag to any command (e.g., `/sdd-discuss-phase --text`)
122
128
  - Per-project: `sdd-tools config-set workflow.text_mode true`
123
129
 
124
130
  Text mode applies to ALL workflows in the session, not just discuss-phase.
@@ -126,7 +132,7 @@ Text mode applies to ALL workflows in the session, not just discuss-phase.
126
132
 
127
133
  <process>
128
134
 
129
- **Express path available:** If you already have a PRD or acceptance criteria document, use `/sdd:plan-phase {phase} --prd path/to/prd.md` to skip this discussion and go straight to planning.
135
+ **Express path available:** If you already have a PRD or acceptance criteria document, use `/sdd-plan-phase {phase} --prd path/to/prd.md` to skip this discussion and go straight to planning.
130
136
 
131
137
  <step name="initialize" priority="first">
132
138
  Phase number from argument (required).
@@ -137,24 +143,60 @@ if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi
137
143
  AGENT_SKILLS_ADVISOR=$(node "$HOME/.claude/sdd/bin/sdd-tools.cjs" agent-skills sdd-advisor 2>/dev/null)
138
144
  ```
139
145
 
140
- 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`.
146
+ 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`, `response_language`.
147
+
148
+ **If `response_language` is set:** All user-facing questions, prompts, and explanations in this workflow MUST be presented in `{response_language}`. This includes AskUserQuestion labels, option text, gray area descriptions, and discussion summaries. Technical terms, code, and file paths remain in English. Subagent prompts stay in English — only user-facing output is translated.
141
149
 
142
150
  **If `phase_found` is false:**
143
151
  ```
144
152
  Phase [X] not found in roadmap.
145
153
 
146
- Use /sdd:progress ${SDD_WS} to see available phases.
154
+ Use /sdd-progress ${SDD_WS} to see available phases.
147
155
  ```
148
156
  Exit workflow.
149
157
 
150
158
  **If `phase_found` is true:** Continue to check_existing.
151
159
 
160
+ **Power mode** — If `--power` is present in ARGUMENTS:
161
+ - Skip interactive questioning entirely
162
+ - Read and execute @~/.claude/sdd/workflows/discuss-phase-power.md end-to-end
163
+ - Do not continue with the steps below
164
+
152
165
  **Auto mode** — If `--auto` is present in ARGUMENTS:
153
166
  - In `check_existing`: auto-select "Skip" (if context exists) or continue without prompting (if no context/plans)
154
167
  - In `present_gray_areas`: auto-select ALL gray areas without asking the user
155
168
  - In `discuss_areas`: for each discussion question, choose the recommended option (first option, or the one marked "recommended") without using AskUserQuestion
156
169
  - Log each auto-selected choice inline so the user can review decisions in the context file
157
170
  - After discussion completes, auto-advance to plan-phase (existing behavior)
171
+
172
+ **Chain mode** — If `--chain` is present in ARGUMENTS:
173
+ - Discussion is fully interactive (questions, gray area selection — same as default mode)
174
+ - After discussion completes, auto-advance to plan-phase → execute-phase (same as `--auto`)
175
+ - This is the middle ground: user controls the discuss decisions, then plan+execute run autonomously
176
+ </step>
177
+
178
+ <step name="check_blocking_antipatterns" priority="first">
179
+ **MANDATORY — Check for blocking anti-patterns before any other work.**
180
+
181
+ Look for a `.continue-here.md` in the current phase directory:
182
+
183
+ ```bash
184
+ ls ${phase_dir}/.continue-here.md 2>/dev/null || true
185
+ ```
186
+
187
+ If `.continue-here.md` exists, parse its "Critical Anti-Patterns" table for rows with `severity` = `blocking`.
188
+
189
+ **If one or more `blocking` anti-patterns are found:**
190
+
191
+ This step cannot be skipped. Before proceeding to `check_existing` or any other step, the agent must demonstrate understanding of each blocking anti-pattern by answering all three questions for each one:
192
+
193
+ 1. **What is this anti-pattern?** — Describe it in your own words, not by quoting the handoff.
194
+ 2. **How did it manifest?** — Explain the specific failure that caused it to be recorded.
195
+ 3. **What structural mechanism (not acknowledgment) prevents it?** — Name the concrete step, checklist item, or enforcement mechanism that stops recurrence.
196
+
197
+ Write these answers inline before continuing. If a blocking anti-pattern cannot be answered from the context in `.continue-here.md`, stop and ask the user for clarification.
198
+
199
+ **If no `.continue-here.md` exists, or no `blocking` rows are found:** Proceed directly to `check_existing`.
158
200
  </step>
159
201
 
160
202
  <step name="check_existing">
@@ -182,6 +224,26 @@ If "Skip": Exit workflow
182
224
 
183
225
  **If doesn't exist:**
184
226
 
227
+ **Check for interrupted discussion checkpoint:**
228
+
229
+ ```bash
230
+ ls ${phase_dir}/*-DISCUSS-CHECKPOINT.json 2>/dev/null || true
231
+ ```
232
+
233
+ If a checkpoint file exists (previous session was interrupted before CONTEXT.md was written):
234
+
235
+ **If `--auto`:** Auto-select "Resume" — load checkpoint and continue from last completed area.
236
+
237
+ **Otherwise:** Use AskUserQuestion:
238
+ - header: "Resume"
239
+ - question: "Found interrupted discussion checkpoint ({N} areas completed out of {M}). Resume from where you left off?"
240
+ - options:
241
+ - "Resume" — Load checkpoint, skip completed areas, continue discussion
242
+ - "Start fresh" — Delete checkpoint, start discussion from scratch
243
+
244
+ If "Resume": Parse the checkpoint JSON. Load `decisions` into the internal accumulator. Set `areas_completed` to skip those areas. Continue to `present_gray_areas` with only the remaining areas.
245
+ If "Start fresh": Delete the checkpoint file. Continue as if no checkpoint existed.
246
+
185
247
  Check `has_plans` and `plan_count` from init. **If `has_plans` is true:**
186
248
 
187
249
  **If `--auto`:** Auto-select "Continue and replan after". Log: `[auto] Plans exist — continuing with context capture, will replan after.`
@@ -190,7 +252,7 @@ Check `has_plans` and `plan_count` from init. **If `has_plans` is true:**
190
252
  - header: "Plans exist"
191
253
  - question: "Phase [X] already has {plan_count} plan(s) created without user context. Your decisions here won't affect existing plans unless you replan."
192
254
  - options:
193
- - "Continue and replan after" — Capture context, then run /sdd:plan-phase {X} ${SDD_WS} to replan
255
+ - "Continue and replan after" — Capture context, then run /sdd-plan-phase {X} ${SDD_WS} to replan
194
256
  - "View existing plans" — Show plans before deciding
195
257
  - "Cancel" — Skip discuss-phase
196
258
 
@@ -545,6 +607,20 @@ Table-first discussion flow — present research-backed comparison tables, then
545
607
  - If user picks from table options → record as locked decision for that area
546
608
  - If user picks "Other" → receive their input, reflect it back for confirmation, record
547
609
 
610
+ **Thinking partner (conditional):**
611
+ If `features.thinking_partner` is enabled in config, check the user's answer for tradeoff signals
612
+ (see `references/thinking-partner.md` for signal list). If tradeoff detected:
613
+
614
+ ```
615
+ I notice competing priorities here — {option_A} optimizes for {goal_A} while {option_B} optimizes for {goal_B}.
616
+
617
+ Want me to think through the tradeoffs before we lock this in?
618
+ [Yes, analyze] / [No, decision made]
619
+ ```
620
+
621
+ If yes: provide 3-5 bullet analysis (what each optimizes/sacrifices, alignment with PROJECT.md goals, recommendation). Then return to normal flow.
622
+ If no or thinking_partner disabled: continue to next area.
623
+
548
624
  4. **After recording pick, Claude decides whether follow-up questions are needed:**
549
625
  - If the pick has ambiguity that would affect downstream planning → ask 1-2 targeted follow-up questions using AskUserQuestion
550
626
  - If the pick is clear and self-contained → move to next area
@@ -640,6 +716,16 @@ Each answer (or answer set, in batch mode) should reveal the next question or ne
640
716
  ```
641
717
  After all areas are auto-resolved, skip the "Explore more gray areas" prompt and proceed directly to write_context.
642
718
 
719
+ **CRITICAL — Auto-mode pass cap:**
720
+ In `--auto` mode, the discuss step MUST complete in a **single pass**. After writing CONTEXT.md once, you are DONE — proceed immediately to write_context and then auto_advance. Do NOT re-read your own CONTEXT.md to find "gaps", "undefined types", or "missing decisions" and run additional passes. This creates a self-feeding loop where each pass generates references that the next pass treats as gaps, consuming unbounded time and resources.
721
+
722
+ Check the pass cap from config:
723
+ ```bash
724
+ MAX_PASSES=$(node "$HOME/.claude/sdd/bin/sdd-tools.cjs" config-get workflow.max_discuss_passes 2>/dev/null || echo "3")
725
+ ```
726
+
727
+ If you have already written and committed CONTEXT.md, the discuss step is complete. Move on.
728
+
643
729
  **Interactive mode (no `--auto`):**
644
730
 
645
731
  **For each area:**
@@ -719,6 +805,44 @@ Back to [current area]: [return to current question]"
719
805
 
720
806
  Track deferred ideas internally.
721
807
 
808
+ **Incremental checkpoint — save after each area completes:**
809
+
810
+ After each area is resolved (user says "Next area" or area auto-resolves in `--auto` mode), immediately write a checkpoint file with all decisions captured so far. This prevents data loss if the session is interrupted mid-discussion.
811
+
812
+ **Checkpoint file:** `${phase_dir}/${padded_phase}-DISCUSS-CHECKPOINT.json`
813
+
814
+ Write after each area:
815
+ ```json
816
+ {
817
+ "phase": "{PHASE_NUM}",
818
+ "phase_name": "{phase_name}",
819
+ "timestamp": "{ISO timestamp}",
820
+ "areas_completed": ["Area 1", "Area 2"],
821
+ "areas_remaining": ["Area 3", "Area 4"],
822
+ "decisions": {
823
+ "Area 1": [
824
+ {"question": "...", "answer": "...", "options_presented": ["..."]},
825
+ {"question": "...", "answer": "...", "options_presented": ["..."]}
826
+ ],
827
+ "Area 2": [
828
+ {"question": "...", "answer": "...", "options_presented": ["..."]}
829
+ ]
830
+ },
831
+ "deferred_ideas": ["..."],
832
+ "canonical_refs": ["..."]
833
+ }
834
+ ```
835
+
836
+ This is a structured checkpoint, not the final CONTEXT.md — the `write_context` step still produces the canonical output. But if the session dies, the next `/sdd-discuss-phase` invocation can detect this checkpoint and offer to resume from it instead of starting from scratch.
837
+
838
+ **On session resume:** In the `check_existing` step, also check for `*-DISCUSS-CHECKPOINT.json`. If found and no CONTEXT.md exists:
839
+ - Display: "Found interrupted discussion checkpoint ({N} areas completed). Resume from checkpoint?"
840
+ - Options: "Resume" / "Start fresh"
841
+ - On "Resume": Load the checkpoint, skip completed areas, continue from where it left off
842
+ - On "Start fresh": Delete the checkpoint, proceed as normal
843
+
844
+ **After write_context completes successfully:** Delete the checkpoint file — the canonical CONTEXT.md now has all decisions.
845
+
722
846
  **Track discussion log data internally:**
723
847
  For each question asked, accumulate:
724
848
  - Area name
@@ -873,15 +997,16 @@ Created: .planning/phases/${PADDED_PHASE}-${SLUG}/${PADDED_PHASE}-CONTEXT.md
873
997
 
874
998
  **Phase ${PHASE}: [Name]** — [Goal from ROADMAP.md]
875
999
 
876
- `/sdd:plan-phase ${PHASE} ${SDD_WS}`
1000
+ `/clear` then:
877
1001
 
878
- <sub>`/clear` first → fresh context window</sub>
1002
+ `/sdd-plan-phase ${PHASE} ${SDD_WS}`
879
1003
 
880
1004
  ---
881
1005
 
882
1006
  **Also available:**
883
- - `/sdd:plan-phase ${PHASE} --skip-research ${SDD_WS}` — plan without research
884
- - `/sdd:ui-phase ${PHASE} ${SDD_WS}` — generate UI design contract before planning (if phase has frontend work)
1007
+ - `/sdd-discuss-phase ${PHASE} --chain ${SDD_WS}` — re-run with auto plan+execute after
1008
+ - `/sdd-plan-phase ${PHASE} --skip-research ${SDD_WS}` — plan without research
1009
+ - `/sdd-ui-phase ${PHASE} ${SDD_WS}` — generate UI design contract before planning (if phase has frontend work)
885
1010
  - Review/edit CONTEXT.md before continuing
886
1011
 
887
1012
  ---
@@ -933,6 +1058,12 @@ Created: .planning/phases/${PADDED_PHASE}-${SLUG}/${PADDED_PHASE}-CONTEXT.md
933
1058
 
934
1059
  Write file.
935
1060
 
1061
+ **Clean up checkpoint file** — CONTEXT.md is now the canonical record:
1062
+
1063
+ ```bash
1064
+ rm -f "${phase_dir}/${padded_phase}-DISCUSS-CHECKPOINT.json"
1065
+ ```
1066
+
936
1067
  Commit phase context and discussion log:
937
1068
 
938
1069
  ```bash
@@ -961,10 +1092,10 @@ node "$HOME/.claude/sdd/bin/sdd-tools.cjs" commit "docs(state): record phase ${P
961
1092
  <step name="auto_advance">
962
1093
  Check for auto-advance trigger:
963
1094
 
964
- 1. Parse `--auto` flag from $ARGUMENTS
965
- 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):
1095
+ 1. Parse `--auto` and `--chain` flags from $ARGUMENTS
1096
+ 2. **Sync chain flag with intent** — if user invoked manually (no `--auto` and no `--chain`), clear the ephemeral chain flag from any previous interrupted `--auto` chain. This does NOT touch `workflow.auto_advance` (the user's persistent settings preference):
966
1097
  ```bash
967
- if [[ ! "$ARGUMENTS" =~ --auto ]]; then
1098
+ if [[ ! "$ARGUMENTS" =~ --auto ]] && [[ ! "$ARGUMENTS" =~ --chain ]]; then
968
1099
  node "$HOME/.claude/sdd/bin/sdd-tools.cjs" config-set workflow._auto_chain_active false 2>/dev/null
969
1100
  fi
970
1101
  ```
@@ -974,12 +1105,12 @@ Check for auto-advance trigger:
974
1105
  AUTO_CFG=$(node "$HOME/.claude/sdd/bin/sdd-tools.cjs" config-get workflow.auto_advance 2>/dev/null || echo "false")
975
1106
  ```
976
1107
 
977
- **If `--auto` flag present AND `AUTO_CHAIN` is not true:** Persist chain flag to config (handles direct `--auto` usage without new-project):
1108
+ **If `--auto` or `--chain` flag present AND `AUTO_CHAIN` is not true:** Persist chain flag to config (handles direct usage without new-project):
978
1109
  ```bash
979
1110
  node "$HOME/.claude/sdd/bin/sdd-tools.cjs" config-set workflow._auto_chain_active true
980
1111
  ```
981
1112
 
982
- **If `--auto` flag present OR `AUTO_CHAIN` is true OR `AUTO_CFG` is true:**
1113
+ **If `--auto` flag present OR `--chain` flag present OR `AUTO_CHAIN` is true OR `AUTO_CFG` is true:**
983
1114
 
984
1115
  Display banner:
985
1116
  ```
@@ -992,7 +1123,7 @@ Context captured. Launching plan-phase...
992
1123
 
993
1124
  Launch plan-phase using the Skill tool to avoid nested Task sessions (which cause runtime freezes due to deep agent nesting — see #686):
994
1125
  ```
995
- Skill(skill="sdd:plan-phase", args="${PHASE} --auto ${SDD_WS}")
1126
+ Skill(skill="sdd-plan-phase", args="${PHASE} --auto ${SDD_WS}")
996
1127
  ```
997
1128
 
998
1129
  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.
@@ -1006,31 +1137,47 @@ This keeps the auto-advance chain flat — discuss, plan, and execute all run at
1006
1137
 
1007
1138
  Auto-advance pipeline finished: discuss → plan → execute
1008
1139
 
1009
- Next: /sdd:discuss-phase ${NEXT_PHASE} --auto ${SDD_WS}
1010
- <sub>/clear first → fresh context window</sub>
1140
+ /clear then:
1141
+
1142
+ Next: /sdd-discuss-phase ${NEXT_PHASE} ${WAS_CHAIN ? "--chain" : "--auto"} ${SDD_WS}
1011
1143
  ```
1012
1144
  - **PLANNING COMPLETE** → Planning done, execution didn't complete:
1013
1145
  ```
1014
1146
  Auto-advance partial: Planning complete, execution did not finish.
1015
- Continue: /sdd:execute-phase ${PHASE} ${SDD_WS}
1147
+ Continue: /sdd-execute-phase ${PHASE} ${SDD_WS}
1016
1148
  ```
1017
1149
  - **PLANNING INCONCLUSIVE / CHECKPOINT** → Stop chain:
1018
1150
  ```
1019
1151
  Auto-advance stopped: Planning needs input.
1020
- Continue: /sdd:plan-phase ${PHASE} ${SDD_WS}
1152
+ Continue: /sdd-plan-phase ${PHASE} ${SDD_WS}
1021
1153
  ```
1022
1154
  - **GAPS FOUND** → Stop chain:
1023
1155
  ```
1024
1156
  Auto-advance stopped: Gaps found during execution.
1025
- Continue: /sdd:plan-phase ${PHASE} --gaps ${SDD_WS}
1157
+ Continue: /sdd-plan-phase ${PHASE} --gaps ${SDD_WS}
1026
1158
  ```
1027
1159
 
1028
- **If neither `--auto` nor config enabled:**
1160
+ **If none of `--auto`, `--chain`, nor config enabled:**
1029
1161
  Route to `confirm_creation` step (existing behavior — show manual next steps).
1030
1162
  </step>
1031
1163
 
1032
1164
  </process>
1033
1165
 
1166
+ <power_user_mode>
1167
+ When `--power` flag is present in ARGUMENTS, skip interactive questioning and execute the power user workflow.
1168
+
1169
+ The power user mode generates ALL questions upfront into machine-readable and human-friendly files, then waits for the user to answer at their own pace before processing all answers in a single pass.
1170
+
1171
+ **Full step-by-step instructions:** @~/.claude/sdd/workflows/discuss-phase-power.md
1172
+
1173
+ **Summary of flow:**
1174
+ 1. Run the same phase analysis (gray area identification) as standard mode
1175
+ 2. Write all questions to `{phase_dir}/{padded_phase}-QUESTIONS.json` and `{phase_dir}/{padded_phase}-QUESTIONS.html`
1176
+ 3. Notify user with file paths and wait for a "refresh" or "finalize" command
1177
+ 4. On "refresh": read the JSON, process answered questions, update stats and HTML
1178
+ 5. On "finalize": read all answers from JSON, generate CONTEXT.md in the standard format
1179
+ </power_user_mode>
1180
+
1034
1181
  <success_criteria>
1035
1182
  - Phase validated against roadmap
1036
1183
  - Prior context loaded (PROJECT.md, REQUIREMENTS.md, STATE.md, prior CONTEXT.md files)
@@ -1046,4 +1193,9 @@ Route to `confirm_creation` step (existing behavior — show manual next steps).
1046
1193
  - Deferred ideas preserved for future phases
1047
1194
  - STATE.md updated with session info
1048
1195
  - User knows next steps
1196
+ - Checkpoint file written after each area completes (incremental save)
1197
+ - Interrupted sessions can be resumed from checkpoint (no re-answering completed areas)
1198
+ - Checkpoint file cleaned up after successful CONTEXT.md write
1199
+ - `--chain` triggers interactive discuss followed by auto plan+execute (no auto-answering)
1200
+ - `--chain` and `--auto` both persist chain flag and auto-advance to plan-phase
1049
1201
  </success_criteria>
@@ -11,6 +11,8 @@ Read all files referenced by the invoking prompt's execution_context before star
11
11
  <step name="validate">
12
12
  **Check for input.**
13
13
 
14
+
15
+ **Text mode (`workflow.text_mode: true` in config or `--text` flag):** Set `TEXT_MODE=true` if `--text` is present in `$ARGUMENTS` OR `text_mode` from init JSON is `true`. When TEXT_MODE is active, replace every `AskUserQuestion` call with a plain-text numbered list and ask the user to type their choice number. This is required for non-Claude runtimes (OpenAI Codex, Gemini CLI, etc.) where `AskUserQuestion` is not available.
14
16
  If `$ARGUMENTS` is empty, ask via AskUserQuestion:
15
17
 
16
18
  ```
@@ -37,31 +39,31 @@ Evaluate `$ARGUMENTS` against these routing rules. Apply the **first matching**
37
39
 
38
40
  | If the text describes... | Route to | Why |
39
41
  |--------------------------|----------|-----|
40
- | Starting a new project, "set up", "initialize" | `/sdd:new-project` | Needs full project initialization |
41
- | Mapping or analyzing an existing codebase | `/sdd:map-codebase` | Codebase discovery |
42
- | A bug, error, crash, failure, or something broken | `/sdd:debug` | Needs systematic investigation |
43
- | Exploring, researching, comparing, or "how does X work" | `/sdd:research-phase` | Domain research before planning |
44
- | Discussing vision, "how should X look", brainstorming | `/sdd:discuss-phase` | Needs context gathering |
45
- | A complex task: refactoring, migration, multi-file architecture, system redesign | `/sdd:add-phase` | Needs a full phase with plan/build cycle |
46
- | Planning a specific phase or "plan phase N" | `/sdd:plan-phase` | Direct planning request |
47
- | Executing a phase or "build phase N", "run phase N" | `/sdd:execute-phase` | Direct execution request |
48
- | Running all remaining phases automatically | `/sdd:autonomous` | Full autonomous execution |
49
- | A review or quality concern about existing work | `/sdd:verify-work` | Needs verification |
50
- | Checking progress, status, "where am I" | `/sdd:progress` | Status check |
51
- | Resuming work, "pick up where I left off" | `/sdd:resume-work` | Session restoration |
52
- | A note, idea, or "remember to..." | `/sdd:add-todo` | Capture for later |
53
- | Adding tests, "write tests", "test coverage" | `/sdd:add-tests` | Test generation |
54
- | Completing a milestone, shipping, releasing | `/sdd:complete-milestone` | Milestone lifecycle |
55
- | A specific, actionable, small task (add feature, fix typo, update config) | `/sdd:quick` | Self-contained, single executor |
56
-
57
- **Requires `.planning/` directory:** All routes except `/sdd:new-project`, `/sdd:map-codebase`, `/sdd:help`, and `/sdd:join-discord`. If the project doesn't exist and the route requires it, suggest `/sdd:new-project` first.
42
+ | Starting a new project, "set up", "initialize" | `/sdd-new-project` | Needs full project initialization |
43
+ | Mapping or analyzing an existing codebase | `/sdd-map-codebase` | Codebase discovery |
44
+ | A bug, error, crash, failure, or something broken | `/sdd-debug` | Needs systematic investigation |
45
+ | Exploring, researching, comparing, or "how does X work" | `/sdd-research-phase` | Domain research before planning |
46
+ | Discussing vision, "how should X look", brainstorming | `/sdd-discuss-phase` | Needs context gathering |
47
+ | A complex task: refactoring, migration, multi-file architecture, system redesign | `/sdd-add-phase` | Needs a full phase with plan/build cycle |
48
+ | Planning a specific phase or "plan phase N" | `/sdd-plan-phase` | Direct planning request |
49
+ | Executing a phase or "build phase N", "run phase N" | `/sdd-execute-phase` | Direct execution request |
50
+ | Running all remaining phases automatically | `/sdd-autonomous` | Full autonomous execution |
51
+ | A review or quality concern about existing work | `/sdd-verify-work` | Needs verification |
52
+ | Checking progress, status, "where am I" | `/sdd-progress` | Status check |
53
+ | Resuming work, "pick up where I left off" | `/sdd-resume-work` | Session restoration |
54
+ | A note, idea, or "remember to..." | `/sdd-add-todo` | Capture for later |
55
+ | Adding tests, "write tests", "test coverage" | `/sdd-add-tests` | Test generation |
56
+ | Completing a milestone, shipping, releasing | `/sdd-complete-milestone` | Milestone lifecycle |
57
+ | A specific, actionable, small task (add feature, fix typo, update config) | `/sdd-quick` | Self-contained, single executor |
58
+
59
+ **Requires `.planning/` directory:** All routes except `/sdd-new-project`, `/sdd-map-codebase`, `/sdd-help`, and `/sdd-join-discord`. If the project doesn't exist and the route requires it, suggest `/sdd-new-project` first.
58
60
 
59
61
  **Ambiguity handling:** If the text could reasonably match multiple routes, ask the user via AskUserQuestion with the top 2-3 options. For example:
60
62
 
61
63
  ```
62
64
  "Refactor the authentication system" could be:
63
- 1. /sdd:add-phase — Full planning cycle (recommended for multi-file refactors)
64
- 2. /sdd:quick — Quick execution (if scope is small and clear)
65
+ 1. /sdd-add-phase — Full planning cycle (recommended for multi-file refactors)
66
+ 2. /sdd-quick — Quick execution (if scope is small and clear)
65
67
 
66
68
  Which approach fits better?
67
69
  ```
@@ -84,7 +86,7 @@ Which approach fits better?
84
86
  <step name="dispatch">
85
87
  **Invoke the chosen command.**
86
88
 
87
- Run the selected `/sdd:*` command, passing `$ARGUMENTS` as args.
89
+ Run the selected `/sdd-*` command, passing `$ARGUMENTS` as args.
88
90
 
89
91
  If the chosen command expects a phase number and one wasn't provided in the text, extract it from context or ask via AskUserQuestion.
90
92