gsd-pi 2.71.0-dev.e17e0ce → 2.72.0-dev.3118184

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 (352) hide show
  1. package/README.md +46 -3
  2. package/dist/cli.js +76 -3
  3. package/dist/mcp-server.js +37 -14
  4. package/dist/onboarding.js +10 -0
  5. package/dist/resources/agents/debugger.md +58 -0
  6. package/dist/resources/agents/doc-writer.md +43 -0
  7. package/dist/resources/agents/git-ops.md +56 -0
  8. package/dist/resources/agents/javascript-pro.md +46 -271
  9. package/dist/resources/agents/planner.md +55 -0
  10. package/dist/resources/agents/refactorer.md +47 -0
  11. package/dist/resources/agents/reviewer.md +48 -0
  12. package/dist/resources/agents/security.md +59 -0
  13. package/dist/resources/agents/tester.md +50 -0
  14. package/dist/resources/agents/typescript-pro.md +41 -235
  15. package/dist/resources/extensions/async-jobs/await-tool.js +7 -4
  16. package/dist/resources/extensions/async-jobs/job-manager.js +28 -3
  17. package/dist/resources/extensions/claude-code-cli/partial-builder.js +40 -12
  18. package/dist/resources/extensions/claude-code-cli/stream-adapter.js +132 -10
  19. package/dist/resources/extensions/gsd/auto/loop.js +84 -1
  20. package/dist/resources/extensions/gsd/auto/phases.js +4 -0
  21. package/dist/resources/extensions/gsd/auto-post-unit.js +6 -0
  22. package/dist/resources/extensions/gsd/auto-prompts.js +88 -33
  23. package/dist/resources/extensions/gsd/auto-recovery.js +11 -0
  24. package/dist/resources/extensions/gsd/auto-start.js +24 -4
  25. package/dist/resources/extensions/gsd/auto.js +29 -19
  26. package/dist/resources/extensions/gsd/bootstrap/db-tools.js +3 -3
  27. package/dist/resources/extensions/gsd/bootstrap/register-hooks.js +9 -11
  28. package/dist/resources/extensions/gsd/bootstrap/register-shortcuts.js +2 -5
  29. package/dist/resources/extensions/gsd/commands-handlers.js +4 -1
  30. package/dist/resources/extensions/gsd/context-injector.js +1 -1
  31. package/dist/resources/extensions/gsd/custom-workflow-engine.js +3 -7
  32. package/dist/resources/extensions/gsd/definition-io.js +15 -0
  33. package/dist/resources/extensions/gsd/dispatch-guard.js +4 -0
  34. package/dist/resources/extensions/gsd/doctor-providers.js +23 -0
  35. package/dist/resources/extensions/gsd/doctor-runtime-checks.js +6 -3
  36. package/dist/resources/extensions/gsd/error-classifier.js +4 -1
  37. package/dist/resources/extensions/gsd/gate-registry.js +208 -0
  38. package/dist/resources/extensions/gsd/git-service.js +11 -8
  39. package/dist/resources/extensions/gsd/gitignore.js +12 -6
  40. package/dist/resources/extensions/gsd/gsd-db.js +90 -6
  41. package/dist/resources/extensions/gsd/key-manager.js +2 -0
  42. package/dist/resources/extensions/gsd/milestone-validation-gates.js +11 -12
  43. package/dist/resources/extensions/gsd/notification-overlay.js +26 -12
  44. package/dist/resources/extensions/gsd/notification-store.js +5 -4
  45. package/dist/resources/extensions/gsd/preferences-skills.js +2 -34
  46. package/dist/resources/extensions/gsd/preferences-types.js +15 -0
  47. package/dist/resources/extensions/gsd/preferences.js +16 -3
  48. package/dist/resources/extensions/gsd/prompt-loader.js +4 -1
  49. package/dist/resources/extensions/gsd/prompt-validation.js +126 -0
  50. package/dist/resources/extensions/gsd/prompts/complete-slice.md +3 -1
  51. package/dist/resources/extensions/gsd/prompts/discuss.md +122 -13
  52. package/dist/resources/extensions/gsd/prompts/execute-task.md +2 -0
  53. package/dist/resources/extensions/gsd/prompts/system.md +1 -1
  54. package/dist/resources/extensions/gsd/prompts/validate-milestone.md +2 -0
  55. package/dist/resources/extensions/gsd/shortcut-defs.js +7 -1
  56. package/dist/resources/extensions/gsd/state.js +29 -2
  57. package/dist/resources/extensions/gsd/tools/complete-slice.js +52 -1
  58. package/dist/resources/extensions/gsd/tools/complete-task.js +51 -1
  59. package/dist/resources/extensions/gsd/tools/workflow-tool-executors.js +4 -1
  60. package/dist/resources/extensions/gsd/workflow-projections.js +7 -0
  61. package/dist/resources/extensions/gsd/worktree-manager.js +30 -3
  62. package/dist/resources/extensions/gsd/write-intercept.js +10 -1
  63. package/dist/resources/extensions/ollama/index.js +17 -10
  64. package/dist/resources/extensions/ollama/ollama-client.js +35 -6
  65. package/dist/resources/extensions/ollama/ollama-discovery.js +32 -6
  66. package/dist/resources/extensions/shared/gsd-phase-state.js +35 -0
  67. package/dist/resources/extensions/subagent/agents.js +8 -0
  68. package/dist/resources/extensions/subagent/index.js +17 -0
  69. package/dist/startup-model-validation.d.ts +0 -1
  70. package/dist/startup-model-validation.js +6 -2
  71. package/dist/web/standalone/.next/BUILD_ID +1 -1
  72. package/dist/web/standalone/.next/app-path-routes-manifest.json +14 -14
  73. package/dist/web/standalone/.next/build-manifest.json +2 -2
  74. package/dist/web/standalone/.next/prerender-manifest.json +3 -3
  75. package/dist/web/standalone/.next/server/app/_global-error/page.js +3 -3
  76. package/dist/web/standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  77. package/dist/web/standalone/.next/server/app/_global-error.html +1 -1
  78. package/dist/web/standalone/.next/server/app/_global-error.rsc +1 -1
  79. package/dist/web/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  80. package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  81. package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  82. package/dist/web/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  83. package/dist/web/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  84. package/dist/web/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  85. package/dist/web/standalone/.next/server/app/_not-found/page.js +2 -2
  86. package/dist/web/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  87. package/dist/web/standalone/.next/server/app/_not-found.html +1 -1
  88. package/dist/web/standalone/.next/server/app/_not-found.rsc +1 -1
  89. package/dist/web/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
  90. package/dist/web/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  91. package/dist/web/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
  92. package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  93. package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  94. package/dist/web/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  95. package/dist/web/standalone/.next/server/app/api/boot/route.js +1 -1
  96. package/dist/web/standalone/.next/server/app/api/bridge-terminal/input/route.js +1 -1
  97. package/dist/web/standalone/.next/server/app/api/bridge-terminal/resize/route.js +1 -1
  98. package/dist/web/standalone/.next/server/app/api/bridge-terminal/stream/route.js +2 -2
  99. package/dist/web/standalone/.next/server/app/api/browse-directories/route.js +1 -1
  100. package/dist/web/standalone/.next/server/app/api/captures/route.js +1 -1
  101. package/dist/web/standalone/.next/server/app/api/cleanup/route.js +1 -1
  102. package/dist/web/standalone/.next/server/app/api/dev-mode/route.js +1 -1
  103. package/dist/web/standalone/.next/server/app/api/doctor/route.js +1 -1
  104. package/dist/web/standalone/.next/server/app/api/experimental/route.js +2 -2
  105. package/dist/web/standalone/.next/server/app/api/export-data/route.js +1 -1
  106. package/dist/web/standalone/.next/server/app/api/files/route.js +1 -1
  107. package/dist/web/standalone/.next/server/app/api/forensics/route.js +1 -1
  108. package/dist/web/standalone/.next/server/app/api/git/route.js +1 -1
  109. package/dist/web/standalone/.next/server/app/api/history/route.js +1 -1
  110. package/dist/web/standalone/.next/server/app/api/hooks/route.js +1 -1
  111. package/dist/web/standalone/.next/server/app/api/inspect/route.js +1 -1
  112. package/dist/web/standalone/.next/server/app/api/knowledge/route.js +1 -1
  113. package/dist/web/standalone/.next/server/app/api/live-state/route.js +1 -1
  114. package/dist/web/standalone/.next/server/app/api/notifications/route.js +2 -2
  115. package/dist/web/standalone/.next/server/app/api/onboarding/route.js +1 -1
  116. package/dist/web/standalone/.next/server/app/api/preferences/route.js +1 -1
  117. package/dist/web/standalone/.next/server/app/api/projects/route.js +1 -1
  118. package/dist/web/standalone/.next/server/app/api/recovery/route.js +1 -1
  119. package/dist/web/standalone/.next/server/app/api/remote-questions/route.js +2 -2
  120. package/dist/web/standalone/.next/server/app/api/session/browser/route.js +1 -1
  121. package/dist/web/standalone/.next/server/app/api/session/command/route.js +1 -1
  122. package/dist/web/standalone/.next/server/app/api/session/events/route.js +2 -2
  123. package/dist/web/standalone/.next/server/app/api/session/manage/route.js +1 -1
  124. package/dist/web/standalone/.next/server/app/api/settings-data/route.js +1 -1
  125. package/dist/web/standalone/.next/server/app/api/shutdown/route.js +1 -1
  126. package/dist/web/standalone/.next/server/app/api/skill-health/route.js +1 -1
  127. package/dist/web/standalone/.next/server/app/api/steer/route.js +1 -1
  128. package/dist/web/standalone/.next/server/app/api/switch-root/route.js +1 -1
  129. package/dist/web/standalone/.next/server/app/api/terminal/input/route.js +2 -2
  130. package/dist/web/standalone/.next/server/app/api/terminal/resize/route.js +2 -2
  131. package/dist/web/standalone/.next/server/app/api/terminal/sessions/route.js +2 -2
  132. package/dist/web/standalone/.next/server/app/api/terminal/stream/route.js +3 -3
  133. package/dist/web/standalone/.next/server/app/api/terminal/upload/route.js +1 -1
  134. package/dist/web/standalone/.next/server/app/api/undo/route.js +1 -1
  135. package/dist/web/standalone/.next/server/app/api/update/route.js +1 -1
  136. package/dist/web/standalone/.next/server/app/api/visualizer/route.js +1 -1
  137. package/dist/web/standalone/.next/server/app/index.html +1 -1
  138. package/dist/web/standalone/.next/server/app/index.rsc +1 -1
  139. package/dist/web/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
  140. package/dist/web/standalone/.next/server/app/index.segments/_full.segment.rsc +1 -1
  141. package/dist/web/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
  142. package/dist/web/standalone/.next/server/app/index.segments/_index.segment.rsc +1 -1
  143. package/dist/web/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
  144. package/dist/web/standalone/.next/server/app/page.js +2 -2
  145. package/dist/web/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
  146. package/dist/web/standalone/.next/server/app-paths-manifest.json +14 -14
  147. package/dist/web/standalone/.next/server/chunks/2331.js +16 -16
  148. package/dist/web/standalone/.next/server/chunks/4741.js +12 -12
  149. package/dist/web/standalone/.next/server/chunks/5822.js +2 -2
  150. package/dist/web/standalone/.next/server/chunks/63.js +8 -8
  151. package/dist/web/standalone/.next/server/chunks/6897.js +3 -3
  152. package/dist/web/standalone/.next/server/edge-runtime-webpack.js +2 -0
  153. package/dist/web/standalone/.next/server/functions-config-manifest.json +0 -9
  154. package/dist/web/standalone/.next/server/middleware-build-manifest.js +1 -1
  155. package/dist/web/standalone/.next/server/middleware-manifest.json +29 -2
  156. package/dist/web/standalone/.next/server/middleware.js +4 -12
  157. package/dist/web/standalone/.next/server/pages/404.html +1 -1
  158. package/dist/web/standalone/.next/server/pages/500.html +1 -1
  159. package/dist/web/standalone/.next/server/server-reference-manifest.json +1 -1
  160. package/dist/web/standalone/.next/server/webpack-runtime.js +1 -1
  161. package/package.json +1 -1
  162. package/packages/mcp-server/dist/server.d.ts +12 -1
  163. package/packages/mcp-server/dist/server.d.ts.map +1 -1
  164. package/packages/mcp-server/dist/server.js +90 -42
  165. package/packages/mcp-server/dist/server.js.map +1 -1
  166. package/packages/mcp-server/dist/workflow-tools.js +1 -1
  167. package/packages/mcp-server/dist/workflow-tools.js.map +1 -1
  168. package/packages/mcp-server/src/server.ts +110 -38
  169. package/packages/mcp-server/src/workflow-tools.ts +1 -1
  170. package/packages/pi-ai/dist/env-api-keys.js +1 -0
  171. package/packages/pi-ai/dist/env-api-keys.js.map +1 -1
  172. package/packages/pi-ai/dist/models.custom.d.ts +105 -0
  173. package/packages/pi-ai/dist/models.custom.d.ts.map +1 -1
  174. package/packages/pi-ai/dist/models.custom.js +97 -0
  175. package/packages/pi-ai/dist/models.custom.js.map +1 -1
  176. package/packages/pi-ai/dist/models.generated.d.ts +648 -140
  177. package/packages/pi-ai/dist/models.generated.d.ts.map +1 -1
  178. package/packages/pi-ai/dist/models.generated.js +867 -370
  179. package/packages/pi-ai/dist/models.generated.js.map +1 -1
  180. package/packages/pi-ai/dist/models.generated.test.d.ts +2 -0
  181. package/packages/pi-ai/dist/models.generated.test.d.ts.map +1 -0
  182. package/packages/pi-ai/dist/models.generated.test.js +334 -0
  183. package/packages/pi-ai/dist/models.generated.test.js.map +1 -0
  184. package/packages/pi-ai/dist/models.test.js +105 -0
  185. package/packages/pi-ai/dist/models.test.js.map +1 -1
  186. package/packages/pi-ai/dist/types.d.ts +1 -1
  187. package/packages/pi-ai/dist/types.d.ts.map +1 -1
  188. package/packages/pi-ai/dist/types.js.map +1 -1
  189. package/packages/pi-ai/dist/utils/oauth/github-copilot.d.ts.map +1 -1
  190. package/packages/pi-ai/dist/utils/oauth/github-copilot.js +5 -1
  191. package/packages/pi-ai/dist/utils/oauth/github-copilot.js.map +1 -1
  192. package/packages/pi-ai/dist/utils/oauth/github-copilot.test.d.ts +2 -0
  193. package/packages/pi-ai/dist/utils/oauth/github-copilot.test.d.ts.map +1 -0
  194. package/packages/pi-ai/dist/utils/oauth/github-copilot.test.js +57 -0
  195. package/packages/pi-ai/dist/utils/oauth/github-copilot.test.js.map +1 -0
  196. package/packages/pi-ai/src/env-api-keys.ts +1 -0
  197. package/packages/pi-ai/src/models.custom.ts +98 -0
  198. package/packages/pi-ai/src/models.generated.test.ts +373 -0
  199. package/packages/pi-ai/src/models.generated.ts +867 -370
  200. package/packages/pi-ai/src/models.test.ts +135 -0
  201. package/packages/pi-ai/src/types.ts +1 -0
  202. package/packages/pi-ai/src/utils/oauth/github-copilot.test.ts +71 -0
  203. package/packages/pi-ai/src/utils/oauth/github-copilot.ts +4 -1
  204. package/packages/pi-coding-agent/dist/core/model-resolver.d.ts.map +1 -1
  205. package/packages/pi-coding-agent/dist/core/model-resolver.js +1 -0
  206. package/packages/pi-coding-agent/dist/core/model-resolver.js.map +1 -1
  207. package/packages/pi-coding-agent/dist/core/model-resolver.test.d.ts +8 -0
  208. package/packages/pi-coding-agent/dist/core/model-resolver.test.d.ts.map +1 -0
  209. package/packages/pi-coding-agent/dist/core/model-resolver.test.js +75 -0
  210. package/packages/pi-coding-agent/dist/core/model-resolver.test.js.map +1 -0
  211. package/packages/pi-coding-agent/dist/core/retry-handler.d.ts +5 -0
  212. package/packages/pi-coding-agent/dist/core/retry-handler.d.ts.map +1 -1
  213. package/packages/pi-coding-agent/dist/core/retry-handler.js +55 -1
  214. package/packages/pi-coding-agent/dist/core/retry-handler.js.map +1 -1
  215. package/packages/pi-coding-agent/dist/core/retry-handler.test.js +57 -0
  216. package/packages/pi-coding-agent/dist/core/retry-handler.test.js.map +1 -1
  217. package/packages/pi-coding-agent/dist/core/sdk.d.ts.map +1 -1
  218. package/packages/pi-coding-agent/dist/core/sdk.js +9 -0
  219. package/packages/pi-coding-agent/dist/core/sdk.js.map +1 -1
  220. package/packages/pi-coding-agent/dist/modes/interactive/components/__tests__/tool-execution.test.js +36 -0
  221. package/packages/pi-coding-agent/dist/modes/interactive/components/__tests__/tool-execution.test.js.map +1 -1
  222. package/packages/pi-coding-agent/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
  223. package/packages/pi-coding-agent/dist/modes/interactive/components/model-selector.js +9 -2
  224. package/packages/pi-coding-agent/dist/modes/interactive/components/model-selector.js.map +1 -1
  225. package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
  226. package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.js +87 -12
  227. package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.js.map +1 -1
  228. package/packages/pi-coding-agent/dist/modes/interactive/controllers/model-controller.d.ts.map +1 -1
  229. package/packages/pi-coding-agent/dist/modes/interactive/controllers/model-controller.js +6 -1
  230. package/packages/pi-coding-agent/dist/modes/interactive/controllers/model-controller.js.map +1 -1
  231. package/packages/pi-coding-agent/package.json +1 -1
  232. package/packages/pi-coding-agent/src/core/model-resolver.test.ts +85 -0
  233. package/packages/pi-coding-agent/src/core/model-resolver.ts +1 -0
  234. package/packages/pi-coding-agent/src/core/retry-handler.test.ts +83 -0
  235. package/packages/pi-coding-agent/src/core/retry-handler.ts +60 -1
  236. package/packages/pi-coding-agent/src/core/sdk.ts +10 -0
  237. package/packages/pi-coding-agent/src/modes/interactive/components/__tests__/tool-execution.test.ts +72 -0
  238. package/packages/pi-coding-agent/src/modes/interactive/components/model-selector.ts +15 -6
  239. package/packages/pi-coding-agent/src/modes/interactive/components/tool-execution.ts +84 -12
  240. package/packages/pi-coding-agent/src/modes/interactive/controllers/model-controller.ts +6 -1
  241. package/packages/pi-tui/dist/components/__tests__/editor.test.js +12 -0
  242. package/packages/pi-tui/dist/components/__tests__/editor.test.js.map +1 -1
  243. package/packages/pi-tui/dist/components/__tests__/input.test.js +12 -0
  244. package/packages/pi-tui/dist/components/__tests__/input.test.js.map +1 -1
  245. package/packages/pi-tui/dist/keys.d.ts.map +1 -1
  246. package/packages/pi-tui/dist/keys.js +27 -0
  247. package/packages/pi-tui/dist/keys.js.map +1 -1
  248. package/packages/pi-tui/src/components/__tests__/editor.test.ts +18 -0
  249. package/packages/pi-tui/src/components/__tests__/input.test.ts +18 -0
  250. package/packages/pi-tui/src/keys.ts +32 -0
  251. package/pkg/package.json +1 -1
  252. package/src/resources/agents/debugger.md +58 -0
  253. package/src/resources/agents/doc-writer.md +43 -0
  254. package/src/resources/agents/git-ops.md +56 -0
  255. package/src/resources/agents/javascript-pro.md +46 -271
  256. package/src/resources/agents/planner.md +55 -0
  257. package/src/resources/agents/refactorer.md +47 -0
  258. package/src/resources/agents/reviewer.md +48 -0
  259. package/src/resources/agents/security.md +59 -0
  260. package/src/resources/agents/tester.md +50 -0
  261. package/src/resources/agents/typescript-pro.md +41 -235
  262. package/src/resources/extensions/async-jobs/await-tool.test.ts +40 -7
  263. package/src/resources/extensions/async-jobs/await-tool.ts +7 -4
  264. package/src/resources/extensions/async-jobs/job-manager.ts +33 -3
  265. package/src/resources/extensions/claude-code-cli/partial-builder.ts +45 -12
  266. package/src/resources/extensions/claude-code-cli/stream-adapter.ts +139 -8
  267. package/src/resources/extensions/claude-code-cli/tests/partial-builder.test.ts +91 -2
  268. package/src/resources/extensions/claude-code-cli/tests/stream-adapter.test.ts +245 -2
  269. package/src/resources/extensions/gsd/auto/loop.ts +89 -1
  270. package/src/resources/extensions/gsd/auto/phases.ts +4 -0
  271. package/src/resources/extensions/gsd/auto-post-unit.ts +7 -0
  272. package/src/resources/extensions/gsd/auto-prompts.ts +111 -33
  273. package/src/resources/extensions/gsd/auto-recovery.ts +10 -0
  274. package/src/resources/extensions/gsd/auto-start.ts +31 -4
  275. package/src/resources/extensions/gsd/auto.ts +29 -20
  276. package/src/resources/extensions/gsd/bootstrap/db-tools.ts +3 -3
  277. package/src/resources/extensions/gsd/bootstrap/register-hooks.ts +8 -10
  278. package/src/resources/extensions/gsd/bootstrap/register-shortcuts.ts +2 -5
  279. package/src/resources/extensions/gsd/commands-handlers.ts +5 -1
  280. package/src/resources/extensions/gsd/context-injector.ts +1 -1
  281. package/src/resources/extensions/gsd/custom-workflow-engine.ts +4 -8
  282. package/src/resources/extensions/gsd/definition-io.ts +18 -0
  283. package/src/resources/extensions/gsd/dispatch-guard.ts +5 -0
  284. package/src/resources/extensions/gsd/doctor-providers.ts +24 -0
  285. package/src/resources/extensions/gsd/doctor-runtime-checks.ts +6 -3
  286. package/src/resources/extensions/gsd/error-classifier.ts +4 -1
  287. package/src/resources/extensions/gsd/gate-registry.ts +251 -0
  288. package/src/resources/extensions/gsd/git-service.ts +11 -8
  289. package/src/resources/extensions/gsd/gitignore.ts +12 -6
  290. package/src/resources/extensions/gsd/gsd-db.ts +105 -6
  291. package/src/resources/extensions/gsd/key-manager.ts +2 -0
  292. package/src/resources/extensions/gsd/milestone-validation-gates.ts +11 -13
  293. package/src/resources/extensions/gsd/notification-overlay.ts +27 -11
  294. package/src/resources/extensions/gsd/notification-store.ts +5 -4
  295. package/src/resources/extensions/gsd/preferences-skills.ts +2 -36
  296. package/src/resources/extensions/gsd/preferences-types.ts +16 -0
  297. package/src/resources/extensions/gsd/preferences.ts +19 -6
  298. package/src/resources/extensions/gsd/prompt-loader.ts +6 -1
  299. package/src/resources/extensions/gsd/prompt-validation.ts +157 -0
  300. package/src/resources/extensions/gsd/prompts/complete-slice.md +3 -1
  301. package/src/resources/extensions/gsd/prompts/discuss.md +122 -13
  302. package/src/resources/extensions/gsd/prompts/execute-task.md +2 -0
  303. package/src/resources/extensions/gsd/prompts/system.md +1 -1
  304. package/src/resources/extensions/gsd/prompts/validate-milestone.md +2 -0
  305. package/src/resources/extensions/gsd/shortcut-defs.ts +8 -1
  306. package/src/resources/extensions/gsd/state.ts +33 -2
  307. package/src/resources/extensions/gsd/tests/auto-paused-ui-cleanup.test.ts +27 -0
  308. package/src/resources/extensions/gsd/tests/auto-start-model-capture.test.ts +14 -0
  309. package/src/resources/extensions/gsd/tests/block-db-writes.test.ts +63 -0
  310. package/src/resources/extensions/gsd/tests/complete-slice-gate-closure.test.ts +167 -0
  311. package/src/resources/extensions/gsd/tests/definition-io.test.ts +57 -0
  312. package/src/resources/extensions/gsd/tests/dispatch-guard.test.ts +26 -0
  313. package/src/resources/extensions/gsd/tests/doctor-heal-fixable-warnings.test.ts +14 -0
  314. package/src/resources/extensions/gsd/tests/doctor-providers.test.ts +36 -0
  315. package/src/resources/extensions/gsd/tests/false-degraded-mode-warning.test.ts +104 -0
  316. package/src/resources/extensions/gsd/tests/format-shortcut.test.ts +16 -0
  317. package/src/resources/extensions/gsd/tests/gate-dispatch.test.ts +27 -0
  318. package/src/resources/extensions/gsd/tests/gate-registry.test.ts +140 -0
  319. package/src/resources/extensions/gsd/tests/gsd-db.test.ts +107 -5
  320. package/src/resources/extensions/gsd/tests/integration/git-service.test.ts +8 -6
  321. package/src/resources/extensions/gsd/tests/key-manager.test.ts +63 -0
  322. package/src/resources/extensions/gsd/tests/memory-pressure-stuck-state.test.ts +54 -0
  323. package/src/resources/extensions/gsd/tests/plan-milestone-artifact-verification.test.ts +62 -0
  324. package/src/resources/extensions/gsd/tests/post-unit-state-rebuild.test.ts +34 -0
  325. package/src/resources/extensions/gsd/tests/preferences-formatting.test.ts +87 -0
  326. package/src/resources/extensions/gsd/tests/preferences.test.ts +53 -0
  327. package/src/resources/extensions/gsd/tests/projection-regression.test.ts +96 -1
  328. package/src/resources/extensions/gsd/tests/prompt-loader-working-directory.test.ts +19 -0
  329. package/src/resources/extensions/gsd/tests/prompt-system-gate-coverage.test.ts +208 -0
  330. package/src/resources/extensions/gsd/tests/provider-errors.test.ts +9 -0
  331. package/src/resources/extensions/gsd/tests/register-hooks-depth-verification.test.ts +97 -0
  332. package/src/resources/extensions/gsd/tests/register-shortcuts.test.ts +3 -2
  333. package/src/resources/extensions/gsd/tests/stale-slice-rows.test.ts +41 -0
  334. package/src/resources/extensions/gsd/tools/complete-slice.ts +63 -0
  335. package/src/resources/extensions/gsd/tools/complete-task.ts +63 -0
  336. package/src/resources/extensions/gsd/tools/workflow-tool-executors.ts +4 -1
  337. package/src/resources/extensions/gsd/types.ts +26 -0
  338. package/src/resources/extensions/gsd/workflow-projections.ts +8 -0
  339. package/src/resources/extensions/gsd/worktree-manager.ts +29 -3
  340. package/src/resources/extensions/gsd/write-intercept.ts +10 -1
  341. package/src/resources/extensions/ollama/index.ts +17 -8
  342. package/src/resources/extensions/ollama/ollama-client.ts +35 -6
  343. package/src/resources/extensions/ollama/ollama-discovery.ts +37 -6
  344. package/src/resources/extensions/ollama/ollama-status-indicator.test.ts +28 -0
  345. package/src/resources/extensions/ollama/tests/ollama-discovery.test.ts +54 -0
  346. package/src/resources/extensions/shared/gsd-phase-state.ts +42 -0
  347. package/src/resources/extensions/shared/tests/gsd-phase-state.test.ts +48 -0
  348. package/src/resources/extensions/subagent/agents.ts +10 -0
  349. package/src/resources/extensions/subagent/index.ts +18 -0
  350. package/src/resources/extensions/subagent/tests/agents-conflicts.test.ts +33 -0
  351. /package/dist/web/standalone/.next/static/{cYPZv_bAhZk2ms-Pz6vsY → NzO79SOz9jHX-VY5-0t2O}/_buildManifest.js +0 -0
  352. /package/dist/web/standalone/.next/static/{cYPZv_bAhZk2ms-Pz6vsY → NzO79SOz9jHX-VY5-0t2O}/_ssgManifest.js +0 -0
@@ -2,7 +2,7 @@
2
2
  // Scrollable panel showing all persisted notifications with severity filtering.
3
3
  // Toggled with Ctrl+Alt+N (⌃⌥N on macOS), Ctrl+Shift+N fallback, or /gsd notifications.
4
4
  import { truncateToWidth, visibleWidth, matchesKey, Key } from "@gsd/pi-tui";
5
- import { readNotifications, markAllRead, clearNotifications, } from "./notification-store.js";
5
+ import { readNotifications, markAllRead, clearNotifications, onNotificationStoreChange, } from "./notification-store.js";
6
6
  import { formattedShortcutPair } from "./shortcut-defs.js";
7
7
  import { padRight, joinColumns } from "../shared/mod.js";
8
8
  const FILTER_CYCLE = ["all", "error", "warning", "info"];
@@ -74,6 +74,7 @@ export class GSDNotificationOverlay {
74
74
  refreshTimer;
75
75
  disposed = false;
76
76
  resizeHandler = null;
77
+ unsubscribeStore = null;
77
78
  constructor(tui, theme, onClose) {
78
79
  this.tui = tui;
79
80
  this.theme = theme;
@@ -90,20 +91,18 @@ export class GSDNotificationOverlay {
90
91
  this.tui.requestRender();
91
92
  };
92
93
  process.stdout.on("resize", this.resizeHandler);
93
- // Refresh every 3s for new notifications
94
+ // Subscribe to store mutations for immediate updates
95
+ this.unsubscribeStore = onNotificationStoreChange(() => {
96
+ if (this.disposed)
97
+ return;
98
+ this._refreshFromDisk();
99
+ });
100
+ // 30s safety-net for cross-process edits (web subprocess, parallel workers)
94
101
  this.refreshTimer = setInterval(() => {
95
102
  if (this.disposed)
96
103
  return;
97
- const fresh = readNotifications();
98
- const signature = notificationSignature(fresh);
99
- if (signature !== this.entriesSignature) {
100
- markAllRead();
101
- this.entries = readNotifications();
102
- this.entriesSignature = notificationSignature(this.entries);
103
- this.invalidate();
104
- this.tui.requestRender();
105
- }
106
- }, 3000);
104
+ this._refreshFromDisk();
105
+ }, 30_000);
107
106
  }
108
107
  get filter() {
109
108
  return FILTER_CYCLE[this.filterIndex];
@@ -188,11 +187,26 @@ export class GSDNotificationOverlay {
188
187
  dispose() {
189
188
  this.disposed = true;
190
189
  clearInterval(this.refreshTimer);
190
+ if (this.unsubscribeStore) {
191
+ this.unsubscribeStore();
192
+ this.unsubscribeStore = null;
193
+ }
191
194
  if (this.resizeHandler) {
192
195
  process.stdout.removeListener("resize", this.resizeHandler);
193
196
  this.resizeHandler = null;
194
197
  }
195
198
  }
199
+ _refreshFromDisk() {
200
+ const fresh = readNotifications();
201
+ const signature = notificationSignature(fresh);
202
+ if (signature !== this.entriesSignature) {
203
+ markAllRead();
204
+ this.entries = readNotifications();
205
+ this.entriesSignature = notificationSignature(this.entries);
206
+ this.invalidate();
207
+ this.tui.requestRender();
208
+ }
209
+ }
196
210
  wrapInBox(inner, width) {
197
211
  const th = this.theme;
198
212
  const border = (s) => th.fg("borderAccent", s);
@@ -301,10 +301,11 @@ function _withLock(basePath, fn) {
301
301
  break;
302
302
  }
303
303
  }
304
- // Only run the mutation if we actually own the lock
305
- const ownsLock = fd !== null;
304
+ // Best-effort: mutation runs regardless of lock status (idempotent overwrites).
305
+ // createdLock gates cleanup only — never skip fn() on lock failure.
306
+ const createdLock = fd !== null;
306
307
  try {
307
- if (ownsLock && fd !== null) {
308
+ if (createdLock && fd !== null) {
308
309
  // Write our PID timestamp into the lock for stale detection
309
310
  writeFileSync(lockPath, String(Date.now()), "utf-8");
310
311
  closeSync(fd);
@@ -313,7 +314,7 @@ function _withLock(basePath, fn) {
313
314
  }
314
315
  finally {
315
316
  // Only delete the lock if we created it — never remove another process's lock
316
- if (ownsLock) {
317
+ if (createdLock) {
317
318
  try {
318
319
  unlinkSync(lockPath);
319
320
  }
@@ -9,7 +9,6 @@ import { homedir } from "node:os";
9
9
  import { isAbsolute, join } from "node:path";
10
10
  import { statSync } from "node:fs";
11
11
  import { validatePreferences } from "./preferences-validation.js";
12
- import { loadEffectiveGSDPreferences } from "./preferences.js";
13
12
  /**
14
13
  * Known skill directories, in priority order.
15
14
  * Searches both the skills.sh ecosystem directory (~/.agents/skills/) and
@@ -130,36 +129,5 @@ export function resolveAllSkillReferences(preferences, cwd) {
130
129
  }
131
130
  return { resolutions, warnings };
132
131
  }
133
- /**
134
- * Format a skill reference for the system prompt.
135
- * If resolved, shows the path so the agent knows exactly where to read.
136
- * If unresolved, marks it clearly.
137
- */
138
- export function formatSkillRef(ref, resolutions) {
139
- const resolution = resolutions.get(ref);
140
- if (!resolution || resolution.method === "unresolved") {
141
- return `${ref} (⚠ not found — check skill name or path)`;
142
- }
143
- // For absolute paths where SKILL.md is just appended, don't clutter the output
144
- if (resolution.method === "absolute-path" || resolution.method === "absolute-dir") {
145
- return ref;
146
- }
147
- // For bare names resolved from skill directories, show the resolved path
148
- return `${ref} → \`${resolution.resolvedPath}\``;
149
- }
150
- /**
151
- * Resolve the skill discovery mode from effective preferences.
152
- * Defaults to "suggest" -- skills are identified during research but not installed automatically.
153
- */
154
- export function resolveSkillDiscoveryMode() {
155
- const prefs = loadEffectiveGSDPreferences();
156
- return prefs?.preferences.skill_discovery ?? "suggest";
157
- }
158
- /**
159
- * Resolve the skill staleness threshold in days.
160
- * Returns 0 if disabled, default 60 if not configured.
161
- */
162
- export function resolveSkillStalenessDays() {
163
- const prefs = loadEffectiveGSDPreferences();
164
- return prefs?.preferences.skill_staleness_days ?? 60;
165
- }
132
+ // resolveSkillDiscoveryMode and resolveSkillStalenessDays moved to
133
+ // preferences.ts to break circular dependency (they need loadEffectiveGSDPreferences).
@@ -92,3 +92,18 @@ export const KNOWN_UNIT_TYPES = [
92
92
  "discuss-milestone", "discuss-slice", "worktree-merge",
93
93
  ];
94
94
  export const SKILL_ACTIONS = new Set(["use", "prefer", "avoid"]);
95
+ /**
96
+ * Format a skill reference for the system prompt.
97
+ * If resolved, shows the path so the agent knows exactly where to read.
98
+ * If unresolved, marks it clearly.
99
+ */
100
+ export function formatSkillRef(ref, resolutions) {
101
+ const resolution = resolutions.get(ref);
102
+ if (!resolution || resolution.method === "unresolved") {
103
+ return `${ref} (⚠ not found — check skill name or path)`;
104
+ }
105
+ if (resolution.method === "absolute-path" || resolution.method === "absolute-dir") {
106
+ return ref;
107
+ }
108
+ return `${ref} → \`${resolution.resolvedPath}\``;
109
+ }
@@ -17,13 +17,23 @@ import { parse as parseYaml } from "yaml";
17
17
  import { normalizeStringArray } from "../shared/format-utils.js";
18
18
  import { logWarning } from "./workflow-logger.js";
19
19
  import { resolveProfileDefaults as _resolveProfileDefaults } from "./preferences-models.js";
20
- import { KNOWN_PREFERENCE_KEYS, MODE_DEFAULTS, } from "./preferences-types.js";
20
+ import { KNOWN_PREFERENCE_KEYS, MODE_DEFAULTS, formatSkillRef, } from "./preferences-types.js";
21
21
  import { validatePreferences } from "./preferences-validation.js";
22
- import { formatSkillRef } from "./preferences-skills.js";
23
22
  // ─── Re-exports: validation ─────────────────────────────────────────────────
24
23
  export { validatePreferences } from "./preferences-validation.js";
25
24
  // ─── Re-exports: skills ─────────────────────────────────────────────────────
26
- export { resolveAllSkillReferences, resolveSkillDiscoveryMode, resolveSkillStalenessDays, } from "./preferences-skills.js";
25
+ export { resolveAllSkillReferences } from "./preferences-skills.js";
26
+ // These lived in preferences-skills.ts but imported loadEffectiveGSDPreferences
27
+ // back from this file, creating a circular dependency. Moved here since they
28
+ // are trivial wrappers over loadEffectiveGSDPreferences.
29
+ export function resolveSkillDiscoveryMode() {
30
+ const prefs = loadEffectiveGSDPreferences();
31
+ return prefs?.preferences.skill_discovery ?? "suggest";
32
+ }
33
+ export function resolveSkillStalenessDays() {
34
+ const prefs = loadEffectiveGSDPreferences();
35
+ return prefs?.preferences.skill_staleness_days ?? 60;
36
+ }
27
37
  // ─── Re-exports: models ─────────────────────────────────────────────────────
28
38
  export { resolveModelForUnit, resolveModelWithFallbacksForUnit, getNextFallbackModel, isTransientNetworkError, validateModelId, updatePreferencesModels, resolveDynamicRoutingConfig, resolveAutoSupervisorConfig, resolveProfileDefaults, resolveEffectiveProfile, resolveInlineLevel, resolveContextSelection, resolveSearchProviderFromPreferences, } from "./preferences-models.js";
29
39
  // ─── Path Constants & Getters ───────────────────────────────────────────────
@@ -304,6 +314,9 @@ function mergePreferences(base, override) {
304
314
  github: (base.github || override.github)
305
315
  ? { ...(base.github ?? {}), ...(override.github ?? {}) }
306
316
  : undefined,
317
+ experimental: (base.experimental || override.experimental)
318
+ ? { ...(base.experimental ?? {}), ...(override.experimental ?? {}) }
319
+ : undefined,
307
320
  service_tier: override.service_tier ?? base.service_tier,
308
321
  forensics_dedup: override.forensics_dedup ?? base.forensics_dedup,
309
322
  show_token_cost: override.show_token_cost ?? base.show_token_cost,
@@ -132,10 +132,13 @@ export function loadPrompt(name, vars = {}) {
132
132
  }
133
133
  }
134
134
  for (const [key, value] of Object.entries(effectiveVars)) {
135
+ const safeValue = key === "workingDirectory" && typeof value === "string"
136
+ ? value.replaceAll("\\", "/")
137
+ : value;
135
138
  // Use split/join instead of replaceAll to avoid JavaScript's special
136
139
  // replacement patterns ($', $`, $&) being interpreted in the value.
137
140
  // See: https://github.com/gsd-build/gsd-2/issues/2968
138
- content = content.split(`{{${key}}}`).join(value);
141
+ content = content.split(`{{${key}}}`).join(safeValue);
139
142
  }
140
143
  return content.trim();
141
144
  }
@@ -0,0 +1,126 @@
1
+ /**
2
+ * GSD Prompt Validation — Validates enhanced context and turn output
3
+ * artifacts before writing.
4
+ *
5
+ * Implements R109 validation requirement: CONTEXT.md must have required
6
+ * sections before being written to disk. Additionally, per-turn validators
7
+ * check that artifacts produced by gate-owning turns contain the gate
8
+ * sections declared in gate-registry.ts, so a malformed summary/validation
9
+ * markdown file cannot silently drop a quality gate.
10
+ */
11
+ import { getGatesForTurn } from "./gate-registry.js";
12
+ /**
13
+ * Validate that enhanced context content has all required sections.
14
+ *
15
+ * Required sections per R109:
16
+ * - Scope section (## Scope, ## Milestone Scope, or ## Why This Milestone)
17
+ * - Architectural Decisions section (## Architectural Decisions)
18
+ * - Acceptance Criteria section (## Acceptance Criteria or ## Final Integrated Acceptance)
19
+ *
20
+ * Additionally validates that the Architectural Decisions section contains
21
+ * at least one decision entry (### heading or **Decision marker).
22
+ *
23
+ * @param content - The enhanced context markdown content
24
+ * @returns ValidationResult with valid flag and list of missing sections
25
+ */
26
+ export function validateEnhancedContext(content) {
27
+ const missing = [];
28
+ // Required section 1: Scope (multiple acceptable header variants)
29
+ const hasScopeSection = /^## Scope\b/m.test(content) ||
30
+ /^## Milestone Scope\b/m.test(content) ||
31
+ /^## Why This Milestone\b/m.test(content);
32
+ if (!hasScopeSection) {
33
+ missing.push("Milestone Scope or Why This Milestone");
34
+ }
35
+ // Required section 2: Architectural Decisions
36
+ const hasArchitecturalDecisions = /^## Architectural Decisions\b/m.test(content);
37
+ if (!hasArchitecturalDecisions) {
38
+ missing.push("Architectural Decisions");
39
+ }
40
+ // Required section 3: Acceptance Criteria (multiple acceptable header variants)
41
+ const hasAcceptanceCriteria = /^## Acceptance Criteria\b/m.test(content) ||
42
+ /^## Final Integrated Acceptance\b/m.test(content);
43
+ if (!hasAcceptanceCriteria) {
44
+ missing.push("Acceptance Criteria");
45
+ }
46
+ // Additional validation: Architectural Decisions must have at least one entry
47
+ if (hasArchitecturalDecisions) {
48
+ // Extract the section content between ## Architectural Decisions and the next ## heading.
49
+ // Uses indexOf-based extraction instead of regex with \z (which is invalid in JavaScript
50
+ // regex — it's PCRE/Ruby syntax and JS treats it as literal 'z').
51
+ const sectionStart = content.indexOf("## Architectural Decisions");
52
+ if (sectionStart === -1) {
53
+ missing.push("Architectural Decisions");
54
+ }
55
+ else {
56
+ const afterHeading = content.slice(sectionStart + "## Architectural Decisions".length);
57
+ const nextSection = afterHeading.search(/^## /m);
58
+ const sectionContent = nextSection === -1 ? afterHeading : afterHeading.slice(0, nextSection);
59
+ // Check for actual decision entries:
60
+ // - ### heading (subsection per decision)
61
+ // - **Decision marker (inline decision format)
62
+ const hasDecisionEntry = /^### /m.test(sectionContent) || /^\*\*Decision/m.test(sectionContent);
63
+ if (!hasDecisionEntry) {
64
+ missing.push("At least one architectural decision entry");
65
+ }
66
+ }
67
+ }
68
+ return {
69
+ valid: missing.length === 0,
70
+ missing,
71
+ };
72
+ }
73
+ // ─── Per-Turn Gate Section Validators ─────────────────────────────────────
74
+ //
75
+ // Each validator checks that the artifact written by a turn contains a
76
+ // heading for every gate owned by that turn. The registry is the source
77
+ // of truth for which sections must exist; adding a new gate automatically
78
+ // flows through via `getGatesForTurn(turn)`.
79
+ /**
80
+ * Escape a string so it can be embedded safely inside a regular expression.
81
+ */
82
+ function escapeRegExp(value) {
83
+ return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
84
+ }
85
+ /**
86
+ * Validate that an artifact contains an `## H2` heading for every gate the
87
+ * named turn owns. Returns the list of missing gate section headers.
88
+ *
89
+ * Soft rule: a section counts as "present" if it is declared (H2 heading
90
+ * exists) — empty-body sections are allowed and handled by the tool
91
+ * handler, which will record such gates as `omitted`.
92
+ */
93
+ export function validateGateSections(content, turn) {
94
+ const missing = [];
95
+ for (const def of getGatesForTurn(turn)) {
96
+ const pattern = new RegExp(`^##\\s+${escapeRegExp(def.promptSection)}\\b`, "m");
97
+ if (!pattern.test(content)) {
98
+ missing.push(`${def.id} (## ${def.promptSection})`);
99
+ }
100
+ }
101
+ return { valid: missing.length === 0, missing };
102
+ }
103
+ /**
104
+ * Validate a SUMMARY.md produced by the complete-slice turn. Requires
105
+ * an H2 heading for every gate owned by complete-slice (e.g. Q8 →
106
+ * "## Operational Readiness"). Intended for use in the tool handler's
107
+ * pre-write checks or in the post-unit validation sweep.
108
+ */
109
+ export function validateSliceSummaryOutput(content) {
110
+ return validateGateSections(content, "complete-slice");
111
+ }
112
+ /**
113
+ * Validate a task SUMMARY.md produced by the execute-task turn. Only
114
+ * flags gates that are still pending for the task; skips the check
115
+ * when no rows are seeded (simple task).
116
+ */
117
+ export function validateTaskSummaryOutput(content) {
118
+ return validateGateSections(content, "execute-task");
119
+ }
120
+ /**
121
+ * Validate a VALIDATION.md produced by the validate-milestone turn.
122
+ * Requires an H2 heading for every MV gate declared in the registry.
123
+ */
124
+ export function validateMilestoneValidationOutput(content) {
125
+ return validateGateSections(content, "validate-milestone");
126
+ }
@@ -16,6 +16,8 @@ All relevant context has been preloaded below — the slice plan, all task summa
16
16
 
17
17
  {{inlinedContext}}
18
18
 
19
+ {{gatesToClose}}
20
+
19
21
  **Match effort to complexity.** A simple slice with 1-2 tasks needs a brief summary and lightweight verification. A complex slice with 5 tasks across multiple subsystems needs thorough verification and a detailed summary. Scale the work below accordingly.
20
22
 
21
23
  Then:
@@ -23,7 +25,7 @@ Then:
23
25
  2. {{skillActivation}}
24
26
  3. Run all slice-level verification checks defined in the slice plan. All must pass before marking the slice done. If any fail, fix them first. Task artifacts use a **flat file layout** directly inside `tasks/` (for example `T01-SUMMARY.md`, `T02-SUMMARY.md`) rather than per-task subdirectories. If you need to count or re-read task summaries during verification, use `find .gsd/milestones/{{milestoneId}}/slices/{{sliceId}}/tasks -name "*-SUMMARY.md"` or `ls .gsd/milestones/{{milestoneId}}/slices/{{sliceId}}/tasks/*-SUMMARY.md`. Never use `tasks/*/SUMMARY.md` — that glob expects subdirectories that do not exist.
25
27
  4. If the slice plan includes observability/diagnostic surfaces, confirm they work. Skip this for simple slices that don't have observability sections.
26
- 5. If the slice involved runtime behavior, fill the **Operational Readiness** section (Q8) in the slice summary: health signal, failure signal, recovery procedure, and monitoring gaps. Omit entirely for simple slices with no runtime concerns.
28
+ 5. Address every gate listed in the **Gates to Close** section above — each gate maps to a specific slice-summary section the handler inspects (for example, Q8 maps to **Operational Readiness**: health signal, failure signal, recovery procedure, and monitoring gaps). Leaving a section empty records the gate as `omitted`.
27
29
  6. If this slice produced evidence that a requirement changed status (Active → Validated, Active → Deferred, etc.), call `gsd_requirement_update` with the requirement ID, updated `status`, and `validation` evidence. Do NOT write `.gsd/REQUIREMENTS.md` directly — the engine renders it from the database.
28
30
  7. Prepare the slice completion content you will pass to `gsd_complete_slice` using the camelCase fields `milestoneId`, `sliceId`, `sliceTitle`, `oneLiner`, `narrative`, `verification`, and `uatContent`. Do **not** manually write `{{sliceSummaryPath}}`. Do **not** manually write `{{sliceUatPath}}` — the DB-backed tool is the canonical write path for both artifacts.
29
31
  8. Draft the UAT content you will pass as `uatContent` — a concrete UAT script with real test cases derived from the slice plan and task summaries. Include preconditions, numbered steps with expected outcomes, and edge cases. This must NOT be a placeholder or generic template — tailor every test case to what this slice actually built.
@@ -49,31 +49,132 @@ This happens ONCE, before the first round. The goal: your first questions should
49
49
 
50
50
  For subsequent rounds, continue investigating between rounds — check docs, search, or scout as needed to make each round's questions smarter. But the first-round investigation is mandatory and explicit. Distribute searches across turns rather than clustering them in one turn.
51
51
 
52
- ## Question Rounds
52
+ ## Layered Question Rounds
53
53
 
54
- Ask **1–3 questions per round**. Keep each round tightly focused on one or two of the depth checklist dimensions do not try to cover all six in one round.
54
+ Questions are organized into four layers. Each layer targets a specific depth dimension. At each layer: ask 1-3 open questions per round, investigate between rounds as needed, and gate before advancing.
55
55
 
56
- **If `{{structuredQuestionsAvailable}}` is `true`:** use `ask_user_questions` for each round. 1–3 questions per call, each as a separate question object. Keep option labels short (3–5 words). Always include a freeform "Other / let me explain" option. When the user picks that option or writes a long freeform answer, switch to plain text follow-up for that thread before resuming structured questions. **IMPORTANT: Call `ask_user_questions` exactly once per turn. Never make multiple calls with the same or overlapping questions — wait for the user's response before asking the next round.**
56
+ **Default to open questions.** Use `ask_user_questions` only when there are 2-3 genuinely distinct paths with clear tradeoffs (e.g., "REST vs GraphQL" or "Postgres vs SQLite"). For nuanced design questions, ask in plain text and let the user explain.
57
57
 
58
- **If `{{structuredQuestionsAvailable}}` is `false`:** ask questions in plain text. Keep each round to 1–3 focused questions. Wait for answers before asking the next round.
58
+ **If `{{structuredQuestionsAvailable}}` is `true`:** use `ask_user_questions` for binary/ternary choices. Keep option labels short (3-5 words). Always include a freeform "Other / let me explain" option. When the user picks that option or writes a long freeform answer, switch to plain text follow-up for that thread before resuming structured questions. **IMPORTANT: Call `ask_user_questions` exactly once per turn. Never make multiple calls with the same or overlapping questions — wait for the user's response before asking the next round.**
59
59
 
60
- After each answer set, investigate further if any answer opens a new unknown, then ask the next round.
60
+ **If `{{structuredQuestionsAvailable}}` is `false`:** ask questions in plain text. Keep each round to 1-3 focused questions. Wait for answers before asking the next round.
61
61
 
62
- ### Round cadence
62
+ **Incremental persistence:** After every 2 question rounds (across any layer), silently save a `{{milestoneId}}-CONTEXT-DRAFT.md` using `gsd_summary_save` with `artifact_type: "CONTEXT-DRAFT"` and `milestone_id: "{{milestoneId}}"`. This protects confirmed work against session crashes. Do NOT mention this save to the user.
63
63
 
64
- After each round of answers, decide whether you already have enough depth to write strong output.
64
+ ### Identify Work Type
65
65
 
66
- - **Incremental persistence:** After every 2 question rounds, silently save a `{{milestoneId}}-CONTEXT-DRAFT.md` using `gsd_summary_save` with `artifact_type: "CONTEXT-DRAFT"` and `milestone_id: "{{milestoneId}}"`. This protects confirmed work against session crashes. Do NOT mention this save to the user.
67
- - If not ready, continue to the next round immediately. Do **not** ask a meta "ready to wrap up?" question after every round.
68
- - **Depth-matching rule:** Simple, well-defined work needs fewer rounds — maybe 1–2. Large, ambiguous visions need more maybe 4+. Do not pad rounds to hit a number. Stop when the Depth Enforcement checklist below is fully satisfied.
69
- - Do not count the reflection step as a question round. Rounds start after reflection is confirmed.
70
- - When you genuinely believe the depth checklist is satisfied, move to the Depth Verification step below. Do not ask a separate "ready to wrap up?" gate the depth verification IS the gate.
66
+ Before starting Layer 1, identify the primary work type and state it:
67
+
68
+ "Based on your description and the codebase, this is primarily **[work type]** work."
69
+
70
+ Work types include: API/backend, UI/frontend, CLI/developer tool, data pipeline, ML/AI, infrastructure/platform, refactoring/migration, or a combination. The user can correct this. The classification shapes which questions deserve deep exploration at each layer.
71
+
72
+ ### Layer 1 — Scope
73
+
74
+ Resolve what's in and what's out. Ask about:
75
+ - Feature boundaries — what exactly ships in this milestone vs later
76
+ - Ambiguities in the user's description — anything you're unsure about, ask
77
+ - Dependencies — what does this work depend on, what depends on it
78
+ - Priority — if scope needs trimming, what matters most
79
+
80
+ Adapt depth to work type:
81
+ - **CLI work:** Focus on user mental model, command grammar, what existing commands do
82
+ - **Refactoring:** Focus on what changes vs what must stay identical
83
+
84
+ **Depth-matching:** Simple, well-defined scope may need 1 round. Ambiguous or large scope may need 3-4 rounds. Don't pad rounds to hit a number.
85
+
86
+ #### Layer 1 Gate
87
+
88
+ Summarize scope decisions in the user's own terminology:
89
+ - What's included, what's excluded, what's deferred
90
+ - Key boundaries and constraints
91
+
92
+ Then ask: **"Does this capture the scope? Adjust anything before we move on."**
93
+
94
+ If the user adjusts, reflect the updated understanding and ask again. Do not advance until the user explicitly confirms. If the user says "looks good, let's move faster" at any gate, respect that and advance.
95
+
96
+ ---
97
+
98
+ ### Layer 2 — Architecture
99
+
100
+ Resolve how it's built. Ask about:
101
+ - Per-slice technical decisions — what approach for each major piece
102
+ - Inter-slice contracts — how do the pieces connect
103
+ - Library/framework choices — with evidence from investigation, not assumptions
104
+ - Integration with existing code — what patterns to follow, what to change
105
+
106
+ Adapt depth to work type:
107
+ - **API work:** Contracts, versioning, backwards compatibility, auth boundaries
108
+ - **UI work:** Component boundaries, state management, data flow
109
+ - **Infrastructure:** Deployment topology, failure domains, rollback
110
+
111
+ Between rounds, use your available web search tools to research technologies from the Codebase Brief. Search for "[technology] [version] best practices [current year]" and "[technology] [version] known issues". Present findings alongside your questions.
112
+
113
+ #### Layer 2 Gate
114
+
115
+ Summarize architecture decisions, each with:
116
+ - The decision and rationale
117
+ - Evidence source (codebase patterns, library docs, web research)
118
+ - Alternatives considered
119
+
120
+ Then ask: **"Does this capture the architecture? Adjust anything before we move on."**
121
+
122
+ Same gate rules: reflect adjustments, wait for confirmation.
123
+
124
+ ---
125
+
126
+ ### Layer 3 — Error States
127
+
128
+ Resolve what happens when things fail. Present this layer with an option:
129
+
130
+ "We can go deep on error handling and failure modes, or I can apply sensible defaults based on the architecture decisions above. Which do you prefer?"
131
+
132
+ If the user chooses defaults, summarize what the defaults are and gate. If the user chooses to go deep, ask about:
133
+ - Failure modes for each major component
134
+ - Error propagation between layers (API → frontend, service → database)
135
+ - Timeout, retry, and circuit-breaker strategies
136
+ - What the user sees when something fails
137
+
138
+ Adapt depth to work type:
139
+ - **API work:** Rate limiting, timeout cascades, partial failure, status codes
140
+ - **UI work:** Loading states, optimistic updates, offline behavior, error boundaries
141
+ - **Data pipelines:** Data corruption, checkpoint recovery, idempotency
142
+
143
+ #### Layer 3 Gate
144
+
145
+ Summarize error handling strategy. Then ask: **"Does this capture how errors should be handled? Adjust anything before we move on."**
146
+
147
+ ---
148
+
149
+ ### Layer 4 — Quality Bar
150
+
151
+ Resolve what "done" means concretely. Ask about:
152
+ - Per-slice acceptance criteria — specific enough for automated verification
153
+ - Test strategy — what types of tests, what coverage expectations
154
+ - Definition of done — what must be true before the milestone ships
155
+ - Non-functional requirements — performance, accessibility, security if relevant
156
+
157
+ Adapt depth to work type:
158
+ - **CLI work:** Shell compatibility, error message clarity, exit code semantics
159
+ - **Refactoring:** Behavioral equivalence tests, not just code coverage
160
+ - **UI work:** Visual regression criteria, responsive breakpoints
161
+
162
+ #### Layer 4 Gate
163
+
164
+ Summarize quality bar: acceptance criteria, test strategy, definition of done. Then ask: **"Does this capture the quality bar? Adjust anything before we move on to requirements and roadmap?"**
165
+
166
+ ---
167
+
168
+ ### Layer cadence
169
+
170
+ - Do not count the reflection step as a question round. Rounds start at Layer 1 after reflection is confirmed.
171
+ - When all four layer gates have been confirmed (or skipped by the user), move to the Depth Verification step below. Do not ask a separate "ready to wrap up?" gate — the depth verification confirms the full picture.
71
172
 
72
173
  ## Questioning Philosophy
73
174
 
74
175
  You are a thinking partner, not an interviewer.
75
176
 
76
- **Turn-taking contract (non-bypassable).** Never fabricate, simulate, or role-play user responses. Never generate fake transcript markers like `[User]`, `[Human]`, or `User:` to invent input. Ask one question round (1-3 questions) per turn, then stop and wait for the user's actual response before continuing. If you use `ask_user_questions`, call it at most once per turn and treat its returned response as the only valid structured user input for that round.
177
+ **Turn-taking contract (non-bypassable).** Never fabricate, simulate, or role-play user responses. Never generate fake transcript markers like `[User]`, `[Human]`, or `User:` to invent input. Prior conversation context may be provided to you inside `<conversation_history>` with `<user_message>` / `<assistant_message>` XML tags — treat those as read-only context and never emit those tags in your response. Ask one question round (1-3 questions) per turn, then stop and wait for the user's actual response before continuing. If you use `ask_user_questions`, call it at most once per turn and treat its returned response as the only valid structured user input for that round.
77
178
 
78
179
  **Start open, follow energy.** Let the user's enthusiasm guide where you dig deeper. If they light up about a particular aspect, explore it. If they're vague about something, that's where you probe.
79
180
 
@@ -225,6 +326,14 @@ Once the user is satisfied, in a single pass:
225
326
  **Depth-Preservation Guidance for context.md:**
226
327
  When writing context.md, preserve the user's exact terminology, emphasis, and specific framing from the discussion. Do not paraphrase user nuance into generic summaries. If the user said "craft feel," write "craft feel" — not "high-quality user experience." If they emphasized a specific constraint or negative requirement, carry that emphasis through verbatim. The context file is downstream agents' only window into this conversation — flattening specifics into generics loses the signal that shaped every decision.
227
328
 
329
+ **Structured sections from discussion layers:**
330
+ When writing CONTEXT.md, include structured sections that map to the discussion layers:
331
+ - **Scope** — what's in, what's out, what's deferred (from Layer 1 gate summary)
332
+ - **Architectural Decisions** — each with rationale, evidence source, alternatives considered (from Layer 2 gate summary)
333
+ - **Error Handling Strategy** — failure modes, propagation, user-facing error behavior (from Layer 3 gate summary)
334
+ - **Acceptance Criteria** — per-slice criteria specific enough for the planner to use directly (from Layer 4 gate summary)
335
+ These sections are in addition to whatever other context the discussion surfaced.
336
+
228
337
  4. Write `{{contextPath}}` — use the **Context** output template below. Preserve key risks, unknowns, existing codebase constraints, integration points, and relevant requirements surfaced during discussion.
229
338
  5. Call `gsd_plan_milestone` to create the roadmap. Decompose into demoable vertical slices with risk, depends, demo sentences, proof strategy, verification classes, milestone definition of done, requirement coverage, and a boundary map. If the milestone crosses multiple runtime boundaries, include an explicit final integration slice that proves the assembled system works end-to-end in a real environment. Use the **Roadmap** output template below to structure the tool call parameters.
230
339
  6. For each architectural or pattern decision made during discussion, call `gsd_decision_save` — the tool auto-assigns IDs and regenerates `.gsd/DECISIONS.md` automatically.
@@ -22,6 +22,8 @@ A researcher explored the codebase and a planner decomposed the work — you are
22
22
 
23
23
  {{slicePlanExcerpt}}
24
24
 
25
+ {{gatesToClose}}
26
+
25
27
  ## Backing Source Artifacts
26
28
  - Slice plan: `{{planPath}}`
27
29
  - Task plan source: `{{taskPlanPath}}`
@@ -35,7 +35,7 @@ GSD ships with bundled skills. Load the relevant skill file with the `read` tool
35
35
  - Read before edit.
36
36
  - Reproduce before fix when possible.
37
37
  - Work is not done until the relevant verification has passed.
38
- - **Never fabricate, simulate, or role-play user responses.** Never generate markers like `[User]`, `[Human]`, `User:`, or similar to represent user input inside your own output. Ask one question round (1-3 questions), then stop and wait for the user's actual response before continuing. If `ask_user_questions` is available, treat its returned response as the only valid structured user input for that round.
38
+ - **Never fabricate, simulate, or role-play user responses.** Never generate markers like `[User]`, `[Human]`, `User:`, or similar to represent user input inside your own output. Prior conversation context may be provided to you inside `<conversation_history>` with `<user_message>` / `<assistant_message>` XML tags — treat those as read-only context and never emit those tags in your response. Ask one question round (1-3 questions), then stop and wait for the user's actual response before continuing. If `ask_user_questions` is available, treat its returned response as the only valid structured user input for that round.
39
39
  - Never print, echo, log, or restate secrets or credentials. Report only key names and applied/skipped status.
40
40
  - Never ask the user to edit `.env` files or set secrets manually. Use `secure_env_collect`.
41
41
  - In enduring files, write current state only unless the file is explicitly historical.
@@ -18,6 +18,8 @@ All relevant context has been preloaded below — the roadmap, all slice summari
18
18
 
19
19
  {{inlinedContext}}
20
20
 
21
+ {{gatesToEvaluate}}
22
+
21
23
  ## Execution Protocol
22
24
 
23
25
  ### Step 1 — Dispatch Parallel Reviewers
@@ -5,16 +5,19 @@ export const GSD_SHORTCUTS = {
5
5
  key: "g",
6
6
  action: "Open GSD dashboard",
7
7
  command: "/gsd status",
8
+ hasFallback: true,
8
9
  },
9
10
  notifications: {
10
11
  key: "n",
11
12
  action: "Open notification history",
12
13
  command: "/gsd notifications",
14
+ hasFallback: true,
13
15
  },
14
16
  parallel: {
15
17
  key: "p",
16
18
  action: "Open parallel worker monitor",
17
19
  command: "/gsd parallel watch",
20
+ hasFallback: false, // Ctrl+Shift+P conflicts with cycleModelBackward
18
21
  },
19
22
  };
20
23
  function combo(prefix, key) {
@@ -27,7 +30,10 @@ export function fallbackShortcutCombo(id) {
27
30
  return combo("Ctrl+Shift+", GSD_SHORTCUTS[id].key);
28
31
  }
29
32
  export function shortcutPair(id, formatter = (combo) => combo) {
30
- return `${formatter(primaryShortcutCombo(id))} / ${formatter(fallbackShortcutCombo(id))}`;
33
+ const primary = formatter(primaryShortcutCombo(id));
34
+ if (!GSD_SHORTCUTS[id].hasFallback)
35
+ return primary;
36
+ return `${primary} / ${formatter(fallbackShortcutCombo(id))}`;
31
37
  }
32
38
  export function formattedShortcutPair(id) {
33
39
  return shortcutPair(id, formatShortcut);