@garygentry/feature-forge 0.2.3 → 0.2.4

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 (149) hide show
  1. package/README.md +6 -1
  2. package/adapters/GENERATION-REPORT.md +5 -1
  3. package/adapters/claude/references/forge-config-schema.json +25 -3
  4. package/adapters/claude/references/pipeline-state-schema.json +3 -2
  5. package/adapters/claude/references/portable-root.md +2 -2
  6. package/adapters/claude/references/process-overview.md +10 -0
  7. package/adapters/claude/references/shared-conventions.md +14 -9
  8. package/adapters/claude/references/stage-exit-protocol.md +99 -0
  9. package/adapters/claude/scripts/epic-manifest.py +10 -0
  10. package/adapters/claude/scripts/forge-bootstrap.py +94 -16
  11. package/adapters/claude/scripts/forge-init.sh +7 -1
  12. package/adapters/claude/scripts/forge-session.py +175 -30
  13. package/adapters/claude/skills/forge/SKILL.md +28 -14
  14. package/adapters/claude/skills/forge-0-epic/SKILL.md +20 -15
  15. package/adapters/claude/skills/forge-0-epic/references/edit-mode.md +6 -4
  16. package/adapters/claude/skills/forge-0-epic/references/epic-manifest-subcommands.md +1 -1
  17. package/adapters/claude/skills/forge-1-prd/SKILL.md +14 -4
  18. package/adapters/claude/skills/forge-2-tech/SKILL.md +14 -3
  19. package/adapters/claude/skills/forge-3-specs/SKILL.md +14 -3
  20. package/adapters/claude/skills/forge-4-backlog/SKILL.md +16 -5
  21. package/adapters/claude/skills/forge-5-loop/SKILL.md +19 -21
  22. package/adapters/claude/skills/forge-5-loop/references/result-reporting.md +10 -5
  23. package/adapters/claude/skills/forge-6-docs/SKILL.md +6 -6
  24. package/adapters/claude/skills/forge-bootstrap/SKILL.md +4 -4
  25. package/adapters/claude/skills/forge-fix/SKILL.md +27 -6
  26. package/adapters/claude/skills/forge-guide/SKILL.md +179 -0
  27. package/adapters/claude/skills/forge-init/SKILL.md +28 -1
  28. package/adapters/claude/skills/forge-verify/SKILL.md +46 -15
  29. package/adapters/claude/skills/forge-verify/references/verification-checklists.md +1 -1
  30. package/adapters/codex/references/forge-config-schema.json +25 -3
  31. package/adapters/codex/references/pipeline-state-schema.json +3 -2
  32. package/adapters/codex/references/portable-root.md +2 -2
  33. package/adapters/codex/references/process-overview.md +10 -0
  34. package/adapters/codex/references/shared-conventions.md +14 -9
  35. package/adapters/codex/references/stage-exit-protocol.md +99 -0
  36. package/adapters/codex/scripts/epic-manifest.py +10 -0
  37. package/adapters/codex/scripts/forge-bootstrap.py +94 -16
  38. package/adapters/codex/scripts/forge-init.sh +7 -1
  39. package/adapters/codex/scripts/forge-session.py +175 -30
  40. package/adapters/codex/skills/forge/SKILL.md +33 -19
  41. package/adapters/codex/skills/forge-0-epic/SKILL.md +21 -16
  42. package/adapters/codex/skills/forge-0-epic/references/edit-mode.md +6 -4
  43. package/adapters/codex/skills/forge-0-epic/references/epic-manifest-subcommands.md +1 -1
  44. package/adapters/codex/skills/forge-1-prd/SKILL.md +14 -4
  45. package/adapters/codex/skills/forge-2-tech/SKILL.md +15 -4
  46. package/adapters/codex/skills/forge-3-specs/SKILL.md +14 -3
  47. package/adapters/codex/skills/forge-4-backlog/SKILL.md +16 -5
  48. package/adapters/codex/skills/forge-5-loop/SKILL.md +21 -23
  49. package/adapters/codex/skills/forge-5-loop/references/result-reporting.md +10 -5
  50. package/adapters/codex/skills/forge-6-docs/SKILL.md +6 -6
  51. package/adapters/codex/skills/forge-bootstrap/SKILL.md +4 -4
  52. package/adapters/codex/skills/forge-fix/SKILL.md +27 -6
  53. package/adapters/codex/skills/forge-guide/SKILL.md +188 -0
  54. package/adapters/codex/skills/forge-init/SKILL.md +28 -1
  55. package/adapters/codex/skills/forge-verify/SKILL.md +45 -14
  56. package/adapters/codex/skills/forge-verify/references/verification-checklists.md +1 -1
  57. package/adapters/copilot/references/forge-config-schema.json +25 -3
  58. package/adapters/copilot/references/pipeline-state-schema.json +3 -2
  59. package/adapters/copilot/references/portable-root.md +2 -2
  60. package/adapters/copilot/references/process-overview.md +10 -0
  61. package/adapters/copilot/references/shared-conventions.md +14 -9
  62. package/adapters/copilot/references/stage-exit-protocol.md +99 -0
  63. package/adapters/copilot/scripts/epic-manifest.py +10 -0
  64. package/adapters/copilot/scripts/forge-bootstrap.py +94 -16
  65. package/adapters/copilot/scripts/forge-init.sh +7 -1
  66. package/adapters/copilot/scripts/forge-session.py +175 -30
  67. package/adapters/copilot/skills/forge/forge.md +33 -19
  68. package/adapters/copilot/skills/forge-0-epic/forge-0-epic.md +21 -16
  69. package/adapters/copilot/skills/forge-0-epic/references/edit-mode.md +6 -4
  70. package/adapters/copilot/skills/forge-0-epic/references/epic-manifest-subcommands.md +1 -1
  71. package/adapters/copilot/skills/forge-1-prd/forge-1-prd.md +14 -4
  72. package/adapters/copilot/skills/forge-2-tech/forge-2-tech.md +15 -4
  73. package/adapters/copilot/skills/forge-3-specs/forge-3-specs.md +14 -3
  74. package/adapters/copilot/skills/forge-4-backlog/forge-4-backlog.md +16 -5
  75. package/adapters/copilot/skills/forge-5-loop/forge-5-loop.md +21 -23
  76. package/adapters/copilot/skills/forge-5-loop/references/result-reporting.md +10 -5
  77. package/adapters/copilot/skills/forge-6-docs/forge-6-docs.md +6 -6
  78. package/adapters/copilot/skills/forge-bootstrap/forge-bootstrap.md +4 -4
  79. package/adapters/copilot/skills/forge-fix/forge-fix.md +27 -6
  80. package/adapters/copilot/skills/forge-guide/forge-guide.md +188 -0
  81. package/adapters/copilot/skills/forge-init/forge-init.md +28 -1
  82. package/adapters/copilot/skills/forge-verify/forge-verify.md +45 -14
  83. package/adapters/copilot/skills/forge-verify/references/verification-checklists.md +1 -1
  84. package/adapters/cursor/references/forge-config-schema.json +25 -3
  85. package/adapters/cursor/references/pipeline-state-schema.json +3 -2
  86. package/adapters/cursor/references/portable-root.md +2 -2
  87. package/adapters/cursor/references/process-overview.md +10 -0
  88. package/adapters/cursor/references/shared-conventions.md +14 -9
  89. package/adapters/cursor/references/stage-exit-protocol.md +99 -0
  90. package/adapters/cursor/scripts/epic-manifest.py +10 -0
  91. package/adapters/cursor/scripts/forge-bootstrap.py +94 -16
  92. package/adapters/cursor/scripts/forge-init.sh +7 -1
  93. package/adapters/cursor/scripts/forge-session.py +175 -30
  94. package/adapters/cursor/skills/forge/forge.mdc +33 -19
  95. package/adapters/cursor/skills/forge-0-epic/forge-0-epic.mdc +21 -16
  96. package/adapters/cursor/skills/forge-0-epic/references/edit-mode.md +6 -4
  97. package/adapters/cursor/skills/forge-0-epic/references/epic-manifest-subcommands.md +1 -1
  98. package/adapters/cursor/skills/forge-1-prd/forge-1-prd.mdc +14 -4
  99. package/adapters/cursor/skills/forge-2-tech/forge-2-tech.mdc +15 -4
  100. package/adapters/cursor/skills/forge-3-specs/forge-3-specs.mdc +14 -3
  101. package/adapters/cursor/skills/forge-4-backlog/forge-4-backlog.mdc +16 -5
  102. package/adapters/cursor/skills/forge-5-loop/forge-5-loop.mdc +21 -23
  103. package/adapters/cursor/skills/forge-5-loop/references/result-reporting.md +10 -5
  104. package/adapters/cursor/skills/forge-6-docs/forge-6-docs.mdc +6 -6
  105. package/adapters/cursor/skills/forge-bootstrap/forge-bootstrap.mdc +4 -4
  106. package/adapters/cursor/skills/forge-fix/forge-fix.mdc +27 -6
  107. package/adapters/cursor/skills/forge-guide/forge-guide.mdc +189 -0
  108. package/adapters/cursor/skills/forge-init/forge-init.mdc +28 -1
  109. package/adapters/cursor/skills/forge-verify/forge-verify.mdc +45 -14
  110. package/adapters/cursor/skills/forge-verify/references/verification-checklists.md +1 -1
  111. package/adapters/gemini/gemini-extension.json +4 -0
  112. package/adapters/gemini/references/forge-config-schema.json +25 -3
  113. package/adapters/gemini/references/pipeline-state-schema.json +3 -2
  114. package/adapters/gemini/references/portable-root.md +2 -2
  115. package/adapters/gemini/references/process-overview.md +10 -0
  116. package/adapters/gemini/references/shared-conventions.md +14 -9
  117. package/adapters/gemini/references/stage-exit-protocol.md +99 -0
  118. package/adapters/gemini/scripts/epic-manifest.py +10 -0
  119. package/adapters/gemini/scripts/forge-bootstrap.py +94 -16
  120. package/adapters/gemini/scripts/forge-init.sh +7 -1
  121. package/adapters/gemini/scripts/forge-session.py +175 -30
  122. package/adapters/gemini/skills/forge/forge.md +33 -19
  123. package/adapters/gemini/skills/forge-0-epic/forge-0-epic.md +21 -16
  124. package/adapters/gemini/skills/forge-0-epic/references/edit-mode.md +6 -4
  125. package/adapters/gemini/skills/forge-0-epic/references/epic-manifest-subcommands.md +1 -1
  126. package/adapters/gemini/skills/forge-1-prd/forge-1-prd.md +14 -4
  127. package/adapters/gemini/skills/forge-2-tech/forge-2-tech.md +15 -4
  128. package/adapters/gemini/skills/forge-3-specs/forge-3-specs.md +14 -3
  129. package/adapters/gemini/skills/forge-4-backlog/forge-4-backlog.md +16 -5
  130. package/adapters/gemini/skills/forge-5-loop/forge-5-loop.md +21 -23
  131. package/adapters/gemini/skills/forge-5-loop/references/result-reporting.md +10 -5
  132. package/adapters/gemini/skills/forge-6-docs/forge-6-docs.md +6 -6
  133. package/adapters/gemini/skills/forge-bootstrap/forge-bootstrap.md +4 -4
  134. package/adapters/gemini/skills/forge-fix/forge-fix.md +27 -6
  135. package/adapters/gemini/skills/forge-guide/forge-guide.md +188 -0
  136. package/adapters/gemini/skills/forge-init/forge-init.md +28 -1
  137. package/adapters/gemini/skills/forge-verify/forge-verify.md +45 -14
  138. package/adapters/gemini/skills/forge-verify/references/verification-checklists.md +1 -1
  139. package/dist/apply.js +34 -8
  140. package/dist/cli.js +40 -4
  141. package/dist/fsutil.d.ts +0 -12
  142. package/dist/fsutil.js +10 -1
  143. package/dist/manifest.d.ts +1 -1
  144. package/dist/plan.js +22 -2
  145. package/dist/rauf.d.ts +4 -4
  146. package/dist/rauf.js +3 -3
  147. package/dist/report.js +1 -1
  148. package/dist/types.d.ts +1 -1
  149. package/package.json +1 -1
@@ -88,7 +88,7 @@ Interview the user about technology decisions. Unlike the PRD interview, here yo
88
88
  - Recommend approaches consistent with the established stack, and say *why* the convention favors it (evidence-backed mode). Where the choice is genuine taste (e.g. folder layout, naming), give a default but flag it as preference.
89
89
  - Challenge over-engineering: does the feature need this, or is a simpler approach sufficient? Frame the simpler option's trade-off (less flexibility now vs. less to maintain).
90
90
  - Ask about every integration point and how the feature interacts with existing modules.
91
- - For competing module structures or code-shape choices, use the the host's question mechanism `preview` field to show the candidates side-by-side.
91
+ - For competing module structures or code-shape choices, use the host's question mechanism `preview` field to show the candidates side-by-side.
92
92
 
93
93
  **Parking lot:** If the user raises a concern that belongs to a different pipeline stage (e.g., backlog granularity, documentation format), acknowledge it and note it in the pipeline state's `notes` field: "Good point — I've noted that for the [specs/backlog/docs stage]. Let's continue with the tech spec."
94
94
 
@@ -187,9 +187,20 @@ Write pipeline state conforming to `references/pipeline-state-schema.json`.
187
187
  - Record `artifacts`, `completedAt`, `version`
188
188
  - Set `stages.forge-2-tech.basedOnVersions` to `{"forge-1-prd": <current forge-1-prd version>}`
189
189
  - Check downstream stages (forge-3-specs, forge-4-backlog, forge-5-loop, forge-6-docs). If any have `basedOnVersions` referencing an older version of forge-2-tech, set their status to `stale`
190
- 2. Use the host's question mechanism to ask about notes to persist
191
- 3. If `gitCommitAfterStage` is true, follow the Git Commit Protocol in `references/shared-conventions.md`: stage files, attempt commit with message `"{commitPrefix}({feature}): complete tech-spec v{n}"`, then set `stages.forge-2-tech.status` to `complete` with commit hash only on success. If commit fails, leave status as `in-progress`.
192
- 5. Tell the user: "Tech spec complete. Next steps:\n - `/feature-forge:forge-verify {feature}` to verify the tech spec\n - `/feature-forge:forge-3-specs {feature}` to create implementation specs\n - `/feature-forge:forge {feature}` to see full pipeline status"
190
+ 2. **Offer a note — don't force one.** As a statement (not a blocking question), let the user know they can jot anything worth preserving across sessions and you'll store it in the `notes` field. If they volunteer something, store it; otherwise proceed.
191
+ 3. If `gitCommitAfterStage` is true, follow the Git Commit Protocol in `references/shared-conventions.md`: stage files, attempt commit with message `"{commitPrefix}({feature}): complete tech-spec v{n}"` (marking `stages.forge-2-tech.status` `complete` with `commitHash: null` in that commit), then record the artifact-commit hash via the protocol's two-commit follow-up (never `--amend`) only on success. If commit fails, leave status as `in-progress`.
192
+ 4. **Close with the Stage Exit Protocol** (single-sourced in `references/stage-exit-protocol.md`; do not improvise a "Next steps" list):
193
+
194
+ **This stage is done — walk the user through the Stage Exit Protocol** before moving on. The order is fixed, and step 2 is something only the user can do:
195
+
196
+ 1. **Verify the tech spec first — if it isn't already verified.** When this stage has no fresh verification on record (`verifyState` is **missing or stale**) **and** `autoVerify` is off for it, verify **now, before clearing**. If verify already ran, is pending under auto-verify, or the stage was explicitly skipped, say so and go straight to step 2. Present the **Standard Verify Gate** using the host's question mechanism with exactly these three options — but only when the host has a question mechanism **and** the clean-room path is available (the host's subagent mechanism plus a dispatchable `forge-verifier` subagent):
197
+ - **Verify the tech spec now** *(recommended)* — dispatch the clean-room `forge-verifier` subagent from this session in require-clean mode; the digest returns here so any fix decision keeps its context. One-time — it does **not** change config.
198
+ - **Verify now + enable auto-verify going forward** — verify now **and** patch `"autoVerify": true` into `forge.config.json` in place (preserve formatting and every other key) so future stages verify automatically, no prompt. This complements the `forge-init` opt-in. **Do not auto-commit this config change** — treat it like `notes`: a user-facing edit the user commits on their own cadence, never folded into a stage's artifact commit.
199
+ - **Skip for now** — go straight to clear your session / start a fresh session and the next command without verifying. Record this stage's verify status as `"skipped"` in pipeline state (mirroring the existing skip handling) **only** on an explicit skip — a skip does not go stale.
200
+
201
+ **Host / clean-room fallback (not a user-selectable option):** if the question mechanism, the host's subagent mechanism, or the `forge-verifier` subagent is unavailable, do **not** run clean-room — degrade to printing `/feature-forge:forge-verify {feature}` for the user to run inline/manually (mirroring `autoInvokeNextStage`), and offer the auto-verify enable as plain text only if a config write is possible.
202
+ 2. **Then clear your session / start a fresh session.** Recommended **unconditionally** at this boundary for a clean start — independent of how full the context window is. Every artifact is on disk, so the work survives the clear. **I can't clear your session / start a fresh session for you — you have to run it yourself.**
203
+ 3. **Then run `/feature-forge:forge-3-specs {feature}`** in the fresh session — or re-run `/feature-forge:forge` to let the navigator resume from disk.
193
204
 
194
205
  ## Gotchas
195
206
 
@@ -141,9 +141,20 @@ Write pipeline state conforming to `references/pipeline-state-schema.json`.
141
141
  - Record all created files in `artifacts`, including `TRACEABILITY.md`
142
142
  - Set `stages.forge-3-specs.basedOnVersions` to `{"forge-1-prd": <current version>, "forge-2-tech": <current version>}`
143
143
  - Check downstream stages (forge-4-backlog, forge-5-loop, forge-6-docs). If any have `basedOnVersions` referencing older versions, set their status to `stale`
144
- 2. Use the host's question mechanism to ask about notes to persist
145
- 3. If `gitCommitAfterStage` is true, follow the Git Commit Protocol in `references/shared-conventions.md`: stage files, attempt commit with message `"{commitPrefix}({feature}): complete implementation specs v{n}"`, then set `stages.forge-3-specs.status` to `complete` with commit hash only on success. If commit fails, leave status as `in-progress`.
146
- 5. Tell the user: "Implementation specs complete. Next steps:\n - `/feature-forge:forge-verify {feature}` to verify the specs (strongly recommended)\n - `/feature-forge:forge-4-backlog {feature}` to generate the backlog\n - `/feature-forge:forge {feature}` to see full pipeline status"
144
+ 2. **Offer a note — don't force one.** As a statement (not a blocking question), let the user know they can jot anything worth preserving across sessions and you'll store it in the `notes` field. If they volunteer something, store it; otherwise proceed.
145
+ 3. If `gitCommitAfterStage` is true, follow the Git Commit Protocol in `references/shared-conventions.md`: stage files, attempt commit with message `"{commitPrefix}({feature}): complete implementation specs v{n}"` (marking `stages.forge-3-specs.status` `complete` with `commitHash: null` in that commit), then record the artifact-commit hash via the protocol's two-commit follow-up (never `--amend`) only on success. If commit fails, leave status as `in-progress`.
146
+ 4. **Close with the Stage Exit Protocol** (single-sourced in `references/stage-exit-protocol.md`; do not improvise a "Next steps" list). Specs feed every downstream stage, so the verify gate matters here:
147
+
148
+ **This stage is done — walk the user through the Stage Exit Protocol** before moving on. The order is fixed, and step 2 is something only the user can do:
149
+
150
+ 1. **Verify the implementation specs first — if it isn't already verified.** When this stage has no fresh verification on record (`verifyState` is **missing or stale**) **and** `autoVerify` is off for it, verify **now, before clearing**. If verify already ran, is pending under auto-verify, or the stage was explicitly skipped, say so and go straight to step 2. Present the **Standard Verify Gate** using the host's question mechanism with exactly these three options — but only when the host has a question mechanism **and** the clean-room path is available (the host's subagent mechanism plus a dispatchable `forge-verifier` subagent):
151
+ - **Verify the implementation specs now** *(recommended)* — dispatch the clean-room `forge-verifier` subagent from this session in require-clean mode; the digest returns here so any fix decision keeps its context. One-time — it does **not** change config.
152
+ - **Verify now + enable auto-verify going forward** — verify now **and** patch `"autoVerify": true` into `forge.config.json` in place (preserve formatting and every other key) so future stages verify automatically, no prompt. This complements the `forge-init` opt-in. **Do not auto-commit this config change** — treat it like `notes`: a user-facing edit the user commits on their own cadence, never folded into a stage's artifact commit.
153
+ - **Skip for now** — go straight to clear your session / start a fresh session and the next command without verifying. Record this stage's verify status as `"skipped"` in pipeline state (mirroring the existing skip handling) **only** on an explicit skip — a skip does not go stale.
154
+
155
+ **Host / clean-room fallback (not a user-selectable option):** if the question mechanism, the host's subagent mechanism, or the `forge-verifier` subagent is unavailable, do **not** run clean-room — degrade to printing `/feature-forge:forge-verify {feature}` for the user to run inline/manually (mirroring `autoInvokeNextStage`), and offer the auto-verify enable as plain text only if a config write is possible.
156
+ 2. **Then clear your session / start a fresh session.** Recommended **unconditionally** at this boundary for a clean start — independent of how full the context window is. Every artifact is on disk, so the work survives the clear. **I can't clear your session / start a fresh session for you — you have to run it yourself.**
157
+ 3. **Then run `/feature-forge:forge-4-backlog {feature}`** in the fresh session — or re-run `/feature-forge:forge` to let the navigator resume from disk.
147
158
 
148
159
  ## Gotchas
149
160
 
@@ -39,7 +39,7 @@ Resolve the **loop runner** from the `loopRunner` block in `forge.config.json`,
39
39
 
40
40
  **Prerequisite check:** Read `{resolvedFeatureDir}/.pipeline-state.json`. If not in force mode, stages `forge-1-prd`, `forge-2-tech`, and `forge-3-specs` must all be `complete`. If not, STOP and tell the user which prerequisites are missing.
41
41
 
42
- **Strongly recommended:** Check if specs have been verified. If not, use the host's question mechanism to warn with the cost of skipping: "Specs haven't been verified yet. Recommended: run `/feature-forge:forge-verify {feature}` first — unverified specs can carry gaps or contradictions that get baked into backlog items and only surface mid-loop, where they're far more expensive to fix. Continue anyway?" Offer **Verify first (recommended)** · **Continue without verifying**.
42
+ **Verification check.** Check whether the specs have been verified. If not, use the host's question mechanism to warn with the cost of skipping: "Specs haven't been verified yet. Recommended: run `/feature-forge:forge-verify {feature}` first — unverified specs can carry gaps or contradictions that get baked into backlog items and only surface mid-loop, where they're far more expensive to fix. Continue anyway?" Offer **Verify first (recommended)** · **Continue without verifying**.
43
43
 
44
44
  ## Step 2: Load All Specs
45
45
 
@@ -123,7 +123,7 @@ Interpret the result:
123
123
 
124
124
  Present a summary: total items N, dependency-chain depth, estimated loop iterations (`ceil(pendingItems * loopIterationMultiplier)`). Note whether validation passed or was skipped (runner not yet available).
125
125
 
126
- Use the host's question mechanism to ask: "Ready to proceed, or any adjustments needed?"
126
+ State that the backlog is ready and invite adjustments before committing — a statement, not a forced gate: "Backlog is ready. Tell me if you want any items split, merged, or reordered; otherwise I'll record state and commit." Proceed to Step 7 unless the user asks for changes.
127
127
 
128
128
  ## Step 7: Update Pipeline State and Commit
129
129
 
@@ -134,10 +134,21 @@ Write pipeline state conforming to `references/pipeline-state-schema.json`. Foll
134
134
  - Set `stages.forge-4-backlog.basedOnVersions` to `{"forge-1-prd": <current version>, "forge-2-tech": <current version>, "forge-3-specs": <current version>}`
135
135
  - Set `currentStage` to `forge-5-loop`
136
136
  - Check downstream stages (`forge-5-loop`, `forge-6-docs`). If any have `basedOnVersions` referencing an older version of `forge-4-backlog`, set their status to `stale`.
137
- 2. Use the host's question mechanism to ask about notes to persist
138
- 3. If `gitCommitAfterStage` is true, follow the Git Commit Protocol: stage files, attempt commit, then set status to `complete` with commit hash only on success. If commit fails, leave status as `in-progress`.
137
+ 2. **Offer a note — don't force one.** As a statement (not a blocking question), let the user know they can jot anything worth preserving across sessions and you'll store it in the `notes` field. If they volunteer something, store it; otherwise proceed.
138
+ 3. If `gitCommitAfterStage` is true, follow the Git Commit Protocol: stage files, attempt commit (marking `stages.forge-4-backlog.status` `complete` with `commitHash: null` in that commit), then record the artifact-commit hash via the protocol's two-commit follow-up (never `--amend`) only on success. If commit fails, leave status as `in-progress`.
139
139
  4. If verification was available but the user chose to skip it, record `stages.forge-verify-backlog.status` as `"skipped"` in pipeline state.
140
- 5. Tell user: "Backlog complete with {N} items. Next steps:\n - `/feature-forge:forge-verify {feature}` to verify the backlog\n - `/feature-forge:forge-5-loop {feature}` to run the loop\n - `/feature-forge:forge {feature}` to see full pipeline status"
140
+ 5. **Close with the Stage Exit Protocol** (single-sourced in `references/stage-exit-protocol.md`; do not improvise a "Next steps" list). Lead with the item count ("Backlog complete with {N} items."), then:
141
+
142
+ **This stage is done — walk the user through the Stage Exit Protocol** before moving on. The order is fixed, and step 2 is something only the user can do:
143
+
144
+ 1. **Verify the backlog first — if it isn't already verified.** When this stage has no fresh verification on record (`verifyState` is **missing or stale**) **and** `autoVerify` is off for it, verify **now, before clearing**. If verify already ran, is pending under auto-verify, or the stage was explicitly skipped, say so and go straight to step 2. Present the **Standard Verify Gate** using the host's question mechanism with exactly these three options — but only when the host has a question mechanism **and** the clean-room path is available (the host's subagent mechanism plus a dispatchable `forge-verifier` subagent):
145
+ - **Verify the backlog now** *(recommended)* — dispatch the clean-room `forge-verifier` subagent from this session in require-clean mode; the digest returns here so any fix decision keeps its context. One-time — it does **not** change config.
146
+ - **Verify now + enable auto-verify going forward** — verify now **and** patch `"autoVerify": true` into `forge.config.json` in place (preserve formatting and every other key) so future stages verify automatically, no prompt. This complements the `forge-init` opt-in. **Do not auto-commit this config change** — treat it like `notes`: a user-facing edit the user commits on their own cadence, never folded into a stage's artifact commit.
147
+ - **Skip for now** — go straight to clear your session / start a fresh session and the next command without verifying. Record this stage's verify status as `"skipped"` in pipeline state (mirroring the existing skip handling) **only** on an explicit skip — a skip does not go stale.
148
+
149
+ **Host / clean-room fallback (not a user-selectable option):** if the question mechanism, the host's subagent mechanism, or the `forge-verifier` subagent is unavailable, do **not** run clean-room — degrade to printing `/feature-forge:forge-verify {feature}` for the user to run inline/manually (mirroring `autoInvokeNextStage`), and offer the auto-verify enable as plain text only if a config write is possible.
150
+ 2. **Then clear your session / start a fresh session.** Recommended **unconditionally** at this boundary for a clean start — independent of how full the context window is. Every artifact is on disk, so the work survives the clear. **I can't clear your session / start a fresh session for you — you have to run it yourself.**
151
+ 3. **Then run `/feature-forge:forge-5-loop {feature}`** in the fresh session — or re-run `/feature-forge:forge` to let the navigator resume from disk.
141
152
 
142
153
  ## Gotchas
143
154
 
@@ -50,7 +50,7 @@ Read `{resolvedFeatureDir}/.pipeline-state.json`. If not in force mode, `stages.
50
50
 
51
51
  ### 1b. Verification Check
52
52
 
53
- Check if `stages.forge-verify-backlog` exists and has status `passed` or `findings-applied`. If not, use the host's question mechanism to warn:
53
+ Check if `stages.forge-verify-backlog` exists and has status `passed` or `findings-applied`. If not, use the host's question mechanism to warn with the cost of skipping:
54
54
 
55
55
  "Backlog hasn't been verified yet. Recommended: run `/feature-forge:forge-verify {feature}` first — the loop implements items autonomously and commits as it goes, so a bad item (wrong scope, missing dependency, untestable acceptance criteria) is far cheaper to catch now than after several commits build on it. Continue anyway?" Offer **Verify first (recommended)** · **Continue without verifying**.
56
56
 
@@ -61,7 +61,7 @@ Read the resolved feature's `.pipeline-state.json`. **If it has no `epic` key, s
61
61
  1. Run `render-status "{epic}" --specs-dir "{specsDir}" --json` via the helper:
62
62
 
63
63
  ```bash
64
- R="$(for d in "$HOME"/.claude/skills/feature-forge "$HOME"/.claude/plugins/*/feature-forge "$HOME"/.agents/skills/feature-forge ./.agents/skills/feature-forge; do [ -x "$d/scripts/forge-root.sh" ] && exec "$d/scripts/forge-root.sh"; done)"
64
+ R="$(bash -c 'for d in "$HOME"/.claude/skills/feature-forge "$HOME"/.claude/plugins/*/feature-forge "$HOME"/.agents/skills/feature-forge ./.agents/skills/feature-forge; do [ -x "$d/scripts/forge-root.sh" ] && exec "$d/scripts/forge-root.sh"; done')"
65
65
  [ -n "$R" ] || { echo "feature-forge: cannot locate plugin root" >&2; exit 1; }
66
66
  python3 "$R/scripts/epic-manifest.py" \
67
67
  render-status "{epic}" --specs-dir "{specsDir}" --json
@@ -211,7 +211,7 @@ verbatim "Loop started…" inform-user output template is in
211
211
 
212
212
  ### 3d. Arm a Monitor on the event stream, and react to events
213
213
 
214
- Arm the **the host's monitoring mechanism** on the structured event stream (the NDJSON file, or the
214
+ Arm the **host's monitoring mechanism** on the structured event stream (the NDJSON file, or the
215
215
  human log as fallback) so events flow back into this session as they happen. Use
216
216
  **`persistent: true`** — runs can exceed the host's monitoring mechanism's maximum `timeout_ms` (1 hour),
217
217
  and a bounded timeout would silently stop watching a still-running loop. The filter
@@ -259,11 +259,7 @@ output templates — **all-done**, **needs-human**, **blocked**, **deferred**, a
259
259
 
260
260
  Update `{resolvedFeatureDir}/.pipeline-state.json`:
261
261
 
262
- 1. Set `stages.forge-5-loop`:
263
- - `status`: `"complete"` if all backlog items are `done`, otherwise `"in-progress"`
264
- - `completedAt`: current ISO timestamp (only if complete)
265
- - `basedOnVersions`: `{"forge-4-backlog": <current version from pipeline state>}`
266
- - `artifacts`: `["{backlogDir}/{loopRunner.stateDir}/state.json"]`
262
+ 1. Set `stages.forge-5-loop`: `status` = `"complete"` if all backlog items are `done`, else `"in-progress"`; `completedAt` = current ISO timestamp (only if complete); `basedOnVersions` = `{"forge-4-backlog": <current version from pipeline state>}`; `artifacts` = `["{backlogDir}/{loopRunner.stateDir}/state.json"]`.
267
263
  2. If all items complete: set `currentStage` to `"forge-6-docs"`
268
264
  3. Update `updatedAt`
269
265
 
@@ -277,30 +273,32 @@ Update `{resolvedFeatureDir}/.pipeline-state.json`:
277
273
 
278
274
  **Gate:** only run this step if (a) the resolved feature's `.pipeline-state.json` has an `epic` key **and** (b) Step 5 set `stages.forge-5-loop.status` to `complete` (all backlog items done). If either is false, **skip** — standalone completed features are handled by Step 5b, and partial runs end as today (REQ-COMPAT-01).
279
275
 
280
- 1. **Offer impl-verify first (recommended, skippable).** Per the completion rule (`00-core-definitions.md §7`), a feature whose `forge-verify-impl.status == findings-reported` does **not** unblock dependents. Use the host's question mechanism (NOT inline prose) to offer:
281
-
282
- > "{feature}'s loop is done. Recommended: run `/feature-forge:forge-verify {feature} impl` before unblocking dependents. Run it now, or skip and continue the handoff?"
283
-
284
- The user may skip (then completion is judged on the §7 rule with impl-verify absent).
276
+ 1. **Offer impl-verify first (recommended, skippable).** Per the completion rule (`00-core-definitions.md §7`), a feature whose `forge-verify-impl.status == findings-reported` does **not** unblock dependents. Use the host's question mechanism (NOT inline prose) to offer: *"{feature}'s loop is done. Recommended: run `/feature-forge:forge-verify {feature} impl` before unblocking dependents. Run it now, or skip and continue the handoff?"* The user may skip (then completion is judged on the §7 rule with impl-verify absent).
285
277
  2. **Recompute and announce.** Run `render-status "{epic}" --specs-dir "{specsDir}" --json`. Announce the feature's completion and the epic rollup (e.g. "2/4 features complete") — derived live from disk, never re-computed in prose.
286
- 3. **Identify the next actionable feature(s).** Read `render-status`'s `actionable` set (features whose every dependency is now complete and that are not themselves complete) and `nextCommand`.
287
- - **None actionable** (everything done, or remaining features still blocked): say so.
288
- - If `rollup.total > 0` **AND** `rollup.complete == rollup.total`, suggest `/feature-forge:forge-6-docs {feature}` and note the epic-level documentation offer (§10). The `rollup.total > 0` guard prevents an **empty epic** (`0 == 0`) from being reported complete.
289
- - Otherwise, list what is still blocked and on which dependencies. End — do not prompt to start a feature that cannot start.
290
- - **One or more actionable:** use the host's question mechanism presenting **each actionable feature** as an option (plus "stop here"). Execution is **serial** — the user picks exactly one (REQ-ORCH-03). Do **not** autonomously chain into the next pipeline.
291
- 4. **Begin the chosen feature.** For the picked feature:
292
- - **PRD absent** (no `PRD.md`, or `stages.forge-1-prd` not complete): offer to author it now — "Start `/feature-forge:forge-1-prd {chosen}`?" (REQ-ORCH-02). On yes, hand off to forge-1-prd (which injects epic context per §5.1).
293
- - **PRD present:** point the user at the chosen feature's `nextCommand` from render-status.
278
+ 3. **Identify the next actionable feature(s).** Read `render-status`'s `actionable` set (every dependency now complete, not itself complete) and `nextCommand`. **None actionable:** say so — if `rollup.total > 0` **AND** `rollup.complete == rollup.total`, suggest `/feature-forge:forge-6-docs {feature}` and note the epic-level documentation offer (§10) (the `rollup.total > 0` guard prevents an **empty epic** `0 == 0` from reading as complete); otherwise list what is still blocked and on which dependencies, then end (do not prompt to start a feature that cannot start). **One or more actionable:** use the host's question mechanism presenting **each actionable feature** as an option (plus "stop here"). Execution is **serial** — the user picks exactly one (REQ-ORCH-03); do **not** autonomously chain into the next pipeline.
279
+ 4. **Begin the chosen feature.** **PRD absent** (no `PRD.md`, or `stages.forge-1-prd` not complete): offer to author it now — "Start `/feature-forge:forge-1-prd {chosen}`?" (REQ-ORCH-02); on yes, hand off to forge-1-prd (which injects epic context per §5.1). **PRD present:** point the user at the chosen feature's `nextCommand` from render-status.
294
280
  5. **Commit (REQ-OBS-01).** When `gitCommitAfterStage` is true, commit the Step 5 completion write (and any manifest `updatedAt` bump) via the shared-conventions **Git Commit Protocol**, staging the epic subtree so the member state change commits atomically: `git add {specsDir}/{epic}/` then `{commitPrefix}({feature}): complete loop`. If `gitCommitAfterStage` is false, skip the commit.
281
+ 6. **Close the handoff with the Stage Exit Protocol.** Finishing feature `{feature}` → starting the picked feature `{chosen}`'s PRD is a **cold** stage boundary (single-sourced in `references/stage-exit-protocol.md`). Feature `{feature}`'s impl-verify was already offered in Step 6.1, so step 1's gate self-suppresses when it ran or was skipped — the block collapses to clear your session / start a fresh session → next-command. Present it only when the chosen feature's PRD is absent (a PRD-present pick just runs its `nextCommand`):
282
+
283
+ **This stage is done — walk the user through the Stage Exit Protocol** before moving on. The order is fixed, and step 2 is something only the user can do:
284
+
285
+ 1. **Verify feature {feature}'s loop first — if it isn't already verified.** When this stage has no fresh verification on record (`verifyState` is **missing or stale**) **and** `autoVerify` is off for it, verify **now, before clearing**. If verify already ran, is pending under auto-verify, or the stage was explicitly skipped, say so and go straight to step 2. Present the **Standard Verify Gate** using the host's question mechanism with exactly these three options — but only when the host has a question mechanism **and** the clean-room path is available (the host's subagent mechanism plus a dispatchable `forge-verifier` subagent):
286
+ - **Verify feature {feature}'s loop now** *(recommended)* — dispatch the clean-room `forge-verifier` subagent from this session in require-clean mode; the digest returns here so any fix decision keeps its context. One-time — it does **not** change config.
287
+ - **Verify now + enable auto-verify going forward** — verify now **and** patch `"autoVerify": true` into `forge.config.json` in place (preserve formatting and every other key) so future stages verify automatically, no prompt. This complements the `forge-init` opt-in. **Do not auto-commit this config change** — treat it like `notes`: a user-facing edit the user commits on their own cadence, never folded into a stage's artifact commit.
288
+ - **Skip for now** — go straight to clear your session / start a fresh session and the next command without verifying. Record this stage's verify status as `"skipped"` in pipeline state (mirroring the existing skip handling) **only** on an explicit skip — a skip does not go stale.
289
+
290
+ **Host / clean-room fallback (not a user-selectable option):** if the question mechanism, the host's subagent mechanism, or the `forge-verifier` subagent is unavailable, do **not** run clean-room — degrade to printing `/feature-forge:forge-verify {feature} impl` for the user to run inline/manually (mirroring `autoInvokeNextStage`), and offer the auto-verify enable as plain text only if a config write is possible.
291
+ 2. **Then clear your session / start a fresh session.** Recommended **unconditionally** at this boundary for a clean start — independent of how full the context window is. Every artifact is on disk, so the work survives the clear. **I can't clear your session / start a fresh session for you — you have to run it yourself.**
292
+ 3. **Then run `/feature-forge:forge-1-prd {chosen}`** in the fresh session — or re-run `/feature-forge:forge` to let the navigator resume from disk.
295
293
 
296
294
  ## Gotchas
297
295
 
298
- - **Plugin-root discovery (1b-epic helper) covers installed paths, not workspace-dev checkouts.** The `forge-root.sh` search in 1b-epic probes `~/.claude/skills/feature-forge`, `~/.claude/plugins/*/feature-forge`, and `./.agents/skills/feature-forge` — the locations of an **installed** plugin. A feature-forge **source checkout** (e.g. `~/workspace/feature-forge`) is not on that list, so the helper exits "cannot locate plugin root." That is expected in a dev environment, not a bug; run the epic-manifest script from the checkout directly (`python3 <checkout>/scripts/epic-manifest.py …`). Note the `~/.claude/plugins/*/feature-forge` glob can also print a zsh "no matches found" line when that dir is empty — harmless.
296
+ - **Plugin-root discovery (1b-epic helper) covers installed paths, not workspace-dev checkouts.** The `forge-root.sh` search in 1b-epic probes `~/.claude/skills/feature-forge`, `~/.claude/plugins/*/feature-forge`, and `./.agents/skills/feature-forge` — the locations of an **installed** plugin. A feature-forge **source checkout** (e.g. `~/workspace/feature-forge`) is not on that list, so the helper exits "cannot locate plugin root." That is expected in a dev environment, not a bug; run the epic-manifest script from the checkout directly (`python3 <checkout>/scripts/epic-manifest.py …`). The bootstrap prelude wraps its candidate loop in `bash -c` so the `~/.claude/plugins/*/feature-forge` glob is zsh-safe: an empty expansion no longer aborts the loop under zsh's `nomatch`.
299
297
  - `{backlogDir}` is a **directory path**, not a file path. Pass `specs/auth`, not `specs/auth/backlog.json`.
300
298
  - rauf resolves `RAUF.md` with fallback: checks `{backlogDir}/.rauf/RAUF.md` first, then the project's `.rauf/RAUF.md`. As long as the runner is installed in the project, the prompt template will be found.
301
299
  - State files (state.json, {loopRunner.logFile}, etc.) are created at `{backlogDir}/{loopRunner.stateDir}/` — this is within the feature's spec directory and is expected. State is isolated per backlog dir, so concurrent features don't collide.
302
300
  - If the session disconnects during a long-running loop, the runner process continues independently. The user can check results later with the status / list commands.
303
- - Never run the run command in the foreground (without the host's background-execution mechanism) — it blocks and will hit the Bash tool timeout for any non-trivial backlog. "Don't block the foreground" is NOT "stay silent": supervise via the host's monitoring mechanism (3d), never `sleep`/poll in the foreground. The the host's monitoring mechanism must use `persistent: true` (not a bounded `timeout_ms`), watch the **structured** surface (`events.ndjson`), and never filter on raw `RAUF_*` tokens — they appear in agent prose and false-match. A `needs_human`/`blocked`/`review` signal does **not** pause the loop — the runner sets the item aside and keeps going; surface it live but don't tell the user the loop is waiting. See `references/runner-contract.md` for the full monitoring rules.
301
+ - Never run the run command in the foreground (without the host's background-execution mechanism) — it blocks and will hit the Bash tool timeout for any non-trivial backlog. "Don't block the foreground" is NOT "stay silent": supervise via the host's monitoring mechanism (3d), never `sleep`/poll in the foreground. The host's monitoring mechanism must use `persistent: true` (not a bounded `timeout_ms`), watch the **structured** surface (`events.ndjson`), and never filter on raw `RAUF_*` tokens — they appear in agent prose and false-match. A `needs_human`/`blocked`/`review` signal does **not** pause the loop — the runner sets the item aside and keeps going; surface it live but don't tell the user the loop is waiting. See `references/runner-contract.md` for the full monitoring rules.
304
302
  - If a previous loop run left a stale lock, the user may need to pass `--force` to clear it. rauf will report this error clearly.
305
303
  - The version gate (1c) uses the `--json` form on purpose; never parse `rauf version`'s human output.
306
304
  - **Implementation artifacts must not cite specs.** The loop should **read** the specs and `backlog.json` freely — they are the source of truth for what to build, and the backlog rightly references specs for provenance. But the artifacts the loop **writes into the target repo** (source code, generated `SKILL.md`/agent files, configs, code comments) must be **self-contained**: they must NOT reference feature-forge spec files (no `See specs/{feature}/NN-*.md`, no "source spec" provenance notes in shipped output). Specs are pre-implementation inputs that may be archived or deleted once the feature ships; the implementation must stand on its own. This applies only to shipped implementation output — never to the backlog or spec documents, which should keep citing specs.
@@ -4,15 +4,20 @@ These are the five verbatim result-report output templates for **Step 4b** of
4
4
  `forge-5-loop/SKILL.md`. Pick **every** branch that applies (a run can be both
5
5
  blocked and needs-human) and render its report.
6
6
 
7
- **All items done:**
7
+ **All items done.** Print the completion summary, then close with the **warm-acceptable
8
+ variant** of the Stage Exit Protocol (single-sourced in
9
+ `references/stage-exit-protocol.md`) — the `forge-5-loop → forge-6-docs` boundary is the
10
+ one place where clearing before the next stage is optional:
8
11
  ```
9
12
  Loop completed for {feature}. All {N} items implemented successfully.
10
-
11
- Next steps:
12
- - /feature-forge:forge-verify {feature} impl Verify the implementation
13
- - /feature-forge:forge-6-docs {feature} Generate architecture docs
14
13
  ```
15
14
 
15
+ **The loop is complete — this is the one boundary where clearing before the next stage is optional.**
16
+
17
+ 1. **Verify is already offered above.** Impl-verify is offered interactively right after this report (Step 5b for a standalone feature, Step 6.1 for an epic member) — run it there rather than as a second gate. It runs clean-room, so it needs no fresh session.
18
+ 2. **Clearing is optional here — warm is fine.** `forge-6-docs` benefits from the still-warm context of what the loop actually did, so continuing in this same session is the easy default. A cold start also works — every artifact is on disk — but there is no need to force it.
19
+ 3. **Then run `/feature-forge:forge-6-docs {feature}`** — in this warm session, or a fresh one if you prefer.
20
+
16
21
  **Runner review pass.** A review flag (e.g. rauf's `--review`) makes the runner run
17
22
  a post-loop review that **auto-creates and implements fix items** rather than handing
18
23
  findings to the user — distinct from `forge-verify impl` (a clean-context audit that
@@ -44,18 +44,18 @@ Check `.pipeline-state.json` for `stages.forge-verify-impl`. If it is **absent**
44
44
  If the resolved feature has an `epic` back-pointer in its `.pipeline-state.json`, run:
45
45
 
46
46
  ```bash
47
- R="$(for d in "$HOME"/.claude/skills/feature-forge "$HOME"/.claude/plugins/*/feature-forge "$HOME"/.agents/skills/feature-forge ./.agents/skills/feature-forge; do [ -x "$d/scripts/forge-root.sh" ] && exec "$d/scripts/forge-root.sh"; done)"
47
+ R="$(bash -c 'for d in "$HOME"/.claude/skills/feature-forge "$HOME"/.claude/plugins/*/feature-forge "$HOME"/.agents/skills/feature-forge ./.agents/skills/feature-forge; do [ -x "$d/scripts/forge-root.sh" ] && exec "$d/scripts/forge-root.sh"; done')"
48
48
  [ -n "$R" ] || { echo "feature-forge: cannot locate plugin root" >&2; exit 1; }
49
49
  python3 "$R/scripts/epic-manifest.py" render-status "{epic}" --specs-dir "{specsDir}" --json
50
50
  ```
51
51
 
52
52
  If `render-status` fails, skip the epic-level offer and proceed with the per-feature docs only; surface the error per the exit-1/exit-2 split in the **Feature Directory Resolution** block of `references/shared-conventions.md` (exit 1 → parse `{findings[]}` from stdout; exit 2 → surface the plain `Error:` stderr line verbatim).
53
53
 
54
- **Only if `rollup.total > 0 AND rollup.complete == rollup.total`** (every member is complete-for-orchestration; the `total > 0` guard excludes an empty epic), use the host's question mechanism to offer:
54
+ **Only if `rollup.total > 0 AND rollup.complete == rollup.total`** (every member is complete-for-orchestration; the `total > 0` guard excludes an empty epic), offer the extra doc as a statement the user can take or leave — not a forced question:
55
55
 
56
- "All {total} features in the '{epic}' epic are complete. Generate an **epic-level architecture document** spanning the features, in addition to {feature}'s per-feature docs?"
56
+ "All {total} features in the '{epic}' epic are complete. I can also generate an **epic-level architecture document** spanning the features, alongside {feature}'s per-feature docs — say the word and I'll add it."
57
57
 
58
- On yes, synthesize a doc at **`{docsDir}/{epic}/`** sourced from: the `EPIC.md` narrative, each member's per-feature docs, and the manifest contracts (each feature's `exposes`/`consumes`). When the epic-level doc is written, the Step 5 commit also stages `{docsDir}/{epic}/`.
58
+ If the user asks for it, synthesize a doc at **`{docsDir}/{epic}/`** sourced from: the `EPIC.md` narrative, each member's per-feature docs, and the manifest contracts (each feature's `exposes`/`consumes`). When the epic-level doc is written, the Step 5 commit also stages `{docsDir}/{epic}/`.
59
59
 
60
60
  If not all members are complete (or the feature has no `epic` back-pointer), **do not offer** — the per-feature doc flow proceeds unchanged.
61
61
 
@@ -97,7 +97,7 @@ Based on feature complexity and existing doc conventions, propose a doc plan:
97
97
  └── adr-001-*.md — Architecture decision records (if significant decisions were made)
98
98
  ```
99
99
 
100
- Present the plan and use the host's question mechanism to get the user's confirmation.
100
+ Present the plan as a statement and invite edits before writing — not a forced confirmation gate: "Here's the doc plan I'll generate. Tell me if you want to add, remove, or restructure any documents; otherwise I'll proceed." Write the docs unless the user asks for changes.
101
101
 
102
102
  ## Step 3: Write Documentation
103
103
 
@@ -176,7 +176,7 @@ Write pipeline state conforming to `references/pipeline-state-schema.json`.
176
176
  - Set `currentStage` to `complete`
177
177
  - Record `artifacts`
178
178
  - Set `stages.forge-6-docs.basedOnVersions` to include versions for all completed upstream stages. Always include forge-1-prd, forge-2-tech, forge-3-specs. Include forge-4-backlog and forge-5-loop ONLY if they have status `complete`.
179
- 2. If `gitCommitAfterStage` is true, follow the Git Commit Protocol in `references/shared-conventions.md`: stage files (`git add {docsDir}/{feature}/ {resolvedFeatureDir}/` — and **also** `{docsDir}/{epic}/` when an epic-level doc was written in Step 1), attempt commit with message `"{commitPrefix}({feature}): complete architecture docs"`, then set `stages.forge-6-docs.status` to `complete` with commit hash only on success. If commit fails, leave status as `in-progress`.
179
+ 2. If `gitCommitAfterStage` is true, follow the Git Commit Protocol in `references/shared-conventions.md`: stage files (`git add {docsDir}/{feature}/ {resolvedFeatureDir}/` — and **also** `{docsDir}/{epic}/` when an epic-level doc was written in Step 1), attempt commit with message `"{commitPrefix}({feature}): complete architecture docs"` (marking `stages.forge-6-docs.status` `complete` with `commitHash: null` in that commit), then record the artifact-commit hash via the protocol's two-commit follow-up (never `--amend`) only on success. If commit fails, leave status as `in-progress`.
180
180
  4. Tell user: "Documentation complete. Feature pipeline for '{feature}' is finished!\n `/feature-forge:forge {feature}` to see the final pipeline status."
181
181
 
182
182
  ## Gotchas
@@ -59,7 +59,7 @@ Every bash invocation begins with the byte-identical portable-root prelude, then
59
59
  helper. Pass `--specs-dir ./specs` (the default) so the gate allow-lists the specs directory.
60
60
 
61
61
  ```bash
62
- R="$(for d in "$HOME"/.claude/skills/feature-forge "$HOME"/.claude/plugins/*/feature-forge "$HOME"/.agents/skills/feature-forge ./.agents/skills/feature-forge; do [ -x "$d/scripts/forge-root.sh" ] && exec "$d/scripts/forge-root.sh"; done)"
62
+ R="$(bash -c 'for d in "$HOME"/.claude/skills/feature-forge "$HOME"/.claude/plugins/*/feature-forge "$HOME"/.agents/skills/feature-forge ./.agents/skills/feature-forge; do [ -x "$d/scripts/forge-root.sh" ] && exec "$d/scripts/forge-root.sh"; done')"
63
63
  [ -n "$R" ] || { echo "feature-forge: cannot locate plugin root" >&2; exit 1; }
64
64
  python3 "$R/scripts/forge-bootstrap.py" check "<target-dir>" --json --specs-dir ./specs
65
65
  ```
@@ -136,7 +136,7 @@ when running under a Claude host (e.g. the host's question mechanism is availabl
136
136
  `CLAUDE.md` only when `host == "claude"`.
137
137
 
138
138
  ```bash
139
- R="$(for d in "$HOME"/.claude/skills/feature-forge "$HOME"/.claude/plugins/*/feature-forge "$HOME"/.agents/skills/feature-forge ./.agents/skills/feature-forge; do [ -x "$d/scripts/forge-root.sh" ] && exec "$d/scripts/forge-root.sh"; done)"
139
+ R="$(bash -c 'for d in "$HOME"/.claude/skills/feature-forge "$HOME"/.claude/plugins/*/feature-forge "$HOME"/.agents/skills/feature-forge ./.agents/skills/feature-forge; do [ -x "$d/scripts/forge-root.sh" ] && exec "$d/scripts/forge-root.sh"; done')"
140
140
  [ -n "$R" ] || { echo "feature-forge: cannot locate plugin root" >&2; exit 1; }
141
141
  python3 "$R/scripts/forge-bootstrap.py" scaffold "<target-dir>" --json --answers '<Answers JSON>'
142
142
  ```
@@ -144,7 +144,7 @@ python3 "$R/scripts/forge-bootstrap.py" scaffold "<target-dir>" --json --answers
144
144
  ### Step 5 — verify
145
145
 
146
146
  ```bash
147
- R="$(for d in "$HOME"/.claude/skills/feature-forge "$HOME"/.claude/plugins/*/feature-forge "$HOME"/.agents/skills/feature-forge ./.agents/skills/feature-forge; do [ -x "$d/scripts/forge-root.sh" ] && exec "$d/scripts/forge-root.sh"; done)"
147
+ R="$(bash -c 'for d in "$HOME"/.claude/skills/feature-forge "$HOME"/.claude/plugins/*/feature-forge "$HOME"/.agents/skills/feature-forge ./.agents/skills/feature-forge; do [ -x "$d/scripts/forge-root.sh" ] && exec "$d/scripts/forge-root.sh"; done')"
148
148
  [ -n "$R" ] || { echo "feature-forge: cannot locate plugin root" >&2; exit 1; }
149
149
  python3 "$R/scripts/forge-bootstrap.py" verify "<target-dir>" --json --answers '<Answers JSON>'
150
150
  ```
@@ -170,7 +170,7 @@ and removes the sentinel before staging so it never enters history. Read
170
170
  leave the sentinel in-progress (resumable) — do **not** declare success.
171
171
 
172
172
  ```bash
173
- R="$(for d in "$HOME"/.claude/skills/feature-forge "$HOME"/.claude/plugins/*/feature-forge "$HOME"/.agents/skills/feature-forge ./.agents/skills/feature-forge; do [ -x "$d/scripts/forge-root.sh" ] && exec "$d/scripts/forge-root.sh"; done)"
173
+ R="$(bash -c 'for d in "$HOME"/.claude/skills/feature-forge "$HOME"/.claude/plugins/*/feature-forge "$HOME"/.agents/skills/feature-forge ./.agents/skills/feature-forge; do [ -x "$d/scripts/forge-root.sh" ] && exec "$d/scripts/forge-root.sh"; done')"
174
174
  [ -n "$R" ] || { echo "feature-forge: cannot locate plugin root" >&2; exit 1; }
175
175
  python3 "$R/scripts/forge-bootstrap.py" commit "<target-dir>" --json --answers '<Answers JSON>' [--stage-only]
176
176
  ```
@@ -9,6 +9,15 @@ alwaysApply: false
9
9
 
10
10
  Apply fixes from the most recent forge-verify findings document, with step-level tracking for crash recovery.
11
11
 
12
+ Usually invoked by the user, but the `/feature-forge:forge` navigator may also invoke this skill
13
+ automatically when `autoFix: true` is configured **and** its preconditions hold (the findings
14
+ document has zero unresolved decision points, the working tree is clean, and a mandatory re-verify
15
+ passes afterward). The **fix application** below is identical either way — this skill is not
16
+ "auto-aware" about *applying* findings; it always applies the latest findings document. The
17
+ navigator owns the gating decisions, including the closing re-verify: the Step 6 gate is
18
+ presented **only on a direct invocation**, because under an `autoFix` chain the navigator runs the
19
+ mandatory re-verify itself.
20
+
12
21
  ## Prerequisites
13
22
 
14
23
  Read and follow `references/shared-conventions.md` for feature name validation, configuration reading, and force mode handling before proceeding.
@@ -55,14 +64,26 @@ Follow the Git Commit Protocol in `references/shared-conventions.md`.
55
64
  1. Update `{resolvedFeatureDir}/.pipeline-state.json`:
56
65
  - Set the relevant `forge-verify-*` entry status to `findings-applied`
57
66
  - Record `fixedAt` timestamp
58
- 2. If `gitCommitAfterStage` is true, follow the Git Commit Protocol: stage files (`git add {resolvedFeatureDir}/` — or `{specsDir}/{epic}/` for an epic member so the member-state change commits atomically with the epic subtree), attempt commit with message `"{commitPrefix}({feature}): apply {mode} verification fixes"`, then record commit hash only on success.
67
+ - Record `verifiedStageVersion` = the current `version` of the production stage entry
68
+ this verify covers (e.g. fixing `tech` findings → `stages["forge-2-tech"].version`).
69
+ This keeps the navigator's freshness ledger accurate after a fix, so the verified
70
+ stage reads as `fresh` and auto-verify does not needlessly re-fire on an unchanged
71
+ artifact. (If the fix itself bumped the production stage's `version`, use the new
72
+ value so the ledger reflects what was actually verified/fixed.)
73
+ 2. If `gitCommitAfterStage` is true, follow the Git Commit Protocol: stage files (`git add {resolvedFeatureDir}/` — or `{specsDir}/{epic}/` for an epic member so the member-state change commits atomically with the epic subtree), attempt commit with message `"{commitPrefix}({feature}): apply {mode} verification fixes"` (writing `commitHash: null` in that commit), then record the artifact-commit hash via the protocol's two-commit follow-up (never `--amend`) only on success.
74
+
75
+ ## Step 6: Re-verify Gate
76
+
77
+ Fixes are applied and recorded (`findings-applied`), so the stage reads **fresh** in the navigator's ledger (Step 5 set `verifiedStageVersion` to the current version). A re-verify is nonetheless the only thing that *confirms* the fixes actually resolved the findings, so on a **direct/manual** `forge-fix` invocation, **prompt** it rather than leaving it as a passive suggestion — this is the same **Standard Verify Gate** the stage skills stamp (`references/stage-exit-protocol.md`).
78
+
79
+ **Skip this gate when the navigator invoked you as part of an `autoFix` chain** (`skills/forge/SKILL.md` §3b step 2b): there the navigator owns the mandatory re-verify, so a second gate here would block the unattended flow or double the re-verify. Just return and let the navigator proceed.
59
80
 
60
- ## Step 6: Next Steps
81
+ On a direct invocation, present the gate using the host's question mechanism with these three options — but only when the host has a question mechanism **and** the clean-room path is available (the host's subagent mechanism plus a dispatchable `forge-verifier` subagent):
82
+ - **Re-verify {feature} now** *(recommended)* — dispatch the clean-room `forge-verifier` subagent from this session in require-clean mode to confirm every finding is resolved; the digest returns here so any remaining issue keeps its context. One-time — it does **not** change config.
83
+ - **Re-verify now + enable auto-verify going forward** — re-verify now **and** patch `"autoVerify": true` into `forge.config.json` in place (preserve formatting and every other key) so future stages verify automatically, no prompt. This complements the `forge-init` opt-in. **Do not auto-commit this config change** — treat it like `notes`: a user-facing edit the user commits on their own cadence, never folded into a stage's artifact commit.
84
+ - **Skip for now** — proceed without re-verifying; the fixes are already recorded, so the stage stays `findings-applied` (fresh in the ledger). Run `/feature-forge:forge {feature}` when you want pipeline status.
61
85
 
62
- Tell the user:
63
- "Fixes applied. Next steps:
64
- - Run `/feature-forge:forge-verify {feature}` again to confirm all issues are resolved
65
- - Or `/feature-forge:forge {feature}` to see pipeline status"
86
+ **Host / clean-room fallback (not a user-selectable option):** if the question mechanism, the host's subagent mechanism, or the `forge-verifier` subagent is unavailable, do **not** run clean-room — degrade to printing `/feature-forge:forge-verify {feature}` for the user to run inline/manually (mirroring `autoInvokeNextStage`), and offer the auto-verify enable as plain text only if a config write is possible.
66
87
 
67
88
  ---
68
89
 
@@ -0,0 +1,189 @@
1
+ ---
2
+ # GENERATED — DO NOT EDIT. Source: skills/forge-guide/SKILL.md. Regenerate: python3 scripts/build-adapters.py
3
+ description: Explain what feature-forge is, when to use it, how to configure it, and its best practices — advisory guidance, not stage execution. Use when the user or another agent asks what feature-forge is, whether/when to adopt it, how the pipeline works conceptually, how to set up or configure forge.config.json, or for usage tips and best practices. Do NOT trigger to RUN a pipeline stage (use forge-1-prd … forge-6-docs), to show a specific feature's status (use forge), or for general software questions unrelated to feature-forge.
4
+ globs: []
5
+ alwaysApply: false
6
+ ---
7
+
8
+ # Feature Forge — Usage & Best-Practices Guide
9
+
10
+ You are the **guide** for feature-forge: an advisor, not an operator. Your job is to
11
+ explain *what* forge is, *when* to use it, *how* to configure it, and *what the best
12
+ practices are* — in plain language, grounded in the repo's own docs. You do **not**
13
+ run pipeline stages; when the user is ready to act, point them at the right skill.
14
+
15
+ ## How to answer
16
+
17
+ 1. Identify the topic (the argument, or infer from the question).
18
+ 2. **Ground yourself in the canonical source before answering** — read the mapped
19
+ reference file(s) below rather than answering from memory. These are the source
20
+ of truth and stay current as the pipeline evolves.
21
+ 3. Answer concisely, then end with the concrete next command (`/feature-forge:forge-*`)
22
+ or doc pointer the user should go to.
23
+
24
+ | Topic | Read first |
25
+ |-------|-----------|
26
+ | Pipeline architecture, stage-by-stage flow | `references/process-overview.md` |
27
+ | Cross-stage conventions (naming, state, git, branch, epic injection) | `references/shared-conventions.md` |
28
+ | Config keys + defaults | `references/forge-config-schema.json` |
29
+ | Stack detection / language profiles | `references/stack-resolution.md`, `references/stacks/*.md` |
30
+ | Loop runner interface, signals & version gate | `references/ralph-loop-contract.md` |
31
+ | Deep dives, glossary, troubleshooting | `references/process-overview.md`, `references/shared-conventions.md` |
32
+
33
+ Those `references/` files are the guaranteed grounding path — they ship in every install.
34
+ The project's `README.md`, `COMPATIBILITY.md`, and the hosted docs site are richer but are
35
+ **not** part of an installed bundle, so treat them as optional enrichment (offer the docs-site
36
+ URL to a human) and never block an answer on opening them — fall back to the `references/`
37
+ files and your own knowledge.
38
+
39
+ Do NOT actually invoke stage skills or write files — this skill only explains and directs.
40
+
41
+ ## What feature-forge is
42
+
43
+ A **feature development pipeline** that refines a vague idea into shipped code through
44
+ discrete, auditable stages — like a compiler for features. Each stage narrows scope and
45
+ adds structure, reading the previous stage's artifacts as standalone contracts:
46
+
47
+ - **PRD** — *what* to build (requirements only, no technology).
48
+ - **Tech spec** — *how* to build it (design, grounded in the codebase).
49
+ - **Implementation specs** — build-ready detail (types, signatures, contracts, tests).
50
+ - **Backlog** — self-contained work items for autonomous execution.
51
+ - **Loop** — a fresh-context runner implements each item, tests, and commits.
52
+ - **Docs** — architecture reference generated from the real implementation.
53
+
54
+ `REQ-XXX-NN` requirement IDs form a traceability spine from PRD through implementation.
55
+ **Verification gates** are available after any stage and run clean-room in a fresh subagent.
56
+
57
+ ## When to use it — and when not
58
+
59
+ **Use forge when:** you have a well-defined feature or small epic to ship; you want
60
+ requirements captured cleanly before coding; you value traceability, thorough spec
61
+ verification, and autonomous loop execution with fresh context per item; you want
62
+ reproducible, auditable artifacts.
63
+
64
+ **Skip forge when:** the work is an exploratory spike with still-fluid requirements
65
+ (though Stage 1's interview can help clarify them); it's a one-line bug fix or trivial
66
+ patch where pipeline overhead isn't justified; or you're only extending mature code
67
+ along established patterns, where new specs become noise.
68
+
69
+ **Anti-patterns to warn against:** skipping the PRD and jumping to tech spec (the value
70
+ comes from separating *what* from *how*); treating specs as living contracts (they're
71
+ pre-implementation — drop an `AGENTS.md`/`CLAUDE.md` in the specs dir telling agents to
72
+ ignore drift); forcing an epic for a single feature; relying on conversation memory to
73
+ carry context across stages instead of reading upstream artifacts.
74
+
75
+ ## The pipeline at a glance
76
+
77
+ | Stage | Skill | Produces |
78
+ |-------|-------|----------|
79
+ | 0 (optional) | `forge-0-epic` | `epic-manifest.json` + `EPIC.md` (members, deps, `exposes`/`consumes` contracts) |
80
+ | 1 | `forge-1-prd` | `PRD.md` with `REQ-*` IDs |
81
+ | 2 | `forge-2-tech` | `tech-spec.md`; detects stack + test/typecheck commands |
82
+ | 3 | `forge-3-specs` | numbered spec suite + `TRACEABILITY.md` |
83
+ | 4 | `forge-4-backlog` | `backlog.json` (self-contained items) |
84
+ | 5 | `forge-5-loop` | implemented code, tested + committed per item |
85
+ | 6 | `forge-6-docs` | architecture docs from the real code |
86
+ | any | `forge-verify` → `forge-fix` | findings report → applied fixes |
87
+ | any | `forge` | status dashboard / navigator |
88
+
89
+ Drive the whole thing with the **navigator**: `/feature-forge:forge <feature>` shows the
90
+ current stage and offers the next; with `autoInvokeNextStage` it launches it directly.
91
+
92
+ ## Setup & configuration
93
+
94
+ **First-time setup:** `/feature-forge:forge-init` (existing repo) creates `forge.config.json`
95
+ with defaults. `/feature-forge:forge-bootstrap` scaffolds a *greenfield* (empty) repo to a
96
+ green baseline. On non-Claude agents, install via `npx @garygentry/feature-forge install`.
97
+
98
+ **Key `forge.config.json` knobs** (authoritative list: `references/forge-config-schema.json`):
99
+
100
+ - **Paths** — `specsDir` (`./specs`), `docsDir` (`./docs/architecture`), `backlogDir`.
101
+ - **Git** — `gitCommitAfterStage` (true), `commitPrefix` (`forge`); commits use a two-commit
102
+ protocol so the stage's commit hash is recorded in state without `--amend`.
103
+ - **Branch** — `branchPerFeature` (true), `branchPrefix` (`forge/`): isolate each feature.
104
+ - **Stack** — `stack`, `typeCheckCommand`, `testCommand`: null until Stage 2 auto-detects them.
105
+ - **Context** — `contextWindowTokens`, `contextWarnThreshold` (0.7): the navigator warns to
106
+ clear your session / start a fresh session past this fullness. On 1M-context models set `contextWindowTokens` explicitly.
107
+ - **Verification** — `autoVerify` (false), `autoVerifyStages`, `autoFix` (false).
108
+ - **Stage flow** — `autoInvokeNextStage` (true on Claude, print-only elsewhere).
109
+ - **Loop** — `loopRunner` block (binary, command templates, version gate, agent selection);
110
+ defaults to **rauf** when absent. `workspaces` supports monorepos.
111
+
112
+ ## Verification gates
113
+
114
+ `forge-verify <feature>` dispatches the read-only `forge-verifier` subagent to find gaps,
115
+ inconsistencies, and quality issues; it writes a findings doc, and `forge-fix` applies them.
116
+ Because verification runs in a **fresh subagent**, it's clean-room by construction — it never
117
+ needs a clear your session / start a fresh session, and it's safe to automate with `autoVerify: true` (fixing stays human-gated
118
+ unless `autoFix: true`). **Always verify before Stage 5 (the loop)** — catching errors in
119
+ specs/backlog is far cheaper than mid-loop. Verifying after PRD and after backlog is also
120
+ recommended. A findings pass is fresh only while the artifact `version` matches what was
121
+ verified; revise upstream and downstream re-verifies.
122
+
123
+ ## Context management
124
+
125
+ Each stage reads upstream artifacts as standalone contracts, so you can (and usually should)
126
+ clear your session / start a fresh session between them:
127
+
128
+ - **Clear** between PRD → tech, tech → specs, specs → backlog, backlog → loop.
129
+ - **Stay warm** mid-interview (PRD, tech spec) — the interview needs a continuous thread.
130
+ - **No clear needed** for any → verify (runs in a fresh subagent).
131
+
132
+ The navigator warns when the session passes `contextWarnThreshold` (default 70% full).
133
+
134
+ ## Epics (large changes)
135
+
136
+ Use Stage 0 only when a change naturally splits into **several interdependent features** that
137
+ must agree on interfaces. `forge-0-epic` produces `epic-manifest.json` + `EPIC.md` with a
138
+ per-member charter, `exposes`/`consumes` contracts, and `dependsOn` edges. Each member then
139
+ runs the normal pipeline with epic context injected. At Stage 5 a **dependency gate** warns if
140
+ a member's dependencies are unmet. Epic support is purely additive — single-feature flows are
141
+ unchanged. Re-run `forge-0-epic` on an existing epic to enter edit mode.
142
+
143
+ ## The loop
144
+
145
+ Stage 5 runs a configurable runner (**rauf** by default) that gives each backlog item a fresh
146
+ agent session — implement → run the verification command → commit on pass. This is why items
147
+ must be truly **self-contained**; context bleed breaks the model. Per-item signals:
148
+
149
+ - `RAUF_DONE` — item passed; loop continues.
150
+ - `RAUF_BLOCKED` — missing dependency / unclear requirement; set aside, loop continues others.
151
+ - `RAUF_NEEDS_HUMAN` — decision or secret needed; set aside, loop continues.
152
+
153
+ The loop doesn't pause on blocked items. Supply what's missing, then `rauf resume <path>` to
154
+ retry set-aside items. The runner refuses to start with a **dirty working tree** and enforces
155
+ a minimum runner version (the version gate is described in `references/ralph-loop-contract.md`).
156
+
157
+ ## Best practices & gotchas
158
+
159
+ - Feature name is **required** for every stage command — never guess or infer it.
160
+ - Verify **before the loop**; a bad spec is cheap to fix now, expensive mid-loop.
161
+ - Keep backlog items self-contained — the loop has zero memory across items.
162
+ - Let stages commit for you; don't hand-edit `.pipeline-state.json` or backlog status.
163
+ - Re-running an upstream stage marks downstream stages **stale** — re-run them rather than
164
+ reaching for `--force`, which skips prerequisite checks and should be rare.
165
+ - Specs are pre-implementation artifacts, not living docs — don't cite them from generated code.
166
+ - Use the navigator (`/feature-forge:forge <feature>`) to orient; use `forge-verify` to inspect.
167
+
168
+ ## Troubleshooting starters
169
+
170
+ - **Stage 5 won't start:** backlog exists and is verified? runner installed and ≥ min version?
171
+ working tree clean? See `references/ralph-loop-contract.md` for the runner contract and version gate.
172
+ - **Loop stopped mid-run:** check the signal — `BLOCKED`/`NEEDS_HUMAN` items are set aside, not
173
+ failures; the loop keeps going.
174
+ - **Downstream flagged stale:** an upstream stage was revised; re-run the downstream stage.
175
+ - **Where am I?** `/feature-forge:forge <feature>` renders the full pipeline status.
176
+
177
+ For anything deeper, ground yourself in `references/process-overview.md` and
178
+ `references/shared-conventions.md`, and point the *user* at the hosted docs site —
179
+ <https://garygentry.github.io/feature-forge/> — for the full guides and glossary.
180
+
181
+ ---
182
+
183
+ ## Host execution notes
184
+
185
+ This skill was authored Claude-first; the body above refers to "the host's question mechanism", "the host's subagent mechanism", and "the host's background-execution mechanism". Use your runtime's equivalent for each — and if your runtime has no such tool:
186
+
187
+ - **User input:** ask the question directly and wait for the answer before proceeding. Do not skip a required question or assume an answer.
188
+ - **Subagents:** if your host cannot dispatch the named custom agent, run that step inline yourself.
189
+ - **Background / monitoring:** run long-lived commands in the foreground (or your host's background facility) and report progress as it arrives.