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
@@ -0,0 +1,62 @@
1
+ # Gap Closure Mode — Planner Reference
2
+
3
+ Triggered by `--gaps` flag. Creates plans to address verification or UAT failures.
4
+
5
+ **Important: Skip deferred items.** When reading VERIFICATION.md, only the `gaps:` section contains actionable items that need closure plans. The `deferred:` section (if present) lists items explicitly addressed in later milestone phases — these are NOT gaps and must be ignored during gap closure planning. Creating plans for deferred items wastes effort on work already scheduled for future phases.
6
+
7
+ **1. Find gap sources:**
8
+
9
+ Use init context (from load_project_state) which provides `phase_dir`:
10
+
11
+ ```bash
12
+ # Check for VERIFICATION.md (code verification gaps)
13
+ ls "$phase_dir"/*-VERIFICATION.md 2>/dev/null
14
+
15
+ # Check for UAT.md with diagnosed status (user testing gaps)
16
+ grep -l "status: diagnosed" "$phase_dir"/*-UAT.md 2>/dev/null
17
+ ```
18
+
19
+ **2. Parse gaps:** Each gap has: truth (failed behavior), reason, artifacts (files with issues), missing (things to add/fix).
20
+
21
+ **3. Load existing SUMMARYs** to understand what's already built.
22
+
23
+ **4. Find next plan number:** If plans 01-03 exist, next is 04.
24
+
25
+ **5. Group gaps into plans** by: same artifact, same concern, dependency order (can't wire if artifact is stub → fix stub first).
26
+
27
+ **6. Create gap closure tasks:**
28
+
29
+ ```xml
30
+ <task name="{fix_description}" type="auto">
31
+ <files>{artifact.path}</files>
32
+ <action>
33
+ {For each item in gap.missing:}
34
+ - {missing item}
35
+
36
+ Reference existing code: {from SUMMARYs}
37
+ Gap reason: {gap.reason}
38
+ </action>
39
+ <verify>{How to confirm gap is closed}</verify>
40
+ <done>{Observable truth now achievable}</done>
41
+ </task>
42
+ ```
43
+
44
+ **7. Assign waves using standard dependency analysis** (same as `assign_waves` step):
45
+ - Plans with no dependencies → wave 1
46
+ - Plans that depend on other gap closure plans → max(dependency waves) + 1
47
+ - Also consider dependencies on existing (non-gap) plans in the phase
48
+
49
+ **8. write PLAN.md files:**
50
+
51
+ ```yaml
52
+ ---
53
+ phase: XX-name
54
+ plan: NN # Sequential after existing
55
+ type: execute
56
+ wave: N # Computed from depends_on (see assign_waves)
57
+ depends_on: [...] # Other plans this depends on (gap or existing)
58
+ files_modified: [...]
59
+ autonomous: true
60
+ gap_closure: true # Flag for tracking
61
+ ---
62
+ ```
@@ -0,0 +1,39 @@
1
+ # Reviews Mode — Planner Reference
2
+
3
+ Triggered when orchestrator sets Mode to `reviews`. Replanning from scratch with REVIEWS.md feedback as additional context.
4
+
5
+ **Mindset:** Fresh planner with review insights — not a surgeon making patches, but an architect who has read peer critiques.
6
+
7
+ ### Step 1: Load REVIEWS.md
8
+ read the reviews file from `<files_to_read>`. Parse:
9
+ - Per-reviewer feedback (strengths, concerns, suggestions)
10
+ - Consensus Summary (agreed concerns = highest priority to address)
11
+ - Divergent Views (investigate, make a judgment call)
12
+
13
+ ### Step 2: Categorize Feedback
14
+ Group review feedback into:
15
+ - **Must address**: HIGH severity consensus concerns
16
+ - **Should address**: MEDIUM severity concerns from 2+ reviewers
17
+ - **Consider**: Individual reviewer suggestions, LOW severity items
18
+
19
+ ### Step 3: Plan Fresh with Review Context
20
+ Create new plans following the standard planning process, but with review feedback as additional constraints:
21
+ - Each HIGH severity consensus concern MUST have a task that addresses it
22
+ - MEDIUM concerns should be addressed where feasible without over-engineering
23
+ - Note in task actions: "Addresses review concern: {concern}" for traceability
24
+
25
+ ### Step 4: Return
26
+ Use standard PLANNING COMPLETE return format, adding a reviews section:
27
+
28
+ ```markdown
29
+ ### Review Feedback Addressed
30
+
31
+ | Concern | Severity | How Addressed |
32
+ |---------|----------|---------------|
33
+ | {concern} | HIGH | Plan {N}, task {M}: {how} |
34
+
35
+ ### Review Feedback Deferred
36
+ | Concern | Reason |
37
+ |---------|--------|
38
+ | {concern} | {why — out of scope, disagree, etc.} |
39
+ ```
@@ -0,0 +1,87 @@
1
+ # Revision Mode — Planner Reference
2
+
3
+ Triggered when orchestrator provides `<revision_context>` with checker issues. NOT starting fresh — making targeted updates to existing plans.
4
+
5
+ **Mindset:** Surgeon, not architect. Minimal changes for specific issues.
6
+
7
+ ### Step 1: Load Existing Plans
8
+
9
+ ```bash
10
+ cat .planning/phases/$PHASE-*/$PHASE-*-PLAN.md
11
+ ```
12
+
13
+ Build mental model of current plan structure, existing tasks, must_haves.
14
+
15
+ ### Step 2: Parse Checker Issues
16
+
17
+ Issues come in structured format:
18
+
19
+ ```yaml
20
+ issues:
21
+ - plan: "16-01"
22
+ dimension: "task_completeness"
23
+ severity: "blocker"
24
+ description: "task 2 missing <verify> element"
25
+ fix_hint: "Add verification command for build output"
26
+ ```
27
+
28
+ Group by plan, dimension, severity.
29
+
30
+ ### Step 3: Revision Strategy
31
+
32
+ | Dimension | Strategy |
33
+ |-----------|----------|
34
+ | requirement_coverage | Add task(s) for missing requirement |
35
+ | task_completeness | Add missing elements to existing task |
36
+ | dependency_correctness | Fix depends_on, recompute waves |
37
+ | key_links_planned | Add wiring task or update action |
38
+ | scope_sanity | Split into multiple plans |
39
+ | must_haves_derivation | Derive and add must_haves to frontmatter |
40
+
41
+ ### Step 4: Make Targeted Updates
42
+
43
+ **DO:** edit specific flagged sections, preserve working parts, update waves if dependencies change.
44
+
45
+ **DO NOT:** Rewrite entire plans for minor issues, add unnecessary tasks, break existing working plans.
46
+
47
+ ### Step 5: Validate Changes
48
+
49
+ - [ ] All flagged issues addressed
50
+ - [ ] No new issues introduced
51
+ - [ ] Wave numbers still valid
52
+ - [ ] Dependencies still correct
53
+ - [ ] Files on disk updated
54
+
55
+ ### Step 6: Commit
56
+
57
+ ```bash
58
+ node "$HOME/.config/opencode/get-shit-done/bin/gsd-tools.cjs" commit "fix($PHASE): revise plans based on checker feedback" --files .planning/phases/$PHASE-*/$PHASE-*-PLAN.md
59
+ ```
60
+
61
+ ### Step 7: Return Revision Summary
62
+
63
+ ```markdown
64
+ ## REVISION COMPLETE
65
+
66
+ **Issues addressed:** {N}/{M}
67
+
68
+ ### Changes Made
69
+
70
+ | Plan | Change | Issue Addressed |
71
+ |------|--------|-----------------|
72
+ | 16-01 | Added <verify> to task 2 | task_completeness |
73
+ | 16-02 | Added logout task | requirement_coverage (AUTH-02) |
74
+
75
+ ### Files Updated
76
+
77
+ - .planning/phases/16-xxx/16-01-PLAN.md
78
+ - .planning/phases/16-xxx/16-02-PLAN.md
79
+
80
+ {If any issues NOT addressed:}
81
+
82
+ ### Unaddressed Issues
83
+
84
+ | Issue | Reason |
85
+ |-------|--------|
86
+ | {issue} | {why - needs user input, architectural change, etc.} |
87
+ ```
@@ -10,8 +10,17 @@ Configuration options for `.planning/` directory behavior.
10
10
  },
11
11
  "git": {
12
12
  "branching_strategy": "none",
13
+ "base_branch": null,
13
14
  "phase_branch_template": "gsd/phase-{phase}-{slug}",
14
- "milestone_branch_template": "gsd/{milestone}-{slug}"
15
+ "milestone_branch_template": "gsd/{milestone}-{slug}",
16
+ "quick_branch_template": null
17
+ },
18
+ "manager": {
19
+ "flags": {
20
+ "discuss": "",
21
+ "plan": "",
22
+ "execute": ""
23
+ }
15
24
  }
16
25
  ```
17
26
 
@@ -20,8 +29,16 @@ Configuration options for `.planning/` directory behavior.
20
29
  | `commit_docs` | `true` | Whether to commit planning artifacts to git |
21
30
  | `search_gitignored` | `false` | Add `--no-ignore` to broad rg searches |
22
31
  | `git.branching_strategy` | `"none"` | Git branching approach: `"none"`, `"phase"`, or `"milestone"` |
32
+ | `git.base_branch` | `null` (auto-detect) | Target branch for PRs and merges (e.g. `"master"`, `"develop"`). When `null`, auto-detects from `git symbolic-ref refs/remotes/origin/HEAD`, falling back to `"main"`. |
23
33
  | `git.phase_branch_template` | `"gsd/phase-{phase}-{slug}"` | Branch template for phase strategy |
24
34
  | `git.milestone_branch_template` | `"gsd/{milestone}-{slug}"` | Branch template for milestone strategy |
35
+ | `git.quick_branch_template` | `null` | Optional branch template for quick-task runs |
36
+ | `workflow.use_worktrees` | `true` | Whether executor agents run in isolated git worktrees. Set to `false` to disable worktrees — agents execute sequentially on the main working tree instead. Recommended for solo developers or when worktree merges cause issues. |
37
+ | `workflow.subagent_timeout` | `300000` | Timeout in milliseconds for parallel subagent tasks (e.g. codebase mapping). Increase for large codebases or slower models. Default: 300000 (5 minutes). |
38
+ | `manager.flags.discuss` | `""` | Flags passed to `/gsd-discuss-phase` when dispatched from manager (e.g. `"--auto --analyze"`) |
39
+ | `manager.flags.plan` | `""` | Flags passed to plan workflow when dispatched from manager |
40
+ | `manager.flags.execute` | `""` | Flags passed to execute workflow when dispatched from manager |
41
+ | `response_language` | `null` | Language for user-facing questions and prompts across all phases/subagents (e.g. `"Portuguese"`, `"Japanese"`, `"Spanish"`). When set, all spawned agents include a directive to respond in this language. |
25
42
  </config_schema>
26
43
 
27
44
  <commit_docs_behavior>
@@ -0,0 +1,97 @@
1
+ # Revision Loop Pattern
2
+
3
+ Standard pattern for iterative agent revision with feedback. Used when a checker/validator finds issues and the producing agent needs to revise its output.
4
+
5
+ ---
6
+
7
+ ## Pattern: Check-Revise-Escalate (max 3 iterations)
8
+
9
+ This pattern applies whenever:
10
+ 1. An agent produces output (plans, imports, gap-closure plans)
11
+ 2. A checker/validator evaluates that output
12
+ 3. Issues are found that need revision
13
+
14
+ ### Flow
15
+
16
+ ```
17
+ prev_issue_count = Infinity
18
+ iteration = 0
19
+
20
+ LOOP:
21
+ 1. Run checker/validator on current output
22
+ 2. read checker results
23
+ 3. If PASSED or only INFO-level issues:
24
+ -> Accept output, exit loop
25
+ 4. If BLOCKER or WARNING issues found:
26
+ a. iteration += 1
27
+ b. If iteration > 3:
28
+ -> Escalate to user (see "After 3 Iterations" below)
29
+ c. Parse issue count from checker output
30
+ d. If issue_count >= prev_issue_count:
31
+ -> Escalate to user: "Revision loop stalled (issue count not decreasing)"
32
+ e. prev_issue_count = issue_count
33
+ f. Re-spawn the producing agent with checker feedback appended
34
+ g. After revision completes, go to LOOP
35
+ ```
36
+
37
+ ### Issue Count Tracking
38
+
39
+ Track the number of BLOCKER + WARNING issues returned by the checker on each iteration. If the count does not decrease between consecutive iterations, the producing agent is stuck and further iterations will not help. Break early and escalate to the user.
40
+
41
+ Display iteration progress before each revision spawn:
42
+ `Revision iteration {N}/3 -- {blocker_count} blockers, {warning_count} warnings`
43
+
44
+ ### Re-spawn Prompt Structure
45
+
46
+ When re-spawning the producing agent for revision, pass the checker's YAML-formatted issues. The checker's output contains a `## Issues` heading followed by a YAML block. Parse this block and pass it verbatim to the revision agent.
47
+
48
+ ```
49
+ <checker_issues>
50
+ The issues below are in YAML format. Each has: dimension, severity, finding,
51
+ affected_field, suggested_fix. Address ALL BLOCKER issues. Address WARNING
52
+ issues where feasible.
53
+
54
+ {YAML issues block from checker output -- passed verbatim}
55
+ </checker_issues>
56
+
57
+ <revision_instructions>
58
+ Address ALL BLOCKER and WARNING issues identified above.
59
+ - For each BLOCKER: make the required change
60
+ - For each WARNING: address or explain why it's acceptable
61
+ - Do NOT introduce new issues while fixing existing ones
62
+ - Preserve all content not flagged by the checker
63
+ This is revision iteration {N} of max 3. Previous iteration had {prev_count}
64
+ issues. You must reduce the count or the loop will terminate.
65
+ </revision_instructions>
66
+ ```
67
+
68
+ ### After 3 Iterations
69
+
70
+ If issues persist after 3 revision cycles:
71
+
72
+ 1. Present remaining issues to the user
73
+ 2. Use gate prompt (pattern: yes-no from `references/gate-prompts.md`):
74
+ question: "Issues remain after 3 revision attempts. Proceed with current output?"
75
+ header: "Proceed?"
76
+ options:
77
+ - label: "Proceed anyway" description: "Accept output with remaining issues"
78
+ - label: "Adjust approach" description: "Discuss a different approach"
79
+ 3. If "Proceed anyway": accept current output and continue
80
+ 4. If "Adjust approach" or "Other": discuss with user, then re-enter the producing step with updated context
81
+
82
+ ### Workflow-Specific Variations
83
+
84
+ | Workflow | Producer Agent | Checker Agent | Notes |
85
+ |----------|---------------|---------------|-------|
86
+ | plan-phase | gsd-planner | gsd-plan-checker | Revision prompt via planner-revision.md |
87
+ | execute-phase | gsd-executor | gsd-verifier | Post-execution verification |
88
+ | discuss-phase | orchestrator | gsd-plan-checker | Inline revision by orchestrator |
89
+
90
+ ---
91
+
92
+ ## Important Notes
93
+
94
+ - **INFO-level issues are always acceptable** -- they don't trigger revision
95
+ - **Each iteration gets a fresh agent spawn** -- don't try to continue in the same context
96
+ - **Checker feedback must be inlined** -- the revision agent needs to see exactly what failed
97
+ - **Don't silently swallow issues** -- always present the final state to the user after exiting the loop
@@ -108,9 +108,9 @@ Always at end of major completions.
108
108
 
109
109
  **{Identifier}: {Name}** — {one-line description}
110
110
 
111
- `{copy-paste command}`
111
+ `/new` then:
112
112
 
113
- *`/new` first → fresh context window*
113
+ `{copy-paste command}`
114
114
 
115
115
  ───────────────────────────────────────────────────────────────
116
116
 
@@ -0,0 +1,58 @@
1
+ # Universal Anti-Patterns
2
+
3
+ Rules that apply to ALL workflows and agents. Individual workflows may have additional specific anti-patterns.
4
+
5
+ ---
6
+
7
+ ## Context Budget Rules
8
+
9
+ 1. **Never** read agent definition files (`agents/*.md`) -- `@<custom_agent>` call auto-loads them. Reading agent definitions into the orchestrator wastes context for content automatically injected into subagent sessions.
10
+ 2. **Never** inline large files into subagent prompts -- tell agents to read files from disk instead. Agents have their own context windows.
11
+ 3. **read depth scales with context window** -- check `context_window_tokens` in `.planning/config.json`. At < 500000: read only frontmatter, status fields, or summaries. At >= 500000 (1M model): full body reads permitted when content is needed for inline decisions. See `references/context-budget.md` for the complete table.
12
+ 4. **Delegate** heavy work to subagents -- the orchestrator routes, it does not build, analyze, research, investigate, or verify.
13
+ 5. **Proactive pause warning**: If you have already consumed significant context (large file reads, multiple subagent results), warn the user: "Context budget is getting heavy. Consider checkpointing progress."
14
+
15
+ ## File Reading Rules
16
+
17
+ 6. **SUMMARY.md read depth scales with context window** -- at context_window_tokens < 500000: read frontmatter only from prior phase SUMMARYs. At >= 500000: full body reads permitted for direct-dependency phases. Transitive dependencies (2+ phases back) remain frontmatter-only regardless.
18
+ 7. **Never** read full PLAN.md files from other phases -- only current phase plans.
19
+ 8. **Never** read `.planning/logs/` files -- only the health workflow reads these.
20
+ 9. **Do not** re-read full file contents when frontmatter is sufficient -- frontmatter contains status, key_files, commits, and provides fields. Exception: at >= 500000, re-reading full body is acceptable when semantic content is needed.
21
+
22
+ ## Subagent Rules
23
+
24
+ 10. **NEVER** use non-GSD agent types (`general`, `Explore`, `Plan`, `bash`, `feature-dev`, etc.) -- ALWAYS use `@gsd-{agent}` call (e.g., `@gsd-phase-researcher`, `@gsd-executor`, `@gsd-planner`). GSD agents have project-aware prompts, audit logging, and workflow context. Generic agents bypass all of this.
25
+ 11. **Do not** re-litigate decisions that are already locked in CONTEXT.md (or PROJECT.md ## Context section) -- respect locked decisions unconditionally.
26
+
27
+ ## Questioning Anti-Patterns
28
+
29
+ Reference: `references/questioning.md` for the full anti-pattern list.
30
+
31
+ 12. **Do not** walk through checklists -- checklist walking (asking items one by one from a list) is the #1 anti-pattern. Instead, use progressive depth: start broad, dig where interesting.
32
+ 13. **Do not** use corporate speak -- avoid jargon like "stakeholder alignment", "synergize", "deliverables". Use plain language.
33
+ 14. **Do not** apply premature constraints -- don't narrow the solution space before understanding the problem. Ask about the problem first, then constrain.
34
+
35
+ ## State Management Anti-Patterns
36
+
37
+ 15. **No direct write/edit to STATE.md or ROADMAP.md for mutations.** Always use `gsd-tools.cjs` CLI commands (`state update`, `state advance-plan`, `roadmap update-status`) for mutations. Direct write tool usage bypasses safe update logic and is unsafe in multi-session environments. Exception: first-time creation of STATE.md from template is allowed.
38
+
39
+ ## Behavioral Rules
40
+
41
+ 16. **Do not** create artifacts the user did not approve -- always confirm before writing new planning documents.
42
+ 17. **Do not** modify files outside the workflow's stated scope -- check the plan's files_modified list.
43
+ 18. **Do not** suggest multiple next actions without clear priority -- one primary suggestion, alternatives listed secondary.
44
+ 19. **Do not** use `git add .` or `git add -A` -- stage specific files only.
45
+ 20. **Do not** include sensitive information (API keys, passwords, tokens) in planning documents or commits.
46
+
47
+ ## Error Recovery Rules
48
+
49
+ 21. **Git lock detection**: Before any git operation, if it fails with "Unable to create lock file", check for stale `.git/index.lock` and advise the user to remove it (do not remove automatically).
50
+ 22. **Config fallback awareness**: Config loading returns `null` silently on invalid JSON. If your workflow depends on config values, check for null and warn the user: "config.json is invalid or missing -- running with defaults."
51
+ 23. **Partial state recovery**: If STATE.md references a phase directory that doesn't exist, do not proceed silently. Warn the user and suggest diagnosing the mismatch.
52
+
53
+ ## GSD-Specific Rules
54
+
55
+ 24. **Do not** check for `mode === 'auto'` or `mode === 'autonomous'` -- GSD uses `yolo` config flag. Check `yolo: true` for autonomous mode, absence or `false` for interactive mode.
56
+ 25. **Always use `gsd-tools.cjs`** (not `gsd-tools.js` or any other variant) -- GSD uses CommonJS for Node.js CLI compatibility.
57
+ 26. **Plan files MUST follow `{padded_phase}-{NN}-PLAN.md` pattern** (e.g., `01-01-PLAN.md`). Never use `PLAN-01.md`, `plan-01.md`, or any other variation -- gsd-tools detection depends on this exact pattern.
58
+ 27. **Do not start executing the next plan before writing the SUMMARY.md for the current plan** -- downstream plans may reference it via `@` includes.