@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
@@ -0,0 +1,515 @@
1
+ <purpose>
2
+ Review source files changed during a phase for bugs, security issues, and code quality problems. Computes file scope (--files override > SUMMARY.md > git diff fallback), checks config gate, spawns sdd-code-reviewer agent, commits REVIEW.md, and presents results to user.
3
+ </purpose>
4
+
5
+ <required_reading>
6
+ Read all files referenced by the invoking prompt's execution_context before starting.
7
+ </required_reading>
8
+
9
+ <available_agent_types>
10
+ - sdd-code-reviewer: Reviews source files for bugs and quality issues
11
+ </available_agent_types>
12
+
13
+ <process>
14
+
15
+ <step name="initialize">
16
+ Parse arguments and load project state:
17
+
18
+ ```bash
19
+ PHASE_ARG="${1}"
20
+ INIT=$(node "$HOME/.claude/sdd/bin/sdd-tools.cjs" init phase-op "${PHASE_ARG}")
21
+ if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi
22
+ ```
23
+
24
+ Parse from init JSON: `phase_found`, `phase_dir`, `phase_number`, `phase_name`, `padded_phase`, `commit_docs`.
25
+
26
+ **Input sanitization (defense-in-depth):**
27
+ ```bash
28
+ # Validate PADDED_PHASE contains only digits and optional dot (e.g., "02", "03.1")
29
+ if ! [[ "$PADDED_PHASE" =~ ^[0-9]+(\.[0-9]+)?$ ]]; then
30
+ echo "Error: Invalid phase number format: '${PADDED_PHASE}'. Expected digits (e.g., 02, 03.1)."
31
+ # Exit workflow
32
+ fi
33
+ ```
34
+
35
+ **Phase validation (before config gate):**
36
+ If `phase_found` is false, report error and exit:
37
+ ```
38
+ Error: Phase ${PHASE_ARG} not found. Run /sdd-status to see available phases.
39
+ ```
40
+
41
+ This runs BEFORE config gate check so user errors are surfaced immediately regardless of config state.
42
+
43
+ Parse optional flags from $ARGUMENTS:
44
+
45
+ **--depth flag:**
46
+ ```bash
47
+ DEPTH_OVERRIDE=""
48
+ for arg in "$@"; do
49
+ if [[ "$arg" == --depth=* ]]; then
50
+ DEPTH_OVERRIDE="${arg#--depth=}"
51
+ fi
52
+ done
53
+ ```
54
+
55
+ **--files flag:**
56
+ ```bash
57
+ FILES_OVERRIDE=""
58
+ for arg in "$@"; do
59
+ if [[ "$arg" == --files=* ]]; then
60
+ FILES_OVERRIDE="${arg#--files=}"
61
+ fi
62
+ done
63
+ ```
64
+
65
+ If FILES_OVERRIDE is set, split by comma into array:
66
+ ```bash
67
+ if [ -n "$FILES_OVERRIDE" ]; then
68
+ IFS=',' read -ra FILES_ARRAY <<< "$FILES_OVERRIDE"
69
+ fi
70
+ ```
71
+ </step>
72
+
73
+ <step name="check_config_gate">
74
+ Check if code review is enabled via config:
75
+
76
+ ```bash
77
+ CODE_REVIEW_ENABLED=$(node "$HOME/.claude/sdd/bin/sdd-tools.cjs" config-get workflow.code_review 2>/dev/null || echo "true")
78
+ ```
79
+
80
+ If CODE_REVIEW_ENABLED is "false":
81
+ ```
82
+ Code review skipped (workflow.code_review=false in config)
83
+ ```
84
+ Exit workflow.
85
+
86
+ Default is true — only skip on explicit false. This check runs AFTER phase validation so invalid phase errors are shown first.
87
+ </step>
88
+
89
+ <step name="resolve_depth">
90
+ Determine review depth with priority order:
91
+
92
+ 1. DEPTH_OVERRIDE from --depth flag (highest priority)
93
+ 2. Config value: `node "$HOME/.claude/sdd/bin/sdd-tools.cjs" config-get workflow.code_review_depth 2>/dev/null`
94
+ 3. Default: "standard"
95
+
96
+ ```bash
97
+ if [ -n "$DEPTH_OVERRIDE" ]; then
98
+ REVIEW_DEPTH="$DEPTH_OVERRIDE"
99
+ else
100
+ CONFIG_DEPTH=$(node "$HOME/.claude/sdd/bin/sdd-tools.cjs" config-get workflow.code_review_depth 2>/dev/null || echo "")
101
+ REVIEW_DEPTH="${CONFIG_DEPTH:-standard}"
102
+ fi
103
+ ```
104
+
105
+ **Validate depth value:**
106
+ ```bash
107
+ case "$REVIEW_DEPTH" in
108
+ quick|standard|deep)
109
+ # Valid
110
+ ;;
111
+ *)
112
+ echo "Warning: Invalid depth '${REVIEW_DEPTH}'. Valid values: quick, standard, deep. Using 'standard'."
113
+ REVIEW_DEPTH="standard"
114
+ ;;
115
+ esac
116
+ ```
117
+ </step>
118
+
119
+ <step name="compute_file_scope">
120
+ Three-tier scoping with explicit precedence:
121
+
122
+ **Tier 1 — --files override (highest precedence per D-08):**
123
+
124
+ If FILES_OVERRIDE is set (from --files flag):
125
+ ```bash
126
+ if [ -n "$FILES_OVERRIDE" ]; then
127
+ REVIEW_FILES=()
128
+ REPO_ROOT=$(git rev-parse --show-toplevel 2>/dev/null)
129
+
130
+ for file_path in "${FILES_ARRAY[@]}"; do
131
+ # Security: validate path is within repository (prevent path traversal)
132
+ ABS_PATH=$(realpath -m "${file_path}" 2>/dev/null || echo "${file_path}")
133
+ if [[ "$ABS_PATH" != "$REPO_ROOT"* ]]; then
134
+ echo "Error: File path outside repository, skipping: ${file_path}"
135
+ continue
136
+ fi
137
+
138
+ # Validate path exists (relative to repo root)
139
+ if [ -f "${REPO_ROOT}/${file_path}" ] || [ -f "${file_path}" ]; then
140
+ REVIEW_FILES+=("$file_path")
141
+ else
142
+ echo "Warning: File not found, skipping: ${file_path}"
143
+ fi
144
+ done
145
+
146
+ echo "File scope: ${#REVIEW_FILES[@]} files from --files override"
147
+ fi
148
+ ```
149
+
150
+ Skip SUMMARY/git scoping entirely when --files is provided.
151
+
152
+ **Tier 2 — SUMMARY.md extraction (primary per D-01):**
153
+
154
+ If --files NOT provided:
155
+ ```bash
156
+ if [ -z "$FILES_OVERRIDE" ]; then
157
+ SUMMARIES=$(ls "${PHASE_DIR}"/*-SUMMARY.md 2>/dev/null)
158
+ REVIEW_FILES=()
159
+
160
+ if [ -n "$SUMMARIES" ]; then
161
+ for summary in $SUMMARIES; do
162
+ # Extract key_files.created and key_files.modified using node for reliable YAML parsing
163
+ # This avoids fragile awk parsing that breaks on indentation differences
164
+ EXTRACTED=$(node -e "
165
+ const fs = require('fs');
166
+ const content = fs.readFileSync('$summary', 'utf-8');
167
+ const match = content.match(/^---\n([\s\S]*?)\n---/);
168
+ if (!match) { process.exit(0); }
169
+ const yaml = match[1];
170
+ const files = [];
171
+ let inSection = null;
172
+ for (const line of yaml.split('\n')) {
173
+ if (/^\s+created:/.test(line)) { inSection = 'created'; continue; }
174
+ if (/^\s+modified:/.test(line)) { inSection = 'modified'; continue; }
175
+ if (/^\s+\w+:/.test(line) && !/^\s+-/.test(line)) { inSection = null; continue; }
176
+ if (inSection && /^\s+-\s+(.+)/.test(line)) {
177
+ files.push(line.match(/^\s+-\s+(.+)/)[1].trim());
178
+ }
179
+ }
180
+ if (files.length) console.log(files.join('\n'));
181
+ " 2>/dev/null)
182
+
183
+ # Add extracted files to REVIEW_FILES array
184
+ if [ -n "$EXTRACTED" ]; then
185
+ while IFS= read -r file; do
186
+ if [ -n "$file" ]; then
187
+ REVIEW_FILES+=("$file")
188
+ fi
189
+ done <<< "$EXTRACTED"
190
+ fi
191
+ done
192
+
193
+ if [ ${#REVIEW_FILES[@]} -eq 0 ]; then
194
+ echo "Warning: SUMMARY artifacts found but contained no file paths. Falling back to git diff."
195
+ fi
196
+ fi
197
+ fi
198
+ ```
199
+
200
+ **Tier 3 — Git diff fallback (per D-02):**
201
+
202
+ If no SUMMARY.md files found OR no files extracted from them:
203
+ ```bash
204
+ if [ ${#REVIEW_FILES[@]} -eq 0 ]; then
205
+ # Compute diff base from phase commits — fail closed if no reliable base found
206
+ PHASE_COMMITS=$(git log --oneline --all --grep="${PADDED_PHASE}" --format="%H" 2>/dev/null)
207
+
208
+ if [ -n "$PHASE_COMMITS" ]; then
209
+ DIFF_BASE=$(echo "$PHASE_COMMITS" | tail -1)^
210
+
211
+ # Verify the parent commit exists (first commit in repo has no parent)
212
+ if ! git rev-parse "${DIFF_BASE}" >/dev/null 2>&1; then
213
+ DIFF_BASE=$(echo "$PHASE_COMMITS" | tail -1)
214
+ fi
215
+
216
+ # Run git diff with specific exclusions (per D-03)
217
+ DIFF_FILES=$(git diff --name-only "${DIFF_BASE}..HEAD" -- . \
218
+ ':!.planning/' ':!ROADMAP.md' ':!STATE.md' \
219
+ ':!*-SUMMARY.md' ':!*-VERIFICATION.md' ':!*-PLAN.md' \
220
+ ':!package-lock.json' ':!yarn.lock' ':!Gemfile.lock' ':!poetry.lock' 2>/dev/null)
221
+
222
+ while IFS= read -r file; do
223
+ [ -n "$file" ] && REVIEW_FILES+=("$file")
224
+ done <<< "$DIFF_FILES"
225
+
226
+ echo "File scope: ${#REVIEW_FILES[@]} files from git diff (base: ${DIFF_BASE})"
227
+ else
228
+ # Fail closed — no reliable diff base found. Do not use arbitrary HEAD~N.
229
+ echo "Warning: No phase commits found for '${PADDED_PHASE}'. Cannot determine reliable diff scope."
230
+ echo "Use --files flag to specify files explicitly: /sdd-code-review ${PHASE_ARG} --files=file1,file2,..."
231
+ fi
232
+ fi
233
+ ```
234
+
235
+ **Post-processing (all tiers):**
236
+
237
+ 1. **Apply exclusions (per D-03):** Remove paths matching planning artifacts
238
+ ```bash
239
+ FILTERED_FILES=()
240
+ for file in "${REVIEW_FILES[@]}"; do
241
+ # Skip planning directory and specific artifacts
242
+ if [[ "$file" == .planning/* ]] || \
243
+ [[ "$file" == ROADMAP.md ]] || \
244
+ [[ "$file" == STATE.md ]] || \
245
+ [[ "$file" == *-SUMMARY.md ]] || \
246
+ [[ "$file" == *-VERIFICATION.md ]] || \
247
+ [[ "$file" == *-PLAN.md ]]; then
248
+ continue
249
+ fi
250
+ FILTERED_FILES+=("$file")
251
+ done
252
+ REVIEW_FILES=("${FILTERED_FILES[@]}")
253
+ ```
254
+
255
+ 2. **Filter deleted files:** Remove paths that don't exist on disk
256
+ ```bash
257
+ EXISTING_FILES=()
258
+ DELETED_COUNT=0
259
+ for file in "${REVIEW_FILES[@]}"; do
260
+ if [ -f "$file" ]; then
261
+ EXISTING_FILES+=("$file")
262
+ else
263
+ DELETED_COUNT=$((DELETED_COUNT + 1))
264
+ fi
265
+ done
266
+ REVIEW_FILES=("${EXISTING_FILES[@]}")
267
+
268
+ if [ $DELETED_COUNT -gt 0 ]; then
269
+ echo "Filtered $DELETED_COUNT deleted files from review scope"
270
+ fi
271
+ ```
272
+
273
+ 3. **Deduplicate:** Remove duplicate paths (portable — bash 3.2+ compatible, handles spaces in paths)
274
+ ```bash
275
+ DEDUPED=()
276
+ while IFS= read -r line; do
277
+ [ -n "$line" ] && DEDUPED+=("$line")
278
+ done < <(printf '%s\n' "${REVIEW_FILES[@]}" | sort -u)
279
+ REVIEW_FILES=("${DEDUPED[@]}")
280
+ ```
281
+
282
+ 4. **Sort:** Alphabetical sort for reproducible agent input (already sorted by sort -u above)
283
+
284
+ **Log final scope and warn if large:**
285
+ ```bash
286
+ if [ -n "$FILES_OVERRIDE" ]; then
287
+ TIER="--files override"
288
+ elif [ -n "$SUMMARIES" ] && [ ${#REVIEW_FILES[@]} -gt 0 ]; then
289
+ TIER="SUMMARY.md"
290
+ else
291
+ TIER="git diff"
292
+ fi
293
+ echo "File scope: ${#REVIEW_FILES[@]} files from ${TIER}"
294
+
295
+ # Warn if file count is very large — may exceed agent context or produce superficial review
296
+ if [ ${#REVIEW_FILES[@]} -gt 50 ]; then
297
+ echo "Warning: ${#REVIEW_FILES[@]} files is a large review scope."
298
+ echo "Consider using --files to narrow scope, or --depth=quick for a faster pass."
299
+ if [ "$REVIEW_DEPTH" = "deep" ]; then
300
+ echo "Switching from deep to standard depth for large file count."
301
+ REVIEW_DEPTH="standard"
302
+ fi
303
+ fi
304
+ ```
305
+ </step>
306
+
307
+ <step name="check_empty_scope">
308
+ If REVIEW_FILES is empty:
309
+ ```
310
+ No source files changed in phase ${PHASE_ARG}. Skipping review.
311
+ ```
312
+ Exit workflow. Do NOT spawn agent or create REVIEW.md.
313
+ </step>
314
+
315
+ <step name="spawn_reviewer">
316
+ Compute the review output path:
317
+ ```bash
318
+ REVIEW_PATH="${PHASE_DIR}/${PADDED_PHASE}-REVIEW.md"
319
+ ```
320
+
321
+ Compute DIFF_BASE for agent context (in case agent needs it):
322
+ ```bash
323
+ PHASE_COMMITS=$(git log --oneline --all --grep="${PADDED_PHASE}" --format="%H" 2>/dev/null)
324
+ if [ -n "$PHASE_COMMITS" ]; then
325
+ DIFF_BASE=$(echo "$PHASE_COMMITS" | tail -1)^
326
+ else
327
+ DIFF_BASE=""
328
+ fi
329
+ ```
330
+
331
+ Build files_to_read block for agent:
332
+ ```bash
333
+ FILES_TO_READ=""
334
+ for file in "${REVIEW_FILES[@]}"; do
335
+ FILES_TO_READ+="- ${file}\n"
336
+ done
337
+ ```
338
+
339
+ Build config block for agent:
340
+ ```bash
341
+ CONFIG_FILES=""
342
+ for file in "${REVIEW_FILES[@]}"; do
343
+ CONFIG_FILES+=" - ${file}\n"
344
+ done
345
+ ```
346
+
347
+ Spawn the sdd-code-reviewer agent:
348
+
349
+ ```
350
+ Task(subagent_type="sdd-code-reviewer", prompt="
351
+ <files_to_read>
352
+ ${FILES_TO_READ}
353
+ </files_to_read>
354
+
355
+ <config>
356
+ depth: ${REVIEW_DEPTH}
357
+ phase_dir: ${PHASE_DIR}
358
+ review_path: ${REVIEW_PATH}
359
+ ${DIFF_BASE:+diff_base: ${DIFF_BASE}}
360
+ files:
361
+ ${CONFIG_FILES}
362
+ </config>
363
+
364
+ Review the listed source files at ${REVIEW_DEPTH} depth. Write findings to ${REVIEW_PATH}.
365
+ Do NOT commit the output — the orchestrator handles that.
366
+ ")
367
+ ```
368
+
369
+ **Agent failure handling:**
370
+
371
+ If the Task() call fails (agent error, timeout, or exception):
372
+ ```
373
+ Error: Code review agent failed: ${error_message}
374
+
375
+ No REVIEW.md created. You can retry with /sdd-code-review ${PHASE_ARG} or check agent logs.
376
+ ```
377
+
378
+ Do NOT proceed to commit_review step. Do NOT create a partial or empty REVIEW.md. Exit workflow.
379
+ </step>
380
+
381
+ <step name="commit_review">
382
+ After agent completes successfully, verify REVIEW.md was created and has valid structure:
383
+
384
+ ```bash
385
+ if [ -f "${REVIEW_PATH}" ]; then
386
+ # Validate REVIEW.md has valid YAML frontmatter with status field
387
+ HAS_STATUS=$(REVIEW_PATH="${REVIEW_PATH}" node -e "
388
+ const fs = require('fs');
389
+ const content = fs.readFileSync(process.env.REVIEW_PATH, 'utf-8');
390
+ const match = content.match(/^---\n([\s\S]*?)\n---/);
391
+ if (match && /status:/.test(match[1])) { console.log('valid'); } else { console.log('invalid'); }
392
+ " 2>/dev/null)
393
+
394
+ if [ "$HAS_STATUS" = "valid" ]; then
395
+ echo "REVIEW.md created at ${REVIEW_PATH}"
396
+
397
+ if [ "$COMMIT_DOCS" = "true" ]; then
398
+ node "$HOME/.claude/sdd/bin/sdd-tools.cjs" commit \
399
+ "docs(${PADDED_PHASE}): add code review report" \
400
+ --files "${REVIEW_PATH}"
401
+ fi
402
+ else
403
+ echo "Warning: REVIEW.md exists but has invalid or missing frontmatter (no status field)."
404
+ echo "Agent may have produced malformed output. Not committing. Review manually: ${REVIEW_PATH}"
405
+ fi
406
+ else
407
+ echo "Warning: Agent completed but REVIEW.md not found at ${REVIEW_PATH}. This may indicate an agent issue."
408
+ echo "No REVIEW.md to commit. Please retry with /sdd-code-review ${PHASE_ARG}"
409
+ fi
410
+ ```
411
+ </step>
412
+
413
+ <step name="present_results">
414
+ Read the REVIEW.md YAML frontmatter to extract finding counts.
415
+
416
+ Extract frontmatter between `---` delimiters first to avoid matching values in the review body:
417
+
418
+ ```bash
419
+ # Extract only the YAML frontmatter block (between first two --- lines)
420
+ FRONTMATTER=$(REVIEW_PATH="${REVIEW_PATH}" node -e "
421
+ const fs = require('fs');
422
+ const content = fs.readFileSync(process.env.REVIEW_PATH, 'utf-8');
423
+ const match = content.match(/^---\n([\s\S]*?)\n---/);
424
+ if (match) process.stdout.write(match[1]);
425
+ " 2>/dev/null)
426
+
427
+ # Parse fields from frontmatter only (not full file)
428
+ STATUS=$(echo "$FRONTMATTER" | grep "^status:" | cut -d: -f2 | xargs)
429
+ FILES_REVIEWED=$(echo "$FRONTMATTER" | grep "^files_reviewed:" | cut -d: -f2 | xargs)
430
+ CRITICAL=$(echo "$FRONTMATTER" | grep "critical:" | head -1 | cut -d: -f2 | xargs)
431
+ WARNING=$(echo "$FRONTMATTER" | grep "warning:" | head -1 | cut -d: -f2 | xargs)
432
+ INFO=$(echo "$FRONTMATTER" | grep "info:" | head -1 | cut -d: -f2 | xargs)
433
+ TOTAL=$(echo "$FRONTMATTER" | grep "total:" | head -1 | cut -d: -f2 | xargs)
434
+ ```
435
+
436
+ Display inline summary to user:
437
+
438
+ ```
439
+ ═══════════════════════════════════════════════════════════════
440
+
441
+ Code Review Complete: Phase ${PHASE_NUMBER} (${PHASE_NAME})
442
+
443
+ ───────────────────────────────────────────────────────────────
444
+
445
+ Depth: ${REVIEW_DEPTH}
446
+ Files Reviewed: ${FILES_REVIEWED}
447
+
448
+ Findings:
449
+ Critical: ${CRITICAL}
450
+ Warning: ${WARNING}
451
+ Info: ${INFO}
452
+ ──────────
453
+ Total: ${TOTAL}
454
+
455
+ ───────────────────────────────────────────────────────────────
456
+ ```
457
+
458
+ If status is "clean":
459
+ ```
460
+ ✓ No issues found. All ${FILES_REVIEWED} files pass review at ${REVIEW_DEPTH} depth.
461
+
462
+ Full report: ${REVIEW_PATH}
463
+ ```
464
+
465
+ If total findings > 0:
466
+ ```
467
+ ⚠ Issues found. Review the report for details.
468
+
469
+ Full report: ${REVIEW_PATH}
470
+
471
+ Next steps:
472
+ /sdd-code-review-fix ${PHASE_NUMBER} — Auto-fix issues
473
+ cat ${REVIEW_PATH} — View full report
474
+ ```
475
+
476
+ If critical > 0 or warning > 0, list top 3 issues inline:
477
+ ```bash
478
+ echo "Top issues:"
479
+ grep -A 3 "^### CR-\|^### WR-" "${REVIEW_PATH}" | head -n 12
480
+ ```
481
+
482
+ **Note on tests:** Automated tests for this command and workflow are planned for Phase 4 (Pipeline Integration & Testing, requirement INFR-03). Phase 2 focuses on correct implementation; Phase 4 adds regression coverage across platforms.
483
+
484
+ ═══════════════════════════════════════════════════════════════
485
+ </step>
486
+
487
+ </process>
488
+
489
+ <platform_notes>
490
+ **Windows:** This workflow uses bash features (arrays, process substitution). On Windows, it requires
491
+ Git Bash or WSL. Native PowerShell is not supported. The CI matrix (Ubuntu/macOS/Windows)
492
+ runs under Git Bash on Windows runners, which provides bash compatibility.
493
+
494
+ **macOS:** macOS ships with bash 3.2 (GPL licensing). This workflow does NOT use `mapfile` (bash 4+
495
+ only) — all array construction uses portable `while IFS= read -r` loops compatible with bash 3.2.
496
+ The `--files` path validation uses `realpath -m` which requires GNU coreutils (install via
497
+ `brew install coreutils`). Without coreutils, the path guard falls back to fail-closed behavior
498
+ (rejects paths it cannot verify), so security is maintained but valid relative paths may be rejected.
499
+ If `--files` validation fails unexpectedly on macOS, install coreutils or use absolute paths.
500
+ </platform_notes>
501
+
502
+ <success_criteria>
503
+ - [ ] Phase validated before config gate check
504
+ - [ ] Config gate checked (workflow.code_review)
505
+ - [ ] Depth resolved with validation (quick|standard|deep)
506
+ - [ ] File scope computed with 3 tiers: --files > SUMMARY.md > git diff
507
+ - [ ] Malformed/missing SUMMARY.md handled gracefully with fallback
508
+ - [ ] Deleted files filtered from scope
509
+ - [ ] Files deduplicated and sorted
510
+ - [ ] Empty scope results in skip (no agent spawn)
511
+ - [ ] Agent spawned with explicit file list, depth, review_path, diff_base
512
+ - [ ] Agent failure handled without partial commits
513
+ - [ ] REVIEW.md committed if created
514
+ - [ ] Results presented inline with next step suggestion
515
+ </success_criteria>
@@ -20,8 +20,8 @@ When a milestone completes:
20
20
 
21
21
  1. Extract full milestone details to `.planning/milestones/v[X.Y]-ROADMAP.md`
22
22
  2. Archive requirements to `.planning/milestones/v[X.Y]-REQUIREMENTS.md`
23
- 3. Update ROADMAP.md — replace milestone details with one-line summary
24
- 4. Delete REQUIREMENTS.md (fresh one for next milestone)
23
+ 3. Update ROADMAP.md — overwrite in place with milestone grouping (preserve Backlog section)
24
+ 4. Safety commit archive files + updated ROADMAP.md, then `git rm REQUIREMENTS.md` (fresh for next milestone)
25
25
  5. Perform full PROJECT.md evolution review
26
26
  6. Offer to create next milestone inline
27
27
  7. Archive UI artifacts (`*-UI-SPEC.md`, `*-UI-REVIEW.md`) alongside other phase documents
@@ -82,7 +82,7 @@ Requirements: {N}/{M} v1 requirements checked off
82
82
 
83
83
  MUST present 3 options:
84
84
  1. **Proceed anyway** — mark milestone complete with known gaps
85
- 2. **Run audit first** — `/sdd:audit-milestone` to assess gap severity
85
+ 2. **Run audit first** — `/sdd-audit-milestone` to assess gap severity
86
86
  3. **Abort** — return to development
87
87
 
88
88
  If user selects "Proceed anyway": note incomplete requirements in MILESTONES.md under `### Known Gaps` with REQ-IDs and descriptions.
@@ -387,6 +387,8 @@ Verify: `✅ Milestone archived to .planning/milestones/`
387
387
 
388
388
  **Phase archival (optional):** After archival completes, ask the user:
389
389
 
390
+
391
+ **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.
390
392
  AskUserQuestion(header="Archive Phases", question="Archive phase directories to milestones/?", options: "Yes — move to milestones/v[X.Y]-phases/" | "Skip — keep phases in place")
391
393
 
392
394
  If "Yes": move phase directories to the milestone archive:
@@ -397,21 +399,32 @@ mv .planning/phases/{phase-dir} .planning/milestones/v[X.Y]-phases/
397
399
  ```
398
400
  Verify: `✅ Phase directories archived to .planning/milestones/v[X.Y]-phases/`
399
401
 
400
- If "Skip": Phase directories remain in `.planning/phases/` as raw execution history. Use `/sdd:cleanup` later to archive retroactively.
402
+ If "Skip": Phase directories remain in `.planning/phases/` as raw execution history. Use `/sdd-cleanup` later to archive retroactively.
401
403
 
402
404
  After archival, the AI still handles:
403
- - Reorganizing ROADMAP.md with milestone grouping (requires judgment)
405
+ - Reorganizing ROADMAP.md with milestone grouping (requires judgment) — overwrite in place after extracting Backlog section
404
406
  - Full PROJECT.md evolution review (requires understanding)
405
- - Deleting original ROADMAP.md and REQUIREMENTS.md
407
+ - Safety commit of archive files + updated ROADMAP.md, then `git rm .planning/REQUIREMENTS.md`
406
408
  - These are NOT fully delegated because they require AI interpretation of content
407
409
 
408
410
  </step>
409
411
 
410
412
  <step name="reorganize_roadmap_and_delete_originals">
411
413
 
412
- After `milestone complete` has archived, reorganize ROADMAP.md with milestone groupings, then delete originals:
414
+ After `milestone complete` has archived, reorganize ROADMAP.md with milestone groupings, then commit archives as a safety checkpoint before removing originals.
415
+
416
+ **Backlog preservation — do this FIRST before rewriting ROADMAP.md:**
417
+
418
+ Extract the Backlog section from the current ROADMAP.md before making any changes:
419
+
420
+ ```bash
421
+ # Extract lines under ## Backlog through end of file (or next ## section)
422
+ BACKLOG_SECTION=$(awk '/^## Backlog/{found=1} found{print}' .planning/ROADMAP.md)
423
+ ```
424
+
425
+ If `$BACKLOG_SECTION` is empty, there is no Backlog section — skip silently.
413
426
 
414
- **Reorganize ROADMAP.md** — group completed milestone phases:
427
+ **Reorganize ROADMAP.md** — overwrite in place (do NOT delete first) with milestone groupings:
415
428
 
416
429
  ```markdown
417
430
  # Roadmap: [Project Name]
@@ -432,11 +445,22 @@ After `milestone complete` has archived, reorganize ROADMAP.md with milestone gr
432
445
  </details>
433
446
  ```
434
447
 
435
- **Then delete originals:**
448
+ **Re-append Backlog section after the rewrite** (only if `$BACKLOG_SECTION` was non-empty):
449
+
450
+ Append the extracted Backlog content verbatim to the end of the newly written ROADMAP.md. This ensures 999.x backlog items are never silently dropped during milestone reorganization.
451
+
452
+ **Safety commit — commit archive files BEFORE deleting any originals:**
436
453
 
437
454
  ```bash
438
- rm .planning/ROADMAP.md
439
- rm .planning/REQUIREMENTS.md
455
+ node "$HOME/.claude/sdd/bin/sdd-tools.cjs" commit "chore: archive v[X.Y] milestone files" --files .planning/milestones/v[X.Y]-ROADMAP.md .planning/milestones/v[X.Y]-REQUIREMENTS.md .planning/milestones/v[X.Y]-MILESTONE-AUDIT.md .planning/MILESTONES.md .planning/PROJECT.md .planning/STATE.md .planning/ROADMAP.md
456
+ ```
457
+
458
+ This creates a durable checkpoint in git history. If anything fails after this point, the working tree can be reconstructed from git.
459
+
460
+ **Remove REQUIREMENTS.md via git rm** (preserves history, stages deletion atomically):
461
+
462
+ ```bash
463
+ git rm .planning/REQUIREMENTS.md
440
464
  ```
441
465
 
442
466
  </step>
@@ -537,6 +561,15 @@ if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi
537
561
 
538
562
  Extract `branching_strategy`, `phase_branch_template`, `milestone_branch_template`, and `commit_docs` from init JSON.
539
563
 
564
+ Detect base branch:
565
+ ```bash
566
+ BASE_BRANCH=$(node "$HOME/.claude/sdd/bin/sdd-tools.cjs" config-get git.base_branch 2>/dev/null || echo "")
567
+ if [ -z "$BASE_BRANCH" ] || [ "$BASE_BRANCH" = "null" ]; then
568
+ BASE_BRANCH=$(git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null | sed 's|^refs/remotes/origin/||')
569
+ BASE_BRANCH="${BASE_BRANCH:-main}"
570
+ fi
571
+ ```
572
+
540
573
  **If "none":** Skip to git_tag.
541
574
 
542
575
  **For "phase" strategy:**
@@ -575,7 +608,7 @@ AskUserQuestion with options: Squash merge (Recommended), Merge with history, De
575
608
 
576
609
  ```bash
577
610
  CURRENT_BRANCH=$(git branch --show-current)
578
- git checkout main
611
+ git checkout ${BASE_BRANCH}
579
612
 
580
613
  if [ "$BRANCHING_STRATEGY" = "phase" ]; then
581
614
  for branch in $PHASE_BRANCHES; do
@@ -604,7 +637,7 @@ git checkout "$CURRENT_BRANCH"
604
637
 
605
638
  ```bash
606
639
  CURRENT_BRANCH=$(git branch --show-current)
607
- git checkout main
640
+ git checkout ${BASE_BRANCH}
608
641
 
609
642
  if [ "$BRANCHING_STRATEGY" = "phase" ]; then
610
643
  for branch in $PHASE_BRANCHES; do
@@ -677,14 +710,13 @@ git push origin v[X.Y]
677
710
 
678
711
  <step name="git_commit_milestone">
679
712
 
680
- Commit milestone completion.
713
+ Commit the REQUIREMENTS.md deletion (archive files and ROADMAP.md were already committed in the safety commit in `reorganize_roadmap_and_delete_originals`).
681
714
 
682
715
  ```bash
683
- node "$HOME/.claude/sdd/bin/sdd-tools.cjs" commit "chore: complete v[X.Y] milestone" --files .planning/milestones/v[X.Y]-ROADMAP.md .planning/milestones/v[X.Y]-REQUIREMENTS.md .planning/milestones/v[X.Y]-MILESTONE-AUDIT.md .planning/MILESTONES.md .planning/PROJECT.md .planning/STATE.md
684
- ```
716
+ git commit -m "chore: remove REQUIREMENTS.md for v[X.Y] milestone"
685
717
  ```
686
718
 
687
- Confirm: "Committed: chore: complete v[X.Y] milestone"
719
+ Confirm: "Committed: chore: remove REQUIREMENTS.md for v[X.Y] milestone"
688
720
 
689
721
  </step>
690
722
 
@@ -710,9 +742,9 @@ Tag: v[X.Y]
710
742
 
711
743
  **Start Next Milestone** — questioning → research → requirements → roadmap
712
744
 
713
- `/sdd:new-milestone`
745
+ `/clear` then:
714
746
 
715
- <sub>`/clear` first → fresh context window</sub>
747
+ `/sdd-new-milestone`
716
748
 
717
749
  ---
718
750
  ```
@@ -750,10 +782,12 @@ Milestone completion is successful when:
750
782
  - [ ] PROJECT.md full evolution review completed
751
783
  - [ ] All shipped requirements moved to Validated in PROJECT.md
752
784
  - [ ] Key Decisions updated with outcomes
753
- - [ ] ROADMAP.md reorganized with milestone grouping
785
+ - [ ] ROADMAP.md Backlog section extracted before rewrite, re-appended after (skipped if absent)
786
+ - [ ] ROADMAP.md reorganized with milestone grouping (overwritten in place, not deleted)
754
787
  - [ ] Roadmap archive created (milestones/v[X.Y]-ROADMAP.md)
755
788
  - [ ] Requirements archive created (milestones/v[X.Y]-REQUIREMENTS.md)
756
- - [ ] REQUIREMENTS.md deleted (fresh for next milestone)
789
+ - [ ] Safety commit made (archive files + updated ROADMAP.md) BEFORE deleting REQUIREMENTS.md
790
+ - [ ] REQUIREMENTS.md removed via `git rm` (fresh for next milestone, history preserved)
757
791
  - [ ] STATE.md updated with fresh project reference
758
792
  - [ ] Git tag created (v[X.Y])
759
793
  - [ ] Milestone commit made (includes archive files and deletion)
@@ -762,6 +796,6 @@ Milestone completion is successful when:
762
796
  - [ ] Known gaps recorded in MILESTONES.md if user proceeded with incomplete requirements
763
797
  - [ ] RETROSPECTIVE.md updated with milestone section
764
798
  - [ ] Cross-milestone trends updated
765
- - [ ] User knows next step (/sdd:new-milestone)
799
+ - [ ] User knows next step (/sdd-new-milestone)
766
800
 
767
801
  </success_criteria>