gsd-antigravity-kit 2.0.1 → 2.1.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 (251) hide show
  1. package/.agent/skills/gsd/SKILL.md +26 -4
  2. package/.agent/skills/gsd/VERSION +1 -1
  3. package/.agent/skills/gsd/assets/templates/AI-SPEC.md +246 -0
  4. package/.agent/skills/gsd/assets/templates/DEBUG.md +7 -2
  5. package/.agent/skills/gsd/assets/templates/config.json +56 -48
  6. package/.agent/skills/gsd/assets/templates/research.md +40 -0
  7. package/.agent/skills/gsd/assets/templates/spec.md +307 -0
  8. package/.agent/skills/gsd/assets/templates/state.md +8 -0
  9. package/.agent/skills/gsd/bin/gsd-tools.cjs +212 -11
  10. package/.agent/skills/gsd/bin/help-manifest.json +8 -2
  11. package/.agent/skills/gsd/bin/hooks/gsd-check-update-worker.js +108 -0
  12. package/.agent/skills/gsd/bin/hooks/gsd-check-update.js +14 -89
  13. package/.agent/skills/gsd/bin/hooks/gsd-context-monitor.js +34 -5
  14. package/.agent/skills/gsd/bin/hooks/gsd-phase-boundary.sh +1 -0
  15. package/.agent/skills/gsd/bin/hooks/gsd-prompt-guard.js +1 -1
  16. package/.agent/skills/gsd/bin/hooks/gsd-read-guard.js +6 -1
  17. package/.agent/skills/gsd/bin/hooks/gsd-session-state.sh +1 -0
  18. package/.agent/skills/gsd/bin/hooks/gsd-statusline.js +150 -16
  19. package/.agent/skills/gsd/bin/hooks/gsd-validate-commit.sh +1 -0
  20. package/.agent/skills/gsd/bin/hooks/gsd-workflow-guard.js +1 -1
  21. package/.agent/skills/gsd/bin/lib/audit.cjs +757 -0
  22. package/.agent/skills/gsd/bin/lib/commands.cjs +17 -7
  23. package/.agent/skills/gsd/bin/lib/config.cjs +66 -20
  24. package/.agent/skills/gsd/bin/lib/core.cjs +212 -12
  25. package/.agent/skills/gsd/bin/lib/frontmatter.cjs +6 -8
  26. package/.agent/skills/gsd/bin/lib/graphify.cjs +494 -0
  27. package/.agent/skills/gsd/bin/lib/gsd2-import.cjs +511 -0
  28. package/.agent/skills/gsd/bin/lib/init.cjs +371 -18
  29. package/.agent/skills/gsd/bin/lib/intel.cjs +9 -30
  30. package/.agent/skills/gsd/bin/lib/milestone.cjs +18 -17
  31. package/.agent/skills/gsd/bin/lib/model-profiles.cjs +1 -0
  32. package/.agent/skills/gsd/bin/lib/phase.cjs +225 -98
  33. package/.agent/skills/gsd/bin/lib/profile-output.cjs +17 -5
  34. package/.agent/skills/gsd/bin/lib/roadmap.cjs +12 -5
  35. package/.agent/skills/gsd/bin/lib/state.cjs +394 -129
  36. package/.agent/skills/gsd/bin/lib/template.cjs +8 -4
  37. package/.agent/skills/gsd/bin/lib/uat.cjs +2 -1
  38. package/.agent/skills/gsd/bin/lib/verify.cjs +111 -42
  39. package/.agent/skills/gsd/migration_report.md +2 -2
  40. package/.agent/skills/gsd/references/agents/gsd-advisor-researcher.md +23 -0
  41. package/.agent/skills/gsd/references/agents/gsd-ai-researcher.md +133 -0
  42. package/.agent/skills/gsd/references/agents/gsd-code-fixer.md +11 -10
  43. package/.agent/skills/gsd/references/agents/gsd-code-reviewer.md +2 -2
  44. package/.agent/skills/gsd/references/agents/gsd-codebase-mapper.md +13 -2
  45. package/.agent/skills/gsd/references/agents/gsd-debug-session-manager.md +314 -0
  46. package/.agent/skills/gsd/references/agents/gsd-debugger.md +147 -76
  47. package/.agent/skills/gsd/references/agents/gsd-doc-verifier.md +1 -1
  48. package/.agent/skills/gsd/references/agents/gsd-doc-writer.md +615 -602
  49. package/.agent/skills/gsd/references/agents/gsd-domain-researcher.md +153 -0
  50. package/.agent/skills/gsd/references/agents/gsd-eval-auditor.md +175 -0
  51. package/.agent/skills/gsd/references/agents/gsd-eval-planner.md +154 -0
  52. package/.agent/skills/gsd/references/agents/gsd-executor.md +108 -38
  53. package/.agent/skills/gsd/references/agents/gsd-framework-selector.md +160 -0
  54. package/.agent/skills/gsd/references/agents/gsd-integration-checker.md +454 -443
  55. package/.agent/skills/gsd/references/agents/gsd-intel-updater.md +40 -20
  56. package/.agent/skills/gsd/references/agents/gsd-nyquist-auditor.md +187 -176
  57. package/.agent/skills/gsd/references/agents/gsd-pattern-mapper.md +335 -0
  58. package/.agent/skills/gsd/references/agents/gsd-phase-researcher.md +112 -13
  59. package/.agent/skills/gsd/references/agents/gsd-plan-checker.md +104 -10
  60. package/.agent/skills/gsd/references/agents/gsd-planner.md +125 -167
  61. package/.agent/skills/gsd/references/agents/gsd-project-researcher.md +25 -2
  62. package/.agent/skills/gsd/references/agents/gsd-research-synthesizer.md +3 -3
  63. package/.agent/skills/gsd/references/agents/gsd-roadmapper.md +12 -1
  64. package/.agent/skills/gsd/references/agents/gsd-security-auditor.md +139 -128
  65. package/.agent/skills/gsd/references/agents/gsd-ui-auditor.md +3 -3
  66. package/.agent/skills/gsd/references/agents/gsd-ui-checker.md +11 -2
  67. package/.agent/skills/gsd/references/agents/gsd-ui-researcher.md +27 -4
  68. package/.agent/skills/gsd/references/agents/gsd-verifier.md +13 -19
  69. package/.agent/skills/gsd/references/commands/atomic/add-todo.md +2 -2
  70. package/.agent/skills/gsd/references/commands/atomic/check-todos.md +2 -2
  71. package/.agent/skills/gsd/references/commands/atomic/cleanup.md +2 -2
  72. package/.agent/skills/gsd/references/commands/atomic/do.md +2 -2
  73. package/.agent/skills/gsd/references/commands/atomic/help.md +2 -2
  74. package/.agent/skills/gsd/references/commands/atomic/join-discord.md +2 -2
  75. package/.agent/skills/gsd/references/commands/atomic/note.md +2 -2
  76. package/.agent/skills/gsd/references/commands/atomic/session-report.md +2 -2
  77. package/.agent/skills/gsd/references/commands/atomic/ship.md +2 -2
  78. package/.agent/skills/gsd/references/commands/atomic/stats.md +2 -2
  79. package/.agent/skills/gsd/references/commands/atomic/thread.md +141 -41
  80. package/.agent/skills/gsd/references/commands/atomic/undo.md +2 -2
  81. package/.agent/skills/gsd/references/commands/milestone/add-backlog.md +15 -12
  82. package/.agent/skills/gsd/references/commands/milestone/audit-milestone.md +2 -2
  83. package/.agent/skills/gsd/references/commands/milestone/complete-milestone.md +2 -2
  84. package/.agent/skills/gsd/references/commands/milestone/milestone-summary.md +2 -2
  85. package/.agent/skills/gsd/references/commands/milestone/new-milestone.md +2 -2
  86. package/.agent/skills/gsd/references/commands/milestone/plan-milestone-gaps.md +2 -2
  87. package/.agent/skills/gsd/references/commands/milestone/plant-seed.md +2 -2
  88. package/.agent/skills/gsd/references/commands/milestone/review-backlog.md +4 -4
  89. package/.agent/skills/gsd/references/commands/misc/ai-integration-phase.md +38 -0
  90. package/.agent/skills/gsd/references/commands/misc/audit-fix.md +2 -2
  91. package/.agent/skills/gsd/references/commands/misc/audit-uat.md +2 -2
  92. package/.agent/skills/gsd/references/commands/misc/eval-review.md +34 -0
  93. package/.agent/skills/gsd/references/commands/misc/extract_learnings.md +24 -0
  94. package/.agent/skills/gsd/references/commands/misc/from-gsd2.md +49 -0
  95. package/.agent/skills/gsd/references/commands/misc/graphify.md +203 -0
  96. package/.agent/skills/gsd/references/commands/misc/inbox.md +40 -0
  97. package/.agent/skills/gsd/references/commands/misc/next.md +5 -3
  98. package/.agent/skills/gsd/references/commands/misc/progress.md +4 -3
  99. package/.agent/skills/gsd/references/commands/misc/sketch-wrap-up.md +33 -0
  100. package/.agent/skills/gsd/references/commands/misc/sketch.md +47 -0
  101. package/.agent/skills/gsd/references/commands/misc/spec-phase.md +64 -0
  102. package/.agent/skills/gsd/references/commands/misc/spike-wrap-up.md +33 -0
  103. package/.agent/skills/gsd/references/commands/misc/spike.md +43 -0
  104. package/.agent/skills/gsd/references/commands/misc/verify-work.md +2 -2
  105. package/.agent/skills/gsd/references/commands/phase/add-phase.md +2 -2
  106. package/.agent/skills/gsd/references/commands/phase/add-tests.md +2 -2
  107. package/.agent/skills/gsd/references/commands/phase/discuss-phase.md +5 -5
  108. package/.agent/skills/gsd/references/commands/phase/execute-phase.md +4 -4
  109. package/.agent/skills/gsd/references/commands/phase/insert-phase.md +2 -2
  110. package/.agent/skills/gsd/references/commands/phase/list-phase-assumptions.md +2 -2
  111. package/.agent/skills/gsd/references/commands/phase/plan-phase.md +3 -3
  112. package/.agent/skills/gsd/references/commands/phase/remove-phase.md +2 -2
  113. package/.agent/skills/gsd/references/commands/phase/research-phase.md +5 -5
  114. package/.agent/skills/gsd/references/commands/phase/secure-phase.md +2 -2
  115. package/.agent/skills/gsd/references/commands/phase/ui-phase.md +2 -2
  116. package/.agent/skills/gsd/references/commands/phase/ui-review.md +2 -2
  117. package/.agent/skills/gsd/references/commands/phase/validate-phase.md +2 -2
  118. package/.agent/skills/gsd/references/commands/phase/workstreams.md +9 -9
  119. package/.agent/skills/gsd/references/commands/project/analyze-dependencies.md +2 -2
  120. package/.agent/skills/gsd/references/commands/project/explore.md +2 -2
  121. package/.agent/skills/gsd/references/commands/project/import.md +2 -2
  122. package/.agent/skills/gsd/references/commands/project/intel.md +10 -10
  123. package/.agent/skills/gsd/references/commands/project/list-workspaces.md +2 -2
  124. package/.agent/skills/gsd/references/commands/project/map-codebase.md +2 -2
  125. package/.agent/skills/gsd/references/commands/project/new-project.md +2 -2
  126. package/.agent/skills/gsd/references/commands/project/new-workspace.md +2 -2
  127. package/.agent/skills/gsd/references/commands/project/remove-workspace.md +2 -2
  128. package/.agent/skills/gsd/references/commands/project/scan.md +2 -2
  129. package/.agent/skills/gsd/references/commands/system/autonomous.md +4 -3
  130. package/.agent/skills/gsd/references/commands/system/code-review-fix.md +3 -3
  131. package/.agent/skills/gsd/references/commands/system/code-review.md +3 -3
  132. package/.agent/skills/gsd/references/commands/system/debug.md +177 -100
  133. package/.agent/skills/gsd/references/commands/system/docs-update.md +2 -2
  134. package/.agent/skills/gsd/references/commands/system/fast.md +2 -2
  135. package/.agent/skills/gsd/references/commands/system/forensics.md +2 -2
  136. package/.agent/skills/gsd/references/commands/system/gsd-tools.md +153 -6
  137. package/.agent/skills/gsd/references/commands/system/health.md +2 -2
  138. package/.agent/skills/gsd/references/commands/system/manager.md +3 -3
  139. package/.agent/skills/gsd/references/commands/system/pause-work.md +2 -2
  140. package/.agent/skills/gsd/references/commands/system/pr-branch.md +2 -2
  141. package/.agent/skills/gsd/references/commands/system/profile-user.md +2 -2
  142. package/.agent/skills/gsd/references/commands/system/quick.md +127 -3
  143. package/.agent/skills/gsd/references/commands/system/reapply-patches.md +45 -6
  144. package/.agent/skills/gsd/references/commands/system/resume-work.md +2 -2
  145. package/.agent/skills/gsd/references/commands/system/review.md +6 -4
  146. package/.agent/skills/gsd/references/commands/system/set-profile.md +3 -3
  147. package/.agent/skills/gsd/references/commands/system/settings.md +2 -2
  148. package/.agent/skills/gsd/references/commands/system/update.md +2 -2
  149. package/.agent/skills/gsd/references/docs/ai-evals.md +156 -0
  150. package/.agent/skills/gsd/references/docs/ai-frameworks.md +186 -0
  151. package/.agent/skills/gsd/references/docs/artifact-types.md +18 -0
  152. package/.agent/skills/gsd/references/docs/autonomous-smart-discuss.md +277 -0
  153. package/.agent/skills/gsd/references/docs/checkpoints.md +30 -0
  154. package/.agent/skills/gsd/references/docs/common-bug-patterns.md +49 -49
  155. package/.agent/skills/gsd/references/docs/continuation-format.md +11 -7
  156. package/.agent/skills/gsd/references/docs/debugger-philosophy.md +76 -0
  157. package/.agent/skills/gsd/references/docs/decimal-phase-calculation.md +64 -64
  158. package/.agent/skills/gsd/references/docs/executor-examples.md +110 -0
  159. package/.agent/skills/gsd/references/docs/git-integration.md +4 -4
  160. package/.agent/skills/gsd/references/docs/git-planning-commit.md +40 -38
  161. package/.agent/skills/gsd/references/docs/ios-scaffold.md +123 -0
  162. package/.agent/skills/gsd/references/docs/mandatory-initial-read.md +2 -0
  163. package/.agent/skills/gsd/references/docs/phase-argument-parsing.md +61 -61
  164. package/.agent/skills/gsd/references/docs/planner-antipatterns.md +89 -0
  165. package/.agent/skills/gsd/references/docs/planner-revision.md +87 -87
  166. package/.agent/skills/gsd/references/docs/planner-source-audit.md +73 -0
  167. package/.agent/skills/gsd/references/docs/planning-config.md +33 -8
  168. package/.agent/skills/gsd/references/docs/project-skills-discovery.md +19 -0
  169. package/.agent/skills/gsd/references/docs/sketch-interactivity.md +41 -0
  170. package/.agent/skills/gsd/references/docs/sketch-theme-system.md +94 -0
  171. package/.agent/skills/gsd/references/docs/sketch-tooling.md +45 -0
  172. package/.agent/skills/gsd/references/docs/sketch-variant-patterns.md +81 -0
  173. package/.agent/skills/gsd/references/docs/tdd.md +67 -0
  174. package/.agent/skills/gsd/references/docs/universal-anti-patterns.md +5 -0
  175. package/.agent/skills/gsd/references/docs/workstream-flag.md +11 -11
  176. package/.agent/skills/gsd/references/mapping.md +1 -1
  177. package/.agent/skills/gsd/references/workflows/add-phase.md +112 -112
  178. package/.agent/skills/gsd/references/workflows/add-tests.md +6 -3
  179. package/.agent/skills/gsd/references/workflows/add-todo.md +5 -3
  180. package/.agent/skills/gsd/references/workflows/ai-integration-phase.md +284 -0
  181. package/.agent/skills/gsd/references/workflows/audit-fix.md +157 -157
  182. package/.agent/skills/gsd/references/workflows/audit-milestone.md +340 -340
  183. package/.agent/skills/gsd/references/workflows/audit-uat.md +109 -109
  184. package/.agent/skills/gsd/references/workflows/autonomous.md +20 -288
  185. package/.agent/skills/gsd/references/workflows/check-todos.md +4 -2
  186. package/.agent/skills/gsd/references/workflows/cleanup.md +3 -1
  187. package/.agent/skills/gsd/references/workflows/code-review-fix.md +497 -497
  188. package/.agent/skills/gsd/references/workflows/code-review.md +515 -515
  189. package/.agent/skills/gsd/references/workflows/complete-milestone.md +97 -24
  190. package/.agent/skills/gsd/references/workflows/diagnose-issues.md +238 -238
  191. package/.agent/skills/gsd/references/workflows/discovery-phase.md +2 -0
  192. package/.agent/skills/gsd/references/workflows/discuss-phase-assumptions.md +11 -11
  193. package/.agent/skills/gsd/references/workflows/discuss-phase.md +143 -19
  194. package/.agent/skills/gsd/references/workflows/do.md +8 -2
  195. package/.agent/skills/gsd/references/workflows/docs-update.md +5 -3
  196. package/.agent/skills/gsd/references/workflows/eval-review.md +155 -0
  197. package/.agent/skills/gsd/references/workflows/execute-phase.md +338 -54
  198. package/.agent/skills/gsd/references/workflows/execute-plan.md +80 -104
  199. package/.agent/skills/gsd/references/workflows/explore.md +3 -1
  200. package/.agent/skills/gsd/references/workflows/extract_learnings.md +232 -0
  201. package/.agent/skills/gsd/references/workflows/forensics.md +3 -3
  202. package/.agent/skills/gsd/references/workflows/health.md +2 -2
  203. package/.agent/skills/gsd/references/workflows/help.md +59 -1
  204. package/.agent/skills/gsd/references/workflows/import.md +3 -1
  205. package/.agent/skills/gsd/references/workflows/inbox.md +387 -384
  206. package/.agent/skills/gsd/references/workflows/insert-phase.md +130 -130
  207. package/.agent/skills/gsd/references/workflows/list-workspaces.md +56 -56
  208. package/.agent/skills/gsd/references/workflows/manager.md +5 -3
  209. package/.agent/skills/gsd/references/workflows/map-codebase.md +19 -5
  210. package/.agent/skills/gsd/references/workflows/milestone-summary.md +6 -6
  211. package/.agent/skills/gsd/references/workflows/new-milestone.md +63 -9
  212. package/.agent/skills/gsd/references/workflows/new-project.md +126 -22
  213. package/.agent/skills/gsd/references/workflows/new-workspace.md +6 -4
  214. package/.agent/skills/gsd/references/workflows/next.md +220 -153
  215. package/.agent/skills/gsd/references/workflows/note.md +2 -0
  216. package/.agent/skills/gsd/references/workflows/pause-work.md +11 -7
  217. package/.agent/skills/gsd/references/workflows/plan-milestone-gaps.md +273 -273
  218. package/.agent/skills/gsd/references/workflows/plan-phase.md +281 -62
  219. package/.agent/skills/gsd/references/workflows/plant-seed.md +4 -1
  220. package/.agent/skills/gsd/references/workflows/pr-branch.md +41 -13
  221. package/.agent/skills/gsd/references/workflows/profile-user.md +15 -13
  222. package/.agent/skills/gsd/references/workflows/progress.md +133 -21
  223. package/.agent/skills/gsd/references/workflows/quick.md +67 -27
  224. package/.agent/skills/gsd/references/workflows/remove-phase.md +155 -155
  225. package/.agent/skills/gsd/references/workflows/remove-workspace.md +4 -2
  226. package/.agent/skills/gsd/references/workflows/research-phase.md +3 -3
  227. package/.agent/skills/gsd/references/workflows/resume-project.md +3 -3
  228. package/.agent/skills/gsd/references/workflows/review.md +71 -8
  229. package/.agent/skills/gsd/references/workflows/scan.md +102 -102
  230. package/.agent/skills/gsd/references/workflows/secure-phase.md +7 -5
  231. package/.agent/skills/gsd/references/workflows/settings.md +24 -7
  232. package/.agent/skills/gsd/references/workflows/ship.md +71 -6
  233. package/.agent/skills/gsd/references/workflows/sketch-wrap-up.md +283 -0
  234. package/.agent/skills/gsd/references/workflows/sketch.md +263 -0
  235. package/.agent/skills/gsd/references/workflows/spec-phase.md +262 -0
  236. package/.agent/skills/gsd/references/workflows/spike-wrap-up.md +273 -0
  237. package/.agent/skills/gsd/references/workflows/spike.md +270 -0
  238. package/.agent/skills/gsd/references/workflows/stats.md +60 -60
  239. package/.agent/skills/gsd/references/workflows/transition.md +671 -671
  240. package/.agent/skills/gsd/references/workflows/ui-phase.md +33 -12
  241. package/.agent/skills/gsd/references/workflows/ui-review.md +6 -4
  242. package/.agent/skills/gsd/references/workflows/undo.md +3 -1
  243. package/.agent/skills/gsd/references/workflows/update.md +113 -2
  244. package/.agent/skills/gsd/references/workflows/validate-phase.md +7 -5
  245. package/.agent/skills/gsd/references/workflows/verify-phase.md +93 -10
  246. package/.agent/skills/gsd/references/workflows/verify-work.md +50 -10
  247. package/.agent/skills/gsd-converter/references/mapping.md +1 -1
  248. package/.agent/skills/gsd-converter/scripts/convert.py +36 -17
  249. package/.agent/skills/gsd-converter/scripts/regression_test.py +68 -33
  250. package/README.md +3 -2
  251. package/package.json +1 -1
@@ -57,6 +57,8 @@ Parse `$ARGUMENTS` before loading any context:
57
57
  - First positional token → `PHASE_ARG`
58
58
  - Optional `--wave N` → `WAVE_FILTER`
59
59
  - Optional `--gaps-only` keeps its current meaning
60
+ - Optional `--cross-ai` → `CROSS_AI_FORCE=true` (force all plans through cross-AI execution)
61
+ - Optional `--no-cross-ai` → `CROSS_AI_DISABLED=true` (disable cross-AI for this run, overrides config and frontmatter)
60
62
 
61
63
  If `--wave` is absent, preserve the current behavior of executing all incomplete waves in the phase.
62
64
  </step>
@@ -65,9 +67,9 @@ If `--wave` is absent, preserve the current behavior of executing all incomplete
65
67
  Load all context in one call:
66
68
 
67
69
  ```bash
68
- .agent/skills/gsd/bin/gsd-tools.cjs" init execute-phase "${PHASE_ARG}")
70
+ INIT=$(gsd-sdk query init.execute-phase "${PHASE_ARG}")
69
71
  if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi
70
- .agent/skills/gsd/bin/gsd-tools.cjs" agent-skills gsd-executor 2>/dev/null)
72
+ AGENT_SKILLS=$(gsd-sdk query agent-skills gsd-executor 2>/dev/null)
71
73
  ```
72
74
 
73
75
  Parse JSON for: `executor_model`, `verifier_model`, `commit_docs`, `parallelization`, `branching_strategy`, `branch_name`, `phase_found`, `phase_dir`, `phase_number`, `phase_name`, `phase_slug`, `plans`, `incomplete_plans`, `plan_count`, `incomplete_count`, `state_exists`, `roadmap_exists`, `phase_req_ids`, `response_language`.
@@ -77,7 +79,16 @@ Parse JSON for: `executor_model`, `verifier_model`, `commit_docs`, `parallelizat
77
79
  Read worktree config:
78
80
 
79
81
  ```bash
80
- .agent/skills/gsd/bin/gsd-tools.cjs" config-get workflow.use_worktrees 2>/dev/null || echo "true")
82
+ USE_WORKTREES=$(gsd-sdk query config-get workflow.use_worktrees 2>/dev/null || echo "true")
83
+ ```
84
+
85
+ If the project uses git submodules, worktree isolation is skipped regardless of the `workflow.use_worktrees` config — the executor commit protocol cannot correctly handle submodule commits inside isolated worktrees. Sequential execution handles submodules transparently.
86
+
87
+ ```bash
88
+ if [ -f .gitmodules ]; then
89
+ echo "[worktree] Submodule project detected (.gitmodules exists) — falling back to sequential execution"
90
+ USE_WORKTREES=false
91
+ fi
81
92
  ```
82
93
 
83
94
  When `USE_WORKTREES` is `false`, all executor agents run without `isolation="worktree"` — they execute sequentially on the main working tree instead of in parallel worktrees.
@@ -85,7 +96,7 @@ When `USE_WORKTREES` is `false`, all executor agents run without `isolation="wor
85
96
  Read context window size for adaptive prompt enrichment:
86
97
 
87
98
  ```bash
88
- .agent/skills/gsd/bin/gsd-tools.cjs" config-get context_window 2>/dev/null || echo "200000")
99
+ CONTEXT_WINDOW=$(gsd-sdk query config-get context_window 2>/dev/null || echo "200000")
89
100
  ```
90
101
 
91
102
  When `CONTEXT_WINDOW >= 500000` (1M-class models), subagent prompts include richer context:
@@ -93,6 +104,12 @@ When `CONTEXT_WINDOW >= 500000` (1M-class models), subagent prompts include rich
93
104
  - Verifier agents receive all PLAN.md, SUMMARY.md, CONTEXT.md files plus REQUIREMENTS.md
94
105
  - This enables cross-phase awareness and history-aware verification
95
106
 
107
+ When `CONTEXT_WINDOW < 200000` (sub-200K models), subagent prompts are thinned to reduce static overhead:
108
+ - Executor agents omit extended deviation rule examples and checkpoint examples from inline prompt — load on-demand via @references/docs/executor-examples.md
109
+ - Planner agents omit extended anti-pattern lists and specificity examples from inline prompt — load on-demand via @references/docs/planner-antipatterns.md
110
+ - Core rules and decision logic remain inline; only verbose examples and edge-case lists are extracted
111
+ - This reduces executor static overhead by ~40% while preserving behavioral correctness
112
+
96
113
  **If `phase_found` is false:** Error — phase directory not found.
97
114
  **If `plan_count` is 0:** Error — no plans found in phase.
98
115
  **If `state_exists` is false but `.planning/` exists:** Offer reconstruct or continue.
@@ -111,7 +128,7 @@ inline path for each plan.
111
128
  ```bash
112
129
  # REQUIRED: prevents stale auto-chain from previous --auto runs
113
130
  if [[ ! "$ARGUMENTS" =~ --auto ]]; then
114
- .agent/skills/gsd/bin/gsd-tools.cjs" config-set workflow._auto_chain_active false 2>/dev/null
131
+ gsd-sdk query config-set workflow._auto_chain_active false 2>/dev/null
115
132
  fi
116
133
  ```
117
134
  </step>
@@ -208,7 +225,7 @@ Report: "Found {plan_count} plans in {phase_dir} ({incomplete_count} incomplete)
208
225
 
209
226
  **Update STATE.md for phase start:**
210
227
  ```bash
211
- .agent/skills/gsd/bin/gsd-tools.cjs" state begin-phase --phase "${PHASE_NUMBER}" --name "${PHASE_NAME}" --plans "${PLAN_COUNT}"
228
+ gsd-sdk query state.begin-phase --phase "${PHASE_NUMBER}" --name "${PHASE_NAME}" --plans "${PLAN_COUNT}"
212
229
  ```
213
230
  This updates Status, Last Activity, Current focus, Current Position, and plan counts in STATE.md so frontmatter and body text reflect the active phase immediately.
214
231
  </step>
@@ -217,7 +234,7 @@ This updates Status, Last Activity, Current focus, Current Position, and plan co
217
234
  Load plan inventory with wave grouping in one call:
218
235
 
219
236
  ```bash
220
- .agent/skills/gsd/bin/gsd-tools.cjs" phase-plan-index "${PHASE_NUMBER}")
237
+ PLAN_INDEX=$(gsd-sdk query phase-plan-index "${PHASE_NUMBER}")
221
238
  ```
222
239
 
223
240
  Parse JSON for: `phase`, `plans[]` (each with `id`, `wave`, `autonomous`, `objective`, `files_modified`, `task_count`, `has_summary`), `waves` (map of wave number → plan IDs), `incomplete`, `has_checkpoints`.
@@ -243,6 +260,77 @@ Report:
243
260
  ```
244
261
  </step>
245
262
 
263
+ <step name="cross_ai_delegation">
264
+ **Optional step 2.5 — Delegate plans to an external AI runtime.**
265
+
266
+ This step runs after plan discovery and before normal wave execution. It identifies plans
267
+ that should be delegated to an external AI command and executes them via stdin-based prompt
268
+ delivery. Plans handled here are removed from the execute_waves plan list so the normal
269
+ executor skips them.
270
+
271
+ **Activation logic:**
272
+
273
+ 1. If `CROSS_AI_DISABLED` is true (`--no-cross-ai` flag): skip this step entirely.
274
+ 2. If `CROSS_AI_FORCE` is true (`--cross-ai` flag): mark ALL incomplete plans for cross-AI execution.
275
+ 3. Otherwise: check each plan's frontmatter for `cross_ai: true` AND verify config
276
+ `workflow.cross_ai_execution` is `true`. Plans matching both conditions are marked for cross-AI.
277
+
278
+ ```bash
279
+ CROSS_AI_ENABLED=$(gsd-sdk query config-get workflow.cross_ai_execution 2>/dev/null || echo "false")
280
+ CROSS_AI_CMD=$(gsd-sdk query config-get workflow.cross_ai_command 2>/dev/null || echo "")
281
+ CROSS_AI_TIMEOUT=$(gsd-sdk query config-get workflow.cross_ai_timeout 2>/dev/null || echo "300")
282
+ ```
283
+
284
+ **If no plans are marked for cross-AI:** Skip to execute_waves.
285
+
286
+ **If plans are marked but `cross_ai_command` is empty:** Error — tell user to set
287
+ `workflow.cross_ai_command` via `gsd-sdk query config-set workflow.cross_ai_command "<command>"`.
288
+
289
+ **For each cross-AI plan (sequentially):**
290
+
291
+ 1. **Construct the task prompt** from the plan file:
292
+ - Extract `<objective>` and `<tasks>` sections from the PLAN.md
293
+ - Append PROJECT.md context (project name, description, tech stack)
294
+ - Format as a self-contained execution prompt
295
+
296
+ 2. **Check for dirty working tree before execution:**
297
+ ```bash
298
+ if ! git diff --quiet HEAD 2>/dev/null; then
299
+ echo "WARNING: dirty working tree detected — the external AI command may produce uncommitted changes that conflict with existing modifications"
300
+ fi
301
+ ```
302
+
303
+ 3. **Run the external command** from the project root, writing the prompt to stdin.
304
+ Never shell-interpolate the prompt — always pipe via stdin to prevent injection:
305
+ ```bash
306
+ echo "$TASK_PROMPT" | timeout "${CROSS_AI_TIMEOUT}s" ${CROSS_AI_CMD} > "$CANDIDATE_SUMMARY" 2>"$ERROR_LOG"
307
+ EXIT_CODE=$?
308
+ ```
309
+
310
+ 4. **Evaluate the result:**
311
+
312
+ **Success (exit 0 + valid summary):**
313
+ - Read `$CANDIDATE_SUMMARY` and validate it contains meaningful content
314
+ (not empty, has at least a heading and description — a valid SUMMARY.md structure)
315
+ - Write it as the plan's SUMMARY.md file
316
+ - Update STATE.md plan status to complete
317
+ - Update ROADMAP.md progress
318
+ - Mark plan as handled — skip it in execute_waves
319
+
320
+ **Failure (non-zero exit or invalid summary):**
321
+ - Display the error output and exit code
322
+ - Warn: "The external command may have left uncommitted changes or partial edits
323
+ in the working tree. Review `git status` and `git diff` before proceeding."
324
+ - Offer three choices:
325
+ - **retry** — run the same plan through cross-AI again
326
+ - **skip** — fall back to normal executor for this plan (re-add to execute_waves list)
327
+ - **abort** — stop execution entirely, preserve state for resume
328
+
329
+ 5. **After all cross-AI plans processed:** Remove successfully handled plans from the
330
+ incomplete plan list so execute_waves skips them. Any skipped-to-fallback plans remain
331
+ in the list for normal executor processing.
332
+ </step>
333
+
246
334
  <step name="execute_waves">
247
335
  Execute each selected wave in sequence. Within a wave: parallel if `PARALLELIZATION=true`, sequential if `false`.
248
336
 
@@ -348,29 +436,46 @@ Execute each selected wave in sequence. Within a wave: parallel if `PARALLELIZAT
348
436
  Run:
349
437
  ```bash
350
438
  ACTUAL_BASE=$(git merge-base HEAD {EXPECTED_BASE})
351
- CURRENT_HEAD=$(git rev-parse HEAD)
352
439
  ```
353
440
 
354
441
  If `ACTUAL_BASE` != `{EXPECTED_BASE}` (i.e. the worktree branch was created from an older
355
- base such as `main` instead of the feature branch HEAD), rebase onto the correct base:
442
+ base such as `main` instead of the feature branch HEAD), hard-reset to the correct base:
356
443
  ```bash
357
- git rebase --onto {EXPECTED_BASE} $(git rev-parse --abbrev-ref HEAD~1 2>/dev/null || git rev-parse HEAD^) HEAD 2>/dev/null || true
358
- # If rebase fails or is a no-op, reset the branch to start from the correct base:
359
- git reset --soft {EXPECTED_BASE}
444
+ # Safe: this runs before any agent work, so no uncommitted changes to lose
445
+ git reset --hard {EXPECTED_BASE}
446
+ # Verify correction succeeded
447
+ if [ "$(git rev-parse HEAD)" != "{EXPECTED_BASE}" ]; then
448
+ echo "ERROR: Could not correct worktree base — aborting to prevent data loss"
449
+ exit 1
450
+ fi
360
451
  ```
361
452
 
453
+ `reset --hard` is safe here because this is a fresh worktree with no user changes. It
454
+ resets both the HEAD pointer AND the working tree to the correct base commit (#2015).
455
+
362
456
  If `ACTUAL_BASE` == `{EXPECTED_BASE}`: the branch base is correct, proceed immediately.
363
457
 
364
- This check fixes a known issue on Windows where `EnterWorktree` creates branches from
365
- `main` instead of the current feature branch HEAD.
458
+ This check fixes a known issue where `EnterWorktree` creates branches from
459
+ `main` instead of the current feature branch HEAD (affects all platforms).
366
460
  </worktree_branch_check>
367
461
 
368
462
  <parallel_execution>
369
- You are running as a PARALLEL executor agent. Use --no-verify on all git
370
- commits to avoid pre-commit hook contention with other agents. The
371
- orchestrator validates hooks once after all agents complete.
372
- For gsd-tools commits: add --no-verify flag.
463
+ You are running as a PARALLEL executor agent in a git worktree.
464
+ Use --no-verify on all git commits to avoid pre-commit hook contention
465
+ with other agents. The orchestrator validates hooks once after all agents complete.
466
+ For `gsd-sdk query commit` (or legacy `gsd-tools.cjs` commit): add --no-verify flag when needed.
373
467
  For direct git commits: use git commit --no-verify -m "..."
468
+
469
+ IMPORTANT: Do NOT modify STATE.md or ROADMAP.md. execute-plan.md
470
+ auto-detects worktree mode (`.git` is a file, not a directory) and skips
471
+ shared file updates automatically. The orchestrator updates them centrally
472
+ after merge.
473
+
474
+ REQUIRED: SUMMARY.md MUST be committed before you return. In worktree mode the
475
+ git_commit_metadata step in execute-plan.md commits SUMMARY.md and REQUIREMENTS.md
476
+ only (STATE.md and ROADMAP.md are excluded automatically). Do NOT skip or defer
477
+ this commit — the orchestrator force-removes the worktree after you return, and
478
+ any uncommitted SUMMARY.md will be permanently lost (#2070).
374
479
  </parallel_execution>
375
480
 
376
481
  <execution_context>
@@ -378,6 +483,7 @@ Execute each selected wave in sequence. Within a wave: parallel if `PARALLELIZAT
378
483
  @assets/templates/summary.md
379
484
  @references/docs/checkpoints.md
380
485
  @references/docs/tdd.md
486
+ ${CONTEXT_WINDOW < 200000 ? '' : '@references/docs/executor-examples.md'}
381
487
  </execution_context>
382
488
 
383
489
  <files_to_read>
@@ -408,6 +514,7 @@ Execute each selected wave in sequence. Within a wave: parallel if `PARALLELIZAT
408
514
  - [ ] All tasks executed
409
515
  - [ ] Each task committed individually
410
516
  - [ ] SUMMARY.md created in plan directory
517
+ - [ ] No modifications to shared orchestrator artifacts (the orchestrator handles all post-wave shared-file writes)
411
518
  </success_criteria>
412
519
  "
413
520
  )
@@ -492,17 +599,28 @@ Execute each selected wave in sequence. Within a wave: parallel if `PARALLELIZAT
492
599
  # and ROADMAP.md are stale. Main always wins for these files.
493
600
  STATE_BACKUP=$(mktemp)
494
601
  ROADMAP_BACKUP=$(mktemp)
495
- git show HEAD:.planning/STATE.md > "$STATE_BACKUP" 2>/dev/null || true
496
- git show HEAD:.planning/ROADMAP.md > "$ROADMAP_BACKUP" 2>/dev/null || true
602
+ [ -f .planning/STATE.md ] && cp .planning/STATE.md "$STATE_BACKUP" || true
603
+ [ -f .planning/ROADMAP.md ] && cp .planning/ROADMAP.md "$ROADMAP_BACKUP" || true
497
604
 
498
605
  # Snapshot list of files on main BEFORE merge to detect resurrections
499
606
  PRE_MERGE_FILES=$(git ls-files .planning/)
500
607
 
501
- # Merge the worktree branch into the current branch
502
- git merge "$WT_BRANCH" --no-edit -m "chore: merge executor worktree ($WT_BRANCH)" 2>&1 || {
503
- echo "⚠ Merge conflict from worktree $WT_BRANCH resolve manually"
608
+ # Pre-merge deletion check: warn if the worktree branch deletes tracked files
609
+ DELETIONS=$(git diff --diff-filter=D --name-only HEAD..."$WT_BRANCH" 2>/dev/null || true)
610
+ if [ -n "$DELETIONS" ]; then
611
+ echo "BLOCKED: Worktree branch $WT_BRANCH contains file deletions: $DELETIONS"
612
+ echo "Review these deletions before merging. If intentional, remove this guard and re-run."
504
613
  rm -f "$STATE_BACKUP" "$ROADMAP_BACKUP"
505
614
  continue
615
+ fi
616
+
617
+ # Merge the worktree branch into the current branch (--no-ff ensures a merge commit so HEAD~1 is reliable)
618
+ git merge "$WT_BRANCH" --no-ff --no-edit -m "chore: merge executor worktree ($WT_BRANCH)" 2>&1 || {
619
+ echo "⚠ Merge conflict from worktree $WT_BRANCH — resolve manually"
620
+ echo " STATE.md backup: $STATE_BACKUP"
621
+ echo " ROADMAP.md backup: $ROADMAP_BACKUP"
622
+ echo " Restore with: cp \$STATE_BACKUP .planning/STATE.md && cp \$ROADMAP_BACKUP .planning/ROADMAP.md"
623
+ break
506
624
  }
507
625
 
508
626
  # Restore orchestrator-owned files (main always wins)
@@ -528,13 +646,24 @@ Execute each selected wave in sequence. Within a wave: parallel if `PARALLELIZAT
528
646
  if ! git diff --quiet .planning/STATE.md .planning/ROADMAP.md 2>/dev/null || \
529
647
  [ -n "$DELETED_FILES" ]; then
530
648
  # Only amend the commit with .planning/ files if commit_docs is enabled (#1783)
531
- .agent/skills/gsd/bin/gsd-tools.cjs" config-get commit_docs 2>/dev/null || echo "true")
649
+ COMMIT_DOCS=$(gsd-sdk query config-get commit_docs 2>/dev/null || echo "true")
532
650
  if [ "$COMMIT_DOCS" != "false" ]; then
533
651
  git add .planning/STATE.md .planning/ROADMAP.md 2>/dev/null || true
534
652
  git commit --amend --no-edit 2>/dev/null || true
535
653
  fi
536
654
  fi
537
655
 
656
+ # Safety net: commit any uncommitted SUMMARY.md before force-removing the worktree.
657
+ # This guards against executors that skipped the git_commit_metadata step (#2070).
658
+ UNCOMMITTED_SUMMARY=$(git -C "$WT" ls-files --modified --others --exclude-standard -- "*SUMMARY.md" 2>/dev/null || true)
659
+ if [ -n "$UNCOMMITTED_SUMMARY" ]; then
660
+ echo "⚠ SUMMARY.md was not committed by executor — committing now to prevent data loss"
661
+ git -C "$WT" add -- "*SUMMARY.md" 2>/dev/null || true
662
+ git -C "$WT" commit --no-verify -m "docs(recovery): rescue uncommitted SUMMARY.md before worktree removal (#2070)" 2>/dev/null || true
663
+ # Re-merge the recovery commit
664
+ git merge "$WT_BRANCH" --no-edit -m "chore: merge rescued SUMMARY.md from executor worktree ($WT_BRANCH)" 2>/dev/null || true
665
+ fi
666
+
538
667
  # Remove the worktree
539
668
  git worktree remove "$WT" --force 2>/dev/null || true
540
669
 
@@ -548,22 +677,113 @@ Execute each selected wave in sequence. Within a wave: parallel if `PARALLELIZAT
548
677
 
549
678
  **If no worktrees found:** Skip silently — agents may have been spawned without worktree isolation.
550
679
 
551
- 5.6. **Post-wave shared artifact update (worktree mode only):**
680
+ 5.6. **Post-merge test gate (parallel mode only):**
681
+
682
+ After merging all worktrees in a wave, run the project's test suite to catch
683
+ cross-plan integration issues that individual worktree self-checks cannot detect
684
+ (e.g., conflicting type definitions, removed exports, import changes).
552
685
 
553
- When executor agents ran with `isolation="worktree"`, they skipped STATE.md and ROADMAP.md updates to avoid last-merge-wins overwrites. The orchestrator is the single writer for these files. After worktrees are merged back, update shared artifacts once:
686
+ This addresses the Generator self-evaluation blind spot identified in Anthropic's
687
+ harness engineering research: agents reliably report Self-Check: PASSED even when
688
+ merging their work creates failures.
554
689
 
555
690
  ```bash
556
- # Update ROADMAP.md for each completed plan in this wave
557
- for PLAN_ID in ${WAVE_PLAN_IDS}; do
558
- .agent/skills/gsd/bin/gsd-tools.cjs" roadmap update-plan-progress "${PHASE_NUMBER}" "${PLAN_ID}" completed
559
- done
691
+ # Detect test runner and run quick smoke test (timeout: 5 minutes)
692
+ TEST_EXIT=0
693
+ timeout 300 bash -c '
694
+ if [ -f "package.json" ]; then
695
+ npm test 2>&1
696
+ elif [ -f "Cargo.toml" ]; then
697
+ cargo test 2>&1
698
+ elif [ -f "go.mod" ]; then
699
+ go test ./... 2>&1
700
+ elif [ -f "pyproject.toml" ] || [ -f "requirements.txt" ]; then
701
+ python -m pytest -x -q --tb=short 2>&1 || uv run python -m pytest -x -q --tb=short 2>&1
702
+ else
703
+ echo "⚠ No test runner detected — skipping post-merge test gate"
704
+ exit 0
705
+ fi
706
+ '
707
+ TEST_EXIT=$?
708
+ if [ "${TEST_EXIT}" -eq 0 ]; then
709
+ echo "✓ Post-merge test gate passed — no cross-plan conflicts"
710
+ elif [ "${TEST_EXIT}" -eq 124 ]; then
711
+ echo "⚠ Post-merge test gate timed out after 5 minutes"
712
+ else
713
+ echo "✗ Post-merge test gate failed (exit code ${TEST_EXIT})"
714
+ WAVE_FAILURE_COUNT=$((WAVE_FAILURE_COUNT + 1))
715
+ fi
716
+ ```
717
+
718
+ **If `TEST_EXIT` is 0 (pass):** `✓ Post-merge test gate: {N} tests passed — no cross-plan conflicts` → continue to orchestrator tracking update.
719
+
720
+ **If `TEST_EXIT` is 124 (timeout):** Log warning, treat as non-blocking, continue. Tests may need a longer budget or manual run.
721
+
722
+ **If `TEST_EXIT` is non-zero (test failure):** Increment `WAVE_FAILURE_COUNT` to track
723
+ cumulative failures across waves. Subsequent waves should report:
724
+ `⚠ Note: ${WAVE_FAILURE_COUNT} prior wave(s) had test failures`
725
+
726
+ 5.7. **Post-wave shared artifact update (worktree mode only, skip if tests failed):**
727
+
728
+ When executor agents ran with `isolation="worktree"`, they skipped STATE.md and ROADMAP.md updates to avoid last-merge-wins overwrites. The orchestrator is the single writer for these files. After worktrees are merged back, update shared artifacts once.
729
+
730
+ **Only update tracking when tests passed (TEST_EXIT=0).**
731
+ If tests failed or timed out, skip the tracking update — plans should
732
+ not be marked as complete when integration tests are failing or inconclusive.
560
733
 
734
+ ```bash
735
+ # Guard: only update tracking if post-merge tests passed
736
+ # Timeout (124) is treated as inconclusive — do NOT mark plans complete
737
+ if [ "${TEST_EXIT}" -eq 0 ]; then
738
+ # Update ROADMAP plan progress for each completed plan in this wave
739
+ for plan_id in {completed_plan_ids}; do
740
+ gsd-sdk query roadmap.update-plan-progress "${PHASE_NUMBER}" "${plan_id}" "complete"
741
+ done
742
+
743
+ # Only commit tracking files if they actually changed
744
+ if ! git diff --quiet .planning/ROADMAP.md .planning/STATE.md 2>/dev/null; then
745
+ gsd-sdk query commit "docs(phase-${PHASE_NUMBER}): update tracking after wave ${N}" .planning/ROADMAP.md .planning/STATE.md
746
+ fi
747
+ elif [ "${TEST_EXIT}" -eq 124 ]; then
748
+ echo "⚠ Skipping tracking update — test suite timed out. Plans remain in-progress. Run tests manually to confirm."
749
+ else
750
+ echo "⚠ Skipping tracking update — post-merge tests failed (exit ${TEST_EXIT}). Plans remain in-progress until tests pass."
751
+ fi
561
752
  ```
562
753
 
563
754
  Where `WAVE_PLAN_IDS` is the space-separated list of plan IDs that completed in this wave.
564
755
 
565
756
  **If `workflow.use_worktrees` is `false`:** Sequential agents already updated STATE.md and ROADMAP.md themselves — skip this step.
566
757
 
758
+ 5.8. **Handle test gate failures (when `WAVE_FAILURE_COUNT > 0`):**
759
+
760
+ ```
761
+ ## ⚠ Post-Merge Test Failure (cumulative failures: ${WAVE_FAILURE_COUNT})
762
+
763
+ Wave {N} worktrees merged successfully, but {M} tests fail after merge.
764
+ This typically indicates conflicting changes across parallel plans
765
+ (e.g., type definitions, shared imports, API contracts).
766
+
767
+ Failed tests:
768
+ {first 10 lines of failure output}
769
+
770
+ Options:
771
+ 1. Fix now (recommended) — resolve conflicts before next wave
772
+ 2. Continue — failures may compound in subsequent waves
773
+ ```
774
+
775
+ Note: If `WAVE_FAILURE_COUNT > 1`, strongly recommend "Fix now" — compounding
776
+ failures across multiple waves become exponentially harder to diagnose.
777
+
778
+ If "Fix now": diagnose failures (typically import conflicts, missing types,
779
+ or changed function signatures from parallel plans modifying the same module).
780
+ Fix, commit as `fix: resolve post-merge conflicts from wave {N}`, re-run tests.
781
+
782
+ **Why this matters:** Worktree isolation means each agent's Self-Check passes
783
+ in isolation. But when merged, add/add conflicts in shared files (models, registries,
784
+ CLI entry points) can silently drop code. The post-merge gate catches this before
785
+ the next wave builds on a broken foundation.
786
+
567
787
  6. **Report completion — spot-check claims first:**
568
788
 
569
789
  For each SUMMARY.md:
@@ -599,7 +819,7 @@ Execute each selected wave in sequence. Within a wave: parallel if `PARALLELIZAT
599
819
 
600
820
  Before spawning wave N+1, for each plan in the upcoming wave:
601
821
  ```bash
602
- .agent/skills/gsd/bin/gsd-tools.cjs" verify key-links {phase_dir}/{plan}-PLAN.md
822
+ gsd-sdk query verify.key-links {phase_dir}/{plan}-PLAN.md
603
823
  ```
604
824
 
605
825
  If any key-link from a PRIOR wave's artifact fails verification:
@@ -628,8 +848,8 @@ Plans with `autonomous: false` require user interaction.
628
848
 
629
849
  Read auto-advance config (chain flag + user preference):
630
850
  ```bash
631
- .agent/skills/gsd/bin/gsd-tools.cjs" config-get workflow._auto_chain_active 2>/dev/null || echo "false")
632
- .agent/skills/gsd/bin/gsd-tools.cjs" config-get workflow.auto_advance 2>/dev/null || echo "false")
851
+ AUTO_CHAIN=$(gsd-sdk query config-get workflow._auto_chain_active 2>/dev/null || echo "false")
852
+ AUTO_CFG=$(gsd-sdk query config-get workflow.auto_advance 2>/dev/null || echo "false")
633
853
  ```
634
854
 
635
855
  When executor returns a checkpoint AND (`AUTO_CHAIN` is `"true"` OR `AUTO_CFG` is `"true"`):
@@ -690,7 +910,7 @@ After all waves:
690
910
 
691
911
  **Security gate check:**
692
912
  ```bash
693
- .agent/skills/gsd/bin/gsd-tools.cjs" config-get workflow.security_enforcement --raw 2>/dev/null || echo "true")
913
+ SECURITY_CFG=$(gsd-sdk query config-get workflow.security_enforcement --raw 2>/dev/null || echo "true")
694
914
  SECURITY_FILE=$(ls "${PHASE_DIR}"/*-SECURITY.md 2>/dev/null | head -1)
695
915
  ```
696
916
 
@@ -710,11 +930,55 @@ If `SECURITY_CFG` is `true` AND SECURITY.md exists: check frontmatter `threats_o
710
930
  ```
711
931
  </step>
712
932
 
933
+ <step name="tdd_review_checkpoint">
934
+ **Optional step — TDD collaborative review.**
935
+
936
+ ```bash
937
+ TDD_MODE=$(gsd-sdk query config-get workflow.tdd_mode 2>/dev/null || echo "false")
938
+ ```
939
+
940
+ **Skip if `TDD_MODE` is `false`.**
941
+
942
+ When `TDD_MODE` is `true`, check whether any completed plans in this phase have `type: tdd` in their frontmatter:
943
+
944
+ ```bash
945
+ TDD_PLANS=$(grep -rl "^type: tdd" "${PHASE_DIR}"/*-PLAN.md 2>/dev/null | wc -l | tr -d ' ')
946
+ ```
947
+
948
+ **If `TDD_PLANS` > 0:** Insert end-of-phase collaborative review checkpoint.
949
+
950
+ 1. Collect all SUMMARY.md files for TDD plans
951
+ 2. For each TDD plan summary, verify the RED/GREEN/REFACTOR gate sequence:
952
+ - RED gate: A failing test commit exists (`test(...)` commit with MUST-fail evidence)
953
+ - GREEN gate: An implementation commit exists (`feat(...)` commit making tests pass)
954
+ - REFACTOR gate: Optional cleanup commit (`refactor(...)` commit, tests still pass)
955
+ 3. If any TDD plan is missing the RED or GREEN gate commits, flag it:
956
+ ```
957
+ ⚠ TDD gate violation: Plan {plan_id} missing {RED|GREEN} phase commit.
958
+ Expected commit pattern: test({phase}-{plan}): ... → feat({phase}-{plan}): ...
959
+ ```
960
+ 4. Present collaborative review summary:
961
+ ```
962
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
963
+ TDD REVIEW — Phase {X}
964
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
965
+
966
+ TDD Plans: {TDD_PLANS} | Gate violations: {count}
967
+
968
+ | Plan | RED | GREEN | REFACTOR | Status |
969
+ |------|-----|-------|----------|--------|
970
+ | {id} | ✓ | ✓ | ✓ | Pass |
971
+ | {id} | ✓ | ✗ | — | FAIL |
972
+ ```
973
+
974
+ **Gate violations are advisory** — they do not block execution but are surfaced to the user for review. The verifier agent (step `verify_phase_goal`) will also check TDD discipline as part of its quality assessment.
975
+ </step>
976
+
713
977
  <step name="handle_partial_wave_execution">
714
978
  If `WAVE_FILTER` was used, re-run plan discovery after execution:
715
979
 
716
980
  ```bash
717
- .agent/skills/gsd/bin/gsd-tools.cjs" phase-plan-index "${PHASE_NUMBER}")
981
+ POST_PLAN_INDEX=$(gsd-sdk query phase-plan-index "${PHASE_NUMBER}")
718
982
  ```
719
983
 
720
984
  Apply the same "incomplete" filtering rules as earlier:
@@ -746,7 +1010,7 @@ Selected wave finished successfully. This phase still has incomplete plans, so p
746
1010
 
747
1011
  **Config gate:**
748
1012
  ```bash
749
- .agent/skills/gsd/bin/gsd-tools.cjs" config-get workflow.code_review 2>/dev/null || echo "true")
1013
+ CODE_REVIEW_ENABLED=$(gsd-sdk query config-get workflow.code_review 2>/dev/null || echo "true")
750
1014
  ```
751
1015
 
752
1016
  If `CODE_REVIEW_ENABLED` is `"false"`: display "Code review skipped (workflow.code_review=false)" and proceed to next step.
@@ -789,7 +1053,7 @@ fi
789
1053
 
790
1054
  **2. Find parent UAT file:**
791
1055
  ```bash
792
- .agent/skills/gsd/bin/gsd-tools.cjs" find-phase "${PARENT_PHASE}" --raw)
1056
+ PARENT_INFO=$(gsd-sdk query find-phase "${PARENT_PHASE}" --raw)
793
1057
  # Extract directory from PARENT_INFO JSON, then find UAT file in that directory
794
1058
  ```
795
1059
 
@@ -820,7 +1084,7 @@ mv .planning/debug/{slug}.md .planning/debug/resolved/
820
1084
 
821
1085
  **6. Commit updated artifacts:**
822
1086
  ```bash
823
- .agent/skills/gsd/bin/gsd-tools.cjs" commit "docs(phase-${PARENT_PHASE}): resolve UAT gaps and debug sessions after ${PHASE_NUMBER} gap closure" --files .planning/phases/*${PARENT_PHASE}*/*-UAT.md .planning/debug/resolved/*.md
1087
+ gsd-sdk query commit "docs(phase-${PARENT_PHASE}): resolve UAT gaps and debug sessions after ${PHASE_NUMBER} gap closure" .planning/phases/*${PARENT_PHASE}*/*-UAT.md .planning/debug/resolved/*.md
824
1088
  ```
825
1089
  </step>
826
1090
 
@@ -849,10 +1113,11 @@ Collect all unique test file paths into `REGRESSION_FILES`.
849
1113
  ```bash
850
1114
  # Detect test runner and run prior phase tests
851
1115
  if [ -f "package.json" ]; then
852
- # Node.js — use project's test runner
853
- npx jest ${REGRESSION_FILES} --passWithNoTests --no-coverage -q 2>&1 || npx vitest run ${REGRESSION_FILES} 2>&1
1116
+ npm test 2>&1
854
1117
  elif [ -f "Cargo.toml" ]; then
855
1118
  cargo test 2>&1
1119
+ elif [ -f "go.mod" ]; then
1120
+ go test ./... 2>&1
856
1121
  elif [ -f "requirements.txt" ] || [ -f "pyproject.toml" ]; then
857
1122
  python -m pytest ${REGRESSION_FILES} -q --tb=short 2>&1
858
1123
  fi
@@ -892,7 +1157,7 @@ build/types pass because TypeScript types come from config, not the live databas
892
1157
  **Run after execution completes but BEFORE verification marks success.**
893
1158
 
894
1159
  ```bash
895
- .agent/skills/gsd/bin/gsd-tools.cjs" verify schema-drift "${PHASE_NUMBER}" 2>/dev/null)
1160
+ SCHEMA_DRIFT=$(gsd-sdk query verify.schema-drift "${PHASE_NUMBER}" 2>/dev/null)
896
1161
  ```
897
1162
 
898
1163
  Parse JSON result for: `drift_detected`, `blocking`, `schema_files`, `orms`, `unpushed_orms`, `message`.
@@ -955,7 +1220,7 @@ If `TEXT_MODE` is true, present as a plain-text numbered list. Otherwise use Ask
955
1220
  Verify phase achieved its GOAL, not just completed tasks.
956
1221
 
957
1222
  ```bash
958
- .agent/skills/gsd/bin/gsd-tools.cjs" agent-skills gsd-verifier 2>/dev/null)
1223
+ VERIFIER_SKILLS=$(gsd-sdk query agent-skills gsd-verifier 2>/dev/null)
959
1224
  ```
960
1225
 
961
1226
  ```
@@ -1038,7 +1303,7 @@ blocked: 0
1038
1303
 
1039
1304
  Commit the file:
1040
1305
  ```bash
1041
- .agent/skills/gsd/bin/gsd-tools.cjs" commit "test({phase_num}): persist human verification items as UAT" --files "{phase_dir}/{phase_num}-HUMAN-UAT.md"
1306
+ gsd-sdk query commit "test({phase_num}): persist human verification items as UAT" "{phase_dir}/{phase_num}-HUMAN-UAT.md"
1042
1307
  ```
1043
1308
 
1044
1309
  **Step B: Present to user:**
@@ -1070,7 +1335,7 @@ Items saved to `{phase_num}-HUMAN-UAT.md` — they will appear in `/gsd-progress
1070
1335
  {Gap summaries from VERIFICATION.md}
1071
1336
 
1072
1337
  ---
1073
- ## ▶ Next Up
1338
+ ## ▶ Next Up — [${PROJECT_CODE}] ${PROJECT_TITLE}
1074
1339
 
1075
1340
  `/clear` then:
1076
1341
 
@@ -1087,7 +1352,7 @@ Gap closure cycle: `/gsd-plan-phase {X} --gaps ${GSD_WS}` reads VERIFICATION.md
1087
1352
  **Mark phase complete and update all tracking files:**
1088
1353
 
1089
1354
  ```bash
1090
- .agent/skills/gsd/bin/gsd-tools.cjs" phase complete "${PHASE_NUMBER}")
1355
+ COMPLETION=$(gsd-sdk query phase.complete "${PHASE_NUMBER}")
1091
1356
  ```
1092
1357
 
1093
1358
  The CLI handles:
@@ -1110,7 +1375,7 @@ These items are tracked and will appear in `/gsd-progress` and `/gsd-audit-uat`.
1110
1375
  ```
1111
1376
 
1112
1377
  ```bash
1113
- .agent/skills/gsd/bin/gsd-tools.cjs" commit "docs(phase-{X}): complete phase execution" --files .planning/ROADMAP.md .planning/STATE.md .planning/REQUIREMENTS.md {phase_dir}/*-VERIFICATION.md
1378
+ gsd-sdk query commit "docs(phase-{X}): complete phase execution" .planning/ROADMAP.md .planning/STATE.md .planning/REQUIREMENTS.md {phase_dir}/*-VERIFICATION.md
1114
1379
  ```
1115
1380
  </step>
1116
1381
 
@@ -1122,7 +1387,7 @@ entries from the completed phase to the global learnings store at `~/.gsd/knowle
1122
1387
 
1123
1388
  **Check config gate:**
1124
1389
  ```bash
1125
- .agent/skills/gsd/bin/gsd-tools.cjs" config-get features.global_learnings --raw 2>/dev/null || echo "false")
1390
+ GL_ENABLED=$(gsd-sdk query config-get features.global_learnings --raw 2>/dev/null || echo "false")
1126
1391
  ```
1127
1392
 
1128
1393
  **If `GL_ENABLED` is not `true`:** Skip this step entirely (feature disabled by default).
@@ -1132,7 +1397,7 @@ entries from the completed phase to the global learnings store at `~/.gsd/knowle
1132
1397
  1. Check if LEARNINGS.md exists in the phase directory (use the `phase_dir` value from init context)
1133
1398
  2. If found, copy to global store:
1134
1399
  ```bash
1135
- .agent/skills/gsd/bin/gsd-tools.cjs" learnings copy 2>/dev/null || echo "⚠ Learnings copy failed — continuing"
1400
+ gsd-sdk query learnings.copy 2>/dev/null || echo "⚠ Learnings copy failed — continuing"
1136
1401
  ```
1137
1402
  Copy failure must NOT block phase completion.
1138
1403
  </step>
@@ -1153,7 +1418,7 @@ PROJECT.md falls behind silently over multiple phases.
1153
1418
  5. Commit the change:
1154
1419
 
1155
1420
  ```bash
1156
- .agent/skills/gsd/bin/gsd-tools.cjs" commit "docs(phase-{X}): evolve PROJECT.md after phase completion" --files .planning/PROJECT.md
1421
+ gsd-sdk query commit "docs(phase-{X}): evolve PROJECT.md after phase completion" .planning/PROJECT.md
1157
1422
  ```
1158
1423
 
1159
1424
  **Skip this step if** `.planning/PROJECT.md` does not exist.
@@ -1191,8 +1456,8 @@ STOP. Do not proceed to auto-advance or transition.
1191
1456
  1. Parse `--auto` flag from $ARGUMENTS
1192
1457
  2. Read both the chain flag and user preference (chain flag already synced in init step):
1193
1458
  ```bash
1194
- .agent/skills/gsd/bin/gsd-tools.cjs" config-get workflow._auto_chain_active 2>/dev/null || echo "false")
1195
- .agent/skills/gsd/bin/gsd-tools.cjs" config-get workflow.auto_advance 2>/dev/null || echo "false")
1459
+ AUTO_CHAIN=$(gsd-sdk query config-get workflow._auto_chain_active 2>/dev/null || echo "false")
1460
+ AUTO_CFG=$(gsd-sdk query config-get workflow.auto_advance 2>/dev/null || echo "false")
1196
1461
  ```
1197
1462
 
1198
1463
  **If `--auto` flag present OR `AUTO_CHAIN` is true OR `AUTO_CFG` is true (AND verification passed with no gaps):**
@@ -1214,13 +1479,32 @@ references/workflows/transition.md`, passing through the `--auto` flag so it pro
1214
1479
 
1215
1480
  **IMPORTANT: There is NO `/gsd-transition` command. Never suggest it. The transition workflow is internal only.**
1216
1481
 
1482
+ Check whether CONTEXT.md already exists for the next phase:
1483
+
1484
+ ```bash
1485
+ ls .planning/phases/*{next}*/{next}-CONTEXT.md 2>/dev/null || echo "no-context"
1486
+ ```
1487
+
1488
+ If CONTEXT.md does **not** exist for the next phase, present:
1489
+
1490
+ ```
1491
+ ## ✓ Phase {X}: {Name} Complete
1492
+
1493
+ /gsd-progress ${GSD_WS} — see updated roadmap
1494
+ /gsd-discuss-phase {next} ${GSD_WS} — start here: discuss next phase before planning ← recommended
1495
+ /gsd-plan-phase {next} ${GSD_WS} — plan next phase (skip discuss)
1496
+ /gsd-execute-phase {next} ${GSD_WS} — execute next phase (skip discuss and plan)
1497
+ ```
1498
+
1499
+ If CONTEXT.md **exists** for the next phase, present:
1500
+
1217
1501
  ```
1218
1502
  ## ✓ Phase {X}: {Name} Complete
1219
1503
 
1220
1504
  /gsd-progress ${GSD_WS} — see updated roadmap
1221
- /gsd-discuss-phase {next} ${GSD_WS} — discuss next phase before planning
1222
- /gsd-plan-phase {next} ${GSD_WS} — plan next phase
1223
- /gsd-execute-phase {next} ${GSD_WS} — execute next phase
1505
+ /gsd-plan-phase {next} ${GSD_WS} — start here: plan next phase (CONTEXT.md already present) ← recommended
1506
+ /gsd-discuss-phase {next} ${GSD_WS} — re-discuss next phase
1507
+ /gsd-execute-phase {next} ${GSD_WS} — execute next phase (skip planning)
1224
1508
  ```
1225
1509
 
1226
1510
  Only suggest the commands listed above. Do not invent or hallucinate command names.