@bhargavvc/sdd-cc 1.30.0 → 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 +2151 -551
  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
@@ -6,6 +6,10 @@ Create executable phase prompts (PLAN.md files) for a roadmap phase with integra
6
6
  Read all files referenced by the invoking prompt's execution_context before starting.
7
7
 
8
8
  @~/.claude/sdd/references/ui-brand.md
9
+ @~/.claude/sdd/references/revision-loop.md
10
+ @~/.claude/sdd/references/gate-prompts.md
11
+ @~/.claude/sdd/references/agent-contracts.md
12
+ @~/.claude/sdd/references/gates.md
9
13
  </required_reading>
10
14
 
11
15
  <available_agent_types>
@@ -27,17 +31,22 @@ if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi
27
31
  AGENT_SKILLS_RESEARCHER=$(node "$HOME/.claude/sdd/bin/sdd-tools.cjs" agent-skills sdd-researcher 2>/dev/null)
28
32
  AGENT_SKILLS_PLANNER=$(node "$HOME/.claude/sdd/bin/sdd-tools.cjs" agent-skills sdd-planner 2>/dev/null)
29
33
  AGENT_SKILLS_CHECKER=$(node "$HOME/.claude/sdd/bin/sdd-tools.cjs" agent-skills sdd-checker 2>/dev/null)
34
+ CONTEXT_WINDOW=$(node "$HOME/.claude/sdd/bin/sdd-tools.cjs" config-get context_window 2>/dev/null || echo "200000")
30
35
  ```
31
36
 
32
- Parse JSON for: `researcher_model`, `planner_model`, `checker_model`, `research_enabled`, `plan_checker_enabled`, `nyquist_validation_enabled`, `commit_docs`, `text_mode`, `phase_found`, `phase_dir`, `phase_number`, `phase_name`, `phase_slug`, `padded_phase`, `has_research`, `has_context`, `has_reviews`, `has_plans`, `plan_count`, `planning_exists`, `roadmap_exists`, `phase_req_ids`.
37
+ When `CONTEXT_WINDOW >= 500000`, the planner prompt includes prior phase CONTEXT.md files so cross-phase decisions are consistent (e.g., "use library X for all data fetching" from Phase 2 is visible to Phase 5's planner).
38
+
39
+ Parse JSON for: `researcher_model`, `planner_model`, `checker_model`, `research_enabled`, `plan_checker_enabled`, `nyquist_validation_enabled`, `commit_docs`, `text_mode`, `phase_found`, `phase_dir`, `phase_number`, `phase_name`, `phase_slug`, `padded_phase`, `has_research`, `has_context`, `has_reviews`, `has_plans`, `plan_count`, `planning_exists`, `roadmap_exists`, `phase_req_ids`, `response_language`.
40
+
41
+ **If `response_language` is set:** Include `response_language: {value}` in all spawned subagent prompts so any user-facing output stays in the configured language.
33
42
 
34
43
  **File paths (for <files_to_read> blocks):** `state_path`, `roadmap_path`, `requirements_path`, `context_path`, `research_path`, `verification_path`, `uat_path`, `reviews_path`. These are null if files don't exist.
35
44
 
36
- **If `planning_exists` is false:** Error — run `/sdd:new-project` first.
45
+ **If `planning_exists` is false:** Error — run `/sdd-new-project` first.
37
46
 
38
47
  ## 2. Parse and Normalize Arguments
39
48
 
40
- Extract from $ARGUMENTS: phase number (integer or decimal like `2.1`), flags (`--research`, `--skip-research`, `--gaps`, `--skip-verify`, `--prd <filepath>`, `--reviews`, `--text`).
49
+ Extract from $ARGUMENTS: phase number (integer or decimal like `2.1`), flags (`--research`, `--skip-research`, `--gaps`, `--skip-verify`, `--skip-ui`, `--prd <filepath>`, `--reviews`, `--text`).
41
50
 
42
51
  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 Claude Code remote sessions (`/rc` mode) where TUI menus don't work through the Claude App.
43
52
 
@@ -64,9 +73,9 @@ Error:
64
73
  ```
65
74
  No REVIEWS.md found for Phase {N}. Run reviews first:
66
75
 
67
- /sdd:review --phase {N}
76
+ /sdd-review --phase {N}
68
77
 
69
- Then re-run /sdd:plan-phase {N} --reviews
78
+ Then re-run /sdd-plan-phase {N} --reviews
70
79
  ```
71
80
  Exit workflow.
72
81
 
@@ -226,12 +235,52 @@ If "Run discuss-phase first":
226
235
  does not work correctly in nested subcontexts (#1009). Instead, display the command
227
236
  and exit so the user runs it as a top-level command:
228
237
  ```
229
- Run this command first, then re-run /sdd:plan-phase {X} ${SDD_WS}:
238
+ Run this command first, then re-run /sdd-plan-phase {X} ${SDD_WS}:
230
239
 
231
- /sdd:discuss-phase {X} ${SDD_WS}
240
+ /sdd-discuss-phase {X} ${SDD_WS}
232
241
  ```
233
242
  **Exit the plan-phase workflow. Do not continue.**
234
243
 
244
+ ## 4.5. Check AI-SPEC
245
+
246
+ **Skip if:** `ai_integration_phase_enabled` from config is false, or `--skip-ai-spec` flag provided.
247
+
248
+ ```bash
249
+ AI_SPEC_FILE=$(ls "${PHASE_DIR}"/*-AI-SPEC.md 2>/dev/null | head -1)
250
+ AI_PHASE_CFG=$(node "$HOME/.claude/sdd/bin/sdd-tools.cjs" config-get workflow.ai_integration_phase 2>/dev/null || echo "true")
251
+ ```
252
+
253
+ **Skip if `AI_PHASE_CFG` is `false`.**
254
+
255
+ **If `AI_SPEC_FILE` is empty:** Check phase goal for AI keywords:
256
+ ```bash
257
+ echo "${phase_goal}" | grep -qi "agent\|llm\|rag\|chatbot\|embedding\|langchain\|llamaindex\|crewai\|langgraph\|openai\|anthropic\|vector\|eval\|ai system"
258
+ ```
259
+
260
+ **If AI keywords detected AND no AI-SPEC.md:**
261
+ ```
262
+ ◆ Note: This phase appears to involve AI system development.
263
+ Consider running /sdd-ai-integration-phase {N} before planning to:
264
+ - Select the right framework for your use case
265
+ - Research its docs and best practices
266
+ - Design an evaluation strategy
267
+
268
+ Continue planning without AI-SPEC? (non-blocking — /sdd-ai-integration-phase can be run after)
269
+ ```
270
+
271
+ Use AskUserQuestion with options:
272
+ - "Continue — plan without AI-SPEC"
273
+ - "Stop — I'll run /sdd-ai-integration-phase {N} first"
274
+
275
+ If "Stop": Exit with `/sdd-ai-integration-phase {N}` reminder.
276
+ If "Continue": Proceed. (Non-blocking — planner will note AI-SPEC is absent.)
277
+
278
+ **If `AI_SPEC_FILE` is non-empty:** Extract framework for planner context:
279
+ ```bash
280
+ FRAMEWORK_LINE=$(grep "Selected Framework:" "${AI_SPEC_FILE}" | head -1)
281
+ ```
282
+ Pass `ai_spec_path` and `framework_line` to planner in step 7 so it can reference the AI design contract.
283
+
235
284
  ## 5. Handle Research
236
285
 
237
286
  **Skip if:** `--gaps` flag or `--skip-research` flag or `--reviews` flag.
@@ -296,7 +345,7 @@ Answer: "What do I need to know to PLAN this phase well?"
296
345
  </objective>
297
346
 
298
347
  <files_to_read>
299
- - {context_path} (USER DECISIONS from /sdd:discuss-phase)
348
+ - {context_path} (USER DECISIONS from /sdd-discuss-phase)
300
349
  - {requirements_path} (Project requirements)
301
350
  - {state_path} (Project decisions and history)
302
351
  </files_to_read>
@@ -360,6 +409,32 @@ test -f "${PHASE_DIR}/${PADDED_PHASE}-VALIDATION.md" && echo "VALIDATION_CREATED
360
409
 
361
410
  **If not found:** Warn and continue — plans may fail Dimension 8.
362
411
 
412
+ ## 5.55. Security Threat Model Gate
413
+
414
+ > Skip if `workflow.security_enforcement` is explicitly `false`. Absent = enabled.
415
+
416
+ ```bash
417
+ SECURITY_CFG=$(node "$HOME/.claude/sdd/bin/sdd-tools.cjs" config-get workflow.security_enforcement --raw 2>/dev/null || echo "true")
418
+ SECURITY_ASVS=$(node "$HOME/.claude/sdd/bin/sdd-tools.cjs" config-get workflow.security_asvs_level --raw 2>/dev/null || echo "1")
419
+ SECURITY_BLOCK=$(node "$HOME/.claude/sdd/bin/sdd-tools.cjs" config-get workflow.security_block_on --raw 2>/dev/null || echo "high")
420
+ ```
421
+
422
+ **If `SECURITY_CFG` is `false`:** Skip to step 5.6.
423
+
424
+ **If `SECURITY_CFG` is `true`:** Display banner:
425
+
426
+ ```
427
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
428
+ SDD ► SECURITY THREAT MODEL REQUIRED (ASVS L{SECURITY_ASVS})
429
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
430
+
431
+ Each PLAN.md must include a <threat_model> block.
432
+ Block on: {SECURITY_BLOCK} severity threats.
433
+ Opt out: set security_enforcement: false in .planning/config.json
434
+ ```
435
+
436
+ Continue to step 5.6. Security config is passed to the planner in step 8.
437
+
363
438
  ## 5.6. UI Design Contract Gate
364
439
 
365
440
  > Skip if `workflow.ui_phase` is explicitly `false` AND `workflow.ui_safety_gate` is explicitly `false` in `.planning/config.json`. If keys are absent, treat as enabled.
@@ -388,28 +463,106 @@ UI_SPEC_FILE=$(ls "${PHASE_DIR}"/*-UI-SPEC.md 2>/dev/null | head -1)
388
463
 
389
464
  **If UI-SPEC.md found:** Set `UI_SPEC_PATH=$UI_SPEC_FILE`. Display: `Using UI design contract: ${UI_SPEC_PATH}`
390
465
 
466
+ **If UI-SPEC.md missing AND `--skip-ui` flag is present in $ARGUMENTS:** Skip silently to step 6.
467
+
391
468
  **If UI-SPEC.md missing AND `UI_GATE_CFG` is `true`:**
392
469
 
393
- If `TEXT_MODE` is true, present as a plain-text numbered list:
470
+ Read auto-chain state:
471
+ ```bash
472
+ AUTO_CHAIN=$(node "$HOME/.claude/sdd/bin/sdd-tools.cjs" config-get workflow._auto_chain_active 2>/dev/null || echo "false")
394
473
  ```
395
- Phase {N} has frontend indicators but no UI-SPEC.md. Generate a design contract before planning?
396
474
 
397
- 1. Generate UI-SPEC first Run /sdd:ui-phase {N} then re-run /sdd:plan-phase {N}
398
- 2. Continue without UI-SPEC
399
- 3. Not a frontend phase
475
+ **If `AUTO_CHAIN` is `true` (running inside a `--chain` or `--auto` pipeline):**
400
476
 
401
- Enter number:
477
+ Auto-generate UI-SPEC without prompting:
478
+ ```
479
+ Skill(skill="sdd-ui-phase", args="${PHASE} --auto ${SDD_WS}")
402
480
  ```
481
+ After `sdd-ui-phase` returns, re-read:
482
+ ```bash
483
+ UI_SPEC_FILE=$(ls "${PHASE_DIR}"/*-UI-SPEC.md 2>/dev/null | head -1)
484
+ UI_SPEC_PATH="${UI_SPEC_FILE}"
485
+ ```
486
+ Continue to step 6.
403
487
 
404
- Otherwise use AskUserQuestion:
405
- - header: "UI Design Contract"
406
- - question: "Phase {N} has frontend indicators but no UI-SPEC.md. Generate a design contract before planning?"
407
- - options:
408
- - "Generate UI-SPEC first" → Display: "Run `/sdd:ui-phase {N} ${SDD_WS}` then re-run `/sdd:plan-phase {N} ${SDD_WS}`". Exit workflow.
409
- - "Continue without UI-SPEC" Continue to step 6.
410
- - "Not a frontend phase" → Continue to step 6.
488
+ **If `AUTO_CHAIN` is `false` (manual invocation):**
489
+
490
+ Output this markdown directly (not as a code block):
491
+
492
+ ```
493
+ ## UI-SPEC.md missing for Phase {N}
494
+ Recommended next step:
495
+ `/sdd-ui-phase {N} ${SDD_WS}` — generate UI design contract before planning
496
+ ───────────────────────────────────────────────
497
+ Also available:
498
+ - `/sdd-plan-phase {N} --skip-ui ${SDD_WS}` — plan without UI-SPEC (not recommended for frontend phases)
499
+ ```
500
+
501
+ **Exit the plan-phase workflow. Do not continue.**
502
+
503
+ **If `HAS_UI` is 1 (no frontend indicators):** Skip silently to step 5.7.
504
+
505
+ ## 5.7. Schema Push Detection Gate
411
506
 
412
- **If `HAS_UI` is 1 (no frontend indicators):** Skip silently to step 6.
507
+ > Detects schema-relevant files in the phase scope and injects a mandatory `[BLOCKING]` schema push task into the plan. Prevents false-positive verification where build/types pass because TypeScript types come from config, not the live database.
508
+
509
+ Check if any files in the phase scope match schema patterns:
510
+
511
+ ```bash
512
+ PHASE_SECTION=$(node "$HOME/.claude/sdd/bin/sdd-tools.cjs" roadmap get-phase "${PHASE}" --pick section 2>/dev/null)
513
+ ```
514
+
515
+ Scan `PHASE_SECTION`, `CONTEXT.md` (if loaded), and `RESEARCH.md` (if exists) for file paths matching these ORM patterns:
516
+
517
+ | ORM | File Patterns |
518
+ |-----|--------------|
519
+ | Payload CMS | `src/collections/**/*.ts`, `src/globals/**/*.ts` |
520
+ | Prisma | `prisma/schema.prisma`, `prisma/schema/*.prisma` |
521
+ | Drizzle | `drizzle/schema.ts`, `src/db/schema.ts`, `drizzle/*.ts` |
522
+ | Supabase | `supabase/migrations/*.sql` |
523
+ | TypeORM | `src/entities/**/*.ts`, `src/migrations/**/*.ts` |
524
+
525
+ Also check if any existing PLAN.md files for this phase already reference these file patterns in `files_modified`.
526
+
527
+ **If schema-relevant files detected:**
528
+
529
+ Set `SCHEMA_PUSH_REQUIRED=true` and `SCHEMA_ORM={detected_orm}`.
530
+
531
+ Determine the push command for the detected ORM:
532
+
533
+ | ORM | Push Command | Non-TTY Workaround |
534
+ |-----|-------------|-------------------|
535
+ | Payload CMS | `npx payload migrate` | `CI=true PAYLOAD_MIGRATING=true npx payload migrate` |
536
+ | Prisma | `npx prisma db push` | `npx prisma db push --accept-data-loss` (if destructive) |
537
+ | Drizzle | `npx drizzle-kit push` | `npx drizzle-kit push` |
538
+ | Supabase | `supabase db push` | Set `SUPABASE_ACCESS_TOKEN` env var |
539
+ | TypeORM | `npx typeorm migration:run` | `npx typeorm migration:run -d src/data-source.ts` |
540
+
541
+ Inject the following into the planner prompt (step 8) as an additional constraint:
542
+
543
+ ```markdown
544
+ <schema_push_requirement>
545
+ **[BLOCKING] Schema Push Required**
546
+
547
+ This phase modifies schema-relevant files ({detected_files}). The planner MUST include
548
+ a `[BLOCKING]` task that runs the database schema push command AFTER all schema file
549
+ modifications are complete but BEFORE verification.
550
+
551
+ - ORM detected: {SCHEMA_ORM}
552
+ - Push command: {push_command}
553
+ - Non-TTY workaround: {env_hint}
554
+ - If push requires interactive prompts that cannot be suppressed, flag the task for
555
+ manual intervention with `autonomous: false`
556
+
557
+ This task is mandatory — the phase CANNOT pass verification without it. Build and
558
+ type checks will pass without the push (types come from config, not the live database),
559
+ creating a false-positive verification state.
560
+ </schema_push_requirement>
561
+ ```
562
+
563
+ Display: `Schema files detected ({SCHEMA_ORM}) — [BLOCKING] push task will be injected into plans`
564
+
565
+ **If no schema-relevant files detected:** Skip silently to step 6.
413
566
 
414
567
  ## 6. Check Existing Plans
415
568
 
@@ -453,7 +606,7 @@ VALIDATION_EXISTS=$(ls "${PHASE_DIR}"/*-VALIDATION.md 2>/dev/null | head -1)
453
606
  ```
454
607
 
455
608
  If missing and Nyquist is still enabled/applicable — ask user:
456
- 1. Re-run: `/sdd:plan-phase {PHASE} --research ${SDD_WS}`
609
+ 1. Re-run: `/sdd-plan-phase {PHASE} --research ${SDD_WS}`
457
610
  2. Disable Nyquist with the exact command:
458
611
  `node "$HOME/.claude/sdd/bin/sdd-tools.cjs" config-set workflow.nyquist_validation false`
459
612
  3. Continue anyway (plans fail Dimension 8)
@@ -482,12 +635,17 @@ Planner prompt:
482
635
  - {state_path} (Project State)
483
636
  - {roadmap_path} (Roadmap)
484
637
  - {requirements_path} (Requirements)
485
- - {context_path} (USER DECISIONS from /sdd:discuss-phase)
638
+ - {context_path} (USER DECISIONS from /sdd-discuss-phase)
486
639
  - {research_path} (Technical Research)
487
640
  - {verification_path} (Verification Gaps - if --gaps)
488
641
  - {uat_path} (UAT Gaps - if --gaps)
489
642
  - {reviews_path} (Cross-AI Review Feedback - if --reviews)
490
643
  - {UI_SPEC_PATH} (UI Design Contract — visual/interaction specs, if exists)
644
+ ${CONTEXT_WINDOW >= 500000 ? `
645
+ **Cross-phase context (1M model enrichment):**
646
+ - Prior phase CONTEXT.md files (locked decisions from earlier phases — maintain consistency)
647
+ - Prior phase SUMMARY.md files (what was actually built — reuse patterns, avoid duplication)
648
+ ` : ''}
491
649
  </files_to_read>
492
650
 
493
651
  ${AGENT_SKILLS_PLANNER}
@@ -496,10 +654,11 @@ ${AGENT_SKILLS_PLANNER}
496
654
 
497
655
  **Project instructions:** Read ./CLAUDE.md if exists — follow project-specific guidelines
498
656
  **Project skills:** Check .claude/skills/ or .agents/skills/ directory (if either exists) — read SKILL.md files, plans should account for project skill rules
657
+
499
658
  </planning_context>
500
659
 
501
660
  <downstream_consumer>
502
- Output consumed by /sdd:execute-phase. Plans need:
661
+ Output consumed by /sdd-execute-phase. Plans need:
503
662
  - Frontmatter (wave, depends_on, files_modified, autonomous)
504
663
  - Tasks in XML format with read_first and acceptance_criteria fields (MANDATORY on every task)
505
664
  - Verification criteria
@@ -560,9 +719,42 @@ Task(
560
719
  ## 9. Handle Planner Return
561
720
 
562
721
  - **`## PLANNING COMPLETE`:** Display plan count. If `--skip-verify` or `plan_checker_enabled` is false (from init): skip to step 13. Otherwise: step 10.
722
+ - **`## PHASE SPLIT RECOMMENDED`:** The planner determined the phase is too complex to implement all user decisions without simplifying them. Handle in step 9b.
563
723
  - **`## CHECKPOINT REACHED`:** Present to user, get response, spawn continuation (step 12)
564
724
  - **`## PLANNING INCONCLUSIVE`:** Show attempts, offer: Add context / Retry / Manual
565
725
 
726
+ ## 9b. Handle Phase Split Recommendation
727
+
728
+ When the planner returns `## PHASE SPLIT RECOMMENDED`, it means the phase has too many decisions to implement at full fidelity within the plan budget. The planner proposes groupings.
729
+
730
+ **Extract from planner return:**
731
+ - Proposed sub-phases (e.g., "17a: processing core (D-01 to D-19)", "17b: billing + config UX (D-20 to D-27)")
732
+ - Which D-XX decisions go in each sub-phase
733
+ - Why the split is necessary (decision count, complexity estimate)
734
+
735
+ **Present to user:**
736
+ ```
737
+ ## Phase {X} is too complex for full-fidelity implementation
738
+
739
+ The planner found {N} decisions that cannot all be implemented without
740
+ simplifying some. Instead of reducing your decisions, we recommend splitting:
741
+
742
+ **Option 1: Split into sub-phases**
743
+ - Phase {X}a: {name} — {D-XX to D-YY} ({N} decisions)
744
+ - Phase {X}b: {name} — {D-XX to D-YY} ({M} decisions)
745
+
746
+ **Option 2: Proceed anyway** (planner will attempt all, quality may degrade)
747
+
748
+ **Option 3: Prioritize** — you choose which decisions to implement now,
749
+ rest become a follow-up phase
750
+ ```
751
+
752
+ Use AskUserQuestion with these 3 options.
753
+
754
+ **If "Split":** Use `/sdd-insert-phase` to create the sub-phases, then replan each.
755
+ **If "Proceed":** Return to planner with instruction to attempt all decisions at full fidelity, accepting more plans/tasks.
756
+ **If "Prioritize":** Use AskUserQuestion (multiSelect) to let user pick which D-XX are "now" vs "later". Create CONTEXT.md for each sub-phase with the selected decisions.
757
+
566
758
  ## 10. Spawn sdd-plan-checker Agent
567
759
 
568
760
  Display banner:
@@ -585,7 +777,7 @@ Checker prompt:
585
777
  - {PHASE_DIR}/*-PLAN.md (Plans to verify)
586
778
  - {roadmap_path} (Roadmap)
587
779
  - {requirements_path} (Requirements)
588
- - {context_path} (USER DECISIONS from /sdd:discuss-phase)
780
+ - {context_path} (USER DECISIONS from /sdd-discuss-phase)
589
781
  - {research_path} (Technical Research — includes Validation Architecture)
590
782
  </files_to_read>
591
783
 
@@ -617,13 +809,56 @@ Task(
617
809
  - **`## VERIFICATION PASSED`:** Display confirmation, proceed to step 13.
618
810
  - **`## ISSUES FOUND`:** Display issues, check iteration count, proceed to step 12.
619
811
 
812
+ **Thinking partner for architectural tradeoffs (conditional):**
813
+ If `features.thinking_partner` is enabled, scan the checker's issues for architectural tradeoff keywords
814
+ ("architecture", "approach", "strategy", "pattern", "vs", "alternative"). If found:
815
+
816
+ ```
817
+ The plan-checker flagged an architectural decision point:
818
+ {issue description}
819
+
820
+ Brief analysis:
821
+ - Option A: {approach_from_plan} — {pros/cons}
822
+ - Option B: {alternative_approach} — {pros/cons}
823
+ - Recommendation: {choice} aligned with {phase_goal}
824
+
825
+ Apply this to the revision? [Yes] / [No, I'll decide]
826
+ ```
827
+
828
+ If yes: include the recommendation in the revision prompt. If no: proceed to revision loop as normal.
829
+ If thinking_partner disabled: skip this block entirely.
830
+
620
831
  ## 12. Revision Loop (Max 3 Iterations)
621
832
 
622
833
  Track `iteration_count` (starts at 1 after initial plan + check).
834
+ Track `prev_issue_count` (initialized to `Infinity` before the loop begins).
835
+ Track `stall_reentry_count` (starts at 0; incremented each time "Adjust approach" re-enters step 8).
623
836
 
624
837
  **If iteration_count < 3:**
625
838
 
626
- Display: `Sending back to planner for revision... (iteration {N}/3)`
839
+ Parse issue count from checker return: count BLOCKER + WARNING entries in the YAML issues block (structured output from sdd-plan-checker). If the checker's return contains no YAML issues block (i.e., the plan was approved with no issues), treat `issue_count` as 0 and skip the stall check — the plan passed. Proceed to step 13.
840
+
841
+ Display: `Revision iteration {N}/3 -- {blocker_count} blockers, {warning_count} warnings`
842
+
843
+ **Stall detection:** If `issue_count >= prev_issue_count`:
844
+ Display: `Revision loop stalled — issue count not decreasing ({issue_count} issues remain after {N} iterations)`
845
+
846
+ **If `stall_reentry_count < 2`:**
847
+ Ask user:
848
+ Question: "Issues remain after {N} revision attempts with no progress. Proceed with current output?"
849
+ Options: "Proceed anyway" | "Adjust approach"
850
+ If "Proceed anyway": accept current plans and continue to step 13.
851
+ If "Adjust approach": increment `stall_reentry_count`, open freeform discussion, then re-enter step 8 (full replanning). Note: re-entry resets `iteration_count` and `prev_issue_count` but `stall_reentry_count` persists across re-entries and is capped at 2.
852
+
853
+ **If `stall_reentry_count >= 2`:**
854
+ Display: `Stall persists after 2 re-planning attempts. The following issues could not be resolved automatically:`
855
+ List the remaining issues from the checker.
856
+ Suggest: "Consider resolving these issues manually or running `/sdd-debug` to investigate root causes."
857
+ Options: "Proceed anyway" | "Abandon"
858
+ If "Proceed anyway": accept current plans and continue to step 13.
859
+ If "Abandon": stop workflow.
860
+
861
+ Set `prev_issue_count = issue_count`.
627
862
 
628
863
  Revision prompt:
629
864
 
@@ -634,7 +869,7 @@ Revision prompt:
634
869
 
635
870
  <files_to_read>
636
871
  - {PHASE_DIR}/*-PLAN.md (Existing plans)
637
- - {context_path} (USER DECISIONS from /sdd:discuss-phase)
872
+ - {context_path} (USER DECISIONS from /sdd-discuss-phase)
638
873
  </files_to_read>
639
874
 
640
875
  ${AGENT_SKILLS_PLANNER}
@@ -717,6 +952,16 @@ Options:
717
952
 
718
953
  If `TEXT_MODE` is true, present as a plain-text numbered list (options already shown in the block above). Otherwise use AskUserQuestion to present the options.
719
954
 
955
+ ## 13b. Record Planning Completion in STATE.md
956
+
957
+ After plans pass all gates, record that planning is complete so STATE.md reflects the new phase status:
958
+
959
+ ```bash
960
+ node "$HOME/.claude/sdd/bin/sdd-tools.cjs" state planned-phase --phase "${PHASE_NUMBER}" --name "${PHASE_NAME}" --plans "${PLAN_COUNT}"
961
+ ```
962
+
963
+ This updates STATUS to "Ready to execute", sets the correct plan count, and timestamps Last Activity.
964
+
720
965
  ## 14. Present Final Status
721
966
 
722
967
  Route to `<offer_next>` OR `auto_advance` depending on flags/config.
@@ -725,10 +970,10 @@ Route to `<offer_next>` OR `auto_advance` depending on flags/config.
725
970
 
726
971
  Check for auto-advance trigger:
727
972
 
728
- 1. Parse `--auto` flag from $ARGUMENTS
729
- 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):
973
+ 1. Parse `--auto` and `--chain` flags from $ARGUMENTS
974
+ 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):
730
975
  ```bash
731
- if [[ ! "$ARGUMENTS" =~ --auto ]]; then
976
+ if [[ ! "$ARGUMENTS" =~ --auto ]] && [[ ! "$ARGUMENTS" =~ --chain ]]; then
732
977
  node "$HOME/.claude/sdd/bin/sdd-tools.cjs" config-set workflow._auto_chain_active false 2>/dev/null
733
978
  fi
734
979
  ```
@@ -738,7 +983,14 @@ Check for auto-advance trigger:
738
983
  AUTO_CFG=$(node "$HOME/.claude/sdd/bin/sdd-tools.cjs" config-get workflow.auto_advance 2>/dev/null || echo "false")
739
984
  ```
740
985
 
741
- **If `--auto` flag present OR `AUTO_CHAIN` is true OR `AUTO_CFG` is true:**
986
+ **If `--auto` or `--chain` flag present AND `AUTO_CHAIN` is not true:** Persist chain flag to config (handles direct invocation without prior discuss-phase):
987
+ ```bash
988
+ if ([[ "$ARGUMENTS" =~ --auto ]] || [[ "$ARGUMENTS" =~ --chain ]]) && [[ "$AUTO_CHAIN" != "true" ]]; then
989
+ node "$HOME/.claude/sdd/bin/sdd-tools.cjs" config-set workflow._auto_chain_active true
990
+ fi
991
+ ```
992
+
993
+ **If `--auto` or `--chain` flag present OR `AUTO_CHAIN` is true OR `AUTO_CFG` is true:**
742
994
 
743
995
  Display banner:
744
996
  ```
@@ -751,7 +1003,7 @@ Plans ready. Launching execute-phase...
751
1003
 
752
1004
  Launch execute-phase using the Skill tool to avoid nested Task sessions (which cause runtime freezes due to deep agent nesting):
753
1005
  ```
754
- Skill(skill="sdd:execute-phase", args="${PHASE} --auto --no-transition ${SDD_WS}")
1006
+ Skill(skill="sdd-execute-phase", args="${PHASE} --auto --no-transition ${SDD_WS}")
755
1007
  ```
756
1008
 
757
1009
  The `--no-transition` flag tells execute-phase to return status after verification instead of chaining further. This keeps the auto-advance chain flat — each phase runs at the same nesting level rather than spawning deeper Task agents.
@@ -765,14 +1017,14 @@ The `--no-transition` flag tells execute-phase to return status after verificati
765
1017
 
766
1018
  Auto-advance pipeline finished.
767
1019
 
768
- Next: /sdd:discuss-phase ${NEXT_PHASE} --auto ${SDD_WS}
1020
+ Next: /sdd-discuss-phase ${NEXT_PHASE} --auto ${SDD_WS}
769
1021
  ```
770
1022
  - **GAPS FOUND / VERIFICATION FAILED** → Display result, stop chain:
771
1023
  ```
772
1024
  Auto-advance stopped: Execution needs review.
773
1025
 
774
1026
  Review the output above and continue manually:
775
- /sdd:execute-phase ${PHASE} ${SDD_WS}
1027
+ /sdd-execute-phase ${PHASE} ${SDD_WS}
776
1028
  ```
777
1029
 
778
1030
  **If neither `--auto` nor config enabled:**
@@ -803,17 +1055,17 @@ Verification: {Passed | Passed with override | Skipped}
803
1055
 
804
1056
  **Execute Phase {X}** — run all {N} plans
805
1057
 
806
- /sdd:execute-phase {X} ${SDD_WS}
1058
+ /clear then:
807
1059
 
808
- <sub>/clear first → fresh context window</sub>
1060
+ /sdd-execute-phase {X} ${SDD_WS}
809
1061
 
810
1062
  ───────────────────────────────────────────────────────────────
811
1063
 
812
1064
  **Also available:**
813
1065
  - cat .planning/phases/{phase-dir}/*-PLAN.md — review plans
814
- - /sdd:plan-phase {X} --research — re-research first
815
- - /sdd:review --phase {X} --all — peer review plans with external AIs
816
- - /sdd:plan-phase {X} --reviews — replan incorporating review feedback
1066
+ - /sdd-plan-phase {X} --research — re-research first
1067
+ - /sdd-review --phase {X} --all — peer review plans with external AIs
1068
+ - /sdd-plan-phase {X} --reviews — replan incorporating review feedback
817
1069
 
818
1070
  ───────────────────────────────────────────────────────────────
819
1071
  </offer_next>
@@ -834,11 +1086,11 @@ stdio deadlocks with MCP servers — see Claude Code issue anthropics/claude-cod
834
1086
  Remove-Item -Recurse -Force "$env:USERPROFILE\.claude\tasks\*" -ErrorAction SilentlyContinue
835
1087
  ```
836
1088
  4. **Reduce MCP server count:** Temporarily disable non-essential MCP servers in settings.json
837
- 5. **Retry:** Restart Claude Code and run `/sdd:plan-phase` again
1089
+ 5. **Retry:** Restart Claude Code and run `/sdd-plan-phase` again
838
1090
 
839
1091
  If freezes persist, try `--skip-research` to reduce the agent chain from 3 to 2 agents:
840
1092
  ```
841
- /sdd:plan-phase N --skip-research
1093
+ /sdd-plan-phase N --skip-research
842
1094
  ```
843
1095
  </windows_troubleshooting>
844
1096
 
@@ -1,6 +1,6 @@
1
1
  <purpose>
2
2
  Capture a forward-looking idea as a structured seed file with trigger conditions.
3
- Seeds auto-surface during /sdd:new-milestone when trigger conditions match the
3
+ Seeds auto-surface during /sdd-new-milestone when trigger conditions match the
4
4
  new milestone's scope.
5
5
 
6
6
  Seeds beat deferred items because they:
@@ -32,6 +32,9 @@ mkdir -p .planning/seeds
32
32
  <step name="gather_context">
33
33
  Ask focused questions to build a complete seed:
34
34
 
35
+
36
+ **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.
37
+
35
38
  ```
36
39
  AskUserQuestion(
37
40
  header: "Trigger",
@@ -117,7 +120,7 @@ scope: {$SCOPE}
117
120
 
118
121
  **Trigger:** {$TRIGGER}
119
122
 
120
- This seed should be presented during `/sdd:new-milestone` when the milestone
123
+ This seed should be presented during `/sdd-new-milestone` when the milestone
121
124
  scope matches any of these conditions:
122
125
  - {trigger condition 1}
123
126
  - {trigger condition 2}
@@ -153,7 +156,7 @@ Trigger: {$TRIGGER}
153
156
  Scope: {$SCOPE}
154
157
  File: .planning/seeds/SEED-{PADDED}-{slug}.md
155
158
 
156
- This seed will surface automatically when you run /sdd:new-milestone
159
+ This seed will surface automatically when you run /sdd-new-milestone
157
160
  and the milestone scope matches the trigger condition.
158
161
  ```
159
162
  </step>
@@ -1,7 +1,8 @@
1
1
  <purpose>
2
- Create a clean branch for pull requests by filtering out .planning/ commits.
3
- The PR branch contains only code changes reviewers don't see SDD artifacts
4
- (PLAN.md, SUMMARY.md, STATE.md, CONTEXT.md, etc.).
2
+ Create a clean branch for pull requests by filtering out transient .planning/ commits.
3
+ The PR branch contains only code changes and structural planning state reviewers
4
+ don't see SDD transient artifacts (PLAN.md, SUMMARY.md, CONTEXT.md, RESEARCH.md, etc.)
5
+ but milestone archives, STATE.md, ROADMAP.md, and PROJECT.md changes are preserved.
5
6
 
6
7
  Uses git cherry-pick with path filtering to rebuild a clean history.
7
8
  </purpose>
@@ -48,24 +49,47 @@ Classify commits:
48
49
  git log --oneline "$TARGET".."$CURRENT_BRANCH" --no-merges
49
50
  ```
50
51
 
51
- For each commit, check if it ONLY touches .planning/ files:
52
+ **Structural planning files** always preserved (repository planning state):
53
+ - `.planning/STATE.md`
54
+ - `.planning/ROADMAP.md`
55
+ - `.planning/MILESTONES.md`
56
+ - `.planning/PROJECT.md`
57
+ - `.planning/REQUIREMENTS.md`
58
+ - `.planning/milestones/**`
59
+
60
+ **Transient planning files** — excluded from PR branch (reviewer noise):
61
+ - `.planning/phases/**` (PLAN.md, SUMMARY.md, CONTEXT.md, RESEARCH.md, etc.)
62
+ - `.planning/quick/**`
63
+ - `.planning/research/**`
64
+ - `.planning/threads/**`
65
+ - `.planning/todos/**`
66
+ - `.planning/debug/**`
67
+ - `.planning/seeds/**`
68
+ - `.planning/codebase/**`
69
+ - `.planning/ui-reviews/**`
70
+
71
+ For each commit, check what it touches:
52
72
 
53
73
  ```bash
54
74
  # For each commit hash
55
75
  FILES=$(git diff-tree --no-commit-id --name-only -r $HASH)
56
- ALL_PLANNING=$(echo "$FILES" | grep -v "^\.planning/" | wc -l)
76
+ NON_PLANNING=$(echo "$FILES" | grep -v "^\.planning/" | wc -l)
77
+ STRUCTURAL=$(echo "$FILES" | grep -E "^\.planning/(STATE|ROADMAP|MILESTONES|PROJECT|REQUIREMENTS)\.md|^\.planning/milestones/" | wc -l)
78
+ TRANSIENT_ONLY=$(echo "$FILES" | grep "^\.planning/" | grep -vE "^\.planning/(STATE|ROADMAP|MILESTONES|PROJECT|REQUIREMENTS)\.md|^\.planning/milestones/" | wc -l)
57
79
  ```
58
80
 
59
81
  Classify:
60
82
  - **Code commits**: Touch at least one non-.planning/ file → INCLUDE
61
- - **Planning-only commits**: Touch only .planning/ files → EXCLUDE
62
- - **Mixed commits**: Touch both INCLUDE (planning changes come along)
83
+ - **Structural planning commits**: Touch only structural .planning/ files (STATE.md, ROADMAP.md, MILESTONES.md, PROJECT.md, REQUIREMENTS.md, milestones/**) INCLUDE
84
+ - **Transient planning commits**: Touch only transient .planning/ files (phases/, quick/, research/, etc.) → EXCLUDE
85
+ - **Mixed commits**: Touch code + any planning files → INCLUDE (transient planning changes come along; acceptable in mixed context)
63
86
 
64
87
  Display analysis:
65
88
  ```
66
- Commits to include: {N} (code changes)
67
- Commits to exclude: {N} (planning-only)
89
+ Commits to include: {N} (code changes + structural planning)
90
+ Commits to exclude: {N} (transient planning-only)
68
91
  Mixed commits: {N} (code + planning — included)
92
+ Structural planning commits: {N} (STATE/ROADMAP/milestone updates — included)
69
93
  ```
70
94
  </step>
71
95
 
@@ -77,13 +101,17 @@ PR_BRANCH="${CURRENT_BRANCH}-pr"
77
101
  git checkout -b "$PR_BRANCH" "$TARGET"
78
102
  ```
79
103
 
80
- Cherry-pick only code commits (in order):
104
+ Cherry-pick code commits and structural planning commits (in order):
81
105
 
82
106
  ```bash
83
- for HASH in $CODE_COMMITS; do
107
+ for HASH in $CODE_AND_STRUCTURAL_COMMITS; do
84
108
  git cherry-pick "$HASH" --no-commit
85
- # Remove any .planning/ files that came along in mixed commits
86
- git rm -r --cached .planning/ 2>/dev/null || true
109
+ # Remove only transient .planning/ subdirectories that came along in mixed commits.
110
+ # DO NOT remove structural files (STATE.md, ROADMAP.md, MILESTONES.md, PROJECT.md,
111
+ # REQUIREMENTS.md, milestones/) — these must survive into the PR branch.
112
+ for dir in phases quick research threads todos debug seeds codebase ui-reviews; do
113
+ git rm -r --cached ".planning/$dir/" 2>/dev/null || true
114
+ done
87
115
  git commit -C "$HASH"
88
116
  done
89
117
  ```
@@ -114,7 +142,7 @@ Next steps:
114
142
  git push origin {PR_BRANCH}
115
143
  gh pr create --base {TARGET} --head {PR_BRANCH}
116
144
 
117
- Or use /sdd:ship to create the PR automatically.
145
+ Or use /sdd-ship to create the PR automatically.
118
146
  ```
119
147
  </step>
120
148