@bhargavvc/sdd-cc 1.30.1 → 1.42.3

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 (1392) hide show
  1. package/README.ja-JP.md +165 -129
  2. package/README.ko-KR.md +161 -123
  3. package/README.md +103 -679
  4. package/README.pt-BR.md +92 -52
  5. package/README.zh-CN.md +145 -103
  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 +668 -0
  9. package/agents/sdd-code-reviewer.md +387 -0
  10. package/agents/sdd-codebase-mapper.md +86 -3
  11. package/agents/sdd-debug-session-manager.md +314 -0
  12. package/agents/sdd-debugger.md +157 -78
  13. package/agents/sdd-doc-classifier.md +168 -0
  14. package/agents/sdd-doc-synthesizer.md +204 -0
  15. package/agents/sdd-doc-verifier.md +217 -0
  16. package/agents/sdd-doc-writer.md +615 -0
  17. package/agents/sdd-domain-researcher.md +153 -0
  18. package/agents/sdd-eval-auditor.md +191 -0
  19. package/agents/sdd-eval-planner.md +154 -0
  20. package/agents/sdd-executor.md +283 -40
  21. package/agents/sdd-framework-selector.md +160 -0
  22. package/agents/sdd-integration-checker.md +30 -3
  23. package/agents/sdd-intel-updater.md +342 -0
  24. package/agents/sdd-nyquist-auditor.md +31 -4
  25. package/agents/sdd-pattern-mapper.md +335 -0
  26. package/agents/sdd-phase-researcher.md +254 -24
  27. package/agents/sdd-plan-checker.md +223 -18
  28. package/agents/sdd-planner.md +286 -362
  29. package/agents/sdd-project-researcher.md +28 -5
  30. package/agents/sdd-research-synthesizer.md +4 -4
  31. package/agents/sdd-roadmapper.md +14 -5
  32. package/agents/sdd-security-auditor.md +155 -0
  33. package/agents/sdd-ui-auditor.md +60 -4
  34. package/agents/sdd-ui-checker.md +11 -2
  35. package/agents/sdd-ui-researcher.md +27 -4
  36. package/agents/sdd-user-profiler.md +2 -2
  37. package/agents/sdd-verifier.md +258 -41
  38. package/bin/install.js +6862 -618
  39. package/bin/sdd-sdk.js +37 -0
  40. package/commands/sdd/add-tests.md +3 -2
  41. package/commands/sdd/ai-integration-phase.md +37 -0
  42. package/commands/sdd/audit-fix.md +34 -0
  43. package/commands/sdd/audit-milestone.md +3 -2
  44. package/commands/sdd/autonomous.md +10 -5
  45. package/commands/sdd/capture.md +62 -0
  46. package/commands/sdd/cleanup.md +7 -1
  47. package/commands/sdd/code-review.md +59 -0
  48. package/commands/sdd/complete-milestone.md +11 -4
  49. package/commands/sdd/config.md +58 -0
  50. package/commands/sdd/debug.md +23 -144
  51. package/commands/sdd/discuss-phase.md +22 -10
  52. package/commands/sdd/docs-update.md +49 -0
  53. package/commands/sdd/eval-review.md +33 -0
  54. package/commands/sdd/execute-phase.md +9 -4
  55. package/commands/sdd/explore.md +27 -0
  56. package/commands/sdd/extract-learnings.md +23 -0
  57. package/commands/sdd/fast.md +2 -1
  58. package/commands/sdd/forensics.md +3 -2
  59. package/commands/sdd/graphify.md +199 -0
  60. package/commands/sdd/health.md +12 -3
  61. package/commands/sdd/help.md +3 -1
  62. package/commands/sdd/import.md +41 -0
  63. package/commands/sdd/inbox.md +39 -0
  64. package/commands/sdd/ingest-docs.md +42 -0
  65. package/commands/sdd/manager.md +9 -3
  66. package/commands/sdd/map-codebase.md +15 -3
  67. package/commands/sdd/milestone-summary.md +1 -1
  68. package/commands/sdd/mvp-phase.md +45 -0
  69. package/commands/sdd/new-milestone.md +3 -2
  70. package/commands/sdd/new-project.md +7 -2
  71. package/commands/sdd/ns-context.md +23 -0
  72. package/commands/sdd/ns-ideate.md +24 -0
  73. package/commands/sdd/ns-manage.md +29 -0
  74. package/commands/sdd/ns-project.md +22 -0
  75. package/commands/sdd/ns-review.md +26 -0
  76. package/commands/sdd/ns-workflow.md +28 -0
  77. package/commands/sdd/pause-work.md +6 -1
  78. package/commands/sdd/phase.md +56 -0
  79. package/commands/sdd/plan-phase.md +19 -4
  80. package/commands/sdd/plan-review-convergence.md +59 -0
  81. package/commands/sdd/pr-branch.md +2 -1
  82. package/commands/sdd/profile-user.md +2 -2
  83. package/commands/sdd/progress.md +27 -5
  84. package/commands/sdd/quick.md +132 -5
  85. package/commands/sdd/resume-work.md +2 -12
  86. package/commands/sdd/review-backlog.md +4 -2
  87. package/commands/sdd/review.md +7 -3
  88. package/commands/sdd/secure-phase.md +36 -0
  89. package/commands/sdd/settings.md +2 -9
  90. package/commands/sdd/ship.md +1 -0
  91. package/commands/sdd/sketch.md +60 -0
  92. package/commands/sdd/spec-phase.md +63 -0
  93. package/commands/sdd/spike.md +57 -0
  94. package/commands/sdd/stats.md +2 -1
  95. package/commands/sdd/surface.md +129 -0
  96. package/commands/sdd/thread.md +8 -111
  97. package/commands/sdd/ui-phase.md +3 -2
  98. package/commands/sdd/ui-review.md +3 -2
  99. package/commands/sdd/ultraplan-phase.md +34 -0
  100. package/commands/sdd/undo.md +35 -0
  101. package/commands/sdd/update.md +21 -10
  102. package/commands/sdd/validate-phase.md +3 -2
  103. package/commands/sdd/verify-work.md +4 -3
  104. package/commands/sdd/workspace.md +52 -0
  105. package/commands/sdd/workstreams.md +15 -8
  106. package/hooks/dist/sdd-check-update-worker.js +116 -0
  107. package/hooks/dist/sdd-check-update.js +19 -69
  108. package/hooks/dist/sdd-context-monitor.js +43 -7
  109. package/hooks/dist/sdd-phase-boundary.sh +47 -0
  110. package/hooks/dist/sdd-prompt-guard.js +1 -0
  111. package/hooks/dist/sdd-read-guard.js +101 -0
  112. package/hooks/dist/sdd-read-injection-scanner.js +152 -0
  113. package/hooks/dist/sdd-session-state.sh +59 -0
  114. package/hooks/dist/sdd-statusline.js +439 -21
  115. package/hooks/dist/sdd-update-banner.js +134 -0
  116. package/hooks/dist/sdd-validate-commit.sh +57 -0
  117. package/hooks/dist/sdd-workflow-guard.js +2 -2
  118. package/hooks/lib/git-cmd.js +150 -0
  119. package/hooks/sdd-check-update-worker.js +116 -0
  120. package/hooks/sdd-check-update.js +64 -0
  121. package/hooks/sdd-context-monitor.js +192 -0
  122. package/hooks/sdd-phase-boundary.sh +47 -0
  123. package/hooks/sdd-prompt-guard.js +97 -0
  124. package/hooks/sdd-read-guard.js +101 -0
  125. package/hooks/sdd-read-injection-scanner.js +152 -0
  126. package/hooks/sdd-session-state.sh +59 -0
  127. package/hooks/sdd-statusline.js +537 -0
  128. package/hooks/sdd-update-banner.js +134 -0
  129. package/hooks/sdd-validate-commit.sh +57 -0
  130. package/hooks/sdd-workflow-guard.js +94 -0
  131. package/package.json +34 -9
  132. package/scripts/audit-workflow-script-paths.cjs +73 -0
  133. package/scripts/build-hooks.js +114 -9
  134. package/scripts/changeset/cli.cjs +269 -0
  135. package/scripts/changeset/github-release-notes.cjs +198 -0
  136. package/scripts/changeset/lint.cjs +110 -0
  137. package/scripts/changeset/new.cjs +137 -0
  138. package/scripts/changeset/parse.cjs +60 -0
  139. package/scripts/changeset/render.cjs +34 -0
  140. package/scripts/changeset/serialize.cjs +74 -0
  141. package/scripts/command-contract-helpers.cjs +61 -0
  142. package/scripts/diff-touches-shipped-paths.cjs +147 -0
  143. package/scripts/fix-slash-commands.cjs +106 -0
  144. package/scripts/gen-inventory-manifest.cjs +109 -0
  145. package/scripts/lint-command-contract.cjs +108 -0
  146. package/scripts/lint-descriptions.cjs +83 -0
  147. package/scripts/lint-no-source-grep-extras.cjs +81 -0
  148. package/scripts/lint-no-source-grep.cjs +174 -0
  149. package/scripts/lint-shell-command-projection-drift.cjs +57 -0
  150. package/scripts/lint-skill-deps.cjs +180 -0
  151. package/scripts/pr-template-policy.cjs +169 -0
  152. package/scripts/prompt-injection-scan.sh +3 -0
  153. package/scripts/rebrand-gsd-to-sdd.sh +222 -220
  154. package/scripts/run-tests.cjs +5 -1
  155. package/scripts/strip-prose-atrefs.cjs +106 -0
  156. package/scripts/verify-tarball-sdk-dist.sh +69 -0
  157. package/sdd/bin/check-latest-version.cjs +104 -0
  158. package/sdd/bin/lib/active-workstream-store.cjs +85 -0
  159. package/sdd/bin/lib/adr-parser.cjs +394 -0
  160. package/sdd/bin/lib/artifacts.cjs +53 -0
  161. package/sdd/bin/lib/audit.cjs +755 -0
  162. package/sdd/bin/lib/cjs-command-router-adapter.cjs +39 -0
  163. package/sdd/bin/lib/clusters.cjs +135 -0
  164. package/sdd/bin/lib/command-aliases.generated.cjs +838 -0
  165. package/sdd/bin/lib/commands.cjs +179 -107
  166. package/sdd/bin/lib/config-schema.cjs +135 -0
  167. package/sdd/bin/lib/config.cjs +313 -86
  168. package/sdd/bin/lib/context-utilization.cjs +47 -0
  169. package/sdd/bin/lib/core.cjs +1146 -391
  170. package/sdd/bin/lib/decisions.cjs +48 -0
  171. package/sdd/bin/lib/docs.cjs +270 -0
  172. package/sdd/bin/lib/drift.cjs +379 -0
  173. package/sdd/bin/lib/fallow-runner.cjs +109 -0
  174. package/sdd/bin/lib/frontmatter.cjs +389 -336
  175. package/sdd/bin/lib/gap-checker.cjs +197 -0
  176. package/sdd/bin/lib/graphify.cjs +577 -0
  177. package/sdd/bin/lib/init-command-router.cjs +70 -0
  178. package/sdd/bin/lib/init.cjs +692 -97
  179. package/sdd/bin/lib/install-profiles.cjs +572 -0
  180. package/sdd/bin/lib/installer-migration-authoring.cjs +117 -0
  181. package/sdd/bin/lib/installer-migration-report.cjs +328 -0
  182. package/sdd/bin/lib/installer-migrations/000-first-time-baseline.cjs +220 -0
  183. package/sdd/bin/lib/installer-migrations/001-legacy-orphan-files.cjs +41 -0
  184. package/sdd/bin/lib/installer-migrations/002-codex-legacy-hooks-json.cjs +80 -0
  185. package/sdd/bin/lib/installer-migrations.cjs +703 -0
  186. package/sdd/bin/lib/intel.cjs +643 -0
  187. package/sdd/bin/lib/learnings.cjs +379 -0
  188. package/sdd/bin/lib/milestone.cjs +313 -252
  189. package/sdd/bin/lib/model-catalog.cjs +136 -0
  190. package/sdd/bin/lib/model-profiles.cjs +25 -68
  191. package/sdd/bin/lib/phase-command-router.cjs +96 -0
  192. package/sdd/bin/lib/phase.cjs +868 -335
  193. package/sdd/bin/lib/phases-command-router.cjs +39 -0
  194. package/sdd/bin/lib/plan-scan.cjs +138 -0
  195. package/sdd/bin/lib/planning-workspace.cjs +361 -0
  196. package/sdd/bin/lib/profile-output.cjs +197 -35
  197. package/sdd/bin/lib/profile-pipeline.cjs +1 -1
  198. package/sdd/bin/lib/review-reviewer-selection.cjs +125 -0
  199. package/sdd/bin/lib/roadmap-command-router.cjs +23 -0
  200. package/sdd/bin/lib/roadmap.cjs +416 -124
  201. package/sdd/bin/lib/runtime-homes.cjs +178 -0
  202. package/sdd/bin/lib/schema-detect.cjs +238 -0
  203. package/sdd/bin/lib/sdd2-import.cjs +511 -0
  204. package/sdd/bin/lib/secrets.cjs +33 -0
  205. package/sdd/bin/lib/security.cjs +131 -9
  206. package/sdd/bin/lib/shell-command-projection.cjs +548 -0
  207. package/sdd/bin/lib/state-command-router.cjs +100 -0
  208. package/sdd/bin/lib/state-document.cjs +12 -0
  209. package/sdd/bin/lib/state-document.generated.cjs +127 -0
  210. package/sdd/bin/lib/state.cjs +1253 -367
  211. package/sdd/bin/lib/surface.cjs +398 -0
  212. package/sdd/bin/lib/template.cjs +11 -5
  213. package/sdd/bin/lib/uat.cjs +9 -2
  214. package/sdd/bin/lib/validate-command-router.cjs +55 -0
  215. package/sdd/bin/lib/verify-command-router.cjs +34 -0
  216. package/sdd/bin/lib/verify.cjs +648 -140
  217. package/sdd/bin/lib/workstream-inventory.cjs +159 -0
  218. package/sdd/bin/lib/workstream-name-policy.cjs +33 -0
  219. package/sdd/bin/lib/workstream.cjs +78 -196
  220. package/sdd/bin/lib/worktree-safety.cjs +563 -0
  221. package/sdd/bin/sdd-tools.cjs +528 -222
  222. package/sdd/bin/verify-reapply-patches.cjs +247 -0
  223. package/sdd/contexts/dev.md +21 -0
  224. package/sdd/contexts/research.md +22 -0
  225. package/sdd/contexts/review.md +23 -0
  226. package/sdd/references/agent-contracts.md +79 -0
  227. package/sdd/references/ai-evals.md +156 -0
  228. package/sdd/references/ai-frameworks.md +186 -0
  229. package/sdd/references/artifact-types.md +131 -0
  230. package/sdd/references/autonomous-smart-discuss.md +277 -0
  231. package/sdd/references/checkpoints.md +36 -0
  232. package/sdd/references/common-bug-patterns.md +114 -0
  233. package/sdd/references/context-budget.md +85 -0
  234. package/sdd/references/continuation-format.md +30 -26
  235. package/sdd/references/debugger-philosophy.md +76 -0
  236. package/sdd/references/decimal-phase-calculation.md +5 -5
  237. package/sdd/references/doc-conflict-engine.md +91 -0
  238. package/sdd/references/domain-probes.md +125 -0
  239. package/sdd/references/execute-mvp-tdd.md +81 -0
  240. package/sdd/references/executor-examples.md +110 -0
  241. package/sdd/references/few-shot-examples/plan-checker.md +73 -0
  242. package/sdd/references/few-shot-examples/verifier.md +109 -0
  243. package/sdd/references/gate-prompts.md +100 -0
  244. package/sdd/references/gates.md +70 -0
  245. package/sdd/references/git-integration.md +9 -6
  246. package/sdd/references/git-planning-commit.md +6 -4
  247. package/sdd/references/ios-scaffold.md +123 -0
  248. package/sdd/references/mandatory-initial-read.md +2 -0
  249. package/sdd/references/model-profile-resolution.md +2 -0
  250. package/sdd/references/model-profiles.md +128 -22
  251. package/sdd/references/mvp-concepts.md +49 -0
  252. package/sdd/references/phase-argument-parsing.md +3 -3
  253. package/sdd/references/planner-antipatterns.md +89 -0
  254. package/sdd/references/planner-chunked.md +49 -0
  255. package/sdd/references/planner-gap-closure.md +62 -0
  256. package/sdd/references/planner-human-verify-mode.md +57 -0
  257. package/sdd/references/planner-mvp-mode.md +53 -0
  258. package/sdd/references/planner-reviews.md +39 -0
  259. package/sdd/references/planner-revision.md +87 -0
  260. package/sdd/references/planner-source-audit.md +73 -0
  261. package/sdd/references/planning-config.md +276 -7
  262. package/sdd/references/project-skills-discovery.md +19 -0
  263. package/sdd/references/revision-loop.md +97 -0
  264. package/sdd/references/scout-codebase.md +51 -0
  265. package/sdd/references/skeleton-template.md +48 -0
  266. package/sdd/references/sketch-interactivity.md +41 -0
  267. package/sdd/references/sketch-theme-system.md +94 -0
  268. package/sdd/references/sketch-tooling.md +45 -0
  269. package/sdd/references/sketch-variant-patterns.md +81 -0
  270. package/sdd/references/spidr-splitting.md +69 -0
  271. package/sdd/references/tdd.md +67 -0
  272. package/sdd/references/thinking-models-debug.md +44 -0
  273. package/sdd/references/thinking-models-execution.md +50 -0
  274. package/sdd/references/thinking-models-planning.md +62 -0
  275. package/sdd/references/thinking-models-research.md +50 -0
  276. package/sdd/references/thinking-models-verification.md +55 -0
  277. package/sdd/references/thinking-partner.md +96 -0
  278. package/sdd/references/ui-brand.md +4 -4
  279. package/sdd/references/universal-anti-patterns.md +63 -0
  280. package/sdd/references/user-story-template.md +58 -0
  281. package/sdd/references/verification-overrides.md +227 -0
  282. package/sdd/references/verify-mvp-mode.md +85 -0
  283. package/sdd/references/workstream-flag.md +63 -10
  284. package/sdd/references/worktree-path-safety.md +89 -0
  285. package/sdd/templates/AI-SPEC.md +246 -0
  286. package/sdd/templates/DEBUG.md +7 -2
  287. package/sdd/templates/README.md +77 -0
  288. package/sdd/templates/SECURITY.md +61 -0
  289. package/sdd/templates/VALIDATION.md +3 -3
  290. package/sdd/templates/claude-md.md +27 -4
  291. package/sdd/templates/config.json +20 -2
  292. package/sdd/templates/discovery.md +2 -2
  293. package/sdd/templates/research.md +40 -0
  294. package/sdd/templates/spec.md +307 -0
  295. package/sdd/templates/state.md +10 -2
  296. package/sdd/workflows/add-backlog.md +90 -0
  297. package/sdd/workflows/add-phase.md +12 -12
  298. package/sdd/workflows/add-tests.md +6 -3
  299. package/sdd/workflows/add-todo.md +8 -6
  300. package/sdd/workflows/ai-integration-phase.md +294 -0
  301. package/sdd/workflows/analyze-dependencies.md +96 -0
  302. package/sdd/workflows/audit-fix.md +177 -0
  303. package/sdd/workflows/audit-milestone.md +35 -18
  304. package/sdd/workflows/audit-uat.md +1 -1
  305. package/sdd/workflows/autonomous.md +202 -304
  306. package/sdd/workflows/check-todos.md +12 -10
  307. package/sdd/workflows/cleanup.md +3 -1
  308. package/sdd/workflows/code-review-fix.md +501 -0
  309. package/sdd/workflows/code-review.md +613 -0
  310. package/sdd/workflows/complete-milestone.md +115 -28
  311. package/sdd/workflows/debug.md +231 -0
  312. package/sdd/workflows/diagnose-issues.md +14 -5
  313. package/sdd/workflows/discovery-phase.md +3 -1
  314. package/sdd/workflows/discuss-phase/modes/advisor.md +175 -0
  315. package/sdd/workflows/discuss-phase/modes/all.md +28 -0
  316. package/sdd/workflows/discuss-phase/modes/analyze.md +44 -0
  317. package/sdd/workflows/discuss-phase/modes/auto.md +56 -0
  318. package/sdd/workflows/discuss-phase/modes/batch.md +52 -0
  319. package/sdd/workflows/discuss-phase/modes/chain.md +97 -0
  320. package/sdd/workflows/discuss-phase/modes/default.md +141 -0
  321. package/sdd/workflows/discuss-phase/modes/power.md +44 -0
  322. package/sdd/workflows/discuss-phase/modes/text.md +55 -0
  323. package/sdd/workflows/discuss-phase/templates/checkpoint.json +18 -0
  324. package/sdd/workflows/discuss-phase/templates/context.md +136 -0
  325. package/sdd/workflows/discuss-phase/templates/discussion-log.md +50 -0
  326. package/sdd/workflows/discuss-phase-assumptions.md +41 -20
  327. package/sdd/workflows/discuss-phase-power.md +291 -0
  328. package/sdd/workflows/discuss-phase.md +242 -792
  329. package/sdd/workflows/do.md +13 -7
  330. package/sdd/workflows/docs-update.md +1161 -0
  331. package/sdd/workflows/edit-phase.md +294 -0
  332. package/sdd/workflows/eval-review.md +155 -0
  333. package/sdd/workflows/execute-phase/steps/codebase-drift-gate.md +81 -0
  334. package/sdd/workflows/execute-phase/steps/per-plan-worktree-gate.md +94 -0
  335. package/sdd/workflows/execute-phase/steps/post-merge-gate.md +116 -0
  336. package/sdd/workflows/execute-phase.md +1062 -108
  337. package/sdd/workflows/execute-plan.md +118 -107
  338. package/sdd/workflows/explore.md +143 -0
  339. package/sdd/workflows/extract-learnings.md +242 -0
  340. package/sdd/workflows/forensics.md +17 -4
  341. package/sdd/workflows/graduation.md +195 -0
  342. package/sdd/workflows/health.md +45 -3
  343. package/sdd/workflows/help.md +265 -88
  344. package/sdd/workflows/import.md +253 -0
  345. package/sdd/workflows/inbox.md +387 -0
  346. package/sdd/workflows/ingest-docs.md +339 -0
  347. package/sdd/workflows/insert-phase.md +37 -16
  348. package/sdd/workflows/list-phase-assumptions.md +2 -2
  349. package/sdd/workflows/list-workspaces.md +3 -3
  350. package/sdd/workflows/manager.md +62 -32
  351. package/sdd/workflows/map-codebase.md +90 -24
  352. package/sdd/workflows/milestone-summary.md +6 -6
  353. package/sdd/workflows/mvp-phase.md +221 -0
  354. package/sdd/workflows/new-milestone.md +168 -20
  355. package/sdd/workflows/new-project.md +273 -47
  356. package/sdd/workflows/new-workspace.md +8 -6
  357. package/sdd/workflows/next.md +127 -4
  358. package/sdd/workflows/note.md +7 -5
  359. package/sdd/workflows/pause-work.md +79 -12
  360. package/sdd/workflows/plan-milestone-gaps.md +14 -7
  361. package/sdd/workflows/plan-phase.md +987 -62
  362. package/sdd/workflows/plan-review-convergence.md +329 -0
  363. package/sdd/workflows/plant-seed.md +145 -85
  364. package/sdd/workflows/pr-branch.md +41 -13
  365. package/sdd/workflows/profile-user.md +20 -18
  366. package/sdd/workflows/progress.md +186 -44
  367. package/sdd/workflows/quick.md +470 -58
  368. package/sdd/workflows/reapply-patches.md +390 -0
  369. package/sdd/workflows/remove-phase.md +12 -12
  370. package/sdd/workflows/remove-workspace.md +24 -7
  371. package/sdd/workflows/resume-project.md +18 -15
  372. package/sdd/workflows/review.md +242 -11
  373. package/sdd/workflows/scan.md +104 -0
  374. package/sdd/workflows/secure-phase.md +179 -0
  375. package/sdd/workflows/session-report.md +2 -2
  376. package/sdd/workflows/settings-advanced.md +579 -0
  377. package/sdd/workflows/settings-integrations.md +281 -0
  378. package/sdd/workflows/settings.md +221 -16
  379. package/sdd/workflows/ship.md +140 -13
  380. package/sdd/workflows/sketch-wrap-up.md +285 -0
  381. package/sdd/workflows/sketch.md +360 -0
  382. package/sdd/workflows/spec-phase.md +262 -0
  383. package/sdd/workflows/spike-wrap-up.md +306 -0
  384. package/sdd/workflows/spike.md +452 -0
  385. package/sdd/workflows/stats.md +20 -1
  386. package/sdd/workflows/sync-skills.md +182 -0
  387. package/sdd/workflows/thread.md +221 -0
  388. package/sdd/workflows/transition.md +44 -22
  389. package/sdd/workflows/ui-phase.md +39 -14
  390. package/sdd/workflows/ui-review.md +33 -6
  391. package/sdd/workflows/ultraplan-phase.md +198 -0
  392. package/sdd/workflows/undo.md +314 -0
  393. package/sdd/workflows/update.md +350 -29
  394. package/sdd/workflows/validate-phase.md +10 -6
  395. package/sdd/workflows/verify-phase.md +307 -18
  396. package/sdd/workflows/verify-work.md +153 -10
  397. package/sdk/dist/cli-transport.d.ts +19 -0
  398. package/sdk/dist/cli-transport.d.ts.map +1 -0
  399. package/sdk/dist/cli-transport.js +104 -0
  400. package/sdk/dist/cli-transport.js.map +1 -0
  401. package/sdk/dist/cli.d.ts +46 -0
  402. package/sdk/dist/cli.d.ts.map +1 -0
  403. package/sdk/dist/cli.js +511 -0
  404. package/sdk/dist/cli.js.map +1 -0
  405. package/sdk/dist/config.d.ts +84 -0
  406. package/sdk/dist/config.d.ts.map +1 -0
  407. package/sdk/dist/config.js +135 -0
  408. package/sdk/dist/config.js.map +1 -0
  409. package/sdk/dist/context-engine.d.ts +49 -0
  410. package/sdk/dist/context-engine.d.ts.map +1 -0
  411. package/sdk/dist/context-engine.js +142 -0
  412. package/sdk/dist/context-engine.js.map +1 -0
  413. package/sdk/dist/context-truncation.d.ts +33 -0
  414. package/sdk/dist/context-truncation.d.ts.map +1 -0
  415. package/sdk/dist/context-truncation.js +197 -0
  416. package/sdk/dist/context-truncation.js.map +1 -0
  417. package/sdk/dist/errors.d.ts +46 -0
  418. package/sdk/dist/errors.d.ts.map +1 -0
  419. package/sdk/dist/errors.js +64 -0
  420. package/sdk/dist/errors.js.map +1 -0
  421. package/sdk/dist/event-stream.d.ts +53 -0
  422. package/sdk/dist/event-stream.d.ts.map +1 -0
  423. package/sdk/dist/event-stream.js +321 -0
  424. package/sdk/dist/event-stream.js.map +1 -0
  425. package/sdk/dist/golden/capture.d.ts +15 -0
  426. package/sdk/dist/golden/capture.d.ts.map +1 -0
  427. package/sdk/dist/golden/capture.js +67 -0
  428. package/sdk/dist/golden/capture.js.map +1 -0
  429. package/sdk/dist/golden/golden-integration-covered.d.ts +6 -0
  430. package/sdk/dist/golden/golden-integration-covered.d.ts.map +1 -0
  431. package/sdk/dist/golden/golden-integration-covered.js +30 -0
  432. package/sdk/dist/golden/golden-integration-covered.js.map +1 -0
  433. package/sdk/dist/golden/golden-mutation-covered.d.ts +7 -0
  434. package/sdk/dist/golden/golden-mutation-covered.d.ts.map +1 -0
  435. package/sdk/dist/golden/golden-mutation-covered.js +17 -0
  436. package/sdk/dist/golden/golden-mutation-covered.js.map +1 -0
  437. package/sdk/dist/golden/golden-policy.d.ts +10 -0
  438. package/sdk/dist/golden/golden-policy.d.ts.map +1 -0
  439. package/sdk/dist/golden/golden-policy.js +98 -0
  440. package/sdk/dist/golden/golden-policy.js.map +1 -0
  441. package/sdk/dist/golden/init-golden-normalize.d.ts +8 -0
  442. package/sdk/dist/golden/init-golden-normalize.d.ts.map +1 -0
  443. package/sdk/dist/golden/init-golden-normalize.js +14 -0
  444. package/sdk/dist/golden/init-golden-normalize.js.map +1 -0
  445. package/sdk/dist/golden/read-only-golden-rows.d.ts +20 -0
  446. package/sdk/dist/golden/read-only-golden-rows.d.ts.map +1 -0
  447. package/sdk/dist/golden/read-only-golden-rows.js +67 -0
  448. package/sdk/dist/golden/read-only-golden-rows.js.map +1 -0
  449. package/sdk/dist/golden/registry-canonical-commands.d.ts +6 -0
  450. package/sdk/dist/golden/registry-canonical-commands.d.ts.map +1 -0
  451. package/sdk/dist/golden/registry-canonical-commands.js +30 -0
  452. package/sdk/dist/golden/registry-canonical-commands.js.map +1 -0
  453. package/sdk/dist/index.d.ts +125 -0
  454. package/sdk/dist/index.d.ts.map +1 -0
  455. package/sdk/dist/index.js +298 -0
  456. package/sdk/dist/index.js.map +1 -0
  457. package/sdk/dist/init-runner.d.ts +90 -0
  458. package/sdk/dist/init-runner.d.ts.map +1 -0
  459. package/sdk/dist/init-runner.js +613 -0
  460. package/sdk/dist/init-runner.js.map +1 -0
  461. package/sdk/dist/logger.d.ts +50 -0
  462. package/sdk/dist/logger.d.ts.map +1 -0
  463. package/sdk/dist/logger.js +70 -0
  464. package/sdk/dist/logger.js.map +1 -0
  465. package/sdk/dist/model-catalog.d.ts +31 -0
  466. package/sdk/dist/model-catalog.d.ts.map +1 -0
  467. package/sdk/dist/model-catalog.js +31 -0
  468. package/sdk/dist/model-catalog.js.map +1 -0
  469. package/sdk/dist/phase-prompt.d.ts +72 -0
  470. package/sdk/dist/phase-prompt.d.ts.map +1 -0
  471. package/sdk/dist/phase-prompt.js +213 -0
  472. package/sdk/dist/phase-prompt.js.map +1 -0
  473. package/sdk/dist/phase-runner.d.ts +145 -0
  474. package/sdk/dist/phase-runner.d.ts.map +1 -0
  475. package/sdk/dist/phase-runner.js +1206 -0
  476. package/sdk/dist/phase-runner.js.map +1 -0
  477. package/sdk/dist/plan-parser.d.ts +55 -0
  478. package/sdk/dist/plan-parser.d.ts.map +1 -0
  479. package/sdk/dist/plan-parser.js +389 -0
  480. package/sdk/dist/plan-parser.js.map +1 -0
  481. package/sdk/dist/planning-journal.d.ts +64 -0
  482. package/sdk/dist/planning-journal.d.ts.map +1 -0
  483. package/sdk/dist/planning-journal.js +88 -0
  484. package/sdk/dist/planning-journal.js.map +1 -0
  485. package/sdk/dist/planning-runtime.d.ts +67 -0
  486. package/sdk/dist/planning-runtime.d.ts.map +1 -0
  487. package/sdk/dist/planning-runtime.js +58 -0
  488. package/sdk/dist/planning-runtime.js.map +1 -0
  489. package/sdk/dist/prompt-builder.d.ts +44 -0
  490. package/sdk/dist/prompt-builder.d.ts.map +1 -0
  491. package/sdk/dist/prompt-builder.js +180 -0
  492. package/sdk/dist/prompt-builder.js.map +1 -0
  493. package/sdk/dist/prompt-sanitizer.d.ts +35 -0
  494. package/sdk/dist/prompt-sanitizer.d.ts.map +1 -0
  495. package/sdk/dist/prompt-sanitizer.js +101 -0
  496. package/sdk/dist/prompt-sanitizer.js.map +1 -0
  497. package/sdk/dist/query/active-workstream-store.d.ts +7 -0
  498. package/sdk/dist/query/active-workstream-store.d.ts.map +1 -0
  499. package/sdk/dist/query/active-workstream-store.js +56 -0
  500. package/sdk/dist/query/active-workstream-store.js.map +1 -0
  501. package/sdk/dist/query/agent-failure-classifier.d.ts +38 -0
  502. package/sdk/dist/query/agent-failure-classifier.d.ts.map +1 -0
  503. package/sdk/dist/query/agent-failure-classifier.js +83 -0
  504. package/sdk/dist/query/agent-failure-classifier.js.map +1 -0
  505. package/sdk/dist/query/audit-open.d.ts +46 -0
  506. package/sdk/dist/query/audit-open.d.ts.map +1 -0
  507. package/sdk/dist/query/audit-open.js +662 -0
  508. package/sdk/dist/query/audit-open.js.map +1 -0
  509. package/sdk/dist/query/check-auto-mode.d.ts +13 -0
  510. package/sdk/dist/query/check-auto-mode.d.ts.map +1 -0
  511. package/sdk/dist/query/check-auto-mode.js +40 -0
  512. package/sdk/dist/query/check-auto-mode.js.map +1 -0
  513. package/sdk/dist/query/check-completion.d.ts +10 -0
  514. package/sdk/dist/query/check-completion.d.ts.map +1 -0
  515. package/sdk/dist/query/check-completion.js +157 -0
  516. package/sdk/dist/query/check-completion.js.map +1 -0
  517. package/sdk/dist/query/check-decision-coverage.d.ts +33 -0
  518. package/sdk/dist/query/check-decision-coverage.d.ts.map +1 -0
  519. package/sdk/dist/query/check-decision-coverage.js +472 -0
  520. package/sdk/dist/query/check-decision-coverage.js.map +1 -0
  521. package/sdk/dist/query/check-gates.d.ts +10 -0
  522. package/sdk/dist/query/check-gates.d.ts.map +1 -0
  523. package/sdk/dist/query/check-gates.js +89 -0
  524. package/sdk/dist/query/check-gates.js.map +1 -0
  525. package/sdk/dist/query/check-ship-ready.d.ts +10 -0
  526. package/sdk/dist/query/check-ship-ready.d.ts.map +1 -0
  527. package/sdk/dist/query/check-ship-ready.js +93 -0
  528. package/sdk/dist/query/check-ship-ready.js.map +1 -0
  529. package/sdk/dist/query/check-verification-status.d.ts +10 -0
  530. package/sdk/dist/query/check-verification-status.d.ts.map +1 -0
  531. package/sdk/dist/query/check-verification-status.js +142 -0
  532. package/sdk/dist/query/check-verification-status.js.map +1 -0
  533. package/sdk/dist/query/command-aliases.generated.d.ts +31 -0
  534. package/sdk/dist/query/command-aliases.generated.d.ts.map +1 -0
  535. package/sdk/dist/query/command-aliases.generated.js +135 -0
  536. package/sdk/dist/query/command-aliases.generated.js.map +1 -0
  537. package/sdk/dist/query/command-catalog.d.ts +9 -0
  538. package/sdk/dist/query/command-catalog.d.ts.map +1 -0
  539. package/sdk/dist/query/command-catalog.js +17 -0
  540. package/sdk/dist/query/command-catalog.js.map +1 -0
  541. package/sdk/dist/query/command-definition.d.ts +19 -0
  542. package/sdk/dist/query/command-definition.d.ts.map +1 -0
  543. package/sdk/dist/query/command-definition.js +44 -0
  544. package/sdk/dist/query/command-definition.js.map +1 -0
  545. package/sdk/dist/query/command-family-handlers.d.ts +3 -0
  546. package/sdk/dist/query/command-family-handlers.d.ts.map +1 -0
  547. package/sdk/dist/query/command-family-handlers.js +94 -0
  548. package/sdk/dist/query/command-family-handlers.js.map +1 -0
  549. package/sdk/dist/query/command-manifest.d.ts +2 -0
  550. package/sdk/dist/query/command-manifest.d.ts.map +1 -0
  551. package/sdk/dist/query/command-manifest.init.d.ts +6 -0
  552. package/sdk/dist/query/command-manifest.init.d.ts.map +1 -0
  553. package/sdk/dist/query/command-manifest.init.js +23 -0
  554. package/sdk/dist/query/command-manifest.init.js.map +1 -0
  555. package/sdk/dist/query/command-manifest.js +17 -0
  556. package/sdk/dist/query/command-manifest.js.map +1 -0
  557. package/sdk/dist/query/command-manifest.non-family.d.ts +9 -0
  558. package/sdk/dist/query/command-manifest.non-family.d.ts.map +1 -0
  559. package/sdk/dist/query/command-manifest.non-family.js +59 -0
  560. package/sdk/dist/query/command-manifest.non-family.js.map +1 -0
  561. package/sdk/dist/query/command-manifest.phase.d.ts +6 -0
  562. package/sdk/dist/query/command-manifest.phase.d.ts.map +1 -0
  563. package/sdk/dist/query/command-manifest.phase.js +15 -0
  564. package/sdk/dist/query/command-manifest.phase.js.map +1 -0
  565. package/sdk/dist/query/command-manifest.phases.d.ts +7 -0
  566. package/sdk/dist/query/command-manifest.phases.d.ts.map +1 -0
  567. package/sdk/dist/query/command-manifest.phases.js +10 -0
  568. package/sdk/dist/query/command-manifest.phases.js.map +1 -0
  569. package/sdk/dist/query/command-manifest.roadmap.d.ts +6 -0
  570. package/sdk/dist/query/command-manifest.roadmap.d.ts.map +1 -0
  571. package/sdk/dist/query/command-manifest.roadmap.js +10 -0
  572. package/sdk/dist/query/command-manifest.roadmap.js.map +1 -0
  573. package/sdk/dist/query/command-manifest.state.d.ts +9 -0
  574. package/sdk/dist/query/command-manifest.state.d.ts.map +1 -0
  575. package/sdk/dist/query/command-manifest.state.js +30 -0
  576. package/sdk/dist/query/command-manifest.state.js.map +1 -0
  577. package/sdk/dist/query/command-manifest.types.d.ts +12 -0
  578. package/sdk/dist/query/command-manifest.types.d.ts.map +1 -0
  579. package/sdk/dist/query/command-manifest.types.js +2 -0
  580. package/sdk/dist/query/command-manifest.types.js.map +1 -0
  581. package/sdk/dist/query/command-manifest.validate.d.ts +6 -0
  582. package/sdk/dist/query/command-manifest.validate.d.ts.map +1 -0
  583. package/sdk/dist/query/command-manifest.validate.js +10 -0
  584. package/sdk/dist/query/command-manifest.validate.js.map +1 -0
  585. package/sdk/dist/query/command-manifest.verify.d.ts +6 -0
  586. package/sdk/dist/query/command-manifest.verify.d.ts.map +1 -0
  587. package/sdk/dist/query/command-manifest.verify.js +14 -0
  588. package/sdk/dist/query/command-manifest.verify.js.map +1 -0
  589. package/sdk/dist/query/command-static-catalog-domain.d.ts +3 -0
  590. package/sdk/dist/query/command-static-catalog-domain.d.ts.map +1 -0
  591. package/sdk/dist/query/command-static-catalog-domain.js +116 -0
  592. package/sdk/dist/query/command-static-catalog-domain.js.map +1 -0
  593. package/sdk/dist/query/command-static-catalog-foundation.d.ts +7 -0
  594. package/sdk/dist/query/command-static-catalog-foundation.d.ts.map +1 -0
  595. package/sdk/dist/query/command-static-catalog-foundation.js +98 -0
  596. package/sdk/dist/query/command-static-catalog-foundation.js.map +1 -0
  597. package/sdk/dist/query/command-topology.d.ts +32 -0
  598. package/sdk/dist/query/command-topology.d.ts.map +1 -0
  599. package/sdk/dist/query/command-topology.js +66 -0
  600. package/sdk/dist/query/command-topology.js.map +1 -0
  601. package/sdk/dist/query/commands-list.d.ts +14 -0
  602. package/sdk/dist/query/commands-list.d.ts.map +1 -0
  603. package/sdk/dist/query/commands-list.js +18 -0
  604. package/sdk/dist/query/commands-list.js.map +1 -0
  605. package/sdk/dist/query/commit.d.ts +79 -0
  606. package/sdk/dist/query/commit.d.ts.map +1 -0
  607. package/sdk/dist/query/commit.js +340 -0
  608. package/sdk/dist/query/commit.js.map +1 -0
  609. package/sdk/dist/query/config-gates.d.ts +12 -0
  610. package/sdk/dist/query/config-gates.d.ts.map +1 -0
  611. package/sdk/dist/query/config-gates.js +66 -0
  612. package/sdk/dist/query/config-gates.js.map +1 -0
  613. package/sdk/dist/query/config-mutation.d.ts +86 -0
  614. package/sdk/dist/query/config-mutation.d.ts.map +1 -0
  615. package/sdk/dist/query/config-mutation.js +518 -0
  616. package/sdk/dist/query/config-mutation.js.map +1 -0
  617. package/sdk/dist/query/config-query.d.ts +57 -0
  618. package/sdk/dist/query/config-query.d.ts.map +1 -0
  619. package/sdk/dist/query/config-query.js +208 -0
  620. package/sdk/dist/query/config-query.js.map +1 -0
  621. package/sdk/dist/query/config-schema.d.ts +36 -0
  622. package/sdk/dist/query/config-schema.d.ts.map +1 -0
  623. package/sdk/dist/query/config-schema.js +147 -0
  624. package/sdk/dist/query/config-schema.js.map +1 -0
  625. package/sdk/dist/query/decisions.d.ts +58 -0
  626. package/sdk/dist/query/decisions.d.ts.map +1 -0
  627. package/sdk/dist/query/decisions.js +161 -0
  628. package/sdk/dist/query/decisions.js.map +1 -0
  629. package/sdk/dist/query/detect-custom-files.d.ts +11 -0
  630. package/sdk/dist/query/detect-custom-files.d.ts.map +1 -0
  631. package/sdk/dist/query/detect-custom-files.js +89 -0
  632. package/sdk/dist/query/detect-custom-files.js.map +1 -0
  633. package/sdk/dist/query/detect-phase-type.d.ts +9 -0
  634. package/sdk/dist/query/detect-phase-type.d.ts.map +1 -0
  635. package/sdk/dist/query/detect-phase-type.js +124 -0
  636. package/sdk/dist/query/detect-phase-type.js.map +1 -0
  637. package/sdk/dist/query/docs-init.d.ts +26 -0
  638. package/sdk/dist/query/docs-init.d.ts.map +1 -0
  639. package/sdk/dist/query/docs-init.js +231 -0
  640. package/sdk/dist/query/docs-init.js.map +1 -0
  641. package/sdk/dist/query/fallow-audit.d.ts +44 -0
  642. package/sdk/dist/query/fallow-audit.d.ts.map +1 -0
  643. package/sdk/dist/query/fallow-audit.js +44 -0
  644. package/sdk/dist/query/fallow-audit.js.map +1 -0
  645. package/sdk/dist/query/frontmatter-mutation.d.ts +77 -0
  646. package/sdk/dist/query/frontmatter-mutation.d.ts.map +1 -0
  647. package/sdk/dist/query/frontmatter-mutation.js +317 -0
  648. package/sdk/dist/query/frontmatter-mutation.js.map +1 -0
  649. package/sdk/dist/query/frontmatter.d.ts +93 -0
  650. package/sdk/dist/query/frontmatter.d.ts.map +1 -0
  651. package/sdk/dist/query/frontmatter.js +365 -0
  652. package/sdk/dist/query/frontmatter.js.map +1 -0
  653. package/sdk/dist/query/helpers.d.ts +191 -0
  654. package/sdk/dist/query/helpers.d.ts.map +1 -0
  655. package/sdk/dist/query/helpers.js +613 -0
  656. package/sdk/dist/query/helpers.js.map +1 -0
  657. package/sdk/dist/query/index.d.ts +8 -0
  658. package/sdk/dist/query/index.d.ts.map +1 -0
  659. package/sdk/dist/query/index.js +6 -0
  660. package/sdk/dist/query/index.js.map +1 -0
  661. package/sdk/dist/query/init-complex.d.ts +47 -0
  662. package/sdk/dist/query/init-complex.d.ts.map +1 -0
  663. package/sdk/dist/query/init-complex.js +718 -0
  664. package/sdk/dist/query/init-complex.js.map +1 -0
  665. package/sdk/dist/query/init.d.ts +106 -0
  666. package/sdk/dist/query/init.d.ts.map +1 -0
  667. package/sdk/dist/query/init.js +1159 -0
  668. package/sdk/dist/query/init.js.map +1 -0
  669. package/sdk/dist/query/intel.d.ts +43 -0
  670. package/sdk/dist/query/intel.d.ts.map +1 -0
  671. package/sdk/dist/query/intel.js +416 -0
  672. package/sdk/dist/query/intel.js.map +1 -0
  673. package/sdk/dist/query/mutation-event-decorator.d.ts +5 -0
  674. package/sdk/dist/query/mutation-event-decorator.d.ts.map +1 -0
  675. package/sdk/dist/query/mutation-event-decorator.js +28 -0
  676. package/sdk/dist/query/mutation-event-decorator.js.map +1 -0
  677. package/sdk/dist/query/mutation-event-mapper.d.ts +4 -0
  678. package/sdk/dist/query/mutation-event-mapper.d.ts.map +1 -0
  679. package/sdk/dist/query/mutation-event-mapper.js +70 -0
  680. package/sdk/dist/query/mutation-event-mapper.js.map +1 -0
  681. package/sdk/dist/query/mvp.d.ts +113 -0
  682. package/sdk/dist/query/mvp.d.ts.map +1 -0
  683. package/sdk/dist/query/mvp.js +225 -0
  684. package/sdk/dist/query/mvp.js.map +1 -0
  685. package/sdk/dist/query/phase-filesystem-adapter.d.ts +4 -0
  686. package/sdk/dist/query/phase-filesystem-adapter.d.ts.map +1 -0
  687. package/sdk/dist/query/phase-filesystem-adapter.js +33 -0
  688. package/sdk/dist/query/phase-filesystem-adapter.js.map +1 -0
  689. package/sdk/dist/query/phase-lifecycle-policy.d.ts +34 -0
  690. package/sdk/dist/query/phase-lifecycle-policy.d.ts.map +1 -0
  691. package/sdk/dist/query/phase-lifecycle-policy.js +138 -0
  692. package/sdk/dist/query/phase-lifecycle-policy.js.map +1 -0
  693. package/sdk/dist/query/phase-lifecycle.d.ts +116 -0
  694. package/sdk/dist/query/phase-lifecycle.d.ts.map +1 -0
  695. package/sdk/dist/query/phase-lifecycle.js +1486 -0
  696. package/sdk/dist/query/phase-lifecycle.js.map +1 -0
  697. package/sdk/dist/query/phase-list-queries.d.ts +18 -0
  698. package/sdk/dist/query/phase-list-queries.d.ts.map +1 -0
  699. package/sdk/dist/query/phase-list-queries.js +129 -0
  700. package/sdk/dist/query/phase-list-queries.js.map +1 -0
  701. package/sdk/dist/query/phase-ready.d.ts +9 -0
  702. package/sdk/dist/query/phase-ready.d.ts.map +1 -0
  703. package/sdk/dist/query/phase-ready.js +132 -0
  704. package/sdk/dist/query/phase-ready.js.map +1 -0
  705. package/sdk/dist/query/phase-roadmap-mutation.d.ts +13 -0
  706. package/sdk/dist/query/phase-roadmap-mutation.d.ts.map +1 -0
  707. package/sdk/dist/query/phase-roadmap-mutation.js +65 -0
  708. package/sdk/dist/query/phase-roadmap-mutation.js.map +1 -0
  709. package/sdk/dist/query/phase.d.ts +48 -0
  710. package/sdk/dist/query/phase.d.ts.map +1 -0
  711. package/sdk/dist/query/phase.js +451 -0
  712. package/sdk/dist/query/phase.js.map +1 -0
  713. package/sdk/dist/query/pipeline.d.ts +53 -0
  714. package/sdk/dist/query/pipeline.d.ts.map +1 -0
  715. package/sdk/dist/query/pipeline.js +198 -0
  716. package/sdk/dist/query/pipeline.js.map +1 -0
  717. package/sdk/dist/query/plan-scan.d.ts +14 -0
  718. package/sdk/dist/query/plan-scan.d.ts.map +1 -0
  719. package/sdk/dist/query/plan-scan.js +70 -0
  720. package/sdk/dist/query/plan-scan.js.map +1 -0
  721. package/sdk/dist/query/plan-task-structure.d.ts +9 -0
  722. package/sdk/dist/query/plan-task-structure.d.ts.map +1 -0
  723. package/sdk/dist/query/plan-task-structure.js +59 -0
  724. package/sdk/dist/query/plan-task-structure.js.map +1 -0
  725. package/sdk/dist/query/profile-extract-messages.d.ts +40 -0
  726. package/sdk/dist/query/profile-extract-messages.d.ts.map +1 -0
  727. package/sdk/dist/query/profile-extract-messages.js +195 -0
  728. package/sdk/dist/query/profile-extract-messages.js.map +1 -0
  729. package/sdk/dist/query/profile-output.d.ts +11 -0
  730. package/sdk/dist/query/profile-output.d.ts.map +1 -0
  731. package/sdk/dist/query/profile-output.js +873 -0
  732. package/sdk/dist/query/profile-output.js.map +1 -0
  733. package/sdk/dist/query/profile-questionnaire-data.d.ts +21 -0
  734. package/sdk/dist/query/profile-questionnaire-data.d.ts.map +1 -0
  735. package/sdk/dist/query/profile-questionnaire-data.js +171 -0
  736. package/sdk/dist/query/profile-questionnaire-data.js.map +1 -0
  737. package/sdk/dist/query/profile-sample.d.ts +22 -0
  738. package/sdk/dist/query/profile-sample.d.ts.map +1 -0
  739. package/sdk/dist/query/profile-sample.js +136 -0
  740. package/sdk/dist/query/profile-sample.js.map +1 -0
  741. package/sdk/dist/query/profile-scan-sessions.d.ts +49 -0
  742. package/sdk/dist/query/profile-scan-sessions.d.ts.map +1 -0
  743. package/sdk/dist/query/profile-scan-sessions.js +137 -0
  744. package/sdk/dist/query/profile-scan-sessions.js.map +1 -0
  745. package/sdk/dist/query/profile.d.ts +61 -0
  746. package/sdk/dist/query/profile.d.ts.map +1 -0
  747. package/sdk/dist/query/profile.js +307 -0
  748. package/sdk/dist/query/profile.js.map +1 -0
  749. package/sdk/dist/query/progress.d.ts +77 -0
  750. package/sdk/dist/query/progress.d.ts.map +1 -0
  751. package/sdk/dist/query/progress.js +481 -0
  752. package/sdk/dist/query/progress.js.map +1 -0
  753. package/sdk/dist/query/query-cli-adapter.d.ts +8 -0
  754. package/sdk/dist/query/query-cli-adapter.d.ts.map +1 -0
  755. package/sdk/dist/query/query-cli-adapter.js +32 -0
  756. package/sdk/dist/query/query-cli-adapter.js.map +1 -0
  757. package/sdk/dist/query/query-cli-output.d.ts +9 -0
  758. package/sdk/dist/query/query-cli-output.d.ts.map +1 -0
  759. package/sdk/dist/query/query-cli-output.js +28 -0
  760. package/sdk/dist/query/query-cli-output.js.map +1 -0
  761. package/sdk/dist/query/query-command-diagnosis.d.ts +6 -0
  762. package/sdk/dist/query/query-command-diagnosis.d.ts.map +1 -0
  763. package/sdk/dist/query/query-command-diagnosis.js +6 -0
  764. package/sdk/dist/query/query-command-diagnosis.js.map +1 -0
  765. package/sdk/dist/query/query-command-resolution-strategy.d.ts +29 -0
  766. package/sdk/dist/query/query-command-resolution-strategy.d.ts.map +1 -0
  767. package/sdk/dist/query/query-command-resolution-strategy.js +103 -0
  768. package/sdk/dist/query/query-command-resolution-strategy.js.map +1 -0
  769. package/sdk/dist/query/query-command-semantics.d.ts +7 -0
  770. package/sdk/dist/query/query-command-semantics.d.ts.map +1 -0
  771. package/sdk/dist/query/query-command-semantics.js +7 -0
  772. package/sdk/dist/query/query-command-semantics.js.map +1 -0
  773. package/sdk/dist/query/query-dispatch-contract.d.ts +21 -0
  774. package/sdk/dist/query/query-dispatch-contract.d.ts.map +1 -0
  775. package/sdk/dist/query/query-dispatch-contract.js +2 -0
  776. package/sdk/dist/query/query-dispatch-contract.js.map +1 -0
  777. package/sdk/dist/query/query-dispatch-error-mapper.d.ts +6 -0
  778. package/sdk/dist/query/query-dispatch-error-mapper.d.ts.map +1 -0
  779. package/sdk/dist/query/query-dispatch-error-mapper.js +6 -0
  780. package/sdk/dist/query/query-dispatch-error-mapper.js.map +1 -0
  781. package/sdk/dist/query/query-dispatch-formatting.d.ts +6 -0
  782. package/sdk/dist/query/query-dispatch-formatting.d.ts.map +1 -0
  783. package/sdk/dist/query/query-dispatch-formatting.js +6 -0
  784. package/sdk/dist/query/query-dispatch-formatting.js.map +1 -0
  785. package/sdk/dist/query/query-dispatch-input-validation.d.ts +6 -0
  786. package/sdk/dist/query/query-dispatch-input-validation.d.ts.map +1 -0
  787. package/sdk/dist/query/query-dispatch-input-validation.js +6 -0
  788. package/sdk/dist/query/query-dispatch-input-validation.js.map +1 -0
  789. package/sdk/dist/query/query-dispatch-observability.d.ts +2 -0
  790. package/sdk/dist/query/query-dispatch-observability.d.ts.map +1 -0
  791. package/sdk/dist/query/query-dispatch-observability.js +7 -0
  792. package/sdk/dist/query/query-dispatch-observability.js.map +1 -0
  793. package/sdk/dist/query/query-dispatch-plan.d.ts +6 -0
  794. package/sdk/dist/query/query-dispatch-plan.d.ts.map +1 -0
  795. package/sdk/dist/query/query-dispatch-plan.js +6 -0
  796. package/sdk/dist/query/query-dispatch-plan.js.map +1 -0
  797. package/sdk/dist/query/query-dispatch-result-builder.d.ts +6 -0
  798. package/sdk/dist/query/query-dispatch-result-builder.d.ts.map +1 -0
  799. package/sdk/dist/query/query-dispatch-result-builder.js +6 -0
  800. package/sdk/dist/query/query-dispatch-result-builder.js.map +1 -0
  801. package/sdk/dist/query/query-dispatch.d.ts +48 -0
  802. package/sdk/dist/query/query-dispatch.d.ts.map +1 -0
  803. package/sdk/dist/query/query-dispatch.js +175 -0
  804. package/sdk/dist/query/query-dispatch.js.map +1 -0
  805. package/sdk/dist/query/query-error-details-schema.d.ts +19 -0
  806. package/sdk/dist/query/query-error-details-schema.d.ts.map +1 -0
  807. package/sdk/dist/query/query-error-details-schema.js +10 -0
  808. package/sdk/dist/query/query-error-details-schema.js.map +1 -0
  809. package/sdk/dist/query/query-error-taxonomy.d.ts +38 -0
  810. package/sdk/dist/query/query-error-taxonomy.d.ts.map +1 -0
  811. package/sdk/dist/query/query-error-taxonomy.js +74 -0
  812. package/sdk/dist/query/query-error-taxonomy.js.map +1 -0
  813. package/sdk/dist/query/query-fallback-bridge-adapter.d.ts +14 -0
  814. package/sdk/dist/query/query-fallback-bridge-adapter.d.ts.map +1 -0
  815. package/sdk/dist/query/query-fallback-bridge-adapter.js +33 -0
  816. package/sdk/dist/query/query-fallback-bridge-adapter.js.map +1 -0
  817. package/sdk/dist/query/query-fallback-executor.d.ts +11 -0
  818. package/sdk/dist/query/query-fallback-executor.d.ts.map +1 -0
  819. package/sdk/dist/query/query-fallback-executor.js +31 -0
  820. package/sdk/dist/query/query-fallback-executor.js.map +1 -0
  821. package/sdk/dist/query/query-fallback-output-classifier.d.ts +6 -0
  822. package/sdk/dist/query/query-fallback-output-classifier.d.ts.map +1 -0
  823. package/sdk/dist/query/query-fallback-output-classifier.js +27 -0
  824. package/sdk/dist/query/query-fallback-output-classifier.js.map +1 -0
  825. package/sdk/dist/query/query-fallback-policy.d.ts +6 -0
  826. package/sdk/dist/query/query-fallback-policy.d.ts.map +1 -0
  827. package/sdk/dist/query/query-fallback-policy.js +7 -0
  828. package/sdk/dist/query/query-fallback-policy.js.map +1 -0
  829. package/sdk/dist/query/query-native-dispatch-adapter.d.ts +7 -0
  830. package/sdk/dist/query/query-native-dispatch-adapter.d.ts.map +1 -0
  831. package/sdk/dist/query/query-native-dispatch-adapter.js +6 -0
  832. package/sdk/dist/query/query-native-dispatch-adapter.js.map +1 -0
  833. package/sdk/dist/query/query-policy-capability.d.ts +10 -0
  834. package/sdk/dist/query/query-policy-capability.d.ts.map +1 -0
  835. package/sdk/dist/query/query-policy-capability.js +17 -0
  836. package/sdk/dist/query/query-policy-capability.js.map +1 -0
  837. package/sdk/dist/query/query-runtime-context.d.ts +19 -0
  838. package/sdk/dist/query/query-runtime-context.d.ts.map +1 -0
  839. package/sdk/dist/query/query-runtime-context.js +31 -0
  840. package/sdk/dist/query/query-runtime-context.js.map +1 -0
  841. package/sdk/dist/query/query-unknown-command-hints.d.ts +2 -0
  842. package/sdk/dist/query/query-unknown-command-hints.d.ts.map +1 -0
  843. package/sdk/dist/query/query-unknown-command-hints.js +6 -0
  844. package/sdk/dist/query/query-unknown-command-hints.js.map +1 -0
  845. package/sdk/dist/query/registry-assembly-descriptor.d.ts +12 -0
  846. package/sdk/dist/query/registry-assembly-descriptor.d.ts.map +1 -0
  847. package/sdk/dist/query/registry-assembly-descriptor.js +61 -0
  848. package/sdk/dist/query/registry-assembly-descriptor.js.map +1 -0
  849. package/sdk/dist/query/registry-assembly-invariants.d.ts +30 -0
  850. package/sdk/dist/query/registry-assembly-invariants.d.ts.map +1 -0
  851. package/sdk/dist/query/registry-assembly-invariants.js +77 -0
  852. package/sdk/dist/query/registry-assembly-invariants.js.map +1 -0
  853. package/sdk/dist/query/registry-assembly.d.ts +10 -0
  854. package/sdk/dist/query/registry-assembly.d.ts.map +1 -0
  855. package/sdk/dist/query/registry-assembly.js +53 -0
  856. package/sdk/dist/query/registry-assembly.js.map +1 -0
  857. package/sdk/dist/query/registry.d.ts +90 -0
  858. package/sdk/dist/query/registry.d.ts.map +1 -0
  859. package/sdk/dist/query/registry.js +129 -0
  860. package/sdk/dist/query/registry.js.map +1 -0
  861. package/sdk/dist/query/requirements-extract-from-plans.d.ts +9 -0
  862. package/sdk/dist/query/requirements-extract-from-plans.d.ts.map +1 -0
  863. package/sdk/dist/query/requirements-extract-from-plans.js +76 -0
  864. package/sdk/dist/query/requirements-extract-from-plans.js.map +1 -0
  865. package/sdk/dist/query/roadmap-update-plan-progress.d.ts +11 -0
  866. package/sdk/dist/query/roadmap-update-plan-progress.d.ts.map +1 -0
  867. package/sdk/dist/query/roadmap-update-plan-progress.js +124 -0
  868. package/sdk/dist/query/roadmap-update-plan-progress.js.map +1 -0
  869. package/sdk/dist/query/roadmap.d.ts +137 -0
  870. package/sdk/dist/query/roadmap.d.ts.map +1 -0
  871. package/sdk/dist/query/roadmap.js +753 -0
  872. package/sdk/dist/query/roadmap.js.map +1 -0
  873. package/sdk/dist/query/route-next-action.d.ts +9 -0
  874. package/sdk/dist/query/route-next-action.d.ts.map +1 -0
  875. package/sdk/dist/query/route-next-action.js +318 -0
  876. package/sdk/dist/query/route-next-action.js.map +1 -0
  877. package/sdk/dist/query/schema-detect.d.ts +21 -0
  878. package/sdk/dist/query/schema-detect.d.ts.map +1 -0
  879. package/sdk/dist/query/schema-detect.js +146 -0
  880. package/sdk/dist/query/schema-detect.js.map +1 -0
  881. package/sdk/dist/query/secrets.d.ts +27 -0
  882. package/sdk/dist/query/secrets.d.ts.map +1 -0
  883. package/sdk/dist/query/secrets.js +42 -0
  884. package/sdk/dist/query/secrets.js.map +1 -0
  885. package/sdk/dist/query/skill-manifest.d.ts +50 -0
  886. package/sdk/dist/query/skill-manifest.d.ts.map +1 -0
  887. package/sdk/dist/query/skill-manifest.js +171 -0
  888. package/sdk/dist/query/skill-manifest.js.map +1 -0
  889. package/sdk/dist/query/skills.d.ts +27 -0
  890. package/sdk/dist/query/skills.d.ts.map +1 -0
  891. package/sdk/dist/query/skills.js +137 -0
  892. package/sdk/dist/query/skills.js.map +1 -0
  893. package/sdk/dist/query/state-document.d.ts +14 -0
  894. package/sdk/dist/query/state-document.d.ts.map +1 -0
  895. package/sdk/dist/query/state-document.js +110 -0
  896. package/sdk/dist/query/state-document.js.map +1 -0
  897. package/sdk/dist/query/state-mutation.d.ts +224 -0
  898. package/sdk/dist/query/state-mutation.d.ts.map +1 -0
  899. package/sdk/dist/query/state-mutation.js +1539 -0
  900. package/sdk/dist/query/state-mutation.js.map +1 -0
  901. package/sdk/dist/query/state-project-load.d.ts +23 -0
  902. package/sdk/dist/query/state-project-load.d.ts.map +1 -0
  903. package/sdk/dist/query/state-project-load.js +75 -0
  904. package/sdk/dist/query/state-project-load.js.map +1 -0
  905. package/sdk/dist/query/state.d.ts +78 -0
  906. package/sdk/dist/query/state.d.ts.map +1 -0
  907. package/sdk/dist/query/state.js +430 -0
  908. package/sdk/dist/query/state.js.map +1 -0
  909. package/sdk/dist/query/summary.d.ts +18 -0
  910. package/sdk/dist/query/summary.d.ts.map +1 -0
  911. package/sdk/dist/query/summary.js +249 -0
  912. package/sdk/dist/query/summary.js.map +1 -0
  913. package/sdk/dist/query/template.d.ts +46 -0
  914. package/sdk/dist/query/template.d.ts.map +1 -0
  915. package/sdk/dist/query/template.js +210 -0
  916. package/sdk/dist/query/template.js.map +1 -0
  917. package/sdk/dist/query/uat.d.ts +34 -0
  918. package/sdk/dist/query/uat.d.ts.map +1 -0
  919. package/sdk/dist/query/uat.js +339 -0
  920. package/sdk/dist/query/uat.js.map +1 -0
  921. package/sdk/dist/query/utils.d.ts +59 -0
  922. package/sdk/dist/query/utils.d.ts.map +1 -0
  923. package/sdk/dist/query/utils.js +74 -0
  924. package/sdk/dist/query/utils.js.map +1 -0
  925. package/sdk/dist/query/validate.d.ts +67 -0
  926. package/sdk/dist/query/validate.d.ts.map +1 -0
  927. package/sdk/dist/query/validate.js +908 -0
  928. package/sdk/dist/query/validate.js.map +1 -0
  929. package/sdk/dist/query/verify.d.ts +110 -0
  930. package/sdk/dist/query/verify.d.ts.map +1 -0
  931. package/sdk/dist/query/verify.js +631 -0
  932. package/sdk/dist/query/verify.js.map +1 -0
  933. package/sdk/dist/query/websearch.d.ts +24 -0
  934. package/sdk/dist/query/websearch.d.ts.map +1 -0
  935. package/sdk/dist/query/websearch.js +68 -0
  936. package/sdk/dist/query/websearch.js.map +1 -0
  937. package/sdk/dist/query/workspace.d.ts +62 -0
  938. package/sdk/dist/query/workspace.d.ts.map +1 -0
  939. package/sdk/dist/query/workspace.js +104 -0
  940. package/sdk/dist/query/workspace.js.map +1 -0
  941. package/sdk/dist/query/workstream-inventory.d.ts +52 -0
  942. package/sdk/dist/query/workstream-inventory.d.ts.map +1 -0
  943. package/sdk/dist/query/workstream-inventory.js +141 -0
  944. package/sdk/dist/query/workstream-inventory.js.map +1 -0
  945. package/sdk/dist/query/workstream.d.ts +35 -0
  946. package/sdk/dist/query/workstream.d.ts.map +1 -0
  947. package/sdk/dist/query/workstream.js +298 -0
  948. package/sdk/dist/query/workstream.js.map +1 -0
  949. package/sdk/dist/query/worktree.d.ts +3 -0
  950. package/sdk/dist/query/worktree.d.ts.map +1 -0
  951. package/sdk/dist/query/worktree.js +36 -0
  952. package/sdk/dist/query/worktree.js.map +1 -0
  953. package/sdk/dist/query-command-executor.d.ts +22 -0
  954. package/sdk/dist/query-command-executor.d.ts.map +1 -0
  955. package/sdk/dist/query-command-executor.js +22 -0
  956. package/sdk/dist/query-command-executor.js.map +1 -0
  957. package/sdk/dist/query-execution-policy.d.ts +24 -0
  958. package/sdk/dist/query-execution-policy.d.ts.map +1 -0
  959. package/sdk/dist/query-execution-policy.js +27 -0
  960. package/sdk/dist/query-execution-policy.js.map +1 -0
  961. package/sdk/dist/query-failure-classification.d.ts +9 -0
  962. package/sdk/dist/query-failure-classification.d.ts.map +1 -0
  963. package/sdk/dist/query-failure-classification.js +32 -0
  964. package/sdk/dist/query-failure-classification.js.map +1 -0
  965. package/sdk/dist/query-hotpath-methods.d.ts +19 -0
  966. package/sdk/dist/query-hotpath-methods.d.ts.map +1 -0
  967. package/sdk/dist/query-hotpath-methods.js +34 -0
  968. package/sdk/dist/query-hotpath-methods.js.map +1 -0
  969. package/sdk/dist/query-native-direct-adapter.d.ts +20 -0
  970. package/sdk/dist/query-native-direct-adapter.d.ts.map +1 -0
  971. package/sdk/dist/query-native-direct-adapter.js +52 -0
  972. package/sdk/dist/query-native-direct-adapter.js.map +1 -0
  973. package/sdk/dist/query-native-hotpath-adapter.d.ts +15 -0
  974. package/sdk/dist/query-native-hotpath-adapter.d.ts.map +1 -0
  975. package/sdk/dist/query-native-hotpath-adapter.js +32 -0
  976. package/sdk/dist/query-native-hotpath-adapter.js.map +1 -0
  977. package/sdk/dist/query-raw-output-projection.d.ts +6 -0
  978. package/sdk/dist/query-raw-output-projection.d.ts.map +1 -0
  979. package/sdk/dist/query-raw-output-projection.js +67 -0
  980. package/sdk/dist/query-raw-output-projection.js.map +1 -0
  981. package/sdk/dist/query-runtime-bridge.d.ts +61 -0
  982. package/sdk/dist/query-runtime-bridge.d.ts.map +1 -0
  983. package/sdk/dist/query-runtime-bridge.js +144 -0
  984. package/sdk/dist/query-runtime-bridge.js.map +1 -0
  985. package/sdk/dist/query-sdd-tools-path.d.ts +2 -0
  986. package/sdk/dist/query-sdd-tools-path.d.ts.map +1 -0
  987. package/sdk/dist/query-sdd-tools-path.js +2 -0
  988. package/sdk/dist/query-sdd-tools-path.js.map +1 -0
  989. package/sdk/dist/query-sdd-tools-runtime.d.ts +20 -0
  990. package/sdk/dist/query-sdd-tools-runtime.d.ts.map +1 -0
  991. package/sdk/dist/query-sdd-tools-runtime.js +47 -0
  992. package/sdk/dist/query-sdd-tools-runtime.js.map +1 -0
  993. package/sdk/dist/query-subprocess-adapter.d.ts +18 -0
  994. package/sdk/dist/query-subprocess-adapter.d.ts.map +1 -0
  995. package/sdk/dist/query-subprocess-adapter.js +92 -0
  996. package/sdk/dist/query-subprocess-adapter.js.map +1 -0
  997. package/sdk/dist/query-tools-error-factory.d.ts +16 -0
  998. package/sdk/dist/query-tools-error-factory.d.ts.map +1 -0
  999. package/sdk/dist/query-tools-error-factory.js +33 -0
  1000. package/sdk/dist/query-tools-error-factory.js.map +1 -0
  1001. package/sdk/dist/research-gate.d.ts +24 -0
  1002. package/sdk/dist/research-gate.d.ts.map +1 -0
  1003. package/sdk/dist/research-gate.js +70 -0
  1004. package/sdk/dist/research-gate.js.map +1 -0
  1005. package/sdk/dist/runtime-gate.d.ts +14 -0
  1006. package/sdk/dist/runtime-gate.d.ts.map +1 -0
  1007. package/sdk/dist/runtime-gate.js +48 -0
  1008. package/sdk/dist/runtime-gate.js.map +1 -0
  1009. package/sdk/dist/sdd-tools-error.d.ts +23 -0
  1010. package/sdk/dist/sdd-tools-error.d.ts.map +1 -0
  1011. package/sdk/dist/sdd-tools-error.js +29 -0
  1012. package/sdk/dist/sdd-tools-error.js.map +1 -0
  1013. package/sdk/dist/sdd-tools.d.ts +97 -0
  1014. package/sdk/dist/sdd-tools.d.ts.map +1 -0
  1015. package/sdk/dist/sdd-tools.js +168 -0
  1016. package/sdk/dist/sdd-tools.js.map +1 -0
  1017. package/sdk/dist/sdd-transport-policy.d.ts +10 -0
  1018. package/sdk/dist/sdd-transport-policy.d.ts.map +1 -0
  1019. package/sdk/dist/sdd-transport-policy.js +32 -0
  1020. package/sdk/dist/sdd-transport-policy.js.map +1 -0
  1021. package/sdk/dist/sdd-transport.d.ts +39 -0
  1022. package/sdk/dist/sdd-transport.d.ts.map +1 -0
  1023. package/sdk/dist/sdd-transport.js +78 -0
  1024. package/sdk/dist/sdd-transport.js.map +1 -0
  1025. package/sdk/dist/sdk-package-compatibility.d.ts +38 -0
  1026. package/sdk/dist/sdk-package-compatibility.d.ts.map +1 -0
  1027. package/sdk/dist/sdk-package-compatibility.js +90 -0
  1028. package/sdk/dist/sdk-package-compatibility.js.map +1 -0
  1029. package/sdk/dist/session-runner.d.ts +40 -0
  1030. package/sdk/dist/session-runner.d.ts.map +1 -0
  1031. package/sdk/dist/session-runner.js +274 -0
  1032. package/sdk/dist/session-runner.js.map +1 -0
  1033. package/sdk/dist/tool-scoping.d.ts +31 -0
  1034. package/sdk/dist/tool-scoping.d.ts.map +1 -0
  1035. package/sdk/dist/tool-scoping.js +54 -0
  1036. package/sdk/dist/tool-scoping.js.map +1 -0
  1037. package/sdk/dist/types.d.ts +794 -0
  1038. package/sdk/dist/types.d.ts.map +1 -0
  1039. package/sdk/dist/types.js +77 -0
  1040. package/sdk/dist/types.js.map +1 -0
  1041. package/sdk/dist/workstream-name-policy.d.ts +13 -0
  1042. package/sdk/dist/workstream-name-policy.d.ts.map +1 -0
  1043. package/sdk/dist/workstream-name-policy.js +24 -0
  1044. package/sdk/dist/workstream-name-policy.js.map +1 -0
  1045. package/sdk/dist/workstream-utils.d.ts +15 -0
  1046. package/sdk/dist/workstream-utils.d.ts.map +1 -0
  1047. package/sdk/dist/workstream-utils.js +21 -0
  1048. package/sdk/dist/workstream-utils.js.map +1 -0
  1049. package/sdk/dist/ws-transport.d.ts +32 -0
  1050. package/sdk/dist/ws-transport.d.ts.map +1 -0
  1051. package/sdk/dist/ws-transport.js +84 -0
  1052. package/sdk/dist/ws-transport.js.map +1 -0
  1053. package/sdk/package-lock.json +2502 -0
  1054. package/sdk/package.json +57 -0
  1055. package/sdk/prompts/templates/project.md +186 -0
  1056. package/sdk/prompts/templates/requirements.md +231 -0
  1057. package/sdk/prompts/templates/research-project/ARCHITECTURE.md +204 -0
  1058. package/sdk/prompts/templates/research-project/FEATURES.md +147 -0
  1059. package/sdk/prompts/templates/research-project/PITFALLS.md +200 -0
  1060. package/sdk/prompts/templates/research-project/STACK.md +120 -0
  1061. package/sdk/prompts/templates/research-project/SUMMARY.md +170 -0
  1062. package/sdk/prompts/templates/roadmap.md +202 -0
  1063. package/sdk/prompts/templates/state.md +175 -0
  1064. package/sdk/shared/model-catalog.json +122 -0
  1065. package/sdk/src/assembled-prompts.test.ts +349 -0
  1066. package/sdk/src/bug-3591-sddtools-runtime-workstream.test.ts +179 -0
  1067. package/sdk/src/cli-transport.test.ts +388 -0
  1068. package/sdk/src/cli-transport.ts +130 -0
  1069. package/sdk/src/cli.test.ts +426 -0
  1070. package/sdk/src/cli.ts +589 -0
  1071. package/sdk/src/config.test.ts +271 -0
  1072. package/sdk/src/config.ts +218 -0
  1073. package/sdk/src/context-engine.test.ts +295 -0
  1074. package/sdk/src/context-engine.ts +170 -0
  1075. package/sdk/src/context-truncation.test.ts +163 -0
  1076. package/sdk/src/context-truncation.ts +233 -0
  1077. package/sdk/src/e2e.integration.test.ts +181 -0
  1078. package/sdk/src/errors.ts +72 -0
  1079. package/sdk/src/event-stream.test.ts +661 -0
  1080. package/sdk/src/event-stream.ts +441 -0
  1081. package/sdk/src/golden/capture.ts +95 -0
  1082. package/sdk/src/golden/fixtures/generate-slug.golden.json +1 -0
  1083. package/sdk/src/golden/fixtures/profile-sample-sessions/demo-project/sample.jsonl +3 -0
  1084. package/sdk/src/golden/fixtures/summary-extract-sample.md +26 -0
  1085. package/sdk/src/golden/fixtures/uat-render-checkpoint-sample.md +15 -0
  1086. package/sdk/src/golden/golden-integration-covered.ts +30 -0
  1087. package/sdk/src/golden/golden-mutation-covered.ts +17 -0
  1088. package/sdk/src/golden/golden-policy.test.ts +8 -0
  1089. package/sdk/src/golden/golden-policy.ts +120 -0
  1090. package/sdk/src/golden/golden.integration.test.ts +677 -0
  1091. package/sdk/src/golden/init-golden-normalize.ts +15 -0
  1092. package/sdk/src/golden/read-only-golden-rows.ts +77 -0
  1093. package/sdk/src/golden/read-only-parity.integration.test.ts +133 -0
  1094. package/sdk/src/golden/registry-canonical-commands.ts +31 -0
  1095. package/sdk/src/index.ts +352 -0
  1096. package/sdk/src/init-e2e.integration.test.ts +138 -0
  1097. package/sdk/src/init-runner.test.ts +740 -0
  1098. package/sdk/src/init-runner.ts +734 -0
  1099. package/sdk/src/lifecycle-e2e.integration.test.ts +258 -0
  1100. package/sdk/src/logger.test.ts +149 -0
  1101. package/sdk/src/logger.ts +113 -0
  1102. package/sdk/src/milestone-runner.test.ts +421 -0
  1103. package/sdk/src/model-catalog.ts +70 -0
  1104. package/sdk/src/phase-prompt.test.ts +535 -0
  1105. package/sdk/src/phase-prompt.ts +259 -0
  1106. package/sdk/src/phase-runner-types.test.ts +421 -0
  1107. package/sdk/src/phase-runner.integration.test.ts +377 -0
  1108. package/sdk/src/phase-runner.test.ts +2720 -0
  1109. package/sdk/src/phase-runner.ts +1442 -0
  1110. package/sdk/src/plan-parser.test.ts +579 -0
  1111. package/sdk/src/plan-parser.ts +431 -0
  1112. package/sdk/src/planning-journal.test.ts +70 -0
  1113. package/sdk/src/planning-journal.ts +153 -0
  1114. package/sdk/src/planning-runtime.test.ts +29 -0
  1115. package/sdk/src/planning-runtime.ts +100 -0
  1116. package/sdk/src/prompt-builder.test.ts +318 -0
  1117. package/sdk/src/prompt-builder.ts +218 -0
  1118. package/sdk/src/prompt-sanitizer.test.ts +260 -0
  1119. package/sdk/src/prompt-sanitizer.ts +116 -0
  1120. package/sdk/src/query/QUERY-HANDLERS.md +349 -0
  1121. package/sdk/src/query/active-workstream-store.ts +50 -0
  1122. package/sdk/src/query/agent-failure-classifier.test.ts +157 -0
  1123. package/sdk/src/query/agent-failure-classifier.ts +105 -0
  1124. package/sdk/src/query/audit-open.ts +722 -0
  1125. package/sdk/src/query/check-auto-mode.test.ts +77 -0
  1126. package/sdk/src/query/check-auto-mode.ts +49 -0
  1127. package/sdk/src/query/check-completion.test.ts +113 -0
  1128. package/sdk/src/query/check-completion.ts +182 -0
  1129. package/sdk/src/query/check-decision-coverage.test.ts +519 -0
  1130. package/sdk/src/query/check-decision-coverage.ts +554 -0
  1131. package/sdk/src/query/check-gates.test.ts +103 -0
  1132. package/sdk/src/query/check-gates.ts +112 -0
  1133. package/sdk/src/query/check-ship-ready.test.ts +111 -0
  1134. package/sdk/src/query/check-ship-ready.ts +104 -0
  1135. package/sdk/src/query/check-verification-status.test.ts +143 -0
  1136. package/sdk/src/query/check-verification-status.ts +160 -0
  1137. package/sdk/src/query/command-aliases.generated.ts +156 -0
  1138. package/sdk/src/query/command-catalog.ts +31 -0
  1139. package/sdk/src/query/command-definition.test.ts +47 -0
  1140. package/sdk/src/query/command-definition.ts +70 -0
  1141. package/sdk/src/query/command-family-handlers.ts +117 -0
  1142. package/sdk/src/query/command-manifest.init.ts +24 -0
  1143. package/sdk/src/query/command-manifest.non-family.ts +85 -0
  1144. package/sdk/src/query/command-manifest.phase.ts +16 -0
  1145. package/sdk/src/query/command-manifest.phases.ts +11 -0
  1146. package/sdk/src/query/command-manifest.roadmap.ts +11 -0
  1147. package/sdk/src/query/command-manifest.state.ts +31 -0
  1148. package/sdk/src/query/command-manifest.ts +17 -0
  1149. package/sdk/src/query/command-manifest.types.ts +13 -0
  1150. package/sdk/src/query/command-manifest.validate.ts +11 -0
  1151. package/sdk/src/query/command-manifest.verify.ts +15 -0
  1152. package/sdk/src/query/command-resolution.test.ts +70 -0
  1153. package/sdk/src/query/command-seam-coverage.test.ts +118 -0
  1154. package/sdk/src/query/command-static-catalog-domain.ts +117 -0
  1155. package/sdk/src/query/command-static-catalog-foundation.ts +103 -0
  1156. package/sdk/src/query/command-topology.test.ts +28 -0
  1157. package/sdk/src/query/command-topology.ts +114 -0
  1158. package/sdk/src/query/commands-list.test.ts +36 -0
  1159. package/sdk/src/query/commands-list.ts +19 -0
  1160. package/sdk/src/query/commit.test.ts +485 -0
  1161. package/sdk/src/query/commit.ts +383 -0
  1162. package/sdk/src/query/config-gates.test.ts +89 -0
  1163. package/sdk/src/query/config-gates.ts +69 -0
  1164. package/sdk/src/query/config-mutation.test.ts +598 -0
  1165. package/sdk/src/query/config-mutation.ts +575 -0
  1166. package/sdk/src/query/config-query.test.ts +367 -0
  1167. package/sdk/src/query/config-query.ts +244 -0
  1168. package/sdk/src/query/config-schema.ts +159 -0
  1169. package/sdk/src/query/decisions.test.ts +215 -0
  1170. package/sdk/src/query/decisions.ts +192 -0
  1171. package/sdk/src/query/decomposed-handlers.test.ts +431 -0
  1172. package/sdk/src/query/detect-custom-files.test.ts +115 -0
  1173. package/sdk/src/query/detect-custom-files.ts +96 -0
  1174. package/sdk/src/query/detect-phase-type.test.ts +105 -0
  1175. package/sdk/src/query/detect-phase-type.ts +141 -0
  1176. package/sdk/src/query/docs-init.ts +258 -0
  1177. package/sdk/src/query/fallow-audit.ts +88 -0
  1178. package/sdk/src/query/frontmatter-array.test.ts +14 -0
  1179. package/sdk/src/query/frontmatter-mutation.test.ts +259 -0
  1180. package/sdk/src/query/frontmatter-mutation.ts +343 -0
  1181. package/sdk/src/query/frontmatter.test.ts +326 -0
  1182. package/sdk/src/query/frontmatter.ts +395 -0
  1183. package/sdk/src/query/helpers.test.ts +615 -0
  1184. package/sdk/src/query/helpers.ts +646 -0
  1185. package/sdk/src/query/index-thin-seam.test.ts +16 -0
  1186. package/sdk/src/query/index.ts +9 -0
  1187. package/sdk/src/query/init-complex.test.ts +616 -0
  1188. package/sdk/src/query/init-complex.ts +799 -0
  1189. package/sdk/src/query/init-progress-precedence.test.ts +177 -0
  1190. package/sdk/src/query/init-workstream-milestone-op.test.ts +321 -0
  1191. package/sdk/src/query/init.test.ts +792 -0
  1192. package/sdk/src/query/init.ts +1262 -0
  1193. package/sdk/src/query/intel.test.ts +90 -0
  1194. package/sdk/src/query/intel.ts +404 -0
  1195. package/sdk/src/query/mutation-event-decorator.test.ts +45 -0
  1196. package/sdk/src/query/mutation-event-decorator.ts +37 -0
  1197. package/sdk/src/query/mutation-event-mapper.test.ts +33 -0
  1198. package/sdk/src/query/mutation-event-mapper.ts +102 -0
  1199. package/sdk/src/query/mvp.test.ts +335 -0
  1200. package/sdk/src/query/mvp.ts +292 -0
  1201. package/sdk/src/query/normalize-query-command.test.ts +102 -0
  1202. package/sdk/src/query/phase-filesystem-adapter.ts +35 -0
  1203. package/sdk/src/query/phase-lifecycle-policy.ts +171 -0
  1204. package/sdk/src/query/phase-lifecycle.test.ts +1750 -0
  1205. package/sdk/src/query/phase-lifecycle.ts +1833 -0
  1206. package/sdk/src/query/phase-list-queries.test.ts +88 -0
  1207. package/sdk/src/query/phase-list-queries.ts +152 -0
  1208. package/sdk/src/query/phase-ready.test.ts +65 -0
  1209. package/sdk/src/query/phase-ready.ts +159 -0
  1210. package/sdk/src/query/phase-roadmap-mutation.ts +77 -0
  1211. package/sdk/src/query/phase.test.ts +651 -0
  1212. package/sdk/src/query/phase.ts +550 -0
  1213. package/sdk/src/query/pipeline.test.ts +169 -0
  1214. package/sdk/src/query/pipeline.ts +243 -0
  1215. package/sdk/src/query/plan-scan.test.ts +35 -0
  1216. package/sdk/src/query/plan-scan.ts +82 -0
  1217. package/sdk/src/query/plan-task-structure.test.ts +65 -0
  1218. package/sdk/src/query/plan-task-structure.ts +63 -0
  1219. package/sdk/src/query/policy-convergence.test.ts +28 -0
  1220. package/sdk/src/query/profile-extract-messages.ts +247 -0
  1221. package/sdk/src/query/profile-output.ts +929 -0
  1222. package/sdk/src/query/profile-questionnaire-data.ts +181 -0
  1223. package/sdk/src/query/profile-sample.ts +184 -0
  1224. package/sdk/src/query/profile-scan-sessions.ts +174 -0
  1225. package/sdk/src/query/profile.test.ts +136 -0
  1226. package/sdk/src/query/profile.ts +337 -0
  1227. package/sdk/src/query/progress.test.ts +156 -0
  1228. package/sdk/src/query/progress.ts +566 -0
  1229. package/sdk/src/query/query-cli-adapter.test.ts +79 -0
  1230. package/sdk/src/query/query-cli-adapter.ts +39 -0
  1231. package/sdk/src/query/query-cli-output.test.ts +33 -0
  1232. package/sdk/src/query/query-cli-output.ts +35 -0
  1233. package/sdk/src/query/query-command-diagnosis.test.ts +22 -0
  1234. package/sdk/src/query/query-command-diagnosis.ts +5 -0
  1235. package/sdk/src/query/query-command-resolution-strategy.test.ts +34 -0
  1236. package/sdk/src/query/query-command-resolution-strategy.ts +121 -0
  1237. package/sdk/src/query/query-command-semantics.test.ts +22 -0
  1238. package/sdk/src/query/query-command-semantics.ts +22 -0
  1239. package/sdk/src/query/query-dispatch-contract.ts +30 -0
  1240. package/sdk/src/query/query-dispatch-error-mapper.test.ts +62 -0
  1241. package/sdk/src/query/query-dispatch-error-mapper.ts +5 -0
  1242. package/sdk/src/query/query-dispatch-formatting.test.ts +28 -0
  1243. package/sdk/src/query/query-dispatch-formatting.ts +5 -0
  1244. package/sdk/src/query/query-dispatch-input-validation.test.ts +23 -0
  1245. package/sdk/src/query/query-dispatch-input-validation.ts +5 -0
  1246. package/sdk/src/query/query-dispatch-observability.test.ts +10 -0
  1247. package/sdk/src/query/query-dispatch-observability.ts +6 -0
  1248. package/sdk/src/query/query-dispatch-plan.test.ts +25 -0
  1249. package/sdk/src/query/query-dispatch-plan.ts +5 -0
  1250. package/sdk/src/query/query-dispatch-result-builder.test.ts +16 -0
  1251. package/sdk/src/query/query-dispatch-result-builder.ts +5 -0
  1252. package/sdk/src/query/query-dispatch.test.ts +399 -0
  1253. package/sdk/src/query/query-dispatch.ts +243 -0
  1254. package/sdk/src/query/query-error-details-schema.ts +29 -0
  1255. package/sdk/src/query/query-error-taxonomy.test.ts +39 -0
  1256. package/sdk/src/query/query-error-taxonomy.ts +117 -0
  1257. package/sdk/src/query/query-fallback-bridge-adapter.test.ts +32 -0
  1258. package/sdk/src/query/query-fallback-bridge-adapter.ts +54 -0
  1259. package/sdk/src/query/query-fallback-executor.test.ts +82 -0
  1260. package/sdk/src/query/query-fallback-executor.ts +44 -0
  1261. package/sdk/src/query/query-fallback-output-classifier.test.ts +36 -0
  1262. package/sdk/src/query/query-fallback-output-classifier.ts +31 -0
  1263. package/sdk/src/query/query-fallback-policy.test.ts +13 -0
  1264. package/sdk/src/query/query-fallback-policy.ts +11 -0
  1265. package/sdk/src/query/query-native-dispatch-adapter.ts +16 -0
  1266. package/sdk/src/query/query-policy-capability.test.ts +10 -0
  1267. package/sdk/src/query/query-policy-capability.ts +26 -0
  1268. package/sdk/src/query/query-policy-snapshot.test.ts +9 -0
  1269. package/sdk/src/query/query-registry-capability.test.ts +14 -0
  1270. package/sdk/src/query/query-runtime-context.ts +44 -0
  1271. package/sdk/src/query/query-unknown-command-hints.test.ts +9 -0
  1272. package/sdk/src/query/query-unknown-command-hints.ts +5 -0
  1273. package/sdk/src/query/registry-assembly-descriptor.ts +87 -0
  1274. package/sdk/src/query/registry-assembly-invariants.ts +127 -0
  1275. package/sdk/src/query/registry-assembly.test.ts +138 -0
  1276. package/sdk/src/query/registry-assembly.ts +78 -0
  1277. package/sdk/src/query/registry.test.ts +208 -0
  1278. package/sdk/src/query/registry.ts +142 -0
  1279. package/sdk/src/query/requirements-extract-from-plans.test.ts +58 -0
  1280. package/sdk/src/query/requirements-extract-from-plans.ts +86 -0
  1281. package/sdk/src/query/roadmap-update-plan-progress.test.ts +233 -0
  1282. package/sdk/src/query/roadmap-update-plan-progress.ts +159 -0
  1283. package/sdk/src/query/roadmap.test.ts +1181 -0
  1284. package/sdk/src/query/roadmap.ts +894 -0
  1285. package/sdk/src/query/route-next-action.test.ts +61 -0
  1286. package/sdk/src/query/route-next-action.ts +345 -0
  1287. package/sdk/src/query/schema-detect.ts +189 -0
  1288. package/sdk/src/query/secrets.test.ts +66 -0
  1289. package/sdk/src/query/secrets.ts +43 -0
  1290. package/sdk/src/query/skill-manifest.test.ts +62 -0
  1291. package/sdk/src/query/skill-manifest.ts +216 -0
  1292. package/sdk/src/query/skills.test.ts +234 -0
  1293. package/sdk/src/query/skills.ts +143 -0
  1294. package/sdk/src/query/state-document.test.ts +197 -0
  1295. package/sdk/src/query/state-document.ts +129 -0
  1296. package/sdk/src/query/state-mutation.test.ts +1198 -0
  1297. package/sdk/src/query/state-mutation.ts +1718 -0
  1298. package/sdk/src/query/state-project-load.ts +80 -0
  1299. package/sdk/src/query/state.test.ts +616 -0
  1300. package/sdk/src/query/state.ts +463 -0
  1301. package/sdk/src/query/sub-repos-root.integration.test.ts +79 -0
  1302. package/sdk/src/query/summary.test.ts +95 -0
  1303. package/sdk/src/query/summary.ts +296 -0
  1304. package/sdk/src/query/template.test.ts +180 -0
  1305. package/sdk/src/query/template.ts +242 -0
  1306. package/sdk/src/query/uat.test.ts +77 -0
  1307. package/sdk/src/query/uat.ts +365 -0
  1308. package/sdk/src/query/utils.test.ts +82 -0
  1309. package/sdk/src/query/utils.ts +106 -0
  1310. package/sdk/src/query/validate.test.ts +831 -0
  1311. package/sdk/src/query/validate.ts +952 -0
  1312. package/sdk/src/query/verify.test.ts +414 -0
  1313. package/sdk/src/query/verify.ts +692 -0
  1314. package/sdk/src/query/websearch.test.ts +31 -0
  1315. package/sdk/src/query/websearch.ts +82 -0
  1316. package/sdk/src/query/workspace.test.ts +120 -0
  1317. package/sdk/src/query/workspace.ts +145 -0
  1318. package/sdk/src/query/workstream-inventory.ts +195 -0
  1319. package/sdk/src/query/workstream.test.ts +153 -0
  1320. package/sdk/src/query/workstream.ts +324 -0
  1321. package/sdk/src/query/worktree.ts +39 -0
  1322. package/sdk/src/query-command-executor.ts +31 -0
  1323. package/sdk/src/query-execution-policy.test.ts +52 -0
  1324. package/sdk/src/query-execution-policy.ts +46 -0
  1325. package/sdk/src/query-failure-classification.test.ts +23 -0
  1326. package/sdk/src/query-failure-classification.ts +42 -0
  1327. package/sdk/src/query-hotpath-methods.ts +48 -0
  1328. package/sdk/src/query-native-direct-adapter.test.ts +35 -0
  1329. package/sdk/src/query-native-direct-adapter.ts +70 -0
  1330. package/sdk/src/query-native-hotpath-adapter.test.ts +43 -0
  1331. package/sdk/src/query-native-hotpath-adapter.ts +45 -0
  1332. package/sdk/src/query-raw-output-projection.test.ts +39 -0
  1333. package/sdk/src/query-raw-output-projection.ts +74 -0
  1334. package/sdk/src/query-runtime-bridge.test.ts +150 -0
  1335. package/sdk/src/query-runtime-bridge.ts +215 -0
  1336. package/sdk/src/query-runtime-seam-coverage.test.ts +20 -0
  1337. package/sdk/src/query-sdd-tools-path.ts +1 -0
  1338. package/sdk/src/query-sdd-tools-runtime.ts +89 -0
  1339. package/sdk/src/query-subprocess-adapter.test.ts +84 -0
  1340. package/sdk/src/query-subprocess-adapter.ts +146 -0
  1341. package/sdk/src/query-tools-error-factory.test.ts +35 -0
  1342. package/sdk/src/query-tools-error-factory.ts +76 -0
  1343. package/sdk/src/research-gate.test.ts +190 -0
  1344. package/sdk/src/research-gate.ts +94 -0
  1345. package/sdk/src/runtime-bridge-options.test.ts +33 -0
  1346. package/sdk/src/runtime-gate.test.ts +84 -0
  1347. package/sdk/src/runtime-gate.ts +52 -0
  1348. package/sdk/src/sdd-tools-error.test.ts +21 -0
  1349. package/sdk/src/sdd-tools-error.ts +65 -0
  1350. package/sdk/src/sdd-tools.test.ts +472 -0
  1351. package/sdk/src/sdd-tools.ts +237 -0
  1352. package/sdk/src/sdd-transport-policy.test.ts +34 -0
  1353. package/sdk/src/sdd-transport-policy.ts +48 -0
  1354. package/sdk/src/sdd-transport.test.ts +292 -0
  1355. package/sdk/src/sdd-transport.ts +117 -0
  1356. package/sdk/src/sdk-package-compatibility.test.ts +97 -0
  1357. package/sdk/src/sdk-package-compatibility.ts +141 -0
  1358. package/sdk/src/session-runner.test.ts +164 -0
  1359. package/sdk/src/session-runner.ts +327 -0
  1360. package/sdk/src/tool-scoping.test.ts +160 -0
  1361. package/sdk/src/tool-scoping.ts +61 -0
  1362. package/sdk/src/types.ts +927 -0
  1363. package/sdk/src/workflow-agent-skills-consistency.test.ts +98 -0
  1364. package/sdk/src/workstream-name-policy.ts +24 -0
  1365. package/sdk/src/workstream-utils.ts +21 -0
  1366. package/sdk/src/ws-flag.test.ts +285 -0
  1367. package/sdk/src/ws-transport.test.ts +161 -0
  1368. package/sdk/src/ws-transport.ts +93 -0
  1369. package/sdk/tsconfig.json +20 -0
  1370. package/commands/sdd/add-backlog.md +0 -76
  1371. package/commands/sdd/add-phase.md +0 -43
  1372. package/commands/sdd/add-todo.md +0 -47
  1373. package/commands/sdd/check-todos.md +0 -45
  1374. package/commands/sdd/do.md +0 -30
  1375. package/commands/sdd/insert-phase.md +0 -32
  1376. package/commands/sdd/join-discord.md +0 -18
  1377. package/commands/sdd/list-phase-assumptions.md +0 -46
  1378. package/commands/sdd/list-workspaces.md +0 -19
  1379. package/commands/sdd/new-workspace.md +0 -44
  1380. package/commands/sdd/next.md +0 -24
  1381. package/commands/sdd/note.md +0 -34
  1382. package/commands/sdd/plan-milestone-gaps.md +0 -34
  1383. package/commands/sdd/plant-seed.md +0 -28
  1384. package/commands/sdd/reapply-patches.md +0 -123
  1385. package/commands/sdd/remove-phase.md +0 -31
  1386. package/commands/sdd/remove-workspace.md +0 -26
  1387. package/commands/sdd/research-phase.md +0 -195
  1388. package/commands/sdd/session-report.md +0 -19
  1389. package/commands/sdd/set-profile.md +0 -12
  1390. package/scripts/sync-upstream.sh +0 -56
  1391. package/sdd/commands/sdd/workstreams.md +0 -63
  1392. package/sdd/workflows/research-phase.md +0 -82
@@ -4,56 +4,63 @@ 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
+
13
+ <progressive_disclosure>
14
+ **Per-mode bodies, templates, and the advisor flow are lazy-loaded** to keep
15
+ this file under the 500-line workflow budget (#2551, mirrors #2361's agent
16
+ budget). Read only the files needed for the current invocation:
17
+
18
+ | When | Read |
19
+ |---|---|
20
+ | `--power` in $ARGUMENTS | `workflows/discuss-phase/modes/power.md` (then exit standard flow) |
21
+ | `--all` in $ARGUMENTS | `workflows/discuss-phase/modes/all.md` overlay |
22
+ | `--auto` in $ARGUMENTS | `workflows/discuss-phase/modes/auto.md` + `workflows/discuss-phase/modes/chain.md` (auto-advance) |
23
+ | `--chain` in $ARGUMENTS | `workflows/discuss-phase/modes/default.md` + `workflows/discuss-phase/modes/chain.md` |
24
+ | `--text` in $ARGUMENTS or `workflow.text_mode: true` | `workflows/discuss-phase/modes/text.md` overlay |
25
+ | `--batch` in $ARGUMENTS | `workflows/discuss-phase/modes/batch.md` overlay |
26
+ | `--analyze` in $ARGUMENTS | `workflows/discuss-phase/modes/analyze.md` overlay |
27
+ | ADVISOR_MODE = true (USER-PROFILE.md exists) | `workflows/discuss-phase/modes/advisor.md` |
28
+ | no flags above | `workflows/discuss-phase/modes/default.md` |
29
+ | in `write_context` step | `workflows/discuss-phase/templates/context.md` |
30
+ | in `git_commit` step | `workflows/discuss-phase/templates/discussion-log.md` |
31
+ | writing checkpoints | `workflows/discuss-phase/templates/checkpoint.json` |
32
+
33
+ Do not Read mode files unless the corresponding flag/condition is set.
34
+ </progressive_disclosure>
35
+
7
36
  <downstream_awareness>
8
37
  **CONTEXT.md feeds into:**
9
38
 
10
39
  1. **sdd-phase-researcher** — Reads CONTEXT.md to know WHAT to research
11
- - "User wants card-based layout" → researcher investigates card component patterns
12
- - "Infinite scroll decided" → researcher looks into virtualization libraries
13
-
14
40
  2. **sdd-planner** — Reads CONTEXT.md to know WHAT decisions are locked
15
- - "Pull-to-refresh on mobile" → planner includes that in task specs
16
- - "Claude's Discretion: loading skeleton" → planner can decide approach
17
41
 
18
42
  **Your job:** Capture decisions clearly enough that downstream agents can act on them without asking the user again.
19
-
20
43
  **Not your job:** Figure out HOW to implement. That's what research and planning do with the decisions you capture.
21
44
  </downstream_awareness>
22
45
 
23
46
  <philosophy>
24
47
  **User = founder/visionary. Claude = builder.**
25
48
 
26
- The user knows:
27
- - How they imagine it working
28
- - What it should look/feel like
29
- - What's essential vs nice-to-have
30
- - Specific behaviors or references they have in mind
49
+ The user knows: how they imagine it working, what it should look/feel like, what's essential vs nice-to-have, specific behaviors or references they have in mind.
31
50
 
32
- The user doesn't know (and shouldn't be asked):
33
- - Codebase patterns (researcher reads the code)
34
- - Technical risks (researcher identifies these)
35
- - Implementation approach (planner figures this out)
36
- - Success metrics (inferred from the work)
51
+ The user doesn't know (and shouldn't be asked): codebase patterns (researcher reads the code), technical risks (researcher identifies these), implementation approach (planner figures this out), success metrics (inferred from the work).
37
52
 
38
53
  Ask about vision and implementation choices. Capture decisions for downstream agents.
39
54
  </philosophy>
40
55
 
41
56
  <scope_guardrail>
42
- **CRITICAL: No scope creep.**
43
-
44
- The phase boundary comes from ROADMAP.md and is FIXED. Discussion clarifies HOW to implement what's scoped, never WHETHER to add new capabilities.
57
+ **CRITICAL: No scope creep.** The phase boundary comes from ROADMAP.md and is FIXED. Discussion clarifies HOW to implement what's scoped, never WHETHER to add new capabilities.
45
58
 
46
- **Allowed (clarifying ambiguity):**
47
- - "How should posts be displayed?" (layout, density, info shown)
48
- - "What happens on empty state?" (within the feature)
49
- - "Pull to refresh or manual?" (behavior choice)
59
+ **Allowed (clarifying ambiguity):** "How should posts be displayed?" (layout), "What happens on empty state?" (within the feature), "Pull to refresh or manual?" (behavior choice).
50
60
 
51
- **Not allowed (scope creep):**
52
- - "Should we also add comments?" (new capability)
53
- - "What about search/filtering?" (new capability)
54
- - "Maybe include bookmarking?" (new capability)
61
+ **Not allowed (scope creep):** "Should we also add comments?" / "What about search/filtering?" / "Maybe include bookmarking?" — those are new capabilities and belong in their own phase.
55
62
 
56
- **The heuristic:** Does this clarify how we implement what's already in the phase, or does it add a new capability that could be its own phase?
63
+ **Heuristic:** Does this clarify how we implement what's already in the phase, or does it add a new capability that could be its own phase?
57
64
 
58
65
  **When user suggests scope creep:**
59
66
  ```
@@ -69,59 +76,29 @@ Capture the idea in a "Deferred Ideas" section. Don't lose it, don't act on it.
69
76
  <gray_area_identification>
70
77
  Gray areas are **implementation decisions the user cares about** — things that could go multiple ways and would change the result.
71
78
 
72
- **How to identify gray areas:**
79
+ 1. Read the phase goal from ROADMAP.md
80
+ 2. Understand the domain — something users SEE / CALL / RUN / READ / something being ORGANIZED — and let that drive what kinds of decisions matter
81
+ 3. Generate phase-specific gray areas (not generic categories)
73
82
 
74
- 1. **Read the phase goal** from ROADMAP.md
75
- 2. **Understand the domain** — What kind of thing is being built?
76
- - Something users SEE → visual presentation, interactions, states matter
77
- - Something users CALL → interface contracts, responses, errors matter
78
- - Something users RUN → invocation, output, behavior modes matter
79
- - Something users READ → structure, tone, depth, flow matter
80
- - Something being ORGANIZED → criteria, grouping, handling exceptions matter
81
- 3. **Generate phase-specific gray areas** — Not generic categories, but concrete decisions for THIS phase
82
-
83
- **Don't use generic category labels** (UI, UX, Behavior). Generate specific gray areas:
83
+ **Don't use generic category labels** (UI, UX, Behavior). Generate specific gray areas. Examples:
84
84
 
85
85
  ```
86
- Phase: "User authentication"
87
- Session handling, Error responses, Multi-device policy, Recovery flow
88
-
89
- Phase: "Organize photo library"
90
- → Grouping criteria, Duplicate handling, Naming convention, Folder structure
91
-
92
- Phase: "CLI for database backups"
93
- → Output format, Flag design, Progress reporting, Error recovery
94
-
95
- Phase: "API documentation"
96
- → Structure/navigation, Code examples depth, Versioning approach, Interactive elements
86
+ Phase: "User authentication" → Session handling, Error responses, Multi-device policy, Recovery flow
87
+ Phase: "Organize photo library" Grouping criteria, Duplicate handling, Naming convention, Folder structure
88
+ Phase: "CLI for database backups"→ Output format, Flag design, Progress reporting, Error recovery
89
+ Phase: "API documentation" → Structure/navigation, Code examples depth, Versioning approach, Interactive elements
97
90
  ```
98
91
 
99
- **The key question:** What decisions would change the outcome that the user should weigh in on?
100
-
101
- **Claude handles these (don't ask):**
102
- - Technical implementation details
103
- - Architecture patterns
104
- - Performance optimization
105
- - Scope (roadmap defines this)
92
+ **Claude handles these (don't ask):** technical implementation details, architecture patterns, performance optimization, scope (roadmap defines this).
106
93
  </gray_area_identification>
107
94
 
108
95
  <answer_validation>
109
- **IMPORTANT: Answer validation** — After every AskUserQuestion call, check if the response is empty or whitespace-only. If so:
110
- 1. Retry the question once with the same parameters
111
- 2. If still empty, present the options as a plain-text numbered list and ask the user to type their choice number
112
- Never proceed with an empty answer.
113
-
114
- **Text mode (`workflow.text_mode: true` in config or `--text` flag):**
115
- When text mode is active, **do not use AskUserQuestion at all**. Instead, present every
116
- question as a plain-text numbered list and ask the user to type their choice number.
117
- This is required for Claude Code remote sessions (`/rc` mode) where the Claude App
118
- cannot forward TUI menu selections back to the host.
119
-
120
- Enable text mode:
121
- - Per-session: pass `--text` flag to any command (e.g., `/sdd:discuss-phase --text`)
122
- - Per-project: `sdd-tools config-set workflow.text_mode true`
123
-
124
- Text mode applies to ALL workflows in the session, not just discuss-phase.
96
+ **IMPORTANT: Answer validation** — After every AskUserQuestion call, if the response is empty/whitespace-only:
97
+
98
+ - **"Other" with empty text** (the user wants to type freeform): output `"What would you like to discuss?"`, STOP generating, wait for the user's next message, then reflect it back and continue. Do NOT retry AskUserQuestion or call any tools.
99
+ - **Any other empty response:** retry once with the same parameters; if still empty, present options as a plain-text numbered list. Never proceed with empty input.
100
+
101
+ **Text mode** (`--text` or `workflow.text_mode: true`): follow `workflows/discuss-phase/modes/text.md` — do not use AskUserQuestion at all.
125
102
  </answer_validation>
126
103
 
127
104
  <process>
@@ -132,721 +109,293 @@ Text mode applies to ALL workflows in the session, not just discuss-phase.
132
109
  Phase number from argument (required).
133
110
 
134
111
  ```bash
135
- INIT=$(node "$HOME/.claude/sdd/bin/sdd-tools.cjs" init phase-op "${PHASE}")
112
+ INIT=$(sdd-sdk query init.phase-op "${PHASE}")
136
113
  if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi
137
- AGENT_SKILLS_ADVISOR=$(node "$HOME/.claude/sdd/bin/sdd-tools.cjs" agent-skills sdd-advisor 2>/dev/null)
114
+ AGENT_SKILLS_ADVISOR=$(sdd-sdk query agent-skills sdd-advisor-researcher)
138
115
  ```
139
116
 
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`.
117
+ 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`.
118
+
119
+ **If `response_language` is set:** All user-facing questions, prompts, and explanations in this workflow MUST be presented in `{response_language}`. Technical terms, code, file paths, and subagent prompts stay in English — only user-facing output is translated.
141
120
 
142
121
  **If `phase_found` is false:**
143
122
  ```
144
123
  Phase [X] not found in roadmap.
145
-
146
124
  Use /sdd:progress ${SDD_WS} to see available phases.
147
125
  ```
148
126
  Exit workflow.
149
127
 
150
- **If `phase_found` is true:** Continue to check_existing.
128
+ **Mode dispatch Read mode files lazily based on flags in $ARGUMENTS:**
151
129
 
152
- **Auto mode** — If `--auto` is present in ARGUMENTS:
153
- - In `check_existing`: auto-select "Skip" (if context exists) or continue without prompting (if no context/plans)
154
- - In `present_gray_areas`: auto-select ALL gray areas without asking the user
155
- - In `discuss_areas`: for each discussion question, choose the recommended option (first option, or the one marked "recommended") without using AskUserQuestion
156
- - Log each auto-selected choice inline so the user can review decisions in the context file
157
- - After discussion completes, auto-advance to plan-phase (existing behavior)
130
+ ```bash
131
+ # Detect advisor mode (file-existence guard no Read until needed)
132
+ if [ -f "$HOME/.claude/sdd/USER-PROFILE.md" ]; then
133
+ ADVISOR_MODE=true
134
+ else
135
+ ADVISOR_MODE=false
136
+ fi
137
+ ```
138
+
139
+ - If `--power` in $ARGUMENTS: `Read(workflows/discuss-phase/modes/power.md)` and execute it end-to-end. Do NOT continue with the steps below.
140
+ - Otherwise, continue. Per-flag overlay reads happen at their relevant steps:
141
+ - `--all` → Read `workflows/discuss-phase/modes/all.md` before `present_gray_areas`.
142
+ - `--auto` → Read `workflows/discuss-phase/modes/auto.md` before `check_existing` (it overrides several steps).
143
+ - `--chain` → Read `workflows/discuss-phase/modes/chain.md` before `auto_advance`.
144
+ - `--text` (or `workflow.text_mode: true`) → Read `workflows/discuss-phase/modes/text.md` before any AskUserQuestion call.
145
+ - `--batch` → Read `workflows/discuss-phase/modes/batch.md` before `discuss_areas`.
146
+ - `--analyze` → Read `workflows/discuss-phase/modes/analyze.md` before `discuss_areas`.
147
+ - `ADVISOR_MODE = true` → Read `workflows/discuss-phase/modes/advisor.md` before `analyze_phase` (it changes the discussion flow and adds an `advisor_research` substep).
148
+ - No flags → Read `workflows/discuss-phase/modes/default.md` before `discuss_areas`.
149
+
150
+ **If `phase_found` is true:** Continue to `check_blocking_antipatterns`.
158
151
  </step>
159
152
 
160
- <step name="check_existing">
161
- Check if CONTEXT.md already exists using `has_context` from init.
153
+ <step name="check_blocking_antipatterns" priority="first">
154
+ **MANDATORY — Check for blocking anti-patterns before any other work.**
155
+
156
+ Look for a `.continue-here.md` in the current phase directory:
162
157
 
163
158
  ```bash
164
- ls ${phase_dir}/*-CONTEXT.md 2>/dev/null || true
159
+ ls ${phase_dir}/.continue-here.md 2>/dev/null || true
165
160
  ```
166
161
 
167
- **If exists:**
168
-
169
- **If `--auto`:** Auto-select "Update it" — load existing context and continue to analyze_phase. Log: `[auto] Context exists — updating with auto-selected decisions.`
170
-
171
- **Otherwise:** Use AskUserQuestion:
172
- - header: "Context"
173
- - question: "Phase [X] already has context. What do you want to do?"
174
- - options:
175
- - "Update it" — Review and revise existing context
176
- - "View it" — Show me what's there
177
- - "Skip" — Use existing context as-is
162
+ If `.continue-here.md` exists, parse its "Critical Anti-Patterns" table for rows with `severity` = `blocking`.
178
163
 
179
- If "Update": Load existing, continue to analyze_phase
180
- If "View": Display CONTEXT.md, then offer update/skip
181
- If "Skip": Exit workflow
164
+ **If one or more `blocking` anti-patterns are found:** the agent must demonstrate understanding of each by answering all three questions for each one:
165
+ 1. **What is this anti-pattern?** Describe it in your own words.
166
+ 2. **How did it manifest?** — Explain the specific failure that caused it to be recorded.
167
+ 3. **What structural mechanism (not acknowledgment) prevents it?** — Name the concrete step or enforcement mechanism that stops recurrence.
182
168
 
183
- **If doesn't exist:**
169
+ 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.
184
170
 
185
- Check `has_plans` and `plan_count` from init. **If `has_plans` is true:**
186
-
187
- **If `--auto`:** Auto-select "Continue and replan after". Log: `[auto] Plans exist — continuing with context capture, will replan after.`
188
-
189
- **Otherwise:** Use AskUserQuestion:
190
- - header: "Plans exist"
191
- - 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
- - options:
193
- - "Continue and replan after" — Capture context, then run /sdd:plan-phase {X} ${SDD_WS} to replan
194
- - "View existing plans" — Show plans before deciding
195
- - "Cancel" — Skip discuss-phase
196
-
197
- If "Continue and replan after": Continue to analyze_phase.
198
- If "View existing plans": Display plan files, then offer "Continue" / "Cancel".
199
- If "Cancel": Exit workflow.
200
-
201
- **If `has_plans` is false:** Continue to load_prior_context.
171
+ **If no `.continue-here.md` exists, or no `blocking` rows are found:** Proceed directly to `check_spec`.
202
172
  </step>
203
173
 
204
- <step name="load_prior_context">
205
- Read project-level and prior phase context to avoid re-asking decided questions and maintain consistency.
206
-
207
- **Step 1: Read project-level files**
208
- ```bash
209
- # Core project files
210
- cat .planning/PROJECT.md 2>/dev/null || true
211
- cat .planning/REQUIREMENTS.md 2>/dev/null || true
212
- cat .planning/STATE.md 2>/dev/null || true
213
- ```
214
-
215
- Extract from these:
216
- - **PROJECT.md** — Vision, principles, non-negotiables, user preferences
217
- - **REQUIREMENTS.md** — Acceptance criteria, constraints, must-haves vs nice-to-haves
218
- - **STATE.md** — Current progress, any flags or session notes
174
+ <step name="check_spec">
175
+ Check if a SPEC.md (from `/sdd:spec-phase`) exists for this phase. SPEC.md locks requirements before implementation decisions.
219
176
 
220
- **Step 2: Read all prior CONTEXT.md files**
221
177
  ```bash
222
- # Find all CONTEXT.md files from phases before current
223
- (find .planning/phases -name "*-CONTEXT.md" 2>/dev/null || true) | sort
178
+ ls ${phase_dir}/*-SPEC.md 2>/dev/null | grep -v AI-SPEC | head -1 || true
224
179
  ```
225
180
 
226
- For each CONTEXT.md where phase number < current phase:
227
- - Read the `<decisions>` section — these are locked preferences
228
- - Read `<specifics>` particular references or "I want it like X" moments
229
- - Note any patterns (e.g., "user consistently prefers minimal UI", "user rejected single-key shortcuts")
181
+ **If SPEC.md is found:**
182
+ 1. Read the SPEC.md file.
183
+ 2. Count requirements (numbered items in `## Requirements`).
184
+ 3. Display: `Found SPEC.md {N} requirements locked. Focusing on implementation decisions.`
185
+ 4. Set `spec_loaded = true`.
186
+ 5. Store requirements, boundaries, and acceptance criteria as `<locked_requirements>` — these flow directly into CONTEXT.md without re-asking.
230
187
 
231
- **Step 3: Build internal `<prior_decisions>` context**
188
+ **If no SPEC.md is found:** Continue with `spec_loaded = false`.
232
189
 
233
- Structure the extracted information:
234
- ```
235
- <prior_decisions>
236
- ## Project-Level
237
- - [Key principle or constraint from PROJECT.md]
238
- - [Requirement that affects this phase from REQUIREMENTS.md]
239
-
240
- ## From Prior Phases
241
- ### Phase N: [Name]
242
- - [Decision that may be relevant to current phase]
243
- - [Preference that establishes a pattern]
244
-
245
- ### Phase M: [Name]
246
- - [Another relevant decision]
247
- </prior_decisions>
248
- ```
249
-
250
- **Usage in subsequent steps:**
251
- - `analyze_phase`: Skip gray areas already decided in prior phases
252
- - `present_gray_areas`: Annotate options with prior decisions ("You chose X in Phase 5")
253
- - `discuss_areas`: Pre-fill answers or flag conflicts ("This contradicts Phase 3 — same here or different?")
254
-
255
- **If no prior context exists:** Continue without — this is expected for early phases.
190
+ **Note:** SPEC.md files named `AI-SPEC.md` (from `/sdd:ai-integration-phase`) are excluded — different purpose.
256
191
  </step>
257
192
 
258
- <step name="cross_reference_todos">
259
- Check if any pending todos are relevant to this phase's scope. Surfaces backlog items that might otherwise be missed.
193
+ <step name="check_existing">
194
+ Check if CONTEXT.md already exists using `has_context` from init.
260
195
 
261
- **Load and match todos:**
262
196
  ```bash
263
- TODO_MATCHES=$(node "$HOME/.claude/sdd/bin/sdd-tools.cjs" todo match-phase "${PHASE_NUMBER}")
197
+ ls ${phase_dir}/*-CONTEXT.md 2>/dev/null || true
264
198
  ```
265
199
 
266
- Parse JSON for: `todo_count`, `matches[]` (each with `file`, `title`, `area`, `score`, `reasons`).
200
+ **If exists:**
267
201
 
268
- **If `todo_count` is 0 or `matches` is empty:** Skip silentlyno workflow slowdown.
202
+ **If `--auto`:** Auto-select "Update it" — load existing context and continue to `analyze_phase`. Log: `[auto] Context existsupdating with auto-selected decisions.`
269
203
 
270
- **If matches found:**
204
+ **Otherwise:** AskUserQuestion (header: "Context"; question: "Phase [X] already has context. What do you want to do?"; options: "Update it" / "View it" / "Skip"). Branch accordingly.
271
205
 
272
- Present matched todos to the user. Show each match with its title, area, and why it matched:
206
+ **If doesn't exist:**
273
207
 
208
+ Check for an interrupted discussion checkpoint:
209
+ ```bash
210
+ ls ${phase_dir}/*-DISCUSS-CHECKPOINT.json 2>/dev/null || true
274
211
  ```
275
- 📋 Found {N} pending todo(s) that may be relevant to Phase {X}:
276
212
 
277
- {For each match:}
278
- - **{title}** (area: {area}, relevance: {score}) — matched on {reasons}
279
- ```
213
+ If a checkpoint file exists:
280
214
 
281
- Use AskUserQuestion (multiSelect) asking which todos to fold into this phase's scope:
215
+ **If `--auto`:** Auto-select "Resume" load checkpoint and continue from last completed area.
282
216
 
283
- ```
284
- Which of these todos should be folded into Phase {X} scope?
285
- (Select any that apply, or none to skip)
286
- ```
217
+ **Otherwise:** AskUserQuestion (header: "Resume"; question: "Found interrupted discussion checkpoint ({N} areas completed out of {M}). Resume from where you left off?"; options: "Resume" / "Start fresh"). On "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. On "Start fresh", delete the checkpoint and continue.
287
218
 
288
- **For selected (folded) todos:**
289
- - Store internally as `<folded_todos>` for inclusion in CONTEXT.md `<decisions>` section
290
- - These become additional scope items that downstream agents (researcher, planner) will see
219
+ Check `has_plans` and `plan_count` from init. **If `has_plans` is true:**
291
220
 
292
- **For unselected (reviewed but not folded) todos:**
293
- - Store internally as `<reviewed_todos>` for inclusion in CONTEXT.md `<deferred>` section
294
- - This prevents future phases from re-surfacing the same todos as "missed"
221
+ **If `--auto`:** Auto-select "Continue and replan after". Log: `[auto] Plans exist — continuing with context capture, will replan after.`
295
222
 
296
- **Auto mode (`--auto`):** Fold all todos with score >= 0.4 automatically. Log the selection.
223
+ **Otherwise:** AskUserQuestion (header: "Plans exist"; question: "Phase [X] already has {plan_count} plan(s) created without user context. Your decisions here won't affect existing plans unless you replan."; options: "Continue and replan after" / "View existing plans" / "Cancel"). Branch accordingly.
224
+
225
+ **If `has_plans` is false:** Continue to `load_prior_context`.
297
226
  </step>
298
227
 
299
- <step name="scout_codebase">
300
- Lightweight scan of existing code to inform gray area identification and discussion. Uses ~10% context acceptable for an interactive session.
228
+ <step name="load_prior_context">
229
+ Read project-level and prior phase context to avoid re-asking decided questions.
301
230
 
302
- **Step 1: Check for existing codebase maps**
303
231
  ```bash
304
- ls .planning/codebase/*.md 2>/dev/null || true
232
+ cat .planning/PROJECT.md 2>/dev/null || true
233
+ cat .planning/REQUIREMENTS.md 2>/dev/null || true
234
+ cat .planning/STATE.md 2>/dev/null || true
305
235
  ```
306
236
 
307
- **If codebase maps exist:** Read the most relevant ones (CONVENTIONS.md, STRUCTURE.md, STACK.md based on phase type). Extract:
308
- - Reusable components/hooks/utilities
309
- - Established patterns (state management, styling, data fetching)
310
- - Integration points (where new code would connect)
237
+ Read at most **3** prior CONTEXT.md files (most recent 3 phases before current). If `.planning/DECISIONS-INDEX.md` exists, read that instead — it is a bounded rolling summary that supersedes per-phase reads.
311
238
 
312
- Skip to Step 3 below.
313
-
314
- **Step 2: If no codebase maps, do targeted grep**
239
+ ```bash
240
+ (find .planning/phases -name "*-CONTEXT.md" 2>/dev/null || true) | sort -r
241
+ ```
315
242
 
316
- Extract key terms from the phase goal (e.g., "feed" "post", "card", "list"; "auth" "login", "session", "token").
243
+ For each CONTEXT.md read: extract `<decisions>` (locked preferences), `<specifics>` (particular references), and patterns (e.g., "user prefers minimal UI", "user rejected single-key shortcuts").
317
244
 
245
+ **Spike/sketch findings:** Check for project-local skills:
318
246
  ```bash
319
- # Find files related to phase goal terms
320
- grep -rl "{term1}\|{term2}" src/ app/ --include="*.ts" --include="*.tsx" --include="*.js" --include="*.jsx" 2>/dev/null | head -10 || true
321
-
322
- # Find existing components/hooks
323
- ls src/components/ 2>/dev/null || true
324
- ls src/hooks/ 2>/dev/null || true
325
- ls src/lib/ src/utils/ 2>/dev/null || true
247
+ SPIKE_FINDINGS=$(ls ./.claude/skills/spike-findings-*/SKILL.md 2>/dev/null | head -1 || true)
248
+ SKETCH_FINDINGS=$(ls ./.claude/skills/sketch-findings-*/SKILL.md 2>/dev/null | head -1 || true)
249
+ RAW_SPIKES=$(ls .planning/spikes/MANIFEST.md 2>/dev/null)
250
+ RAW_SKETCHES=$(ls .planning/sketches/MANIFEST.md 2>/dev/null)
326
251
  ```
327
252
 
328
- Read the 3-5 most relevant files to understand existing patterns.
253
+ If findings skills exist, read SKILL.md and reference files; extract validated patterns, landmines, constraints, design decisions. Add them to `<prior_decisions>`.
329
254
 
330
- **Step 3: Build internal codebase_context**
255
+ If raw spikes/sketches exist but no findings skill, note: `⚠ Unpackaged spikes/sketches detected — run /sdd:spike --wrap-up or /sdd:sketch --wrap-up to make findings available.`
331
256
 
332
- From the scan, identify:
333
- - **Reusable assets** — existing components, hooks, utilities that could be used in this phase
334
- - **Established patterns** — how the codebase does state management, styling, data fetching
335
- - **Integration points** — where new code would connect (routes, nav, providers)
336
- - **Creative options** — approaches the existing architecture enables or constrains
257
+ Build internal `<prior_decisions>` with sections for Project-Level (from PROJECT.md / REQUIREMENTS.md), From Prior Phases (per-phase decisions), and From Spike/Sketch Findings (validated patterns, landmines, design decisions).
337
258
 
338
- Store as internal `<codebase_context>` for use in analyze_phase and present_gray_areas. This is NOT written to a file it's used within this session only.
339
- </step>
259
+ **Usage downstream:** `analyze_phase` skips already-decided gray areas; `present_gray_areas` annotates options ("You chose X in Phase 5"); `discuss_areas` pre-fills or flags conflicts.
340
260
 
341
- <step name="analyze_phase">
342
- Analyze the phase to identify gray areas worth discussing. **Use both `prior_decisions` and `codebase_context` to ground the analysis.**
261
+ **If no prior context exists:** Continue without — expected for early phases.
262
+ </step>
343
263
 
344
- **Read the phase description from ROADMAP.md and determine:**
264
+ <step name="cross_reference_todos">
265
+ Check pending todos for matches with this phase's scope.
345
266
 
346
- 1. **Domain boundary** — What capability is this phase delivering? State it clearly.
267
+ ```bash
268
+ TODO_MATCHES=$(sdd-sdk query todo.match-phase "${PHASE_NUMBER}")
269
+ ```
347
270
 
348
- 1b. **Initialize canonical refs accumulator** — Start building the `<canonical_refs>` list for CONTEXT.md. This accumulates throughout the entire discussion, not just this step.
271
+ Parse JSON for: `todo_count`, `matches[]` (each with `file`, `title`, `area`, `score`, `reasons`).
349
272
 
350
- **Source 1 (now):** Copy `Canonical refs:` from ROADMAP.md for this phase. Expand each to a full relative path.
351
- **Source 2 (now):** Check REQUIREMENTS.md and PROJECT.md for any specs/ADRs referenced for this phase.
352
- **Source 3 (scout_codebase):** If existing code references docs (e.g., comments citing ADRs), add those.
353
- **Source 4 (discuss_areas):** When the user says "read X", "check Y", or references any doc/spec/ADR during discussion — add it immediately. These are often the MOST important refs because they represent docs the user specifically wants followed.
273
+ **If `todo_count` is 0 or `matches` is empty:** Skip silently.
354
274
 
355
- This list is MANDATORY in CONTEXT.md. Every ref must have a full relative path so downstream agents can read it directly. If no external docs exist, note that explicitly.
275
+ **If matches found:** Present each match (title, area, why it matched). AskUserQuestion (multiSelect) asking which to fold. Folded `<folded_todos>` for CONTEXT.md `<decisions>`. Reviewed but not folded `<reviewed_todos>` for CONTEXT.md `<deferred>`.
356
276
 
357
- 2. **Check prior decisions** Before generating gray areas, check if any were already decided:
358
- - Scan `<prior_decisions>` for relevant choices (e.g., "Ctrl+C only, no single-key shortcuts")
359
- - These are **pre-answered** — don't re-ask unless this phase has conflicting needs
360
- - Note applicable prior decisions for use in presentation
277
+ **Auto mode (`--auto`):** Fold all todos with score >= 0.4 automatically. Log the selection.
278
+ </step>
361
279
 
362
- 3. **Gray areas by category** — For each relevant category (UI, UX, Behavior, Empty States, Content), identify 1-2 specific ambiguities that would change implementation. **Annotate with code context where relevant** (e.g., "You already have a Card component" or "No existing pattern for this").
280
+ <step name="scout_codebase">
281
+ Lightweight scan of existing code to inform gray area identification (~10% context).
363
282
 
364
- 4. **Skip assessment** If no meaningful gray areas exist (pure infrastructure, clear-cut implementation, or all already decided in prior phases), the phase may not need discussion.
283
+ Read `@~/.claude/sdd/references/scout-codebase.md`it contains the phase-type→map selection table, single-read rule, no-maps fallback, and `<codebase_context>` output schema. Then execute:
284
+ 1. `ls .planning/codebase/*.md` to find existing maps
285
+ 2. Select 2–3 maps via the reference's table; or grep fallback if none exist
286
+ 3. Build internal `<codebase_context>` per the reference's output schema
287
+ </step>
365
288
 
366
- **Advisor Mode Detection:**
289
+ <step name="analyze_phase">
290
+ Analyze the phase to identify gray areas. Use both `prior_decisions` and `codebase_context` to ground the analysis.
367
291
 
368
- Check if advisor mode should activate:
292
+ 1. **Domain boundary** What capability is this phase delivering? State it clearly.
369
293
 
370
- 1. Check for USER-PROFILE.md:
371
- ```bash
372
- PROFILE_PATH="$HOME/.claude/sdd/USER-PROFILE.md"
373
- ```
374
- ADVISOR_MODE = file exists at PROFILE_PATH → true, otherwise → false
294
+ 1b. **Initialize canonical refs accumulator** — Start building `<canonical_refs>` for CONTEXT.md. Sources:
295
+ - **Now:** Copy `Canonical refs:` from ROADMAP.md for this phase. Expand each to a full relative path. Check REQUIREMENTS.md and PROJECT.md for specs/ADRs referenced.
296
+ - **`scout_codebase`:** If existing code references docs (e.g., comments citing ADRs), add those.
297
+ - **`discuss_areas`:** When the user says "read X", "check Y", or references any doc/spec/ADR — add it immediately. These are often the MOST important refs.
375
298
 
376
- 2. If ADVISOR_MODE is true, resolve vendor_philosophy calibration tier:
377
- - Priority 1: Read config.json > preferences.vendor_philosophy (project-level override)
378
- - Priority 2: Read USER-PROFILE.md Vendor Choices/Philosophy rating (global)
379
- - Priority 3: Default to "standard" if neither has a value or value is UNSCORED
299
+ This list is MANDATORY in CONTEXT.md. Every ref must have a full relative path. If no external docs exist, note that explicitly.
380
300
 
381
- Map to calibration tier:
382
- - conservative OR thorough-evaluator → full_maturity
383
- - opinionated → minimal_decisive
384
- - pragmatic-fast OR any other value OR empty → standard
301
+ 2. **Check prior decisions** — Scan `<prior_decisions>` for already-decided gray areas; mark them pre-answered.
385
302
 
386
- 3. Resolve model for advisor agents:
387
- ```bash
388
- ADVISOR_MODEL=$(node "$HOME/.claude/sdd/bin/sdd-tools.cjs" resolve-model sdd-advisor-researcher --raw)
389
- ```
303
+ 2b. **SPEC.md awareness** If `spec_loaded = true`: `<locked_requirements>` are pre-answered (Goal, Boundaries, Constraints, Acceptance Criteria). Do NOT generate gray areas about WHAT to build or WHY. Only generate gray areas about HOW to implement. When presenting, include: "Requirements are locked by SPEC.md — discussing implementation decisions only."
390
304
 
391
- If ADVISOR_MODE is false, skip all advisor-specific steps workflow proceeds with existing conversational flow unchanged.
305
+ 3. **Gray areas** — For each relevant category, identify 1-2 specific ambiguities that would change implementation. Annotate with code context where relevant.
392
306
 
393
- **Output your analysis internally, then present to user.**
307
+ 4. **Skip assessment** If no meaningful gray areas exist (pure infrastructure, clear-cut implementation, all already decided), the phase may not need discussion.
394
308
 
395
- Example analysis for "Post Feed" phase (with code and prior context):
396
- ```
397
- Domain: Displaying posts from followed users
398
- Existing: Card component (src/components/ui/Card.tsx), useInfiniteQuery hook, Tailwind CSS
399
- Prior decisions: "Minimal UI preferred" (Phase 2), "No pagination — always infinite scroll" (Phase 4)
400
- Gray areas:
401
- - UI: Layout style (cards vs timeline vs grid) — Card component exists with shadow/rounded variants
402
- - UI: Information density (full posts vs previews) — no existing density patterns
403
- - Behavior: Loading pattern — ALREADY DECIDED: infinite scroll (Phase 4)
404
- - Empty State: What shows when no posts exist — EmptyState component exists in ui/
405
- - Content: What metadata displays (time, author, reactions count)
406
- ```
309
+ **Advisor mode hand-off:** If `ADVISOR_MODE` is true, follow `workflows/discuss-phase/modes/advisor.md` for the rest of analyze/discuss flow (it adds an `advisor_research` substep and replaces the standard `discuss_areas` with table-first selection). The detection block (USER-PROFILE.md existence + non-technical-owner signals + calibration tier resolution) lives in that file — read it once when ADVISOR_MODE is true and follow its rules.
407
310
  </step>
408
311
 
409
312
  <step name="present_gray_areas">
410
- Present the domain boundary, prior decisions, and gray areas to user.
313
+ Present the domain boundary, prior decisions, and gray areas to the user.
411
314
 
412
- **First, state the boundary and any prior decisions that apply:**
413
315
  ```
414
316
  Phase [X]: [Name]
415
317
  Domain: [What this phase delivers — from your analysis]
416
318
 
417
- We'll clarify HOW to implement this.
418
- (New capabilities belong in other phases.)
319
+ We'll clarify HOW to implement this. (New capabilities belong in other phases.)
419
320
 
420
321
  [If prior decisions apply:]
421
322
  **Carrying forward from earlier phases:**
422
323
  - [Decision from Phase N that applies here]
423
- - [Decision from Phase M that applies here]
424
324
  ```
425
325
 
426
- **If `--auto`:** Auto-select ALL gray areas. Log: `[auto] Selected all gray areas: [list area names].` Skip the AskUserQuestion below and continue directly to discuss_areas with all areas selected.
326
+ **If `--auto` or `--all`** (per `modes/auto.md` or `modes/all.md`): Auto-select ALL gray areas. Log: `[--auto/--all] Selected all gray areas: [list area names].` Skip the AskUserQuestion below and continue directly to `discuss_areas` with all areas selected.
427
327
 
428
328
  **Otherwise, use AskUserQuestion (multiSelect: true):**
429
329
  - header: "Discuss"
430
330
  - question: "Which areas do you want to discuss for [phase name]?"
431
- - options: Generate 3-4 phase-specific gray areas, each with:
432
- - "[Specific area]" (label) — concrete, not generic
433
- - [1-2 questions this covers + code context annotation] (description)
434
- - **Highlight the recommended choice with brief explanation why**
435
-
436
- **Prior decision annotations:** When a gray area was already decided in a prior phase, annotate it:
437
- ```
438
- ☐ Exit shortcuts — How should users quit?
439
- (You decided "Ctrl+C only, no single-key shortcuts" in Phase 5 — revisit or keep?)
440
- ```
441
-
442
- **Code context annotations:** When the scout found relevant existing code, annotate the gray area description:
443
- ```
444
- ☐ Layout style — Cards vs list vs timeline?
445
- (You already have a Card component with shadow/rounded variants. Reusing it keeps the app consistent.)
446
- ```
447
-
448
- **Combining both:** When both prior decisions and code context apply:
449
- ```
450
- ☐ Loading behavior — Infinite scroll or pagination?
451
- (You chose infinite scroll in Phase 4. useInfiniteQuery hook already set up.)
452
- ```
453
-
454
- **Do NOT include a "skip" or "you decide" option.** User ran this command to discuss — give them real choices.
455
-
456
- **Examples by domain (with code context):**
457
-
458
- For "Post Feed" (visual feature):
459
- ```
460
- ☐ Layout style — Cards vs list vs timeline? (Card component exists with variants)
461
- ☐ Loading behavior — Infinite scroll or pagination? (useInfiniteQuery hook available)
462
- ☐ Content ordering — Chronological, algorithmic, or user choice?
463
- ☐ Post metadata — What info per post? Timestamps, reactions, author?
464
- ```
465
-
466
- For "Database backup CLI" (command-line tool):
467
- ```
468
- ☐ Output format — JSON, table, or plain text? Verbosity levels?
469
- ☐ Flag design — Short flags, long flags, or both? Required vs optional?
470
- ☐ Progress reporting — Silent, progress bar, or verbose logging?
471
- ☐ Error recovery — Fail fast, retry, or prompt for action?
472
- ```
473
-
474
- For "Organize photo library" (organization task):
475
- ```
476
- ☐ Grouping criteria — By date, location, faces, or events?
477
- ☐ Duplicate handling — Keep best, keep all, or prompt each time?
478
- ☐ Naming convention — Original names, dates, or descriptive?
479
- ☐ Folder structure — Flat, nested by year, or by category?
480
- ```
481
-
482
- Continue to discuss_areas with selected areas (or advisor_research if ADVISOR_MODE is true).
483
- </step>
484
-
485
- <step name="advisor_research">
486
- **Advisor Research** (only when ADVISOR_MODE is true)
487
-
488
- After user selects gray areas in present_gray_areas, spawn parallel research agents.
489
-
490
- 1. Display brief status: "Researching {N} areas..."
491
-
492
- 2. For EACH user-selected gray area, spawn a Task() in parallel:
493
-
494
- Task(
495
- prompt="First, read @~/.claude/agents/sdd-advisor-researcher.md for your role and instructions.
496
-
497
- <gray_area>{area_name}: {area_description from gray area identification}</gray_area>
498
- <phase_context>{phase_goal and description from ROADMAP.md}</phase_context>
499
- <project_context>{project name and brief description from PROJECT.md}</project_context>
500
- <calibration_tier>{resolved calibration tier: full_maturity | standard | minimal_decisive}</calibration_tier>
501
-
502
- Research this gray area and return a structured comparison table with rationale.
503
- ${AGENT_SKILLS_ADVISOR}",
504
- subagent_type="general-purpose",
505
- model="{ADVISOR_MODEL}",
506
- description="Research: {area_name}"
507
- )
508
-
509
- All Task() calls spawn simultaneously — do NOT wait for one before starting the next.
331
+ - options: 3-4 phase-specific gray areas, each with a concrete label (not generic), 1-2 questions in description, and code-context / prior-decision annotations:
332
+ ```
333
+ Layout style Cards vs list vs timeline?
334
+ (You already have a Card component with shadow/rounded variants. Reusing it keeps the app consistent.)
510
335
 
511
- 3. After ALL agents return, SYNTHESIZE results before presenting:
512
- For each agent's return:
513
- a. Parse the markdown comparison table and rationale paragraph
514
- b. Verify all 5 columns present (Option | Pros | Cons | Complexity | Recommendation) — fill any missing columns rather than showing broken table
515
- c. Verify option count matches calibration tier:
516
- - full_maturity: 3-5 options acceptable
517
- - standard: 2-4 options acceptable
518
- - minimal_decisive: 1-2 options acceptable
519
- If agent returned too many, trim least viable. If too few, accept as-is.
520
- d. Rewrite rationale paragraph to weave in project context and ongoing discussion context that the agent did not have access to
521
- e. If agent returned only 1 option, convert from table format to direct recommendation: "Standard approach for {area}: {option}. {rationale}"
336
+ Loading behavior Infinite scroll or pagination?
337
+ (You chose infinite scroll in Phase 4. useInfiniteQuery hook already set up.)
338
+ ```
522
339
 
523
- 4. Store synthesized tables for use in discuss_areas.
340
+ **Do NOT include a "skip" or "you decide" option.** User ran this command to discuss — give real choices.
524
341
 
525
- **If ADVISOR_MODE is false:** Skip this step entirely proceed directly from present_gray_areas to discuss_areas.
342
+ Continue to `discuss_areas` with selected areas (or to `advisor_research` per `modes/advisor.md` if `ADVISOR_MODE` is true).
526
343
  </step>
527
344
 
528
345
  <step name="discuss_areas">
529
- Discuss each selected area with the user. Flow depends on advisor mode.
530
-
531
- **If ADVISOR_MODE is true:**
532
-
533
- Table-first discussion flow — present research-backed comparison tables, then capture user picks.
534
-
535
- **For each selected area:**
536
-
537
- 1. **Present the synthesized comparison table + rationale paragraph** (from advisor_research step)
538
-
539
- 2. **Use AskUserQuestion:**
540
- - header: "{area_name}"
541
- - question: "Which approach for {area_name}?"
542
- - options: Extract from the table's Option column (AskUserQuestion adds "Other" automatically)
543
-
544
- 3. **Record the user's selection:**
545
- - If user picks from table options → record as locked decision for that area
546
- - If user picks "Other" → receive their input, reflect it back for confirmation, record
547
-
548
- 4. **After recording pick, Claude decides whether follow-up questions are needed:**
549
- - If the pick has ambiguity that would affect downstream planning → ask 1-2 targeted follow-up questions using AskUserQuestion
550
- - If the pick is clear and self-contained → move to next area
551
- - Do NOT ask the standard 4 questions — the table already provided the context
346
+ Discussion behavior is defined by the active mode file(s):
552
347
 
553
- 5. **After all areas processed:**
554
- - header: "Done"
555
- - question: "That covers [list areas]. Ready to create context?"
556
- - options: "Create context" / "Revisit an area"
348
+ - **Advisor mode (ADVISOR_MODE = true):** follow `workflows/discuss-phase/modes/advisor.md` — research-backed comparison tables, table-first selection.
349
+ - **--auto:** follow `workflows/discuss-phase/modes/auto.md` — Claude picks recommended option for every question; no AskUserQuestion. Single-pass cap enforced.
350
+ - **Default (no flags):** follow `workflows/discuss-phase/modes/default.md` 4 single-question turns per area, then check whether to continue.
557
351
 
558
- **Scope creep handling (advisor mode):**
559
- If user mentions something outside the phase domain:
560
- ```
561
- "[Feature] sounds like a new capability that belongs in its own phase.
562
- I'll note it as a deferred idea.
563
-
564
- Back to [current area]: [return to current question]"
565
- ```
566
-
567
- Track deferred ideas internally.
568
-
569
- ---
570
-
571
- **If ADVISOR_MODE is false:**
572
-
573
- For each selected area, conduct a focused discussion loop.
574
-
575
- **Research-before-questions mode:** Check if `workflow.research_before_questions` is enabled in config (from init context or `.planning/config.json`). When enabled, before presenting questions for each area:
576
- 1. Do a brief web search for best practices related to the area topic
577
- 2. Summarize the top findings in 2-3 bullet points
578
- 3. Present the research alongside the question so the user can make a more informed decision
579
-
580
- Example with research enabled:
581
- ```
582
- Let's talk about [Authentication Strategy].
583
-
584
- 📊 Best practices research:
585
- • OAuth 2.0 + PKCE is the current standard for SPAs (replaces implicit flow)
586
- • Session tokens with httpOnly cookies preferred over localStorage for XSS protection
587
- • Consider passkey/WebAuthn support — adoption is accelerating in 2025-2026
588
-
589
- With that context: How should users authenticate?
590
- ```
591
-
592
- When disabled (default), skip the research and present questions directly as before.
352
+ Overlays (combine with the active mode):
353
+ - `--text` `workflows/discuss-phase/modes/text.md` (replace AskUserQuestion with plain-text numbered lists)
354
+ - `--batch` → `workflows/discuss-phase/modes/batch.md` (group 2–5 questions per turn)
355
+ - `--analyze` `workflows/discuss-phase/modes/analyze.md` (trade-off table before each question)
593
356
 
594
- **Text mode support:** Parse optional `--text` from `$ARGUMENTS`.
595
- - Accept `--text` flag OR read `workflow.text_mode` from config (from init context)
596
- - When active, replace ALL `AskUserQuestion` calls with plain-text numbered lists
597
- - User types a number to select, or types free text for "Other"
598
- - This is required for Claude Code remote sessions (`/rc` mode) where TUI menus
599
- don't work through the Claude App
600
-
601
- **Batch mode support:** Parse optional `--batch` from `$ARGUMENTS`.
602
- - Accept `--batch`, `--batch=N`, or `--batch N`
603
-
604
- **Analyze mode support:** Parse optional `--analyze` from `$ARGUMENTS`.
605
- When `--analyze` is active, before presenting each question (or question group in batch mode), provide a brief **trade-off analysis** for the decision:
606
- - 2-3 options with pros/cons based on codebase context and common patterns
607
- - A recommended approach with reasoning
608
- - Known pitfalls or constraints from prior phases
609
-
610
- Example with `--analyze`:
611
- ```
612
- **Trade-off analysis: Authentication strategy**
613
-
614
- | Approach | Pros | Cons |
615
- |----------|------|------|
616
- | Session cookies | Simple, httpOnly prevents XSS | Requires CSRF protection, sticky sessions |
617
- | JWT (stateless) | Scalable, no server state | Token size, revocation complexity |
618
- | OAuth 2.0 + PKCE | Industry standard for SPAs | More setup, redirect flow UX |
619
-
620
- 💡 Recommended: OAuth 2.0 + PKCE — your app has social login in requirements (REQ-04) and this aligns with the existing NextAuth setup in `src/lib/auth.ts`.
621
-
622
- How should users authenticate?
623
- ```
624
-
625
- This gives the user context to make informed decisions without extra prompting. When `--analyze` is absent, present questions directly as before.
626
- - Accept `--batch`, `--batch=N`, or `--batch N`
627
- - Default to 4 questions per batch when no number is provided
628
- - Clamp explicit sizes to 2-5 so a batch stays answerable
629
- - If `--batch` is absent, keep the existing one-question-at-a-time flow
630
-
631
- **Philosophy:** stay adaptive, but let the user choose the pacing.
632
- - Default mode: 4 single-question turns, then check whether to continue
633
- - `--batch` mode: 1 grouped turn with 2-5 numbered questions, then check whether to continue
634
-
635
- Each answer (or answer set, in batch mode) should reveal the next question or next batch.
636
-
637
- **Auto mode (`--auto`):** For each area, Claude selects the recommended option (first option, or the one explicitly marked "recommended") for every question without using AskUserQuestion. Log each auto-selected choice:
638
- ```
639
- [auto] [Area] — Q: "[question text]" → Selected: "[chosen option]" (recommended default)
640
- ```
641
- After all areas are auto-resolved, skip the "Explore more gray areas" prompt and proceed directly to write_context.
642
-
643
- **Interactive mode (no `--auto`):**
644
-
645
- **For each area:**
646
-
647
- 1. **Announce the area:**
648
- ```
649
- Let's talk about [Area].
650
- ```
651
-
652
- 2. **Ask questions using the selected pacing:**
653
-
654
- **Default (no `--batch`): Ask 4 questions using AskUserQuestion**
655
- - header: "[Area]" (max 12 chars — abbreviate if needed)
656
- - question: Specific decision for this area
657
- - options: 2-3 concrete choices (AskUserQuestion adds "Other" automatically), with the recommended choice highlighted and brief explanation why
658
- - **Annotate options with code context** when relevant:
659
- ```
660
- "How should posts be displayed?"
661
- - Cards (reuses existing Card component — consistent with Messages)
662
- - List (simpler, would be a new pattern)
663
- - Timeline (needs new Timeline component — none exists yet)
664
- ```
665
- - Include "You decide" as an option when reasonable — captures Claude discretion
666
- - **Context7 for library choices:** When a gray area involves library selection (e.g., "magic links" → query next-auth docs) or API approach decisions, use `mcp__context7__*` tools to fetch current documentation and inform the options. Don't use Context7 for every question — only when library-specific knowledge improves the options.
667
-
668
- **Batch mode (`--batch`): Ask 2-5 numbered questions in one plain-text turn**
669
- - Group closely related questions for the current area into a single message
670
- - Keep each question concrete and answerable in one reply
671
- - When options are helpful, include short inline choices per question rather than a separate AskUserQuestion for every item
672
- - After the user replies, reflect back the captured decisions, note any unanswered items, and ask only the minimum follow-up needed before moving on
673
- - Preserve adaptiveness between batches: use the full set of answers to decide the next batch or whether the area is sufficiently clear
674
-
675
- 3. **After the current set of questions, check:**
676
- - header: "[Area]" (max 12 chars)
677
- - question: "More questions about [area], or move to next? (Remaining: [list other unvisited areas])"
678
- - options: "More questions" / "Next area"
679
-
680
- When building the question text, list the remaining unvisited areas so the user knows what's ahead. For example: "More questions about Layout, or move to next? (Remaining: Loading behavior, Content ordering)"
681
-
682
- If "More questions" → ask another 4 single questions, or another 2-5 question batch when `--batch` is active, then check again
683
- If "Next area" → proceed to next selected area
684
- If "Other" (free text) → interpret intent: continuation phrases ("chat more", "keep going", "yes", "more") map to "More questions"; advancement phrases ("done", "move on", "next", "skip") map to "Next area". If ambiguous, ask: "Continue with more questions about [area], or move to the next area?"
685
-
686
- 4. **After all initially-selected areas complete:**
687
- - Summarize what was captured from the discussion so far
688
- - AskUserQuestion:
689
- - header: "Done"
690
- - question: "We've discussed [list areas]. Which gray areas remain unclear?"
691
- - options: "Explore more gray areas" / "I'm ready for context"
692
- - If "Explore more gray areas":
693
- - Identify 2-4 additional gray areas based on what was learned
694
- - Return to present_gray_areas logic with these new areas
695
- - Loop: discuss new areas, then prompt again
696
- - If "I'm ready for context": Proceed to write_context
697
-
698
- **Canonical ref accumulation during discussion:**
699
- When the user references a doc, spec, or ADR during any answer — e.g., "read adr-014", "check the MCP spec", "per browse-spec.md" — immediately:
700
- 1. Read the referenced doc (or confirm it exists)
701
- 2. Add it to the canonical refs accumulator with full relative path
702
- 3. Use what you learned from the doc to inform subsequent questions
703
-
704
- These user-referenced docs are often MORE important than ROADMAP.md refs because they represent docs the user specifically wants downstream agents to follow. Never drop them.
705
-
706
- **Question design:**
707
- - Options should be concrete, not abstract ("Cards" not "Option A")
708
- - Each answer should inform the next question or next batch
709
- - If user picks "Other" to provide freeform input (e.g., "let me describe it", "something else", or an open-ended reply), ask your follow-up as plain text — NOT another AskUserQuestion. Wait for them to type at the normal prompt, then reflect their input back and confirm before resuming AskUserQuestion or the next numbered batch.
710
-
711
- **Scope creep handling:**
712
- If user mentions something outside the phase domain:
713
- ```
714
- "[Feature] sounds like a new capability — that belongs in its own phase.
715
- I'll note it as a deferred idea.
357
+ **Overlay stacking:** overlays combine and apply outer→inner in fixed order `--analyze` → `--batch` → `--text` (e.g., `--batch --analyze` = trade-off table per question group; add `--text` for plain-text rendering). Mode-specific precedence (e.g., `--auto --power`) is documented in each overlay file's "Combination rules" section.
716
358
 
717
- Back to [current area]: [return to current question]"
718
- ```
359
+ All modes preserve the universal rules below.
719
360
 
720
- Track deferred ideas internally.
361
+ **Universal rules (apply to every mode):**
721
362
 
722
- **Track discussion log data internally:**
723
- For each question asked, accumulate:
724
- - Area name
725
- - All options presented (label + description)
726
- - Which option the user selected (or their free-text response)
727
- - Any follow-up notes or clarifications the user provided
728
- This data is used to generate DISCUSSION-LOG.md in the `write_context` step.
363
+ - **Canonical ref accumulation** when the user references a doc/spec/ADR during any answer, immediately Read it (or confirm it exists) and add it to the canonical refs accumulator with full relative path. Use what you learned to inform subsequent questions. These docs are often MORE important than ROADMAP.md refs because the user specifically wants downstream agents to follow them.
364
+ - **Scope creep** — if user mentions something outside the phase domain, capture as deferred idea and redirect.
365
+ - **Incremental checkpoint** — after each area completes, write `${phase_dir}/${padded_phase}-DISCUSS-CHECKPOINT.json`. Read `workflows/discuss-phase/templates/checkpoint.json` for the schema. The checkpoint is structured state, not the canonical CONTEXT.md (`write_context` produces the canonical output). On session resume, the parent's `check_existing` step detects the checkpoint and offers to resume.
366
+ - **Discussion log accumulation** — for each question asked, accumulate area name, options presented, user's selection, follow-up notes. Used by `git_commit` to write DISCUSSION-LOG.md.
729
367
  </step>
730
368
 
731
369
  <step name="write_context">
732
- Create CONTEXT.md capturing decisions made.
370
+ Create CONTEXT.md and DISCUSSION-LOG.md.
733
371
 
734
- **Also generate DISCUSSION-LOG.md** a full audit trail of the discuss-phase Q&A.
735
- This file is for human reference only (software audits, compliance reviews). It is NOT
736
- consumed by downstream agents (researcher, planner, executor).
372
+ DISCUSSION-LOG.md is for human reference only (audits, retrospectives) and is NOT consumed by downstream agents (researcher, planner, executor).
737
373
 
738
374
  **Find or create phase directory:**
739
375
 
740
- Use values from init: `phase_dir`, `phase_slug`, `padded_phase`.
741
-
742
- If `phase_dir` is null (phase exists in roadmap but no directory):
376
+ Use values from init: `phase_dir`, `expected_phase_dir`, `phase_slug`, `padded_phase`. If `phase_dir` is null:
743
377
  ```bash
744
- mkdir -p ".planning/phases/${padded_phase}-${phase_slug}"
378
+ mkdir -p "${expected_phase_dir}"
745
379
  ```
746
380
 
747
- **File location:** `${phase_dir}/${padded_phase}-CONTEXT.md`
748
-
749
- **Structure the content by what was discussed:**
750
-
751
- ```markdown
752
- # Phase [X]: [Name] - Context
753
-
754
- **Gathered:** [date]
755
- **Status:** Ready for planning
756
-
757
- <domain>
758
- ## Phase Boundary
759
-
760
- [Clear statement of what this phase delivers — the scope anchor]
761
-
762
- </domain>
763
-
764
- <decisions>
765
- ## Implementation Decisions
766
-
767
- ### [Category 1 that was discussed]
768
- - **D-01:** [Decision or preference captured]
769
- - **D-02:** [Another decision if applicable]
770
-
771
- ### [Category 2 that was discussed]
772
- - **D-03:** [Decision or preference captured]
773
-
774
- ### Claude's Discretion
775
- [Areas where user said "you decide" — note that Claude has flexibility here]
776
-
777
- ### Folded Todos
778
- [If any todos were folded into scope from the cross_reference_todos step, list them here.
779
- Each entry should include the todo title, original problem, and how it fits this phase's scope.
780
- If no todos were folded: omit this subsection entirely.]
781
-
782
- </decisions>
783
-
784
- <canonical_refs>
785
- ## Canonical References
786
-
787
- **Downstream agents MUST read these before planning or implementing.**
788
-
789
- [MANDATORY section. Write the FULL accumulated canonical refs list here.
790
- Sources: ROADMAP.md refs + REQUIREMENTS.md refs + user-referenced docs during
791
- discussion + any docs discovered during codebase scout. Group by topic area.
792
- Every entry needs a full relative path — not just a name.]
793
-
794
- ### [Topic area 1]
795
- - `path/to/adr-or-spec.md` — [What it decides/defines that's relevant]
796
- - `path/to/doc.md` §N — [Specific section reference]
797
-
798
- ### [Topic area 2]
799
- - `path/to/feature-doc.md` — [What this doc defines]
800
-
801
- [If no external specs: "No external specs — requirements fully captured in decisions above"]
802
-
803
- </canonical_refs>
804
-
805
- <code_context>
806
- ## Existing Code Insights
807
-
808
- ### Reusable Assets
809
- - [Component/hook/utility]: [How it could be used in this phase]
810
-
811
- ### Established Patterns
812
- - [Pattern]: [How it constrains/enables this phase]
813
-
814
- ### Integration Points
815
- - [Where new code connects to existing system]
816
-
817
- </code_context>
818
-
819
- <specifics>
820
- ## Specific Ideas
821
-
822
- [Any particular references, examples, or "I want it like X" moments from discussion]
823
-
824
- [If none: "No specific requirements — open to standard approaches"]
381
+ Set `phase_dir="${expected_phase_dir}"` after creation.
825
382
 
826
- </specifics>
827
-
828
- <deferred>
829
- ## Deferred Ideas
830
-
831
- [Ideas that came up but belong in other phases. Don't lose them.]
832
-
833
- ### Reviewed Todos (not folded)
834
- [If any todos were reviewed in cross_reference_todos but not folded into scope,
835
- list them here so future phases know they were considered.
836
- Each entry: todo title + reason it was deferred (out of scope, belongs in Phase Y, etc.)
837
- If no reviewed-but-deferred todos: omit this subsection entirely.]
383
+ **File location:** `${phase_dir}/${padded_phase}-CONTEXT.md`
838
384
 
839
- [If none: "None discussion stayed within phase scope"]
385
+ **Read the CONTEXT.md template now (lazy-loaded):**
386
+ ```
387
+ Read(workflows/discuss-phase/templates/context.md)
388
+ ```
840
389
 
841
- </deferred>
390
+ The template documents variable substitutions and conditional sections. Substitute live values for `[X]`, `[Name]`, `[date]`, `${padded_phase}`, `{N}`. Include `<spec_lock>` only when `spec_loaded = true`. Include "Folded Todos" / "Reviewed Todos" subsections only when the `cross_reference_todos` step folded or reviewed todos.
842
391
 
843
- ---
392
+ **SPEC.md integration** — If `spec_loaded = true`:
393
+ - Add the `<spec_lock>` section immediately after `<domain>`.
394
+ - Add the SPEC.md file to `<canonical_refs>` with note "Locked requirements — MUST read before planning".
395
+ - Do NOT duplicate requirements text from SPEC.md into `<decisions>` — agents read SPEC.md directly.
396
+ - The `<decisions>` section contains only implementation decisions from this discussion.
844
397
 
845
- *Phase: XX-name*
846
- *Context gathered: [date]*
847
- ```
848
-
849
- Write file.
398
+ Write the file.
850
399
  </step>
851
400
 
852
401
  <step name="confirm_creation">
@@ -856,10 +405,6 @@ Present summary and next steps:
856
405
  Created: .planning/phases/${PADDED_PHASE}-${SLUG}/${PADDED_PHASE}-CONTEXT.md
857
406
 
858
407
  ## Decisions Captured
859
-
860
- ### [Category]
861
- - [Key decision]
862
-
863
408
  ### [Category]
864
409
  - [Key decision]
865
410
 
@@ -869,74 +414,40 @@ Created: .planning/phases/${PADDED_PHASE}-${SLUG}/${PADDED_PHASE}-CONTEXT.md
869
414
 
870
415
  ---
871
416
 
872
- ## ▶ Next Up
417
+ ## ▶ Next Up — [${PROJECT_CODE}] ${PROJECT_TITLE}
873
418
 
874
419
  **Phase ${PHASE}: [Name]** — [Goal from ROADMAP.md]
875
420
 
876
- `/sdd:plan-phase ${PHASE} ${SDD_WS}`
421
+ `/clear` then:
877
422
 
878
- <sub>`/clear` first → fresh context window</sub>
423
+ `/sdd:plan-phase ${PHASE} ${SDD_WS}`
879
424
 
880
425
  ---
881
426
 
882
- **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)
885
- - Review/edit CONTEXT.md before continuing
886
-
887
- ---
427
+ **Also available:** `--chain` for auto plan+execute after; `/sdd:plan-phase ${PHASE} --skip-research ${SDD_WS}` to plan without research; `/sdd:ui-phase ${PHASE} ${SDD_WS}` for UI design contracts; review/edit CONTEXT.md before continuing.
888
428
  ```
889
429
  </step>
890
430
 
891
431
  <step name="git_commit">
892
- **Write DISCUSSION-LOG.md before committing:**
432
+ **Write DISCUSSION-LOG.md before committing.**
893
433
 
894
434
  **File location:** `${phase_dir}/${padded_phase}-DISCUSSION-LOG.md`
895
435
 
896
- ```markdown
897
- # Phase [X]: [Name] - Discussion Log
898
-
899
- > **Audit trail only.** Do not use as input to planning, research, or execution agents.
900
- > Decisions are captured in CONTEXT.md — this log preserves the alternatives considered.
901
-
902
- **Date:** [ISO date]
903
- **Phase:** [phase number]-[phase name]
904
- **Areas discussed:** [comma-separated list]
905
-
906
- ---
907
-
908
- [For each gray area discussed:]
909
-
910
- ## [Area Name]
911
-
912
- | Option | Description | Selected |
913
- |--------|-------------|----------|
914
- | [Option 1] | [Description from AskUserQuestion] | |
915
- | [Option 2] | [Description] | ✓ |
916
- | [Option 3] | [Description] | |
917
-
918
- **User's choice:** [Selected option or free-text response]
919
- **Notes:** [Any clarifications, follow-up context, or rationale the user provided]
920
-
921
- ---
922
-
923
- [Repeat for each area]
924
-
925
- ## Claude's Discretion
926
-
927
- [List areas where user said "you decide" or deferred to Claude]
436
+ **Read the DISCUSSION-LOG.md template now (lazy-loaded):**
437
+ ```
438
+ Read(workflows/discuss-phase/templates/discussion-log.md)
439
+ ```
928
440
 
929
- ## Deferred Ideas
441
+ Substitute live values from the discussion log accumulator (area names, options presented, user selections, notes, deferred ideas, Claude's discretion items). Write the file.
930
442
 
931
- [Ideas mentioned during discussion that were noted for future phases]
443
+ **Clean up checkpoint file** CONTEXT.md is now the canonical record:
444
+ ```bash
445
+ rm -f "${phase_dir}/${padded_phase}-DISCUSS-CHECKPOINT.json"
932
446
  ```
933
447
 
934
- Write file.
935
-
936
448
  Commit phase context and discussion log:
937
-
938
449
  ```bash
939
- node "$HOME/.claude/sdd/bin/sdd-tools.cjs" commit "docs(${padded_phase}): capture phase context" --files "${phase_dir}/${padded_phase}-CONTEXT.md" "${phase_dir}/${padded_phase}-DISCUSSION-LOG.md"
450
+ sdd-sdk query commit "docs(${padded_phase}): capture phase context" --files "${phase_dir}/${padded_phase}-CONTEXT.md" "${phase_dir}/${padded_phase}-DISCUSSION-LOG.md"
940
451
  ```
941
452
 
942
453
  Confirm: "Committed: docs(${padded_phase}): capture phase context"
@@ -946,87 +457,20 @@ Confirm: "Committed: docs(${padded_phase}): capture phase context"
946
457
  Update STATE.md with session info:
947
458
 
948
459
  ```bash
949
- node "$HOME/.claude/sdd/bin/sdd-tools.cjs" state record-session \
460
+ sdd-sdk query state.record-session \
950
461
  --stopped-at "Phase ${PHASE} context gathered" \
951
462
  --resume-file "${phase_dir}/${padded_phase}-CONTEXT.md"
952
- ```
953
463
 
954
- Commit STATE.md:
955
-
956
- ```bash
957
- node "$HOME/.claude/sdd/bin/sdd-tools.cjs" commit "docs(state): record phase ${PHASE} context session" --files .planning/STATE.md
464
+ sdd-sdk query commit "docs(state): record phase ${PHASE} context session" --files .planning/STATE.md
958
465
  ```
959
466
  </step>
960
467
 
961
468
  <step name="auto_advance">
962
- Check for auto-advance trigger:
963
-
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):
966
- ```bash
967
- if [[ ! "$ARGUMENTS" =~ --auto ]]; then
968
- node "$HOME/.claude/sdd/bin/sdd-tools.cjs" config-set workflow._auto_chain_active false 2>/dev/null
969
- fi
970
- ```
971
- 3. Read both the chain flag and user preference:
972
- ```bash
973
- AUTO_CHAIN=$(node "$HOME/.claude/sdd/bin/sdd-tools.cjs" config-get workflow._auto_chain_active 2>/dev/null || echo "false")
974
- AUTO_CFG=$(node "$HOME/.claude/sdd/bin/sdd-tools.cjs" config-get workflow.auto_advance 2>/dev/null || echo "false")
975
- ```
976
-
977
- **If `--auto` flag present AND `AUTO_CHAIN` is not true:** Persist chain flag to config (handles direct `--auto` usage without new-project):
978
- ```bash
979
- node "$HOME/.claude/sdd/bin/sdd-tools.cjs" config-set workflow._auto_chain_active true
980
- ```
981
-
982
- **If `--auto` flag present OR `AUTO_CHAIN` is true OR `AUTO_CFG` is true:**
983
-
984
- Display banner:
985
- ```
986
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
987
- SDD ► AUTO-ADVANCING TO PLAN
988
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
989
-
990
- Context captured. Launching plan-phase...
991
- ```
469
+ Auto-advance behavior is defined in `workflows/discuss-phase/modes/chain.md`.
992
470
 
993
- Launch plan-phase using the Skill tool to avoid nested Task sessions (which cause runtime freezes due to deep agent nesting see #686):
994
- ```
995
- Skill(skill="sdd:plan-phase", args="${PHASE} --auto ${SDD_WS}")
996
- ```
997
-
998
- 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.
999
-
1000
- **Handle plan-phase return:**
1001
- - **PHASE COMPLETE** → Full chain succeeded. Display:
1002
- ```
1003
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1004
- SDD ► PHASE ${PHASE} COMPLETE
1005
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1006
-
1007
- Auto-advance pipeline finished: discuss → plan → execute
1008
-
1009
- Next: /sdd:discuss-phase ${NEXT_PHASE} --auto ${SDD_WS}
1010
- <sub>/clear first → fresh context window</sub>
1011
- ```
1012
- - **PLANNING COMPLETE** → Planning done, execution didn't complete:
1013
- ```
1014
- Auto-advance partial: Planning complete, execution did not finish.
1015
- Continue: /sdd:execute-phase ${PHASE} ${SDD_WS}
1016
- ```
1017
- - **PLANNING INCONCLUSIVE / CHECKPOINT** → Stop chain:
1018
- ```
1019
- Auto-advance stopped: Planning needs input.
1020
- Continue: /sdd:plan-phase ${PHASE} ${SDD_WS}
1021
- ```
1022
- - **GAPS FOUND** → Stop chain:
1023
- ```
1024
- Auto-advance stopped: Gaps found during execution.
1025
- Continue: /sdd:plan-phase ${PHASE} --gaps ${SDD_WS}
1026
- ```
471
+ If `--auto`, `--chain`, or `workflow.auto_advance` is enabled, Read that file now and execute its `auto_advance` step (which handles flag-syncing, banner display, plan-phase Skill dispatch, and return-status branching).
1027
472
 
1028
- **If neither `--auto` nor config enabled:**
1029
- Route to `confirm_creation` step (existing behavior — show manual next steps).
473
+ Otherwise, route to `confirm_creation` (manual next steps).
1030
474
  </step>
1031
475
 
1032
476
  </process>
@@ -1036,14 +480,20 @@ Route to `confirm_creation` step (existing behavior — show manual next steps).
1036
480
  - Prior context loaded (PROJECT.md, REQUIREMENTS.md, STATE.md, prior CONTEXT.md files)
1037
481
  - Already-decided questions not re-asked (carried forward from prior phases)
1038
482
  - Codebase scouted for reusable assets, patterns, and integration points
1039
- - Gray areas identified through intelligent analysis with code and prior decision annotations
1040
- - User selected which areas to discuss
1041
- - Each selected area explored until user satisfied (with code-informed and prior-decision-informed options)
483
+ - Gray areas identified with code and prior-decision annotations
484
+ - User selected which areas to discuss (or `--all`/`--auto` auto-selected)
485
+ - Each selected area explored under the active mode's rules until satisfied
1042
486
  - Scope creep redirected to deferred ideas
1043
487
  - CONTEXT.md captures actual decisions, not vague vision
1044
- - CONTEXT.md includes canonical_refs section with full file paths to every spec/ADR/doc downstream agents need (MANDATORY — never omit)
488
+ - CONTEXT.md includes canonical_refs section with full file paths to every spec/ADR/doc downstream agents need (MANDATORY)
1045
489
  - CONTEXT.md includes code_context section with reusable assets and patterns
1046
490
  - Deferred ideas preserved for future phases
1047
491
  - STATE.md updated with session info
1048
492
  - User knows next steps
493
+ - Checkpoint file written after each area completes (incremental save)
494
+ - Interrupted sessions can be resumed from checkpoint
495
+ - Checkpoint file cleaned up after successful CONTEXT.md write
496
+ - `--chain` triggers interactive discuss followed by auto plan+execute (no auto-answering)
497
+ - `--chain` and `--auto` both persist chain flag and auto-advance to plan-phase
498
+ - Per-mode bodies, templates, and advisor flow are lazy-loaded — parent stays under the workflow size budget enforced by `tests/workflow-size-budget.test.cjs`
1049
499
  </success_criteria>