@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
@@ -15,52 +15,163 @@ Read all files referenced by the invoking prompt's execution_context before star
15
15
  <available_agent_types>
16
16
  Valid SDD subagent types (use exact names — do not fall back to 'general-purpose'):
17
17
  - sdd-phase-researcher — Researches technical approaches for a phase
18
+ - sdd-pattern-mapper — Analyzes codebase for existing patterns, produces PATTERNS.md
18
19
  - sdd-planner — Creates detailed plans from phase scope
19
20
  - sdd-plan-checker — Reviews plan quality before execution
20
21
  </available_agent_types>
21
22
 
22
23
  <process>
23
24
 
25
+ ## 0. Git Branch Invariant
26
+
27
+ **Do not create, rename, or switch git branches during plan-phase.** Branch identity is established at discuss-phase and is owned by the user's git workflow. A phase rename in ROADMAP.md is a plan-level change only — it does not mutate git branch names. If `phase_slug` in the init JSON differs from the current branch name, that is expected and correct; leave the branch unchanged.
28
+
24
29
  ## 1. Initialize
25
30
 
26
31
  Load all context in one call (paths only to minimize orchestrator context):
27
32
 
28
33
  ```bash
29
- INIT=$(node "$HOME/.claude/sdd/bin/sdd-tools.cjs" init plan-phase "$PHASE")
34
+ INIT=$(sdd-sdk query init.plan-phase "$PHASE")
30
35
  if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi
31
- AGENT_SKILLS_RESEARCHER=$(node "$HOME/.claude/sdd/bin/sdd-tools.cjs" agent-skills sdd-researcher 2>/dev/null)
32
- AGENT_SKILLS_PLANNER=$(node "$HOME/.claude/sdd/bin/sdd-tools.cjs" agent-skills sdd-planner 2>/dev/null)
33
- AGENT_SKILLS_CHECKER=$(node "$HOME/.claude/sdd/bin/sdd-tools.cjs" agent-skills sdd-checker 2>/dev/null)
34
- CONTEXT_WINDOW=$(node "$HOME/.claude/sdd/bin/sdd-tools.cjs" config-get context_window 2>/dev/null || echo "200000")
36
+ AGENT_SKILLS_RESEARCHER=$(sdd-sdk query agent-skills sdd-phase-researcher)
37
+ AGENT_SKILLS_PLANNER=$(sdd-sdk query agent-skills sdd-planner)
38
+ AGENT_SKILLS_CHECKER=$(sdd-sdk query agent-skills sdd-plan-checker)
39
+ CONTEXT_WINDOW=$(sdd-sdk query config-get context_window 2>/dev/null || echo "200000")
40
+ TDD_MODE=$(sdd-sdk query config-get workflow.tdd_mode 2>/dev/null || echo "false")
41
+ MVP_MODE_CFG=$(sdd-sdk query config-get workflow.mvp_mode 2>/dev/null || echo "false")
35
42
  ```
36
43
 
37
- When `CONTEXT_WINDOW >= 500000`, the planner prompt includes prior phase CONTEXT.md files so cross-phase decisions are consistent (e.g., "use library X for all data fetching" from Phase 2 is visible to Phase 5's planner).
44
+ When `TDD_MODE` is `true`, the planner agent is instructed to apply `type: tdd` to eligible tasks using heuristics from `references/tdd.md`. The planner's `<required_reading>` is extended to include `@~/.claude/sdd/references/tdd.md` so gate enforcement rules are available during planning.
45
+
46
+ When `CONTEXT_WINDOW >= 500000`, the planner prompt includes the 3 most recent prior phase CONTEXT.md and SUMMARY.md files PLUS any phases explicitly listed in the current phase's `Depends on:` field in ROADMAP.md. Explicit dependencies always load regardless of recency (e.g., Phase 7 declaring `Depends on: Phase 2` always sees Phase 2's context). Bounded recency keeps the planner's context budget focused on recent work.
38
47
 
39
- Parse JSON for: `researcher_model`, `planner_model`, `checker_model`, `research_enabled`, `plan_checker_enabled`, `nyquist_validation_enabled`, `commit_docs`, `text_mode`, `phase_found`, `phase_dir`, `phase_number`, `phase_name`, `phase_slug`, `padded_phase`, `has_research`, `has_context`, `has_reviews`, `has_plans`, `plan_count`, `planning_exists`, `roadmap_exists`, `phase_req_ids`, `response_language`.
48
+ Parse JSON for: `researcher_model`, `planner_model`, `checker_model`, `research_enabled`, `plan_checker_enabled`, `nyquist_validation_enabled`, `commit_docs`, `text_mode`, `phase_found`, `phase_dir`, `phase_number`, `phase_name`, `phase_slug`, `padded_phase`, `has_research`, `has_context`, `has_reviews`, `has_plans`, `plan_count`, `phase_status` (#3569), `planning_exists`, `roadmap_exists`, `phase_req_ids`, `response_language`.
40
49
 
41
50
  **If `response_language` is set:** Include `response_language: {value}` in all spawned subagent prompts so any user-facing output stays in the configured language.
42
51
 
43
52
  **File paths (for <files_to_read> blocks):** `state_path`, `roadmap_path`, `requirements_path`, `context_path`, `research_path`, `verification_path`, `uat_path`, `reviews_path`. These are null if files don't exist.
44
53
 
45
- **If `planning_exists` is false:** Error — run `/sdd-new-project` first.
54
+ **If `planning_exists` is false:** Error — run `/sdd:new-project` first.
55
+
56
+ ## 1.5. Closed-Phase Gate (#3569)
57
+
58
+ The init JSON includes `phase_status` — one of `Pending | Planned | In Progress | Executed | Complete | Needs Review`. `Complete` means the phase has all summaries AND a `VERIFICATION.md` with `status: passed`. Replanning a closed phase silently rewrites plan docs that no longer match the shipped code, so the workflow must hard-stop here unless the operator explicitly overrides.
59
+
60
+ Parse `phase_status` from the init JSON, then:
61
+
62
+ ```bash
63
+ FORCE_REPLAN=false
64
+ if [[ "$ARGUMENTS" =~ (^|[[:space:]])--force([[:space:]]|$) ]]; then
65
+ FORCE_REPLAN=true
66
+ fi
67
+
68
+ if [ "${phase_status}" = "Complete" ]; then
69
+ if [[ "$ARGUMENTS" =~ (^|[[:space:]])--reviews([[:space:]]|$) ]]; then
70
+ # --reviews on a closed phase is never legitimate — concerns belong in a
71
+ # new phase or issue against the closed phase's commits.
72
+ cat <<EOF >&2
73
+ Phase ${phase_number} (${phase_name}) is already CLOSED (VERIFICATION status: passed).
74
+ /sdd:plan-phase --reviews cannot replan a closed phase. If the review surfaced
75
+ real concerns, open a follow-up phase or file an issue against the closed
76
+ phase's commits. There is no --force override for --reviews on a closed phase.
77
+ EOF
78
+ exit 1
79
+ fi
80
+ if [ "$FORCE_REPLAN" != "true" ]; then
81
+ cat <<EOF >&2
82
+ Phase ${phase_number} (${phase_name}) is already CLOSED (VERIFICATION status: passed).
83
+ Replanning a closed phase will overwrite plan docs that no longer match the
84
+ shipped code. If you intentionally want to replan over closed work, re-run
85
+ with: /sdd:plan-phase ${phase_number} --force
86
+
87
+ Otherwise, to view what shipped, see: ${verification_path}
88
+ EOF
89
+ exit 1
90
+ fi
91
+ # FORCE_REPLAN=true: continue, but emit a banner so the operator sees the
92
+ # decision in the transcript and in any committed plan docs.
93
+ echo "WARNING: Replanning CLOSED phase ${phase_number} under --force. Verify the closeout was wrong before committing new plan docs." >&2
94
+ fi
95
+ ```
96
+
97
+ The gate fires only on `Complete`. `Executed` and `Needs Review` are not gated — those states mean planning was finished but verification did not pass, and replanning is a legitimate next step.
46
98
 
47
99
  ## 2. Parse and Normalize Arguments
48
100
 
49
- Extract from $ARGUMENTS: phase number (integer or decimal like `2.1`), flags (`--research`, `--skip-research`, `--gaps`, `--skip-verify`, `--skip-ui`, `--prd <filepath>`, `--reviews`, `--text`).
101
+ Extract from $ARGUMENTS: phase number (integer or decimal like `2.1`), flags (`--research`, `--skip-research`, `--research-phase <N>`, `--gaps`, `--skip-verify`, `--skip-ui`, `--prd <filepath>`, `--ingest <path-or-glob>`, `--ingest-format <auto|nygard|madr|narrative>`, `--reviews`, `--text`, `--bounce`, `--skip-bounce`, `--chunked`, `--mvp`, `--force` (override closed-phase gate, see §1.5)).
102
+
103
+ **`--research-phase <N>` — research-only mode (#3042 + #3044).** When this flag is present, parse `<N>` as the phase number (overrides any positional phase argument), set `RESEARCH_ONLY=true`, and treat the rest of this workflow as a research-dispatch only — the planner spawn (step 8), plan-checker, verification, gaps, bounce, and post-planning-gaps blocks all skip on `RESEARCH_ONLY`. Use this for cross-phase research, doc review before committing to a planning approach, and correction-without-replanning loops. Replaces the deleted `/sdd-research-phase` command.
104
+
105
+ In research-only mode, two modifiers control behavior when `RESEARCH.md` already exists:
106
+
107
+ - **`--research`** — force-refresh re-research without prompting. Re-spawns the researcher unconditionally and overwrites the existing RESEARCH.md. (This is the existing `--research` flag's standard "force re-research" semantics, reused here.)
108
+ - **`--view`** — view-only: print existing `RESEARCH.md` to stdout, do **not** spawn the researcher. Sets `VIEW_ONLY=true`. Cheapest mode for the correction-without-replanning loop. If `RESEARCH.md` does not exist, error with a hint to drop `--view`.
109
+
110
+ ```bash
111
+ RESEARCH_ONLY=false
112
+ VIEW_ONLY=false
113
+ if [[ "$ARGUMENTS" =~ --research-phase[[:space:]]+([0-9]+(\.[0-9]+)?) ]]; then
114
+ RESEARCH_ONLY=true
115
+ PHASE="${BASH_REMATCH[1]}"
116
+ fi
117
+ if $RESEARCH_ONLY && [[ "$ARGUMENTS" =~ (^|[[:space:]])--view([[:space:]]|$) ]]; then
118
+ VIEW_ONLY=true
119
+ fi
120
+ ```
50
121
 
51
122
  Set `TEXT_MODE=true` if `--text` is present in $ARGUMENTS OR `text_mode` from init JSON is `true`. When `TEXT_MODE` is active, replace every `AskUserQuestion` call with a plain-text numbered list and ask the user to type their choice number. This is required for Claude Code remote sessions (`/rc` mode) where TUI menus don't work through the Claude App.
52
123
 
53
- Extract `--prd <filepath>` from $ARGUMENTS. If present, set PRD_FILE to the filepath.
124
+ **MVP_MODE resolution.** Resolve `MVP_MODE` once via the centralized `phase.mvp-mode` query verb. Precedence (first hit wins): CLI flag → ROADMAP.md `**Mode:** mvp` → `workflow.mvp_mode` config → false. The verb is the single source of truth — do not re-implement the chain.
125
+
126
+ ```bash
127
+ MVP_FLAG_ARG=""
128
+ if [[ "$ARGUMENTS" =~ (^|[[:space:]])--mvp([[:space:]]|$) ]]; then MVP_FLAG_ARG="--cli-flag"; fi
129
+ ```
130
+
131
+ Defer the `phase.mvp-mode` query until `PHASE` is finalized (after explicit argument parsing/fallback phase detection + validation).
132
+ The verb returns `true|false`. Full result also exposes `source` (`cli_flag` | `roadmap` | `config` | `none`) for diagnostics. The mode is **all-or-nothing per phase** (PRD decision Q1) — never selective per task.
133
+
134
+ **Walking Skeleton gate.** When `MVP_MODE=true` AND `phase_number == "01"` AND there are zero prior phase summaries (new project), the planner runs in **Walking Skeleton mode** (per PRD decision Q2 — new projects only). Detect with:
135
+
136
+ ```bash
137
+ WALKING_SKELETON=false
138
+ if [ "$MVP_MODE" = "true" ] && [ "$padded_phase" = "01" ]; then
139
+ PRIOR_SUMMARIES=$(sdd-sdk query phases.list --pick summaries_total 2>/dev/null || echo "0")
140
+ if [ "$PRIOR_SUMMARIES" = "0" ]; then WALKING_SKELETON=true; fi
141
+ fi
142
+ ```
143
+
144
+ When `WALKING_SKELETON=true`:
145
+ - Planner is instructed to produce `SKELETON.md` in the phase directory alongside `PLAN.md`. The template lives at `@~/.claude/sdd/references/skeleton-template.md`.
146
+ - The plan must scaffold project + routing + one real DB read/write + one real UI interaction + dev deployment — the thinnest possible end-to-end working slice.
147
+
148
+ **Interaction with `--prd <filepath>`.** `--mvp` and `--prd` compose. The PRD express path (Step 3.5) creates `CONTEXT.md` from the PRD file and continues to research; the Walking Skeleton gate fires independently from the conditions above. When both are active on Phase 1 of a new project, the planner receives `WALKING_SKELETON=true` and PRD-derived context simultaneously — the PRD informs *what the skeleton should prove*. No precedence is needed; the two signals are orthogonal. See [`references/mvp-concepts.md`](../references/mvp-concepts.md) for the broader interaction map.
149
+
150
+ Extract express-path args from $ARGUMENTS: `PRD_FILE` (`--prd <filepath>`), `INGEST_PATH` (`--ingest <path-or-glob>`), and optional `INGEST_FORMAT` (`--ingest-format <auto|nygard|madr|narrative>`, default `auto`).
151
+
152
+ `--prd` and `--ingest` are mutually exclusive. If both are present, error and exit:
153
+ `Invalid arguments: cannot combine \`--prd\` with \`--ingest\`.`
54
154
 
55
155
  **If no phase number:** Detect next unplanned phase from roadmap.
56
156
 
57
- **If `phase_found` is false:** Validate phase exists in ROADMAP.md. If valid, create the directory using `phase_slug` and `padded_phase` from init:
157
+ **If `phase_found` is false:** Validate phase exists in ROADMAP.md. If valid, create the directory using `expected_phase_dir` from init (includes `project_code` prefix when set):
58
158
  ```bash
59
- mkdir -p ".planning/phases/${padded_phase}-${phase_slug}"
159
+ mkdir -p "${expected_phase_dir}"
60
160
  ```
61
161
 
162
+ Set `phase_dir="${expected_phase_dir}"` after creation.
163
+
62
164
  **Existing artifacts from init:** `has_research`, `has_plans`, `plan_count`.
63
165
 
166
+ Set `CHUNKED_MODE` from flag or config:
167
+ ```bash
168
+ CHUNKED_CFG=$(sdd-sdk query config-get workflow.plan_chunked 2>/dev/null || echo "false")
169
+ CHUNKED_MODE=false
170
+ if [[ "$ARGUMENTS" =~ --chunked ]] || [[ "$CHUNKED_CFG" == "true" ]]; then
171
+ CHUNKED_MODE=true
172
+ fi
173
+ ```
174
+
64
175
  ## 2.5. Validate `--reviews` Prerequisite
65
176
 
66
177
  **Skip if:** No `--reviews` flag.
@@ -73,20 +184,25 @@ Error:
73
184
  ```
74
185
  No REVIEWS.md found for Phase {N}. Run reviews first:
75
186
 
76
- /sdd-review --phase {N}
187
+ /sdd:review --phase {N}
77
188
 
78
- Then re-run /sdd-plan-phase {N} --reviews
189
+ Then re-run /sdd:plan-phase {N} --reviews
79
190
  ```
80
191
  Exit workflow.
81
192
 
82
193
  ## 3. Validate Phase
83
194
 
84
195
  ```bash
85
- PHASE_INFO=$(node "$HOME/.claude/sdd/bin/sdd-tools.cjs" roadmap get-phase "${PHASE}")
196
+ PHASE_INFO=$(sdd-sdk query roadmap.get-phase "${PHASE}")
86
197
  ```
87
198
 
88
199
  **If `found` is false:** Error with available phases. **If `found` is true:** Extract `phase_number`, `phase_name`, `goal` from JSON.
89
200
 
201
+ Now that `PHASE` is finalized, resolve MVP mode:
202
+ ```bash
203
+ MVP_MODE=$(sdd-sdk query phase.mvp-mode "${PHASE}" $MVP_FLAG_ARG --pick active)
204
+ ```
205
+
90
206
  ## 3.5. Handle PRD Express Path
91
207
 
92
208
  **Skip if:** No `--prd` flag in arguments.
@@ -184,16 +300,31 @@ Use full relative paths. Group by topic area.]
184
300
 
185
301
  5. Commit:
186
302
  ```bash
187
- node "$HOME/.claude/sdd/bin/sdd-tools.cjs" commit "docs(${padded_phase}): generate context from PRD" --files "${phase_dir}/${padded_phase}-CONTEXT.md"
303
+ sdd-sdk query commit "docs(${padded_phase}): generate context from PRD" --files "${phase_dir}/${padded_phase}-CONTEXT.md"
188
304
  ```
189
305
 
190
306
  6. Set `context_content` to the generated CONTEXT.md content and continue to step 5 (Handle Research).
191
307
 
192
308
  **Effect:** This completely bypasses step 4 (Load CONTEXT.md) since we just created it. The rest of the workflow (research, planning, verification) proceeds normally with the PRD-derived context.
193
309
 
310
+ ## 3.6. Handle ADR Ingest Express Path
311
+
312
+ **Skip if:** No `--ingest` flag in arguments.
313
+
314
+ **If `--ingest <path-or-glob>` provided:**
315
+
316
+ 1. Display banner: `SDD ► ADR Ingest Express Path` with `{INGEST_PATH}` and `{INGEST_FORMAT}`.
317
+ 2. Parse each resolved ADR through `sdd/bin/lib/adr-parser.cjs` (`--input`, `--format`) and collect normalized records.
318
+ 3. Status gate: reject `superseded`/`rejected`/`deprecated`; warn on `proposed`; missing status defaults to `accepted`.
319
+ 4. Empty-decisions fallback: if all parsed ADRs have zero `decisions[]`, emit `ADR ingest produced no locked decisions; fall back to discuss-phase for this phase.` and exit with `/sdd:discuss-phase {N}` guidance.
320
+ 5. Generate CONTEXT.md using `<domain>`, `<decisions>`, `<canonical_refs>`, `<specifics>`, `<deferred>`, `<scope_fence>`, map `consequences_positive[]` to Success Criteria and `consequences_negative[]` to Risk Summary, and include `**Source:** ADR Ingest Express Path ({INGEST_PATH})`.
321
+ 6. Commit with `sdd-sdk query commit "docs(${padded_phase}): generate context from ADR ingest" --files "${phase_dir}/${padded_phase}-CONTEXT.md"` and set `context_content`; continue to step 5.
322
+
323
+ **Effect:** This bypasses step 4 (Load CONTEXT.md) since CONTEXT.md was synthesized from ADR input.
324
+
194
325
  ## 4. Load CONTEXT.md
195
326
 
196
- **Skip if:** PRD express path was used (CONTEXT.md already created in step 3.5).
327
+ **Skip if:** PRD express path or ADR ingest express path was used (CONTEXT.md already created in step 3.5/3.6).
197
328
 
198
329
  Check `context_path` from init JSON.
199
330
 
@@ -203,7 +334,7 @@ If `context_path` is not null, display: `Using phase context from: ${context_pat
203
334
 
204
335
  Read discuss mode for context gate label:
205
336
  ```bash
206
- DISCUSS_MODE=$(node "$HOME/.claude/sdd/bin/sdd-tools.cjs" config-get workflow.discuss_mode 2>/dev/null || echo "discuss")
337
+ DISCUSS_MODE=$(sdd-sdk query config-get workflow.discuss_mode 2>/dev/null || echo "discuss")
207
338
  ```
208
339
 
209
340
  If `TEXT_MODE` is true, present as a plain-text numbered list:
@@ -235,9 +366,9 @@ If "Run discuss-phase first":
235
366
  does not work correctly in nested subcontexts (#1009). Instead, display the command
236
367
  and exit so the user runs it as a top-level command:
237
368
  ```
238
- Run this command first, then re-run /sdd-plan-phase {X} ${SDD_WS}:
369
+ Run this command first, then re-run /sdd:plan-phase {X} ${SDD_WS}:
239
370
 
240
- /sdd-discuss-phase {X} ${SDD_WS}
371
+ /sdd:discuss-phase {X} ${SDD_WS}
241
372
  ```
242
373
  **Exit the plan-phase workflow. Do not continue.**
243
374
 
@@ -247,7 +378,7 @@ If "Run discuss-phase first":
247
378
 
248
379
  ```bash
249
380
  AI_SPEC_FILE=$(ls "${PHASE_DIR}"/*-AI-SPEC.md 2>/dev/null | head -1)
250
- AI_PHASE_CFG=$(node "$HOME/.claude/sdd/bin/sdd-tools.cjs" config-get workflow.ai_integration_phase 2>/dev/null || echo "true")
381
+ AI_PHASE_CFG=$(sdd-sdk query config-get workflow.ai_integration_phase 2>/dev/null || echo "true")
251
382
  ```
252
383
 
253
384
  **Skip if `AI_PHASE_CFG` is `false`.**
@@ -260,19 +391,19 @@ echo "${phase_goal}" | grep -qi "agent\|llm\|rag\|chatbot\|embedding\|langchain\
260
391
  **If AI keywords detected AND no AI-SPEC.md:**
261
392
  ```
262
393
  ◆ Note: This phase appears to involve AI system development.
263
- Consider running /sdd-ai-integration-phase {N} before planning to:
394
+ Consider running /sdd:ai-integration-phase {N} before planning to:
264
395
  - Select the right framework for your use case
265
396
  - Research its docs and best practices
266
397
  - Design an evaluation strategy
267
398
 
268
- Continue planning without AI-SPEC? (non-blocking — /sdd-ai-integration-phase can be run after)
399
+ Continue planning without AI-SPEC? (non-blocking — /sdd:ai-integration-phase can be run after)
269
400
  ```
270
401
 
271
402
  Use AskUserQuestion with options:
272
403
  - "Continue — plan without AI-SPEC"
273
- - "Stop — I'll run /sdd-ai-integration-phase {N} first"
404
+ - "Stop — I'll run /sdd:ai-integration-phase {N} first"
274
405
 
275
- If "Stop": Exit with `/sdd-ai-integration-phase {N}` reminder.
406
+ If "Stop": Exit with `/sdd:ai-integration-phase {N}` reminder.
276
407
  If "Continue": Proceed. (Non-blocking — planner will note AI-SPEC is absent.)
277
408
 
278
409
  **If `AI_SPEC_FILE` is non-empty:** Extract framework for planner context:
@@ -285,6 +416,27 @@ Pass `ai_spec_path` and `framework_line` to planner in step 7 so it can referenc
285
416
 
286
417
  **Skip if:** `--gaps` flag or `--skip-research` flag or `--reviews` flag.
287
418
 
419
+ ### 5.0. Research-Only Modifiers (`--view`, `--research`, prompt)
420
+
421
+ **Skip if:** `RESEARCH_ONLY` is `false`.
422
+
423
+ Three branches in research-only mode (`--research-phase <N>`):
424
+
425
+ 1. **`--view`** (or user picks "View" in the prompt below): print `RESEARCH.md` to stdout, no spawn, exit. If `RESEARCH.md` is missing, error with: `--view requires an existing RESEARCH.md; drop --view to spawn the researcher.`
426
+ 2. **`--research`** (force-refresh): re-spawn researcher unconditionally — fall through to "Spawn sdd-phase-researcher" below.
427
+ 3. **Neither flag AND `has_research=true`:** emit `RESEARCH.md already exists for Phase ${PHASE}.` and prompt the user with three choices: `1. Update — re-spawn researcher and refresh RESEARCH.md`, `2. View — print existing RESEARCH.md and exit (no spawn)`, `3. Skip — exit without spawning or printing`. Map "Update" → fall through to spawn, "View" → set `VIEW_ONLY=true` and emit RESEARCH.md as in (1), "Skip" → exit cleanly. Mirrors the deleted `/sdd-research-phase` standalone's existing-artifact menu (#3042 parity).
428
+
429
+ ```bash
430
+ if [[ "$VIEW_ONLY" == "true" ]]; then
431
+ [[ -f "$research_path" ]] || { echo "Error: --view requires an existing RESEARCH.md (Phase ${PHASE}). Drop --view to spawn the researcher."; exit 1; }
432
+ cat "$research_path"; exit 0
433
+ fi
434
+ ```
435
+
436
+ ### 5.1. Standard Research Decision
437
+
438
+ **Skip if** `RESEARCH_ONLY=true` (the research-only mode in 5.0 already determined the path: spawn or exit). Without this guard, an LLM following the workflow could fall through into "use existing, skip to step 6" → planner spawn, violating the research-only contract. **CR #3045 finding: this gate makes the early-exit unreachable from any non-research-only branch.**
439
+
288
440
  **If `has_research` is true (from init) AND no `--research` flag:** Use existing, skip to step 6.
289
441
 
290
442
  **If RESEARCH.md missing OR `--research` flag:**
@@ -333,7 +485,7 @@ Display banner:
333
485
  ### Spawn sdd-phase-researcher
334
486
 
335
487
  ```bash
336
- PHASE_DESC=$(node "$HOME/.claude/sdd/bin/sdd-tools.cjs" roadmap get-phase "${PHASE}" --pick section)
488
+ PHASE_DESC=$(sdd-sdk query roadmap.get-phase "${PHASE}" --pick section)
337
489
  ```
338
490
 
339
491
  Research prompt:
@@ -345,7 +497,7 @@ Answer: "What do I need to know to PLAN this phase well?"
345
497
  </objective>
346
498
 
347
499
  <files_to_read>
348
- - {context_path} (USER DECISIONS from /sdd-discuss-phase)
500
+ - {context_path} (USER DECISIONS from /sdd:discuss-phase)
349
501
  - {requirements_path} (Project requirements)
350
502
  - {state_path} (Project decisions and history)
351
503
  </files_to_read>
@@ -366,7 +518,7 @@ Write to: {phase_dir}/{phase_num}-RESEARCH.md
366
518
  ```
367
519
 
368
520
  ```
369
- Task(
521
+ Agent(
370
522
  prompt=research_prompt,
371
523
  subagent_type="sdd-phase-researcher",
372
524
  model="{researcher_model}",
@@ -374,11 +526,31 @@ Task(
374
526
  )
375
527
  ```
376
528
 
529
+ > **ORCHESTRATOR RULE — CODEX RUNTIME**: After calling Agent() above, stop working on this task immediately. Do not read more files, edit code, or run tests related to this task while the subagent is active. Wait for the subagent to return its result. This prevents duplicate work, conflicting edits, and wasted context. Only resume when the subagent result is available.
530
+
377
531
  ### Handle Researcher Return
378
532
 
379
533
  - **`## RESEARCH COMPLETE`:** Display confirmation, continue to step 6
380
534
  - **`## RESEARCH BLOCKED`:** Display blocker, offer: 1) Provide context, 2) Skip research, 3) Abort
381
535
 
536
+ ### Research-Only Early Exit (`--research-phase`)
537
+
538
+ **Skip if:** `RESEARCH_ONLY` is `false` (the default).
539
+
540
+ **If `RESEARCH_ONLY=true`:** the user invoked `/sdd:plan-phase --research-phase <N>` for research-only mode. Do **not** continue to Section 5.5+ (validation strategy, planner, plan-checker, verification, gaps, bounce, post-planning-gaps). Print the research-complete summary and exit cleanly:
541
+
542
+ ```text
543
+ ✓ Research-only mode complete (#3042)
544
+
545
+ Phase: ${PHASE}
546
+ RESEARCH.md: ${research_path}
547
+
548
+ Re-run /sdd:plan-phase ${PHASE} to plan the phase using this research,
549
+ or /sdd:plan-phase ${PHASE} --research to refresh research and plan.
550
+ ```
551
+
552
+ This exits the workflow. The planner / plan-checker / verifier blocks below are skipped.
553
+
382
554
  ## 5.5. Create Validation Strategy
383
555
 
384
556
  Skip if `nyquist_validation_enabled` is false OR `research_enabled` is false.
@@ -414,9 +586,9 @@ test -f "${PHASE_DIR}/${PADDED_PHASE}-VALIDATION.md" && echo "VALIDATION_CREATED
414
586
  > Skip if `workflow.security_enforcement` is explicitly `false`. Absent = enabled.
415
587
 
416
588
  ```bash
417
- SECURITY_CFG=$(node "$HOME/.claude/sdd/bin/sdd-tools.cjs" config-get workflow.security_enforcement --raw 2>/dev/null || echo "true")
418
- SECURITY_ASVS=$(node "$HOME/.claude/sdd/bin/sdd-tools.cjs" config-get workflow.security_asvs_level --raw 2>/dev/null || echo "1")
419
- SECURITY_BLOCK=$(node "$HOME/.claude/sdd/bin/sdd-tools.cjs" config-get workflow.security_block_on --raw 2>/dev/null || echo "high")
589
+ SECURITY_CFG=$(sdd-sdk query config-get workflow.security_enforcement --raw 2>/dev/null || echo "true")
590
+ SECURITY_ASVS=$(sdd-sdk query config-get workflow.security_asvs_level --raw 2>/dev/null || echo "1")
591
+ SECURITY_BLOCK=$(sdd-sdk query config-get workflow.security_block_on --raw 2>/dev/null || echo "high")
420
592
  ```
421
593
 
422
594
  **If `SECURITY_CFG` is `false`:** Skip to step 5.6.
@@ -440,8 +612,8 @@ Continue to step 5.6. Security config is passed to the planner in step 8.
440
612
  > Skip if `workflow.ui_phase` is explicitly `false` AND `workflow.ui_safety_gate` is explicitly `false` in `.planning/config.json`. If keys are absent, treat as enabled.
441
613
 
442
614
  ```bash
443
- UI_PHASE_CFG=$(node "$HOME/.claude/sdd/bin/sdd-tools.cjs" config-get workflow.ui_phase 2>/dev/null || echo "true")
444
- UI_GATE_CFG=$(node "$HOME/.claude/sdd/bin/sdd-tools.cjs" config-get workflow.ui_safety_gate 2>/dev/null || echo "true")
615
+ UI_PHASE_CFG=$(sdd-sdk query config-get workflow.ui_phase 2>/dev/null || echo "true")
616
+ UI_GATE_CFG=$(sdd-sdk query config-get workflow.ui_safety_gate 2>/dev/null || echo "true")
445
617
  ```
446
618
 
447
619
  **If both are `false`:** Skip to step 6.
@@ -449,7 +621,7 @@ UI_GATE_CFG=$(node "$HOME/.claude/sdd/bin/sdd-tools.cjs" config-get workflow.ui_
449
621
  Check if phase has frontend indicators:
450
622
 
451
623
  ```bash
452
- PHASE_SECTION=$(node "$HOME/.claude/sdd/bin/sdd-tools.cjs" roadmap get-phase "${PHASE}" 2>/dev/null)
624
+ PHASE_SECTION=$(sdd-sdk query roadmap.get-phase "${PHASE}" 2>/dev/null)
453
625
  echo "$PHASE_SECTION" | grep -iE "UI|interface|frontend|component|layout|page|screen|view|form|dashboard|widget" > /dev/null 2>&1
454
626
  HAS_UI=$?
455
627
  ```
@@ -467,9 +639,9 @@ UI_SPEC_FILE=$(ls "${PHASE_DIR}"/*-UI-SPEC.md 2>/dev/null | head -1)
467
639
 
468
640
  **If UI-SPEC.md missing AND `UI_GATE_CFG` is `true`:**
469
641
 
470
- Read auto-chain state:
642
+ Read ephemeral chain flag (same field as `check.auto-mode` → `auto_chain_active`):
471
643
  ```bash
472
- AUTO_CHAIN=$(node "$HOME/.claude/sdd/bin/sdd-tools.cjs" config-get workflow._auto_chain_active 2>/dev/null || echo "false")
644
+ AUTO_CHAIN=$(sdd-sdk query check auto-mode --pick auto_chain_active 2>/dev/null || echo "false")
473
645
  ```
474
646
 
475
647
  **If `AUTO_CHAIN` is `true` (running inside a `--chain` or `--auto` pipeline):**
@@ -492,10 +664,10 @@ Output this markdown directly (not as a code block):
492
664
  ```
493
665
  ## ⚠ UI-SPEC.md missing for Phase {N}
494
666
  ▶ Recommended next step:
495
- `/sdd-ui-phase {N} ${SDD_WS}` — generate UI design contract before planning
667
+ `/sdd:ui-phase {N} ${SDD_WS}` — generate UI design contract before planning
496
668
  ───────────────────────────────────────────────
497
669
  Also available:
498
- - `/sdd-plan-phase {N} --skip-ui ${SDD_WS}` — plan without UI-SPEC (not recommended for frontend phases)
670
+ - `/sdd:plan-phase {N} --skip-ui ${SDD_WS}` — plan without UI-SPEC (not recommended for frontend phases)
499
671
  ```
500
672
 
501
673
  **Exit the plan-phase workflow. Do not continue.**
@@ -509,7 +681,7 @@ Also available:
509
681
  Check if any files in the phase scope match schema patterns:
510
682
 
511
683
  ```bash
512
- PHASE_SECTION=$(node "$HOME/.claude/sdd/bin/sdd-tools.cjs" roadmap get-phase "${PHASE}" --pick section 2>/dev/null)
684
+ PHASE_SECTION=$(sdd-sdk query roadmap.get-phase "${PHASE}" --pick section 2>/dev/null)
513
685
  ```
514
686
 
515
687
  Scan `PHASE_SECTION`, `CONTEXT.md` (if loaded), and `RESEARCH.md` (if exists) for file paths matching these ORM patterns:
@@ -588,6 +760,11 @@ VERIFICATION_PATH=$(_sdd_field "$INIT" verification_path)
588
760
  UAT_PATH=$(_sdd_field "$INIT" uat_path)
589
761
  CONTEXT_PATH=$(_sdd_field "$INIT" context_path)
590
762
  REVIEWS_PATH=$(_sdd_field "$INIT" reviews_path)
763
+ PATTERNS_PATH=$(_sdd_field "$INIT" patterns_path)
764
+
765
+ # Detect spike/sketch findings skills (project-local)
766
+ SPIKE_FINDINGS_PATH=$(ls ./.claude/skills/spike-findings-*/SKILL.md 2>/dev/null | head -1 || true)
767
+ SKETCH_FINDINGS_PATH=$(ls ./.claude/skills/sketch-findings-*/SKILL.md 2>/dev/null | head -1 || true)
591
768
  ```
592
769
 
593
770
  ## 7.5. Verify Nyquist Artifacts
@@ -606,12 +783,73 @@ VALIDATION_EXISTS=$(ls "${PHASE_DIR}"/*-VALIDATION.md 2>/dev/null | head -1)
606
783
  ```
607
784
 
608
785
  If missing and Nyquist is still enabled/applicable — ask user:
609
- 1. Re-run: `/sdd-plan-phase {PHASE} --research ${SDD_WS}`
786
+ 1. Re-run: `/sdd:plan-phase {PHASE} --research ${SDD_WS}`
610
787
  2. Disable Nyquist with the exact command:
611
- `node "$HOME/.claude/sdd/bin/sdd-tools.cjs" config-set workflow.nyquist_validation false`
788
+ `sdd-sdk query config-set workflow.nyquist_validation false`
612
789
  3. Continue anyway (plans fail Dimension 8)
613
790
 
614
- Proceed to Step 8 only if user selects 2 or 3.
791
+ Proceed to Step 7.8 (or Step 8 if pattern mapper is disabled) only if user selects 2 or 3.
792
+
793
+ ## 7.8. Spawn sdd-pattern-mapper Agent (Optional)
794
+
795
+ **Skip if** `workflow.pattern_mapper` is explicitly set to `false` in config.json (absent key = enabled). Also skip if no CONTEXT.md and no RESEARCH.md exist for this phase (nothing to extract file lists from).
796
+
797
+ Check config:
798
+ ```bash
799
+ PATTERN_MAPPER_CFG=$(sdd-sdk query config-get workflow.pattern_mapper 2>/dev/null || echo "true")
800
+ ```
801
+
802
+ **If `PATTERN_MAPPER_CFG` is `false`:** Skip to step 8.
803
+
804
+ **If PATTERNS.md already exists** (`PATTERNS_PATH` is non-empty from step 7): Skip to step 8 (use existing).
805
+
806
+ Display banner:
807
+ ```
808
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
809
+ SDD ► PATTERN MAPPING PHASE {X}
810
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
811
+
812
+ ◆ Spawning pattern mapper...
813
+ ```
814
+
815
+ Pattern mapper prompt:
816
+
817
+ ```markdown
818
+ <pattern_mapping_context>
819
+ **Phase:** {phase_number} - {phase_name}
820
+ **Phase directory:** {phase_dir}
821
+ **Padded phase:** {padded_phase}
822
+
823
+ <files_to_read>
824
+ - {context_path} (USER DECISIONS from /sdd:discuss-phase)
825
+ - {research_path} (Technical Research)
826
+ </files_to_read>
827
+
828
+ **Output file:** {phase_dir}/{padded_phase}-PATTERNS.md
829
+
830
+ Extract the list of files to be created/modified from CONTEXT.md and RESEARCH.md. For each file, classify by role and data flow, find the closest existing analog in the codebase, extract concrete code excerpts, and produce PATTERNS.md.
831
+ </pattern_mapping_context>
832
+ ```
833
+
834
+ Spawn with:
835
+ ```
836
+ Agent(
837
+ prompt="{above}",
838
+ subagent_type="sdd-pattern-mapper",
839
+ model="{researcher_model}",
840
+ )
841
+ ```
842
+
843
+ > **ORCHESTRATOR RULE — CODEX RUNTIME**: After calling Agent() above, stop working on this task immediately. Do not read more files, edit code, or run tests related to this task while the subagent is active. Wait for the subagent to return its result. This prevents duplicate work, conflicting edits, and wasted context. Only resume when the subagent result is available.
844
+
845
+ **Handle return:**
846
+ - **`## PATTERN MAPPING COMPLETE`:** Update `PATTERNS_PATH` to the created file path, continue to step 8.
847
+ - **Any error or empty return:** Log warning, continue to step 8 without patterns (non-blocking).
848
+
849
+ After pattern mapper completes, update the path variable:
850
+ ```bash
851
+ PATTERNS_PATH="${PHASE_DIR}/${PADDED_PHASE}-PATTERNS.md"
852
+ ```
615
853
 
616
854
  ## 8. Spawn sdd-planner Agent
617
855
 
@@ -635,16 +873,22 @@ Planner prompt:
635
873
  - {state_path} (Project State)
636
874
  - {roadmap_path} (Roadmap)
637
875
  - {requirements_path} (Requirements)
638
- - {context_path} (USER DECISIONS from /sdd-discuss-phase)
876
+ - {context_path} (USER DECISIONS from /sdd:discuss-phase)
639
877
  - {research_path} (Technical Research)
878
+ - {PATTERNS_PATH} (Pattern Map — analog files and code excerpts, if exists)
640
879
  - {verification_path} (Verification Gaps - if --gaps)
641
880
  - {uat_path} (UAT Gaps - if --gaps)
642
881
  - {reviews_path} (Cross-AI Review Feedback - if --reviews)
643
882
  - {UI_SPEC_PATH} (UI Design Contract — visual/interaction specs, if exists)
883
+ - {SPIKE_FINDINGS_PATH} (Spike Findings — validated patterns, constraints, landmines from experiments, if exists)
884
+ - {SKETCH_FINDINGS_PATH} (Sketch Findings — validated design decisions, CSS patterns, visual direction, if exists)
644
885
  ${CONTEXT_WINDOW >= 500000 ? `
645
886
  **Cross-phase context (1M model enrichment):**
646
- - Prior phase CONTEXT.md files (locked decisions from earlier phases — maintain consistency)
647
- - Prior phase SUMMARY.md files (what was actually built — reuse patterns, avoid duplication)
887
+ - CONTEXT.md files from the 3 most recent completed phases (locked decisions — maintain consistency)
888
+ - SUMMARY.md files from the 3 most recent completed phases (what was built — reuse patterns, avoid duplication)
889
+ - LEARNINGS.md files from the 3 most recent completed phases (structured decisions, patterns, lessons, surprises — skip silently if a phase has no LEARNINGS.md; prefix each block with \`[from Phase N LEARNINGS]\` for source attribution; if total size exceeds 15% of context budget, drop oldest first)
890
+ - CONTEXT.md, SUMMARY.md, and LEARNINGS.md from any phases listed in the current phase's "Depends on:" field in ROADMAP.md (regardless of recency — explicit dependencies always load, deduplicated against the 3 most recent)
891
+ - Skip all other prior phases to stay within context budget
648
892
  ` : ''}
649
893
  </files_to_read>
650
894
 
@@ -655,10 +899,29 @@ ${AGENT_SKILLS_PLANNER}
655
899
  **Project instructions:** Read ./CLAUDE.md if exists — follow project-specific guidelines
656
900
  **Project skills:** Check .claude/skills/ or .agents/skills/ directory (if either exists) — read SKILL.md files, plans should account for project skill rules
657
901
 
902
+ ${TDD_MODE === 'true' ? `
903
+ <tdd_mode_active>
904
+ **TDD Mode is ENABLED.** Apply TDD heuristics from @~/.claude/sdd/references/tdd.md to all eligible tasks:
905
+ - Business logic with defined I/O → type: tdd
906
+ - API endpoints with request/response contracts → type: tdd
907
+ - Data transformations, validation, algorithms → type: tdd
908
+ - UI, config, glue code, CRUD → standard plan (type: execute)
909
+ Each TDD plan gets one feature with RED/GREEN/REFACTOR gate sequence.
910
+ </tdd_mode_active>
911
+ ` : ''}
912
+
913
+ **MVP_MODE:** ${MVP_MODE} (when true, follow vertical-slice rules from `@~/.claude/sdd/references/planner-mvp-mode.md`; when false, ignore MVP guidance entirely.)
914
+ **WALKING_SKELETON:** ${WALKING_SKELETON} (when true, the first deliverable must be a Walking Skeleton — produce SKELETON.md alongside PLAN.md.)
915
+
916
+ ${MVP_MODE === 'true' ? `
917
+ <mvp_mode_active>
918
+ **MVP Mode is ENABLED.** Follow vertical-slice planning rules from @~/.claude/sdd/references/planner-mvp-mode.md. Each plan must deliver a complete vertical slice — thin end-to-end functionality rather than horizontal layers.
919
+ </mvp_mode_active>
920
+ ` : ''}
658
921
  </planning_context>
659
922
 
660
923
  <downstream_consumer>
661
- Output consumed by /sdd-execute-phase. Plans need:
924
+ Output consumed by /sdd:execute-phase. Plans need:
662
925
  - Frontmatter (wave, depends_on, files_modified, autonomous)
663
926
  - Tasks in XML format with read_first and acceptance_criteria fields (MANDATORY on every task)
664
927
  - Verification criteria
@@ -676,22 +939,24 @@ Every task MUST include these fields — they are NOT optional:
676
939
  - Any file whose patterns, signatures, types, or conventions must be replicated or respected
677
940
 
678
941
  2. **`<acceptance_criteria>`** — Verifiable conditions that prove the task was done correctly. Rules:
679
- - Every criterion must be checkable with grep, file read, test command, or CLI output
942
+ - Every criterion must be checkable as a source assertion, behavior assertion, test command, or CLI output
680
943
  - NEVER use subjective language ("looks correct", "properly configured", "consistent with")
681
- - ALWAYS include exact strings, patterns, values, or command outputs that must be present
944
+ - Include exact strings, patterns, values, command outputs, or observable behavior where that is the right proof
682
945
  - Examples:
683
946
  - Code: `auth.py contains def verify_token(` / `test_auth.py exits 0`
947
+ - Behavior: `POST /api/auth/login returns 200 + httpOnly JWT cookie for valid credentials`
684
948
  - Config: `.env.example contains DATABASE_URL=` / `Dockerfile contains HEALTHCHECK`
685
949
  - Docs: `README.md contains '## Installation'` / `API.md lists all endpoints`
686
950
  - Infra: `deploy.yml has rollback step` / `docker-compose.yml has healthcheck for db`
687
951
 
688
952
  3. **`<action>`** — Must include CONCRETE values, not references. Rules:
689
953
  - NEVER say "align X with Y", "match X to Y", "update to be consistent" without specifying the exact target state
690
- - ALWAYS include the actual values: config keys, function signatures, SQL statements, class names, import paths, env vars, etc.
691
- - If CONTEXT.md has a comparison table or expected values, copy them into the action verbatim
692
- - The executor should be able to complete the task from the action text alone, without needing to read CONTEXT.md or reference files (read_first is for verification, not discovery)
954
+ - Include concrete identifiers and reference values: config keys, function signatures, SQL table names, class names, import paths, env vars, endpoint paths, etc.
955
+ - If CONTEXT.md has a comparison table or expected values, copy only the target identifiers/values needed to remove ambiguity
956
+ - Do not include full file contents, fenced code blocks, or complete implementations in `<action>`
957
+ - The executor should understand the intended target state from `<action>` and use `<read_first>` files for current implementation details, patterns, and source-of-truth context
693
958
 
694
- **Why this matters:** Executor agents work from the plan text. Vague instructions like "update the config to match production" produce shallow one-line changes. Concrete instructions like "add DATABASE_URL=postgresql://... , set POOL_SIZE=20, add REDIS_URL=redis://..." produce complete work. The cost of verbose plans is far less than the cost of re-doing shallow execution.
959
+ **Why this matters:** Executor agents work from the plan text. Vague instructions like "update the config to match production" produce shallow one-line changes. Concrete instructions like "add DATABASE_URL, set POOL_SIZE=20, add REDIS_URL, and read config/runtime.ts before editing" produce complete work without turning the planner into the executor.
695
960
  </deep_work_rules>
696
961
 
697
962
  <quality_gate>
@@ -699,16 +964,18 @@ Every task MUST include these fields — they are NOT optional:
699
964
  - [ ] Each plan has valid frontmatter
700
965
  - [ ] Tasks are specific and actionable
701
966
  - [ ] Every task has `<read_first>` with at least the file being modified
702
- - [ ] Every task has `<acceptance_criteria>` with grep-verifiable conditions
703
- - [ ] Every `<action>` contains concrete values (no "align X with Y" without specifying what)
967
+ - [ ] Every task has `<acceptance_criteria>` with behavior, test-command, CLI, or source assertions
968
+ - [ ] Every `<action>` contains concrete identifiers without fenced code blocks or full implementations
704
969
  - [ ] Dependencies correctly identified
705
970
  - [ ] Waves assigned for parallel execution
706
971
  - [ ] must_haves derived from phase goal
707
972
  </quality_gate>
708
973
  ```
709
974
 
710
- ```
711
- Task(
975
+ **If `CHUNKED_MODE` is `false` (default):** Spawn the planner as a single long-lived Agent:
976
+
977
+ ```text
978
+ Agent(
712
979
  prompt=filled_prompt,
713
980
  subagent_type="sdd-planner",
714
981
  model="{planner_model}",
@@ -716,44 +983,214 @@ Task(
716
983
  )
717
984
  ```
718
985
 
986
+ > **ORCHESTRATOR RULE — CODEX RUNTIME**: After calling Agent() above, stop working on this task immediately. Do not read more files, edit code, or run tests related to this task while the subagent is active. Wait for the subagent to return its result. This prevents duplicate work, conflicting edits, and wasted context. Only resume when the subagent result is available.
987
+
988
+ **If `CHUNKED_MODE` is `true`:** Skip the Agent() call above — proceed to step 8.5 instead.
989
+
990
+ ## 8.5. Chunked Planning Mode
991
+
992
+ **Skip if `CHUNKED_MODE` is `false`.**
993
+
994
+ Chunked mode splits the single long-lived planner Agent run into a short outline Agent run followed by
995
+ N short per-plan Agent runs. Each run is bounded to ~3–5 min; each plan is committed individually
996
+ for crash resilience. If any run hangs and the terminal is force-killed, rerunning
997
+ `/sdd:plan-phase {N} --chunked` resumes from the last successfully committed plan.
998
+
999
+ **Intended for new or in-progress chunked runs.** To recover plans already written by a prior
1000
+ *non-chunked* run, use step 6's "Add more plans" or proceed directly to `/sdd:execute-phase`
1001
+ — don't start a fresh chunked run over existing non-chunked plans.
1002
+
1003
+ ### 8.5.1 Outline Phase (outline-only mode, ~2 min)
1004
+
1005
+ **Resume detection:** If `${PHASE_DIR}/${PADDED_PHASE}-PLAN-OUTLINE.md` already exists **and
1006
+ is valid** (contains the `## OUTLINE COMPLETE` marker), skip this sub-step — the outline
1007
+ already exists from a previous run. Proceed directly to 8.5.2.
1008
+
1009
+ ```bash
1010
+ OUTLINE_FILE="${PHASE_DIR}/${PADDED_PHASE}-PLAN-OUTLINE.md"
1011
+ if [[ -f "$OUTLINE_FILE" ]] && grep -q "^## OUTLINE COMPLETE" "$OUTLINE_FILE"; then
1012
+ # reuse existing outline — skip to 8.5.2
1013
+ fi
1014
+ ```
1015
+
1016
+ Display:
1017
+ ```text
1018
+ ◆ Chunked mode: spawning outline planner...
1019
+ ```
1020
+
1021
+ Spawn the planner in **outline-only** mode — it must write only the outline manifest, not any
1022
+ PLAN.md files:
1023
+
1024
+ ```javascript
1025
+ Agent(
1026
+ prompt="{same planning_context as step 8, plus:}
1027
+
1028
+ **Chunked mode: outline-only.**
1029
+ Do NOT write any PLAN.md files in this Task.
1030
+ Write only: {PHASE_DIR}/{PADDED_PHASE}-PLAN-OUTLINE.md
1031
+
1032
+ The outline must be a markdown table with columns:
1033
+ Plan ID | Objective | Wave | Depends On | Requirements
1034
+
1035
+ Return: ## OUTLINE COMPLETE with plan count.",
1036
+ subagent_type="sdd-planner",
1037
+ model="{planner_model}",
1038
+ description="Outline Phase {phase} (chunked)"
1039
+ )
1040
+ ```
1041
+
1042
+ > **ORCHESTRATOR RULE — CODEX RUNTIME**: After calling Agent() above, stop working on this task immediately. Do not read more files, edit code, or run tests related to this task while the subagent is active. Wait for the subagent to return its result. This prevents duplicate work, conflicting edits, and wasted context. Only resume when the subagent result is available.
1043
+
1044
+ Handle return:
1045
+ - **`## OUTLINE COMPLETE`:** Read `PLAN-OUTLINE.md`, extract plan list. Continue to 8.5.2.
1046
+ - **Any other return or empty:** Display error. Offer: 1) Retry outline, 2) Stop.
1047
+
1048
+ ### 8.5.2 Per-Plan Tasks (single-plan mode, ~3-5 min each)
1049
+
1050
+ For each plan entry extracted from `PLAN-OUTLINE.md`:
1051
+
1052
+ 1. **Resume check:** If `${PHASE_DIR}/{plan_id}-PLAN.md` already exists on disk **and has
1053
+ valid YAML frontmatter** (opening `---` delimiter present), skip this plan (do not
1054
+ overwrite completed work — resume safety).
1055
+
1056
+ ```bash
1057
+ PLAN_FILE="${PHASE_DIR}/${plan_id}-PLAN.md"
1058
+ if [[ -f "$PLAN_FILE" ]] && head -1 "$PLAN_FILE" | grep -q '^---'; then
1059
+ continue # plan already written, skip
1060
+ fi
1061
+ ```
1062
+
1063
+ 2. Display:
1064
+ ```text
1065
+ ◆ Chunked mode: planning {plan_id} ({k}/{N})...
1066
+ ```
1067
+
1068
+ 3. Spawn the planner in **single-plan** mode — it must write exactly one PLAN.md file:
1069
+ ```javascript
1070
+ Agent(
1071
+ prompt="{same planning_context as step 8, plus:}
1072
+
1073
+ **Chunked mode: single-plan.**
1074
+ Write exactly ONE plan file: {PHASE_DIR}/{plan_id}-PLAN.md
1075
+ Plan to write: {plan_id} — {objective}
1076
+ Wave: {wave} | Depends on: {depends_on}
1077
+ Phase requirement IDs to cover in this plan: {plan_requirements}
1078
+
1079
+ Return: ## PLAN COMPLETE with the plan ID.",
1080
+ subagent_type="sdd-planner",
1081
+ model="{planner_model}",
1082
+ description="Plan {plan_id} (chunked {k}/{N})"
1083
+ )
1084
+ ```
1085
+
1086
+ > **ORCHESTRATOR RULE — CODEX RUNTIME**: After calling Agent() above, stop working on this task immediately. Do not read more files, edit code, or run tests related to this task while the subagent is active. Wait for the subagent to return its result. This prevents duplicate work, conflicting edits, and wasted context. Only resume when the subagent result is available.
1087
+
1088
+ 4. **Verify disk:** Check `${PHASE_DIR}/{plan_id}-PLAN.md` exists. If missing: offer 1) Retry, 2) Stop.
1089
+
1090
+ 5. **Commit per-plan:**
1091
+ ```bash
1092
+ sdd-sdk query commit "docs(${PADDED_PHASE}): plan ${plan_id} (chunked)" --files "${PHASE_DIR}/${plan_id}-PLAN.md"
1093
+ ```
1094
+
1095
+ After all N plans are written and committed, treat this as `## PLANNING COMPLETE` and continue
1096
+ to step 9.
1097
+
719
1098
  ## 9. Handle Planner Return
720
1099
 
721
1100
  - **`## PLANNING COMPLETE`:** Display plan count. If `--skip-verify` or `plan_checker_enabled` is false (from init): skip to step 13. Otherwise: step 10.
722
- - **`## PHASE SPLIT RECOMMENDED`:** The planner determined the phase is too complex to implement all user decisions without simplifying them. Handle in step 9b.
1101
+ - **`## PHASE SPLIT RECOMMENDED`:** The planner determined the phase exceeds the context budget for full-fidelity implementation of all source items. Handle in step 9b.
1102
+ - **`## ⚠ Source Audit: Unplanned Items Found`:** The planner's multi-source coverage audit found items from REQUIREMENTS.md, RESEARCH.md, ROADMAP goal, or CONTEXT.md decisions that are not covered by any plan. Handle in step 9c.
723
1103
  - **`## CHECKPOINT REACHED`:** Present to user, get response, spawn continuation (step 12)
724
1104
  - **`## PLANNING INCONCLUSIVE`:** Show attempts, offer: Add context / Retry / Manual
1105
+ - **Empty / truncated / no recognized marker:** → Filesystem fallback (step 9a).
1106
+
1107
+ ## 9a. Filesystem Fallback (Planner)
1108
+
1109
+ **Triggered when:** Agent() returns but the return contains no recognized marker (`## PLANNING COMPLETE`, `## PHASE SPLIT RECOMMENDED`, `## ⚠ Source Audit`, `## CHECKPOINT REACHED`, `## PLANNING INCONCLUSIVE`).
1110
+
1111
+ ```bash
1112
+ DISK_PLANS=$(ls "${PHASE_DIR}"/*-PLAN.md 2>/dev/null | wc -l | tr -d ' ')
1113
+ ```
1114
+
1115
+ **If `DISK_PLANS` > 0:** The planner wrote plans to disk but the Agent() return was empty or
1116
+ truncated (the Windows stdio hang pattern — the subagent finished but the return never
1117
+ arrived). Display:
1118
+
1119
+ ```text
1120
+ ◆ Planner wrote {DISK_PLANS} plan(s) to disk but did not emit a PLANNING COMPLETE marker.
1121
+ This is a known Windows stdio hang pattern — work is likely recoverable.
1122
+
1123
+ Plans found on disk:
1124
+ {ls output of *-PLAN.md}
1125
+ ```
1126
+
1127
+ Offer 3 options:
1128
+ 1. **Accept plans** — treat as `## PLANNING COMPLETE` and continue through step 9 `## PLANNING COMPLETE` handling (so `--skip-verify` / `plan_checker_enabled=false` are honored — may skip to step 13 rather than step 10)
1129
+ 2. **Retry planner** — re-spawn the planner with the same prompt (return to step 8)
1130
+ 3. **Stop** — exit; user can re-run `/sdd:plan-phase {N}` to resume
1131
+
1132
+ **If `DISK_PLANS` is 0 and no marker:** The planner produced no output. Treat as
1133
+ `## PLANNING INCONCLUSIVE` and handle accordingly.
725
1134
 
726
1135
  ## 9b. Handle Phase Split Recommendation
727
1136
 
728
- When the planner returns `## PHASE SPLIT RECOMMENDED`, it means the phase has too many decisions to implement at full fidelity within the plan budget. The planner proposes groupings.
1137
+ When the planner returns `## PHASE SPLIT RECOMMENDED`, it means the phase's source items exceed the context budget for full-fidelity implementation. The planner proposes groupings.
729
1138
 
730
1139
  **Extract from planner return:**
731
1140
  - Proposed sub-phases (e.g., "17a: processing core (D-01 to D-19)", "17b: billing + config UX (D-20 to D-27)")
732
- - Which D-XX decisions go in each sub-phase
733
- - Why the split is necessary (decision count, complexity estimate)
1141
+ - Which source items (REQ-IDs, D-XX decisions, RESEARCH items) go in each sub-phase
1142
+ - Why the split is necessary (context cost estimate, file count)
734
1143
 
735
1144
  **Present to user:**
736
1145
  ```
737
- ## Phase {X} is too complex for full-fidelity implementation
1146
+ ## Phase {X} exceeds context budget for full-fidelity implementation
738
1147
 
739
- The planner found {N} decisions that cannot all be implemented without
740
- simplifying some. Instead of reducing your decisions, we recommend splitting:
1148
+ The planner found {N} source items that exceed the context budget when
1149
+ planned at full fidelity. Instead of reducing scope, we recommend splitting:
741
1150
 
742
1151
  **Option 1: Split into sub-phases**
743
- - Phase {X}a: {name} — {D-XX to D-YY} ({N} decisions)
744
- - Phase {X}b: {name} — {D-XX to D-YY} ({M} decisions)
1152
+ - Phase {X}a: {name} — {items} ({N} source items, ~{P}% context)
1153
+ - Phase {X}b: {name} — {items} ({M} source items, ~{Q}% context)
745
1154
 
746
- **Option 2: Proceed anyway** (planner will attempt all, quality may degrade)
1155
+ **Option 2: Proceed anyway** (planner will attempt all, quality may degrade past 50% context)
747
1156
 
748
- **Option 3: Prioritize** — you choose which decisions to implement now,
1157
+ **Option 3: Prioritize** — you choose which items to implement now,
749
1158
  rest become a follow-up phase
750
1159
  ```
751
1160
 
752
1161
  Use AskUserQuestion with these 3 options.
753
1162
 
754
- **If "Split":** Use `/sdd-insert-phase` to create the sub-phases, then replan each.
755
- **If "Proceed":** Return to planner with instruction to attempt all decisions at full fidelity, accepting more plans/tasks.
756
- **If "Prioritize":** Use AskUserQuestion (multiSelect) to let user pick which D-XX are "now" vs "later". Create CONTEXT.md for each sub-phase with the selected decisions.
1163
+ **If "Split":** Use `/sdd:phase --insert` to create the sub-phases, then replan each.
1164
+ **If "Proceed":** Return to planner with instruction to attempt all items at full fidelity, accepting more plans/tasks.
1165
+ **If "Prioritize":** Use AskUserQuestion (multiSelect) to let user pick which items are "now" vs "later". Create CONTEXT.md for each sub-phase with the selected items.
1166
+
1167
+ ## 9c. Handle Source Audit Gaps
1168
+
1169
+ When the planner returns `## ⚠ Source Audit: Unplanned Items Found`, it means items from REQUIREMENTS.md, RESEARCH.md, ROADMAP goal, or CONTEXT.md decisions have no corresponding plan.
1170
+
1171
+ **Extract from planner return:**
1172
+ - Each unplanned item with its source artifact and section
1173
+ - The planner's suggested options (A: add plan, B: split phase, C: defer with confirmation)
1174
+
1175
+ **Present each gap to user.** For each unplanned item:
1176
+
1177
+ ```
1178
+ ## ⚠ Unplanned: {item description}
1179
+
1180
+ Source: {RESEARCH.md / REQUIREMENTS.md / ROADMAP goal / CONTEXT.md}
1181
+ Details: {why the planner flagged this}
1182
+
1183
+ Options:
1184
+ 1. Add a plan to cover this item (recommended)
1185
+ 2. Split phase — move to a sub-phase with related items
1186
+ 3. Defer — add to backlog (developer confirms this is intentional)
1187
+ ```
1188
+
1189
+ Use AskUserQuestion for each gap (or batch if multiple gaps).
1190
+
1191
+ **If "Add plan":** Return to planner (step 8) with instruction to add plans covering the missing items, preserving existing plans.
1192
+ **If "Split":** Use `/sdd:phase --insert` for overflow items, then replan.
1193
+ **If "Defer":** Record in CONTEXT.md `## Deferred Ideas` with developer's confirmation. Proceed to step 10.
757
1194
 
758
1195
  ## 10. Spawn sdd-plan-checker Agent
759
1196
 
@@ -777,7 +1214,7 @@ Checker prompt:
777
1214
  - {PHASE_DIR}/*-PLAN.md (Plans to verify)
778
1215
  - {roadmap_path} (Roadmap)
779
1216
  - {requirements_path} (Requirements)
780
- - {context_path} (USER DECISIONS from /sdd-discuss-phase)
1217
+ - {context_path} (USER DECISIONS from /sdd:discuss-phase)
781
1218
  - {research_path} (Technical Research — includes Validation Architecture)
782
1219
  </files_to_read>
783
1220
 
@@ -796,7 +1233,7 @@ ${AGENT_SKILLS_CHECKER}
796
1233
  ```
797
1234
 
798
1235
  ```
799
- Task(
1236
+ Agent(
800
1237
  prompt=checker_prompt,
801
1238
  subagent_type="sdd-plan-checker",
802
1239
  model="{checker_model}",
@@ -804,10 +1241,13 @@ Task(
804
1241
  )
805
1242
  ```
806
1243
 
1244
+ > **ORCHESTRATOR RULE — CODEX RUNTIME**: After calling Agent() above, stop working on this task immediately. Do not read more files, edit code, or run tests related to this task while the subagent is active. Wait for the subagent to return its result. This prevents duplicate work, conflicting edits, and wasted context. Only resume when the subagent result is available.
1245
+
807
1246
  ## 11. Handle Checker Return
808
1247
 
809
1248
  - **`## VERIFICATION PASSED`:** Display confirmation, proceed to step 13.
810
1249
  - **`## ISSUES FOUND`:** Display issues, check iteration count, proceed to step 12.
1250
+ - **Empty / truncated / no recognized marker:** → Filesystem fallback (step 11a).
811
1251
 
812
1252
  **Thinking partner for architectural tradeoffs (conditional):**
813
1253
  If `features.thinking_partner` is enabled, scan the checker's issues for architectural tradeoff keywords
@@ -828,6 +1268,29 @@ Apply this to the revision? [Yes] / [No, I'll decide]
828
1268
  If yes: include the recommendation in the revision prompt. If no: proceed to revision loop as normal.
829
1269
  If thinking_partner disabled: skip this block entirely.
830
1270
 
1271
+ ## 11a. Filesystem Fallback (Checker)
1272
+
1273
+ **Triggered when:** Checker Agent() returns but the return contains neither `## VERIFICATION PASSED` nor `## ISSUES FOUND`.
1274
+
1275
+ ```bash
1276
+ DISK_PLANS=$(ls "${PHASE_DIR}"/*-PLAN.md 2>/dev/null | wc -l | tr -d ' ')
1277
+ ```
1278
+
1279
+ **If `DISK_PLANS` > 0:** Plans exist on disk; the checker return was empty or truncated (the
1280
+ Windows stdio hang pattern — the subagent finished but the return never arrived). Display:
1281
+
1282
+ ```text
1283
+ ◆ Checker return was empty or truncated. {DISK_PLANS} plan(s) exist on disk.
1284
+ This is a known Windows stdio hang pattern — checker may have completed without returning.
1285
+ ```
1286
+
1287
+ Offer 3 options:
1288
+ 1. **Accept verification** — treat as `## VERIFICATION PASSED` and continue to step 13
1289
+ 2. **Retry checker** — re-spawn the checker with the same prompt (return to step 10)
1290
+ 3. **Stop** — exit; user can re-run `/sdd:plan-phase {N}` to resume
1291
+
1292
+ **If `DISK_PLANS` is 0:** No plans on disk — something is seriously wrong. Display error and stop.
1293
+
831
1294
  ## 12. Revision Loop (Max 3 Iterations)
832
1295
 
833
1296
  Track `iteration_count` (starts at 1 after initial plan + check).
@@ -853,7 +1316,7 @@ Display: `Revision iteration {N}/3 -- {blocker_count} blockers, {warning_count}
853
1316
  **If `stall_reentry_count >= 2`:**
854
1317
  Display: `Stall persists after 2 re-planning attempts. The following issues could not be resolved automatically:`
855
1318
  List the remaining issues from the checker.
856
- Suggest: "Consider resolving these issues manually or running `/sdd-debug` to investigate root causes."
1319
+ Suggest: "Consider resolving these issues manually or running `/sdd:debug` to investigate root causes."
857
1320
  Options: "Proceed anyway" | "Abandon"
858
1321
  If "Proceed anyway": accept current plans and continue to step 13.
859
1322
  If "Abandon": stop workflow.
@@ -869,7 +1332,7 @@ Revision prompt:
869
1332
 
870
1333
  <files_to_read>
871
1334
  - {PHASE_DIR}/*-PLAN.md (Existing plans)
872
- - {context_path} (USER DECISIONS from /sdd-discuss-phase)
1335
+ - {context_path} (USER DECISIONS from /sdd:discuss-phase)
873
1336
  </files_to_read>
874
1337
 
875
1338
  ${AGENT_SKILLS_PLANNER}
@@ -885,7 +1348,7 @@ Return what changed.
885
1348
  ```
886
1349
 
887
1350
  ```
888
- Task(
1351
+ Agent(
889
1352
  prompt=revision_prompt,
890
1353
  subagent_type="sdd-planner",
891
1354
  model="{planner_model}",
@@ -893,6 +1356,8 @@ Task(
893
1356
  )
894
1357
  ```
895
1358
 
1359
+ > **ORCHESTRATOR RULE — CODEX RUNTIME**: After calling Agent() above, stop working on this task immediately. Do not read more files, edit code, or run tests related to this task while the subagent is active. Wait for the subagent to return its result. This prevents duplicate work, conflicting edits, and wasted context. Only resume when the subagent result is available.
1360
+
896
1361
  After planner returns -> spawn checker again (step 10), increment iteration_count.
897
1362
 
898
1363
  **If iteration_count >= 3:**
@@ -901,6 +1366,77 @@ Display: `Max iterations reached. {N} issues remain:` + issue list
901
1366
 
902
1367
  Offer: 1) Force proceed, 2) Provide guidance and retry, 3) Abandon
903
1368
 
1369
+ ## 12.5. Plan Bounce (Optional External Refinement)
1370
+
1371
+ **Skip if:** `--skip-bounce` flag, `--gaps` flag, or bounce is not activated.
1372
+
1373
+ **Activation:** Bounce runs when `--bounce` flag is present OR `workflow.plan_bounce` config is `true`. The `--skip-bounce` flag always wins (disables bounce even if config enables it). The `--gaps` flag also disables bounce (gap-closure mode should not modify plans externally).
1374
+
1375
+ **Prerequisites:** `workflow.plan_bounce_script` must be set to a valid script path. If bounce is activated but no script is configured, display warning and skip:
1376
+ ```
1377
+ ⚠ Plan bounce activated but no script configured.
1378
+ Set workflow.plan_bounce_script to the path of your refinement script.
1379
+ Skipping bounce step.
1380
+ ```
1381
+
1382
+ **Read pass count:**
1383
+ ```bash
1384
+ BOUNCE_PASSES=$(sdd-sdk query config-get workflow.plan_bounce_passes 2>/dev/null || echo "2")
1385
+ BOUNCE_SCRIPT=$(sdd-sdk query config-get workflow.plan_bounce_script 2>/dev/null | jq -r '.' 2>/dev/null || true)
1386
+ ```
1387
+
1388
+ Display banner:
1389
+ ```
1390
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1391
+ SDD ► BOUNCING PLANS (External Refinement)
1392
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1393
+
1394
+ Script: ${BOUNCE_SCRIPT}
1395
+ Max passes: ${BOUNCE_PASSES}
1396
+ ```
1397
+
1398
+ **For each PLAN.md file in the phase directory:**
1399
+
1400
+ 1. **Backup:** Copy `*-PLAN.md` to `*-PLAN.pre-bounce.md`
1401
+ ```bash
1402
+ cp "${PLAN_FILE}" "${PLAN_FILE%.md}.pre-bounce.md"
1403
+ ```
1404
+
1405
+ 2. **Invoke bounce script:**
1406
+ ```bash
1407
+ "${BOUNCE_SCRIPT}" "${PLAN_FILE}" "${BOUNCE_PASSES}"
1408
+ ```
1409
+
1410
+ 3. **Validate bounced plan — YAML frontmatter integrity:**
1411
+ After the script returns, check that the bounced file still has valid YAML frontmatter (opening and closing `---` delimiters with parseable content between them). If the bounced plan breaks YAML frontmatter validation, restore the original from the pre-bounce.md backup and continue to the next plan:
1412
+ ```
1413
+ ⚠ Bounced plan ${PLAN_FILE} has broken YAML frontmatter — restoring original from pre-bounce backup.
1414
+ ```
1415
+
1416
+ 4. **Handle script failure:** If the bounce script exits non-zero, restore the original plan from the pre-bounce.md backup and continue to the next plan:
1417
+ ```
1418
+ ⚠ Bounce script failed for ${PLAN_FILE} (exit code ${EXIT_CODE}) — restoring original from pre-bounce backup.
1419
+ ```
1420
+
1421
+ **After all plans are bounced:**
1422
+
1423
+ 5. **Re-run plan checker on bounced plans:** Spawn sdd-plan-checker (same as step 10) on all modified plans. If a bounced plan fails the checker, restore original from its pre-bounce.md backup:
1424
+ ```
1425
+ ⚠ Bounced plan ${PLAN_FILE} failed checker validation — restoring original from pre-bounce backup.
1426
+ ```
1427
+
1428
+ 6. **Commit surviving bounced plans:** If at least one plan survived both the frontmatter validation and the checker re-run, commit the changes:
1429
+ ```bash
1430
+ sdd-sdk query commit "refactor(${padded_phase}): bounce plans through external refinement" --files "${PHASE_DIR}/*-PLAN.md"
1431
+ ```
1432
+
1433
+ Display summary:
1434
+ ```
1435
+ Plan bounce complete: {survived}/{total} plans refined
1436
+ ```
1437
+
1438
+ **Clean up:** Remove all `*-PLAN.pre-bounce.md` backup files after the bounce step completes (whether plans survived or were restored).
1439
+
904
1440
  ## 13. Requirements Coverage Gate
905
1441
 
906
1442
  After plans pass the checker (or checker is skipped), verify that all phase requirements are covered by at least one plan.
@@ -952,41 +1488,178 @@ Options:
952
1488
 
953
1489
  If `TEXT_MODE` is true, present as a plain-text numbered list (options already shown in the block above). Otherwise use AskUserQuestion to present the options.
954
1490
 
1491
+ ## 13a. Decision Coverage Gate
1492
+
1493
+ After the requirements coverage gate passes, verify that every trackable
1494
+ decision captured by discuss-phase in CONTEXT.md `<decisions>` is referenced
1495
+ by at least one plan. This is the **translation gate** from issue #2492 —
1496
+ its job is to refuse to mark a phase planned when a discuss-phase decision
1497
+ silently dropped on the way into the plans.
1498
+
1499
+ **Skip if** `workflow.context_coverage_gate` is explicitly set to `false`
1500
+ (absent key = enabled). Also skip if no CONTEXT.md exists for this phase
1501
+ (nothing to translate) or if its `<decisions>` block is empty.
1502
+
1503
+ ```bash
1504
+ GATE_CFG=$(sdd-sdk query config-get workflow.context_coverage_gate 2>/dev/null || echo "true")
1505
+ if [ "$GATE_CFG" != "false" ]; then
1506
+ GATE_RESULT=$(sdd-sdk query check.decision-coverage-plan "${PHASE_DIR}" "${CONTEXT_PATH}")
1507
+ # BLOCKING: refuse to mark phase planned when a trackable decision is uncovered.
1508
+ # `passed: true` covers both real-pass and skipped cases (gate disabled / no CONTEXT.md /
1509
+ # no trackable decisions). Verify-phase counterpart deliberately omits this exit-1 — that
1510
+ # gate is non-blocking by design (review finding F15).
1511
+ echo "$GATE_RESULT" | jq -e '.data.passed == true' >/dev/null || {
1512
+ echo "$GATE_RESULT" | jq -r '.data.message'
1513
+ exit 1
1514
+ }
1515
+ fi
1516
+ ```
1517
+
1518
+ The handler returns JSON:
1519
+ ```json
1520
+ {
1521
+ "passed": true,
1522
+ "skipped": false,
1523
+ "total": 2,
1524
+ "covered": 2,
1525
+ "uncovered": [ { "id": "D-01", "text": "...", "category": "..." } ],
1526
+ "message": "..."
1527
+ }
1528
+ ```
1529
+
1530
+ **If `passed` is true (or `skipped` is true):** Display
1531
+ `✓ Decision coverage: {M}/{N} CONTEXT.md decisions covered by plans` (or
1532
+ `(skipped — gate disabled)` / `(skipped — no decisions)`) and proceed to
1533
+ step 13b.
1534
+
1535
+ **If `passed` is false:** Display the handler's `message` block. It already
1536
+ names each uncovered decision (`D-NN | category | text`) and tells the user
1537
+ what to do — cite the id in a relevant plan's `must_haves` / `truths`, or
1538
+ move the decision under `### Claude's Discretion` / tag it `[informational]`
1539
+ if it should not be tracked. Then offer:
1540
+
1541
+ ```text
1542
+ Options:
1543
+ 1. Re-plan to cover missing decisions (recommended)
1544
+ 2. Edit CONTEXT.md to mark dropped decisions as [informational] / Discretion
1545
+ 3. Proceed anyway — accept the coverage gap
1546
+ ```
1547
+
1548
+ If `TEXT_MODE` is true, present as a plain-text numbered list. Otherwise use
1549
+ AskUserQuestion. Selecting "Proceed anyway" continues to step 13b but
1550
+ records the override in STATE.md so verify-phase can re-surface it.
1551
+
1552
+ **Why this gate blocks:** failing here is cheap. The plans are the contract
1553
+ between discuss-phase and execute-phase; if a decision isn't visible in any
1554
+ plan, no executor will implement it. Catching that now beats discovering it
1555
+ after thousands of dollars of execution.
1556
+
955
1557
  ## 13b. Record Planning Completion in STATE.md
956
1558
 
957
1559
  After plans pass all gates, record that planning is complete so STATE.md reflects the new phase status:
958
1560
 
959
1561
  ```bash
960
- node "$HOME/.claude/sdd/bin/sdd-tools.cjs" state planned-phase --phase "${PHASE_NUMBER}" --name "${PHASE_NAME}" --plans "${PLAN_COUNT}"
1562
+ sdd-sdk query state.planned-phase --phase "${PHASE_NUMBER}" --name "${PHASE_NAME}" --plans "${PLAN_COUNT}"
961
1563
  ```
962
1564
 
963
1565
  This updates STATUS to "Ready to execute", sets the correct plan count, and timestamps Last Activity.
964
1566
 
1567
+ ## 13c. Annotate ROADMAP with Wave Dependencies and Cross-cutting Constraints
1568
+
1569
+ After plans are finalized, annotate the ROADMAP.md plan list for this phase with:
1570
+ - **Wave dependency notes** — a bold header before each wave group ("Wave 2 *(blocked on Wave 1 completion)*")
1571
+ - **Cross-cutting constraints** — a "Cross-cutting constraints:" subsection listing `must_haves.truths` entries that appear in 2 or more plans
1572
+
1573
+ This step is derived entirely from existing PLAN frontmatter — no extra LLM pass is required.
1574
+
1575
+ ```bash
1576
+ sdd-sdk query roadmap.annotate-dependencies "${PHASE_NUMBER}"
1577
+ ```
1578
+
1579
+ This operation is idempotent: if wave headers or cross-cutting constraints already exist in the ROADMAP phase section, the command returns without modifying the file. Skip this step if `plan_count` is 0.
1580
+
1581
+ ## 13d. Commit Plans if commit_docs is true
1582
+
1583
+ If `commit_docs` is true (from the init JSON parsed in step 1), commit the generated plan artifacts (including any ROADMAP.md annotations from step 13c):
1584
+
1585
+ ```bash
1586
+ sdd-sdk query commit "docs(${PADDED_PHASE}): create phase plan" --files "${PHASE_DIR}"/*-PLAN.md .planning/STATE.md .planning/ROADMAP.md
1587
+ ```
1588
+
1589
+ This commits all PLAN.md files for the phase plus the updated STATE.md and ROADMAP.md to version-control the planning artifacts. Skip this step if `commit_docs` is false.
1590
+
1591
+ ## 13e. Post-Planning Gap Analysis
1592
+
1593
+ After all plans are generated, committed, and the Requirements Coverage Gate (§13)
1594
+ has run, emit a single unified gap report covering both REQUIREMENTS.md and the
1595
+ CONTEXT.md `<decisions>` section. This is a **proactive, post-hoc report** — it
1596
+ does not block phase advancement and does not re-plan. It exists so that any
1597
+ requirement or decision that slipped through the per-plan checks is surfaced in
1598
+ one place before execution begins.
1599
+
1600
+ **Skip if:** `workflow.post_planning_gaps` is `false`. Default is `true`.
1601
+
1602
+ ```bash
1603
+ POST_PLANNING_GAPS=$(sdd-sdk query config-get workflow.post_planning_gaps --default true 2>/dev/null || echo true)
1604
+ if [ "$POST_PLANNING_GAPS" = "true" ]; then
1605
+ node "$HOME/.claude/sdd/bin/sdd-tools.cjs" gap-analysis --phase-dir "${PHASE_DIR}"
1606
+ fi
1607
+ ```
1608
+
1609
+ (`sdd-tools.cjs gap-analysis` reads `.planning/REQUIREMENTS.md`, `${PHASE_DIR}/CONTEXT.md`,
1610
+ and `${PHASE_DIR}/*-PLAN.md`, then prints a markdown table with one row per
1611
+ REQ-ID and D-ID. Word-boundary matching prevents `REQ-1` from being mistaken for
1612
+ `REQ-10`.)
1613
+
1614
+ **Output format (deterministic; sorted REQUIREMENTS.md → CONTEXT.md, then natural
1615
+ sort within source):**
1616
+
1617
+ ```
1618
+ ## Post-Planning Gap Analysis
1619
+
1620
+ | Source | Item | Status |
1621
+ |--------|------|--------|
1622
+ | REQUIREMENTS.md | REQ-01 | ✓ Covered |
1623
+ | REQUIREMENTS.md | REQ-02 | ✗ Not covered |
1624
+ | CONTEXT.md | D-01 | ✓ Covered |
1625
+ | CONTEXT.md | D-02 | ✗ Not covered |
1626
+
1627
+ ⚠ N items not covered by any plan
1628
+ ```
1629
+
1630
+ **Skip-gracefully behavior:**
1631
+ - REQUIREMENTS.md missing → CONTEXT-only report.
1632
+ - CONTEXT.md missing → REQUIREMENTS-only report.
1633
+ - Both missing or `<decisions>` block missing → "No requirements or decisions to check" line, no error.
1634
+
1635
+ This step is non-blocking. If items are reported as not covered, the user may
1636
+ re-run `/sdd:plan-phase --gaps` to add plans, or proceed to execute-phase as-is.
1637
+
965
1638
  ## 14. Present Final Status
966
1639
 
967
1640
  Route to `<offer_next>` OR `auto_advance` depending on flags/config.
968
1641
 
969
1642
  ## 15. Auto-Advance Check
970
1643
 
971
- Check for auto-advance trigger:
1644
+ Check for auto-advance trigger using values already loaded in step 1:
972
1645
 
973
1646
  1. Parse `--auto` and `--chain` flags from $ARGUMENTS
974
- 2. **Sync chain flag with intent** if user invoked manually (no `--auto` and no `--chain`), clear the ephemeral chain flag from any previous interrupted `--auto` chain. This does NOT touch `workflow.auto_advance` (the user's persistent settings preference):
1647
+ 2. Use `auto_chain_active` and `auto_advance` from the INIT JSON parsed in step 1 **do not issue additional `config-get` calls for these values** (they are already present in the init output). Issuing redundant `config-get` calls for values already in INIT can cause infinite read loops on some runtimes.
1648
+ 3. **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):
975
1649
  ```bash
976
1650
  if [[ ! "$ARGUMENTS" =~ --auto ]] && [[ ! "$ARGUMENTS" =~ --chain ]]; then
977
- node "$HOME/.claude/sdd/bin/sdd-tools.cjs" config-set workflow._auto_chain_active false 2>/dev/null
1651
+ sdd-sdk query config-set workflow._auto_chain_active false || true
978
1652
  fi
979
1653
  ```
980
- 3. Read both the chain flag and user preference:
981
- ```bash
982
- AUTO_CHAIN=$(node "$HOME/.claude/sdd/bin/sdd-tools.cjs" config-get workflow._auto_chain_active 2>/dev/null || echo "false")
983
- AUTO_CFG=$(node "$HOME/.claude/sdd/bin/sdd-tools.cjs" config-get workflow.auto_advance 2>/dev/null || echo "false")
984
- ```
1654
+
1655
+ Set local variables from INIT (parsed once in step 1):
1656
+ - `AUTO_CHAIN` = `auto_chain_active` from INIT JSON (boolean, default false)
1657
+ - `AUTO_CFG` = `auto_advance` from INIT JSON (boolean, default false)
985
1658
 
986
1659
  **If `--auto` or `--chain` flag present AND `AUTO_CHAIN` is not true:** Persist chain flag to config (handles direct invocation without prior discuss-phase):
987
1660
  ```bash
988
1661
  if ([[ "$ARGUMENTS" =~ --auto ]] || [[ "$ARGUMENTS" =~ --chain ]]) && [[ "$AUTO_CHAIN" != "true" ]]; then
989
- node "$HOME/.claude/sdd/bin/sdd-tools.cjs" config-set workflow._auto_chain_active true
1662
+ sdd-sdk query config-set workflow._auto_chain_active true
990
1663
  fi
991
1664
  ```
992
1665
 
@@ -1017,14 +1690,14 @@ The `--no-transition` flag tells execute-phase to return status after verificati
1017
1690
 
1018
1691
  Auto-advance pipeline finished.
1019
1692
 
1020
- Next: /sdd-discuss-phase ${NEXT_PHASE} --auto ${SDD_WS}
1693
+ Next: /sdd:discuss-phase ${NEXT_PHASE} --auto ${SDD_WS}
1021
1694
  ```
1022
1695
  - **GAPS FOUND / VERIFICATION FAILED** → Display result, stop chain:
1023
1696
  ```
1024
1697
  Auto-advance stopped: Execution needs review.
1025
1698
 
1026
1699
  Review the output above and continue manually:
1027
- /sdd-execute-phase ${PHASE} ${SDD_WS}
1700
+ /sdd:execute-phase ${PHASE} ${SDD_WS}
1028
1701
  ```
1029
1702
 
1030
1703
  **If neither `--auto` nor config enabled:**
@@ -1051,21 +1724,21 @@ Verification: {Passed | Passed with override | Skipped}
1051
1724
 
1052
1725
  ───────────────────────────────────────────────────────────────
1053
1726
 
1054
- ## ▶ Next Up
1727
+ ## ▶ Next Up — [${PROJECT_CODE}] ${PROJECT_TITLE}
1055
1728
 
1056
1729
  **Execute Phase {X}** — run all {N} plans
1057
1730
 
1058
1731
  /clear then:
1059
1732
 
1060
- /sdd-execute-phase {X} ${SDD_WS}
1733
+ /sdd:execute-phase {X} ${SDD_WS}
1061
1734
 
1062
1735
  ───────────────────────────────────────────────────────────────
1063
1736
 
1064
1737
  **Also available:**
1065
1738
  - cat .planning/phases/{phase-dir}/*-PLAN.md — review plans
1066
- - /sdd-plan-phase {X} --research — re-research first
1067
- - /sdd-review --phase {X} --all — peer review plans with external AIs
1068
- - /sdd-plan-phase {X} --reviews — replan incorporating review feedback
1739
+ - /sdd:plan-phase {X} --research — re-research first
1740
+ - /sdd:review --phase {X} --all — peer review plans with external AIs
1741
+ - /sdd:plan-phase {X} --reviews — replan incorporating review feedback
1069
1742
 
1070
1743
  ───────────────────────────────────────────────────────────────
1071
1744
  </offer_next>
@@ -1086,11 +1759,11 @@ stdio deadlocks with MCP servers — see Claude Code issue anthropics/claude-cod
1086
1759
  Remove-Item -Recurse -Force "$env:USERPROFILE\.claude\tasks\*" -ErrorAction SilentlyContinue
1087
1760
  ```
1088
1761
  4. **Reduce MCP server count:** Temporarily disable non-essential MCP servers in settings.json
1089
- 5. **Retry:** Restart Claude Code and run `/sdd-plan-phase` again
1762
+ 5. **Retry:** Restart Claude Code and run `/sdd:plan-phase` again
1090
1763
 
1091
1764
  If freezes persist, try `--skip-research` to reduce the agent chain from 3 to 2 agents:
1092
1765
  ```
1093
- /sdd-plan-phase N --skip-research
1766
+ /sdd:plan-phase N --skip-research
1094
1767
  ```
1095
1768
  </windows_troubleshooting>
1096
1769