gsd-opencode 1.22.1 → 1.33.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 (188) hide show
  1. package/agents/gsd-advisor-researcher.md +112 -0
  2. package/agents/gsd-assumptions-analyzer.md +110 -0
  3. package/agents/gsd-codebase-mapper.md +0 -2
  4. package/agents/gsd-debugger.md +117 -2
  5. package/agents/gsd-doc-verifier.md +207 -0
  6. package/agents/gsd-doc-writer.md +608 -0
  7. package/agents/gsd-executor.md +45 -4
  8. package/agents/gsd-integration-checker.md +0 -2
  9. package/agents/gsd-nyquist-auditor.md +0 -2
  10. package/agents/gsd-phase-researcher.md +191 -5
  11. package/agents/gsd-plan-checker.md +152 -5
  12. package/agents/gsd-planner.md +131 -157
  13. package/agents/gsd-project-researcher.md +28 -3
  14. package/agents/gsd-research-synthesizer.md +0 -2
  15. package/agents/gsd-roadmapper.md +29 -2
  16. package/agents/gsd-security-auditor.md +129 -0
  17. package/agents/gsd-ui-auditor.md +485 -0
  18. package/agents/gsd-ui-checker.md +305 -0
  19. package/agents/gsd-ui-researcher.md +368 -0
  20. package/agents/gsd-user-profiler.md +173 -0
  21. package/agents/gsd-verifier.md +207 -22
  22. package/commands/gsd/gsd-add-backlog.md +76 -0
  23. package/commands/gsd/gsd-analyze-dependencies.md +34 -0
  24. package/commands/gsd/gsd-audit-uat.md +24 -0
  25. package/commands/gsd/gsd-autonomous.md +45 -0
  26. package/commands/gsd/gsd-cleanup.md +5 -0
  27. package/commands/gsd/gsd-debug.md +29 -21
  28. package/commands/gsd/gsd-discuss-phase.md +15 -36
  29. package/commands/gsd/gsd-do.md +30 -0
  30. package/commands/gsd/gsd-docs-update.md +48 -0
  31. package/commands/gsd/gsd-execute-phase.md +24 -2
  32. package/commands/gsd/gsd-fast.md +30 -0
  33. package/commands/gsd/gsd-forensics.md +56 -0
  34. package/commands/gsd/gsd-help.md +2 -0
  35. package/commands/gsd/gsd-join-discord.md +2 -1
  36. package/commands/gsd/gsd-list-workspaces.md +19 -0
  37. package/commands/gsd/gsd-manager.md +40 -0
  38. package/commands/gsd/gsd-milestone-summary.md +51 -0
  39. package/commands/gsd/gsd-new-project.md +4 -0
  40. package/commands/gsd/gsd-new-workspace.md +44 -0
  41. package/commands/gsd/gsd-next.md +24 -0
  42. package/commands/gsd/gsd-note.md +34 -0
  43. package/commands/gsd/gsd-plan-phase.md +8 -1
  44. package/commands/gsd/gsd-plant-seed.md +28 -0
  45. package/commands/gsd/gsd-pr-branch.md +25 -0
  46. package/commands/gsd/gsd-profile-user.md +46 -0
  47. package/commands/gsd/gsd-quick.md +7 -3
  48. package/commands/gsd/gsd-reapply-patches.md +178 -45
  49. package/commands/gsd/gsd-remove-workspace.md +26 -0
  50. package/commands/gsd/gsd-research-phase.md +7 -12
  51. package/commands/gsd/gsd-review-backlog.md +62 -0
  52. package/commands/gsd/gsd-review.md +38 -0
  53. package/commands/gsd/gsd-secure-phase.md +35 -0
  54. package/commands/gsd/gsd-session-report.md +19 -0
  55. package/commands/gsd/gsd-set-profile.md +24 -23
  56. package/commands/gsd/gsd-ship.md +23 -0
  57. package/commands/gsd/gsd-stats.md +18 -0
  58. package/commands/gsd/gsd-thread.md +127 -0
  59. package/commands/gsd/gsd-ui-phase.md +34 -0
  60. package/commands/gsd/gsd-ui-review.md +32 -0
  61. package/commands/gsd/gsd-workstreams.md +71 -0
  62. package/get-shit-done/bin/gsd-tools.cjs +450 -90
  63. package/get-shit-done/bin/lib/commands.cjs +489 -24
  64. package/get-shit-done/bin/lib/config.cjs +329 -48
  65. package/get-shit-done/bin/lib/core.cjs +1143 -102
  66. package/get-shit-done/bin/lib/docs.cjs +267 -0
  67. package/get-shit-done/bin/lib/frontmatter.cjs +125 -43
  68. package/get-shit-done/bin/lib/init.cjs +918 -106
  69. package/get-shit-done/bin/lib/milestone.cjs +65 -33
  70. package/get-shit-done/bin/lib/model-profiles.cjs +70 -0
  71. package/get-shit-done/bin/lib/phase.cjs +434 -404
  72. package/get-shit-done/bin/lib/profile-output.cjs +1048 -0
  73. package/get-shit-done/bin/lib/profile-pipeline.cjs +539 -0
  74. package/get-shit-done/bin/lib/roadmap.cjs +156 -101
  75. package/get-shit-done/bin/lib/schema-detect.cjs +238 -0
  76. package/get-shit-done/bin/lib/security.cjs +384 -0
  77. package/get-shit-done/bin/lib/state.cjs +711 -79
  78. package/get-shit-done/bin/lib/template.cjs +2 -2
  79. package/get-shit-done/bin/lib/uat.cjs +282 -0
  80. package/get-shit-done/bin/lib/verify.cjs +254 -42
  81. package/get-shit-done/bin/lib/workstream.cjs +495 -0
  82. package/get-shit-done/references/agent-contracts.md +79 -0
  83. package/get-shit-done/references/artifact-types.md +113 -0
  84. package/get-shit-done/references/checkpoints.md +12 -10
  85. package/get-shit-done/references/context-budget.md +49 -0
  86. package/get-shit-done/references/continuation-format.md +15 -15
  87. package/get-shit-done/references/decimal-phase-calculation.md +2 -3
  88. package/get-shit-done/references/domain-probes.md +125 -0
  89. package/get-shit-done/references/gate-prompts.md +100 -0
  90. package/get-shit-done/references/git-integration.md +47 -0
  91. package/get-shit-done/references/model-profile-resolution.md +2 -0
  92. package/get-shit-done/references/model-profiles.md +62 -16
  93. package/get-shit-done/references/phase-argument-parsing.md +2 -2
  94. package/get-shit-done/references/planner-gap-closure.md +62 -0
  95. package/get-shit-done/references/planner-reviews.md +39 -0
  96. package/get-shit-done/references/planner-revision.md +87 -0
  97. package/get-shit-done/references/planning-config.md +18 -1
  98. package/get-shit-done/references/revision-loop.md +97 -0
  99. package/get-shit-done/references/ui-brand.md +2 -2
  100. package/get-shit-done/references/universal-anti-patterns.md +58 -0
  101. package/get-shit-done/references/user-profiling.md +681 -0
  102. package/get-shit-done/references/workstream-flag.md +111 -0
  103. package/get-shit-done/templates/SECURITY.md +61 -0
  104. package/get-shit-done/templates/UAT.md +21 -3
  105. package/get-shit-done/templates/UI-SPEC.md +100 -0
  106. package/get-shit-done/templates/VALIDATION.md +3 -3
  107. package/get-shit-done/templates/claude-md.md +145 -0
  108. package/get-shit-done/templates/config.json +14 -3
  109. package/get-shit-done/templates/context.md +61 -6
  110. package/get-shit-done/templates/debug-subagent-prompt.md +2 -6
  111. package/get-shit-done/templates/dev-preferences.md +21 -0
  112. package/get-shit-done/templates/discussion-log.md +63 -0
  113. package/get-shit-done/templates/phase-prompt.md +46 -5
  114. package/get-shit-done/templates/planner-subagent-prompt.md +2 -10
  115. package/get-shit-done/templates/project.md +2 -0
  116. package/get-shit-done/templates/state.md +2 -2
  117. package/get-shit-done/templates/user-profile.md +146 -0
  118. package/get-shit-done/workflows/add-phase.md +4 -4
  119. package/get-shit-done/workflows/add-tests.md +4 -4
  120. package/get-shit-done/workflows/add-todo.md +4 -4
  121. package/get-shit-done/workflows/analyze-dependencies.md +96 -0
  122. package/get-shit-done/workflows/audit-milestone.md +20 -16
  123. package/get-shit-done/workflows/audit-uat.md +109 -0
  124. package/get-shit-done/workflows/autonomous.md +1036 -0
  125. package/get-shit-done/workflows/check-todos.md +4 -4
  126. package/get-shit-done/workflows/cleanup.md +4 -4
  127. package/get-shit-done/workflows/complete-milestone.md +22 -10
  128. package/get-shit-done/workflows/diagnose-issues.md +21 -7
  129. package/get-shit-done/workflows/discovery-phase.md +2 -2
  130. package/get-shit-done/workflows/discuss-phase-assumptions.md +671 -0
  131. package/get-shit-done/workflows/discuss-phase-power.md +291 -0
  132. package/get-shit-done/workflows/discuss-phase.md +558 -47
  133. package/get-shit-done/workflows/do.md +104 -0
  134. package/get-shit-done/workflows/docs-update.md +1093 -0
  135. package/get-shit-done/workflows/execute-phase.md +741 -58
  136. package/get-shit-done/workflows/execute-plan.md +77 -12
  137. package/get-shit-done/workflows/fast.md +105 -0
  138. package/get-shit-done/workflows/forensics.md +265 -0
  139. package/get-shit-done/workflows/health.md +28 -6
  140. package/get-shit-done/workflows/help.md +127 -7
  141. package/get-shit-done/workflows/insert-phase.md +4 -4
  142. package/get-shit-done/workflows/list-phase-assumptions.md +2 -2
  143. package/get-shit-done/workflows/list-workspaces.md +56 -0
  144. package/get-shit-done/workflows/manager.md +363 -0
  145. package/get-shit-done/workflows/map-codebase.md +83 -44
  146. package/get-shit-done/workflows/milestone-summary.md +223 -0
  147. package/get-shit-done/workflows/new-milestone.md +133 -25
  148. package/get-shit-done/workflows/new-project.md +216 -54
  149. package/get-shit-done/workflows/new-workspace.md +237 -0
  150. package/get-shit-done/workflows/next.md +97 -0
  151. package/get-shit-done/workflows/node-repair.md +92 -0
  152. package/get-shit-done/workflows/note.md +156 -0
  153. package/get-shit-done/workflows/pause-work.md +132 -15
  154. package/get-shit-done/workflows/plan-milestone-gaps.md +6 -7
  155. package/get-shit-done/workflows/plan-phase.md +513 -62
  156. package/get-shit-done/workflows/plant-seed.md +169 -0
  157. package/get-shit-done/workflows/pr-branch.md +129 -0
  158. package/get-shit-done/workflows/profile-user.md +450 -0
  159. package/get-shit-done/workflows/progress.md +154 -29
  160. package/get-shit-done/workflows/quick.md +285 -111
  161. package/get-shit-done/workflows/remove-phase.md +2 -2
  162. package/get-shit-done/workflows/remove-workspace.md +90 -0
  163. package/get-shit-done/workflows/research-phase.md +13 -9
  164. package/get-shit-done/workflows/resume-project.md +37 -18
  165. package/get-shit-done/workflows/review.md +281 -0
  166. package/get-shit-done/workflows/secure-phase.md +154 -0
  167. package/get-shit-done/workflows/session-report.md +146 -0
  168. package/get-shit-done/workflows/set-profile.md +2 -2
  169. package/get-shit-done/workflows/settings.md +91 -11
  170. package/get-shit-done/workflows/ship.md +237 -0
  171. package/get-shit-done/workflows/stats.md +60 -0
  172. package/get-shit-done/workflows/transition.md +150 -23
  173. package/get-shit-done/workflows/ui-phase.md +292 -0
  174. package/get-shit-done/workflows/ui-review.md +183 -0
  175. package/get-shit-done/workflows/update.md +262 -30
  176. package/get-shit-done/workflows/validate-phase.md +14 -17
  177. package/get-shit-done/workflows/verify-phase.md +143 -11
  178. package/get-shit-done/workflows/verify-work.md +141 -39
  179. package/package.json +1 -1
  180. package/skills/gsd-audit-milestone/SKILL.md +29 -0
  181. package/skills/gsd-cleanup/SKILL.md +19 -0
  182. package/skills/gsd-complete-milestone/SKILL.md +131 -0
  183. package/skills/gsd-discuss-phase/SKILL.md +54 -0
  184. package/skills/gsd-execute-phase/SKILL.md +49 -0
  185. package/skills/gsd-plan-phase/SKILL.md +37 -0
  186. package/skills/gsd-ui-phase/SKILL.md +24 -0
  187. package/skills/gsd-ui-review/SKILL.md +24 -0
  188. package/skills/gsd-verify-work/SKILL.md +30 -0
@@ -1,6 +1,6 @@
1
- <purpose>
1
+ <objective>
2
2
  Execute a phase prompt (PLAN.md) and create the outcome summary (SUMMARY.md).
3
- </purpose>
3
+ </objective>
4
4
 
5
5
  <required_reading>
6
6
  read STATE.md before any operation to load project context.
@@ -9,6 +9,11 @@ read config.json for planning behavior settings.
9
9
  @$HOME/.config/opencode/get-shit-done/references/git-integration.md
10
10
  </required_reading>
11
11
 
12
+ <available_agent_types>
13
+ Valid GSD subagent types (use exact names — do not fall back to 'general'):
14
+ - gsd-executor — Executes plan tasks, commits, creates SUMMARY.md
15
+ </available_agent_types>
16
+
12
17
  <process>
13
18
 
14
19
  <step name="init_context" priority="first">
@@ -19,7 +24,7 @@ INIT=$(node "$HOME/.config/opencode/get-shit-done/bin/gsd-tools.cjs" init execut
19
24
  if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi
20
25
  ```
21
26
 
22
- Extract from init JSON: `executor_model`, `commit_docs`, `phase_dir`, `phase_number`, `plans`, `summaries`, `incomplete_plans`, `state_path`, `config_path`.
27
+ Extract from init JSON: `executor_model`, `commit_docs`, `sub_repos`, `phase_dir`, `phase_number`, `plans`, `summaries`, `incomplete_plans`, `state_path`, `config_path`.
23
28
 
24
29
  If `.planning/` missing: error.
25
30
  </step>
@@ -27,8 +32,8 @@ If `.planning/` missing: error.
27
32
  <step name="identify_plan">
28
33
  ```bash
29
34
  # 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
35
+ (ls .planning/phases/XX-name/*-PLAN.md 2>/dev/null || true) | sort
36
+ (ls .planning/phases/XX-name/*-SUMMARY.md 2>/dev/null || true) | sort
32
37
  ```
33
38
 
34
39
  Find first PLAN without matching SUMMARY. Decimal phases supported (`01.1-hotfix/`):
@@ -67,7 +72,7 @@ grep -n "type=\"checkpoint" .planning/phases/XX-name/{phase}-{plan}-PLAN.md
67
72
  | Verify-only | B (segmented) | Segments between checkpoints. After none/human-verify → SUBAGENT. After decision/human-action → MAIN |
68
73
  | Decision | C (main) | Execute entirely in main context |
69
74
 
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.
75
+ **Pattern A:** init_agent_tracking → capture `EXPECTED_BASE=$(git rev-parse HEAD)` → spawn task(subagent_type="gsd-executor", model=executor_model) with prompt: execute plan at [path], autonomous, all tasks + SUMMARY + commit, follow deviation/auth rules, report: plan name, tasks, SUMMARY path, commit hash → track agent_id → wait → update tracking → report. **Include `isolation="worktree"` only if `workflow.use_worktrees` is not `false`** (read via `config-get workflow.use_worktrees`). **When using `isolation="worktree"`, include a `<worktree_branch_check>` block in the prompt** instructing the executor to run `git merge-base HEAD {EXPECTED_BASE}` and, if the result differs from `{EXPECTED_BASE}`, reset the branch base with `git reset --soft {EXPECTED_BASE}` before starting work. This corrects a known issue on Windows where `EnterWorktree` creates branches from `main` instead of the feature branch HEAD.
71
76
 
72
77
  **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
78
 
@@ -135,9 +140,12 @@ If previous SUMMARY has unresolved "Issues Encountered" or "Next Phase Readiness
135
140
  Deviations are normal — handle via rules below.
136
141
 
137
142
  1. read @context files from prompt
138
- 2. Per task:
143
+ 2. **MCP tools:** If AGENTS.md or project instructions reference MCP tools (e.g. jCodeMunch for code navigation), prefer them over grep/glob when available. Fall back to grep/glob if MCP tools are not accessible.
144
+ 3. Per task:
145
+ - **MANDATORY read_first gate:** If the task has a `<read_first>` field, you MUST read every listed file BEFORE making any edits. This is not optional. Do not skip files because you "already know" what's in them — read them. The read_first files establish ground truth for the task.
139
146
  - `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
147
  - `type="checkpoint:*"`: STOP → checkpoint_protocol → wait for user → continue only after confirmation.
148
+ - **MANDATORY acceptance_criteria check:** After completing each task, if it has `<acceptance_criteria>`, verify EVERY criterion before moving to the next task. Use grep, file reads, or CLI commands to confirm each criterion. If any criterion fails, fix the implementation before proceeding. Do not skip criteria or mark them as "will verify later".
141
149
  3. Run `<verification>` checks
142
150
  4. Confirm `<success_criteria>` met
143
151
  5. Document deviations in Summary
@@ -226,6 +234,25 @@ Errors: RED doesn't fail → investigate test/existing feature. GREEN doesn't pa
226
234
  See `$HOME/.config/opencode/get-shit-done/references/tdd.md` for structure.
227
235
  </tdd_plan_execution>
228
236
 
237
+ <precommit_failure_handling>
238
+ ## Pre-commit Hook Failure Handling
239
+
240
+ Your commits may trigger pre-commit hooks. Auto-fix hooks handle themselves transparently — files get fixed and re-staged automatically.
241
+
242
+ **If running as a parallel executor agent (spawned by execute-phase):**
243
+ Use `--no-verify` on all commits. Pre-commit hooks cause build lock contention when multiple agents commit simultaneously (e.g., cargo lock fights in Rust projects). The orchestrator validates once after all agents complete.
244
+
245
+ **If running as the sole executor (sequential mode):**
246
+ If a commit is BLOCKED by a hook:
247
+
248
+ 1. The `git commit` command fails with hook error output
249
+ 2. read the error — it tells you exactly which hook and what failed
250
+ 3. Fix the issue (type error, lint violation, secret leak, etc.)
251
+ 4. `git add` the fixed files
252
+ 5. Retry the commit
253
+ 6. Budget 1-2 retry cycles per commit
254
+ </precommit_failure_handling>
255
+
229
256
  <task_commit>
230
257
  ## task Commit Protocol
231
258
 
@@ -254,12 +281,35 @@ git add src/types/user.ts
254
281
 
255
282
  **4. Format:** `{type}({phase}-{plan}): {description}` with bullet points for key changes.
256
283
 
284
+ <sub_repos_commit_flow>
285
+ **Sub-repos mode:** If `sub_repos` is configured (non-empty array from init context), use `commit-to-subrepo` instead of standard git commit. This routes files to their correct sub-repo based on path prefix.
286
+
287
+ ```bash
288
+ node $HOME/.config/opencode/get-shit-done/bin/gsd-tools.cjs commit-to-subrepo "{type}({phase}-{plan}): {description}" --files file1 file2 ...
289
+ ```
290
+
291
+ The command groups files by sub-repo prefix and commits atomically to each. Returns JSON: `{ committed: true, repos: { "backend": { hash: "abc", files: [...] }, ... } }`.
292
+
293
+ Record hashes from each repo in the response for SUMMARY tracking.
294
+
295
+ **If `sub_repos` is empty or not set:** Use standard git commit flow below.
296
+ </sub_repos_commit_flow>
297
+
257
298
  **5. Record hash:**
258
299
  ```bash
259
300
  TASK_COMMIT=$(git rev-parse --short HEAD)
260
301
  TASK_COMMITS+=("task ${TASK_NUM}: ${TASK_COMMIT}")
261
302
  ```
262
303
 
304
+ **6. Check for untracked generated files:**
305
+ ```bash
306
+ git status --short | grep '^??'
307
+ ```
308
+ If new untracked files appeared after running scripts or tools, decide for each:
309
+ - **Commit it** — if it's a source file, config, or intentional artifact
310
+ - **Add to .gitignore** — if it's a generated/runtime output (build artifacts, `.env` files, cache files, compiled output)
311
+ - Do NOT leave generated files untracked
312
+
263
313
  </task_commit>
264
314
 
265
315
  <step name="checkpoint_protocol">
@@ -287,7 +337,22 @@ Orchestrator parses → presents to user → spawns fresh continuation with your
287
337
  </step>
288
338
 
289
339
  <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".
340
+ If verification fails:
341
+
342
+ **Check if node repair is enabled** (default: on):
343
+ ```bash
344
+ NODE_REPAIR=$(node "./.OpenCode/get-shit-done/bin/gsd-tools.cjs" config-get workflow.node_repair 2>/dev/null || echo "true")
345
+ ```
346
+
347
+ If `NODE_REPAIR` is `true`: invoke `@./.OpenCode/get-shit-done/workflows/node-repair.md` with:
348
+ - FAILED_TASK: task number, name, done-criteria
349
+ - ERROR: expected vs actual result
350
+ - PLAN_CONTEXT: adjacent task names + phase goal
351
+ - REPAIR_BUDGET: `workflow.node_repair_budget` from config (default: 2)
352
+
353
+ Node repair will attempt RETRY, DECOMPOSE, or PRUNE autonomously. Only reaches this gate again if repair budget is exhausted (ESCALATE).
354
+
355
+ If `NODE_REPAIR` is `false` OR repair returns ESCALATE: STOP. Present: "Verification failed for task [X]: [name]. Expected: [criteria]. Actual: [result]. Repair attempted: [summary of what was tried]." Options: Retry | Skip (mark incomplete) | Stop (investigate). If skipped → SUMMARY "Issues Encountered".
291
356
  </step>
292
357
 
293
358
  <step name="record_completion_time">
@@ -327,7 +392,7 @@ One-liner SUBSTANTIVE: "JWT auth with refresh rotation using jose library" not "
327
392
 
328
393
  Include: duration, start/end times, task count, file count.
329
394
 
330
- Next: more plans → "Ready for {next-plan}" | last → "Phase complete, ready for transition".
395
+ Next: more plans → "Ready for {next-plan}" | last → "Phase complete, ready for next step".
331
396
  </step>
332
397
 
333
398
  <step name="update_current_position">
@@ -407,7 +472,7 @@ If .planning/codebase/ doesn't exist: skip.
407
472
 
408
473
  ```bash
409
474
  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
475
+ git diff --name-only ${FIRST_TASK}^..HEAD 2>/dev/null || true
411
476
  ```
412
477
 
413
478
  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.
@@ -421,8 +486,8 @@ node "$HOME/.config/opencode/get-shit-done/bin/gsd-tools.cjs" commit "" --files
421
486
  If `USER_SETUP_CREATED=true`: display `⚠️ USER SETUP REQUIRED` with path + env/config tasks at TOP.
422
487
 
423
488
  ```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
489
+ (ls -1 .planning/phases/[current-phase-dir]/*-PLAN.md 2>/dev/null || true) | wc -l
490
+ (ls -1 .planning/phases/[current-phase-dir]/*-SUMMARY.md 2>/dev/null || true) | wc -l
426
491
  ```
427
492
 
428
493
  | Condition | Route | Action |
@@ -0,0 +1,105 @@
1
+ <objective>
2
+ Execute a trivial task inline without subagent overhead. No PLAN.md, no task spawning,
3
+ no research, no plan checking. Just: understand → do → commit → log.
4
+
5
+ For tasks like: fix a typo, update a config value, add a missing import, rename a
6
+ variable, commit uncommitted work, add a .gitignore entry, bump a version number.
7
+
8
+ Use /gsd-quick for anything that needs multi-step planning or research.
9
+ </objective>
10
+
11
+ <process>
12
+
13
+ <step name="parse_task">
14
+ Parse `$ARGUMENTS` for the task description.
15
+
16
+ If empty, ask:
17
+ ```
18
+ What's the quick fix? (one sentence)
19
+ ```
20
+
21
+ Store as `$TASK`.
22
+ </step>
23
+
24
+ <step name="scope_check">
25
+ **Before doing anything, verify this is actually trivial.**
26
+
27
+ A task is trivial if it can be completed in:
28
+ - ≤ 3 file edits
29
+ - ≤ 1 minute of work
30
+ - No new dependencies or architecture changes
31
+ - No research needed
32
+
33
+ If the task seems non-trivial (multi-file refactor, new feature, needs research),
34
+ say:
35
+
36
+ ```
37
+ This looks like it needs planning. Use /gsd-quick instead:
38
+ /gsd-quick "{task description}"
39
+ ```
40
+
41
+ And stop.
42
+ </step>
43
+
44
+ <step name="execute_inline">
45
+ Do the work directly:
46
+
47
+ 1. read the relevant file(s)
48
+ 2. Make the change(s)
49
+ 3. Verify the change works (run existing tests if applicable, or do a quick sanity check)
50
+
51
+ **No PLAN.md.** Just do it.
52
+ </step>
53
+
54
+ <step name="commit">
55
+ Commit the change atomically:
56
+
57
+ ```bash
58
+ git add -A
59
+ git commit -m "fix: {concise description of what changed}"
60
+ ```
61
+
62
+ Use conventional commit format: `fix:`, `feat:`, `docs:`, `chore:`, `refactor:` as appropriate.
63
+ </step>
64
+
65
+ <step name="log_to_state">
66
+ If `.planning/STATE.md` exists, append to the "Quick Tasks Completed" table.
67
+ If the table doesn't exist, skip this step silently.
68
+
69
+ ```bash
70
+ # Check if STATE.md has quick tasks table
71
+ if grep -q "Quick Tasks Completed" .planning/STATE.md 2>/dev/null; then
72
+ # Append entry — workflow handles the format
73
+ echo "| $(date +%Y-%m-%d) | fast | $TASK | ✅ |" >> .planning/STATE.md
74
+ fi
75
+ ```
76
+ </step>
77
+
78
+ <step name="done">
79
+ Report completion:
80
+
81
+ ```
82
+ ✅ Done: {what was changed}
83
+ Commit: {short hash}
84
+ Files: {list of changed files}
85
+ ```
86
+
87
+ No next-step suggestions. No workflow routing. Just done.
88
+ </step>
89
+
90
+ </process>
91
+
92
+ <guardrails>
93
+ - NEVER spawn a task/subagent — this runs inline
94
+ - NEVER create PLAN.md or SUMMARY.md files
95
+ - NEVER run research or plan-checking
96
+ - If the task takes more than 3 file edits, STOP and redirect to /gsd-quick
97
+ - If you're unsure how to implement it, STOP and redirect to /gsd-quick
98
+ </guardrails>
99
+
100
+ <success_criteria>
101
+ - [ ] task completed in current context (no subagents)
102
+ - [ ] Atomic git commit with conventional message
103
+ - [ ] STATE.md updated if it exists
104
+ - [ ] Total operation under 2 minutes wall time
105
+ </success_criteria>
@@ -0,0 +1,265 @@
1
+ # Forensics Workflow
2
+
3
+ Post-mortem investigation for failed or stuck GSD workflows. Analyzes git history,
4
+ `.planning/` artifacts, and file system state to detect anomalies and generate a
5
+ structured diagnostic report.
6
+
7
+ **Principle:** This is a read-only investigation. Do not modify project files.
8
+ Only write the forensic report.
9
+
10
+ ---
11
+
12
+ ## Step 1: Get Problem Description
13
+
14
+ ```bash
15
+ PROBLEM="$ARGUMENTS"
16
+ ```
17
+
18
+ If `$ARGUMENTS` is empty, ask the user:
19
+ > "What went wrong? Describe the issue — e.g., 'autonomous mode got stuck on phase 3',
20
+ > 'execute-phase failed silently', 'costs seem unusually high'."
21
+
22
+ Record the problem description for the report.
23
+
24
+ ## Step 2: Gather Evidence
25
+
26
+ Collect data from all available sources. Missing sources are fine — adapt to what exists.
27
+
28
+ ### 2a. Git History
29
+
30
+ ```bash
31
+ # Recent commits (last 30)
32
+ git log --oneline -30
33
+
34
+ # Commits with timestamps for gap analysis
35
+ git log --format="%H %ai %s" -30
36
+
37
+ # Files changed in recent commits (detect repeated edits)
38
+ git log --name-only --format="" -20 | sort | uniq -c | sort -rn | head -20
39
+
40
+ # Uncommitted work
41
+ git status --short
42
+ git diff --stat
43
+ ```
44
+
45
+ Record:
46
+ - Commit timeline (dates, messages, frequency)
47
+ - Most-edited files (potential stuck-loop indicator)
48
+ - Uncommitted changes (potential crash/interruption indicator)
49
+
50
+ ### 2b. Planning State
51
+
52
+ read these files if they exist:
53
+ - `.planning/STATE.md` — current milestone, phase, progress, blockers, last session
54
+ - `.planning/ROADMAP.md` — phase list with status
55
+ - `.planning/config.json` — workflow configuration
56
+
57
+ Extract:
58
+ - Current phase and its status
59
+ - Last recorded session stop point
60
+ - Any blockers or flags
61
+
62
+ ### 2c. Phase Artifacts
63
+
64
+ For each phase directory in `.planning/phases/*/`:
65
+
66
+ ```bash
67
+ ls .planning/phases/*/
68
+ ```
69
+
70
+ For each phase, check which artifacts exist:
71
+ - `{padded}-PLAN.md` or `{padded}-PLAN-*.md` (execution plans)
72
+ - `{padded}-SUMMARY.md` (completion summary)
73
+ - `{padded}-VERIFICATION.md` (quality verification)
74
+ - `{padded}-CONTEXT.md` (design decisions)
75
+ - `{padded}-RESEARCH.md` (pre-planning research)
76
+
77
+ Track: which phases have complete artifact sets vs gaps.
78
+
79
+ ### 2d. Session Reports
80
+
81
+ read `.planning/reports/SESSION_REPORT.md` if it exists — extract last session outcomes,
82
+ work completed, token estimates.
83
+
84
+ ### 2e. Git Worktree State
85
+
86
+ ```bash
87
+ git worktree list
88
+ ```
89
+
90
+ Check for orphaned worktrees (from crashed agents).
91
+
92
+ ## Step 3: Detect Anomalies
93
+
94
+ Evaluate the gathered evidence against these anomaly patterns:
95
+
96
+ ### Stuck Loop Detection
97
+
98
+ **Signal:** Same file appears in 3+ consecutive commits within a short time window.
99
+
100
+ ```bash
101
+ # Look for files committed repeatedly in sequence
102
+ git log --name-only --format="---COMMIT---" -20
103
+ ```
104
+
105
+ Parse commit boundaries. If any file appears in 3+ consecutive commits, flag as:
106
+ - **Confidence HIGH** if the commit messages are similar (e.g., "fix:", "fix:", "fix:" on same file)
107
+ - **Confidence MEDIUM** if the file appears frequently but commit messages vary
108
+
109
+ ### Missing Artifact Detection
110
+
111
+ **Signal:** Phase appears complete (has commits, is past in roadmap) but lacks expected artifacts.
112
+
113
+ For each phase that should be complete:
114
+ - PLAN.md missing → planning step was skipped
115
+ - SUMMARY.md missing → phase was not properly closed
116
+ - VERIFICATION.md missing → quality check was skipped
117
+
118
+ ### Abandoned Work Detection
119
+
120
+ **Signal:** Large gap between last commit and current time, with STATE.md showing mid-execution.
121
+
122
+ ```bash
123
+ # Time since last commit
124
+ git log -1 --format="%ai"
125
+ ```
126
+
127
+ If STATE.md shows an active phase but the last commit is >2 hours old and there are
128
+ uncommitted changes, flag as potential abandonment or crash.
129
+
130
+ ### Crash/Interruption Detection
131
+
132
+ **Signal:** Uncommitted changes + STATE.md shows mid-execution + orphaned worktrees.
133
+
134
+ Combine:
135
+ - `git status` shows modified/staged files
136
+ - STATE.md has an active execution entry
137
+ - `git worktree list` shows worktrees beyond the main one
138
+
139
+ ### Scope Drift Detection
140
+
141
+ **Signal:** Recent commits touch files outside the current phase's expected scope.
142
+
143
+ read the current phase PLAN.md to determine expected file paths. Compare against
144
+ files actually modified in recent commits. Flag any files that are clearly outside
145
+ the phase's domain.
146
+
147
+ ### Test Regression Detection
148
+
149
+ **Signal:** Commit messages containing "fix test", "revert", or re-commits of test files.
150
+
151
+ ```bash
152
+ git log --oneline -20 | grep -iE "fix test|revert|broken|regression|fail"
153
+ ```
154
+
155
+ ## Step 4: Generate Report
156
+
157
+ Create the forensics directory if needed:
158
+ ```bash
159
+ mkdir -p .planning/forensics
160
+ ```
161
+
162
+ write to `.planning/forensics/report-$(date +%Y%m%d-%H%M%S).md`:
163
+
164
+ ```markdown
165
+ # Forensic Report
166
+
167
+ **Generated:** {ISO timestamp}
168
+ **Problem:** {user's description}
169
+
170
+ ---
171
+
172
+ ## Evidence Summary
173
+
174
+ ### Git Activity
175
+ - **Last commit:** {date} — "{message}"
176
+ - **Commits (last 30):** {count}
177
+ - **Time span:** {earliest} → {latest}
178
+ - **Uncommitted changes:** {yes/no — list if yes}
179
+ - **Active worktrees:** {count — list if >1}
180
+
181
+ ### Planning State
182
+ - **Current milestone:** {version or "none"}
183
+ - **Current phase:** {number — name — status}
184
+ - **Last session:** {stopped_at from STATE.md}
185
+ - **Blockers:** {any flags from STATE.md}
186
+
187
+ ### Artifact Completeness
188
+ | Phase | PLAN | CONTEXT | RESEARCH | SUMMARY | VERIFICATION |
189
+ |-------|------|---------|----------|---------|-------------|
190
+ {for each phase: name | ✅/❌ per artifact}
191
+
192
+ ## Anomalies Detected
193
+
194
+ ### {Anomaly Type} — {Confidence: HIGH/MEDIUM/LOW}
195
+ **Evidence:** {specific commits, files, or state data}
196
+ **Interpretation:** {what this likely means}
197
+
198
+ {repeat for each anomaly found}
199
+
200
+ ## Root Cause Hypothesis
201
+
202
+ Based on the evidence above, the most likely explanation is:
203
+
204
+ {1-3 sentence hypothesis grounded in the anomalies}
205
+
206
+ ## Recommended Actions
207
+
208
+ 1. {Specific, actionable remediation step}
209
+ 2. {Another step if applicable}
210
+ 3. {Recovery command if applicable — e.g., `/gsd-resume-work`, `/gsd-execute-phase N`}
211
+
212
+ ---
213
+
214
+ *Report generated by `/gsd-forensics`. All paths redacted for portability.*
215
+ ```
216
+
217
+ **Redaction rules:**
218
+ - Replace absolute paths with relative paths (strip `$HOME` prefix)
219
+ - Remove any API keys, tokens, or credentials found in git diff output
220
+ - Truncate large diffs to first 50 lines
221
+
222
+ ## Step 5: Present Report
223
+
224
+ Display the full forensic report inline.
225
+
226
+ ## Step 6: Offer Interactive Investigation
227
+
228
+ > "Report saved to `.planning/forensics/report-{timestamp}.md`.
229
+ >
230
+ > I can dig deeper into any finding. Want me to:
231
+ > - Trace a specific anomaly to its root cause?
232
+ > - read specific files referenced in the evidence?
233
+ > - Check if a similar issue has been reported before?"
234
+
235
+ If the user asks follow-up questions, answer from the evidence already gathered.
236
+ read additional files only if specifically needed.
237
+
238
+ ## Step 7: Offer Issue Creation
239
+
240
+ If actionable anomalies were found (HIGH or MEDIUM confidence):
241
+
242
+ > "Want me to create a GitHub issue for this? I'll format the findings and redact paths."
243
+
244
+ If confirmed:
245
+ ```bash
246
+ # Check if "bug" label exists before using it
247
+ BUG_LABEL=$(gh label list --search "bug" --json name -q '.[0].name' 2>/dev/null)
248
+ LABEL_FLAG=""
249
+ if [ -n "$BUG_LABEL" ]; then
250
+ LABEL_FLAG="--label bug"
251
+ fi
252
+
253
+ gh issue create \
254
+ --title "bug: {concise description from anomaly}" \
255
+ $LABEL_FLAG \
256
+ --body "{formatted findings from report}"
257
+ ```
258
+
259
+ ## Step 8: Update STATE.md
260
+
261
+ ```bash
262
+ gsd-tools.cjs state record-session \
263
+ --stopped-at "Forensic investigation complete" \
264
+ --resume-file ".planning/forensics/report-{timestamp}.md"
265
+ ```
@@ -1,6 +1,6 @@
1
- <purpose>
1
+ <objective>
2
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>
3
+ </objective>
4
4
 
5
5
  <required_reading>
6
6
  read all files referenced by the invoking prompt's execution_context before starting.
@@ -72,8 +72,8 @@ Errors: N | Warnings: N | Info: N
72
72
  ```
73
73
  ## Warnings
74
74
 
75
- - [W001] STATE.md references phase 5, but only phases 1-3 exist
76
- Fix: Run /gsd-health --repair to regenerate
75
+ - [W002] STATE.md references phase 5, but only phases 1-3 exist
76
+ Fix: Review STATE.md manually before changing it; repair will not overwrite an existing STATE.md
77
77
 
78
78
  - [W005] Phase directory "1-setup" doesn't follow NN-name format
79
79
  Fix: Rename to match pattern (e.g., 01-setup)
@@ -130,7 +130,7 @@ Report final status.
130
130
  | E004 | error | STATE.md not found | Yes |
131
131
  | E005 | error | config.json parse error | Yes |
132
132
  | W001 | warning | PROJECT.md missing required section | No |
133
- | W002 | warning | STATE.md references invalid phase | Yes |
133
+ | W002 | warning | STATE.md references invalid phase | No |
134
134
  | W003 | warning | config.json not found | Yes |
135
135
  | W004 | warning | config.json invalid field value | No |
136
136
  | W005 | warning | Phase directory naming mismatch | No |
@@ -148,7 +148,7 @@ Report final status.
148
148
  |--------|--------|------|
149
149
  | createConfig | Create config.json with defaults | None |
150
150
  | resetConfig | Delete + recreate config.json | Loses custom settings |
151
- | regenerateState | Create STATE.md from ROADMAP structure | Loses session history |
151
+ | regenerateState | Create STATE.md from ROADMAP structure when it is missing | Loses session history |
152
152
  | addNyquistKey | Add workflow.nyquist_validation: true to config.json | None — matches existing default |
153
153
 
154
154
  **Not repairable (too risky):**
@@ -157,3 +157,25 @@ Report final status.
157
157
  - Orphaned plan cleanup
158
158
 
159
159
  </repair_actions>
160
+
161
+ <stale_task_cleanup>
162
+ **Windows-specific:** Check for stale OpenCode task directories that accumulate on crash/freeze.
163
+ These are left behind when subagents are force-killed and consume disk space.
164
+
165
+ When `--repair` is active, detect and clean up:
166
+
167
+ ```bash
168
+ # Check for stale task directories (older than 24 hours)
169
+ TASKS_DIR="$HOME/.OpenCode/tasks"
170
+ if [ -d "$TASKS_DIR" ]; then
171
+ STALE_COUNT=$( (find "$TASKS_DIR" -maxdepth 1 -type d -mtime +1 2>/dev/null || true) | wc -l )
172
+ if [ "$STALE_COUNT" -gt 0 ]; then
173
+ echo "⚠️ Found $STALE_COUNT stale task directories in $HOME/.config/opencode/tasks/"
174
+ echo " These are leftover from crashed subagent sessions."
175
+ echo " Run: rm -rf $HOME/.config/opencode/tasks/* (safe — only affects dead sessions)"
176
+ fi
177
+ fi
178
+ ```
179
+
180
+ Report as info diagnostic: `I002 | info | Stale subagent task directories found | Yes (--repair removes them)`
181
+ </stale_task_cleanup>