@opengsd/gsd-core 1.13.0 → 1.14.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 (257) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/agents/gsd-advisor-researcher.compact.md +85 -0
  4. package/agents/gsd-ai-researcher.compact.md +96 -0
  5. package/agents/gsd-assumptions-analyzer.compact.md +81 -0
  6. package/agents/gsd-code-fixer.compact.md +458 -0
  7. package/agents/gsd-code-fixer.md +5 -5
  8. package/agents/gsd-code-reviewer.compact.md +269 -0
  9. package/agents/gsd-code-reviewer.md +15 -3
  10. package/agents/gsd-codebase-mapper.compact.md +760 -0
  11. package/agents/gsd-debug-session-manager.compact.md +345 -0
  12. package/agents/gsd-doc-classifier.compact.md +192 -0
  13. package/agents/gsd-doc-synthesizer.compact.md +200 -0
  14. package/agents/gsd-doc-verifier.compact.md +143 -0
  15. package/agents/gsd-doc-writer.compact.md +440 -0
  16. package/agents/gsd-dom-verifier.compact.md +138 -0
  17. package/agents/gsd-domain-researcher.compact.md +141 -0
  18. package/agents/gsd-eval-auditor.compact.md +160 -0
  19. package/agents/gsd-eval-planner.compact.md +137 -0
  20. package/agents/gsd-framework-selector.compact.md +82 -0
  21. package/agents/gsd-integration-checker.compact.md +245 -0
  22. package/agents/gsd-intel-updater.compact.md +226 -0
  23. package/agents/gsd-mempalace-curator.compact.md +45 -0
  24. package/agents/gsd-nyquist-auditor.compact.md +179 -0
  25. package/agents/gsd-pattern-mapper.compact.md +275 -0
  26. package/agents/gsd-project-researcher.compact.md +587 -0
  27. package/agents/gsd-research-synthesizer.compact.md +212 -0
  28. package/agents/gsd-roadmapper.compact.md +454 -0
  29. package/agents/gsd-roadmapper.md +13 -0
  30. package/agents/gsd-security-auditor.compact.md +162 -0
  31. package/agents/gsd-ui-auditor.compact.md +404 -0
  32. package/agents/gsd-ui-checker.compact.md +277 -0
  33. package/agents/gsd-ui-researcher.compact.md +282 -0
  34. package/agents/gsd-user-profiler.compact.md +108 -0
  35. package/bin/install.js +206 -68
  36. package/commands/gsd/cleanup.md +1 -0
  37. package/commands/gsd/code-review.md +2 -1
  38. package/commands/gsd/complete-milestone.md +1 -0
  39. package/commands/gsd/config.md +1 -0
  40. package/commands/gsd/debug.md +1 -0
  41. package/commands/gsd/graphify.md +1 -0
  42. package/commands/gsd/health.md +1 -0
  43. package/commands/gsd/mempalace-capture.md +1 -0
  44. package/commands/gsd/mempalace-recall.md +1 -0
  45. package/commands/gsd/new-milestone.md +1 -0
  46. package/commands/gsd/new-project.md +1 -0
  47. package/commands/gsd/next.md +1 -0
  48. package/commands/gsd/pause-work.md +1 -0
  49. package/commands/gsd/phase.md +1 -0
  50. package/commands/gsd/pr-branch.md +1 -0
  51. package/commands/gsd/resume-work.md +1 -0
  52. package/commands/gsd/review-backlog.md +1 -0
  53. package/commands/gsd/settings.md +2 -1
  54. package/commands/gsd/stats.md +1 -0
  55. package/commands/gsd/thread.md +1 -0
  56. package/commands/gsd/workspace.md +1 -0
  57. package/commands/gsd/workstreams.md +1 -0
  58. package/gsd-core/bin/check-latest-version.cjs +8 -3
  59. package/gsd-core/bin/gsd-tools.cjs +338 -125
  60. package/gsd-core/bin/lib/adr-parser.cjs +1 -1
  61. package/gsd-core/bin/lib/artifacts.cjs +2 -1
  62. package/gsd-core/bin/lib/audit.cjs +39 -22
  63. package/gsd-core/bin/lib/broken-windows.cjs +168 -49
  64. package/gsd-core/bin/lib/capability-lifecycle.cjs +10 -6
  65. package/gsd-core/bin/lib/capability-loader.cjs +135 -1
  66. package/gsd-core/bin/lib/capability-registry.cjs +79 -67
  67. package/gsd-core/bin/lib/capability-source.cjs +19 -2
  68. package/gsd-core/bin/lib/capability-validator.cjs +14 -1
  69. package/gsd-core/bin/lib/check-command-router.cjs +113 -36
  70. package/gsd-core/bin/lib/code-review-depth.cjs +2 -2
  71. package/gsd-core/bin/lib/commands.cjs +650 -72
  72. package/gsd-core/bin/lib/config-loader.cjs +1 -0
  73. package/gsd-core/bin/lib/config.cjs +153 -38
  74. package/gsd-core/bin/lib/coverage.cjs +1 -1
  75. package/gsd-core/bin/lib/decisions.cjs +137 -34
  76. package/gsd-core/bin/lib/external-descriptor-trust.cjs +29 -14
  77. package/gsd-core/bin/lib/gsd2-import.cjs +1 -2
  78. package/gsd-core/bin/lib/health-diagnostic-rules/state-consistency.cjs +12 -1
  79. package/gsd-core/bin/lib/health-diagnostic-rules/worktree-health.cjs +1 -1
  80. package/gsd-core/bin/lib/init.cjs +409 -47
  81. package/gsd-core/bin/lib/install-engine.cjs +16 -3
  82. package/gsd-core/bin/lib/install-profiles.cjs +14 -0
  83. package/gsd-core/bin/lib/installer-migrations.cjs +33 -4
  84. package/gsd-core/bin/lib/loop-resolver.cjs +50 -31
  85. package/gsd-core/bin/lib/mcp-catalog.cjs +2 -2
  86. package/gsd-core/bin/lib/milestone.cjs +19 -8
  87. package/gsd-core/bin/lib/model-resolver.cjs +101 -10
  88. package/gsd-core/bin/lib/phase-command-router.cjs +7 -1
  89. package/gsd-core/bin/lib/phase-id.cjs +161 -22
  90. package/gsd-core/bin/lib/phase-lifecycle.cjs +61 -0
  91. package/gsd-core/bin/lib/phase.cjs +167 -63
  92. package/gsd-core/bin/lib/planning-inspect.cjs +34 -18
  93. package/gsd-core/bin/lib/planning-snapshot.cjs +61 -12
  94. package/gsd-core/bin/lib/planning-workspace.cjs +50 -1
  95. package/gsd-core/bin/lib/pristine-baseline.cjs +182 -0
  96. package/gsd-core/bin/lib/prohibition-enforcement.cjs +91 -4
  97. package/gsd-core/bin/lib/quick-batch.cjs +1 -1
  98. package/gsd-core/bin/lib/refactor-trigger-command-router.cjs +61 -2
  99. package/gsd-core/bin/lib/research-store.cjs +11 -12
  100. package/gsd-core/bin/lib/review-lane-invocation.cjs +23 -0
  101. package/gsd-core/bin/lib/reviewer-step-dispatch.cjs +337 -0
  102. package/gsd-core/bin/lib/roadmap-parser.cjs +56 -15
  103. package/gsd-core/bin/lib/roadmap.cjs +108 -14
  104. package/gsd-core/bin/lib/runtime-artifact-conversion.cjs +27 -10
  105. package/gsd-core/bin/lib/runtime-artifact-install-plan.cjs +12 -3
  106. package/gsd-core/bin/lib/runtime-artifact-layout.cjs +13 -5
  107. package/gsd-core/bin/lib/runtime-hooks-surface.cjs +193 -4
  108. package/gsd-core/bin/lib/security.cjs +126 -7
  109. package/gsd-core/bin/lib/state-document.cjs +130 -28
  110. package/gsd-core/bin/lib/state-md-schema.cjs +21 -14
  111. package/gsd-core/bin/lib/state-transition.cjs +142 -28
  112. package/gsd-core/bin/lib/state.cjs +223 -27
  113. package/gsd-core/bin/lib/surface.cjs +60 -2
  114. package/gsd-core/bin/lib/task-command-router.cjs +12 -6
  115. package/gsd-core/bin/lib/uat.cjs +1 -1
  116. package/gsd-core/bin/lib/update-context.cjs +30 -24
  117. package/gsd-core/bin/lib/vendor/js-yaml.cjs +11 -3
  118. package/gsd-core/bin/lib/verification.cjs +47 -15
  119. package/gsd-core/bin/lib/verify-command-grounding.cjs +1 -1
  120. package/gsd-core/bin/lib/verify.cjs +188 -23
  121. package/gsd-core/bin/lib/workstream-inventory.cjs +1 -0
  122. package/gsd-core/bin/lib/worktree-safety.cjs +13 -7
  123. package/gsd-core/bin/shared/config-defaults.manifest.json +1 -0
  124. package/gsd-core/bin/shared/config-schema.manifest.json +5 -0
  125. package/gsd-core/bin/verify-reapply-patches.cjs +439 -80
  126. package/gsd-core/references/compact-content-gate.md +66 -0
  127. package/gsd-core/references/loop-hook-dispatch.md +18 -0
  128. package/gsd-core/references/model-profiles.md +12 -3
  129. package/gsd-core/references/planning-config.md +3 -0
  130. package/gsd-core/references/tdd.md +5 -2
  131. package/gsd-core/references/thinking-models-planning.md +18 -2
  132. package/gsd-core/references/verification-patterns.md +17 -4
  133. package/gsd-core/references/worktree-path-safety.md +112 -2
  134. package/gsd-core/templates/README.md +7 -1
  135. package/gsd-core/templates/state.md +6 -3
  136. package/gsd-core/templates/summary.compact.md +212 -0
  137. package/gsd-core/templates/user-setup.compact.md +199 -0
  138. package/gsd-core/templates/user-setup.md +0 -9
  139. package/gsd-core/workflows/add-todo.md +3 -2
  140. package/gsd-core/workflows/autonomous.md +13 -10
  141. package/gsd-core/workflows/check-todos.md +4 -2
  142. package/gsd-core/workflows/cleanup.md +3 -1
  143. package/gsd-core/workflows/code-review/steps/structural-pre-pass.md +7 -0
  144. package/gsd-core/workflows/code-review-fix.md +3 -3
  145. package/gsd-core/workflows/code-review.md +156 -30
  146. package/gsd-core/workflows/complete-milestone/detail/elaboration.md +274 -0
  147. package/gsd-core/workflows/complete-milestone.md +39 -262
  148. package/gsd-core/workflows/docs-update/detail/elaboration.md +179 -0
  149. package/gsd-core/workflows/docs-update.md +14 -155
  150. package/gsd-core/workflows/execute-phase/detail/elaboration.md +124 -0
  151. package/gsd-core/workflows/execute-phase/steps/codebase-drift-gate.md +18 -3
  152. package/gsd-core/workflows/execute-phase/steps/completion-reconciliation.md +56 -0
  153. package/gsd-core/workflows/execute-phase/steps/executor-isolation-dispatch.md +7 -2
  154. package/gsd-core/workflows/execute-phase/steps/executor-progress-policy.md +43 -0
  155. package/gsd-core/workflows/execute-phase/steps/sequential-root-pin.md +35 -0
  156. package/gsd-core/workflows/execute-phase.md +53 -152
  157. package/gsd-core/workflows/execute-plan.md +20 -7
  158. package/gsd-core/workflows/help/modes/full.compact.md +398 -0
  159. package/gsd-core/workflows/help.md +1 -1
  160. package/gsd-core/workflows/map-codebase.md +50 -3
  161. package/gsd-core/workflows/new-milestone.md +54 -12
  162. package/gsd-core/workflows/new-project/detail/elaboration.md +216 -0
  163. package/gsd-core/workflows/new-project.md +32 -202
  164. package/gsd-core/workflows/plan-phase/detail/elaboration.md +209 -0
  165. package/gsd-core/workflows/plan-phase.md +22 -181
  166. package/gsd-core/workflows/pr-branch.md +19 -7
  167. package/gsd-core/workflows/quick.md +8 -1
  168. package/gsd-core/workflows/reapply-patches.md +77 -3
  169. package/gsd-core/workflows/settings.md +18 -5
  170. package/gsd-core/workflows/update.md +7 -5
  171. package/gsd-core/workflows/verify-work/detail/elaboration.md +230 -0
  172. package/gsd-core/workflows/verify-work.md +20 -180
  173. package/hooks/dist/gsd-agent-isolation-guard.js +42 -16
  174. package/hooks/dist/gsd-context-monitor.js +88 -15
  175. package/hooks/dist/gsd-cursor-subagent-start.js +34 -14
  176. package/hooks/dist/gsd-secret-read-guard.js +44 -18
  177. package/hooks/dist/gsd-statusline.js +11 -7
  178. package/hooks/dist/gsd-validate-commit.sh +34 -4
  179. package/hooks/dist/gsd-worktree-path-guard.js +25 -14
  180. package/hooks/dist/gsd-write-guard.js +46 -1
  181. package/hooks/dist/lib/dispatch-identity.js +187 -0
  182. package/hooks/dist/lib/filename-classification.js +64 -0
  183. package/hooks/dist/lib/isolation-deny-reason.js +53 -1
  184. package/hooks/dist/lib/isolation-sentinel.js +58 -19
  185. package/hooks/gsd-agent-isolation-guard.js +42 -16
  186. package/hooks/gsd-context-monitor.js +88 -15
  187. package/hooks/gsd-cursor-subagent-start.js +34 -14
  188. package/hooks/gsd-secret-read-guard.js +44 -18
  189. package/hooks/gsd-statusline.js +11 -7
  190. package/hooks/gsd-validate-commit.sh +34 -4
  191. package/hooks/gsd-worktree-path-guard.js +25 -14
  192. package/hooks/gsd-write-guard.js +46 -1
  193. package/hooks/lib/dispatch-identity.js +187 -0
  194. package/hooks/lib/filename-classification.js +64 -0
  195. package/hooks/lib/isolation-deny-reason.js +53 -1
  196. package/hooks/lib/isolation-sentinel.js +58 -19
  197. package/package.json +10 -6
  198. package/scripts/benchmark-compact-content-variants.cjs +298 -0
  199. package/scripts/benchmark-compact-content.cjs +368 -0
  200. package/scripts/check-contract-drift.cjs +4 -1
  201. package/scripts/check-env.cjs +36 -8
  202. package/scripts/check-glossary-refs.cjs +25 -21
  203. package/scripts/ci-next-health.cjs +271 -0
  204. package/scripts/ci-prepare-test-scope.cjs +7 -7
  205. package/scripts/ci-test-scope.cjs +126 -20
  206. package/scripts/ci-timeout-report.cjs +1 -1
  207. package/scripts/diff-touches-shipped-paths.cjs +1 -1
  208. package/scripts/docs-guard-registry.cjs +7 -2
  209. package/scripts/gen-adr-index.cjs +8 -2
  210. package/scripts/gen-inventory-manifest.cjs +12 -0
  211. package/scripts/gen-platform-conformance-tier.cjs +557 -0
  212. package/scripts/lib/drift-scan.cjs +1 -1
  213. package/scripts/lib/macos-conformance-tier.generated.cjs +210 -0
  214. package/scripts/lib/npm-version-check-diagnosis.cjs +59 -0
  215. package/scripts/lib/platform-conformance-tier.generated.cjs +276 -0
  216. package/scripts/lib/suite-detection.cjs +32 -0
  217. package/scripts/lint-allowed-tools-parity.cjs +221 -0
  218. package/scripts/lint-docs-guard-registration.exempt-baseline.cjs +19 -2
  219. package/scripts/lint-phase-id-drift.cjs +338 -13
  220. package/scripts/lint-response-language-coverage.cjs +9 -3
  221. package/scripts/lint-source-test-name-collision.cjs +1 -1
  222. package/scripts/lint-test-file-count.allowlist.json +1 -0
  223. package/scripts/lint-vendored-deps.cjs +128 -17
  224. package/scripts/lint-workflow-shellcheck-baseline.json +85 -0
  225. package/scripts/prompt-injection-scan.sh +14 -0
  226. package/scripts/workflow-size.cjs +139 -0
  227. package/skills/gsd-cleanup/SKILL.md +1 -0
  228. package/skills/gsd-code-review/SKILL.md +2 -1
  229. package/skills/gsd-complete-milestone/SKILL.md +1 -0
  230. package/skills/gsd-config/SKILL.md +1 -0
  231. package/skills/gsd-debug/SKILL.md +1 -0
  232. package/skills/gsd-graphify/SKILL.md +1 -0
  233. package/skills/gsd-health/SKILL.md +1 -0
  234. package/skills/gsd-mempalace-capture/SKILL.md +1 -0
  235. package/skills/gsd-mempalace-recall/SKILL.md +1 -0
  236. package/skills/gsd-new-milestone/SKILL.md +1 -0
  237. package/skills/gsd-new-project/SKILL.md +1 -0
  238. package/skills/gsd-next/SKILL.md +1 -0
  239. package/skills/gsd-pause-work/SKILL.md +1 -0
  240. package/skills/gsd-phase/SKILL.md +1 -0
  241. package/skills/gsd-pr-branch/SKILL.md +1 -0
  242. package/skills/gsd-resume-work/SKILL.md +1 -0
  243. package/skills/gsd-review-backlog/SKILL.md +1 -0
  244. package/skills/gsd-settings/SKILL.md +2 -1
  245. package/skills/gsd-stats/SKILL.md +1 -0
  246. package/skills/gsd-thread/SKILL.md +1 -0
  247. package/skills/gsd-workspace/SKILL.md +1 -0
  248. package/skills/gsd-workstreams/SKILL.md +1 -0
  249. package/vscode/package.json +1 -1
  250. package/gsd-core/templates/claude-md.md +0 -145
  251. package/gsd-core/templates/codebase/concerns.md +0 -310
  252. package/gsd-core/templates/codebase/conventions.md +0 -307
  253. package/gsd-core/templates/codebase/integrations.md +0 -280
  254. package/gsd-core/templates/codebase/structure.md +0 -285
  255. package/gsd-core/templates/codebase/testing.md +0 -480
  256. package/gsd-core/templates/debug-subagent-prompt.md +0 -91
  257. package/gsd-core/templates/discovery.md +0 -146
@@ -0,0 +1,179 @@
1
+ # docs-update.md — deferred elaboration
2
+
3
+ Read in full when `workflow.compact_content` is `false` (the default) — see
4
+ `gsd-core/references/compact-content-gate.md` for the check and resolution rule this
5
+ spine defers to. Each `§` below is the full text the spine condenses at the point it
6
+ names.
7
+
8
+ ## § 1 — sequential_generation
9
+
10
+ **Read the work manifest first:** `Read .planning/tmp/docs-work-manifest.json` — use `canonical_queue` items for generation order. Update `status` after each doc is generated. Write the updated manifest back to disk after all docs are complete.
11
+
12
+ When the `Task` tool is unavailable, generate docs sequentially in the current context. This step replaces dispatch_wave_1, collect_wave_1, dispatch_wave_2, and collect_wave_2.
13
+
14
+ **IMPORTANT:** Do NOT use `browser_subagent`, `Explore`, or any browser-based tool. Use only file system tools (Read, Bash, Write, Grep, Glob, or equivalent tools available in your runtime).
15
+
16
+ Read `agents/gsd-doc-writer.md` instructions once before beginning. Follow the create_mode or update_mode instructions from that agent for each doc, using the same doc_assignment fields as the parallel path.
17
+
18
+ **Wave 1 (sequential — complete all three before starting Wave 2):**
19
+
20
+ For each Wave 1 doc, construct the equivalent doc_assignment block and generate the file inline:
21
+
22
+ 1. **README** — mode from resolve_modes; for update/supplement mode, include existing_content
23
+ - Construct doc_assignment: `type: readme`, `mode: {create|update|supplement}`, `preservation_mode: {value|null}`, `project_context: {INIT JSON}`, `existing_content:` (if update/supplement)
24
+ - Explore the codebase (Read, Grep, Glob, Bash) following gsd-doc-writer create_mode / update_mode instructions
25
+ - Write the file to the resolved path (README.md)
26
+
27
+ 2. **ARCHITECTURE** — mode from resolve_modes; for update/supplement mode, include existing_content
28
+ - Construct doc_assignment: `type: architecture`, `mode: {create|update|supplement}`, `preservation_mode: {value|null}`, `project_context: {INIT JSON}`, `existing_content:` (if update/supplement)
29
+ - Explore the codebase following gsd-doc-writer instructions
30
+ - Write the file to the resolved path (docs/ARCHITECTURE.md, or ARCHITECTURE.md if found at root as fallback)
31
+
32
+ 3. **CONFIGURATION** — mode from resolve_modes; for update/supplement mode, include existing_content
33
+ - Construct doc_assignment: `type: configuration`, `mode: {create|update|supplement}`, `preservation_mode: {value|null}`, `project_context: {INIT JSON}`, `existing_content:` (if update/supplement)
34
+ - Apply VERIFY markers to any infrastructure claim not discoverable from the repository
35
+ - Explore the codebase following gsd-doc-writer instructions
36
+ - Write the file to the resolved path (docs/CONFIGURATION.md, or CONFIGURATION.md if found at root as fallback)
37
+
38
+ **Wave 2 (sequential — begin only after all Wave 1 docs are written):**
39
+
40
+ Wave 2 docs can reference Wave 1 outputs since they are already written. Include `wave_1_outputs` in each doc_assignment.
41
+
42
+ 4. **GETTING-STARTED** — mode from resolve_modes; include wave_1_outputs: [README.md, docs/ARCHITECTURE.md, docs/CONFIGURATION.md]
43
+ 5. **DEVELOPMENT** — mode from resolve_modes; include wave_1_outputs
44
+ 6. **TESTING** — mode from resolve_modes; include wave_1_outputs
45
+ 7. **API** (only if queued) — mode from resolve_modes; include wave_1_outputs
46
+ 8. **DEPLOYMENT** (only if queued) — Apply VERIFY markers to any infrastructure claim not discoverable from the repository; include wave_1_outputs
47
+ 9. **CONTRIBUTING** (only if queued) — mode from resolve_modes; include wave_1_outputs
48
+
49
+ **Monorepo per-package READMEs (only if `monorepo_workspaces` is non-empty):**
50
+
51
+ After all 9 root-level docs are written, generate per-package READMEs sequentially:
52
+
53
+ For each resolved package directory (from workspace glob expansion) that contains a `package.json`:
54
+ - Determine mode: if `{package_dir}/README.md` exists, mode = `update`; else mode = `create`
55
+ - Construct doc_assignment: `type: readme`, `mode: {create|update}`, `scope: per_package`, `package_dir: {absolute path}`, `project_context: {INIT JSON with project_root set to package directory}`, `existing_content:` (if update)
56
+ - Follow gsd-doc-writer instructions for per_package scope
57
+ - Write the file to `{package_dir}/README.md`
58
+
59
+ Continue to verify_docs.
60
+
61
+ ## § 2 — fix_loop
62
+
63
+ **Read the work manifest first:** `Read .planning/tmp/docs-work-manifest.json` — identify ALL docs (canonical AND non-canonical) with `claims_failed > 0` from the verification results in `.planning/tmp/verify-*.json`. Both queues are eligible for fixes.
64
+
65
+ Correct flagged inaccuracies by re-sending failing docs to the doc-writer in fix mode. Per D-06, max 2 iterations. Per D-05, halt immediately on regression.
66
+
67
+ **Skip condition:** If all docs passed verification (no failures), skip this step.
68
+
69
+ **Iteration tracking:**
70
+ - `MAX_FIX_ITERATIONS = 2`
71
+ - `iteration = 0`
72
+ - `previous_passed_docs` = set of doc_paths where claims_failed === 0 after initial verification
73
+
74
+ **For each iteration (while iteration < MAX_FIX_ITERATIONS and there are docs with failures):**
75
+
76
+ 1. For each doc with `claims_failed > 0` in the latest verification_results:
77
+ a. Read the current file content from disk (the spine's truncation guard captures its line count from this same read).
78
+ b. Spawn `gsd-doc-writer` agent (or invoke sequentially) with a fix assignment:
79
+ ```xml
80
+ <doc_assignment>
81
+ type: {original doc type from the queue, e.g. readme}
82
+ mode: fix
83
+ doc_path: {relative path}
84
+ project_context: {the same INIT JSON object every doc_assignment carries}
85
+ existing_content: {current file content read from disk}
86
+ failures:
87
+ - line: {line}
88
+ claim: "{claim}"
89
+ expected: "{expected}"
90
+ actual: "{actual}"
91
+ </doc_assignment>
92
+ ```
93
+ c. Never batch multiple docs' failures into a single spawn — one agent call per doc.
94
+ d. Once the agent returns, apply the spine's post-fix truncation guard (line-count comparison, restore-and-mark-corrupted on breach). A corrupted doc stays in this iteration's re-verify pass at step 2 below; it just isn't handed another fix attempt.
95
+
96
+ 2. After all fix agents complete, re-verify ALL docs (not just the ones that were fixed):
97
+ - Re-run the same verification process as verify_docs step.
98
+ - Read updated result JSONs from `.planning/tmp/verify-{doc_filename}.json`.
99
+
100
+ 3. **Regression detection (D-05):**
101
+ For each doc in the new verification_results:
102
+ - If this doc was in `previous_passed_docs` (passed in the prior round) AND now has `claims_failed > 0`, this is a REGRESSION.
103
+ - If regression detected: HALT the loop immediately. Present:
104
+ ```
105
+ REGRESSION DETECTED -- halting fix loop.
106
+
107
+ {doc_path} previously passed verification but now has {claims_failed} failures after fix iteration {iteration + 1}.
108
+
109
+ This means the fix introduced new errors. Remaining failures require manual review.
110
+ ```
111
+ Continue to scan_for_secrets (do not attempt further fixes).
112
+
113
+ 4. Update `previous_passed_docs` with docs that now pass.
114
+ 5. Increment `iteration`.
115
+
116
+ **After loop exhaustion (iteration === MAX_FIX_ITERATIONS and failures remain):**
117
+
118
+ Present remaining failures:
119
+ ```
120
+ Fix loop completed ({MAX_FIX_ITERATIONS} iterations). Remaining failures:
121
+
122
+ | Doc | Failed Claims |
123
+ |-------------------|---------------|
124
+ | {doc_path} | {count} |
125
+
126
+ These failures require manual correction. Review the verification output in .planning/tmp/verify-*.json for details.
127
+ ```
128
+
129
+ Continue to scan_for_secrets.
130
+
131
+ ## § 3 — verify_only_report
132
+
133
+ **Reached when `--verify-only` is present in `$ARGUMENTS`.** This is an early-exit step — do not proceed to dispatch, generation, commit, or report steps after this step.
134
+
135
+ Invoke the gsd-doc-verifier agent in read-only mode for each file in `existing_docs` from the init JSON:
136
+
137
+ 1. For each doc in `existing_docs`:
138
+ a. Spawn `gsd-doc-verifier` (or invoke sequentially if Task tool is unavailable), passing `model="{DOC_VERIFIER_MODEL}"` as the Task/Agent call's `model` parameter — not part of the `<verify_assignment>` prompt — so `dynamic_routing`/`model_profile` tiers apply instead of the caller's session model (#3602). Omit the parameter entirely when the value is `"inherit"` or empty (#2517). Each spawn carries:
139
+ ```xml
140
+ <verify_assignment>
141
+ doc_path: {doc.path}
142
+ project_root: {the project_root field carried in the init JSON}
143
+ </verify_assignment>
144
+ ```
145
+ b. Read the result JSON from `.planning/tmp/verify-{doc_filename}.json`.
146
+
147
+ 2. Also count VERIFY markers in each doc: grep for `<!-- VERIFY:` in the file content.
148
+
149
+ Present a combined summary table:
150
+
151
+ ```
152
+ --verify-only audit:
153
+
154
+ | File | Claims Checked | Passed | Failed | VERIFY Markers |
155
+ |--------------------------|----------------|--------|--------|----------------|
156
+ | README.md | 12 | 10 | 2 | 0 |
157
+ | docs/ARCHITECTURE.md | 8 | 8 | 0 | 0 |
158
+ | docs/CONFIGURATION.md | 5 | 3 | 2 | 5 |
159
+ | ... | ... | ... | ... | ... |
160
+
161
+ Total: {total_checked} claims checked, {total_failed} failures, {total_markers} VERIFY markers requiring manual review
162
+ ```
163
+
164
+ If any failures exist, show details:
165
+ ```
166
+ Failed claims:
167
+ README.md:34 - "src/cli/index.ts" (expected: file exists, actual: file not found)
168
+ docs/CONFIGURATION.md:12 - "npm run deploy" (expected: script in package.json, actual: script not found)
169
+ ```
170
+
171
+ Display note:
172
+ ```
173
+ To fix failures automatically: /gsd:docs-update (runs generation + fix loop)
174
+ To regenerate all docs from scratch: /gsd:docs-update --force
175
+ ```
176
+
177
+ Clean up temp files: remove `.planning/tmp/verify-*.json` files.
178
+
179
+ End workflow — do not proceed to any dispatch, commit, or report steps.
@@ -10,6 +10,8 @@ Valid GSD subagent types (use exact names — do not fall back to 'general-purpo
10
10
 
11
11
  <process>
12
12
 
13
+ **Compact Content Gate.** Read and follow `gsd-core/references/compact-content-gate.md` now — it states the `workflow.compact_content` check and the resolution rule this spine defers to. When it directs a Read, read `gsd-core/workflows/docs-update/detail/elaboration.md` in full before continuing past this point; its content elaborates on three steps below (sequential_generation, fix_loop, verify_only_report).
14
+
13
15
  <step name="init_context" priority="first">
14
16
  Load docs-update context:
15
17
 
@@ -286,7 +288,7 @@ Mode resolution:
286
288
  | architecture | docs/architecture/overview.md | create | new directory |
287
289
  | getting_started | docs/guides/getting-started.md | update | found, hand-written |
288
290
  | development | docs/guides/development.md | create | matched docs/guides/ |
289
- | testing | docs/guides/testing.md | create | matched docs/guides/ |
291
+ | contributing | docs/guides/contributing.md | create | matched docs/guides/ |
290
292
  | configuration | docs/guides/configuration.md | create | matched docs/guides/ |
291
293
  | api | docs/api/reference.md | create | new directory |
292
294
  | deployment | docs/guides/deployment.md | update | found, hand-written |
@@ -721,56 +723,9 @@ If `section_manifest` (from `INIT_DOCS_UPDATE`) is `null` or `"dispatch-monorepo
721
723
  <!-- /gsd:section -->
722
724
 
723
725
  <step name="sequential_generation" condition="Task tool is NOT available (e.g. Antigravity, Gemini CLI, Codex, Copilot)">
724
- **Read the work manifest first:** `Read .planning/tmp/docs-work-manifest.json` — use `canonical_queue` items for generation order. Update `status` after each doc is generated. Write the updated manifest back to disk after all docs are complete.
725
-
726
- When the `Task` tool is unavailable, generate docs sequentially in the current context. This step replaces dispatch_wave_1, collect_wave_1, dispatch_wave_2, and collect_wave_2.
727
-
728
- **IMPORTANT:** Do NOT use `browser_subagent`, `Explore`, or any browser-based tool. Use only file system tools (Read, Bash, Write, Grep, Glob, or equivalent tools available in your runtime).
729
-
730
- Read `agents/gsd-doc-writer.md` instructions once before beginning. Follow the create_mode or update_mode instructions from that agent for each doc, using the same doc_assignment fields as the parallel path.
731
-
732
- **Wave 1 (sequential — complete all three before starting Wave 2):**
733
-
734
- For each Wave 1 doc, construct the equivalent doc_assignment block and generate the file inline:
735
-
736
- 1. **README** — mode from resolve_modes; for update/supplement mode, include existing_content
737
- - Construct doc_assignment: `type: readme`, `mode: {create|update|supplement}`, `preservation_mode: {value|null}`, `project_context: {INIT JSON}`, `existing_content:` (if update/supplement)
738
- - Explore the codebase (Read, Grep, Glob, Bash) following gsd-doc-writer create_mode / update_mode instructions
739
- - Write the file to the resolved path (README.md)
740
-
741
- 2. **ARCHITECTURE** — mode from resolve_modes; for update/supplement mode, include existing_content
742
- - Construct doc_assignment: `type: architecture`, `mode: {create|update|supplement}`, `preservation_mode: {value|null}`, `project_context: {INIT JSON}`, `existing_content:` (if update/supplement)
743
- - Explore the codebase following gsd-doc-writer instructions
744
- - Write the file to the resolved path (docs/ARCHITECTURE.md, or ARCHITECTURE.md if found at root as fallback)
745
-
746
- 3. **CONFIGURATION** — mode from resolve_modes; for update/supplement mode, include existing_content
747
- - Construct doc_assignment: `type: configuration`, `mode: {create|update|supplement}`, `preservation_mode: {value|null}`, `project_context: {INIT JSON}`, `existing_content:` (if update/supplement)
748
- - Apply VERIFY markers to any infrastructure claim not discoverable from the repository
749
- - Explore the codebase following gsd-doc-writer instructions
750
- - Write the file to the resolved path (docs/CONFIGURATION.md, or CONFIGURATION.md if found at root as fallback)
751
-
752
- **Wave 2 (sequential — begin only after all Wave 1 docs are written):**
753
-
754
- Wave 2 docs can reference Wave 1 outputs since they are already written. Include `wave_1_outputs` in each doc_assignment.
755
-
756
- 4. **GETTING-STARTED** — mode from resolve_modes; include wave_1_outputs: [README.md, docs/ARCHITECTURE.md, docs/CONFIGURATION.md]
757
- 5. **DEVELOPMENT** — mode from resolve_modes; include wave_1_outputs
758
- 6. **TESTING** — mode from resolve_modes; include wave_1_outputs
759
- 7. **API** (only if queued) — mode from resolve_modes; include wave_1_outputs
760
- 8. **DEPLOYMENT** (only if queued) — Apply VERIFY markers to any infrastructure claim not discoverable from the repository; include wave_1_outputs
761
- 9. **CONTRIBUTING** (only if queued) — mode from resolve_modes; include wave_1_outputs
726
+ When the `Task` tool is unavailable, generate all queued docs sequentially in the current context instead of spawning subagents — this step replaces dispatch_wave_1, collect_wave_1, dispatch_wave_2, and collect_wave_2. Read `agents/gsd-doc-writer.md` once, then for each queued doc (Wave 1: README/ARCHITECTURE/CONFIGURATION, complete before Wave 2; Wave 2: GETTING-STARTED/DEVELOPMENT/TESTING plus any queued conditional docs, referencing Wave 1 outputs) construct the same doc_assignment fields the parallel path uses and write the file inline, using only file system tools (never browser-based tools). If `monorepo_workspaces` is non-empty, generate per-package READMEs sequentially afterward. Continue to verify_docs.
762
727
 
763
- **Monorepo per-package READMEs (only if `monorepo_workspaces` is non-empty):**
764
-
765
- After all 9 root-level docs are written, generate per-package READMEs sequentially:
766
-
767
- For each resolved package directory (from workspace glob expansion) that contains a `package.json`:
768
- - Determine mode: if `{package_dir}/README.md` exists, mode = `update`; else mode = `create`
769
- - Construct doc_assignment: `type: readme`, `mode: {create|update}`, `scope: per_package`, `package_dir: {absolute path}`, `project_context: {INIT JSON with project_root set to package directory}`, `existing_content:` (if update)
770
- - Follow gsd-doc-writer instructions for per_package scope
771
- - Write the file to `{package_dir}/README.md`
772
-
773
- Continue to verify_docs.
728
+ Exact per-doc construction and the monorepo per-package loop: `gsd-core/workflows/docs-update/detail/elaboration.md` § 1.
774
729
  </step>
775
730
 
776
731
  <step name="verify_docs">
@@ -847,39 +802,16 @@ If any doc (canonical OR non-canonical) has `claims_failed > 0`: continue to fix
847
802
  </step>
848
803
 
849
804
  <step name="fix_loop">
850
- **Read the work manifest first:** `Read .planning/tmp/docs-work-manifest.json` — identify ALL docs (canonical AND non-canonical) with `claims_failed > 0` from the verification results in `.planning/tmp/verify-*.json`. Both queues are eligible for fixes.
851
-
852
- Correct flagged inaccuracies by re-sending failing docs to the doc-writer in fix mode. Per D-06, max 2 iterations. Per D-05, halt immediately on regression.
853
-
854
- **Skip condition:** If all docs passed verification (no failures), skip this step.
855
-
856
- **Iteration tracking:**
857
- - `MAX_FIX_ITERATIONS = 2`
858
- - `iteration = 0`
859
- - `previous_passed_docs` = set of doc_paths where claims_failed === 0 after initial verification
805
+ **Skip condition:** if every doc passed verification (no `claims_failed > 0`), skip this step entirely.
860
806
 
861
- **For each iteration (while iteration < MAX_FIX_ITERATIONS and there are docs with failures):**
807
+ Otherwise, correct flagged inaccuracies by re-sending failing docs to `gsd-doc-writer` in `fix` mode (one spawn per doc, never batched), for at most 2 iterations (D-06). Each spawn carries a `<doc_assignment>` block: `type` (the doc's original type), `mode: fix`, `doc_path`, `project_context`, `existing_content` (current file content), and `failures:` — a structured array of `{line, claim, expected, actual}` objects, one per failed claim.
862
808
 
863
- 1. For each doc with `claims_failed > 0` in the latest verification_results:
809
+ For each doc with a failure, per iteration:
864
810
  a. Read the current file content from disk. Record the pre-fix line count:
865
811
  ```bash
866
812
  PRE_FIX_LINES=$(wc -l < "{doc_path}" 2>/dev/null || echo 0)
867
813
  ```
868
- b. Spawn `gsd-doc-writer` agent (or invoke sequentially) with a fix assignment:
869
- ```xml
870
- <doc_assignment>
871
- type: {original doc type from the queue, e.g. readme}
872
- mode: fix
873
- doc_path: {relative path}
874
- project_context: {INIT JSON}
875
- existing_content: {current file content read from disk}
876
- failures:
877
- - line: {line}
878
- claim: "{claim}"
879
- expected: "{expected}"
880
- actual: "{actual}"
881
- </doc_assignment>
882
- ```
814
+ b. Spawn `gsd-doc-writer` with the `<doc_assignment>` block above.
883
815
  c. One agent spawn per doc with failures. Do not batch multiple docs into one spawn.
884
816
  d. **Post-fix truncation guard:** After the fix agent completes, check for file corruption:
885
817
  ```bash
@@ -891,90 +823,17 @@ Correct flagged inaccuracies by re-sending failing docs to the doc-writer in fix
891
823
  - Mark this doc as `"fix-corrupted"` in the manifest; it will appear in remaining failures at the end
892
824
  - Do NOT attempt to fix this doc again this iteration. It is still included in the step 2 re-verification (so its failures are counted) but no further fix agent will be dispatched for it in this iteration.
893
825
 
894
- 2. After all fix agents complete, re-verify ALL docs (not just the ones that were fixed):
895
- - Re-run the same verification process as verify_docs step.
896
- - Read updated result JSONs from `.planning/tmp/verify-{doc_filename}.json`.
897
-
898
- 3. **Regression detection (D-05):**
899
- For each doc in the new verification_results:
900
- - If this doc was in `previous_passed_docs` (passed in the prior round) AND now has `claims_failed > 0`, this is a REGRESSION.
901
- - If regression detected: HALT the loop immediately. Present:
902
- ```
903
- REGRESSION DETECTED -- halting fix loop.
904
-
905
- {doc_path} previously passed verification but now has {claims_failed} failures after fix iteration {iteration + 1}.
906
-
907
- This means the fix introduced new errors. Remaining failures require manual review.
908
- ```
909
- Continue to scan_for_secrets (do not attempt further fixes).
910
-
911
- 4. Update `previous_passed_docs` with docs that now pass.
912
- 5. Increment `iteration`.
826
+ After each iteration's fix agents complete, re-verify ALL docs and check for regression (D-05): any doc that previously passed and now fails HALTS the loop immediately — remaining failures require manual review, no further fixes attempted. After 2 iterations with failures remaining, report them and continue.
913
827
 
914
- **After loop exhaustion (iteration === MAX_FIX_ITERATIONS and failures remain):**
828
+ Continue to scan_for_secrets either way.
915
829
 
916
- Present remaining failures:
917
- ```
918
- Fix loop completed ({MAX_FIX_ITERATIONS} iterations). Remaining failures:
919
-
920
- | Doc | Failed Claims |
921
- |-------------------|---------------|
922
- | {doc_path} | {count} |
923
-
924
- These failures require manual correction. Review the verification output in .planning/tmp/verify-*.json for details.
925
- ```
926
-
927
- Continue to scan_for_secrets.
830
+ Exact iteration bookkeeping and the regression-halt report wording: `gsd-core/workflows/docs-update/detail/elaboration.md` § 2.
928
831
  </step>
929
832
 
930
833
  <step name="verify_only_report">
931
- **Reached when `--verify-only` is present in `$ARGUMENTS`.** This is an early-exit step — do not proceed to dispatch, generation, commit, or report steps after this step.
932
-
933
- Invoke the gsd-doc-verifier agent in read-only mode for each file in `existing_docs` from the init JSON:
934
-
935
- 1. For each doc in `existing_docs`:
936
- a. Spawn `gsd-doc-verifier` (or invoke sequentially if Task tool is unavailable), passing `model="{DOC_VERIFIER_MODEL}"` as the Task/Agent call's `model` parameter — not part of the `<verify_assignment>` prompt — so `dynamic_routing`/`model_profile` tiers apply instead of the caller's session model (#3602). Omit the parameter entirely when the value is `"inherit"` or empty (#2517). Each spawn carries:
937
- ```xml
938
- <verify_assignment>
939
- doc_path: {doc.path}
940
- project_root: {project_root from init JSON}
941
- </verify_assignment>
942
- ```
943
- b. Read the result JSON from `.planning/tmp/verify-{doc_filename}.json`.
944
-
945
- 2. Also count VERIFY markers in each doc: grep for `<!-- VERIFY:` in the file content.
946
-
947
- Present a combined summary table:
948
-
949
- ```
950
- --verify-only audit:
951
-
952
- | File | Claims Checked | Passed | Failed | VERIFY Markers |
953
- |--------------------------|----------------|--------|--------|----------------|
954
- | README.md | 12 | 10 | 2 | 0 |
955
- | docs/ARCHITECTURE.md | 8 | 8 | 0 | 0 |
956
- | docs/CONFIGURATION.md | 5 | 3 | 2 | 5 |
957
- | ... | ... | ... | ... | ... |
958
-
959
- Total: {total_checked} claims checked, {total_failed} failures, {total_markers} VERIFY markers requiring manual review
960
- ```
961
-
962
- If any failures exist, show details:
963
- ```
964
- Failed claims:
965
- README.md:34 - "src/cli/index.ts" (expected: file exists, actual: file not found)
966
- docs/CONFIGURATION.md:12 - "npm run deploy" (expected: script in package.json, actual: script not found)
967
- ```
968
-
969
- Display note:
970
- ```
971
- To fix failures automatically: /gsd:docs-update (runs generation + fix loop)
972
- To regenerate all docs from scratch: /gsd:docs-update --force
973
- ```
974
-
975
- Clean up temp files: remove `.planning/tmp/verify-*.json` files.
834
+ **Reached when `--verify-only` is present in `$ARGUMENTS`** — an early-exit reporting mode: do not proceed to dispatch, generation, commit, or report steps after this step. Spawn `gsd-doc-verifier` (read-only) for every file in `existing_docs`, count `<!-- VERIFY:` markers in each, and present a combined claims-checked/passed/failed/markers table plus a "how to fix" pointer to `/gsd:docs-update` (or `--force` to regenerate everything). Clean up `.planning/tmp/verify-*.json` afterward. End the workflow here.
976
835
 
977
- End workflow — do not proceed to any dispatch, commit, or report steps.
836
+ Exact table format and failure-detail wording: `gsd-core/workflows/docs-update/detail/elaboration.md` § 3.
978
837
  </step>
979
838
 
980
839
  <step name="scan_for_secrets">
@@ -0,0 +1,124 @@
1
+ # execute-phase.md — deferred elaboration
2
+
3
+ Read in full when `workflow.compact_content` is `false` (the default) — see
4
+ `gsd-core/references/compact-content-gate.md` for the check and resolution rule this
5
+ spine defers to. Each `§` below is the full text the spine condenses at the point it
6
+ names.
7
+
8
+ (safe_resume_gate, checkpoint_handling, and auto_copy_learnings are stated verbatim in the
9
+ spine itself — pre-existing structural drift guards in this repo's test suite pin their exact
10
+ wording and bash there, so nothing about them is deferred to this file.)
11
+
12
+ ## § 1 — check_interactive_mode
13
+
14
+ **Parse `--interactive` flag from $ARGUMENTS.**
15
+
16
+ **If `--interactive` flag present:** Switch to interactive execution mode.
17
+
18
+ Interactive mode executes plans sequentially **inline** (no subagent spawning) with user
19
+ checkpoints between tasks. The user can review, modify, or redirect work at any point.
20
+
21
+ **Interactive execution flow:**
22
+
23
+ 1. Load plan inventory as normal (discover_and_group_plans)
24
+ 2. For each plan (sequentially, ignoring wave grouping):
25
+
26
+ a. **Present the plan to the user:**
27
+ ```
28
+ ## Plan {plan_id}: {plan_name}
29
+
30
+ Objective: {from plan file}
31
+ Tasks: {task_count}
32
+
33
+ Options:
34
+ - Execute (proceed with all tasks)
35
+ - Review first (show task breakdown before starting)
36
+ - Skip (move to next plan)
37
+ - Stop (end execution, save progress)
38
+ ```
39
+
40
+ b. **If "Review first":** Read and display the full plan file. Ask again: Execute, Modify, Skip.
41
+
42
+ c. **If "Execute":** Read and follow `~/.claude/gsd-core/workflows/execute-plan.md` **inline**
43
+ (do NOT spawn a subagent). Execute tasks one at a time.
44
+
45
+ d. **After each task:** Pause briefly. If the user intervenes (types anything), stop and address
46
+ their feedback before continuing. Otherwise proceed to next task.
47
+
48
+ e. **After plan complete:** Show results, commit, create SUMMARY.md, then present next plan.
49
+
50
+ 3. After all plans: proceed to verification (same as normal mode).
51
+
52
+ (The spine's own condensed text already states the handle_branching hand-off; not repeated here.)
53
+
54
+ ## § 2 — cross_ai_delegation
55
+
56
+ **Optional step 2.5 — Delegate plans to an external AI runtime.**
57
+
58
+ This step runs after plan discovery and before normal wave execution. It identifies plans
59
+ that should be delegated to an external AI command and executes them via stdin-based prompt
60
+ delivery. Plans handled here are removed from the execute_waves plan list so the normal
61
+ executor skips them.
62
+
63
+ **Activation logic:**
64
+
65
+ 1. If `CROSS_AI_DISABLED` is true (`--no-cross-ai` flag): skip this step entirely.
66
+ 2. If `CROSS_AI_FORCE` is true (`--cross-ai` flag): mark ALL incomplete plans for cross-AI execution.
67
+ 3. Otherwise: check each plan's frontmatter for `cross_ai: true` AND verify config
68
+ `workflow.cross_ai_execution` is `true`. Plans matching both conditions are marked for cross-AI.
69
+
70
+ ```bash
71
+ _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
72
+ CROSS_AI_ENABLED=$(gsd_run query config-get workflow.cross_ai_execution --raw 2>/dev/null || echo "false")
73
+ CROSS_AI_CMD=$(gsd_run query config-get workflow.cross_ai_command --raw 2>/dev/null || echo "")
74
+ CROSS_AI_TIMEOUT=$(gsd_run query config-get workflow.cross_ai_timeout --raw 2>/dev/null || echo "300")
75
+ ```
76
+
77
+ **If no plans are marked for cross-AI:** Skip to execute_waves.
78
+
79
+ **If plans are marked but `cross_ai_command` is empty:** Error — tell user to set
80
+ `workflow.cross_ai_command` via `gsd_run query config-set workflow.cross_ai_command "<command>"`.
81
+
82
+ **For each cross-AI plan (sequentially):**
83
+
84
+ 1. **Construct the task prompt** from the plan file:
85
+ - Extract `<objective>` and `<tasks>` sections from the PLAN.md
86
+ - Append PROJECT.md context (project name, description, tech stack)
87
+ - Format as a self-contained execution prompt
88
+
89
+ 2. **Check for dirty working tree before execution:**
90
+ ```bash
91
+ if ! git diff --quiet HEAD 2>/dev/null; then
92
+ echo "WARNING: dirty working tree detected — the external AI command may produce uncommitted changes that conflict with existing modifications"
93
+ fi
94
+ ```
95
+
96
+ 3. **Run the external command** from the project root, writing the prompt to stdin.
97
+ Never shell-interpolate the prompt — always pipe via stdin to prevent injection:
98
+ ```bash
99
+ echo "$TASK_PROMPT" | gsd_run run-with-timeout "${CROSS_AI_TIMEOUT}" -- ${CROSS_AI_CMD} > "$CANDIDATE_SUMMARY" 2>"$ERROR_LOG"
100
+ EXIT_CODE=$?
101
+ ```
102
+
103
+ 4. **Evaluate the result:**
104
+
105
+ **Success (exit 0 + valid summary):**
106
+ - Read `$CANDIDATE_SUMMARY` and validate it contains meaningful content
107
+ (not empty, has at least a heading and description — a valid SUMMARY.md structure)
108
+ - Write it as the plan's SUMMARY.md file
109
+ - Update STATE.md plan status to complete
110
+ - Update ROADMAP.md progress
111
+ - Mark plan as handled — skip it in execute_waves
112
+
113
+ **Failure (non-zero exit or invalid summary):**
114
+ - Display the error output and exit code
115
+ - Warn: "The external command may have left uncommitted changes or partial edits
116
+ in the working tree. Review `git status` and `git diff` before proceeding."
117
+ - Offer three choices:
118
+ - **retry** — run the same plan through cross-AI again
119
+ - **skip** — fall back to normal executor for this plan (re-add to execute_waves list)
120
+ - **abort** — stop execution entirely, preserve state for resume
121
+
122
+ 5. **After all cross-AI plans processed:** Remove successfully handled plans from the
123
+ incomplete plan list so execute_waves skips them. Any skipped-to-fallback plans remain
124
+ in the list for normal executor processing.
@@ -79,7 +79,6 @@ Today's date: {date}
79
79
  --paths {affected_paths joined by comma}
80
80
 
81
81
  Refresh STRUCTURE.md and ARCHITECTURE.md scoped to the listed paths only.
82
- Stamp last_mapped_commit in each document's frontmatter.
83
82
  ${AGENT_SKILLS_MAPPER}"
84
83
  )
85
84
  ```
@@ -90,8 +89,24 @@ If the spawn fails or the agent reports an error: log `Codebase drift
90
89
  auto-remap failed: {reason}` and continue to `verify_phase_goal`. The phase
91
90
  is NOT failed by a remap failure.
92
91
 
93
- If the remap succeeds: log `Codebase drift auto-remap completed for paths:
94
- {affected_paths}` and continue to `verify_phase_goal`.
92
+ If the remap succeeds, stamp the new baseline into the two documents the
93
+ mapper just refreshed:
94
+
95
+ ```bash
96
+ gsd_run stamp-codebase-map --files STRUCTURE.md,ARCHITECTURE.md
97
+ ```
98
+
99
+ The stamp is a shell step, not a line in the mapper's prompt. An agent that
100
+ concludes its work is already done skips a prose instruction silently, and the
101
+ stamp is the one marker no human reviewing the documents would notice missing
102
+ (#3418). `--files` is scoped to what this step actually refreshed -- the other
103
+ five documents were not remapped and must not claim currency at HEAD.
104
+
105
+ Only stamp on success: stamping after a failed remap would record a baseline
106
+ the map never reached.
107
+
108
+ Then log `Codebase drift auto-remap completed for paths: {affected_paths}` and
109
+ continue to `verify_phase_goal`.
95
110
 
96
111
  The two relevant config keys (continue on error / failure if either is invalid):
97
112
  - `workflow.drift_threshold` (integer, default 3) — minimum drift elements before action
@@ -0,0 +1,56 @@
1
+ # Completion reconciliation (#4217, split A of #3754)
2
+
3
+ Read and follow this fragment from `execute-phase.md` step 4 whenever an executor's
4
+ completion is in question. It owns the whole reconciliation policy — both arms — so the
5
+ host wait step stays inside the ADR-857 Phase 6 byte ceiling (#1168).
6
+
7
+ **Reconcile FIRST, classify SECOND.** How the child's session ended is bookkeeping
8
+ about the transport; what it wrote to disk and to git is the evidence about the work.
9
+
10
+ ## When this runs
11
+
12
+ 1. **No terminal response** — a spawned agent does not return a normal terminal
13
+ completion signal but appears to have finished its work (or may still be running).
14
+ 2. **Abnormal end** — the child's session ended without a normal terminal completion
15
+ response: interrupted, aborted, closed, killed, timed out, or ended `turn_aborted` —
16
+ INCLUDING ends the orchestrator itself initiated. **An abnormally-ended child is
17
+ not evidence of failure (#4217):** the orchestrator's own interrupt/close says
18
+ nothing about whether the work completed; only the artifacts do.
19
+
20
+ This policy applies to EVERY runtime and every isolation path — harness `Agent()`
21
+ dispatches, orchestrator-worktree process spawns, and sequential dispatch alike. Never
22
+ block indefinitely waiting for a signal; verify via filesystem and git state.
23
+
24
+ ## Probes (per plan in the wave)
25
+
26
+ ```bash
27
+ # For each plan in this wave, check if the executor finished:
28
+ SUMMARY_EXISTS=$(test -f "{phase_dir}/{plan_number}-{plan_padded}-SUMMARY.md" && echo "true" || echo "false")
29
+ # #4003: anchored, zero-pad-tolerant scope (see safe_resume_gate); --since stays.
30
+ SPOT_PHASE_NUMBER="{phase_number}"
31
+ # #4619: same decimal/N-segment handling as safe_resume_gate.
32
+ SPOT_PHASE_INT=${SPOT_PHASE_NUMBER%%.*}; SPOT_PHASE_FRAC=${SPOT_PHASE_NUMBER#"$SPOT_PHASE_INT"}
33
+ SPOT_PHASE_N="$((10#$SPOT_PHASE_INT))${SPOT_PHASE_FRAC//./\\.}"
34
+ SPOT_PLAN_N=$((10#{plan_padded}))
35
+ COMMITS_FOUND=$(git log --oneline --all -E --grep="^[a-z]+\((0*${SPOT_PHASE_N})-(0*${SPOT_PLAN_N})\):" --since="1 hour ago" | head -1)
36
+ COMMITS_SINCE_DISPATCH=$(git log "${EXPECTED_BRANCH}" --since="${DISPATCH_TS}" --oneline | head -1)
37
+ ```
38
+
39
+ ## Verdicts
40
+
41
+ **If SUMMARY.md exists AND matching commits are found:** the agent completed
42
+ successfully — treat the plan as complete WITHOUT requiring another terminal child
43
+ response, proceed to step 5, and do NOT re-dispatch a fresh executor for this plan:
44
+ the work is already committed, and a second executor would redo it on top of itself.
45
+ Log: `"✓ {Plan ID} completed (verified via spot-check — completion signal not received)"`.
46
+
47
+ **If SUMMARY.md does NOT exist after a reasonable wait:** the agent may still be
48
+ running or may have failed silently. Check `git log --oneline -5` for recent
49
+ activity. If commits are still appearing, wait longer. If no activity, report the
50
+ plan as failed and route to the failure handler in step 6.
51
+
52
+ Evidence is BOTH probes or neither: a SUMMARY without matching commits, and matching
53
+ commits without a SUMMARY, are each incomplete evidence — never auto-complete on one
54
+ of them. When an abnormal end reconciles to no completion evidence, it stays failed:
55
+ route to the failure handler exactly as a normal failure would, and let the
56
+ safe-resume gate handle any un-summarized commits on the next run.
@@ -149,8 +149,12 @@ Assign the composed prompt to a shell variable so it can be passed as one argume
149
149
  # An unreadable source file is a halt condition (#3637 fail-closed),
150
150
  # never a skip — a child without these texts is not a gsd-executor.
151
151
  # 2. Substitute this plan's {plan_number}, {phase_number}, {phase_name},
152
- # {phase_dir}, and {plan_file} placeholders (same values the harness
153
- # path substitutes into its Agent() prompt).
152
+ # {phase_dir}, {plan_file}, and {plan_id} placeholders (same values the
153
+ # harness path substitutes into its Agent() prompt). {plan_id} is this
154
+ # plan's `id` field from the phase-plan-index JSON — the guard hooks
155
+ # compare it verbatim against the sentinel the per-plan gate wrote, so a
156
+ # paraphrase or omission costs the dispatch its recorded isolation
157
+ # decision.
154
158
  # 3. Inline the gsd-executor ROLE DEFINITION: read `agents/gsd-executor.md`
155
159
  # (resolved against the install root the same way the harness runtime
156
160
  # resolves subagent types) and inline it verbatim at the provenance
@@ -175,6 +179,7 @@ TDD_APPLICABLE="$_TDD_APPLICABLE_RAW"
175
179
 
176
180
  EXECUTOR_PROMPT='<objective>
177
181
  Execute plan {plan_number} of phase {phase_number}-{phase_name}.
182
+ [gsd:dispatch phase="{phase_number}" plan="{plan_id}"]
178
183
  Commit each task atomically. Create SUMMARY.md.
179
184
  Do NOT update STATE.md or ROADMAP.md — the orchestrator owns those writes after all worktree agents in the wave complete.
180
185
  </objective>