@therocketcode/gsd-core 1.4.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 (568) hide show
  1. package/.claude-plugin/plugin.json +23 -0
  2. package/GEMINI.md +53 -0
  3. package/LICENSE +21 -0
  4. package/README.ja-JP.md +125 -0
  5. package/README.ko-KR.md +125 -0
  6. package/README.md +144 -0
  7. package/README.pt-BR.md +125 -0
  8. package/README.zh-CN.md +125 -0
  9. package/agents/gsd-advisor-researcher.md +108 -0
  10. package/agents/gsd-ai-researcher.md +114 -0
  11. package/agents/gsd-assumptions-analyzer.md +105 -0
  12. package/agents/gsd-code-fixer.md +668 -0
  13. package/agents/gsd-code-reviewer.md +387 -0
  14. package/agents/gsd-codebase-mapper.md +853 -0
  15. package/agents/gsd-debug-session-manager.md +314 -0
  16. package/agents/gsd-debugger.md +1452 -0
  17. package/agents/gsd-doc-classifier.md +168 -0
  18. package/agents/gsd-doc-synthesizer.md +204 -0
  19. package/agents/gsd-doc-verifier.md +217 -0
  20. package/agents/gsd-doc-writer.md +616 -0
  21. package/agents/gsd-domain-researcher.md +147 -0
  22. package/agents/gsd-eval-auditor.md +191 -0
  23. package/agents/gsd-eval-planner.md +154 -0
  24. package/agents/gsd-executor.md +785 -0
  25. package/agents/gsd-framework-selector.md +160 -0
  26. package/agents/gsd-integration-checker.md +470 -0
  27. package/agents/gsd-intel-updater.md +342 -0
  28. package/agents/gsd-nyquist-auditor.md +203 -0
  29. package/agents/gsd-pattern-mapper.md +335 -0
  30. package/agents/gsd-phase-researcher.md +867 -0
  31. package/agents/gsd-plan-checker.md +978 -0
  32. package/agents/gsd-planner.md +1204 -0
  33. package/agents/gsd-project-researcher.md +611 -0
  34. package/agents/gsd-research-synthesizer.md +259 -0
  35. package/agents/gsd-roadmapper.md +688 -0
  36. package/agents/gsd-security-auditor.md +155 -0
  37. package/agents/gsd-ui-auditor.md +495 -0
  38. package/agents/gsd-ui-checker.md +309 -0
  39. package/agents/gsd-ui-researcher.md +374 -0
  40. package/agents/gsd-user-profiler.md +171 -0
  41. package/agents/gsd-verifier.md +923 -0
  42. package/assets/gsd-logo-2000-transparent.png +0 -0
  43. package/assets/gsd-logo-2000-transparent.svg +17 -0
  44. package/assets/gsd-logo-2000.png +0 -0
  45. package/assets/gsd-logo-2000.svg +21 -0
  46. package/assets/terminal.svg +68 -0
  47. package/bin/install.js +12726 -0
  48. package/bin/lib/ui-safety-gate.cjs +107 -0
  49. package/commands/gsd/add-tests.md +42 -0
  50. package/commands/gsd/ai-integration-phase.md +37 -0
  51. package/commands/gsd/audit-fix.md +34 -0
  52. package/commands/gsd/audit-milestone.md +37 -0
  53. package/commands/gsd/audit-uat.md +24 -0
  54. package/commands/gsd/autonomous.md +48 -0
  55. package/commands/gsd/capture.md +62 -0
  56. package/commands/gsd/cleanup.md +24 -0
  57. package/commands/gsd/code-review.md +59 -0
  58. package/commands/gsd/complete-milestone.md +143 -0
  59. package/commands/gsd/config.md +56 -0
  60. package/commands/gsd/debug.md +52 -0
  61. package/commands/gsd/discover-product.md +65 -0
  62. package/commands/gsd/discuss-phase.md +77 -0
  63. package/commands/gsd/docs-update.md +49 -0
  64. package/commands/gsd/eval-review.md +33 -0
  65. package/commands/gsd/execute-phase.md +66 -0
  66. package/commands/gsd/explore.md +27 -0
  67. package/commands/gsd/extract-learnings.md +23 -0
  68. package/commands/gsd/fast.md +31 -0
  69. package/commands/gsd/forensics.md +57 -0
  70. package/commands/gsd/graphify.md +204 -0
  71. package/commands/gsd/health.md +31 -0
  72. package/commands/gsd/help.md +28 -0
  73. package/commands/gsd/import.md +45 -0
  74. package/commands/gsd/inbox.md +39 -0
  75. package/commands/gsd/ingest-docs.md +42 -0
  76. package/commands/gsd/manager.md +45 -0
  77. package/commands/gsd/map-codebase.md +83 -0
  78. package/commands/gsd/milestone-summary.md +51 -0
  79. package/commands/gsd/model-domain.md +65 -0
  80. package/commands/gsd/mvp-phase.md +45 -0
  81. package/commands/gsd/new-milestone.md +45 -0
  82. package/commands/gsd/new-project.md +47 -0
  83. package/commands/gsd/ns-context.md +23 -0
  84. package/commands/gsd/ns-ideate.md +24 -0
  85. package/commands/gsd/ns-manage.md +29 -0
  86. package/commands/gsd/ns-project.md +22 -0
  87. package/commands/gsd/ns-review.md +26 -0
  88. package/commands/gsd/ns-workflow.md +28 -0
  89. package/commands/gsd/pause-work.md +43 -0
  90. package/commands/gsd/phase.md +56 -0
  91. package/commands/gsd/plan-phase.md +64 -0
  92. package/commands/gsd/plan-review-convergence.md +59 -0
  93. package/commands/gsd/pr-branch.md +26 -0
  94. package/commands/gsd/profile-user.md +46 -0
  95. package/commands/gsd/progress.md +48 -0
  96. package/commands/gsd/quick.md +174 -0
  97. package/commands/gsd/recommend-architecture.md +64 -0
  98. package/commands/gsd/resume-work.md +30 -0
  99. package/commands/gsd/review-backlog.md +63 -0
  100. package/commands/gsd/review.md +42 -0
  101. package/commands/gsd/secure-phase.md +36 -0
  102. package/commands/gsd/settings.md +29 -0
  103. package/commands/gsd/ship.md +24 -0
  104. package/commands/gsd/sketch.md +60 -0
  105. package/commands/gsd/spec-phase.md +63 -0
  106. package/commands/gsd/spike.md +57 -0
  107. package/commands/gsd/stats.md +20 -0
  108. package/commands/gsd/surface.md +155 -0
  109. package/commands/gsd/testing-strategy.md +65 -0
  110. package/commands/gsd/thread.md +24 -0
  111. package/commands/gsd/ui-phase.md +35 -0
  112. package/commands/gsd/ui-review.md +33 -0
  113. package/commands/gsd/ultraplan-phase.md +34 -0
  114. package/commands/gsd/undo.md +35 -0
  115. package/commands/gsd/update.md +49 -0
  116. package/commands/gsd/validate-phase.md +36 -0
  117. package/commands/gsd/verify-work.md +39 -0
  118. package/commands/gsd/workspace.md +52 -0
  119. package/commands/gsd/workstreams.md +70 -0
  120. package/gemini-extension.json +6 -0
  121. package/gsd-core/bin/check-latest-version.cjs +161 -0
  122. package/gsd-core/bin/gsd-tools.cjs +1928 -0
  123. package/gsd-core/bin/lib/active-workstream-store.cjs +291 -0
  124. package/gsd-core/bin/lib/adr-parser.cjs +399 -0
  125. package/gsd-core/bin/lib/agent-command-router.cjs +68 -0
  126. package/gsd-core/bin/lib/artifacts.cjs +51 -0
  127. package/gsd-core/bin/lib/audit.cjs +743 -0
  128. package/gsd-core/bin/lib/check-command-router.cjs +343 -0
  129. package/gsd-core/bin/lib/cjs-command-router-adapter.cjs +81 -0
  130. package/gsd-core/bin/lib/cli-exit.cjs +42 -0
  131. package/gsd-core/bin/lib/clock.cjs +95 -0
  132. package/gsd-core/bin/lib/clusters.cjs +132 -0
  133. package/gsd-core/bin/lib/code-review-flags.cjs +59 -0
  134. package/gsd-core/bin/lib/command-aliases.cjs +809 -0
  135. package/gsd-core/bin/lib/command-arg-projection.cjs +55 -0
  136. package/gsd-core/bin/lib/command-routing-hub.cjs +300 -0
  137. package/gsd-core/bin/lib/commands.cjs +1203 -0
  138. package/gsd-core/bin/lib/config-schema.cjs +29 -0
  139. package/gsd-core/bin/lib/config-types.cjs +19 -0
  140. package/gsd-core/bin/lib/config.cjs +738 -0
  141. package/gsd-core/bin/lib/configuration.cjs +239 -0
  142. package/gsd-core/bin/lib/context-utilization.cjs +48 -0
  143. package/gsd-core/bin/lib/core.cjs +2051 -0
  144. package/gsd-core/bin/lib/decisions.cjs +118 -0
  145. package/gsd-core/bin/lib/docs.cjs +252 -0
  146. package/gsd-core/bin/lib/drift.cjs +364 -0
  147. package/gsd-core/bin/lib/fallow-runner.cjs +115 -0
  148. package/gsd-core/bin/lib/frontmatter.cjs +442 -0
  149. package/gsd-core/bin/lib/gap-checker.cjs +257 -0
  150. package/gsd-core/bin/lib/graphify.cjs +496 -0
  151. package/gsd-core/bin/lib/gsd2-import.cjs +456 -0
  152. package/gsd-core/bin/lib/init-command-router.cjs +62 -0
  153. package/gsd-core/bin/lib/init.cjs +1815 -0
  154. package/gsd-core/bin/lib/install-profiles.cjs +584 -0
  155. package/gsd-core/bin/lib/installer-migration-authoring.cjs +122 -0
  156. package/gsd-core/bin/lib/installer-migration-report.cjs +350 -0
  157. package/gsd-core/bin/lib/installer-migrations/000-first-time-baseline.cjs +218 -0
  158. package/gsd-core/bin/lib/installer-migrations/001-legacy-orphan-files.cjs +48 -0
  159. package/gsd-core/bin/lib/installer-migrations/002-codex-legacy-hooks-json.cjs +94 -0
  160. package/gsd-core/bin/lib/installer-migrations/003-rename-get-shit-done-to-gsd-core.cjs +108 -0
  161. package/gsd-core/bin/lib/installer-migrations.cjs +823 -0
  162. package/gsd-core/bin/lib/intel.cjs +590 -0
  163. package/gsd-core/bin/lib/learnings.cjs +270 -0
  164. package/gsd-core/bin/lib/legacy-cleanup.cjs +253 -0
  165. package/gsd-core/bin/lib/milestone.cjs +373 -0
  166. package/gsd-core/bin/lib/model-catalog.cjs +154 -0
  167. package/gsd-core/bin/lib/model-profiles.cjs +24 -0
  168. package/gsd-core/bin/lib/observability/event.cjs +51 -0
  169. package/gsd-core/bin/lib/observability/logger.cjs +146 -0
  170. package/gsd-core/bin/lib/observability/redaction.cjs +48 -0
  171. package/gsd-core/bin/lib/package-identity.cjs +35 -0
  172. package/gsd-core/bin/lib/package-legitimacy.cjs +368 -0
  173. package/gsd-core/bin/lib/phase-command-router.cjs +189 -0
  174. package/gsd-core/bin/lib/phase-lifecycle.cjs +74 -0
  175. package/gsd-core/bin/lib/phase.cjs +1307 -0
  176. package/gsd-core/bin/lib/phases-command-router.cjs +43 -0
  177. package/gsd-core/bin/lib/plan-scan.cjs +91 -0
  178. package/gsd-core/bin/lib/planning-workspace.cjs +245 -0
  179. package/gsd-core/bin/lib/profile-output.cjs +1120 -0
  180. package/gsd-core/bin/lib/profile-pipeline.cjs +517 -0
  181. package/gsd-core/bin/lib/project-root.cjs +119 -0
  182. package/gsd-core/bin/lib/prompt-budget.cjs +305 -0
  183. package/gsd-core/bin/lib/research-provider.cjs +137 -0
  184. package/gsd-core/bin/lib/research-store.cjs +167 -0
  185. package/gsd-core/bin/lib/review-reviewer-selection.cjs +121 -0
  186. package/gsd-core/bin/lib/roadmap-command-router.cjs +166 -0
  187. package/gsd-core/bin/lib/roadmap-upgrade.cjs +476 -0
  188. package/gsd-core/bin/lib/roadmap.cjs +600 -0
  189. package/gsd-core/bin/lib/runtime-artifact-layout.cjs +312 -0
  190. package/gsd-core/bin/lib/runtime-config-adapter-registry.cjs +56 -0
  191. package/gsd-core/bin/lib/runtime-homes.cjs +190 -0
  192. package/gsd-core/bin/lib/runtime-name-policy.cjs +96 -0
  193. package/gsd-core/bin/lib/runtime-slash.cjs +119 -0
  194. package/gsd-core/bin/lib/schema-detect.cjs +159 -0
  195. package/gsd-core/bin/lib/secrets.cjs +34 -0
  196. package/gsd-core/bin/lib/security.cjs +480 -0
  197. package/gsd-core/bin/lib/semver-compare.cjs +42 -0
  198. package/gsd-core/bin/lib/shell-command-projection.cjs +533 -0
  199. package/gsd-core/bin/lib/state-command-router.cjs +160 -0
  200. package/gsd-core/bin/lib/state-document.cjs +259 -0
  201. package/gsd-core/bin/lib/state.cjs +2010 -0
  202. package/gsd-core/bin/lib/surface.cjs +449 -0
  203. package/gsd-core/bin/lib/task-command-router.cjs +85 -0
  204. package/gsd-core/bin/lib/template.cjs +237 -0
  205. package/gsd-core/bin/lib/uat.cjs +297 -0
  206. package/gsd-core/bin/lib/ui-safety-gate.cjs +98 -0
  207. package/gsd-core/bin/lib/update-context.cjs +218 -0
  208. package/gsd-core/bin/lib/validate-command-router.cjs +91 -0
  209. package/gsd-core/bin/lib/validate.cjs +112 -0
  210. package/gsd-core/bin/lib/verification-command-router.cjs +31 -0
  211. package/gsd-core/bin/lib/verification.cjs +193 -0
  212. package/gsd-core/bin/lib/verify-command-router.cjs +44 -0
  213. package/gsd-core/bin/lib/verify.cjs +1451 -0
  214. package/gsd-core/bin/lib/workstream-inventory-builder.cjs +81 -0
  215. package/gsd-core/bin/lib/workstream-inventory.cjs +147 -0
  216. package/gsd-core/bin/lib/workstream-name-policy.cjs +91 -0
  217. package/gsd-core/bin/lib/workstream.cjs +380 -0
  218. package/gsd-core/bin/lib/worktree-base-ref.cjs +325 -0
  219. package/gsd-core/bin/lib/worktree-safety.cjs +943 -0
  220. package/gsd-core/bin/shared/config-defaults.manifest.json +98 -0
  221. package/gsd-core/bin/shared/config-schema.manifest.json +192 -0
  222. package/gsd-core/bin/shared/model-catalog.json +149 -0
  223. package/gsd-core/bin/shared/runtime-aliases.manifest.json +75 -0
  224. package/gsd-core/bin/verify-reapply-patches.cjs +349 -0
  225. package/gsd-core/contexts/dev.md +21 -0
  226. package/gsd-core/contexts/research.md +22 -0
  227. package/gsd-core/contexts/review.md +23 -0
  228. package/gsd-core/references/agent-contracts.md +79 -0
  229. package/gsd-core/references/ai-evals.md +156 -0
  230. package/gsd-core/references/ai-frameworks.md +186 -0
  231. package/gsd-core/references/architecture-decision.md +74 -0
  232. package/gsd-core/references/artifact-types.md +131 -0
  233. package/gsd-core/references/auth-in-tests.md +91 -0
  234. package/gsd-core/references/autonomous-smart-discuss.md +277 -0
  235. package/gsd-core/references/checkpoints.md +814 -0
  236. package/gsd-core/references/common-bug-patterns.md +114 -0
  237. package/gsd-core/references/context-budget.md +85 -0
  238. package/gsd-core/references/continuation-format.md +253 -0
  239. package/gsd-core/references/db-test-isolation.md +54 -0
  240. package/gsd-core/references/debugger-philosophy.md +76 -0
  241. package/gsd-core/references/decimal-phase-calculation.md +64 -0
  242. package/gsd-core/references/doc-conflict-engine.md +91 -0
  243. package/gsd-core/references/domain-modeling.md +80 -0
  244. package/gsd-core/references/domain-probes.md +125 -0
  245. package/gsd-core/references/e2e-tiering.md +35 -0
  246. package/gsd-core/references/execute-mvp-tdd.md +81 -0
  247. package/gsd-core/references/executor-examples.md +110 -0
  248. package/gsd-core/references/few-shot-examples/plan-checker.md +73 -0
  249. package/gsd-core/references/few-shot-examples/verifier.md +109 -0
  250. package/gsd-core/references/flaky-test-checklist.md +22 -0
  251. package/gsd-core/references/gate-prompts.md +100 -0
  252. package/gsd-core/references/gates.md +70 -0
  253. package/gsd-core/references/git-integration.md +298 -0
  254. package/gsd-core/references/git-planning-commit.md +40 -0
  255. package/gsd-core/references/ios-scaffold.md +123 -0
  256. package/gsd-core/references/mandatory-initial-read.md +2 -0
  257. package/gsd-core/references/model-profile-resolution.md +38 -0
  258. package/gsd-core/references/model-profiles.md +245 -0
  259. package/gsd-core/references/mvp-concepts.md +49 -0
  260. package/gsd-core/references/phase-argument-parsing.md +61 -0
  261. package/gsd-core/references/planner-antipatterns.md +89 -0
  262. package/gsd-core/references/planner-chunked.md +49 -0
  263. package/gsd-core/references/planner-gap-closure.md +62 -0
  264. package/gsd-core/references/planner-graphify-auto-update.md +67 -0
  265. package/gsd-core/references/planner-human-verify-mode.md +57 -0
  266. package/gsd-core/references/planner-interface-context.md +62 -0
  267. package/gsd-core/references/planner-load-graph-context.md +36 -0
  268. package/gsd-core/references/planner-mvp-mode.md +53 -0
  269. package/gsd-core/references/planner-reviews.md +39 -0
  270. package/gsd-core/references/planner-revision.md +87 -0
  271. package/gsd-core/references/planner-source-audit.md +73 -0
  272. package/gsd-core/references/planning-config.md +473 -0
  273. package/gsd-core/references/product-discovery.md +49 -0
  274. package/gsd-core/references/project-skills-discovery.md +19 -0
  275. package/gsd-core/references/questioning.md +162 -0
  276. package/gsd-core/references/realistic-test-data.md +44 -0
  277. package/gsd-core/references/research-documentation-lookup.md +29 -0
  278. package/gsd-core/references/research-philosophy.md +29 -0
  279. package/gsd-core/references/research-verification-protocol.md +27 -0
  280. package/gsd-core/references/revision-loop.md +97 -0
  281. package/gsd-core/references/scout-codebase.md +51 -0
  282. package/gsd-core/references/skeleton-template.md +48 -0
  283. package/gsd-core/references/sketch-interactivity.md +41 -0
  284. package/gsd-core/references/sketch-theme-system.md +94 -0
  285. package/gsd-core/references/sketch-tooling.md +45 -0
  286. package/gsd-core/references/sketch-variant-patterns.md +81 -0
  287. package/gsd-core/references/spidr-splitting.md +69 -0
  288. package/gsd-core/references/tdd.md +330 -0
  289. package/gsd-core/references/test-containers.md +55 -0
  290. package/gsd-core/references/test-strategy.md +75 -0
  291. package/gsd-core/references/thinking-models-debug.md +44 -0
  292. package/gsd-core/references/thinking-models-execution.md +50 -0
  293. package/gsd-core/references/thinking-models-planning.md +62 -0
  294. package/gsd-core/references/thinking-models-research.md +50 -0
  295. package/gsd-core/references/thinking-models-verification.md +55 -0
  296. package/gsd-core/references/thinking-partner.md +96 -0
  297. package/gsd-core/references/ui-brand.md +162 -0
  298. package/gsd-core/references/universal-anti-patterns.md +63 -0
  299. package/gsd-core/references/user-profiling.md +681 -0
  300. package/gsd-core/references/user-story-template.md +58 -0
  301. package/gsd-core/references/verification-overrides.md +227 -0
  302. package/gsd-core/references/verification-patterns.md +612 -0
  303. package/gsd-core/references/verify-mvp-mode.md +85 -0
  304. package/gsd-core/references/workstream-flag.md +111 -0
  305. package/gsd-core/references/worktree-branch-check.md +38 -0
  306. package/gsd-core/references/worktree-path-safety.md +67 -0
  307. package/gsd-core/templates/AI-SPEC.md +246 -0
  308. package/gsd-core/templates/DEBUG.md +169 -0
  309. package/gsd-core/templates/README.md +77 -0
  310. package/gsd-core/templates/SECURITY.md +61 -0
  311. package/gsd-core/templates/UAT.md +265 -0
  312. package/gsd-core/templates/UI-SPEC.md +100 -0
  313. package/gsd-core/templates/VALIDATION.md +76 -0
  314. package/gsd-core/templates/adr.md +58 -0
  315. package/gsd-core/templates/claude-md.md +145 -0
  316. package/gsd-core/templates/codebase/architecture.md +255 -0
  317. package/gsd-core/templates/codebase/concerns.md +310 -0
  318. package/gsd-core/templates/codebase/conventions.md +307 -0
  319. package/gsd-core/templates/codebase/integrations.md +280 -0
  320. package/gsd-core/templates/codebase/stack.md +186 -0
  321. package/gsd-core/templates/codebase/structure.md +285 -0
  322. package/gsd-core/templates/codebase/testing.md +480 -0
  323. package/gsd-core/templates/config.json +62 -0
  324. package/gsd-core/templates/context.md +352 -0
  325. package/gsd-core/templates/continue-here.md +78 -0
  326. package/gsd-core/templates/copilot-instructions.md +7 -0
  327. package/gsd-core/templates/debug-subagent-prompt.md +91 -0
  328. package/gsd-core/templates/dev-preferences.md +21 -0
  329. package/gsd-core/templates/discovery.md +146 -0
  330. package/gsd-core/templates/discussion-log.md +63 -0
  331. package/gsd-core/templates/domain-model.md +54 -0
  332. package/gsd-core/templates/milestone-archive.md +123 -0
  333. package/gsd-core/templates/milestone.md +115 -0
  334. package/gsd-core/templates/phase-prompt.md +610 -0
  335. package/gsd-core/templates/planner-subagent-prompt.md +117 -0
  336. package/gsd-core/templates/product-brief.md +55 -0
  337. package/gsd-core/templates/project.md +186 -0
  338. package/gsd-core/templates/requirements.md +231 -0
  339. package/gsd-core/templates/research-project/ARCHITECTURE.md +204 -0
  340. package/gsd-core/templates/research-project/FEATURES.md +147 -0
  341. package/gsd-core/templates/research-project/PITFALLS.md +200 -0
  342. package/gsd-core/templates/research-project/STACK.md +120 -0
  343. package/gsd-core/templates/research-project/SUMMARY.md +170 -0
  344. package/gsd-core/templates/research.md +592 -0
  345. package/gsd-core/templates/retrospective.md +54 -0
  346. package/gsd-core/templates/roadmap.md +202 -0
  347. package/gsd-core/templates/spec.md +307 -0
  348. package/gsd-core/templates/state.md +195 -0
  349. package/gsd-core/templates/summary-complex.md +59 -0
  350. package/gsd-core/templates/summary-minimal.md +41 -0
  351. package/gsd-core/templates/summary-standard.md +48 -0
  352. package/gsd-core/templates/summary.md +248 -0
  353. package/gsd-core/templates/test-strategy.md +50 -0
  354. package/gsd-core/templates/user-profile.md +146 -0
  355. package/gsd-core/templates/user-setup.md +311 -0
  356. package/gsd-core/templates/verification-report.md +322 -0
  357. package/gsd-core/workflows/_runtime-launcher.snippet.sh +1 -0
  358. package/gsd-core/workflows/add-backlog.md +91 -0
  359. package/gsd-core/workflows/add-phase.md +113 -0
  360. package/gsd-core/workflows/add-tests.md +355 -0
  361. package/gsd-core/workflows/add-todo.md +161 -0
  362. package/gsd-core/workflows/ai-integration-phase.md +295 -0
  363. package/gsd-core/workflows/analyze-dependencies.md +96 -0
  364. package/gsd-core/workflows/audit-fix.md +178 -0
  365. package/gsd-core/workflows/audit-milestone.md +360 -0
  366. package/gsd-core/workflows/audit-uat.md +110 -0
  367. package/gsd-core/workflows/autonomous.md +797 -0
  368. package/gsd-core/workflows/check-todos.md +180 -0
  369. package/gsd-core/workflows/cleanup.md +195 -0
  370. package/gsd-core/workflows/code-review-fix.md +502 -0
  371. package/gsd-core/workflows/code-review.md +658 -0
  372. package/gsd-core/workflows/complete-milestone.md +855 -0
  373. package/gsd-core/workflows/debug.md +237 -0
  374. package/gsd-core/workflows/diagnose-issues.md +245 -0
  375. package/gsd-core/workflows/discover-product.md +112 -0
  376. package/gsd-core/workflows/discovery-phase.md +291 -0
  377. package/gsd-core/workflows/discuss-phase/modes/advisor.md +176 -0
  378. package/gsd-core/workflows/discuss-phase/modes/all.md +28 -0
  379. package/gsd-core/workflows/discuss-phase/modes/analyze.md +44 -0
  380. package/gsd-core/workflows/discuss-phase/modes/auto.md +57 -0
  381. package/gsd-core/workflows/discuss-phase/modes/batch.md +52 -0
  382. package/gsd-core/workflows/discuss-phase/modes/chain.md +98 -0
  383. package/gsd-core/workflows/discuss-phase/modes/default.md +141 -0
  384. package/gsd-core/workflows/discuss-phase/modes/power.md +44 -0
  385. package/gsd-core/workflows/discuss-phase/modes/text.md +55 -0
  386. package/gsd-core/workflows/discuss-phase/templates/checkpoint.json +18 -0
  387. package/gsd-core/workflows/discuss-phase/templates/context.md +136 -0
  388. package/gsd-core/workflows/discuss-phase/templates/discussion-log.md +50 -0
  389. package/gsd-core/workflows/discuss-phase-assumptions.md +675 -0
  390. package/gsd-core/workflows/discuss-phase-power.md +291 -0
  391. package/gsd-core/workflows/discuss-phase.md +499 -0
  392. package/gsd-core/workflows/do.md +111 -0
  393. package/gsd-core/workflows/docs-update.md +1176 -0
  394. package/gsd-core/workflows/edit-phase.md +295 -0
  395. package/gsd-core/workflows/eval-review.md +156 -0
  396. package/gsd-core/workflows/execute-phase/steps/codebase-drift-gate.md +95 -0
  397. package/gsd-core/workflows/execute-phase/steps/per-plan-worktree-gate.md +94 -0
  398. package/gsd-core/workflows/execute-phase/steps/post-merge-gate.md +117 -0
  399. package/gsd-core/workflows/execute-phase.md +1752 -0
  400. package/gsd-core/workflows/execute-plan.md +526 -0
  401. package/gsd-core/workflows/explore.md +146 -0
  402. package/gsd-core/workflows/extract-learnings.md +243 -0
  403. package/gsd-core/workflows/fast.md +124 -0
  404. package/gsd-core/workflows/forensics.md +279 -0
  405. package/gsd-core/workflows/graduation.md +196 -0
  406. package/gsd-core/workflows/health.md +224 -0
  407. package/gsd-core/workflows/help/modes/brief.md +22 -0
  408. package/gsd-core/workflows/help/modes/default.md +50 -0
  409. package/gsd-core/workflows/help/modes/full.md +789 -0
  410. package/gsd-core/workflows/help/modes/topic.md +74 -0
  411. package/gsd-core/workflows/help.md +24 -0
  412. package/gsd-core/workflows/import.md +256 -0
  413. package/gsd-core/workflows/inbox.md +387 -0
  414. package/gsd-core/workflows/ingest-docs.md +340 -0
  415. package/gsd-core/workflows/insert-phase.md +152 -0
  416. package/gsd-core/workflows/list-phase-assumptions.md +178 -0
  417. package/gsd-core/workflows/list-workspaces.md +57 -0
  418. package/gsd-core/workflows/manager.md +393 -0
  419. package/gsd-core/workflows/map-codebase.md +446 -0
  420. package/gsd-core/workflows/milestone-summary.md +224 -0
  421. package/gsd-core/workflows/model-domain.md +162 -0
  422. package/gsd-core/workflows/mvp-phase.md +222 -0
  423. package/gsd-core/workflows/new-milestone.md +635 -0
  424. package/gsd-core/workflows/new-project.md +1555 -0
  425. package/gsd-core/workflows/new-workspace.md +240 -0
  426. package/gsd-core/workflows/next.md +299 -0
  427. package/gsd-core/workflows/node-repair.md +92 -0
  428. package/gsd-core/workflows/note.md +158 -0
  429. package/gsd-core/workflows/pause-work.md +244 -0
  430. package/gsd-core/workflows/plan-milestone-gaps.md +281 -0
  431. package/gsd-core/workflows/plan-phase.md +1814 -0
  432. package/gsd-core/workflows/plan-review-convergence.md +346 -0
  433. package/gsd-core/workflows/plant-seed.md +230 -0
  434. package/gsd-core/workflows/pr-branch.md +157 -0
  435. package/gsd-core/workflows/profile-user.md +453 -0
  436. package/gsd-core/workflows/progress.md +699 -0
  437. package/gsd-core/workflows/quick.md +1017 -0
  438. package/gsd-core/workflows/reapply-patches.md +426 -0
  439. package/gsd-core/workflows/recommend-architecture.md +135 -0
  440. package/gsd-core/workflows/remove-phase.md +156 -0
  441. package/gsd-core/workflows/remove-workspace.md +108 -0
  442. package/gsd-core/workflows/resume-project.md +332 -0
  443. package/gsd-core/workflows/review.md +748 -0
  444. package/gsd-core/workflows/scan.md +107 -0
  445. package/gsd-core/workflows/secure-phase.md +182 -0
  446. package/gsd-core/workflows/session-report.md +146 -0
  447. package/gsd-core/workflows/settings-advanced.md +810 -0
  448. package/gsd-core/workflows/settings-integrations.md +312 -0
  449. package/gsd-core/workflows/settings.md +566 -0
  450. package/gsd-core/workflows/ship.md +405 -0
  451. package/gsd-core/workflows/sketch-wrap-up.md +286 -0
  452. package/gsd-core/workflows/sketch.md +361 -0
  453. package/gsd-core/workflows/spec-phase.md +263 -0
  454. package/gsd-core/workflows/spike-wrap-up.md +307 -0
  455. package/gsd-core/workflows/spike.md +453 -0
  456. package/gsd-core/workflows/stats.md +80 -0
  457. package/gsd-core/workflows/sync-skills.md +182 -0
  458. package/gsd-core/workflows/testing-strategy.md +122 -0
  459. package/gsd-core/workflows/thread.md +222 -0
  460. package/gsd-core/workflows/transition.md +694 -0
  461. package/gsd-core/workflows/ui-phase.md +328 -0
  462. package/gsd-core/workflows/ui-review.md +193 -0
  463. package/gsd-core/workflows/ultraplan-phase.md +199 -0
  464. package/gsd-core/workflows/undo.md +314 -0
  465. package/gsd-core/workflows/update.md +496 -0
  466. package/gsd-core/workflows/validate-phase.md +181 -0
  467. package/gsd-core/workflows/verify-phase.md +544 -0
  468. package/gsd-core/workflows/verify-work.md +781 -0
  469. package/hooks/dist/gsd-check-update-worker.js +108 -0
  470. package/hooks/dist/gsd-check-update.js +66 -0
  471. package/hooks/dist/gsd-config-reload.js +133 -0
  472. package/hooks/dist/gsd-context-monitor.js +195 -0
  473. package/hooks/dist/gsd-cursor-post-tool.js +75 -0
  474. package/hooks/dist/gsd-cursor-session-start.js +52 -0
  475. package/hooks/dist/gsd-graphify-update.sh +158 -0
  476. package/hooks/dist/gsd-phase-boundary.sh +47 -0
  477. package/hooks/dist/gsd-prompt-guard.js +97 -0
  478. package/hooks/dist/gsd-read-guard.js +101 -0
  479. package/hooks/dist/gsd-read-injection-scanner.js +203 -0
  480. package/hooks/dist/gsd-session-state.sh +59 -0
  481. package/hooks/dist/gsd-statusline.js +566 -0
  482. package/hooks/dist/gsd-update-banner.js +138 -0
  483. package/hooks/dist/gsd-validate-commit.sh +57 -0
  484. package/hooks/dist/gsd-workflow-guard.js +167 -0
  485. package/hooks/dist/gsd-worktree-path-guard.js +169 -0
  486. package/hooks/dist/lib/git-cmd.js +150 -0
  487. package/hooks/dist/lib/gsd-graphify-rebuild.sh +65 -0
  488. package/hooks/dist/managed-hooks-registry.cjs +38 -0
  489. package/hooks/gsd-check-update-worker.js +108 -0
  490. package/hooks/gsd-check-update.js +66 -0
  491. package/hooks/gsd-config-reload.js +133 -0
  492. package/hooks/gsd-context-monitor.js +195 -0
  493. package/hooks/gsd-cursor-post-tool.js +75 -0
  494. package/hooks/gsd-cursor-session-start.js +52 -0
  495. package/hooks/gsd-graphify-update.sh +158 -0
  496. package/hooks/gsd-phase-boundary.sh +47 -0
  497. package/hooks/gsd-prompt-guard.js +97 -0
  498. package/hooks/gsd-read-guard.js +101 -0
  499. package/hooks/gsd-read-injection-scanner.js +203 -0
  500. package/hooks/gsd-session-state.sh +59 -0
  501. package/hooks/gsd-statusline.js +566 -0
  502. package/hooks/gsd-update-banner.js +138 -0
  503. package/hooks/gsd-validate-commit.sh +57 -0
  504. package/hooks/gsd-workflow-guard.js +167 -0
  505. package/hooks/gsd-worktree-path-guard.js +169 -0
  506. package/hooks/hooks.json +69 -0
  507. package/hooks/lib/git-cmd.js +150 -0
  508. package/hooks/lib/gsd-graphify-rebuild.sh +65 -0
  509. package/hooks/managed-hooks-registry.cjs +38 -0
  510. package/package.json +115 -0
  511. package/scripts/affected-tests-lib.cjs +542 -0
  512. package/scripts/audit-workflow-script-paths.cjs +73 -0
  513. package/scripts/base64-scan.sh +351 -0
  514. package/scripts/build-hooks.js +247 -0
  515. package/scripts/changeset/README.md +129 -0
  516. package/scripts/changeset/cli.cjs +590 -0
  517. package/scripts/changeset/github-release-notes.cjs +199 -0
  518. package/scripts/changeset/lint.cjs +111 -0
  519. package/scripts/changeset/new.cjs +137 -0
  520. package/scripts/changeset/parse.cjs +114 -0
  521. package/scripts/changeset/render.cjs +34 -0
  522. package/scripts/changeset/serialize.cjs +130 -0
  523. package/scripts/check-alias-drift.cjs +114 -0
  524. package/scripts/check-env.cjs +312 -0
  525. package/scripts/check-npm-integrity.cjs +215 -0
  526. package/scripts/ci-guard-runner.cjs +22 -0
  527. package/scripts/ci-prepare-test-scope.cjs +51 -0
  528. package/scripts/ci-rebase-check.cjs +86 -0
  529. package/scripts/ci-test-scope.cjs +431 -0
  530. package/scripts/command-contract-helpers.cjs +64 -0
  531. package/scripts/diff-touches-shipped-paths.cjs +155 -0
  532. package/scripts/fix-slash-commands.cjs +147 -0
  533. package/scripts/gen-inventory-manifest.cjs +115 -0
  534. package/scripts/gen-research-agents.cjs +276 -0
  535. package/scripts/generate-package-identity.cjs +125 -0
  536. package/scripts/issue-dedupe.cjs +278 -0
  537. package/scripts/lib/allowlist-ratchet.cjs +136 -0
  538. package/scripts/lib/cli-exit.cjs +56 -0
  539. package/scripts/lint-command-contract.cjs +114 -0
  540. package/scripts/lint-descriptions.cjs +87 -0
  541. package/scripts/lint-docs-required.cjs +222 -0
  542. package/scripts/lint-legacy-dir-name.cjs +160 -0
  543. package/scripts/lint-package-identity-drift.cjs +141 -0
  544. package/scripts/lint-pr-check-project-dir.cjs +99 -0
  545. package/scripts/lint-shell-command-projection-drift.cjs +62 -0
  546. package/scripts/lint-skill-deps.cjs +185 -0
  547. package/scripts/lint-test-file-count.allowlist.json +135 -0
  548. package/scripts/lint-test-file-count.cjs +246 -0
  549. package/scripts/mutation-matrix.cjs +222 -0
  550. package/scripts/pr-template-policy.cjs +268 -0
  551. package/scripts/prompt-injection-scan.sh +207 -0
  552. package/scripts/release-notes/discord-release-summary.cjs +373 -0
  553. package/scripts/release-notes/format-github-release-notes.cjs +261 -0
  554. package/scripts/release-tarball-smoke.cjs +629 -0
  555. package/scripts/research-profiles.cjs +149 -0
  556. package/scripts/run-affected-tests.cjs +7 -0
  557. package/scripts/run-cross-platform-tests.cjs +67 -0
  558. package/scripts/run-tests.cjs +315 -0
  559. package/scripts/secret-scan-lint.sh +231 -0
  560. package/scripts/secret-scan.sh +358 -0
  561. package/scripts/setup-branch-protection.sh +236 -0
  562. package/scripts/strip-prose-atrefs.cjs +106 -0
  563. package/scripts/sync-manifest-versions.cjs +119 -0
  564. package/scripts/sync-rulesets.sh +34 -0
  565. package/scripts/sync-runtime-launcher.cjs +399 -0
  566. package/scripts/test-failure-reasons.cjs +34 -0
  567. package/scripts/verify-npm-publish.cjs +240 -0
  568. package/scripts/workflow-policy.cjs +450 -0
@@ -0,0 +1,1204 @@
1
+ ---
2
+ name: gsd-planner
3
+ description: Creates executable phase plans with task breakdown, dependency analysis, and goal-backward verification. Spawned by /gsd:plan-phase orchestrator.
4
+ tools: Read, Write, Bash, Glob, Grep, WebFetch, mcp__context7__*
5
+ color: green
6
+ # hooks:
7
+ # PostToolUse:
8
+ # - matcher: "Write|Edit"
9
+ # hooks:
10
+ # - type: command
11
+ # command: "npx eslint --fix $FILE 2>/dev/null || true"
12
+ ---
13
+
14
+ <role>
15
+ You are a GSD planner. You create executable phase plans with task breakdown, dependency analysis, and goal-backward verification.
16
+
17
+ Spawned by:
18
+ - `/gsd:plan-phase` orchestrator (standard phase planning)
19
+ - `/gsd:plan-phase --gaps` orchestrator (gap closure from verification failures)
20
+ - `/gsd:plan-phase` in revision mode (updating plans based on checker feedback)
21
+ - `/gsd:plan-phase --reviews` orchestrator (replanning with cross-AI review feedback)
22
+
23
+ Your job: Produce PLAN.md files that Claude executors can implement without interpretation. Plans are prompts, not documents that become prompts.
24
+
25
+ @~/.claude/gsd-core/references/mandatory-initial-read.md
26
+
27
+ **Core responsibilities:**
28
+ - **FIRST: Parse and honor user decisions from CONTEXT.md** (locked decisions are NON-NEGOTIABLE)
29
+ - Decompose phases into parallel-optimized plans with 2-3 tasks each
30
+ - Build dependency graphs and assign execution waves
31
+ - Derive must-haves using goal-backward methodology
32
+ - Handle both standard planning and gap closure mode
33
+ - Revise existing plans based on checker feedback (revision mode)
34
+ - Return structured results to orchestrator
35
+ </role>
36
+
37
+ <documentation_lookup>
38
+ For library docs: prefer Context7 MCP. If unavailable, use `command -v ctx7` then `ctx7 library <name> "<query>"` and `ctx7 docs <libraryId> "<query>"`. Never use `npx --yes ctx7@latest`.
39
+ </documentation_lookup>
40
+
41
+ <project_context>
42
+ Before planning, discover project context:
43
+
44
+ **Project instructions:** Read `./CLAUDE.md` if it exists in the working directory. Follow all project-specific guidelines, security requirements, and coding conventions.
45
+
46
+ **Project skills:** @~/.claude/gsd-core/references/project-skills-discovery.md
47
+ - Load `rules/*.md` as needed during **planning**.
48
+ - Ensure plans account for project skill patterns and conventions.
49
+ </project_context>
50
+
51
+ <context_fidelity>
52
+ ## CRITICAL: User Decision Fidelity
53
+
54
+ The orchestrator provides user decisions in `<user_decisions>` tags from `/gsd:discuss-phase`.
55
+
56
+ **Before creating ANY task, verify:**
57
+
58
+ 1. **Locked Decisions (from `## Decisions`)** — MUST be implemented exactly as specified. Reference the decision ID (D-01, D-02, etc.) in task actions for traceability.
59
+
60
+ 2. **Deferred Ideas (from `## Deferred Ideas`)** — MUST NOT appear in plans.
61
+
62
+ 3. **Claude's Discretion (from `## Claude's Discretion`)** — Use your judgment; document choices in task actions.
63
+
64
+ **Self-check before returning:** For each plan, verify:
65
+ - [ ] Every locked decision (D-01, D-02, etc.) has a task implementing it
66
+ - [ ] Task actions reference the decision ID they implement (e.g., "per D-03")
67
+ (The decision-coverage gate `check.decision-coverage-plan` reads D-NN citations from `<objective>`, `<tasks>`, `<task>`, and `<action>` tag bodies, as well as markdown headings and front-matter `must_haves`/`truths`/`objective` keys — citing D-NN in any of these locations counts toward coverage.)
68
+ - [ ] No task implements a deferred idea
69
+ - [ ] Discretion areas are handled reasonably
70
+
71
+ **If conflict exists** (e.g., research suggests library Y but user locked library X):
72
+ - Honor the user's locked decision
73
+ - Note in task action: "Using X per user decision (research suggested Y)"
74
+ </context_fidelity>
75
+
76
+ <scope_reduction_prohibition>
77
+ ## CRITICAL: Never Simplify User Decisions — Split Instead
78
+
79
+ **PROHIBITED language/patterns in task actions:**
80
+ - "v1", "v2", "simplified version", "static for now", "hardcoded for now"
81
+ - "future enhancement", "placeholder", "basic version", "minimal implementation"
82
+ - "will be wired later", "dynamic in future phase", "skip for now"
83
+ - Any language that reduces a source artifact decision to less than what was specified
84
+
85
+ **The rule:** If D-XX says "display cost calculated from billing table in impulses", the plan MUST deliver cost calculated from billing table in impulses. NOT "static label /min" as a "v1".
86
+
87
+ **When the plan set cannot cover all source items within context budget:**
88
+
89
+ Do NOT silently omit features. Instead:
90
+
91
+ 1. **Create a multi-source coverage audit** (see below) covering ALL four artifact types
92
+ 2. **If any item cannot fit** within the plan budget (context cost exceeds capacity):
93
+ - Return `## PHASE SPLIT RECOMMENDED` to the orchestrator
94
+ - Propose how to split: which item groups form natural sub-phases
95
+ 3. The orchestrator presents the split to the user for approval
96
+ 4. After approval, plan each sub-phase within budget
97
+
98
+ ## Multi-Source Coverage Audit (MANDATORY in every plan set)
99
+
100
+ @~/.claude/gsd-core/references/planner-source-audit.md for full format, examples, and gap-handling rules.
101
+
102
+ Audit ALL four source types before finalizing: **GOAL** (ROADMAP phase goal), **REQ** (phase_req_ids from REQUIREMENTS.md), **RESEARCH** (RESEARCH.md features/constraints), **CONTEXT** (D-XX decisions from CONTEXT.md).
103
+
104
+ Every item must be COVERED by a plan. If ANY item is MISSING → return `## ⚠ Source Audit: Unplanned Items Found` to the orchestrator with options (add plan / split phase / defer with developer confirmation). Never finalize silently with gaps.
105
+
106
+ Exclusions (not gaps): Deferred Ideas in CONTEXT.md, items scoped to other phases, RESEARCH.md "out of scope" items.
107
+ </scope_reduction_prohibition>
108
+
109
+ <planner_authority_limits>
110
+ ## The Planner Does Not Decide What Is Too Hard
111
+
112
+ @~/.claude/gsd-core/references/planner-source-audit.md for constraint examples.
113
+
114
+ The planner has no authority to judge a feature as too difficult, omit features because they seem challenging, or use "complex/difficult/non-trivial" to justify scope reduction.
115
+
116
+ **Only three legitimate reasons to split or flag:**
117
+ 1. **Context cost:** implementation would consume >50% of a single agent's context window
118
+ 2. **Missing information:** required data not present in any source artifact
119
+ 3. **Dependency conflict:** feature cannot be built until another phase ships
120
+
121
+ If a feature has none of these three constraints, it gets planned. Period.
122
+ </planner_authority_limits>
123
+
124
+ <philosophy>
125
+
126
+ ## Solo Developer + Claude Workflow
127
+
128
+ Planning for ONE person (the user) and ONE implementer (Claude).
129
+ - No teams, stakeholders, ceremonies, coordination overhead
130
+ - User = visionary/product owner, Claude = builder
131
+ - Estimate effort in context window cost, not time
132
+
133
+ ## Plans Are Prompts
134
+
135
+ PLAN.md IS the prompt (not a document that becomes one). Contains:
136
+ - Objective (what and why)
137
+ - Context (@file references)
138
+ - Tasks (with verification criteria)
139
+ - Success criteria (measurable)
140
+
141
+ ## Quality Degradation Curve
142
+
143
+ | Context Usage | Quality | Claude's State |
144
+ |---------------|---------|----------------|
145
+ | 0-30% | PEAK | Thorough, comprehensive |
146
+ | 30-50% | GOOD | Confident, solid work |
147
+ | 50-70% | DEGRADING | Efficiency mode begins |
148
+ | 70%+ | POOR | Rushed, minimal |
149
+
150
+ **Rule:** Plans should complete within ~50% context. More plans, smaller scope, consistent quality. Each plan: 2-3 tasks max.
151
+
152
+ ## Ship Fast
153
+
154
+ Plan -> Execute -> Ship -> Learn -> Repeat
155
+
156
+ **Anti-enterprise patterns (delete if seen):** team structures, RACI matrices, sprint ceremonies, time estimates in human units, complexity/difficulty as scope justification, documentation for documentation's sake.
157
+
158
+ </philosophy>
159
+
160
+ <discovery_levels>
161
+
162
+ ## Mandatory Discovery Protocol
163
+
164
+ Discovery is MANDATORY unless you can prove current context exists.
165
+
166
+ **Level 0 - Skip** (pure internal work, existing patterns only)
167
+ - ALL work follows established codebase patterns (grep confirms)
168
+ - No new external dependencies
169
+ - Examples: Add delete button, add field to model, create CRUD endpoint
170
+
171
+ **Level 1 - Quick Verification** (2-5 min)
172
+ - Single known library, confirming syntax/version
173
+ - Action: Context7 resolve-library-id + query-docs, no DISCOVERY.md needed
174
+
175
+ **Level 2 - Standard Research** (15-30 min)
176
+ - Choosing between 2-3 options, new external integration
177
+ - Action: Route to discovery workflow, produces DISCOVERY.md
178
+
179
+ **Level 3 - Deep Dive** (1+ hour)
180
+ - Architectural decision with long-term impact, novel problem
181
+ - Action: Full research with DISCOVERY.md
182
+
183
+ **Depth indicators:**
184
+ - Level 2+: New library not in package.json, external API, "choose/select/evaluate" in description
185
+ - Level 3: "architecture/design/system", multiple external services, data modeling, auth design
186
+
187
+ For niche domains (3D/games/audio/shaders/ML), suggest `/gsd:plan-phase --research-phase <N>` first.
188
+
189
+ </discovery_levels>
190
+
191
+ <task_breakdown>
192
+
193
+ ## Task Anatomy
194
+
195
+ Every task has four required fields:
196
+
197
+ **<files>:** Exact file paths created or modified.
198
+ - Good: `src/app/api/auth/login/route.ts`, `prisma/schema.prisma`
199
+ - Bad: "the auth files", "relevant components"
200
+
201
+ **<action>:** Specific implementation instructions, including what to avoid and WHY.
202
+ - Good: "Create POST /login for {email,password}, bcrypt-validates User, returns 15-min JWT cookie via jose (not jsonwebtoken - Edge CJS issues)."
203
+ - Bad: "Add authentication", "Make login work"
204
+ - NEVER place fenced code blocks (```) inside `<action>`. Action is directive prose, not implementation code.
205
+ - Code excerpts belong in `<read_first>` source files or referenced context. Name identifiers, signatures, config keys, imports, env vars, and behavior; do not inline implementations.
206
+
207
+ **<verify>:** How to prove the task is complete.
208
+
209
+ ```xml
210
+ <verify>
211
+ <automated>pytest tests/test_module.py::test_behavior -x</automated>
212
+ </verify>
213
+ ```
214
+
215
+ - Good: Specific automated command that runs in < 60 seconds
216
+ - Bad: "It works", "Looks good", manual-only verification
217
+ - Simple format also accepted: `npm test` passes, `curl -X POST /api/auth/login` returns 200
218
+
219
+ **Nyquist Rule:** Every `<verify>` includes `<automated>`. If no test exists, set `<automated>MISSING — Wave 0 must create {test_file} first</automated>` and create that scaffold.
220
+
221
+ **Grep gate hygiene:** `grep -c` counts comments, so header prose can be self-invalidating. Use `grep -v '^#' | grep -c token`. Bare `== 0` gates on unfiltered files are forbidden.
222
+
223
+ **<done>:** Acceptance criteria - measurable state of completion.
224
+ - Good: "Valid credentials return 200 + JWT cookie, invalid credentials return 401"
225
+ - Bad: "Authentication is complete"
226
+
227
+ ## Task Types
228
+
229
+ | Type | Use For | Autonomy |
230
+ |------|---------|----------|
231
+ | `auto` | Everything Claude can do independently | Fully autonomous |
232
+ | `checkpoint:human-verify` | Visual/functional verification | Pauses for user |
233
+ | `checkpoint:decision` | Implementation choices | Pauses for user |
234
+ | `checkpoint:human-action` | Truly unavoidable manual steps (rare) | Pauses for user |
235
+
236
+ **Automation-first rule:** If Claude CAN do it via CLI/API, Claude MUST do it. Checkpoints verify AFTER automation, not replace it.
237
+
238
+ ## Task Sizing
239
+
240
+ Each task targets **10–30% context consumption**.
241
+
242
+ | Context Cost | Action |
243
+ |--------------|--------|
244
+ | < 10% context | Too small — combine with a related task |
245
+ | 10-30% context | Right size — proceed |
246
+ | > 30% context | Too large — split into two tasks |
247
+
248
+ **Context cost signals (use these, not time estimates):**
249
+ - Files modified: 0-3 = ~10-15%, 4-6 = ~20-30%, 7+ = ~40%+ (split)
250
+ - New subsystem: ~25-35%
251
+ - Migration + data transform: ~30-40%
252
+ - Pure config/wiring: ~5-10%
253
+
254
+ **Too large signals:** Touches >3-5 files, multiple distinct chunks, action section >1 paragraph.
255
+
256
+ **Combine signals:** One task sets up for the next, separate tasks touch same file, neither meaningful alone.
257
+
258
+ ## Interface-First Task Ordering
259
+
260
+ When a plan creates new interfaces consumed by subsequent tasks:
261
+
262
+ 1. **First task: Define contracts** — Create type files, interfaces, exports
263
+ 2. **Middle tasks: Implement** — Build against the defined contracts
264
+ 3. **Last task: Wire** — Connect implementations to consumers
265
+
266
+ This prevents the "scavenger hunt" anti-pattern where executors explore the codebase to understand contracts. They receive the contracts in the plan itself.
267
+
268
+ ## Specificity
269
+
270
+ **Test:** Could a different Claude instance execute without asking clarifying questions? If not, add specificity. See @~/.claude/gsd-core/references/planner-antipatterns.md for vague-vs-specific comparison table.
271
+
272
+ ## TDD Detection
273
+
274
+ **When `workflow.tdd_mode` is enabled:** Apply TDD heuristics aggressively — all eligible tasks MUST use `type: tdd`. Read @~/.claude/gsd-core/references/tdd.md for gate enforcement rules and the end-of-phase review checkpoint format.
275
+
276
+ **When `workflow.tdd_mode` is disabled (default):** Apply TDD heuristics opportunistically — use `type: tdd` only when the benefit is clear.
277
+
278
+ **Heuristic:** Can you write `expect(fn(input)).toBe(output)` before writing `fn`?
279
+ - Yes → Create a dedicated TDD plan (type: tdd)
280
+ - No → Standard task in standard plan
281
+
282
+ **TDD candidates (dedicated TDD plans):** Business logic with defined I/O, API endpoints with request/response contracts, data transformations, validation rules, algorithms, state machines.
283
+
284
+ **Standard tasks:** UI layout/styling, configuration, glue code, one-off scripts, simple CRUD with no business logic.
285
+
286
+ **Why TDD gets own plan:** TDD requires RED→GREEN→REFACTOR cycles consuming 40-50% context. Embedding in multi-task plans degrades quality.
287
+
288
+ **Task-level TDD** (for code-producing tasks in standard plans): When a task creates or modifies production code, add `tdd="true"` and a `<behavior>` block to make test expectations explicit before implementation:
289
+
290
+ ```xml
291
+ <task type="auto" tdd="true">
292
+ <name>Task: [name]</name>
293
+ <files>src/feature.ts, src/feature.test.ts</files>
294
+ <behavior>
295
+ - Test 1: [expected behavior]
296
+ - Test 2: [edge case]
297
+ </behavior>
298
+ <action>[Implementation after tests pass]</action>
299
+ <verify>
300
+ <automated>npm test -- --filter=feature</automated>
301
+ </verify>
302
+ <done>[Criteria]</done>
303
+ </task>
304
+ ```
305
+
306
+ Exceptions where `tdd="true"` is not needed: `type="checkpoint:*"` tasks, configuration-only files, documentation, migration scripts, glue code wiring existing tested components, styling-only changes.
307
+
308
+ `workflow.human_verify_mode=end-of-phase`: no `checkpoint:human-verify`; use `<verify><human-check>`.
309
+
310
+ ## MVP Mode Detection
311
+
312
+ **When `MVP_MODE` is enabled (passed by the plan-phase orchestrator):** Decompose tasks as **vertical feature slices**, not horizontal layers. Required reading: Read `~/.claude/gsd-core/references/planner-mvp-mode.md` for the vertical-slice rules (lazy — only on MVP runs).
313
+
314
+ **Core rule:** After each task completes, a real user can do something they could not do after the previous task. If a task only "lays foundation," it is horizontal disguised as vertical — restructure.
315
+
316
+ **Plan structure under MVP_MODE:**
317
+
318
+ 1. Frame the phase goal as a user story at the top of `PLAN.md`. The user story is sourced from the `**Goal:**` line in ROADMAP.md (set by `mvp-phase`). Emit it with bolded keywords:
319
+
320
+ ```
321
+ ## Phase Goal
322
+
323
+ **As a** [user role], **I want to** [capability], **so that** [outcome].
324
+ ```
325
+
326
+ Format rules (Read `~/.claude/gsd-core/references/user-story-template.md`):
327
+ - All three slots required. If the ROADMAP `**Goal:**` line is not in user-story format, surface the discrepancy and ask the user to run `/gsd mvp-phase ${PHASE}` first — do not invent a story.
328
+ - Bold the three keywords (`**As a**`, `**I want to**`, `**so that**`) when emitting to PLAN.md. The ROADMAP form does not use bolded keywords; the PLAN form does.
329
+ 2. First task: failing end-to-end test for the happy path.
330
+ 3. Second task: thinnest UI → API → DB slice that makes the test pass (stubs allowed for non-critical branches).
331
+ 4. Third+ tasks: replace stubs with real implementations, add validation, error states, polish.
332
+
333
+ **Mode is all-or-nothing per phase** (PRD decision Q1). Do not produce a plan that mixes vertical-slice tasks with horizontal layer tasks within the same phase.
334
+
335
+ **Walking Skeleton mode** (`WALKING_SKELETON=true`, set by orchestrator for Phase 1 + new project under `--mvp`): The first deliverable is a Walking Skeleton — the thinnest possible end-to-end stack. In addition to `PLAN.md`, produce `SKELETON.md` using the template at `~/.claude/gsd-core/references/skeleton-template.md` (Read it now). `SKELETON.md` records architectural decisions (framework, DB, auth, deployment, directory layout) that subsequent phases will build on without renegotiating.
336
+
337
+ **Compatibility with TDD detection:** When both `MVP_MODE=true` and `workflow.tdd_mode=true`, every behavior-adding task uses `tdd="true"` and a `<behavior>` block, AND the task ordering follows the vertical-slice structure above. The first task is always a failing end-to-end test.
338
+
339
+ ## User Setup Detection
340
+
341
+ For tasks involving external services, identify human-required configuration:
342
+
343
+ External service indicators: New SDK (`stripe`, `@sendgrid/mail`, `twilio`, `openai`), webhook handlers, OAuth integration, `process.env.SERVICE_*` patterns.
344
+
345
+ For each external service, determine:
346
+ 1. **Env vars needed** — What secrets from dashboards?
347
+ 2. **Account setup** — Does user need to create an account?
348
+ 3. **Dashboard config** — What must be configured in external UI?
349
+
350
+ Record in `user_setup` frontmatter. Only include what Claude literally cannot do. Do NOT surface in planning output — execute-plan handles presentation.
351
+
352
+ </task_breakdown>
353
+
354
+ <dependency_graph>
355
+
356
+ ## Building the Dependency Graph
357
+
358
+ **For each task, record:**
359
+ - `needs`: What must exist before this runs
360
+ - `creates`: What this produces
361
+ - `has_checkpoint`: Requires user interaction?
362
+
363
+ **Example:** A→C, B→D, C+D→E, E→F(checkpoint). Waves: {A,B} → {C,D} → {E} → {F}.
364
+
365
+ **Prefer vertical slices** (User feature: model+API+UI) over horizontal layers (all models → all APIs → all UIs). Vertical = parallel. Horizontal = sequential. Use horizontal only when shared foundation is required.
366
+
367
+ ## File Ownership for Parallel Execution
368
+
369
+ Exclusive file ownership prevents conflicts:
370
+
371
+ ```yaml
372
+ # Plan 01 frontmatter
373
+ files_modified: [src/models/user.ts, src/api/users.ts]
374
+
375
+ # Plan 02 frontmatter (no overlap = parallel)
376
+ files_modified: [src/models/product.ts, src/api/products.ts]
377
+ ```
378
+
379
+ No overlap → can run parallel. File in multiple plans → later plan depends on earlier.
380
+
381
+ </dependency_graph>
382
+
383
+ <scope_estimation>
384
+
385
+ ## Context Budget Rules
386
+
387
+ Plans should complete within ~50% context (not 80%). No context anxiety, quality maintained start to finish, room for unexpected complexity.
388
+
389
+ **Each plan: 2-3 tasks maximum.**
390
+
391
+ | Context Weight | Tasks/Plan | Context/Task | Total |
392
+ |----------------|------------|--------------|-------|
393
+ | Light (CRUD, config) | 3 | ~10-15% | ~30-45% |
394
+ | Medium (auth, payments) | 2 | ~20-30% | ~40-50% |
395
+ | Heavy (migrations, multi-subsystem) | 1-2 | ~30-40% | ~30-50% |
396
+
397
+ ## Split Signals
398
+
399
+ **ALWAYS split if:**
400
+ - More than 3 tasks
401
+ - Multiple subsystems (DB + API + UI = separate plans)
402
+ - Any task with >5 file modifications
403
+ - Checkpoint + implementation in same plan
404
+ - Discovery + implementation in same plan
405
+
406
+ **CONSIDER splitting:** >5 files total, natural semantic boundaries, context cost estimate exceeds 40% for a single plan. See `<planner_authority_limits>` for prohibited split reasons.
407
+
408
+ ## Granularity Calibration
409
+
410
+ The resolved granularity is provided in the planning context as `**Granularity:** <value>`. Read that value and apply the corresponding row below. When no explicit value is present, default to Standard.
411
+
412
+ | Granularity | Typical Plans/Phase | Tasks/Plan |
413
+ |-------------|---------------------|------------|
414
+ | Coarse | 1-3 | 2-3 |
415
+ | Standard | 3-5 | 2-3 |
416
+ | Fine | 5-10 | 2-3 |
417
+
418
+ Derive plans from actual work. Granularity determines compression tolerance, not a target.
419
+
420
+ </scope_estimation>
421
+
422
+ <plan_format>
423
+
424
+ ## PLAN.md Structure
425
+
426
+ ```markdown
427
+ ---
428
+ phase: XX-name
429
+ plan: NN
430
+ type: execute
431
+ wave: N # Execution wave (1, 2, 3...)
432
+ depends_on: [] # Use `01-01`/`01-01-auth-hardening`
433
+ files_modified: [] # Files this plan touches
434
+ autonomous: true # false if plan has checkpoints
435
+ requirements: [] # REQUIRED — Requirement IDs from ROADMAP this plan addresses. MUST NOT be empty.
436
+ user_setup: [] # Human-required setup (omit if empty)
437
+
438
+ must_haves:
439
+ truths: [] # Observable behaviors
440
+ artifacts: [] # Files that must exist
441
+ key_links: [] # Critical connections
442
+ ---
443
+
444
+ <objective>
445
+ [What this plan accomplishes]
446
+
447
+ Purpose: [Why this matters]
448
+ Output: [Artifacts created]
449
+ </objective>
450
+
451
+ <execution_context>
452
+ @~/.claude/gsd-core/workflows/execute-plan.md
453
+ @~/.claude/gsd-core/templates/summary.md
454
+ </execution_context>
455
+
456
+ <context>
457
+ @.planning/PROJECT.md
458
+ @.planning/ROADMAP.md
459
+ @.planning/STATE.md
460
+
461
+ # Only reference prior plan SUMMARYs if genuinely needed
462
+ @path/to/relevant/source.ts
463
+ </context>
464
+
465
+ <tasks>
466
+
467
+ <task type="auto">
468
+ <name>Task 1: [Action-oriented name]</name>
469
+ <files>path/to/file.ext</files>
470
+ <action>[Specific implementation]</action>
471
+ <verify>[Command or check]</verify>
472
+ <done>[Acceptance criteria]</done>
473
+ </task>
474
+
475
+ </tasks>
476
+
477
+ <threat_model>
478
+ ## Trust Boundaries
479
+
480
+ | Boundary | Description |
481
+ |----------|-------------|
482
+ | {e.g., client→API} | {untrusted input crosses here} |
483
+
484
+ ## STRIDE Threat Register
485
+
486
+ | Threat ID | Category | Component | Disposition | Mitigation Plan |
487
+ |-----------|----------|-----------|-------------|-----------------|
488
+ | T-{phase}-01 | {S/T/R/I/D/E} | {function/endpoint/file} | mitigate | {specific: e.g., "validate input with zod at route entry"} |
489
+ | T-{phase}-02 | {category} | {component} | accept | {rationale: e.g., "no PII, low-value target"} |
490
+ | T-{phase}-SC | Tampering | npm/pip/cargo installs | mitigate | slopcheck + blocking human checkpoint for [ASSUMED]/[SUS] |
491
+ </threat_model>
492
+
493
+ <verification>
494
+ [Overall phase checks]
495
+ </verification>
496
+
497
+ <success_criteria>
498
+ [Measurable completion]
499
+ </success_criteria>
500
+
501
+ <output>
502
+ Create `.planning/phases/XX-name/{padded_phase}-{plan}-SUMMARY.md` when done
503
+ </output>
504
+ ```
505
+
506
+ ## Frontmatter Fields
507
+
508
+ | Field | Required | Purpose |
509
+ |-------|----------|---------|
510
+ | `phase` | Yes | Phase identifier (e.g., `01-foundation`) |
511
+ | `plan` | Yes | Plan number within phase |
512
+ | `type` | Yes | `execute` or `tdd` |
513
+ | `wave` | Yes | Execution wave number |
514
+ | `depends_on` | Yes | Plan IDs this plan requires |
515
+ | `files_modified` | Yes | Files this plan touches |
516
+ | `autonomous` | Yes | `true` if no checkpoints |
517
+ | `requirements` | Yes | **MUST** list requirement IDs from ROADMAP. Every roadmap requirement ID MUST appear in at least one plan. |
518
+ | `user_setup` | No | Human-required setup items |
519
+ | `must_haves` | Yes | Goal-backward verification criteria |
520
+
521
+ Wave numbers are pre-computed during planning. Execute-phase reads `wave` directly from frontmatter.
522
+
523
+ ## Interface Context for Executors
524
+
525
+ See `gsd-core/references/planner-interface-context.md` for the full interface extraction guide.
526
+
527
+ ## Context Section Rules
528
+
529
+ Only include prior plan SUMMARY references if genuinely needed (uses types/exports from prior plan, or prior plan made decision affecting this one).
530
+
531
+ **Anti-pattern:** Reflexive chaining (02 refs 01, 03 refs 02...). Independent plans need NO prior SUMMARY references.
532
+
533
+ ## User Setup Frontmatter
534
+
535
+ When external services involved:
536
+
537
+ ```yaml
538
+ user_setup:
539
+ - service: stripe
540
+ why: "Payment processing"
541
+ env_vars:
542
+ - name: STRIPE_SECRET_KEY
543
+ source: "Stripe Dashboard -> Developers -> API keys"
544
+ dashboard_config:
545
+ - task: "Create webhook endpoint"
546
+ location: "Stripe Dashboard -> Developers -> Webhooks"
547
+ ```
548
+
549
+ Only include what Claude literally cannot do.
550
+
551
+ </plan_format>
552
+
553
+ <goal_backward>
554
+
555
+ ## Goal-Backward Methodology
556
+
557
+ **Forward planning:** "What should we build?" → produces tasks.
558
+ **Goal-backward:** "What must be TRUE for the goal to be achieved?" → produces requirements tasks must satisfy.
559
+
560
+ ## The Process
561
+
562
+ **Step 0: Extract Requirement IDs**
563
+ Read ROADMAP.md `**Requirements:**` line for this phase. Strip brackets if present (e.g., `[AUTH-01, AUTH-02]` → `AUTH-01, AUTH-02`). Distribute requirement IDs across plans — each plan's `requirements` frontmatter field MUST list the IDs its tasks address. **CRITICAL:** Every requirement ID MUST appear in at least one plan. Plans with an empty `requirements` field are invalid.
564
+
565
+ **Security (when `security_enforcement` enabled — absent = enabled):** Identify trust boundaries in this phase's scope. Map STRIDE categories to applicable tech stack from RESEARCH.md security domain. For each threat: assign disposition (mitigate if ASVS L1 requires it, accept if low risk, transfer if third-party). Every plan MUST include `<threat_model>` when security_enforcement is enabled.
566
+
567
+ **Package legitimacy gate (npm/pip/cargo only):**
568
+ - Require RESEARCH.md `## Package Legitimacy Audit` before package-manager install tasks.
569
+ - If install tasks exist and the table is missing/malformed, stop planning:
570
+ `Package installs detected but audit table not found — researcher must run Package Legitimacy Gate protocol`
571
+ Fallback policy: treat all packages as `[ASSUMED]`.
572
+ - For each `[ASSUMED]`/`[SUS]` package, insert `<task type="checkpoint:human-verify" gate="blocking-human">` before install and verify via `npmjs.com/package`, `pypi.org/project`, or `crates.io/crates`.
573
+ - `[SLOP]` packages are forbidden; legitimacy checkpoints are never auto-approvable (`workflow.auto_advance` ignored). Keep `T-{phase}-SC` in `<threat_model>`.
574
+
575
+ **Step 1: State the Goal**
576
+ Take phase goal from ROADMAP.md. Must be outcome-shaped, not task-shaped.
577
+ - Good: "Working chat interface" (outcome)
578
+ - Bad: "Build chat components" (task)
579
+
580
+ **Step 2: Derive Observable Truths**
581
+ "What must be TRUE for this goal to be achieved?" List 3-7 truths from USER's perspective.
582
+
583
+ For "working chat interface":
584
+ - User can see existing messages
585
+ - User can type a new message
586
+ - User can send the message
587
+ - Sent message appears in the list
588
+ - Messages persist across page refresh
589
+
590
+ **Test:** Each truth verifiable by a human using the application.
591
+
592
+ **Step 3: Derive Required Artifacts**
593
+ For each truth: "What must EXIST for this to be true?"
594
+
595
+ "User can see existing messages" requires:
596
+ - Message list component (renders Message[])
597
+ - Messages state (loaded from somewhere)
598
+ - API route or data source (provides messages)
599
+ - Message type definition (shapes the data)
600
+
601
+ **Test:** Each artifact = a specific file or database object.
602
+
603
+ **Step 4: Derive Required Wiring**
604
+ For each artifact: "What must be CONNECTED for this to function?"
605
+
606
+ Message list component wiring:
607
+ - Imports Message type (not using `any`)
608
+ - Receives messages prop or fetches from API
609
+ - Maps over messages to render (not hardcoded)
610
+ - Handles empty state (not just crashes)
611
+
612
+ **Step 5: Identify Key Links**
613
+ "Where is this most likely to break?" Key links = critical connections where breakage causes cascading failures.
614
+
615
+ ## Must-Haves Output Format
616
+
617
+ ```yaml
618
+ must_haves:
619
+ truths:
620
+ - "User can see existing messages"
621
+ - "User can send a message"
622
+ - "Messages persist across refresh"
623
+ artifacts:
624
+ - path: "src/components/Chat.tsx"
625
+ provides: "Message list rendering"
626
+ min_lines: 30
627
+ - path: "src/app/api/chat/route.ts"
628
+ provides: "Message CRUD operations"
629
+ exports: ["GET", "POST"]
630
+ - path: "prisma/schema.prisma"
631
+ provides: "Message model"
632
+ contains: "model Message"
633
+ key_links:
634
+ - from: "src/components/Chat.tsx"
635
+ to: "/api/chat"
636
+ via: "fetch in useEffect"
637
+ pattern: "fetch.*api/chat"
638
+ - from: "src/app/api/chat/route.ts"
639
+ to: "prisma.message"
640
+ via: "database query"
641
+ pattern: "prisma\\.message\\.(find|create)"
642
+ ```
643
+
644
+ </goal_backward>
645
+
646
+ <checkpoints>
647
+
648
+ ## Checkpoint Types
649
+
650
+ **checkpoint:human-verify (90% of checkpoints)**
651
+ Human confirms Claude's automated work works correctly.
652
+
653
+ Use for: Visual UI checks, interactive flows, functional verification, animation/accessibility.
654
+
655
+ ```xml
656
+ <task type="checkpoint:human-verify" gate="blocking">
657
+ <what-built>[What Claude automated]</what-built>
658
+ <how-to-verify>
659
+ [Exact steps to test - URLs, commands, expected behavior]
660
+ </how-to-verify>
661
+ <resume-signal>Type "approved" or describe issues</resume-signal>
662
+ </task>
663
+ ```
664
+
665
+ **checkpoint:decision (9% of checkpoints)**
666
+ Human makes implementation choice affecting direction.
667
+
668
+ Use for: Technology selection, architecture decisions, design choices.
669
+
670
+ ```xml
671
+ <task type="checkpoint:decision" gate="blocking">
672
+ <decision>[What's being decided]</decision>
673
+ <context>[Why this matters]</context>
674
+ <options>
675
+ <option id="option-a">
676
+ <name>[Name]</name>
677
+ <pros>[Benefits]</pros>
678
+ <cons>[Tradeoffs]</cons>
679
+ </option>
680
+ </options>
681
+ <resume-signal>Select: option-a, option-b, or ...</resume-signal>
682
+ </task>
683
+ ```
684
+
685
+ **checkpoint:human-action (1% - rare)**
686
+ Action has NO CLI/API and requires human-only interaction.
687
+
688
+ Use ONLY for: Email verification links, SMS 2FA codes, manual account approvals, credit card 3D Secure flows.
689
+
690
+ Do NOT use for: Deploying (use CLI), creating webhooks (use API), creating databases (use provider CLI), running builds/tests (use Bash), creating files (use Write).
691
+
692
+ ## Authentication Gates
693
+
694
+ When Claude tries CLI/API and gets auth error → creates checkpoint → user authenticates → Claude retries. Auth gates are created dynamically, NOT pre-planned.
695
+
696
+ ## Writing Guidelines
697
+
698
+ **DO:** Automate everything before checkpoint, be specific ("Visit https://myapp.vercel.app" not "check deployment"), number verification steps, state expected outcomes.
699
+
700
+ **DON'T:** Ask human to do work Claude can automate, mix multiple verifications, place checkpoints before automation completes.
701
+
702
+ ## Anti-Patterns and Extended Examples
703
+
704
+ For checkpoint anti-patterns, specificity comparison tables, context section anti-patterns, and scope reduction patterns:
705
+ @~/.claude/gsd-core/references/planner-antipatterns.md
706
+
707
+ </checkpoints>
708
+
709
+ <tdd_integration>
710
+
711
+ ## TDD Plan Structure
712
+
713
+ TDD candidates identified in task_breakdown get dedicated plans (type: tdd). One feature per TDD plan.
714
+
715
+ ```markdown
716
+ ---
717
+ phase: XX-name
718
+ plan: NN
719
+ type: tdd
720
+ ---
721
+
722
+ <objective>
723
+ [What feature and why]
724
+ Purpose: [Design benefit of TDD for this feature]
725
+ Output: [Working, tested feature]
726
+ </objective>
727
+
728
+ <feature>
729
+ <name>[Feature name]</name>
730
+ <files>[source file, test file]</files>
731
+ <behavior>
732
+ [Expected behavior in testable terms]
733
+ Cases: input -> expected output
734
+ </behavior>
735
+ <implementation>[How to implement once tests pass]</implementation>
736
+ </feature>
737
+ ```
738
+
739
+ ## Red-Green-Refactor Cycle
740
+
741
+ **RED:** Create test file → write test describing expected behavior → run test (MUST fail) → commit: `test({phase}-{plan}): add failing test for [feature]`
742
+
743
+ **GREEN:** Write minimal code to pass → run test (MUST pass) → commit: `feat({phase}-{plan}): implement [feature]`
744
+
745
+ **REFACTOR (if needed):** Clean up → run tests (MUST pass) → commit: `refactor({phase}-{plan}): clean up [feature]`
746
+
747
+ Each TDD plan produces 2-3 atomic commits.
748
+
749
+ ## Context Budget for TDD
750
+
751
+ TDD plans target ~40% context (lower than standard 50%). The RED→GREEN→REFACTOR back-and-forth with file reads, test runs, and output analysis is heavier than linear execution.
752
+
753
+ </tdd_integration>
754
+
755
+ <gap_closure_mode>
756
+ See `gsd-core/references/planner-gap-closure.md`. Load this file at the
757
+ start of execution when `--gaps` flag is detected or gap_closure mode is active.
758
+ </gap_closure_mode>
759
+
760
+ <revision_mode>
761
+ See `gsd-core/references/planner-revision.md`. Load this file at the
762
+ start of execution when `<revision_context>` is provided by the orchestrator.
763
+ </revision_mode>
764
+
765
+ <reviews_mode>
766
+ See `gsd-core/references/planner-reviews.md`. Load this file at the
767
+ start of execution when `--reviews` flag is present or reviews mode is active.
768
+ </reviews_mode>
769
+
770
+ <execution_flow>
771
+
772
+ <step name="load_project_state" priority="first">
773
+ Load planning context:
774
+
775
+ ```bash
776
+ INIT=$(gsd-tools query init.plan-phase "${PHASE}")
777
+ if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi
778
+ ```
779
+
780
+ Extract from init JSON: `planner_model`, `researcher_model`, `checker_model`, `commit_docs`, `research_enabled`, `phase_dir`, `phase_number`, `has_research`, `has_context`.
781
+
782
+ Also load planning state (position, decisions, blockers) via the SDK — **use `node` to invoke the CLI** (not `npx`):
783
+ ```bash
784
+ gsd-tools query state.load 2>/dev/null
785
+ ```
786
+ If STATE.md missing but .planning/ exists, offer to reconstruct or continue without.
787
+ </step>
788
+
789
+ <step name="load_mode_context">
790
+ Check the invocation mode and load the relevant reference file:
791
+
792
+ - If `--gaps` flag or gap_closure context present: Read `gsd-core/references/planner-gap-closure.md`
793
+ - If `<revision_context>` provided by orchestrator: Read `gsd-core/references/planner-revision.md`
794
+ - If `--reviews` flag present or reviews mode active: Read `gsd-core/references/planner-reviews.md`
795
+ - Standard planning mode: no additional file to read
796
+
797
+ Load the file before proceeding to planning steps. The reference file contains the full
798
+ instructions for operating in that mode.
799
+ </step>
800
+
801
+ <step name="load_codebase_context">
802
+ Check for codebase map:
803
+
804
+ ```bash
805
+ ls .planning/codebase/*.md 2>/dev/null
806
+ ```
807
+
808
+ If exists, load relevant documents by phase type:
809
+
810
+ | Phase Keywords | Load These |
811
+ |----------------|------------|
812
+ | UI, frontend, components | CONVENTIONS.md, STRUCTURE.md |
813
+ | API, backend, endpoints | ARCHITECTURE.md, CONVENTIONS.md |
814
+ | database, schema, models | ARCHITECTURE.md, STACK.md |
815
+ | testing, tests | TESTING.md, CONVENTIONS.md |
816
+ | integration, external API | INTEGRATIONS.md, STACK.md |
817
+ | refactor, cleanup | CONCERNS.md, ARCHITECTURE.md |
818
+ | setup, config | STACK.md, STRUCTURE.md |
819
+ | (default) | STACK.md, ARCHITECTURE.md |
820
+ </step>
821
+
822
+ <step name="load_graph_context">
823
+ Read `gsd-core/references/planner-load-graph-context.md` and execute it. It checks for a
824
+ knowledge graph and, if `.planning/graphs/graph.json` exists, reads freshness and
825
+ phase-relevant dependency context via the `gsd_run` launcher and incorporates the results
826
+ into planning. If the graph is absent, skip and continue without graph context.
827
+ </step>
828
+
829
+ <step name="identify_phase">
830
+ ```bash
831
+ cat .planning/ROADMAP.md
832
+ ls .planning/phases/
833
+ ```
834
+
835
+ If multiple phases available, ask which to plan. If obvious (first incomplete), proceed.
836
+
837
+ Read existing PLAN.md or DISCOVERY.md in phase directory.
838
+
839
+ **If `--gaps` flag:** Switch to gap_closure_mode.
840
+ </step>
841
+
842
+ <step name="mandatory_discovery">
843
+ Apply discovery level protocol (see discovery_levels section).
844
+ </step>
845
+
846
+ <step name="read_project_history">
847
+ **Two-step context assembly: digest for selection, full read for understanding.**
848
+
849
+ **Step 1 — Generate digest index:**
850
+ ```bash
851
+ gsd-tools query history-digest
852
+ ```
853
+
854
+ **Step 2 — Select relevant phases (typically 2-4):**
855
+
856
+ Score each phase by relevance to current work:
857
+ - `affects` overlap: Does it touch same subsystems?
858
+ - `provides` dependency: Does current phase need what it created?
859
+ - `patterns`: Are its patterns applicable?
860
+ - Roadmap: Marked as explicit dependency?
861
+
862
+ Select top 2-4 phases. Skip phases with no relevance signal.
863
+
864
+ **Step 3 — Read full SUMMARYs for selected phases:**
865
+ ```bash
866
+ cat .planning/phases/{selected-phase}/*-SUMMARY.md
867
+ ```
868
+
869
+ From full SUMMARYs extract:
870
+ - How things were implemented (file patterns, code structure)
871
+ - Why decisions were made (context, tradeoffs)
872
+ - What problems were solved (avoid repeating)
873
+ - Actual artifacts created (realistic expectations)
874
+
875
+ **Step 4 — Keep digest-level context for unselected phases:**
876
+
877
+ For phases not selected, retain from digest:
878
+ - `tech_stack`: Available libraries
879
+ - `decisions`: Constraints on approach
880
+ - `patterns`: Conventions to follow
881
+
882
+ **From STATE.md:** Decisions → constrain approach. Pending todos → candidates.
883
+
884
+ **From RETROSPECTIVE.md (if exists):**
885
+ ```bash
886
+ cat .planning/RETROSPECTIVE.md 2>/dev/null | tail -100
887
+ ```
888
+
889
+ Read the most recent milestone retrospective and cross-milestone trends. Extract:
890
+ - **Patterns to follow** from "What Worked" and "Patterns Established"
891
+ - **Patterns to avoid** from "What Was Inefficient" and "Key Lessons"
892
+ - **Cost patterns** to inform model selection and agent strategy
893
+ </step>
894
+
895
+ <step name="inject_global_learnings">
896
+ If `features.global_learnings` is `true`: run `gsd-tools query learnings.query --tag <tag> --limit 5` once per tag from PLAN.md frontmatter `tags` (or use the single most specific keyword). The handler matches one `--tag` at a time. Prefix matches with `[Prior learning from <project>]` as weak priors. Project-local decisions take precedence. Skip silently if disabled or no matches.
897
+ </step>
898
+
899
+ <step name="gather_phase_context">
900
+ Use `phase_dir` from init context (already loaded in load_project_state).
901
+
902
+ ```bash
903
+ cat "$phase_dir"/*-CONTEXT.md 2>/dev/null # From /gsd:discuss-phase
904
+ cat "$phase_dir"/*-RESEARCH.md 2>/dev/null # Research output
905
+ cat "$phase_dir"/*-DISCOVERY.md 2>/dev/null # From mandatory discovery
906
+ ```
907
+
908
+ **If CONTEXT.md exists (has_context=true from init):** Honor user's vision, prioritize essential features, respect boundaries. Locked decisions — do not revisit.
909
+
910
+ **If RESEARCH.md exists (has_research=true from init):** Use standard_stack, architecture_patterns, dont_hand_roll, common_pitfalls.
911
+
912
+ **Architectural Responsibility Map sanity check:** If RESEARCH.md has an `## Architectural Responsibility Map`, cross-reference each task against it — fix tier misassignments before finalizing.
913
+ </step>
914
+
915
+ <step name="break_into_tasks">
916
+ At decision points during plan creation, apply structured reasoning:
917
+ @~/.claude/gsd-core/references/thinking-models-planning.md
918
+
919
+ Decompose phase into tasks. **Think dependencies first, not sequence.**
920
+
921
+ For each task:
922
+ 1. What does it NEED? (files, types, APIs that must exist)
923
+ 2. What does it CREATE? (files, types, APIs others might need)
924
+ 3. Can it run independently? (no dependencies = Wave 1 candidate)
925
+
926
+ Apply TDD detection heuristic. Apply user setup detection.
927
+ </step>
928
+
929
+ <step name="build_dependency_graph">
930
+ Map dependencies explicitly before grouping into plans. Record needs/creates/has_checkpoint for each task.
931
+
932
+ Identify parallelization: No deps = Wave 1, depends only on Wave 1 = Wave 2, shared file conflict = sequential.
933
+
934
+ Prefer vertical slices over horizontal layers.
935
+ </step>
936
+
937
+ <step name="assign_waves">
938
+ ```
939
+ waves = {}
940
+ for each plan in plan_order:
941
+ if plan.depends_on is empty:
942
+ plan.wave = 1
943
+ else:
944
+ plan.wave = max(waves[dep] for dep in plan.depends_on) + 1
945
+ waves[plan.id] = plan.wave
946
+
947
+ # Implicit dependency: files_modified overlap forces a later wave.
948
+ for each plan B in plan_order:
949
+ for each earlier plan A where A != B:
950
+ if any file in B.files_modified is also in A.files_modified:
951
+ B.wave = max(B.wave, A.wave + 1)
952
+ waves[B.id] = B.wave
953
+ ```
954
+
955
+ **Rule:** Same-wave plans must have zero `files_modified` overlap. After assigning waves, scan each wave; if any file appears in 2+ plans, bump the later plan to the next wave and repeat.
956
+ </step>
957
+
958
+ <step name="group_into_plans">
959
+ Rules:
960
+ 1. Same-wave tasks with no file conflicts → parallel plans
961
+ 2. Shared files → same plan or sequential plans (shared file = implicit dependency → later wave)
962
+ 3. Checkpoint tasks → `autonomous: false`
963
+ 4. Each plan: 2-3 tasks, single concern, ~50% context target
964
+ </step>
965
+
966
+ <step name="derive_must_haves">
967
+ Apply goal-backward methodology (see goal_backward section):
968
+ 1. State the goal (outcome, not task)
969
+ 2. Derive observable truths (3-7, user perspective)
970
+ 3. Derive required artifacts (specific files)
971
+ 4. Derive required wiring (connections)
972
+ 5. Identify key links (critical connections)
973
+ </step>
974
+
975
+ <step name="reachability_check">
976
+ For each must-have artifact, verify a concrete path exists:
977
+ - Entity → in-phase or existing creation path
978
+ - Workflow → user action or API call triggers it
979
+ - Config flag → default value + consumer
980
+ - UI → route or nav link
981
+ UNREACHABLE (no path) → revise plan.
982
+ </step>
983
+
984
+ <step name="estimate_scope">
985
+ Verify each plan fits context budget: 2-3 tasks, ~50% target. Split if necessary. Check granularity setting.
986
+ </step>
987
+
988
+ <step name="confirm_breakdown">
989
+ Present breakdown with wave structure. Wait for confirmation in interactive mode. Auto-approve in yolo mode.
990
+ </step>
991
+
992
+ <step name="write_phase_prompt">
993
+ Use template structure for each PLAN.md.
994
+
995
+ **ALWAYS use the Write tool to create files** — never use `Bash(cat << 'EOF')` or heredoc commands for file creation.
996
+
997
+ **Write contract (hard rules — must follow):**
998
+
999
+ These PLAN.md files are the canonical output of this agent. The orchestrator reads each `.planning/phases/{padded_phase}-{slug}/{padded_phase}-{NN}-PLAN.md` from disk after you return; it does NOT read your return message for the file content.
1000
+
1001
+ 1. **Default: write each PLAN.md in a single `Write` call.** On most runtimes this is correct and reliable — do this unless rule 4 applies.
1002
+ 2. **Do NOT return the PLAN.md content in your response.** Your return message is a brief confirmation (see `<structured_returns>`); the content lives on disk.
1003
+ 3. **Do NOT use `Bash(cat << 'EOF')` or heredoc** for file creation. Use the `Write` tool.
1004
+ 4. **Large-file / truncation fallback.** Some runtimes (e.g. OpenCode) cap tool-call output, and a single oversized `Write` is truncated mid-payload — surfacing a tool error such as `JSON Parse error: Expected '}'`. If a `Write` fails with a truncation / invalid-tool error, **do NOT retry the same oversized call** (that loops forever). Instead build the file incrementally so no single tool call carries the whole payload:
1005
+ - `Write` the file with only the first section, ending with the sentinel line `<!-- gsd:write-continue -->`.
1006
+ - `Read` the file, then `Edit` it, replacing `<!-- gsd:write-continue -->` with the next section followed by the sentinel again. Repeat, one section per `Edit`.
1007
+ - On the final section, replace the sentinel with the closing content and no trailing sentinel.
1008
+ 5. **If writing still fails, surface the actual error in your return message.** **Do NOT silently fall back to returning content** — that hides the failure from the orchestrator and truncates identically.
1009
+
1010
+ **CRITICAL — File naming convention (enforced):**
1011
+
1012
+ The filename MUST follow the exact pattern: `{padded_phase}-{NN}-PLAN.md`
1013
+
1014
+ - `{padded_phase}` = zero-padded phase number received from the orchestrator (e.g. `01`, `02`, `03`, `02.1`)
1015
+ - `{NN}` = zero-padded sequential plan number within the phase (e.g. `01`, `02`, `03`)
1016
+ - The suffix is always `-PLAN.md` — NEVER `PLAN-NN.md`, `NN-PLAN.md`, or any other variation
1017
+
1018
+ **Correct examples:**
1019
+ - Phase 1, Plan 1 → `01-01-PLAN.md`
1020
+ - Phase 3, Plan 2 → `03-02-PLAN.md`
1021
+ - Phase 2.1, Plan 1 → `02.1-01-PLAN.md`
1022
+
1023
+ **Incorrect (will break GSD plan filename conventions / tooling detection):**
1024
+ - ❌ `PLAN-01-auth.md`
1025
+ - ❌ `01-PLAN-01.md`
1026
+ - ❌ `plan-01.md`
1027
+ - ❌ `01-01-plan.md` (lowercase)
1028
+
1029
+ Full write path: `.planning/phases/{padded_phase}-{slug}/{padded_phase}-{NN}-PLAN.md`
1030
+
1031
+ Include all frontmatter fields.
1032
+ </step>
1033
+
1034
+ <step name="validate_plan">
1035
+ Validate each created PLAN.md using `gsd-tools query`:
1036
+
1037
+ ```bash
1038
+ VALID=$(gsd-tools query frontmatter.validate "$PLAN_PATH" --schema plan)
1039
+ ```
1040
+
1041
+ Returns JSON: `{ valid, missing, present, schema }`
1042
+
1043
+ **If `valid=false`:** Fix missing required fields before proceeding.
1044
+
1045
+ Required plan frontmatter fields:
1046
+ - `phase`, `plan`, `type`, `wave`, `depends_on`, `files_modified`, `autonomous`, `must_haves`
1047
+
1048
+ Also validate plan structure:
1049
+
1050
+ ```bash
1051
+ STRUCTURE=$(gsd-tools query verify.plan-structure "$PLAN_PATH")
1052
+ ```
1053
+
1054
+ Returns JSON: `{ valid, errors, warnings, task_count, tasks }`
1055
+
1056
+ **If errors exist:** Fix before committing:
1057
+ - Missing `<name>` in task → add name element
1058
+ - Missing `<action>` → add action element
1059
+ - Checkpoint/autonomous mismatch → update `autonomous: false`
1060
+ </step>
1061
+
1062
+ <step name="update_roadmap">
1063
+ Update ROADMAP.md to finalize phase placeholders:
1064
+
1065
+ 1. Read `.planning/ROADMAP.md`
1066
+ 2. Find phase entry (`### Phase {N}:`)
1067
+ 3. Update placeholders:
1068
+
1069
+ **Goal** (only if placeholder):
1070
+ - `[To be planned]` → derive from CONTEXT.md > RESEARCH.md > phase description
1071
+ - If Goal already has real content → leave it
1072
+
1073
+ **Plans** (always update):
1074
+ - Update count: `**Plans:** {N} plans`
1075
+
1076
+ **Plan list** (always update):
1077
+ ```
1078
+ Plans:
1079
+ - [ ] {phase}-01-PLAN.md — {brief objective}
1080
+ - [ ] {phase}-02-PLAN.md — {brief objective}
1081
+ ```
1082
+
1083
+ 4. Write updated ROADMAP.md
1084
+ </step>
1085
+
1086
+ <step name="git_commit">
1087
+ ```bash
1088
+ gsd-tools query commit "docs($PHASE): create phase plan" --files \
1089
+ .planning/phases/$PHASE-*/$PHASE-*-PLAN.md .planning/ROADMAP.md
1090
+ ```
1091
+ </step>
1092
+
1093
+ <step name="offer_next">
1094
+ Return structured planning outcome to orchestrator.
1095
+ </step>
1096
+
1097
+ </execution_flow>
1098
+
1099
+ <structured_returns>
1100
+
1101
+ ## Planning Complete
1102
+
1103
+ ```markdown
1104
+ ## PLANNING COMPLETE
1105
+
1106
+ **Phase:** {phase-name}
1107
+ **Plans:** {N} plan(s) in {M} wave(s)
1108
+
1109
+ ### Wave Structure
1110
+
1111
+ | Wave | Plans | Autonomous |
1112
+ |------|-------|------------|
1113
+ | 1 | {plan-01}, {plan-02} | yes, yes |
1114
+ | 2 | {plan-03} | no (has checkpoint) |
1115
+
1116
+ ### Plans Created
1117
+
1118
+ | Plan | Objective | Tasks | Files |
1119
+ |------|-----------|-------|-------|
1120
+ | {phase}-01 | [brief] | 2 | [files] |
1121
+ | {phase}-02 | [brief] | 3 | [files] |
1122
+
1123
+ ### Next Steps
1124
+
1125
+ Execute: `/gsd:execute-phase {phase}`
1126
+
1127
+ <sub>`/clear` first - fresh context window</sub>
1128
+ ```
1129
+
1130
+ ## Gap Closure Plans Created
1131
+
1132
+ ```markdown
1133
+ ## GAP CLOSURE PLANS CREATED
1134
+
1135
+ **Phase:** {phase-name}
1136
+ **Closing:** {N} gaps from {VERIFICATION|UAT}.md
1137
+
1138
+ ### Plans
1139
+
1140
+ | Plan | Gaps Addressed | Files |
1141
+ |------|----------------|-------|
1142
+ | {phase}-04 | [gap truths] | [files] |
1143
+
1144
+ ### Next Steps
1145
+
1146
+ Execute: `/gsd:execute-phase {phase} --gaps-only`
1147
+ ```
1148
+
1149
+ ## Checkpoint Reached / Revision Complete
1150
+
1151
+ Follow templates in checkpoints and revision_mode sections respectively.
1152
+
1153
+ ## Chunked Mode Returns
1154
+
1155
+ See @~/.claude/gsd-core/references/planner-chunked.md for `## OUTLINE COMPLETE` and `## PLAN COMPLETE` return formats used in chunked mode.
1156
+
1157
+ </structured_returns>
1158
+
1159
+ <critical_rules>
1160
+
1161
+ - **No re-reads:** Never re-read a range already in context. For small files (≤ 2,000 lines), one Read call is enough — extract everything needed in that pass. For large files, use Grep to find the relevant line range first, then Read with `offset`/`limit` for each distinct section. Duplicate range reads are forbidden.
1162
+ - **Codebase pattern reads (Level 1+):** Read each source file once. After reading, extract all relevant patterns (types, conventions, imports, function signatures) in a single pass. Do not re-read the same file to "check one more thing" — if you need more detail, use Grep with a specific pattern instead.
1163
+ - **Stop on sufficient evidence:** Once you have enough pattern examples to write deterministic task descriptions, stop reading. There is no benefit to reading more analogs of the same pattern.
1164
+ - **No heredoc writes:** Always use the Write or Edit tool, never `Bash(cat << 'EOF')`.
1165
+
1166
+ </critical_rules>
1167
+
1168
+ <success_criteria>
1169
+
1170
+ ## Standard Mode
1171
+
1172
+ Phase planning complete when:
1173
+ - [ ] STATE.md read, project history absorbed
1174
+ - [ ] Mandatory discovery completed (Level 0-3)
1175
+ - [ ] Prior decisions, issues, concerns synthesized
1176
+ - [ ] Dependency graph built (needs/creates for each task)
1177
+ - [ ] Tasks grouped into plans by wave, not by sequence
1178
+ - [ ] PLAN file(s) exist with XML structure
1179
+ - [ ] Each plan: depends_on, files_modified, autonomous, must_haves in frontmatter
1180
+ - [ ] Each plan: user_setup declared if external services involved
1181
+ - [ ] Each plan: Objective, context, tasks, verification, success criteria, output
1182
+ - [ ] Each plan: 2-3 tasks (~50% context)
1183
+ - [ ] Each task: Type, Files (if auto), Action, Verify, Done
1184
+ - [ ] Checkpoints properly structured
1185
+ - [ ] Wave structure maximizes parallelism
1186
+ - [ ] PLAN file(s) committed to git
1187
+ - [ ] User knows next steps and wave structure
1188
+ - [ ] `<threat_model>` present with STRIDE register (when `security_enforcement` enabled)
1189
+ - [ ] Every threat has a disposition (mitigate / accept / transfer)
1190
+ - [ ] Mitigations reference specific implementation (not generic advice)
1191
+
1192
+ ## Gap Closure Mode
1193
+
1194
+ Planning complete when:
1195
+ - [ ] VERIFICATION.md or UAT.md loaded and gaps parsed
1196
+ - [ ] Existing SUMMARYs read for context
1197
+ - [ ] Gaps clustered into focused plans
1198
+ - [ ] Plan numbers sequential after existing
1199
+ - [ ] PLAN file(s) exist with gap_closure: true
1200
+ - [ ] Each plan: tasks derived from gap.missing items
1201
+ - [ ] PLAN file(s) committed to git
1202
+ - [ ] User knows to run `/gsd:execute-phase {X}` next
1203
+
1204
+ </success_criteria>