@opengsd/gsd-core 1.9.1 → 1.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (426) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/.claude-plugin/plugin.json +2 -3
  3. package/.opencode/plugins/gsd-core.js +8 -1
  4. package/agents/gsd-code-fixer.md +27 -3
  5. package/agents/gsd-debug-session-manager.md +11 -0
  6. package/agents/gsd-debugger.md +12 -246
  7. package/agents/gsd-doc-synthesizer.md +2 -4
  8. package/agents/gsd-executor.md +12 -10
  9. package/agents/gsd-integration-checker.md +3 -0
  10. package/agents/gsd-mempalace-curator.md +5 -2
  11. package/agents/gsd-phase-researcher.md +20 -1
  12. package/agents/gsd-plan-checker.md +46 -0
  13. package/agents/gsd-planner.md +49 -54
  14. package/agents/gsd-roadmapper.md +21 -3
  15. package/agents/gsd-user-profiler.md +3 -0
  16. package/agents/gsd-verifier.md +26 -73
  17. package/bin/install.js +1272 -1238
  18. package/bin/lib/ui-safety-gate.cjs +2 -0
  19. package/commands/gsd/code-review.md +1 -1
  20. package/commands/gsd/execute-phase.md +1 -1
  21. package/commands/gsd/map-codebase.md +1 -1
  22. package/commands/gsd/mempalace-capture.md +2 -2
  23. package/commands/gsd/mempalace-recall.md +1 -1
  24. package/commands/gsd/new-milestone.md +2 -2
  25. package/commands/gsd/plan-phase.md +1 -1
  26. package/commands/gsd/quick.md +1 -1
  27. package/commands/gsd/review-backlog.md +2 -1
  28. package/commands/gsd/verify-work.md +1 -1
  29. package/gsd-core/bin/gsd-tools.cjs +1009 -115
  30. package/gsd-core/bin/lib/active-workstream-store.cjs +153 -12
  31. package/gsd-core/bin/lib/agent-install-check.cjs +268 -38
  32. package/gsd-core/bin/lib/api-coverage.cjs +123 -5
  33. package/gsd-core/bin/lib/artifacts.cjs +3 -0
  34. package/gsd-core/bin/lib/assumption-delta.cjs +2 -4
  35. package/gsd-core/bin/lib/audit-command-router.cjs +9 -2
  36. package/gsd-core/bin/lib/audit.cjs +926 -202
  37. package/gsd-core/bin/lib/broken-windows.cjs +36 -6
  38. package/gsd-core/bin/lib/capability-consent.cjs +149 -15
  39. package/gsd-core/bin/lib/capability-lifecycle.cjs +45 -0
  40. package/gsd-core/bin/lib/capability-registry.cjs +608 -148
  41. package/gsd-core/bin/lib/capability-source.cjs +92 -0
  42. package/gsd-core/bin/lib/capability-trust.cjs +444 -25
  43. package/gsd-core/bin/lib/capability-validator.cjs +507 -24
  44. package/gsd-core/bin/lib/capability-writer.cjs +3 -2
  45. package/gsd-core/bin/lib/check-command-router.cjs +114 -38
  46. package/gsd-core/bin/lib/claude-orchestration.cjs +56 -3
  47. package/gsd-core/bin/lib/codex-agent-toml.cjs +329 -0
  48. package/gsd-core/bin/lib/command-aliases.cjs +94 -0
  49. package/gsd-core/bin/lib/command-roster.cjs +44 -1
  50. package/gsd-core/bin/lib/commands.cjs +665 -99
  51. package/gsd-core/bin/lib/commonjs-marker.cjs +142 -0
  52. package/gsd-core/bin/lib/complexity-trigger.cjs +1172 -0
  53. package/gsd-core/bin/lib/config-loader.cjs +76 -0
  54. package/gsd-core/bin/lib/config.cjs +22 -2
  55. package/gsd-core/bin/lib/context-composer.cjs +278 -0
  56. package/gsd-core/bin/lib/context-predicates.cjs +506 -0
  57. package/gsd-core/bin/lib/core-utils.cjs +217 -40
  58. package/gsd-core/bin/lib/decisions.cjs +23 -0
  59. package/gsd-core/bin/lib/docs.cjs +3 -2
  60. package/gsd-core/bin/lib/external-job.cjs +19 -4
  61. package/gsd-core/bin/lib/fallow-runner.cjs +20 -44
  62. package/gsd-core/bin/lib/frontmatter.cjs +239 -32
  63. package/gsd-core/bin/lib/gap-checker.cjs +68 -7
  64. package/gsd-core/bin/lib/gate-predicate-evaluator.cjs +57 -6
  65. package/gsd-core/bin/lib/git-base-branch.cjs +160 -15
  66. package/gsd-core/bin/lib/graphify.cjs +142 -27
  67. package/gsd-core/bin/lib/gsd2-import.cjs +37 -5
  68. package/gsd-core/bin/lib/health-diagnostic-rules/agent-install.cjs +101 -0
  69. package/gsd-core/bin/lib/health-diagnostic-rules/config-validation.cjs +348 -0
  70. package/gsd-core/bin/lib/health-diagnostic-rules/consistency.cjs +145 -0
  71. package/gsd-core/bin/lib/health-diagnostic-rules/install-surface-shadowing.cjs +98 -0
  72. package/gsd-core/bin/lib/health-diagnostic-rules/milestone-archive-hygiene.cjs +100 -0
  73. package/gsd-core/bin/lib/health-diagnostic-rules/phase-structure.cjs +222 -0
  74. package/gsd-core/bin/lib/health-diagnostic-rules/roadmap-disk-consistency.cjs +265 -0
  75. package/gsd-core/bin/lib/health-diagnostic-rules/root-existence.cjs +161 -0
  76. package/gsd-core/bin/lib/health-diagnostic-rules/state-consistency.cjs +303 -0
  77. package/gsd-core/bin/lib/health-diagnostic-rules/worktree-health.cjs +173 -0
  78. package/gsd-core/bin/lib/health-diagnostic-types.cjs +68 -0
  79. package/gsd-core/bin/lib/health-diagnostic.cjs +431 -0
  80. package/gsd-core/bin/lib/host-integration.cjs +13 -1
  81. package/gsd-core/bin/lib/host-runtime-detection.cjs +134 -0
  82. package/gsd-core/bin/lib/init-command-router.cjs +83 -8
  83. package/gsd-core/bin/lib/init.cjs +1325 -169
  84. package/gsd-core/bin/lib/install-effort-resolver.cjs +73 -30
  85. package/gsd-core/bin/lib/install-engine.cjs +805 -264
  86. package/gsd-core/bin/lib/install-fs-adapter.cjs +262 -0
  87. package/gsd-core/bin/lib/install-model-override-resolver.cjs +203 -0
  88. package/gsd-core/bin/lib/install-profiles.cjs +160 -57
  89. package/gsd-core/bin/lib/install-scope.cjs +270 -0
  90. package/gsd-core/bin/lib/install-shadow-report.cjs +385 -0
  91. package/gsd-core/bin/lib/installed-surface-resolver.cjs +381 -0
  92. package/gsd-core/bin/lib/installer-migration-authoring.cjs +3 -1
  93. package/gsd-core/bin/lib/installer-migration-report.cjs +4 -0
  94. package/gsd-core/bin/lib/installer-migrations/007-retire-config-root-commonjs-marker.cjs +149 -0
  95. package/gsd-core/bin/lib/installer-migrations/008-cursor-retire-commands-surface.cjs +55 -0
  96. package/gsd-core/bin/lib/installer-migrations/009-pi-retire-reserved-hooks-dir.cjs +199 -0
  97. package/gsd-core/bin/lib/installer-migrations.cjs +206 -13
  98. package/gsd-core/bin/lib/io.cjs +38 -3
  99. package/gsd-core/bin/lib/markdown-sectionizer.cjs +8 -1
  100. package/gsd-core/bin/lib/markdown-table.cjs +133 -20
  101. package/gsd-core/bin/lib/mcp-catalog.cjs +518 -0
  102. package/gsd-core/bin/lib/mcp-server.cjs +135 -3
  103. package/gsd-core/bin/lib/milestone-lock.cjs +248 -0
  104. package/gsd-core/bin/lib/milestone.cjs +821 -109
  105. package/gsd-core/bin/lib/model-catalog.cjs +59 -1
  106. package/gsd-core/bin/lib/model-resolver.cjs +183 -40
  107. package/gsd-core/bin/lib/normalize-test-command.cjs +1 -1
  108. package/gsd-core/bin/lib/pattern.cjs +122 -0
  109. package/gsd-core/bin/lib/phase-estimation.cjs +1 -1
  110. package/gsd-core/bin/lib/phase-id.cjs +507 -36
  111. package/gsd-core/bin/lib/phase-lifecycle.cjs +28 -3
  112. package/gsd-core/bin/lib/phase-locator.cjs +258 -58
  113. package/gsd-core/bin/lib/phase.cjs +891 -156
  114. package/gsd-core/bin/lib/plan-dependency-graph.cjs +303 -0
  115. package/gsd-core/bin/lib/plan-drift-guard.cjs +120 -0
  116. package/gsd-core/bin/lib/plan-scan.cjs +86 -2
  117. package/gsd-core/bin/lib/planning-scope.cjs +31 -0
  118. package/gsd-core/bin/lib/planning-snapshot.cjs +890 -0
  119. package/gsd-core/bin/lib/planning-workspace.cjs +60 -6
  120. package/gsd-core/bin/lib/probe-core.cjs +1 -1
  121. package/gsd-core/bin/lib/profile-output.cjs +1 -1
  122. package/gsd-core/bin/lib/prompt-budget.cjs +128 -165
  123. package/gsd-core/bin/lib/refactor-trigger-command-router.cjs +740 -0
  124. package/gsd-core/bin/lib/retired-artifact-cleanup.cjs +85 -0
  125. package/gsd-core/bin/lib/review-lane-descriptor.cjs +108 -0
  126. package/gsd-core/bin/lib/review-lane-invocation.cjs +30 -0
  127. package/gsd-core/bin/lib/review-lane-runner.cjs +447 -68
  128. package/gsd-core/bin/lib/review-reviewer-selection.cjs +13 -18
  129. package/gsd-core/bin/lib/roadmap-command-router.cjs +76 -9
  130. package/gsd-core/bin/lib/roadmap-parser.cjs +1035 -194
  131. package/gsd-core/bin/lib/roadmap-upgrade.cjs +37 -10
  132. package/gsd-core/bin/lib/roadmap.cjs +405 -84
  133. package/gsd-core/bin/lib/runtime-artifact-conversion.cjs +795 -100
  134. package/gsd-core/bin/lib/runtime-artifact-install-plan.cjs +14 -2
  135. package/gsd-core/bin/lib/runtime-artifact-layout.cjs +440 -57
  136. package/gsd-core/bin/lib/runtime-config-adapter-registry.cjs +3 -2
  137. package/gsd-core/bin/lib/runtime-homes.cjs +220 -41
  138. package/gsd-core/bin/lib/runtime-hooks-surface.cjs +220 -44
  139. package/gsd-core/bin/lib/runtime-name-policy.cjs +3 -1
  140. package/gsd-core/bin/lib/runtime-slash.cjs +27 -9
  141. package/gsd-core/bin/lib/section-manifest.cjs +209 -0
  142. package/gsd-core/bin/lib/security.cjs +104 -5
  143. package/gsd-core/bin/lib/shell-command-projection.cjs +388 -30
  144. package/gsd-core/bin/lib/smart-entry.cjs +154 -22
  145. package/gsd-core/bin/lib/state-command-router.cjs +5 -1
  146. package/gsd-core/bin/lib/state-document.cjs +152 -8
  147. package/gsd-core/bin/lib/state-transition.cjs +424 -105
  148. package/gsd-core/bin/lib/state.cjs +1927 -401
  149. package/gsd-core/bin/lib/surface.cjs +35 -10
  150. package/gsd-core/bin/lib/text-lines.cjs +80 -0
  151. package/gsd-core/bin/lib/token-scanner.cjs +76 -0
  152. package/gsd-core/bin/lib/uat-predicate.cjs +20 -4
  153. package/gsd-core/bin/lib/uat.cjs +706 -64
  154. package/gsd-core/bin/lib/ui-frontend-evidence.cjs +157 -0
  155. package/gsd-core/bin/lib/ui-safety-gate.cjs +14 -5
  156. package/gsd-core/bin/lib/unusable-input.cjs +33 -0
  157. package/gsd-core/bin/lib/update-context.cjs +8 -2
  158. package/gsd-core/bin/lib/user-artifact-staging.cjs +705 -0
  159. package/gsd-core/bin/lib/validate.cjs +20 -6
  160. package/gsd-core/bin/lib/vendor/README.md +37 -0
  161. package/gsd-core/bin/lib/vendor/re2js.cjs +6480 -0
  162. package/gsd-core/bin/lib/vendor/re2js.d.cts +938 -0
  163. package/gsd-core/bin/lib/verification-command-router.cjs +2 -1
  164. package/gsd-core/bin/lib/verification.cjs +287 -20
  165. package/gsd-core/bin/lib/verify.cjs +368 -880
  166. package/gsd-core/bin/lib/workflow-fragments.cjs +557 -0
  167. package/gsd-core/bin/lib/workstream-inventory-builder.cjs +203 -19
  168. package/gsd-core/bin/lib/workstream-inventory.cjs +576 -31
  169. package/gsd-core/bin/lib/workstream.cjs +8 -2
  170. package/gsd-core/bin/lib/worktree-base-ref.cjs +50 -6
  171. package/gsd-core/bin/lib/worktree-safety.cjs +450 -125
  172. package/gsd-core/bin/shared/config-defaults.manifest.json +1 -0
  173. package/gsd-core/bin/shared/config-schema.manifest.json +9 -1
  174. package/gsd-core/references/agent-contracts.md +43 -26
  175. package/gsd-core/references/artifact-types.md +10 -3
  176. package/gsd-core/references/autonomous-ui-design-contract.md +42 -0
  177. package/gsd-core/references/checkpoints.md +2 -2
  178. package/gsd-core/references/context-budget.md +1 -1
  179. package/gsd-core/references/debugger-techniques.md +255 -0
  180. package/gsd-core/references/dispatch-isolation-gate.md +138 -0
  181. package/gsd-core/references/doc-conflict-engine.md +1 -1
  182. package/gsd-core/references/execute-mvp-tdd.md +3 -3
  183. package/gsd-core/references/execute-phase-between-wave-reset.md +6 -2
  184. package/gsd-core/references/execute-phase-context-guard.md +1 -1
  185. package/gsd-core/references/execute-phase-response-language.md +1 -1
  186. package/gsd-core/references/execute-phase-wave-guard.md +6 -2
  187. package/gsd-core/references/gate-prompts.md +1 -1
  188. package/gsd-core/references/git-planning-commit.md +2 -1
  189. package/gsd-core/references/loop-hook-dispatch.md +39 -2
  190. package/gsd-core/references/model-profiles.md +12 -4
  191. package/gsd-core/references/mvp-concepts.md +9 -9
  192. package/gsd-core/references/planner-guidance.md +3 -9
  193. package/gsd-core/references/planner-preconditions.md +1 -1
  194. package/gsd-core/references/planner-reviews.md +1 -1
  195. package/gsd-core/references/planning-config.md +8 -6
  196. package/gsd-core/references/research-documentation-lookup.md +5 -3
  197. package/gsd-core/references/revision-loop.md +1 -1
  198. package/gsd-core/references/specless-probe-fallback.md +8 -7
  199. package/gsd-core/references/universal-anti-patterns.md +3 -3
  200. package/gsd-core/references/verifier-phase-gates.md +192 -0
  201. package/gsd-core/references/verifier-wiring-patterns.md +100 -0
  202. package/gsd-core/references/verify-mvp-mode.md +1 -1
  203. package/gsd-core/references/workstream-flag.md +22 -6
  204. package/gsd-core/references/worktree-branch-check.md +2 -2
  205. package/gsd-core/templates/discussion-log.md +1 -1
  206. package/gsd-core/templates/phase-prompt.md +2 -4
  207. package/gsd-core/templates/state.md +4 -4
  208. package/gsd-core/templates/summary-complex.md +2 -0
  209. package/gsd-core/templates/summary-minimal.md +2 -0
  210. package/gsd-core/templates/summary-standard.md +2 -0
  211. package/gsd-core/templates/summary.md +2 -0
  212. package/gsd-core/templates/verification-report.md +9 -1
  213. package/gsd-core/workflows/ai-integration-phase.md +9 -11
  214. package/gsd-core/workflows/audit-milestone.md +3 -0
  215. package/gsd-core/workflows/autonomous/steps/converge-banner.md +1 -0
  216. package/gsd-core/workflows/autonomous/steps/converge-dispatch-bg.md +11 -0
  217. package/gsd-core/workflows/autonomous/steps/converge-dispatch-inline.md +7 -0
  218. package/gsd-core/workflows/autonomous/steps/converge-fail-fast.md +21 -0
  219. package/gsd-core/workflows/autonomous/steps/converge-loop.md +7 -0
  220. package/gsd-core/workflows/autonomous.md +33 -70
  221. package/gsd-core/workflows/cleanup.md +62 -3
  222. package/gsd-core/workflows/code-review/steps/dispatch-fix.md +39 -0
  223. package/gsd-core/workflows/code-review/steps/structural-pre-pass.md +93 -0
  224. package/gsd-core/workflows/code-review-fix.md +37 -10
  225. package/gsd-core/workflows/code-review.md +74 -166
  226. package/gsd-core/workflows/complete-milestone/steps/git-tag.md +29 -0
  227. package/gsd-core/workflows/complete-milestone.md +160 -95
  228. package/gsd-core/workflows/debug.md +16 -17
  229. package/gsd-core/workflows/diagnose-issues.md +56 -8
  230. package/gsd-core/workflows/discuss-phase/modes/chain.md +2 -1
  231. package/gsd-core/workflows/discuss-phase/modes/default.md +1 -1
  232. package/gsd-core/workflows/discuss-phase-assumptions/steps/auto-advance-dispatch.md +15 -0
  233. package/gsd-core/workflows/discuss-phase-assumptions.md +7 -17
  234. package/gsd-core/workflows/docs-update/steps/dispatch-monorepo-packages.md +51 -0
  235. package/gsd-core/workflows/docs-update.md +8 -51
  236. package/gsd-core/workflows/edit-phase.md +26 -1
  237. package/gsd-core/workflows/eval-review.md +3 -5
  238. package/gsd-core/workflows/execute-phase/steps/executor-isolation-dispatch.md +64 -7
  239. package/gsd-core/workflows/execute-phase/steps/gap-closure-artifacts.md +50 -0
  240. package/gsd-core/workflows/execute-phase/steps/partial-wave.md +31 -0
  241. package/gsd-core/workflows/execute-phase/steps/per-plan-executor-routing.md +77 -0
  242. package/gsd-core/workflows/execute-phase/steps/per-plan-worktree-gate.md +21 -0
  243. package/gsd-core/workflows/execute-phase/steps/regression-gate-run.md +42 -0
  244. package/gsd-core/workflows/execute-phase/steps/regression-gate.md +43 -37
  245. package/gsd-core/workflows/execute-phase.md +103 -187
  246. package/gsd-core/workflows/execute-plan.md +36 -4
  247. package/gsd-core/workflows/explore.md +131 -4
  248. package/gsd-core/workflows/fast.md +10 -2
  249. package/gsd-core/workflows/health.md +73 -4
  250. package/gsd-core/workflows/help/modes/full.md +6 -1
  251. package/gsd-core/workflows/import.md +4 -4
  252. package/gsd-core/workflows/ingest-docs.md +7 -6
  253. package/gsd-core/workflows/mvp-phase.md +6 -3
  254. package/gsd-core/workflows/new-milestone/steps/project-md-milestone-write.md +16 -0
  255. package/gsd-core/workflows/new-milestone/steps/reset-phase-safety.md +19 -0
  256. package/gsd-core/workflows/new-milestone.md +35 -47
  257. package/gsd-core/workflows/new-project/steps/auto-mode-config.md +176 -0
  258. package/gsd-core/workflows/new-project/steps/auto-mode-detection.md +32 -0
  259. package/gsd-core/workflows/new-project/steps/codebase-map-offer.md +18 -0
  260. package/gsd-core/workflows/new-project.md +27 -240
  261. package/gsd-core/workflows/next.md +12 -0
  262. package/gsd-core/workflows/plan-phase/steps/adr-ingest-express-path.md +15 -0
  263. package/gsd-core/workflows/plan-phase/steps/chunked-planning-mode.md +110 -0
  264. package/gsd-core/workflows/plan-phase/steps/prd-express-gate.md +8 -0
  265. package/gsd-core/workflows/plan-phase/steps/research-only-early-exit.md +17 -0
  266. package/gsd-core/workflows/plan-phase/steps/research-only-modifiers.md +16 -0
  267. package/gsd-core/workflows/plan-phase/steps/reviews-prerequisite.md +17 -0
  268. package/gsd-core/workflows/plan-phase/steps/stall-detection-helpers.md +149 -0
  269. package/gsd-core/workflows/plan-phase.md +89 -209
  270. package/gsd-core/workflows/plan-review-convergence.md +50 -2
  271. package/gsd-core/workflows/progress/steps/forensic-audit.md +125 -0
  272. package/gsd-core/workflows/progress/steps/mvp-display.md +18 -0
  273. package/gsd-core/workflows/progress.md +45 -159
  274. package/gsd-core/workflows/quick/steps/discussion-phase.md +124 -0
  275. package/gsd-core/workflows/quick/steps/plan-checker-loop.md +111 -0
  276. package/gsd-core/workflows/quick/steps/quick-verification.md +67 -0
  277. package/gsd-core/workflows/quick/steps/research-phase.md +72 -0
  278. package/gsd-core/workflows/quick/steps/worktree-pre-dispatch-commit.md +37 -0
  279. package/gsd-core/workflows/quick.md +55 -405
  280. package/gsd-core/workflows/resume-project.md +3 -0
  281. package/gsd-core/workflows/review/steps/reviewer-instances-note-1.md +4 -0
  282. package/gsd-core/workflows/review/steps/reviewer-instances-note-2.md +3 -0
  283. package/gsd-core/workflows/review.md +41 -13
  284. package/gsd-core/workflows/section-manifest.json +219 -0
  285. package/gsd-core/workflows/secure-phase.md +1 -1
  286. package/gsd-core/workflows/session-report.md +2 -1
  287. package/gsd-core/workflows/settings.md +66 -2
  288. package/gsd-core/workflows/ship.md +104 -44
  289. package/gsd-core/workflows/sketch.md +1 -1
  290. package/gsd-core/workflows/spec-phase.md +41 -20
  291. package/gsd-core/workflows/spike-wrap-up.md +20 -5
  292. package/gsd-core/workflows/spike.md +50 -16
  293. package/gsd-core/workflows/sync-skills.md +106 -13
  294. package/gsd-core/workflows/transition/steps/workstream-collision-check.md +17 -0
  295. package/gsd-core/workflows/transition.md +53 -31
  296. package/gsd-core/workflows/ui-phase.md +13 -12
  297. package/gsd-core/workflows/ui-review.md +2 -2
  298. package/gsd-core/workflows/update/steps/channel-banner.md +7 -0
  299. package/gsd-core/workflows/update.md +19 -8
  300. package/gsd-core/workflows/validate-phase.md +1 -1
  301. package/gsd-core/workflows/verify-work/steps/automated-ui-verification.md +36 -0
  302. package/gsd-core/workflows/verify-work/steps/mvp-uat-framing.md +21 -0
  303. package/gsd-core/workflows/verify-work.md +17 -65
  304. package/hooks/dist/gsd-agent-isolation-guard.js +517 -0
  305. package/hooks/dist/gsd-check-update-worker.js +64 -12
  306. package/hooks/dist/gsd-check-update.js +19 -1
  307. package/hooks/dist/gsd-cursor-pre-tool.js +0 -3
  308. package/hooks/dist/gsd-cursor-subagent-start.js +607 -26
  309. package/hooks/dist/gsd-cursor-subagent-stop.js +3 -2
  310. package/hooks/dist/gsd-prompt-guard.js +21 -20
  311. package/hooks/dist/gsd-read-injection-scanner.js +45 -24
  312. package/hooks/dist/gsd-statusline.js +90 -6
  313. package/hooks/dist/gsd-update-banner.js +22 -1
  314. package/hooks/dist/gsd-workflow-guard.js +134 -36
  315. package/hooks/dist/gsd-worktree-path-guard.js +2 -1
  316. package/hooks/dist/gsd-write-guard.js +359 -0
  317. package/hooks/dist/lib/git-cmd.js +92 -59
  318. package/hooks/dist/lib/injection-patterns.js +45 -0
  319. package/hooks/dist/lib/isolation-deny-reason.js +39 -0
  320. package/hooks/dist/lib/isolation-sentinel.js +277 -0
  321. package/hooks/dist/managed-hooks-registry.cjs +2 -0
  322. package/hooks/gsd-agent-isolation-guard.js +517 -0
  323. package/hooks/gsd-check-update-worker.js +64 -12
  324. package/hooks/gsd-check-update.js +19 -1
  325. package/hooks/gsd-cursor-pre-tool.js +0 -3
  326. package/hooks/gsd-cursor-subagent-start.js +607 -26
  327. package/hooks/gsd-cursor-subagent-stop.js +3 -2
  328. package/hooks/gsd-prompt-guard.js +21 -20
  329. package/hooks/gsd-read-injection-scanner.js +45 -24
  330. package/hooks/gsd-statusline.js +90 -6
  331. package/hooks/gsd-update-banner.js +22 -1
  332. package/hooks/gsd-workflow-guard.js +134 -36
  333. package/hooks/gsd-worktree-path-guard.js +2 -1
  334. package/hooks/gsd-write-guard.js +359 -0
  335. package/hooks/hooks.json +12 -0
  336. package/hooks/lib/git-cmd.js +92 -59
  337. package/hooks/lib/injection-patterns.js +45 -0
  338. package/hooks/lib/isolation-deny-reason.js +39 -0
  339. package/hooks/lib/isolation-sentinel.js +277 -0
  340. package/hooks/managed-hooks-registry.cjs +2 -0
  341. package/package.json +31 -10
  342. package/pi/gsd.cjs +71 -12
  343. package/scripts/baselines/planning-prompt-drift-baseline.json +4 -0
  344. package/scripts/baselines/planning-snapshot-bypass-baseline.json +12 -0
  345. package/scripts/baselines/unreachable-guard-drift-baseline.json +4 -0
  346. package/scripts/build-hooks.js +9 -0
  347. package/scripts/changeset/lint.cjs +68 -6
  348. package/scripts/changeset/serialize.cjs +5 -1
  349. package/scripts/check-alias-drift.cjs +7 -43
  350. package/scripts/check-contract-drift.cjs +297 -0
  351. package/scripts/ci-test-scope.cjs +19 -2
  352. package/scripts/command-contract-helpers.cjs +903 -1
  353. package/scripts/gen-adr-index.cjs +728 -38
  354. package/scripts/gen-capability-matrix.cjs +1 -1
  355. package/scripts/gen-capability-registry.cjs +3 -15
  356. package/scripts/gen-context-index.cjs +439 -0
  357. package/scripts/gen-health-docs.cjs +390 -0
  358. package/scripts/gen-inventory-manifest.cjs +150 -4
  359. package/scripts/gen-loop-host-contract.cjs +4 -24
  360. package/scripts/gen-prompt-budget-parity-corpus.cjs +645 -0
  361. package/scripts/gen-registry.cjs +3 -14
  362. package/scripts/gen-section-manifest.cjs +638 -0
  363. package/scripts/generate-package-identity.cjs +4 -2
  364. package/scripts/lib/alias-drift-families.cjs +46 -0
  365. package/scripts/lib/drift-scan.cjs +278 -0
  366. package/scripts/lint-allow-test-rule-refs.allowlist.json +15 -54
  367. package/scripts/lint-allow-test-rule-refs.effective-ceiling.json +4 -0
  368. package/scripts/lint-allow-test-rule-refs.unverified-ceiling.json +3 -0
  369. package/scripts/lint-canary-version-leak.cjs +73 -0
  370. package/scripts/lint-command-contract.cjs +96 -13
  371. package/scripts/lint-compiled-artifact-sync.cjs +6 -1
  372. package/scripts/lint-completion-predicate-drift.cjs +933 -0
  373. package/scripts/lint-completion-ratio-drift.cjs +214 -0
  374. package/scripts/lint-default-flip-documentation.cjs +193 -0
  375. package/scripts/lint-docs-command-form.cjs +195 -0
  376. package/scripts/lint-docs-required.cjs +9 -1
  377. package/scripts/lint-emitted-drift-ack.cjs +215 -20
  378. package/scripts/lint-eslint-glob-coverage.allowlist.json +34 -0
  379. package/scripts/lint-eslint-glob-coverage.cjs +340 -0
  380. package/scripts/lint-example-parser-parity.cjs +395 -0
  381. package/scripts/lint-frontmatter-scalar-broad-grep.cjs +237 -0
  382. package/scripts/lint-health-diagnostic-rule-table.cjs +404 -0
  383. package/scripts/lint-hooks-runtime-build-seam.cjs +262 -0
  384. package/scripts/lint-milestone-window-drift.cjs +468 -0
  385. package/scripts/lint-phase-enumeration-drift.cjs +479 -0
  386. package/scripts/lint-plan-count-drift.cjs +318 -0
  387. package/scripts/lint-planning-artifact-writer-drift.cjs +398 -0
  388. package/scripts/lint-planning-prompt-drift.cjs +434 -0
  389. package/scripts/lint-planning-snapshot-bypass-drift.cjs +544 -0
  390. package/scripts/lint-regression-test-names.cjs +15 -13
  391. package/scripts/lint-removed-but-needed.cjs +320 -0
  392. package/scripts/lint-state-field-drift.cjs +805 -0
  393. package/scripts/lint-state-write-path-drift.cjs +1045 -0
  394. package/scripts/lint-test-file-count.allowlist.json +40 -3
  395. package/scripts/lint-unreachable-guard-drift.cjs +843 -0
  396. package/scripts/lint-vendored-deps.cjs +124 -0
  397. package/scripts/mutation-matrix.cjs +13 -0
  398. package/scripts/pr-changed-files.cjs +63 -0
  399. package/scripts/pr-template-policy.cjs +14 -4
  400. package/scripts/prompt-injection-scan.sh +52 -6
  401. package/scripts/require-issue-link-policy.cjs +192 -0
  402. package/scripts/state-write-path-drift-baseline.json +19 -0
  403. package/scripts/sync-runtime-launcher.cjs +2 -4
  404. package/skills/gsd-autonomous/SKILL.md +0 -1
  405. package/skills/gsd-code-review/SKILL.md +1 -1
  406. package/skills/gsd-execute-phase/SKILL.md +1 -2
  407. package/skills/gsd-map-codebase/SKILL.md +1 -1
  408. package/skills/gsd-mempalace-capture/SKILL.md +2 -2
  409. package/skills/gsd-mempalace-recall/SKILL.md +1 -1
  410. package/skills/gsd-new-milestone/SKILL.md +2 -2
  411. package/skills/gsd-next/SKILL.md +0 -1
  412. package/skills/gsd-plan-phase/SKILL.md +1 -2
  413. package/skills/gsd-progress/SKILL.md +0 -1
  414. package/skills/gsd-quick/SKILL.md +1 -1
  415. package/skills/gsd-review-backlog/SKILL.md +2 -1
  416. package/skills/gsd-stats/SKILL.md +0 -1
  417. package/skills/gsd-verify-work/SKILL.md +1 -1
  418. package/vscode/package.json +1 -1
  419. package/gsd-core/workflows/discovery-phase.md +0 -298
  420. package/gsd-core/workflows/plan-milestone-gaps.md +0 -281
  421. package/gsd-core/workflows/verify-phase.md +0 -577
  422. package/scripts/affected-tests-lib.cjs +0 -554
  423. package/scripts/gen-emitted-baseline.cjs +0 -145
  424. package/scripts/lint-allow-test-rule-refs.cjs +0 -162
  425. package/scripts/run-affected-tests.cjs +0 -7
  426. package/scripts/run-tests.cjs +0 -1050
@@ -9,7 +9,7 @@
9
9
  {
10
10
  "name": "gsd-core",
11
11
  "description": "GSD Core is a meta-prompting, context engineering, and spec-driven development system for AI coding agents.",
12
- "version": "1.9.1",
12
+ "version": "1.11.0",
13
13
  "source": "./",
14
14
  "author": {
15
15
  "name": "open-gsd",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "gsd-core",
3
3
  "displayName": "GSD Core",
4
- "version": "1.9.1",
4
+ "version": "1.11.0",
5
5
  "description": "GSD Core is a meta-prompting, context engineering, and spec-driven development system for AI coding agents.",
6
6
  "author": {
7
7
  "name": "open-gsd",
@@ -19,6 +19,5 @@
19
19
  "gsd"
20
20
  ],
21
21
  "commands": "./commands/gsd/",
22
- "skills": "./skills/",
23
- "hooks": "./hooks/hooks.json"
22
+ "skills": "./skills/"
24
23
  }
@@ -563,7 +563,14 @@ const GsdCorePlugin = async ({ directory } = {}) => {
563
563
  handleHookResult(r, output);
564
564
  }
565
565
 
566
- // 4. gsd-workflow-guard.js — workflow advisory + git-force-add block
566
+ // 4. gsd-write-guard.js — hard-block catastrophic shrink of curated
567
+ // .planning/ artifacts (ROADMAP.md, milestones/*-ROADMAP.md, STATE.md)
568
+ if (claudeTool === "Write") {
569
+ const r = runHook("gsd-write-guard.js", prePayload());
570
+ handleHookResult(r, output);
571
+ }
572
+
573
+ // 5. gsd-workflow-guard.js — workflow advisory + git-force-add block
567
574
  // (covers Write/Edit/MultiEdit AND Bash force-add detection)
568
575
  if (isWriteLike || claudeTool === "Bash") {
569
576
  const r = runHook("gsd-workflow-guard.js", prePayload());
@@ -252,6 +252,17 @@ USE_WORKTREES=$(node -e '
252
252
  branch=$(git branch --show-current)
253
253
  test -n "$branch" || { echo "Detached HEAD is not supported for review-fix (#2686)"; exit 1; }
254
254
 
255
+ # #2647 defense-in-depth: padded_phase is interpolated into a worktree PATH
256
+ # and a git BRANCH NAME below. The orchestrator (code-review-fix.md) already
257
+ # validates it as ^[0-9]+(\.[0-9]+)?$, but this agent prompt is a literal bash
258
+ # contract any caller can spawn — validate at the SINK too, so a future caller
259
+ # that forgets cannot turn ${padded_phase} into a path-traversal or branch-name
260
+ # injection. Reject anything that is not digits + an optional single dotted
261
+ # numeric suffix (e.g. '02' or '36.14'); reject '../', spaces, shell metachars.
262
+ if ! [[ "$padded_phase" =~ ^[0-9]+(\.[0-9]+)?$ ]]; then
263
+ echo "Invalid padded_phase for review-fix: '$padded_phase' (expected e.g. '02' or '36.14')"; exit 1
264
+ fi
265
+
255
266
  # Recovery-sentinel handling (#2839):
256
267
  # Path is ${phase_dir}/.review-fix-recovery-pending.json. If it already exists,
257
268
  # a previous run was interrupted between fix commits and `git worktree remove`.
@@ -303,7 +314,20 @@ if [ "$USE_WORKTREES" = "false" ]; then
303
314
  reviewfix_branch="$branch"
304
315
  echo "workflow.use_worktrees=false — editing/committing in the main checkout (no worktree)."
305
316
  else
306
- wt=$(mktemp -d "/tmp/sv-${padded_phase}-reviewfix-XXXXXX")
317
+ # #2647: create the worktree INSIDE the repo under the same `.claude/worktrees/`
318
+ # dir the harness-managed executor worktrees already use. An absolute `/tmp`
319
+ # path landed outside the project tree (outside the agent session's permission
320
+ # allowlist → every Read inside prompted; on Windows/Git Bash mktemp also
321
+ # produced an un-removable short `C:/mvwtNN` path to dodge MAX_PATH). A
322
+ # repo-relative path inherits the repository's existing permission scope, is
323
+ # valid and short on Windows as well as POSIX, and is covered by the single
324
+ # `.gitignore` rule for `.claude/` (`.gitignore:12`). Uniqueness across
325
+ # concurrent runs for the same phase comes from the PID (`$$`) + epoch suffix
326
+ # (replacing mktemp's XXXXXX). `$main_repo` is resolved the same way the
327
+ # cleanup tail below resolves it (`git worktree list --porcelain` first line).
328
+ main_repo="$(git worktree list --porcelain | awk '/^worktree / { sub(/^worktree /, ""); print; exit }')"
329
+ wt="$main_repo/.claude/worktrees/rf-${padded_phase}-$$-$(date +%s)"
330
+ mkdir -p "$wt"
307
331
 
308
332
  # Create a temp branch from the current branch tip so the worktree
309
333
  # attaches to that NEW branch rather than the user's currently-checked-out
@@ -338,7 +362,7 @@ Concrete steps:
338
362
  1. Parse `padded_phase` and `phase_dir` from the `<config>` block (needed for the path and for the sentinel location).
339
363
  2. Resolve the current branch: `branch=$(git branch --show-current)`. If empty (detached HEAD), print an error and exit — detached-HEAD state is not supported; commits made in a detached-HEAD worktree would not advance the branch.
340
364
  3. **Recovery check (#2839, #2990):** If `${phase_dir}/.review-fix-recovery-pending.json` already exists, a prior run was interrupted. Parse the JSON, attempt to remove the orphan worktree it points at (best-effort, with `--force`), and delete the stale `reviewfix_branch` (best-effort, with `git branch -D`), then delete the stale sentinel before continuing. This makes a re-run of `/gsd:code-review --fix` self-healing.
341
- 4. Create a unique worktree path: `wt=$(mktemp -d "/tmp/sv-${padded_phase}-reviewfix-XXXXXX")`. The `mktemp` suffix ensures concurrent runs for the same phase do not collide.
365
+ 4. Create a unique worktree path **inside the repo**: `main_repo="$(git worktree list --porcelain | awk '/^worktree / { sub(/^worktree /, ""); print; exit }')"` then `wt="$main_repo/.claude/worktrees/rf-${padded_phase}-$$-$(date +%s)"` + `mkdir -p "$wt"`. The path lives under the same `.claude/worktrees/` dir the harness-managed executor worktrees use (already gitignored via `.claude/`, already in the session's permission scope), and the `$$`-PID + epoch suffix ensures concurrent runs for the same phase do not collide (#2647 — an absolute `/tmp` path landed outside the project tree and prompted on every read).
342
366
  5. Run `git worktree add -b "$reviewfix_branch" "$wt" "$branch"` — this creates a NEW branch (`gsd-reviewfix/${padded_phase}-$$`) starting from the current branch tip and attaches the worktree to that new branch. Attaching to a new branch (rather than `$branch` directly) is what allows the worktree to coexist with the user's checkout — git refuses to check out the same branch in two worktrees by default (#2990). Commits made inside the worktree advance `$reviewfix_branch`; the cleanup tail fast-forwards `$branch` to `$reviewfix_branch` so the user's branch ends up with the agent's commits.
343
367
  6. **Write the recovery sentinel** at `${phase_dir}/.review-fix-recovery-pending.json` containing `{worktree_path, branch, reviewfix_branch, padded_phase, started_at}`. Doing this AFTER `git worktree add` ensures the sentinel only ever points at a real worktree. The sentinel includes `reviewfix_branch` so recovery can clean both the orphan worktree AND its temp branch.
344
368
  7. All subsequent file reads, edits, and commits happen inside `$wt` (which is on `$reviewfix_branch`, not `$branch`).
@@ -636,7 +660,7 @@ _Iteration: {N}_
636
660
 
637
661
  <critical_rules>
638
662
 
639
- **ALWAYS run inside the isolated worktree** — set up via `branch=$(git branch --show-current)` + `wt=$(mktemp -d "/tmp/sv-${padded_phase}-reviewfix-XXXXXX")` + `git worktree add -b "$reviewfix_branch" "$wt" "$branch"` at the very start (see `setup_worktree` step). Using `mktemp` ensures concurrent runs do not collide. Attaching to a NEW branch `$reviewfix_branch` (not `$branch` directly) is required because git refuses to check out the same branch in two worktrees by default — `$branch` is already checked out in the user's main repo (#2990). Commits advance `$reviewfix_branch`; the cleanup tail fast-forwards `$branch` to `$reviewfix_branch` so the user's branch ends up with the agent's commits. Every file read, edit, and commit must happen inside `$wt`. Run the four-step cleanup tail when done (treat it as a finally block) — but only when a worktree was actually created; when `workflow.use_worktrees` is `false` the cleanup early-exits (no worktree to remove). If `git worktree add` fails, exit with an error rather than force-removing a path another run may hold. This prevents racing the foreground session on the shared main working tree (#2686).
663
+ **ALWAYS run inside the isolated worktree** — set up via `branch=$(git branch --show-current)` + `main_repo="$(git worktree list --porcelain | awk '/^worktree / { sub(/^worktree /, ""); print; exit }')"` + `wt="$main_repo/.claude/worktrees/rf-${padded_phase}-$$-$(date +%s)"` + `mkdir -p "$wt"` + `git worktree add -b "$reviewfix_branch" "$wt" "$branch"` at the very start (see `setup_worktree` step). The worktree path is repo-relative under `.claude/worktrees/` (the same dir the harness-managed executor worktrees use — gitignored via `.claude/`, inside the session's permission scope); the `$$`-PID + epoch suffix ensures concurrent runs do not collide (#2647 — a hardcoded `/tmp` path landed outside the project tree and prompted on every read). Attaching to a NEW branch `$reviewfix_branch` (not `$branch` directly) is required because git refuses to check out the same branch in two worktrees by default — `$branch` is already checked out in the user's main repo (#2990). Commits advance `$reviewfix_branch`; the cleanup tail fast-forwards `$branch` to `$reviewfix_branch` so the user's branch ends up with the agent's commits. Every file read, edit, and commit must happen inside `$wt`. Run the four-step cleanup tail when done (treat it as a finally block) — but only when a worktree was actually created; when `workflow.use_worktrees` is `false` the cleanup early-exits (no worktree to remove). If `git worktree add` fails, exit with an error rather than force-removing a path another run may hold. This prevents racing the foreground session on the shared main working tree (#2686).
640
664
 
641
665
  **#2825 — honor `workflow.use_worktrees`.** Before creating a worktree, read the
642
666
  `workflow.use_worktrees` config flag (the documented opt-out — same key the four sibling writer
@@ -33,6 +33,7 @@ Received from spawning orchestrator:
33
33
  - `tdd_mode` — boolean; true if TDD gate is active
34
34
  - `goal` — `find_root_cause_only` | `find_and_fix`
35
35
  - `specialist_dispatch_enabled` — boolean; true if specialist skill review is enabled
36
+ - `resume` — boolean; present only on an orchestrator auto-resume re-spawn (#3448), accompanied by `resume_status` and `resume_next_action` (the checkpoint's `status`/`next_action` read from the debug file at resume time). When `resume: true`, any earlier checkpoint in the session was already answered — carry that disposition and the recorded next action into the Step 2 dispatch.
36
37
  </session_parameters>
37
38
 
38
39
  <process>
@@ -75,6 +76,16 @@ Continue debugging {slug}. Evidence is in the debug file.
75
76
  </required_reading>
76
77
  </prior_state>
77
78
 
79
+ {if resume: "<resume_directive>
80
+ DATA_START
81
+ **Status at pause:** {resume_status}
82
+ **Recorded next action — resume here and proceed directly on it:** {resume_next_action}
83
+ **Prior checkpoints:** already answered by the user; do not re-raise them. Route only
84
+ genuinely NEW human input (a pending decision or destructive-action approval) back through
85
+ the checkpoint loop, never a re-ask of an answered one.
86
+ DATA_END
87
+ </resume_directive>"}
88
+
78
89
  <mode>
79
90
  symptoms_prefilled: {symptoms_prefilled}
80
91
  goal: {goal}
@@ -168,73 +168,20 @@ try {
168
168
 
169
169
  <investigation_techniques>
170
170
 
171
- ## Binary Search / Divide and Conquer
171
+ ## Technique Catalog
172
172
 
173
- **When:** Large codebase, long execution path, many possible failure points.
173
+ Full step-by-step bodies for every technique below: @gsd-core/references/debugger-techniques.md
174
174
 
175
- **How:** Cut problem space in half repeatedly until you isolate the issue.
176
-
177
- 1. Identify boundaries (where works, where fails)
178
- 2. Add logging/testing at midpoint
179
- 3. Determine which half contains the bug
180
- 4. Repeat until you find exact line
181
-
182
- **Example:** API returns wrong data
183
- - Test: Data leaves database correctly? YES
184
- - Test: Data reaches frontend correctly? NO
185
- - Test: Data leaves API route correctly? YES
186
- - Test: Data survives serialization? NO
187
- - **Found:** Bug in serialization layer (4 tests eliminated 90% of code)
188
-
189
- ## Rubber Duck Debugging
190
-
191
- **When:** Stuck, confused, mental model doesn't match reality.
192
-
193
- **How:** Explain the problem out loud in complete detail.
194
-
195
- Write or say:
196
- 1. "The system should do X"
197
- 2. "Instead it does Y"
198
- 3. "I think this is because Z"
199
- 4. "The code path is: A -> B -> C -> D"
200
- 5. "I've verified that..." (list what you tested)
201
- 6. "I'm assuming that..." (list assumptions)
202
-
203
- Often you'll spot the bug mid-explanation: "Wait, I never verified that B returns what I think it does."
204
-
205
- ## Delta Debugging
206
-
207
- **When:** Large change set is suspected (many commits, a big refactor, or a complex feature that broke something). Also when "comment out everything" is too slow.
208
-
209
- **How:** Binary search over the change space — not just the code, but the commits, configs, and inputs.
210
-
211
- **Over commits (use git bisect):**
212
- Already covered under Git Bisect. But delta debugging extends it: after finding the breaking commit, delta-debug the commit itself — identify which of its N changed files/lines actually causes the failure.
213
-
214
- **Over code (systematic elimination):**
215
- 1. Identify the boundary: a known-good state (commit, config, input) vs the broken state
216
- 2. List all differences between good and bad states
217
- 3. Split the differences in half. Apply only half to the good state.
218
- 4. If broken: bug is in the applied half. If not: bug is in the other half.
219
- 5. Repeat until you have the minimal change set that causes the failure.
220
-
221
- **Over inputs:**
222
- 1. Find a minimal input that triggers the bug (strip out unrelated data fields)
223
- 2. The minimal input reveals which code path is exercised
224
-
225
- **When to use:**
226
- - "This worked yesterday, something changed" → delta debug commits
227
- - "Works with small data, fails with real data" → delta debug inputs
228
- - "Works without this config change, fails with it" → delta debug config diff
229
-
230
- **Example:** 40-file commit introduces bug
231
- ```
232
- Split into two 20-file halves.
233
- Apply first 20: still works → bug in second half.
234
- Split second half into 10+10.
235
- Apply first 10: broken → bug in first 10.
236
- ... 6 splits later: single file isolated.
237
- ```
175
+ - **Binary Search / Divide and Conquer** — halve the search space until the fault localizes.
176
+ - **Rubber Duck Debugging** — reconstruct the mental model aloud; the gap is the bug.
177
+ - **Delta Debugging** — shrink a failing input to its minimal failing core.
178
+ - **Minimal Reproduction** — strip everything not required to reproduce.
179
+ - **Working Backwards** — start at the symptom and walk causality in reverse.
180
+ - **Differential Debugging** — compare a working case against a failing one.
181
+ - **Observability First** — add instrumentation before forming further hypotheses.
182
+ - **Comment Out Everything** — reduce to nothing, restore until the fault returns.
183
+ - **Git Bisect** — binary-search history for the introducing commit.
184
+ - **Follow the Indirection** — trace each hop when the fault hides behind a layer.
238
185
 
239
186
  ## Structured Reasoning Checkpoint
240
187
 
@@ -268,187 +215,6 @@ reasoning_checkpoint:
268
215
 
269
216
  If you cannot fill all seven fields with specific, concrete answers — you do not have a confirmed root cause yet. Return to investigation_loop.
270
217
 
271
- ## Minimal Reproduction
272
-
273
- **When:** Complex system, many moving parts, unclear which part fails.
274
-
275
- **How:** Strip away everything until smallest possible code reproduces the bug.
276
-
277
- 1. Copy failing code to new file
278
- 2. Remove one piece (dependency, function, feature)
279
- 3. Test: Does it still reproduce? YES = keep removed. NO = put back.
280
- 4. Repeat until bare minimum
281
- 5. Bug is now obvious in stripped-down code
282
- 6. **Shrinking (input-space bugs)** — when the bug triggers on a class of inputs, wrap it in a property (fast-check for JS/TS, Hypothesis for Python) and let the shrinker auto-minimize the counterexample; store the **minimized** input as the regression seed. See `gsd-core/references/debugger-repro-hardening.md`.
283
-
284
- **Example:**
285
- ```jsx
286
- // Start: 500-line React component with 15 props, 8 hooks, 3 contexts
287
- // End after stripping:
288
- function MinimalRepro() {
289
- const [count, setCount] = useState(0);
290
-
291
- useEffect(() => {
292
- setCount(count + 1); // Bug: infinite loop, missing dependency array
293
- });
294
-
295
- return <div>{count}</div>;
296
- }
297
- // The bug was hidden in complexity. Minimal reproduction made it obvious.
298
- ```
299
-
300
- ## Working Backwards
301
-
302
- **When:** You know correct output, don't know why you're not getting it.
303
-
304
- **How:** Start from desired end state, trace backwards.
305
-
306
- 1. Define desired output precisely
307
- 2. What function produces this output?
308
- 3. Test that function with expected input - does it produce correct output?
309
- - YES: Bug is earlier (wrong input)
310
- - NO: Bug is here
311
- 4. Repeat backwards through call stack
312
- 5. Find divergence point (where expected vs actual first differ)
313
-
314
- **Example:** UI shows "User not found" when user exists
315
- ```
316
- Trace backwards:
317
- 1. UI displays: user.error → Is this the right value to display? YES
318
- 2. Component receives: user.error = "User not found" → Correct? NO, should be null
319
- 3. API returns: { error: "User not found" } → Why?
320
- 4. Database query: SELECT * FROM users WHERE id = 'undefined' → AH!
321
- 5. FOUND: User ID is 'undefined' (string) instead of a number
322
- ```
323
-
324
- ## Differential Debugging
325
-
326
- **When:** Something used to work and now doesn't. Works in one environment but not another.
327
-
328
- **Time-based (worked, now doesn't):**
329
- - What changed in code since it worked?
330
- - What changed in environment? (Node version, OS, dependencies)
331
- - What changed in data?
332
- - What changed in configuration?
333
-
334
- **Environment-based (works in dev, fails in prod):**
335
- - Configuration values
336
- - Environment variables
337
- - Network conditions (latency, reliability)
338
- - Data volume
339
- - Third-party service behavior
340
-
341
- **Process:** List differences, test each in isolation, find the difference that causes failure.
342
-
343
- **Example:** Works locally, fails in CI
344
- ```
345
- Differences:
346
- - Node version: Same ✓
347
- - Environment variables: Same ✓
348
- - Timezone: Different! ✗
349
-
350
- Test: Set local timezone to UTC (like CI)
351
- Result: Now fails locally too
352
- FOUND: Date comparison logic assumes local timezone
353
- ```
354
-
355
- ## Observability First
356
-
357
- **When:** Always. Before making any fix.
358
-
359
- **Add visibility before changing behavior:**
360
-
361
- ```javascript
362
- // Strategic logging (useful):
363
- console.log('[handleSubmit] Input:', { email, password: '***' });
364
- console.log('[handleSubmit] Validation result:', validationResult);
365
- console.log('[handleSubmit] API response:', response);
366
-
367
- // Assertion checks:
368
- console.assert(user !== null, 'User is null!');
369
- console.assert(user.id !== undefined, 'User ID is undefined!');
370
-
371
- // Timing measurements:
372
- console.time('Database query');
373
- const result = await db.query(sql);
374
- console.timeEnd('Database query');
375
-
376
- // Stack traces at key points:
377
- console.log('[updateUser] Called from:', new Error().stack);
378
- ```
379
-
380
- **Workflow:** Add logging -> Run code -> Observe output -> Form hypothesis -> Then make changes.
381
-
382
- ## Comment Out Everything
383
-
384
- **When:** Many possible interactions, unclear which code causes issue.
385
-
386
- **How:**
387
- 1. Comment out everything in function/file
388
- 2. Verify bug is gone
389
- 3. Uncomment one piece at a time
390
- 4. After each uncomment, test
391
- 5. When bug returns, you found the culprit
392
-
393
- **Example:** Some middleware breaks requests, but you have 8 middleware functions
394
- ```javascript
395
- app.use(helmet()); // Uncomment, test → works
396
- app.use(cors()); // Uncomment, test → works
397
- app.use(compression()); // Uncomment, test → works
398
- app.use(bodyParser.json({ limit: '50mb' })); // Uncomment, test → BREAKS
399
- // FOUND: Body size limit too high causes memory issues
400
- ```
401
-
402
- ## Git Bisect
403
-
404
- **When:** Feature worked in past, broke at unknown commit.
405
-
406
- **How:** Binary search through git history.
407
-
408
- ```bash
409
- git bisect start
410
- git bisect bad # Current commit is broken
411
- git bisect good abc123 # This commit worked
412
- # Git checks out middle commit
413
- git bisect bad # or good, based on testing
414
- # Repeat until culprit found
415
- ```
416
-
417
- 100 commits between working and broken: ~7 tests to find exact breaking commit.
418
-
419
- ## Follow the Indirection
420
-
421
- **When:** Code constructs paths, URLs, keys, or references from variables — and the constructed value might not point where you expect.
422
-
423
- **The trap:** You read code that builds a path like `path.join(configDir, 'hooks')` and assume it's correct because it looks reasonable. But you never verified that the constructed path matches where another part of the system actually writes/reads.
424
-
425
- **How:**
426
- 1. Find the code that **produces** the value (writer/installer/creator)
427
- 2. Find the code that **consumes** the value (reader/checker/validator)
428
- 3. Trace the actual resolved value in both — do they agree?
429
- 4. Check every variable in the path construction — where does each come from? What's its actual value at runtime?
430
-
431
- **Common indirection bugs:**
432
- - Path A writes to `dir/sub/hooks/` but Path B checks `dir/hooks/` (directory mismatch)
433
- - Config value comes from cache/template that wasn't updated
434
- - Variable is derived differently in two places (e.g., one adds a subdirectory, the other doesn't)
435
- - Template placeholder (`{{VERSION}}`) not substituted in all code paths
436
-
437
- **Example:** Stale hook warning persists after update
438
- ```
439
- Check code says: hooksDir = path.join(configDir, 'hooks')
440
- configDir = ~/.claude
441
- → checks ~/.claude/hooks/
442
-
443
- Installer says: hooksDest = path.join(targetDir, 'hooks')
444
- targetDir = ~/.claude/gsd-core
445
- → writes to ~/.claude/gsd-core/hooks/
446
-
447
- MISMATCH: Checker looks in wrong directory → hooks "not found" → reported as stale
448
- ```
449
-
450
- **The discipline:** Never assume a constructed path is correct. Resolve it to its actual value and verify the other side agrees. When two systems share a resource (file, directory, key), trace the full path in both.
451
-
452
218
  ## Technique Selection (routed by bug class)
453
219
 
454
220
  Classify the failure first (Phase 1.75), then route by class — not by ad-hoc
@@ -17,7 +17,7 @@ You are a GSD doc synthesizer. You consume per-doc classification JSON files and
17
17
  You do NOT prompt the user. You do NOT write PROJECT.md, REQUIREMENTS.md, or ROADMAP.md — those are produced downstream by `gsd-roadmapper` using your output. Your job is synthesis + conflict surfacing.
18
18
 
19
19
  **CRITICAL: Mandatory Initial Read**
20
- If the prompt contains a `<required_reading>` block, load every file listed there first — especially `references/doc-conflict-engine.md` which defines your conflict report format.
20
+ If the prompt contains a `<required_reading>` block, load every file listed there first — especially `gsd-core/references/doc-conflict-engine.md` which defines your conflict report format.
21
21
  </role>
22
22
 
23
23
  @~/.claude/gsd-core/references/untrusted-input-boundary.md
@@ -173,7 +173,7 @@ Absent fields → mark absent (empty / omit), never fabricate. LOCKED-vs-LOCKED
173
173
  </terminal_output_schema_restatement>
174
174
 
175
175
  <step name="write_conflicts_report">
176
- Write `CONFLICTS_PATH` using the format from `references/doc-conflict-engine.md`. Three buckets, plain text, no tables.
176
+ Write `CONFLICTS_PATH` using the format from `gsd-core/references/doc-conflict-engine.md`. Three buckets, plain text, no tables.
177
177
 
178
178
  Structure:
179
179
 
@@ -224,8 +224,6 @@ This is the single entry point `gsd-roadmapper` reads.
224
224
  Return ≤ 10 lines to the orchestrator:
225
225
 
226
226
  ```
227
- ## Synthesis Complete
228
-
229
227
  Docs synthesized: {N} ({breakdown})
230
228
  Decisions locked: {N}
231
229
  Requirements: {N}
@@ -26,10 +26,12 @@ When you need library or framework documentation, check in this order:
26
26
 
27
27
  1. If Context7 MCP tools (`mcp__context7__*, mcp__plugin_context7_context7__*`) are available in your environment, use them:
28
28
  - Resolve library ID: `mcp__context7__resolve-library-id` with `libraryName`
29
- - Fetch docs: `mcp__context7__get-library-docs` with `context7CompatibleLibraryId` and `topic`
29
+ - Fetch docs: `mcp__context7__query-docs` with `libraryId` (the ID from step 1) and `query`
30
30
 
31
- 2. If Context7 MCP is not available (upstream bug anthropics/claude-code#13898 strips MCP
32
- tools from agents with a `tools:` frontmatter restriction), use the CLI fallback via Bash:
31
+ 2. If Context7 MCP is not available (custom subagents cannot see project-scoped
32
+ `.mcp.json` servers — they only inherit user-scoped `~/.claude/mcp.json`, so a
33
+ context7 server configured at the project scope is invisible to spawned
34
+ agents), use the CLI fallback via Bash:
33
35
 
34
36
  Step 1 — Resolve library ID:
35
37
  ```bash
@@ -146,7 +148,7 @@ For each task:
146
148
 
147
149
  0. **Precondition check (before any other task work):** If the task carries a `<precondition>` element, evaluate that single prose line first — it names a runnable/checkable fact the task assumes (env var set, prior-phase artifact present, server responding to `/health`, `user_setup` step done). Verify with **read-only checks only** — file existence, env var presence (no value output), idempotent `GET /health`-style pings. Do NOT run commands with side effects (writes, network POSTs, secret emission) as the check; if a side-effecting check seems required, halt and surface via checkpoint instead.
148
150
  - **Met OR absent:** continue with no visible change to execution flow. The precondition is a no-op for the rest of the task loop.
149
- - **Unmet:** STOP — return a `checkpoint:human-verify` (use `checkpoint_return_format`) with `**Blocked by:** Precondition not met: <precondition text>`. Do NOT partial-commit the task. Unmet preconditions are NEVER auto-approved, even under `AUTO_CFG=true` — a missing prerequisite is not a verification step a human can rubber-stamp; it is a fact the executor cannot establish on its own. The human either satisfies the precondition (sets the env var, completes the `user_setup` step, regenerates the artifact) or reruns `/gsd:plan-phase` to restructure.
151
+ - **Unmet:** STOP — return a `checkpoint:human-verify` reporting `**Gate:** blocking-human` (use `checkpoint_return_format`) with `**Blocked by:** Precondition not met: <precondition text>`. Do NOT partial-commit the task. Unmet preconditions are NEVER auto-approved, even under `AUTO_CFG=true` — a missing prerequisite is not a verification step a human can rubber-stamp; it is a fact the executor cannot establish on its own. The human either satisfies the precondition (sets the env var, completes the `user_setup` step, regenerates the artifact) or reruns `/gsd:plan-phase` to restructure.
150
152
 
151
153
  1. **If `type="auto"`:**
152
154
  - Check for `tdd="true"` → follow TDD execution flow
@@ -326,7 +328,7 @@ For full automation-first patterns, server lifecycle, CLI handling:
326
328
 
327
329
  **Auto-mode checkpoint behavior** (when `AUTO_CFG` is `"true"`):
328
330
 
329
- - **checkpoint:human-verify** → Auto-approve **except package-legitimacy checkpoints**. If checkpoint has `gate="blocking-human"` OR its purpose indicates package legitimacy verification (`what-built` mentions `Package verification required before install` or `Package install failed — human verification required`), do **not** auto-approve. STOP and return checkpoint_return_format for explicit human confirmation.
331
+ - **checkpoint:human-verify** → Auto-approve **except package-legitimacy checkpoints**. If checkpoint has `gate="blocking-human"` OR its purpose indicates package legitimacy verification (`what-built` mentions `Package verification required before install` or `Package install failed — human verification required`), do **not** auto-approve. STOP and return checkpoint_return_format for explicit human confirmation. Precondition-unmet checkpoints report `blocking-human` — never auto-approved.
330
332
  - **checkpoint:decision** → If checkpoint has `gate="blocking-human"`, do **not** auto-select — STOP and return checkpoint_return_format for an explicit human decision (a `blocking-human` decision exists because its default answer would be wrong to assume). Otherwise auto-select first option (planners front-load the recommended choice), log `⚡ Auto-selected: [option name]`, continue to next task.
331
333
  - **checkpoint:human-action** → STOP normally. Auth gates cannot be automated — return structured checkpoint message using checkpoint_return_format.
332
334
 
@@ -352,7 +354,7 @@ When hitting checkpoint or auth gate, return this structure:
352
354
  ## CHECKPOINT REACHED
353
355
 
354
356
  **Type:** [human-verify | decision | human-action]
355
- **Gate:** [blocking | blocking-human] — copy the task's `gate` attribute verbatim so the orchestrator's carve-out sees it
357
+ **Gate:** [blocking | blocking-human] — copy the task's `gate` attribute verbatim (precondition-unmet checkpoints report `blocking-human`)
356
358
  **Plan:** {phase}-{plan}
357
359
  **Progress:** {completed}/{total} tasks complete
358
360
 
@@ -424,7 +426,7 @@ If RED or GREEN gate commits are missing, add a warning to SUMMARY.md under a `#
424
426
  **Halt-and-report protocol:**
425
427
 
426
428
  1. Stop. Do not run the task's implementation step.
427
- 2. Emit the structured halt report defined in `references/execute-mvp-tdd.md` (header line, reason code, expected behavior, required next step).
429
+ 2. Emit the structured halt report defined in `gsd-core/references/execute-mvp-tdd.md` (header line, reason code, expected behavior, required next step).
428
430
  3. Update `STATE.md` with `last_gate_trip: {plan_id}/{task_id}`.
429
431
  4. Exit the current execution wave cleanly. Prior commits in the same wave stay — do not roll back.
430
432
 
@@ -434,7 +436,7 @@ If RED or GREEN gate commits are missing, add a warning to SUMMARY.md under a `#
434
436
  IS_BEHAVIOR_ADDING=$(gsd_run query task.is-behavior-adding "$TASK_FILE" --pick is_behavior_adding)
435
437
  ```
436
438
 
437
- The verb owns the canonical predicate (tdd="true" frontmatter AND `<behavior>` block AND non-test source files in `<files>`). Pure doc-only / config-only / test-only tasks return `false` and are exempt. Full result also exposes per-check breakdown (`checks.tdd_true`, `checks.has_behavior_block`, `checks.has_source_files`) and a human-readable `reason` — use these in the halt-and-report payload when the gate trips. See `references/execute-mvp-tdd.md` for halt protocol.
439
+ The verb owns the canonical predicate (tdd="true" frontmatter AND `<behavior>` block AND non-test source files in `<files>`). Pure doc-only / config-only / test-only tasks return `false` and are exempt. Full result also exposes per-check breakdown (`checks.tdd_true`, `checks.has_behavior_block`, `checks.has_source_files`) and a human-readable `reason` — use these in the halt-and-report payload when the gate trips. See `gsd-core/references/execute-mvp-tdd.md` for halt protocol.
438
440
 
439
441
  **Mode is all-or-nothing per phase** (PRD decision Q1, inherited from Phase 1). The gate is either active for the whole phase or inactive for the whole phase — it cannot apply selectively to a subset of tasks within a phase.
440
442
 
@@ -498,8 +500,8 @@ if [ -f .git ]; then # worktree
498
500
  # Positive allow-list: HEAD must be on a per-agent branch (`agent-<id>` or
499
501
  # legacy `worktree-agent-<id>`). This catches feature/* and any other
500
502
  # arbitrary branch that the deny-list would silently allow (#2924, #1995).
501
- if ! echo "$ACTUAL_BRANCH" | grep -Eq '^(worktree-)?agent-[A-Za-z0-9._/-]+$'; then
502
- echo "FATAL: refusing to commit — worktree HEAD '$ACTUAL_BRANCH' is not in the agent-* / worktree-agent-* namespace." >&2
503
+ if ! echo "$ACTUAL_BRANCH" | grep -Eq '^((worktree-)?agent-|worktree-wf_)[A-Za-z0-9._/-]+$'; then
504
+ echo "FATAL: refusing to commit — worktree HEAD '$ACTUAL_BRANCH' is not in the agent-* / worktree-agent-* / worktree-wf_* namespace." >&2
503
505
  echo "Agent commits must live on per-agent branches; surface as blocker (#2924)." >&2
504
506
  exit 1
505
507
  fi
@@ -94,6 +94,9 @@ For each phase, extract what it provides and what it should consume.
94
94
  **From SUMMARYs, extract:**
95
95
 
96
96
  ```bash
97
+ # #2962: zsh aborts the block on an unmatched for-list glob (nomatch); bash passes it through. nullglob both.
98
+ shopt -s nullglob 2>/dev/null; setopt NULL_GLOB 2>/dev/null
99
+
97
100
  # Key exports from each phase
98
101
  for summary in .planning/phases/*/*-SUMMARY.md; do
99
102
  echo "=== $summary ==="
@@ -8,6 +8,9 @@ color: cyan
8
8
 
9
9
  <role>
10
10
  You are the MemPalace curator. You run once per phase at `ship:post`, after verification has passed, to consolidate the phase's memory into the palace. Everything you do is best-effort and wing-scoped: a MemPalace failure must never fail the ship step (`onError: skip`), and you must never touch drawers outside this project's wing.
11
+
12
+ **CRITICAL: Mandatory Initial Read**
13
+ If the prompt contains a `<required_reading>` block, you MUST use the `Read` tool to load every file listed there before performing any other actions. This is your primary context.
11
14
  </role>
12
15
 
13
16
  <inputs>
@@ -27,9 +30,9 @@ If `mempalace.enabled !== true`, do nothing and report `MemPalace disabled — c
27
30
 
28
31
  ## Tasks (each independently best-effort)
29
32
 
30
- 1. **Diary entry** (when `mempalace.diary_journal` is true). Write one concise per-agent diary entry summarising the phase outcome: `mempalace_diary_write(agent_name=<project>/<role>, entry=<summary>, topic="phase-ship", wing=<wing>)` (CLI: `mempalace hook run` / the diary CLI). Namespace `agent_name` by repo+role so diaries don't collide across projects. **Idempotency:** before writing, `mempalace_diary_read` (or list) for an existing entry keyed by `(wing, agent_name, topic, phase-id)`; if one exists for this phase, update it in place rather than appending a second.
33
+ 1. **Diary entry** (unless `mempalace.diary_journal !== false` — registry default is true, an absent key means enabled). Write one concise per-agent diary entry summarising the phase outcome: `mempalace_diary_write(agent_name=<project>/<role>, entry=<summary>, topic="phase-ship", wing=<wing>)` (CLI: `mempalace hook run` / the diary CLI). Namespace `agent_name` by repo+role so diaries don't collide across projects. **Idempotency:** before writing, `mempalace_diary_read` (or list) for an existing entry keyed by `(wing, agent_name, topic, phase-id)`; if one exists for this phase, update it in place rather than appending a second.
31
34
 
32
- 2. **extract-learnings → KG mirror** (when `mempalace.mirror_kg` is true). For each decision/lesson/pattern/surprise from the phase's learnings, add a typed KG triple with provenance (`source_file`, `source_drawer_id`) and `valid_from` = the phase date. **Idempotency:** the triple `(subject, predicate, object)` is the natural key — `mempalace_kg_query` for it first and skip `mempalace_kg_add` if it already exists with the same `valid_from`, so reruns don't fork duplicate facts. When a prior decision was superseded this phase, call `mempalace_kg_invalidate` to set its `valid_to` rather than deleting it.
35
+ 2. **extract-learnings → KG mirror** (unless `mempalace.mirror_kg !== false` — registry default is true, an absent key means enabled). For each decision/lesson/pattern/surprise from the phase's learnings, add a typed KG triple with provenance (`source_file`, `source_drawer_id`) and `valid_from` = the phase date. **Idempotency:** the triple `(subject, predicate, object)` is the natural key — `mempalace_kg_query` for it first and skip `mempalace_kg_add` if it already exists with the same `valid_from`, so reruns don't fork duplicate facts. When a prior decision was superseded this phase, call `mempalace_kg_invalidate` to set its `valid_to` rather than deleting it.
33
36
 
34
37
  3. **Cross-project tunnels** (when `mempalace.cross_project_tunnels` is true). Use `mempalace_find_tunnels` to surface related wings, then `mempalace_create_tunnel(label=…)` only for connections you (or the user) can justify. **Idempotency:** check the `find_tunnels` result first and skip creation if a tunnel with that `(source-wing, target-wing, label)` already exists. Do not mass-create tunnels.
35
38
 
@@ -183,6 +183,14 @@ Keep using the provenance tags in RESEARCH.md:
183
183
 
184
184
  **Never present LOW confidence findings as authoritative.**
185
185
 
186
+ **Claim-disposition mode (the `/gsd:explore` quick-research pass).** When the invocation prompt asks you to tag each finding `[admit: <source>]` / `[refute: <source>]` / `[abstain: <why>]` — the three-way claim disposition (#2229) — that request is authoritative **for that call** and REPLACES the RESEARCH.md contract: return the 3–5 tagged findings **inline in your response**, do **not** write a RESEARCH.md file, and do **not** use the *Research Complete* structured return. Derive each disposition from the same source work you already do:
187
+
188
+ - `[admit: <source>]` — a finding you would tag `[VERIFIED]` (tool-confirmed AND from a source authoritative for *this* claim) **and** which survived your prompted-to-refute attempt.
189
+ - `[refute: <source>]` — a primary source authoritative for the claim contradicts it; give the correction, with the source.
190
+ - `[abstain: <why>]` — everything else: `[ASSUMED]`/LOW, a non-authoritative `[CITED]` source, unverifiable, or a source-vs-prior conflict. `<why>` MUST be one of the caller's five ledger reasons, byte-identical to `explore.md`: `unverifiable` | `source-vs-prior conflict` | `non-authoritative source` | `tier-floor: unearned confidence` | `untagged — disposition not reported` — the last is the caller's to assign, not yours. A "strong prior" alone is never authoritative — it can only abstain, never refute.
191
+
192
+ Every finding carries **exactly one** tag; an untagged finding is routed to the caller's Unresolved Ledger as `untagged — disposition not reported`. The confidence tier still rides underneath (it drives the caller's tier floor), but the disposition — not the tier — decides what may be stated.
193
+
186
194
  </source_hierarchy>
187
195
 
188
196
  <verification_protocol>
@@ -537,7 +545,8 @@ Also read `.planning/config.json` — include Validation Architecture section in
537
545
 
538
546
  Then read CONTEXT.md if exists:
539
547
  ```bash
540
- cat "$phase_dir"/*-CONTEXT.md 2>/dev/null
548
+ _CTX=( "$phase_dir"/*-CONTEXT.md )
549
+ if [ -e "${_CTX[0]}" ]; then cat "${_CTX[@]}"; fi
541
550
  ```
542
551
 
543
552
  **If CONTEXT.md exists**, it constrains research:
@@ -843,6 +852,16 @@ Research complete. Planner can now create PLAN.md files.
843
852
  [What's needed to continue]
844
853
  ```
845
854
 
855
+ ## Quick Claim-Disposition Pass (`/gsd:explore`)
856
+
857
+ Not the templates above — an inline return, no RESEARCH.md and no phase/confidence header. 3–5 findings, each on its own line, each carrying exactly one disposition tag (see **Claim-disposition mode**):
858
+
859
+ ```markdown
860
+ - [admit: <source>] <finding that survived refute and is grounded>
861
+ - [refute: <source>] <corrected claim — a primary source contradicts the original>
862
+ - [abstain: <why>] <finding that is unverifiable / non-authoritative / conflicted>
863
+ ```
864
+
846
865
  </structured_returns>
847
866
 
848
867
  <success_criteria>