gsd-pi 2.79.0-dev.ece5fd8ba → 2.80.0-dev.4ea7d80e7

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 (681) hide show
  1. package/dist/resources/.managed-resources-content-hash +1 -1
  2. package/dist/resources/extensions/github-sync/templates.js +90 -74
  3. package/dist/resources/extensions/gsd/auto/contracts.js +1 -0
  4. package/dist/resources/extensions/gsd/auto/custom-verify-retry-store.js +53 -0
  5. package/dist/resources/extensions/gsd/auto/loop.js +365 -522
  6. package/dist/resources/extensions/gsd/auto/orchestrator.js +146 -0
  7. package/dist/resources/extensions/gsd/auto/phases.js +55 -6
  8. package/dist/resources/extensions/gsd/auto/run-unit.js +19 -15
  9. package/dist/resources/extensions/gsd/auto/session.js +8 -0
  10. package/dist/resources/extensions/gsd/auto/workflow-custom-engine-dispatch-outcome.js +12 -0
  11. package/dist/resources/extensions/gsd/auto/workflow-custom-engine-iteration.js +24 -0
  12. package/dist/resources/extensions/gsd/auto/workflow-custom-engine-reconcile-outcome.js +33 -0
  13. package/dist/resources/extensions/gsd/auto/workflow-custom-engine-reconcile.js +26 -0
  14. package/dist/resources/extensions/gsd/auto/workflow-custom-engine-retry.js +49 -0
  15. package/dist/resources/extensions/gsd/auto/workflow-custom-engine-verify-outcome.js +25 -0
  16. package/dist/resources/extensions/gsd/auto/workflow-dispatch-claim.js +48 -0
  17. package/dist/resources/extensions/gsd/auto/workflow-dispatch-ledger.js +26 -0
  18. package/dist/resources/extensions/gsd/auto/workflow-iteration-completion.js +10 -0
  19. package/dist/resources/extensions/gsd/auto/workflow-journal-reporter.js +16 -0
  20. package/dist/resources/extensions/gsd/auto/workflow-kernel.js +263 -0
  21. package/dist/resources/extensions/gsd/auto/workflow-memory-pressure.js +36 -0
  22. package/dist/resources/extensions/gsd/auto/workflow-phase-reporter.js +9 -0
  23. package/dist/resources/extensions/gsd/auto/workflow-session-lock.js +35 -0
  24. package/dist/resources/extensions/gsd/auto/workflow-sidecar-iteration.js +24 -0
  25. package/dist/resources/extensions/gsd/auto/workflow-sidecar-queue.js +26 -0
  26. package/dist/resources/extensions/gsd/auto/workflow-turn-reporter.js +36 -0
  27. package/dist/resources/extensions/gsd/auto/workflow-unit-dispatch.js +44 -0
  28. package/dist/resources/extensions/gsd/auto/workflow-worker-heartbeat.js +15 -0
  29. package/dist/resources/extensions/gsd/auto-dashboard.js +54 -15
  30. package/dist/resources/extensions/gsd/auto-dispatch.js +10 -0
  31. package/dist/resources/extensions/gsd/auto-prompts.js +168 -3
  32. package/dist/resources/extensions/gsd/auto-recovery.js +198 -59
  33. package/dist/resources/extensions/gsd/auto-runtime-state.js +4 -0
  34. package/dist/resources/extensions/gsd/auto-start.js +2 -3
  35. package/dist/resources/extensions/gsd/auto-verification.js +2 -11
  36. package/dist/resources/extensions/gsd/auto-worktree.js +87 -38
  37. package/dist/resources/extensions/gsd/auto.js +168 -3
  38. package/dist/resources/extensions/gsd/bootstrap/agent-end-recovery.js +24 -2
  39. package/dist/resources/extensions/gsd/bootstrap/db-tools.js +10 -0
  40. package/dist/resources/extensions/gsd/bootstrap/register-hooks.js +22 -6
  41. package/dist/resources/extensions/gsd/bootstrap/write-gate.js +129 -1
  42. package/dist/resources/extensions/gsd/commands-extract-learnings.js +17 -12
  43. package/dist/resources/extensions/gsd/commands-ship.js +23 -46
  44. package/dist/resources/extensions/gsd/commands-workflow-templates.js +12 -7
  45. package/dist/resources/extensions/gsd/component-loader.js +5 -11
  46. package/dist/resources/extensions/gsd/custom-workflow-engine.js +25 -1
  47. package/dist/resources/extensions/gsd/db-adapter.js +47 -0
  48. package/dist/resources/extensions/gsd/db-base-schema.js +351 -0
  49. package/dist/resources/extensions/gsd/db-connection-cache.js +31 -0
  50. package/dist/resources/extensions/gsd/db-coordination-schema.js +104 -0
  51. package/dist/resources/extensions/gsd/db-decision-requirement-rows.js +71 -0
  52. package/dist/resources/extensions/gsd/db-gate-rows.js +16 -0
  53. package/dist/resources/extensions/gsd/db-lightweight-query-rows.js +29 -0
  54. package/dist/resources/extensions/gsd/db-memory-fts-schema.js +56 -0
  55. package/dist/resources/extensions/gsd/db-migration-backup.js +22 -0
  56. package/dist/resources/extensions/gsd/db-migration-steps.js +410 -0
  57. package/dist/resources/extensions/gsd/db-milestone-artifact-rows.js +35 -0
  58. package/dist/resources/extensions/gsd/db-open-state.js +32 -0
  59. package/dist/resources/extensions/gsd/db-provider.js +108 -0
  60. package/dist/resources/extensions/gsd/db-runtime-kv-schema.js +27 -0
  61. package/dist/resources/extensions/gsd/db-schema-metadata.js +23 -0
  62. package/dist/resources/extensions/gsd/db-task-slice-rows.js +86 -0
  63. package/dist/resources/extensions/gsd/db-transaction.js +63 -0
  64. package/dist/resources/extensions/gsd/db-verification-evidence-rows.js +3 -0
  65. package/dist/resources/extensions/gsd/db-verification-evidence-schema.js +19 -0
  66. package/dist/resources/extensions/gsd/escalation.js +2 -0
  67. package/dist/resources/extensions/gsd/graph.js +9 -3
  68. package/dist/resources/extensions/gsd/gsd-db.js +316 -1520
  69. package/dist/resources/extensions/gsd/guided-flow.js +2 -2
  70. package/dist/resources/extensions/gsd/legacy-telemetry.js +70 -0
  71. package/dist/resources/extensions/gsd/markdown-renderer.js +2 -0
  72. package/dist/resources/extensions/gsd/model-router.js +9 -6
  73. package/dist/resources/extensions/gsd/notification-widget.js +21 -3
  74. package/dist/resources/extensions/gsd/post-execution-checks.js +27 -6
  75. package/dist/resources/extensions/gsd/pr-evidence.js +117 -0
  76. package/dist/resources/extensions/gsd/pre-execution-checks.js +2 -0
  77. package/dist/resources/extensions/gsd/process-task-path.js +61 -0
  78. package/dist/resources/extensions/gsd/prompt-loader.js +9 -5
  79. package/dist/resources/extensions/gsd/prompts/complete-milestone.md +32 -30
  80. package/dist/resources/extensions/gsd/prompts/complete-slice.md +23 -34
  81. package/dist/resources/extensions/gsd/prompts/discuss-headless.md +50 -96
  82. package/dist/resources/extensions/gsd/prompts/discuss.md +81 -181
  83. package/dist/resources/extensions/gsd/prompts/execute-task.md +40 -67
  84. package/dist/resources/extensions/gsd/prompts/forensics.md +41 -84
  85. package/dist/resources/extensions/gsd/prompts/guided-discuss-milestone.md +29 -39
  86. package/dist/resources/extensions/gsd/prompts/guided-discuss-project.md +30 -65
  87. package/dist/resources/extensions/gsd/prompts/guided-discuss-requirements.md +25 -52
  88. package/dist/resources/extensions/gsd/prompts/guided-discuss-slice.md +36 -36
  89. package/dist/resources/extensions/gsd/prompts/guided-research-project.md +20 -38
  90. package/dist/resources/extensions/gsd/prompts/plan-milestone.md +45 -59
  91. package/dist/resources/extensions/gsd/prompts/plan-slice.md +25 -87
  92. package/dist/resources/extensions/gsd/prompts/queue.md +46 -53
  93. package/dist/resources/extensions/gsd/prompts/refine-slice.md +23 -23
  94. package/dist/resources/extensions/gsd/prompts/research-slice.md +23 -23
  95. package/dist/resources/extensions/gsd/prompts/rethink.md +10 -10
  96. package/dist/resources/extensions/gsd/prompts/system.md +65 -107
  97. package/dist/resources/extensions/gsd/prompts/triage-captures.md +15 -15
  98. package/dist/resources/extensions/gsd/prompts/validate-milestone.md +24 -24
  99. package/dist/resources/extensions/gsd/prompts/worktree-merge.md +35 -35
  100. package/dist/resources/extensions/gsd/state.js +4 -0
  101. package/dist/resources/extensions/gsd/tools/complete-milestone.js +14 -9
  102. package/dist/resources/extensions/gsd/tools/complete-task.js +2 -0
  103. package/dist/resources/extensions/gsd/tools/workflow-tool-executors.js +6 -1
  104. package/dist/resources/extensions/gsd/unit-context-composer.js +1 -1
  105. package/dist/resources/extensions/gsd/uok/kernel.js +8 -3
  106. package/dist/resources/extensions/gsd/uok/plan-v2.js +2 -0
  107. package/dist/resources/extensions/gsd/workflow-logger.js +13 -13
  108. package/dist/resources/extensions/gsd/workflow-manifest.js +2 -0
  109. package/dist/resources/extensions/gsd/workflow-projections.js +2 -0
  110. package/dist/resources/extensions/gsd/workflow-templates.js +9 -0
  111. package/dist/resources/extensions/gsd/working-output-messages.js +64 -0
  112. package/dist/resources/extensions/shared/interview-ui.js +15 -4
  113. package/dist/tsconfig.extensions.tsbuildinfo +1 -1
  114. package/dist/web/standalone/.next/BUILD_ID +1 -1
  115. package/dist/web/standalone/.next/app-path-routes-manifest.json +14 -14
  116. package/dist/web/standalone/.next/build-manifest.json +3 -3
  117. package/dist/web/standalone/.next/prerender-manifest.json +3 -3
  118. package/dist/web/standalone/.next/react-loadable-manifest.json +1 -1
  119. package/dist/web/standalone/.next/required-server-files.json +1 -1
  120. package/dist/web/standalone/.next/server/app/_global-error.html +1 -1
  121. package/dist/web/standalone/.next/server/app/_global-error.rsc +1 -1
  122. package/dist/web/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  123. package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  124. package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  125. package/dist/web/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  126. package/dist/web/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  127. package/dist/web/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  128. package/dist/web/standalone/.next/server/app/_not-found.html +1 -1
  129. package/dist/web/standalone/.next/server/app/_not-found.rsc +1 -1
  130. package/dist/web/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
  131. package/dist/web/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  132. package/dist/web/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
  133. package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  134. package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  135. package/dist/web/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  136. package/dist/web/standalone/.next/server/app/api/boot/route.js +1 -1
  137. package/dist/web/standalone/.next/server/app/api/boot/route.js.nft.json +1 -1
  138. package/dist/web/standalone/.next/server/app/api/bridge-terminal/input/route.js +1 -1
  139. package/dist/web/standalone/.next/server/app/api/bridge-terminal/input/route.js.nft.json +1 -1
  140. package/dist/web/standalone/.next/server/app/api/bridge-terminal/resize/route.js +1 -1
  141. package/dist/web/standalone/.next/server/app/api/bridge-terminal/resize/route.js.nft.json +1 -1
  142. package/dist/web/standalone/.next/server/app/api/bridge-terminal/stream/route.js +1 -1
  143. package/dist/web/standalone/.next/server/app/api/bridge-terminal/stream/route.js.nft.json +1 -1
  144. package/dist/web/standalone/.next/server/app/api/captures/route.js +1 -1
  145. package/dist/web/standalone/.next/server/app/api/captures/route.js.nft.json +1 -1
  146. package/dist/web/standalone/.next/server/app/api/cleanup/route.js +1 -1
  147. package/dist/web/standalone/.next/server/app/api/cleanup/route.js.nft.json +1 -1
  148. package/dist/web/standalone/.next/server/app/api/doctor/route.js +1 -1
  149. package/dist/web/standalone/.next/server/app/api/doctor/route.js.nft.json +1 -1
  150. package/dist/web/standalone/.next/server/app/api/export-data/route.js +1 -1
  151. package/dist/web/standalone/.next/server/app/api/export-data/route.js.nft.json +1 -1
  152. package/dist/web/standalone/.next/server/app/api/files/route.js +1 -1
  153. package/dist/web/standalone/.next/server/app/api/files/route.js.nft.json +1 -1
  154. package/dist/web/standalone/.next/server/app/api/forensics/route.js +1 -1
  155. package/dist/web/standalone/.next/server/app/api/forensics/route.js.nft.json +1 -1
  156. package/dist/web/standalone/.next/server/app/api/git/route.js +1 -1
  157. package/dist/web/standalone/.next/server/app/api/git/route.js.nft.json +1 -1
  158. package/dist/web/standalone/.next/server/app/api/history/route.js +1 -1
  159. package/dist/web/standalone/.next/server/app/api/history/route.js.nft.json +1 -1
  160. package/dist/web/standalone/.next/server/app/api/hooks/route.js +1 -1
  161. package/dist/web/standalone/.next/server/app/api/hooks/route.js.nft.json +1 -1
  162. package/dist/web/standalone/.next/server/app/api/inspect/route.js +1 -1
  163. package/dist/web/standalone/.next/server/app/api/inspect/route.js.nft.json +1 -1
  164. package/dist/web/standalone/.next/server/app/api/knowledge/route.js +1 -1
  165. package/dist/web/standalone/.next/server/app/api/knowledge/route.js.nft.json +1 -1
  166. package/dist/web/standalone/.next/server/app/api/live-state/route.js +1 -1
  167. package/dist/web/standalone/.next/server/app/api/live-state/route.js.nft.json +1 -1
  168. package/dist/web/standalone/.next/server/app/api/notifications/route.js +1 -1
  169. package/dist/web/standalone/.next/server/app/api/notifications/route.js.nft.json +1 -1
  170. package/dist/web/standalone/.next/server/app/api/onboarding/route.js +1 -1
  171. package/dist/web/standalone/.next/server/app/api/onboarding/route.js.nft.json +1 -1
  172. package/dist/web/standalone/.next/server/app/api/projects/route.js +1 -1
  173. package/dist/web/standalone/.next/server/app/api/projects/route.js.nft.json +1 -1
  174. package/dist/web/standalone/.next/server/app/api/recovery/route.js +1 -1
  175. package/dist/web/standalone/.next/server/app/api/recovery/route.js.nft.json +1 -1
  176. package/dist/web/standalone/.next/server/app/api/session/browser/route.js +1 -1
  177. package/dist/web/standalone/.next/server/app/api/session/browser/route.js.nft.json +1 -1
  178. package/dist/web/standalone/.next/server/app/api/session/command/route.js +1 -1
  179. package/dist/web/standalone/.next/server/app/api/session/command/route.js.nft.json +1 -1
  180. package/dist/web/standalone/.next/server/app/api/session/events/route.js +1 -1
  181. package/dist/web/standalone/.next/server/app/api/session/events/route.js.nft.json +1 -1
  182. package/dist/web/standalone/.next/server/app/api/session/manage/route.js +1 -1
  183. package/dist/web/standalone/.next/server/app/api/session/manage/route.js.nft.json +1 -1
  184. package/dist/web/standalone/.next/server/app/api/settings-data/route.js +1 -1
  185. package/dist/web/standalone/.next/server/app/api/settings-data/route.js.nft.json +1 -1
  186. package/dist/web/standalone/.next/server/app/api/skill-health/route.js +1 -1
  187. package/dist/web/standalone/.next/server/app/api/skill-health/route.js.nft.json +1 -1
  188. package/dist/web/standalone/.next/server/app/api/steer/route.js +1 -1
  189. package/dist/web/standalone/.next/server/app/api/steer/route.js.nft.json +1 -1
  190. package/dist/web/standalone/.next/server/app/api/switch-root/route.js +1 -1
  191. package/dist/web/standalone/.next/server/app/api/switch-root/route.js.nft.json +1 -1
  192. package/dist/web/standalone/.next/server/app/api/terminal/sessions/route.js +1 -1
  193. package/dist/web/standalone/.next/server/app/api/terminal/sessions/route.js.nft.json +1 -1
  194. package/dist/web/standalone/.next/server/app/api/terminal/stream/route.js +1 -1
  195. package/dist/web/standalone/.next/server/app/api/terminal/stream/route.js.nft.json +1 -1
  196. package/dist/web/standalone/.next/server/app/api/undo/route.js +1 -1
  197. package/dist/web/standalone/.next/server/app/api/undo/route.js.nft.json +1 -1
  198. package/dist/web/standalone/.next/server/app/api/visualizer/route.js +1 -1
  199. package/dist/web/standalone/.next/server/app/api/visualizer/route.js.nft.json +1 -1
  200. package/dist/web/standalone/.next/server/app/index.html +1 -1
  201. package/dist/web/standalone/.next/server/app/index.rsc +1 -1
  202. package/dist/web/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
  203. package/dist/web/standalone/.next/server/app/index.segments/_full.segment.rsc +1 -1
  204. package/dist/web/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
  205. package/dist/web/standalone/.next/server/app/index.segments/_index.segment.rsc +1 -1
  206. package/dist/web/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
  207. package/dist/web/standalone/.next/server/app-paths-manifest.json +14 -14
  208. package/dist/web/standalone/.next/server/chunks/167.js +2 -0
  209. package/dist/web/standalone/.next/server/chunks/6897.js +3 -3
  210. package/dist/web/standalone/.next/server/middleware-build-manifest.js +1 -1
  211. package/dist/web/standalone/.next/server/middleware-react-loadable-manifest.js +1 -1
  212. package/dist/web/standalone/.next/server/pages/404.html +1 -1
  213. package/dist/web/standalone/.next/server/pages/500.html +1 -1
  214. package/dist/web/standalone/.next/server/server-reference-manifest.json +1 -1
  215. package/dist/web/standalone/.next/static/chunks/{8336.6f6f30e410419aff.js → 8336.631939fb583761fa.js} +1 -1
  216. package/dist/web/standalone/.next/static/chunks/{webpack-d82dbee6356c1733.js → webpack-0481f1221120a7c6.js} +1 -1
  217. package/dist/web/standalone/package.json +1 -0
  218. package/dist/web/standalone/server.js +1 -1
  219. package/package.json +18 -7
  220. package/packages/contracts/dist/index.d.ts +3 -0
  221. package/packages/contracts/dist/index.d.ts.map +1 -0
  222. package/packages/contracts/dist/index.js +5 -0
  223. package/packages/contracts/dist/index.js.map +1 -0
  224. package/packages/contracts/dist/rpc.d.ts +549 -0
  225. package/packages/contracts/dist/rpc.d.ts.map +1 -0
  226. package/packages/contracts/dist/rpc.js +53 -0
  227. package/packages/contracts/dist/rpc.js.map +1 -0
  228. package/packages/contracts/dist/rpc.test.d.ts +2 -0
  229. package/packages/contracts/dist/rpc.test.d.ts.map +1 -0
  230. package/packages/contracts/dist/rpc.test.js +47 -0
  231. package/packages/contracts/dist/rpc.test.js.map +1 -0
  232. package/packages/contracts/dist/workflow.d.ts +180 -0
  233. package/packages/contracts/dist/workflow.d.ts.map +1 -0
  234. package/packages/contracts/dist/workflow.js +201 -0
  235. package/packages/contracts/dist/workflow.js.map +1 -0
  236. package/packages/contracts/package.json +39 -0
  237. package/packages/contracts/src/index.ts +5 -0
  238. package/packages/contracts/src/rpc.test.ts +72 -0
  239. package/packages/contracts/src/rpc.ts +286 -0
  240. package/packages/contracts/src/workflow.ts +213 -0
  241. package/packages/contracts/tsconfig.json +25 -0
  242. package/packages/daemon/package.json +3 -2
  243. package/packages/daemon/src/event-bridge.test.ts +2 -1
  244. package/packages/daemon/src/event-bridge.ts +1 -1
  245. package/packages/daemon/src/event-formatter.test.ts +1 -2
  246. package/packages/daemon/src/event-formatter.ts +1 -2
  247. package/packages/daemon/src/session-manager.ts +2 -2
  248. package/packages/daemon/src/types.ts +3 -18
  249. package/packages/mcp-server/dist/server.d.ts +13 -0
  250. package/packages/mcp-server/dist/server.d.ts.map +1 -1
  251. package/packages/mcp-server/dist/server.js +77 -0
  252. package/packages/mcp-server/dist/server.js.map +1 -1
  253. package/packages/mcp-server/dist/session-manager.js +1 -1
  254. package/packages/mcp-server/dist/session-manager.js.map +1 -1
  255. package/packages/mcp-server/dist/types.d.ts +3 -11
  256. package/packages/mcp-server/dist/types.d.ts.map +1 -1
  257. package/packages/mcp-server/dist/types.js.map +1 -1
  258. package/packages/mcp-server/dist/workflow-tools.d.ts +1 -1
  259. package/packages/mcp-server/dist/workflow-tools.d.ts.map +1 -1
  260. package/packages/mcp-server/dist/workflow-tools.js +2 -40
  261. package/packages/mcp-server/dist/workflow-tools.js.map +1 -1
  262. package/packages/mcp-server/package.json +3 -2
  263. package/packages/mcp-server/src/mcp-server.test.ts +138 -0
  264. package/packages/mcp-server/src/server.ts +99 -1
  265. package/packages/mcp-server/src/session-manager.ts +2 -2
  266. package/packages/mcp-server/src/types.ts +7 -18
  267. package/packages/mcp-server/src/workflow-tools.ts +2 -40
  268. package/packages/mcp-server/tsconfig.tsbuildinfo +1 -1
  269. package/packages/native/package.json +1 -1
  270. package/packages/pi-agent-core/package.json +1 -1
  271. package/packages/pi-ai/dist/models/fake-model.d.ts +12 -0
  272. package/packages/pi-ai/dist/models/fake-model.d.ts.map +1 -0
  273. package/packages/pi-ai/dist/models/fake-model.js +27 -0
  274. package/packages/pi-ai/dist/models/fake-model.js.map +1 -0
  275. package/packages/pi-ai/dist/models/index.d.ts.map +1 -1
  276. package/packages/pi-ai/dist/models/index.js +8 -0
  277. package/packages/pi-ai/dist/models/index.js.map +1 -1
  278. package/packages/pi-ai/dist/providers/fake.d.ts +42 -0
  279. package/packages/pi-ai/dist/providers/fake.d.ts.map +1 -0
  280. package/packages/pi-ai/dist/providers/fake.js +319 -0
  281. package/packages/pi-ai/dist/providers/fake.js.map +1 -0
  282. package/packages/pi-ai/dist/providers/register-builtins.d.ts.map +1 -1
  283. package/packages/pi-ai/dist/providers/register-builtins.js +24 -0
  284. package/packages/pi-ai/dist/providers/register-builtins.js.map +1 -1
  285. package/packages/pi-ai/package.json +1 -1
  286. package/packages/pi-ai/src/models/fake-model.ts +30 -0
  287. package/packages/pi-ai/src/models/index.ts +9 -0
  288. package/packages/pi-ai/src/providers/fake.ts +376 -0
  289. package/packages/pi-ai/src/providers/register-builtins.ts +23 -0
  290. package/packages/pi-ai/tsconfig.tsbuildinfo +1 -1
  291. package/packages/pi-coding-agent/dist/core/chat-controller-ordering.test.js +74 -0
  292. package/packages/pi-coding-agent/dist/core/chat-controller-ordering.test.js.map +1 -1
  293. package/packages/pi-coding-agent/dist/core/extensions/runner.d.ts +2 -0
  294. package/packages/pi-coding-agent/dist/core/extensions/runner.d.ts.map +1 -1
  295. package/packages/pi-coding-agent/dist/core/extensions/runner.js +14 -1
  296. package/packages/pi-coding-agent/dist/core/extensions/runner.js.map +1 -1
  297. package/packages/pi-coding-agent/dist/core/extensions/runner.test.js +97 -0
  298. package/packages/pi-coding-agent/dist/core/extensions/runner.test.js.map +1 -1
  299. package/packages/pi-coding-agent/dist/core/model-registry.d.ts.map +1 -1
  300. package/packages/pi-coding-agent/dist/core/model-registry.js +5 -0
  301. package/packages/pi-coding-agent/dist/core/model-registry.js.map +1 -1
  302. package/packages/pi-coding-agent/dist/core/settings-manager.d.ts +4 -0
  303. package/packages/pi-coding-agent/dist/core/settings-manager.d.ts.map +1 -1
  304. package/packages/pi-coding-agent/dist/core/settings-manager.js +8 -0
  305. package/packages/pi-coding-agent/dist/core/settings-manager.js.map +1 -1
  306. package/packages/pi-coding-agent/dist/core/slash-commands.d.ts.map +1 -1
  307. package/packages/pi-coding-agent/dist/core/slash-commands.js +1 -0
  308. package/packages/pi-coding-agent/dist/core/slash-commands.js.map +1 -1
  309. package/packages/pi-coding-agent/dist/modes/interactive/components/__tests__/chat-frame-compaction-tone.test.js +6 -4
  310. package/packages/pi-coding-agent/dist/modes/interactive/components/__tests__/chat-frame-compaction-tone.test.js.map +1 -1
  311. package/packages/pi-coding-agent/dist/modes/interactive/components/__tests__/tool-execution.test.js +67 -14
  312. package/packages/pi-coding-agent/dist/modes/interactive/components/__tests__/tool-execution.test.js.map +1 -1
  313. package/packages/pi-coding-agent/dist/modes/interactive/components/adaptive-layout.d.ts +26 -0
  314. package/packages/pi-coding-agent/dist/modes/interactive/components/adaptive-layout.d.ts.map +1 -0
  315. package/packages/pi-coding-agent/dist/modes/interactive/components/adaptive-layout.js +112 -0
  316. package/packages/pi-coding-agent/dist/modes/interactive/components/adaptive-layout.js.map +1 -0
  317. package/packages/pi-coding-agent/dist/modes/interactive/components/adaptive-layout.test.d.ts +2 -0
  318. package/packages/pi-coding-agent/dist/modes/interactive/components/adaptive-layout.test.d.ts.map +1 -0
  319. package/packages/pi-coding-agent/dist/modes/interactive/components/adaptive-layout.test.js +51 -0
  320. package/packages/pi-coding-agent/dist/modes/interactive/components/adaptive-layout.test.js.map +1 -0
  321. package/packages/pi-coding-agent/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
  322. package/packages/pi-coding-agent/dist/modes/interactive/components/assistant-message.js.map +1 -1
  323. package/packages/pi-coding-agent/dist/modes/interactive/components/chat-frame.d.ts.map +1 -1
  324. package/packages/pi-coding-agent/dist/modes/interactive/components/chat-frame.js +10 -9
  325. package/packages/pi-coding-agent/dist/modes/interactive/components/chat-frame.js.map +1 -1
  326. package/packages/pi-coding-agent/dist/modes/interactive/components/settings-selector.d.ts +3 -0
  327. package/packages/pi-coding-agent/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
  328. package/packages/pi-coding-agent/dist/modes/interactive/components/settings-selector.js +11 -0
  329. package/packages/pi-coding-agent/dist/modes/interactive/components/settings-selector.js.map +1 -1
  330. package/packages/pi-coding-agent/dist/modes/interactive/components/tool-card-cleanup-and-success-runtime.test.js +27 -6
  331. package/packages/pi-coding-agent/dist/modes/interactive/components/tool-card-cleanup-and-success-runtime.test.js.map +1 -1
  332. package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.d.ts +16 -0
  333. package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
  334. package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.js +112 -18
  335. package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.js.map +1 -1
  336. package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.d.ts.map +1 -1
  337. package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.js +60 -1
  338. package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.js.map +1 -1
  339. package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.test.js +40 -1
  340. package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.test.js.map +1 -1
  341. package/packages/pi-coding-agent/dist/modes/interactive/controllers/input-controller.test.js +1 -0
  342. package/packages/pi-coding-agent/dist/modes/interactive/controllers/input-controller.test.js.map +1 -1
  343. package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode-state.d.ts +1 -0
  344. package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode-state.d.ts.map +1 -1
  345. package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode-state.js.map +1 -1
  346. package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts +12 -1
  347. package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  348. package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js +54 -10
  349. package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js.map +1 -1
  350. package/packages/pi-coding-agent/dist/modes/interactive/slash-command-handlers.d.ts.map +1 -1
  351. package/packages/pi-coding-agent/dist/modes/interactive/slash-command-handlers.js +20 -0
  352. package/packages/pi-coding-agent/dist/modes/interactive/slash-command-handlers.js.map +1 -1
  353. package/packages/pi-coding-agent/dist/modes/interactive/slash-command-handlers.test.d.ts +2 -0
  354. package/packages/pi-coding-agent/dist/modes/interactive/slash-command-handlers.test.d.ts.map +1 -0
  355. package/packages/pi-coding-agent/dist/modes/interactive/slash-command-handlers.test.js +79 -0
  356. package/packages/pi-coding-agent/dist/modes/interactive/slash-command-handlers.test.js.map +1 -0
  357. package/packages/pi-coding-agent/dist/modes/interactive/theme/theme-schema.d.ts +12 -0
  358. package/packages/pi-coding-agent/dist/modes/interactive/theme/theme-schema.d.ts.map +1 -1
  359. package/packages/pi-coding-agent/dist/modes/interactive/theme/theme-schema.js +13 -0
  360. package/packages/pi-coding-agent/dist/modes/interactive/theme/theme-schema.js.map +1 -1
  361. package/packages/pi-coding-agent/dist/modes/interactive/theme/theme.d.ts +1 -1
  362. package/packages/pi-coding-agent/dist/modes/interactive/theme/theme.d.ts.map +1 -1
  363. package/packages/pi-coding-agent/dist/modes/interactive/theme/theme.js +18 -1
  364. package/packages/pi-coding-agent/dist/modes/interactive/theme/theme.js.map +1 -1
  365. package/packages/pi-coding-agent/dist/modes/interactive/theme/themes.d.ts.map +1 -1
  366. package/packages/pi-coding-agent/dist/modes/interactive/theme/themes.js +36 -27
  367. package/packages/pi-coding-agent/dist/modes/interactive/theme/themes.js.map +1 -1
  368. package/packages/pi-coding-agent/dist/modes/interactive/tui-mode.d.ts +11 -0
  369. package/packages/pi-coding-agent/dist/modes/interactive/tui-mode.d.ts.map +1 -0
  370. package/packages/pi-coding-agent/dist/modes/interactive/tui-mode.js +18 -0
  371. package/packages/pi-coding-agent/dist/modes/interactive/tui-mode.js.map +1 -0
  372. package/packages/pi-coding-agent/dist/modes/interactive/tui-mode.test.d.ts +2 -0
  373. package/packages/pi-coding-agent/dist/modes/interactive/tui-mode.test.d.ts.map +1 -0
  374. package/packages/pi-coding-agent/dist/modes/interactive/tui-mode.test.js +48 -0
  375. package/packages/pi-coding-agent/dist/modes/interactive/tui-mode.test.js.map +1 -0
  376. package/packages/pi-coding-agent/dist/modes/rpc/rpc-types.d.ts +1 -512
  377. package/packages/pi-coding-agent/dist/modes/rpc/rpc-types.d.ts.map +1 -1
  378. package/packages/pi-coding-agent/dist/modes/rpc/rpc-types.js +3 -7
  379. package/packages/pi-coding-agent/dist/modes/rpc/rpc-types.js.map +1 -1
  380. package/packages/pi-coding-agent/package.json +2 -1
  381. package/packages/pi-coding-agent/src/core/chat-controller-ordering.test.ts +87 -0
  382. package/packages/pi-coding-agent/src/core/extensions/runner.test.ts +108 -0
  383. package/packages/pi-coding-agent/src/core/extensions/runner.ts +16 -1
  384. package/packages/pi-coding-agent/src/core/model-registry.ts +4 -0
  385. package/packages/pi-coding-agent/src/core/settings-manager.ts +12 -0
  386. package/packages/pi-coding-agent/src/core/slash-commands.ts +1 -0
  387. package/packages/pi-coding-agent/src/modes/interactive/components/__tests__/chat-frame-compaction-tone.test.ts +7 -5
  388. package/packages/pi-coding-agent/src/modes/interactive/components/__tests__/tool-execution.test.ts +100 -16
  389. package/packages/pi-coding-agent/src/modes/interactive/components/adaptive-layout.test.ts +59 -0
  390. package/packages/pi-coding-agent/src/modes/interactive/components/adaptive-layout.ts +160 -0
  391. package/packages/pi-coding-agent/src/modes/interactive/components/assistant-message.ts +1 -0
  392. package/packages/pi-coding-agent/src/modes/interactive/components/chat-frame.ts +10 -9
  393. package/packages/pi-coding-agent/src/modes/interactive/components/settings-selector.ts +15 -0
  394. package/packages/pi-coding-agent/src/modes/interactive/components/tool-card-cleanup-and-success-runtime.test.ts +41 -9
  395. package/packages/pi-coding-agent/src/modes/interactive/components/tool-execution.ts +124 -18
  396. package/packages/pi-coding-agent/src/modes/interactive/controllers/chat-controller.test.ts +43 -1
  397. package/packages/pi-coding-agent/src/modes/interactive/controllers/chat-controller.ts +75 -1
  398. package/packages/pi-coding-agent/src/modes/interactive/controllers/input-controller.test.ts +1 -0
  399. package/packages/pi-coding-agent/src/modes/interactive/interactive-mode-state.ts +1 -1
  400. package/packages/pi-coding-agent/src/modes/interactive/interactive-mode.ts +75 -9
  401. package/packages/pi-coding-agent/src/modes/interactive/slash-command-handlers.test.ts +95 -0
  402. package/packages/pi-coding-agent/src/modes/interactive/slash-command-handlers.ts +24 -1
  403. package/packages/pi-coding-agent/src/modes/interactive/theme/theme-schema.ts +13 -0
  404. package/packages/pi-coding-agent/src/modes/interactive/theme/theme.ts +32 -2
  405. package/packages/pi-coding-agent/src/modes/interactive/theme/themes.ts +36 -27
  406. package/packages/pi-coding-agent/src/modes/interactive/tui-mode.test.ts +65 -0
  407. package/packages/pi-coding-agent/src/modes/interactive/tui-mode.ts +29 -0
  408. package/packages/pi-coding-agent/src/modes/rpc/rpc-types.ts +3 -336
  409. package/packages/pi-coding-agent/tsconfig.tsbuildinfo +1 -1
  410. package/packages/pi-tui/dist/__tests__/style.test.d.ts +2 -0
  411. package/packages/pi-tui/dist/__tests__/style.test.d.ts.map +1 -0
  412. package/packages/pi-tui/dist/__tests__/style.test.js +63 -0
  413. package/packages/pi-tui/dist/__tests__/style.test.js.map +1 -0
  414. package/packages/pi-tui/dist/__tests__/tui.test.js +24 -3
  415. package/packages/pi-tui/dist/__tests__/tui.test.js.map +1 -1
  416. package/packages/pi-tui/dist/index.d.ts +1 -0
  417. package/packages/pi-tui/dist/index.d.ts.map +1 -1
  418. package/packages/pi-tui/dist/index.js +2 -0
  419. package/packages/pi-tui/dist/index.js.map +1 -1
  420. package/packages/pi-tui/dist/style.d.ts +41 -0
  421. package/packages/pi-tui/dist/style.d.ts.map +1 -0
  422. package/packages/pi-tui/dist/style.js +158 -0
  423. package/packages/pi-tui/dist/style.js.map +1 -0
  424. package/packages/pi-tui/dist/tui.d.ts.map +1 -1
  425. package/packages/pi-tui/dist/tui.js +1 -0
  426. package/packages/pi-tui/dist/tui.js.map +1 -1
  427. package/packages/pi-tui/package.json +1 -1
  428. package/packages/pi-tui/src/__tests__/style.test.ts +76 -0
  429. package/packages/pi-tui/src/__tests__/tui.test.ts +29 -3
  430. package/packages/pi-tui/src/index.ts +9 -0
  431. package/packages/pi-tui/src/style.ts +225 -0
  432. package/packages/pi-tui/src/tui.ts +1 -0
  433. package/packages/pi-tui/tsconfig.tsbuildinfo +1 -1
  434. package/packages/rpc-client/README.md +3 -3
  435. package/packages/rpc-client/dist/index.d.ts +1 -1
  436. package/packages/rpc-client/dist/index.d.ts.map +1 -1
  437. package/packages/rpc-client/dist/index.js.map +1 -1
  438. package/packages/rpc-client/dist/rpc-client.d.ts +2 -6
  439. package/packages/rpc-client/dist/rpc-client.d.ts.map +1 -1
  440. package/packages/rpc-client/dist/rpc-client.js.map +1 -1
  441. package/packages/rpc-client/dist/rpc-types.d.ts +1 -565
  442. package/packages/rpc-client/dist/rpc-types.d.ts.map +1 -1
  443. package/packages/rpc-client/dist/rpc-types.js +3 -11
  444. package/packages/rpc-client/dist/rpc-types.js.map +1 -1
  445. package/packages/rpc-client/package.json +4 -1
  446. package/packages/rpc-client/src/index.ts +1 -1
  447. package/packages/rpc-client/src/rpc-client.ts +3 -6
  448. package/packages/rpc-client/src/rpc-types.ts +3 -398
  449. package/packages/rpc-client/tsconfig.tsbuildinfo +1 -1
  450. package/pkg/dist/modes/interactive/theme/theme-schema.d.ts +12 -0
  451. package/pkg/dist/modes/interactive/theme/theme-schema.d.ts.map +1 -1
  452. package/pkg/dist/modes/interactive/theme/theme-schema.js +13 -0
  453. package/pkg/dist/modes/interactive/theme/theme-schema.js.map +1 -1
  454. package/pkg/dist/modes/interactive/theme/theme.d.ts +1 -1
  455. package/pkg/dist/modes/interactive/theme/theme.d.ts.map +1 -1
  456. package/pkg/dist/modes/interactive/theme/theme.js +18 -1
  457. package/pkg/dist/modes/interactive/theme/theme.js.map +1 -1
  458. package/pkg/dist/modes/interactive/theme/themes.d.ts.map +1 -1
  459. package/pkg/dist/modes/interactive/theme/themes.js +36 -27
  460. package/pkg/dist/modes/interactive/theme/themes.js.map +1 -1
  461. package/pkg/package.json +1 -1
  462. package/src/resources/extensions/github-sync/templates.ts +93 -88
  463. package/src/resources/extensions/github-sync/tests/inline-code.test.ts +66 -0
  464. package/src/resources/extensions/github-sync/tests/templates.test.ts +10 -2
  465. package/src/resources/extensions/gsd/auto/contracts.ts +87 -0
  466. package/src/resources/extensions/gsd/auto/custom-verify-retry-store.ts +72 -0
  467. package/src/resources/extensions/gsd/auto/loop-deps.ts +10 -3
  468. package/src/resources/extensions/gsd/auto/loop.ts +416 -596
  469. package/src/resources/extensions/gsd/auto/orchestrator.ts +161 -0
  470. package/src/resources/extensions/gsd/auto/phases.ts +82 -8
  471. package/src/resources/extensions/gsd/auto/run-unit.ts +24 -14
  472. package/src/resources/extensions/gsd/auto/session.ts +11 -0
  473. package/src/resources/extensions/gsd/auto/workflow-custom-engine-dispatch-outcome.ts +28 -0
  474. package/src/resources/extensions/gsd/auto/workflow-custom-engine-iteration.ts +52 -0
  475. package/src/resources/extensions/gsd/auto/workflow-custom-engine-reconcile-outcome.ts +58 -0
  476. package/src/resources/extensions/gsd/auto/workflow-custom-engine-reconcile.ts +71 -0
  477. package/src/resources/extensions/gsd/auto/workflow-custom-engine-retry.ts +90 -0
  478. package/src/resources/extensions/gsd/auto/workflow-custom-engine-verify-outcome.ts +50 -0
  479. package/src/resources/extensions/gsd/auto/workflow-dispatch-claim.ts +97 -0
  480. package/src/resources/extensions/gsd/auto/workflow-dispatch-ledger.ts +45 -0
  481. package/src/resources/extensions/gsd/auto/workflow-iteration-completion.ts +26 -0
  482. package/src/resources/extensions/gsd/auto/workflow-journal-reporter.ts +33 -0
  483. package/src/resources/extensions/gsd/auto/workflow-kernel.ts +520 -0
  484. package/src/resources/extensions/gsd/auto/workflow-memory-pressure.ts +58 -0
  485. package/src/resources/extensions/gsd/auto/workflow-phase-reporter.ts +22 -0
  486. package/src/resources/extensions/gsd/auto/workflow-session-lock.ts +68 -0
  487. package/src/resources/extensions/gsd/auto/workflow-sidecar-iteration.ts +46 -0
  488. package/src/resources/extensions/gsd/auto/workflow-sidecar-queue.ts +46 -0
  489. package/src/resources/extensions/gsd/auto/workflow-turn-reporter.ts +68 -0
  490. package/src/resources/extensions/gsd/auto/workflow-unit-dispatch.ts +89 -0
  491. package/src/resources/extensions/gsd/auto/workflow-worker-heartbeat.ts +38 -0
  492. package/src/resources/extensions/gsd/auto-dashboard.ts +61 -8
  493. package/src/resources/extensions/gsd/auto-dispatch.ts +17 -0
  494. package/src/resources/extensions/gsd/auto-prompts.ts +170 -3
  495. package/src/resources/extensions/gsd/auto-recovery.ts +194 -56
  496. package/src/resources/extensions/gsd/auto-runtime-state.ts +7 -0
  497. package/src/resources/extensions/gsd/auto-start.ts +7 -6
  498. package/src/resources/extensions/gsd/auto-verification.ts +5 -1
  499. package/src/resources/extensions/gsd/auto-worktree.ts +85 -36
  500. package/src/resources/extensions/gsd/auto.ts +179 -2
  501. package/src/resources/extensions/gsd/bootstrap/agent-end-recovery.ts +30 -2
  502. package/src/resources/extensions/gsd/bootstrap/db-tools.ts +11 -0
  503. package/src/resources/extensions/gsd/bootstrap/register-hooks.ts +30 -6
  504. package/src/resources/extensions/gsd/bootstrap/write-gate.ts +135 -1
  505. package/src/resources/extensions/gsd/commands-extract-learnings.ts +17 -12
  506. package/src/resources/extensions/gsd/commands-ship.ts +24 -51
  507. package/src/resources/extensions/gsd/commands-workflow-templates.ts +13 -0
  508. package/src/resources/extensions/gsd/component-loader.ts +5 -11
  509. package/src/resources/extensions/gsd/custom-workflow-engine.ts +29 -0
  510. package/src/resources/extensions/gsd/db-adapter.ts +75 -0
  511. package/src/resources/extensions/gsd/db-base-schema.ts +383 -0
  512. package/src/resources/extensions/gsd/db-connection-cache.ts +45 -0
  513. package/src/resources/extensions/gsd/db-coordination-schema.ts +109 -0
  514. package/src/resources/extensions/gsd/db-decision-requirement-rows.ts +77 -0
  515. package/src/resources/extensions/gsd/db-gate-rows.ts +19 -0
  516. package/src/resources/extensions/gsd/db-lightweight-query-rows.ts +50 -0
  517. package/src/resources/extensions/gsd/db-memory-fts-schema.ts +66 -0
  518. package/src/resources/extensions/gsd/db-migration-backup.ts +34 -0
  519. package/src/resources/extensions/gsd/db-migration-steps.ts +451 -0
  520. package/src/resources/extensions/gsd/db-milestone-artifact-rows.ts +70 -0
  521. package/src/resources/extensions/gsd/db-open-state.ts +47 -0
  522. package/src/resources/extensions/gsd/db-provider.ts +148 -0
  523. package/src/resources/extensions/gsd/db-runtime-kv-schema.ts +30 -0
  524. package/src/resources/extensions/gsd/db-schema-metadata.ts +33 -0
  525. package/src/resources/extensions/gsd/db-task-slice-rows.ts +146 -0
  526. package/src/resources/extensions/gsd/db-transaction.ts +76 -0
  527. package/src/resources/extensions/gsd/db-verification-evidence-rows.ts +14 -0
  528. package/src/resources/extensions/gsd/db-verification-evidence-schema.ts +22 -0
  529. package/src/resources/extensions/gsd/escalation.ts +3 -1
  530. package/src/resources/extensions/gsd/graph.ts +12 -5
  531. package/src/resources/extensions/gsd/gsd-db.ts +379 -1660
  532. package/src/resources/extensions/gsd/guided-flow.ts +2 -2
  533. package/src/resources/extensions/gsd/interrupted-session.ts +1 -0
  534. package/src/resources/extensions/gsd/legacy-telemetry.ts +99 -0
  535. package/src/resources/extensions/gsd/markdown-renderer.ts +4 -1
  536. package/src/resources/extensions/gsd/model-router.ts +10 -6
  537. package/src/resources/extensions/gsd/notification-widget.ts +25 -4
  538. package/src/resources/extensions/gsd/post-execution-checks.ts +35 -7
  539. package/src/resources/extensions/gsd/pr-evidence.ts +182 -0
  540. package/src/resources/extensions/gsd/pre-execution-checks.ts +4 -1
  541. package/src/resources/extensions/gsd/process-task-path.ts +81 -0
  542. package/src/resources/extensions/gsd/prompt-loader.ts +9 -5
  543. package/src/resources/extensions/gsd/prompts/complete-milestone.md +32 -30
  544. package/src/resources/extensions/gsd/prompts/complete-slice.md +23 -34
  545. package/src/resources/extensions/gsd/prompts/discuss-headless.md +50 -96
  546. package/src/resources/extensions/gsd/prompts/discuss.md +81 -181
  547. package/src/resources/extensions/gsd/prompts/execute-task.md +40 -67
  548. package/src/resources/extensions/gsd/prompts/forensics.md +41 -84
  549. package/src/resources/extensions/gsd/prompts/guided-discuss-milestone.md +29 -39
  550. package/src/resources/extensions/gsd/prompts/guided-discuss-project.md +30 -65
  551. package/src/resources/extensions/gsd/prompts/guided-discuss-requirements.md +25 -52
  552. package/src/resources/extensions/gsd/prompts/guided-discuss-slice.md +36 -36
  553. package/src/resources/extensions/gsd/prompts/guided-research-project.md +20 -38
  554. package/src/resources/extensions/gsd/prompts/plan-milestone.md +45 -59
  555. package/src/resources/extensions/gsd/prompts/plan-slice.md +25 -87
  556. package/src/resources/extensions/gsd/prompts/queue.md +46 -53
  557. package/src/resources/extensions/gsd/prompts/refine-slice.md +23 -23
  558. package/src/resources/extensions/gsd/prompts/research-slice.md +23 -23
  559. package/src/resources/extensions/gsd/prompts/rethink.md +10 -10
  560. package/src/resources/extensions/gsd/prompts/system.md +65 -107
  561. package/src/resources/extensions/gsd/prompts/triage-captures.md +15 -15
  562. package/src/resources/extensions/gsd/prompts/validate-milestone.md +24 -24
  563. package/src/resources/extensions/gsd/prompts/worktree-merge.md +35 -35
  564. package/src/resources/extensions/gsd/state.ts +6 -3
  565. package/src/resources/extensions/gsd/tests/auto-abort-pause-regression.test.ts +38 -0
  566. package/src/resources/extensions/gsd/tests/auto-dashboard.test.ts +98 -0
  567. package/src/resources/extensions/gsd/tests/auto-loop.test.ts +117 -0
  568. package/src/resources/extensions/gsd/tests/auto-orchestrator.test.ts +353 -0
  569. package/src/resources/extensions/gsd/tests/auto-pr-bugs.test.ts +19 -0
  570. package/src/resources/extensions/gsd/tests/auto-recovery.test.ts +170 -1
  571. package/src/resources/extensions/gsd/tests/auto-runtime-state.test.ts +39 -0
  572. package/src/resources/extensions/gsd/tests/auto-session-encapsulation.test.ts +3 -0
  573. package/src/resources/extensions/gsd/tests/commands-eval-review.test.ts +2 -2
  574. package/src/resources/extensions/gsd/tests/commands-extract-learnings.test.ts +9 -0
  575. package/src/resources/extensions/gsd/tests/commands-ship-eval-warn.test.ts +3 -2
  576. package/src/resources/extensions/gsd/tests/complete-milestone-prompt-rendering.test.ts +47 -0
  577. package/src/resources/extensions/gsd/tests/complete-milestone.test.ts +19 -5
  578. package/src/resources/extensions/gsd/tests/component-loader.test.ts +2 -9
  579. package/src/resources/extensions/gsd/tests/custom-engine-loop-integration.test.ts +144 -0
  580. package/src/resources/extensions/gsd/tests/custom-verify-retry-store.test.ts +139 -0
  581. package/src/resources/extensions/gsd/tests/custom-workflow-engine.test.ts +50 -0
  582. package/src/resources/extensions/gsd/tests/dashboard-custom-engine.test.ts +3 -3
  583. package/src/resources/extensions/gsd/tests/db-adapter.test.ts +82 -0
  584. package/src/resources/extensions/gsd/tests/db-base-schema.test.ts +62 -0
  585. package/src/resources/extensions/gsd/tests/db-connection-cache.test.ts +60 -0
  586. package/src/resources/extensions/gsd/tests/db-coordination-schema.test.ts +39 -0
  587. package/src/resources/extensions/gsd/tests/db-decision-requirement-rows.test.ts +135 -0
  588. package/src/resources/extensions/gsd/tests/db-gate-rows.test.ts +53 -0
  589. package/src/resources/extensions/gsd/tests/db-lightweight-query-rows.test.ts +45 -0
  590. package/src/resources/extensions/gsd/tests/db-memory-fts-schema.test.ts +86 -0
  591. package/src/resources/extensions/gsd/tests/db-migration-backup.test.ts +105 -0
  592. package/src/resources/extensions/gsd/tests/db-migration-steps.integration.test.ts +428 -0
  593. package/src/resources/extensions/gsd/tests/db-migration-steps.test.ts +159 -0
  594. package/src/resources/extensions/gsd/tests/db-milestone-artifact-rows.test.ts +53 -0
  595. package/src/resources/extensions/gsd/tests/db-open-state.test.ts +56 -0
  596. package/src/resources/extensions/gsd/tests/db-provider.test.ts +105 -0
  597. package/src/resources/extensions/gsd/tests/db-runtime-kv-schema.test.ts +37 -0
  598. package/src/resources/extensions/gsd/tests/db-schema-metadata.test.ts +115 -0
  599. package/src/resources/extensions/gsd/tests/db-task-slice-rows.test.ts +128 -0
  600. package/src/resources/extensions/gsd/tests/db-transaction.test.ts +110 -0
  601. package/src/resources/extensions/gsd/tests/db-verification-evidence-schema.test.ts +76 -0
  602. package/src/resources/extensions/gsd/tests/discuss-headless-rendering.test.ts +37 -0
  603. package/src/resources/extensions/gsd/tests/execute-task-rendering.test.ts +59 -0
  604. package/src/resources/extensions/gsd/tests/fixtures/pr-body/commands-ship-basic.md +52 -0
  605. package/src/resources/extensions/gsd/tests/fixtures/pr-body/commands-ship-empty-optionals.md +42 -0
  606. package/src/resources/extensions/gsd/tests/fixtures/pr-body/swarm-lane-no-blockers.md +55 -0
  607. package/src/resources/extensions/gsd/tests/fixtures/pr-body/swarm-lane-with-blockers.md +60 -0
  608. package/src/resources/extensions/gsd/tests/forensics-prompt-rendering.test.ts +36 -0
  609. package/src/resources/extensions/gsd/tests/graph-operations.test.ts +10 -0
  610. package/src/resources/extensions/gsd/tests/gsd-db.test.ts +139 -0
  611. package/src/resources/extensions/gsd/tests/guided-discuss-milestone-prompt-rendering.test.ts +43 -0
  612. package/src/resources/extensions/gsd/tests/guided-discuss-project-prompt-rendering.test.ts +41 -0
  613. package/src/resources/extensions/gsd/tests/guided-discuss-requirements-prompt-rendering.test.ts +45 -0
  614. package/src/resources/extensions/gsd/tests/has-pending-deep-stage.test.ts +33 -1
  615. package/src/resources/extensions/gsd/tests/integration/auto-recovery.test.ts +79 -0
  616. package/src/resources/extensions/gsd/tests/integration/auto-worktree-milestone-merge.test.ts +37 -0
  617. package/src/resources/extensions/gsd/tests/integration/state-machine-live-validation.test.ts +5 -3
  618. package/src/resources/extensions/gsd/tests/journal-integration.test.ts +134 -0
  619. package/src/resources/extensions/gsd/tests/legacy-component-format-telemetry.test.ts +62 -0
  620. package/src/resources/extensions/gsd/tests/legacy-telemetry.test.ts +144 -0
  621. package/src/resources/extensions/gsd/tests/memory-pressure-stuck-state.test.ts +40 -16
  622. package/src/resources/extensions/gsd/tests/model-router.test.ts +33 -12
  623. package/src/resources/extensions/gsd/tests/notification-store.test.ts +8 -0
  624. package/src/resources/extensions/gsd/tests/notification-widget.test.ts +40 -1
  625. package/src/resources/extensions/gsd/tests/paused-session-via-db.test.ts +2 -0
  626. package/src/resources/extensions/gsd/tests/plan-milestone-rendering.test.ts +45 -0
  627. package/src/resources/extensions/gsd/tests/plan-slice-prompt.test.ts +65 -16
  628. package/src/resources/extensions/gsd/tests/plan-slice.test.ts +27 -0
  629. package/src/resources/extensions/gsd/tests/post-execution-checks.test.ts +46 -0
  630. package/src/resources/extensions/gsd/tests/pr-evidence-equivalence.test.ts +102 -0
  631. package/src/resources/extensions/gsd/tests/pr-evidence-hardening.test.ts +165 -0
  632. package/src/resources/extensions/gsd/tests/pr-evidence.test.ts +79 -0
  633. package/src/resources/extensions/gsd/tests/process-task-path.test.ts +51 -0
  634. package/src/resources/extensions/gsd/tests/prompt-step-ordering.test.ts +16 -1
  635. package/src/resources/extensions/gsd/tests/queue-prompt-rendering.test.ts +37 -0
  636. package/src/resources/extensions/gsd/tests/start-auto-detached.test.ts +46 -2
  637. package/src/resources/extensions/gsd/tests/tool-naming.test.ts +32 -9
  638. package/src/resources/extensions/gsd/tests/unit-context-composer.test.ts +6 -6
  639. package/src/resources/extensions/gsd/tests/uok-kernel-path.test.ts +12 -0
  640. package/src/resources/extensions/gsd/tests/uok-plan-v2-wiring.test.ts +1 -1
  641. package/src/resources/extensions/gsd/tests/workflow-custom-engine-dispatch-outcome.test.ts +55 -0
  642. package/src/resources/extensions/gsd/tests/workflow-custom-engine-iteration.test.ts +93 -0
  643. package/src/resources/extensions/gsd/tests/workflow-custom-engine-reconcile-outcome.test.ts +108 -0
  644. package/src/resources/extensions/gsd/tests/workflow-custom-engine-reconcile.test.ts +146 -0
  645. package/src/resources/extensions/gsd/tests/workflow-custom-engine-retry.test.ts +136 -0
  646. package/src/resources/extensions/gsd/tests/workflow-custom-engine-verify-outcome.test.ts +95 -0
  647. package/src/resources/extensions/gsd/tests/workflow-dispatch-claim.test.ts +158 -0
  648. package/src/resources/extensions/gsd/tests/workflow-dispatch-ledger.test.ts +82 -0
  649. package/src/resources/extensions/gsd/tests/workflow-iteration-completion.test.ts +44 -0
  650. package/src/resources/extensions/gsd/tests/workflow-journal-reporter.test.ts +49 -0
  651. package/src/resources/extensions/gsd/tests/workflow-kernel.test.ts +607 -0
  652. package/src/resources/extensions/gsd/tests/workflow-logger.test.ts +20 -4
  653. package/src/resources/extensions/gsd/tests/workflow-memory-pressure.test.ts +71 -0
  654. package/src/resources/extensions/gsd/tests/workflow-phase-reporter.test.ts +40 -0
  655. package/src/resources/extensions/gsd/tests/workflow-session-lock.test.ts +135 -0
  656. package/src/resources/extensions/gsd/tests/workflow-sidecar-iteration.test.ts +110 -0
  657. package/src/resources/extensions/gsd/tests/workflow-sidecar-queue.test.ts +116 -0
  658. package/src/resources/extensions/gsd/tests/workflow-templates.test.ts +21 -0
  659. package/src/resources/extensions/gsd/tests/workflow-tool-executors.test.ts +32 -0
  660. package/src/resources/extensions/gsd/tests/workflow-turn-reporter.test.ts +87 -0
  661. package/src/resources/extensions/gsd/tests/workflow-unit-dispatch.test.ts +160 -0
  662. package/src/resources/extensions/gsd/tests/workflow-worker-heartbeat.test.ts +123 -0
  663. package/src/resources/extensions/gsd/tests/working-output-messages.test.ts +93 -0
  664. package/src/resources/extensions/gsd/tests/worktree-submodule-safety.test.ts +17 -33
  665. package/src/resources/extensions/gsd/tests/worktree-write-gate.test.ts +179 -0
  666. package/src/resources/extensions/gsd/tools/complete-milestone.ts +15 -9
  667. package/src/resources/extensions/gsd/tools/complete-task.ts +4 -1
  668. package/src/resources/extensions/gsd/tools/workflow-tool-executors.ts +6 -1
  669. package/src/resources/extensions/gsd/unit-context-composer.ts +1 -1
  670. package/src/resources/extensions/gsd/uok/kernel.ts +10 -3
  671. package/src/resources/extensions/gsd/uok/plan-v2.ts +5 -1
  672. package/src/resources/extensions/gsd/workflow-logger.ts +13 -13
  673. package/src/resources/extensions/gsd/workflow-manifest.ts +6 -15
  674. package/src/resources/extensions/gsd/workflow-projections.ts +5 -1
  675. package/src/resources/extensions/gsd/workflow-templates.ts +11 -0
  676. package/src/resources/extensions/gsd/working-output-messages.ts +120 -0
  677. package/src/resources/extensions/shared/interview-ui.ts +18 -5
  678. package/src/resources/extensions/shared/tests/interview-notes-loop.test.ts +41 -0
  679. package/dist/web/standalone/.next/server/chunks/6336.js +0 -1
  680. /package/dist/web/standalone/.next/static/{TzEVJ1Lh8vbez4n4Q9TqQ → vIAZSyxIuvqNkCvXt9oqb}/_buildManifest.js +0 -0
  681. /package/dist/web/standalone/.next/static/{TzEVJ1Lh8vbez4n4Q9TqQ → vIAZSyxIuvqNkCvXt9oqb}/_ssgManifest.js +0 -0
@@ -1,65 +1,54 @@
1
1
  {{preamble}}
2
2
 
3
- Ask: "What's the vision?" once, and then use whatever the user replies with as the vision input to continue.
3
+ Ask: "What's the vision?" once, then use the reply as vision input.
4
4
 
5
- Special handling: if the user message is not a project description (for example, they ask about status, branch state, or other clarifications), treat it as the vision input and proceed with discussion logic instead of repeating "What's the vision?".
5
+ **Special handling:** If the user message is status, branch state, clarification, or any other non-project-description, treat it as vision input and proceed instead of repeating "What's the vision?".
6
6
 
7
7
  ## Reflection Step
8
8
 
9
- After the user describes their idea, **do not ask questions yet**. First, prove you understood by reflecting back:
9
+ After the user describes the idea, **do not ask questions yet**. Reflect first:
10
+ 1. Concrete summary in your own words.
11
+ 2. Honest size read: rough milestone count and first-milestone slice count.
12
+ 3. Scope honesty: "Here's what I'm hearing:" plus major capability bullets.
13
+ 4. Plain-text correction invite: "Here's my read. Correct anything important I missed."
10
14
 
11
- 1. Summarize what you understood in your own words concretely, not abstractly.
12
- 2. Give an honest size read: roughly how many milestones, roughly how many slices in the first one. Base this on the actual work involved, not a classification label. A config change might be 1 milestone with 1 slice. A social network might be 5 milestones with 8+ slices each. Use your judgment.
13
- 3. Include scope honesty — a bullet list of the major capabilities you're hearing: "Here's what I'm hearing: [bullet list of major capabilities]."
14
- 4. Invite correction in one plain sentence: "Here's my read. Correct anything important I missed." — plain text, not `ask_user_questions`.
15
-
16
- This prevents runaway questioning by forcing comprehension proof before anything else. Do not skip this step. Do not combine it with the first question round.
15
+ Do not skip this or combine it with the first question round.
17
16
 
18
17
  ## Vision Mapping
19
18
 
20
- After reflection is confirmed, decide the approach based on the actual scope not a label:
19
+ After reflection is confirmed, choose the approach from actual scope, not a label:
21
20
 
22
- **If the work spans multiple milestones:** Before drilling into details, map the full landscape:
23
- 1. Propose a milestone sequence — names, one-line intents, rough dependencies
24
- 2. Present this as the working milestone sequence. Adjust it if the user objects, sharpens it, or adds constraints; otherwise keep moving.
25
- 3. Only then begin the deep Q&A and scope the Q&A to the full vision, not just M001
21
+ **If the work spans multiple milestones:** map the landscape before details:
22
+ 1. Propose milestone names, intents, and rough dependencies.
23
+ 2. Treat it as the working sequence; adjust if the user objects or adds constraints.
24
+ 3. Then begin deep Q&A scoped to the full vision, not just M001.
26
25
 
27
26
  **If the work fits in a single milestone:** Proceed directly to questioning.
28
27
 
29
- **Anti-reduction rule:** If the user describes a big vision, plan the big vision. Do not ask "what's the minimum viable version?" or try to reduce scope unless the user explicitly asks for an MVP or minimal version. When something is complex or risky, phase it into a later milestone do not cut it. The user's ambition is the target, and your job is to sequence it intelligently, not shrink it.
28
+ **Anti-reduction rule:** If the user describes a big vision, plan it. Do not ask for an MVP or reduce scope unless explicitly requested. Phase complex/risky work into later milestones; do not cut it.
30
29
 
31
30
  {{preparationContext}}
32
31
 
33
32
  ## Mandatory Investigation Before First Question Round
34
33
 
35
- Before asking your first question, do a mandatory investigation pass. This is not optional.
36
-
37
- 1. **Scout the codebase** `ls`, `find`, `rg`, or `scout` for broad unfamiliar areas. Understand what already exists, what patterns are established, what constraints current code imposes.
38
- 2. **Check library docs** `resolve_library` / `get_library_docs` for any tech the user mentioned. Get current facts about capabilities, constraints, API shapes, version-specific behavior.
39
- 3. **Web search** — `search-the-web` if the domain is unfamiliar, if you need current best practices, or if the user referenced external services/APIs you need facts about. Use `fetch_page` for full content when snippets aren't enough.
40
-
41
- **Web search budget:** You have a limited number of web searches per turn (typically 3-5). The discuss phase spans many turns (investigation, question rounds, focused research, requirements), so budget carefully:
42
- - Prefer `resolve_library` / `get_library_docs` over `search-the-web` for library documentation — they don't consume the web search budget.
43
- - Prefer `search_and_read` for one-shot topic research — it combines search + page fetch in a single call.
44
- - Target 2-3 web searches in the investigation pass. Save remaining budget for the focused research pass before roadmap creation.
45
- - Do NOT repeat the same or similar queries. If a search didn't find what you need, rephrase once or move on.
46
- - When a search returns many results, each result contains multiple text spans — this is normal formatting, not separate searches.
34
+ Before the first question round, gather enough evidence for grounded questions:
35
+ 1. Scout relevant code with `ls`, `find`, `rg`, or `scout`.
36
+ 2. Check mentioned tech with `resolve_library` / `get_library_docs`.
37
+ 3. Use web tools only for current external facts.
47
38
 
48
- This happens ONCE, before the first round. The goal: your first questions should reflect what's actually true, not what you assume.
49
-
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.
39
+ Budget searches across the discussion; prefer docs and one-shot `search_and_read`. Re-investigate only when answers expose new gaps.
51
40
 
52
41
  ## Layered Question Rounds
53
42
 
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.
43
+ Questions have four layers. At each layer, ask 1-3 open questions per round, investigate as needed, and gate before advancing.
55
44
 
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.
45
+ **Default to open questions.** Use `ask_user_questions` only for 2-3 distinct paths with clear tradeoffs. Use plain text for nuanced design questions.
57
46
 
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.**
47
+ **If `{{structuredQuestionsAvailable}}` is `true`:** use `ask_user_questions` for binary/ternary choices. Keep labels short (3-5 words). Always include "Other / let me explain". If chosen or the user gives a long freeform answer, switch to plain-text follow-up before resuming structured questions. **IMPORTANT: Call `ask_user_questions` exactly once per turn. Never make multiple overlapping calls; wait for response before the next round.**
59
48
 
60
49
  **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
50
 
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.
51
+ **Incremental persistence:** After every 2 question rounds, silently save `{{milestoneId}}-CONTEXT-DRAFT.md` using `gsd_summary_save` with `artifact_type: "CONTEXT-DRAFT"` and `milestone_id: "{{milestoneId}}"`. Do NOT mention this save to the user.
63
52
 
64
53
  ### Identify Work Type
65
54
 
@@ -67,27 +56,19 @@ Before starting Layer 1, identify the primary work type and state it:
67
56
 
68
57
  "Based on your description and the codebase, this is primarily **[work type]** work."
69
58
 
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.
59
+ 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; it shapes question depth.
71
60
 
72
61
  ### Layer 1 — Scope
73
62
 
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
63
+ Resolve in/out/deferred scope: boundaries, ambiguities, dependencies, priority.
79
64
 
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
65
+ Adapt depth: CLI -> mental model, command grammar, existing behavior. Refactoring -> what changes vs what must stay identical.
83
66
 
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.
67
+ **Depth-matching:** Simple scope may need 1 round; ambiguous/large scope may need 3-4. Do not pad rounds.
85
68
 
86
69
  #### Layer 1 Gate
87
70
 
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
71
+ Summarize scope in the user's terminology: included, excluded, deferred, boundaries, constraints.
91
72
 
92
73
  Then ask: **"Does this capture the scope? Adjust anything before we move on."**
93
74
 
@@ -97,25 +78,15 @@ If the user adjusts, reflect the updated understanding and ask again. Do not adv
97
78
 
98
79
  ### Layer 2 — Architecture
99
80
 
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
81
+ Resolve how it is built: per-slice decisions, inter-slice contracts, evidence-backed library/framework choices, and existing-code integration.
105
82
 
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
83
+ Adapt depth: API -> contracts/versioning/auth/backcompat. UI -> components/state/data flow. Infrastructure -> topology/failure domains/rollback.
110
84
 
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.
85
+ Between rounds, use web tools for Codebase Brief technologies. Search best practices and known issues for relevant versions. Present findings with questions.
112
86
 
113
87
  #### Layer 2 Gate
114
88
 
115
- Summarize architecture decisions, each with:
116
- - The decision and rationale
117
- - Evidence source (codebase patterns, library docs, web research)
118
- - Alternatives considered
89
+ Summarize architecture decisions with rationale, evidence source, and alternatives considered.
119
90
 
120
91
  Then ask: **"Does this capture the architecture? Adjust anything before we move on."**
121
92
 
@@ -125,20 +96,13 @@ Same gate rules: reflect adjustments, wait for confirmation.
125
96
 
126
97
  ### Layer 3 — Error States
127
98
 
128
- Resolve what happens when things fail. Present this layer with an option:
99
+ Resolve failure behavior. Present this layer with an option:
129
100
 
130
101
  "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
102
 
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
103
+ If the user chooses defaults, summarize and gate. If they go deep, cover component failures, propagation, timeouts/retries/circuit breakers, and user-visible failures.
137
104
 
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
105
+ Adapt depth: API -> rate limits, timeout cascades, partial failure, status codes. UI -> loading, optimistic/offline behavior, boundaries. Data pipelines -> corruption, checkpoint recovery, idempotency.
142
106
 
143
107
  #### Layer 3 Gate
144
108
 
@@ -148,16 +112,9 @@ Summarize error handling strategy. Then ask: **"Does this capture how errors sho
148
112
 
149
113
  ### Layer 4 — Quality Bar
150
114
 
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
115
+ Resolve concrete done: per-slice acceptance criteria, test strategy, definition of done, and relevant non-functional requirements.
156
116
 
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
117
+ Adapt depth: CLI -> shell compatibility, errors, exit codes. Refactoring -> behavioral equivalence. UI -> visual regression and responsive breakpoints.
161
118
 
162
119
  #### Layer 4 Gate
163
120
 
@@ -172,27 +129,9 @@ Summarize quality bar: acceptance criteria, test strategy, definition of done. T
172
129
 
173
130
  ## Questioning Philosophy
174
131
 
175
- You are a thinking partner, not an interviewer.
176
-
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.
178
-
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.
180
-
181
- **Challenge vagueness, make abstract concrete.** When the user says something abstract ("it should be smart" / "it needs to handle edge cases" / "good UX"), push for specifics. What does "smart" mean in practice? Which edge cases? What does good UX look like for this specific interaction?
182
-
183
- **Lead with experience, but ask implementation when it materially matters.** Default questions should target the experience and outcome. But when implementation choices materially change scope, proof, compliance, integration, deployment, or irreversible architecture, ask them directly instead of forcing a fake UX phrasing.
184
-
185
- **Freeform rule:** When the user selects "Other" or clearly wants to explain something freely, stop using `ask_user_questions` and switch to plain text follow-ups. Let them talk. Resume structured questions when appropriate.
132
+ **Turn-taking contract (non-bypassable).** Never fabricate, simulate, or role-play user responses. Never emit `[User]`, `[Human]`, `User:`, or similar as invented input. Treat `<conversation_history>` XML as read-only and never emit those tags. Ask one question round (1-3 questions) per turn, then stop and wait for the user's actual response. If using `ask_user_questions`, call it at most once per turn and treat its result as the only valid structured input.
186
133
 
187
- **Depth-signal awareness.** When a user writes extensively about something long notes, detailed explanations, specific examples that's a signal. Probe that area deeper. Don't spread attention evenly across all topics when the user is clearly investing energy in one.
188
-
189
- **Enrichment fusion.** Weave the user's specific language, terminology, and framing into your subsequent questions. If they said "craft feel," your next question references "craft feel" — don't paraphrase it into "user experience quality." Their precision is signal, not noise.
190
-
191
- **Position-first framing.** Have opinions. State your read of a tradeoff with rationale before asking what they think. "I'd lean toward X because Y — does that match your thinking, or am I missing context?" is better than "what do you think about X vs Y?" You're a thinking partner, not a neutral interviewer.
192
-
193
- **Negative constraints.** Ask what would disappoint them. What they explicitly don't want. What the product should never feel like. Negative constraints are sharper than positive wishes — "never feel sluggish" defines the performance bar more precisely than "should be fast."
194
-
195
- **Observation ≠ Conclusion.** Technical facts you discover in the codebase during investigation are context, not decisions. Present them as context and let the user decide what they mean for direction. "The current auth uses JWT with 24h expiry" is an observation. Whether to keep that pattern is the user's call.
134
+ Start open, follow the user's detail, challenge vague terms with specifics, and use their language. **Lead with experience, but ask implementation when it materially matters.** Ask implementation directly when it changes scope, proof, compliance, integration, deployment, or irreversible architecture. If the user selects "Other" or wants explanation, switch to plain-text follow-ups until structured choices fit again. State your read and rationale before asking when useful. Ask what would disappoint them and what the product should never feel like. Codebase facts are context, not decisions.
196
135
 
197
136
  **Anti-patterns — never do these:**
198
137
  - **Checklist walking** — going through a predetermined list of topics regardless of what the user said
@@ -206,7 +145,7 @@ You are a thinking partner, not an interviewer.
206
145
 
207
146
  ## Depth Enforcement
208
147
 
209
- Do NOT offer to proceed until ALL of the following are satisfied. Track these internally as a background checklist:
148
+ Do NOT offer to proceed until all are satisfied. Track internally:
210
149
 
211
150
  - [ ] **What they're building** — concrete enough that you could explain it to a stranger
212
151
  - [ ] **Why it needs to exist** — the problem it solves or the desire it fulfills
@@ -215,50 +154,35 @@ Do NOT offer to proceed until ALL of the following are satisfied. Track these in
215
154
  - [ ] **The biggest technical unknowns / risks** — what could fail, what hasn't been proven
216
155
  - [ ] **What external systems/services this touches** — APIs, databases, third-party services, hardware
217
156
 
218
- Before offering to proceed, demonstrate absorption: reference specific things the user emphasized, specific terminology they used, specific nuance they sharpened — and show how those shaped your understanding. Synthesize, don't recite. "Your emphasis on X led me to prioritize Y over Z" is good. "You said X, you said Y, you said Z" is not. The user should feel heard in the specifics, not just acknowledged in the abstract.
157
+ Before offering to proceed, show absorption: reference specific emphasis, terminology, nuance, and how it shaped your read.
219
158
 
220
159
  ## Depth Verification
221
160
 
222
- Before moving to the wrap-up gate, present a structured depth summary as a checkpoint.
223
-
224
- **Print the summary as normal chat text first** — this is where the formatting renders properly. Structure the summary across the depth checklist dimensions using the user's own terminology and framing. Cover: what you understood them to be building, what shaped your understanding most (their emphasis, constraints, concerns), and any areas where you're least confident in your understanding.
161
+ Before moving to the wrap-up gate, print a structured depth summary in normal chat text. Use the user's terminology across the checklist, including what they are building, what shaped your understanding, and low-confidence areas.
225
162
 
226
163
  **Then confirm:**
227
164
 
228
- **If `{{structuredQuestionsAvailable}}` is `true`:** use `ask_user_questions` with:
229
- - header: "Depth Check"
230
- - question: "Did I capture the depth right?"
231
- - options: "Yes, you got it (Recommended)", "Not quite — let me clarify"
232
- - **The question ID must contain `depth_verification`** (e.g., `depth_verification_confirm`) — this naming convention enables downstream mechanical detection and the write-gate.
165
+ **If `{{structuredQuestionsAvailable}}` is `true`:** use `ask_user_questions` with header "Depth Check", question "Did I capture the depth right?", options "Yes, you got it (Recommended)" and "Not quite — let me clarify". **The question ID must contain `depth_verification`** (e.g., `depth_verification_confirm`) so the write-gate can detect it.
233
166
 
234
- **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.
167
+ **If `{{structuredQuestionsAvailable}}` is `false`:** ask: "Did I capture that correctly? If not, tell me what I missed." Wait for explicit confirmation. **The same non-bypassable gate applies**: no response, ambiguity, or no explicit confirmation means re-ask.
235
168
 
236
169
  If they clarify, absorb the correction and re-verify.
237
170
 
238
171
  The depth verification is the required write-gate. Do **not** add another meta "ready to proceed?" checkpoint immediately after it unless there is still material ambiguity.
239
172
 
240
- **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.
173
+ **CRITICAL — Non-bypassable gate:** The system blocks CONTEXT.md writes until the user selects "(Recommended)" (structured path) or explicitly confirms (plain-text path). If the user declines, cancels, does not respond, or the tool fails, re-ask; never rationalize past the block.
241
174
 
242
175
  ## Wrap-up Gate
243
176
 
244
- Once the depth checklist is fully satisfied, move directly into requirements and roadmap preview. Do not insert a separate "are you ready to continue?" gate unless the user explicitly wants to keep brainstorming or you still see material ambiguity.
177
+ Once the depth checklist is satisfied, move directly into requirements and roadmap preview. Do not add a separate "ready to continue?" gate unless the user wants brainstorming or material ambiguity remains.
245
178
 
246
- If you need a final scope reflection, fold it into the depth summary or roadmap preview rather than asking for permission twice.
179
+ If needed, fold final scope reflection into the depth summary or roadmap preview instead of asking twice.
247
180
 
248
181
  ## Focused Research
249
182
 
250
183
  For a new project or any project that does not yet have `.gsd/REQUIREMENTS.md`, do a focused research pass before roadmap creation.
251
184
 
252
- Research is advisory, not auto-binding. Use the discussion output to identify:
253
- - table stakes the product space usually expects
254
- - domain-standard behaviors the user may or may not want
255
- - likely omissions that would make the product feel incomplete
256
- - plausible anti-features or scope traps
257
- - differentiators worth preserving
258
-
259
- If the research suggests requirements the user did not explicitly ask for, present them as candidate requirements to confirm, defer, or reject. Do not silently turn research into scope.
260
-
261
- For multi-milestone visions, research should cover the full landscape, not just the first milestone. Research findings may affect milestone sequencing, not just slice ordering within M001.
185
+ Research is advisory, not auto-binding. Use discussion output to identify table stakes, domain-standard behaviors, likely omissions, scope traps, and differentiators. Present unrequested requirements as candidates to confirm, defer, or reject. For multi-milestone visions, cover the full landscape because findings may affect milestone sequencing.
262
186
 
263
187
  ## Capability Contract
264
188
 
@@ -266,56 +190,37 @@ Before writing a roadmap, produce or update `.gsd/REQUIREMENTS.md`.
266
190
 
267
191
  Use it as the project's explicit capability contract.
268
192
 
269
- Requirements must be organized into:
270
- - Active
271
- - Validated
272
- - Deferred
273
- - Out of Scope
274
- - Traceability
275
-
276
- Each requirement should include:
277
- - stable ID (`R###`)
278
- - title
279
- - class
280
- - status
281
- - description
282
- - why it matters
283
- - source (`user`, `inferred`, `research`, or `execution`)
284
- - primary owning slice
285
- - supporting slices
286
- - validation status
287
- - notes
193
+ Requirements must be organized into Active, Validated, Deferred, Out of Scope, and Traceability.
194
+
195
+ Each requirement includes stable ID (`R###`), title, class, status, description, why it matters, source (`user`, `inferred`, `research`, or `execution`), primary owning slice, supporting slices, validation status, and notes.
288
196
 
289
197
  Rules:
290
- - Keep requirements capability-oriented, not a giant feature inventory
198
+ - Keep requirements capability-oriented, not a feature inventory
291
199
  - Every Active requirement must either be mapped to a roadmap owner, explicitly deferred, blocked with reason, or moved out of scope
292
200
  - Product-facing work should capture launchability, primary user loop, continuity, and failure visibility when relevant
293
201
  - Later milestones may have provisional ownership, but the first planned milestone should map requirements to concrete slices wherever possible
294
202
 
295
- For multi-milestone projects, requirements should span the full vision. Requirements owned by later milestones get provisional ownership. The full requirement set captures the user's complete vision milestones are the sequencing strategy, not the scope boundary.
203
+ For multi-milestone projects, requirements span the full vision. Later milestones get provisional ownership. The full set captures the complete vision; milestones sequence scope, not bound it.
296
204
 
297
- 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.
205
+ If the project is new or lacks `REQUIREMENTS.md`, surface candidate requirements in chat before roadmap writing. Ask for correction only on material omissions, wrong ownership, or wrong scope. If the user was specific and raises no substantive objection, treat requirements as confirmed.
298
206
 
299
- **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.
207
+ **Print the requirements in chat before writing the roadmap.** The user must see them in terminal. Print a markdown table with ID, Title, Status, Owner, Source, grouped by status. Then ask: "Confirm, adjust, or add?" **Non-bypassable:** no response or ambiguity means re-ask; never proceed without explicit requirement confirmation.
300
208
 
301
209
  ## Scope Assessment
302
210
 
303
- Before moving to output, confirm the size estimate from your reflection still holds. Discussion often reveals hidden complexity or simplifies things. If the scope grew or shrank significantly during Q&A, adjust the milestone and slice counts accordingly. Be honest — if something you thought was multi-milestone turns out to be 3 slices, plan 3 slices. If something you thought was simple turns out to need multiple milestones, say so.
211
+ Before output, confirm the reflection size estimate still holds. If Q&A changed scope, adjust milestone and slice counts honestly.
304
212
 
305
213
  ## Output Phase
306
214
 
307
215
  ### Roadmap Preview
308
216
 
309
- 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.
217
+ Before writing files, **print the planned roadmap in chat** for approval: markdown table with Slice, Title, Risk, Depends, Demo. Below it, print definition of done bullets.
310
218
 
311
- 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."
219
+ If the user objects, adjust. Otherwise ask: "Ready to write, or want to adjust?" One gate, not two. **Non-bypassable:** no response or ambiguity means re-ask; never write files without explicit approval.
312
220
 
313
221
  ### Naming Convention
314
222
 
315
- Directories use bare IDs. Files use ID-SUFFIX format. Titles live inside file content, not in names.
316
- - Milestone dir: `.gsd/milestones/{{milestoneId}}/`
317
- - Milestone files: `{{milestoneId}}-CONTEXT.md`, `{{milestoneId}}-ROADMAP.md`
318
- - Slice dirs: `S01/`, `S02/`, etc.
223
+ Directories use bare IDs. Files use ID-SUFFIX format. Titles live inside file content. Milestone dir: `.gsd/milestones/{{milestoneId}}/`; files: `{{milestoneId}}-CONTEXT.md`, `{{milestoneId}}-ROADMAP.md`; slice dirs: `S01/`, `S02/`, etc.
319
224
 
320
225
  ### Single Milestone
321
226
 
@@ -324,18 +229,13 @@ Once the user is satisfied, in a single pass:
324
229
  2. Write or update `.gsd/PROJECT.md` — use the **Project** output template below. Describe what the project is, its current state, and list the milestone sequence.
325
230
  3. Write or update `.gsd/REQUIREMENTS.md` — use the **Requirements** output template below. Confirm requirement states, ownership, and traceability before roadmap creation.
326
231
  **Depth-Preservation Guidance for context.md:**
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.
232
+ When writing context.md, preserve the user's exact terminology, emphasis, and framing. Do not flatten nuance into generic summaries. If the user said "craft feel," write "craft feel," not "high-quality user experience." CONTEXT.md is downstream agents' only window into this conversation.
328
233
 
329
234
  **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.
235
+ When writing CONTEXT.md, include discussion-layer sections: **Scope**, **Architectural Decisions** with rationale/evidence/alternatives, **Error Handling Strategy**, and **Acceptance Criteria** specific enough for planning.
336
236
 
337
237
  4. Write `{{contextPath}}` — use the **Context** output template below. Preserve key risks, unknowns, existing codebase constraints, integration points, and relevant requirements surfaced during discussion.
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.
238
+ 5. Call `gsd_plan_milestone` to create the roadmap. Decompose into demoable vertical slices with risk, depends, demo sentences, proof strategy, verification classes, definition of done, requirement coverage, and a boundary map. If crossing runtime boundaries, include a final integration slice proving end-to-end behavior in a real environment. Use the **Roadmap** template below for tool parameters.
339
239
  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.
340
240
  7. {{commitInstruction}}
341
241
 
@@ -350,7 +250,7 @@ Before emitting the ready phrase, verify in the CURRENT turn that you have:
350
250
 
351
251
  If ANY box is unchecked, **STOP**. Do NOT emit the ready phrase. Emit the missing tool calls in this same turn. The system detects missing artifacts and will reject premature ready signals — you will be asked again and retries are capped.
352
252
 
353
- Do not announce the ready phrase as something you are "about to" do. Do not narrate "now writing the files" as a substitute for actually writing them. The ready phrase is a post-write signal, not an intent signal.
253
+ Do not announce the ready phrase as something you are "about to" do. It is a post-write signal, not intent.
354
254
 
355
255
  After completing steps 1–7 above, say exactly: "Milestone {{milestoneId}} ready." — nothing else. Auto-mode will start automatically.
356
256
 
@@ -360,7 +260,7 @@ Once the user confirms the milestone split:
360
260
 
361
261
  #### Phase 1: Shared artifacts
362
262
 
363
- 1. For each milestone, call `gsd_milestone_generate_id` to get its ID — never invent milestone IDs manually. Then `mkdir -p .gsd/milestones/<ID>/slices`.
263
+ 1. For each milestone, call `gsd_milestone_generate_id`; never invent IDs. Then `mkdir -p .gsd/milestones/<ID>/slices`.
364
264
  2. Write `.gsd/PROJECT.md` — use the **Project** output template below.
365
265
  3. Write `.gsd/REQUIREMENTS.md` — use the **Requirements** output template below. Capture Active, Deferred, Out of Scope, and any already Validated requirements. Later milestones may have provisional ownership where slice plans do not exist yet.
366
266
  4. For any architectural or pattern decisions made during discussion, call `gsd_decision_save` — the tool auto-assigns IDs and regenerates `.gsd/DECISIONS.md` automatically.
@@ -368,11 +268,11 @@ Once the user confirms the milestone split:
368
268
  #### Phase 2: Primary milestone
369
269
 
370
270
  5. Write a full `CONTEXT.md` for the primary milestone (the one discussed in depth).
371
- 6. Call `gsd_plan_milestone` for **only the primary milestone** detail-planning later milestones now is waste because the codebase will change. Include requirement coverage and a milestone definition of done.
271
+ 6. Call `gsd_plan_milestone` for **only the primary milestone**; detail-planning later milestones now is waste because the codebase will change. Include requirement coverage and definition of done.
372
272
 
373
273
  #### MANDATORY: depends_on Frontmatter in CONTEXT.md
374
274
 
375
- Every CONTEXT.md for a milestone that depends on other milestones MUST have YAML frontmatter with `depends_on`. The auto-mode state machine reads this field to determine execution order without it, milestones may execute out of order or in parallel when they shouldn't.
275
+ Every CONTEXT.md for a milestone that depends on others MUST have YAML frontmatter with `depends_on`. The state machine reads this for execution order; without it, milestones may run out of order or in parallel.
376
276
 
377
277
  ```yaml
378
278
  ---
@@ -382,33 +282,33 @@ depends_on: [M001, M002]
382
282
  # M003: Title
383
283
  ```
384
284
 
385
- If a milestone has no dependencies, omit the frontmatter. The dependency chain from the milestone confirmation gate MUST be reflected in each CONTEXT.md frontmatter. Do NOT rely on QUEUE.md or PROJECT.md for dependency tracking — the state machine only reads CONTEXT.md frontmatter.
285
+ If no dependencies, omit frontmatter. The confirmed dependency chain MUST appear in each CONTEXT.md frontmatter. Do NOT rely on QUEUE.md or PROJECT.md; the state machine reads CONTEXT.md frontmatter only.
386
286
 
387
287
  #### Phase 3: Sequential readiness gate for remaining milestones
388
288
 
389
- For each remaining milestone **one at a time, in sequence**, decide the most likely readiness mode from the evidence you already have, then present the three options below to the user. **If `{{structuredQuestionsAvailable}}` is `true`:** use `ask_user_questions`. **If `{{structuredQuestionsAvailable}}` is `false`:** present the options as a plain-text numbered list and ask the user to type their choice. **Non-bypassable:** If the user does not respond, gives an ambiguous answer, or the tool fails, you MUST re-ask never rationalize past the block or auto-select a readiness mode. Present three options:
289
+ For each remaining milestone **one at a time, in sequence**, choose the likely readiness mode from evidence, then present these options. **If `{{structuredQuestionsAvailable}}` is `true`:** use `ask_user_questions`. **If false:** use a plain-text numbered list. **Non-bypassable:** no response, ambiguity, or tool failure means re-ask; never auto-select.
390
290
 
391
- - **"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.
392
- - **"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.
393
- - **"Just queue it"** — This milestone is identified but intentionally left without context. No context file is written — the directory already exists from Phase 1. **What happens downstream:** When auto-mode reaches this milestone, it pauses and notifies the user to run /gsd. The wizard starts a full discussion from scratch.
291
+ - **"Discuss now"** — Conduct focused discussion now while context is fresh (reflection -> investigation -> questioning -> depth verification), then write full `CONTEXT.md` and move to the next gate.
292
+ - **"Write draft for later"** — Write `CONTEXT-DRAFT.md` with seed material, key ideas, provisional scope, and open questions. Mark it as draft. Downstream auto-mode pauses and offers "Discuss from draft"; final CONTEXT.md deletes the draft.
293
+ - **"Just queue it"** — Leave the milestone without context. Directory exists from Phase 1. Downstream auto-mode pauses and starts full discussion from scratch.
394
294
 
395
295
  **When "Discuss now" is chosen — Technical Assumption Verification is MANDATORY:**
396
296
 
397
297
  Before writing each milestone's CONTEXT.md (whether primary or secondary), you MUST verify technical assumptions:
398
298
 
399
- 1. **Read the actual code** for every file or module you reference. Confirm APIs exist, check what functions actually do, identify phantom capabilities (code that exists but isn't wired up).
400
- 2. **Check for stale assumptions** — the codebase changes. Verify referenced modules still work as described.
401
- 3. **Present findings** — **If `{{structuredQuestionsAvailable}}` is `true`:** use `ask_user_questions` with a question ID containing BOTH `depth_verification` AND the milestone ID (e.g., `depth_verification_M002`). Present: what you're about to write, key technical findings from investigation, risks the code review surfaced. **If `{{structuredQuestionsAvailable}}` is `false`:** present the same findings in plain text and ask for explicit confirmation before proceeding.
299
+ 1. **Read actual code** for every referenced file/module. Confirm APIs exist, behavior matches assumptions, and phantom capabilities are not assumed.
300
+ 2. **Check stale assumptions** — verify referenced modules still work as described.
301
+ 3. **Present findings** — **If `{{structuredQuestionsAvailable}}` is `true`:** use `ask_user_questions` with a question ID containing BOTH `depth_verification` AND milestone ID. Present what you will write, key technical findings, and risks. **If false:** present the same in plain text and ask for explicit confirmation.
402
302
 
403
- **The system mechanically blocks CONTEXT.md writes until the per-milestone depth verification passes** (structured path: user selects "(Recommended)" option; plain-text path: user explicitly confirms). Each milestone needs its own verification — one global verification does not unlock all milestones.
303
+ **The system blocks CONTEXT.md writes until per-milestone depth verification passes** (structured: "(Recommended)"; plain text: explicit confirmation). Each milestone needs its own verification.
404
304
 
405
- **Why sequential, not batch:** After writing the primary milestone's context and roadmap, the agent still has context window capacity. Asking one milestone at a time lets the user decide per-milestone whether to invest that remaining capacity in a focused discussion now, or defer to a future session. A batch question ("Ready/Draft/Queue for M002, M003, M004?") forces the user to decide everything upfront without knowing how much session capacity remains.
305
+ **Why sequential, not batch:** One-at-a-time lets the user decide whether to spend remaining context on focused discussion or defer. Batch decisions force premature choices.
406
306
 
407
- Each context file (full or draft) should be rich enough that a future agent encountering it fresh — with no memory of this conversation — can understand the intent, constraints, dependencies, what this milestone unlocks, and what "done" looks like.
307
+ Each full/draft context must let a future agent understand intent, constraints, dependencies, unlocks, and done criteria without this conversation.
408
308
 
409
309
  #### Milestone Gate Tracking (MANDATORY for multi-milestone)
410
310
 
411
- After EVERY Phase 3 gate decision, immediately write or update `.gsd/DISCUSSION-MANIFEST.json` with the cumulative state. This file is mechanically validated by the system before auto-mode starts — if gates are incomplete, auto-mode will NOT start.
311
+ After EVERY Phase 3 gate decision, immediately write/update `.gsd/DISCUSSION-MANIFEST.json` with cumulative state. The system validates it before auto-mode; incomplete gates block start.
412
312
 
413
313
  ```json
414
314
  {
@@ -423,9 +323,9 @@ After EVERY Phase 3 gate decision, immediately write or update `.gsd/DISCUSSION-
423
323
  }
424
324
  ```
425
325
 
426
- Write this file AFTER each gate decision, not just at the end. Update `gates_completed` incrementally. The system reads this file and BLOCKS auto-start if `gates_completed < total`.
326
+ Write this file AFTER each gate decision, not just at the end. Update `gates_completed` incrementally. Auto-start is blocked if `gates_completed < total`.
427
327
 
428
- For single-milestone projects, do NOT write this file — it is only for multi-milestone discussions.
328
+ For single-milestone projects, do NOT write this file.
429
329
 
430
330
  #### Phase 4: Finalize
431
331
 
@@ -443,7 +343,7 @@ Before emitting the ready phrase, verify in the CURRENT turn that you have:
443
343
 
444
344
  If ANY box is unchecked, **STOP**. Do NOT emit the ready phrase. Emit the missing tool calls in this same turn. The system detects missing artifacts and will reject premature ready signals — you will be asked again and retries are capped.
445
345
 
446
- Do not announce the ready phrase as something you are "about to" do. Do not narrate "now writing the files" as a substitute for actually writing them. The ready phrase is a post-write signal, not an intent signal.
346
+ Do not announce the ready phrase as something you are "about to" do. It is a post-write signal, not intent.
447
347
 
448
348
  After completing all phases above, say exactly: "Milestone M001 ready." — nothing else. Auto-mode will start automatically.
449
349