gsd-antigravity-kit 2.0.0 → 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 (258) 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 +4 -2
  252. package/.agent/skills/release-manager/SKILL.md +0 -162
  253. package/.agent/skills/release-manager/bin/LICENSE +0 -21
  254. package/.agent/skills/release-manager/bin/gh.exe +0 -0
  255. package/.agent/skills/release-manager/references/update_kb_from_fixes.md +0 -29
  256. package/.agent/skills/release-manager/scripts/release.ps1 +0 -222
  257. package/.agent/skills/selectpaste-update/SKILL.md +0 -46
  258. package/.agent/skills/selectpaste-update/scripts/sync-commands.py +0 -317
@@ -20,7 +20,7 @@ Valid GSD subagent types (use exact names — do not fall back to 'general-purpo
20
20
  Load execution context (paths only to minimize orchestrator context):
21
21
 
22
22
  ```bash
23
- .agent/skills/gsd/bin/gsd-tools.cjs" init execute-phase "${PHASE}")
23
+ INIT=$(gsd-sdk query init.execute-phase "${PHASE}")
24
24
  if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi
25
25
  ```
26
26
 
@@ -40,7 +40,7 @@ Find first PLAN without matching SUMMARY. Decimal phases supported (`01.1-hotfix
40
40
 
41
41
  ```bash
42
42
  PHASE=$(echo "$PLAN_PATH" | grep -oE '[0-9]+(\.[0-9]+)?-[0-9]+')
43
- # config settings can be fetched via gsd-tools config-get if needed
43
+ # config settings can be fetched via gsd-sdk query config-get if needed
44
44
  ```
45
45
 
46
46
  <if mode="yolo">
@@ -61,10 +61,19 @@ PLAN_START_EPOCH=$(date +%s)
61
61
 
62
62
  <step name="parse_segments">
63
63
  ```bash
64
+ # Count tasks — match <task tag at any indentation level
65
+ TASK_COUNT=$(grep -cE '^\s*<task[[:space:]>]' .planning/phases/XX-name/{phase}-{plan}-PLAN.md 2>/dev/null || echo "0")
66
+ INLINE_THRESHOLD=$(gsd-sdk query config-get workflow.inline_plan_threshold 2>/dev/null || echo "2")
64
67
  grep -n "type=\"checkpoint" .planning/phases/XX-name/{phase}-{plan}-PLAN.md
65
68
  ```
66
69
 
67
- **Routing by checkpoint type:**
70
+ **Primary routing: task count threshold (#1979)**
71
+
72
+ If `INLINE_THRESHOLD > 0` AND `TASK_COUNT <= INLINE_THRESHOLD`: Use Pattern C (inline) regardless of checkpoint type. Small plans execute faster inline — avoids ~14K token subagent spawn overhead and preserves prompt cache. Configure threshold via `workflow.inline_plan_threshold` (default: 2, set to `0` to always spawn subagents).
73
+
74
+ Otherwise: Apply checkpoint-based routing below.
75
+
76
+ **Checkpoint-based routing (plans with > threshold tasks):**
68
77
 
69
78
  | Checkpoints | Pattern | Execution |
70
79
  |-------------|---------|-----------|
@@ -72,7 +81,7 @@ grep -n "type=\"checkpoint" .planning/phases/XX-name/{phase}-{plan}-PLAN.md
72
81
  | Verify-only | B (segmented) | Segments between checkpoints. After none/human-verify → SUBAGENT. After decision/human-action → MAIN |
73
82
  | Decision | C (main) | Execute entirely in main context |
74
83
 
75
- **Pattern A:** init_agent_tracking → capture `EXPECTED_BASE=$(git rev-parse HEAD)` → spawn Task(subagent_type="gsd-executor", model=executor_model) with prompt: execute plan at [path], autonomous, all tasks + SUMMARY + commit, follow deviation/auth rules, report: plan name, tasks, SUMMARY path, commit hash → track agent_id → wait → update tracking → report. **Include `isolation="worktree"` only if `workflow.use_worktrees` is not `false`** (read via `config-get workflow.use_worktrees`). **When using `isolation="worktree"`, include a `<worktree_branch_check>` block in the prompt** instructing the executor to run `git merge-base HEAD {EXPECTED_BASE}` and, if the result differs from `{EXPECTED_BASE}`, reset the branch base with `git reset --soft {EXPECTED_BASE}` before starting work. This corrects a known issue on Windows where `EnterWorktree` creates branches from `main` instead of the feature branch HEAD.
84
+ **Pattern A:** init_agent_tracking → capture `EXPECTED_BASE=$(git rev-parse HEAD)` → spawn Task(subagent_type="gsd-executor", model=executor_model) with prompt: execute plan at [path], autonomous, all tasks + SUMMARY + commit, follow deviation/auth rules, report: plan name, tasks, SUMMARY path, commit hash → track agent_id → wait → update tracking → report. **Include `isolation="worktree"` only if `workflow.use_worktrees` is not `false`** (read via `config-get workflow.use_worktrees`). **When using `isolation="worktree"`, include a `<worktree_branch_check>` block in the prompt** instructing the executor to run `git merge-base HEAD {EXPECTED_BASE}` and, if the result differs from `{EXPECTED_BASE}`, hard-reset the branch with `git reset --hard {EXPECTED_BASE}` before starting work (safe — runs before any agent work), then verify with `[ "$(git rev-parse HEAD)" != "{EXPECTED_BASE}" ] && exit 1`. This corrects a known issue where `EnterWorktree` creates branches from `main` instead of the feature branch HEAD (affects all platforms).
76
85
 
77
86
  **Pattern B:** Execute segment-by-segment. Autonomous segments: spawn subagent for assigned tasks only (no SUMMARY/commit). Checkpoints: main context. After all segments: aggregate, create SUMMARY, commit. See segment_execution.
78
87
 
@@ -110,6 +119,8 @@ Pattern B only (verify-only checkpoints). Skip for A/C.
110
119
  3. After ALL segments: aggregate files/deviations/decisions → create SUMMARY.md → commit → self-check:
111
120
  - Verify key-files.created exist on disk with `[ -f ]`
112
121
  - Check `git log --oneline --all --grep="{phase}-{plan}"` returns ≥1 commit
122
+ - Re-run ALL `<acceptance_criteria>` from every task — if any fail, fix before finalizing SUMMARY
123
+ - Re-run the plan-level `<verification>` commands — log results in SUMMARY
113
124
  - Append `## Self-Check: PASSED` or `## Self-Check: FAILED` to SUMMARY
114
125
 
115
126
  **Known Antigravity bug (classifyHandoffIfNeeded):** If any segment agent reports "failed" with `classifyHandoffIfNeeded is not defined`, this is a Antigravity runtime bug — not a real failure. Run spot-checks; if they pass, treat as successful.
@@ -130,9 +141,11 @@ This IS the execution instructions. Follow exactly. If plan references CONTEXT.m
130
141
 
131
142
  <step name="previous_phase_check">
132
143
  ```bash
133
- .agent/skills/gsd/bin/gsd-tools.cjs" phases list --type summaries --raw
144
+ gsd-sdk query phases.list --type summaries --raw
134
145
  # Extract the second-to-last summary from the JSON result
135
146
  ```
147
+
148
+ **Text mode (`workflow.text_mode: true` in config or `--text` flag):** Set `TEXT_MODE=true` if `--text` is present in `$ARGUMENTS` OR `text_mode` from init JSON is `true`. When TEXT_MODE is active, replace every `AskUserQuestion` call with a plain-text numbered list and ask the user to type their choice number. This is required for non-Antigravity runtimes (OpenAI Codex, Gemini CLI, etc.) where `AskUserQuestion` is not available.
136
149
  If previous SUMMARY has unresolved "Issues Encountered" or "Next Phase Readiness" blockers: AskUserQuestion(header="Previous Issues", options: "Proceed anyway" | "Address first" | "Review previous").
137
150
  </step>
138
151
 
@@ -145,7 +158,13 @@ Deviations are normal — handle via rules below.
145
158
  - **MANDATORY read_first gate:** If the task has a `<read_first>` field, you MUST read every listed file BEFORE making any edits. This is not optional. Do not skip files because you "already know" what's in them — read them. The read_first files establish ground truth for the task.
146
159
  - `type="auto"`: if `tdd="true"` → TDD execution. Implement with deviation rules + auth gates. Verify done criteria. Commit (see task_commit). Track hash for Summary.
147
160
  - `type="checkpoint:*"`: STOP → checkpoint_protocol → wait for user → continue only after confirmation.
148
- - **MANDATORY acceptance_criteria check:** After completing each task, if it has `<acceptance_criteria>`, verify EVERY criterion before moving to the next task. Use grep, file reads, or CLI commands to confirm each criterion. If any criterion fails, fix the implementation before proceeding. Do not skip criteria or mark them as "will verify later".
161
+ - **HARD GATE — acceptance_criteria verification:** After completing each task, if it has `<acceptance_criteria>`, you MUST run a verification loop before proceeding:
162
+ 1. For each criterion: execute the grep, file check, or CLI command that proves it passes
163
+ 2. Log each result as PASS or FAIL with the command output
164
+ 3. If ANY criterion fails: fix the implementation immediately, then re-run ALL criteria
165
+ 4. Repeat until all criteria pass — you are BLOCKED from starting the next task until this gate clears
166
+ 5. If a criterion cannot be satisfied after 2 fix attempts, log it as a deviation with reason — do NOT silently skip it
167
+ This is not advisory. A task with failing acceptance criteria is an incomplete task.
149
168
  3. Run `<verification>` checks
150
169
  4. Confirm `<success_criteria>` met
151
170
  5. Document deviations in Summary
@@ -178,32 +197,12 @@ Auth errors during execution are NOT failures — they're expected interaction p
178
197
 
179
198
  ## Deviation Rules
180
199
 
181
- You WILL discover unplanned work. Apply automatically, track all for Summary.
182
-
183
- | Rule | Trigger | Action | Permission |
184
- |------|---------|--------|------------|
185
- | **1: Bug** | Broken behavior, errors, wrong queries, type errors, security vulns, race conditions, leaks | Fix test verify track `[Rule 1 - Bug]` | Auto |
186
- | **2: Missing Critical** | Missing essentials: error handling, validation, auth, CSRF/CORS, rate limiting, indexes, logging | Add test → verify → track `[Rule 2 - Missing Critical]` | Auto |
187
- | **3: Blocking** | Prevents completion: missing deps, wrong types, broken imports, missing env/config/files, circular deps | Fix blocker → verify proceeds → track `[Rule 3 - Blocking]` | Auto |
188
- | **4: Architectural** | Structural change: new DB table, schema change, new service, switching libs, breaking API, new infra | STOP → present decision (below) → track `[Rule 4 - Architectural]` | Ask user |
189
-
190
- **Rule 4 format:**
191
- ```
192
- ⚠️ Architectural Decision Needed
193
-
194
- Current task: [task name]
195
- Discovery: [what prompted this]
196
- Proposed change: [modification]
197
- Why needed: [rationale]
198
- Impact: [what this affects]
199
- Alternatives: [other approaches]
200
-
201
- Proceed with proposed change? (yes / different approach / defer)
202
- ```
203
-
204
- **Priority:** Rule 4 (STOP) > Rules 1-3 (auto) > unsure → Rule 4
205
- **Edge cases:** missing validation → R2 | null crash → R1 | new table → R4 | new column → R1/2
206
- **Heuristic:** Affects correctness/security/completion? → R1-3. Maybe? → R4.
200
+ Apply deviation rules from the gsd-executor agent definition (single source of truth):
201
+ - **Rules 1-3** (bugs, missing critical, blockers): auto-fix, test, verify, track as deviations
202
+ - **Rule 4** (architectural changes): STOP, present decision to user, await approval
203
+ - **Scope boundary**: do not auto-fix pre-existing issues unrelated to current task
204
+ - **Fix attempt limit**: max 3 retries per deviation before escalating
205
+ - **Priority**: Rule 4 (STOP) > Rules 1-3 (auto) > unsure → Rule 4
207
206
 
208
207
  </deviation_rules>
209
208
 
@@ -256,59 +255,9 @@ If a commit is BLOCKED by a hook:
256
255
  <task_commit>
257
256
  ## Task Commit Protocol
258
257
 
259
- After each task (verification passed, done criteria met), commit immediately.
260
-
261
- **1. Check:** `git status --short`
262
-
263
- **2. Stage individually** (NEVER `git add .` or `git add -A`):
264
- ```bash
265
- git add src/api/auth.ts
266
- git add src/types/user.ts
267
- ```
268
-
269
- **3. Commit type:**
270
-
271
- | Type | When | Example |
272
- |------|------|---------|
273
- | `feat` | New functionality | feat(08-02): create user registration endpoint |
274
- | `fix` | Bug fix | fix(08-02): correct email validation regex |
275
- | `test` | Test-only (TDD RED) | test(08-02): add failing test for password hashing |
276
- | `refactor` | No behavior change (TDD REFACTOR) | refactor(08-02): extract validation to helper |
277
- | `perf` | Performance | perf(08-02): add database index |
278
- | `docs` | Documentation | docs(08-02): add API docs |
279
- | `style` | Formatting | style(08-02): format auth module |
280
- | `chore` | Config/deps | chore(08-02): add bcrypt dependency |
281
-
282
- **4. Format:** `{type}({phase}-{plan}): {description}` with bullet points for key changes.
258
+ Canonical per-task commit rules live in **`agents/gsd-executor.md`** (`<task_commit_protocol>`). Follow that section for staging, `{type}({phase}-{plan})` messages, `commit-to-subrepo` when `sub_repos` is set, post-commit checks, and untracked-file handling — do not duplicate or paraphrase the full protocol here (single source of truth).
283
259
 
284
- <sub_repos_commit_flow>
285
- **Sub-repos mode:** If `sub_repos` is configured (non-empty array from init context), use `commit-to-subrepo` instead of standard git commit. This routes files to their correct sub-repo based on path prefix.
286
-
287
- ```bash
288
- .agent/skills/gsd/bin/gsd-tools.cjs commit-to-subrepo "{type}({phase}-{plan}): {description}" --files file1 file2 ...
289
- ```
290
-
291
- The command groups files by sub-repo prefix and commits atomically to each. Returns JSON: `{ committed: true, repos: { "backend": { hash: "abc", files: [...] }, ... } }`.
292
-
293
- Record hashes from each repo in the response for SUMMARY tracking.
294
-
295
- **If `sub_repos` is empty or not set:** Use standard git commit flow below.
296
- </sub_repos_commit_flow>
297
-
298
- **5. Record hash:**
299
- ```bash
300
- TASK_COMMIT=$(git rev-parse --short HEAD)
301
- TASK_COMMITS+=("Task ${TASK_NUM}: ${TASK_COMMIT}")
302
- ```
303
-
304
- **6. Check for untracked generated files:**
305
- ```bash
306
- git status --short | grep '^??'
307
- ```
308
- If new untracked files appeared after running scripts or tools, decide for each:
309
- - **Commit it** — if it's a source file, config, or intentional artifact
310
- - **Add to .gitignore** — if it's a generated/runtime output (build artifacts, `.env` files, cache files, compiled output)
311
- - Do NOT leave generated files untracked
260
+ **Orchestrator note:** After each task, the spawned executor reports commit hashes; this workflow does not re-specify commit semantics beyond pointing at the executor.
312
261
 
313
262
  </task_commit>
314
263
 
@@ -341,7 +290,7 @@ If verification fails:
341
290
 
342
291
  **Check if node repair is enabled** (default: on):
343
292
  ```bash
344
- .agent/skills/gsd/bin/gsd-tools.cjs" config-get workflow.node_repair 2>/dev/null || echo "true")
293
+ NODE_REPAIR=$(gsd-sdk query config-get workflow.node_repair 2>/dev/null || echo "true")
345
294
  ```
346
295
 
347
296
  If `NODE_REPAIR` is `true`: invoke `@references/workflows/node-repair.md` with:
@@ -396,19 +345,29 @@ Next: more plans → "Ready for {next-plan}" | last → "Phase complete, ready f
396
345
  </step>
397
346
 
398
347
  <step name="update_current_position">
399
- Update STATE.md using gsd-tools:
348
+ **Skip this step if running in parallel mode** (the orchestrator in execute-phase.md
349
+ handles STATE.md/ROADMAP.md updates centrally after merging worktrees to avoid
350
+ merge conflicts).
351
+
352
+ Update STATE.md using gsd-sdk query (or legacy gsd-tools) state mutations:
400
353
 
401
354
  ```bash
402
- # Advance plan counter (handles last-plan edge case)
403
- .agent/skills/gsd/bin/gsd-tools.cjs" state advance-plan
355
+ # Auto-detect parallel mode: .git is a file in worktrees, a directory in main repo
356
+ IS_WORKTREE=$([ -f .git ] && echo "true" || echo "false")
357
+
358
+ # Skip in parallel mode — orchestrator handles STATE.md centrally
359
+ if [ "$IS_WORKTREE" != "true" ]; then
360
+ # Advance plan counter (handles last-plan edge case)
361
+ gsd-sdk query state.advance-plan
404
362
 
405
- # Recalculate progress bar from disk state
406
- .agent/skills/gsd/bin/gsd-tools.cjs" state update-progress
363
+ # Recalculate progress bar from disk state
364
+ gsd-sdk query state.update-progress
407
365
 
408
- # Record execution metrics
409
- .agent/skills/gsd/bin/gsd-tools.cjs" state record-metric \
410
- --phase "${PHASE}" --plan "${PLAN}" --duration "${DURATION}" \
411
- --tasks "${TASK_COUNT}" --files "${FILE_COUNT}"
366
+ # Record execution metrics
367
+ gsd-sdk query state.record-metric \
368
+ --phase "${PHASE}" --plan "${PLAN}" --duration "${DURATION}" \
369
+ --tasks "${TASK_COUNT}" --files "${FILE_COUNT}"
370
+ fi
412
371
  ```
413
372
  </step>
414
373
 
@@ -418,19 +377,19 @@ From SUMMARY: Extract decisions and add to STATE.md:
418
377
  ```bash
419
378
  # Add each decision from SUMMARY key-decisions
420
379
  # Prefer file inputs for shell-safe text (preserves `$`, `*`, etc. exactly)
421
- .agent/skills/gsd/bin/gsd-tools.cjs" state add-decision \
380
+ gsd-sdk query state.add-decision \
422
381
  --phase "${PHASE}" --summary-file "${DECISION_TEXT_FILE}" --rationale-file "${RATIONALE_FILE}"
423
382
 
424
383
  # Add blockers if any found
425
- .agent/skills/gsd/bin/gsd-tools.cjs" state add-blocker --text-file "${BLOCKER_TEXT_FILE}"
384
+ gsd-sdk query state.add-blocker --text-file "${BLOCKER_TEXT_FILE}"
426
385
  ```
427
386
  </step>
428
387
 
429
388
  <step name="update_session_continuity">
430
- Update session info using gsd-tools:
389
+ Update session info using gsd-sdk query (or legacy gsd-tools):
431
390
 
432
391
  ```bash
433
- .agent/skills/gsd/bin/gsd-tools.cjs" state record-session \
392
+ gsd-sdk query state.record-session \
434
393
  --stopped-at "Completed ${PHASE}-${PLAN}-PLAN.md" \
435
394
  --resume-file "None"
436
395
  ```
@@ -443,8 +402,17 @@ If SUMMARY "Issues Encountered" ≠ "None": yolo → log and continue. Interacti
443
402
  </step>
444
403
 
445
404
  <step name="update_roadmap">
405
+ **Skip this step if running in parallel mode** (the orchestrator handles ROADMAP.md
406
+ updates centrally after merging worktrees).
407
+
446
408
  ```bash
447
- .agent/skills/gsd/bin/gsd-tools.cjs" roadmap update-plan-progress "${PHASE}"
409
+ # Auto-detect parallel mode: .git is a file in worktrees, a directory in main repo
410
+ IS_WORKTREE=$([ -f .git ] && echo "true" || echo "false")
411
+
412
+ # Skip in parallel mode — orchestrator handles ROADMAP.md centrally
413
+ if [ "$IS_WORKTREE" != "true" ]; then
414
+ gsd-sdk query roadmap.update-plan-progress "${PHASE}"
415
+ fi
448
416
  ```
449
417
  Counts PLAN vs SUMMARY files on disk. Updates progress table row with correct count and status (`In Progress` or `Complete` with date).
450
418
  </step>
@@ -453,7 +421,7 @@ Counts PLAN vs SUMMARY files on disk. Updates progress table row with correct co
453
421
  Mark completed requirements from the PLAN.md frontmatter `requirements:` field:
454
422
 
455
423
  ```bash
456
- .agent/skills/gsd/bin/gsd-tools.cjs" requirements mark-complete ${REQ_IDS}
424
+ gsd-sdk query requirements.mark-complete ${REQ_IDS}
457
425
  ```
458
426
 
459
427
  Extract requirement IDs from the plan's frontmatter (e.g., `requirements: [AUTH-01, AUTH-02]`). If no requirements field, skip.
@@ -463,7 +431,15 @@ Extract requirement IDs from the plan's frontmatter (e.g., `requirements: [AUTH-
463
431
  Task code already committed per-task. Commit plan metadata:
464
432
 
465
433
  ```bash
466
- .agent/skills/gsd/bin/gsd-tools.cjs" commit "docs({phase}-{plan}): complete [plan-name] plan" --files .planning/phases/XX-name/{phase}-{plan}-SUMMARY.md .planning/STATE.md .planning/ROADMAP.md .planning/REQUIREMENTS.md
434
+ # Auto-detect parallel mode: .git is a file in worktrees, a directory in main repo
435
+ IS_WORKTREE=$([ -f .git ] && echo "true" || echo "false")
436
+
437
+ # In parallel mode: exclude STATE.md and ROADMAP.md (orchestrator commits these)
438
+ if [ "$IS_WORKTREE" = "true" ]; then
439
+ gsd-sdk query commit "docs({phase}-{plan}): complete [plan-name] plan" .planning/phases/XX-name/{phase}-{plan}-SUMMARY.md .planning/REQUIREMENTS.md
440
+ else
441
+ gsd-sdk query commit "docs({phase}-{plan}): complete [plan-name] plan" .planning/phases/XX-name/{phase}-{plan}-SUMMARY.md .planning/STATE.md .planning/ROADMAP.md .planning/REQUIREMENTS.md
442
+ fi
467
443
  ```
468
444
  </step>
469
445
 
@@ -478,7 +454,7 @@ git diff --name-only ${FIRST_TASK}^..HEAD 2>/dev/null || true
478
454
  Update only structural changes: new src/ dir → STRUCTURE.md | deps → STACK.md | file pattern → CONVENTIONS.md | API client → INTEGRATIONS.md | config → STACK.md | renamed → update paths. Skip code-only/bugfix/content changes.
479
455
 
480
456
  ```bash
481
- .agent/skills/gsd/bin/gsd-tools.cjs" commit "" --files .planning/codebase/*.md --amend
457
+ gsd-sdk query commit "" .planning/codebase/*.md --amend
482
458
  ```
483
459
  </step>
484
460
 
@@ -507,8 +483,8 @@ All routes: `/clear` first for fresh context.
507
483
  - All verifications pass
508
484
  - USER-SETUP.md generated if user_setup in frontmatter
509
485
  - SUMMARY.md created with substantive content
510
- - STATE.md updated (position, decisions, issues, session)
511
- - ROADMAP.md updated
486
+ - STATE.md updated (position, decisions, issues, session) — unless parallel mode (orchestrator handles)
487
+ - ROADMAP.md updated — unless parallel mode (orchestrator handles)
512
488
  - If codebase map exists: map updated with execution changes (or skipped if no significant changes)
513
489
  - If USER-SETUP.md created: prominently surfaced in completion output
514
490
  </success_criteria>
@@ -82,6 +82,8 @@ When the conversation reaches natural conclusions or the developer signals readi
82
82
  | Research question | `.planning/research/questions.md` (append) | Open questions that need deeper investigation |
83
83
  | Requirement | `REQUIREMENTS.md` (append) | Clear requirements that emerged from discussion |
84
84
  | New phase | `ROADMAP.md` (append) | Scope large enough to warrant its own phase |
85
+ | Spike | `/gsd-spike` (invoke) | Feasibility uncertainty surfaced — "will this API work?", "can we do X?" |
86
+ | Sketch | `/gsd-sketch` (invoke) | Design direction unclear — "what should this look like?", "how should this feel?" |
85
87
 
86
88
  Present suggestions:
87
89
  ```
@@ -111,7 +113,7 @@ For each selected output, write the file:
111
113
 
112
114
  Commit if `commit_docs` is enabled:
113
115
  ```bash
114
- .agent/skills/gsd/bin/gsd-tools.cjs" commit "docs: capture exploration — {topic_slug}" --files {file_list}
116
+ gsd-sdk query commit "docs: capture exploration — {topic_slug}" {file_list}
115
117
  ```
116
118
 
117
119
  ## Step 6: Close
@@ -0,0 +1,232 @@
1
+ <purpose>
2
+ Extract decisions, lessons learned, patterns discovered, and surprises encountered from completed phase artifacts into a structured LEARNINGS.md file. Captures institutional knowledge that would otherwise be lost between phases.
3
+ </purpose>
4
+
5
+ <required_reading>
6
+ Read all files referenced by the invoking prompt's execution_context before starting.
7
+ </required_reading>
8
+
9
+ <objective>
10
+ Analyze completed phase artifacts (PLAN.md, SUMMARY.md, VERIFICATION.md, UAT.md, STATE.md) and extract structured learnings into 4 categories: decisions, lessons, patterns, and surprises. Each extracted item includes source attribution. The output is a LEARNINGS.md file with YAML frontmatter containing metadata about the extraction.
11
+ </objective>
12
+
13
+ <process>
14
+
15
+ <step name="initialize">
16
+ Parse arguments and load project state:
17
+
18
+ ```bash
19
+ INIT=$(gsd-sdk query init.phase-op "${PHASE_ARG}")
20
+ if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi
21
+ ```
22
+
23
+ Parse from init JSON: `phase_found`, `phase_dir`, `phase_number`, `phase_name`, `padded_phase`.
24
+
25
+ If phase not found, exit with error: "Phase {PHASE_ARG} not found."
26
+ </step>
27
+
28
+ <step name="collect_artifacts">
29
+ Read the phase artifacts. PLAN.md and SUMMARY.md are required; VERIFICATION.md, UAT.md, and STATE.md are optional.
30
+
31
+ **Required artifacts:**
32
+ - `${PHASE_DIR}/*-PLAN.md` — all plan files for the phase
33
+ - `${PHASE_DIR}/*-SUMMARY.md` — all summary files for the phase
34
+
35
+ If PLAN.md or SUMMARY.md files are not found or missing, exit with error: "Required artifacts missing. PLAN.md and SUMMARY.md are required for learning extraction."
36
+
37
+ **Optional artifacts (read if available, skip if not found):**
38
+ - `${PHASE_DIR}/*-VERIFICATION.md` — verification results
39
+ - `${PHASE_DIR}/*-UAT.md` — user acceptance test results
40
+ - `.planning/STATE.md` — project state with decisions and blockers
41
+
42
+ Track which optional artifacts are missing for the `missing_artifacts` frontmatter field.
43
+ </step>
44
+
45
+ <step name="extract_learnings">
46
+ Analyze all collected artifacts and extract learnings into 4 categories:
47
+
48
+ ### 1. Decisions
49
+ Technical and architectural decisions made during the phase. Look for:
50
+ - Explicit decisions documented in PLAN.md or SUMMARY.md
51
+ - Technology choices and their rationale
52
+ - Trade-offs that were evaluated
53
+ - Design decisions recorded in STATE.md
54
+
55
+ Each decision entry must include:
56
+ - **What** was decided
57
+ - **Why** it was decided (rationale)
58
+ - **Source:** attribution to the artifact where the decision was found (e.g., "Source: 03-01-PLAN.md")
59
+
60
+ ### 2. Lessons
61
+ Things learned during execution that were not known beforehand. Look for:
62
+ - Unexpected complexity in SUMMARY.md
63
+ - Issues discovered during verification in VERIFICATION.md
64
+ - Failed approaches documented in SUMMARY.md
65
+ - UAT feedback that revealed gaps
66
+
67
+ Each lesson entry must include:
68
+ - **What** was learned
69
+ - **Context** for the lesson
70
+ - **Source:** attribution to the originating artifact
71
+
72
+ ### 3. Patterns
73
+ Reusable patterns, approaches, or techniques discovered. Look for:
74
+ - Successful implementation patterns in SUMMARY.md
75
+ - Testing patterns from VERIFICATION.md or UAT.md
76
+ - Workflow patterns that worked well
77
+ - Code organization patterns from PLAN.md
78
+
79
+ Each pattern entry must include:
80
+ - **Pattern** name/description
81
+ - **When to use** it
82
+ - **Source:** attribution to the originating artifact
83
+
84
+ ### 4. Surprises
85
+ Unexpected findings, behaviors, or outcomes. Look for:
86
+ - Things that took longer or shorter than estimated
87
+ - Unexpected dependencies or interactions
88
+ - Edge cases not anticipated in planning
89
+ - Performance or behavior that differed from expectations
90
+
91
+ Each surprise entry must include:
92
+ - **What** was surprising
93
+ - **Impact** of the surprise
94
+ - **Source:** attribution to the originating artifact
95
+ </step>
96
+
97
+ <step name="capture_thought_integration">
98
+ If the `capture_thought` tool is available in the current session, capture each extracted learning as a thought with metadata:
99
+
100
+ ```
101
+ capture_thought({
102
+ category: "decision" | "lesson" | "pattern" | "surprise",
103
+ phase: PHASE_NUMBER,
104
+ content: LEARNING_TEXT,
105
+ source: ARTIFACT_NAME
106
+ })
107
+ ```
108
+
109
+ If `capture_thought` is not available (e.g., runtime does not support it), gracefully skip this step and continue. The LEARNINGS.md file is the primary output — capture_thought is a supplementary integration that provides a fallback for runtimes with thought capture support. The workflow must not fail or warn if capture_thought is unavailable.
110
+ </step>
111
+
112
+ <step name="write_learnings">
113
+ Write the LEARNINGS.md file to the phase directory. If a previous LEARNINGS.md exists, overwrite it (replace the file entirely).
114
+
115
+ Output path: `${PHASE_DIR}/${PADDED_PHASE}-LEARNINGS.md`
116
+
117
+ The file must have YAML frontmatter with these fields:
118
+ ```yaml
119
+ ---
120
+ phase: {PHASE_NUMBER}
121
+ phase_name: "{PHASE_NAME}"
122
+ project: "{PROJECT_NAME}"
123
+ generated: "{ISO_DATE}"
124
+ counts:
125
+ decisions: {N}
126
+ lessons: {N}
127
+ patterns: {N}
128
+ surprises: {N}
129
+ missing_artifacts:
130
+ - "{ARTIFACT_NAME}"
131
+ ---
132
+ ```
133
+
134
+ The body follows this structure:
135
+ ```markdown
136
+ # Phase {PHASE_NUMBER} Learnings: {PHASE_NAME}
137
+
138
+ ## Decisions
139
+
140
+ ### {Decision Title}
141
+ {What was decided}
142
+
143
+ **Rationale:** {Why}
144
+ **Source:** {artifact file}
145
+
146
+ ---
147
+
148
+ ## Lessons
149
+
150
+ ### {Lesson Title}
151
+ {What was learned}
152
+
153
+ **Context:** {context}
154
+ **Source:** {artifact file}
155
+
156
+ ---
157
+
158
+ ## Patterns
159
+
160
+ ### {Pattern Name}
161
+ {Description}
162
+
163
+ **When to use:** {applicability}
164
+ **Source:** {artifact file}
165
+
166
+ ---
167
+
168
+ ## Surprises
169
+
170
+ ### {Surprise Title}
171
+ {What was surprising}
172
+
173
+ **Impact:** {impact description}
174
+ **Source:** {artifact file}
175
+ ```
176
+ </step>
177
+
178
+ <step name="update_state">
179
+ Update STATE.md to reflect the learning extraction:
180
+
181
+ ```bash
182
+ gsd-sdk query state.update "Last Activity" "$(date +%Y-%m-%d)"
183
+ ```
184
+ </step>
185
+
186
+ <step name="report">
187
+ ```
188
+ ---------------------------------------------------------------
189
+
190
+ ## Learnings Extracted: Phase {X} — {Name}
191
+
192
+ Decisions: {N}
193
+ Lessons: {N}
194
+ Patterns: {N}
195
+ Surprises: {N}
196
+ Total: {N}
197
+
198
+ Output: {PHASE_DIR}/{PADDED_PHASE}-LEARNINGS.md
199
+
200
+ Missing artifacts: {list or "none"}
201
+
202
+ Next steps:
203
+ - Review extracted learnings for accuracy
204
+ - /gsd-progress — see overall project state
205
+ - /gsd-execute-phase {next} — continue to next phase
206
+
207
+ ---------------------------------------------------------------
208
+ ```
209
+ </step>
210
+
211
+ </process>
212
+
213
+ <success_criteria>
214
+ - [ ] Phase artifacts located and read successfully
215
+ - [ ] All 4 categories extracted: decisions, lessons, patterns, surprises
216
+ - [ ] Each extracted item has source attribution
217
+ - [ ] LEARNINGS.md written with correct YAML frontmatter
218
+ - [ ] Missing optional artifacts tracked in frontmatter
219
+ - [ ] capture_thought integration attempted if tool available
220
+ - [ ] STATE.md updated with extraction activity
221
+ - [ ] User receives summary report
222
+ </success_criteria>
223
+
224
+ <critical_rules>
225
+ - PLAN.md and SUMMARY.md are required — exit with clear error if missing
226
+ - VERIFICATION.md, UAT.md, and STATE.md are optional — extract from them if present, skip gracefully if not found
227
+ - Every extracted learning must have source attribution back to the originating artifact
228
+ - Running extract-learnings twice on the same phase must overwrite (replace) the previous LEARNINGS.md, not append
229
+ - Do not fabricate learnings — only extract what is explicitly documented in artifacts
230
+ - If capture_thought is unavailable, the workflow must not fail — graceful degradation to file-only output
231
+ - LEARNINGS.md frontmatter must include counts for all 4 categories and list any missing_artifacts
232
+ </critical_rules>
@@ -259,7 +259,7 @@ gh issue create \
259
259
  ## Step 8: Update STATE.md
260
260
 
261
261
  ```bash
262
- gsd-tools.cjs state record-session \
263
- --stopped-at "Forensic investigation complete" \
264
- --resume-file ".planning/forensics/report-{timestamp}.md"
262
+ gsd-sdk query state.record-session "" \
263
+ "Forensic investigation complete" \
264
+ ".planning/forensics/report-{timestamp}.md"
265
265
  ```
@@ -25,7 +25,7 @@ fi
25
25
  **Run health validation:**
26
26
 
27
27
  ```bash
28
- .agent/skills/gsd/bin/gsd-tools.cjs" validate health $REPAIR_FLAG
28
+ gsd-sdk query validate.health $REPAIR_FLAG
29
29
  ```
30
30
 
31
31
  Parse JSON output:
@@ -112,7 +112,7 @@ If yes, re-run with --repair flag and display results.
112
112
  Re-run health check without --repair to confirm issues are resolved:
113
113
 
114
114
  ```bash
115
- .agent/skills/gsd/bin/gsd-tools.cjs" validate health
115
+ gsd-sdk query validate.health
116
116
  ```
117
117
 
118
118
  Report final status.