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,550 @@
1
+ # Research: Forge Workflow V2 — Complete Refactor
2
+
3
+ **Feature slug**: `forge-workflow-v2`
4
+ **Date**: 2026-02-26
5
+ **Status**: Design complete, ready for /plan
6
+
7
+ ---
8
+
9
+ ## Objective
10
+
11
+ Refactor the Forge 9-stage workflow into a leaner 7-stage workflow that:
12
+ 1. Absorbs Superpowers mechanics (brainstorming, subagent-driven-development, git worktrees, verification) natively — no Superpowers plugin install needed
13
+ 2. Front-loads all design decisions so `/dev` runs autonomously with bypass permissions
14
+ 3. Enforces hard gates at every stage exit (structural, not soft instructions)
15
+ 4. Removes OpenSpec as a dependency — replaced by design doc + `--strategic` flag
16
+ 5. Removes `/research` as a standalone stage — absorbed into `/plan` Phase 2
17
+ 6. Introduces a decisions log and impact scoring framework for undocumented decisions during `/dev`
18
+
19
+ ---
20
+
21
+ ## Codebase Analysis
22
+
23
+ ### Current Command Files (Baseline)
24
+
25
+ | Command | File | Key Mechanics | What Changes |
26
+ |---------|------|--------------|-------------|
27
+ | `/status` | `.claude/commands/status.md` | Reads PROGRESS.md, bd list, git log | No longer a numbered stage — utility only |
28
+ | `/research` | `.claude/commands/research.md` | Explore agent + parallel web search + OWASP → docs/research/ | Absorbed into /plan Phase 2. Command removed or kept as shortcut |
29
+ | `/plan` | `.claude/commands/plan.md` | Read research, determine scope, bd create, git branch | Expanded to 3 phases + task list. OpenSpec replaced by --strategic flag |
30
+ | `/dev` | `.claude/commands/dev.md` | TodoWrite + Task agents + RED-GREEN-REFACTOR | TodoWrite loop replaced by subagent-driven-development |
31
+ | `/check` | `.claude/commands/check.md` | type/lint/code-review/security/tests | Add HARD-GATE exit requiring fresh command output |
32
+ | `/ship` | `.claude/commands/ship.md` | Verify /check, bd update, git push, gh pr create | Add HARD-GATE entry + update PR body to reference design doc not research doc |
33
+ | `/review` | `.claude/commands/review.md` | GitHub Actions + Greptile + SonarCloud | Add HARD-GATE exit blocking when threads unresolved |
34
+ | `/premerge` | `.claude/commands/premerge.md` | Docs update + bd sync + OpenSpec archive + hand off | Remove OpenSpec archive step. Add HARD-GATE no-merge enforcer |
35
+ | `/verify` | `.claude/commands/verify.md` | git checkout master + CI check + bd close | Lightweight. Simplify — no new changes needed |
36
+
37
+ ### Current AGENTS.md Workflow Table
38
+
39
+ Current: 9 stages, 6 change classifications (Critical/Standard/Simple/Hotfix/Docs/Refactor).
40
+ New: 7 stages, same 6 classifications — but classification skips updated to reflect new stage numbers.
41
+
42
+ ### Current Skills Directory
43
+
44
+ `skills/parallel-web-search/` — stays, used in /plan Phase 2
45
+ `skills/parallel-deep-research/` — stays, used optionally in /plan Phase 2
46
+
47
+ No Superpowers plugin will be installed. Superpowers mechanics are ported natively into command files.
48
+
49
+ ---
50
+
51
+ ## Design Decisions Made (Session Record)
52
+
53
+ ### Decision 1: Absorb /research into /plan Phase 2
54
+ **Reasoning**: What `/research` produces (approach selection, TDD scenarios, OWASP analysis) IS planning output, not raw research. Separating them creates an artificial two-step that adds stage count without adding value.
55
+ **What changes**: `/plan` gains Phase 2 (parallel web search + OWASP). `/research` command is either removed or kept as an alias that jumps straight to Phase 2 context.
56
+ **Evidence**: Current `/research` output goes into a doc that `/plan` immediately reads — they were already sequential with no human gate between them.
57
+
58
+ ### Decision 2: Add brainstorming as /plan Phase 1
59
+ **Reasoning**: Superpowers brainstorming SKILL.md (fetched) shows it captures WHAT to build: purpose, constraints, success criteria, edge cases, approach selection. Forge had no WHAT phase — it jumped straight to HOW (web research). The WHAT phase front-loads all decisions that would otherwise surface as undocumented mid-dev surprises.
60
+ **What changes**: /plan starts with one-question-at-a-time Q&A. Design doc saved to `docs/plans/YYYY-MM-DD-<slug>-design.md` before any research begins.
61
+ **HARD-GATE**: No Phase 2 until design doc exists AND user has approved it.
62
+
63
+ ### Decision 3: Add task list creation as /plan Phase 3 final step
64
+ **Reasoning**: Superpowers `writing-plans` SKILL.md (fetched) shows it creates 2-5 min tasks with exact file paths, code, test steps, and expected output. This belongs at the END of /plan, not the START of /dev. When /dev starts, it gets a pre-made task list, not a design doc to interpret.
65
+ **What changes**: /plan Phase 3 ends with task list written to `docs/plans/YYYY-MM-DD-<slug>-tasks.md`. User reviews and approves task list before /dev.
66
+ **HARD-GATE**: /dev cannot start until task list exists AND user confirms it.
67
+
68
+ ### Decision 4: Add git worktrees to /plan Phase 3
69
+ **Reasoning**: Superpowers `using-git-worktrees` SKILL.md shows it is REQUIRED by subagent-driven-development. Worktree creation belongs at /plan Phase 3 (after branch creation) because isolation should be set up before implementation starts, and verifying a clean baseline catches pre-existing failures before /dev.
70
+ **What changes**: /plan Phase 3 adds: `git worktree add .worktrees/<slug> -b feat/<slug>`, project setup, baseline test run. Baseline test failures surface here, not mid-/dev.
71
+
72
+ ### Decision 5: Replace TodoWrite loop in /dev with subagent-driven-development
73
+ **Reasoning**: Superpowers `subagent-driven-development` SKILL.md (fetched) shows: implementer subagent (fresh context, TDD) → spec compliance reviewer → code quality reviewer, per task. This catches spec drift and quality issues per-task rather than at feature end. TDD is enforced inside each implementer subagent.
74
+ **What changes**: /dev reads from task list (pre-made in /plan Phase 3), dispatches subagents per task with the task's FULL text (not a file path), runs two-stage review per task.
75
+ **What stays**: RED-GREEN-REFACTOR is still the TDD mechanic, just enforced inside implementer subagents.
76
+
77
+ ### Decision 6: Remove OpenSpec — replace with --strategic flag on /plan
78
+ **Reasoning**: With a thorough Phase 1 (brainstorming → design doc) and Phase 2 (research), OpenSpec's value (design intent capture, approach selection, technical decisions) is already covered. The only unique value OpenSpec adds for strategic cases is a formal proposal PR. That's 2 git commands, not a separate tool.
79
+ **What changes**: Remove `openspec` dependency entirely. Add `--strategic` flag to /plan: creates design doc PR before proceeding to Phase 2 and Phase 3. User merges proposal PR to approve. Then `/plan --continue` runs Phase 2 + 3.
80
+ **In /premerge**: Remove the `openspec archive <slug>` step.
81
+ **In /ship**: Remove OpenSpec PR link from PR body template.
82
+
83
+ ### Decision 7: Add HARD-GATE at every stage exit
84
+ **Reasoning**: Soft instructions fail. Superpowers introduced `<HARD-GATE>` blocks in v4.3.0 after discovering soft "read AGENTS.md" instructions were being ignored (confirmed in Forge by the Option A failure test this session). Hard gates explicitly name forbidden actions and conditions that must be met. They prevent rationalization.
85
+ **What changes**: Every command gets explicit `<HARD-GATE>` blocks at internal transitions and at exit. See full gate specification below.
86
+
87
+ ### Decision 8: Introduce decisions log and impact scoring in /dev
88
+ **Reasoning**: When an implementer subagent encounters a gap in the spec, it currently has no structured process. Silent drift (making a choice without documentation) is the failure mode. The scoring checklist makes classification objective — not agent judgment.
89
+ **What changes**: New artifact: `docs/plans/YYYY-MM-DD-<slug>-decisions.md` created at /dev start. 7-dimension checklist with score thresholds. Score 0-3 → proceed. Score 4-7 → spec reviewer. Score 8+ or override → all remaining independent tasks complete, developer input surfaced at /dev end.
90
+ **Design goal**: Plan quality is the primary fix. Decision gate is the safety net.
91
+
92
+ ### Decision 9: /status is utility, not numbered stage
93
+ **Reasoning**: User correctly identified that /status is a check command, not a workflow stage. Removing it from the numbered sequence simplifies the workflow description from "9 stages" to "7 stages."
94
+ **What changes**: AGENTS.md workflow table renumbers stages 1-7. /status remains available as `/status` utility.
95
+
96
+ ### Decision 10: /verify stays as separate lightweight stage
97
+ **Reasoning**: /premerge and /verify cannot be merged because the user's merge action is a hard human gate between them. /verify is already lightweight (CI check on main, close Beads, report). Keeping it separate preserves the clean "done" signal.
98
+ **What changes**: None to /verify. Add HARD-GATE at /premerge exit that explicitly says STOP and presents PR URL.
99
+
100
+ ---
101
+
102
+ ## New 7-Stage Workflow
103
+
104
+ ```
105
+ Stage | Command | Purpose
106
+ ------+------------+--------------------------------------------------
107
+ 1 | /plan | 3-phase: design intent → research → branch+worktree+task list
108
+ 2 | /dev | Subagent-driven: implementer + spec-review + quality-review per task
109
+ 3 | /check | type/lint/security/tests + verification HARD-GATE at exit
110
+ 4 | /ship | Push + PR creation with design doc reference
111
+ 5 | /review | GitHub Actions + Greptile + SonarCloud — all threads resolved
112
+ 6 | /premerge | Doc updates + HARD-GATE STOP for user merge
113
+ 7 | /verify | Post-merge CI on main + close Beads
114
+
115
+ Utility: /status (not numbered — context check before starting)
116
+ ```
117
+
118
+ Change classifications updated:
119
+ - Critical: full 7 stages
120
+ - Standard: plan → dev → check → ship → review → premerge
121
+ - Simple: dev → check → ship
122
+ - Hotfix: dev → check → ship (immediate)
123
+ - Docs: verify → ship
124
+ - Refactor: plan → dev → check → ship → premerge
125
+
126
+ ---
127
+
128
+ ## /plan — Full Spec (Refactored)
129
+
130
+ ### Phase 1: Design Intent (Brainstorming)
131
+ **Source**: Superpowers brainstorming SKILL.md mechanics
132
+
133
+ Steps:
134
+ 1. Explore project context — read files, docs, recent commits relevant to the feature
135
+ 2. Ask clarifying questions ONE at a time (multiple choice preferred)
136
+ - Purpose: what problem does this solve?
137
+ - Constraints: what must it NOT do?
138
+ - Success criteria: how will we know it's done?
139
+ - Edge cases: what happens when X fails / Y is missing / Z is ambiguous?
140
+ - Technical preferences: library A or B? approach X or Y?
141
+ - Ambiguity policy: if spec gap found mid-dev, make reasonable choice + document, or pause for input?
142
+ 3. Propose 2-3 approaches with trade-offs and recommendation
143
+ 4. Present design in sections — get approval after each section
144
+ 5. Write design doc to `docs/plans/YYYY-MM-DD-<slug>-design.md`
145
+ 6. Commit design doc
146
+
147
+ ```
148
+ <HARD-GATE: Phase 1 exit>
149
+ Do NOT begin Phase 2 (web research) until:
150
+ 1. User has approved the design in this session
151
+ 2. Design doc exists at docs/plans/YYYY-MM-DD-<slug>-design.md
152
+ 3. Design doc includes: success criteria, edge cases, out-of-scope, ambiguity policy
153
+ 4. Design doc is committed to git
154
+ </HARD-GATE>
155
+ ```
156
+
157
+ **--strategic flag behavior**: After writing design doc, push to branch and open PR:
158
+ ```bash
159
+ git push -u origin feat/<slug>-proposal
160
+ gh pr create --title "Design: <slug>" --body "See docs/plans/YYYY-MM-DD-<slug>-design.md"
161
+ ```
162
+ Then STOP. No Phase 2 until user merges proposal PR.
163
+
164
+ ### Phase 2: Technical Research
165
+ **Source**: Current /research command mechanics
166
+
167
+ Steps (run in parallel):
168
+ - Parallel web search: best practices, known issues, library docs
169
+ - OWASP Top 10 analysis for this feature's risk surface
170
+ - Codebase exploration: similar patterns, affected files, existing tests
171
+ - TDD test scenarios: minimum 3 identified
172
+
173
+ Research notes appended to design doc under `## Technical Research` section (not a separate file).
174
+
175
+ ```
176
+ <HARD-GATE: Phase 2 exit>
177
+ Do NOT begin Phase 3 (setup) until:
178
+ 1. OWASP analysis is documented in design doc
179
+ 2. At least 3 TDD test scenarios are identified
180
+ 3. Approach selection is confirmed (which library/pattern to use)
181
+ </HARD-GATE>
182
+ ```
183
+
184
+ ### Phase 3: Setup + Task List
185
+ **Source**: Superpowers using-git-worktrees + writing-plans SKILL.md mechanics
186
+
187
+ Steps:
188
+ 1. **Scope determination**: tactical (no design PR needed) vs strategic (already done in --strategic)
189
+ 2. **Beads issue**: `bd create "<feature-name>" --type=feature`; `bd update <id> --status=in_progress`
190
+ 3. **Branch + worktree**:
191
+ ```bash
192
+ git checkout -b feat/<slug>
193
+ git worktree add .worktrees/<slug> -b feat/<slug>
194
+ cd .worktrees/<slug>
195
+ ```
196
+ 4. **Verify .worktrees/ is gitignored** — if not, add to .gitignore and commit
197
+ 5. **Project setup in worktree**: auto-detect and run (npm install / bun install / pip install etc.)
198
+ 6. **Baseline test run**: run full test suite in worktree. If tests fail: report and ask whether to proceed or investigate
199
+ 7. **Task list creation** (Superpowers writing-plans mechanics):
200
+ - Read design doc
201
+ - Break implementation into 2-5 min tasks with: exact file paths, complete code, verification steps
202
+ - Order by dependency: foundational/shared tasks FIRST, uncertain/ambiguous tasks LAST
203
+ - Flag any tasks that touch areas not fully specified in design doc
204
+ - Present flagged tasks to user for quick clarification BEFORE finalizing
205
+ - Save to `docs/plans/YYYY-MM-DD-<slug>-tasks.md`
206
+ 8. **User reviews task list** — can reorder, split, or remove tasks
207
+ 9. **STOP**: present summary, wait for `/dev`
208
+
209
+ ```
210
+ <HARD-GATE: /plan exit>
211
+ Do NOT proceed to /dev until:
212
+ 1. git branch --show-current confirms feat/<slug>
213
+ 2. Worktree exists at .worktrees/<slug> with tests passing
214
+ 3. Beads issue is created and status=in_progress
215
+ 4. Task list exists at docs/plans/YYYY-MM-DD-<slug>-tasks.md
216
+ 5. User has confirmed task list looks correct
217
+ </HARD-GATE>
218
+ ```
219
+
220
+ ---
221
+
222
+ ## /dev — Full Spec (Refactored)
223
+
224
+ **Source**: Superpowers subagent-driven-development SKILL.md mechanics + decisions framework
225
+
226
+ ### Setup
227
+ 1. Read task list from `docs/plans/YYYY-MM-DD-<slug>-tasks.md` — extract ALL tasks with full text
228
+ 2. Read design doc including ambiguity policy
229
+ 3. Create `docs/plans/YYYY-MM-DD-<slug>-decisions.md` (empty log, ready for entries)
230
+
231
+ ```
232
+ <HARD-GATE: /dev start>
233
+ Do NOT write any code until:
234
+ 1. git branch --show-current confirms NOT main or master
235
+ 2. Worktree path confirmed (not main repo directory)
236
+ 3. Task list file confirmed to exist
237
+ 4. Decisions log file created
238
+ </HARD-GATE>
239
+ ```
240
+
241
+ ### Per-Task Loop
242
+
243
+ For each task in order:
244
+
245
+ **Step 1: Dispatch implementer subagent**
246
+ - Provide: full task text, design doc excerpt relevant to this task, codebase context
247
+ - Do NOT send file path to plan — send the text directly
248
+ - Implementer subagent: asks clarifying questions (before starting) → TDD (RED-GREEN-REFACTOR) → self-review → commit
249
+
250
+ ```
251
+ <HARD-GATE: TDD enforcement (inside implementer subagent)>
252
+ Do NOT write any production code until:
253
+ 1. A FAILING test exists for that code
254
+ 2. The test has been run and output shows it failing
255
+ 3. The failure reason matches the expected missing behavior
256
+ If code was written before its test: delete it. Start with the test.
257
+ </HARD-GATE>
258
+ ```
259
+
260
+ **Step 2: Decision gate (when implementer hits spec gap)**
261
+
262
+ Fill checklist BEFORE implementing:
263
+ ```
264
+ Gap: [describe what spec doesn't cover]
265
+
266
+ Score each (0=No / 1=Possibly / 2=Yes):
267
+ [ ] Files affected beyond current task?
268
+ [ ] Changes a function signature or export?
269
+ [ ] Changes a shared module used by other tasks?
270
+ [ ] Changes or touches persistent data/schema?
271
+ [ ] Changes user-visible behavior?
272
+ [ ] Affects auth, permissions, or data exposure?
273
+ [ ] Hard to reverse without cascading changes?
274
+ TOTAL: ___
275
+
276
+ Mandatory overrides (any = always escalate):
277
+ [ ] Security dimension = 2
278
+ [ ] Schema migration or data model change
279
+ [ ] Removes/changes existing public API endpoint
280
+ [ ] Affects already-implemented task
281
+ ```
282
+
283
+ Score routing:
284
+ - 0-3: Proceed. Document in decisions log + commit message.
285
+ - 4-7: Route to spec reviewer. Continue independent tasks while reviewer works.
286
+ - 8+ / override: Document in decisions log. Complete all other independent tasks. Surface to developer at /dev end.
287
+
288
+ **Step 3: Spec compliance review** (after implementer done)
289
+ - Dispatch spec reviewer subagent with: task text, design doc section, git diff
290
+ - Reviewer checks: all requirements met? nothing extra added? edge cases handled?
291
+ - If issues: implementer fixes → re-review → until ✅
292
+
293
+ ```
294
+ <HARD-GATE: spec before quality>
295
+ Do NOT dispatch code quality reviewer until spec compliance reviewer returns ✅
296
+ Running quality review before spec compliance ✅ is wrong order.
297
+ </HARD-GATE>
298
+ ```
299
+
300
+ **Step 4: Code quality review** (after spec ✅)
301
+ - Dispatch quality reviewer subagent with: git SHAs, code changes
302
+ - Reviewer checks: naming, structure, duplication, test coverage, no magic numbers
303
+ - If issues: implementer fixes → re-review → until ✅
304
+
305
+ **Step 5: Task completion**
306
+
307
+ ```
308
+ <HARD-GATE: task completion>
309
+ Do NOT mark task complete or move to next task until:
310
+ 1. Spec compliance reviewer returned ✅ this session
311
+ 2. Code quality reviewer returned ✅ this session
312
+ 3. Tests run fresh — output shows passing
313
+ 4. Implementer has committed
314
+ </HARD-GATE>
315
+ ```
316
+
317
+ ### /dev Completion
318
+
319
+ After all tasks:
320
+ - Dispatch final code reviewer for full implementation
321
+ - Surface any BLOCKED decisions to developer with full documentation
322
+ - If BLOCKED decisions exist: wait for developer input → implement → re-review
323
+
324
+ ```
325
+ <HARD-GATE: /dev exit>
326
+ Do NOT declare /dev complete until:
327
+ 1. All tasks are marked complete (or BLOCKED with decisions surfaced to developer)
328
+ 2. Final code reviewer has approved
329
+ 3. All decisions in decisions log have a Status of RESOLVED or PENDING-DEVELOPER-INPUT
330
+ 4. No unresolved spec or quality issues remain
331
+ </HARD-GATE>
332
+ ```
333
+
334
+ ---
335
+
336
+ ## /check — Refactored (HARD-GATE Exit Added)
337
+
338
+ All existing steps stay (type check, lint, code review, security, tests).
339
+
340
+ ```
341
+ <HARD-GATE: /check exit>
342
+ Do NOT output any variation of "check complete", "ready to ship", or proceed to /ship
343
+ until ALL FOUR show fresh output in this session:
344
+
345
+ 1. Type check: [command run] → [actual output] → exit 0 confirmed
346
+ 2. Lint: [command run] → [actual output] → 0 errors, 0 warnings confirmed
347
+ 3. Tests: [command run] → [actual output] → N/N passing confirmed
348
+ 4. Security scan: [command run] → [actual output] → no critical issues
349
+
350
+ "Should pass", "was passing earlier", and "I'm confident" are not evidence.
351
+ Run the commands. Show the output. THEN declare done.
352
+ </HARD-GATE>
353
+ ```
354
+
355
+ ---
356
+
357
+ ## /ship — Refactored (Entry Gate + PR Body Update)
358
+
359
+ ```
360
+ <HARD-GATE: /ship entry>
361
+ Do NOT create PR until:
362
+ 1. /check was run in this session with all four outputs shown
363
+ 2. All checks confirmed passing (not assumed)
364
+ 3. Beads issue is in_progress
365
+ 4. Branch is NOT main or master
366
+ </HARD-GATE>
367
+ ```
368
+
369
+ PR body template update — replace `/research` references with `/plan` design doc:
370
+ ```
371
+ ## Design Doc
372
+ See: docs/plans/YYYY-MM-DD-<slug>-design.md
373
+
374
+ ## Decisions Log
375
+ See: docs/plans/YYYY-MM-DD-<slug>-decisions.md (if any undocumented decisions arose)
376
+ ```
377
+
378
+ ---
379
+
380
+ ## /review — Refactored (HARD-GATE Exit Added)
381
+
382
+ All existing steps stay (GitHub Actions, Greptile, SonarCloud).
383
+
384
+ ```
385
+ <HARD-GATE: /review exit>
386
+ Do NOT declare /review complete until:
387
+ 1. bash .claude/scripts/greptile-resolve.sh stats <pr-number> shows "All Greptile threads resolved"
388
+ 2. ALL human reviewer comments are either resolved or have a reply with explanation
389
+ 3. gh pr checks <pr-number> shows all checks passing
390
+ </HARD-GATE>
391
+ ```
392
+
393
+ ---
394
+
395
+ ## /premerge — Refactored (OpenSpec step removed + HARD-GATE STOP)
396
+
397
+ Remove: `openspec archive <slug>` step (OpenSpec no longer used)
398
+
399
+ Update doc references: check for `docs/plans/` design doc and decisions log instead of `docs/research/` and `openspec/`
400
+
401
+ ```
402
+ <HARD-GATE: /premerge exit>
403
+ Do NOT run gh pr merge.
404
+ Do NOT suggest merging.
405
+ /premerge ends here. Output the PR URL and status. Wait for user.
406
+
407
+ "After you merge, run /verify to confirm everything landed correctly."
408
+ </HARD-GATE>
409
+ ```
410
+
411
+ ---
412
+
413
+ ## /verify — No Changes
414
+
415
+ Current /verify is correct and lightweight. Add HARD-GATE:
416
+
417
+ ```
418
+ <HARD-GATE: /verify exit>
419
+ Do NOT declare /verify complete until:
420
+ 1. gh run list --branch master --limit 3 confirms CI passing on main (not just branch)
421
+ 2. Beads issue is closed: bd close <id>
422
+ "It should be fine" is not evidence. Run the command. Show the output.
423
+ </HARD-GATE>
424
+ ```
425
+
426
+ ---
427
+
428
+ ## /status — No Changes
429
+
430
+ Remains a utility command. Remove from numbered workflow stages in AGENTS.md table.
431
+
432
+ ---
433
+
434
+ ## Files to Change
435
+
436
+ ### New command files (rewrites)
437
+ 1. `.claude/commands/plan.md` — full rewrite: 3 phases, worktrees, task list, HARD-GATES
438
+ 2. `.claude/commands/dev.md` — full rewrite: subagent-driven-development, decisions framework, HARD-GATES
439
+ 3. `.claude/commands/check.md` — add HARD-GATE exit block
440
+ 4. `.claude/commands/ship.md` — add HARD-GATE entry block, update PR body template
441
+ 5. `.claude/commands/review.md` — add HARD-GATE exit block
442
+ 6. `.claude/commands/premerge.md` — remove OpenSpec archive step, add HARD-GATE exit
443
+ 7. `.claude/commands/verify.md` — add HARD-GATE exit block
444
+
445
+ ### Config / docs updates
446
+ 8. `AGENTS.md` — renumber stages 1-7, remove /status from table, update stage descriptions, update change classification stage numbers, remove OpenSpec references
447
+ 9. `CLAUDE.md` — update workflow table (sync via script after AGENTS.md change)
448
+ 10. `GEMINI.md` — update workflow table (sync via script)
449
+ 11. `.claude/rules/workflow.md` — update workflow command table and philosophy section
450
+ 12. `.claude/commands/research.md` — convert to thin alias: "This is now Phase 2 of /plan. Run /plan to start the full workflow."
451
+
452
+ ### New files to create
453
+ 13. `docs/plans/.gitkeep` — ensure docs/plans/ directory exists (currently doesn't exist, only docs/research/ exists)
454
+ 14. `.worktrees/` entry in `.gitignore` — required for worktree isolation
455
+
456
+ ### Files NOT to change
457
+ - `/review` Greptile scripts (`.claude/scripts/greptile-resolve.sh`) — unchanged
458
+ - Skills directory — no new skills needed; parallel-web-search and parallel-deep-research stay as-is
459
+ - Existing `/verify` command — only HARD-GATE addition needed
460
+
461
+ ---
462
+
463
+ ## TDD Verification Scenarios
464
+
465
+ Config files don't have unit tests. Verification is manual and behavioral:
466
+
467
+ 1. **Phase 1 gate**: Run `/plan test-feature`. Answer design Q&A. Attempt web search before approving design. Agent must refuse — HARD-GATE fires.
468
+
469
+ 2. **Phase 2 gate**: After design approval, attempt to jump to Phase 3 without OWASP section in design doc. Agent must refuse.
470
+
471
+ 3. **Phase 3 gate**: Attempt `/dev` without task list file existing. Agent must refuse.
472
+
473
+ 4. **TDD gate in /dev**: In implementer subagent, attempt to write production code before test. Agent must delete code and start with test.
474
+
475
+ 5. **Spec before quality gate**: Force spec reviewer to return ✅, then verify quality reviewer fires. Attempt to skip spec reviewer — agent must refuse.
476
+
477
+ 6. **/check HARD-GATE**: After implementing a change, run `/check` and have agent claim "tests should pass" without running them. Agent must run commands and show output.
478
+
479
+ 7. **Decision gate scoring**: Create a scenario where implementer hits an undocumented decision affecting a shared module (score expected: 6+). Verify agent fills checklist, routes to spec reviewer, does NOT implement.
480
+
481
+ 8. **/premerge HARD-GATE**: Run `/premerge` and verify agent produces PR URL and stops. Does NOT run `gh pr merge`.
482
+
483
+ 9. **Decisions log**: Complete a /dev run. Verify `docs/plans/YYYY-MM-DD-<slug>-decisions.md` exists and all entries have Status field.
484
+
485
+ 10. **Plan quality feedback**: After /dev, count decision gates fired. 0 = excellent plan. 3+ = Phase 1 Q&A insufficient.
486
+
487
+ ---
488
+
489
+ ## Security Analysis
490
+
491
+ | Risk | Stage | Mitigation |
492
+ |------|-------|-----------|
493
+ | Agent writes on main branch | /dev | HARD-GATE: branch check before any code |
494
+ | Silent spec drift | /dev | Spec compliance reviewer per task + decisions log |
495
+ | False completion claim | /check, /verify | HARD-GATE: run command, show output, THEN claim |
496
+ | Merge without review | /premerge | HARD-GATE: explicit STOP, PR URL output only |
497
+ | Worktree contents committed | /plan Phase 3 | git check-ignore verification before worktree creation |
498
+ | Undocumented high-impact decisions | /dev | Impact scoring checklist with 7 objective dimensions |
499
+ | Phase 1 ambiguity policy not captured | /plan Phase 1 | Q&A explicitly asks for ambiguity policy |
500
+
501
+ ---
502
+
503
+ ## Scope Assessment
504
+
505
+ **Type**: Strategic (architecture change — full workflow refactor affects all command files)
506
+ **Complexity**: High (9 files to rewrite + 4 config files + new directory)
507
+ **Branch**: `feat/forge-workflow-v2` (new branch)
508
+ **Beads**: Create new issue
509
+
510
+ **Parallelizable tracks**:
511
+ - Track A: /plan command rewrite (Phase 1 + 2 + 3, task list, HARD-GATES)
512
+ - Track B: /dev command rewrite (subagent-driven-development, decisions framework)
513
+ - Track C: AGENTS.md + CLAUDE.md + GEMINI.md + workflow.md updates
514
+ - Track D: /check + /ship + /review + /premerge + /verify HARD-GATE additions (lighter)
515
+
516
+ Track A and B have no shared dependencies and can be written in parallel. Track C depends on final stage numbering (wait for A+B to finalize). Track D is independent of all.
517
+
518
+ **Estimated sessions**: 2-3 for Track A+B (complex rewrites), 1 for Track C+D.
519
+
520
+ ---
521
+
522
+ ## Sources
523
+
524
+ | # | Source | Used For |
525
+ |---|--------|----------|
526
+ | 1 | `obra/superpowers` brainstorming/SKILL.md (GitHub API) | Phase 1 mechanics: Q&A structure, design doc format, HARD-GATE pattern |
527
+ | 2 | `obra/superpowers` writing-plans/SKILL.md (GitHub API) | Phase 3 task list: granularity, file paths, code in plan, TDD steps per task |
528
+ | 3 | `obra/superpowers` subagent-driven-development/SKILL.md (GitHub API) | /dev rewrite: implementer + 2-stage review per task, spec before quality order |
529
+ | 4 | `obra/superpowers` using-git-worktrees/SKILL.md (GitHub API) | /plan Phase 3: worktree creation, ignore verification, baseline test run |
530
+ | 5 | `obra/superpowers` verification-before-completion/SKILL.md (GitHub API) | /check HARD-GATE: Iron Law, command evidence required |
531
+ | 6 | Forge `.claude/commands/research.md` | Baseline for Phase 2 mechanics |
532
+ | 7 | Forge `.claude/commands/plan.md` | Baseline for Phase 3 setup mechanics |
533
+ | 8 | Forge `.claude/commands/dev.md` | Baseline for TDD enforcement, parallel tracks |
534
+ | 9 | Forge `.claude/commands/check.md` | Baseline for validation steps |
535
+ | 10 | Forge `.claude/commands/ship.md` | Baseline for PR creation |
536
+ | 11 | Forge `.claude/commands/review.md` | Baseline for Greptile + SonarCloud process |
537
+ | 12 | Forge `.claude/commands/premerge.md` | Baseline for doc updates + hand-off |
538
+ | 13 | Forge `.claude/commands/verify.md` | Baseline for post-merge CI check |
539
+ | 14 | Forge `AGENTS.md` | Current workflow table and change classifications |
540
+ | 15 | `docs/research/superpowers.md` (this session) | Superpowers overview, 14 skills, community reception |
541
+ | 16 | `docs/research/superpowers-integration.md` (this session) | Integration options analysis, auto-trigger collision documentation |
542
+ | 17 | Session design decisions (conversation record) | All 10 design decisions documented above |
543
+
544
+ ---
545
+
546
+ ## Next Step
547
+
548
+ ```bash
549
+ /plan forge-workflow-v2
550
+ ```