gsd-pi 2.66.1 → 2.67.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 (272) hide show
  1. package/dist/claude-cli-check.d.ts +8 -0
  2. package/dist/claude-cli-check.js +36 -0
  3. package/dist/cli.js +40 -0
  4. package/dist/onboarding.js +19 -2
  5. package/dist/resources/extensions/ask-user-questions.js +79 -11
  6. package/dist/resources/extensions/claude-code-cli/partial-builder.js +4 -3
  7. package/dist/resources/extensions/claude-code-cli/readiness.js +63 -12
  8. package/dist/resources/extensions/claude-code-cli/stream-adapter.js +10 -3
  9. package/dist/resources/extensions/gsd/auto/loop.js +13 -1
  10. package/dist/resources/extensions/gsd/auto/phases.js +22 -3
  11. package/dist/resources/extensions/gsd/auto/run-unit.js +10 -2
  12. package/dist/resources/extensions/gsd/auto/session.js +1 -1
  13. package/dist/resources/extensions/gsd/auto-dashboard.js +65 -15
  14. package/dist/resources/extensions/gsd/auto-dispatch.js +30 -28
  15. package/dist/resources/extensions/gsd/auto-model-selection.js +12 -3
  16. package/dist/resources/extensions/gsd/auto-prompts.js +173 -25
  17. package/dist/resources/extensions/gsd/auto-recovery.js +11 -12
  18. package/dist/resources/extensions/gsd/auto.js +13 -1
  19. package/dist/resources/extensions/gsd/bootstrap/agent-end-recovery.js +32 -1
  20. package/dist/resources/extensions/gsd/bootstrap/db-tools.js +18 -6
  21. package/dist/resources/extensions/gsd/bootstrap/provider-error-resume.js +5 -0
  22. package/dist/resources/extensions/gsd/bootstrap/register-hooks.js +59 -5
  23. package/dist/resources/extensions/gsd/bootstrap/register-shortcuts.js +8 -5
  24. package/dist/resources/extensions/gsd/bootstrap/write-gate.js +186 -14
  25. package/dist/resources/extensions/gsd/codebase-generator.js +4 -0
  26. package/dist/resources/extensions/gsd/commands/handlers/core.js +3 -3
  27. package/dist/resources/extensions/gsd/commands-prefs-wizard.js +10 -4
  28. package/dist/resources/extensions/gsd/context-store.js +134 -2
  29. package/dist/resources/extensions/gsd/custom-workflow-engine.js +3 -1
  30. package/dist/resources/extensions/gsd/detection.js +6 -0
  31. package/dist/resources/extensions/gsd/files.js +19 -2
  32. package/dist/resources/extensions/gsd/guided-flow.js +12 -8
  33. package/dist/resources/extensions/gsd/index.js +1 -1
  34. package/dist/resources/extensions/gsd/parallel-monitor-overlay.js +2 -0
  35. package/dist/resources/extensions/gsd/parsers-legacy.js +3 -1
  36. package/dist/resources/extensions/gsd/preferences.js +6 -1
  37. package/dist/resources/extensions/gsd/prompts/complete-milestone.md +1 -1
  38. package/dist/resources/extensions/gsd/prompts/discuss-prepared.md +7 -7
  39. package/dist/resources/extensions/gsd/prompts/discuss.md +3 -3
  40. package/dist/resources/extensions/gsd/prompts/guided-discuss-milestone.md +3 -3
  41. package/dist/resources/extensions/gsd/prompts/guided-discuss-slice.md +3 -1
  42. package/dist/resources/extensions/gsd/prompts/rethink.md +6 -2
  43. package/dist/resources/extensions/gsd/prompts/system.md +1 -1
  44. package/dist/resources/extensions/gsd/prompts/triage-captures.md +1 -1
  45. package/dist/resources/extensions/gsd/prompts/validate-milestone.md +4 -4
  46. package/dist/resources/extensions/gsd/prompts/worktree-merge.md +3 -1
  47. package/dist/resources/extensions/gsd/safety/file-change-validator.js +2 -1
  48. package/dist/resources/extensions/gsd/state.js +2 -1
  49. package/dist/resources/extensions/gsd/visualizer-overlay.js +27 -26
  50. package/dist/resources/extensions/gsd/workflow-reconcile.js +46 -7
  51. package/dist/resources/extensions/remote-questions/manager.js +8 -0
  52. package/dist/resources/extensions/shared/interview-ui.js +10 -0
  53. package/dist/web/standalone/.next/BUILD_ID +1 -1
  54. package/dist/web/standalone/.next/app-path-routes-manifest.json +12 -12
  55. package/dist/web/standalone/.next/build-manifest.json +2 -2
  56. package/dist/web/standalone/.next/prerender-manifest.json +3 -3
  57. package/dist/web/standalone/.next/server/app/_global-error.html +2 -2
  58. package/dist/web/standalone/.next/server/app/_global-error.rsc +1 -1
  59. package/dist/web/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  60. package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  61. package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  62. package/dist/web/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  63. package/dist/web/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  64. package/dist/web/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  65. package/dist/web/standalone/.next/server/app/_not-found.html +1 -1
  66. package/dist/web/standalone/.next/server/app/_not-found.rsc +1 -1
  67. package/dist/web/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
  68. package/dist/web/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  69. package/dist/web/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
  70. package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  71. package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  72. package/dist/web/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  73. package/dist/web/standalone/.next/server/app/index.html +1 -1
  74. package/dist/web/standalone/.next/server/app/index.rsc +1 -1
  75. package/dist/web/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
  76. package/dist/web/standalone/.next/server/app/index.segments/_full.segment.rsc +1 -1
  77. package/dist/web/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
  78. package/dist/web/standalone/.next/server/app/index.segments/_index.segment.rsc +1 -1
  79. package/dist/web/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
  80. package/dist/web/standalone/.next/server/app-paths-manifest.json +12 -12
  81. package/dist/web/standalone/.next/server/pages/404.html +1 -1
  82. package/dist/web/standalone/.next/server/pages/500.html +2 -2
  83. package/dist/web/standalone/.next/server/server-reference-manifest.json +1 -1
  84. package/package.json +1 -1
  85. package/packages/pi-ai/dist/providers/anthropic-shared.d.ts.map +1 -1
  86. package/packages/pi-ai/dist/providers/anthropic-shared.js +4 -3
  87. package/packages/pi-ai/dist/providers/anthropic-shared.js.map +1 -1
  88. package/packages/pi-ai/dist/utils/json-parse.d.ts.map +1 -1
  89. package/packages/pi-ai/dist/utils/json-parse.js +11 -1
  90. package/packages/pi-ai/dist/utils/json-parse.js.map +1 -1
  91. package/packages/pi-ai/dist/utils/repair-tool-json.d.ts.map +1 -1
  92. package/packages/pi-ai/dist/utils/repair-tool-json.js +60 -1
  93. package/packages/pi-ai/dist/utils/repair-tool-json.js.map +1 -1
  94. package/packages/pi-ai/dist/utils/tests/json-parse.test.d.ts +2 -0
  95. package/packages/pi-ai/dist/utils/tests/json-parse.test.d.ts.map +1 -0
  96. package/packages/pi-ai/dist/utils/tests/json-parse.test.js +14 -0
  97. package/packages/pi-ai/dist/utils/tests/json-parse.test.js.map +1 -0
  98. package/packages/pi-ai/dist/utils/tests/repair-tool-json.test.js +10 -0
  99. package/packages/pi-ai/dist/utils/tests/repair-tool-json.test.js.map +1 -1
  100. package/packages/pi-ai/src/providers/anthropic-shared.ts +4 -3
  101. package/packages/pi-ai/src/utils/json-parse.ts +11 -1
  102. package/packages/pi-ai/src/utils/repair-tool-json.ts +69 -1
  103. package/packages/pi-ai/src/utils/tests/json-parse.test.ts +17 -0
  104. package/packages/pi-ai/src/utils/tests/repair-tool-json.test.ts +13 -0
  105. package/packages/pi-coding-agent/dist/core/agent-session.d.ts +3 -0
  106. package/packages/pi-coding-agent/dist/core/agent-session.d.ts.map +1 -1
  107. package/packages/pi-coding-agent/dist/core/agent-session.js +1 -0
  108. package/packages/pi-coding-agent/dist/core/agent-session.js.map +1 -1
  109. package/packages/pi-coding-agent/dist/core/retry-handler.d.ts +16 -0
  110. package/packages/pi-coding-agent/dist/core/retry-handler.d.ts.map +1 -1
  111. package/packages/pi-coding-agent/dist/core/retry-handler.js +58 -1
  112. package/packages/pi-coding-agent/dist/core/retry-handler.js.map +1 -1
  113. package/packages/pi-coding-agent/dist/core/retry-handler.test.js +58 -0
  114. package/packages/pi-coding-agent/dist/core/retry-handler.test.js.map +1 -1
  115. package/packages/pi-coding-agent/dist/core/sdk.d.ts +3 -0
  116. package/packages/pi-coding-agent/dist/core/sdk.d.ts.map +1 -1
  117. package/packages/pi-coding-agent/dist/core/sdk.js +1 -0
  118. package/packages/pi-coding-agent/dist/core/sdk.js.map +1 -1
  119. package/packages/pi-coding-agent/dist/modes/interactive/components/__tests__/provider-display-name.test.d.ts +2 -0
  120. package/packages/pi-coding-agent/dist/modes/interactive/components/__tests__/provider-display-name.test.d.ts.map +1 -0
  121. package/packages/pi-coding-agent/dist/modes/interactive/components/__tests__/provider-display-name.test.js +17 -0
  122. package/packages/pi-coding-agent/dist/modes/interactive/components/__tests__/provider-display-name.test.js.map +1 -0
  123. package/packages/pi-coding-agent/dist/modes/interactive/components/footer.d.ts.map +1 -1
  124. package/packages/pi-coding-agent/dist/modes/interactive/components/footer.js +2 -1
  125. package/packages/pi-coding-agent/dist/modes/interactive/components/footer.js.map +1 -1
  126. package/packages/pi-coding-agent/dist/modes/interactive/components/model-selector.d.ts +1 -0
  127. package/packages/pi-coding-agent/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
  128. package/packages/pi-coding-agent/dist/modes/interactive/components/model-selector.js +9 -2
  129. package/packages/pi-coding-agent/dist/modes/interactive/components/model-selector.js.map +1 -1
  130. package/packages/pi-coding-agent/dist/modes/interactive/components/provider-manager.d.ts.map +1 -1
  131. package/packages/pi-coding-agent/dist/modes/interactive/components/provider-manager.js +2 -1
  132. package/packages/pi-coding-agent/dist/modes/interactive/components/provider-manager.js.map +1 -1
  133. package/packages/pi-coding-agent/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -1
  134. package/packages/pi-coding-agent/dist/modes/interactive/components/scoped-models-selector.js +2 -1
  135. package/packages/pi-coding-agent/dist/modes/interactive/components/scoped-models-selector.js.map +1 -1
  136. package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js +2 -2
  137. package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js.map +1 -1
  138. package/packages/pi-coding-agent/package.json +1 -1
  139. package/packages/pi-coding-agent/src/core/agent-session.ts +4 -0
  140. package/packages/pi-coding-agent/src/core/retry-handler.test.ts +69 -0
  141. package/packages/pi-coding-agent/src/core/retry-handler.ts +66 -1
  142. package/packages/pi-coding-agent/src/core/sdk.ts +5 -0
  143. package/packages/pi-coding-agent/src/modes/interactive/components/__tests__/provider-display-name.test.ts +18 -0
  144. package/packages/pi-coding-agent/src/modes/interactive/components/footer.ts +2 -1
  145. package/packages/pi-coding-agent/src/modes/interactive/components/model-selector.ts +11 -2
  146. package/packages/pi-coding-agent/src/modes/interactive/components/provider-manager.ts +2 -1
  147. package/packages/pi-coding-agent/src/modes/interactive/components/scoped-models-selector.ts +2 -1
  148. package/packages/pi-coding-agent/src/modes/interactive/interactive-mode.ts +2 -2
  149. package/packages/pi-tui/dist/__tests__/autocomplete.test.js +13 -0
  150. package/packages/pi-tui/dist/__tests__/autocomplete.test.js.map +1 -1
  151. package/packages/pi-tui/dist/__tests__/stdin-buffer.test.d.ts +2 -0
  152. package/packages/pi-tui/dist/__tests__/stdin-buffer.test.d.ts.map +1 -0
  153. package/packages/pi-tui/dist/__tests__/stdin-buffer.test.js +35 -0
  154. package/packages/pi-tui/dist/__tests__/stdin-buffer.test.js.map +1 -0
  155. package/packages/pi-tui/dist/__tests__/tui.test.d.ts +2 -0
  156. package/packages/pi-tui/dist/__tests__/tui.test.d.ts.map +1 -0
  157. package/packages/pi-tui/dist/__tests__/tui.test.js +43 -0
  158. package/packages/pi-tui/dist/__tests__/tui.test.js.map +1 -0
  159. package/packages/pi-tui/dist/autocomplete.d.ts.map +1 -1
  160. package/packages/pi-tui/dist/autocomplete.js +9 -7
  161. package/packages/pi-tui/dist/autocomplete.js.map +1 -1
  162. package/packages/pi-tui/dist/components/__tests__/editor.test.d.ts +2 -0
  163. package/packages/pi-tui/dist/components/__tests__/editor.test.d.ts.map +1 -0
  164. package/packages/pi-tui/dist/components/__tests__/editor.test.js +54 -0
  165. package/packages/pi-tui/dist/components/__tests__/editor.test.js.map +1 -0
  166. package/packages/pi-tui/dist/components/editor.d.ts +3 -1
  167. package/packages/pi-tui/dist/components/editor.d.ts.map +1 -1
  168. package/packages/pi-tui/dist/components/editor.js +14 -3
  169. package/packages/pi-tui/dist/components/editor.js.map +1 -1
  170. package/packages/pi-tui/dist/stdin-buffer.d.ts.map +1 -1
  171. package/packages/pi-tui/dist/stdin-buffer.js +6 -0
  172. package/packages/pi-tui/dist/stdin-buffer.js.map +1 -1
  173. package/packages/pi-tui/dist/tui.d.ts.map +1 -1
  174. package/packages/pi-tui/dist/tui.js +8 -0
  175. package/packages/pi-tui/dist/tui.js.map +1 -1
  176. package/packages/pi-tui/src/__tests__/autocomplete.test.ts +15 -0
  177. package/packages/pi-tui/src/__tests__/stdin-buffer.test.ts +43 -0
  178. package/packages/pi-tui/src/__tests__/tui.test.ts +50 -0
  179. package/packages/pi-tui/src/autocomplete.ts +9 -7
  180. package/packages/pi-tui/src/components/__tests__/editor.test.ts +64 -0
  181. package/packages/pi-tui/src/components/editor.ts +14 -3
  182. package/packages/pi-tui/src/stdin-buffer.ts +7 -0
  183. package/packages/pi-tui/src/tui.ts +9 -0
  184. package/pkg/package.json +1 -1
  185. package/src/resources/extensions/ask-user-questions.ts +103 -11
  186. package/src/resources/extensions/claude-code-cli/partial-builder.ts +4 -3
  187. package/src/resources/extensions/claude-code-cli/readiness.ts +67 -12
  188. package/src/resources/extensions/claude-code-cli/stream-adapter.ts +12 -3
  189. package/src/resources/extensions/claude-code-cli/tests/partial-builder.test.ts +17 -0
  190. package/src/resources/extensions/claude-code-cli/tests/stream-adapter.test.ts +18 -0
  191. package/src/resources/extensions/gsd/auto/loop-deps.ts +2 -1
  192. package/src/resources/extensions/gsd/auto/loop.ts +14 -1
  193. package/src/resources/extensions/gsd/auto/phases.ts +27 -4
  194. package/src/resources/extensions/gsd/auto/run-unit.ts +14 -2
  195. package/src/resources/extensions/gsd/auto/session.ts +1 -1
  196. package/src/resources/extensions/gsd/auto-dashboard.ts +76 -16
  197. package/src/resources/extensions/gsd/auto-dispatch.ts +36 -35
  198. package/src/resources/extensions/gsd/auto-model-selection.ts +12 -3
  199. package/src/resources/extensions/gsd/auto-prompts.ts +195 -25
  200. package/src/resources/extensions/gsd/auto-recovery.ts +15 -15
  201. package/src/resources/extensions/gsd/auto.ts +12 -1
  202. package/src/resources/extensions/gsd/bootstrap/agent-end-recovery.ts +34 -1
  203. package/src/resources/extensions/gsd/bootstrap/db-tools.ts +27 -6
  204. package/src/resources/extensions/gsd/bootstrap/provider-error-resume.ts +6 -0
  205. package/src/resources/extensions/gsd/bootstrap/register-hooks.ts +67 -6
  206. package/src/resources/extensions/gsd/bootstrap/register-shortcuts.ts +11 -8
  207. package/src/resources/extensions/gsd/bootstrap/write-gate.ts +209 -16
  208. package/src/resources/extensions/gsd/codebase-generator.ts +4 -0
  209. package/src/resources/extensions/gsd/commands/handlers/core.ts +6 -6
  210. package/src/resources/extensions/gsd/commands-prefs-wizard.ts +11 -4
  211. package/src/resources/extensions/gsd/context-store.ts +167 -2
  212. package/src/resources/extensions/gsd/custom-workflow-engine.ts +3 -1
  213. package/src/resources/extensions/gsd/detection.ts +6 -0
  214. package/src/resources/extensions/gsd/files.ts +21 -2
  215. package/src/resources/extensions/gsd/guided-flow.ts +15 -8
  216. package/src/resources/extensions/gsd/index.ts +6 -0
  217. package/src/resources/extensions/gsd/parallel-monitor-overlay.ts +2 -0
  218. package/src/resources/extensions/gsd/parsers-legacy.ts +3 -1
  219. package/src/resources/extensions/gsd/preferences.ts +6 -1
  220. package/src/resources/extensions/gsd/prompts/complete-milestone.md +1 -1
  221. package/src/resources/extensions/gsd/prompts/discuss-prepared.md +7 -7
  222. package/src/resources/extensions/gsd/prompts/discuss.md +3 -3
  223. package/src/resources/extensions/gsd/prompts/guided-discuss-milestone.md +3 -3
  224. package/src/resources/extensions/gsd/prompts/guided-discuss-slice.md +3 -1
  225. package/src/resources/extensions/gsd/prompts/rethink.md +6 -2
  226. package/src/resources/extensions/gsd/prompts/system.md +1 -1
  227. package/src/resources/extensions/gsd/prompts/triage-captures.md +1 -1
  228. package/src/resources/extensions/gsd/prompts/validate-milestone.md +4 -4
  229. package/src/resources/extensions/gsd/prompts/worktree-merge.md +3 -1
  230. package/src/resources/extensions/gsd/safety/file-change-validator.ts +4 -1
  231. package/src/resources/extensions/gsd/state.ts +2 -1
  232. package/src/resources/extensions/gsd/tests/auto-dashboard.test.ts +52 -1
  233. package/src/resources/extensions/gsd/tests/auto-loop.test.ts +50 -2
  234. package/src/resources/extensions/gsd/tests/auto-model-selection.test.ts +21 -7
  235. package/src/resources/extensions/gsd/tests/auto-recovery.test.ts +48 -0
  236. package/src/resources/extensions/gsd/tests/codebase-generator.test.ts +22 -0
  237. package/src/resources/extensions/gsd/tests/context-store.test.ts +176 -0
  238. package/src/resources/extensions/gsd/tests/core-overlay-fallback.test.ts +44 -0
  239. package/src/resources/extensions/gsd/tests/custom-engine-loop-integration.test.ts +7 -1
  240. package/src/resources/extensions/gsd/tests/custom-workflow-engine.test.ts +31 -0
  241. package/src/resources/extensions/gsd/tests/decision-scope-cascade.test.ts +370 -0
  242. package/src/resources/extensions/gsd/tests/detection.test.ts +37 -0
  243. package/src/resources/extensions/gsd/tests/file-change-validator.test.ts +50 -0
  244. package/src/resources/extensions/gsd/tests/gsd-tools.test.ts +35 -0
  245. package/src/resources/extensions/gsd/tests/guided-flow-session-isolation.test.ts +34 -0
  246. package/src/resources/extensions/gsd/tests/health-widget.test.ts +45 -0
  247. package/src/resources/extensions/gsd/tests/integration/auto-recovery.test.ts +53 -13
  248. package/src/resources/extensions/gsd/tests/integration/state-machine-runtime-failures.test.ts +2 -2
  249. package/src/resources/extensions/gsd/tests/journal-integration.test.ts +3 -3
  250. package/src/resources/extensions/gsd/tests/measurement.test.ts +531 -0
  251. package/src/resources/extensions/gsd/tests/migrate-writer-integration.test.ts +3 -4
  252. package/src/resources/extensions/gsd/tests/parallel-monitor-overlay.test.ts +21 -0
  253. package/src/resources/extensions/gsd/tests/parallel-research-dispatch.test.ts +71 -2
  254. package/src/resources/extensions/gsd/tests/parsers.test.ts +25 -0
  255. package/src/resources/extensions/gsd/tests/preferences.test.ts +20 -0
  256. package/src/resources/extensions/gsd/tests/prompt-contracts.test.ts +8 -1
  257. package/src/resources/extensions/gsd/tests/provider-errors.test.ts +60 -0
  258. package/src/resources/extensions/gsd/tests/queue-execution-guard.test.ts +9 -0
  259. package/src/resources/extensions/gsd/tests/reactive-graph.test.ts +19 -0
  260. package/src/resources/extensions/gsd/tests/register-shortcuts.test.ts +73 -0
  261. package/src/resources/extensions/gsd/tests/remote-questions.test.ts +98 -0
  262. package/src/resources/extensions/gsd/tests/smart-entry-complete.test.ts +2 -2
  263. package/src/resources/extensions/gsd/tests/validate-milestone.test.ts +26 -0
  264. package/src/resources/extensions/gsd/tests/visualizer-overlay.test.ts +59 -0
  265. package/src/resources/extensions/gsd/tests/workflow-reconcile.test.ts +91 -0
  266. package/src/resources/extensions/gsd/tests/write-gate.test.ts +210 -35
  267. package/src/resources/extensions/gsd/visualizer-overlay.ts +31 -27
  268. package/src/resources/extensions/gsd/workflow-reconcile.ts +59 -8
  269. package/src/resources/extensions/remote-questions/manager.ts +9 -0
  270. package/src/resources/extensions/shared/interview-ui.ts +13 -0
  271. /package/dist/web/standalone/.next/static/{y5P0reMrCMs-4-gswdawm → DFZllMYDbO0OwyS6FSvm5}/_buildManifest.js +0 -0
  272. /package/dist/web/standalone/.next/static/{y5P0reMrCMs-4-gswdawm → DFZllMYDbO0OwyS6FSvm5}/_ssgManifest.js +0 -0
@@ -49,7 +49,8 @@ export function queryDecisions(opts) {
49
49
  }
50
50
  /**
51
51
  * Query active (non-superseded) requirements with optional filters.
52
- * - sliceId: filters where primary_owner LIKE '%sliceId%' OR supporting_slices LIKE '%sliceId%'
52
+ * - milestoneId: combined with sliceId for precise filtering (e.g. %M005/S01%)
53
+ * - sliceId: filters where primary_owner LIKE '%pattern%' OR supporting_slices LIKE '%pattern%'
53
54
  * - status: filters where status = :status (exact match)
54
55
  *
55
56
  * Returns [] if DB is not available. Never throws.
@@ -63,10 +64,22 @@ export function queryRequirements(opts) {
63
64
  try {
64
65
  const clauses = ['superseded_by IS NULL'];
65
66
  const params = {};
66
- if (opts?.sliceId) {
67
+ // Combined milestone+slice filtering for precise scoping
68
+ if (opts?.milestoneId && opts?.sliceId) {
69
+ // Use combined pattern like %M005/S01% to avoid cross-milestone contamination
70
+ clauses.push('(primary_owner LIKE :combined_pattern OR supporting_slices LIKE :combined_pattern)');
71
+ params[':combined_pattern'] = `%${opts.milestoneId}/${opts.sliceId}%`;
72
+ }
73
+ else if (opts?.sliceId) {
74
+ // Slice-only filtering (legacy behavior)
67
75
  clauses.push('(primary_owner LIKE :slice_pattern OR supporting_slices LIKE :slice_pattern)');
68
76
  params[':slice_pattern'] = `%${opts.sliceId}%`;
69
77
  }
78
+ else if (opts?.milestoneId) {
79
+ // Milestone-only filtering
80
+ clauses.push('(primary_owner LIKE :milestone_pattern OR supporting_slices LIKE :milestone_pattern)');
81
+ params[':milestone_pattern'] = `%${opts.milestoneId}%`;
82
+ }
70
83
  if (opts?.status) {
71
84
  clauses.push('status = :status');
72
85
  params[':status'] = opts.status;
@@ -164,3 +177,122 @@ export function queryArtifact(path) {
164
177
  export function queryProject() {
165
178
  return queryArtifact('PROJECT.md');
166
179
  }
180
+ // ─── Knowledge Query ───────────────────────────────────────────────────────
181
+ /**
182
+ * Filter KNOWLEDGE.md sections by keyword matching.
183
+ * Uses H2 sections, matches keywords case-insensitively against:
184
+ * 1. Section header text
185
+ * 2. First paragraph of section content (up to first blank line or next heading)
186
+ *
187
+ * Per D020, returns empty string (not null) when no matches found.
188
+ * This signals "no relevant knowledge" vs "file not found".
189
+ *
190
+ * @param content - Full KNOWLEDGE.md content
191
+ * @param keywords - Keywords to match (case-insensitive)
192
+ * @returns Concatenated matching sections with H2 headers, or empty string
193
+ */
194
+ export async function queryKnowledge(content, keywords) {
195
+ if (!content || keywords.length === 0)
196
+ return '';
197
+ // Lazy import to avoid circular dependency
198
+ const { extractAllSections } = await import('./files.js');
199
+ const sections = extractAllSections(content, 2);
200
+ if (sections.size === 0)
201
+ return '';
202
+ // Normalize keywords for case-insensitive matching
203
+ const normalizedKeywords = keywords.map(k => k.toLowerCase());
204
+ const matchingSections = [];
205
+ for (const [header, body] of sections) {
206
+ // Extract first paragraph: everything up to first blank line or next heading
207
+ const firstParagraph = body.split(/\n\s*\n|\n#/)[0] || '';
208
+ // Check if any keyword matches header or first paragraph
209
+ const headerLower = header.toLowerCase();
210
+ const paragraphLower = firstParagraph.toLowerCase();
211
+ const matches = normalizedKeywords.some(kw => headerLower.includes(kw) || paragraphLower.includes(kw));
212
+ if (matches) {
213
+ matchingSections.push(`## ${header}\n\n${body}`);
214
+ }
215
+ }
216
+ return matchingSections.join('\n\n');
217
+ }
218
+ // ─── Roadmap Excerpt Formatter ─────────────────────────────────────────────
219
+ /**
220
+ * Format a minimal roadmap excerpt for prompt injection.
221
+ * Parses the slice table from roadmap content, extracts:
222
+ * 1. Header row + separator
223
+ * 2. Predecessor row (if sliceId depends on one via the Depends column)
224
+ * 3. Target slice row
225
+ * 4. Reference directive pointing to full roadmap path
226
+ *
227
+ * Per D021, this minimizes injected content while preserving dependency awareness.
228
+ * Returns empty string if sliceId is not found in the table.
229
+ * Never throws.
230
+ *
231
+ * @param roadmapContent - Full content of the M###-ROADMAP.md file
232
+ * @param sliceId - Target slice ID (e.g. 'S02')
233
+ * @param roadmapPath - Optional path for reference directive (defaults to generic)
234
+ */
235
+ export function formatRoadmapExcerpt(roadmapContent, sliceId, roadmapPath = 'ROADMAP.md') {
236
+ if (!roadmapContent || !sliceId)
237
+ return '';
238
+ const lines = roadmapContent.split('\n');
239
+ // Find the slice table header: | ID | Slice | ... (case insensitive)
240
+ let headerIndex = -1;
241
+ for (let i = 0; i < lines.length; i++) {
242
+ const line = lines[i];
243
+ if (line && /^\s*\|\s*ID\s*\|\s*Slice\s*\|/i.test(line)) {
244
+ headerIndex = i;
245
+ break;
246
+ }
247
+ }
248
+ if (headerIndex === -1)
249
+ return '';
250
+ // The separator should be the next line (|---|---|...)
251
+ const separatorIndex = headerIndex + 1;
252
+ if (separatorIndex >= lines.length)
253
+ return '';
254
+ const headerLine = lines[headerIndex];
255
+ const separatorLine = lines[separatorIndex];
256
+ // Validate separator line looks like |---|---|... (may include : for alignment)
257
+ if (!separatorLine || !/^\s*\|[\s:\-|]+\|/.test(separatorLine))
258
+ return '';
259
+ const sliceRows = [];
260
+ for (let i = separatorIndex + 1; i < lines.length; i++) {
261
+ const line = lines[i];
262
+ if (!line || !line.trim().startsWith('|'))
263
+ break; // End of table
264
+ // Parse row: | ID | Slice | Risk | Depends | Done | After this |
265
+ const cells = line.split('|').map(c => c.trim());
266
+ // cells[0] is empty (before first |), cells[1] is ID, etc.
267
+ if (cells.length < 5)
268
+ continue;
269
+ const id = cells[1] || '';
270
+ const depends = cells[4] || ''; // Depends column (0-indexed: empty, ID, Slice, Risk, Depends, ...)
271
+ sliceRows.push({ line, id, depends });
272
+ }
273
+ // Find target slice row
274
+ const targetRow = sliceRows.find(r => r.id === sliceId);
275
+ if (!targetRow)
276
+ return '';
277
+ // Find predecessor if target depends on one
278
+ // Depends column may contain: '—', 'S01', 'S01, S02', etc.
279
+ let predecessorRow;
280
+ const dependsRaw = targetRow.depends;
281
+ if (dependsRaw && dependsRaw !== '—' && dependsRaw !== '-') {
282
+ // Extract first dependency (e.g. 'S01' from 'S01, S02')
283
+ const depMatch = dependsRaw.match(/S\d+/);
284
+ if (depMatch) {
285
+ predecessorRow = sliceRows.find(r => r.id === depMatch[0]);
286
+ }
287
+ }
288
+ // Build excerpt
289
+ const excerptLines = [headerLine, separatorLine];
290
+ if (predecessorRow) {
291
+ excerptLines.push(predecessorRow.line);
292
+ }
293
+ excerptLines.push(targetRow.line);
294
+ // Add reference directive
295
+ excerptLines.push('');
296
+ excerptLines.push(`> See full roadmap: ${roadmapPath}`);
297
+ return excerptLines.join('\n');
298
+ }
@@ -135,7 +135,9 @@ export class CustomWorkflowEngine {
135
135
  * Returns "milestone-complete" when all steps are now done, "continue" otherwise.
136
136
  */
137
137
  async reconcile(state, completedStep) {
138
- const graph = state.raw;
138
+ // Re-read the graph from disk so we do not overwrite concurrent
139
+ // workflow edits with a stale in-memory snapshot from deriveState().
140
+ const graph = readGraph(this.runDir);
139
141
  // Extract stepId from "<workflowName>/<stepId>"
140
142
  const { milestone, slice, task } = parseUnitId(completedStep.unitId);
141
143
  const stepId = task ?? slice ?? milestone;
@@ -170,6 +170,12 @@ const TEST_MARKERS = [
170
170
  /** Directories skipped during bounded recursive project scans. */
171
171
  const RECURSIVE_SCAN_IGNORED_DIRS = new Set([
172
172
  ".git",
173
+ ".gsd",
174
+ ".planning",
175
+ ".plans",
176
+ ".claude",
177
+ ".cursor",
178
+ ".vscode",
173
179
  "node_modules",
174
180
  ".venv",
175
181
  "venv",
@@ -104,6 +104,23 @@ export function extractAllSections(body, level = 2) {
104
104
  function escapeRegex(s) {
105
105
  return s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
106
106
  }
107
+ /**
108
+ * Normalize a task-plan file reference that may include inline description text
109
+ * after the path, for example:
110
+ * "docs/file.md — explanation"
111
+ * "docs/file.md - explanation"
112
+ */
113
+ export function normalizePlannedFileReference(value) {
114
+ const trimmed = value.trim().replace(/`/g, "");
115
+ const match = /^(.*?)(?:\s+(?:—|-)\s+)(.+)$/.exec(trimmed);
116
+ if (!match)
117
+ return trimmed;
118
+ const pathCandidate = match[1].trim();
119
+ if (pathCandidate.includes("/") || pathCandidate.includes("\\") || pathCandidate.includes(".")) {
120
+ return pathCandidate;
121
+ }
122
+ return trimmed;
123
+ }
107
124
  /** Parse bullet list items from a text block. */
108
125
  export function parseBullets(text) {
109
126
  return text.split('\n')
@@ -540,11 +557,11 @@ export function parseTaskPlanIO(content) {
540
557
  let match;
541
558
  backtickPathRegex.lastIndex = 0;
542
559
  while ((match = backtickPathRegex.exec(trimmed)) !== null) {
543
- const candidate = match[1];
560
+ const candidate = normalizePlannedFileReference(match[1]);
544
561
  // Filter out things that look like code tokens rather than file paths
545
562
  // (e.g. `true`, `false`, `npm run test`). A file path has at least one
546
563
  // dot or slash.
547
- if (candidate.includes("/") || candidate.includes(".")) {
564
+ if (candidate.includes("/") || candidate.includes("\\") || candidate.includes(".")) {
548
565
  paths.push(candidate);
549
566
  }
550
567
  }
@@ -142,12 +142,13 @@ export function checkAutoStartAfterDiscuss() {
142
142
  // Parse PROJECT.md for milestone sequence, warn if any are missing context.
143
143
  // Don't block — milestones can be intentionally queued without context.
144
144
  const projectFile = resolveGsdRootFile(basePath, "PROJECT");
145
+ let projectIds = [];
145
146
  if (projectFile) {
146
147
  try {
147
148
  const projectContent = readFileSync(projectFile, "utf-8");
148
- const milestoneIds = parseMilestoneSequenceFromProject(projectContent);
149
- if (milestoneIds.length > 1) {
150
- const missing = milestoneIds.filter(id => {
149
+ projectIds = parseMilestoneSequenceFromProject(projectContent);
150
+ if (projectIds.length > 1) {
151
+ const missing = projectIds.filter(id => {
151
152
  const hasContext = !!resolveMilestoneFile(basePath, id, "CONTEXT");
152
153
  const hasDraft = !!resolveMilestoneFile(basePath, id, "CONTEXT-DRAFT");
153
154
  const hasDir = existsSync(join(gsdRoot(basePath), "milestones", id));
@@ -165,9 +166,14 @@ export function checkAutoStartAfterDiscuss() {
165
166
  }
166
167
  // Gate 4: Discussion manifest process verification (multi-milestone only)
167
168
  // The LLM writes DISCUSSION-MANIFEST.json after each Phase 3 gate decision.
168
- // If the manifest exists but gates_completed < total, the LLM hasn't finished
169
- // presenting all readiness gates to the user — block auto-start.
169
+ // If the project is multi-milestone, the manifest is required. When it is
170
+ // missing, fail closed instead of assuming the discussion finished.
170
171
  const manifestPath = join(gsdRoot(basePath), "DISCUSSION-MANIFEST.json");
172
+ const requiresManifest = projectIds.length > 1 || findMilestoneIds(basePath).length > 1;
173
+ if (requiresManifest && !existsSync(manifestPath)) {
174
+ ctx.ui.notify("Multi-milestone discussion manifest is missing. Auto-start will remain paused until the manifest is written.", "warning");
175
+ return false;
176
+ }
171
177
  if (existsSync(manifestPath)) {
172
178
  try {
173
179
  const manifest = JSON.parse(readFileSync(manifestPath, "utf-8"));
@@ -178,9 +184,7 @@ export function checkAutoStartAfterDiscuss() {
178
184
  return false;
179
185
  }
180
186
  // Cross-check manifest milestones against PROJECT.md if available
181
- if (projectFile) {
182
- const projectContent = readFileSync(projectFile, "utf-8");
183
- const projectIds = parseMilestoneSequenceFromProject(projectContent);
187
+ if (projectIds.length > 0) {
184
188
  const manifestIds = Object.keys(manifest.milestones ?? {});
185
189
  const untracked = projectIds.filter(id => !manifestIds.includes(id));
186
190
  if (untracked.length > 0) {
@@ -1,4 +1,4 @@
1
- export { isDepthConfirmationAnswer, isDepthVerified, isQueuePhaseActive, setQueuePhaseActive, shouldBlockContextWrite, shouldBlockQueueExecution, } from "./bootstrap/write-gate.js";
1
+ export { isDepthConfirmationAnswer, isDepthVerified, isGateQuestionId, isQueuePhaseActive, setQueuePhaseActive, shouldBlockContextWrite, shouldBlockPendingGate, shouldBlockPendingGateBash, shouldBlockQueueExecution, setPendingGate, clearPendingGate, getPendingGate, } from "./bootstrap/write-gate.js";
2
2
  export default async function registerExtension(pi) {
3
3
  const { registerGsdExtension } = await import("./bootstrap/register-extension.js");
4
4
  registerGsdExtension(pi);
@@ -406,6 +406,8 @@ export class ParallelMonitorOverlay {
406
406
  lines.push(t.fg("muted", " ESC/q to close │ ↑↓ scroll"));
407
407
  // Apply scroll — use terminal rows as height estimate
408
408
  const termHeight = process.stdout.rows || 40;
409
+ const maxScroll = Math.max(0, lines.length - termHeight);
410
+ this.scrollOffset = Math.min(Math.max(this.scrollOffset, 0), maxScroll);
409
411
  const visible = lines.slice(this.scrollOffset, this.scrollOffset + termHeight);
410
412
  this.cachedLines = visible;
411
413
  return visible;
@@ -177,7 +177,9 @@ function _parsePlanImpl(content) {
177
177
  for (const line of lines) {
178
178
  const cbMatch = line.match(/^-\s+\[([ xX])\]\s+\*\*([\w.]+):\s+(.+?)\*\*\s*(.*)/);
179
179
  // Heading-style: ### T01 -- Title, ### T01: Title, ### T01 — Title
180
- const hdMatch = !cbMatch ? line.match(/^#{2,4}\s+([\w.]+)\s*(?:--|—|:)\s*(.+)/) : null;
180
+ const hdMatch = !cbMatch
181
+ ? line.match(/^#{2,4}\s+([A-Z]+\d+(?:\.[A-Z]+\d+)*)\s*(?:--|—|:)\s*(.+)/)
182
+ : null;
181
183
  if (cbMatch || hdMatch) {
182
184
  const taskId = cbMatch ? cbMatch[2] : hdMatch[1];
183
185
  // Skip tasks already found in the Tasks section
@@ -127,10 +127,12 @@ function loadPreferencesFile(path, scope) {
127
127
  };
128
128
  }
129
129
  let _warnedUnrecognizedFormat = false;
130
+ let _warnedSectionParse = false;
130
131
  /** @internal Reset the warn-once flags — exported for testing only. */
131
132
  export function _resetParseWarningFlag() {
132
133
  _warnedUnrecognizedFormat = false;
133
134
  _warnedFrontmatterParse = false;
135
+ _warnedSectionParse = false;
134
136
  }
135
137
  /** @internal Exported for testing only */
136
138
  export function parsePreferencesMarkdown(content) {
@@ -227,7 +229,10 @@ function parseHeadingListFormat(content) {
227
229
  typed[targetSection] = value;
228
230
  }
229
231
  catch (e) {
230
- logWarning("guided", `preferences section parse failed: ${e.message}`);
232
+ if (!_warnedSectionParse) {
233
+ _warnedSectionParse = true;
234
+ logWarning("guided", `preferences section parse failed: ${e.message}`);
235
+ }
231
236
  }
232
237
  }
233
238
  return typed;
@@ -63,6 +63,6 @@ Then:
63
63
  13. Do not commit manually — the system auto-commits your changes after this unit completes.
64
64
  - Say: "Milestone {{milestoneId}} complete."
65
65
 
66
- **Important:** Do NOT skip the code change verification, success criteria, or definition of done verification (steps 3-5). The milestone summary must reflect actual verified outcomes, not assumed success. Verification failures BLOCK completion — there is no override. The milestone stays in its current state until issues are resolved and verification is re-run.
66
+ **Important:** Do NOT skip the code change verification, success criteria, or definition of done verification (steps 3-5). The milestone summary must reflect actual verified outcomes, not assumed success. Verification failures BLOCK completion — there is no override. The milestone stays in its current state until issues are resolved and verification is re-run. **If a verification tool itself fails, errors, or returns unexpected output, treat it as a verification failure** — never rationalize past a tool error ("tool didn't respond, assuming success" is forbidden). A tool that cannot verify is a tool that did not verify.
67
67
 
68
68
  **File system safety:** When scanning milestone directories for evidence, use `ls` or `find` to list directory contents first — never pass a directory path (e.g. `tasks/`, `slices/`) directly to the `read` tool. The `read` tool only accepts file paths, not directories.
@@ -109,7 +109,7 @@ Options:
109
109
  - "Needs adjustment" — user will clarify, then re-present scope
110
110
  ```
111
111
 
112
- **Do NOT proceed to Layer 2 until the user explicitly approves the scope.**
112
+ **CRITICAL — Non-bypassable gate:** Do NOT proceed to Layer 2 until the user explicitly approves the scope. If `ask_user_questions` fails, errors, returns no response, or the user's response does not match a provided option, you MUST re-ask — never rationalize past the block. "Tool not responding, I'll proceed," "auth issues," or "I'll use my recommended scope" are all **forbidden**. The gate exists to protect the user's work; treat a block as an instruction to wait, not an obstacle to work around.
113
113
 
114
114
  ---
115
115
 
@@ -120,7 +120,7 @@ Before presenting Layer 2 findings, use your available web search tools to resea
120
120
  1. Search for "[technology] [version] best practices [current year]"
121
121
  2. Search for "[technology] [version] known issues"
122
122
 
123
- Summarize findings concisely. If no search tools are available, note this and proceed using your training knowledge — don't block the discussion on missing search results.
123
+ Summarize findings concisely. If search tools fail or are unavailable, note this and proceed using your training knowledge — but do NOT use a search failure as justification to skip any gate.
124
124
 
125
125
  Present ecosystem findings at the start of Layer 2 alongside your architecture recommendation.
126
126
 
@@ -180,7 +180,7 @@ Options:
180
180
  - "Want to adjust" — user will clarify, then re-present architecture
181
181
  ```
182
182
 
183
- **Do NOT proceed to Layer 3 until the user explicitly approves the architecture.**
183
+ **CRITICAL — Non-bypassable gate:** Do NOT proceed to Layer 3 until the user explicitly approves the architecture. If `ask_user_questions` fails, errors, returns no response, or the user's response does not match a provided option, you MUST re-ask — never rationalize past the block. The gate exists to protect the user's work; treat a block as an instruction to wait, not an obstacle to work around.
184
184
 
185
185
  ---
186
186
 
@@ -243,7 +243,7 @@ Options:
243
243
  - "Want to adjust error handling" — user will clarify, then re-present errors
244
244
  ```
245
245
 
246
- **Do NOT proceed to Layer 4 until the user explicitly approves error handling.**
246
+ **CRITICAL — Non-bypassable gate:** Do NOT proceed to Layer 4 until the user explicitly approves error handling. If `ask_user_questions` fails, errors, returns no response, or the user's response does not match a provided option, you MUST re-ask — never rationalize past the block. The gate exists to protect the user's work; treat a block as an instruction to wait, not an obstacle to work around.
247
247
 
248
248
  ---
249
249
 
@@ -297,7 +297,7 @@ Options:
297
297
  - "Want to adjust the quality bar" — user will clarify, then re-present quality
298
298
  ```
299
299
 
300
- **Do NOT proceed to Output Phase until the user explicitly approves the quality bar.**
300
+ **CRITICAL — Non-bypassable gate:** Do NOT proceed to Output Phase until the user explicitly approves the quality bar. If `ask_user_questions` fails, errors, returns no response, or the user's response does not match a provided option, you MUST re-ask — never rationalize past the block. The gate exists to protect the user's work; treat a block as an instruction to wait, not an obstacle to work around.
301
301
 
302
302
  ---
303
303
 
@@ -315,13 +315,13 @@ Before writing a roadmap, produce or update `.gsd/REQUIREMENTS.md`.
315
315
 
316
316
  Use it as the project's explicit capability contract. Requirements discovered during the 4-layer discussion should be captured here with source `user` or `inferred` as appropriate.
317
317
 
318
- **Print the requirements in chat before writing the roadmap.** Print a markdown table with columns: ID, Title, Status, Owner, Source. Group by status (Active, Deferred, Out of Scope). After the table, ask: "Confirm, adjust, or add?"
318
+ **Print the requirements in chat before writing the roadmap.** Print a markdown table with columns: ID, Title, Status, Owner, Source. Group by status (Active, Deferred, Out of Scope). After the table, ask: "Confirm, adjust, or add?" **Non-bypassable:** If the user does not respond or gives an ambiguous answer, you MUST re-ask — never proceed to roadmap creation without explicit requirement confirmation.
319
319
 
320
320
  ### Roadmap Preview
321
321
 
322
322
  Before writing any files, **print the planned roadmap in chat** so the user can see and approve it. Print a markdown table with columns: Slice, Title, Risk, Depends, Demo. One row per slice. Below the table, print the milestone definition of done as a bullet list.
323
323
 
324
- If the user raises a substantive objection, adjust the roadmap. Otherwise, present the roadmap and ask: "Ready to write, or want to adjust?" — one gate, not two.
324
+ If the user raises a substantive objection, adjust the roadmap. Otherwise, present the roadmap and ask: "Ready to write, or want to adjust?" — one gate, not two. **Non-bypassable:** If the user does not respond or gives an ambiguous answer, you MUST re-ask — never write files without explicit approval. A missing response is not a "yes."
325
325
 
326
326
  ### Naming Convention
327
327
 
@@ -173,7 +173,7 @@ For multi-milestone projects, requirements should span the full vision. Requirem
173
173
 
174
174
  If the project is new or has no `REQUIREMENTS.md`, surface candidate requirements in chat before writing the roadmap. Ask for correction only on material omissions, wrong ownership, or wrong scope. If the user has already been specific and raises no substantive objection, treat the requirement set as confirmed and continue.
175
175
 
176
- **Print the requirements in chat before writing the roadmap.** Do not say "here are the requirements" and then only write them to a file. The user must see them in the terminal. Print a markdown table with columns: ID, Title, Status, Owner, Source. Group by status (Active, Deferred, Out of Scope). After the table, ask: "Confirm, adjust, or add?"
176
+ **Print the requirements in chat before writing the roadmap.** Do not say "here are the requirements" and then only write them to a file. The user must see them in the terminal. Print a markdown table with columns: ID, Title, Status, Owner, Source. Group by status (Active, Deferred, Out of Scope). After the table, ask: "Confirm, adjust, or add?" **Non-bypassable:** If the user does not respond or gives an ambiguous answer, you MUST re-ask — never proceed to roadmap creation without explicit requirement confirmation.
177
177
 
178
178
  ## Scope Assessment
179
179
 
@@ -185,7 +185,7 @@ Before moving to output, confirm the size estimate from your reflection still ho
185
185
 
186
186
  Before writing any files, **print the planned roadmap in chat** so the user can see and approve it. Print a markdown table with columns: Slice, Title, Risk, Depends, Demo. One row per slice. Below the table, print the milestone definition of done as a bullet list.
187
187
 
188
- If the user raises a substantive objection, adjust the roadmap. Otherwise, present the roadmap and ask: "Ready to write, or want to adjust?" — one gate, not two.
188
+ If the user raises a substantive objection, adjust the roadmap. Otherwise, present the roadmap and ask: "Ready to write, or want to adjust?" — one gate, not two. **Non-bypassable:** If the user does not respond or gives an ambiguous answer, you MUST re-ask — never write files without explicit approval. A missing response is not a "yes."
189
189
 
190
190
  ### Naming Convention
191
191
 
@@ -242,7 +242,7 @@ If a milestone has no dependencies, omit the frontmatter. The dependency chain f
242
242
 
243
243
  #### Phase 3: Sequential readiness gate for remaining milestones
244
244
 
245
- For each remaining milestone **one at a time, in sequence**, decide the most likely readiness mode from the evidence you already have, then use `ask_user_questions` to let the user correct that recommendation. Present three options:
245
+ For each remaining milestone **one at a time, in sequence**, decide the most likely readiness mode from the evidence you already have, then use `ask_user_questions` to let the user correct that recommendation. **Non-bypassable:** If `ask_user_questions` fails, errors, returns no response, or the user's response does not match a provided option, you MUST re-ask — never rationalize past the block or auto-select a readiness mode. Present three options:
246
246
 
247
247
  - **"Discuss now"** — The user wants to conduct a focused discussion for this milestone in the current session, while the context from the broader discussion is still fresh. Proceed with a focused discussion for this milestone (reflection → investigation → questioning → depth verification). When the discussion concludes, write a full `CONTEXT.md`. Then move to the gate for the next milestone.
248
248
  - **"Write draft for later"** — This milestone has seed material from the current conversation but needs its own dedicated discussion in a future session. Write a `CONTEXT-DRAFT.md` capturing the seed material (what was discussed, key ideas, provisional scope, open questions). Mark it clearly as a draft, not a finalized context. **What happens downstream:** When auto-mode reaches this milestone, it pauses and notifies the user: "M00x has draft context — needs discussion. Run /gsd." The `/gsd` wizard shows a "Discuss from draft" option that seeds the new discussion with this draft, so nothing from the current conversation is lost. After the dedicated discussion produces a full CONTEXT.md, the draft file is automatically deleted.
@@ -92,15 +92,15 @@ Before moving to the wrap-up gate, verify you have covered:
92
92
  - header: "Depth Check"
93
93
  - question: "Did I capture the depth right?"
94
94
  - options: "Yes, you got it (Recommended)", "Not quite — let me clarify"
95
- - **The question ID must contain `depth_verification`** (e.g. `depth_verification_confirm`) — this enables the write-gate downstream.
95
+ - **The question ID must contain `depth_verification` and the milestone id** (e.g. `depth_verification_{{milestoneId}}_confirm`) — this enables the write-gate downstream and keeps verification scoped to the milestone being discussed.
96
96
 
97
- **If `{{structuredQuestionsAvailable}}` is `false`:** ask in plain text: "Did I capture that correctly? If not, tell me what I missed." Wait for confirmation before proceeding.
97
+ **If `{{structuredQuestionsAvailable}}` is `false`:** ask in plain text: "Did I capture that correctly? If not, tell me what I missed." Wait for explicit confirmation before proceeding. **The same non-bypassable gate applies to the plain-text path** — if the user does not respond, gives an ambiguous answer, or does not explicitly confirm, you MUST re-ask. Never rationalize past a missing confirmation.
98
98
 
99
99
  If they clarify, absorb the correction and re-verify.
100
100
 
101
101
  The depth verification is the only required confirmation gate. Do not add a second "ready to proceed?" gate after it.
102
102
 
103
- **CRITICAL — Non-bypassable gate:** The system mechanically blocks CONTEXT.md writes until the user selects the "(Recommended)" option. If the user declines, cancels, or the tool fails, you MUST re-ask — never rationalize past the block ("tool not responding, I'll proceed" is forbidden). The gate exists to protect the user's work; treat a block as an instruction, not an obstacle to work around.
103
+ **CRITICAL — Non-bypassable gate:** The system mechanically blocks CONTEXT.md writes until the user selects the "(Recommended)" option (structured path) or explicitly confirms (plain-text path). If the user declines, cancels, does not respond, or the tool fails, you MUST re-ask — never rationalize past the block ("tool not responding, I'll proceed" is forbidden). The gate exists to protect the user's work; treat a block as an instruction, not an obstacle to work around.
104
104
 
105
105
  ---
106
106
 
@@ -41,11 +41,13 @@ After each round of answers, decide whether you already have enough signal to wr
41
41
  - Ask a single wrap-up question only when you genuinely believe the slice is well understood or the user signals they want to stop.
42
42
  - When you do ask it, offer two choices: "Write the context file" *(recommended when the slice is well understood)* or "One more pass". Use `ask_user_questions` if available, otherwise ask in plain text.
43
43
 
44
+ **CRITICAL — Non-bypassable gate:** Do NOT write the context file until the user explicitly selects "Write the context file." If `ask_user_questions` fails, errors, returns no response, or the user's response does not match a provided option, you MUST re-ask — never rationalize past the block. "Tool not responding, I'll proceed," "auth issues," or "the slice seems well understood, I'll write it" are all **forbidden**. The gate exists to protect the user's work; treat a block as an instruction to wait, not an obstacle to work around.
45
+
44
46
  ---
45
47
 
46
48
  ## Output
47
49
 
48
- Once the user is ready to wrap up:
50
+ Once the user has explicitly confirmed they are ready to write the context file:
49
51
 
50
52
  1. Use the **Slice Context** output template below
51
53
  2. `mkdir -p {{sliceDirPath}}`
@@ -12,7 +12,7 @@ You are a project reorganization assistant for a GSD (Get Shit Done) project. Th
12
12
 
13
13
  1. Present the current milestone order as a clear numbered list with status indicators (e.g. ✅ complete, ▶ active, ⏳ pending, ⏸ parked)
14
14
  2. Ask: **"What would you like to change?"**
15
- 3. Execute changes conversationally, confirming destructive operations before proceeding
15
+ 3. Execute changes conversationally, confirming destructive operations before proceeding. **Non-bypassable:** For any destructive operation (discard, skip, reorder that breaks dependencies), you MUST get explicit user confirmation before executing. If the user does not respond, gives an ambiguous answer, or `ask_user_questions` fails, you MUST re-ask — never rationalize past the block. A missing confirmation is a "do not proceed."
16
16
 
17
17
  ## Supported Operations
18
18
 
@@ -53,8 +53,12 @@ gsd_skip_slice({ milestoneId: "M003", sliceId: "S02", reason: "Descoped — feat
53
53
  Skipped slices are treated as closed by the state machine (like "complete" but distinct). Use when a slice is no longer needed or has been superseded. The slice data is preserved for reference.
54
54
  **Do NOT** just check the slice checkbox in the roadmap — this does not update the DB and auto-mode will resume the slice.
55
55
 
56
+ **CRITICAL — Non-bypassable gate:** Skipping a slice is a permanent DB operation. You MUST confirm with the user before calling `gsd_skip_slice`. If the user does not respond or gives an ambiguous answer, you MUST re-ask — never proceed without explicit approval.
57
+
56
58
  ### Discard a milestone
57
- **Permanently** delete a milestone directory and prune it from QUEUE-ORDER.json. **Always confirm with the user before discarding.** Warn explicitly if the milestone has completed work.
59
+ **Permanently** delete a milestone directory and prune it from QUEUE-ORDER.json.
60
+
61
+ **CRITICAL — Non-bypassable gate:** Discarding is irreversible. You MUST confirm with the user before discarding. Warn explicitly if the milestone has completed work. If the user does not respond or gives an ambiguous answer, you MUST re-ask — never rationalize past the block. A missing confirmation is a "do not discard."
58
62
 
59
63
  ### Add a new milestone
60
64
  Use the `gsd_milestone_generate_id` tool to get the next ID, then call `gsd_summary_save` with `milestone_id: {ID}`, `artifact_type: "CONTEXT"`, and the scope/goals/success criteria as `content` — the tool writes the context file to disk and persists to DB. Update QUEUE-ORDER.json to place it at the desired position.
@@ -38,7 +38,7 @@ GSD ships with bundled skills. Load the relevant skill file with the `read` tool
38
38
  - Never print, echo, log, or restate secrets or credentials. Report only key names and applied/skipped status.
39
39
  - Never ask the user to edit `.env` files or set secrets manually. Use `secure_env_collect`.
40
40
  - In enduring files, write current state only unless the file is explicitly historical.
41
- - **Never take outward-facing actions on GitHub (or any external service) without explicit user confirmation.** This includes: creating issues, closing issues, merging PRs, approving PRs, posting comments, pushing to remote branches, publishing packages, or any other action that affects state outside the local filesystem. Read-only operations (listing, viewing, diffing) are fine. Always present what you intend to do and get a clear "yes" before executing.
41
+ - **Never take outward-facing actions on GitHub (or any external service) without explicit user confirmation.** This includes: creating issues, closing issues, merging PRs, approving PRs, posting comments, pushing to remote branches, publishing packages, or any other action that affects state outside the local filesystem. Read-only operations (listing, viewing, diffing) are fine. Always present what you intend to do and get a clear "yes" before executing. **Non-bypassable:** If the user does not respond, gives an ambiguous answer, or `ask_user_questions` fails, you MUST re-ask — never rationalize past the block ("tool not responding, I'll proceed" is forbidden). A missing "yes" is a "no."
42
42
 
43
43
  If a `GSD Skill Preferences` block is present below this contract, treat it as explicit durable guidance for which skills to use, prefer, or avoid during GSD work. Follow it where it does not conflict with required GSD artifact rules, verification requirements, or higher-priority system/developer instructions.
44
44
 
@@ -51,7 +51,7 @@ For each capture, classify it as one of:
51
51
 
52
52
  For captures classified as **note** or **defer**, auto-confirm without asking — these are low-impact.
53
53
  For captures classified as **stop** or **backtrack**, auto-confirm without asking — these are urgent user directives that must be honored immediately.
54
- For captures classified as **quick-task**, **inject**, or **replan**, ask the user to confirm or choose a different classification.
54
+ For captures classified as **quick-task**, **inject**, or **replan**, ask the user to confirm or choose a different classification. **Non-bypassable:** If `ask_user_questions` fails, errors, or the user does not respond, you MUST re-ask — never auto-confirm these classifications without explicit user approval.
55
55
 
56
56
  3. **Update** `.gsd/CAPTURES.md` — for each capture, update its section with the confirmed classification:
57
57
  - Change `**Status:** pending` to `**Status:** resolved`
@@ -14,7 +14,7 @@ This is remediation round {{remediationRound}}. If this is round 0, this is the
14
14
 
15
15
  ## Context
16
16
 
17
- All relevant context has been preloaded below — the roadmap, all slice summaries, UAT results, requirements, decisions, and project context are inlined. Start working immediately without re-reading these files.
17
+ All relevant context has been preloaded below — the roadmap, all slice summaries, assessment results, requirements, decisions, and project context are inlined. Start working immediately without re-reading these files.
18
18
 
19
19
  {{inlinedContext}}
20
20
 
@@ -30,8 +30,8 @@ Prompt: "Review milestone {{milestoneId}} requirements coverage. Working directo
30
30
  **Reviewer B — Cross-Slice Integration**
31
31
  Prompt: "Review milestone {{milestoneId}} cross-slice integration. Working directory: {{workingDirectory}}. Read `{{roadmapPath}}` and find the boundary map (produces/consumes contracts). For each boundary, check that the producing slice's SUMMARY confirms it produced the artifact, and the consuming slice's SUMMARY confirms it consumed it. Output a markdown table: Boundary | Producer Summary | Consumer Summary | Status. End with a one-line verdict: PASS if all boundaries honored, NEEDS-ATTENTION if any gaps."
32
32
 
33
- **Reviewer C — UAT & Acceptance Criteria**
34
- Prompt: "Review milestone {{milestoneId}} UAT and acceptance criteria. Working directory: {{workingDirectory}}. Read `.gsd/{{milestoneId}}/CONTEXT.md` for acceptance criteria. Check for UAT-RESULT files in each slice directory. Verify each acceptance criterion maps to either a passing UAT result or clear SUMMARY evidence. Output a checklist: [ ] Criterion | Evidence. End with a one-line verdict: PASS if all criteria met, NEEDS-ATTENTION if gaps exist."
33
+ **Reviewer C — Assessment & Acceptance Criteria**
34
+ Prompt: "Review milestone {{milestoneId}} assessment evidence and acceptance criteria. Working directory: {{workingDirectory}}. Read `.gsd/{{milestoneId}}/CONTEXT.md` for acceptance criteria. Check for ASSESSMENT files in each slice directory. Verify each acceptance criterion maps to either a passing assessment result or clear SUMMARY evidence. Output a checklist: [ ] Criterion | Evidence. End with a one-line verdict: PASS if all criteria met, NEEDS-ATTENTION if gaps exist."
35
35
 
36
36
  ### Step 2 — Synthesize Findings
37
37
 
@@ -59,7 +59,7 @@ reviewers: 3
59
59
  ## Reviewer B — Cross-Slice Integration
60
60
  <paste Reviewer B output>
61
61
 
62
- ## Reviewer C — UAT & Acceptance Criteria
62
+ ## Reviewer C — Assessment & Acceptance Criteria
63
63
  <paste Reviewer C output>
64
64
 
65
65
  ## Synthesis
@@ -90,9 +90,11 @@ Present a merge plan to the user:
90
90
 
91
91
  Ask the user to confirm the merge plan before proceeding.
92
92
 
93
+ **CRITICAL — Non-bypassable gate:** Do NOT execute any merge commands until the user explicitly approves the merge plan. If `ask_user_questions` fails, errors, returns no response, or the user's response is ambiguous, you MUST re-ask — never rationalize past the block. "No response, I'll proceed with the clean merges," "the plan looks safe, merging," or any other self-authorization is **forbidden**. The gate exists to protect the user's branches; treat a block as an instruction to wait, not an obstacle to work around.
94
+
93
95
  ### Step 4: Execute Merge
94
96
 
95
- Once confirmed, run all commands from `{{mainTreePath}}` (your CWD):
97
+ Once the user has explicitly confirmed, run all commands from `{{mainTreePath}}` (your CWD):
96
98
 
97
99
  1. Ensure you are on the target branch: `git checkout {{mainBranch}}`
98
100
  2. If there are conflicts requiring manual reconciliation, apply the reconciled versions first
@@ -9,6 +9,7 @@
9
9
  * Copyright (c) 2026 Jeremy McSpadden <jeremy@fluxlabs.net>
10
10
  */
11
11
  import { execFileSync } from "node:child_process";
12
+ import { normalizePlannedFileReference } from "../files.js";
12
13
  import { logWarning } from "../workflow-logger.js";
13
14
  // ─── Public API ─────────────────────────────────────────────────────────────
14
15
  /**
@@ -31,7 +32,7 @@ export function validateFileChanges(basePath, expectedOutput, plannedFiles) {
31
32
  // Filter out .gsd/ internal files — only validate project source files
32
33
  const projectFiles = actualFiles.filter(f => !f.startsWith(".gsd/") && !f.startsWith(".gsd\\"));
33
34
  // Normalize expected paths (strip leading ./ or /)
34
- const normalizedExpected = new Set([...allExpected].map(f => f.replace(/^\.\//, "").replace(/^\//, "")));
35
+ const normalizedExpected = new Set([...allExpected].map((f) => normalizePlannedFileReference(f).replace(/^\.\//, "").replace(/^\//, "")));
35
36
  // Compute symmetric difference
36
37
  const unexpectedFiles = projectFiles.filter(f => !normalizedExpected.has(f));
37
38
  const missingFiles = [...normalizedExpected].filter(f => !projectFiles.includes(f));
@@ -1194,7 +1194,8 @@ export async function _deriveStateImpl(basePath) {
1194
1194
  ? `All milestones complete. ${activeReqs} active requirement${activeReqs === 1 ? '' : 's'} in REQUIREMENTS.md ${activeReqs === 1 ? 'has' : 'have'} not been mapped to a milestone.`
1195
1195
  : 'All milestones complete.';
1196
1196
  return {
1197
- activeMilestone: lastEntry ? { id: lastEntry.id, title: lastEntry.title } : null,
1197
+ activeMilestone: null,
1198
+ lastCompletedMilestone: lastEntry ? { id: lastEntry.id, title: lastEntry.title } : null,
1198
1199
  activeSlice: null,
1199
1200
  activeTask: null,
1200
1201
  phase: 'complete',