claude-code-pilot 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (257) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +151 -0
  3. package/bin/install.js +431 -0
  4. package/docs/agent-guides/architecture.md +107 -0
  5. package/ecc/agents/architect.md +211 -0
  6. package/ecc/agents/code-reviewer.md +237 -0
  7. package/ecc/agents/doc-updater.md +107 -0
  8. package/ecc/agents/e2e-runner.md +107 -0
  9. package/ecc/agents/security-reviewer.md +108 -0
  10. package/ecc/agents/tdd-guide.md +91 -0
  11. package/ecc/commands/checkpoint.md +74 -0
  12. package/ecc/commands/evolve.md +178 -0
  13. package/ecc/commands/learn.md +70 -0
  14. package/ecc/commands/model-route.md +26 -0
  15. package/ecc/commands/quality-gate.md +29 -0
  16. package/ecc/commands/resume-session.md +155 -0
  17. package/ecc/commands/save-session.md +275 -0
  18. package/ecc/commands/sessions.md +305 -0
  19. package/ecc/commands/verify.md +59 -0
  20. package/ecc/contexts/dev.md +20 -0
  21. package/ecc/contexts/research.md +26 -0
  22. package/ecc/contexts/review.md +22 -0
  23. package/ecc/examples/CLAUDE.md +100 -0
  24. package/ecc/examples/django-api-CLAUDE.md +308 -0
  25. package/ecc/examples/go-microservice-CLAUDE.md +267 -0
  26. package/ecc/examples/rust-api-CLAUDE.md +285 -0
  27. package/ecc/examples/saas-nextjs-CLAUDE.md +166 -0
  28. package/ecc/examples/user-CLAUDE.md +109 -0
  29. package/ecc/rules/common/agents.md +49 -0
  30. package/ecc/rules/common/coding-style.md +48 -0
  31. package/ecc/rules/common/development-workflow.md +37 -0
  32. package/ecc/rules/common/git-workflow.md +24 -0
  33. package/ecc/rules/common/hooks.md +30 -0
  34. package/ecc/rules/common/patterns.md +31 -0
  35. package/ecc/rules/common/performance.md +55 -0
  36. package/ecc/rules/common/security.md +29 -0
  37. package/ecc/rules/common/testing.md +29 -0
  38. package/ecc/rules/golang/coding-style.md +32 -0
  39. package/ecc/rules/golang/hooks.md +17 -0
  40. package/ecc/rules/golang/patterns.md +45 -0
  41. package/ecc/rules/golang/security.md +34 -0
  42. package/ecc/rules/golang/testing.md +31 -0
  43. package/ecc/rules/kotlin/coding-style.md +86 -0
  44. package/ecc/rules/kotlin/patterns.md +146 -0
  45. package/ecc/rules/kotlin/security.md +82 -0
  46. package/ecc/rules/kotlin/testing.md +128 -0
  47. package/ecc/rules/perl/coding-style.md +46 -0
  48. package/ecc/rules/perl/hooks.md +22 -0
  49. package/ecc/rules/perl/patterns.md +76 -0
  50. package/ecc/rules/perl/security.md +69 -0
  51. package/ecc/rules/perl/testing.md +54 -0
  52. package/ecc/rules/php/coding-style.md +35 -0
  53. package/ecc/rules/php/hooks.md +24 -0
  54. package/ecc/rules/php/patterns.md +32 -0
  55. package/ecc/rules/php/security.md +33 -0
  56. package/ecc/rules/php/testing.md +34 -0
  57. package/ecc/rules/python/coding-style.md +42 -0
  58. package/ecc/rules/python/hooks.md +19 -0
  59. package/ecc/rules/python/patterns.md +39 -0
  60. package/ecc/rules/python/security.md +30 -0
  61. package/ecc/rules/python/testing.md +38 -0
  62. package/ecc/rules/swift/coding-style.md +47 -0
  63. package/ecc/rules/swift/hooks.md +20 -0
  64. package/ecc/rules/swift/patterns.md +66 -0
  65. package/ecc/rules/swift/security.md +33 -0
  66. package/ecc/rules/swift/testing.md +45 -0
  67. package/ecc/rules/typescript/coding-style.md +199 -0
  68. package/ecc/rules/typescript/hooks.md +22 -0
  69. package/ecc/rules/typescript/patterns.md +52 -0
  70. package/ecc/rules/typescript/security.md +28 -0
  71. package/ecc/rules/typescript/testing.md +18 -0
  72. package/ecc/scripts/hooks/check-hook-enabled.js +12 -0
  73. package/ecc/scripts/hooks/evaluate-session.js +100 -0
  74. package/ecc/scripts/hooks/pre-compact.js +48 -0
  75. package/ecc/scripts/hooks/run-with-flags-shell.sh +32 -0
  76. package/ecc/scripts/hooks/run-with-flags.js +120 -0
  77. package/ecc/scripts/hooks/session-end-marker.js +15 -0
  78. package/ecc/scripts/hooks/session-end.js +258 -0
  79. package/ecc/scripts/hooks/session-start.js +97 -0
  80. package/ecc/scripts/hooks/suggest-compact.js +80 -0
  81. package/ecc/scripts/lib/hook-flags.js +74 -0
  82. package/ecc/scripts/lib/package-manager.d.ts +119 -0
  83. package/ecc/scripts/lib/package-manager.js +431 -0
  84. package/ecc/scripts/lib/project-detect.js +428 -0
  85. package/ecc/scripts/lib/resolve-formatter.js +185 -0
  86. package/ecc/scripts/lib/session-aliases.d.ts +136 -0
  87. package/ecc/scripts/lib/session-aliases.js +481 -0
  88. package/ecc/scripts/lib/session-manager.d.ts +131 -0
  89. package/ecc/scripts/lib/session-manager.js +444 -0
  90. package/ecc/scripts/lib/shell-split.js +86 -0
  91. package/ecc/scripts/lib/utils.d.ts +183 -0
  92. package/ecc/scripts/lib/utils.js +543 -0
  93. package/ecc/skills/continuous-learning-v2/SKILL.md +365 -0
  94. package/ecc/skills/continuous-learning-v2/agents/observer-loop.sh +144 -0
  95. package/ecc/skills/continuous-learning-v2/agents/observer.md +198 -0
  96. package/ecc/skills/continuous-learning-v2/agents/start-observer.sh +194 -0
  97. package/ecc/skills/continuous-learning-v2/config.json +8 -0
  98. package/ecc/skills/continuous-learning-v2/hooks/observe.sh +246 -0
  99. package/ecc/skills/continuous-learning-v2/scripts/detect-project.sh +218 -0
  100. package/ecc/skills/continuous-learning-v2/scripts/instinct-cli.py +1148 -0
  101. package/ecc/skills/continuous-learning-v2/scripts/test_parse_instinct.py +984 -0
  102. package/ecc/skills/strategic-compact/SKILL.md +103 -0
  103. package/ecc/skills/strategic-compact/suggest-compact.sh +54 -0
  104. package/ecc/skills/verification-loop-SKILL.md +126 -0
  105. package/gsd/LICENSE +21 -0
  106. package/gsd/agents/gsd-codebase-mapper.md +772 -0
  107. package/gsd/agents/gsd-debugger.md +1257 -0
  108. package/gsd/agents/gsd-executor.md +489 -0
  109. package/gsd/agents/gsd-integration-checker.md +445 -0
  110. package/gsd/agents/gsd-nyquist-auditor.md +178 -0
  111. package/gsd/agents/gsd-phase-researcher.md +555 -0
  112. package/gsd/agents/gsd-plan-checker.md +708 -0
  113. package/gsd/agents/gsd-planner.md +1309 -0
  114. package/gsd/agents/gsd-project-researcher.md +631 -0
  115. package/gsd/agents/gsd-research-synthesizer.md +249 -0
  116. package/gsd/agents/gsd-roadmapper.md +652 -0
  117. package/gsd/agents/gsd-verifier.md +581 -0
  118. package/gsd/commands-gsd/add-phase.md +43 -0
  119. package/gsd/commands-gsd/add-tests.md +41 -0
  120. package/gsd/commands-gsd/add-todo.md +47 -0
  121. package/gsd/commands-gsd/audit-milestone.md +36 -0
  122. package/gsd/commands-gsd/check-todos.md +45 -0
  123. package/gsd/commands-gsd/cleanup.md +18 -0
  124. package/gsd/commands-gsd/complete-milestone.md +136 -0
  125. package/gsd/commands-gsd/debug.md +168 -0
  126. package/gsd/commands-gsd/discuss-phase.md +90 -0
  127. package/gsd/commands-gsd/execute-phase.md +41 -0
  128. package/gsd/commands-gsd/health.md +22 -0
  129. package/gsd/commands-gsd/help.md +22 -0
  130. package/gsd/commands-gsd/insert-phase.md +32 -0
  131. package/gsd/commands-gsd/join-discord.md +18 -0
  132. package/gsd/commands-gsd/list-phase-assumptions.md +46 -0
  133. package/gsd/commands-gsd/map-codebase.md +71 -0
  134. package/gsd/commands-gsd/new-milestone.md +44 -0
  135. package/gsd/commands-gsd/new-project.md +42 -0
  136. package/gsd/commands-gsd/pause-work.md +38 -0
  137. package/gsd/commands-gsd/plan-milestone-gaps.md +34 -0
  138. package/gsd/commands-gsd/plan-phase.md +45 -0
  139. package/gsd/commands-gsd/progress.md +24 -0
  140. package/gsd/commands-gsd/quick.md +45 -0
  141. package/gsd/commands-gsd/reapply-patches.md +123 -0
  142. package/gsd/commands-gsd/remove-phase.md +31 -0
  143. package/gsd/commands-gsd/research-phase.md +190 -0
  144. package/gsd/commands-gsd/resume-work.md +40 -0
  145. package/gsd/commands-gsd/set-profile.md +34 -0
  146. package/gsd/commands-gsd/settings.md +36 -0
  147. package/gsd/commands-gsd/update.md +37 -0
  148. package/gsd/commands-gsd/validate-phase.md +35 -0
  149. package/gsd/commands-gsd/verify-work.md +38 -0
  150. package/gsd/get-shit-done/bin/gsd-tools.cjs +592 -0
  151. package/gsd/get-shit-done/bin/lib/commands.cjs +548 -0
  152. package/gsd/get-shit-done/bin/lib/config.cjs +169 -0
  153. package/gsd/get-shit-done/bin/lib/core.cjs +492 -0
  154. package/gsd/get-shit-done/bin/lib/frontmatter.cjs +299 -0
  155. package/gsd/get-shit-done/bin/lib/init.cjs +710 -0
  156. package/gsd/get-shit-done/bin/lib/milestone.cjs +241 -0
  157. package/gsd/get-shit-done/bin/lib/phase.cjs +901 -0
  158. package/gsd/get-shit-done/bin/lib/roadmap.cjs +298 -0
  159. package/gsd/get-shit-done/bin/lib/state.cjs +721 -0
  160. package/gsd/get-shit-done/bin/lib/template.cjs +222 -0
  161. package/gsd/get-shit-done/bin/lib/verify.cjs +820 -0
  162. package/gsd/get-shit-done/references/checkpoints.md +776 -0
  163. package/gsd/get-shit-done/references/continuation-format.md +249 -0
  164. package/gsd/get-shit-done/references/decimal-phase-calculation.md +65 -0
  165. package/gsd/get-shit-done/references/git-integration.md +248 -0
  166. package/gsd/get-shit-done/references/git-planning-commit.md +38 -0
  167. package/gsd/get-shit-done/references/model-profile-resolution.md +34 -0
  168. package/gsd/get-shit-done/references/model-profiles.md +93 -0
  169. package/gsd/get-shit-done/references/phase-argument-parsing.md +61 -0
  170. package/gsd/get-shit-done/references/planning-config.md +200 -0
  171. package/gsd/get-shit-done/references/questioning.md +162 -0
  172. package/gsd/get-shit-done/references/tdd.md +263 -0
  173. package/gsd/get-shit-done/references/ui-brand.md +160 -0
  174. package/gsd/get-shit-done/references/verification-patterns.md +612 -0
  175. package/gsd/get-shit-done/templates/DEBUG.md +164 -0
  176. package/gsd/get-shit-done/templates/UAT.md +247 -0
  177. package/gsd/get-shit-done/templates/VALIDATION.md +76 -0
  178. package/gsd/get-shit-done/templates/codebase/architecture.md +255 -0
  179. package/gsd/get-shit-done/templates/codebase/concerns.md +310 -0
  180. package/gsd/get-shit-done/templates/codebase/conventions.md +307 -0
  181. package/gsd/get-shit-done/templates/codebase/integrations.md +280 -0
  182. package/gsd/get-shit-done/templates/codebase/stack.md +186 -0
  183. package/gsd/get-shit-done/templates/codebase/structure.md +285 -0
  184. package/gsd/get-shit-done/templates/codebase/testing.md +480 -0
  185. package/gsd/get-shit-done/templates/config.json +37 -0
  186. package/gsd/get-shit-done/templates/context.md +297 -0
  187. package/gsd/get-shit-done/templates/continue-here.md +78 -0
  188. package/gsd/get-shit-done/templates/debug-subagent-prompt.md +91 -0
  189. package/gsd/get-shit-done/templates/discovery.md +146 -0
  190. package/gsd/get-shit-done/templates/milestone-archive.md +123 -0
  191. package/gsd/get-shit-done/templates/milestone.md +115 -0
  192. package/gsd/get-shit-done/templates/phase-prompt.md +569 -0
  193. package/gsd/get-shit-done/templates/planner-subagent-prompt.md +117 -0
  194. package/gsd/get-shit-done/templates/project.md +184 -0
  195. package/gsd/get-shit-done/templates/requirements.md +231 -0
  196. package/gsd/get-shit-done/templates/research-project/ARCHITECTURE.md +204 -0
  197. package/gsd/get-shit-done/templates/research-project/FEATURES.md +147 -0
  198. package/gsd/get-shit-done/templates/research-project/PITFALLS.md +200 -0
  199. package/gsd/get-shit-done/templates/research-project/STACK.md +120 -0
  200. package/gsd/get-shit-done/templates/research-project/SUMMARY.md +170 -0
  201. package/gsd/get-shit-done/templates/research.md +552 -0
  202. package/gsd/get-shit-done/templates/retrospective.md +54 -0
  203. package/gsd/get-shit-done/templates/roadmap.md +202 -0
  204. package/gsd/get-shit-done/templates/state.md +176 -0
  205. package/gsd/get-shit-done/templates/summary-complex.md +59 -0
  206. package/gsd/get-shit-done/templates/summary-minimal.md +41 -0
  207. package/gsd/get-shit-done/templates/summary-standard.md +48 -0
  208. package/gsd/get-shit-done/templates/summary.md +248 -0
  209. package/gsd/get-shit-done/templates/user-setup.md +311 -0
  210. package/gsd/get-shit-done/templates/verification-report.md +322 -0
  211. package/gsd/get-shit-done/workflows/add-phase.md +112 -0
  212. package/gsd/get-shit-done/workflows/add-tests.md +351 -0
  213. package/gsd/get-shit-done/workflows/add-todo.md +158 -0
  214. package/gsd/get-shit-done/workflows/audit-milestone.md +332 -0
  215. package/gsd/get-shit-done/workflows/check-todos.md +177 -0
  216. package/gsd/get-shit-done/workflows/cleanup.md +152 -0
  217. package/gsd/get-shit-done/workflows/complete-milestone.md +764 -0
  218. package/gsd/get-shit-done/workflows/diagnose-issues.md +219 -0
  219. package/gsd/get-shit-done/workflows/discovery-phase.md +289 -0
  220. package/gsd/get-shit-done/workflows/discuss-phase.md +676 -0
  221. package/gsd/get-shit-done/workflows/execute-phase.md +459 -0
  222. package/gsd/get-shit-done/workflows/execute-plan.md +449 -0
  223. package/gsd/get-shit-done/workflows/health.md +159 -0
  224. package/gsd/get-shit-done/workflows/help.md +489 -0
  225. package/gsd/get-shit-done/workflows/insert-phase.md +130 -0
  226. package/gsd/get-shit-done/workflows/list-phase-assumptions.md +178 -0
  227. package/gsd/get-shit-done/workflows/map-codebase.md +316 -0
  228. package/gsd/get-shit-done/workflows/new-milestone.md +384 -0
  229. package/gsd/get-shit-done/workflows/new-project.md +1111 -0
  230. package/gsd/get-shit-done/workflows/pause-work.md +122 -0
  231. package/gsd/get-shit-done/workflows/plan-milestone-gaps.md +274 -0
  232. package/gsd/get-shit-done/workflows/plan-phase.md +560 -0
  233. package/gsd/get-shit-done/workflows/progress.md +382 -0
  234. package/gsd/get-shit-done/workflows/quick.md +601 -0
  235. package/gsd/get-shit-done/workflows/remove-phase.md +155 -0
  236. package/gsd/get-shit-done/workflows/research-phase.md +74 -0
  237. package/gsd/get-shit-done/workflows/resume-project.md +307 -0
  238. package/gsd/get-shit-done/workflows/set-profile.md +81 -0
  239. package/gsd/get-shit-done/workflows/settings.md +214 -0
  240. package/gsd/get-shit-done/workflows/transition.md +544 -0
  241. package/gsd/get-shit-done/workflows/update.md +240 -0
  242. package/gsd/get-shit-done/workflows/validate-phase.md +167 -0
  243. package/gsd/get-shit-done/workflows/verify-phase.md +243 -0
  244. package/gsd/get-shit-done/workflows/verify-work.md +583 -0
  245. package/gsd/hooks/gsd-check-update.js +81 -0
  246. package/gsd/hooks/gsd-context-monitor.js +141 -0
  247. package/gsd/hooks/gsd-statusline.js +115 -0
  248. package/kit/CLAUDE.md +43 -0
  249. package/kit/commands/kit/update.md +46 -0
  250. package/kit/commands/setup-refresh.md +50 -0
  251. package/kit/commands/setup.md +579 -0
  252. package/kit/commands/tool-guide.md +44 -0
  253. package/kit/hooks/kit-check-update.js +54 -0
  254. package/kit/mcp.json +10 -0
  255. package/kit/rules/code-style.md +24 -0
  256. package/manifest.json +30 -0
  257. package/package.json +36 -0
@@ -0,0 +1,449 @@
1
+ <purpose>
2
+ Execute a phase prompt (PLAN.md) and create the outcome summary (SUMMARY.md).
3
+ </purpose>
4
+
5
+ <required_reading>
6
+ Read STATE.md before any operation to load project context.
7
+ Read config.json for planning behavior settings.
8
+
9
+ @~/.claude/get-shit-done/references/git-integration.md
10
+ </required_reading>
11
+
12
+ <process>
13
+
14
+ <step name="init_context" priority="first">
15
+ Load execution context (paths only to minimize orchestrator context):
16
+
17
+ ```bash
18
+ INIT=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" init execute-phase "${PHASE}")
19
+ if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi
20
+ ```
21
+
22
+ Extract from init JSON: `executor_model`, `commit_docs`, `phase_dir`, `phase_number`, `plans`, `summaries`, `incomplete_plans`, `state_path`, `config_path`.
23
+
24
+ If `.planning/` missing: error.
25
+ </step>
26
+
27
+ <step name="identify_plan">
28
+ ```bash
29
+ # Use plans/summaries from INIT JSON, or list files
30
+ ls .planning/phases/XX-name/*-PLAN.md 2>/dev/null | sort
31
+ ls .planning/phases/XX-name/*-SUMMARY.md 2>/dev/null | sort
32
+ ```
33
+
34
+ Find first PLAN without matching SUMMARY. Decimal phases supported (`01.1-hotfix/`):
35
+
36
+ ```bash
37
+ PHASE=$(echo "$PLAN_PATH" | grep -oE '[0-9]+(\.[0-9]+)?-[0-9]+')
38
+ # config settings can be fetched via gsd-tools config-get if needed
39
+ ```
40
+
41
+ <if mode="yolo">
42
+ Auto-approve: `⚡ Execute {phase}-{plan}-PLAN.md [Plan X of Y for Phase Z]` → parse_segments.
43
+ </if>
44
+
45
+ <if mode="interactive" OR="custom with gates.execute_next_plan true">
46
+ Present plan identification, wait for confirmation.
47
+ </if>
48
+ </step>
49
+
50
+ <step name="record_start_time">
51
+ ```bash
52
+ PLAN_START_TIME=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
53
+ PLAN_START_EPOCH=$(date +%s)
54
+ ```
55
+ </step>
56
+
57
+ <step name="parse_segments">
58
+ ```bash
59
+ grep -n "type=\"checkpoint" .planning/phases/XX-name/{phase}-{plan}-PLAN.md
60
+ ```
61
+
62
+ **Routing by checkpoint type:**
63
+
64
+ | Checkpoints | Pattern | Execution |
65
+ |-------------|---------|-----------|
66
+ | None | A (autonomous) | Single subagent: full plan + SUMMARY + commit |
67
+ | Verify-only | B (segmented) | Segments between checkpoints. After none/human-verify → SUBAGENT. After decision/human-action → MAIN |
68
+ | Decision | C (main) | Execute entirely in main context |
69
+
70
+ **Pattern A:** init_agent_tracking → 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.
71
+
72
+ **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.
73
+
74
+ **Pattern C:** Execute in main using standard flow (step name="execute").
75
+
76
+ Fresh context per subagent preserves peak quality. Main context stays lean.
77
+ </step>
78
+
79
+ <step name="init_agent_tracking">
80
+ ```bash
81
+ if [ ! -f .planning/agent-history.json ]; then
82
+ echo '{"version":"1.0","max_entries":50,"entries":[]}' > .planning/agent-history.json
83
+ fi
84
+ rm -f .planning/current-agent-id.txt
85
+ if [ -f .planning/current-agent-id.txt ]; then
86
+ INTERRUPTED_ID=$(cat .planning/current-agent-id.txt)
87
+ echo "Found interrupted agent: $INTERRUPTED_ID"
88
+ fi
89
+ ```
90
+
91
+ If interrupted: ask user to resume (Task `resume` parameter) or start fresh.
92
+
93
+ **Tracking protocol:** On spawn: write agent_id to `current-agent-id.txt`, append to agent-history.json: `{"agent_id":"[id]","task_description":"[desc]","phase":"[phase]","plan":"[plan]","segment":[num|null],"timestamp":"[ISO]","status":"spawned","completion_timestamp":null}`. On completion: status → "completed", set completion_timestamp, delete current-agent-id.txt. Prune: if entries > max_entries, remove oldest "completed" (never "spawned").
94
+
95
+ Run for Pattern A/B before spawning. Pattern C: skip.
96
+ </step>
97
+
98
+ <step name="segment_execution">
99
+ Pattern B only (verify-only checkpoints). Skip for A/C.
100
+
101
+ 1. Parse segment map: checkpoint locations and types
102
+ 2. Per segment:
103
+ - Subagent route: spawn gsd-executor for assigned tasks only. Prompt: task range, plan path, read full plan for context, execute assigned tasks, track deviations, NO SUMMARY/commit. Track via agent protocol.
104
+ - Main route: execute tasks using standard flow (step name="execute")
105
+ 3. After ALL segments: aggregate files/deviations/decisions → create SUMMARY.md → commit → self-check:
106
+ - Verify key-files.created exist on disk with `[ -f ]`
107
+ - Check `git log --oneline --all --grep="{phase}-{plan}"` returns ≥1 commit
108
+ - Append `## Self-Check: PASSED` or `## Self-Check: FAILED` to SUMMARY
109
+
110
+ **Known Claude Code bug (classifyHandoffIfNeeded):** If any segment agent reports "failed" with `classifyHandoffIfNeeded is not defined`, this is a Claude Code runtime bug — not a real failure. Run spot-checks; if they pass, treat as successful.
111
+
112
+
113
+
114
+
115
+ </step>
116
+
117
+ <step name="load_prompt">
118
+ ```bash
119
+ cat .planning/phases/XX-name/{phase}-{plan}-PLAN.md
120
+ ```
121
+ This IS the execution instructions. Follow exactly. If plan references CONTEXT.md: honor user's vision throughout.
122
+
123
+ **If plan contains `<interfaces>` block:** These are pre-extracted type definitions and contracts. Use them directly — do NOT re-read the source files to discover types. The planner already extracted what you need.
124
+ </step>
125
+
126
+ <step name="previous_phase_check">
127
+ ```bash
128
+ node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" phases list --type summaries --raw
129
+ # Extract the second-to-last summary from the JSON result
130
+ ```
131
+ If previous SUMMARY has unresolved "Issues Encountered" or "Next Phase Readiness" blockers: AskUserQuestion(header="Previous Issues", options: "Proceed anyway" | "Address first" | "Review previous").
132
+ </step>
133
+
134
+ <step name="execute">
135
+ Deviations are normal — handle via rules below.
136
+
137
+ 1. Read @context files from prompt
138
+ 2. Per task:
139
+ - `type="auto"`: if `tdd="true"` → TDD execution. Implement with deviation rules + auth gates. Verify done criteria. Commit (see task_commit). Track hash for Summary.
140
+ - `type="checkpoint:*"`: STOP → checkpoint_protocol → wait for user → continue only after confirmation.
141
+ 3. Run `<verification>` checks
142
+ 4. Confirm `<success_criteria>` met
143
+ 5. Document deviations in Summary
144
+ </step>
145
+
146
+ <authentication_gates>
147
+
148
+ ## Authentication Gates
149
+
150
+ Auth errors during execution are NOT failures — they're expected interaction points.
151
+
152
+ **Indicators:** "Not authenticated", "Unauthorized", 401/403, "Please run {tool} login", "Set {ENV_VAR}"
153
+
154
+ **Protocol:**
155
+ 1. Recognize auth gate (not a bug)
156
+ 2. STOP task execution
157
+ 3. Create dynamic checkpoint:human-action with exact auth steps
158
+ 4. Wait for user to authenticate
159
+ 5. Verify credentials work
160
+ 6. Retry original task
161
+ 7. Continue normally
162
+
163
+ **Example:** `vercel --yes` → "Not authenticated" → checkpoint asking user to `vercel login` → verify with `vercel whoami` → retry deploy → continue
164
+
165
+ **In Summary:** Document as normal flow under "## Authentication Gates", not as deviations.
166
+
167
+ </authentication_gates>
168
+
169
+ <deviation_rules>
170
+
171
+ ## Deviation Rules
172
+
173
+ You WILL discover unplanned work. Apply automatically, track all for Summary.
174
+
175
+ | Rule | Trigger | Action | Permission |
176
+ |------|---------|--------|------------|
177
+ | **1: Bug** | Broken behavior, errors, wrong queries, type errors, security vulns, race conditions, leaks | Fix → test → verify → track `[Rule 1 - Bug]` | Auto |
178
+ | **2: Missing Critical** | Missing essentials: error handling, validation, auth, CSRF/CORS, rate limiting, indexes, logging | Add → test → verify → track `[Rule 2 - Missing Critical]` | Auto |
179
+ | **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 |
180
+ | **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 |
181
+
182
+ **Rule 4 format:**
183
+ ```
184
+ ⚠️ Architectural Decision Needed
185
+
186
+ Current task: [task name]
187
+ Discovery: [what prompted this]
188
+ Proposed change: [modification]
189
+ Why needed: [rationale]
190
+ Impact: [what this affects]
191
+ Alternatives: [other approaches]
192
+
193
+ Proceed with proposed change? (yes / different approach / defer)
194
+ ```
195
+
196
+ **Priority:** Rule 4 (STOP) > Rules 1-3 (auto) > unsure → Rule 4
197
+ **Edge cases:** missing validation → R2 | null crash → R1 | new table → R4 | new column → R1/2
198
+ **Heuristic:** Affects correctness/security/completion? → R1-3. Maybe? → R4.
199
+
200
+ </deviation_rules>
201
+
202
+ <deviation_documentation>
203
+
204
+ ## Documenting Deviations
205
+
206
+ Summary MUST include deviations section. None? → `## Deviations from Plan\n\nNone - plan executed exactly as written.`
207
+
208
+ Per deviation: **[Rule N - Category] Title** — Found during: Task X | Issue | Fix | Files modified | Verification | Commit hash
209
+
210
+ End with: **Total deviations:** N auto-fixed (breakdown). **Impact:** assessment.
211
+
212
+ </deviation_documentation>
213
+
214
+ <tdd_plan_execution>
215
+ ## TDD Execution
216
+
217
+ For `type: tdd` plans — RED-GREEN-REFACTOR:
218
+
219
+ 1. **Infrastructure** (first TDD plan only): detect project, install framework, config, verify empty suite
220
+ 2. **RED:** Read `<behavior>` → failing test(s) → run (MUST fail) → commit: `test({phase}-{plan}): add failing test for [feature]`
221
+ 3. **GREEN:** Read `<implementation>` → minimal code → run (MUST pass) → commit: `feat({phase}-{plan}): implement [feature]`
222
+ 4. **REFACTOR:** Clean up → tests MUST pass → commit: `refactor({phase}-{plan}): clean up [feature]`
223
+
224
+ Errors: RED doesn't fail → investigate test/existing feature. GREEN doesn't pass → debug, iterate. REFACTOR breaks → undo.
225
+
226
+ See `~/.claude/get-shit-done/references/tdd.md` for structure.
227
+ </tdd_plan_execution>
228
+
229
+ <task_commit>
230
+ ## Task Commit Protocol
231
+
232
+ After each task (verification passed, done criteria met), commit immediately.
233
+
234
+ **1. Check:** `git status --short`
235
+
236
+ **2. Stage individually** (NEVER `git add .` or `git add -A`):
237
+ ```bash
238
+ git add src/api/auth.ts
239
+ git add src/types/user.ts
240
+ ```
241
+
242
+ **3. Commit type:**
243
+
244
+ | Type | When | Example |
245
+ |------|------|---------|
246
+ | `feat` | New functionality | feat(08-02): create user registration endpoint |
247
+ | `fix` | Bug fix | fix(08-02): correct email validation regex |
248
+ | `test` | Test-only (TDD RED) | test(08-02): add failing test for password hashing |
249
+ | `refactor` | No behavior change (TDD REFACTOR) | refactor(08-02): extract validation to helper |
250
+ | `perf` | Performance | perf(08-02): add database index |
251
+ | `docs` | Documentation | docs(08-02): add API docs |
252
+ | `style` | Formatting | style(08-02): format auth module |
253
+ | `chore` | Config/deps | chore(08-02): add bcrypt dependency |
254
+
255
+ **4. Format:** `{type}({phase}-{plan}): {description}` with bullet points for key changes.
256
+
257
+ **5. Record hash:**
258
+ ```bash
259
+ TASK_COMMIT=$(git rev-parse --short HEAD)
260
+ TASK_COMMITS+=("Task ${TASK_NUM}: ${TASK_COMMIT}")
261
+ ```
262
+
263
+ </task_commit>
264
+
265
+ <step name="checkpoint_protocol">
266
+ On `type="checkpoint:*"`: automate everything possible first. Checkpoints are for verification/decisions only.
267
+
268
+ Display: `CHECKPOINT: [Type]` box → Progress {X}/{Y} → Task name → type-specific content → `YOUR ACTION: [signal]`
269
+
270
+ | Type | Content | Resume signal |
271
+ |------|---------|---------------|
272
+ | human-verify (90%) | What was built + verification steps (commands/URLs) | "approved" or describe issues |
273
+ | decision (9%) | Decision needed + context + options with pros/cons | "Select: option-id" |
274
+ | human-action (1%) | What was automated + ONE manual step + verification plan | "done" |
275
+
276
+ After response: verify if specified. Pass → continue. Fail → inform, wait. WAIT for user — do NOT hallucinate completion.
277
+
278
+ See ~/.claude/get-shit-done/references/checkpoints.md for details.
279
+ </step>
280
+
281
+ <step name="checkpoint_return_for_orchestrator">
282
+ When spawned via Task and hitting checkpoint: return structured state (cannot interact with user directly).
283
+
284
+ **Required return:** 1) Completed Tasks table (hashes + files) 2) Current Task (what's blocking) 3) Checkpoint Details (user-facing content) 4) Awaiting (what's needed from user)
285
+
286
+ Orchestrator parses → presents to user → spawns fresh continuation with your completed tasks state. You will NOT be resumed. In main context: use checkpoint_protocol above.
287
+ </step>
288
+
289
+ <step name="verification_failure_gate">
290
+ If verification fails: STOP. Present: "Verification failed for Task [X]: [name]. Expected: [criteria]. Actual: [result]." Options: Retry | Skip (mark incomplete) | Stop (investigate). If skipped → SUMMARY "Issues Encountered".
291
+ </step>
292
+
293
+ <step name="record_completion_time">
294
+ ```bash
295
+ PLAN_END_TIME=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
296
+ PLAN_END_EPOCH=$(date +%s)
297
+
298
+ DURATION_SEC=$(( PLAN_END_EPOCH - PLAN_START_EPOCH ))
299
+ DURATION_MIN=$(( DURATION_SEC / 60 ))
300
+
301
+ if [[ $DURATION_MIN -ge 60 ]]; then
302
+ HRS=$(( DURATION_MIN / 60 ))
303
+ MIN=$(( DURATION_MIN % 60 ))
304
+ DURATION="${HRS}h ${MIN}m"
305
+ else
306
+ DURATION="${DURATION_MIN} min"
307
+ fi
308
+ ```
309
+ </step>
310
+
311
+ <step name="generate_user_setup">
312
+ ```bash
313
+ grep -A 50 "^user_setup:" .planning/phases/XX-name/{phase}-{plan}-PLAN.md | head -50
314
+ ```
315
+
316
+ If user_setup exists: create `{phase}-USER-SETUP.md` using template `~/.claude/get-shit-done/templates/user-setup.md`. Per service: env vars table, account setup checklist, dashboard config, local dev notes, verification commands. Status "Incomplete". Set `USER_SETUP_CREATED=true`. If empty/missing: skip.
317
+ </step>
318
+
319
+ <step name="create_summary">
320
+ Create `{phase}-{plan}-SUMMARY.md` at `.planning/phases/XX-name/`. Use `~/.claude/get-shit-done/templates/summary.md`.
321
+
322
+ **Frontmatter:** phase, plan, subsystem, tags | requires/provides/affects | tech-stack.added/patterns | key-files.created/modified | key-decisions | requirements-completed (**MUST** copy `requirements` array from PLAN.md frontmatter verbatim) | duration ($DURATION), completed ($PLAN_END_TIME date).
323
+
324
+ Title: `# Phase [X] Plan [Y]: [Name] Summary`
325
+
326
+ One-liner SUBSTANTIVE: "JWT auth with refresh rotation using jose library" not "Authentication implemented"
327
+
328
+ Include: duration, start/end times, task count, file count.
329
+
330
+ Next: more plans → "Ready for {next-plan}" | last → "Phase complete, ready for transition".
331
+ </step>
332
+
333
+ <step name="update_current_position">
334
+ Update STATE.md using gsd-tools:
335
+
336
+ ```bash
337
+ # Advance plan counter (handles last-plan edge case)
338
+ node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" state advance-plan
339
+
340
+ # Recalculate progress bar from disk state
341
+ node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" state update-progress
342
+
343
+ # Record execution metrics
344
+ node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" state record-metric \
345
+ --phase "${PHASE}" --plan "${PLAN}" --duration "${DURATION}" \
346
+ --tasks "${TASK_COUNT}" --files "${FILE_COUNT}"
347
+ ```
348
+ </step>
349
+
350
+ <step name="extract_decisions_and_issues">
351
+ From SUMMARY: Extract decisions and add to STATE.md:
352
+
353
+ ```bash
354
+ # Add each decision from SUMMARY key-decisions
355
+ # Prefer file inputs for shell-safe text (preserves `$`, `*`, etc. exactly)
356
+ node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" state add-decision \
357
+ --phase "${PHASE}" --summary-file "${DECISION_TEXT_FILE}" --rationale-file "${RATIONALE_FILE}"
358
+
359
+ # Add blockers if any found
360
+ node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" state add-blocker --text-file "${BLOCKER_TEXT_FILE}"
361
+ ```
362
+ </step>
363
+
364
+ <step name="update_session_continuity">
365
+ Update session info using gsd-tools:
366
+
367
+ ```bash
368
+ node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" state record-session \
369
+ --stopped-at "Completed ${PHASE}-${PLAN}-PLAN.md" \
370
+ --resume-file "None"
371
+ ```
372
+
373
+ Keep STATE.md under 150 lines.
374
+ </step>
375
+
376
+ <step name="issues_review_gate">
377
+ If SUMMARY "Issues Encountered" ≠ "None": yolo → log and continue. Interactive → present issues, wait for acknowledgment.
378
+ </step>
379
+
380
+ <step name="update_roadmap">
381
+ ```bash
382
+ node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" roadmap update-plan-progress "${PHASE}"
383
+ ```
384
+ Counts PLAN vs SUMMARY files on disk. Updates progress table row with correct count and status (`In Progress` or `Complete` with date).
385
+ </step>
386
+
387
+ <step name="update_requirements">
388
+ Mark completed requirements from the PLAN.md frontmatter `requirements:` field:
389
+
390
+ ```bash
391
+ node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" requirements mark-complete ${REQ_IDS}
392
+ ```
393
+
394
+ Extract requirement IDs from the plan's frontmatter (e.g., `requirements: [AUTH-01, AUTH-02]`). If no requirements field, skip.
395
+ </step>
396
+
397
+ <step name="git_commit_metadata">
398
+ Task code already committed per-task. Commit plan metadata:
399
+
400
+ ```bash
401
+ node "$HOME/.claude/get-shit-done/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
402
+ ```
403
+ </step>
404
+
405
+ <step name="update_codebase_map">
406
+ If .planning/codebase/ doesn't exist: skip.
407
+
408
+ ```bash
409
+ FIRST_TASK=$(git log --oneline --grep="feat({phase}-{plan}):" --grep="fix({phase}-{plan}):" --grep="test({phase}-{plan}):" --reverse | head -1 | cut -d' ' -f1)
410
+ git diff --name-only ${FIRST_TASK}^..HEAD 2>/dev/null
411
+ ```
412
+
413
+ 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.
414
+
415
+ ```bash
416
+ node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" commit "" --files .planning/codebase/*.md --amend
417
+ ```
418
+ </step>
419
+
420
+ <step name="offer_next">
421
+ If `USER_SETUP_CREATED=true`: display `⚠️ USER SETUP REQUIRED` with path + env/config tasks at TOP.
422
+
423
+ ```bash
424
+ ls -1 .planning/phases/[current-phase-dir]/*-PLAN.md 2>/dev/null | wc -l
425
+ ls -1 .planning/phases/[current-phase-dir]/*-SUMMARY.md 2>/dev/null | wc -l
426
+ ```
427
+
428
+ | Condition | Route | Action |
429
+ |-----------|-------|--------|
430
+ | summaries < plans | **A: More plans** | Find next PLAN without SUMMARY. Yolo: auto-continue. Interactive: show next plan, suggest `/gsd:execute-phase {phase}` + `/gsd:verify-work`. STOP here. |
431
+ | summaries = plans, current < highest phase | **B: Phase done** | Show completion, suggest `/gsd:plan-phase {Z+1}` + `/gsd:verify-work {Z}` + `/gsd:discuss-phase {Z+1}` |
432
+ | summaries = plans, current = highest phase | **C: Milestone done** | Show banner, suggest `/gsd:complete-milestone` + `/gsd:verify-work` + `/gsd:add-phase` |
433
+
434
+ All routes: `/clear` first for fresh context.
435
+ </step>
436
+
437
+ </process>
438
+
439
+ <success_criteria>
440
+
441
+ - All tasks from PLAN.md completed
442
+ - All verifications pass
443
+ - USER-SETUP.md generated if user_setup in frontmatter
444
+ - SUMMARY.md created with substantive content
445
+ - STATE.md updated (position, decisions, issues, session)
446
+ - ROADMAP.md updated
447
+ - If codebase map exists: map updated with execution changes (or skipped if no significant changes)
448
+ - If USER-SETUP.md created: prominently surfaced in completion output
449
+ </success_criteria>
@@ -0,0 +1,159 @@
1
+ <purpose>
2
+ Validate `.planning/` directory integrity and report actionable issues. Checks for missing files, invalid configurations, inconsistent state, and orphaned plans. Optionally repairs auto-fixable issues.
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
+ <process>
10
+
11
+ <step name="parse_args">
12
+ **Parse arguments:**
13
+
14
+ Check if `--repair` flag is present in the command arguments.
15
+
16
+ ```
17
+ REPAIR_FLAG=""
18
+ if arguments contain "--repair"; then
19
+ REPAIR_FLAG="--repair"
20
+ fi
21
+ ```
22
+ </step>
23
+
24
+ <step name="run_health_check">
25
+ **Run health validation:**
26
+
27
+ ```bash
28
+ node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" validate health $REPAIR_FLAG
29
+ ```
30
+
31
+ Parse JSON output:
32
+ - `status`: "healthy" | "degraded" | "broken"
33
+ - `errors[]`: Critical issues (code, message, fix, repairable)
34
+ - `warnings[]`: Non-critical issues
35
+ - `info[]`: Informational notes
36
+ - `repairable_count`: Number of auto-fixable issues
37
+ - `repairs_performed[]`: Actions taken if --repair was used
38
+ </step>
39
+
40
+ <step name="format_output">
41
+ **Format and display results:**
42
+
43
+ ```
44
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
45
+ GSD Health Check
46
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
47
+
48
+ Status: HEALTHY | DEGRADED | BROKEN
49
+ Errors: N | Warnings: N | Info: N
50
+ ```
51
+
52
+ **If repairs were performed:**
53
+ ```
54
+ ## Repairs Performed
55
+
56
+ - ✓ config.json: Created with defaults
57
+ - ✓ STATE.md: Regenerated from roadmap
58
+ ```
59
+
60
+ **If errors exist:**
61
+ ```
62
+ ## Errors
63
+
64
+ - [E001] config.json: JSON parse error at line 5
65
+ Fix: Run /gsd:health --repair to reset to defaults
66
+
67
+ - [E002] PROJECT.md not found
68
+ Fix: Run /gsd:new-project to create
69
+ ```
70
+
71
+ **If warnings exist:**
72
+ ```
73
+ ## Warnings
74
+
75
+ - [W001] STATE.md references phase 5, but only phases 1-3 exist
76
+ Fix: Run /gsd:health --repair to regenerate
77
+
78
+ - [W005] Phase directory "1-setup" doesn't follow NN-name format
79
+ Fix: Rename to match pattern (e.g., 01-setup)
80
+ ```
81
+
82
+ **If info exists:**
83
+ ```
84
+ ## Info
85
+
86
+ - [I001] 02-implementation/02-01-PLAN.md has no SUMMARY.md
87
+ Note: May be in progress
88
+ ```
89
+
90
+ **Footer (if repairable issues exist and --repair was NOT used):**
91
+ ```
92
+ ---
93
+ N issues can be auto-repaired. Run: /gsd:health --repair
94
+ ```
95
+ </step>
96
+
97
+ <step name="offer_repair">
98
+ **If repairable issues exist and --repair was NOT used:**
99
+
100
+ Ask user if they want to run repairs:
101
+
102
+ ```
103
+ Would you like to run /gsd:health --repair to fix N issues automatically?
104
+ ```
105
+
106
+ If yes, re-run with --repair flag and display results.
107
+ </step>
108
+
109
+ <step name="verify_repairs">
110
+ **If repairs were performed:**
111
+
112
+ Re-run health check without --repair to confirm issues are resolved:
113
+
114
+ ```bash
115
+ node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" validate health
116
+ ```
117
+
118
+ Report final status.
119
+ </step>
120
+
121
+ </process>
122
+
123
+ <error_codes>
124
+
125
+ | Code | Severity | Description | Repairable |
126
+ |------|----------|-------------|------------|
127
+ | E001 | error | .planning/ directory not found | No |
128
+ | E002 | error | PROJECT.md not found | No |
129
+ | E003 | error | ROADMAP.md not found | No |
130
+ | E004 | error | STATE.md not found | Yes |
131
+ | E005 | error | config.json parse error | Yes |
132
+ | W001 | warning | PROJECT.md missing required section | No |
133
+ | W002 | warning | STATE.md references invalid phase | Yes |
134
+ | W003 | warning | config.json not found | Yes |
135
+ | W004 | warning | config.json invalid field value | No |
136
+ | W005 | warning | Phase directory naming mismatch | No |
137
+ | W006 | warning | Phase in ROADMAP but no directory | No |
138
+ | W007 | warning | Phase on disk but not in ROADMAP | No |
139
+ | W008 | warning | config.json: workflow.nyquist_validation absent (defaults to enabled but agents may skip) | Yes |
140
+ | W009 | warning | Phase has Validation Architecture in RESEARCH.md but no VALIDATION.md | No |
141
+ | I001 | info | Plan without SUMMARY (may be in progress) | No |
142
+
143
+ </error_codes>
144
+
145
+ <repair_actions>
146
+
147
+ | Action | Effect | Risk |
148
+ |--------|--------|------|
149
+ | createConfig | Create config.json with defaults | None |
150
+ | resetConfig | Delete + recreate config.json | Loses custom settings |
151
+ | regenerateState | Create STATE.md from ROADMAP structure | Loses session history |
152
+ | addNyquistKey | Add workflow.nyquist_validation: true to config.json | None — matches existing default |
153
+
154
+ **Not repairable (too risky):**
155
+ - PROJECT.md, ROADMAP.md content
156
+ - Phase directory renaming
157
+ - Orphaned plan cleanup
158
+
159
+ </repair_actions>