forge-workflow 0.0.1

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 (105) hide show
  1. package/.claude/commands/dev.md +314 -0
  2. package/.claude/commands/plan.md +389 -0
  3. package/.claude/commands/premerge.md +179 -0
  4. package/.claude/commands/research.md +42 -0
  5. package/.claude/commands/review.md +442 -0
  6. package/.claude/commands/rollback.md +721 -0
  7. package/.claude/commands/ship.md +134 -0
  8. package/.claude/commands/sonarcloud.md +152 -0
  9. package/.claude/commands/status.md +77 -0
  10. package/.claude/commands/validate.md +237 -0
  11. package/.claude/commands/verify.md +221 -0
  12. package/.claude/rules/greptile-review-process.md +285 -0
  13. package/.claude/rules/workflow.md +105 -0
  14. package/.claude/scripts/greptile-resolve.sh +526 -0
  15. package/.claude/scripts/load-env.sh +32 -0
  16. package/.forge/hooks/check-tdd.js +240 -0
  17. package/.github/PLUGIN_TEMPLATE.json +32 -0
  18. package/.mcp.json.example +12 -0
  19. package/AGENTS.md +169 -0
  20. package/CLAUDE.md +99 -0
  21. package/LICENSE +21 -0
  22. package/README.md +414 -0
  23. package/bin/forge-cmd.js +313 -0
  24. package/bin/forge-validate.js +303 -0
  25. package/bin/forge.js +4228 -0
  26. package/docs/AGENT_INSTALL_PROMPT.md +342 -0
  27. package/docs/ENHANCED_ONBOARDING.md +602 -0
  28. package/docs/EXAMPLES.md +482 -0
  29. package/docs/GREPTILE_SETUP.md +400 -0
  30. package/docs/MANUAL_REVIEW_GUIDE.md +106 -0
  31. package/docs/ROADMAP.md +359 -0
  32. package/docs/SETUP.md +632 -0
  33. package/docs/TOOLCHAIN.md +849 -0
  34. package/docs/VALIDATION.md +363 -0
  35. package/docs/WORKFLOW.md +400 -0
  36. package/docs/planning/PROGRESS.md +396 -0
  37. package/docs/plans/.gitkeep +0 -0
  38. package/docs/plans/2026-02-27-forge-test-suite-v2-decisions.md +21 -0
  39. package/docs/plans/2026-02-27-forge-test-suite-v2-design.md +362 -0
  40. package/docs/plans/2026-02-27-forge-test-suite-v2-tasks.md +343 -0
  41. package/docs/plans/2026-03-02-superpowers-gaps-decisions.md +26 -0
  42. package/docs/plans/2026-03-02-superpowers-gaps-design.md +239 -0
  43. package/docs/plans/2026-03-02-superpowers-gaps-tasks.md +260 -0
  44. package/docs/plans/2026-03-04-agent-command-parity-design.md +163 -0
  45. package/docs/plans/2026-03-04-verify-worktree-cleanup-decisions.md +7 -0
  46. package/docs/plans/2026-03-04-verify-worktree-cleanup-design.md +165 -0
  47. package/docs/plans/2026-03-05-forge-uto-decisions.md +6 -0
  48. package/docs/plans/2026-03-05-forge-uto-design.md +116 -0
  49. package/docs/plans/2026-03-05-forge-uto-tasks.md +244 -0
  50. package/docs/plans/2026-03-10-command-creator-and-eval-decisions.md +52 -0
  51. package/docs/plans/2026-03-10-command-creator-and-eval-design.md +350 -0
  52. package/docs/plans/2026-03-10-command-creator-and-eval-tasks.md +426 -0
  53. package/docs/plans/2026-03-10-stale-workflow-refs-decisions.md +8 -0
  54. package/docs/plans/2026-03-10-stale-workflow-refs-design.md +80 -0
  55. package/docs/plans/2026-03-10-stale-workflow-refs-tasks.md +90 -0
  56. package/docs/plans/2026-03-14-beads-plan-context-decisions.md +9 -0
  57. package/docs/plans/2026-03-14-beads-plan-context-design.md +171 -0
  58. package/docs/plans/2026-03-14-beads-plan-context-tasks.md +160 -0
  59. package/docs/plans/2026-03-14-skill-eval-loop-decisions.md +33 -0
  60. package/docs/plans/2026-03-14-skill-eval-loop-design.md +118 -0
  61. package/docs/plans/2026-03-14-skill-eval-loop-results.md +78 -0
  62. package/docs/plans/2026-03-14-skill-eval-loop-tasks.md +160 -0
  63. package/docs/plans/2026-03-15-agent-command-parity-v2-decisions.md +11 -0
  64. package/docs/plans/2026-03-15-agent-command-parity-v2-design.md +145 -0
  65. package/docs/plans/2026-03-15-agent-command-parity-v2-tasks.md +211 -0
  66. package/docs/research/TEMPLATE.md +292 -0
  67. package/docs/research/advanced-testing.md +297 -0
  68. package/docs/research/agent-permissions.md +167 -0
  69. package/docs/research/dependency-chain.md +328 -0
  70. package/docs/research/forge-workflow-v2.md +550 -0
  71. package/docs/research/plugin-architecture.md +772 -0
  72. package/docs/research/pr4-cli-automation.md +326 -0
  73. package/docs/research/premerge-verify-restructure.md +205 -0
  74. package/docs/research/skills-restructure.md +508 -0
  75. package/docs/research/sonarcloud-perfection-plan.md +166 -0
  76. package/docs/research/sonarcloud-quality-gate.md +184 -0
  77. package/docs/research/superpowers-integration.md +403 -0
  78. package/docs/research/superpowers.md +319 -0
  79. package/docs/research/test-environment.md +519 -0
  80. package/install.sh +1062 -0
  81. package/lefthook.yml +39 -0
  82. package/lib/agents/README.md +198 -0
  83. package/lib/agents/claude.plugin.json +28 -0
  84. package/lib/agents/cline.plugin.json +22 -0
  85. package/lib/agents/codex.plugin.json +19 -0
  86. package/lib/agents/copilot.plugin.json +24 -0
  87. package/lib/agents/cursor.plugin.json +25 -0
  88. package/lib/agents/kilocode.plugin.json +22 -0
  89. package/lib/agents/opencode.plugin.json +20 -0
  90. package/lib/agents/roo.plugin.json +23 -0
  91. package/lib/agents-config.js +2112 -0
  92. package/lib/commands/dev.js +513 -0
  93. package/lib/commands/plan.js +696 -0
  94. package/lib/commands/recommend.js +119 -0
  95. package/lib/commands/ship.js +377 -0
  96. package/lib/commands/status.js +378 -0
  97. package/lib/commands/validate.js +602 -0
  98. package/lib/context-merge.js +359 -0
  99. package/lib/plugin-catalog.js +360 -0
  100. package/lib/plugin-manager.js +166 -0
  101. package/lib/plugin-recommender.js +141 -0
  102. package/lib/project-discovery.js +491 -0
  103. package/lib/setup.js +118 -0
  104. package/lib/workflow-profiles.js +203 -0
  105. package/package.json +115 -0
@@ -0,0 +1,260 @@
1
+ # Task List: superpowers-gaps
2
+
3
+ **Feature**: superpowers-gaps
4
+ **Design doc**: `docs/plans/2026-03-02-superpowers-gaps-design.md`
5
+ **Beads**: forge-6od
6
+ **Branch**: feat/superpowers-gaps
7
+ **Created**: 2026-03-02
8
+ **Baseline**: 1215 pass, 0 fail
9
+
10
+ ---
11
+
12
+ ## Overview
13
+
14
+ 6 changes, ordered by dependency:
15
+ 0a. **Task 0a**: ✅ Entry HARD-GATE in `/plan` — blocks planning if not on master, creates worktree before Phase 1 (DONE: 86eaec8)
16
+ 0b. **Task 0b**: ✅ Branch isolation fix in `/plan` Phase 3 — always `git checkout master` before branching (DONE: 9b31bd9)
17
+ 1. **Task 1**: DRY gate in `plan.md` Phase 2 (instruction change only — no lib/test change)
18
+ 2. **Task 2**: YAGNI filter in `plan.md` Phase 3 + `lib/commands/plan.js` function + test
19
+ 3. **Task 3**: Verification HARD-GATE in `dev.md` task completion (instruction change only)
20
+ 4. **Task 4**: Rename `/check` → `/validate`: rename files, update lib, update tests, update all references
21
+
22
+ ---
23
+
24
+ ## Task 1: DRY gate in /plan Phase 2
25
+
26
+ **File(s)**:
27
+ - `.claude/commands/plan.md`
28
+
29
+ **What to implement**:
30
+ Add an explicit DRY search step to Phase 2's "Codebase exploration" section, immediately before the `HARD-GATE: Phase 2 exit` block. The step must require the agent to use actual search tools (Grep, Glob, Read) — not just "think about it" — to find existing implementations before finalizing the approach. If a match is found, the design doc's approach section must be updated to say "extend existing [file/function]" not "create new".
31
+
32
+ **TDD steps**:
33
+ 1. Write test: `test/commands/plan.phases.test.js` — add test `'should detect DRY violation when existing implementation found'`
34
+ - Input: mock codebase grep returning a match for a search term
35
+ - Expected: `detectDRYViolation({ searchTerm: 'validateSlug', matches: [{ file: 'lib/utils.js', line: 42 }] })` returns `{ violation: true, existingFile: 'lib/utils.js', existingLine: 42 }`
36
+ 2. Run test: `bun test test/commands/plan.phases.test.js` — confirm it fails (function doesn't exist yet)
37
+ 3. Implement: add `detectDRYViolation(params)` to `lib/commands/plan.js` AND add DRY search step to `plan.md` Phase 2 codebase exploration section
38
+ 4. Run test: confirm it passes
39
+ 5. Commit: `feat: add DRY gate to /plan Phase 2 codebase exploration`
40
+
41
+ **Expected output**:
42
+ - `plan.md` Phase 2 has new step under "Codebase exploration": "DRY check — before finalizing approach, run grep/glob searches for existing implementations of [key concept from approach]. Document what was found. If match exists: update approach to 'extend [file]', not 'create new'."
43
+ - `lib/commands/plan.js` exports `detectDRYViolation({ searchTerm, matches })` returning `{ violation: bool, existingFile?, existingLine? }`
44
+ - Test passes
45
+
46
+ ---
47
+
48
+ ## Task 2: YAGNI filter in /plan Phase 3 task writing
49
+
50
+ **File(s)**:
51
+ - `.claude/commands/plan.md`
52
+ - `lib/commands/plan.js`
53
+ - `test/commands/plan.phases.test.js`
54
+
55
+ **What to implement**:
56
+ Add a YAGNI filter step to Phase 3 Step 5 (task list creation), after the initial task draft but before saving to file. For each task, the agent must confirm it maps to a specific requirement, success criterion, or edge case in the design doc. Tasks with no design doc anchor are flagged. Flagged tasks are presented to the user as "potential scope creep" with the anchor they couldn't find. The user decides: keep (and specify which requirement it serves) or remove.
57
+
58
+ Special case: if ALL tasks are flagged, return `allFlagged: true` and message "Design doc doesn't cover all tasks — needs amendment."
59
+
60
+ **TDD steps**:
61
+ 1. Write test: `test/commands/plan.phases.test.js` — add 3 tests:
62
+ - `'should pass YAGNI filter when task maps to design doc requirement'`
63
+ - Input: `applyYAGNIFilter({ task: 'Add validateSlug function', designDoc: '## Success Criteria\n- validateSlug validates slug format' })`
64
+ - Expected: `{ flagged: false, anchor: 'Success Criteria: validateSlug validates slug format' }`
65
+ - `'should flag task with no design doc anchor'`
66
+ - Input: `applyYAGNIFilter({ task: 'Add dark mode toggle', designDoc: '## Success Criteria\n- validateSlug validates slug format' })`
67
+ - Expected: `{ flagged: true, reason: 'No matching requirement found in design doc' }`
68
+ - `'should return allFlagged when all tasks fail YAGNI filter'`
69
+ - Input: `applyYAGNIFilter({ tasks: ['Task A', 'Task B'], designDoc: '## Purpose\nFoo' })`
70
+ - Expected: `{ allFlagged: true, message: "Design doc doesn't cover all tasks — needs amendment" }`
71
+ 2. Run test: `bun test test/commands/plan.phases.test.js` — confirm all 3 fail
72
+ 3. Implement: add `applyYAGNIFilter(params)` to `lib/commands/plan.js` AND add YAGNI filter step to `plan.md` Phase 3 Step 5
73
+ 4. Run test: confirm all 3 pass
74
+ 5. Commit: `feat: add YAGNI filter to /plan Phase 3 task writing`
75
+
76
+ **Expected output**:
77
+ - `plan.md` Phase 3 Step 5 has new step after "initial task draft": "YAGNI filter — for each task, find the design doc requirement it serves (success criterion, edge case, constraint). Tasks with no match → flag as 'potential scope creep'. Present flagged tasks to user. User decides: keep (specify requirement) or remove."
78
+ - `lib/commands/plan.js` exports `applyYAGNIFilter({ task|tasks, designDoc })` with correct behavior per tests above
79
+ - All 3 tests pass
80
+
81
+ ---
82
+
83
+ ## Task 3: Verification HARD-GATE in /dev task completion
84
+
85
+ **File(s)**:
86
+ - `.claude/commands/dev.md`
87
+
88
+ **What to implement**:
89
+ Upgrade the existing `<HARD-GATE: task completion>` block (currently at line ~178) to require fresh verification evidence before marking a task done. The current gate checks test passage only. The new gate must also require: run the actual implemented function/feature and observe real output. This is the "verification-before-completion" Iron Law from Superpowers: "NO COMPLETION CLAIMS WITHOUT FRESH VERIFICATION EVIDENCE."
90
+
91
+ The gate must explicitly:
92
+ 1. Name what command proves completion
93
+ 2. Require running it fresh (not "last run was fine")
94
+ 3. Show the actual output
95
+ 4. Forbid the phrases: "should pass", "looks good", "seems to work"
96
+
97
+ This is a `.md` instruction change only — no `lib/` change, no new test. The existing `dev.test.js` tests should continue to pass.
98
+
99
+ **TDD steps**:
100
+ 1. Write test: `test/commands/dev.test.js` — add test `'should require fresh verification evidence in completion gate'`
101
+ - Search for `HARD-GATE: task completion` in dev.md content
102
+ - Expected: the gate text includes "fresh" AND "actual output" AND does NOT include any path that allows "should pass" without running
103
+ - This is a documentation structure test: `const content = fs.readFileSync('.claude/commands/dev.md'); expect(content).toContain('fresh'); expect(content).toContain('actual output');`
104
+ 2. Run test: `bun test test/commands/dev.test.js` — confirm it fails (current gate doesn't have this language)
105
+ 3. Implement: update the `<HARD-GATE: task completion>` block in `dev.md` with the verification-before-completion language
106
+ 4. Run test: confirm it passes
107
+ 5. Commit: `feat: add verification-before-completion to /dev task completion gate`
108
+
109
+ **Expected output**:
110
+ - `dev.md` task completion HARD-GATE includes:
111
+ - "Run the implemented function/feature and observe actual output (not just tests)"
112
+ - "Forbidden: 'should pass', 'looks good', 'seems to work' — these are not evidence"
113
+ - "Required: paste actual command + actual output before marking task done"
114
+ - Test passes
115
+
116
+ ---
117
+
118
+ ## Task 4: Rename /check → /validate + add 4-phase debug mode
119
+
120
+ This is the largest task. Split into 4 sub-tasks for clarity, but implement as one committed change (keep atomic).
121
+
122
+ ### Task 4a: Rename core files
123
+
124
+ **File(s)**:
125
+ - `.claude/commands/check.md` → `.claude/commands/validate.md`
126
+ - `lib/commands/check.js` → `lib/commands/validate.js`
127
+ - `test/commands/check.test.js` → `test/commands/validate.test.js`
128
+
129
+ **What to implement**:
130
+ - Copy check.md to validate.md, update heading and command references inside
131
+ - Copy check.js to validate.js, update function name exports (`executeCheck` → `executeValidate`, etc.) and the `require()` path in validate.test.js
132
+ - Delete original check.md, check.js, check.test.js after copies are correct
133
+ - Verify tests pass: `bun test test/commands/validate.test.js`
134
+
135
+ **TDD steps**:
136
+ 1. Write test: `test/commands/validate.test.js` (copy of check.test.js with updated imports/names)
137
+ - Key test: `'should run all validations in sequence'` using `executeValidate()` instead of `executeCheck()`
138
+ - Additional test: `'should export executeValidate function'` — `const { executeValidate } = require('../../lib/commands/validate.js'); expect(typeof executeValidate).toBe('function')`
139
+ 2. Run test: `bun test test/commands/validate.test.js` — confirm it fails (validate.js doesn't exist)
140
+ 3. Implement: create validate.js (copy+rename from check.js), create validate.md (copy+rename from check.md)
141
+ 4. Run test: confirm it passes
142
+ 5. Do NOT delete check.js/check.md yet — wait for Task 4d to update all references first
143
+
144
+ ### Task 4b: Add 4-phase debug mode to validate.md
145
+
146
+ **File(s)**:
147
+ - `.claude/commands/validate.md`
148
+ - `lib/commands/validate.js`
149
+ - `test/commands/validate.test.js`
150
+
151
+ **What to implement**:
152
+ Add debug mode as a new section in `validate.md` that activates when any validation step fails. The section must implement the 4-phase systematic debug flow:
153
+ - Phase D1: Reproduce — confirm failure is deterministic, exact error output
154
+ - Phase D2: Root-cause trace — trace failure to source (not symptom)
155
+ - Phase D3: Fix — SINGLE minimal fix, ONE change at a time, FAILING TEST FIRST
156
+ - Phase D4: Verify — re-run full validation from beginning, confirm fix works end-to-end
157
+
158
+ HARD-GATE in debug mode: "NO FIXES WITHOUT ROOT CAUSE INVESTIGATION FIRST" and "3+ fix attempts = STOP, question architecture."
159
+
160
+ In `lib/commands/validate.js`, add:
161
+ - `executeDebugMode({ error, fixAttempts })` — returns `{ escalate: bool, phase: 'D1'|'D2'|'D3'|'D4' }`
162
+ - When `fixAttempts >= 3` → returns `{ escalate: true, message: 'STOP: 3+ fixes. Question architecture before Fix #4.' }`
163
+
164
+ **TDD steps**:
165
+ 1. Write test: `test/commands/validate.test.js` — add 3 tests:
166
+ - `'should enter debug mode on validation failure'`
167
+ - Input: `executeDebugMode({ error: 'Test failed: expected 42, got 0', fixAttempts: 0 })`
168
+ - Expected: `{ escalate: false, phase: 'D1' }`
169
+ - `'should escalate when 3+ fix attempts'`
170
+ - Input: `executeDebugMode({ error: 'still failing', fixAttempts: 3 })`
171
+ - Expected: `{ escalate: true, message: ... }`
172
+ - `'should require fresh verification before claiming fix works'`
173
+ - Input: `executeDebugMode({ error: 'err', fixAttempts: 1, claim: 'should be fixed now' })`
174
+ - Expected: `{ valid: false, reason: 'No fresh verification evidence — run validation fresh' }`
175
+ 2. Run test: confirm all 3 fail
176
+ 3. Implement: add `executeDebugMode()` to `lib/commands/validate.js` AND add 4-phase debug section to `validate.md`
177
+ 4. Run test: confirm all 3 pass
178
+ 5. Hold commit until Task 4c complete
179
+
180
+ ### Task 4c: Update all /check references in command docs
181
+
182
+ **File(s)**:
183
+ - `.claude/commands/dev.md`
184
+ - `.claude/commands/plan.md`
185
+ - `.claude/commands/ship.md`
186
+ - `.claude/commands/review.md`
187
+ - `.claude/commands/premerge.md`
188
+ - `.claude/commands/verify.md`
189
+ - `.claude/commands/research.md`
190
+ - `.claude/commands/rollback.md`
191
+ - `.claude/rules/workflow.md`
192
+ - `AGENTS.md`
193
+
194
+ **What to implement**:
195
+ Replace all `/check` references with `/validate` in the files listed above. Also update:
196
+ - `check.md` → `validate.md` in any file link (`[.claude/commands/check.md]`)
197
+ - `<HARD-GATE: /check exit>` → `<HARD-GATE: /validate exit>`
198
+ - Stage description in workflow table: "Type check, lint, code review, security, tests" → "Validate: type check, lint, tests, security. On failure: 4-phase debug mode."
199
+
200
+ **TDD steps**:
201
+ 1. Write test: `test/commands/validate.test.js` — add test:
202
+ - `'AGENTS.md should reference /validate not /check'`
203
+ - `const content = fs.readFileSync('AGENTS.md', 'utf-8'); expect(content).not.toContain('/check'); expect(content).toContain('/validate');`
204
+ 2. Run test: confirm it fails (AGENTS.md still has /check)
205
+ 3. Implement: batch-replace `/check` → `/validate` across all listed files
206
+ 4. Run test: confirm it passes
207
+ 5. Hold commit until Task 4d complete
208
+
209
+ ### Task 4d: Update docs + GitHub files, delete old check files
210
+
211
+ **File(s)**:
212
+ - `docs/WORKFLOW.md`
213
+ - `docs/TOOLCHAIN.md`
214
+ - `docs/VALIDATION.md`
215
+ - `docs/EXAMPLES.md`
216
+ - `docs/README-v1.3.md`
217
+ - `docs/ROADMAP.md`
218
+ - `docs/MANUAL_REVIEW_GUIDE.md`
219
+ - `docs/ENHANCED_ONBOARDING.md`
220
+ - `.github/CONTRIBUTING.md`
221
+ - `.github/pull_request_template.md`
222
+ - `.github/agentic-workflows/behavioral-test.md`
223
+ - Delete: `.claude/commands/check.md`, `lib/commands/check.js`, `test/commands/check.test.js`
224
+
225
+ **What to implement**:
226
+ - Batch-replace `/check` → `/validate` in all docs/ and .github/ files
227
+ - Delete the original check.md, check.js, check.test.js (now superseded)
228
+ - Update `check.md` links in CONTRIBUTING.md to point to `validate.md`
229
+
230
+ **TDD steps**:
231
+ 1. Write test: `test/commands/validate.test.js` — add test:
232
+ - `'check.md should no longer exist'`
233
+ - `const exists = fs.existsSync('.claude/commands/check.md'); expect(exists).toBe(false);`
234
+ 2. Run test: confirm it fails (check.md still exists)
235
+ 3. Implement: replace in all docs files, then delete check.md, check.js, check.test.js
236
+ 4. Run test: confirm it passes
237
+ 5. Now run FULL test suite: `bun test` — confirm 1215 pass, 0 fail (minus the removed check.test.js tests now in validate.test.js)
238
+ 6. Commit all Task 4a-4d changes: `feat: rename /check to /validate with 4-phase debug mode on failure`
239
+
240
+ ---
241
+
242
+ ## Flagged Tasks (No Design Doc Anchor — Pre-Cleared with User)
243
+
244
+ None. All tasks above map directly to confirmed requirements in the design doc.
245
+
246
+ ---
247
+
248
+ ## Summary
249
+
250
+ | Task | Files Changed | Type | Effort |
251
+ |---|---|---|---|
252
+ | Task 1: DRY gate | plan.md, plan.js, plan.phases.test.js | feature | Small |
253
+ | Task 2: YAGNI filter | plan.md, plan.js, plan.phases.test.js | feature | Small |
254
+ | Task 3: Verification gate | dev.md, dev.test.js | feature | Tiny |
255
+ | Task 4a: Core rename | validate.md, validate.js, validate.test.js | refactor | Medium |
256
+ | Task 4b: Debug mode | validate.md, validate.js, validate.test.js | feature | Medium |
257
+ | Task 4c: Command doc refs | 9 command/rule files | refactor | Small |
258
+ | Task 4d: Docs + delete | 8 docs + 3 github + 3 deletes | refactor | Small |
259
+
260
+ **Total**: 7 sub-tasks, ~4 distinct TDD cycles
@@ -0,0 +1,163 @@
1
+ # Design: Agent Command Parity
2
+
3
+ - **Slug**: agent-command-parity
4
+ - **Date**: 2026-03-04
5
+ - **Status**: Superseded by 2026-03-15-agent-command-parity-v2-design.md
6
+
7
+ ---
8
+
9
+ ## Purpose
10
+
11
+ Every major AI coding agent (Claude Code, Cursor, Codex CLI, OpenCode, Cline, Windsurf, Aider, Kilo, Roo, Continue, Copilot) should have the full Forge workflow implemented using that agent's **native mechanism** — whether that's slash commands, workflow files, rules/context injection, or prompt files.
12
+
13
+ Currently only Claude Code has complete command support. Cursor/Cline/Codex/OpenCode/Windsurf have partial or no implementation. Stage count is inconsistent across files (7 vs 9 stages). The `check → validate` rename exists only in feat/superpowers-gaps (PR 50).
14
+
15
+ **Critically**: Since Forge is used as a framework across many projects, manually cross-checking every agent after each change is not viable. This feature also ships `forge check-agents` — a CLI command any project can run to automatically verify all agent configs are complete and consistent. This becomes part of every project's `/check` stage.
16
+
17
+ ---
18
+
19
+ ## Success Criteria
20
+
21
+ 1. **Claude Code**: Already complete — verify stays correct after PR 50 merge
22
+ 2. **OpenCode**: `.opencode/commands/` — 7 stage command files
23
+ 3. **Antigravity**: `.agents/workflows/` — 7 stage workflow files (triggered with `/workflow-name`)
24
+ 4. **Cursor**: `.cursor/commands/` — 7 stage command files (beta v1.6+)
25
+ 5. **Cline**: `.clinerules/workflows/` — 7 stage workflow files (v3.13+)
26
+ 6. **Windsurf**: `.windsurf/workflows/` — 7 stage workflow files
27
+ 7. **Kilo Code**: `.kilocode/commands/` — 7 stage command files
28
+ 8. **Roo Code**: `.roo/commands/` — 7 stage command files
29
+ 9. **Continue**: `.continue/prompts/` — 7 `.prompt` files with `invokable: true`
30
+ 10. **GitHub Copilot**: `.github/prompts/` — 7 `.prompt.md` files
31
+ 11. **Codex VS Code ext**: `.agents/skills/forge-workflow/SKILL.md` — shared dir with Antigravity; invoked `$forge-workflow` (no project-level `/` commands possible)
32
+ 12. **Aider**: ~~dropped~~ — built-in `/commands` conflict with Forge commands, no custom slash command support, degraded UX. Use Claude Code or any other supported agent instead.
33
+ 13. **All configs consistent**: Same 7-stage workflow, same command names (post-PR-50 = `/validate` not `/check`)
34
+ 14. **Plugin catalog updated**: `lib/agents/*.plugin.json` — all capability flags correct
35
+ 15. **`forge check-agents` CLI command**: Verifies all agent configs are complete and consistent; ships as part of Forge CLI.
36
+
37
+ ---
38
+
39
+ ## Out of Scope
40
+
41
+ - Inventing new workflow stages — the 7-stage workflow is frozen pending PR 50 merge
42
+ - Implementing the workflow logic itself (commands already exist in `.claude/commands/`)
43
+ - Cross-agent testing infrastructure (separate feature)
44
+ - Merging PR 50 (user does that manually)
45
+
46
+ ---
47
+
48
+ ## Dependencies
49
+
50
+ - **PR 50 must merge first** (`feat/superpowers-gaps`) — it contains `check → validate` rename and other fixes; all agent files in this plan use `/validate` naming
51
+ - This work branches from master **after** PR 50 merges
52
+
53
+ ---
54
+
55
+ ## Approach Selected
56
+
57
+ **Native mechanism per agent**: Each agent gets the files appropriate to its actual command system. The source of truth for command content is `.claude/commands/*.md` (which will have `validate.md` post-PR-50). All other agent files are adapters of this source.
58
+
59
+ **Agent priority order** (true slash commands first, then best-effort):
60
+ 1. Claude Code — already complete, verify after PR 50 merge
61
+ 2. OpenCode — `.opencode/commands/*.md`
62
+ 3. Antigravity — `.agents/workflows/*.md` (also has `.agents/skills/` shared with Codex)
63
+ 4. Cursor — `.cursor/commands/*.md` (beta v1.6+)
64
+ 5. Cline — `.clinerules/workflows/*.md` (v3.13+)
65
+ 6. Windsurf — `.windsurf/workflows/*.md`
66
+ 7. Kilo Code — `.kilocode/commands/*.md`
67
+ 8. Roo Code — `.roo/commands/*.md`
68
+ 9. Continue — `.continue/prompts/*.prompt` (with `invokable: true`)
69
+ 10. GitHub Copilot — `.github/prompts/*.prompt.md`
70
+ 11. Codex (VS Code ext) — `.agents/skills/forge-workflow/SKILL.md` (shared dir with Antigravity; no `/` commands; uses `$skill-name` or implicit)
71
+ 12. Aider — **dropped** (built-in command conflicts, no slash command support)
72
+
73
+ **Build order**:
74
+ 1. Research: confirm exact file format for each agent (especially Codex CLI, Windsurf, Kilo, Roo, Continue, Copilot)
75
+ 2. Implement priority 2–8 (native command/workflow/prompt files)
76
+ 3. Implement priority 9–11 (context-injection agents — update rules/context files)
77
+ 4. Update plugin catalog (`lib/agents/*.plugin.json`) to reflect actual capabilities
78
+ 5. Update AGENTS.md to be the consistent, authoritative cross-agent reference
79
+ 6. Build `forge check-agents` CLI command — validates all agent configs in any project using Forge
80
+
81
+ ---
82
+
83
+ ## Constraints
84
+
85
+ - **UX parity**: User types `/plan`, `/dev`, `/validate`, `/ship`, `/review`, `/premerge`, `/verify` — same command names in every agent, same resulting behavior. The agent handles it natively or via context, but the UX is identical.
86
+ - **Context-injection agents must be actionable**: For Cursor native/Cline — config files must read as "when you see `/plan`, do X" not "here is documentation about X". Imperative, not descriptive.
87
+ - **AGENTS.md stays small**: It is always-loaded context (Aider, Codex skills, etc.). Keep it as a concise imperative command reference — not a documentation dump. Full step-by-step detail lives only in per-agent command files, loaded on demand.
88
+ - Command content must be consistent across all agents (same steps, same HARD-GATEs)
89
+ - No introducing new workflow logic — just adapting existing `.claude/commands/` content
90
+ - File formats must match each agent's actual spec (confirmed via research, not assumed)
91
+ - Ambiguity policy: Pause and ask user if any agent's format is unexpected
92
+
93
+ ---
94
+
95
+ ## Edge Cases
96
+
97
+ - **Codex VS Code extension `/commands` in UI = built-in system commands only**: No project-level custom slash commands. Use Skills at `.agents/skills/forge-workflow/SKILL.md` — invoked with `$forge-workflow` or implicitly. The `/` menu shown in UI is not extensible per-project.
98
+ - **Cursor has TWO separate systems**: `.cursor/rules/*.mdc` = persistent context injected every prompt (NOT commands). `.cursor/commands/*.md` = true slash commands (beta v1.6+, triggered on-demand with `/`). We implement both.
99
+ - **Cline has TWO separate systems**: `.clinerules/*.md` = persistent rules. `.clinerules/workflows/*.md` = true slash commands (v3.13+). We implement workflows for commands.
100
+ - **Continue uses `.prompt` extension, not `.md`**: `invokable: true` frontmatter required to enable slash command.
101
+ - **Copilot uses `.prompt.md` double extension**: File must be in `.github/prompts/`.
102
+ - **Some agents don't support hooks**: Windsurf (`.windsurf/hooks.json`) and Copilot (`.github/hooks/*.json`, Preview) support hooks. Codex CLI, Roo, Kilo, Continue do not. Only implement hooks for agents confirmed above.
103
+ - **PR 50 not merged when starting /dev**: Do not start /dev until PR 50 is merged — all files use `/validate`, not `/check`
104
+ - **Plugin.json out of sync**: Multiple plugin files have wrong capability flags — `cursor.plugin.json` says `commands: false` (correct — Cursor uses extension), Codex CLI plugin is missing entirely, hooks flags are all unset.
105
+
106
+ ---
107
+
108
+ ## Ambiguity Policy
109
+
110
+ If any agent's native command format is discovered to differ from what was researched, **pause and ask the user** before implementing. Document the finding and proposed approach, then wait for approval.
111
+
112
+ ---
113
+
114
+ ## Technical Research
115
+
116
+ ### Agent Command/Workflow File Formats (Confirmed)
117
+
118
+ | Agent | Command Dir | File Ext | Key Frontmatter | Trigger | Hooks |
119
+ |-------|------------|----------|-----------------|---------|-------|
120
+ | Claude Code | `.claude/commands/` | `.md` | `description:` | `/name` | `.claude/settings.json` |
121
+ | OpenCode | `.opencode/commands/` | `.md` | `description`, `agent`, `model`, `subtask` | `/name` | Plugin JS/TS: 25+ events |
122
+ | **Antigravity** | `.agents/workflows/` | `.md` | `description:` (optional) | `/name` | `.agents/hooks/` (TBD) |
123
+ | Cursor | `.cursor/commands/` | `.md` | None required | `/name` | None |
124
+ | Cline | `.clinerules/workflows/` | `.md` | None required | `/name` | None |
125
+ | Windsurf | `.windsurf/workflows/` | `.md` | None required | `/name` | `.windsurf/hooks.json`: 12 events |
126
+ | Kilo Code | `.kilocode/commands/` | `.md` | `description`, `mode` | `/name` | None |
127
+ | Roo Code | `.roo/commands/` | `.md` | `description`, `argument-hint`, `mode` | `/name` | None |
128
+ | Continue | `.continue/prompts/` | `.prompt` | `name`, `description`, `invokable: true` | `/name` | None |
129
+ | Copilot | `.github/prompts/` | `.prompt.md` | `name`, `description`, `agent`, `model`, `tools` | `/name` | `.github/hooks/*.json`: 8 events |
130
+ | Codex (ext) | `.agents/skills/<name>/` | `SKILL.md` | `name`, `description` | `$name` (implicit) | None shipped |
131
+ | Aider | **dropped** — command conflicts | — | — | — | — |
132
+
133
+ ### OWASP Top 10 Analysis
134
+
135
+ This feature writes config/instruction files — no user input processing, no auth, no network calls from config files themselves. Risk surface is minimal:
136
+
137
+ - **A01 Broken Access Control**: N/A — no access control in config files
138
+ - **A02 Cryptographic Failures**: N/A
139
+ - **A03 Injection**: Low risk — hook scripts run shell commands. Mitigate: all hook scripts in `.windsurf/hooks.json` and `.github/hooks/*.json` use hardcoded paths, no user input interpolated.
140
+ - **A05 Security Misconfiguration**: Moderate — agent permission configs (opencode.json, `.codex/config.toml`) must not over-grant. Mitigate: follow existing deny/ask/allow patterns established in current configs.
141
+ - **A08 Software and Data Integrity**: Low — config files are checked into git, integrity protected by version control.
142
+ - **Others (A04, A06, A07, A09, A10)**: Not applicable to static config files.
143
+
144
+ ### TDD Test Scenarios (for `forge check-agents`)
145
+
146
+ 1. **Happy path**: Project with all agent dirs populated → `forge check-agents` exits 0, prints "All agents: OK"
147
+ 2. **Missing command file**: Project missing `.opencode/commands/validate.md` → exits non-zero, prints which file is missing for which agent
148
+ 3. **Inconsistent stage count**: `.windsurfrules` says 9 stages, plugin says 7 → check flags inconsistency
149
+ 4. **Unknown agent format in plugin**: plugin.json references directory that doesn't exist → check warns, doesn't error (agent may not be installed)
150
+ 5. **Wrong file extension**: `.continue/prompts/validate.md` instead of `validate.prompt` → check flags extension error
151
+
152
+ ### Sources
153
+
154
+ - [OpenAI Codex CLI Skills](https://developers.openai.com/codex/skills/)
155
+ - [OpenCode Commands](https://opencode.ai/docs/commands/)
156
+ - [Windsurf Workflows](https://docs.windsurf.com/windsurf/cascade/workflows)
157
+ - [Windsurf Hooks](https://docs.windsurf.com/windsurf/cascade/hooks)
158
+ - [Kilo Code Workflows](https://kilo.ai/docs/customize/workflows)
159
+ - [Roo Code Commands](https://docs.roocode.com/features/slash-commands)
160
+ - [Continue Prompt Files](https://docs.continue.dev/customize/deep-dives/prompts)
161
+ - [GitHub Copilot Prompts](https://code.visualstudio.com/docs/copilot/customization/prompt-files)
162
+ - [GitHub Copilot Hooks](https://code.visualstudio.com/docs/copilot/customization/hooks)
163
+ - [Antigravity Workflows](https://docs.antigravity.dev/workflows) <!-- agent-command-parity research; verify URL when implementing -->
@@ -0,0 +1,7 @@
1
+ # Decisions Log: verify-worktree-cleanup
2
+
3
+ - **Feature**: verify-worktree-cleanup
4
+ - **Date**: 2026-03-04
5
+ - **Beads**: forge-bmi
6
+
7
+ _No decisions logged yet._
@@ -0,0 +1,165 @@
1
+ # Design: Fix /verify to Clean Up Worktree and Branch After Merge
2
+
3
+ - **Slug**: verify-worktree-cleanup
4
+ - **Date**: 2026-03-04
5
+ - **Status**: Approved
6
+ - **Beads**: forge-bmi
7
+
8
+ ---
9
+
10
+ ## Purpose
11
+
12
+ `/verify` runs after a PR merges. Currently it checks CI and deployments, but never removes the feature worktree or local branch — leaving stale state in the repo. The example output even shows "Branch: feat/auth-refresh deleted ✓" but no step actually does this.
13
+
14
+ Result: every merged feature leaves a dangling worktree + local branch forever, requiring manual cleanup.
15
+
16
+ ---
17
+
18
+ ## Success Criteria
19
+
20
+ 1. After `/verify` runs on a healthy merge, the feature worktree is removed (`git worktree remove`)
21
+ 2. After `/verify` runs on a healthy merge, the local feature branch is deleted (`git branch -d`)
22
+ 3. If the worktree directory doesn't exist (already cleaned up manually), step skips gracefully
23
+ 4. If the branch is already deleted, step skips gracefully
24
+ 5. Cleanup only happens after CI is confirmed healthy — not before
25
+ 6. The HARD-GATE is updated to include cleanup as a required step
26
+ 7. All other agents' verify command files are updated identically (if they exist)
27
+
28
+ ---
29
+
30
+ ## Out of Scope
31
+
32
+ - Deleting the remote branch (GitHub does that automatically on merge with branch auto-delete enabled)
33
+ - Cleanup on unhealthy merges (user may need to inspect the worktree)
34
+ - Creating new worktree cleanup infrastructure — this is just adding `git worktree remove` + `git branch -d` to the existing verify steps
35
+
36
+ ---
37
+
38
+ ## Approach Selected
39
+
40
+ Add two steps to `/verify` between the existing "Step 5: Report Status" and "Step 7: Close Beads Issue":
41
+
42
+ **New Step 6: Clean Up Worktree and Branch**
43
+
44
+ The feature branch name is known from the Beads issue or from `git worktree list`. Steps:
45
+ 1. Run `git worktree list` to find the worktree path for the merged branch
46
+ 2. `git worktree remove <path>` (if it exists)
47
+ 3. `git branch -d <branch>` (if it still exists locally)
48
+ 4. Report cleanup in the status output
49
+
50
+ Cleanup is conditional on healthy CI (Step 3 passed). If CI failed, skip cleanup and note it in the output.
51
+
52
+ ---
53
+
54
+ ## Constraints
55
+
56
+ - Cleanup is **destructive** — must only run after confirming the merge actually landed (`gh pr list --state merged` confirmed in Step 2)
57
+ - Must be idempotent — if worktree or branch already gone, skip silently
58
+ - `git branch -d` (safe delete) not `git branch -D` (force) — if branch has unmerged commits it should warn rather than silently delete
59
+ - Do not remove worktrees that belong to other in-progress features
60
+
61
+ ---
62
+
63
+ ## Edge Cases
64
+
65
+ - **Worktree already removed**: `git worktree list` won't show it — skip gracefully
66
+ - **Branch already deleted**: `git branch -d` exits non-zero if branch doesn't exist — catch and skip
67
+ - **Multiple worktrees**: `git worktree list` may show multiple — only remove the one matching the merged branch
68
+ - **No worktree was ever created**: Some workflows skip worktree setup — if no matching worktree found, skip cleanup step entirely
69
+ - **Stale superpowers-gaps worktree**: This fix will clean up the `feat/superpowers-gaps` worktree the next time a verify-like cleanup is run manually (`git worktree remove .worktrees/superpowers-gaps`)
70
+
71
+ ---
72
+
73
+ ## Ambiguity Policy
74
+
75
+ If the merged branch name cannot be determined (e.g., squash merge loses branch name), skip cleanup and tell the user: "Could not determine feature branch — run `git worktree list` and `git worktree remove <path>` manually."
76
+
77
+ ---
78
+
79
+ ## Technical Research
80
+
81
+ ### How to detect which worktree to remove
82
+
83
+ ```bash
84
+ # List all worktrees with their branches
85
+ git worktree list --porcelain
86
+ # Output includes: worktree <path>, HEAD <sha>, branch refs/heads/<name>
87
+ # Find the entry where branch = merged branch name
88
+ ```
89
+
90
+ ### How to get merged branch name
91
+
92
+ From the PR info retrieved in Step 2:
93
+ ```bash
94
+ gh pr view <number> --json headRefName --jq '.headRefName'
95
+ ```
96
+
97
+ ### OWASP Analysis
98
+
99
+ - No user input processed — branch names come from `git` and `gh` CLI output
100
+ - `git worktree remove` and `git branch -d` are local operations only
101
+ - No injection risk — branch names passed as arguments are from controlled sources
102
+ - Risk: **A01 Broken Access Control** — N/A (local git operations)
103
+ - Risk: **A03 Injection** — minimal; branch names from `gh` output, not user-typed. Mitigate: use `--` separator in git commands if needed.
104
+
105
+ ### TDD Test Scenarios
106
+
107
+ 1. **Happy path**: Worktree exists for merged branch → removed, branch deleted, report shows cleanup
108
+ 2. **Worktree already gone**: `git worktree list` has no entry for branch → skip silently, no error
109
+ 3. **Branch already deleted**: `git branch -d` fails → catch, skip, log "branch already deleted"
110
+ 4. **CI failed**: Step 3 detected failing CI → skip cleanup entirely, leave worktree intact
111
+ 5. **Multiple worktrees**: Two worktrees exist → only the one matching merged branch is removed
112
+
113
+ ---
114
+
115
+ ## Task List
116
+
117
+ ### Task 1: Update `.claude/commands/verify.md` — add cleanup steps
118
+
119
+ **File(s)**: `.claude/commands/verify.md`
120
+
121
+ **What to implement**:
122
+ - Add **Step 6: Clean Up Worktree and Branch** between current Step 5 (Report Status) and Step 7 (Close Beads):
123
+ 1. Get merged branch name: `gh pr view <number> --json headRefName --jq '.headRefName'`
124
+ 2. Find matching worktree: `git worktree list --porcelain | grep <branch>`
125
+ 3. If found: `git worktree remove <path> --force` (force needed because bun install creates node_modules)
126
+ 4. Delete local branch: `git branch -d <branch>` (safe delete, skip if not found)
127
+ 5. Report: "Worktree: removed ✓" / "Branch: deleted ✓" in status output
128
+ - Update example output to show cleanup lines (they're already in the example — just need the actual steps)
129
+ - Update HARD-GATE to add: "Worktree removed (or confirmed already gone)"
130
+
131
+ **TDD steps**:
132
+ 1. Write test: `test/commands/verify.test.js` — check that verify.md contains "worktree remove", "branch -d", and the HARD-GATE mentions worktree cleanup
133
+ 2. Run test: `bun test test/commands/verify.test.js` — fails (those strings not in file)
134
+ 3. Implement: edit verify.md to add Step 6
135
+ 4. Run test: passes
136
+ 5. Commit: `fix: add worktree and branch cleanup to /verify stage`
137
+
138
+ **Expected output**: verify.md has Step 6 with worktree/branch cleanup; test passes.
139
+
140
+ ---
141
+
142
+ ### Task 2: Clean up the stale `superpowers-gaps` worktree now
143
+
144
+ **File(s)**: none (one-time cleanup)
145
+
146
+ **What to implement**:
147
+ The `feat/superpowers-gaps` worktree at `.worktrees/superpowers-gaps` is stale — PR 50 merged. Remove it manually as a one-time fix:
148
+ ```bash
149
+ git worktree remove .worktrees/superpowers-gaps --force
150
+ git branch -d feat/superpowers-gaps
151
+ ```
152
+
153
+ **TDD steps**:
154
+ 1. Run: `git worktree list` — confirm superpowers-gaps appears
155
+ 2. Run cleanup: `git worktree remove .worktrees/superpowers-gaps --force && git branch -d feat/superpowers-gaps`
156
+ 3. Run: `git worktree list` — confirm it's gone
157
+ 4. Commit: `chore: clean up stale superpowers-gaps worktree`
158
+
159
+ **Expected output**: `git worktree list` shows only master and active feature worktrees.
160
+
161
+ ---
162
+
163
+ ## Ordering
164
+
165
+ Task 2 can run in parallel with Task 1 — it's a one-time cleanup independent of the command file edit.
@@ -0,0 +1,6 @@
1
+ # Decisions Log: forge-uto
2
+
3
+ - **Feature**: forge-uto
4
+ - **Date**: 2026-03-05
5
+
6
+ (No decisions logged yet — populated during /dev)