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