@opengsd/get-shit-done-redux 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1466) hide show
  1. package/LICENSE +21 -0
  2. package/README.ja-JP.md +870 -0
  3. package/README.ko-KR.md +861 -0
  4. package/README.md +300 -0
  5. package/README.pt-BR.md +492 -0
  6. package/README.zh-CN.md +842 -0
  7. package/agents/gsd-advisor-researcher.md +127 -0
  8. package/agents/gsd-ai-researcher.md +133 -0
  9. package/agents/gsd-assumptions-analyzer.md +105 -0
  10. package/agents/gsd-code-fixer.md +668 -0
  11. package/agents/gsd-code-reviewer.md +387 -0
  12. package/agents/gsd-codebase-mapper.md +853 -0
  13. package/agents/gsd-debug-session-manager.md +314 -0
  14. package/agents/gsd-debugger.md +1452 -0
  15. package/agents/gsd-doc-classifier.md +168 -0
  16. package/agents/gsd-doc-synthesizer.md +204 -0
  17. package/agents/gsd-doc-verifier.md +217 -0
  18. package/agents/gsd-doc-writer.md +615 -0
  19. package/agents/gsd-domain-researcher.md +153 -0
  20. package/agents/gsd-eval-auditor.md +191 -0
  21. package/agents/gsd-eval-planner.md +154 -0
  22. package/agents/gsd-executor.md +774 -0
  23. package/agents/gsd-framework-selector.md +160 -0
  24. package/agents/gsd-integration-checker.md +470 -0
  25. package/agents/gsd-intel-updater.md +342 -0
  26. package/agents/gsd-nyquist-auditor.md +203 -0
  27. package/agents/gsd-pattern-mapper.md +335 -0
  28. package/agents/gsd-phase-researcher.md +928 -0
  29. package/agents/gsd-plan-checker.md +978 -0
  30. package/agents/gsd-planner.md +1278 -0
  31. package/agents/gsd-project-researcher.md +677 -0
  32. package/agents/gsd-research-synthesizer.md +247 -0
  33. package/agents/gsd-roadmapper.md +688 -0
  34. package/agents/gsd-security-auditor.md +155 -0
  35. package/agents/gsd-ui-auditor.md +495 -0
  36. package/agents/gsd-ui-checker.md +309 -0
  37. package/agents/gsd-ui-researcher.md +380 -0
  38. package/agents/gsd-user-profiler.md +171 -0
  39. package/agents/gsd-verifier.md +917 -0
  40. package/bin/gsd-sdk.js +37 -0
  41. package/bin/install.js +11468 -0
  42. package/bin/lib/ui-safety-gate.cjs +107 -0
  43. package/commands/gsd/add-tests.md +42 -0
  44. package/commands/gsd/ai-integration-phase.md +37 -0
  45. package/commands/gsd/audit-fix.md +34 -0
  46. package/commands/gsd/audit-milestone.md +37 -0
  47. package/commands/gsd/audit-uat.md +24 -0
  48. package/commands/gsd/autonomous.md +46 -0
  49. package/commands/gsd/capture.md +62 -0
  50. package/commands/gsd/cleanup.md +24 -0
  51. package/commands/gsd/code-review.md +59 -0
  52. package/commands/gsd/complete-milestone.md +143 -0
  53. package/commands/gsd/config.md +58 -0
  54. package/commands/gsd/debug.md +52 -0
  55. package/commands/gsd/discuss-phase.md +76 -0
  56. package/commands/gsd/docs-update.md +49 -0
  57. package/commands/gsd/eval-review.md +33 -0
  58. package/commands/gsd/execute-phase.md +64 -0
  59. package/commands/gsd/explore.md +27 -0
  60. package/commands/gsd/extract-learnings.md +23 -0
  61. package/commands/gsd/fast.md +31 -0
  62. package/commands/gsd/forensics.md +57 -0
  63. package/commands/gsd/graphify.md +199 -0
  64. package/commands/gsd/health.md +31 -0
  65. package/commands/gsd/help.md +28 -0
  66. package/commands/gsd/import.md +41 -0
  67. package/commands/gsd/inbox.md +39 -0
  68. package/commands/gsd/ingest-docs.md +42 -0
  69. package/commands/gsd/manager.md +45 -0
  70. package/commands/gsd/map-codebase.md +83 -0
  71. package/commands/gsd/milestone-summary.md +51 -0
  72. package/commands/gsd/mvp-phase.md +45 -0
  73. package/commands/gsd/new-milestone.md +45 -0
  74. package/commands/gsd/new-project.md +47 -0
  75. package/commands/gsd/ns-context.md +23 -0
  76. package/commands/gsd/ns-ideate.md +24 -0
  77. package/commands/gsd/ns-manage.md +29 -0
  78. package/commands/gsd/ns-project.md +22 -0
  79. package/commands/gsd/ns-review.md +26 -0
  80. package/commands/gsd/ns-workflow.md +28 -0
  81. package/commands/gsd/pause-work.md +43 -0
  82. package/commands/gsd/phase.md +56 -0
  83. package/commands/gsd/plan-phase.md +62 -0
  84. package/commands/gsd/plan-review-convergence.md +59 -0
  85. package/commands/gsd/pr-branch.md +26 -0
  86. package/commands/gsd/profile-user.md +46 -0
  87. package/commands/gsd/progress.md +46 -0
  88. package/commands/gsd/quick.md +174 -0
  89. package/commands/gsd/resume-work.md +30 -0
  90. package/commands/gsd/review-backlog.md +63 -0
  91. package/commands/gsd/review.md +41 -0
  92. package/commands/gsd/secure-phase.md +36 -0
  93. package/commands/gsd/settings.md +29 -0
  94. package/commands/gsd/ship.md +24 -0
  95. package/commands/gsd/sketch.md +60 -0
  96. package/commands/gsd/spec-phase.md +63 -0
  97. package/commands/gsd/spike.md +57 -0
  98. package/commands/gsd/stats.md +19 -0
  99. package/commands/gsd/surface.md +155 -0
  100. package/commands/gsd/thread.md +24 -0
  101. package/commands/gsd/ui-phase.md +35 -0
  102. package/commands/gsd/ui-review.md +33 -0
  103. package/commands/gsd/ultraplan-phase.md +34 -0
  104. package/commands/gsd/undo.md +35 -0
  105. package/commands/gsd/update.md +48 -0
  106. package/commands/gsd/validate-phase.md +36 -0
  107. package/commands/gsd/verify-work.md +39 -0
  108. package/commands/gsd/workspace.md +52 -0
  109. package/commands/gsd/workstreams.md +70 -0
  110. package/get-shit-done/bin/check-latest-version.cjs +104 -0
  111. package/get-shit-done/bin/gsd-tools.cjs +1630 -0
  112. package/get-shit-done/bin/lib/active-workstream-store.cjs +85 -0
  113. package/get-shit-done/bin/lib/adr-parser.cjs +394 -0
  114. package/get-shit-done/bin/lib/artifacts.cjs +53 -0
  115. package/get-shit-done/bin/lib/audit.cjs +755 -0
  116. package/get-shit-done/bin/lib/cjs-command-router-adapter.cjs +39 -0
  117. package/get-shit-done/bin/lib/cjs-sdk-bridge.cjs +136 -0
  118. package/get-shit-done/bin/lib/clusters.cjs +135 -0
  119. package/get-shit-done/bin/lib/code-review-flags.cjs +74 -0
  120. package/get-shit-done/bin/lib/command-aliases.generated.cjs +824 -0
  121. package/get-shit-done/bin/lib/command-routing-hub.cjs +239 -0
  122. package/get-shit-done/bin/lib/commands.cjs +1035 -0
  123. package/get-shit-done/bin/lib/config-schema.cjs +31 -0
  124. package/get-shit-done/bin/lib/config.cjs +704 -0
  125. package/get-shit-done/bin/lib/configuration.generated.cjs +253 -0
  126. package/get-shit-done/bin/lib/context-utilization.cjs +47 -0
  127. package/get-shit-done/bin/lib/core.cjs +1922 -0
  128. package/get-shit-done/bin/lib/decisions.cjs +19 -0
  129. package/get-shit-done/bin/lib/decisions.generated.cjs +121 -0
  130. package/get-shit-done/bin/lib/docs.cjs +270 -0
  131. package/get-shit-done/bin/lib/drift.cjs +388 -0
  132. package/get-shit-done/bin/lib/fallow-runner.cjs +109 -0
  133. package/get-shit-done/bin/lib/frontmatter.cjs +389 -0
  134. package/get-shit-done/bin/lib/gap-checker.cjs +205 -0
  135. package/get-shit-done/bin/lib/graphify.cjs +592 -0
  136. package/get-shit-done/bin/lib/gsd2-import.cjs +514 -0
  137. package/get-shit-done/bin/lib/init-command-router.cjs +174 -0
  138. package/get-shit-done/bin/lib/init.cjs +2096 -0
  139. package/get-shit-done/bin/lib/install-profiles.cjs +603 -0
  140. package/get-shit-done/bin/lib/installer-migration-authoring.cjs +117 -0
  141. package/get-shit-done/bin/lib/installer-migration-report.cjs +354 -0
  142. package/get-shit-done/bin/lib/installer-migrations/000-first-time-baseline.cjs +220 -0
  143. package/get-shit-done/bin/lib/installer-migrations/001-legacy-orphan-files.cjs +41 -0
  144. package/get-shit-done/bin/lib/installer-migrations/002-codex-legacy-hooks-json.cjs +80 -0
  145. package/get-shit-done/bin/lib/installer-migrations.cjs +776 -0
  146. package/get-shit-done/bin/lib/intel.cjs +643 -0
  147. package/get-shit-done/bin/lib/learnings.cjs +379 -0
  148. package/get-shit-done/bin/lib/milestone.cjs +314 -0
  149. package/get-shit-done/bin/lib/model-catalog.cjs +136 -0
  150. package/get-shit-done/bin/lib/model-profiles.cjs +25 -0
  151. package/get-shit-done/bin/lib/phase-command-router.cjs +226 -0
  152. package/get-shit-done/bin/lib/phase.cjs +1490 -0
  153. package/get-shit-done/bin/lib/phases-command-router.cjs +97 -0
  154. package/get-shit-done/bin/lib/plan-scan.cjs +26 -0
  155. package/get-shit-done/bin/lib/plan-scan.generated.cjs +97 -0
  156. package/get-shit-done/bin/lib/planning-workspace.cjs +415 -0
  157. package/get-shit-done/bin/lib/profile-output.cjs +1130 -0
  158. package/get-shit-done/bin/lib/profile-pipeline.cjs +539 -0
  159. package/get-shit-done/bin/lib/project-root.generated.cjs +117 -0
  160. package/get-shit-done/bin/lib/prompt-budget.cjs +399 -0
  161. package/get-shit-done/bin/lib/review-reviewer-selection.cjs +125 -0
  162. package/get-shit-done/bin/lib/roadmap-command-router.cjs +99 -0
  163. package/get-shit-done/bin/lib/roadmap.cjs +642 -0
  164. package/get-shit-done/bin/lib/runtime-artifact-layout.cjs +301 -0
  165. package/get-shit-done/bin/lib/runtime-homes.cjs +185 -0
  166. package/get-shit-done/bin/lib/runtime-slash.cjs +109 -0
  167. package/get-shit-done/bin/lib/schema-detect.cjs +21 -0
  168. package/get-shit-done/bin/lib/schema-detect.generated.cjs +170 -0
  169. package/get-shit-done/bin/lib/secrets.cjs +20 -0
  170. package/get-shit-done/bin/lib/secrets.generated.cjs +37 -0
  171. package/get-shit-done/bin/lib/security.cjs +504 -0
  172. package/get-shit-done/bin/lib/shell-command-projection.cjs +552 -0
  173. package/get-shit-done/bin/lib/state-command-router.cjs +346 -0
  174. package/get-shit-done/bin/lib/state-document.cjs +12 -0
  175. package/get-shit-done/bin/lib/state-document.generated.cjs +127 -0
  176. package/get-shit-done/bin/lib/state.cjs +1940 -0
  177. package/get-shit-done/bin/lib/surface.cjs +430 -0
  178. package/get-shit-done/bin/lib/template.cjs +228 -0
  179. package/get-shit-done/bin/lib/uat.cjs +289 -0
  180. package/get-shit-done/bin/lib/validate-command-router.cjs +129 -0
  181. package/get-shit-done/bin/lib/verify-command-router.cjs +122 -0
  182. package/get-shit-done/bin/lib/verify.cjs +1458 -0
  183. package/get-shit-done/bin/lib/workstream-inventory-builder.generated.cjs +79 -0
  184. package/get-shit-done/bin/lib/workstream-inventory.cjs +132 -0
  185. package/get-shit-done/bin/lib/workstream-name-policy.cjs +19 -0
  186. package/get-shit-done/bin/lib/workstream-name-policy.generated.cjs +61 -0
  187. package/get-shit-done/bin/lib/workstream.cjs +374 -0
  188. package/get-shit-done/bin/lib/worktree-safety.cjs +985 -0
  189. package/get-shit-done/bin/verify-reapply-patches.cjs +336 -0
  190. package/get-shit-done/contexts/dev.md +21 -0
  191. package/get-shit-done/contexts/research.md +22 -0
  192. package/get-shit-done/contexts/review.md +23 -0
  193. package/get-shit-done/references/agent-contracts.md +79 -0
  194. package/get-shit-done/references/ai-evals.md +156 -0
  195. package/get-shit-done/references/ai-frameworks.md +186 -0
  196. package/get-shit-done/references/artifact-types.md +131 -0
  197. package/get-shit-done/references/autonomous-smart-discuss.md +277 -0
  198. package/get-shit-done/references/checkpoints.md +814 -0
  199. package/get-shit-done/references/common-bug-patterns.md +114 -0
  200. package/get-shit-done/references/context-budget.md +85 -0
  201. package/get-shit-done/references/continuation-format.md +253 -0
  202. package/get-shit-done/references/debugger-philosophy.md +76 -0
  203. package/get-shit-done/references/decimal-phase-calculation.md +64 -0
  204. package/get-shit-done/references/doc-conflict-engine.md +91 -0
  205. package/get-shit-done/references/domain-probes.md +125 -0
  206. package/get-shit-done/references/execute-mvp-tdd.md +81 -0
  207. package/get-shit-done/references/executor-examples.md +110 -0
  208. package/get-shit-done/references/few-shot-examples/plan-checker.md +73 -0
  209. package/get-shit-done/references/few-shot-examples/verifier.md +109 -0
  210. package/get-shit-done/references/gate-prompts.md +100 -0
  211. package/get-shit-done/references/gates.md +70 -0
  212. package/get-shit-done/references/git-integration.md +298 -0
  213. package/get-shit-done/references/git-planning-commit.md +40 -0
  214. package/get-shit-done/references/ios-scaffold.md +123 -0
  215. package/get-shit-done/references/mandatory-initial-read.md +2 -0
  216. package/get-shit-done/references/model-profile-resolution.md +38 -0
  217. package/get-shit-done/references/model-profiles.md +245 -0
  218. package/get-shit-done/references/mvp-concepts.md +49 -0
  219. package/get-shit-done/references/phase-argument-parsing.md +61 -0
  220. package/get-shit-done/references/planner-antipatterns.md +89 -0
  221. package/get-shit-done/references/planner-chunked.md +49 -0
  222. package/get-shit-done/references/planner-gap-closure.md +62 -0
  223. package/get-shit-done/references/planner-graphify-auto-update.md +67 -0
  224. package/get-shit-done/references/planner-human-verify-mode.md +57 -0
  225. package/get-shit-done/references/planner-mvp-mode.md +53 -0
  226. package/get-shit-done/references/planner-reviews.md +39 -0
  227. package/get-shit-done/references/planner-revision.md +87 -0
  228. package/get-shit-done/references/planner-source-audit.md +73 -0
  229. package/get-shit-done/references/planning-config.md +471 -0
  230. package/get-shit-done/references/project-skills-discovery.md +19 -0
  231. package/get-shit-done/references/questioning.md +162 -0
  232. package/get-shit-done/references/revision-loop.md +97 -0
  233. package/get-shit-done/references/scout-codebase.md +51 -0
  234. package/get-shit-done/references/skeleton-template.md +48 -0
  235. package/get-shit-done/references/sketch-interactivity.md +41 -0
  236. package/get-shit-done/references/sketch-theme-system.md +94 -0
  237. package/get-shit-done/references/sketch-tooling.md +45 -0
  238. package/get-shit-done/references/sketch-variant-patterns.md +81 -0
  239. package/get-shit-done/references/spidr-splitting.md +69 -0
  240. package/get-shit-done/references/tdd.md +330 -0
  241. package/get-shit-done/references/thinking-models-debug.md +44 -0
  242. package/get-shit-done/references/thinking-models-execution.md +50 -0
  243. package/get-shit-done/references/thinking-models-planning.md +62 -0
  244. package/get-shit-done/references/thinking-models-research.md +50 -0
  245. package/get-shit-done/references/thinking-models-verification.md +55 -0
  246. package/get-shit-done/references/thinking-partner.md +96 -0
  247. package/get-shit-done/references/ui-brand.md +160 -0
  248. package/get-shit-done/references/universal-anti-patterns.md +63 -0
  249. package/get-shit-done/references/user-profiling.md +681 -0
  250. package/get-shit-done/references/user-story-template.md +58 -0
  251. package/get-shit-done/references/verification-overrides.md +227 -0
  252. package/get-shit-done/references/verification-patterns.md +612 -0
  253. package/get-shit-done/references/verify-mvp-mode.md +85 -0
  254. package/get-shit-done/references/workstream-flag.md +111 -0
  255. package/get-shit-done/references/worktree-path-safety.md +89 -0
  256. package/get-shit-done/templates/AI-SPEC.md +246 -0
  257. package/get-shit-done/templates/DEBUG.md +169 -0
  258. package/get-shit-done/templates/README.md +77 -0
  259. package/get-shit-done/templates/SECURITY.md +61 -0
  260. package/get-shit-done/templates/UAT.md +265 -0
  261. package/get-shit-done/templates/UI-SPEC.md +100 -0
  262. package/get-shit-done/templates/VALIDATION.md +76 -0
  263. package/get-shit-done/templates/claude-md.md +145 -0
  264. package/get-shit-done/templates/codebase/architecture.md +255 -0
  265. package/get-shit-done/templates/codebase/concerns.md +310 -0
  266. package/get-shit-done/templates/codebase/conventions.md +307 -0
  267. package/get-shit-done/templates/codebase/integrations.md +280 -0
  268. package/get-shit-done/templates/codebase/stack.md +186 -0
  269. package/get-shit-done/templates/codebase/structure.md +285 -0
  270. package/get-shit-done/templates/codebase/testing.md +480 -0
  271. package/get-shit-done/templates/config.json +62 -0
  272. package/get-shit-done/templates/context.md +352 -0
  273. package/get-shit-done/templates/continue-here.md +78 -0
  274. package/get-shit-done/templates/copilot-instructions.md +7 -0
  275. package/get-shit-done/templates/debug-subagent-prompt.md +91 -0
  276. package/get-shit-done/templates/dev-preferences.md +21 -0
  277. package/get-shit-done/templates/discovery.md +146 -0
  278. package/get-shit-done/templates/discussion-log.md +63 -0
  279. package/get-shit-done/templates/milestone-archive.md +123 -0
  280. package/get-shit-done/templates/milestone.md +115 -0
  281. package/get-shit-done/templates/phase-prompt.md +610 -0
  282. package/get-shit-done/templates/planner-subagent-prompt.md +117 -0
  283. package/get-shit-done/templates/project.md +186 -0
  284. package/get-shit-done/templates/requirements.md +231 -0
  285. package/get-shit-done/templates/research-project/ARCHITECTURE.md +204 -0
  286. package/get-shit-done/templates/research-project/FEATURES.md +147 -0
  287. package/get-shit-done/templates/research-project/PITFALLS.md +200 -0
  288. package/get-shit-done/templates/research-project/STACK.md +120 -0
  289. package/get-shit-done/templates/research-project/SUMMARY.md +170 -0
  290. package/get-shit-done/templates/research.md +592 -0
  291. package/get-shit-done/templates/retrospective.md +54 -0
  292. package/get-shit-done/templates/roadmap.md +202 -0
  293. package/get-shit-done/templates/spec.md +307 -0
  294. package/get-shit-done/templates/state.md +184 -0
  295. package/get-shit-done/templates/summary-complex.md +59 -0
  296. package/get-shit-done/templates/summary-minimal.md +41 -0
  297. package/get-shit-done/templates/summary-standard.md +48 -0
  298. package/get-shit-done/templates/summary.md +248 -0
  299. package/get-shit-done/templates/user-profile.md +146 -0
  300. package/get-shit-done/templates/user-setup.md +311 -0
  301. package/get-shit-done/templates/verification-report.md +322 -0
  302. package/get-shit-done/workflows/add-backlog.md +101 -0
  303. package/get-shit-done/workflows/add-phase.md +123 -0
  304. package/get-shit-done/workflows/add-tests.md +365 -0
  305. package/get-shit-done/workflows/add-todo.md +171 -0
  306. package/get-shit-done/workflows/ai-integration-phase.md +305 -0
  307. package/get-shit-done/workflows/analyze-dependencies.md +96 -0
  308. package/get-shit-done/workflows/audit-fix.md +188 -0
  309. package/get-shit-done/workflows/audit-milestone.md +368 -0
  310. package/get-shit-done/workflows/audit-uat.md +120 -0
  311. package/get-shit-done/workflows/autonomous.md +805 -0
  312. package/get-shit-done/workflows/check-todos.md +190 -0
  313. package/get-shit-done/workflows/cleanup.md +165 -0
  314. package/get-shit-done/workflows/code-review-fix.md +512 -0
  315. package/get-shit-done/workflows/code-review.md +666 -0
  316. package/get-shit-done/workflows/complete-milestone.md +865 -0
  317. package/get-shit-done/workflows/debug.md +242 -0
  318. package/get-shit-done/workflows/diagnose-issues.md +251 -0
  319. package/get-shit-done/workflows/discovery-phase.md +291 -0
  320. package/get-shit-done/workflows/discuss-phase/modes/advisor.md +175 -0
  321. package/get-shit-done/workflows/discuss-phase/modes/all.md +28 -0
  322. package/get-shit-done/workflows/discuss-phase/modes/analyze.md +44 -0
  323. package/get-shit-done/workflows/discuss-phase/modes/auto.md +56 -0
  324. package/get-shit-done/workflows/discuss-phase/modes/batch.md +52 -0
  325. package/get-shit-done/workflows/discuss-phase/modes/chain.md +97 -0
  326. package/get-shit-done/workflows/discuss-phase/modes/default.md +141 -0
  327. package/get-shit-done/workflows/discuss-phase/modes/power.md +44 -0
  328. package/get-shit-done/workflows/discuss-phase/modes/text.md +55 -0
  329. package/get-shit-done/workflows/discuss-phase/templates/checkpoint.json +18 -0
  330. package/get-shit-done/workflows/discuss-phase/templates/context.md +136 -0
  331. package/get-shit-done/workflows/discuss-phase/templates/discussion-log.md +50 -0
  332. package/get-shit-done/workflows/discuss-phase-assumptions.md +685 -0
  333. package/get-shit-done/workflows/discuss-phase-power.md +291 -0
  334. package/get-shit-done/workflows/discuss-phase.md +499 -0
  335. package/get-shit-done/workflows/do.md +122 -0
  336. package/get-shit-done/workflows/docs-update.md +1172 -0
  337. package/get-shit-done/workflows/edit-phase.md +305 -0
  338. package/get-shit-done/workflows/eval-review.md +166 -0
  339. package/get-shit-done/workflows/execute-phase/steps/codebase-drift-gate.md +81 -0
  340. package/get-shit-done/workflows/execute-phase/steps/per-plan-worktree-gate.md +94 -0
  341. package/get-shit-done/workflows/execute-phase/steps/post-merge-gate.md +116 -0
  342. package/get-shit-done/workflows/execute-phase.md +1717 -0
  343. package/get-shit-done/workflows/execute-plan.md +536 -0
  344. package/get-shit-done/workflows/explore.md +154 -0
  345. package/get-shit-done/workflows/extract-learnings.md +253 -0
  346. package/get-shit-done/workflows/fast.md +124 -0
  347. package/get-shit-done/workflows/forensics.md +289 -0
  348. package/get-shit-done/workflows/graduation.md +206 -0
  349. package/get-shit-done/workflows/health.md +234 -0
  350. package/get-shit-done/workflows/help/modes/brief.md +22 -0
  351. package/get-shit-done/workflows/help/modes/default.md +50 -0
  352. package/get-shit-done/workflows/help/modes/full.md +784 -0
  353. package/get-shit-done/workflows/help/modes/topic.md +74 -0
  354. package/get-shit-done/workflows/help.md +24 -0
  355. package/get-shit-done/workflows/import.md +264 -0
  356. package/get-shit-done/workflows/inbox.md +387 -0
  357. package/get-shit-done/workflows/ingest-docs.md +339 -0
  358. package/get-shit-done/workflows/insert-phase.md +162 -0
  359. package/get-shit-done/workflows/list-phase-assumptions.md +178 -0
  360. package/get-shit-done/workflows/list-workspaces.md +67 -0
  361. package/get-shit-done/workflows/manager.md +403 -0
  362. package/get-shit-done/workflows/map-codebase.md +454 -0
  363. package/get-shit-done/workflows/milestone-summary.md +234 -0
  364. package/get-shit-done/workflows/mvp-phase.md +232 -0
  365. package/get-shit-done/workflows/new-milestone.md +645 -0
  366. package/get-shit-done/workflows/new-project.md +1487 -0
  367. package/get-shit-done/workflows/new-workspace.md +250 -0
  368. package/get-shit-done/workflows/next.md +231 -0
  369. package/get-shit-done/workflows/node-repair.md +92 -0
  370. package/get-shit-done/workflows/note.md +158 -0
  371. package/get-shit-done/workflows/pause-work.md +254 -0
  372. package/get-shit-done/workflows/plan-milestone-gaps.md +291 -0
  373. package/get-shit-done/workflows/plan-phase.md +1800 -0
  374. package/get-shit-done/workflows/plan-review-convergence.md +340 -0
  375. package/get-shit-done/workflows/plant-seed.md +240 -0
  376. package/get-shit-done/workflows/pr-branch.md +157 -0
  377. package/get-shit-done/workflows/profile-user.md +463 -0
  378. package/get-shit-done/workflows/progress.md +660 -0
  379. package/get-shit-done/workflows/quick.md +1049 -0
  380. package/get-shit-done/workflows/reapply-patches.md +426 -0
  381. package/get-shit-done/workflows/remove-phase.md +166 -0
  382. package/get-shit-done/workflows/remove-workspace.md +118 -0
  383. package/get-shit-done/workflows/resume-project.md +342 -0
  384. package/get-shit-done/workflows/review.md +633 -0
  385. package/get-shit-done/workflows/scan.md +115 -0
  386. package/get-shit-done/workflows/secure-phase.md +190 -0
  387. package/get-shit-done/workflows/session-report.md +146 -0
  388. package/get-shit-done/workflows/settings-advanced.md +590 -0
  389. package/get-shit-done/workflows/settings-integrations.md +292 -0
  390. package/get-shit-done/workflows/settings.md +545 -0
  391. package/get-shit-done/workflows/ship.md +366 -0
  392. package/get-shit-done/workflows/sketch-wrap-up.md +296 -0
  393. package/get-shit-done/workflows/sketch.md +371 -0
  394. package/get-shit-done/workflows/spec-phase.md +262 -0
  395. package/get-shit-done/workflows/spike-wrap-up.md +317 -0
  396. package/get-shit-done/workflows/spike.md +463 -0
  397. package/get-shit-done/workflows/stats.md +90 -0
  398. package/get-shit-done/workflows/sync-skills.md +182 -0
  399. package/get-shit-done/workflows/thread.md +232 -0
  400. package/get-shit-done/workflows/transition.md +704 -0
  401. package/get-shit-done/workflows/ui-phase.md +338 -0
  402. package/get-shit-done/workflows/ui-review.md +203 -0
  403. package/get-shit-done/workflows/ultraplan-phase.md +209 -0
  404. package/get-shit-done/workflows/undo.md +314 -0
  405. package/get-shit-done/workflows/update.md +664 -0
  406. package/get-shit-done/workflows/validate-phase.md +189 -0
  407. package/get-shit-done/workflows/verify-phase.md +554 -0
  408. package/get-shit-done/workflows/verify-work.md +791 -0
  409. package/hooks/dist/gsd-check-update-worker.js +117 -0
  410. package/hooks/dist/gsd-check-update.js +64 -0
  411. package/hooks/dist/gsd-context-monitor.js +192 -0
  412. package/hooks/dist/gsd-graphify-update.sh +158 -0
  413. package/hooks/dist/gsd-phase-boundary.sh +47 -0
  414. package/hooks/dist/gsd-prompt-guard.js +97 -0
  415. package/hooks/dist/gsd-read-guard.js +101 -0
  416. package/hooks/dist/gsd-read-injection-scanner.js +152 -0
  417. package/hooks/dist/gsd-session-state.sh +59 -0
  418. package/hooks/dist/gsd-statusline.js +537 -0
  419. package/hooks/dist/gsd-update-banner.js +134 -0
  420. package/hooks/dist/gsd-validate-commit.sh +57 -0
  421. package/hooks/dist/gsd-workflow-guard.js +94 -0
  422. package/hooks/dist/lib/git-cmd.js +150 -0
  423. package/hooks/dist/lib/gsd-graphify-rebuild.sh +65 -0
  424. package/hooks/gsd-check-update-worker.js +117 -0
  425. package/hooks/gsd-check-update.js +64 -0
  426. package/hooks/gsd-context-monitor.js +192 -0
  427. package/hooks/gsd-graphify-update.sh +158 -0
  428. package/hooks/gsd-phase-boundary.sh +47 -0
  429. package/hooks/gsd-prompt-guard.js +97 -0
  430. package/hooks/gsd-read-guard.js +101 -0
  431. package/hooks/gsd-read-injection-scanner.js +152 -0
  432. package/hooks/gsd-session-state.sh +59 -0
  433. package/hooks/gsd-statusline.js +537 -0
  434. package/hooks/gsd-update-banner.js +134 -0
  435. package/hooks/gsd-validate-commit.sh +57 -0
  436. package/hooks/gsd-workflow-guard.js +94 -0
  437. package/hooks/lib/git-cmd.js +150 -0
  438. package/hooks/lib/gsd-graphify-rebuild.sh +65 -0
  439. package/package.json +98 -0
  440. package/scripts/audit-workflow-script-paths.cjs +73 -0
  441. package/scripts/base64-scan.sh +262 -0
  442. package/scripts/build-hooks.js +227 -0
  443. package/scripts/changeset/cli.cjs +408 -0
  444. package/scripts/changeset/github-release-notes.cjs +198 -0
  445. package/scripts/changeset/lint.cjs +110 -0
  446. package/scripts/changeset/new.cjs +137 -0
  447. package/scripts/changeset/parse.cjs +114 -0
  448. package/scripts/changeset/render.cjs +34 -0
  449. package/scripts/changeset/serialize.cjs +130 -0
  450. package/scripts/command-contract-helpers.cjs +64 -0
  451. package/scripts/diff-touches-shipped-paths.cjs +147 -0
  452. package/scripts/fix-slash-commands.cjs +147 -0
  453. package/scripts/gen-inventory-manifest.cjs +109 -0
  454. package/scripts/lint-command-contract.cjs +108 -0
  455. package/scripts/lint-descriptions.cjs +83 -0
  456. package/scripts/lint-docs-required.cjs +222 -0
  457. package/scripts/lint-no-source-grep-extras.cjs +81 -0
  458. package/scripts/lint-no-source-grep.cjs +174 -0
  459. package/scripts/lint-pr-check-project-dir.cjs +98 -0
  460. package/scripts/lint-shared-module-handsync.cjs +331 -0
  461. package/scripts/lint-shell-command-projection-drift.cjs +57 -0
  462. package/scripts/lint-skill-deps.cjs +180 -0
  463. package/scripts/lint-test-file-count.allowlist.json +35 -0
  464. package/scripts/lint-test-file-count.cjs +190 -0
  465. package/scripts/pr-template-policy.cjs +268 -0
  466. package/scripts/prompt-injection-scan.sh +203 -0
  467. package/scripts/release-tarball-smoke.cjs +677 -0
  468. package/scripts/run-tests.cjs +178 -0
  469. package/scripts/secret-scan.sh +229 -0
  470. package/scripts/shared-module-handsync-allowlist.json +145 -0
  471. package/scripts/strip-prose-atrefs.cjs +106 -0
  472. package/scripts/sync-rulesets.sh +34 -0
  473. package/scripts/verify-tarball-sdk-dist.sh +69 -0
  474. package/sdk/dist/cli-transport.d.ts +19 -0
  475. package/sdk/dist/cli-transport.d.ts.map +1 -0
  476. package/sdk/dist/cli-transport.js +104 -0
  477. package/sdk/dist/cli-transport.js.map +1 -0
  478. package/sdk/dist/cli.d.ts +46 -0
  479. package/sdk/dist/cli.d.ts.map +1 -0
  480. package/sdk/dist/cli.js +511 -0
  481. package/sdk/dist/cli.js.map +1 -0
  482. package/sdk/dist/config.d.ts +108 -0
  483. package/sdk/dist/config.d.ts.map +1 -0
  484. package/sdk/dist/config.js +116 -0
  485. package/sdk/dist/config.js.map +1 -0
  486. package/sdk/dist/configuration/index.d.ts +85 -0
  487. package/sdk/dist/configuration/index.d.ts.map +1 -0
  488. package/sdk/dist/configuration/index.js +257 -0
  489. package/sdk/dist/configuration/index.js.map +1 -0
  490. package/sdk/dist/context-engine.d.ts +49 -0
  491. package/sdk/dist/context-engine.d.ts.map +1 -0
  492. package/sdk/dist/context-engine.js +142 -0
  493. package/sdk/dist/context-engine.js.map +1 -0
  494. package/sdk/dist/context-truncation.d.ts +33 -0
  495. package/sdk/dist/context-truncation.d.ts.map +1 -0
  496. package/sdk/dist/context-truncation.js +197 -0
  497. package/sdk/dist/context-truncation.js.map +1 -0
  498. package/sdk/dist/errors.d.ts +46 -0
  499. package/sdk/dist/errors.d.ts.map +1 -0
  500. package/sdk/dist/errors.js +64 -0
  501. package/sdk/dist/errors.js.map +1 -0
  502. package/sdk/dist/event-stream.d.ts +53 -0
  503. package/sdk/dist/event-stream.d.ts.map +1 -0
  504. package/sdk/dist/event-stream.js +321 -0
  505. package/sdk/dist/event-stream.js.map +1 -0
  506. package/sdk/dist/golden/capture.d.ts +15 -0
  507. package/sdk/dist/golden/capture.d.ts.map +1 -0
  508. package/sdk/dist/golden/capture.js +67 -0
  509. package/sdk/dist/golden/capture.js.map +1 -0
  510. package/sdk/dist/golden/golden-integration-covered.d.ts +6 -0
  511. package/sdk/dist/golden/golden-integration-covered.d.ts.map +1 -0
  512. package/sdk/dist/golden/golden-integration-covered.js +30 -0
  513. package/sdk/dist/golden/golden-integration-covered.js.map +1 -0
  514. package/sdk/dist/golden/golden-mutation-covered.d.ts +7 -0
  515. package/sdk/dist/golden/golden-mutation-covered.d.ts.map +1 -0
  516. package/sdk/dist/golden/golden-mutation-covered.js +17 -0
  517. package/sdk/dist/golden/golden-mutation-covered.js.map +1 -0
  518. package/sdk/dist/golden/golden-policy.d.ts +10 -0
  519. package/sdk/dist/golden/golden-policy.d.ts.map +1 -0
  520. package/sdk/dist/golden/golden-policy.js +98 -0
  521. package/sdk/dist/golden/golden-policy.js.map +1 -0
  522. package/sdk/dist/golden/init-golden-normalize.d.ts +8 -0
  523. package/sdk/dist/golden/init-golden-normalize.d.ts.map +1 -0
  524. package/sdk/dist/golden/init-golden-normalize.js +14 -0
  525. package/sdk/dist/golden/init-golden-normalize.js.map +1 -0
  526. package/sdk/dist/golden/read-only-golden-rows.d.ts +20 -0
  527. package/sdk/dist/golden/read-only-golden-rows.d.ts.map +1 -0
  528. package/sdk/dist/golden/read-only-golden-rows.js +67 -0
  529. package/sdk/dist/golden/read-only-golden-rows.js.map +1 -0
  530. package/sdk/dist/golden/registry-canonical-commands.d.ts +6 -0
  531. package/sdk/dist/golden/registry-canonical-commands.d.ts.map +1 -0
  532. package/sdk/dist/golden/registry-canonical-commands.js +30 -0
  533. package/sdk/dist/golden/registry-canonical-commands.js.map +1 -0
  534. package/sdk/dist/gsd-tools-error.d.ts +23 -0
  535. package/sdk/dist/gsd-tools-error.d.ts.map +1 -0
  536. package/sdk/dist/gsd-tools-error.js +29 -0
  537. package/sdk/dist/gsd-tools-error.js.map +1 -0
  538. package/sdk/dist/gsd-tools.d.ts +97 -0
  539. package/sdk/dist/gsd-tools.d.ts.map +1 -0
  540. package/sdk/dist/gsd-tools.js +168 -0
  541. package/sdk/dist/gsd-tools.js.map +1 -0
  542. package/sdk/dist/gsd-transport-policy.d.ts +10 -0
  543. package/sdk/dist/gsd-transport-policy.d.ts.map +1 -0
  544. package/sdk/dist/gsd-transport-policy.js +32 -0
  545. package/sdk/dist/gsd-transport-policy.js.map +1 -0
  546. package/sdk/dist/gsd-transport.d.ts +39 -0
  547. package/sdk/dist/gsd-transport.d.ts.map +1 -0
  548. package/sdk/dist/gsd-transport.js +78 -0
  549. package/sdk/dist/gsd-transport.js.map +1 -0
  550. package/sdk/dist/index.d.ts +127 -0
  551. package/sdk/dist/index.d.ts.map +1 -0
  552. package/sdk/dist/index.js +300 -0
  553. package/sdk/dist/index.js.map +1 -0
  554. package/sdk/dist/init-runner.d.ts +90 -0
  555. package/sdk/dist/init-runner.d.ts.map +1 -0
  556. package/sdk/dist/init-runner.js +613 -0
  557. package/sdk/dist/init-runner.js.map +1 -0
  558. package/sdk/dist/logger.d.ts +50 -0
  559. package/sdk/dist/logger.d.ts.map +1 -0
  560. package/sdk/dist/logger.js +70 -0
  561. package/sdk/dist/logger.js.map +1 -0
  562. package/sdk/dist/model-catalog.d.ts +31 -0
  563. package/sdk/dist/model-catalog.d.ts.map +1 -0
  564. package/sdk/dist/model-catalog.js +31 -0
  565. package/sdk/dist/model-catalog.js.map +1 -0
  566. package/sdk/dist/phase-prompt.d.ts +72 -0
  567. package/sdk/dist/phase-prompt.d.ts.map +1 -0
  568. package/sdk/dist/phase-prompt.js +213 -0
  569. package/sdk/dist/phase-prompt.js.map +1 -0
  570. package/sdk/dist/phase-runner.d.ts +145 -0
  571. package/sdk/dist/phase-runner.d.ts.map +1 -0
  572. package/sdk/dist/phase-runner.js +1206 -0
  573. package/sdk/dist/phase-runner.js.map +1 -0
  574. package/sdk/dist/plan-parser.d.ts +55 -0
  575. package/sdk/dist/plan-parser.d.ts.map +1 -0
  576. package/sdk/dist/plan-parser.js +389 -0
  577. package/sdk/dist/plan-parser.js.map +1 -0
  578. package/sdk/dist/planning-journal.d.ts +64 -0
  579. package/sdk/dist/planning-journal.d.ts.map +1 -0
  580. package/sdk/dist/planning-journal.js +88 -0
  581. package/sdk/dist/planning-journal.js.map +1 -0
  582. package/sdk/dist/planning-runtime.d.ts +67 -0
  583. package/sdk/dist/planning-runtime.d.ts.map +1 -0
  584. package/sdk/dist/planning-runtime.js +58 -0
  585. package/sdk/dist/planning-runtime.js.map +1 -0
  586. package/sdk/dist/project-root/index.d.ts +46 -0
  587. package/sdk/dist/project-root/index.d.ts.map +1 -0
  588. package/sdk/dist/project-root/index.js +138 -0
  589. package/sdk/dist/project-root/index.js.map +1 -0
  590. package/sdk/dist/prompt-builder.d.ts +44 -0
  591. package/sdk/dist/prompt-builder.d.ts.map +1 -0
  592. package/sdk/dist/prompt-builder.js +180 -0
  593. package/sdk/dist/prompt-builder.js.map +1 -0
  594. package/sdk/dist/prompt-sanitizer.d.ts +35 -0
  595. package/sdk/dist/prompt-sanitizer.d.ts.map +1 -0
  596. package/sdk/dist/prompt-sanitizer.js +101 -0
  597. package/sdk/dist/prompt-sanitizer.js.map +1 -0
  598. package/sdk/dist/query/active-workstream-store.d.ts +7 -0
  599. package/sdk/dist/query/active-workstream-store.d.ts.map +1 -0
  600. package/sdk/dist/query/active-workstream-store.js +56 -0
  601. package/sdk/dist/query/active-workstream-store.js.map +1 -0
  602. package/sdk/dist/query/agent-failure-classifier.d.ts +38 -0
  603. package/sdk/dist/query/agent-failure-classifier.d.ts.map +1 -0
  604. package/sdk/dist/query/agent-failure-classifier.js +83 -0
  605. package/sdk/dist/query/agent-failure-classifier.js.map +1 -0
  606. package/sdk/dist/query/audit-open.d.ts +46 -0
  607. package/sdk/dist/query/audit-open.d.ts.map +1 -0
  608. package/sdk/dist/query/audit-open.js +662 -0
  609. package/sdk/dist/query/audit-open.js.map +1 -0
  610. package/sdk/dist/query/check-auto-mode.d.ts +13 -0
  611. package/sdk/dist/query/check-auto-mode.d.ts.map +1 -0
  612. package/sdk/dist/query/check-auto-mode.js +40 -0
  613. package/sdk/dist/query/check-auto-mode.js.map +1 -0
  614. package/sdk/dist/query/check-completion.d.ts +10 -0
  615. package/sdk/dist/query/check-completion.d.ts.map +1 -0
  616. package/sdk/dist/query/check-completion.js +157 -0
  617. package/sdk/dist/query/check-completion.js.map +1 -0
  618. package/sdk/dist/query/check-decision-coverage.d.ts +33 -0
  619. package/sdk/dist/query/check-decision-coverage.d.ts.map +1 -0
  620. package/sdk/dist/query/check-decision-coverage.js +472 -0
  621. package/sdk/dist/query/check-decision-coverage.js.map +1 -0
  622. package/sdk/dist/query/check-gates.d.ts +10 -0
  623. package/sdk/dist/query/check-gates.d.ts.map +1 -0
  624. package/sdk/dist/query/check-gates.js +89 -0
  625. package/sdk/dist/query/check-gates.js.map +1 -0
  626. package/sdk/dist/query/check-ship-ready.d.ts +17 -0
  627. package/sdk/dist/query/check-ship-ready.d.ts.map +1 -0
  628. package/sdk/dist/query/check-ship-ready.js +121 -0
  629. package/sdk/dist/query/check-ship-ready.js.map +1 -0
  630. package/sdk/dist/query/check-verification-status.d.ts +10 -0
  631. package/sdk/dist/query/check-verification-status.d.ts.map +1 -0
  632. package/sdk/dist/query/check-verification-status.js +142 -0
  633. package/sdk/dist/query/check-verification-status.js.map +1 -0
  634. package/sdk/dist/query/command-aliases.generated.d.ts +31 -0
  635. package/sdk/dist/query/command-aliases.generated.d.ts.map +1 -0
  636. package/sdk/dist/query/command-aliases.generated.js +133 -0
  637. package/sdk/dist/query/command-aliases.generated.js.map +1 -0
  638. package/sdk/dist/query/command-catalog.d.ts +9 -0
  639. package/sdk/dist/query/command-catalog.d.ts.map +1 -0
  640. package/sdk/dist/query/command-catalog.js +17 -0
  641. package/sdk/dist/query/command-catalog.js.map +1 -0
  642. package/sdk/dist/query/command-definition.d.ts +19 -0
  643. package/sdk/dist/query/command-definition.d.ts.map +1 -0
  644. package/sdk/dist/query/command-definition.js +44 -0
  645. package/sdk/dist/query/command-definition.js.map +1 -0
  646. package/sdk/dist/query/command-family-handlers.d.ts +3 -0
  647. package/sdk/dist/query/command-family-handlers.d.ts.map +1 -0
  648. package/sdk/dist/query/command-family-handlers.js +101 -0
  649. package/sdk/dist/query/command-family-handlers.js.map +1 -0
  650. package/sdk/dist/query/command-manifest.d.ts +2 -0
  651. package/sdk/dist/query/command-manifest.d.ts.map +1 -0
  652. package/sdk/dist/query/command-manifest.init.d.ts +6 -0
  653. package/sdk/dist/query/command-manifest.init.d.ts.map +1 -0
  654. package/sdk/dist/query/command-manifest.init.js +23 -0
  655. package/sdk/dist/query/command-manifest.init.js.map +1 -0
  656. package/sdk/dist/query/command-manifest.js +17 -0
  657. package/sdk/dist/query/command-manifest.js.map +1 -0
  658. package/sdk/dist/query/command-manifest.non-family.d.ts +9 -0
  659. package/sdk/dist/query/command-manifest.non-family.d.ts.map +1 -0
  660. package/sdk/dist/query/command-manifest.non-family.js +60 -0
  661. package/sdk/dist/query/command-manifest.non-family.js.map +1 -0
  662. package/sdk/dist/query/command-manifest.phase.d.ts +6 -0
  663. package/sdk/dist/query/command-manifest.phase.d.ts.map +1 -0
  664. package/sdk/dist/query/command-manifest.phase.js +16 -0
  665. package/sdk/dist/query/command-manifest.phase.js.map +1 -0
  666. package/sdk/dist/query/command-manifest.phases.d.ts +7 -0
  667. package/sdk/dist/query/command-manifest.phases.d.ts.map +1 -0
  668. package/sdk/dist/query/command-manifest.phases.js +10 -0
  669. package/sdk/dist/query/command-manifest.phases.js.map +1 -0
  670. package/sdk/dist/query/command-manifest.roadmap.d.ts +6 -0
  671. package/sdk/dist/query/command-manifest.roadmap.d.ts.map +1 -0
  672. package/sdk/dist/query/command-manifest.roadmap.js +10 -0
  673. package/sdk/dist/query/command-manifest.roadmap.js.map +1 -0
  674. package/sdk/dist/query/command-manifest.state.d.ts +9 -0
  675. package/sdk/dist/query/command-manifest.state.d.ts.map +1 -0
  676. package/sdk/dist/query/command-manifest.state.js +30 -0
  677. package/sdk/dist/query/command-manifest.state.js.map +1 -0
  678. package/sdk/dist/query/command-manifest.types.d.ts +12 -0
  679. package/sdk/dist/query/command-manifest.types.d.ts.map +1 -0
  680. package/sdk/dist/query/command-manifest.types.js +2 -0
  681. package/sdk/dist/query/command-manifest.types.js.map +1 -0
  682. package/sdk/dist/query/command-manifest.validate.d.ts +6 -0
  683. package/sdk/dist/query/command-manifest.validate.d.ts.map +1 -0
  684. package/sdk/dist/query/command-manifest.validate.js +10 -0
  685. package/sdk/dist/query/command-manifest.validate.js.map +1 -0
  686. package/sdk/dist/query/command-manifest.verify.d.ts +6 -0
  687. package/sdk/dist/query/command-manifest.verify.d.ts.map +1 -0
  688. package/sdk/dist/query/command-manifest.verify.js +16 -0
  689. package/sdk/dist/query/command-manifest.verify.js.map +1 -0
  690. package/sdk/dist/query/command-static-catalog-domain.d.ts +3 -0
  691. package/sdk/dist/query/command-static-catalog-domain.d.ts.map +1 -0
  692. package/sdk/dist/query/command-static-catalog-domain.js +110 -0
  693. package/sdk/dist/query/command-static-catalog-domain.js.map +1 -0
  694. package/sdk/dist/query/command-static-catalog-foundation.d.ts +7 -0
  695. package/sdk/dist/query/command-static-catalog-foundation.d.ts.map +1 -0
  696. package/sdk/dist/query/command-static-catalog-foundation.js +106 -0
  697. package/sdk/dist/query/command-static-catalog-foundation.js.map +1 -0
  698. package/sdk/dist/query/command-topology.d.ts +32 -0
  699. package/sdk/dist/query/command-topology.d.ts.map +1 -0
  700. package/sdk/dist/query/command-topology.js +66 -0
  701. package/sdk/dist/query/command-topology.js.map +1 -0
  702. package/sdk/dist/query/commands-list.d.ts +14 -0
  703. package/sdk/dist/query/commands-list.d.ts.map +1 -0
  704. package/sdk/dist/query/commands-list.js +18 -0
  705. package/sdk/dist/query/commands-list.js.map +1 -0
  706. package/sdk/dist/query/commit.d.ts +179 -0
  707. package/sdk/dist/query/commit.d.ts.map +1 -0
  708. package/sdk/dist/query/commit.js +632 -0
  709. package/sdk/dist/query/commit.js.map +1 -0
  710. package/sdk/dist/query/config-gates.d.ts +12 -0
  711. package/sdk/dist/query/config-gates.d.ts.map +1 -0
  712. package/sdk/dist/query/config-gates.js +66 -0
  713. package/sdk/dist/query/config-gates.js.map +1 -0
  714. package/sdk/dist/query/config-mutation.d.ts +86 -0
  715. package/sdk/dist/query/config-mutation.d.ts.map +1 -0
  716. package/sdk/dist/query/config-mutation.js +602 -0
  717. package/sdk/dist/query/config-mutation.js.map +1 -0
  718. package/sdk/dist/query/config-query.d.ts +57 -0
  719. package/sdk/dist/query/config-query.d.ts.map +1 -0
  720. package/sdk/dist/query/config-query.js +277 -0
  721. package/sdk/dist/query/config-query.js.map +1 -0
  722. package/sdk/dist/query/config-schema.d.ts +19 -0
  723. package/sdk/dist/query/config-schema.d.ts.map +1 -0
  724. package/sdk/dist/query/config-schema.js +26 -0
  725. package/sdk/dist/query/config-schema.js.map +1 -0
  726. package/sdk/dist/query/decisions.d.ts +58 -0
  727. package/sdk/dist/query/decisions.d.ts.map +1 -0
  728. package/sdk/dist/query/decisions.js +165 -0
  729. package/sdk/dist/query/decisions.js.map +1 -0
  730. package/sdk/dist/query/detect-custom-files.d.ts +11 -0
  731. package/sdk/dist/query/detect-custom-files.d.ts.map +1 -0
  732. package/sdk/dist/query/detect-custom-files.js +89 -0
  733. package/sdk/dist/query/detect-custom-files.js.map +1 -0
  734. package/sdk/dist/query/detect-phase-type.d.ts +9 -0
  735. package/sdk/dist/query/detect-phase-type.d.ts.map +1 -0
  736. package/sdk/dist/query/detect-phase-type.js +124 -0
  737. package/sdk/dist/query/detect-phase-type.js.map +1 -0
  738. package/sdk/dist/query/docs-init.d.ts +26 -0
  739. package/sdk/dist/query/docs-init.d.ts.map +1 -0
  740. package/sdk/dist/query/docs-init.js +231 -0
  741. package/sdk/dist/query/docs-init.js.map +1 -0
  742. package/sdk/dist/query/fallow-audit.d.ts +44 -0
  743. package/sdk/dist/query/fallow-audit.d.ts.map +1 -0
  744. package/sdk/dist/query/fallow-audit.js +44 -0
  745. package/sdk/dist/query/fallow-audit.js.map +1 -0
  746. package/sdk/dist/query/frontmatter-mutation.d.ts +77 -0
  747. package/sdk/dist/query/frontmatter-mutation.d.ts.map +1 -0
  748. package/sdk/dist/query/frontmatter-mutation.js +299 -0
  749. package/sdk/dist/query/frontmatter-mutation.js.map +1 -0
  750. package/sdk/dist/query/frontmatter.d.ts +93 -0
  751. package/sdk/dist/query/frontmatter.d.ts.map +1 -0
  752. package/sdk/dist/query/frontmatter.js +364 -0
  753. package/sdk/dist/query/frontmatter.js.map +1 -0
  754. package/sdk/dist/query/helpers.d.ts +194 -0
  755. package/sdk/dist/query/helpers.d.ts.map +1 -0
  756. package/sdk/dist/query/helpers.js +540 -0
  757. package/sdk/dist/query/helpers.js.map +1 -0
  758. package/sdk/dist/query/index.d.ts +8 -0
  759. package/sdk/dist/query/index.d.ts.map +1 -0
  760. package/sdk/dist/query/index.js +6 -0
  761. package/sdk/dist/query/index.js.map +1 -0
  762. package/sdk/dist/query/init-complex.d.ts +47 -0
  763. package/sdk/dist/query/init-complex.d.ts.map +1 -0
  764. package/sdk/dist/query/init-complex.js +735 -0
  765. package/sdk/dist/query/init-complex.js.map +1 -0
  766. package/sdk/dist/query/init.d.ts +106 -0
  767. package/sdk/dist/query/init.d.ts.map +1 -0
  768. package/sdk/dist/query/init.js +1228 -0
  769. package/sdk/dist/query/init.js.map +1 -0
  770. package/sdk/dist/query/intel.d.ts +43 -0
  771. package/sdk/dist/query/intel.d.ts.map +1 -0
  772. package/sdk/dist/query/intel.js +416 -0
  773. package/sdk/dist/query/intel.js.map +1 -0
  774. package/sdk/dist/query/mutation-event-decorator.d.ts +5 -0
  775. package/sdk/dist/query/mutation-event-decorator.d.ts.map +1 -0
  776. package/sdk/dist/query/mutation-event-decorator.js +28 -0
  777. package/sdk/dist/query/mutation-event-decorator.js.map +1 -0
  778. package/sdk/dist/query/mutation-event-mapper.d.ts +4 -0
  779. package/sdk/dist/query/mutation-event-mapper.d.ts.map +1 -0
  780. package/sdk/dist/query/mutation-event-mapper.js +70 -0
  781. package/sdk/dist/query/mutation-event-mapper.js.map +1 -0
  782. package/sdk/dist/query/mvp.d.ts +113 -0
  783. package/sdk/dist/query/mvp.d.ts.map +1 -0
  784. package/sdk/dist/query/mvp.js +225 -0
  785. package/sdk/dist/query/mvp.js.map +1 -0
  786. package/sdk/dist/query/phase-filesystem-adapter.d.ts +4 -0
  787. package/sdk/dist/query/phase-filesystem-adapter.d.ts.map +1 -0
  788. package/sdk/dist/query/phase-filesystem-adapter.js +33 -0
  789. package/sdk/dist/query/phase-filesystem-adapter.js.map +1 -0
  790. package/sdk/dist/query/phase-lifecycle-policy.d.ts +34 -0
  791. package/sdk/dist/query/phase-lifecycle-policy.d.ts.map +1 -0
  792. package/sdk/dist/query/phase-lifecycle-policy.js +138 -0
  793. package/sdk/dist/query/phase-lifecycle-policy.js.map +1 -0
  794. package/sdk/dist/query/phase-lifecycle.d.ts +116 -0
  795. package/sdk/dist/query/phase-lifecycle.d.ts.map +1 -0
  796. package/sdk/dist/query/phase-lifecycle.js +1823 -0
  797. package/sdk/dist/query/phase-lifecycle.js.map +1 -0
  798. package/sdk/dist/query/phase-list-queries.d.ts +20 -0
  799. package/sdk/dist/query/phase-list-queries.d.ts.map +1 -0
  800. package/sdk/dist/query/phase-list-queries.js +129 -0
  801. package/sdk/dist/query/phase-list-queries.js.map +1 -0
  802. package/sdk/dist/query/phase-ready.d.ts +9 -0
  803. package/sdk/dist/query/phase-ready.d.ts.map +1 -0
  804. package/sdk/dist/query/phase-ready.js +132 -0
  805. package/sdk/dist/query/phase-ready.js.map +1 -0
  806. package/sdk/dist/query/phase-roadmap-mutation.d.ts +25 -0
  807. package/sdk/dist/query/phase-roadmap-mutation.d.ts.map +1 -0
  808. package/sdk/dist/query/phase-roadmap-mutation.js +76 -0
  809. package/sdk/dist/query/phase-roadmap-mutation.js.map +1 -0
  810. package/sdk/dist/query/phase-uat-passed.d.ts +46 -0
  811. package/sdk/dist/query/phase-uat-passed.d.ts.map +1 -0
  812. package/sdk/dist/query/phase-uat-passed.js +238 -0
  813. package/sdk/dist/query/phase-uat-passed.js.map +1 -0
  814. package/sdk/dist/query/phase.d.ts +104 -0
  815. package/sdk/dist/query/phase.d.ts.map +1 -0
  816. package/sdk/dist/query/phase.js +617 -0
  817. package/sdk/dist/query/phase.js.map +1 -0
  818. package/sdk/dist/query/pipeline.d.ts +53 -0
  819. package/sdk/dist/query/pipeline.d.ts.map +1 -0
  820. package/sdk/dist/query/pipeline.js +198 -0
  821. package/sdk/dist/query/pipeline.js.map +1 -0
  822. package/sdk/dist/query/plan-scan.d.ts +14 -0
  823. package/sdk/dist/query/plan-scan.d.ts.map +1 -0
  824. package/sdk/dist/query/plan-scan.js +70 -0
  825. package/sdk/dist/query/plan-scan.js.map +1 -0
  826. package/sdk/dist/query/plan-task-structure.d.ts +9 -0
  827. package/sdk/dist/query/plan-task-structure.d.ts.map +1 -0
  828. package/sdk/dist/query/plan-task-structure.js +59 -0
  829. package/sdk/dist/query/plan-task-structure.js.map +1 -0
  830. package/sdk/dist/query/profile-extract-messages.d.ts +40 -0
  831. package/sdk/dist/query/profile-extract-messages.d.ts.map +1 -0
  832. package/sdk/dist/query/profile-extract-messages.js +195 -0
  833. package/sdk/dist/query/profile-extract-messages.js.map +1 -0
  834. package/sdk/dist/query/profile-output.d.ts +11 -0
  835. package/sdk/dist/query/profile-output.d.ts.map +1 -0
  836. package/sdk/dist/query/profile-output.js +873 -0
  837. package/sdk/dist/query/profile-output.js.map +1 -0
  838. package/sdk/dist/query/profile-questionnaire-data.d.ts +21 -0
  839. package/sdk/dist/query/profile-questionnaire-data.d.ts.map +1 -0
  840. package/sdk/dist/query/profile-questionnaire-data.js +171 -0
  841. package/sdk/dist/query/profile-questionnaire-data.js.map +1 -0
  842. package/sdk/dist/query/profile-sample.d.ts +22 -0
  843. package/sdk/dist/query/profile-sample.d.ts.map +1 -0
  844. package/sdk/dist/query/profile-sample.js +136 -0
  845. package/sdk/dist/query/profile-sample.js.map +1 -0
  846. package/sdk/dist/query/profile-scan-sessions.d.ts +49 -0
  847. package/sdk/dist/query/profile-scan-sessions.d.ts.map +1 -0
  848. package/sdk/dist/query/profile-scan-sessions.js +137 -0
  849. package/sdk/dist/query/profile-scan-sessions.js.map +1 -0
  850. package/sdk/dist/query/profile.d.ts +61 -0
  851. package/sdk/dist/query/profile.d.ts.map +1 -0
  852. package/sdk/dist/query/profile.js +307 -0
  853. package/sdk/dist/query/profile.js.map +1 -0
  854. package/sdk/dist/query/progress.d.ts +77 -0
  855. package/sdk/dist/query/progress.d.ts.map +1 -0
  856. package/sdk/dist/query/progress.js +481 -0
  857. package/sdk/dist/query/progress.js.map +1 -0
  858. package/sdk/dist/query/prompt-budget.d.ts +14 -0
  859. package/sdk/dist/query/prompt-budget.d.ts.map +1 -0
  860. package/sdk/dist/query/prompt-budget.js +417 -0
  861. package/sdk/dist/query/prompt-budget.js.map +1 -0
  862. package/sdk/dist/query/query-cli-adapter.d.ts +8 -0
  863. package/sdk/dist/query/query-cli-adapter.d.ts.map +1 -0
  864. package/sdk/dist/query/query-cli-adapter.js +32 -0
  865. package/sdk/dist/query/query-cli-adapter.js.map +1 -0
  866. package/sdk/dist/query/query-cli-output.d.ts +9 -0
  867. package/sdk/dist/query/query-cli-output.d.ts.map +1 -0
  868. package/sdk/dist/query/query-cli-output.js +28 -0
  869. package/sdk/dist/query/query-cli-output.js.map +1 -0
  870. package/sdk/dist/query/query-command-diagnosis.d.ts +6 -0
  871. package/sdk/dist/query/query-command-diagnosis.d.ts.map +1 -0
  872. package/sdk/dist/query/query-command-diagnosis.js +6 -0
  873. package/sdk/dist/query/query-command-diagnosis.js.map +1 -0
  874. package/sdk/dist/query/query-command-resolution-strategy.d.ts +29 -0
  875. package/sdk/dist/query/query-command-resolution-strategy.d.ts.map +1 -0
  876. package/sdk/dist/query/query-command-resolution-strategy.js +103 -0
  877. package/sdk/dist/query/query-command-resolution-strategy.js.map +1 -0
  878. package/sdk/dist/query/query-command-semantics.d.ts +7 -0
  879. package/sdk/dist/query/query-command-semantics.d.ts.map +1 -0
  880. package/sdk/dist/query/query-command-semantics.js +7 -0
  881. package/sdk/dist/query/query-command-semantics.js.map +1 -0
  882. package/sdk/dist/query/query-dispatch-contract.d.ts +21 -0
  883. package/sdk/dist/query/query-dispatch-contract.d.ts.map +1 -0
  884. package/sdk/dist/query/query-dispatch-contract.js +2 -0
  885. package/sdk/dist/query/query-dispatch-contract.js.map +1 -0
  886. package/sdk/dist/query/query-dispatch-error-mapper.d.ts +6 -0
  887. package/sdk/dist/query/query-dispatch-error-mapper.d.ts.map +1 -0
  888. package/sdk/dist/query/query-dispatch-error-mapper.js +6 -0
  889. package/sdk/dist/query/query-dispatch-error-mapper.js.map +1 -0
  890. package/sdk/dist/query/query-dispatch-formatting.d.ts +6 -0
  891. package/sdk/dist/query/query-dispatch-formatting.d.ts.map +1 -0
  892. package/sdk/dist/query/query-dispatch-formatting.js +6 -0
  893. package/sdk/dist/query/query-dispatch-formatting.js.map +1 -0
  894. package/sdk/dist/query/query-dispatch-observability.d.ts +2 -0
  895. package/sdk/dist/query/query-dispatch-observability.d.ts.map +1 -0
  896. package/sdk/dist/query/query-dispatch-observability.js +7 -0
  897. package/sdk/dist/query/query-dispatch-observability.js.map +1 -0
  898. package/sdk/dist/query/query-dispatch.d.ts +48 -0
  899. package/sdk/dist/query/query-dispatch.d.ts.map +1 -0
  900. package/sdk/dist/query/query-dispatch.js +175 -0
  901. package/sdk/dist/query/query-dispatch.js.map +1 -0
  902. package/sdk/dist/query/query-error-details-schema.d.ts +19 -0
  903. package/sdk/dist/query/query-error-details-schema.d.ts.map +1 -0
  904. package/sdk/dist/query/query-error-details-schema.js +10 -0
  905. package/sdk/dist/query/query-error-details-schema.js.map +1 -0
  906. package/sdk/dist/query/query-error-taxonomy.d.ts +38 -0
  907. package/sdk/dist/query/query-error-taxonomy.d.ts.map +1 -0
  908. package/sdk/dist/query/query-error-taxonomy.js +74 -0
  909. package/sdk/dist/query/query-error-taxonomy.js.map +1 -0
  910. package/sdk/dist/query/query-fallback-bridge-adapter.d.ts +14 -0
  911. package/sdk/dist/query/query-fallback-bridge-adapter.d.ts.map +1 -0
  912. package/sdk/dist/query/query-fallback-bridge-adapter.js +33 -0
  913. package/sdk/dist/query/query-fallback-bridge-adapter.js.map +1 -0
  914. package/sdk/dist/query/query-fallback-executor.d.ts +11 -0
  915. package/sdk/dist/query/query-fallback-executor.d.ts.map +1 -0
  916. package/sdk/dist/query/query-fallback-executor.js +31 -0
  917. package/sdk/dist/query/query-fallback-executor.js.map +1 -0
  918. package/sdk/dist/query/query-fallback-output-classifier.d.ts +6 -0
  919. package/sdk/dist/query/query-fallback-output-classifier.d.ts.map +1 -0
  920. package/sdk/dist/query/query-fallback-output-classifier.js +27 -0
  921. package/sdk/dist/query/query-fallback-output-classifier.js.map +1 -0
  922. package/sdk/dist/query/query-fallback-policy.d.ts +6 -0
  923. package/sdk/dist/query/query-fallback-policy.d.ts.map +1 -0
  924. package/sdk/dist/query/query-fallback-policy.js +7 -0
  925. package/sdk/dist/query/query-fallback-policy.js.map +1 -0
  926. package/sdk/dist/query/query-native-dispatch-adapter.d.ts +7 -0
  927. package/sdk/dist/query/query-native-dispatch-adapter.d.ts.map +1 -0
  928. package/sdk/dist/query/query-native-dispatch-adapter.js +6 -0
  929. package/sdk/dist/query/query-native-dispatch-adapter.js.map +1 -0
  930. package/sdk/dist/query/query-policy-capability.d.ts +10 -0
  931. package/sdk/dist/query/query-policy-capability.d.ts.map +1 -0
  932. package/sdk/dist/query/query-policy-capability.js +17 -0
  933. package/sdk/dist/query/query-policy-capability.js.map +1 -0
  934. package/sdk/dist/query/query-runtime-context.d.ts +19 -0
  935. package/sdk/dist/query/query-runtime-context.d.ts.map +1 -0
  936. package/sdk/dist/query/query-runtime-context.js +31 -0
  937. package/sdk/dist/query/query-runtime-context.js.map +1 -0
  938. package/sdk/dist/query/query-unknown-command-hints.d.ts +2 -0
  939. package/sdk/dist/query/query-unknown-command-hints.d.ts.map +1 -0
  940. package/sdk/dist/query/query-unknown-command-hints.js +6 -0
  941. package/sdk/dist/query/query-unknown-command-hints.js.map +1 -0
  942. package/sdk/dist/query/registry-assembly-descriptor.d.ts +12 -0
  943. package/sdk/dist/query/registry-assembly-descriptor.d.ts.map +1 -0
  944. package/sdk/dist/query/registry-assembly-descriptor.js +61 -0
  945. package/sdk/dist/query/registry-assembly-descriptor.js.map +1 -0
  946. package/sdk/dist/query/registry-assembly-invariants.d.ts +30 -0
  947. package/sdk/dist/query/registry-assembly-invariants.d.ts.map +1 -0
  948. package/sdk/dist/query/registry-assembly-invariants.js +77 -0
  949. package/sdk/dist/query/registry-assembly-invariants.js.map +1 -0
  950. package/sdk/dist/query/registry-assembly.d.ts +10 -0
  951. package/sdk/dist/query/registry-assembly.d.ts.map +1 -0
  952. package/sdk/dist/query/registry-assembly.js +53 -0
  953. package/sdk/dist/query/registry-assembly.js.map +1 -0
  954. package/sdk/dist/query/registry.d.ts +90 -0
  955. package/sdk/dist/query/registry.d.ts.map +1 -0
  956. package/sdk/dist/query/registry.js +129 -0
  957. package/sdk/dist/query/registry.js.map +1 -0
  958. package/sdk/dist/query/requirements-extract-from-plans.d.ts +9 -0
  959. package/sdk/dist/query/requirements-extract-from-plans.d.ts.map +1 -0
  960. package/sdk/dist/query/requirements-extract-from-plans.js +76 -0
  961. package/sdk/dist/query/requirements-extract-from-plans.js.map +1 -0
  962. package/sdk/dist/query/roadmap-update-plan-progress.d.ts +11 -0
  963. package/sdk/dist/query/roadmap-update-plan-progress.d.ts.map +1 -0
  964. package/sdk/dist/query/roadmap-update-plan-progress.js +124 -0
  965. package/sdk/dist/query/roadmap-update-plan-progress.js.map +1 -0
  966. package/sdk/dist/query/roadmap.d.ts +160 -0
  967. package/sdk/dist/query/roadmap.d.ts.map +1 -0
  968. package/sdk/dist/query/roadmap.js +982 -0
  969. package/sdk/dist/query/roadmap.js.map +1 -0
  970. package/sdk/dist/query/route-next-action.d.ts +9 -0
  971. package/sdk/dist/query/route-next-action.d.ts.map +1 -0
  972. package/sdk/dist/query/route-next-action.js +318 -0
  973. package/sdk/dist/query/route-next-action.js.map +1 -0
  974. package/sdk/dist/query/schema-detect.d.ts +21 -0
  975. package/sdk/dist/query/schema-detect.d.ts.map +1 -0
  976. package/sdk/dist/query/schema-detect.js +146 -0
  977. package/sdk/dist/query/schema-detect.js.map +1 -0
  978. package/sdk/dist/query/secrets.d.ts +27 -0
  979. package/sdk/dist/query/secrets.d.ts.map +1 -0
  980. package/sdk/dist/query/secrets.js +42 -0
  981. package/sdk/dist/query/secrets.js.map +1 -0
  982. package/sdk/dist/query/skill-manifest.d.ts +50 -0
  983. package/sdk/dist/query/skill-manifest.d.ts.map +1 -0
  984. package/sdk/dist/query/skill-manifest.js +171 -0
  985. package/sdk/dist/query/skill-manifest.js.map +1 -0
  986. package/sdk/dist/query/skills.d.ts +27 -0
  987. package/sdk/dist/query/skills.d.ts.map +1 -0
  988. package/sdk/dist/query/skills.js +137 -0
  989. package/sdk/dist/query/skills.js.map +1 -0
  990. package/sdk/dist/query/state-document.d.ts +14 -0
  991. package/sdk/dist/query/state-document.d.ts.map +1 -0
  992. package/sdk/dist/query/state-document.js +110 -0
  993. package/sdk/dist/query/state-document.js.map +1 -0
  994. package/sdk/dist/query/state-mutation.d.ts +224 -0
  995. package/sdk/dist/query/state-mutation.d.ts.map +1 -0
  996. package/sdk/dist/query/state-mutation.js +1635 -0
  997. package/sdk/dist/query/state-mutation.js.map +1 -0
  998. package/sdk/dist/query/state-project-load.d.ts +23 -0
  999. package/sdk/dist/query/state-project-load.d.ts.map +1 -0
  1000. package/sdk/dist/query/state-project-load.js +75 -0
  1001. package/sdk/dist/query/state-project-load.js.map +1 -0
  1002. package/sdk/dist/query/state.d.ts +78 -0
  1003. package/sdk/dist/query/state.d.ts.map +1 -0
  1004. package/sdk/dist/query/state.js +443 -0
  1005. package/sdk/dist/query/state.js.map +1 -0
  1006. package/sdk/dist/query/summary.d.ts +18 -0
  1007. package/sdk/dist/query/summary.d.ts.map +1 -0
  1008. package/sdk/dist/query/summary.js +249 -0
  1009. package/sdk/dist/query/summary.js.map +1 -0
  1010. package/sdk/dist/query/template.d.ts +46 -0
  1011. package/sdk/dist/query/template.d.ts.map +1 -0
  1012. package/sdk/dist/query/template.js +210 -0
  1013. package/sdk/dist/query/template.js.map +1 -0
  1014. package/sdk/dist/query/uat.d.ts +42 -0
  1015. package/sdk/dist/query/uat.d.ts.map +1 -0
  1016. package/sdk/dist/query/uat.js +339 -0
  1017. package/sdk/dist/query/uat.js.map +1 -0
  1018. package/sdk/dist/query/utils.d.ts +59 -0
  1019. package/sdk/dist/query/utils.d.ts.map +1 -0
  1020. package/sdk/dist/query/utils.js +74 -0
  1021. package/sdk/dist/query/utils.js.map +1 -0
  1022. package/sdk/dist/query/validate.d.ts +67 -0
  1023. package/sdk/dist/query/validate.d.ts.map +1 -0
  1024. package/sdk/dist/query/validate.js +1001 -0
  1025. package/sdk/dist/query/validate.js.map +1 -0
  1026. package/sdk/dist/query/verify.d.ts +98 -0
  1027. package/sdk/dist/query/verify.d.ts.map +1 -0
  1028. package/sdk/dist/query/verify.js +593 -0
  1029. package/sdk/dist/query/verify.js.map +1 -0
  1030. package/sdk/dist/query/websearch.d.ts +24 -0
  1031. package/sdk/dist/query/websearch.d.ts.map +1 -0
  1032. package/sdk/dist/query/websearch.js +68 -0
  1033. package/sdk/dist/query/websearch.js.map +1 -0
  1034. package/sdk/dist/query/workspace.d.ts +62 -0
  1035. package/sdk/dist/query/workspace.d.ts.map +1 -0
  1036. package/sdk/dist/query/workspace.js +104 -0
  1037. package/sdk/dist/query/workspace.js.map +1 -0
  1038. package/sdk/dist/query/workstream-inventory.d.ts +24 -0
  1039. package/sdk/dist/query/workstream-inventory.d.ts.map +1 -0
  1040. package/sdk/dist/query/workstream-inventory.js +120 -0
  1041. package/sdk/dist/query/workstream-inventory.js.map +1 -0
  1042. package/sdk/dist/query/workstream.d.ts +35 -0
  1043. package/sdk/dist/query/workstream.d.ts.map +1 -0
  1044. package/sdk/dist/query/workstream.js +298 -0
  1045. package/sdk/dist/query/workstream.js.map +1 -0
  1046. package/sdk/dist/query/worktree.d.ts +9 -0
  1047. package/sdk/dist/query/worktree.d.ts.map +1 -0
  1048. package/sdk/dist/query/worktree.js +79 -0
  1049. package/sdk/dist/query/worktree.js.map +1 -0
  1050. package/sdk/dist/query-command-executor.d.ts +22 -0
  1051. package/sdk/dist/query-command-executor.d.ts.map +1 -0
  1052. package/sdk/dist/query-command-executor.js +22 -0
  1053. package/sdk/dist/query-command-executor.js.map +1 -0
  1054. package/sdk/dist/query-execution-policy.d.ts +24 -0
  1055. package/sdk/dist/query-execution-policy.d.ts.map +1 -0
  1056. package/sdk/dist/query-execution-policy.js +27 -0
  1057. package/sdk/dist/query-execution-policy.js.map +1 -0
  1058. package/sdk/dist/query-failure-classification.d.ts +9 -0
  1059. package/sdk/dist/query-failure-classification.d.ts.map +1 -0
  1060. package/sdk/dist/query-failure-classification.js +32 -0
  1061. package/sdk/dist/query-failure-classification.js.map +1 -0
  1062. package/sdk/dist/query-gsd-tools-path.d.ts +2 -0
  1063. package/sdk/dist/query-gsd-tools-path.d.ts.map +1 -0
  1064. package/sdk/dist/query-gsd-tools-path.js +2 -0
  1065. package/sdk/dist/query-gsd-tools-path.js.map +1 -0
  1066. package/sdk/dist/query-gsd-tools-runtime.d.ts +20 -0
  1067. package/sdk/dist/query-gsd-tools-runtime.d.ts.map +1 -0
  1068. package/sdk/dist/query-gsd-tools-runtime.js +47 -0
  1069. package/sdk/dist/query-gsd-tools-runtime.js.map +1 -0
  1070. package/sdk/dist/query-hotpath-methods.d.ts +19 -0
  1071. package/sdk/dist/query-hotpath-methods.d.ts.map +1 -0
  1072. package/sdk/dist/query-hotpath-methods.js +34 -0
  1073. package/sdk/dist/query-hotpath-methods.js.map +1 -0
  1074. package/sdk/dist/query-native-direct-adapter.d.ts +20 -0
  1075. package/sdk/dist/query-native-direct-adapter.d.ts.map +1 -0
  1076. package/sdk/dist/query-native-direct-adapter.js +52 -0
  1077. package/sdk/dist/query-native-direct-adapter.js.map +1 -0
  1078. package/sdk/dist/query-native-hotpath-adapter.d.ts +15 -0
  1079. package/sdk/dist/query-native-hotpath-adapter.d.ts.map +1 -0
  1080. package/sdk/dist/query-native-hotpath-adapter.js +32 -0
  1081. package/sdk/dist/query-native-hotpath-adapter.js.map +1 -0
  1082. package/sdk/dist/query-raw-output-projection.d.ts +6 -0
  1083. package/sdk/dist/query-raw-output-projection.d.ts.map +1 -0
  1084. package/sdk/dist/query-raw-output-projection.js +86 -0
  1085. package/sdk/dist/query-raw-output-projection.js.map +1 -0
  1086. package/sdk/dist/query-runtime-bridge.d.ts +61 -0
  1087. package/sdk/dist/query-runtime-bridge.d.ts.map +1 -0
  1088. package/sdk/dist/query-runtime-bridge.js +144 -0
  1089. package/sdk/dist/query-runtime-bridge.js.map +1 -0
  1090. package/sdk/dist/query-subprocess-adapter.d.ts +18 -0
  1091. package/sdk/dist/query-subprocess-adapter.d.ts.map +1 -0
  1092. package/sdk/dist/query-subprocess-adapter.js +92 -0
  1093. package/sdk/dist/query-subprocess-adapter.js.map +1 -0
  1094. package/sdk/dist/query-tools-error-factory.d.ts +16 -0
  1095. package/sdk/dist/query-tools-error-factory.d.ts.map +1 -0
  1096. package/sdk/dist/query-tools-error-factory.js +33 -0
  1097. package/sdk/dist/query-tools-error-factory.js.map +1 -0
  1098. package/sdk/dist/research-gate.d.ts +24 -0
  1099. package/sdk/dist/research-gate.d.ts.map +1 -0
  1100. package/sdk/dist/research-gate.js +70 -0
  1101. package/sdk/dist/research-gate.js.map +1 -0
  1102. package/sdk/dist/runtime-bridge-sync/index.d.ts +96 -0
  1103. package/sdk/dist/runtime-bridge-sync/index.d.ts.map +1 -0
  1104. package/sdk/dist/runtime-bridge-sync/index.js +109 -0
  1105. package/sdk/dist/runtime-bridge-sync/index.js.map +1 -0
  1106. package/sdk/dist/runtime-bridge-sync/worker.d.ts +2 -0
  1107. package/sdk/dist/runtime-bridge-sync/worker.d.ts.map +1 -0
  1108. package/sdk/dist/runtime-bridge-sync/worker.js +180 -0
  1109. package/sdk/dist/runtime-bridge-sync/worker.js.map +1 -0
  1110. package/sdk/dist/runtime-gate.d.ts +14 -0
  1111. package/sdk/dist/runtime-gate.d.ts.map +1 -0
  1112. package/sdk/dist/runtime-gate.js +48 -0
  1113. package/sdk/dist/runtime-gate.js.map +1 -0
  1114. package/sdk/dist/sdk-package-compatibility.d.ts +38 -0
  1115. package/sdk/dist/sdk-package-compatibility.d.ts.map +1 -0
  1116. package/sdk/dist/sdk-package-compatibility.js +90 -0
  1117. package/sdk/dist/sdk-package-compatibility.js.map +1 -0
  1118. package/sdk/dist/session-runner.d.ts +40 -0
  1119. package/sdk/dist/session-runner.d.ts.map +1 -0
  1120. package/sdk/dist/session-runner.js +274 -0
  1121. package/sdk/dist/session-runner.js.map +1 -0
  1122. package/sdk/dist/tool-scoping.d.ts +31 -0
  1123. package/sdk/dist/tool-scoping.d.ts.map +1 -0
  1124. package/sdk/dist/tool-scoping.js +54 -0
  1125. package/sdk/dist/tool-scoping.js.map +1 -0
  1126. package/sdk/dist/types.d.ts +794 -0
  1127. package/sdk/dist/types.d.ts.map +1 -0
  1128. package/sdk/dist/types.js +77 -0
  1129. package/sdk/dist/types.js.map +1 -0
  1130. package/sdk/dist/workstream-inventory/builder.d.ts +88 -0
  1131. package/sdk/dist/workstream-inventory/builder.d.ts.map +1 -0
  1132. package/sdk/dist/workstream-inventory/builder.js +84 -0
  1133. package/sdk/dist/workstream-inventory/builder.js.map +1 -0
  1134. package/sdk/dist/workstream-name-policy.d.ts +37 -0
  1135. package/sdk/dist/workstream-name-policy.d.ts.map +1 -0
  1136. package/sdk/dist/workstream-name-policy.js +53 -0
  1137. package/sdk/dist/workstream-name-policy.js.map +1 -0
  1138. package/sdk/dist/workstream-utils.d.ts +23 -0
  1139. package/sdk/dist/workstream-utils.d.ts.map +1 -0
  1140. package/sdk/dist/workstream-utils.js +34 -0
  1141. package/sdk/dist/workstream-utils.js.map +1 -0
  1142. package/sdk/dist/ws-transport.d.ts +32 -0
  1143. package/sdk/dist/ws-transport.d.ts.map +1 -0
  1144. package/sdk/dist/ws-transport.js +84 -0
  1145. package/sdk/dist/ws-transport.js.map +1 -0
  1146. package/sdk/package-lock.json +2530 -0
  1147. package/sdk/package.json +77 -0
  1148. package/sdk/prompts/templates/project.md +186 -0
  1149. package/sdk/prompts/templates/requirements.md +231 -0
  1150. package/sdk/prompts/templates/research-project/ARCHITECTURE.md +204 -0
  1151. package/sdk/prompts/templates/research-project/FEATURES.md +147 -0
  1152. package/sdk/prompts/templates/research-project/PITFALLS.md +200 -0
  1153. package/sdk/prompts/templates/research-project/STACK.md +120 -0
  1154. package/sdk/prompts/templates/research-project/SUMMARY.md +170 -0
  1155. package/sdk/prompts/templates/roadmap.md +202 -0
  1156. package/sdk/prompts/templates/state.md +175 -0
  1157. package/sdk/shared/config-defaults.manifest.json +75 -0
  1158. package/sdk/shared/config-schema.manifest.json +151 -0
  1159. package/sdk/shared/model-catalog.json +122 -0
  1160. package/sdk/src/assembled-prompts.test.ts +349 -0
  1161. package/sdk/src/bug-3589-planning-paths-validation.test.ts +89 -0
  1162. package/sdk/src/bug-3591-gsdtools-runtime-workstream.test.ts +179 -0
  1163. package/sdk/src/cli-transport.test.ts +388 -0
  1164. package/sdk/src/cli-transport.ts +130 -0
  1165. package/sdk/src/cli.test.ts +426 -0
  1166. package/sdk/src/cli.ts +589 -0
  1167. package/sdk/src/config.test.ts +277 -0
  1168. package/sdk/src/config.ts +202 -0
  1169. package/sdk/src/configuration/index.test.ts +318 -0
  1170. package/sdk/src/configuration/index.ts +325 -0
  1171. package/sdk/src/context-engine.test.ts +295 -0
  1172. package/sdk/src/context-engine.ts +170 -0
  1173. package/sdk/src/context-truncation.test.ts +163 -0
  1174. package/sdk/src/context-truncation.ts +233 -0
  1175. package/sdk/src/e2e.integration.test.ts +181 -0
  1176. package/sdk/src/errors.ts +72 -0
  1177. package/sdk/src/event-stream.test.ts +661 -0
  1178. package/sdk/src/event-stream.ts +441 -0
  1179. package/sdk/src/golden/capture.ts +95 -0
  1180. package/sdk/src/golden/fixtures/generate-slug.golden.json +1 -0
  1181. package/sdk/src/golden/fixtures/profile-sample-sessions/demo-project/sample.jsonl +3 -0
  1182. package/sdk/src/golden/fixtures/summary-extract-sample.md +26 -0
  1183. package/sdk/src/golden/fixtures/uat-render-checkpoint-sample.md +15 -0
  1184. package/sdk/src/golden/golden-integration-covered.ts +30 -0
  1185. package/sdk/src/golden/golden-mutation-covered.ts +17 -0
  1186. package/sdk/src/golden/golden-policy.test.ts +8 -0
  1187. package/sdk/src/golden/golden-policy.ts +120 -0
  1188. package/sdk/src/golden/golden.integration.test.ts +1031 -0
  1189. package/sdk/src/golden/init-golden-normalize.ts +15 -0
  1190. package/sdk/src/golden/read-only-golden-rows.ts +77 -0
  1191. package/sdk/src/golden/read-only-parity.integration.test.ts +133 -0
  1192. package/sdk/src/golden/registry-canonical-commands.ts +31 -0
  1193. package/sdk/src/gsd-tools-error.test.ts +21 -0
  1194. package/sdk/src/gsd-tools-error.ts +65 -0
  1195. package/sdk/src/gsd-tools.test.ts +472 -0
  1196. package/sdk/src/gsd-tools.ts +237 -0
  1197. package/sdk/src/gsd-transport-policy.test.ts +34 -0
  1198. package/sdk/src/gsd-transport-policy.ts +48 -0
  1199. package/sdk/src/gsd-transport.test.ts +299 -0
  1200. package/sdk/src/gsd-transport.ts +118 -0
  1201. package/sdk/src/index.ts +366 -0
  1202. package/sdk/src/init-e2e.integration.test.ts +138 -0
  1203. package/sdk/src/init-runner.test.ts +740 -0
  1204. package/sdk/src/init-runner.ts +734 -0
  1205. package/sdk/src/lifecycle-e2e.integration.test.ts +258 -0
  1206. package/sdk/src/logger.test.ts +149 -0
  1207. package/sdk/src/logger.ts +113 -0
  1208. package/sdk/src/milestone-runner.test.ts +421 -0
  1209. package/sdk/src/model-catalog.ts +70 -0
  1210. package/sdk/src/phase-prompt.ts +259 -0
  1211. package/sdk/src/phase-runner.integration.test.ts +377 -0
  1212. package/sdk/src/phase-runner.test.ts +3660 -0
  1213. package/sdk/src/phase-runner.ts +1442 -0
  1214. package/sdk/src/plan-parser.test.ts +579 -0
  1215. package/sdk/src/plan-parser.ts +431 -0
  1216. package/sdk/src/planning-journal.test.ts +70 -0
  1217. package/sdk/src/planning-journal.ts +153 -0
  1218. package/sdk/src/planning-runtime.test.ts +29 -0
  1219. package/sdk/src/planning-runtime.ts +100 -0
  1220. package/sdk/src/project-root/index.test.ts +186 -0
  1221. package/sdk/src/project-root/index.ts +144 -0
  1222. package/sdk/src/prompt-builder.test.ts +318 -0
  1223. package/sdk/src/prompt-builder.ts +218 -0
  1224. package/sdk/src/prompt-sanitizer.test.ts +260 -0
  1225. package/sdk/src/prompt-sanitizer.ts +116 -0
  1226. package/sdk/src/query/QUERY-HANDLERS.md +349 -0
  1227. package/sdk/src/query/active-workstream-store.ts +50 -0
  1228. package/sdk/src/query/agent-failure-classifier.test.ts +157 -0
  1229. package/sdk/src/query/agent-failure-classifier.ts +105 -0
  1230. package/sdk/src/query/audit-open.ts +722 -0
  1231. package/sdk/src/query/check-auto-mode.test.ts +77 -0
  1232. package/sdk/src/query/check-auto-mode.ts +49 -0
  1233. package/sdk/src/query/check-completion.test.ts +113 -0
  1234. package/sdk/src/query/check-completion.ts +182 -0
  1235. package/sdk/src/query/check-decision-coverage.test.ts +519 -0
  1236. package/sdk/src/query/check-decision-coverage.ts +554 -0
  1237. package/sdk/src/query/check-gates.test.ts +103 -0
  1238. package/sdk/src/query/check-gates.ts +112 -0
  1239. package/sdk/src/query/check-ship-ready.test.ts +303 -0
  1240. package/sdk/src/query/check-ship-ready.ts +136 -0
  1241. package/sdk/src/query/check-verification-status.test.ts +143 -0
  1242. package/sdk/src/query/check-verification-status.ts +160 -0
  1243. package/sdk/src/query/command-aliases.generated.ts +154 -0
  1244. package/sdk/src/query/command-catalog.ts +31 -0
  1245. package/sdk/src/query/command-definition.test.ts +47 -0
  1246. package/sdk/src/query/command-definition.ts +70 -0
  1247. package/sdk/src/query/command-family-handlers.ts +123 -0
  1248. package/sdk/src/query/command-manifest.init.ts +24 -0
  1249. package/sdk/src/query/command-manifest.non-family.ts +86 -0
  1250. package/sdk/src/query/command-manifest.phase.ts +17 -0
  1251. package/sdk/src/query/command-manifest.phases.ts +11 -0
  1252. package/sdk/src/query/command-manifest.roadmap.ts +11 -0
  1253. package/sdk/src/query/command-manifest.state.ts +31 -0
  1254. package/sdk/src/query/command-manifest.ts +17 -0
  1255. package/sdk/src/query/command-manifest.types.ts +13 -0
  1256. package/sdk/src/query/command-manifest.validate.ts +11 -0
  1257. package/sdk/src/query/command-manifest.verify.ts +17 -0
  1258. package/sdk/src/query/command-resolution.test.ts +70 -0
  1259. package/sdk/src/query/command-seam-coverage.test.ts +118 -0
  1260. package/sdk/src/query/command-static-catalog-domain.ts +111 -0
  1261. package/sdk/src/query/command-static-catalog-foundation.ts +111 -0
  1262. package/sdk/src/query/command-topology.test.ts +28 -0
  1263. package/sdk/src/query/command-topology.ts +114 -0
  1264. package/sdk/src/query/commands-list.test.ts +36 -0
  1265. package/sdk/src/query/commands-list.ts +19 -0
  1266. package/sdk/src/query/commit.test.ts +485 -0
  1267. package/sdk/src/query/commit.ts +717 -0
  1268. package/sdk/src/query/config-gates.test.ts +89 -0
  1269. package/sdk/src/query/config-gates.ts +69 -0
  1270. package/sdk/src/query/config-mutation.test.ts +598 -0
  1271. package/sdk/src/query/config-mutation.ts +705 -0
  1272. package/sdk/src/query/config-query.test.ts +472 -0
  1273. package/sdk/src/query/config-query.ts +314 -0
  1274. package/sdk/src/query/config-schema.ts +35 -0
  1275. package/sdk/src/query/decisions.test.ts +221 -0
  1276. package/sdk/src/query/decisions.ts +196 -0
  1277. package/sdk/src/query/decomposed-handlers.test.ts +431 -0
  1278. package/sdk/src/query/detect-custom-files.test.ts +115 -0
  1279. package/sdk/src/query/detect-custom-files.ts +96 -0
  1280. package/sdk/src/query/detect-phase-type.test.ts +105 -0
  1281. package/sdk/src/query/detect-phase-type.ts +141 -0
  1282. package/sdk/src/query/docs-init.ts +258 -0
  1283. package/sdk/src/query/fallow-audit.ts +88 -0
  1284. package/sdk/src/query/frontmatter-array.test.ts +14 -0
  1285. package/sdk/src/query/frontmatter-mutation.test.ts +259 -0
  1286. package/sdk/src/query/frontmatter-mutation.ts +328 -0
  1287. package/sdk/src/query/frontmatter.test.ts +326 -0
  1288. package/sdk/src/query/frontmatter.ts +395 -0
  1289. package/sdk/src/query/helpers.test.ts +615 -0
  1290. package/sdk/src/query/helpers.ts +566 -0
  1291. package/sdk/src/query/index-thin-seam.test.ts +16 -0
  1292. package/sdk/src/query/index.ts +9 -0
  1293. package/sdk/src/query/init-complex.test.ts +788 -0
  1294. package/sdk/src/query/init-complex.ts +815 -0
  1295. package/sdk/src/query/init-workstream-milestone-op.test.ts +321 -0
  1296. package/sdk/src/query/init.test.ts +791 -0
  1297. package/sdk/src/query/init.ts +1335 -0
  1298. package/sdk/src/query/intel.test.ts +90 -0
  1299. package/sdk/src/query/intel.ts +404 -0
  1300. package/sdk/src/query/mutation-event-decorator.test.ts +45 -0
  1301. package/sdk/src/query/mutation-event-decorator.ts +37 -0
  1302. package/sdk/src/query/mutation-event-mapper.test.ts +33 -0
  1303. package/sdk/src/query/mutation-event-mapper.ts +102 -0
  1304. package/sdk/src/query/mvp.test.ts +335 -0
  1305. package/sdk/src/query/mvp.ts +292 -0
  1306. package/sdk/src/query/normalize-query-command.test.ts +102 -0
  1307. package/sdk/src/query/phase-filesystem-adapter.ts +35 -0
  1308. package/sdk/src/query/phase-lifecycle-policy.ts +171 -0
  1309. package/sdk/src/query/phase-lifecycle.test.ts +1971 -0
  1310. package/sdk/src/query/phase-lifecycle.ts +2210 -0
  1311. package/sdk/src/query/phase-list-queries.test.ts +88 -0
  1312. package/sdk/src/query/phase-list-queries.ts +152 -0
  1313. package/sdk/src/query/phase-ready.test.ts +65 -0
  1314. package/sdk/src/query/phase-ready.ts +159 -0
  1315. package/sdk/src/query/phase-roadmap-mutation.ts +82 -0
  1316. package/sdk/src/query/phase-uat-passed.test.ts +593 -0
  1317. package/sdk/src/query/phase-uat-passed.ts +297 -0
  1318. package/sdk/src/query/phase.test.ts +693 -0
  1319. package/sdk/src/query/phase.ts +741 -0
  1320. package/sdk/src/query/pipeline.test.ts +169 -0
  1321. package/sdk/src/query/pipeline.ts +243 -0
  1322. package/sdk/src/query/plan-scan.test.ts +35 -0
  1323. package/sdk/src/query/plan-scan.ts +82 -0
  1324. package/sdk/src/query/plan-task-structure.test.ts +65 -0
  1325. package/sdk/src/query/plan-task-structure.ts +63 -0
  1326. package/sdk/src/query/policy-convergence.test.ts +28 -0
  1327. package/sdk/src/query/profile-extract-messages.ts +247 -0
  1328. package/sdk/src/query/profile-output.ts +929 -0
  1329. package/sdk/src/query/profile-questionnaire-data.ts +181 -0
  1330. package/sdk/src/query/profile-sample.ts +184 -0
  1331. package/sdk/src/query/profile-scan-sessions.ts +174 -0
  1332. package/sdk/src/query/profile.test.ts +136 -0
  1333. package/sdk/src/query/profile.ts +337 -0
  1334. package/sdk/src/query/progress.test.ts +156 -0
  1335. package/sdk/src/query/progress.ts +566 -0
  1336. package/sdk/src/query/prompt-budget.ts +556 -0
  1337. package/sdk/src/query/query-cli-adapter.test.ts +79 -0
  1338. package/sdk/src/query/query-cli-adapter.ts +39 -0
  1339. package/sdk/src/query/query-cli-output.test.ts +33 -0
  1340. package/sdk/src/query/query-cli-output.ts +35 -0
  1341. package/sdk/src/query/query-command-diagnosis.test.ts +22 -0
  1342. package/sdk/src/query/query-command-diagnosis.ts +5 -0
  1343. package/sdk/src/query/query-command-resolution-strategy.test.ts +34 -0
  1344. package/sdk/src/query/query-command-resolution-strategy.ts +121 -0
  1345. package/sdk/src/query/query-command-semantics.test.ts +22 -0
  1346. package/sdk/src/query/query-command-semantics.ts +22 -0
  1347. package/sdk/src/query/query-dispatch-contract.ts +30 -0
  1348. package/sdk/src/query/query-dispatch-error-mapper.ts +5 -0
  1349. package/sdk/src/query/query-dispatch-formatting.ts +5 -0
  1350. package/sdk/src/query/query-dispatch-observability.ts +6 -0
  1351. package/sdk/src/query/query-dispatch.test.ts +699 -0
  1352. package/sdk/src/query/query-dispatch.ts +243 -0
  1353. package/sdk/src/query/query-error-details-schema.ts +29 -0
  1354. package/sdk/src/query/query-error-taxonomy.test.ts +39 -0
  1355. package/sdk/src/query/query-error-taxonomy.ts +117 -0
  1356. package/sdk/src/query/query-fallback-bridge-adapter.test.ts +32 -0
  1357. package/sdk/src/query/query-fallback-bridge-adapter.ts +54 -0
  1358. package/sdk/src/query/query-fallback-executor.test.ts +82 -0
  1359. package/sdk/src/query/query-fallback-executor.ts +44 -0
  1360. package/sdk/src/query/query-fallback-output-classifier.test.ts +36 -0
  1361. package/sdk/src/query/query-fallback-output-classifier.ts +31 -0
  1362. package/sdk/src/query/query-fallback-policy.test.ts +13 -0
  1363. package/sdk/src/query/query-fallback-policy.ts +11 -0
  1364. package/sdk/src/query/query-native-dispatch-adapter.ts +16 -0
  1365. package/sdk/src/query/query-policy-capability.test.ts +10 -0
  1366. package/sdk/src/query/query-policy-capability.ts +26 -0
  1367. package/sdk/src/query/query-policy-snapshot.test.ts +9 -0
  1368. package/sdk/src/query/query-registry-capability.test.ts +14 -0
  1369. package/sdk/src/query/query-runtime-context.ts +44 -0
  1370. package/sdk/src/query/query-unknown-command-hints.test.ts +9 -0
  1371. package/sdk/src/query/query-unknown-command-hints.ts +5 -0
  1372. package/sdk/src/query/registry-assembly-descriptor.ts +87 -0
  1373. package/sdk/src/query/registry-assembly-invariants.ts +127 -0
  1374. package/sdk/src/query/registry-assembly.test.ts +138 -0
  1375. package/sdk/src/query/registry-assembly.ts +78 -0
  1376. package/sdk/src/query/registry.test.ts +208 -0
  1377. package/sdk/src/query/registry.ts +142 -0
  1378. package/sdk/src/query/requirements-extract-from-plans.test.ts +58 -0
  1379. package/sdk/src/query/requirements-extract-from-plans.ts +86 -0
  1380. package/sdk/src/query/roadmap-update-plan-progress.test.ts +233 -0
  1381. package/sdk/src/query/roadmap-update-plan-progress.ts +159 -0
  1382. package/sdk/src/query/roadmap.test.ts +1250 -0
  1383. package/sdk/src/query/roadmap.ts +1131 -0
  1384. package/sdk/src/query/route-next-action.test.ts +61 -0
  1385. package/sdk/src/query/route-next-action.ts +345 -0
  1386. package/sdk/src/query/schema-detect.ts +189 -0
  1387. package/sdk/src/query/secrets.test.ts +66 -0
  1388. package/sdk/src/query/secrets.ts +43 -0
  1389. package/sdk/src/query/skill-manifest.test.ts +62 -0
  1390. package/sdk/src/query/skill-manifest.ts +216 -0
  1391. package/sdk/src/query/skills.test.ts +234 -0
  1392. package/sdk/src/query/skills.ts +143 -0
  1393. package/sdk/src/query/state-document.test.ts +197 -0
  1394. package/sdk/src/query/state-document.ts +129 -0
  1395. package/sdk/src/query/state-mutation.test.ts +1210 -0
  1396. package/sdk/src/query/state-mutation.ts +1814 -0
  1397. package/sdk/src/query/state-project-load.ts +80 -0
  1398. package/sdk/src/query/state.test.ts +616 -0
  1399. package/sdk/src/query/state.ts +476 -0
  1400. package/sdk/src/query/sub-repos-root.integration.test.ts +79 -0
  1401. package/sdk/src/query/summary.test.ts +95 -0
  1402. package/sdk/src/query/summary.ts +296 -0
  1403. package/sdk/src/query/template.test.ts +180 -0
  1404. package/sdk/src/query/template.ts +242 -0
  1405. package/sdk/src/query/uat.test.ts +77 -0
  1406. package/sdk/src/query/uat.ts +365 -0
  1407. package/sdk/src/query/utils.test.ts +82 -0
  1408. package/sdk/src/query/utils.ts +106 -0
  1409. package/sdk/src/query/validate.test.ts +924 -0
  1410. package/sdk/src/query/validate.ts +1054 -0
  1411. package/sdk/src/query/verify.test.ts +414 -0
  1412. package/sdk/src/query/verify.ts +656 -0
  1413. package/sdk/src/query/websearch.test.ts +31 -0
  1414. package/sdk/src/query/websearch.ts +82 -0
  1415. package/sdk/src/query/workspace.test.ts +120 -0
  1416. package/sdk/src/query/workspace.ts +145 -0
  1417. package/sdk/src/query/workstream-inventory.ts +143 -0
  1418. package/sdk/src/query/workstream.test.ts +153 -0
  1419. package/sdk/src/query/workstream.ts +324 -0
  1420. package/sdk/src/query/worktree.ts +84 -0
  1421. package/sdk/src/query-command-executor.ts +31 -0
  1422. package/sdk/src/query-execution-policy.test.ts +52 -0
  1423. package/sdk/src/query-execution-policy.ts +46 -0
  1424. package/sdk/src/query-failure-classification.test.ts +23 -0
  1425. package/sdk/src/query-failure-classification.ts +42 -0
  1426. package/sdk/src/query-gsd-tools-path.ts +1 -0
  1427. package/sdk/src/query-gsd-tools-runtime.ts +89 -0
  1428. package/sdk/src/query-hotpath-methods.ts +48 -0
  1429. package/sdk/src/query-native-direct-adapter.test.ts +35 -0
  1430. package/sdk/src/query-native-direct-adapter.ts +70 -0
  1431. package/sdk/src/query-native-hotpath-adapter.test.ts +43 -0
  1432. package/sdk/src/query-native-hotpath-adapter.ts +45 -0
  1433. package/sdk/src/query-raw-output-projection.test.ts +39 -0
  1434. package/sdk/src/query-raw-output-projection.ts +93 -0
  1435. package/sdk/src/query-runtime-bridge.test.ts +150 -0
  1436. package/sdk/src/query-runtime-bridge.ts +215 -0
  1437. package/sdk/src/query-runtime-seam-coverage.test.ts +20 -0
  1438. package/sdk/src/query-subprocess-adapter.test.ts +84 -0
  1439. package/sdk/src/query-subprocess-adapter.ts +146 -0
  1440. package/sdk/src/query-tools-error-factory.test.ts +35 -0
  1441. package/sdk/src/query-tools-error-factory.ts +76 -0
  1442. package/sdk/src/research-gate.test.ts +190 -0
  1443. package/sdk/src/research-gate.ts +94 -0
  1444. package/sdk/src/runtime-bridge-options.test.ts +33 -0
  1445. package/sdk/src/runtime-bridge-sync/index.test.ts +164 -0
  1446. package/sdk/src/runtime-bridge-sync/index.ts +154 -0
  1447. package/sdk/src/runtime-bridge-sync/projectdir-regression.test.ts +150 -0
  1448. package/sdk/src/runtime-bridge-sync/worker.ts +224 -0
  1449. package/sdk/src/runtime-gate.test.ts +84 -0
  1450. package/sdk/src/runtime-gate.ts +52 -0
  1451. package/sdk/src/sdk-package-compatibility.test.ts +97 -0
  1452. package/sdk/src/sdk-package-compatibility.ts +141 -0
  1453. package/sdk/src/session-runner.test.ts +164 -0
  1454. package/sdk/src/session-runner.ts +327 -0
  1455. package/sdk/src/tool-scoping.test.ts +160 -0
  1456. package/sdk/src/tool-scoping.ts +61 -0
  1457. package/sdk/src/types.ts +927 -0
  1458. package/sdk/src/workflow-agent-skills-consistency.test.ts +98 -0
  1459. package/sdk/src/workstream-inventory/builder.test.ts +241 -0
  1460. package/sdk/src/workstream-inventory/builder.ts +170 -0
  1461. package/sdk/src/workstream-name-policy.ts +57 -0
  1462. package/sdk/src/workstream-utils.ts +36 -0
  1463. package/sdk/src/ws-flag.test.ts +285 -0
  1464. package/sdk/src/ws-transport.test.ts +161 -0
  1465. package/sdk/src/ws-transport.ts +93 -0
  1466. package/sdk/tsconfig.json +20 -0
@@ -0,0 +1,1717 @@
1
+ <purpose>
2
+ Execute all plans in a phase using wave-based parallel execution. Orchestrator stays lean — delegates plan execution to subagents.
3
+ </purpose>
4
+
5
+ <core_principle>
6
+ Orchestrator coordinates, not executes. Each subagent loads the full execute-plan context. Orchestrator: discover plans → analyze deps → group waves → spawn agents → handle checkpoints → collect results.
7
+ </core_principle>
8
+
9
+ <runtime_compatibility>
10
+ **Subagent spawning is runtime-specific:**
11
+ - **Claude Code:** Uses `Agent(subagent_type="gsd-executor", ...)` — blocks until complete, returns result
12
+ - **Copilot:** Subagent spawning does not reliably return completion signals. **Default to
13
+ sequential inline execution**: read and follow execute-plan.md directly for each plan
14
+ instead of spawning parallel agents. Only attempt parallel spawning if the user
15
+ explicitly requests it — and in that case, rely on the spot-check fallback in step 3
16
+ to detect completion.
17
+ - **Other runtimes:** If `Agent`/`agent` tool is unavailable, use sequential inline execution as the
18
+ fallback. Check for tool availability at runtime rather than assuming based on runtime name.
19
+
20
+ **Fallback rule:** If a spawned agent completes its work (commits visible, SUMMARY.md exists) but
21
+ the orchestrator never receives the completion signal, treat it as successful based on spot-checks
22
+ and continue to the next wave/plan. Never block indefinitely waiting for a signal — always verify
23
+ via filesystem and git state.
24
+ </runtime_compatibility>
25
+
26
+ <required_reading>
27
+ Read STATE.md before any operation to load project context.
28
+ @~/.claude/get-shit-done/references/agent-contracts.md
29
+ @~/.claude/get-shit-done/references/context-budget.md
30
+ @~/.claude/get-shit-done/references/gates.md
31
+ </required_reading>
32
+
33
+ <available_agent_types>
34
+ These are the valid GSD subagent types registered in .claude/agents/ (or equivalent for your runtime).
35
+ Always use the exact name from this list — do not fall back to 'general-purpose' or other built-in types:
36
+
37
+ - gsd-executor — Executes plan tasks, commits, creates SUMMARY.md
38
+ - gsd-verifier — Verifies phase completion, checks quality gates
39
+ - gsd-planner — Creates detailed plans from phase scope
40
+ - gsd-phase-researcher — Researches technical approaches for a phase
41
+ - gsd-plan-checker — Reviews plan quality before execution
42
+ - gsd-debugger — Diagnoses and fixes issues
43
+ - gsd-codebase-mapper — Maps project structure and dependencies
44
+ - gsd-integration-checker — Checks cross-phase integration
45
+ - gsd-nyquist-auditor — Validates verification coverage
46
+ - gsd-ui-researcher — Researches UI/UX approaches
47
+ - gsd-ui-checker — Reviews UI implementation quality
48
+ - gsd-ui-auditor — Audits UI against design requirements
49
+ </available_agent_types>
50
+
51
+ <process>
52
+
53
+ <step name="parse_args" priority="first">
54
+ Parse `$ARGUMENTS` before loading any context:
55
+
56
+ - First positional token → `PHASE_ARG`
57
+ - Optional `--wave N` → `WAVE_FILTER`
58
+ - Optional `--gaps-only` keeps its current meaning
59
+ - Optional `--cross-ai` → `CROSS_AI_FORCE=true` (force all plans through cross-AI execution)
60
+ - Optional `--no-cross-ai` → `CROSS_AI_DISABLED=true` (disable cross-AI for this run, overrides config and frontmatter)
61
+
62
+ If `--wave` is absent, preserve the current behavior of executing all incomplete waves in the phase.
63
+ </step>
64
+
65
+ <step name="initialize" priority="first">
66
+ Load all context in one call:
67
+
68
+ ```bash
69
+ # SDK resolution: prefer local gsd-tools.cjs, fall back to global gsd-sdk (#3668)
70
+ GSD_TOOLS="${RUNTIME_DIR:-$(git rev-parse --show-toplevel 2>/dev/null || pwd)}/get-shit-done/bin/gsd-tools.cjs"
71
+ if [ -f "$GSD_TOOLS" ]; then
72
+ GSD_SDK="node $GSD_TOOLS"
73
+ elif command -v gsd-sdk >/dev/null 2>&1; then
74
+ GSD_SDK="gsd-sdk"
75
+ else
76
+ echo "ERROR: gsd-sdk not found on PATH and $GSD_TOOLS does not exist." >&2
77
+ echo "Run: npx get-shit-done-cc@latest --claude --local" >&2
78
+ exit 1
79
+ fi
80
+ INIT=$($GSD_SDK query init.execute-phase "${PHASE_ARG}")
81
+ if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi
82
+ AGENT_SKILLS=$($GSD_SDK query agent-skills gsd-executor)
83
+ ```
84
+
85
+ Parse JSON for: `executor_model`, `verifier_model`, `commit_docs`, `parallelization`, `branching_strategy`, `branch_name`, `phase_found`, `phase_dir`, `phase_number`, `phase_name`, `phase_slug`, `plans`, `incomplete_plans`, `plan_count`, `incomplete_count`, `state_exists`, `roadmap_exists`, `phase_req_ids`, `response_language`.
86
+
87
+ **Model resolution:** If `executor_model` is `"inherit"`, omit the `model=` parameter from all `Agent()` calls — do NOT pass `model="inherit"` to Agent. Omitting the `model=` parameter causes Claude Code to inherit the current orchestrator model automatically. Only set `model=` when `executor_model` is an explicit model name (e.g., `"claude-sonnet-4-6"`, `"claude-opus-4-7"`).
88
+
89
+ **If `response_language` is set:** Include `response_language: {value}` in all spawned subagent prompts so any user-facing output stays in the configured language.
90
+
91
+ Read runtime/worktree config and fail closed before any executor dispatch:
92
+
93
+ ```bash
94
+ RUNTIME=$($GSD_SDK query config-get runtime --default claude 2>/dev/null || echo "claude")
95
+ USE_WORKTREES=$($GSD_SDK query config-get workflow.use_worktrees 2>/dev/null || echo "true")
96
+ EXECUTOR_STALL_INTERVAL_MINUTES=$($GSD_SDK query config-get executor.stall_detect_interval_minutes 2>/dev/null || echo "5")
97
+ EXECUTOR_STALL_THRESHOLD_MINUTES=$($GSD_SDK query config-get executor.stall_threshold_minutes 2>/dev/null || echo "10")
98
+
99
+ if [ "$RUNTIME" = "codex" ] && [ "$USE_WORKTREES" != "false" ]; then
100
+ echo "FATAL: Codex execute-phase worktree isolation is unsupported. Set workflow.use_worktrees=false or use a runtime with Agent isolation=\"worktree\" support." >&2
101
+ exit 1
102
+ fi
103
+ # Sweep orphaned locked worktrees from prior crashed sessions before spawning executors (#3707).
104
+ [ "$USE_WORKTREES" != "false" ] && $GSD_SDK query worktree.reap-orphans 2>/dev/null || true
105
+ ```
106
+ Codex maps subagents to `spawn_agent`, which has no direct Codex mapping for Claude Code's `isolation="worktree"` parameter. Failing closed prevents main-checkout edits while the workflow believes agents are isolated.
107
+
108
+ If the project uses git submodules, worktree isolation is unsafe **only when a plan touches a submodule path** — the executor commit protocol cannot correctly handle submodule commits inside isolated worktrees. The previous behavior unconditionally disabled worktree isolation whenever `.gitmodules` existed, which penalised every plan in a submodule project even when the plan was nowhere near a submodule. Compute submodule paths once and intersect them per-plan with the plan's declared `files_modified` frontmatter.
109
+
110
+ ```bash
111
+ # Parse submodule paths from .gitmodules once (empty if no .gitmodules).
112
+ # SUBMODULE_PATHS is a newline-separated list of repo-relative paths.
113
+ if [ -f .gitmodules ]; then
114
+ SUBMODULE_PATHS=$(git config --file .gitmodules --get-regexp '^submodule\..*\.path$' 2>/dev/null | awk '{print $2}')
115
+ else
116
+ SUBMODULE_PATHS=""
117
+ fi
118
+ ```
119
+
120
+ `SUBMODULE_PATHS` is exported to the `execute_waves` step, where the per-plan decision actually happens (see "Per-plan worktree decision" sub-step inside `execute_waves`). The decision is per-plan because different plans in the same wave can touch different files — only plans whose paths intersect a submodule must drop worktree isolation; plans nowhere near a submodule keep parallel isolation.
121
+
122
+ When `USE_WORKTREES` (project-level) is `false`, all executor agents run without `isolation="worktree"` — they execute sequentially on the main working tree instead of in parallel worktrees. The per-plan decision below has no effect when worktrees are project-disabled.
123
+
124
+ Read context window size for adaptive prompt enrichment:
125
+
126
+ ```bash
127
+ CONTEXT_WINDOW=$($GSD_SDK query config-get context_window 2>/dev/null || echo "200000")
128
+ ```
129
+
130
+ When `CONTEXT_WINDOW >= 500000` (1M-class models), subagent prompts include richer context:
131
+ - Executor agents receive prior wave SUMMARY.md files and the phase CONTEXT.md/RESEARCH.md
132
+ - Verifier agents receive all PLAN.md, SUMMARY.md, CONTEXT.md files plus REQUIREMENTS.md
133
+ - This enables cross-phase awareness and history-aware verification
134
+
135
+ When `CONTEXT_WINDOW < 200000` (sub-200K models), subagent prompts are thinned to reduce static overhead:
136
+ - Executor agents omit extended deviation rule examples and checkpoint examples from inline prompt — load on-demand via @~/.claude/get-shit-done/references/executor-examples.md
137
+ - Planner agents omit extended anti-pattern lists and specificity examples from inline prompt — load on-demand via @~/.claude/get-shit-done/references/planner-antipatterns.md
138
+ - Core rules and decision logic remain inline; only verbose examples and edge-case lists are extracted
139
+ - This reduces executor static overhead by ~40% while preserving behavioral correctness
140
+
141
+ **If `phase_found` is false:** Error — phase directory not found.
142
+ **If `plan_count` is 0:** Error — no plans found in phase.
143
+ **If `state_exists` is false but `.planning/` exists:** Offer reconstruct or continue.
144
+
145
+ When `parallelization` is false, plans within a wave execute sequentially.
146
+
147
+ **Runtime detection for Copilot:**
148
+ Check if the current runtime is Copilot by testing for the `@gsd-executor` agent pattern
149
+ or absence of the `Agent()` subagent API. If running under Copilot, force sequential inline
150
+ execution regardless of the `parallelization` setting — Copilot's subagent completion
151
+ signals are unreliable (see `<runtime_compatibility>`). Set `COPILOT_SEQUENTIAL=true`
152
+ internally and skip the `execute_waves` step in favor of `check_interactive_mode`'s
153
+ inline path for each plan.
154
+
155
+ **REQUIRED — Sync chain flag with intent.** If user invoked manually (no `--auto`), clear the ephemeral chain flag from any previous interrupted `--auto` chain. This prevents stale `_auto_chain_active: true` from causing unwanted auto-advance. This does NOT touch `workflow.auto_advance` (the user's persistent settings preference). You MUST execute this bash block before any config reads:
156
+ ```bash
157
+ # REQUIRED: prevents stale auto-chain from previous --auto runs
158
+ if [[ ! "$ARGUMENTS" =~ --auto ]]; then
159
+ $GSD_SDK query config-set workflow._auto_chain_active false || true
160
+ fi
161
+ ```
162
+
163
+ Resolve `MVP_MODE` once via the centralized `phase.mvp-mode` query verb (precedence chain: CLI flag → ROADMAP `**Mode:** mvp` → `workflow.mvp_mode` config → false):
164
+ ```bash
165
+ MVP_FLAG_ARG=""
166
+ if [[ "$ARGUMENTS" =~ (^|[[:space:]])--mvp([[:space:]]|$) ]]; then MVP_FLAG_ARG="--cli-flag"; fi
167
+ MVP_MODE=$($GSD_SDK query phase.mvp-mode "${PHASE_NUMBER}" $MVP_FLAG_ARG --pick active)
168
+ TDD_MODE=$($GSD_SDK query config-get workflow.tdd_mode 2>/dev/null || echo "false")
169
+ ```
170
+
171
+ <step name="safe_resume_gate">
172
+ Before trusting `STATE.md` or dispatching any executor, derive `CURRENT_PLAN_ID`
173
+ from the active incomplete plan in `INIT`, then search recent history:
174
+ ```bash
175
+ CURRENT_PLAN_ID="{phase_number}-{plan_padded}"
176
+ SUMMARY_PATH="{phase_dir}/{plan_padded}-SUMMARY.md"
177
+ PLAN_COMMITS=$(git log --oneline --grep="${CURRENT_PLAN_ID}" -30)
178
+ ```
179
+ If production commits exist and `SUMMARY.md is missing`, stop before spawning a
180
+ new executor; continuing risks duplicate work and stale `STATE.md`/ROADMAP progress.
181
+ Offer these recovery options:
182
+ - `close out manually` — inspect commits, write SUMMARY.md, then update STATE/ROADMAP.
183
+ - `re-execute from scratch` — revert or supersede partial commits before dispatch.
184
+ - `mark-and-skip` — record the anomaly and move on only with explicit confirmation.
185
+ </step>
186
+
187
+ **MVP+TDD gate.** Task-scoped enforcement runs inside plan execution (immediately before each implementation step), where `TASK_FILE`, `PLAN_ID`, and `TASK_ID` are defined. Keep the same predicate and RED-commit contract:
188
+ ```bash
189
+ if [ "$MVP_MODE" = "true" ] && [ "$TDD_MODE" = "true" ]; then
190
+ IS_BEHAVIOR_ADDING=$($GSD_SDK query task.is-behavior-adding "$TASK_FILE" --pick is_behavior_adding)
191
+ if [ "$IS_BEHAVIOR_ADDING" = "true" ]; then
192
+ RED_COMMIT=$(git log --oneline --grep="^test(${PHASE_NUMBER}-${PLAN_ID}):" -- "**/*.test.*" "**/*.spec.*" "tests/" | head -1)
193
+ if [ -z "$RED_COMMIT" ]; then
194
+ $GSD_SDK query state.update last_gate_trip "${PLAN_ID}/${TASK_ID}" || true
195
+ echo "MVP+TDD GATE TRIPPED: missing RED commit for ${PLAN_ID}/${TASK_ID}"
196
+ exit 1
197
+ fi
198
+ fi
199
+ fi
200
+ ```
201
+ Pure doc-only / config-only / test-only tasks return `is_behavior_adding=false` and are exempt. See `execute-mvp-tdd.md` for the halt report format.
202
+ </step>
203
+
204
+ <step name="check_blocking_antipatterns" priority="first">
205
+ **MANDATORY — Check for blocking anti-patterns before any other work.**
206
+
207
+ Look for a `.continue-here.md` in the current phase directory:
208
+
209
+ ```bash
210
+ ls ${phase_dir}/.continue-here.md 2>/dev/null || true
211
+ ```
212
+
213
+ If `.continue-here.md` exists, parse its "Critical Anti-Patterns" table for rows with `severity` = `blocking`.
214
+
215
+ **If one or more `blocking` anti-patterns are found:**
216
+
217
+ This step cannot be skipped. Before proceeding to `check_interactive_mode` or any other step, the agent must demonstrate understanding of each blocking anti-pattern by answering all three questions for each one:
218
+
219
+ 1. **What is this anti-pattern?** — Describe it in your own words, not by quoting the handoff.
220
+ 2. **How did it manifest?** — Explain the specific failure that caused it to be recorded.
221
+ 3. **What structural mechanism (not acknowledgment) prevents it?** — Name the concrete step, checklist item, or enforcement mechanism that stops recurrence.
222
+
223
+ Write these answers inline before continuing. If a blocking anti-pattern cannot be answered from the context in `.continue-here.md`, stop and ask the user for clarification.
224
+
225
+ **If no `.continue-here.md` exists, or no `blocking` rows are found:** Proceed directly to `check_interactive_mode`.
226
+ </step>
227
+
228
+ <step name="check_interactive_mode">
229
+ **Parse `--interactive` flag from $ARGUMENTS.**
230
+
231
+ **If `--interactive` flag present:** Switch to interactive execution mode.
232
+
233
+ Interactive mode executes plans sequentially **inline** (no subagent spawning) with user
234
+ checkpoints between tasks. The user can review, modify, or redirect work at any point.
235
+
236
+ **Interactive execution flow:**
237
+
238
+ 1. Load plan inventory as normal (discover_and_group_plans)
239
+ 2. For each plan (sequentially, ignoring wave grouping):
240
+
241
+ a. **Present the plan to the user:**
242
+ ```
243
+ ## Plan {plan_id}: {plan_name}
244
+
245
+ Objective: {from plan file}
246
+ Tasks: {task_count}
247
+
248
+ Options:
249
+ - Execute (proceed with all tasks)
250
+ - Review first (show task breakdown before starting)
251
+ - Skip (move to next plan)
252
+ - Stop (end execution, save progress)
253
+ ```
254
+
255
+ b. **If "Review first":** Read and display the full plan file. Ask again: Execute, Modify, Skip.
256
+
257
+ c. **If "Execute":** Read and follow `~/.claude/get-shit-done/workflows/execute-plan.md` **inline**
258
+ (do NOT spawn a subagent). Execute tasks one at a time.
259
+
260
+ d. **After each task:** Pause briefly. If the user intervenes (types anything), stop and address
261
+ their feedback before continuing. Otherwise proceed to next task.
262
+
263
+ e. **After plan complete:** Show results, commit, create SUMMARY.md, then present next plan.
264
+
265
+ 3. After all plans: proceed to verification (same as normal mode).
266
+
267
+ **Benefits of interactive mode:**
268
+ - No subagent overhead — dramatically lower token usage
269
+ - User catches mistakes early — saves costly verification cycles
270
+ - Maintains GSD's planning/tracking structure
271
+ - Best for: small phases, bug fixes, verification gaps, learning GSD
272
+
273
+ **Skip to handle_branching step** (interactive plans execute inline after grouping).
274
+ </step>
275
+
276
+ <step name="handle_branching">
277
+ Check `branching_strategy` from init:
278
+
279
+ **"none":** Skip, continue on current branch.
280
+
281
+ **"phase" or "milestone":** Use pre-computed `branch_name` from init.
282
+
283
+ Fork the new phase branch off `origin/HEAD` (the project's default branch), not the current HEAD — otherwise consecutive phases compound and stay unpushed (#2916). If `$BRANCH_NAME` already exists locally, reuse it as-is.
284
+
285
+ ```bash
286
+ DEFAULT_BRANCH=$(git symbolic-ref --quiet --short refs/remotes/origin/HEAD 2>/dev/null | sed 's|^origin/||')
287
+ DEFAULT_BRANCH=${DEFAULT_BRANCH:-main}
288
+
289
+ if git show-ref --verify --quiet "refs/heads/$BRANCH_NAME"; then
290
+ git switch "$BRANCH_NAME" || { echo "ERROR: Could not switch to existing branch '$BRANCH_NAME'." >&2; exit 1; }
291
+ else
292
+ if ! git fetch --quiet origin "$DEFAULT_BRANCH"; then # #2916
293
+ git show-ref --verify --quiet "refs/remotes/origin/$DEFAULT_BRANCH" \
294
+ || { echo "ERROR: fetch origin/$DEFAULT_BRANCH failed and no local copy exists. Refusing to create '$BRANCH_NAME' off current HEAD (#2916)." >&2; exit 1; }
295
+ echo "WARNING: fetch origin/$DEFAULT_BRANCH failed; using local copy as base." >&2
296
+ fi
297
+ if [ -n "$(git status --porcelain)" ]; then
298
+ echo "WARNING: Uncommitted changes will be carried onto '$BRANCH_NAME' (branched off origin/$DEFAULT_BRANCH, not previous HEAD)."
299
+ else
300
+ git switch --quiet "$DEFAULT_BRANCH" 2>/dev/null && git merge --ff-only --quiet "origin/$DEFAULT_BRANCH" 2>/dev/null || true
301
+ fi
302
+ # Pinned base + fail-fast: on success HEAD is exactly at origin/$DEFAULT_BRANCH,
303
+ # so a post-creation merge-base or "ahead-of" guard would be unreachable. The
304
+ # explicit base argument here is the single source of correctness for #2916.
305
+ git checkout -b "$BRANCH_NAME" "origin/$DEFAULT_BRANCH" \
306
+ || { echo "ERROR: Could not create '$BRANCH_NAME' from origin/$DEFAULT_BRANCH (#2916)." >&2; exit 1; }
307
+ fi
308
+ ```
309
+
310
+ All subsequent commits go to this branch. User handles merging.
311
+ </step>
312
+
313
+ <step name="validate_phase">
314
+ From init JSON: `phase_dir`, `plan_count`, `incomplete_count`.
315
+
316
+ Report: "Found {plan_count} plans in {phase_dir} ({incomplete_count} incomplete)"
317
+
318
+ **Update STATE.md for phase start:**
319
+ ```bash
320
+ $GSD_SDK query state.begin-phase --phase "${PHASE_NUMBER}" --name "${PHASE_NAME}" --plans "${PLAN_COUNT}"
321
+ ```
322
+ This updates Status, Last Activity, Current focus, Current Position, and plan counts in STATE.md so frontmatter and body text reflect the active phase immediately.
323
+ </step>
324
+
325
+ <step name="discover_and_group_plans">
326
+ Load plan inventory with wave grouping in one call:
327
+
328
+ ```bash
329
+ PLAN_INDEX=$($GSD_SDK query phase-plan-index "${PHASE_NUMBER}")
330
+ ```
331
+
332
+ Parse JSON for: `phase`, `plans[]` (each with `id`, `wave`, `autonomous`, `objective`, `files_modified`, `task_count`, `has_summary`), `waves` (map of wave number → plan IDs), `incomplete`, `has_checkpoints`.
333
+
334
+ **Filtering:** Skip plans where `has_summary: true`. If `--gaps-only`: also skip non-gap_closure plans. If `WAVE_FILTER` is set: also skip plans whose `wave` does not equal `WAVE_FILTER`.
335
+
336
+ **Wave safety check:** If `WAVE_FILTER` is set and there are still incomplete plans in any lower wave that match the current execution mode, STOP and tell the user to finish earlier waves first. Do not let Wave 2+ execute while prerequisite earlier-wave plans remain incomplete.
337
+
338
+ If all filtered: "No matching incomplete plans" → exit.
339
+
340
+ Report:
341
+ ```
342
+ ## Execution Plan
343
+
344
+ **Phase {X}: {Name}** — {total_plans} matching plans across {wave_count} wave(s)
345
+
346
+ {If WAVE_FILTER is set: `Wave filter active: executing only Wave {WAVE_FILTER}`.}
347
+
348
+ | Wave | Plans | What it builds |
349
+ |------|-------|----------------|
350
+ | 1 | 01-01, 01-02 | {from plan objectives, 3-8 words} |
351
+ | 2 | 01-03 | ... |
352
+ ```
353
+ </step>
354
+
355
+ <step name="cross_ai_delegation">
356
+ **Optional step 2.5 — Delegate plans to an external AI runtime.**
357
+
358
+ This step runs after plan discovery and before normal wave execution. It identifies plans
359
+ that should be delegated to an external AI command and executes them via stdin-based prompt
360
+ delivery. Plans handled here are removed from the execute_waves plan list so the normal
361
+ executor skips them.
362
+
363
+ **Activation logic:**
364
+
365
+ 1. If `CROSS_AI_DISABLED` is true (`--no-cross-ai` flag): skip this step entirely.
366
+ 2. If `CROSS_AI_FORCE` is true (`--cross-ai` flag): mark ALL incomplete plans for cross-AI execution.
367
+ 3. Otherwise: check each plan's frontmatter for `cross_ai: true` AND verify config
368
+ `workflow.cross_ai_execution` is `true`. Plans matching both conditions are marked for cross-AI.
369
+
370
+ ```bash
371
+ CROSS_AI_ENABLED=$($GSD_SDK query config-get workflow.cross_ai_execution 2>/dev/null || echo "false")
372
+ CROSS_AI_CMD=$($GSD_SDK query config-get workflow.cross_ai_command 2>/dev/null || echo "")
373
+ CROSS_AI_TIMEOUT=$($GSD_SDK query config-get workflow.cross_ai_timeout 2>/dev/null || echo "300")
374
+ ```
375
+
376
+ **If no plans are marked for cross-AI:** Skip to execute_waves.
377
+
378
+ **If plans are marked but `cross_ai_command` is empty:** Error — tell user to set
379
+ `workflow.cross_ai_command` via `gsd-sdk query config-set workflow.cross_ai_command "<command>"`.
380
+
381
+ **For each cross-AI plan (sequentially):**
382
+
383
+ 1. **Construct the task prompt** from the plan file:
384
+ - Extract `<objective>` and `<tasks>` sections from the PLAN.md
385
+ - Append PROJECT.md context (project name, description, tech stack)
386
+ - Format as a self-contained execution prompt
387
+
388
+ 2. **Check for dirty working tree before execution:**
389
+ ```bash
390
+ if ! git diff --quiet HEAD 2>/dev/null; then
391
+ echo "WARNING: dirty working tree detected — the external AI command may produce uncommitted changes that conflict with existing modifications"
392
+ fi
393
+ ```
394
+
395
+ 3. **Run the external command** from the project root, writing the prompt to stdin.
396
+ Never shell-interpolate the prompt — always pipe via stdin to prevent injection:
397
+ ```bash
398
+ echo "$TASK_PROMPT" | timeout "${CROSS_AI_TIMEOUT}s" ${CROSS_AI_CMD} > "$CANDIDATE_SUMMARY" 2>"$ERROR_LOG"
399
+ EXIT_CODE=$?
400
+ ```
401
+
402
+ 4. **Evaluate the result:**
403
+
404
+ **Success (exit 0 + valid summary):**
405
+ - Read `$CANDIDATE_SUMMARY` and validate it contains meaningful content
406
+ (not empty, has at least a heading and description — a valid SUMMARY.md structure)
407
+ - Write it as the plan's SUMMARY.md file
408
+ - Update STATE.md plan status to complete
409
+ - Update ROADMAP.md progress
410
+ - Mark plan as handled — skip it in execute_waves
411
+
412
+ **Failure (non-zero exit or invalid summary):**
413
+ - Display the error output and exit code
414
+ - Warn: "The external command may have left uncommitted changes or partial edits
415
+ in the working tree. Review `git status` and `git diff` before proceeding."
416
+ - Offer three choices:
417
+ - **retry** — run the same plan through cross-AI again
418
+ - **skip** — fall back to normal executor for this plan (re-add to execute_waves list)
419
+ - **abort** — stop execution entirely, preserve state for resume
420
+
421
+ 5. **After all cross-AI plans processed:** Remove successfully handled plans from the
422
+ incomplete plan list so execute_waves skips them. Any skipped-to-fallback plans remain
423
+ in the list for normal executor processing.
424
+ </step>
425
+
426
+ <step name="execute_waves">
427
+ Execute each selected wave in sequence. Within a wave: parallel if `PARALLELIZATION=true`, sequential if `false`.
428
+
429
+ **Stream-idle-timeout prevention — checkpoint heartbeats (#2410):**
430
+
431
+ Multi-plan phases can accumulate enough subagent context that the Claude API
432
+ SSE layer terminates with `Stream idle timeout - partial response received`
433
+ between a large tool_result and the next assistant turn (seen on Claude Code
434
+ + Opus 4.7 at ~200K+ cache_read). To keep the stream warm, emit short
435
+ assistant-text heartbeats — **no tool call, just a literal line** — at every
436
+ wave and plan boundary. Each heartbeat MUST start with `[checkpoint]` so
437
+ tooling and `/gsd:manager`'s background-completion handler can grep partial
438
+ transcripts. `{P}/{Q}` is the phase-wide completed/total plans counter and
439
+ increases monotonically across waves. `{status}` is `complete` (success),
440
+ `failed` (executor error), or `checkpoint` (human-gate returned).
441
+
442
+ ```
443
+ [checkpoint] phase {PHASE_NUMBER} wave {N}/{M} starting, {wave_plan_count} plan(s), {P}/{Q} plans done
444
+ [checkpoint] phase {PHASE_NUMBER} wave {N}/{M} plan {plan_id} starting ({P}/{Q} plans done)
445
+ [checkpoint] phase {PHASE_NUMBER} wave {N}/{M} plan {plan_id} {status} ({P}/{Q} plans done)
446
+ [checkpoint] phase {PHASE_NUMBER} wave {N}/{M} complete, {P}/{Q} plans done ({wave_success}/{wave_plan_count} ok)
447
+ ```
448
+
449
+ **For each wave:**
450
+
451
+ 1. **Intra-wave files_modified overlap check (BEFORE spawning):**
452
+
453
+ Before spawning any agents for this wave, inspect the `files_modified` list of all plans
454
+ in the wave. Check every pair of plans in the wave — if any two plans share even one file
455
+ in their `files_modified` lists, those plans have an implicit dependency and MUST NOT run
456
+ in parallel.
457
+
458
+ **Detection algorithm (pseudocode):**
459
+ ```
460
+ seen_files = {}
461
+ overlapping_plans = []
462
+ for each plan in wave_plans:
463
+ for each file in plan.files_modified:
464
+ if file in seen_files:
465
+ overlapping_plans.add(plan, seen_files[file]) # both plans overlap on this file
466
+ else:
467
+ seen_files[file] = plan
468
+ ```
469
+
470
+ **If overlap is detected:**
471
+ - Warn the user:
472
+ ```
473
+ ⚠ Intra-wave files_modified overlap detected in Wave {N}:
474
+ Plan {A} and Plan {B} both modify {file}
475
+ Running these plans sequentially to avoid parallel worktree conflicts.
476
+ ```
477
+ - Override `PARALLELIZATION` to `false` for this wave only — run all plans in the wave
478
+ sequentially regardless of the global parallelization setting.
479
+ - This is a safety net for plans that were incorrectly assigned to the same wave.
480
+ The planner should have caught this; flag it as a planning defect so the user can
481
+ replan the phase if desired.
482
+
483
+ **If no overlap:** proceed normally (parallel if `PARALLELIZATION=true`).
484
+
485
+ 2. **Describe what's being built (BEFORE spawning):**
486
+
487
+ **First, emit the wave-start checkpoint heartbeat as a literal assistant-text
488
+ line — no tool call (#2410). Do NOT skip this even for single-plan waves; it
489
+ is required before any further reasoning or spawning:**
490
+
491
+ ```
492
+ [checkpoint] phase {PHASE_NUMBER} wave {N}/{M} starting, {wave_plan_count} plan(s), {P}/{Q} plans done
493
+ ```
494
+
495
+ Then read each plan's `<objective>`. Extract what's being built and why.
496
+
497
+ ```
498
+ ---
499
+ ## Wave {N}
500
+
501
+ **{Plan ID}: {Plan Name}**
502
+ {2-3 sentences: what this builds, technical approach, why it matters}
503
+
504
+ Spawning {count} agent(s)...
505
+ ---
506
+ ```
507
+
508
+ - Bad: "Executing terrain generation plan"
509
+ - Good: "Procedural terrain generator using Perlin noise — creates height maps, biome zones, and collision meshes. Required before vehicle physics can interact with ground."
510
+
511
+ 2.5. **Per-plan worktree decision (run for each plan in this wave BEFORE its dispatch):**
512
+
513
+ Read and execute `get-shit-done/workflows/execute-phase/steps/per-plan-worktree-gate.md` for each plan. It extracts `PLAN_FILES` from the plan's JSON, intersects against `SUBMODULE_PATHS` (with normalization, bidirectional matching, and glob-prefix handling), and sets `USE_WORKTREES_FOR_PLAN` to `false` when the plan touches a submodule path. Append `plan_id` to a `WAVE_WORKTREE_PLANS` accumulator when `USE_WORKTREES_FOR_PLAN != false`.
514
+
515
+ The dispatch branches in step 3 below MUST gate on `USE_WORKTREES_FOR_PLAN` for the current plan, not on the project-level `USE_WORKTREES`.
516
+
517
+ 3. **Spawn executor agents:**
518
+
519
+ **Emit a plan-start heartbeat (literal line, no tool call) immediately before
520
+ each `Agent()` dispatch (#2410):**
521
+
522
+ `[checkpoint] phase {PHASE_NUMBER} wave {N}/{M} plan {plan_id} starting ({P}/{Q} plans done)`
523
+
524
+ Pass paths only — executors read files themselves with their fresh context window.
525
+ For 200k models, this keeps orchestrator context lean (~10-15%).
526
+ For 1M+ models (Opus 4.6, Sonnet 4.6), richer context can be passed directly.
527
+
528
+ **Worktree mode** (`USE_WORKTREES_FOR_PLAN` is not `false` — evaluated per-plan in step 2.5):
529
+
530
+ Before spawning, capture the current HEAD:
531
+ ```bash
532
+ EXPECTED_BASE=$(git rev-parse HEAD)
533
+ DISPATCH_TS=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
534
+ EXPECTED_BRANCH=$(git rev-parse --abbrev-ref HEAD)
535
+ if [ "${USE_WORKTREES_FOR_PLAN:-true}" != "false" ] && [ -z "${WAVE_WORKTREE_MANIFEST:-}" ]; then
536
+ WAVE_WORKTREE_MANIFEST=$(mktemp "${TMPDIR:-/tmp}/gsd-worktree-wave-XXXXXX.json")
537
+ printf '{"worktrees":[]}\n' > "$WAVE_WORKTREE_MANIFEST"
538
+ export WAVE_WORKTREE_MANIFEST
539
+ fi
540
+ ```
541
+
542
+ **Sequential dispatch for parallel execution (waves with 2+ agents):**
543
+ Dispatch each `Agent()` call **one at a time with `run_in_background: true`**. Do NOT
544
+ send all Agent calls in a single message: simultaneous `git worktree add` calls race
545
+ on `.git/config.lock`. Agents still run in parallel once their worktrees are created.
546
+
547
+ ```text
548
+ # CORRECT: one Agent() per message with run_in_background: true
549
+ # WRONG: multiple Agent() calls in one message -> .git/config.lock contention
550
+ ```
551
+
552
+ ```text
553
+ Agent(
554
+ subagent_type="gsd-executor",
555
+ description="Execute plan {plan_number} of phase {phase_number}",
556
+ # Only include model= when executor_model is an explicit model name.
557
+ # When executor_model is "inherit", omit this parameter entirely so
558
+ # Claude Code inherits the orchestrator model automatically.
559
+ model="{executor_model}", # omit this line when executor_model == "inherit"
560
+ isolation="worktree",
561
+ prompt="
562
+ <objective>
563
+ Execute plan {plan_number} of phase {phase_number}-{phase_name}.
564
+ Commit each task atomically. Create SUMMARY.md.
565
+ Do NOT update STATE.md or ROADMAP.md — the orchestrator owns those writes after all worktree agents in the wave complete.
566
+ </objective>
567
+
568
+ <worktree_branch_check>
569
+ FIRST ACTION: HEAD assertion MUST run before any reset/checkout. Worktrees
570
+ spawned by Claude Code's `isolation="worktree"` use the `worktree-agent-<id>`
571
+ namespace. If HEAD is on a protected ref (main/master/develop/trunk/release/*)
572
+ or detached, HALT — do NOT self-recover by force-rewinding via `git update-ref`,
573
+ that destroys concurrent commits in multi-active scenarios (#2924). Only after
574
+ Step 1 passes is `git reset --hard` safe (#2015 — affects all platforms).
575
+ ```bash
576
+ HEAD_REF=$(git symbolic-ref --quiet HEAD || echo "DETACHED")
577
+ ACTUAL_BRANCH=$(git rev-parse --abbrev-ref HEAD)
578
+ if [ "$HEAD_REF" = "DETACHED" ] || echo "$ACTUAL_BRANCH" | grep -Eq '^(main|master|develop|trunk|release/.*)$'; then
579
+ echo "FATAL: worktree HEAD on '$ACTUAL_BRANCH' (expected worktree-agent-*); refusing to self-recover via 'git update-ref' (#2924)." >&2
580
+ exit 1
581
+ fi
582
+ if ! echo "$ACTUAL_BRANCH" | grep -Eq '^worktree-agent-[A-Za-z0-9._/-]+$'; then
583
+ echo "FATAL: worktree HEAD '$ACTUAL_BRANCH' is not in the worktree-agent-* namespace; refusing to commit (#2924)." >&2
584
+ exit 1
585
+ fi
586
+ ACTUAL_BASE=$(git merge-base HEAD {EXPECTED_BASE})
587
+ if [ "$ACTUAL_BASE" != "{EXPECTED_BASE}" ]; then
588
+ git reset --hard {EXPECTED_BASE}
589
+ [ "$(git rev-parse HEAD)" != "{EXPECTED_BASE}" ] && { echo "ERROR: could not correct worktree base"; exit 1; }
590
+ fi
591
+ ```
592
+ Per-commit HEAD/cwd-drift/path-guard: `agents/gsd-executor.md` steps 0/0a/0b + `references/worktree-path-safety.md` (in <execution_context>).
593
+ </worktree_branch_check>
594
+
595
+ <parallel_execution>
596
+ You are running as a PARALLEL executor agent in a git worktree. Worktree path safety (cwd-drift, absolute-path guards) is in `worktree-path-safety.md` (loaded below).
597
+ Run `git commit` normally — hooks run by default. Do NOT pass `--no-verify`
598
+ unless the orchestrator surfaces `workflow.worktree_skip_hooks=true` in this
599
+ prompt; silent bypass violates project CLAUDE.md guidance (#2924).
600
+
601
+ IMPORTANT: Do NOT modify STATE.md or ROADMAP.md. execute-plan.md
602
+ auto-detects worktree mode (`.git` is a file, not a directory) and skips
603
+ shared file updates automatically. The orchestrator updates them centrally
604
+ after merge.
605
+
606
+ REQUIRED: SUMMARY.md MUST be committed before you return. In worktree mode the
607
+ git_commit_metadata step in execute-plan.md commits SUMMARY.md and REQUIREMENTS.md
608
+ only (STATE.md and ROADMAP.md are excluded automatically). Do NOT skip or defer
609
+ this commit — the orchestrator force-removes the worktree after you return, and
610
+ any uncommitted SUMMARY.md will be permanently lost (#2070).
611
+ REQUIRED ORDER: Write SUMMARY.md → commit → only then any narration. No text between Write and commit (truncation risk; #2070 rescue is not primary defense).
612
+ </parallel_execution>
613
+
614
+ <execution_context>
615
+ @~/.claude/get-shit-done/workflows/execute-plan.md
616
+ @~/.claude/get-shit-done/templates/summary.md
617
+ @~/.claude/get-shit-done/references/checkpoints.md
618
+ @~/.claude/get-shit-done/references/tdd.md
619
+ @~/.claude/get-shit-done/references/worktree-path-safety.md
620
+ ${CONTEXT_WINDOW < 200000 ? '' : '@~/.claude/get-shit-done/references/executor-examples.md'}
621
+ </execution_context>
622
+
623
+ <files_to_read>
624
+ Read these files at execution start using the Read tool:
625
+ - {phase_dir}/{plan_file} (Plan)
626
+ - .planning/PROJECT.md (Project context — core value, requirements, evolution rules)
627
+ - .planning/STATE.md (State)
628
+ - .planning/config.json (Config, if exists)
629
+ ${CONTEXT_WINDOW >= 500000 ? `
630
+ - ${phase_dir}/*-CONTEXT.md (User decisions from discuss-phase — honors locked choices)
631
+ - ${phase_dir}/*-RESEARCH.md (Technical research — pitfalls and patterns to follow)
632
+ - ${prior_wave_summaries} (SUMMARY.md files from earlier waves in this phase — what was already built)
633
+ ` : ''}
634
+ - ./CLAUDE.md (Project instructions, if exists — follow project-specific guidelines and coding conventions)
635
+ - .claude/skills/ or .agents/skills/ (Project skills, if either exists — list skills, read SKILL.md for each, follow relevant rules during implementation)
636
+ </files_to_read>
637
+
638
+ ${AGENT_SKILLS}
639
+
640
+ <mcp_tools>
641
+ If CLAUDE.md or project instructions reference MCP tools (e.g. jCodeMunch, context7,
642
+ or other MCP servers), prefer those tools over Grep/Glob for code navigation when available.
643
+ MCP tools often save significant tokens by providing structured code indexes.
644
+ Check tool availability first — if MCP tools are not accessible, fall back to Grep/Glob.
645
+ </mcp_tools>
646
+
647
+ <success_criteria>
648
+ - [ ] All tasks executed
649
+ - [ ] Each task committed individually
650
+ - [ ] SUMMARY.md created in plan directory
651
+ - [ ] No modifications to shared orchestrator artifacts (the orchestrator handles all post-wave shared-file writes)
652
+ </success_criteria>
653
+ "
654
+ )
655
+ ```
656
+
657
+ Immediately after each worktree `Agent()` spawn returns metadata, atomically append `{agent_id, worktree_path, branch, expected_base}` to `WAVE_WORKTREE_MANIFEST`. If any field is missing, stop and ask for recovery instead of scanning all agent worktrees.
658
+
659
+ > **ORCHESTRATOR RULE — CODEX RUNTIME**: After calling Agent() above to spawn executor agent(s), 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.
660
+
661
+ **Sequential mode** (`USE_WORKTREES_FOR_PLAN` is `false` — either project-level `USE_WORKTREES=false`, or per-plan submodule intersection forced it false in step 2.5):
662
+
663
+ Omit `isolation="worktree"` from the Agent call. Replace the `<parallel_execution>` block with:
664
+
665
+ ```
666
+ <sequential_execution>
667
+ You are running as a SEQUENTIAL executor agent on the main working tree.
668
+ Use normal git commits (with hooks). Do NOT use --no-verify.
669
+ REQUIRED ORDER: Write SUMMARY.md → commit → only then any narration. No text between Write and commit (truncation risk; #2070 rescue is not primary defense).
670
+ </sequential_execution>
671
+ ```
672
+
673
+ The sequential mode Agent prompt uses the same structure as worktree mode but with these differences in success_criteria — since there is only one agent writing at a time, there are no shared-file conflicts:
674
+
675
+ ```
676
+ <success_criteria>
677
+ - [ ] All tasks executed
678
+ - [ ] Each task committed individually
679
+ - [ ] SUMMARY.md created in plan directory
680
+ - [ ] STATE.md updated with position and decisions
681
+ - [ ] ROADMAP.md updated with plan progress (via `roadmap update-plan-progress`)
682
+ </success_criteria>
683
+ ```
684
+
685
+ When worktrees are disabled for a plan (per-plan or project-level), that plan's executor runs on the main working tree. If **any** plan in the current wave dropped to sequential mode, execute the affected plan(s) **one at a time** to avoid concurrent writes to the main working tree — plans in the same wave that retained worktree isolation can still run in parallel alongside the sequential ones, but two non-worktree plans in the same wave must serialize. When the project-level `USE_WORKTREES=false`, all plans in the wave serialize regardless of the `PARALLELIZATION` setting.
686
+
687
+ 4. **Wait for all agents in wave to complete.**
688
+
689
+ **Plan-complete heartbeat (#2410):** as each executor returns (or is verified
690
+ via spot-check below), emit one line — `complete` advances `{P}`, `failed`
691
+ and `checkpoint` do not but still warm the stream:
692
+
693
+ ```
694
+ [checkpoint] phase {PHASE_NUMBER} wave {N}/{M} plan {plan_id} complete ({P}/{Q} plans done)
695
+ [checkpoint] phase {PHASE_NUMBER} wave {N}/{M} plan {plan_id} failed ({P}/{Q} plans done)
696
+ [checkpoint] phase {PHASE_NUMBER} wave {N}/{M} plan {plan_id} checkpoint ({P}/{Q} plans done)
697
+ ```
698
+
699
+ **Completion signal fallback (Copilot and runtimes where Agent() may not return):**
700
+
701
+ If a spawned agent does not return a completion signal but appears to have finished
702
+ its work, do NOT block indefinitely. Instead, verify completion via spot-checks:
703
+
704
+ ```bash
705
+ # For each plan in this wave, check if the executor finished:
706
+ SUMMARY_EXISTS=$(test -f "{phase_dir}/{plan_number}-{plan_padded}-SUMMARY.md" && echo "true" || echo "false")
707
+ COMMITS_FOUND=$(git log --oneline --all --grep="{phase_number}-{plan_padded}" --since="1 hour ago" | head -1)
708
+ COMMITS_SINCE_DISPATCH=$(git log "${EXPECTED_BRANCH}" --since="${DISPATCH_TS}" --oneline | head -1)
709
+ ```
710
+
711
+ **If SUMMARY.md exists AND commits are found:** The agent completed successfully —
712
+ treat as done and proceed to step 5. Log: `"✓ {Plan ID} completed (verified via spot-check — completion signal not received)"`
713
+
714
+ **If SUMMARY.md does NOT exist after a reasonable wait:** The agent may still be
715
+ running or may have failed silently. Check `git log --oneline -5` for recent
716
+ activity. If commits are still appearing, wait longer. If no activity, report
717
+ the plan as failed and route to the failure handler in step 6.
718
+
719
+ **Configurable stall surveillance (#3212):** Every `${EXECUTOR_STALL_INTERVAL_MINUTES}`
720
+ minutes while waiting, inspect `git log "${EXPECTED_BRANCH}" --since="${DISPATCH_TS}"`
721
+ for activity. If no completion signal, no SUMMARY.md, and no expected-branch
722
+ commits appear for `${EXECUTOR_STALL_THRESHOLD_MINUTES}` minutes, pause and
723
+ ask for one recovery path: `continue waiting`, `kill and retry`, or
724
+ `kill and switch to inline execution`.
725
+
726
+ **This fallback applies automatically to all runtimes.** Claude Code's Agent() normally
727
+ returns synchronously, but the fallback ensures resilience if it doesn't.
728
+
729
+ 5. **Post-wave hook validation (parallel mode only):** Hooks run on every executor commit by default (#2924); this post-wave run only fires when `workflow.worktree_skip_hooks=true` opted out of per-commit hooks:
730
+ ```bash
731
+ SKIP_HOOKS=$($GSD_SDK query config-get workflow.worktree_skip_hooks 2>/dev/null || echo "false")
732
+ if [ "$SKIP_HOOKS" = "true" ]; then
733
+ # Stash uncommitted changes under a named ref so we always pop (bare `git stash` strands them on hook/script failure). #3542: `refs/stash` is shared across worktrees, so this helper runs ONLY in the orchestrator's main checkout after all wave worktrees have been merged + removed; executors are forbidden from running any `git stash` subcommand (see `<destructive_git_prohibition>` in `agents/gsd-executor.md`).
734
+ STASHED=false
735
+ if (! git diff --quiet || ! git diff --cached --quiet) && git stash push -u -m "gsd-post-wave-hook-$$" >/dev/null 2>&1; then STASHED=true; fi
736
+ git hook run pre-commit 2>&1 || echo "⚠ Pre-commit hooks failed — review before continuing"
737
+ [ "$STASHED" = "true" ] && (git stash pop >/dev/null 2>&1 || echo "⚠ Could not pop gsd-post-wave-hook stash — recover manually")
738
+ fi
739
+ ```
740
+ If hooks fail: report the failure and ask "Fix hook issues now?" or "Continue to next wave?"
741
+
742
+ 5.5. **Worktree cleanup (when `isolation="worktree"` was used):**
743
+
744
+ **Standard wave contract:** Each wave's worktrees merge to main via the templated path below before the next wave's worktrees fork. The cleanup loop runs once per wave at the end of the wave lifecycle. Worktrees created in wave N must be fully removed before wave N+1 forks new ones.
745
+
746
+ **Cross-wave dependency deviation (supported execution mode):** When the orchestrator legitimately deviates from the standard wave model — for example, a phase with cross-wave plan dependencies that requires custom inter-worktree base-update merges (e.g., `merge: bring 09-01 + 09-02 into 09-03 base`) — the cleanup loop below is NOT automatically re-entered for those custom merges. The deviation path produces correct final history but bypasses this loop, leaving `worktree-agent-*` directories in place. Use the **cleanup-tail snippet** below to remove any residual worktrees after such a deviation.
747
+
748
+ When executor agents ran in worktree isolation, their commits land on temporary branches in separate working trees. After the wave completes, merge these changes back and clean up:
749
+
750
+ **Manifest source of truth (#3384):** Cleanup consumes the `WAVE_WORKTREE_MANIFEST` created and populated during executor dispatch in step 3. Do not recreate or truncate it here.
751
+
752
+ Prefer the bounded helper, which validates branch identity, expected base, deletion
753
+ diffs, merge result, and worktree removal before deleting the temporary branch.
754
+ If the helper reports a blocked cleanup, resolve the reported manifest entry and
755
+ rerun the same command. Do not fall back to broad worktree discovery.
756
+
757
+ ```bash
758
+ [ -n "${WAVE_WORKTREE_MANIFEST:-}" ] && [ -f "$WAVE_WORKTREE_MANIFEST" ] || {
759
+ echo "BLOCKED: missing WAVE_WORKTREE_MANIFEST; refusing broad worktree cleanup (#3384)." >&2
760
+ exit 1
761
+ }
762
+
763
+ # Guard: pin cleanup back to the primary worktree and fail on branch drift (#3174).
764
+ PRIMARY_WT=$(git worktree list --porcelain | awk '/^worktree /{print substr($0,10); exit}')
765
+ if [ -z "$PRIMARY_WT" ]; then
766
+ echo "FATAL: could not resolve primary worktree before cleanup" >&2
767
+ exit 1
768
+ fi
769
+ if [ -n "$PRIMARY_WT" ] && [ "$(pwd -P 2>/dev/null)" != "$(cd "$PRIMARY_WT" 2>/dev/null && pwd -P)" ]; then echo "⚠ Orchestrator CWD drifted to $(pwd) — pinning to $PRIMARY_WT before worktree cleanup (#3174)"; cd "$PRIMARY_WT" || { echo "FATAL: cannot cd to primary worktree $PRIMARY_WT" >&2; exit 1; }; fi
770
+ ORCH_BRANCH=$(git rev-parse --abbrev-ref HEAD)
771
+ [ -z "${EXPECTED_BRANCH:-}" ] || [ "$ORCH_BRANCH" = "$EXPECTED_BRANCH" ] || { echo "FATAL: orchestrator on '$ORCH_BRANCH' but expected '$EXPECTED_BRANCH' before worktree cleanup — refusing to merge (#3174-class drift)" >&2; exit 1; }
772
+
773
+ # Fail closed: SDK refusal (safety guard #3174/#3384) must surface — do not swallow exit 1.
774
+ $GSD_SDK query worktree.cleanup-wave --manifest "$WAVE_WORKTREE_MANIFEST" || exit 1
775
+ ```
776
+
777
+ **Cleanup-tail snippet (use after any wave whose merges did not flow through the templated path above):**
778
+
779
+ If the orchestrator deviated from the standard wave merge path (e.g., custom inter-worktree base-update merges with `merge: bring …` style messages), run this snippet after the custom merges are complete. It reads only `WAVE_WORKTREE_MANIFEST`; do not discover unrelated `worktree-agent-*` worktrees.
780
+
781
+ ```bash
782
+ # Cleanup-tail: pin orchestrator CWD to primary worktree before cleanup-tail (#3174).
783
+ PRIMARY_WT=$(git worktree list --porcelain | awk '/^worktree /{print substr($0,10); exit}')
784
+ if [ -n "$PRIMARY_WT" ] && [ "$(pwd -P 2>/dev/null)" != "$(cd "$PRIMARY_WT" 2>/dev/null && pwd -P)" ]; then echo "⚠ Orchestrator CWD drifted to $(pwd) — pinning to $PRIMARY_WT before cleanup-tail (#3174)"; cd "$PRIMARY_WT" || { echo "FATAL: cannot cd to primary worktree $PRIMARY_WT" >&2; exit 1; }; fi
785
+ # Cleanup-tail: remove residual agent worktrees after a cross-wave-dependency deviation.
786
+ # Uses only the current wave manifest to avoid touching unrelated active agents (#3384).
787
+ WT_PATHS_FILE=$(mktemp "${TMPDIR:-/tmp}/gsd-worktree-paths-XXXXXX")
788
+ node -e 'const fs=require("fs");const p=process.env.WAVE_WORKTREE_MANIFEST;try{if(!p)throw new Error("WAVE_WORKTREE_MANIFEST is unset");if(!fs.existsSync(p))throw new Error("manifest does not exist");const s=fs.readFileSync(p,"utf8");if(!s.trim())throw new Error("manifest is empty");const j=JSON.parse(s);for(const w of j.worktrees||[])if(w.worktree_path)console.log(w.worktree_path)}catch(e){console.error(`ERROR: cannot read worktree manifest ${p||"(unset)"}: ${e.message}`);process.exit(1)}' > "$WT_PATHS_FILE" || { echo "BLOCKED: cannot read WAVE_WORKTREE_MANIFEST; refusing cleanup (#3384)." >&2; exit 1; }
789
+ while IFS= read -r WT; do
790
+ [ -z "$WT" ] && continue
791
+ WT_BRANCH=$(git -C "$WT" rev-parse --abbrev-ref HEAD 2>/dev/null)
792
+ [ -z "$WT_BRANCH" ] || [ "$WT_BRANCH" = "HEAD" ] && continue
793
+ echo "Cleaning up residual worktree: $WT (branch: $WT_BRANCH)"
794
+ git worktree unlock "$WT" 2>/dev/null || true
795
+ if ! git worktree remove "$WT" --force; then
796
+ WT_NAME=$(basename "$WT")
797
+ if [ -f ".git/worktrees/${WT_NAME}/locked" ]; then
798
+ echo "⚠ Worktree $WT is locked — unlock failed; manual cleanup required:"
799
+ echo " git worktree unlock \"$WT\" && git worktree remove \"$WT\" --force && git branch -D \"$WT_BRANCH\""
800
+ else
801
+ echo "⚠ Residual worktree at $WT — remove failed; manual cleanup required"
802
+ fi
803
+ else
804
+ git branch -D "$WT_BRANCH" 2>/dev/null || true
805
+ fi
806
+ done < "$WT_PATHS_FILE"
807
+ git worktree prune
808
+ ```
809
+
810
+ **When to skip step 5.5:**
811
+
812
+ **If no plan in this wave used worktree isolation** (project-level `USE_WORKTREES=false` OR every plan in the wave had `USE_WORKTREES_FOR_PLAN=false` — i.e. `WAVE_WORKTREE_PLANS` from step 2.5 is empty): all agents ran on the main working tree — skip this step entirely.
813
+
814
+ **If the orchestrator merged via custom messages (cross-wave-dependency deviation):** the templated cleanup loop above was not triggered for those merges. Run the cleanup-tail snippet above instead. After the snippet completes, proceed to step 5.6.
815
+
816
+ **If at least one plan used worktrees but others did not:** still run this cleanup — it iterates over actual `git worktree list` output and only merges back the worktrees that were created, leaving sequential plans' commits on the main tree untouched.
817
+
818
+ **If no worktrees found at runtime:** Skip silently — agents may have been spawned without worktree isolation, or the orchestrator already cleaned them up.
819
+
820
+ 5.6. **Post-merge build & test gate:**
821
+
822
+ After merging all worktrees in a wave (parallel mode), or after the last plan completes
823
+ (serial mode), run a build and then the project's test suite to catch cross-plan
824
+ integration issues that individual worktree self-checks cannot detect (e.g., conflicting
825
+ type definitions, removed exports, import changes, link errors).
826
+
827
+ This addresses the Generator self-evaluation blind spot identified in Anthropic's
828
+ harness engineering research: agents reliably report Self-Check: PASSED even when
829
+ merging their work creates failures.
830
+
831
+ Read and execute `get-shit-done/workflows/execute-phase/steps/post-merge-gate.md`.
832
+
833
+ 5.7. **Post-wave shared artifact update (when at least one plan used worktrees, skip if tests failed):**
834
+
835
+ When **any** executor agent in this wave ran with `isolation="worktree"`, that agent skipped STATE.md and ROADMAP.md updates to avoid last-merge-wins overwrites. The orchestrator is the single writer for these files. After worktrees are merged back, update shared artifacts once for every completed plan in the wave (worktree-mode plans **and** sequential plans that ran on the main tree but deferred to the orchestrator for tracking writes).
836
+
837
+ **Only update tracking when tests passed (TEST_EXIT=0).**
838
+ If tests failed or timed out, skip the tracking update — plans should
839
+ not be marked as complete when integration tests are failing or inconclusive.
840
+
841
+ ```bash
842
+ # Guard: only update tracking if post-merge tests passed
843
+ # Timeout (124) is treated as inconclusive — do NOT mark plans complete
844
+ if [ "${TEST_EXIT}" -eq 0 ]; then
845
+ # Update ROADMAP plan progress for each completed plan in this wave
846
+ for plan_id in {completed_plan_ids}; do
847
+ $GSD_SDK query roadmap.update-plan-progress "${PHASE_NUMBER}" "${plan_id}" "complete"
848
+ done
849
+
850
+ # Only commit tracking files if they actually changed
851
+ if ! git diff --quiet .planning/ROADMAP.md .planning/STATE.md 2>/dev/null; then
852
+ $GSD_SDK query commit "docs(phase-${PHASE_NUMBER}): update tracking after wave ${N}" --files .planning/ROADMAP.md .planning/STATE.md
853
+ fi
854
+ elif [ "${TEST_EXIT}" -eq 124 ]; then
855
+ echo "⚠ Skipping tracking update — test suite timed out. Plans remain in-progress. Run tests manually to confirm."
856
+ else
857
+ echo "⚠ Skipping tracking update — post-merge tests failed (exit ${TEST_EXIT}). Plans remain in-progress until tests pass."
858
+ fi
859
+ ```
860
+
861
+ Where `WAVE_PLAN_IDS` is the space-separated list of plan IDs that completed in this wave.
862
+
863
+ **If no plan in this wave used worktrees** (project-level `USE_WORKTREES=false` OR `WAVE_WORKTREE_PLANS` is empty): sequential agents already updated STATE.md and ROADMAP.md themselves — skip this step.
864
+
865
+ 5.8. **Handle test gate failures (when `WAVE_FAILURE_COUNT > 0`):**
866
+
867
+ ```
868
+ ## ⚠ Post-Merge Test Failure (cumulative failures: ${WAVE_FAILURE_COUNT})
869
+
870
+ Wave {N} worktrees merged successfully, but {M} tests fail after merge.
871
+ This typically indicates conflicting changes across parallel plans
872
+ (e.g., type definitions, shared imports, API contracts).
873
+
874
+ Failed tests:
875
+ {first 10 lines of failure output}
876
+
877
+ Options:
878
+ 1. Fix now (recommended) — resolve conflicts before next wave
879
+ 2. Continue — failures may compound in subsequent waves
880
+ ```
881
+
882
+ Note: If `WAVE_FAILURE_COUNT > 1`, strongly recommend "Fix now" — compounding
883
+ failures across multiple waves become exponentially harder to diagnose.
884
+
885
+ If "Fix now": diagnose failures (typically import conflicts, missing types,
886
+ or changed function signatures from parallel plans modifying the same module).
887
+ Fix, commit as `fix: resolve post-merge conflicts from wave {N}`, re-run tests.
888
+
889
+ **Why this matters:** Worktree isolation means each agent's Self-Check passes
890
+ in isolation. But when merged, add/add conflicts in shared files (models, registries,
891
+ CLI entry points) can silently drop code. The post-merge gate catches this before
892
+ the next wave builds on a broken foundation.
893
+
894
+ 6. **Report completion — spot-check claims first:**
895
+
896
+ **Wave-close heartbeat (#2410):** after spot-checks finish (pass or fail),
897
+ before the `## Wave {N} Complete` summary, emit as a literal line:
898
+
899
+ ```
900
+ [checkpoint] phase {PHASE_NUMBER} wave {N}/{M} complete, {P}/{Q} plans done ({wave_success}/{wave_plan_count} ok)
901
+ ```
902
+
903
+
904
+
905
+ For each SUMMARY.md:
906
+ - Verify first 2 files from `key-files.created` exist on disk
907
+ - Check `git log --oneline --all --grep="{phase}-{plan}"` returns ≥1 commit
908
+ - Check for `## Self-Check: FAILED` marker
909
+
910
+ If ANY spot-check fails: report which plan failed, route to failure handler — ask "Retry plan?" or "Continue with remaining waves?"
911
+
912
+ If pass:
913
+ ```
914
+ ---
915
+ ## Wave {N} Complete
916
+
917
+ **{Plan ID}: {Plan Name}**
918
+ {What was built — from SUMMARY.md}
919
+ {Notable deviations, if any}
920
+
921
+ {If more waves: what this enables for next wave}
922
+ ---
923
+ ```
924
+
925
+ 7. **Handle failures:**
926
+ **Step 7.0 — classify before branching (#3095):**
927
+ ```bash
928
+ CLASS_JSON=$($GSD_SDK query agent.classify-failure -- "$AGENT_RETURN_BODY")
929
+ CLASS=$(echo "$CLASS_JSON" | jq -r '.class')
930
+ SENTINEL=$(echo "$CLASS_JSON" | jq -r '.sentinel // empty')
931
+ RETRY_AFTER=$(echo "$CLASS_JSON" | jq -r '.retryAfterSeconds // empty')
932
+ if [ -n "$RETRY_AFTER" ]; then RETRY_HINT=" Provider hinted retry-after: ${RETRY_AFTER}s"; else RETRY_HINT=""; fi
933
+ ```
934
+ One classifier branch handles sentinels across Claude/Copilot/Codex/Gemini. Reference: `docs/research/provider-rate-limit-signals.md`.
935
+ **Step 7.1 — `class == "quota-exceeded"`:**
936
+ Do not offer "retry now". Run step-5 spot-check first; if SUMMARY.md is missing but commits exist, route to safe-resume (`state.verify-against-disk`) instead of immediate redispatch.
937
+ ```text
938
+ ⚠ Plan {plan_id} terminated by provider quota / rate limit
939
+ Runtime sentinel: {SENTINEL}
940
+ {RETRY_HINT}
941
+ Partial commits on worktree branch: {N}
942
+ SUMMARY.md present: {yes|no}
943
+ 1. Wait for quota reset, then resume (recommended)
944
+ 2. Switch to a different runtime / model and resume
945
+ 3. Abort phase and report partial state
946
+ ```
947
+ Re-run `/gsd:execute-phase` after quota reset for Option 1.
948
+ **Step 7.2 — `class == "classify-handoff-bug"`:**
949
+ If error contains `classifyHandoffIfNeeded is not defined`, treat as Claude runtime bug. Run the same step-5 spot-checks; PASS => treat as success, FAIL => fall through.
950
+ **Step 7.3 — `class == "unknown-failure"`:**
951
+ Report failed plan and ask Continue/Stop; continuing may cascade into dependent plan failures.
952
+
953
+ 7b. **Pre-wave dependency check (waves 2+ only):**
954
+ Before wave N+1, run `gsd-sdk query verify.key-links {phase_dir}/{plan}-PLAN.md` for each upcoming plan.
955
+ If any PRIOR-wave artifact link fails, present:
956
+ - `## Cross-Plan Wiring Gap` with plan/link/from/pattern rows
957
+ - Options: investigate+fix before continue, or continue with cascade risk
958
+ Skip key-links that reference files in the CURRENT (upcoming) wave.
959
+ 8. **Execute checkpoint plans between waves** — see `<checkpoint_handling>`.
960
+ 9. **Proceed to next wave.**
961
+ </step>
962
+ <step name="checkpoint_handling">
963
+ Plans with `autonomous: false` require user interaction.
964
+ **Auto-mode checkpoint handling:**
965
+ Read auto-advance config (chain flag OR user preference — same boolean as `check.auto-mode`):
966
+ ```bash
967
+ AUTO_MODE=$($GSD_SDK query check auto-mode --pick active 2>/dev/null || echo "false")
968
+ ```
969
+
970
+ When executor returns a checkpoint AND `AUTO_MODE` is `true`:
971
+ - **human-verify** → Auto-spawn continuation agent with `{user_response}` = `"approved"`. Log `⚡ Auto-approved checkpoint`.
972
+ - **decision** → Auto-spawn continuation agent with `{user_response}` = first option from checkpoint details. Log `⚡ Auto-selected: [option]`.
973
+ - **human-action** → Present to user (existing behavior below). Auth gates cannot be automated.
974
+
975
+ **Standard flow (not auto-mode, or human-action type):**
976
+
977
+ 1. Spawn agent for checkpoint plan
978
+ 2. Agent runs until checkpoint task or auth gate → returns structured state
979
+ 3. Agent return includes: completed tasks table, current task + blocker, checkpoint type/details, what's awaited
980
+ 4. **Present to user:**
981
+ ```
982
+ ## Checkpoint: [Type]
983
+
984
+ **Plan:** 03-03 Dashboard Layout
985
+ **Progress:** 2/3 tasks complete
986
+
987
+ [Checkpoint Details from agent return]
988
+ [Awaiting section from agent return]
989
+ ```
990
+ 5. User responds: "approved"/"done" | issue description | decision selection
991
+ 6. **Spawn continuation agent (NOT resume)** using continuation-prompt.md template:
992
+ - `{completed_tasks_table}`: From checkpoint return
993
+ - `{resume_task_number}` + `{resume_task_name}`: Current task
994
+ - `{user_response}`: What user provided
995
+ - `{resume_instructions}`: Based on checkpoint type
996
+ 7. Continuation agent verifies previous commits, continues from resume point
997
+ 8. Repeat until plan completes or user stops
998
+
999
+ **Why fresh agent, not resume:** Resume relies on internal serialization that breaks with parallel tool calls. Fresh agents with explicit state are more reliable.
1000
+
1001
+ **Checkpoints in parallel waves:** Agent pauses and returns while other parallel agents may complete. Present checkpoint, spawn continuation, wait for all before next wave.
1002
+ </step>
1003
+
1004
+ <step name="aggregate_results">
1005
+ After all waves:
1006
+
1007
+ ```markdown
1008
+ ## Phase {X}: {Name} Execution Complete
1009
+
1010
+ **Waves:** {N} | **Plans:** {M}/{total} complete
1011
+
1012
+ | Wave | Plans | Status |
1013
+ |------|-------|--------|
1014
+ | 1 | plan-01, plan-02 | ✓ Complete |
1015
+ | CP | plan-03 | ✓ Verified |
1016
+ | 2 | plan-04 | ✓ Complete |
1017
+
1018
+ ### Plan Details
1019
+ 1. **03-01**: [one-liner from SUMMARY.md]
1020
+ 2. **03-02**: [one-liner from SUMMARY.md]
1021
+
1022
+ ### Issues Encountered
1023
+ [Aggregate from SUMMARYs, or "None"]
1024
+ ```
1025
+
1026
+ **Security gate check:**
1027
+ ```bash
1028
+ SECURITY_CFG=$($GSD_SDK query config-get workflow.security_enforcement --raw 2>/dev/null || echo "true")
1029
+ SECURITY_FILE=$(ls "${PHASE_DIR}"/*-SECURITY.md 2>/dev/null | head -1)
1030
+ ```
1031
+
1032
+ If `SECURITY_CFG` is `false`: skip.
1033
+
1034
+ If `SECURITY_CFG` is `true` AND `SECURITY_FILE` is empty (no SECURITY.md yet):
1035
+ Include in the next-steps routing output:
1036
+ ```
1037
+ ⚠ Security enforcement enabled — run before advancing:
1038
+ /gsd:secure-phase {PHASE} ${GSD_WS}
1039
+ ```
1040
+
1041
+ If `SECURITY_CFG` is `true` AND SECURITY.md exists: check frontmatter `threats_open`. If > 0:
1042
+ ```
1043
+ ⚠ Security gate: {threats_open} threats open
1044
+ /gsd:secure-phase {PHASE} — resolve before advancing
1045
+ ```
1046
+ </step>
1047
+
1048
+ <step name="tdd_review_checkpoint">
1049
+ **Optional step — TDD collaborative review.**
1050
+
1051
+ ```bash
1052
+ TDD_MODE=$($GSD_SDK query config-get workflow.tdd_mode 2>/dev/null || echo "false")
1053
+ ```
1054
+
1055
+ **Skip if `TDD_MODE` is `false`.**
1056
+
1057
+ When `TDD_MODE` is `true`, check whether any completed plans in this phase have `type: tdd` in their frontmatter:
1058
+
1059
+ ```bash
1060
+ TDD_PLANS=$(grep -rl "^type: tdd" "${PHASE_DIR}"/*-PLAN.md 2>/dev/null | wc -l | tr -d ' ')
1061
+ ```
1062
+
1063
+ **If `TDD_PLANS` > 0:** Insert end-of-phase collaborative review checkpoint.
1064
+
1065
+ 1. Collect all SUMMARY.md files for TDD plans
1066
+ 2. For each TDD plan summary, verify the RED/GREEN/REFACTOR gate sequence:
1067
+ - RED gate: A failing test commit exists (`test(...)` commit with MUST-fail evidence)
1068
+ - GREEN gate: An implementation commit exists (`feat(...)` commit making tests pass)
1069
+ - REFACTOR gate: Optional cleanup commit (`refactor(...)` commit, tests still pass)
1070
+ 3. If any TDD plan is missing the RED or GREEN gate commits, flag it:
1071
+ ```
1072
+ ⚠ TDD gate violation: Plan {plan_id} missing {RED|GREEN} phase commit.
1073
+ Expected commit pattern: test({phase}-{plan}): ... → feat({phase}-{plan}): ...
1074
+ ```
1075
+ 4. Present collaborative review summary:
1076
+ ```
1077
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1078
+ TDD REVIEW — Phase {X}
1079
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1080
+
1081
+ TDD Plans: {TDD_PLANS} | Gate violations: {count}
1082
+
1083
+ | Plan | RED | GREEN | REFACTOR | Status |
1084
+ |------|-----|-------|----------|--------|
1085
+ | {id} | ✓ | ✓ | ✓ | Pass |
1086
+ | {id} | ✓ | ✗ | — | FAIL |
1087
+ ```
1088
+
1089
+ **Escalation under MVP+TDD.** When `MVP_MODE=true` AND `TDD_MODE=true`, the review verdict escalates from advisory to **blocking**: missing RED or GREEN gate commits prevent marking the phase complete.
1090
+ ```text
1091
+ Phase blocked: {N} TDD plan(s) violate the RED→GREEN gate sequence under MVP+TDD.
1092
+ Resolve and re-run /gsd execute-phase, or override with
1093
+ /gsd execute-phase {phase} --force-mvp-gate to ship anyway.
1094
+ ```
1095
+ `--force-mvp-gate` is the escape hatch (documented, not yet implemented). Policy is:
1096
+ - `MVP_MODE=true` AND `TDD_MODE=true`: violations are **blocking** unless explicitly overridden.
1097
+ - otherwise: violations are advisory/non-blocking and are surfaced for review.
1098
+ The verifier agent (step `verify_phase_goal`) still checks TDD discipline in both cases.
1099
+ </step>
1100
+
1101
+ <step name="handle_partial_wave_execution">
1102
+ If `WAVE_FILTER` was used, re-run plan discovery after execution:
1103
+
1104
+ ```bash
1105
+ POST_PLAN_INDEX=$($GSD_SDK query phase-plan-index "${PHASE_NUMBER}")
1106
+ ```
1107
+
1108
+ Apply the same "incomplete" filtering rules as earlier:
1109
+ - ignore plans with `has_summary: true`
1110
+ - if `--gaps-only`, only consider `gap_closure: true` plans
1111
+
1112
+ **If incomplete plans still remain anywhere in the phase:**
1113
+ - STOP here
1114
+ - Do NOT run phase verification
1115
+ - Do NOT mark the phase complete in ROADMAP/STATE
1116
+ - Present:
1117
+
1118
+ ```markdown
1119
+ ## Wave {WAVE_FILTER} Complete
1120
+
1121
+ Selected wave finished successfully. This phase still has incomplete plans, so phase-level verification and completion were intentionally skipped.
1122
+
1123
+ /gsd:execute-phase {phase} ${GSD_WS} # Continue remaining waves
1124
+ /gsd:execute-phase {phase} --wave {next} ${GSD_WS} # Run the next wave explicitly
1125
+ ```
1126
+
1127
+ **If no incomplete plans remain after the selected wave finishes:**
1128
+ - continue with the normal phase-level verification and completion flow below
1129
+ - this means the selected wave happened to be the last remaining work in the phase
1130
+ </step>
1131
+
1132
+ <step name="code_review_gate" required="true">
1133
+ **This step is REQUIRED and must not be skipped.** Auto-invoke code review on the phase's source changes. Advisory only — never blocks execution flow.
1134
+
1135
+ **Config gate:**
1136
+ ```bash
1137
+ CODE_REVIEW_ENABLED=$($GSD_SDK query config-get workflow.code_review 2>/dev/null || echo "true")
1138
+ ```
1139
+
1140
+ If `CODE_REVIEW_ENABLED` is `"false"`: display "Code review skipped (workflow.code_review=false)" and proceed to next step.
1141
+
1142
+ **Invoke review:**
1143
+ ```
1144
+ Skill(skill="gsd-code-review", args="${PHASE_NUMBER}")
1145
+ ```
1146
+
1147
+ **Check results using deterministic path (not glob):**
1148
+ ```bash
1149
+ PADDED=$(printf "%02d" "${PHASE_NUMBER}")
1150
+ REVIEW_FILE="${PHASE_DIR}/${PADDED}-REVIEW.md"
1151
+ REVIEW_STATUS=$(sed -n '/^---$/,/^---$/p' "$REVIEW_FILE" | grep "^status:" | head -1 | cut -d: -f2 | tr -d ' ')
1152
+ ```
1153
+
1154
+ If REVIEW_STATUS is not "clean" and not "skipped" and not empty, display:
1155
+ ```
1156
+ Code review found issues. Consider running:
1157
+ /gsd:code-review ${PHASE_NUMBER} --fix
1158
+ ```
1159
+
1160
+ **Error handling:** If the Skill invocation fails or throws, catch the error, display "Code review encountered an error (non-blocking): {error}" and proceed to next step. Review failures must never block execution.
1161
+
1162
+ Regardless of review result, ALWAYS proceed to close_parent_artifacts → regression_gate → verify_phase_goal.
1163
+ </step>
1164
+
1165
+ <step name="close_parent_artifacts">
1166
+ **For decimal/polish phases only (X.Y pattern):** Close the feedback loop by resolving parent UAT and debug artifacts.
1167
+
1168
+ **Skip if** phase number has no decimal (e.g., `3`, `04`) — only applies to gap-closure phases like `4.1`, `03.1`.
1169
+
1170
+ **1. Detect decimal phase and derive parent:**
1171
+ ```bash
1172
+ # Check if phase_number contains a decimal
1173
+ if [[ "$PHASE_NUMBER" == *.* ]]; then
1174
+ PARENT_PHASE="${PHASE_NUMBER%%.*}"
1175
+ fi
1176
+ ```
1177
+
1178
+ **2. Find parent UAT file:**
1179
+ ```bash
1180
+ PARENT_INFO=$($GSD_SDK query find-phase "${PARENT_PHASE}" --raw)
1181
+ # Extract directory from PARENT_INFO JSON, then find UAT file in that directory
1182
+ ```
1183
+
1184
+ **If no parent UAT found:** Skip this step (gap-closure may have been triggered by VERIFICATION.md instead).
1185
+
1186
+ **3. Update UAT gap statuses:**
1187
+
1188
+ Read the parent UAT file's `## Gaps` section. For each gap entry with `status: failed`:
1189
+ - Update to `status: resolved`
1190
+
1191
+ **4. Update UAT frontmatter:**
1192
+
1193
+ If all gaps now have `status: resolved`:
1194
+ - Update frontmatter `status: diagnosed` → `status: resolved`
1195
+ - Update frontmatter `updated:` timestamp
1196
+
1197
+ **5. Resolve referenced debug sessions:**
1198
+
1199
+ For each gap that has a `debug_session:` field:
1200
+ - Read the debug session file
1201
+ - Update frontmatter `status:` → `resolved`
1202
+ - Update frontmatter `updated:` timestamp
1203
+ - Move to resolved directory:
1204
+ ```bash
1205
+ mkdir -p .planning/debug/resolved
1206
+ mv .planning/debug/{slug}.md .planning/debug/resolved/
1207
+ ```
1208
+
1209
+ **6. Commit updated artifacts:**
1210
+ ```bash
1211
+ $GSD_SDK query commit "docs(phase-${PARENT_PHASE}): resolve UAT gaps and debug sessions after ${PHASE_NUMBER} gap closure" --files .planning/phases/*${PARENT_PHASE}*/*-UAT.md .planning/debug/resolved/*.md
1212
+ ```
1213
+ </step>
1214
+
1215
+ <step name="regression_gate">
1216
+ Run prior phases' test suites to catch cross-phase regressions BEFORE verification.
1217
+
1218
+ **Skip if:** This is the first phase (no prior phases), or no prior VERIFICATION.md files exist.
1219
+
1220
+ **Step 1: Discover prior phases' test files**
1221
+ ```bash
1222
+ # Find all VERIFICATION.md files from prior phases in current milestone
1223
+ PRIOR_VERIFICATIONS=$(find .planning/phases/ -name "*-VERIFICATION.md" ! -path "*${PHASE_NUMBER}*" 2>/dev/null)
1224
+ ```
1225
+
1226
+ **Step 2: Extract test file lists from prior verifications**
1227
+
1228
+ For each VERIFICATION.md found, look for test file references:
1229
+ - Lines containing `test`, `spec`, or `__tests__` paths
1230
+ - The "Test Suite" or "Automated Checks" section
1231
+ - File patterns from `key-files.created` in corresponding SUMMARY.md files that match `*.test.*` or `*.spec.*`
1232
+
1233
+ Collect all unique test file paths into `REGRESSION_FILES`.
1234
+
1235
+ **Step 3: Run regression tests (if any found)**
1236
+
1237
+ ```bash
1238
+ # Resolve test command: project config > Makefile > language sniff
1239
+ REG_TEST_CMD=$($GSD_SDK query config-get workflow.test_command --default "" 2>/dev/null || true)
1240
+ if [ -z "$REG_TEST_CMD" ]; then
1241
+ if [ -f "Makefile" ] && grep -q "^test:" Makefile; then
1242
+ REG_TEST_CMD="make test"
1243
+ elif [ -f "Justfile" ] || [ -f "justfile" ]; then
1244
+ REG_TEST_CMD="just test"
1245
+ elif [ -f "package.json" ]; then
1246
+ REG_TEST_CMD="npm test"
1247
+ elif [ -f "Cargo.toml" ]; then
1248
+ REG_TEST_CMD="cargo test"
1249
+ elif [ -f "go.mod" ]; then
1250
+ REG_TEST_CMD="go test ./..."
1251
+ elif [ -f "requirements.txt" ] || [ -f "pyproject.toml" ]; then
1252
+ REG_TEST_CMD="python -m pytest ${REGRESSION_FILES} -q --tb=short"
1253
+ else
1254
+ REG_TEST_CMD="true"
1255
+ fi
1256
+ fi
1257
+ # Detect test runner and run prior phase tests
1258
+ eval "$REG_TEST_CMD" 2>&1
1259
+ ```
1260
+
1261
+ **Step 4: Report results**
1262
+
1263
+ If all tests pass:
1264
+ ```
1265
+ ✓ Regression gate: {N} prior-phase test files passed — no regressions detected
1266
+ ```
1267
+ → Proceed to verify_phase_goal
1268
+
1269
+ If any tests fail:
1270
+ ```
1271
+ ## ⚠ Cross-Phase Regression Detected
1272
+
1273
+ Phase {X} execution may have broken functionality from prior phases.
1274
+
1275
+ | Test File | Phase | Status | Detail |
1276
+ |-----------|-------|--------|--------|
1277
+ | {file} | {origin_phase} | FAILED | {first_failure_line} |
1278
+
1279
+ Options:
1280
+ 1. Fix regressions before verification (recommended)
1281
+ 2. Continue to verification anyway (regressions will compound)
1282
+ 3. Abort phase — roll back and re-plan
1283
+ ```
1284
+
1285
+ Use AskUserQuestion to present the options.
1286
+ </step>
1287
+
1288
+ <step name="schema_drift_gate">
1289
+ Post-execution schema drift detection. Catches false-positive verification where
1290
+ build/types pass because TypeScript types come from config, not the live database.
1291
+
1292
+ **Run after execution completes but BEFORE verification marks success.**
1293
+
1294
+ ```bash
1295
+ SCHEMA_DRIFT=$($GSD_SDK query verify.schema-drift "${PHASE_NUMBER}" 2>/dev/null)
1296
+ ```
1297
+
1298
+ Parse JSON result for: `drift_detected`, `blocking`, `schema_files`, `orms`, `unpushed_orms`, `message`.
1299
+
1300
+ **If `drift_detected` is false:** Skip to verify_phase_goal.
1301
+
1302
+ **If `drift_detected` is true AND `blocking` is true:**
1303
+
1304
+ Check for override:
1305
+ ```bash
1306
+ SKIP_SCHEMA=$(echo "${GSD_SKIP_SCHEMA_CHECK:-false}")
1307
+ ```
1308
+
1309
+ **If `SKIP_SCHEMA` is `true`:**
1310
+
1311
+ Display:
1312
+ ```
1313
+ ⚠ Schema drift detected but GSD_SKIP_SCHEMA_CHECK=true — bypassing gate.
1314
+
1315
+ Schema files changed: {schema_files}
1316
+ ORMs requiring push: {unpushed_orms}
1317
+
1318
+ Proceeding to verification (database may be out of sync).
1319
+ ```
1320
+ → Continue to verify_phase_goal.
1321
+
1322
+ **If `SKIP_SCHEMA` is not `true`:**
1323
+
1324
+ BLOCK verification. Display:
1325
+
1326
+ ```
1327
+ ## BLOCKED: Schema Drift Detected
1328
+
1329
+ Schema-relevant files changed during this phase but no database push command
1330
+ was executed. Build and type checks pass because TypeScript types come from
1331
+ config, not the live database — verification would produce a false positive.
1332
+
1333
+ Schema files changed: {schema_files}
1334
+ ORMs requiring push: {unpushed_orms}
1335
+
1336
+ Required push commands:
1337
+ {For each unpushed ORM, show the push command from the message}
1338
+
1339
+ Options:
1340
+ 1. Run push command now (recommended) — execute the push, then re-verify
1341
+ 2. Skip schema check (GSD_SKIP_SCHEMA_CHECK=true) — bypass this gate
1342
+ 3. Abort — stop execution and investigate
1343
+ ```
1344
+
1345
+ If `TEXT_MODE` is true, present as a plain-text numbered list. Otherwise use AskUserQuestion.
1346
+
1347
+ **If user selects option 1:** Present the specific push command(s) to run. After user confirms execution, re-run the schema drift check. If it passes, continue to verify_phase_goal.
1348
+
1349
+ **If user selects option 2:** Set override and continue to verify_phase_goal.
1350
+
1351
+ **If user selects option 3:** Stop execution. Report partial completion.
1352
+ </step>
1353
+
1354
+ <step name="codebase_drift_gate">
1355
+ Post-execution structural drift detection (#2003). Non-blocking by contract:
1356
+ any internal error here MUST fall through to `verify_phase_goal`. The phase
1357
+ is never failed by this gate.
1358
+
1359
+ Load and follow the full step spec from
1360
+ `get-shit-done/workflows/execute-phase/steps/codebase-drift-gate.md` —
1361
+ covers the SDK call, JSON contract, `warn` vs `auto-remap` branches, mapper
1362
+ spawn template, and the two `workflow.drift_*` config keys.
1363
+ </step>
1364
+
1365
+ <step name="verify_phase_goal">
1366
+ Verify phase achieved its GOAL, not just completed tasks.
1367
+
1368
+ ```bash
1369
+ VERIFIER_SKILLS=$($GSD_SDK query agent-skills gsd-verifier)
1370
+ ```
1371
+
1372
+ ```
1373
+ Agent(
1374
+ description="Verify phase {phase_number} goal achievement",
1375
+ prompt="Verify phase {phase_number} goal achievement.
1376
+ Phase directory: {phase_dir}
1377
+ Phase goal: {goal from ROADMAP.md}
1378
+ Phase requirement IDs: {phase_req_ids}
1379
+ Check must_haves against actual codebase.
1380
+ Cross-reference requirement IDs from PLAN frontmatter against REQUIREMENTS.md — every ID MUST be accounted for.
1381
+ Create VERIFICATION.md.
1382
+
1383
+ <files_to_read>
1384
+ Read these files before verification:
1385
+ - {phase_dir}/*-PLAN.md (All plans — understand intent, check must_haves)
1386
+ - {phase_dir}/*-SUMMARY.md (All summaries — cross-reference claimed vs actual)
1387
+ - .planning/REQUIREMENTS.md (Requirement traceability)
1388
+ ${CONTEXT_WINDOW >= 500000 ? `- {phase_dir}/*-CONTEXT.md (User decisions — verify they were honored)
1389
+ - {phase_dir}/*-RESEARCH.md (Known pitfalls — check for traps)
1390
+ - Prior VERIFICATION.md files from earlier phases (regression check)
1391
+ ` : ''}
1392
+ </files_to_read>
1393
+
1394
+ ${VERIFIER_SKILLS}",
1395
+ subagent_type="gsd-verifier",
1396
+ model="{verifier_model}"
1397
+ )
1398
+ ```
1399
+
1400
+ > **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.
1401
+
1402
+ Read status:
1403
+ ```bash
1404
+ grep "^status:" "$PHASE_DIR"/*-VERIFICATION.md | cut -d: -f2 | tr -d ' '
1405
+ ```
1406
+
1407
+ | Status | Action |
1408
+ |--------|--------|
1409
+ | `passed` | → update_roadmap |
1410
+ | `human_needed` | Persist and present human testing items; keep phase pending until verification reruns as `passed` |
1411
+ | `gaps_found` | Present gap summary, offer `/gsd:plan-phase {phase} --gaps ${GSD_WS}` |
1412
+
1413
+ **If human_needed:**
1414
+
1415
+ **Step A: Persist human verification items as UAT file.**
1416
+
1417
+ Create `{phase_dir}/{phase_num}-HUMAN-UAT.md` using UAT template format:
1418
+
1419
+ ```markdown
1420
+ ---
1421
+ status: partial
1422
+ phase: {phase_num}-{phase_name}
1423
+ source: [{phase_num}-VERIFICATION.md]
1424
+ started: [now ISO]
1425
+ updated: [now ISO]
1426
+ ---
1427
+
1428
+ ## Current Test
1429
+
1430
+ [awaiting human testing]
1431
+
1432
+ ## Tests
1433
+
1434
+ {For each human_verification item from VERIFICATION.md:}
1435
+
1436
+ ### {N}. {item description}
1437
+ expected: {expected behavior from VERIFICATION.md}
1438
+ result: [pending]
1439
+
1440
+ ## Summary
1441
+
1442
+ total: {count}
1443
+ passed: 0
1444
+ issues: 0
1445
+ pending: {count}
1446
+ skipped: 0
1447
+ blocked: 0
1448
+
1449
+ ## Gaps
1450
+ ```
1451
+
1452
+ Commit the file:
1453
+ ```bash
1454
+ $GSD_SDK query commit "test({phase_num}): persist human verification items as UAT" --files "{phase_dir}/{phase_num}-HUMAN-UAT.md"
1455
+ ```
1456
+
1457
+ **Step B: Present to user:**
1458
+
1459
+ ```
1460
+ ## ✓ Phase {X}: {Name} — Human Verification Required
1461
+
1462
+ All automated checks passed. {N} items need human testing:
1463
+
1464
+ {From VERIFICATION.md human_verification section}
1465
+
1466
+ Items saved to `{phase_num}-HUMAN-UAT.md` — they will appear in `/gsd:progress` and `/gsd:audit-uat`.
1467
+
1468
+ "approved" → continue | Report issues → gap closure
1469
+ ```
1470
+
1471
+ **If user says "approved":** Proceed to `update_roadmap`. The HUMAN-UAT.md file persists with `status: partial` and will surface in future progress checks until the user runs `/gsd:verify-work` on it.
1472
+
1473
+ **If user reports issues:** Proceed to gap closure as currently implemented.
1474
+
1475
+ **If gaps_found:**
1476
+ ```
1477
+ ## ⚠ Phase {X}: {Name} — Gaps Found
1478
+
1479
+ **Score:** {N}/{M} must-haves verified
1480
+ **Report:** {phase_dir}/{phase_num}-VERIFICATION.md
1481
+
1482
+ ### What's Missing
1483
+ {Gap summaries from VERIFICATION.md}
1484
+
1485
+ ---
1486
+ ## ▶ Next Up — [${PROJECT_CODE}] ${PROJECT_TITLE}
1487
+
1488
+ `/clear` then:
1489
+
1490
+ `/gsd:plan-phase {X} --gaps ${GSD_WS}`
1491
+
1492
+ Also: `cat {phase_dir}/{phase_num}-VERIFICATION.md` — full report
1493
+ Also: `/gsd:verify-work {X} ${GSD_WS}` — manual testing first
1494
+ ```
1495
+
1496
+ Gap closure cycle: `/gsd:plan-phase {X} --gaps ${GSD_WS}` reads VERIFICATION.md → creates gap plans with `gap_closure: true` → user runs `/gsd:execute-phase {X} --gaps-only ${GSD_WS}` → verifier re-runs.
1497
+ </step>
1498
+
1499
+ <step name="update_roadmap">
1500
+ **Mark phase complete and update all tracking files:**
1501
+
1502
+ ```bash
1503
+ COMPLETION=$($GSD_SDK query phase.complete "${PHASE_NUMBER}")
1504
+ ```
1505
+
1506
+ The CLI handles:
1507
+ - Marking phase checkbox `[x]` with completion date
1508
+ - Updating Progress table (Status → Complete, date)
1509
+ - Updating plan count to final
1510
+ - Advancing STATE.md to next phase
1511
+ - Updating REQUIREMENTS.md traceability
1512
+ - Scanning for verification debt (returns `warnings` array)
1513
+
1514
+ Extract from result: `next_phase`, `next_phase_name`, `is_last_phase`, `warnings`, `has_warnings`.
1515
+
1516
+ **If has_warnings is true:**
1517
+ ```
1518
+ ## Phase {X} marked complete with {N} warnings:
1519
+
1520
+ {list each warning}
1521
+
1522
+ These items are tracked and will appear in `/gsd:progress` and `/gsd:audit-uat`.
1523
+ ```
1524
+
1525
+ ```bash
1526
+ $GSD_SDK query commit "docs(phase-{X}): complete phase execution" --files .planning/ROADMAP.md .planning/STATE.md .planning/REQUIREMENTS.md {phase_dir}/*-VERIFICATION.md
1527
+ ```
1528
+ </step>
1529
+
1530
+ <step name="auto_copy_learnings">
1531
+ **Auto-copy phase learnings to global store (when enabled).**
1532
+
1533
+ This step runs AFTER phase completion and SUMMARY.md is written. It copies any LEARNINGS.md
1534
+ entries from the completed phase to the global learnings store at `~/.gsd/knowledge/`.
1535
+
1536
+ **Check config gate:**
1537
+ ```bash
1538
+ GL_ENABLED=$($GSD_SDK query config-get features.global_learnings --raw 2>/dev/null || echo "false")
1539
+ ```
1540
+
1541
+ **If `GL_ENABLED` is not `true`:** Skip this step entirely (feature disabled by default).
1542
+
1543
+ **If enabled:**
1544
+
1545
+ 1. Check if LEARNINGS.md exists in the phase directory (use the `phase_dir` value from init context)
1546
+ 2. If found, copy to global store:
1547
+ ```bash
1548
+ $GSD_SDK query learnings.copy 2>/dev/null || echo "⚠ Learnings copy failed — continuing"
1549
+ ```
1550
+ Copy failure must NOT block phase completion.
1551
+ </step>
1552
+
1553
+ <step name="close_phase_todos">
1554
+ **Auto-close pending todos tagged for this phase (#2433).**
1555
+
1556
+ This step runs AFTER `update_roadmap` marks the phase complete. It moves any pending todos that carry `resolves_phase: <current-phase-number>` to the completed directory.
1557
+
1558
+ ```bash
1559
+ PHASE_NUM="${PHASE_NUMBER}"
1560
+ PENDING_DIR=".planning/todos/pending"
1561
+ COMPLETED_DIR=".planning/todos/completed"
1562
+ mkdir -p "$COMPLETED_DIR"
1563
+
1564
+ CLOSED=()
1565
+ for TODO_FILE in "$PENDING_DIR"/*.md; do
1566
+ [ -f "$TODO_FILE" ] || continue
1567
+ # Extract resolves_phase from YAML frontmatter (first --- block only)
1568
+ RP=$(awk '/^---/{c++;next} c==1 && /^resolves_phase:/{print $2;exit} c==2{exit}' "$TODO_FILE" 2>/dev/null || true)
1569
+ if [ "$RP" = "$PHASE_NUM" ] || [ "$RP" = "\"$PHASE_NUM\"" ]; then
1570
+ mv "$TODO_FILE" "$COMPLETED_DIR/"
1571
+ CLOSED+=("$(basename "$TODO_FILE")")
1572
+ fi
1573
+ done
1574
+
1575
+ if [ ${#CLOSED[@]} -gt 0 ]; then
1576
+ $GSD_SDK query commit "docs(phase-${PHASE_NUMBER}): auto-close ${#CLOSED[@]} todo(s) resolved by this phase" --files .planning/todos/completed/ .planning/STATE.md|| true
1577
+ echo "◆ Closed ${#CLOSED[@]} todo(s) resolved by Phase ${PHASE_NUMBER}:"
1578
+ for f in "${CLOSED[@]}"; do echo " ✓ $f"; done
1579
+ fi
1580
+ ```
1581
+
1582
+ **If no todos have `resolves_phase: <this-phase>`:** Skip silently — this step is always additive and never blocks phase completion.
1583
+ </step>
1584
+
1585
+ <step name="update_project_md">
1586
+ **Evolve PROJECT.md to reflect phase completion (prevents planning document drift — #956):**
1587
+
1588
+ PROJECT.md tracks validated requirements, decisions, and current state. Without this step,
1589
+ PROJECT.md falls behind silently over multiple phases.
1590
+
1591
+ 1. Read `.planning/PROJECT.md`
1592
+ 2. If the file exists and has a `## Validated Requirements` or `## Requirements` section:
1593
+ - Move any requirements validated by this phase from Active → Validated
1594
+ - Add a brief note: `Validated in Phase {X}: {Name}`
1595
+ 3. If the file has a `## Current State` or similar section:
1596
+ - Update it to reflect this phase's completion (e.g., "Phase {X} complete — {one-liner}")
1597
+ 4. Update the `Last updated:` footer to today's date
1598
+ 5. Commit the change:
1599
+
1600
+ ```bash
1601
+ $GSD_SDK query commit "docs(phase-{X}): evolve PROJECT.md after phase completion" --files .planning/PROJECT.md
1602
+ ```
1603
+
1604
+ **Skip this step if** `.planning/PROJECT.md` does not exist.
1605
+ </step>
1606
+
1607
+ <step name="offer_next">
1608
+
1609
+ **Exception:** If `gaps_found`, the `verify_phase_goal` step already presents the gap-closure path (`/gsd:plan-phase {X} --gaps`). No additional routing needed — skip auto-advance.
1610
+
1611
+ **No-transition check (spawned by auto-advance chain):**
1612
+
1613
+ Parse `--no-transition` flag from $ARGUMENTS.
1614
+
1615
+ **If `--no-transition` flag present:**
1616
+
1617
+ Execute-phase was spawned by plan-phase's auto-advance. Do NOT run transition.md.
1618
+ After verification passes and roadmap is updated, return completion status to parent:
1619
+
1620
+ ```
1621
+ ## PHASE COMPLETE
1622
+
1623
+ Phase: ${PHASE_NUMBER} - ${PHASE_NAME}
1624
+ Plans: ${completed_count}/${total_count}
1625
+ Verification: {Passed | Gaps Found}
1626
+
1627
+ [Include aggregate_results output]
1628
+ ```
1629
+
1630
+ STOP. Do not proceed to auto-advance or transition.
1631
+
1632
+ **If `--no-transition` flag is NOT present:**
1633
+
1634
+ **Auto-advance detection:**
1635
+
1636
+ 1. Parse `--auto` flag from $ARGUMENTS
1637
+ 2. Read consolidated auto-mode (`active` = chain flag OR user preference; chain flag already synced in init step):
1638
+ ```bash
1639
+ AUTO_MODE=$($GSD_SDK query check auto-mode --pick active 2>/dev/null || echo "false")
1640
+ ```
1641
+
1642
+ **If `--auto` flag present OR `AUTO_MODE` is true (AND verification passed with no gaps):**
1643
+
1644
+ ```
1645
+ ╔══════════════════════════════════════════╗
1646
+ ║ AUTO-ADVANCING → TRANSITION ║
1647
+ ║ Phase {X} verified, continuing chain ║
1648
+ ╚══════════════════════════════════════════╝
1649
+ ```
1650
+
1651
+ Execute the transition workflow inline (do NOT use Agent — orchestrator context is ~10-15%, transition needs phase completion data already in context):
1652
+
1653
+ Read and follow `~/.claude/get-shit-done/workflows/transition.md`, passing through the `--auto` flag so it propagates to the next phase invocation.
1654
+
1655
+ **If neither `--auto` nor `AUTO_MODE` is true:**
1656
+
1657
+ **STOP. Do not auto-advance. Do not execute transition. Do not plan next phase. Present options to the user and wait.**
1658
+
1659
+ **IMPORTANT: There is NO `/gsd-transition` command. Never suggest it. The transition workflow is internal only.**
1660
+
1661
+ Check whether CONTEXT.md already exists for the next phase:
1662
+
1663
+ ```bash
1664
+ ls .planning/phases/*{next}*/{next}-CONTEXT.md 2>/dev/null || echo "no-context"
1665
+ ```
1666
+
1667
+ If CONTEXT.md does **not** exist for the next phase, present:
1668
+
1669
+ ```
1670
+ ## ✓ Phase {X}: {Name} Complete
1671
+
1672
+ /gsd:progress ${GSD_WS} — see updated roadmap
1673
+ /gsd:discuss-phase {next} ${GSD_WS} — start here: discuss next phase before planning ← recommended
1674
+ /gsd:plan-phase {next} ${GSD_WS} — plan next phase (skip discuss)
1675
+ /gsd:execute-phase {next} ${GSD_WS} — execute next phase (skip discuss and plan)
1676
+ ```
1677
+
1678
+ If CONTEXT.md **exists** for the next phase, present:
1679
+
1680
+ ```
1681
+ ## ✓ Phase {X}: {Name} Complete
1682
+
1683
+ /gsd:progress ${GSD_WS} — see updated roadmap
1684
+ /gsd:plan-phase {next} ${GSD_WS} — start here: plan next phase (CONTEXT.md already present) ← recommended
1685
+ /gsd:discuss-phase {next} ${GSD_WS} — re-discuss next phase
1686
+ /gsd:execute-phase {next} ${GSD_WS} — execute next phase (skip planning)
1687
+ ```
1688
+
1689
+ Only suggest the commands listed above. Do not invent or hallucinate command names.
1690
+ </step>
1691
+
1692
+ </process>
1693
+
1694
+ <context_efficiency>
1695
+ Orchestrator: ~10-15% context for 200k windows, can use more for 1M+ windows.
1696
+ Subagents: fresh context each (200k-1M depending on model). No polling (Agent blocks). No context bleed.
1697
+
1698
+ For 1M+ context models, consider:
1699
+ - Passing richer context (code snippets, dependency outputs) directly to executors instead of just file paths
1700
+ - Running small phases (≤3 plans, no dependencies) inline without subagent spawning overhead
1701
+ - Relaxing /clear recommendations — context rot onset is much further out with 5x window
1702
+ </context_efficiency>
1703
+
1704
+ <failure_handling>
1705
+ - **Quota / rate-limit (any runtime — #3095):** Agent return body contains a sentinel like `usage limit`, `rate limit`, `429`, `too many requests`, `RESOURCE_EXHAUSTED`, `usage_limit_reached`. Route via `gsd-sdk query agent.classify-failure` → `class: "quota-exceeded"`. Do not offer retry-now; the right action is wait-for-reset and resume.
1706
+ - **classifyHandoffIfNeeded false failure:** Agent reports "failed" but error is `classifyHandoffIfNeeded is not defined` → Claude Code bug, not GSD. Spot-check (SUMMARY exists, commits present) → if pass, treat as success
1707
+ - **Agent fails mid-plan:** Missing SUMMARY.md → report, ask user how to proceed
1708
+ - **Dependency chain breaks:** Wave 1 fails → Wave 2 dependents likely fail → user chooses attempt or skip
1709
+ - **All agents in wave fail:** Systemic issue → stop, report for investigation
1710
+ - **Checkpoint unresolvable:** "Skip this plan?" or "Abort phase execution?" → record partial progress in STATE.md
1711
+ </failure_handling>
1712
+
1713
+ <resumption>
1714
+ Re-run `/gsd:execute-phase {phase}` → discover_plans finds completed SUMMARYs → skips them → resumes from first incomplete plan → continues wave execution.
1715
+
1716
+ STATE.md tracks: last completed plan, current wave, pending checkpoints.
1717
+ </resumption>