@opengsd/gsd-core 1.5.0-rc.1 → 1.5.0-rc.2

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 (149) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/agents/gsd-code-fixer.md +3 -2
  3. package/agents/gsd-debug-session-manager.md +2 -1
  4. package/agents/gsd-debugger.md +4 -3
  5. package/agents/gsd-executor.md +16 -15
  6. package/agents/gsd-intel-updater.md +38 -41
  7. package/agents/gsd-phase-researcher.md +8 -8
  8. package/agents/gsd-plan-checker.md +12 -11
  9. package/agents/gsd-planner.md +21 -181
  10. package/agents/gsd-project-researcher.md +5 -4
  11. package/agents/gsd-research-synthesizer.md +2 -1
  12. package/agents/gsd-ui-researcher.md +2 -1
  13. package/agents/gsd-verifier.md +9 -8
  14. package/bin/install.js +205 -1402
  15. package/gemini-extension.json +1 -1
  16. package/gsd-core/bin/gsd_run +20 -0
  17. package/gsd-core/bin/lib/capability-registry.cjs +1820 -3
  18. package/gsd-core/bin/lib/check-command-router.cjs +133 -2
  19. package/gsd-core/bin/lib/core.cjs +51 -1
  20. package/gsd-core/bin/lib/edge-probe.cjs +173 -0
  21. package/gsd-core/bin/lib/fallow-runner.cjs +63 -25
  22. package/gsd-core/bin/lib/intel.cjs +3 -3
  23. package/gsd-core/bin/lib/io.cjs +61 -6
  24. package/gsd-core/bin/lib/phase-command-router.cjs +20 -0
  25. package/gsd-core/bin/lib/phase.cjs +17 -0
  26. package/gsd-core/bin/lib/probe-core.cjs +257 -0
  27. package/gsd-core/bin/lib/roadmap.cjs +40 -0
  28. package/gsd-core/bin/lib/runtime-artifact-layout.cjs +51 -141
  29. package/gsd-core/bin/lib/runtime-config-adapter-registry.cjs +67 -29
  30. package/gsd-core/bin/lib/runtime-homes.cjs +137 -101
  31. package/gsd-core/bin/lib/runtime-hooks-surface.cjs +1439 -0
  32. package/gsd-core/bin/lib/runtime-name-policy.cjs +1 -1
  33. package/gsd-core/bin/lib/runtime-slash.cjs +7 -2
  34. package/gsd-core/bin/lib/state-document.cjs +8 -0
  35. package/gsd-core/bin/lib/uat-predicate.cjs +329 -0
  36. package/gsd-core/bin/lib/update-context.cjs +4 -1
  37. package/gsd-core/bin/lib/verify.cjs +103 -0
  38. package/gsd-core/bin/lib/worktree-base-ref.cjs +33 -8
  39. package/gsd-core/bin/shared/model-catalog.json +11 -6
  40. package/gsd-core/bin/shared/runtime-aliases.manifest.json +2 -1
  41. package/gsd-core/references/edge-probe-fixtures/01-round-half-even/expected-coverage.json +7 -0
  42. package/gsd-core/references/edge-probe-fixtures/01-round-half-even/requirements.json +1 -0
  43. package/gsd-core/references/edge-probe-fixtures/02-merge-intervals/expected-coverage.json +8 -0
  44. package/gsd-core/references/edge-probe-fixtures/02-merge-intervals/requirements.json +1 -0
  45. package/gsd-core/references/edge-probe-fixtures/03-truncate-graphemes/expected-coverage.json +7 -0
  46. package/gsd-core/references/edge-probe-fixtures/03-truncate-graphemes/requirements.json +1 -0
  47. package/gsd-core/references/edge-probe-fixtures/04-money-rounding/expected-coverage.json +7 -0
  48. package/gsd-core/references/edge-probe-fixtures/04-money-rounding/requirements.json +1 -0
  49. package/gsd-core/references/edge-probe-fixtures/05-list-dedupe/expected-coverage.json +8 -0
  50. package/gsd-core/references/edge-probe-fixtures/05-list-dedupe/requirements.json +1 -0
  51. package/gsd-core/references/edge-probe-fixtures/06-resolved-mixed/expected-coverage.json +8 -0
  52. package/gsd-core/references/edge-probe-fixtures/06-resolved-mixed/requirements.json +1 -0
  53. package/gsd-core/references/edge-probe-fixtures/06-resolved-mixed/resolutions.json +4 -0
  54. package/gsd-core/references/edge-probe.md +261 -0
  55. package/gsd-core/references/planner-antipatterns.md +41 -0
  56. package/gsd-core/references/planner-guidance.md +186 -0
  57. package/gsd-core/templates/spec.md +12 -0
  58. package/gsd-core/workflows/_runtime-launcher.snippet.sh +1 -1
  59. package/gsd-core/workflows/add-backlog.md +1 -1
  60. package/gsd-core/workflows/add-phase.md +1 -1
  61. package/gsd-core/workflows/add-tests.md +1 -1
  62. package/gsd-core/workflows/add-todo.md +1 -1
  63. package/gsd-core/workflows/ai-integration-phase.md +1 -1
  64. package/gsd-core/workflows/audit-fix.md +1 -1
  65. package/gsd-core/workflows/audit-milestone.md +1 -1
  66. package/gsd-core/workflows/audit-uat.md +1 -1
  67. package/gsd-core/workflows/autonomous.md +26 -37
  68. package/gsd-core/workflows/check-todos.md +1 -1
  69. package/gsd-core/workflows/cleanup.md +1 -1
  70. package/gsd-core/workflows/code-review-fix.md +1 -1
  71. package/gsd-core/workflows/code-review.md +51 -16
  72. package/gsd-core/workflows/complete-milestone.md +1 -1
  73. package/gsd-core/workflows/debug.md +1 -1
  74. package/gsd-core/workflows/diagnose-issues.md +1 -1
  75. package/gsd-core/workflows/discuss-phase/modes/advisor.md +1 -1
  76. package/gsd-core/workflows/discuss-phase/modes/auto.md +1 -1
  77. package/gsd-core/workflows/discuss-phase/modes/chain.md +1 -1
  78. package/gsd-core/workflows/discuss-phase-assumptions.md +1 -1
  79. package/gsd-core/workflows/discuss-phase.md +1 -1
  80. package/gsd-core/workflows/do.md +1 -1
  81. package/gsd-core/workflows/docs-update.md +1 -1
  82. package/gsd-core/workflows/edit-phase.md +1 -1
  83. package/gsd-core/workflows/eval-review.md +1 -1
  84. package/gsd-core/workflows/execute-phase/steps/codebase-drift-gate.md +1 -1
  85. package/gsd-core/workflows/execute-phase/steps/post-merge-gate.md +1 -1
  86. package/gsd-core/workflows/execute-phase.md +1 -1
  87. package/gsd-core/workflows/execute-plan.md +1 -1
  88. package/gsd-core/workflows/explore.md +1 -1
  89. package/gsd-core/workflows/extract-learnings.md +1 -1
  90. package/gsd-core/workflows/forensics.md +1 -1
  91. package/gsd-core/workflows/graduation.md +1 -1
  92. package/gsd-core/workflows/health.md +1 -1
  93. package/gsd-core/workflows/import.md +1 -1
  94. package/gsd-core/workflows/ingest-docs.md +1 -1
  95. package/gsd-core/workflows/insert-phase.md +1 -1
  96. package/gsd-core/workflows/list-workspaces.md +1 -1
  97. package/gsd-core/workflows/manager.md +1 -1
  98. package/gsd-core/workflows/map-codebase.md +1 -1
  99. package/gsd-core/workflows/milestone-summary.md +1 -1
  100. package/gsd-core/workflows/mvp-phase.md +1 -1
  101. package/gsd-core/workflows/new-milestone.md +9 -1
  102. package/gsd-core/workflows/new-project.md +9 -1
  103. package/gsd-core/workflows/new-workspace.md +1 -1
  104. package/gsd-core/workflows/next.md +1 -1
  105. package/gsd-core/workflows/pause-work.md +1 -1
  106. package/gsd-core/workflows/plan-milestone-gaps.md +1 -1
  107. package/gsd-core/workflows/plan-phase.md +39 -27
  108. package/gsd-core/workflows/plan-review-convergence.md +1 -1
  109. package/gsd-core/workflows/plant-seed.md +1 -1
  110. package/gsd-core/workflows/profile-user.md +1 -1
  111. package/gsd-core/workflows/progress.md +1 -1
  112. package/gsd-core/workflows/quick.md +1 -1
  113. package/gsd-core/workflows/remove-phase.md +1 -1
  114. package/gsd-core/workflows/remove-workspace.md +1 -1
  115. package/gsd-core/workflows/resume-project.md +1 -1
  116. package/gsd-core/workflows/review.md +1 -1
  117. package/gsd-core/workflows/scan.md +1 -1
  118. package/gsd-core/workflows/secure-phase.md +1 -1
  119. package/gsd-core/workflows/settings-advanced.md +18 -14
  120. package/gsd-core/workflows/settings-integrations.md +1 -1
  121. package/gsd-core/workflows/settings.md +2 -2
  122. package/gsd-core/workflows/ship.md +1 -1
  123. package/gsd-core/workflows/sketch-wrap-up.md +1 -1
  124. package/gsd-core/workflows/sketch.md +1 -1
  125. package/gsd-core/workflows/spec-phase.md +130 -1
  126. package/gsd-core/workflows/spike-wrap-up.md +1 -1
  127. package/gsd-core/workflows/spike.md +1 -1
  128. package/gsd-core/workflows/stats.md +1 -1
  129. package/gsd-core/workflows/thread.md +1 -1
  130. package/gsd-core/workflows/transition.md +1 -1
  131. package/gsd-core/workflows/ui-phase.md +1 -1
  132. package/gsd-core/workflows/ui-review.md +1 -1
  133. package/gsd-core/workflows/ultraplan-phase.md +1 -1
  134. package/gsd-core/workflows/update.md +2 -2
  135. package/gsd-core/workflows/validate-phase.md +1 -1
  136. package/gsd-core/workflows/verify-phase.md +1 -1
  137. package/gsd-core/workflows/verify-work.md +1 -1
  138. package/package.json +6 -3
  139. package/scripts/gen-capability-registry.cjs +498 -13
  140. package/scripts/lib/allowlist-ratchet.cjs +101 -1
  141. package/scripts/lint-test-file-count.allowlist.json +15 -2
  142. package/scripts/lint-windows-test-portability.cjs +178 -0
  143. package/scripts/research-profiles.cjs +10 -10
  144. package/scripts/run-tests.cjs +54 -13
  145. package/scripts/sync-next-version.cjs +133 -0
  146. package/scripts/sync-runtime-launcher.cjs +21 -5
  147. package/scripts/update-size-baseline.cjs +68 -0
  148. package/scripts/workflow-policy.cjs +42 -9
  149. package/scripts/workflow-size.cjs +90 -0
@@ -123,37 +123,7 @@ If a feature has none of these three constraints, it gets planned. Period.
123
123
 
124
124
  <philosophy>
125
125
 
126
- ## Solo Developer + Claude Workflow
127
-
128
- Planning for ONE person (the user) and ONE implementer (Claude).
129
- - No teams, stakeholders, ceremonies, coordination overhead
130
- - User = visionary/product owner, Claude = builder
131
- - Estimate effort in context window cost, not time
132
-
133
- ## Plans Are Prompts
134
-
135
- PLAN.md IS the prompt (not a document that becomes one). Contains:
136
- - Objective (what and why)
137
- - Context (@file references)
138
- - Tasks (with verification criteria)
139
- - Success criteria (measurable)
140
-
141
- ## Quality Degradation Curve
142
-
143
- | Context Usage | Quality | Claude's State |
144
- |---------------|---------|----------------|
145
- | 0-30% | PEAK | Thorough, comprehensive |
146
- | 30-50% | GOOD | Confident, solid work |
147
- | 50-70% | DEGRADING | Efficiency mode begins |
148
- | 70%+ | POOR | Rushed, minimal |
149
-
150
- **Rule:** Plans should complete within ~50% context. More plans, smaller scope, consistent quality. Each plan: 2-3 tasks max.
151
-
152
- ## Ship Fast
153
-
154
- Plan -> Execute -> Ship -> Learn -> Repeat
155
-
156
- **Anti-enterprise patterns (delete if seen):** team structures, RACI matrices, sprint ceremonies, time estimates in human units, complexity/difficulty as scope justification, documentation for documentation's sake.
126
+ See @~/.claude/gsd-core/references/planner-guidance.md for planning philosophy (Solo Developer workflow, Plans Are Prompts, Quality Degradation Curve, Ship Fast).
157
127
 
158
128
  </philosophy>
159
129
 
@@ -220,54 +190,19 @@ Every task has four required fields:
220
190
 
221
191
  **Grep gate hygiene:** `grep -c` counts comments, so header prose can be self-invalidating. Use `grep -v '^#' | grep -c token`. Bare `== 0` gates on unfiltered files are forbidden.
222
192
 
223
- **<done>:** Acceptance criteria - measurable state of completion.
224
- - Good: "Valid credentials return 200 + JWT cookie, invalid credentials return 401"
225
- - Bad: "Authentication is complete"
226
-
227
- ## Task Types
228
-
229
- | Type | Use For | Autonomy |
230
- |------|---------|----------|
231
- | `auto` | Everything Claude can do independently | Fully autonomous |
232
- | `checkpoint:human-verify` | Visual/functional verification | Pauses for user |
233
- | `checkpoint:decision` | Implementation choices | Pauses for user |
234
- | `checkpoint:human-action` | Truly unavoidable manual steps (rare) | Pauses for user |
235
-
236
- **Automation-first rule:** If Claude CAN do it via CLI/API, Claude MUST do it. Checkpoints verify AFTER automation, not replace it.
237
-
238
- ## Task Sizing
239
-
240
- Each task targets **10–30% context consumption**.
193
+ <comment_text_discipline>
194
+ **Comment-text discipline (HARD GATE, #429):** A literal an acceptance criterion negative-greps for (`grep -c 'LIT' file == 0`) must NOT appear verbatim in any `<action>` body — JSDoc samples, head-comment references, or "what NOT to do" snippets echo into the written file and trip the executor's commit-time gate. `validate_plan` (`verify.plan-structure`) fails plan creation on violation. Rephrase the literal by concept, or — when it must legitimately appear — add an allowlist marker on its own line:
241
195
 
242
- | Context Cost | Action |
243
- |--------------|--------|
244
- | < 10% context | Too small — combine with a related task |
245
- | 10-30% context | Right size — proceed |
246
- | > 30% context | Too large — split into two tasks |
196
+ `<!-- planner-discipline-allow: LIT -->`
247
197
 
248
- **Context cost signals (use these, not time estimates):**
249
- - Files modified: 0-3 = ~10-15%, 4-6 = ~20-30%, 7+ = ~40%+ (split)
250
- - New subsystem: ~25-35%
251
- - Migration + data transform: ~30-40%
252
- - Pure config/wiring: ~5-10%
198
+ Full rules + worked examples: @gsd-core/references/planner-antipatterns.md ("Comment-Text Discipline").
199
+ </comment_text_discipline>
253
200
 
254
- **Too large signals:** Touches >3-5 files, multiple distinct chunks, action section >1 paragraph.
255
-
256
- **Combine signals:** One task sets up for the next, separate tasks touch same file, neither meaningful alone.
257
-
258
- ## Interface-First Task Ordering
259
-
260
- When a plan creates new interfaces consumed by subsequent tasks:
261
-
262
- 1. **First task: Define contracts** — Create type files, interfaces, exports
263
- 2. **Middle tasks: Implement** — Build against the defined contracts
264
- 3. **Last task: Wire** — Connect implementations to consumers
265
-
266
- This prevents the "scavenger hunt" anti-pattern where executors explore the codebase to understand contracts. They receive the contracts in the plan itself.
267
-
268
- ## Specificity
201
+ **<done>:** Acceptance criteria - measurable state of completion.
202
+ - Good: "Valid credentials return 200 + JWT cookie, invalid credentials return 401"
203
+ - Bad: "Authentication is complete"
269
204
 
270
- **Test:** Could a different Claude instance execute without asking clarifying questions? If not, add specificity. See @~/.claude/gsd-core/references/planner-antipatterns.md for vague-vs-specific comparison table.
205
+ See @~/.claude/gsd-core/references/planner-guidance.md for Task Types table, Task Sizing rules, Interface-First Task Ordering, and Specificity guidance.
271
206
 
272
207
  ## TDD Detection
273
208
 
@@ -336,47 +271,13 @@ Exceptions where `tdd="true"` is not needed: `type="checkpoint:*"` tasks, config
336
271
 
337
272
  **Compatibility with TDD detection:** When both `MVP_MODE=true` and `workflow.tdd_mode=true`, every behavior-adding task uses `tdd="true"` and a `<behavior>` block, AND the task ordering follows the vertical-slice structure above. The first task is always a failing end-to-end test.
338
273
 
339
- ## User Setup Detection
340
-
341
- For tasks involving external services, identify human-required configuration:
342
-
343
- External service indicators: New SDK (`stripe`, `@sendgrid/mail`, `twilio`, `openai`), webhook handlers, OAuth integration, `process.env.SERVICE_*` patterns.
344
-
345
- For each external service, determine:
346
- 1. **Env vars needed** — What secrets from dashboards?
347
- 2. **Account setup** — Does user need to create an account?
348
- 3. **Dashboard config** — What must be configured in external UI?
349
-
350
- Record in `user_setup` frontmatter. Only include what Claude literally cannot do. Do NOT surface in planning output — execute-plan handles presentation.
274
+ See @~/.claude/gsd-core/references/planner-guidance.md for User Setup Detection protocol (external service indicators, env vars, dashboard config).
351
275
 
352
276
  </task_breakdown>
353
277
 
354
278
  <dependency_graph>
355
279
 
356
- ## Building the Dependency Graph
357
-
358
- **For each task, record:**
359
- - `needs`: What must exist before this runs
360
- - `creates`: What this produces
361
- - `has_checkpoint`: Requires user interaction?
362
-
363
- **Example:** A→C, B→D, C+D→E, E→F(checkpoint). Waves: {A,B} → {C,D} → {E} → {F}.
364
-
365
- **Prefer vertical slices** (User feature: model+API+UI) over horizontal layers (all models → all APIs → all UIs). Vertical = parallel. Horizontal = sequential. Use horizontal only when shared foundation is required.
366
-
367
- ## File Ownership for Parallel Execution
368
-
369
- Exclusive file ownership prevents conflicts:
370
-
371
- ```yaml
372
- # Plan 01 frontmatter
373
- files_modified: [src/models/user.ts, src/api/users.ts]
374
-
375
- # Plan 02 frontmatter (no overlap = parallel)
376
- files_modified: [src/models/product.ts, src/api/products.ts]
377
- ```
378
-
379
- No overlap → can run parallel. File in multiple plans → later plan depends on earlier.
280
+ See @~/.claude/gsd-core/references/planner-guidance.md for dependency graph building rules and file ownership for parallel execution.
380
281
 
381
282
  </dependency_graph>
382
283
 
@@ -405,17 +306,7 @@ Plans should complete within ~50% context (not 80%). No context anxiety, quality
405
306
 
406
307
  **CONSIDER splitting:** >5 files total, natural semantic boundaries, context cost estimate exceeds 40% for a single plan. See `<planner_authority_limits>` for prohibited split reasons.
407
308
 
408
- ## Granularity Calibration
409
-
410
- The resolved granularity is provided in the planning context as `**Granularity:** <value>`. Read that value and apply the corresponding row below. When no explicit value is present, default to Standard.
411
-
412
- | Granularity | Typical Plans/Phase | Tasks/Plan |
413
- |-------------|---------------------|------------|
414
- | Coarse | 1-3 | 2-3 |
415
- | Standard | 3-5 | 2-3 |
416
- | Fine | 5-10 | 2-3 |
417
-
418
- Derive plans from actual work. Granularity determines compression tolerance, not a target.
309
+ See @~/.claude/gsd-core/references/planner-guidance.md for Granularity Calibration table (Coarse/Standard/Fine plans-per-phase).
419
310
 
420
311
  </scope_estimation>
421
312
 
@@ -773,7 +664,8 @@ start of execution when `--reviews` flag is present or reviews mode is active.
773
664
  Load planning context:
774
665
 
775
666
  ```bash
776
- INIT=$(gsd-tools query init.plan-phase "${PHASE}")
667
+ _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}"; if [ -f "$GSD_TOOLS" ]; then gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${_GSD_RUNTIME_ROOT}/.claude/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${_GSD_RUNTIME_ROOT}/.claude/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${_GSD_RUNTIME_ROOT}/.codex/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${_GSD_RUNTIME_ROOT}/.codex/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif command -v gsd-tools >/dev/null 2>&1; then GSD_TOOLS="$(command -v gsd-tools)"; gsd_run() { "$GSD_TOOLS" "$@"; }; elif [ -f "$HOME/.claude/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="$HOME/.claude/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${HERMES_HOME:-$HOME/.hermes}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${HERMES_HOME:-$HOME/.hermes}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${CURSOR_CONFIG_DIR:-$HOME/.cursor}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${CURSOR_CONFIG_DIR:-$HOME/.cursor}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${CODEX_HOME:-$HOME/.codex}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${CODEX_HOME:-$HOME/.codex}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${GEMINI_CONFIG_DIR:-$HOME/.gemini}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${GEMINI_CONFIG_DIR:-$HOME/.gemini}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${COPILOT_CONFIG_DIR:-$HOME/.copilot}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${COPILOT_CONFIG_DIR:-$HOME/.copilot}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${WINDSURF_CONFIG_DIR:-$HOME/.codeium/windsurf}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${WINDSURF_CONFIG_DIR:-$HOME/.codeium/windsurf}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${AUGMENT_CONFIG_DIR:-$HOME/.augment}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${AUGMENT_CONFIG_DIR:-$HOME/.augment}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${TRAE_CONFIG_DIR:-$HOME/.trae}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${TRAE_CONFIG_DIR:-$HOME/.trae}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${QWEN_CONFIG_DIR:-$HOME/.qwen}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${QWEN_CONFIG_DIR:-$HOME/.qwen}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${CODEBUDDY_CONFIG_DIR:-$HOME/.codebuddy}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${CODEBUDDY_CONFIG_DIR:-$HOME/.codebuddy}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${CLINE_CONFIG_DIR:-$HOME/.cline}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${CLINE_CONFIG_DIR:-$HOME/.cline}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${GROK_AGENTS_HOME:-$HOME/.agents}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${GROK_AGENTS_HOME:-$HOME/.agents}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${ANTIGRAVITY_CONFIG_DIR:-$HOME/.gemini/antigravity}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${ANTIGRAVITY_CONFIG_DIR:-$HOME/.gemini/antigravity}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${OPENCODE_CONFIG_DIR:-${XDG_CONFIG_HOME:-$HOME/.config}/opencode}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${OPENCODE_CONFIG_DIR:-${XDG_CONFIG_HOME:-$HOME/.config}/opencode}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${KILO_CONFIG_DIR:-${XDG_CONFIG_HOME:-$HOME/.config}/kilo}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${KILO_CONFIG_DIR:-${XDG_CONFIG_HOME:-$HOME/.config}/kilo}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; else echo "ERROR: gsd-tools.cjs not found at $GSD_TOOLS and gsd-tools is not on PATH. Run: npx -y @opengsd/gsd-core@latest --claude --local" >&2; exit 1; fi; 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
668
+ INIT=$(gsd_run query init.plan-phase "${PHASE}")
777
669
  if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi
778
670
  ```
779
671
 
@@ -781,7 +673,7 @@ Extract from init JSON: `planner_model`, `researcher_model`, `checker_model`, `c
781
673
 
782
674
  Also load planning state (position, decisions, blockers) via the SDK — **use `node` to invoke the CLI** (not `npx`):
783
675
  ```bash
784
- gsd-tools query state.load 2>/dev/null
676
+ gsd_run query state.load 2>/dev/null
785
677
  ```
786
678
  If STATE.md missing but .planning/ exists, offer to reconstruct or continue without.
787
679
  </step>
@@ -848,7 +740,7 @@ Apply discovery level protocol (see discovery_levels section).
848
740
 
849
741
  **Step 1 — Generate digest index:**
850
742
  ```bash
851
- gsd-tools query history-digest
743
+ gsd_run query history-digest
852
744
  ```
853
745
 
854
746
  **Step 2 — Select relevant phases (typically 2-4):**
@@ -1037,7 +929,7 @@ Include all frontmatter fields.
1037
929
  Validate each created PLAN.md using `gsd-tools query`:
1038
930
 
1039
931
  ```bash
1040
- VALID=$(gsd-tools query frontmatter.validate "$PLAN_PATH" --schema plan)
932
+ VALID=$(gsd_run query frontmatter.validate "$PLAN_PATH" --schema plan)
1041
933
  ```
1042
934
 
1043
935
  Returns JSON: `{ valid, missing, present, schema }`
@@ -1050,7 +942,7 @@ Required plan frontmatter fields:
1050
942
  Also validate plan structure:
1051
943
 
1052
944
  ```bash
1053
- STRUCTURE=$(gsd-tools query verify.plan-structure "$PLAN_PATH")
945
+ STRUCTURE=$(gsd_run query verify.plan-structure "$PLAN_PATH")
1054
946
  ```
1055
947
 
1056
948
  Returns JSON: `{ valid, errors, warnings, task_count, tasks }`
@@ -1089,7 +981,7 @@ Plans:
1089
981
 
1090
982
  <step name="git_commit">
1091
983
  ```bash
1092
- gsd-tools query commit "docs($PHASE): create phase plan" --files \
984
+ gsd_run query commit "docs($PHASE): create phase plan" --files \
1093
985
  .planning/phases/$PHASE-*/$PHASE-*-PLAN.md .planning/ROADMAP.md
1094
986
  ```
1095
987
  </step>
@@ -1102,59 +994,7 @@ Return structured planning outcome to orchestrator.
1102
994
 
1103
995
  <structured_returns>
1104
996
 
1105
- ## Planning Complete
1106
-
1107
- ```markdown
1108
- ## PLANNING COMPLETE
1109
-
1110
- **Phase:** {phase-name}
1111
- **Plans:** {N} plan(s) in {M} wave(s)
1112
-
1113
- ### Wave Structure
1114
-
1115
- | Wave | Plans | Autonomous |
1116
- |------|-------|------------|
1117
- | 1 | {plan-01}, {plan-02} | yes, yes |
1118
- | 2 | {plan-03} | no (has checkpoint) |
1119
-
1120
- ### Plans Created
1121
-
1122
- | Plan | Objective | Tasks | Files |
1123
- |------|-----------|-------|-------|
1124
- | {phase}-01 | [brief] | 2 | [files] |
1125
- | {phase}-02 | [brief] | 3 | [files] |
1126
-
1127
- ### Next Steps
1128
-
1129
- Execute: `/gsd:execute-phase {phase}`
1130
-
1131
- <sub>`/clear` first - fresh context window</sub>
1132
- ```
1133
-
1134
- ## Gap Closure Plans Created
1135
-
1136
- ```markdown
1137
- ## GAP CLOSURE PLANS CREATED
1138
-
1139
- **Phase:** {phase-name}
1140
- **Closing:** {N} gaps from {VERIFICATION|UAT}.md
1141
-
1142
- ### Plans
1143
-
1144
- | Plan | Gaps Addressed | Files |
1145
- |------|----------------|-------|
1146
- | {phase}-04 | [gap truths] | [files] |
1147
-
1148
- ### Next Steps
1149
-
1150
- Execute: `/gsd:execute-phase {phase} --gaps-only`
1151
- ```
1152
-
1153
- ## Checkpoint Reached / Revision Complete
1154
-
1155
- Follow templates in checkpoints and revision_mode sections respectively.
1156
-
1157
- ## Chunked Mode Returns
997
+ See @~/.claude/gsd-core/references/planner-guidance.md for `## PLANNING COMPLETE` and `## GAP CLOSURE PLANS CREATED` return format templates.
1158
998
 
1159
999
  See @~/.claude/gsd-core/references/planner-chunked.md for `## OUTLINE COMPLETE` and `## PLAN COMPLETE` return formats used in chunked mode.
1160
1000
 
@@ -76,7 +76,8 @@ Construct a JSON file at a temp path (e.g. `/tmp/research-plan-input.json`):
76
76
  ### Step B — Obtain the fetch plan
77
77
 
78
78
  ```bash
79
- gsd-tools query research-plan --input /tmp/research-plan-input.json
79
+ _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}"; if [ -f "$GSD_TOOLS" ]; then gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${_GSD_RUNTIME_ROOT}/.claude/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${_GSD_RUNTIME_ROOT}/.claude/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${_GSD_RUNTIME_ROOT}/.codex/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${_GSD_RUNTIME_ROOT}/.codex/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif command -v gsd-tools >/dev/null 2>&1; then GSD_TOOLS="$(command -v gsd-tools)"; gsd_run() { "$GSD_TOOLS" "$@"; }; elif [ -f "$HOME/.claude/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="$HOME/.claude/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${HERMES_HOME:-$HOME/.hermes}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${HERMES_HOME:-$HOME/.hermes}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${CURSOR_CONFIG_DIR:-$HOME/.cursor}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${CURSOR_CONFIG_DIR:-$HOME/.cursor}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${CODEX_HOME:-$HOME/.codex}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${CODEX_HOME:-$HOME/.codex}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${GEMINI_CONFIG_DIR:-$HOME/.gemini}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${GEMINI_CONFIG_DIR:-$HOME/.gemini}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${COPILOT_CONFIG_DIR:-$HOME/.copilot}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${COPILOT_CONFIG_DIR:-$HOME/.copilot}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${WINDSURF_CONFIG_DIR:-$HOME/.codeium/windsurf}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${WINDSURF_CONFIG_DIR:-$HOME/.codeium/windsurf}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${AUGMENT_CONFIG_DIR:-$HOME/.augment}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${AUGMENT_CONFIG_DIR:-$HOME/.augment}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${TRAE_CONFIG_DIR:-$HOME/.trae}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${TRAE_CONFIG_DIR:-$HOME/.trae}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${QWEN_CONFIG_DIR:-$HOME/.qwen}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${QWEN_CONFIG_DIR:-$HOME/.qwen}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${CODEBUDDY_CONFIG_DIR:-$HOME/.codebuddy}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${CODEBUDDY_CONFIG_DIR:-$HOME/.codebuddy}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${CLINE_CONFIG_DIR:-$HOME/.cline}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${CLINE_CONFIG_DIR:-$HOME/.cline}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${GROK_AGENTS_HOME:-$HOME/.agents}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${GROK_AGENTS_HOME:-$HOME/.agents}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${ANTIGRAVITY_CONFIG_DIR:-$HOME/.gemini/antigravity}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${ANTIGRAVITY_CONFIG_DIR:-$HOME/.gemini/antigravity}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${OPENCODE_CONFIG_DIR:-${XDG_CONFIG_HOME:-$HOME/.config}/opencode}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${OPENCODE_CONFIG_DIR:-${XDG_CONFIG_HOME:-$HOME/.config}/opencode}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${KILO_CONFIG_DIR:-${XDG_CONFIG_HOME:-$HOME/.config}/kilo}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${KILO_CONFIG_DIR:-${XDG_CONFIG_HOME:-$HOME/.config}/kilo}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; else echo "ERROR: gsd-tools.cjs not found at $GSD_TOOLS and gsd-tools is not on PATH. Run: npx -y @opengsd/gsd-core@latest --claude --local" >&2; exit 1; fi; 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
80
+ gsd_run query research-plan --input /tmp/research-plan-input.json
80
81
  ```
81
82
 
82
83
  Returns `{ "items": [ { "question": "...", "key": "<sha256>", "cache": { "hit": true/false, "stale": false }, "fetch": { "provider": "context7", "query": "..." } } ] }`.
@@ -111,7 +112,7 @@ For any other provider id `X` not listed above: use `mcp__X__*` if available, el
111
112
  After digesting a source, persist it so future runs can reuse it:
112
113
 
113
114
  ```bash
114
- gsd-tools query research-store put <key> \
115
+ gsd_run query research-store put <key> \
115
116
  --content "<one-paragraph digest>" \
116
117
  --source <curated|web> \
117
118
  --provider <provider-id> \
@@ -128,9 +129,9 @@ gsd-tools query research-store put <key> \
128
129
  Obtain the confidence tier from code — do not hard-code tiers in your reasoning:
129
130
 
130
131
  ```bash
131
- gsd-tools query classify-confidence --provider <provider-id>
132
+ gsd_run query classify-confidence --provider <provider-id>
132
133
  # for cross-checked findings, add --verified:
133
- gsd-tools query classify-confidence --provider <provider-id> --verified
134
+ gsd_run query classify-confidence --provider <provider-id> --verified
134
135
  ```
135
136
 
136
137
  Returns `HIGH`, `MEDIUM`, or `LOW`. Use that value when tagging claims and when calling `research-store put --confidence <value>`.
@@ -151,7 +151,8 @@ Write to `.planning/research/SUMMARY.md`.
151
151
  The 4 parallel researcher agents write files but do NOT commit. You commit everything together.
152
152
 
153
153
  ```bash
154
- gsd-tools query commit "docs: complete project research" --files .planning/research/
154
+ _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}"; if [ -f "$GSD_TOOLS" ]; then gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${_GSD_RUNTIME_ROOT}/.claude/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${_GSD_RUNTIME_ROOT}/.claude/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${_GSD_RUNTIME_ROOT}/.codex/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${_GSD_RUNTIME_ROOT}/.codex/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif command -v gsd-tools >/dev/null 2>&1; then GSD_TOOLS="$(command -v gsd-tools)"; gsd_run() { "$GSD_TOOLS" "$@"; }; elif [ -f "$HOME/.claude/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="$HOME/.claude/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${HERMES_HOME:-$HOME/.hermes}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${HERMES_HOME:-$HOME/.hermes}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${CURSOR_CONFIG_DIR:-$HOME/.cursor}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${CURSOR_CONFIG_DIR:-$HOME/.cursor}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${CODEX_HOME:-$HOME/.codex}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${CODEX_HOME:-$HOME/.codex}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${GEMINI_CONFIG_DIR:-$HOME/.gemini}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${GEMINI_CONFIG_DIR:-$HOME/.gemini}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${COPILOT_CONFIG_DIR:-$HOME/.copilot}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${COPILOT_CONFIG_DIR:-$HOME/.copilot}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${WINDSURF_CONFIG_DIR:-$HOME/.codeium/windsurf}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${WINDSURF_CONFIG_DIR:-$HOME/.codeium/windsurf}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${AUGMENT_CONFIG_DIR:-$HOME/.augment}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${AUGMENT_CONFIG_DIR:-$HOME/.augment}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${TRAE_CONFIG_DIR:-$HOME/.trae}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${TRAE_CONFIG_DIR:-$HOME/.trae}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${QWEN_CONFIG_DIR:-$HOME/.qwen}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${QWEN_CONFIG_DIR:-$HOME/.qwen}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${CODEBUDDY_CONFIG_DIR:-$HOME/.codebuddy}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${CODEBUDDY_CONFIG_DIR:-$HOME/.codebuddy}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${CLINE_CONFIG_DIR:-$HOME/.cline}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${CLINE_CONFIG_DIR:-$HOME/.cline}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${GROK_AGENTS_HOME:-$HOME/.agents}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${GROK_AGENTS_HOME:-$HOME/.agents}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${ANTIGRAVITY_CONFIG_DIR:-$HOME/.gemini/antigravity}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${ANTIGRAVITY_CONFIG_DIR:-$HOME/.gemini/antigravity}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${OPENCODE_CONFIG_DIR:-${XDG_CONFIG_HOME:-$HOME/.config}/opencode}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${OPENCODE_CONFIG_DIR:-${XDG_CONFIG_HOME:-$HOME/.config}/opencode}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${KILO_CONFIG_DIR:-${XDG_CONFIG_HOME:-$HOME/.config}/kilo}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${KILO_CONFIG_DIR:-${XDG_CONFIG_HOME:-$HOME/.config}/kilo}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; else echo "ERROR: gsd-tools.cjs not found at $GSD_TOOLS and gsd-tools is not on PATH. Run: npx -y @opengsd/gsd-core@latest --claude --local" >&2; exit 1; fi; 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
155
+ gsd_run query commit "docs: complete project research" --files .planning/research/
155
156
  ```
156
157
 
157
158
  ## Step 8: Return Summary
@@ -286,7 +286,8 @@ This file is the canonical output of this agent. The orchestrator reads `$PHASE_
286
286
  ## Step 6: Commit (optional)
287
287
 
288
288
  ```bash
289
- gsd-tools query commit "docs($PHASE): UI design contract" --files "$PHASE_DIR/$PADDED_PHASE-UI-SPEC.md"
289
+ _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}"; if [ -f "$GSD_TOOLS" ]; then gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${_GSD_RUNTIME_ROOT}/.claude/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${_GSD_RUNTIME_ROOT}/.claude/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${_GSD_RUNTIME_ROOT}/.codex/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${_GSD_RUNTIME_ROOT}/.codex/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif command -v gsd-tools >/dev/null 2>&1; then GSD_TOOLS="$(command -v gsd-tools)"; gsd_run() { "$GSD_TOOLS" "$@"; }; elif [ -f "$HOME/.claude/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="$HOME/.claude/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${HERMES_HOME:-$HOME/.hermes}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${HERMES_HOME:-$HOME/.hermes}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${CURSOR_CONFIG_DIR:-$HOME/.cursor}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${CURSOR_CONFIG_DIR:-$HOME/.cursor}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${CODEX_HOME:-$HOME/.codex}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${CODEX_HOME:-$HOME/.codex}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${GEMINI_CONFIG_DIR:-$HOME/.gemini}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${GEMINI_CONFIG_DIR:-$HOME/.gemini}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${COPILOT_CONFIG_DIR:-$HOME/.copilot}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${COPILOT_CONFIG_DIR:-$HOME/.copilot}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${WINDSURF_CONFIG_DIR:-$HOME/.codeium/windsurf}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${WINDSURF_CONFIG_DIR:-$HOME/.codeium/windsurf}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${AUGMENT_CONFIG_DIR:-$HOME/.augment}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${AUGMENT_CONFIG_DIR:-$HOME/.augment}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${TRAE_CONFIG_DIR:-$HOME/.trae}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${TRAE_CONFIG_DIR:-$HOME/.trae}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${QWEN_CONFIG_DIR:-$HOME/.qwen}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${QWEN_CONFIG_DIR:-$HOME/.qwen}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${CODEBUDDY_CONFIG_DIR:-$HOME/.codebuddy}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${CODEBUDDY_CONFIG_DIR:-$HOME/.codebuddy}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${CLINE_CONFIG_DIR:-$HOME/.cline}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${CLINE_CONFIG_DIR:-$HOME/.cline}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${GROK_AGENTS_HOME:-$HOME/.agents}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${GROK_AGENTS_HOME:-$HOME/.agents}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${ANTIGRAVITY_CONFIG_DIR:-$HOME/.gemini/antigravity}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${ANTIGRAVITY_CONFIG_DIR:-$HOME/.gemini/antigravity}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${OPENCODE_CONFIG_DIR:-${XDG_CONFIG_HOME:-$HOME/.config}/opencode}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${OPENCODE_CONFIG_DIR:-${XDG_CONFIG_HOME:-$HOME/.config}/opencode}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${KILO_CONFIG_DIR:-${XDG_CONFIG_HOME:-$HOME/.config}/kilo}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${KILO_CONFIG_DIR:-${XDG_CONFIG_HOME:-$HOME/.config}/kilo}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; else echo "ERROR: gsd-tools.cjs not found at $GSD_TOOLS and gsd-tools is not on PATH. Run: npx -y @opengsd/gsd-core@latest --claude --local" >&2; exit 1; fi; 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
290
+ gsd_run query commit "docs($PHASE): UI design contract" --files "$PHASE_DIR/$PADDED_PHASE-UI-SPEC.md"
290
291
  ```
291
292
 
292
293
  ## Step 7: Return Structured Result
@@ -99,9 +99,10 @@ Set `is_re_verification = false`, proceed with Step 1.
99
99
  ## Step 1: Load Context (Initial Mode Only)
100
100
 
101
101
  ```bash
102
+ _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}"; if [ -f "$GSD_TOOLS" ]; then gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${_GSD_RUNTIME_ROOT}/.claude/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${_GSD_RUNTIME_ROOT}/.claude/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${_GSD_RUNTIME_ROOT}/.codex/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${_GSD_RUNTIME_ROOT}/.codex/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif command -v gsd-tools >/dev/null 2>&1; then GSD_TOOLS="$(command -v gsd-tools)"; gsd_run() { "$GSD_TOOLS" "$@"; }; elif [ -f "$HOME/.claude/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="$HOME/.claude/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${HERMES_HOME:-$HOME/.hermes}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${HERMES_HOME:-$HOME/.hermes}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${CURSOR_CONFIG_DIR:-$HOME/.cursor}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${CURSOR_CONFIG_DIR:-$HOME/.cursor}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${CODEX_HOME:-$HOME/.codex}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${CODEX_HOME:-$HOME/.codex}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${GEMINI_CONFIG_DIR:-$HOME/.gemini}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${GEMINI_CONFIG_DIR:-$HOME/.gemini}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${COPILOT_CONFIG_DIR:-$HOME/.copilot}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${COPILOT_CONFIG_DIR:-$HOME/.copilot}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${WINDSURF_CONFIG_DIR:-$HOME/.codeium/windsurf}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${WINDSURF_CONFIG_DIR:-$HOME/.codeium/windsurf}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${AUGMENT_CONFIG_DIR:-$HOME/.augment}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${AUGMENT_CONFIG_DIR:-$HOME/.augment}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${TRAE_CONFIG_DIR:-$HOME/.trae}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${TRAE_CONFIG_DIR:-$HOME/.trae}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${QWEN_CONFIG_DIR:-$HOME/.qwen}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${QWEN_CONFIG_DIR:-$HOME/.qwen}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${CODEBUDDY_CONFIG_DIR:-$HOME/.codebuddy}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${CODEBUDDY_CONFIG_DIR:-$HOME/.codebuddy}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${CLINE_CONFIG_DIR:-$HOME/.cline}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${CLINE_CONFIG_DIR:-$HOME/.cline}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${GROK_AGENTS_HOME:-$HOME/.agents}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${GROK_AGENTS_HOME:-$HOME/.agents}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${ANTIGRAVITY_CONFIG_DIR:-$HOME/.gemini/antigravity}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${ANTIGRAVITY_CONFIG_DIR:-$HOME/.gemini/antigravity}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${OPENCODE_CONFIG_DIR:-${XDG_CONFIG_HOME:-$HOME/.config}/opencode}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${OPENCODE_CONFIG_DIR:-${XDG_CONFIG_HOME:-$HOME/.config}/opencode}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${KILO_CONFIG_DIR:-${XDG_CONFIG_HOME:-$HOME/.config}/kilo}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${KILO_CONFIG_DIR:-${XDG_CONFIG_HOME:-$HOME/.config}/kilo}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; else echo "ERROR: gsd-tools.cjs not found at $GSD_TOOLS and gsd-tools is not on PATH. Run: npx -y @opengsd/gsd-core@latest --claude --local" >&2; exit 1; fi; 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
102
103
  ls "$PHASE_DIR"/*-PLAN.md 2>/dev/null
103
104
  ls "$PHASE_DIR"/*-SUMMARY.md 2>/dev/null
104
- gsd-tools query roadmap.get-phase "$PHASE_NUM"
105
+ gsd_run query roadmap.get-phase "$PHASE_NUM"
105
106
  grep -E "^| $PHASE_NUM" .planning/REQUIREMENTS.md 2>/dev/null
106
107
  ```
107
108
 
@@ -114,7 +115,7 @@ In re-verification mode, must-haves come from Step 0.
114
115
  **Step 2a: Always load ROADMAP Success Criteria**
115
116
 
116
117
  ```bash
117
- PHASE_DATA=$(gsd-tools query roadmap.get-phase "$PHASE_NUM" --raw)
118
+ PHASE_DATA=$(gsd_run query roadmap.get-phase "$PHASE_NUM" --raw)
118
119
  ```
119
120
 
120
121
  Parse the `success_criteria` array from the JSON output. These are the **roadmap contract** — they must always be verified regardless of what PLAN frontmatter says. Store them as `roadmap_truths`.
@@ -219,7 +220,7 @@ overrides:
219
220
  Use `gsd-tools query` for artifact verification against must_haves in PLAN frontmatter:
220
221
 
221
222
  ```bash
222
- ARTIFACT_RESULT=$(gsd-tools query verify.artifacts "$PLAN_PATH")
223
+ ARTIFACT_RESULT=$(gsd_run query verify.artifacts "$PLAN_PATH")
223
224
  ```
224
225
 
225
226
  Parse JSON result: `{ all_passed, passed, total, artifacts: [{path, exists, issues, passed}] }`
@@ -325,7 +326,7 @@ Key links are critical connections. If broken, the goal fails even with all arti
325
326
  Use `gsd-tools query` for key link verification against must_haves in PLAN frontmatter:
326
327
 
327
328
  ```bash
328
- LINKS_RESULT=$(gsd-tools query verify.key-links "$PLAN_PATH")
329
+ LINKS_RESULT=$(gsd_run query verify.key-links "$PLAN_PATH")
329
330
  ```
330
331
 
331
332
  Parse JSON result: `{ all_verified, verified, total, links: [{from, to, via, verified, detail}] }`
@@ -407,12 +408,12 @@ Identify files modified in this phase from SUMMARY.md key-files section, or extr
407
408
 
408
409
  ```bash
409
410
  # Option 1: Extract from SUMMARY frontmatter
410
- SUMMARY_FILES=$(gsd-tools query summary-extract "$PHASE_DIR"/*-SUMMARY.md --fields key-files)
411
+ SUMMARY_FILES=$(gsd_run query summary-extract "$PHASE_DIR"/*-SUMMARY.md --fields key-files)
411
412
 
412
413
  # Option 2: Verify commits exist (if commit hashes documented)
413
414
  COMMIT_HASHES=$(grep -oE "[a-f0-9]{7,40}" "$PHASE_DIR"/*-SUMMARY.md | head -10)
414
415
  if [ -n "$COMMIT_HASHES" ]; then
415
- COMMITS_VALID=$(gsd-tools query verify.commits $COMMIT_HASHES)
416
+ COMMITS_VALID=$(gsd_run query verify.commits $COMMIT_HASHES)
416
417
  fi
417
418
 
418
419
  # Fallback: grep for files
@@ -587,7 +588,7 @@ Before reporting gaps, check if any identified gaps are explicitly addressed in
587
588
  **Load the full milestone roadmap:**
588
589
 
589
590
  ```bash
590
- ROADMAP_DATA=$(gsd-tools query roadmap.analyze --raw)
591
+ ROADMAP_DATA=$(gsd_run query roadmap.analyze --raw)
591
592
  ```
592
593
 
593
594
  Parse the JSON to extract all phases. Identify phases with `number > current_phase_number` (later phases in the milestone). For each later phase, extract its `goal` and `success_criteria`.
@@ -662,7 +663,7 @@ Deferred items are informational only — they do not require closure plans.
662
663
  **User Story format guard:** Apply via the centralized verb instead of inlining the regex:
663
664
 
664
665
  ```bash
665
- USER_STORY_VALID=$(gsd-tools query user-story.validate --story "$PHASE_GOAL" --pick valid)
666
+ USER_STORY_VALID=$(gsd_run query user-story.validate --story "$PHASE_GOAL" --pick valid)
666
667
  ```
667
668
 
668
669
  If `valid != true`, refuse to verify. Surface the discrepancy and ask the user to run `/gsd mvp-phase ${PHASE}` to set a proper User Story goal. The verb owns the canonical regex `/^As a .+, I want to .+, so that .+\.$/` and surfaces per-error guidance in `errors[]` plus slot extractions in `slots`. Do NOT attempt to verify against a non-User Story goal under MVP mode — the User Flow Coverage section would be low-quality.