forge-workflow 0.0.2 → 0.0.3

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 (147) hide show
  1. package/.claude/commands/plan.md +93 -4
  2. package/.cline/workflows/dev.md +311 -0
  3. package/.cline/workflows/plan.md +475 -0
  4. package/.cline/workflows/premerge.md +176 -0
  5. package/.cline/workflows/research.md +39 -0
  6. package/.cline/workflows/review.md +439 -0
  7. package/.cline/workflows/rollback.md +718 -0
  8. package/.cline/workflows/ship.md +131 -0
  9. package/.cline/workflows/sonarcloud.md +146 -0
  10. package/.cline/workflows/status.md +74 -0
  11. package/.cline/workflows/validate.md +234 -0
  12. package/.cline/workflows/verify.md +218 -0
  13. package/.codex/config.toml +11 -0
  14. package/.codex/skills/dev/SKILL.md +314 -0
  15. package/.codex/skills/plan/SKILL.md +478 -0
  16. package/.codex/skills/premerge/SKILL.md +179 -0
  17. package/.codex/skills/research/SKILL.md +42 -0
  18. package/.codex/skills/review/SKILL.md +442 -0
  19. package/.codex/skills/rollback/SKILL.md +721 -0
  20. package/.codex/skills/ship/SKILL.md +134 -0
  21. package/.codex/skills/sonarcloud/SKILL.md +149 -0
  22. package/.codex/skills/status/SKILL.md +77 -0
  23. package/.codex/skills/validate/SKILL.md +237 -0
  24. package/.codex/skills/verify/SKILL.md +221 -0
  25. package/.cursor/commands/dev.md +311 -0
  26. package/.cursor/commands/plan.md +475 -0
  27. package/.cursor/commands/premerge.md +176 -0
  28. package/.cursor/commands/research.md +39 -0
  29. package/.cursor/commands/review.md +439 -0
  30. package/.cursor/commands/rollback.md +718 -0
  31. package/.cursor/commands/ship.md +131 -0
  32. package/.cursor/commands/sonarcloud.md +146 -0
  33. package/.cursor/commands/status.md +74 -0
  34. package/.cursor/commands/validate.md +234 -0
  35. package/.cursor/commands/verify.md +218 -0
  36. package/.cursor/rules/permissions-guidance.mdc +37 -0
  37. package/.github/prompts/dev.prompt.md +316 -0
  38. package/.github/prompts/plan.prompt.md +480 -0
  39. package/.github/prompts/premerge.prompt.md +181 -0
  40. package/.github/prompts/research.prompt.md +44 -0
  41. package/.github/prompts/review.prompt.md +444 -0
  42. package/.github/prompts/rollback.prompt.md +723 -0
  43. package/.github/prompts/ship.prompt.md +136 -0
  44. package/.github/prompts/sonarcloud.prompt.md +151 -0
  45. package/.github/prompts/status.prompt.md +79 -0
  46. package/.github/prompts/validate.prompt.md +239 -0
  47. package/.github/prompts/verify.prompt.md +223 -0
  48. package/.kilocode/workflows/dev.md +315 -0
  49. package/.kilocode/workflows/plan.md +479 -0
  50. package/.kilocode/workflows/premerge.md +180 -0
  51. package/.kilocode/workflows/research.md +43 -0
  52. package/.kilocode/workflows/review.md +443 -0
  53. package/.kilocode/workflows/rollback.md +722 -0
  54. package/.kilocode/workflows/ship.md +135 -0
  55. package/.kilocode/workflows/sonarcloud.md +150 -0
  56. package/.kilocode/workflows/status.md +78 -0
  57. package/.kilocode/workflows/validate.md +238 -0
  58. package/.kilocode/workflows/verify.md +222 -0
  59. package/.opencode/commands/dev.md +314 -0
  60. package/.opencode/commands/plan.md +478 -0
  61. package/.opencode/commands/premerge.md +179 -0
  62. package/.opencode/commands/research.md +42 -0
  63. package/.opencode/commands/review.md +442 -0
  64. package/.opencode/commands/rollback.md +721 -0
  65. package/.opencode/commands/ship.md +134 -0
  66. package/.opencode/commands/sonarcloud.md +149 -0
  67. package/.opencode/commands/status.md +77 -0
  68. package/.opencode/commands/validate.md +237 -0
  69. package/.opencode/commands/verify.md +221 -0
  70. package/.roo/commands/dev.md +315 -0
  71. package/.roo/commands/plan.md +479 -0
  72. package/.roo/commands/premerge.md +180 -0
  73. package/.roo/commands/research.md +43 -0
  74. package/.roo/commands/review.md +443 -0
  75. package/.roo/commands/rollback.md +722 -0
  76. package/.roo/commands/ship.md +135 -0
  77. package/.roo/commands/sonarcloud.md +150 -0
  78. package/.roo/commands/status.md +78 -0
  79. package/.roo/commands/validate.md +238 -0
  80. package/.roo/commands/verify.md +222 -0
  81. package/LICENSE +21 -21
  82. package/docs/ENHANCED_ONBOARDING.md +2 -2
  83. package/docs/TOOLCHAIN.md +15 -234
  84. package/install.sh +32 -36
  85. package/lib/commands/plan.js +11 -15
  86. package/lib/commands/recommend.js +2 -2
  87. package/lib/dep-guard/analyzer.js +294 -0
  88. package/lib/dep-guard/behavior-detector.js +98 -0
  89. package/lib/dep-guard/contract-detector.js +162 -0
  90. package/lib/dep-guard/import-detector.js +498 -0
  91. package/lib/dep-guard/path-utils.js +13 -0
  92. package/lib/dep-guard/rubric.js +120 -0
  93. package/lib/dep-guard/task-parser.js +318 -0
  94. package/lib/plugin-catalog.js +18 -28
  95. package/lib/workflow-profiles.js +5 -11
  96. package/package.json +15 -4
  97. package/skills/parallel-deep-research/SKILL.md +108 -0
  98. package/skills/parallel-deep-research/evals/README.md +27 -0
  99. package/skills/parallel-deep-research/evals/evals.json +62 -0
  100. package/skills/sonarcloud-analysis/SKILL.md +171 -0
  101. package/skills/sonarcloud-analysis/evals/README.md +27 -0
  102. package/skills/sonarcloud-analysis/evals/evals.json +50 -0
  103. package/skills/sonarcloud-analysis/references/api-reference.md +466 -0
  104. package/docs/planning/PROGRESS.md +0 -396
  105. package/docs/plans/.gitkeep +0 -0
  106. package/docs/plans/2026-02-27-forge-test-suite-v2-decisions.md +0 -21
  107. package/docs/plans/2026-02-27-forge-test-suite-v2-design.md +0 -362
  108. package/docs/plans/2026-02-27-forge-test-suite-v2-tasks.md +0 -343
  109. package/docs/plans/2026-03-02-superpowers-gaps-decisions.md +0 -26
  110. package/docs/plans/2026-03-02-superpowers-gaps-design.md +0 -239
  111. package/docs/plans/2026-03-02-superpowers-gaps-tasks.md +0 -260
  112. package/docs/plans/2026-03-04-agent-command-parity-design.md +0 -163
  113. package/docs/plans/2026-03-04-verify-worktree-cleanup-decisions.md +0 -7
  114. package/docs/plans/2026-03-04-verify-worktree-cleanup-design.md +0 -165
  115. package/docs/plans/2026-03-05-forge-uto-decisions.md +0 -6
  116. package/docs/plans/2026-03-05-forge-uto-design.md +0 -116
  117. package/docs/plans/2026-03-05-forge-uto-tasks.md +0 -244
  118. package/docs/plans/2026-03-10-command-creator-and-eval-decisions.md +0 -52
  119. package/docs/plans/2026-03-10-command-creator-and-eval-design.md +0 -350
  120. package/docs/plans/2026-03-10-command-creator-and-eval-tasks.md +0 -426
  121. package/docs/plans/2026-03-10-stale-workflow-refs-decisions.md +0 -8
  122. package/docs/plans/2026-03-10-stale-workflow-refs-design.md +0 -80
  123. package/docs/plans/2026-03-10-stale-workflow-refs-tasks.md +0 -90
  124. package/docs/plans/2026-03-14-beads-plan-context-decisions.md +0 -9
  125. package/docs/plans/2026-03-14-beads-plan-context-design.md +0 -171
  126. package/docs/plans/2026-03-14-beads-plan-context-tasks.md +0 -160
  127. package/docs/plans/2026-03-14-skill-eval-loop-decisions.md +0 -33
  128. package/docs/plans/2026-03-14-skill-eval-loop-design.md +0 -118
  129. package/docs/plans/2026-03-14-skill-eval-loop-results.md +0 -78
  130. package/docs/plans/2026-03-14-skill-eval-loop-tasks.md +0 -160
  131. package/docs/plans/2026-03-15-agent-command-parity-v2-decisions.md +0 -11
  132. package/docs/plans/2026-03-15-agent-command-parity-v2-design.md +0 -145
  133. package/docs/plans/2026-03-15-agent-command-parity-v2-tasks.md +0 -211
  134. package/docs/research/TEMPLATE.md +0 -292
  135. package/docs/research/advanced-testing.md +0 -297
  136. package/docs/research/agent-permissions.md +0 -167
  137. package/docs/research/dependency-chain.md +0 -328
  138. package/docs/research/forge-workflow-v2.md +0 -550
  139. package/docs/research/plugin-architecture.md +0 -772
  140. package/docs/research/pr4-cli-automation.md +0 -326
  141. package/docs/research/premerge-verify-restructure.md +0 -205
  142. package/docs/research/skills-restructure.md +0 -508
  143. package/docs/research/sonarcloud-perfection-plan.md +0 -166
  144. package/docs/research/sonarcloud-quality-gate.md +0 -184
  145. package/docs/research/superpowers-integration.md +0 -403
  146. package/docs/research/superpowers.md +0 -319
  147. package/docs/research/test-environment.md +0 -519
@@ -0,0 +1,478 @@
1
+ ---
2
+ description: Design intent → research → branch + worktree + task list
3
+ ---
4
+
5
+ Plan a feature from scratch: brainstorm design intent, research technical approach, then set up branch, worktree, and a complete task list ready for /dev.
6
+
7
+ # Plan
8
+
9
+ This command runs in **3 phases**. Each phase ends with a HARD-GATE. Do not skip phases.
10
+
11
+ ---
12
+
13
+ ```
14
+ <HARD-GATE: /plan entry — worktree isolation>
15
+ Before ANY planning work begins:
16
+
17
+ 1. Run: git branch --show-current
18
+ 2. If the current branch is NOT master/main:
19
+ - STOP. Do not begin Phase 1.
20
+ - Tell the user: "You are on '<branch>'. Planning must start from a clean worktree on master.
21
+ Run: git checkout master — then re-run /plan."
22
+ 3. If on master, create the worktree NOW before asking any questions:
23
+ a. bd worktree create .worktrees/<slug> --branch feat/<slug>
24
+ b. cd .worktrees/<slug>
25
+ 4. Confirm: "Working in isolated worktree: .worktrees/<slug> (branch: feat/<slug>)"
26
+ 5. ONLY THEN begin Phase 1.
27
+
28
+ Rationale: Planning commits (design docs, task lists) belong only to this feature's branch.
29
+ If planning runs in the main directory on a non-master branch, those commits contaminate
30
+ whatever branch is currently checked out. The worktree ensures zero cross-contamination
31
+ between parallel features or sessions.
32
+ </HARD-GATE>
33
+ ```
34
+
35
+ ---
36
+
37
+ ## Usage
38
+
39
+ ```bash
40
+ /plan <feature-slug>
41
+ /plan <feature-slug> --strategic # Major architecture change: creates design doc PR before Phase 2
42
+ /plan <feature-slug> --continue # After --strategic PR is merged: run Phase 2 + 3
43
+ ```
44
+
45
+ ---
46
+
47
+ ## Phase 1: Design Intent (Brainstorming)
48
+
49
+ **Goal**: Capture WHAT to build — purpose, constraints, success criteria, edge cases, approach.
50
+
51
+ ### Step 0: Dependency ripple check (advisory)
52
+
53
+ Before exploring context or asking questions, check for potential conflicts with in-flight work:
54
+
55
+ ```bash
56
+ # If a Beads issue ID is known (e.g., from /status or bd ready):
57
+ bash scripts/dep-guard.sh check-ripple <beads-issue-id>
58
+
59
+ # If no issue exists yet (first-time plan):
60
+ bd list --status=open,in_progress
61
+ ```
62
+
63
+ Review the output. If overlaps are detected:
64
+ - Consider whether the overlapping issue should be a dependency
65
+ - Note any shared areas for the design Q&A
66
+ - This check is **advisory only** — always proceed to Step 1 regardless of findings
67
+
68
+ #### Ripple Analyst Agent (spawned when contract overlaps found)
69
+
70
+ When `check-ripple` detects overlapping issues AND contract metadata is available, spawn a Ripple Analyst subagent with this prompt:
71
+
72
+ **Input to agent**:
73
+ - Current issue's contract changes (from `extract-contracts` output)
74
+ - Consumer code snippets (from `find-consumers` output for each changed contract)
75
+ - Overlapping issue's title, description, and contract metadata
76
+
77
+ **Agent instructions**:
78
+ 1. For each overlapping contract, imagine 2-3 concrete break scenarios:
79
+ - "If [contract X] changes [specific behavior], then [consumer Y] will [specific failure]"
80
+ 2. Rate overall impact as one of:
81
+ - **NONE**: No real conflict despite keyword overlap
82
+ - **LOW**: Consumers need trivial adjustment (add parameter, rename call)
83
+ - **HIGH**: Consumer needs significant rework (parsing logic, data handling changes)
84
+ - **CRITICAL**: Consumer is in an active in_progress issue's task list
85
+ 3. **When uncertain, default to HIGH** — conservative over permissive
86
+ 4. Recommend one action:
87
+ - Add dependency (`bd dep add <source> <target>`)
88
+ - Coordinate with other issue's developer
89
+ - Scope down current feature to avoid overlap
90
+ - Proceed as-is (no real conflict)
91
+
92
+ **Output format**:
93
+ ```
94
+ Impact: [NONE|LOW|HIGH|CRITICAL]
95
+ Confidence: [high|medium|low]
96
+
97
+ Break scenarios:
98
+ 1. [scenario description]
99
+ 2. [scenario description]
100
+
101
+ Recommendation: [action]
102
+ Reason: [why this action]
103
+ ```
104
+
105
+ This agent is advisory only. The developer always makes the final decision.
106
+
107
+ ### Step 1: Explore project context
108
+
109
+ Before asking any questions, read relevant files:
110
+ - Recent commits related to this area
111
+ - Existing code in affected modules
112
+ - Any related docs, tests, or prior research
113
+
114
+ ### Step 2: Ask clarifying questions — one at a time
115
+
116
+ Ask each question in sequence. Wait for user response. Use multiple choice where possible.
117
+
118
+ Questions to cover (adapt to feature, don't ask mechanical copies):
119
+ 1. **Purpose** — What problem does this solve? Who benefits?
120
+ 2. **Constraints** — What must this NOT do? What are the hard limits?
121
+ 3. **Success criteria** — How will we know it's done? What is the minimum viable result?
122
+ 4. **Edge cases** — What happens when [key dependency] fails / [input] is missing / [state] is ambiguous?
123
+ 5. **Technical preferences** — Library A or B? Pattern X or Y? (when real options exist)
124
+ 6. **Ambiguity policy** — If a spec gap is found mid-dev, should the agent: (a) make a reasonable choice and document it, or (b) pause and wait for input?
125
+
126
+ ### Step 3: Propose approaches
127
+
128
+ Propose 2-3 concrete approaches with:
129
+ - Trade-offs (speed vs safety, complexity vs flexibility)
130
+ - A clear recommendation with reasoning
131
+ - Get user approval on the chosen approach
132
+
133
+ ### Step 4: Write design doc
134
+
135
+ Save to `docs/plans/YYYY-MM-DD-<slug>-design.md` with these sections:
136
+ - **Feature**: slug, date, status
137
+ - **Purpose**: what problem it solves
138
+ - **Success criteria**: measurable, specific
139
+ - **Out of scope**: explicit boundaries
140
+ - **Approach selected**: which option and why
141
+ - **Constraints**: hard limits
142
+ - **Edge cases**: decisions made during Q&A
143
+ - **Ambiguity policy**: agent's fallback when spec gaps arise mid-dev
144
+
145
+ Commit the design doc:
146
+ ```bash
147
+ git add docs/plans/YYYY-MM-DD-<slug>-design.md
148
+ git commit -m "docs: add design doc for <slug>"
149
+ ```
150
+
151
+ ---
152
+
153
+ **--strategic flag** (for major architecture changes):
154
+
155
+ After committing the design doc, push to a proposal branch and open PR:
156
+ ```bash
157
+ git checkout -b feat/<slug>-proposal
158
+ git push -u origin feat/<slug>-proposal
159
+ gh pr create --title "Design: <feature-name>" \
160
+ --body "Design doc for review. See docs/plans/YYYY-MM-DD-<slug>-design.md"
161
+ ```
162
+
163
+ **STOP here.** Present the PR URL. Wait for the user to merge the proposal PR.
164
+ After merge, run `/plan <slug> --continue` to proceed to Phase 2 + 3.
165
+
166
+ ---
167
+
168
+ ```
169
+ <HARD-GATE: Phase 1 exit>
170
+ Do NOT begin Phase 2 (web research) until:
171
+ 1. User has approved the design in this session
172
+ 2. Design doc exists at docs/plans/YYYY-MM-DD-<slug>-design.md
173
+ 3. Design doc includes: success criteria, edge cases, out-of-scope, ambiguity policy
174
+ 4. Design doc is committed to git
175
+ </HARD-GATE>
176
+ ```
177
+
178
+ ---
179
+
180
+ ## Phase 2: Technical Research
181
+
182
+ **Goal**: Find HOW to build it — best practices, known issues, security risks, TDD scenarios.
183
+
184
+ Run these in parallel:
185
+
186
+ ### Web research (parallel-deep-research skill)
187
+ ```
188
+ Skill("parallel-deep-research")
189
+ ```
190
+ Search for:
191
+ - "[tech stack] [feature] best practices [year]"
192
+ - "[library/framework] [feature] implementation patterns"
193
+ - "Known issues / gotchas with [approach selected]"
194
+
195
+ ### OWASP Top 10 analysis
196
+
197
+ For this feature's risk surface, document each relevant OWASP category:
198
+ - What the risk is
199
+ - Whether it applies to this feature
200
+ - What mitigation will be implemented
201
+
202
+ ### Codebase exploration (Explore agent)
203
+ - Similar existing patterns to reuse
204
+ - Files this feature will affect
205
+ - Existing test infrastructure to leverage
206
+
207
+ ### DRY check (mandatory — use actual search tools)
208
+
209
+ Before finalizing the approach, run Grep/Glob/Read searches for existing implementations of the planned function or pattern. Do not rely on memory or assumptions — execute the searches.
210
+
211
+ ```
212
+ Grep(searchTerm) # e.g., the function or concept name
213
+ Glob("**/*.js") # narrow to affected file types if needed
214
+ Read(matchedFile) # inspect any match in context
215
+ ```
216
+
217
+ If a match is found:
218
+ - Update the design doc's "Approach selected" section to say "extend existing [file/function]" — not "create new".
219
+ - Note the existing file path and line number in the design doc.
220
+
221
+ If no match is found: proceed. The DRY gate is cleared.
222
+
223
+ ### Blast-radius search (mandatory for remove/rename/replace features)
224
+
225
+ If this feature involves **removing**, **renaming**, or **replacing** a concept, tool, or dependency:
226
+
227
+ 1. Grep the ENTIRE codebase for the thing being removed/renamed:
228
+ ```
229
+ Grep("<thing-being-removed>") # exact name
230
+ Grep("<thing-being-removed>", -i) # case-insensitive variant
231
+ Glob("**/*<thing>*") # files named after it
232
+ ```
233
+
234
+ 2. For EVERY match found:
235
+ - Note the file path and line number in the design doc
236
+ - Add a cleanup task to the task list (Phase 3)
237
+ - Flag matches in unexpected packages or config files explicitly
238
+
239
+ 3. Common hiding spots to check:
240
+ - `package.json` (scripts, dependencies, description)
241
+ - `install.sh` / setup scripts
242
+ - CI/CD workflows (`.github/workflows/`)
243
+ - Agent config files (`lib/agents/`, `.cursorrules`, etc.)
244
+ - Documentation (`docs/`, `README.md`, `AGENTS.md`)
245
+ - Import statements and require() calls
246
+
247
+ If no removal/rename is involved, this section is skipped.
248
+
249
+ ### TDD test scenarios
250
+
251
+ Identify at minimum 3 test scenarios:
252
+ - Happy path
253
+ - Error / failure path
254
+ - Edge case from Phase 1
255
+
256
+ Append all research findings to the design doc under a `## Technical Research` section (not a separate file).
257
+
258
+ ---
259
+
260
+ ```
261
+ <HARD-GATE: Phase 2 exit>
262
+ Do NOT begin Phase 3 (setup) until:
263
+ 1. OWASP analysis is documented in design doc
264
+ 2. At least 3 TDD test scenarios are identified
265
+ 3. Approach selection is confirmed (which library/pattern to use)
266
+ 4. If feature involves removal/rename: blast-radius search completed, all references added to task list
267
+ </HARD-GATE>
268
+ ```
269
+
270
+ ---
271
+
272
+ ## Phase 3: Setup + Task List
273
+
274
+ **Goal**: Create branch, worktree, Beads issue, and a complete task list ready for /dev.
275
+
276
+ ### Step 1: Beads issue
277
+
278
+ ```bash
279
+ bd create --title="<feature-name>" --type=feature
280
+ bd update <id> --status=in_progress
281
+ ```
282
+
283
+ ### Step 2: Branch + worktree
284
+
285
+ **ALWAYS branch from master, never from the current branch.** If the working directory is on any branch other than master, the new feature branch would inherit all unmerged changes from that branch — contaminating the new feature's history.
286
+
287
+ **Note**: If the Entry HARD-GATE already created the branch and worktree (and you are already inside `.worktrees/<slug>`), skip Steps 2b–2d — they are already done.
288
+
289
+ ```bash
290
+ # Step 2a: Check if branch and worktree were already created by Entry HARD-GATE
291
+ CURRENT=$(git branch --show-current)
292
+ if [ "$CURRENT" = "feat/<slug>" ]; then
293
+ echo "✓ Branch feat/<slug> already exists (Entry HARD-GATE created it) — skipping 2b–2d"
294
+ else
295
+ # Step 2b: Verify .worktrees/ is gitignored — add if missing
296
+ git check-ignore -v .worktrees/ || echo ".worktrees/" >> .gitignore
297
+
298
+ # Step 2c: Create a Beads-aware worktree rooted on master
299
+ git checkout master
300
+ bd worktree create .worktrees/<slug> --branch feat/<slug>
301
+ cd .worktrees/<slug>
302
+ fi
303
+ ```
304
+
305
+ **Why this matters**: Multiple parallel features or sessions each get their own isolated worktree. Changes to one feature never bleed into another. The main working directory can stay on any branch without affecting new feature branches.
306
+
307
+ ### Step 3: Project setup in worktree
308
+
309
+ Auto-detect and run install:
310
+ ```bash
311
+ # e.g., bun install / npm install / pip install -r requirements.txt
312
+ ```
313
+
314
+ ### Step 4: Baseline test run
315
+
316
+ ```bash
317
+ # Run full test suite in worktree
318
+ bun test # or project test command
319
+ ```
320
+
321
+ If tests fail: report which tests are failing and ask user whether to investigate or proceed anyway. Do not silently proceed past failing baseline tests.
322
+
323
+ ### Step 5: Task list creation
324
+
325
+ Read the design doc. Break implementation into granular tasks.
326
+
327
+ **Task format** (each task MUST have ALL of these):
328
+ ```
329
+ Task N: <descriptive title>
330
+ File(s): <exact file paths>
331
+ What to implement: <complete description — not "add feature X", but what specifically>
332
+ TDD steps:
333
+ 1. Write test: <test file path, what assertion, what input/output>
334
+ 2. Run test: confirm it fails with [specific expected error message]
335
+ 3. Implement: <exact function/class/component to write>
336
+ 4. Run test: confirm it passes
337
+ 5. Commit: `<type>: <message>`
338
+ Expected output: <what running the test/code produces when done>
339
+ ```
340
+
341
+ **Ordering rules**:
342
+ - Foundational/shared modules FIRST (types, utils, constants)
343
+ - Feature logic SECOND
344
+ - Integration/wiring THIRD
345
+ - Uncertain/ambiguous tasks LAST (so they can be deferred if blocked)
346
+
347
+ **YAGNI filter** (after initial task draft, before saving):
348
+
349
+ For each task, confirm it maps to a specific requirement, success criterion, or edge case in the design doc. Run `applyYAGNIFilter({ task, designDoc })` for each task.
350
+
351
+ - Tasks that match → keep as-is.
352
+ - Tasks with no anchor → flagged as "potential scope creep". Present flagged tasks to the user: "These tasks have no anchor in the design doc. Keep (specify which requirement it serves) or remove?"
353
+ - If ALL tasks are flagged → return `allFlagged: true` and tell the user: "Design doc doesn't cover all tasks — needs amendment." Do not save the task list until the design doc is updated or tasks are removed.
354
+
355
+ **Before finalizing**: flag any tasks that touch areas not fully specified in the design doc. Present flagged tasks to user for quick clarification before saving.
356
+
357
+ Save to `docs/plans/YYYY-MM-DD-<slug>-tasks.md`.
358
+
359
+ ### Step 5b: Beads context
360
+
361
+ After saving the task list, attach design context and acceptance criteria to the Beads issue so downstream stages (`/dev`, `/validate`, `/review`) can retrieve it without re-reading the design doc.
362
+
363
+ ```bash
364
+ # Link design metadata (task count + task file path) to the Beads issue
365
+ bash scripts/beads-context.sh set-design <id> <task-count> docs/plans/YYYY-MM-DD-<slug>-tasks.md
366
+
367
+ # Record the success criteria from the design doc on the issue
368
+ bash scripts/beads-context.sh set-acceptance <id> "<success-criteria from design doc>"
369
+ ```
370
+
371
+ Both commands must exit with code 0. If either fails, investigate (wrong issue ID? missing script?) before continuing.
372
+
373
+ ### Step 5c: Contract extraction and logic-level dependency review
374
+
375
+ After saving the task list and Beads context, extract and store contract metadata, then run the logic-level Phase 3 dependency review:
376
+
377
+ ```bash
378
+ # Extract contracts — only call store-contracts if extract succeeds (exit 0)
379
+ if bash scripts/dep-guard.sh extract-contracts docs/plans/YYYY-MM-DD-<slug>-tasks.md > /tmp/contracts.txt; then
380
+ bash scripts/dep-guard.sh store-contracts <id> "$(cat /tmp/contracts.txt)"
381
+ else
382
+ echo "No contracts found — skipping store-contracts"
383
+ fi
384
+
385
+ # Re-run ripple check using Beads JSON + logic-level analysis
386
+ bash scripts/dep-guard.sh check-ripple <id>
387
+ ```
388
+
389
+ `extract-contracts` exits 1 when no contracts are found (not an error — just nothing to store). `store-contracts` must exit 0 if called.
390
+
391
+ `check-ripple` is now advisory but logic-aware. It should:
392
+ - read Beads issue data via JSON
393
+ - analyze import/call-chain, contract, and behavioral dependency signals
394
+ - show rubric score, confidence, issue pairs, and proposed dependency updates with pros/cons
395
+ - stop for user approval whenever a dependency mutation is proposed
396
+
397
+ If the user approves a dependency mutation, apply it explicitly:
398
+
399
+ ```bash
400
+ bash scripts/dep-guard.sh apply-decision <id> <dependent-id> <depends-on-id> "<approval rationale>"
401
+ ```
402
+
403
+ That approval step must validate with `bd dep cycles`, show `bd graph`, summarize `bd ready`, and persist the decision via `bd set-state` plus `bd comments`. Beads remains the canonical machine-readable decision record; the plan docs hold only the concise summary.
404
+
405
+ ### Step 6: User review
406
+
407
+ Present the full task list. Allow the user to reorder, split, or remove tasks.
408
+
409
+ ---
410
+
411
+ ```
412
+ <HARD-GATE: /plan exit>
413
+ Do NOT proceed to /dev until ALL are confirmed:
414
+ 1. git branch --show-current output shows feat/<slug>
415
+ 2. git worktree list shows .worktrees/<slug>
416
+ 3. Baseline tests ran — either passing OR user confirmed to proceed past failures
417
+ 4. Beads issue is created with status=in_progress
418
+ 5. Task list exists at docs/plans/YYYY-MM-DD-<slug>-tasks.md
419
+ 6. User has confirmed task list is correct
420
+ 7. `beads-context.sh set-design` ran successfully (exit code 0)
421
+ 8. `beads-context.sh set-acceptance` ran successfully (exit code 0)
422
+ 9. `dep-guard.sh store-contracts` ran successfully (exit code 0) — or skipped if no contracts found
423
+ 10. `dep-guard.sh check-ripple` ran successfully and any proposed dependency mutation was reviewed with the user before calling `apply-decision`
424
+ </HARD-GATE>
425
+ ```
426
+
427
+ After all HARD-GATE items pass, record the stage transition on the Beads issue:
428
+
429
+ ```bash
430
+ bash scripts/beads-context.sh stage-transition <id> plan dev
431
+ ```
432
+
433
+ ---
434
+
435
+ ## Example Output (Phase 3 complete)
436
+
437
+ ```
438
+ ✓ Phase 1: Design intent captured
439
+ - Design doc: docs/plans/2026-02-26-stripe-billing-design.md
440
+ - Approach: Stripe SDK v4 (selected over v3)
441
+ - Ambiguity policy: Make conservative choice + document in decisions log
442
+
443
+ ✓ Phase 2: Technical research complete
444
+ - OWASP Top 10: 3 risks identified, 3 mitigations planned
445
+ - TDD scenarios: 5 identified
446
+ - Sources: 8 references
447
+
448
+ ✓ Phase 3: Setup complete
449
+ - Beads: forge-xyz (in_progress)
450
+ - Branch: feat/stripe-billing
451
+ - Worktree: .worktrees/stripe-billing (baseline: 24/24 tests passing)
452
+ - Task list: docs/plans/2026-02-26-stripe-billing-tasks.md (8 tasks)
453
+
454
+ ⏸️ Task list ready for review. Confirm to proceed.
455
+
456
+ After confirming, run: /dev
457
+ ```
458
+
459
+ ## Integration with Workflow
460
+
461
+ ```
462
+ Utility: /status → Understand current context before starting
463
+ Stage 1: /plan → Design intent → research → branch + worktree + task list (you are here)
464
+ Stage 2: /dev → Implement each task with subagent-driven TDD
465
+ Stage 3: /validate → Type check, lint, tests, security — all fresh output
466
+ Stage 4: /ship → Push + create PR
467
+ Stage 5: /review → Address GitHub Actions, Greptile, SonarCloud
468
+ Stage 6: /premerge → Update docs, hand off PR to user
469
+ Stage 7: /verify → Post-merge CI check on main
470
+ ```
471
+
472
+ ## Tips
473
+
474
+ - **Phase 1 quality = /dev autonomy**: Every ambiguity resolved in Phase 1 is a decision gate that won't fire during /dev
475
+ - **One question at a time**: Don't dump all questions at once — dialogue produces better design decisions than a questionnaire
476
+ - **Task granularity**: Target 2-5 minutes per task. If a task takes longer, split it
477
+ - **Uncertain tasks go last**: Anything ambiguous at the end of the task list can be deferred if blocked without stopping other work
478
+ - **Baseline failures matter**: Pre-existing test failures hide regressions. Fix or explicitly document them before /dev starts
@@ -0,0 +1,179 @@
1
+ ---
2
+ description: Complete all doc updates on feature branch, then hand off PR to user for merge
3
+ ---
4
+
5
+ Prepare the pull request for merge by completing ALL documentation updates on the feature branch, then hand off to the user.
6
+
7
+ # Premerge
8
+
9
+ **The actual merge is always done by the user in the GitHub UI — never by this command.**
10
+
11
+ This command makes the PR 100% complete: code + tests + docs in one unit. After this, the user merges once and there are no follow-up doc PRs needed.
12
+
13
+ ## Usage
14
+
15
+ ```bash
16
+ /premerge <pr-number>
17
+ ```
18
+
19
+ ## What This Command Does
20
+
21
+ ### Step 1: Verify All CI Checks Pass
22
+
23
+ ```bash
24
+ gh pr checks <pr-number>
25
+ ```
26
+
27
+ All checks must be green before proceeding. If any fail, run `/review <pr-number>` first.
28
+
29
+ ### Step 2: Warn If Branch Is Behind Master
30
+
31
+ ```bash
32
+ gh pr view <pr-number> --json baseRefName,headRefName
33
+ git fetch origin master
34
+ git status
35
+ ```
36
+
37
+ If the feature branch is behind `master`, tell the user to rebase first:
38
+
39
+ ```
40
+ ⚠️ Branch is behind master — rebase before updating docs to avoid conflicts:
41
+ git rebase origin/master
42
+ git push --force-with-lease
43
+ ```
44
+
45
+ ### Step 3: Update ALL Relevant Documentation (on feature branch)
46
+
47
+ Check each of the following and update if the feature affects it. Be selective — only update what genuinely changed.
48
+
49
+ **A. `CHANGELOG.md`** (always):
50
+ - Add entry under `## [Unreleased]` heading (create heading if not present)
51
+ - Use [Keep a Changelog](https://keepachangelog.com/) categories:
52
+ - **Added**: New features
53
+ - **Changed**: Changes to existing functionality
54
+ - **Fixed**: Bug fixes
55
+ - **Removed**: Removed features
56
+ - Include: feature name, PR number, Beads ID
57
+ - Example:
58
+ ```markdown
59
+ ## [Unreleased]
60
+
61
+ ### Added
62
+ - Authentication refresh tokens (PR #89, forge-a3f8)
63
+ ```
64
+
65
+ **B. `README.md`** (if user-facing changes):
66
+ - Features list, configuration options, usage examples
67
+
68
+ **C. `docs/reference/API_REFERENCE.md`** (if API changes):
69
+ - New endpoints, request/response schemas, authentication
70
+
71
+ **D. Architecture docs** (if structural changes):
72
+ - `docs/architecture/` diagrams, decision records (ADRs)
73
+
74
+ **E. `CLAUDE.md` — USER section only** (if project conventions changed):
75
+ ```
76
+ <!-- USER:START - Add project-specific learnings here as you work -->
77
+ ...update only between these markers...
78
+ <!-- USER:END -->
79
+ ```
80
+ ⚠️ NEVER touch other managed blocks (e.g., `<!-- AGENT:START/END -->`).
81
+
82
+ **F. `AGENTS.md`** (if agent config, skills, or cross-agent workflow changed):
83
+ - Update relevant sections describing agent capabilities or workflow
84
+
85
+ **G. `docs/WORKFLOW.md`** (if the workflow itself changed):
86
+ - Update stage descriptions or workflow tables
87
+
88
+ **Commit doc updates to feature branch**:
89
+
90
+ ```bash
91
+ git add CHANGELOG.md README.md docs/ AGENTS.md CLAUDE.md
92
+ git commit -m "docs: update documentation for <feature-name>
93
+
94
+ - Updated: [list files changed]
95
+ - Reason: [brief explanation]"
96
+
97
+ git push
98
+ ```
99
+
100
+ ⚠️ **After pushing**: CI will re-trigger (Greptile, SonarCloud, etc.). Wait for checks to pass. If new Greptile comments appear on the doc changes, run `/review <pr-number>` again.
101
+
102
+ ### Step 4: Sync Beads
103
+
104
+ ```bash
105
+ bd sync
106
+ ```
107
+
108
+ ### Step 5: Hand Off — STOP HERE
109
+
110
+ **DO NOT run `gh pr merge`.** Present the PR and wait for the user to merge.
111
+
112
+ Output:
113
+
114
+ ```
115
+ ✅ PR #<number> is ready to merge
116
+
117
+ All checks: ✓ passing
118
+ Documentation: ✓ updated on feature branch
119
+ Beads: ✓ synced
120
+
121
+ 👉 Please merge in the GitHub UI:
122
+ https://github.com/<owner>/<repo>/pull/<number>
123
+
124
+ Recommended: Squash and merge (keeps main history clean)
125
+
126
+ After you merge, run /verify to confirm everything landed correctly.
127
+ ```
128
+
129
+ ```
130
+ <HARD-GATE: /premerge exit>
131
+ Do NOT run gh pr merge.
132
+ Do NOT suggest merging.
133
+ /premerge ends here. Output the PR URL and status. Wait for user.
134
+
135
+ "After you merge, run /verify to confirm everything landed correctly."
136
+ </HARD-GATE>
137
+ ```
138
+
139
+ ## Example Output
140
+
141
+ ```
142
+ ✓ CI checks: All passing
143
+ ✓ Branch: Up to date with master
144
+ ✓ Documentation updated:
145
+ - CHANGELOG.md: Entry added under [Unreleased]
146
+ - README.md: Features list updated
147
+ - CLAUDE.md: USER section updated with new pattern
148
+ - Committed: docs: update documentation for auth-refresh
149
+ ✓ CI re-triggered after doc push — all checks still passing
150
+ ✓ Beads synced
151
+
152
+ ✅ PR #89 is ready to merge
153
+
154
+ 👉 Please merge in the GitHub UI:
155
+ https://github.com/harshanandak/forge/pull/89
156
+
157
+ After you merge, run /verify
158
+ ```
159
+
160
+ ## Rules
161
+
162
+ - **NEVER run `gh pr merge`** — blocked by PreToolUse hook in `.claude/settings.json`
163
+ - **CLAUDE.md USER section only** — never touch other managed blocks
164
+ - **Warn if branch is behind** — tell user to rebase before doc updates
165
+ - **Re-check CI after doc push** — doc commits re-trigger full CI pipeline
166
+ - **One PR, complete** — code + tests + docs merged together, no follow-up doc PRs
167
+
168
+ ## Integration with Workflow
169
+
170
+ ```
171
+ Utility: /status → Understand current context before starting
172
+ Stage 1: /plan → Design intent → research → branch + worktree + task list
173
+ Stage 2: /dev → Implement each task with subagent-driven TDD
174
+ Stage 3: /validate → Type check, lint, tests, security — all fresh output
175
+ Stage 4: /ship → Push + create PR
176
+ Stage 5: /review → Address GitHub Actions, Greptile, SonarCloud
177
+ Stage 6: /premerge → Update docs, hand off PR to user (you are here)
178
+ Stage 7: /verify → Post-merge CI check on main
179
+ ```
@@ -0,0 +1,42 @@
1
+ ---
2
+ description: Deep research with parallel-deep-research, document findings
3
+ ---
4
+
5
+ > **Note**: `/research` is now Phase 2 of `/plan`.
6
+ >
7
+ > The research phase has been absorbed into the `/plan` command, which runs a full 3-phase workflow:
8
+ > - **Phase 1**: Brainstorming — design intent, constraints, success criteria
9
+ > - **Phase 2**: Technical research — web search, OWASP, codebase exploration, TDD scenarios
10
+ > - **Phase 3**: Setup — branch, worktree, Beads issue, task list
11
+ >
12
+ > Run `/plan <feature-slug>` to start the complete planning workflow.
13
+
14
+ # Research (Legacy Alias)
15
+
16
+ This command previously ran a standalone research phase. It is now embedded in `/plan` as Phase 2.
17
+
18
+ ## If you want to run just the research phase
19
+
20
+ Jump to Phase 2 of `/plan` manually:
21
+
22
+ 1. Read or create the design doc at `docs/plans/YYYY-MM-DD-<slug>-design.md`
23
+ 2. Run parallel web search using the `parallel-deep-research` skill
24
+ 3. Run OWASP Top 10 analysis for the feature
25
+ 4. Use the Explore agent for codebase exploration
26
+ 5. Identify at least 3 TDD test scenarios
27
+ 6. Append findings under `## Technical Research` in the design doc
28
+
29
+ Then continue with `/plan <slug> --continue` to run Phase 3 (setup + task list).
30
+
31
+ ## Integration with Workflow
32
+
33
+ ```
34
+ Utility: /status → Understand current context before starting
35
+ Stage 1: /plan → Design intent → research → branch + worktree + task list
36
+ Stage 2: /dev → Implement each task with subagent-driven TDD
37
+ Stage 3: /validate → Type check, lint, tests, security — all fresh output
38
+ Stage 4: /ship → Push + create PR
39
+ Stage 5: /review → Address GitHub Actions, Greptile, SonarCloud
40
+ Stage 6: /premerge → Update docs, hand off PR to user
41
+ Stage 7: /verify → Post-merge CI check on main
42
+ ```