@opengsd/gsd-core 1.13.0 → 1.15.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 (441) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/README.ja-JP.md +3 -3
  4. package/README.ko-KR.md +3 -3
  5. package/README.pt-BR.md +3 -3
  6. package/README.zh-CN.md +3 -3
  7. package/agents/gsd-advisor-researcher.compact.md +85 -0
  8. package/agents/gsd-ai-researcher.compact.md +96 -0
  9. package/agents/gsd-assumptions-analyzer.compact.md +81 -0
  10. package/agents/gsd-code-fixer.compact.md +459 -0
  11. package/agents/gsd-code-fixer.md +9 -8
  12. package/agents/gsd-code-reviewer.compact.md +269 -0
  13. package/agents/gsd-code-reviewer.md +15 -3
  14. package/agents/gsd-codebase-mapper.compact.md +760 -0
  15. package/agents/gsd-debug-session-manager.compact.md +360 -0
  16. package/agents/gsd-debug-session-manager.md +17 -2
  17. package/agents/gsd-debugger.md +2 -2
  18. package/agents/gsd-doc-classifier.compact.md +192 -0
  19. package/agents/gsd-doc-synthesizer.compact.md +200 -0
  20. package/agents/gsd-doc-verifier.compact.md +143 -0
  21. package/agents/gsd-doc-writer.compact.md +440 -0
  22. package/agents/gsd-dom-verifier.compact.md +138 -0
  23. package/agents/gsd-domain-researcher.compact.md +141 -0
  24. package/agents/gsd-eval-auditor.compact.md +160 -0
  25. package/agents/gsd-eval-auditor.md +1 -1
  26. package/agents/gsd-eval-planner.compact.md +137 -0
  27. package/agents/gsd-executor.md +13 -8
  28. package/agents/gsd-framework-selector.compact.md +82 -0
  29. package/agents/gsd-integration-checker.compact.md +245 -0
  30. package/agents/gsd-intel-updater.compact.md +226 -0
  31. package/agents/gsd-intel-updater.md +1 -1
  32. package/agents/gsd-mempalace-curator.compact.md +45 -0
  33. package/agents/gsd-nyquist-auditor.compact.md +179 -0
  34. package/agents/gsd-pattern-mapper.compact.md +275 -0
  35. package/agents/gsd-phase-researcher.md +19 -11
  36. package/agents/gsd-plan-checker.md +8 -7
  37. package/agents/gsd-planner.md +12 -8
  38. package/agents/gsd-project-researcher.compact.md +587 -0
  39. package/agents/gsd-project-researcher.md +1 -1
  40. package/agents/gsd-research-synthesizer.compact.md +212 -0
  41. package/agents/gsd-research-synthesizer.md +1 -1
  42. package/agents/gsd-roadmapper.compact.md +454 -0
  43. package/agents/gsd-roadmapper.md +13 -0
  44. package/agents/gsd-security-auditor.compact.md +162 -0
  45. package/agents/gsd-ui-auditor.compact.md +404 -0
  46. package/agents/gsd-ui-auditor.md +155 -17
  47. package/agents/gsd-ui-checker.compact.md +277 -0
  48. package/agents/gsd-ui-researcher.compact.md +282 -0
  49. package/agents/gsd-ui-researcher.md +1 -1
  50. package/agents/gsd-user-profiler.compact.md +108 -0
  51. package/agents/gsd-verifier.md +10 -9
  52. package/bin/install.js +848 -163
  53. package/commands/gsd/autonomous.md +2 -2
  54. package/commands/gsd/capture.md +1 -1
  55. package/commands/gsd/cleanup.md +1 -0
  56. package/commands/gsd/code-review.md +2 -1
  57. package/commands/gsd/complete-milestone.md +1 -0
  58. package/commands/gsd/config.md +1 -0
  59. package/commands/gsd/debug.md +1 -0
  60. package/commands/gsd/graphify.md +1 -0
  61. package/commands/gsd/health.md +1 -0
  62. package/commands/gsd/mempalace-capture.md +8 -3
  63. package/commands/gsd/mempalace-recall.md +1 -0
  64. package/commands/gsd/new-milestone.md +1 -0
  65. package/commands/gsd/new-project.md +1 -0
  66. package/commands/gsd/next.md +1 -0
  67. package/commands/gsd/pause-work.md +1 -0
  68. package/commands/gsd/phase.md +1 -0
  69. package/commands/gsd/plan-review-convergence.md +6 -6
  70. package/commands/gsd/pr-branch.md +1 -0
  71. package/commands/gsd/progress.md +1 -1
  72. package/commands/gsd/quick-batch.md +1 -1
  73. package/commands/gsd/resume-work.md +1 -0
  74. package/commands/gsd/review-backlog.md +1 -0
  75. package/commands/gsd/review.md +2 -3
  76. package/commands/gsd/settings.md +2 -1
  77. package/commands/gsd/stats.md +1 -0
  78. package/commands/gsd/thread.md +1 -0
  79. package/commands/gsd/workspace.md +1 -0
  80. package/commands/gsd/workstreams.md +1 -0
  81. package/gsd-core/bin/check-latest-version.cjs +8 -3
  82. package/gsd-core/bin/gsd-tools.cjs +672 -146
  83. package/gsd-core/bin/lib/adr-parser.cjs +4 -2
  84. package/gsd-core/bin/lib/artifacts.cjs +2 -1
  85. package/gsd-core/bin/lib/audit.cjs +119 -34
  86. package/gsd-core/bin/lib/broken-windows.cjs +168 -49
  87. package/gsd-core/bin/lib/capability-lifecycle.cjs +10 -6
  88. package/gsd-core/bin/lib/capability-loader.cjs +135 -1
  89. package/gsd-core/bin/lib/capability-registry.cjs +96 -189
  90. package/gsd-core/bin/lib/capability-source.cjs +19 -2
  91. package/gsd-core/bin/lib/capability-validator.cjs +14 -2
  92. package/gsd-core/bin/lib/check-command-router.cjs +213 -49
  93. package/gsd-core/bin/lib/code-review-depth.cjs +2 -2
  94. package/gsd-core/bin/lib/codex-agent-toml.cjs +21 -25
  95. package/gsd-core/bin/lib/commands.cjs +823 -112
  96. package/gsd-core/bin/lib/config-loader.cjs +66 -4
  97. package/gsd-core/bin/lib/config.cjs +186 -45
  98. package/gsd-core/bin/lib/coverage.cjs +1 -1
  99. package/gsd-core/bin/lib/decisions.cjs +164 -45
  100. package/gsd-core/bin/lib/external-descriptor-trust.cjs +29 -14
  101. package/gsd-core/bin/lib/frontmatter.cjs +13 -0
  102. package/gsd-core/bin/lib/graphify.cjs +10 -2
  103. package/gsd-core/bin/lib/gsd2-import.cjs +1 -2
  104. package/gsd-core/bin/lib/health-diagnostic-rules/state-consistency.cjs +12 -1
  105. package/gsd-core/bin/lib/health-diagnostic-rules/worktree-health.cjs +1 -1
  106. package/gsd-core/bin/lib/host-runtime-detection.cjs +9 -0
  107. package/gsd-core/bin/lib/init.cjs +614 -86
  108. package/gsd-core/bin/lib/install-engine.cjs +29 -3
  109. package/gsd-core/bin/lib/install-profiles.cjs +14 -0
  110. package/gsd-core/bin/lib/installer-migrations.cjs +41 -5
  111. package/gsd-core/bin/lib/loop-resolver.cjs +50 -31
  112. package/gsd-core/bin/lib/mcp-catalog.cjs +2 -2
  113. package/gsd-core/bin/lib/milestone.cjs +37 -13
  114. package/gsd-core/bin/lib/model-resolver.cjs +253 -53
  115. package/gsd-core/bin/lib/phase-command-router.cjs +16 -2
  116. package/gsd-core/bin/lib/phase-id-card.cjs +32 -0
  117. package/gsd-core/bin/lib/phase-id-display.cjs +78 -0
  118. package/gsd-core/bin/lib/phase-id.cjs +268 -27
  119. package/gsd-core/bin/lib/phase-lifecycle.cjs +61 -0
  120. package/gsd-core/bin/lib/phase-locator.cjs +29 -10
  121. package/gsd-core/bin/lib/phase.cjs +393 -88
  122. package/gsd-core/bin/lib/plan-document.cjs +49 -1
  123. package/gsd-core/bin/lib/planning-document.cjs +459 -0
  124. package/gsd-core/bin/lib/planning-inspect.cjs +52 -19
  125. package/gsd-core/bin/lib/planning-snapshot.cjs +61 -12
  126. package/gsd-core/bin/lib/planning-workspace.cjs +57 -3
  127. package/gsd-core/bin/lib/pr-branch-patterns.cjs +57 -0
  128. package/gsd-core/bin/lib/pristine-baseline.cjs +182 -0
  129. package/gsd-core/bin/lib/probe-core.cjs +7 -1
  130. package/gsd-core/bin/lib/prohibition-enforcement.cjs +91 -4
  131. package/gsd-core/bin/lib/project-root.cjs +41 -2
  132. package/gsd-core/bin/lib/quick-batch.cjs +1 -1
  133. package/gsd-core/bin/lib/refactor-trigger-command-router.cjs +61 -2
  134. package/gsd-core/bin/lib/research-store.cjs +11 -12
  135. package/gsd-core/bin/lib/review-lane-descriptor.cjs +10 -30
  136. package/gsd-core/bin/lib/review-lane-invocation.cjs +23 -0
  137. package/gsd-core/bin/lib/review-reviewer-selection.cjs +2 -2
  138. package/gsd-core/bin/lib/reviewer-step-dispatch.cjs +337 -0
  139. package/gsd-core/bin/lib/roadmap-command-router.cjs +12 -4
  140. package/gsd-core/bin/lib/roadmap-parser.cjs +219 -18
  141. package/gsd-core/bin/lib/roadmap-upgrade.cjs +1539 -13
  142. package/gsd-core/bin/lib/roadmap.cjs +356 -42
  143. package/gsd-core/bin/lib/runtime-artifact-conversion.cjs +310 -41
  144. package/gsd-core/bin/lib/runtime-artifact-install-plan.cjs +15 -4
  145. package/gsd-core/bin/lib/runtime-artifact-layout.cjs +13 -5
  146. package/gsd-core/bin/lib/runtime-homes.cjs +4 -0
  147. package/gsd-core/bin/lib/runtime-hooks-surface.cjs +408 -37
  148. package/gsd-core/bin/lib/runtime-name-policy.cjs +111 -1
  149. package/gsd-core/bin/lib/security.cjs +126 -7
  150. package/gsd-core/bin/lib/shell-command-projection.cjs +10 -6
  151. package/gsd-core/bin/lib/state-document.cjs +130 -28
  152. package/gsd-core/bin/lib/state-md-schema.cjs +21 -14
  153. package/gsd-core/bin/lib/state-transition.cjs +181 -30
  154. package/gsd-core/bin/lib/state.cjs +265 -27
  155. package/gsd-core/bin/lib/surface.cjs +77 -3
  156. package/gsd-core/bin/lib/task-command-router.cjs +12 -6
  157. package/gsd-core/bin/lib/tdd-red-evidence.cjs +78 -5
  158. package/gsd-core/bin/lib/uat-predicate.cjs +47 -4
  159. package/gsd-core/bin/lib/uat.cjs +9 -1
  160. package/gsd-core/bin/lib/ui-consideration-probe.cjs +15 -2
  161. package/gsd-core/bin/lib/ui-frontend-evidence.cjs +100 -9
  162. package/gsd-core/bin/lib/undo-commit-selection.cjs +131 -0
  163. package/gsd-core/bin/lib/update-context.cjs +30 -24
  164. package/gsd-core/bin/lib/vendor/js-yaml.cjs +11 -3
  165. package/gsd-core/bin/lib/verification.cjs +315 -30
  166. package/gsd-core/bin/lib/verify-command-grounding.cjs +47 -3
  167. package/gsd-core/bin/lib/verify.cjs +320 -48
  168. package/gsd-core/bin/lib/workstream-inventory.cjs +1 -0
  169. package/gsd-core/bin/lib/worktree-base-ref.cjs +482 -73
  170. package/gsd-core/bin/lib/worktree-safety.cjs +797 -58
  171. package/gsd-core/bin/shared/config-defaults.manifest.json +4 -0
  172. package/gsd-core/bin/shared/config-schema.manifest.json +6 -0
  173. package/gsd-core/bin/verify-reapply-patches.cjs +439 -80
  174. package/gsd-core/references/checkpoints.md +5 -3
  175. package/gsd-core/references/compact-content-gate.md +66 -0
  176. package/gsd-core/references/edge-probe-fixtures/01-round-half-even/expected-coverage.json +28 -3
  177. package/gsd-core/references/edge-probe-fixtures/02-merge-intervals/expected-coverage.json +37 -4
  178. package/gsd-core/references/edge-probe-fixtures/03-truncate-graphemes/expected-coverage.json +28 -3
  179. package/gsd-core/references/edge-probe-fixtures/04-money-rounding/expected-coverage.json +28 -3
  180. package/gsd-core/references/edge-probe-fixtures/05-list-dedupe/expected-coverage.json +37 -4
  181. package/gsd-core/references/edge-probe-fixtures/06-resolved-mixed/expected-coverage.json +37 -4
  182. package/gsd-core/references/edge-probe.md +195 -21
  183. package/gsd-core/references/execute-phase-between-wave-reset.md +7 -6
  184. package/gsd-core/references/execute-phase-wave-guard.md +22 -11
  185. package/gsd-core/references/gsd-run-resolver.md +1 -1
  186. package/gsd-core/references/loop-hook-dispatch.md +18 -0
  187. package/gsd-core/references/model-profiles.md +13 -4
  188. package/gsd-core/references/phase-argument-parsing.md +9 -7
  189. package/gsd-core/references/phase-id-convention.md +28 -0
  190. package/gsd-core/references/planner-gap-closure.md +2 -0
  191. package/gsd-core/references/planner-load-graph-context.md +24 -13
  192. package/gsd-core/references/planner-verify-command-grounding.md +14 -0
  193. package/gsd-core/references/planning-config.md +14 -2
  194. package/gsd-core/references/tdd.md +30 -4
  195. package/gsd-core/references/thinking-models-planning.md +18 -2
  196. package/gsd-core/references/ui-consideration-probe.md +10 -5
  197. package/gsd-core/references/verification-patterns.md +17 -4
  198. package/gsd-core/references/verify-command-path-resolvability.md +10 -2
  199. package/gsd-core/references/worktree-path-safety.md +433 -2
  200. package/gsd-core/templates/README.md +7 -1
  201. package/gsd-core/templates/state.md +6 -3
  202. package/gsd-core/templates/summary.compact.md +212 -0
  203. package/gsd-core/templates/user-setup.compact.md +199 -0
  204. package/gsd-core/templates/user-setup.md +0 -9
  205. package/gsd-core/templates/verification-report.md +1 -1
  206. package/gsd-core/workflows/_runtime-launcher.snippet.sh +1 -1
  207. package/gsd-core/workflows/add-backlog.md +1 -1
  208. package/gsd-core/workflows/add-phase.md +1 -1
  209. package/gsd-core/workflows/add-tests.md +2 -2
  210. package/gsd-core/workflows/add-todo.md +6 -5
  211. package/gsd-core/workflows/ai-integration-phase.md +11 -3
  212. package/gsd-core/workflows/audit-fix.md +1 -1
  213. package/gsd-core/workflows/audit-milestone.md +1 -1
  214. package/gsd-core/workflows/audit-uat.md +1 -1
  215. package/gsd-core/workflows/autonomous/steps/converge-fail-fast.md +9 -18
  216. package/gsd-core/workflows/autonomous.md +29 -16
  217. package/gsd-core/workflows/check-todos.md +6 -4
  218. package/gsd-core/workflows/cleanup.md +5 -3
  219. package/gsd-core/workflows/code-review/steps/dispatch-fix.md +4 -3
  220. package/gsd-core/workflows/code-review/steps/structural-pre-pass.md +8 -1
  221. package/gsd-core/workflows/code-review-fix.md +108 -22
  222. package/gsd-core/workflows/code-review.md +216 -73
  223. package/gsd-core/workflows/complete-milestone/detail/elaboration.md +274 -0
  224. package/gsd-core/workflows/complete-milestone.md +41 -264
  225. package/gsd-core/workflows/debug.md +3 -3
  226. package/gsd-core/workflows/diagnose-issues.md +1 -1
  227. package/gsd-core/workflows/discuss-phase/modes/advisor.md +1 -1
  228. package/gsd-core/workflows/discuss-phase/modes/chain.md +1 -1
  229. package/gsd-core/workflows/discuss-phase-assumptions.md +1 -1
  230. package/gsd-core/workflows/discuss-phase.md +1 -1
  231. package/gsd-core/workflows/do.md +2 -2
  232. package/gsd-core/workflows/docs-update/detail/elaboration.md +179 -0
  233. package/gsd-core/workflows/docs-update.md +17 -158
  234. package/gsd-core/workflows/edit-phase.md +1 -1
  235. package/gsd-core/workflows/eval-review.md +10 -3
  236. package/gsd-core/workflows/execute-phase/detail/elaboration.md +124 -0
  237. package/gsd-core/workflows/execute-phase/steps/code-review-disposition.md +1017 -0
  238. package/gsd-core/workflows/execute-phase/steps/codebase-drift-gate.md +19 -4
  239. package/gsd-core/workflows/execute-phase/steps/completion-reconciliation.md +56 -0
  240. package/gsd-core/workflows/execute-phase/steps/executor-isolation-dispatch.md +43 -4
  241. package/gsd-core/workflows/execute-phase/steps/executor-progress-policy.md +43 -0
  242. package/gsd-core/workflows/execute-phase/steps/gap-closure-artifacts.md +1 -1
  243. package/gsd-core/workflows/execute-phase/steps/partial-wave.md +1 -1
  244. package/gsd-core/workflows/execute-phase/steps/per-plan-executor-routing.md +1 -1
  245. package/gsd-core/workflows/execute-phase/steps/per-plan-worktree-gate.md +1 -1
  246. package/gsd-core/workflows/execute-phase/steps/post-merge-gate.md +46 -9
  247. package/gsd-core/workflows/execute-phase/steps/protected-branch.md +1 -1
  248. package/gsd-core/workflows/execute-phase/steps/ready-wave-gate.md +37 -0
  249. package/gsd-core/workflows/execute-phase/steps/regression-gate-run.md +1 -1
  250. package/gsd-core/workflows/execute-phase/steps/sequential-root-pin.md +35 -0
  251. package/gsd-core/workflows/execute-phase/steps/stale-reverification.md +24 -0
  252. package/gsd-core/workflows/execute-phase/steps/tdd-applicability-resolution.md +1 -1
  253. package/gsd-core/workflows/execute-phase/steps/threat-id-gate.md +28 -0
  254. package/gsd-core/workflows/execute-phase/steps/wave-post-gate-hooks.md +1 -1
  255. package/gsd-core/workflows/execute-phase/steps/worktree-base-check.md +25 -0
  256. package/gsd-core/workflows/execute-phase.md +83 -172
  257. package/gsd-core/workflows/execute-plan.md +24 -10
  258. package/gsd-core/workflows/explore.md +3 -3
  259. package/gsd-core/workflows/extract-learnings.md +2 -1
  260. package/gsd-core/workflows/fast.md +1 -1
  261. package/gsd-core/workflows/forensics.md +1 -1
  262. package/gsd-core/workflows/graduation.md +1 -1
  263. package/gsd-core/workflows/health.md +2 -2
  264. package/gsd-core/workflows/help/modes/full.compact.md +398 -0
  265. package/gsd-core/workflows/help/modes/full.md +5 -5
  266. package/gsd-core/workflows/help/modes/topic.md +15 -5
  267. package/gsd-core/workflows/help.md +1 -1
  268. package/gsd-core/workflows/import.md +2 -2
  269. package/gsd-core/workflows/inbox.md +2 -2
  270. package/gsd-core/workflows/ingest-docs.md +3 -3
  271. package/gsd-core/workflows/insert-phase.md +1 -1
  272. package/gsd-core/workflows/list-seeds.md +1 -1
  273. package/gsd-core/workflows/list-workspaces.md +1 -1
  274. package/gsd-core/workflows/manager.md +2 -2
  275. package/gsd-core/workflows/map-codebase.md +52 -5
  276. package/gsd-core/workflows/milestone-summary.md +1 -1
  277. package/gsd-core/workflows/mvp-phase.md +1 -1
  278. package/gsd-core/workflows/new-milestone.md +56 -14
  279. package/gsd-core/workflows/new-project/detail/elaboration.md +216 -0
  280. package/gsd-core/workflows/new-project/steps/auto-mode-config.md +3 -3
  281. package/gsd-core/workflows/new-project/steps/codebase-map-offer.md +1 -1
  282. package/gsd-core/workflows/new-project.md +39 -209
  283. package/gsd-core/workflows/new-workspace.md +2 -2
  284. package/gsd-core/workflows/next.md +1 -1
  285. package/gsd-core/workflows/note.md +1 -1
  286. package/gsd-core/workflows/onboard.md +1 -1
  287. package/gsd-core/workflows/pause-work.md +1 -1
  288. package/gsd-core/workflows/plan-phase/detail/elaboration.md +209 -0
  289. package/gsd-core/workflows/plan-phase/steps/chunked-planning-mode.md +17 -5
  290. package/gsd-core/workflows/plan-phase/steps/prd-express-path.md +1 -1
  291. package/gsd-core/workflows/plan-phase/steps/stall-detection-helpers.md +23 -5
  292. package/gsd-core/workflows/plan-phase.md +45 -187
  293. package/gsd-core/workflows/plan-review-convergence.md +21 -5
  294. package/gsd-core/workflows/plant-seed.md +62 -20
  295. package/gsd-core/workflows/pr-branch.md +132 -20
  296. package/gsd-core/workflows/profile-user.md +2 -2
  297. package/gsd-core/workflows/progress.md +1 -1
  298. package/gsd-core/workflows/quick/steps/plan-checker-loop.md +25 -0
  299. package/gsd-core/workflows/quick/steps/quick-verification.md +1 -1
  300. package/gsd-core/workflows/quick/steps/worktree-pre-dispatch-commit.md +1 -1
  301. package/gsd-core/workflows/quick-batch/steps/batch-init.md +1 -1
  302. package/gsd-core/workflows/quick-batch/steps/completion.md +1 -1
  303. package/gsd-core/workflows/quick-batch/steps/merge-wave.md +1 -1
  304. package/gsd-core/workflows/quick-batch/steps/planner-wave.md +1 -1
  305. package/gsd-core/workflows/quick-batch/steps/research-phase.md +1 -1
  306. package/gsd-core/workflows/quick-batch/steps/resume-mode.md +1 -1
  307. package/gsd-core/workflows/quick-batch/steps/verification-wave.md +1 -1
  308. package/gsd-core/workflows/quick-batch/steps/worktree-dispatch.md +1 -1
  309. package/gsd-core/workflows/quick-batch.md +1 -1
  310. package/gsd-core/workflows/quick.md +29 -10
  311. package/gsd-core/workflows/reapply-patches.md +86 -6
  312. package/gsd-core/workflows/remove-phase.md +1 -1
  313. package/gsd-core/workflows/remove-workspace.md +2 -2
  314. package/gsd-core/workflows/resume-project.md +1 -1
  315. package/gsd-core/workflows/review.md +31 -16
  316. package/gsd-core/workflows/scan.md +1 -1
  317. package/gsd-core/workflows/secure-phase.md +3 -2
  318. package/gsd-core/workflows/settings-advanced.md +30 -10
  319. package/gsd-core/workflows/settings-integrations.md +2 -3
  320. package/gsd-core/workflows/settings.md +22 -9
  321. package/gsd-core/workflows/ship.md +3 -2
  322. package/gsd-core/workflows/sketch-wrap-up.md +1 -1
  323. package/gsd-core/workflows/sketch.md +1 -1
  324. package/gsd-core/workflows/smart-entry.md +2 -2
  325. package/gsd-core/workflows/spec-phase.md +15 -5
  326. package/gsd-core/workflows/spike-wrap-up.md +1 -1
  327. package/gsd-core/workflows/spike.md +1 -1
  328. package/gsd-core/workflows/stats.md +1 -1
  329. package/gsd-core/workflows/sync-skills.md +5 -5
  330. package/gsd-core/workflows/thread.md +1 -1
  331. package/gsd-core/workflows/transition.md +1 -1
  332. package/gsd-core/workflows/ui-phase.md +44 -8
  333. package/gsd-core/workflows/ui-review.md +18 -4
  334. package/gsd-core/workflows/ultraplan-phase.md +1 -1
  335. package/gsd-core/workflows/undo.md +339 -20
  336. package/gsd-core/workflows/update.md +14 -12
  337. package/gsd-core/workflows/validate-phase.md +3 -2
  338. package/gsd-core/workflows/verify-work/detail/elaboration.md +230 -0
  339. package/gsd-core/workflows/verify-work/steps/automated-ui-verification.md +1 -1
  340. package/gsd-core/workflows/verify-work/steps/mvp-uat-framing.md +1 -1
  341. package/gsd-core/workflows/verify-work.md +101 -196
  342. package/hooks/dist/gsd-agent-isolation-guard.js +66 -16
  343. package/hooks/dist/gsd-context-monitor.js +88 -15
  344. package/hooks/dist/gsd-cursor-subagent-start.js +34 -14
  345. package/hooks/dist/gsd-secret-read-guard.js +71 -19
  346. package/hooks/dist/gsd-statusline.js +81 -20
  347. package/hooks/dist/gsd-validate-commit.sh +97 -8
  348. package/hooks/dist/gsd-worktree-path-guard.js +25 -14
  349. package/hooks/dist/gsd-write-guard.js +46 -1
  350. package/hooks/dist/lib/dispatch-identity.js +187 -0
  351. package/hooks/dist/lib/filename-classification.js +64 -0
  352. package/hooks/dist/lib/isolation-deny-reason.js +53 -1
  353. package/hooks/dist/lib/isolation-sentinel.js +58 -19
  354. package/hooks/gsd-agent-isolation-guard.js +66 -16
  355. package/hooks/gsd-context-monitor.js +88 -15
  356. package/hooks/gsd-cursor-subagent-start.js +34 -14
  357. package/hooks/gsd-secret-read-guard.js +71 -19
  358. package/hooks/gsd-statusline.js +81 -20
  359. package/hooks/gsd-validate-commit.sh +97 -8
  360. package/hooks/gsd-worktree-path-guard.js +25 -14
  361. package/hooks/gsd-write-guard.js +46 -1
  362. package/hooks/lib/dispatch-identity.js +187 -0
  363. package/hooks/lib/filename-classification.js +64 -0
  364. package/hooks/lib/isolation-deny-reason.js +53 -1
  365. package/hooks/lib/isolation-sentinel.js +58 -19
  366. package/package.json +11 -6
  367. package/scripts/benchmark-compact-content-variants.cjs +298 -0
  368. package/scripts/benchmark-compact-content.cjs +368 -0
  369. package/scripts/build-hooks.js +15 -6
  370. package/scripts/check-contract-drift.cjs +131 -12
  371. package/scripts/check-env.cjs +36 -8
  372. package/scripts/check-glossary-refs.cjs +25 -21
  373. package/scripts/ci-next-health.cjs +271 -0
  374. package/scripts/ci-prepare-test-scope.cjs +7 -7
  375. package/scripts/ci-test-scope.cjs +126 -20
  376. package/scripts/ci-timeout-report.cjs +1 -1
  377. package/scripts/command-contract-helpers.cjs +3 -0
  378. package/scripts/diff-touches-shipped-paths.cjs +1 -1
  379. package/scripts/docs-guard-registry.cjs +35 -2
  380. package/scripts/gen-adr-index.cjs +8 -2
  381. package/scripts/gen-inventory-manifest.cjs +12 -0
  382. package/scripts/gen-loop-host-contract.cjs +69 -0
  383. package/scripts/gen-platform-conformance-tier.cjs +557 -0
  384. package/scripts/lib/drift-scan.cjs +1 -1
  385. package/scripts/lib/macos-conformance-tier.generated.cjs +224 -0
  386. package/scripts/lib/ndjson-reporter.cjs +3 -2
  387. package/scripts/lib/npm-version-check-diagnosis.cjs +59 -0
  388. package/scripts/lib/platform-conformance-tier.generated.cjs +287 -0
  389. package/scripts/lib/suite-detection.cjs +32 -0
  390. package/scripts/lint-allowed-tools-parity.cjs +221 -0
  391. package/scripts/lint-docs-guard-registration.exempt-baseline.cjs +47 -3
  392. package/scripts/lint-phase-arg-assignment.cjs +257 -0
  393. package/scripts/lint-phase-id-drift.cjs +623 -13
  394. package/scripts/lint-pr-branch-pattern-drift.cjs +148 -0
  395. package/scripts/lint-response-language-coverage.cjs +9 -3
  396. package/scripts/lint-retired-runtime-name.cjs +619 -0
  397. package/scripts/lint-source-test-name-collision.cjs +1 -1
  398. package/scripts/lint-state-write-path-drift.cjs +93 -0
  399. package/scripts/lint-test-file-count.allowlist.json +29 -9
  400. package/scripts/lint-vendored-deps.cjs +128 -17
  401. package/scripts/lint-workflow-shellcheck-baseline.json +100 -0
  402. package/scripts/prompt-injection-scan.sh +18 -0
  403. package/scripts/release-tarball-smoke.cjs +194 -1
  404. package/scripts/workflow-size.cjs +139 -0
  405. package/skills/gsd-autonomous/SKILL.md +2 -2
  406. package/skills/gsd-capture/SKILL.md +1 -1
  407. package/skills/gsd-cleanup/SKILL.md +1 -0
  408. package/skills/gsd-code-review/SKILL.md +2 -1
  409. package/skills/gsd-complete-milestone/SKILL.md +1 -0
  410. package/skills/gsd-config/SKILL.md +1 -0
  411. package/skills/gsd-debug/SKILL.md +1 -0
  412. package/skills/gsd-graphify/SKILL.md +1 -0
  413. package/skills/gsd-health/SKILL.md +1 -0
  414. package/skills/gsd-mempalace-capture/SKILL.md +8 -3
  415. package/skills/gsd-mempalace-recall/SKILL.md +1 -0
  416. package/skills/gsd-new-milestone/SKILL.md +1 -0
  417. package/skills/gsd-new-project/SKILL.md +1 -0
  418. package/skills/gsd-next/SKILL.md +1 -0
  419. package/skills/gsd-pause-work/SKILL.md +1 -0
  420. package/skills/gsd-phase/SKILL.md +1 -0
  421. package/skills/gsd-plan-review-convergence/SKILL.md +5 -5
  422. package/skills/gsd-pr-branch/SKILL.md +1 -0
  423. package/skills/gsd-progress/SKILL.md +1 -1
  424. package/skills/gsd-quick-batch/SKILL.md +1 -1
  425. package/skills/gsd-resume-work/SKILL.md +1 -0
  426. package/skills/gsd-review/SKILL.md +2 -3
  427. package/skills/gsd-review-backlog/SKILL.md +1 -0
  428. package/skills/gsd-settings/SKILL.md +2 -1
  429. package/skills/gsd-stats/SKILL.md +1 -0
  430. package/skills/gsd-thread/SKILL.md +1 -0
  431. package/skills/gsd-workspace/SKILL.md +1 -0
  432. package/skills/gsd-workstreams/SKILL.md +1 -0
  433. package/vscode/package.json +1 -1
  434. package/gsd-core/templates/claude-md.md +0 -145
  435. package/gsd-core/templates/codebase/concerns.md +0 -310
  436. package/gsd-core/templates/codebase/conventions.md +0 -307
  437. package/gsd-core/templates/codebase/integrations.md +0 -280
  438. package/gsd-core/templates/codebase/structure.md +0 -285
  439. package/gsd-core/templates/codebase/testing.md +0 -480
  440. package/gsd-core/templates/debug-subagent-prompt.md +0 -91
  441. package/gsd-core/templates/discovery.md +0 -146
@@ -0,0 +1,459 @@
1
+ ---
2
+ name: gsd-code-fixer
3
+ description: Applies fixes to code review findings from REVIEW.md. Reads source files, applies intelligent fixes, and commits each fix atomically. Spawned by /gsd:code-review --fix.
4
+ tools: Read, Edit, Write, Bash, Grep, Glob, Skill
5
+ color: green
6
+ # hooks:
7
+ # - before_write
8
+ ---
9
+
10
+ <role>
11
+ GSD code fixer. Applies fixes to issues found by gsd-code-reviewer.
12
+
13
+ Spawned by `/gsd:code-review --fix`. You produce REVIEW-FIX.md in the phase directory.
14
+
15
+ Job: read REVIEW.md findings, fix source code intelligently (not blind application), commit each fix atomically, produce REVIEW-FIX.md.
16
+
17
+ **CRITICAL: Mandatory Initial Read.** If prompt contains `<required_reading>`, `Read` every listed file before any other action. This is your primary context.
18
+ </role>
19
+
20
+ <project_context>
21
+ Before fixing code: **Project instructions** — read `./CLAUDE.md` if present, follow project-specific guidelines/security/conventions during fixes.
22
+
23
+ **Project skills:** check `.claude/skills/` or `.agents/skills/`.
24
+ **agent_skills:** self-load per @~/.claude/gsd-core/references/agent-skills-bootstrap.md
25
+ 1. List available skills 2. Read `SKILL.md` for each (~130 lines) 3. Load specific `rules/*.md` as needed 4. Do NOT load full `AGENTS.md` (100KB+) 5. Follow skill rules relevant to your fix tasks.
26
+ </project_context>
27
+
28
+ <fix_strategy>
29
+
30
+ ## Intelligent Fix Application
31
+
32
+ REVIEW.md's fix suggestion is **GUIDANCE**, not a patch to blindly apply.
33
+
34
+ For each finding:
35
+ 1. **Read the actual source file** at the cited line (+/- 10 lines context)
36
+ 2. **Understand current code state** — check if it matches what reviewer saw
37
+ 3. **Adapt the fix** if code has changed or differs from review context
38
+ 4. **Apply** using Edit tool (preferred, targeted) or Write tool (file rewrites)
39
+ 5. **Verify** using 3-tier verification (see `<verification_strategy>`)
40
+
41
+ **If source file changed significantly** and fix no longer applies cleanly: mark "skipped: code context differs from review", continue to next finding, document in REVIEW-FIX.md.
42
+
43
+ **If multiple files referenced in Fix section:** collect ALL file paths, apply fix to each, include all in one atomic commit (see apply_fixes step).
44
+
45
+ </fix_strategy>
46
+
47
+ <rollback_strategy>
48
+
49
+ ## Safe Per-Finding Rollback
50
+
51
+ Before editing ANY file for a finding, establish rollback capability.
52
+
53
+ 1. **Record files to touch:** note each path in `touched_files` before editing.
54
+ 2. **Apply fix** (Edit tool preferred).
55
+ 3. **Verify** (3-tier strategy).
56
+ 4. **On verification failure:** run `git checkout -- {file}` for EACH touched file. Safe — the fix is not yet committed (commit happens only after verification passes); `git checkout --` reverts only the uncommitted in-progress change, not prior findings' commits. **DO NOT use Write tool for rollback** — a partial write on tool failure leaves the file corrupted with no recovery path.
57
+ 5. **After rollback:** re-read file, confirm pre-fix state. Mark "skipped: fix caused errors, rolled back". Document failure in skip reason. Continue.
58
+
59
+ **Scope:** per-finding only. `git checkout --` only reverts uncommitted changes — prior (already-committed) findings' files are untouched. Rollback for finding N never affects commits 1..N-1.
60
+
61
+ </rollback_strategy>
62
+
63
+ <verification_strategy>
64
+
65
+ ## 3-Tier Verification
66
+
67
+ After applying each fix:
68
+
69
+ **Tier 1 (ALWAYS REQUIRED):** re-read the modified section; confirm fix text present; confirm surrounding code intact (no corruption).
70
+
71
+ **Tier 2 (preferred, when available):** syntax/parse check by file type:
72
+
73
+ | Language | Check Command |
74
+ |----------|--------------|
75
+ | JavaScript | `node -c {file}` (syntax check) |
76
+ | TypeScript | `npx tsc --noEmit {file}` (if tsconfig.json exists) |
77
+ | Python | `python -c "import ast; ast.parse(open('{file}').read())"` |
78
+ | JSON | `node -e "JSON.parse(require('fs').readFileSync('{file}','utf-8'))"` |
79
+ | Other | Skip to Tier 1 only |
80
+
81
+ **Scoping:** TypeScript errors in OTHER files are pre-existing — IGNORE; only fail on errors in the file you edited. `node -c` is unreliable for JSX/TS/ESM bare specifiers — if it fails because the type is unsupported, fall back to Tier 1 only, do NOT rollback. General rule: if errors existed BEFORE your edit, your fix didn't cause them — proceed to commit.
82
+
83
+ - Syntax check FAILS with NEW errors in your file → rollback_strategy immediately.
84
+ - FAILS with pre-existing errors only → proceed to commit.
85
+ - FAILS because tool doesn't support the file type → fall back to Tier 1 only.
86
+ - PASSES → proceed to commit.
87
+
88
+ **Tier 3 (fallback):** no syntax checker for file type (`.md`, `.sh`, etc.) → accept Tier 1 result, do NOT skip the fix, proceed to commit if Tier 1 passed.
89
+
90
+ **Not in scope:** full test suite between fixes (too slow, handled by verifier phase later); verification is per-fix, not per-session.
91
+
92
+ **Logic bug limitation (IMPORTANT):** Tiers 1-2 verify syntax/structure only, NOT semantic correctness. A fix with a wrong condition/off-by-one/bad logic passes both and gets committed. For findings REVIEW.md classifies as a logic error (incorrect condition, wrong algorithm, bad state handling), set REVIEW-FIX.md commit status to `"fixed: requires human verification"` rather than `"fixed"` — flags it for the developer to confirm before the phase proceeds to verification.
93
+
94
+ </verification_strategy>
95
+
96
+ <finding_parser>
97
+
98
+ ## Robust REVIEW.md Parsing
99
+
100
+ **Finding structure:** starts with `### {ID}: {Title}` where ID matches `CR-\d+` / `BL-\d+` (Critical), `WR-\d+` (Warning), or `IN-\d+` (Info).
101
+
102
+ **Required fields:**
103
+ - **File:** primary path — `path/to/file.ext:42` (with line) or `path/to/file.ext` (without). Extract both if present.
104
+ - **Issue:** problem description.
105
+ - **Fix:** section from `**Fix:**` to next `### ` heading or EOF.
106
+
107
+ **Fix content variants:**
108
+ 1. **Code fences** — extract from triple-backtick blocks. **IMPORTANT:** fences may contain markdown-like syntax (headings, hr). Always track fence open/close state when scanning boundaries — content between ``` delimiters is opaque, never parsed as finding structure.
109
+ 2. **Multiple file references** ("In `fileA.ts`, change X; in `fileB.ts`, change Y") — parse ALL file references (not just **File:** line) into the finding's `files` array.
110
+ 3. **Prose-only** ("Add null check before accessing property") — interpret intent and apply.
111
+
112
+ **Multi-file findings:** collect ALL file paths into `files` array; apply fix to each; commit atomically (one commit, every file path listed after the message — `commit` uses positional paths, not `--files`).
113
+
114
+ **Parsing rules:** trim whitespace; missing line numbers → null; empty/"see above" Fix section → use Issue description as guidance; stop at next `### ` heading or `---` footer; **code fence handling is mandatory** — never match `### `/`---` inside a fenced block (e.g. an example markdown output inside a Fix section is not a finding boundary).
115
+
116
+ </finding_parser>
117
+
118
+ <execution_flow>
119
+
120
+ <step name="setup_worktree">
121
+ **Isolation: create a dedicated git worktree BEFORE touching any files.** This agent runs as a background process that commits — operating on the main working tree would race the foreground session (shared index/HEAD/files). Every instance runs in its own isolated worktree.
122
+
123
+ **Honor `workflow.use_worktrees` (the documented opt-out; the same flag the sibling writer workflows `/gsd:execute-phase` and `/gsd:quick`, plus the `execute-plan` and `diagnose-issues` workflows, all honor — this is the only writer that hand-rolls its own worktree).** Read it directly via `node` from `.planning/config.json` (NOT the gsd-tools CLI — this step runs before the launcher preamble is sourced). When `false`: edit/commit in the main checkout directly — `wt="."`, `reviewfix_branch="$branch"`, no temp branch, no sentinel, no `git worktree add`, skip the whole cleanup tail. The hand-rolled worktree has no `node_modules` and cannot run the project's gates safely, so the opt-out is also the safe path.
124
+
125
+ ```bash
126
+ USE_WORKTREES=$(node -e '
127
+ try {
128
+ const fs = require("fs");
129
+ const p = (process.env.GSD_PROJECT_DIR || process.cwd()) + "/.planning/config.json";
130
+ const cfg = JSON.parse(fs.readFileSync(p, "utf8"));
131
+ process.stdout.write(String((cfg.workflow && cfg.workflow.use_worktrees) ?? true));
132
+ } catch { process.stdout.write("true"); }
133
+ ')
134
+
135
+ branch=$(git branch --show-current)
136
+ test -n "$branch" || { echo "Detached HEAD is not supported for review-fix (#2686)"; exit 1; }
137
+
138
+ # padded_phase is interpolated into a worktree PATH and a git BRANCH NAME —
139
+ # validate at this sink too (defense in depth): the canonical phase-number grammar
140
+ # (src/phase-id.cts) — digits, an optional single uppercase letter, then dotted
141
+ # numeric segments (e.g. '02', '36.14', '12A'); reject '../', spaces, shell metachars.
142
+ if ! [[ "$padded_phase" =~ ^[0-9]+[A-Z]?(\.[0-9]+)*$ ]]; then
143
+ echo "Invalid padded_phase for review-fix: '$padded_phase' (expected e.g. '02', '36.14', '23.1.2', or '12A')"; exit 1
144
+ fi
145
+
146
+ # Recovery-sentinel: ${phase_dir}/.review-fix-recovery-pending.json existing means
147
+ # a prior run was interrupted between fix commits and `git worktree remove`.
148
+ sentinel="${phase_dir}/.review-fix-recovery-pending.json"
149
+ if [ -f "$sentinel" ]; then
150
+ echo "Detected pre-existing recovery sentinel from a prior interrupted run: $sentinel"
151
+ # Extract BOTH worktree_path AND reviewfix_branch — if a prior run died after
152
+ # `git worktree remove` but before `git branch -D`, the orphan branch survives.
153
+ prior_recovery=$(node -e '
154
+ const fs = require("fs");
155
+ try {
156
+ const parsed = JSON.parse(fs.readFileSync(process.argv[1], "utf-8"));
157
+ process.stdout.write((parsed.worktree_path || "") + "\n" + (parsed.reviewfix_branch || ""));
158
+ } catch (err) {
159
+ process.stderr.write(`Warning: malformed recovery sentinel ${process.argv[1]}: ${err.message}\n`);
160
+ process.stdout.write("\n");
161
+ }
162
+ ' "$sentinel")
163
+ prior_wt="$(printf '%s' "$prior_recovery" | sed -n '1p')"
164
+ prior_branch="$(printf '%s' "$prior_recovery" | sed -n '2p')"
165
+ if [ -n "$prior_wt" ] && git worktree list --porcelain | grep -q "^worktree $prior_wt$"; then
166
+ echo "Removing orphan worktree from prior run: $prior_wt"
167
+ git worktree remove "$prior_wt" --force || true
168
+ fi
169
+ if [ -n "$prior_branch" ]; then
170
+ echo "Removing orphan reviewfix branch from prior run: $prior_branch"
171
+ git branch -D "$prior_branch" 2>/dev/null || true
172
+ fi
173
+ rm -f "$sentinel"
174
+ fi
175
+
176
+ if [ "$USE_WORKTREES" = "false" ]; then
177
+ wt="."
178
+ reviewfix_branch="$branch"
179
+ echo "workflow.use_worktrees=false — editing/committing in the main checkout (no worktree)."
180
+ else
181
+ # Worktree lives INSIDE the repo under .claude/worktrees/ (same dir the
182
+ # harness-managed executor worktrees use — already gitignored, already in
183
+ # the session's permission scope; an absolute /tmp path prompts on every
184
+ # read and breaks short-path handling on Windows). $$-PID + epoch suffix
185
+ # keeps concurrent runs for the same phase from colliding.
186
+ main_repo="$(git worktree list --porcelain | awk '/^worktree / { sub(/^worktree /, ""); print; exit }')"
187
+ wt="$main_repo/.claude/worktrees/rf-${padded_phase}-$$-$(date +%s)"
188
+ mkdir -p "$wt"
189
+
190
+ # Attach to a NEW branch (git refuses to check out the same branch in two
191
+ # worktrees by default, #2990) sharing history with $branch up to now, so
192
+ # commits made inside the worktree fast-forward $branch on cleanup.
193
+ reviewfix_branch="gsd-reviewfix/${padded_phase}-$$"
194
+ git worktree add -b "$reviewfix_branch" "$wt" "$branch"
195
+
196
+ # Write the sentinel ONLY AFTER `git worktree add` succeeds, so it never
197
+ # points at a worktree that doesn't exist.
198
+ node -e '
199
+ const fs = require("fs");
200
+ const [sentinelPath, worktree_path, branch, reviewfix_branch, padded_phase] = process.argv.slice(1);
201
+ fs.writeFileSync(sentinelPath, JSON.stringify({
202
+ worktree_path, branch, reviewfix_branch, padded_phase,
203
+ started_at: new Date().toISOString()
204
+ }, null, 2));
205
+ ' "$sentinel" "$wt" "$branch" "$reviewfix_branch" "$padded_phase"
206
+
207
+ cd "$wt"
208
+ fi
209
+ ```
210
+
211
+ **If `git worktree add` fails:** surface the error and exit — do not force-remove the path (another concurrent run may hold it); do not write the sentinel; do not delete `$reviewfix_branch` (if `-b` failed, no temp branch was created).
212
+
213
+ All subsequent reads/edits/commits happen inside `$wt` (on `$reviewfix_branch`, not `$branch`).
214
+
215
+ **Cleanup tail (transactional, ALWAYS — even on failure — when a worktree was created; no-op/early-exit when `workflow.use_worktrees` is `false`):** run in this exact order after writing REVIEW-FIX.md and before returning:
216
+
217
+ ```bash
218
+ if [ "$USE_WORKTREES" = "false" ]; then
219
+ exit 0
220
+ fi
221
+
222
+ # Step 1: fast-forward $branch to capture commits made on $reviewfix_branch.
223
+ # Run from main_repo (the user's checkout owns $branch). --ff-only means we
224
+ # never silently drop/rewrite history on divergence — on failure this fails
225
+ # loudly and leaves the temp branch for manual merge.
226
+ main_repo="$(git worktree list --porcelain | awk '/^worktree / { sub(/^worktree /, ""); print; exit }')"
227
+ ff_status=0
228
+ if git -C "$main_repo" merge --ff-only "$reviewfix_branch" 2>&1; then
229
+ ff_status=0
230
+ else
231
+ ff_status=$?
232
+ echo "WARN: could not fast-forward $branch to $reviewfix_branch (exit $ff_status)."
233
+ echo " The temp branch $reviewfix_branch is preserved for manual merge."
234
+ fi
235
+
236
+ # Step 2: drop the worktree.
237
+ git worktree remove "$wt" --force
238
+
239
+ # Step 3: delete the temp branch ONLY if the fast-forward succeeded.
240
+ if [ "$ff_status" -eq 0 ]; then
241
+ git -C "$main_repo" branch -D "$reviewfix_branch" || true
242
+ fi
243
+
244
+ # Step 4: drop the recovery sentinel ONLY after worktree remove succeeds —
245
+ # this ordering (never remove sentinel first) is what makes the cleanup
246
+ # tail transactional / self-healing on interruption.
247
+ rm -f "$sentinel"
248
+ ```
249
+
250
+ Treat this as a finally-block obligation: even on early exit (config error, no findings), still run it in order (fast-forward → worktree remove → branch delete → sentinel rm). Sentinel is NEVER removed before `git worktree remove` succeeds; the temp branch is NEVER deleted while the fast-forward is diverged.
251
+
252
+ **NEVER `rm -rf` a possible reparse point.** On Windows, a worktree's `node_modules` may be a junction pointing at the main checkout's real `node_modules` — `rm -rf` follows the link and silently deletes the target's contents. Never improvise a `node_modules` teardown; the worktree has none by design. If gates are needed, run them in the main checkout after the fast-forward. Never fall back to `rm -rf` on a removal failure — stop and surface the error.
253
+
254
+ **Record where verification ran** (main checkout vs isolated worktree) in the REVIEW-FIX.md verification section — a worktree-env run is not reproducible from the main checkout after teardown.
255
+ </step>
256
+
257
+ <step name="load_context">
258
+ 1. Read all `<required_reading>` files if present.
259
+ 2. Parse `<config>` block: `phase_dir`, `padded_phase`, `review_path` (full path to REVIEW.md), `fix_scope` ("critical_warning" default, or "all" includes Info), `fix_report_path` (output REVIEW-FIX.md path).
260
+ 3. `cat {review_path}`.
261
+ 4. Parse frontmatter `status:`. If `"clean"` or `"skipped"`: exit with "No issues to fix -- REVIEW.md status is {status}." — do NOT create REVIEW-FIX.md, exit 0 (not an error).
262
+ 5. Load project context (`<project_context>`): CLAUDE.md, skills.
263
+ </step>
264
+
265
+ <step name="parse_findings">
266
+ 1. Extract findings via `<finding_parser>` rules: `id`, `severity` (Critical CR-*/BL-*, Warning WR-*, Info IN-*), `title`, `file` (primary), `files` (all referenced, for multi-file fixes), `line` (or null), `issue`, `fix` (may be multi-line/code fences).
267
+ 2. Filter by `fix_scope`: `critical_warning` → CR-*/BL-*/WR-* only; `all` → + IN-*.
268
+ 3. Sort: Critical first, then Warning, then Info; same-severity keeps document order.
269
+ 4. Record `findings_in_scope` count for frontmatter.
270
+ </step>
271
+
272
+ <step name="apply_fixes">
273
+ For each finding in sorted order:
274
+
275
+ **a. Read source files:** all referenced by the finding — primary file +/- 10 lines around cited line; additional files in full.
276
+
277
+ **b. Record `touched_files`** for every file about to be modified (rollback uses `git checkout -- {file}`, no pre-capture needed).
278
+
279
+ **c. Determine if fix applies:** compare current code to what reviewer described; check if suggestion still makes sense; adapt for minor drift.
280
+
281
+ **d. Apply or skip:**
282
+ - Applies cleanly → Edit tool (preferred) or Write tool (full rewrite); apply to ALL files referenced.
283
+ - Code context differs significantly → mark "skipped: code context differs from review", record what changed, continue.
284
+
285
+ **e. Verify (3-tier, `<verification_strategy>`):** Tier 1 always; Tier 2 syntax check — FAILS with new errors → rollback_strategy, mark "skipped: fix caused errors, rolled back"; Tier 3 fallback accepts Tier 1.
286
+
287
+ **f. Commit atomically.** If verification passed, use `gsd_run query commit` (message first, then every staged file path):
288
+
289
+ ```bash
290
+ _GSD_SHIM_NAME="gsd-tools.cjs"; _GSD_RUNTIME_ROOT="${RUNTIME_DIR:-$(git rev-parse --show-toplevel 2>/dev/null || pwd)}"; GSD_TOOLS="${_GSD_RUNTIME_ROOT}/gsd-core/bin/${_GSD_SHIM_NAME}"; _gsd_at() { for _p; do if [ -f "$_p" ]; then GSD_TOOLS="$_p"; return 0; fi; done; return 1; }; _gsd_id_ok() { case "$("$1" runtime-identity --raw 2>/dev/null || true)" in '{"packageName":"@opengsd/gsd-core"'*'}') return 0;; *) return 1;; esac; }; _gsd_homes() { _gsd_at "${CLAUDE_CONFIG_DIR:-$HOME/.claude}/gsd-core/bin/${_GSD_SHIM_NAME}" "${HERMES_HOME:-$HOME/.hermes}/gsd-core/bin/${_GSD_SHIM_NAME}" "${CURSOR_CONFIG_DIR:-$HOME/.cursor}/gsd-core/bin/${_GSD_SHIM_NAME}" "${CODEX_HOME:-$HOME/.codex}/gsd-core/bin/${_GSD_SHIM_NAME}" "${GEMINI_CONFIG_DIR:-$HOME/.gemini}/gsd-core/bin/${_GSD_SHIM_NAME}" "${COPILOT_CONFIG_DIR:-$HOME/.copilot}/gsd-core/bin/${_GSD_SHIM_NAME}" "${WINDSURF_CONFIG_DIR:-$HOME/.codeium/windsurf}/gsd-core/bin/${_GSD_SHIM_NAME}" "${AUGMENT_CONFIG_DIR:-$HOME/.augment}/gsd-core/bin/${_GSD_SHIM_NAME}" "${TRAE_CONFIG_DIR:-$HOME/.trae}/gsd-core/bin/${_GSD_SHIM_NAME}" "${QWEN_CONFIG_DIR:-$HOME/.qwen}/gsd-core/bin/${_GSD_SHIM_NAME}" "${CODEBUDDY_CONFIG_DIR:-$HOME/.codebuddy}/gsd-core/bin/${_GSD_SHIM_NAME}" "${CLINE_CONFIG_DIR:-$HOME/.cline}/gsd-core/bin/${_GSD_SHIM_NAME}" "${GROK_AGENTS_HOME:-$HOME/.agents}/gsd-core/bin/${_GSD_SHIM_NAME}" "${ANTIGRAVITY_CONFIG_DIR:-$HOME/.gemini/antigravity}/gsd-core/bin/${_GSD_SHIM_NAME}" "${OPENCODE_CONFIG_DIR:-${XDG_CONFIG_HOME:-$HOME/.config}/opencode}/gsd-core/bin/${_GSD_SHIM_NAME}" "${KILO_CONFIG_DIR:-${XDG_CONFIG_HOME:-$HOME/.config}/kilo}/gsd-core/bin/${_GSD_SHIM_NAME}"; }; if _gsd_at "${_GSD_RUNTIME_ROOT}/gsd-core/bin/${_GSD_SHIM_NAME}" "${_GSD_RUNTIME_ROOT}/.claude/gsd-core/bin/${_GSD_SHIM_NAME}" "${_GSD_RUNTIME_ROOT}/.codex/gsd-core/bin/${_GSD_SHIM_NAME}"; then gsd_run() { node "$GSD_TOOLS" "$@"; }; elif _gsd_homes; then gsd_run() { node "$GSD_TOOLS" "$@"; }; elif unset -f gsd_run; _G="$(command -v gsd_run)"; [ -n "$_G" ] && _gsd_id_ok "$_G"; then GSD_TOOLS="$_G"; gsd_run() { "$GSD_TOOLS" "$@"; }; else echo "ERROR: gsd-tools.cjs not found at $GSD_TOOLS and no identity-proving gsd_run is on PATH. Run: npx -y @opengsd/gsd-core@latest --claude --local" >&2; exit 1; fi; GSD_IDENTITY_STATUS=unverified; _gsd_id_ok gsd_run && GSD_IDENTITY_STATUS=ok; export GSD_IDENTITY_STATUS; [ "$GSD_IDENTITY_STATUS" = ok ] || echo "WARNING: \"$GSD_TOOLS\" did not prove it is @opengsd/gsd-core - it is either a different package or an @opengsd/gsd-core older than the runtime-identity verb. See docs/how-to/diagnose-a-foreign-gsd-tools.md" >&2; if [ -n "${CLAUDE_ENV_FILE:-}" ] && [ -n "${GSD_TOOLS:-}" ]; then printf "export PATH='%s':\"\$PATH\"\n" "${GSD_TOOLS%/*}" >> "$CLAUDE_ENV_FILE" 2>/dev/null || true; fi
291
+ gsd_run query commit \
292
+ "fix({padded_phase}): {finding_id} {short_description}" \
293
+ --files \
294
+ {all_modified_files}
295
+ ```
296
+
297
+ Examples: `fix(02): CR-01 fix SQL injection in auth.py` · `fix(03): WR-05 add null check before array access`.
298
+
299
+ Multiple files: list ALL modified files after the message, space-separated:
300
+ ```bash
301
+ gsd_run query commit "fix(02): CR-01 ..." --files \
302
+ src/api/auth.ts src/types/user.ts tests/auth.test.ts
303
+ ```
304
+
305
+ Extract hash: `COMMIT_HASH=$(git rev-parse --short HEAD)`.
306
+
307
+ **If commit FAILS after successful edit:** mark "skipped: commit failed"; execute rollback_strategy to restore pre-fix state; do NOT leave uncommitted changes; document commit error in skip reason; continue.
308
+
309
+ **g. Record result** per finding:
310
+ ```javascript
311
+ {
312
+ finding_id: "CR-01",
313
+ status: "fixed" | "skipped",
314
+ files_modified: ["path/to/file1", "path/to/file2"], // if fixed
315
+ commit_hash: "abc1234", // if fixed
316
+ skip_reason: "code context differs from review" // if skipped
317
+ }
318
+ ```
319
+
320
+ **h. Safe arithmetic for counters** (avoid set -e issues):
321
+ ```bash
322
+ FIXED_COUNT=$((FIXED_COUNT + 1))
323
+ ```
324
+ NOT `((FIXED_COUNT++))` — fails under `set -e`.
325
+ </step>
326
+
327
+ <step name="write_fix_report">
328
+ Create REVIEW-FIX.md at `fix_report_path`.
329
+
330
+ **Frontmatter:**
331
+ ```yaml
332
+ ---
333
+ phase: {phase}
334
+ fixed_at: {ISO timestamp}
335
+ review_path: {path to source REVIEW.md}
336
+ iteration: {current iteration number, default 1}
337
+ findings_in_scope: {count}
338
+ fixed: {count}
339
+ skipped: {count}
340
+ status: all_fixed | partial | none_fixed
341
+ ---
342
+ ```
343
+ Status: `all_fixed` (all in-scope fixed) · `partial` (some fixed, some skipped) · `none_fixed` (all skipped).
344
+
345
+ **Body:**
346
+ ```markdown
347
+ # Phase {X}: Code Review Fix Report
348
+
349
+ **Fixed at:** {timestamp}
350
+ **Source review:** {review_path}
351
+ **Iteration:** {N}
352
+
353
+ **Summary:**
354
+ - Findings in scope: {count}
355
+ - Fixed: {count}
356
+ - Skipped: {count}
357
+
358
+ ## Fixed Issues
359
+
360
+ {If no fixed issues, write: "None — all findings were skipped."}
361
+
362
+ ### {finding_id}: {title}
363
+
364
+ **Files modified:** `file1`, `file2`
365
+ **Commit:** {hash}
366
+ **Applied fix:** {brief description of what was changed}
367
+
368
+ ## Skipped Issues
369
+
370
+ {If no skipped issues, omit this section}
371
+
372
+ ### {finding_id}: {title}
373
+
374
+ **File:** `path/to/file.ext:{line}`
375
+ **Reason:** {skip_reason}
376
+ **Original issue:** {issue description from REVIEW.md}
377
+
378
+ ---
379
+
380
+ _Fixed: {timestamp}_
381
+ _Fixer: Claude (gsd-code-fixer)_
382
+ _Iteration: {N}_
383
+ ```
384
+
385
+ **Return to orchestrator:** DO NOT commit REVIEW-FIX.md — orchestrator handles it. Fixer only commits individual per-finding changes.
386
+ </step>
387
+
388
+ </execution_flow>
389
+
390
+ <critical_rules>
391
+
392
+ **ALWAYS run inside the isolated worktree** (set up per `setup_worktree`), unless `workflow.use_worktrees` is `false` (then edit/commit in the main checkout, `wt="."`). This prevents racing the foreground session on the shared main working tree (#2686).
393
+
394
+ **NEVER `rm -rf` a possible reparse point** — see setup_worktree. Never improvise `node_modules` teardown.
395
+
396
+ **Record where verification ran** (main checkout vs isolated worktree) in REVIEW-FIX.md.
397
+
398
+ **ALWAYS run the transactional 4-step cleanup tail in order** when a worktree was created (skipped when `workflow.use_worktrees` is `false`): fast-forward → worktree remove → branch delete (only if ff succeeded) → sentinel rm (only after worktree remove succeeds). Reversing the order recreates the orphan-worktree bug.
399
+
400
+ **ALWAYS use the Write tool to create files** — never `Bash(cat << 'EOF')` or heredoc.
401
+
402
+ **DO read the actual source file** before applying any fix — never blindly apply REVIEW.md suggestions.
403
+
404
+ **DO record `touched_files`** before every fix attempt — rollback is `git checkout -- {file}`, not content capture.
405
+
406
+ **DO commit each fix atomically** — one commit per finding, all modified file paths listed after the message.
407
+
408
+ **DO prefer Edit tool** over Write for targeted changes (better diff visibility).
409
+
410
+ **DO verify each fix** (3-tier: re-read → syntax check → accept minimum if unavailable).
411
+
412
+ **DO skip findings that can't be applied cleanly** — never force broken fixes; mark skipped with a clear reason.
413
+
414
+ **DO rollback via `git checkout -- {file}`** — never Write tool for rollback (partial write on failure corrupts the file).
415
+
416
+ **DO NOT modify files unrelated to the finding.**
417
+
418
+ **DO NOT create new files** unless the fix explicitly requires it (e.g. missing import/test file) — document if created.
419
+
420
+ **DO NOT run the full test suite** between fixes — verify only the specific change.
421
+
422
+ **DO respect CLAUDE.md project conventions** during fixes.
423
+
424
+ **DO NOT leave uncommitted changes** — if commit fails after a successful edit, rollback and mark skipped.
425
+
426
+ </critical_rules>
427
+
428
+ <partial_success>
429
+
430
+ ## Partial Failure Semantics
431
+
432
+ Fixes commit **per-finding** — by design, each commit is self-contained and correct.
433
+
434
+ **Mid-run crash:** some fix commits may already exist in git history; valid even if the agent crashes before writing REVIEW-FIX.md. Orchestrator handles overall success/failure reporting.
435
+
436
+ **Agent failure before REVIEW-FIX.md:** workflow detects the missing file and reports "Agent failed. Some fix commits may already exist — check `git log`." User inspects and decides next step.
437
+
438
+ **REVIEW-FIX.md accuracy:** reflects what was actually fixed/skipped at write time; fixed count matches commit count; skip reasons documented.
439
+
440
+ **Idempotency:** re-running on the same REVIEW.md may produce different results if code changed — not a bug, the fixer adapts to current state, not historical review context.
441
+
442
+ **Partial automation:** skip-and-log allows partial automation; human reviews skipped findings and fixes manually.
443
+
444
+ </partial_success>
445
+
446
+ <success_criteria>
447
+
448
+ - [ ] All in-scope findings attempted (fixed or skipped with reason)
449
+ - [ ] Each fix committed atomically with `fix({padded_phase}): {id} {description}` format
450
+ - [ ] All modified files listed after each commit message (multi-file support)
451
+ - [ ] REVIEW-FIX.md created with accurate counts, status, iteration number
452
+ - [ ] No source files left in broken state (failed fixes rolled back via git checkout)
453
+ - [ ] No partial or uncommitted changes remain
454
+ - [ ] Verification performed for each fix (minimum: re-read; preferred: syntax check)
455
+ - [ ] Rollback used `git checkout -- {file}` (atomic, not Write tool)
456
+ - [ ] Skipped findings documented with specific reasons
457
+ - [ ] Project conventions from CLAUDE.md respected
458
+
459
+ </success_criteria>
@@ -217,8 +217,8 @@ If a finding references multiple files (in Fix section or Issue section):
217
217
  This agent runs as a background process that makes commits. Operating on the main working tree would race the foreground session (shared index, HEAD, and on-disk files). Instead, every instance runs in its own isolated worktree.
218
218
 
219
219
  **#2825: honor `workflow.use_worktrees`.** This is the ONLY writer that hand-rolls a git worktree
220
- inside the agent prompt; every other writer path (`/gsd:execute-phase`, `/gsd:execute-plan`,
221
- `/gsd:quick`, `/gsd:diagnose-issues`) reads `workflow.use_worktrees` and skips isolation when it is
220
+ inside the agent prompt; every other writer path (`/gsd:execute-phase`, `/gsd:quick`, and the
221
+ `execute-plan` / `diagnose-issues` workflows) reads `workflow.use_worktrees` and skips isolation when it is
222
222
  `false`. Read the same flag here and, when it is `false`, edit and commit in the main checkout
223
223
  directly (set `wt="."`, no `reviewfix_branch`, no recovery sentinel, no `git worktree add`, and skip
224
224
  the cleanup tail — there is no worktree to remove). When the flag is not `false`, the transactional
@@ -254,13 +254,14 @@ test -n "$branch" || { echo "Detached HEAD is not supported for review-fix (#268
254
254
 
255
255
  # #2647 defense-in-depth: padded_phase is interpolated into a worktree PATH
256
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
257
+ # validates it as ^[0-9]+[A-Z]?(\.[0-9]+)*$, but this agent prompt is a literal bash
258
258
  # contract any caller can spawn — validate at the SINK too, so a future caller
259
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
260
+ # injection. Reject anything that is not the canonical phase-number grammar
261
+ # (src/phase-id.cts): digits, an optional single uppercase letter, then dotted
262
+ # numeric segments (e.g. '02', '36.14', '12A'); reject '../', spaces, shell metachars.
263
+ if ! [[ "$padded_phase" =~ ^[0-9]+[A-Z]?(\.[0-9]+)*$ ]]; then
264
+ echo "Invalid padded_phase for review-fix: '$padded_phase' (expected e.g. '02', '36.14', '23.1.2', or '12A')"; exit 1
264
265
  fi
265
266
 
266
267
  # Recovery-sentinel handling (#2839):
@@ -531,7 +532,7 @@ For each finding in sorted order:
531
532
 
532
533
  Use `gsd_run query commit` with conventional format (message first, then every staged file path):
533
534
  ```bash
534
- _GSD_SHIM_NAME="gsd-tools.cjs"; _GSD_RUNTIME_ROOT="${RUNTIME_DIR:-$(git rev-parse --show-toplevel 2>/dev/null || pwd)}"; GSD_TOOLS="${_GSD_RUNTIME_ROOT}/gsd-core/bin/${_GSD_SHIM_NAME}"; _gsd_at() { for _p; do if [ -f "$_p" ]; then GSD_TOOLS="$_p"; return 0; fi; done; return 1; }; if _gsd_at "${_GSD_RUNTIME_ROOT}/gsd-core/bin/${_GSD_SHIM_NAME}" "${_GSD_RUNTIME_ROOT}/.claude/gsd-core/bin/${_GSD_SHIM_NAME}" "${_GSD_RUNTIME_ROOT}/.codex/gsd-core/bin/${_GSD_SHIM_NAME}"; then gsd_run() { node "$GSD_TOOLS" "$@"; }; elif unset -f gsd_run; _G="$(command -v gsd_run)"; then GSD_TOOLS="$_G"; gsd_run() { "$GSD_TOOLS" "$@"; }; elif _gsd_at "${CLAUDE_CONFIG_DIR:-$HOME/.claude}/gsd-core/bin/${_GSD_SHIM_NAME}" "${HERMES_HOME:-$HOME/.hermes}/gsd-core/bin/${_GSD_SHIM_NAME}" "${CURSOR_CONFIG_DIR:-$HOME/.cursor}/gsd-core/bin/${_GSD_SHIM_NAME}" "${CODEX_HOME:-$HOME/.codex}/gsd-core/bin/${_GSD_SHIM_NAME}" "${GEMINI_CONFIG_DIR:-$HOME/.gemini}/gsd-core/bin/${_GSD_SHIM_NAME}" "${COPILOT_CONFIG_DIR:-$HOME/.copilot}/gsd-core/bin/${_GSD_SHIM_NAME}" "${WINDSURF_CONFIG_DIR:-$HOME/.codeium/windsurf}/gsd-core/bin/${_GSD_SHIM_NAME}" "${AUGMENT_CONFIG_DIR:-$HOME/.augment}/gsd-core/bin/${_GSD_SHIM_NAME}" "${TRAE_CONFIG_DIR:-$HOME/.trae}/gsd-core/bin/${_GSD_SHIM_NAME}" "${QWEN_CONFIG_DIR:-$HOME/.qwen}/gsd-core/bin/${_GSD_SHIM_NAME}" "${CODEBUDDY_CONFIG_DIR:-$HOME/.codebuddy}/gsd-core/bin/${_GSD_SHIM_NAME}" "${CLINE_CONFIG_DIR:-$HOME/.cline}/gsd-core/bin/${_GSD_SHIM_NAME}" "${GROK_AGENTS_HOME:-$HOME/.agents}/gsd-core/bin/${_GSD_SHIM_NAME}" "${ANTIGRAVITY_CONFIG_DIR:-$HOME/.gemini/antigravity}/gsd-core/bin/${_GSD_SHIM_NAME}" "${OPENCODE_CONFIG_DIR:-${XDG_CONFIG_HOME:-$HOME/.config}/opencode}/gsd-core/bin/${_GSD_SHIM_NAME}" "${KILO_CONFIG_DIR:-${XDG_CONFIG_HOME:-$HOME/.config}/kilo}/gsd-core/bin/${_GSD_SHIM_NAME}"; then gsd_run() { node "$GSD_TOOLS" "$@"; }; else echo "ERROR: gsd-tools.cjs not found at $GSD_TOOLS and gsd_run is not on PATH. Run: npx -y @opengsd/gsd-core@latest --claude --local" >&2; exit 1; fi; GSD_IDENTITY_STATUS=unverified; case "$(gsd_run runtime-identity --raw 2>/dev/null || true)" in '{"packageName":"@opengsd/gsd-core"'*'}') GSD_IDENTITY_STATUS=ok;; esac; export GSD_IDENTITY_STATUS; [ "$GSD_IDENTITY_STATUS" = ok ] || echo "WARNING: \"$GSD_TOOLS\" did not prove it is @opengsd/gsd-core - it is either a different package or an @opengsd/gsd-core older than the runtime-identity verb. See docs/how-to/diagnose-a-foreign-gsd-tools.md" >&2; if [ -n "${CLAUDE_ENV_FILE:-}" ] && [ -n "${GSD_TOOLS:-}" ]; then printf "export PATH='%s':\"\$PATH\"\n" "${GSD_TOOLS%/*}" >> "$CLAUDE_ENV_FILE" 2>/dev/null || true; fi
535
+ _GSD_SHIM_NAME="gsd-tools.cjs"; _GSD_RUNTIME_ROOT="${RUNTIME_DIR:-$(git rev-parse --show-toplevel 2>/dev/null || pwd)}"; GSD_TOOLS="${_GSD_RUNTIME_ROOT}/gsd-core/bin/${_GSD_SHIM_NAME}"; _gsd_at() { for _p; do if [ -f "$_p" ]; then GSD_TOOLS="$_p"; return 0; fi; done; return 1; }; _gsd_id_ok() { case "$("$1" runtime-identity --raw 2>/dev/null || true)" in '{"packageName":"@opengsd/gsd-core"'*'}') return 0;; *) return 1;; esac; }; _gsd_homes() { _gsd_at "${CLAUDE_CONFIG_DIR:-$HOME/.claude}/gsd-core/bin/${_GSD_SHIM_NAME}" "${HERMES_HOME:-$HOME/.hermes}/gsd-core/bin/${_GSD_SHIM_NAME}" "${CURSOR_CONFIG_DIR:-$HOME/.cursor}/gsd-core/bin/${_GSD_SHIM_NAME}" "${CODEX_HOME:-$HOME/.codex}/gsd-core/bin/${_GSD_SHIM_NAME}" "${GEMINI_CONFIG_DIR:-$HOME/.gemini}/gsd-core/bin/${_GSD_SHIM_NAME}" "${COPILOT_CONFIG_DIR:-$HOME/.copilot}/gsd-core/bin/${_GSD_SHIM_NAME}" "${WINDSURF_CONFIG_DIR:-$HOME/.codeium/windsurf}/gsd-core/bin/${_GSD_SHIM_NAME}" "${AUGMENT_CONFIG_DIR:-$HOME/.augment}/gsd-core/bin/${_GSD_SHIM_NAME}" "${TRAE_CONFIG_DIR:-$HOME/.trae}/gsd-core/bin/${_GSD_SHIM_NAME}" "${QWEN_CONFIG_DIR:-$HOME/.qwen}/gsd-core/bin/${_GSD_SHIM_NAME}" "${CODEBUDDY_CONFIG_DIR:-$HOME/.codebuddy}/gsd-core/bin/${_GSD_SHIM_NAME}" "${CLINE_CONFIG_DIR:-$HOME/.cline}/gsd-core/bin/${_GSD_SHIM_NAME}" "${GROK_AGENTS_HOME:-$HOME/.agents}/gsd-core/bin/${_GSD_SHIM_NAME}" "${ANTIGRAVITY_CONFIG_DIR:-$HOME/.gemini/antigravity}/gsd-core/bin/${_GSD_SHIM_NAME}" "${OPENCODE_CONFIG_DIR:-${XDG_CONFIG_HOME:-$HOME/.config}/opencode}/gsd-core/bin/${_GSD_SHIM_NAME}" "${KILO_CONFIG_DIR:-${XDG_CONFIG_HOME:-$HOME/.config}/kilo}/gsd-core/bin/${_GSD_SHIM_NAME}"; }; if _gsd_at "${_GSD_RUNTIME_ROOT}/gsd-core/bin/${_GSD_SHIM_NAME}" "${_GSD_RUNTIME_ROOT}/.claude/gsd-core/bin/${_GSD_SHIM_NAME}" "${_GSD_RUNTIME_ROOT}/.codex/gsd-core/bin/${_GSD_SHIM_NAME}"; then gsd_run() { node "$GSD_TOOLS" "$@"; }; elif _gsd_homes; then gsd_run() { node "$GSD_TOOLS" "$@"; }; elif unset -f gsd_run; _G="$(command -v gsd_run)"; [ -n "$_G" ] && _gsd_id_ok "$_G"; then GSD_TOOLS="$_G"; gsd_run() { "$GSD_TOOLS" "$@"; }; else echo "ERROR: gsd-tools.cjs not found at $GSD_TOOLS and no identity-proving gsd_run is on PATH. Run: npx -y @opengsd/gsd-core@latest --claude --local" >&2; exit 1; fi; GSD_IDENTITY_STATUS=unverified; _gsd_id_ok gsd_run && GSD_IDENTITY_STATUS=ok; export GSD_IDENTITY_STATUS; [ "$GSD_IDENTITY_STATUS" = ok ] || echo "WARNING: \"$GSD_TOOLS\" did not prove it is @opengsd/gsd-core - it is either a different package or an @opengsd/gsd-core older than the runtime-identity verb. See docs/how-to/diagnose-a-foreign-gsd-tools.md" >&2; if [ -n "${CLAUDE_ENV_FILE:-}" ] && [ -n "${GSD_TOOLS:-}" ]; then printf "export PATH='%s':\"\$PATH\"\n" "${GSD_TOOLS%/*}" >> "$CLAUDE_ENV_FILE" 2>/dev/null || true; fi
535
536
  gsd_run query commit \
536
537
  "fix({padded_phase}): {finding_id} {short_description}" \
537
538
  --files \