@garygentry/feature-forge 0.3.2 → 0.3.5

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 (389) hide show
  1. package/README.md +1 -1
  2. package/adapters/claude/.feature-forge-bundle.json +1 -1
  3. package/adapters/claude/agents/forge-verifier.md +3 -1
  4. package/adapters/claude/references/decisions/single-writer-threat-model.md +53 -0
  5. package/adapters/claude/references/epic-state-schema.json +50 -0
  6. package/adapters/claude/references/forge-config-schema.json +20 -2
  7. package/adapters/claude/references/forge-decisions-schema.json +33 -0
  8. package/adapters/claude/references/pipeline-state-schema.json +34 -2
  9. package/adapters/claude/references/ralph-loop-contract.md +6 -3
  10. package/adapters/claude/references/shared-conventions.md +15 -4
  11. package/adapters/claude/references/stage-exit-protocol.md +55 -11
  12. package/adapters/claude/scripts/epic-manifest.py +82 -4
  13. package/adapters/claude/scripts/fix-sweep.py +1180 -0
  14. package/adapters/claude/scripts/forge-session.py +1151 -32
  15. package/adapters/claude/skills/forge/SKILL.md +5 -5
  16. package/adapters/claude/skills/forge/references/pipeline-state-schema.json +34 -2
  17. package/adapters/claude/skills/forge/references/shared-conventions.md +15 -4
  18. package/adapters/claude/skills/forge/references/stage-exit-protocol.md +55 -11
  19. package/adapters/claude/skills/forge-0-epic/references/edit-mode.md +5 -1
  20. package/adapters/claude/skills/forge-0-epic/references/epic-manifest-subcommands.md +5 -0
  21. package/adapters/claude/skills/forge-0-epic/references/pipeline-state-schema.json +34 -2
  22. package/adapters/claude/skills/forge-0-epic/references/shared-conventions.md +15 -4
  23. package/adapters/claude/skills/forge-0-epic/references/stage-exit-protocol.md +55 -11
  24. package/adapters/claude/skills/forge-1-prd/SKILL.md +3 -1
  25. package/adapters/claude/skills/forge-1-prd/references/shared-conventions.md +15 -4
  26. package/adapters/claude/skills/forge-1-prd/references/stage-exit-protocol.md +55 -11
  27. package/adapters/claude/skills/forge-2-tech/SKILL.md +5 -1
  28. package/adapters/claude/skills/forge-2-tech/references/shared-conventions.md +15 -4
  29. package/adapters/claude/skills/forge-2-tech/references/stage-exit-protocol.md +55 -11
  30. package/adapters/claude/skills/forge-3-specs/SKILL.md +5 -1
  31. package/adapters/claude/skills/forge-3-specs/references/shared-conventions.md +15 -4
  32. package/adapters/claude/skills/forge-3-specs/references/stage-exit-protocol.md +55 -11
  33. package/adapters/claude/skills/forge-4-backlog/SKILL.md +41 -3
  34. package/adapters/claude/skills/forge-4-backlog/references/shared-conventions.md +15 -4
  35. package/adapters/claude/skills/forge-4-backlog/references/stage-exit-protocol.md +55 -11
  36. package/adapters/claude/skills/forge-5-loop/SKILL.md +36 -36
  37. package/adapters/claude/skills/forge-5-loop/references/agent-selection.md +16 -0
  38. package/adapters/claude/skills/forge-5-loop/references/ralph-loop-contract.md +6 -3
  39. package/adapters/claude/skills/forge-5-loop/references/recovery-procedure.md +349 -0
  40. package/adapters/claude/skills/forge-5-loop/references/result-reporting.md +40 -11
  41. package/adapters/claude/skills/forge-5-loop/references/runner-contract.md +22 -4
  42. package/adapters/claude/skills/forge-5-loop/references/shared-conventions.md +15 -4
  43. package/adapters/claude/skills/forge-5-loop/references/stage-exit-protocol.md +55 -11
  44. package/adapters/claude/skills/forge-6-docs/SKILL.md +29 -6
  45. package/adapters/claude/skills/forge-6-docs/references/shared-conventions.md +15 -4
  46. package/adapters/claude/skills/forge-6-docs/references/stage-exit-protocol.md +55 -11
  47. package/adapters/claude/skills/forge-fix/SKILL.md +34 -0
  48. package/adapters/claude/skills/forge-fix/references/shared-conventions.md +15 -4
  49. package/adapters/claude/skills/forge-fix/references/stage-exit-protocol.md +55 -11
  50. package/adapters/claude/skills/forge-guide/references/forge-config-schema.json +20 -2
  51. package/adapters/claude/skills/forge-guide/references/ralph-loop-contract.md +6 -3
  52. package/adapters/claude/skills/forge-guide/references/shared-conventions.md +15 -4
  53. package/adapters/claude/skills/forge-verify/SKILL.md +10 -11
  54. package/adapters/claude/skills/forge-verify/references/decisions/single-writer-threat-model.md +53 -0
  55. package/adapters/claude/skills/forge-verify/references/findings-template.md +30 -0
  56. package/adapters/claude/skills/forge-verify/references/shared-conventions.md +15 -4
  57. package/adapters/claude/skills/forge-verify/references/stage-exit-protocol.md +55 -11
  58. package/adapters/claude/skills/forge-verify/references/verification-checklists/backlog.md +73 -0
  59. package/adapters/claude/skills/forge-verify/references/verification-checklists/impl.md +85 -0
  60. package/adapters/claude/skills/forge-verify/references/verification-checklists/specs.md +43 -1
  61. package/adapters/codex/.feature-forge-bundle.json +1 -1
  62. package/adapters/codex/agents/forge-verifier.toml +3 -1
  63. package/adapters/codex/references/decisions/single-writer-threat-model.md +53 -0
  64. package/adapters/codex/references/epic-state-schema.json +50 -0
  65. package/adapters/codex/references/forge-config-schema.json +20 -2
  66. package/adapters/codex/references/forge-decisions-schema.json +33 -0
  67. package/adapters/codex/references/pipeline-state-schema.json +34 -2
  68. package/adapters/codex/references/process-overview.md +2 -2
  69. package/adapters/codex/references/ralph-loop-contract.md +6 -3
  70. package/adapters/codex/references/shared-conventions.md +44 -33
  71. package/adapters/codex/references/stage-exit-protocol.md +64 -20
  72. package/adapters/codex/scripts/epic-manifest.py +82 -4
  73. package/adapters/codex/scripts/fix-sweep.py +1180 -0
  74. package/adapters/codex/scripts/forge-session.py +1151 -32
  75. package/adapters/codex/skills/forge/SKILL.md +8 -8
  76. package/adapters/codex/skills/forge/references/pipeline-state-schema.json +34 -2
  77. package/adapters/codex/skills/forge/references/process-overview.md +2 -2
  78. package/adapters/codex/skills/forge/references/shared-conventions.md +44 -33
  79. package/adapters/codex/skills/forge/references/stage-exit-protocol.md +64 -20
  80. package/adapters/codex/skills/forge-0-epic/references/edit-mode.md +14 -10
  81. package/adapters/codex/skills/forge-0-epic/references/epic-manifest-subcommands.md +8 -3
  82. package/adapters/codex/skills/forge-0-epic/references/pipeline-state-schema.json +34 -2
  83. package/adapters/codex/skills/forge-0-epic/references/shared-conventions.md +44 -33
  84. package/adapters/codex/skills/forge-0-epic/references/stage-exit-protocol.md +64 -20
  85. package/adapters/codex/skills/forge-1-prd/SKILL.md +3 -1
  86. package/adapters/codex/skills/forge-1-prd/references/shared-conventions.md +44 -33
  87. package/adapters/codex/skills/forge-1-prd/references/stage-exit-protocol.md +64 -20
  88. package/adapters/codex/skills/forge-2-tech/SKILL.md +5 -1
  89. package/adapters/codex/skills/forge-2-tech/references/shared-conventions.md +44 -33
  90. package/adapters/codex/skills/forge-2-tech/references/stage-exit-protocol.md +64 -20
  91. package/adapters/codex/skills/forge-3-specs/SKILL.md +5 -1
  92. package/adapters/codex/skills/forge-3-specs/references/shared-conventions.md +44 -33
  93. package/adapters/codex/skills/forge-3-specs/references/stage-exit-protocol.md +64 -20
  94. package/adapters/codex/skills/forge-4-backlog/SKILL.md +41 -3
  95. package/adapters/codex/skills/forge-4-backlog/references/shared-conventions.md +44 -33
  96. package/adapters/codex/skills/forge-4-backlog/references/stage-exit-protocol.md +64 -20
  97. package/adapters/codex/skills/forge-5-loop/SKILL.md +36 -36
  98. package/adapters/codex/skills/forge-5-loop/references/agent-selection.md +17 -1
  99. package/adapters/codex/skills/forge-5-loop/references/ralph-loop-contract.md +6 -3
  100. package/adapters/codex/skills/forge-5-loop/references/recovery-procedure.md +349 -0
  101. package/adapters/codex/skills/forge-5-loop/references/result-reporting.md +40 -11
  102. package/adapters/codex/skills/forge-5-loop/references/runner-contract.md +26 -8
  103. package/adapters/codex/skills/forge-5-loop/references/shared-conventions.md +44 -33
  104. package/adapters/codex/skills/forge-5-loop/references/stage-exit-protocol.md +64 -20
  105. package/adapters/codex/skills/forge-6-docs/SKILL.md +29 -6
  106. package/adapters/codex/skills/forge-6-docs/references/shared-conventions.md +44 -33
  107. package/adapters/codex/skills/forge-6-docs/references/stage-exit-protocol.md +64 -20
  108. package/adapters/codex/skills/forge-fix/SKILL.md +34 -0
  109. package/adapters/codex/skills/forge-fix/references/shared-conventions.md +44 -33
  110. package/adapters/codex/skills/forge-fix/references/stage-exit-protocol.md +64 -20
  111. package/adapters/codex/skills/forge-guide/SKILL.md +1 -1
  112. package/adapters/codex/skills/forge-guide/references/forge-config-schema.json +20 -2
  113. package/adapters/codex/skills/forge-guide/references/process-overview.md +2 -2
  114. package/adapters/codex/skills/forge-guide/references/ralph-loop-contract.md +6 -3
  115. package/adapters/codex/skills/forge-guide/references/shared-conventions.md +44 -33
  116. package/adapters/codex/skills/forge-init/SKILL.md +1 -1
  117. package/adapters/codex/skills/forge-verify/SKILL.md +11 -12
  118. package/adapters/codex/skills/forge-verify/references/decisions/single-writer-threat-model.md +53 -0
  119. package/adapters/codex/skills/forge-verify/references/findings-template.md +32 -2
  120. package/adapters/codex/skills/forge-verify/references/shared-conventions.md +44 -33
  121. package/adapters/codex/skills/forge-verify/references/stage-exit-protocol.md +64 -20
  122. package/adapters/codex/skills/forge-verify/references/verification-checklists/backlog.md +73 -0
  123. package/adapters/codex/skills/forge-verify/references/verification-checklists/epic.md +1 -1
  124. package/adapters/codex/skills/forge-verify/references/verification-checklists/impl.md +85 -0
  125. package/adapters/codex/skills/forge-verify/references/verification-checklists/specs.md +43 -1
  126. package/adapters/copilot/.feature-forge-bundle.json +1 -1
  127. package/adapters/copilot/agents/forge-verifier.md +3 -1
  128. package/adapters/copilot/references/decisions/single-writer-threat-model.md +53 -0
  129. package/adapters/copilot/references/epic-state-schema.json +50 -0
  130. package/adapters/copilot/references/forge-config-schema.json +20 -2
  131. package/adapters/copilot/references/forge-decisions-schema.json +33 -0
  132. package/adapters/copilot/references/pipeline-state-schema.json +34 -2
  133. package/adapters/copilot/references/process-overview.md +2 -2
  134. package/adapters/copilot/references/ralph-loop-contract.md +6 -3
  135. package/adapters/copilot/references/shared-conventions.md +44 -33
  136. package/adapters/copilot/references/stage-exit-protocol.md +64 -20
  137. package/adapters/copilot/scripts/epic-manifest.py +82 -4
  138. package/adapters/copilot/scripts/fix-sweep.py +1180 -0
  139. package/adapters/copilot/scripts/forge-session.py +1151 -32
  140. package/adapters/copilot/skills/forge/forge.md +8 -8
  141. package/adapters/copilot/skills/forge/references/pipeline-state-schema.json +34 -2
  142. package/adapters/copilot/skills/forge/references/process-overview.md +2 -2
  143. package/adapters/copilot/skills/forge/references/shared-conventions.md +44 -33
  144. package/adapters/copilot/skills/forge/references/stage-exit-protocol.md +64 -20
  145. package/adapters/copilot/skills/forge-0-epic/references/edit-mode.md +14 -10
  146. package/adapters/copilot/skills/forge-0-epic/references/epic-manifest-subcommands.md +8 -3
  147. package/adapters/copilot/skills/forge-0-epic/references/pipeline-state-schema.json +34 -2
  148. package/adapters/copilot/skills/forge-0-epic/references/shared-conventions.md +44 -33
  149. package/adapters/copilot/skills/forge-0-epic/references/stage-exit-protocol.md +64 -20
  150. package/adapters/copilot/skills/forge-1-prd/forge-1-prd.md +3 -1
  151. package/adapters/copilot/skills/forge-1-prd/references/shared-conventions.md +44 -33
  152. package/adapters/copilot/skills/forge-1-prd/references/stage-exit-protocol.md +64 -20
  153. package/adapters/copilot/skills/forge-2-tech/forge-2-tech.md +5 -1
  154. package/adapters/copilot/skills/forge-2-tech/references/shared-conventions.md +44 -33
  155. package/adapters/copilot/skills/forge-2-tech/references/stage-exit-protocol.md +64 -20
  156. package/adapters/copilot/skills/forge-3-specs/forge-3-specs.md +5 -1
  157. package/adapters/copilot/skills/forge-3-specs/references/shared-conventions.md +44 -33
  158. package/adapters/copilot/skills/forge-3-specs/references/stage-exit-protocol.md +64 -20
  159. package/adapters/copilot/skills/forge-4-backlog/forge-4-backlog.md +41 -3
  160. package/adapters/copilot/skills/forge-4-backlog/references/shared-conventions.md +44 -33
  161. package/adapters/copilot/skills/forge-4-backlog/references/stage-exit-protocol.md +64 -20
  162. package/adapters/copilot/skills/forge-5-loop/forge-5-loop.md +36 -36
  163. package/adapters/copilot/skills/forge-5-loop/references/agent-selection.md +17 -1
  164. package/adapters/copilot/skills/forge-5-loop/references/ralph-loop-contract.md +6 -3
  165. package/adapters/copilot/skills/forge-5-loop/references/recovery-procedure.md +349 -0
  166. package/adapters/copilot/skills/forge-5-loop/references/result-reporting.md +40 -11
  167. package/adapters/copilot/skills/forge-5-loop/references/runner-contract.md +26 -8
  168. package/adapters/copilot/skills/forge-5-loop/references/shared-conventions.md +44 -33
  169. package/adapters/copilot/skills/forge-5-loop/references/stage-exit-protocol.md +64 -20
  170. package/adapters/copilot/skills/forge-6-docs/forge-6-docs.md +29 -6
  171. package/adapters/copilot/skills/forge-6-docs/references/shared-conventions.md +44 -33
  172. package/adapters/copilot/skills/forge-6-docs/references/stage-exit-protocol.md +64 -20
  173. package/adapters/copilot/skills/forge-fix/forge-fix.md +34 -0
  174. package/adapters/copilot/skills/forge-fix/references/shared-conventions.md +44 -33
  175. package/adapters/copilot/skills/forge-fix/references/stage-exit-protocol.md +64 -20
  176. package/adapters/copilot/skills/forge-guide/forge-guide.md +1 -1
  177. package/adapters/copilot/skills/forge-guide/references/forge-config-schema.json +20 -2
  178. package/adapters/copilot/skills/forge-guide/references/process-overview.md +2 -2
  179. package/adapters/copilot/skills/forge-guide/references/ralph-loop-contract.md +6 -3
  180. package/adapters/copilot/skills/forge-guide/references/shared-conventions.md +44 -33
  181. package/adapters/copilot/skills/forge-init/forge-init.md +1 -1
  182. package/adapters/copilot/skills/forge-verify/forge-verify.md +11 -12
  183. package/adapters/copilot/skills/forge-verify/references/decisions/single-writer-threat-model.md +53 -0
  184. package/adapters/copilot/skills/forge-verify/references/findings-template.md +32 -2
  185. package/adapters/copilot/skills/forge-verify/references/shared-conventions.md +44 -33
  186. package/adapters/copilot/skills/forge-verify/references/stage-exit-protocol.md +64 -20
  187. package/adapters/copilot/skills/forge-verify/references/verification-checklists/backlog.md +73 -0
  188. package/adapters/copilot/skills/forge-verify/references/verification-checklists/epic.md +1 -1
  189. package/adapters/copilot/skills/forge-verify/references/verification-checklists/impl.md +85 -0
  190. package/adapters/copilot/skills/forge-verify/references/verification-checklists/specs.md +43 -1
  191. package/adapters/cursor/.feature-forge-bundle.json +1 -1
  192. package/adapters/cursor/agents/forge-verifier.mdc +3 -1
  193. package/adapters/cursor/references/decisions/single-writer-threat-model.md +53 -0
  194. package/adapters/cursor/references/epic-state-schema.json +50 -0
  195. package/adapters/cursor/references/forge-config-schema.json +20 -2
  196. package/adapters/cursor/references/forge-decisions-schema.json +33 -0
  197. package/adapters/cursor/references/pipeline-state-schema.json +34 -2
  198. package/adapters/cursor/references/process-overview.md +2 -2
  199. package/adapters/cursor/references/ralph-loop-contract.md +6 -3
  200. package/adapters/cursor/references/shared-conventions.md +44 -33
  201. package/adapters/cursor/references/stage-exit-protocol.md +64 -20
  202. package/adapters/cursor/scripts/epic-manifest.py +82 -4
  203. package/adapters/cursor/scripts/fix-sweep.py +1180 -0
  204. package/adapters/cursor/scripts/forge-session.py +1151 -32
  205. package/adapters/cursor/skills/forge/forge.mdc +8 -8
  206. package/adapters/cursor/skills/forge/references/pipeline-state-schema.json +34 -2
  207. package/adapters/cursor/skills/forge/references/process-overview.md +2 -2
  208. package/adapters/cursor/skills/forge/references/shared-conventions.md +44 -33
  209. package/adapters/cursor/skills/forge/references/stage-exit-protocol.md +64 -20
  210. package/adapters/cursor/skills/forge-0-epic/references/edit-mode.md +14 -10
  211. package/adapters/cursor/skills/forge-0-epic/references/epic-manifest-subcommands.md +8 -3
  212. package/adapters/cursor/skills/forge-0-epic/references/pipeline-state-schema.json +34 -2
  213. package/adapters/cursor/skills/forge-0-epic/references/shared-conventions.md +44 -33
  214. package/adapters/cursor/skills/forge-0-epic/references/stage-exit-protocol.md +64 -20
  215. package/adapters/cursor/skills/forge-1-prd/forge-1-prd.mdc +3 -1
  216. package/adapters/cursor/skills/forge-1-prd/references/shared-conventions.md +44 -33
  217. package/adapters/cursor/skills/forge-1-prd/references/stage-exit-protocol.md +64 -20
  218. package/adapters/cursor/skills/forge-2-tech/forge-2-tech.mdc +5 -1
  219. package/adapters/cursor/skills/forge-2-tech/references/shared-conventions.md +44 -33
  220. package/adapters/cursor/skills/forge-2-tech/references/stage-exit-protocol.md +64 -20
  221. package/adapters/cursor/skills/forge-3-specs/forge-3-specs.mdc +5 -1
  222. package/adapters/cursor/skills/forge-3-specs/references/shared-conventions.md +44 -33
  223. package/adapters/cursor/skills/forge-3-specs/references/stage-exit-protocol.md +64 -20
  224. package/adapters/cursor/skills/forge-4-backlog/forge-4-backlog.mdc +41 -3
  225. package/adapters/cursor/skills/forge-4-backlog/references/shared-conventions.md +44 -33
  226. package/adapters/cursor/skills/forge-4-backlog/references/stage-exit-protocol.md +64 -20
  227. package/adapters/cursor/skills/forge-5-loop/forge-5-loop.mdc +36 -36
  228. package/adapters/cursor/skills/forge-5-loop/references/agent-selection.md +17 -1
  229. package/adapters/cursor/skills/forge-5-loop/references/ralph-loop-contract.md +6 -3
  230. package/adapters/cursor/skills/forge-5-loop/references/recovery-procedure.md +349 -0
  231. package/adapters/cursor/skills/forge-5-loop/references/result-reporting.md +40 -11
  232. package/adapters/cursor/skills/forge-5-loop/references/runner-contract.md +26 -8
  233. package/adapters/cursor/skills/forge-5-loop/references/shared-conventions.md +44 -33
  234. package/adapters/cursor/skills/forge-5-loop/references/stage-exit-protocol.md +64 -20
  235. package/adapters/cursor/skills/forge-6-docs/forge-6-docs.mdc +29 -6
  236. package/adapters/cursor/skills/forge-6-docs/references/shared-conventions.md +44 -33
  237. package/adapters/cursor/skills/forge-6-docs/references/stage-exit-protocol.md +64 -20
  238. package/adapters/cursor/skills/forge-fix/forge-fix.mdc +34 -0
  239. package/adapters/cursor/skills/forge-fix/references/shared-conventions.md +44 -33
  240. package/adapters/cursor/skills/forge-fix/references/stage-exit-protocol.md +64 -20
  241. package/adapters/cursor/skills/forge-guide/forge-guide.mdc +1 -1
  242. package/adapters/cursor/skills/forge-guide/references/forge-config-schema.json +20 -2
  243. package/adapters/cursor/skills/forge-guide/references/process-overview.md +2 -2
  244. package/adapters/cursor/skills/forge-guide/references/ralph-loop-contract.md +6 -3
  245. package/adapters/cursor/skills/forge-guide/references/shared-conventions.md +44 -33
  246. package/adapters/cursor/skills/forge-init/forge-init.mdc +1 -1
  247. package/adapters/cursor/skills/forge-verify/forge-verify.mdc +11 -12
  248. package/adapters/cursor/skills/forge-verify/references/decisions/single-writer-threat-model.md +53 -0
  249. package/adapters/cursor/skills/forge-verify/references/findings-template.md +32 -2
  250. package/adapters/cursor/skills/forge-verify/references/shared-conventions.md +44 -33
  251. package/adapters/cursor/skills/forge-verify/references/stage-exit-protocol.md +64 -20
  252. package/adapters/cursor/skills/forge-verify/references/verification-checklists/backlog.md +73 -0
  253. package/adapters/cursor/skills/forge-verify/references/verification-checklists/epic.md +1 -1
  254. package/adapters/cursor/skills/forge-verify/references/verification-checklists/impl.md +85 -0
  255. package/adapters/cursor/skills/forge-verify/references/verification-checklists/specs.md +43 -1
  256. package/adapters/gemini/.feature-forge-bundle.json +1 -1
  257. package/adapters/gemini/agents/forge-verifier.md +3 -1
  258. package/adapters/gemini/gemini-extension.json +1 -1
  259. package/adapters/gemini/references/decisions/single-writer-threat-model.md +53 -0
  260. package/adapters/gemini/references/epic-state-schema.json +50 -0
  261. package/adapters/gemini/references/forge-config-schema.json +20 -2
  262. package/adapters/gemini/references/forge-decisions-schema.json +33 -0
  263. package/adapters/gemini/references/pipeline-state-schema.json +34 -2
  264. package/adapters/gemini/references/process-overview.md +2 -2
  265. package/adapters/gemini/references/ralph-loop-contract.md +6 -3
  266. package/adapters/gemini/references/shared-conventions.md +44 -33
  267. package/adapters/gemini/references/stage-exit-protocol.md +64 -20
  268. package/adapters/gemini/scripts/epic-manifest.py +82 -4
  269. package/adapters/gemini/scripts/fix-sweep.py +1180 -0
  270. package/adapters/gemini/scripts/forge-session.py +1151 -32
  271. package/adapters/gemini/skills/forge/forge.md +8 -8
  272. package/adapters/gemini/skills/forge/references/pipeline-state-schema.json +34 -2
  273. package/adapters/gemini/skills/forge/references/process-overview.md +2 -2
  274. package/adapters/gemini/skills/forge/references/shared-conventions.md +44 -33
  275. package/adapters/gemini/skills/forge/references/stage-exit-protocol.md +64 -20
  276. package/adapters/gemini/skills/forge-0-epic/references/edit-mode.md +14 -10
  277. package/adapters/gemini/skills/forge-0-epic/references/epic-manifest-subcommands.md +8 -3
  278. package/adapters/gemini/skills/forge-0-epic/references/pipeline-state-schema.json +34 -2
  279. package/adapters/gemini/skills/forge-0-epic/references/shared-conventions.md +44 -33
  280. package/adapters/gemini/skills/forge-0-epic/references/stage-exit-protocol.md +64 -20
  281. package/adapters/gemini/skills/forge-1-prd/forge-1-prd.md +3 -1
  282. package/adapters/gemini/skills/forge-1-prd/references/shared-conventions.md +44 -33
  283. package/adapters/gemini/skills/forge-1-prd/references/stage-exit-protocol.md +64 -20
  284. package/adapters/gemini/skills/forge-2-tech/forge-2-tech.md +5 -1
  285. package/adapters/gemini/skills/forge-2-tech/references/shared-conventions.md +44 -33
  286. package/adapters/gemini/skills/forge-2-tech/references/stage-exit-protocol.md +64 -20
  287. package/adapters/gemini/skills/forge-3-specs/forge-3-specs.md +5 -1
  288. package/adapters/gemini/skills/forge-3-specs/references/shared-conventions.md +44 -33
  289. package/adapters/gemini/skills/forge-3-specs/references/stage-exit-protocol.md +64 -20
  290. package/adapters/gemini/skills/forge-4-backlog/forge-4-backlog.md +41 -3
  291. package/adapters/gemini/skills/forge-4-backlog/references/shared-conventions.md +44 -33
  292. package/adapters/gemini/skills/forge-4-backlog/references/stage-exit-protocol.md +64 -20
  293. package/adapters/gemini/skills/forge-5-loop/forge-5-loop.md +36 -36
  294. package/adapters/gemini/skills/forge-5-loop/references/agent-selection.md +17 -1
  295. package/adapters/gemini/skills/forge-5-loop/references/ralph-loop-contract.md +6 -3
  296. package/adapters/gemini/skills/forge-5-loop/references/recovery-procedure.md +349 -0
  297. package/adapters/gemini/skills/forge-5-loop/references/result-reporting.md +40 -11
  298. package/adapters/gemini/skills/forge-5-loop/references/runner-contract.md +26 -8
  299. package/adapters/gemini/skills/forge-5-loop/references/shared-conventions.md +44 -33
  300. package/adapters/gemini/skills/forge-5-loop/references/stage-exit-protocol.md +64 -20
  301. package/adapters/gemini/skills/forge-6-docs/forge-6-docs.md +29 -6
  302. package/adapters/gemini/skills/forge-6-docs/references/shared-conventions.md +44 -33
  303. package/adapters/gemini/skills/forge-6-docs/references/stage-exit-protocol.md +64 -20
  304. package/adapters/gemini/skills/forge-fix/forge-fix.md +34 -0
  305. package/adapters/gemini/skills/forge-fix/references/shared-conventions.md +44 -33
  306. package/adapters/gemini/skills/forge-fix/references/stage-exit-protocol.md +64 -20
  307. package/adapters/gemini/skills/forge-guide/forge-guide.md +1 -1
  308. package/adapters/gemini/skills/forge-guide/references/forge-config-schema.json +20 -2
  309. package/adapters/gemini/skills/forge-guide/references/process-overview.md +2 -2
  310. package/adapters/gemini/skills/forge-guide/references/ralph-loop-contract.md +6 -3
  311. package/adapters/gemini/skills/forge-guide/references/shared-conventions.md +44 -33
  312. package/adapters/gemini/skills/forge-init/forge-init.md +1 -1
  313. package/adapters/gemini/skills/forge-verify/forge-verify.md +11 -12
  314. package/adapters/gemini/skills/forge-verify/references/decisions/single-writer-threat-model.md +53 -0
  315. package/adapters/gemini/skills/forge-verify/references/findings-template.md +32 -2
  316. package/adapters/gemini/skills/forge-verify/references/shared-conventions.md +44 -33
  317. package/adapters/gemini/skills/forge-verify/references/stage-exit-protocol.md +64 -20
  318. package/adapters/gemini/skills/forge-verify/references/verification-checklists/backlog.md +73 -0
  319. package/adapters/gemini/skills/forge-verify/references/verification-checklists/epic.md +1 -1
  320. package/adapters/gemini/skills/forge-verify/references/verification-checklists/impl.md +85 -0
  321. package/adapters/gemini/skills/forge-verify/references/verification-checklists/specs.md +43 -1
  322. package/adapters/pi/.feature-forge-bundle.json +1 -1
  323. package/adapters/pi/agents/forge-verifier.md +3 -1
  324. package/adapters/pi/references/decisions/single-writer-threat-model.md +53 -0
  325. package/adapters/pi/references/epic-state-schema.json +50 -0
  326. package/adapters/pi/references/forge-config-schema.json +20 -2
  327. package/adapters/pi/references/forge-decisions-schema.json +33 -0
  328. package/adapters/pi/references/pipeline-state-schema.json +34 -2
  329. package/adapters/pi/references/process-overview.md +2 -2
  330. package/adapters/pi/references/ralph-loop-contract.md +6 -3
  331. package/adapters/pi/references/shared-conventions.md +33 -22
  332. package/adapters/pi/references/stage-exit-protocol.md +63 -19
  333. package/adapters/pi/scripts/epic-manifest.py +82 -4
  334. package/adapters/pi/scripts/fix-sweep.py +1180 -0
  335. package/adapters/pi/scripts/forge-session.py +1151 -32
  336. package/adapters/pi/skills/forge/SKILL.md +5 -5
  337. package/adapters/pi/skills/forge/references/pipeline-state-schema.json +34 -2
  338. package/adapters/pi/skills/forge/references/process-overview.md +2 -2
  339. package/adapters/pi/skills/forge/references/shared-conventions.md +33 -22
  340. package/adapters/pi/skills/forge/references/stage-exit-protocol.md +63 -19
  341. package/adapters/pi/skills/forge-0-epic/references/edit-mode.md +8 -4
  342. package/adapters/pi/skills/forge-0-epic/references/epic-manifest-subcommands.md +6 -1
  343. package/adapters/pi/skills/forge-0-epic/references/pipeline-state-schema.json +34 -2
  344. package/adapters/pi/skills/forge-0-epic/references/shared-conventions.md +33 -22
  345. package/adapters/pi/skills/forge-0-epic/references/stage-exit-protocol.md +63 -19
  346. package/adapters/pi/skills/forge-1-prd/SKILL.md +3 -1
  347. package/adapters/pi/skills/forge-1-prd/references/shared-conventions.md +33 -22
  348. package/adapters/pi/skills/forge-1-prd/references/stage-exit-protocol.md +63 -19
  349. package/adapters/pi/skills/forge-2-tech/SKILL.md +5 -1
  350. package/adapters/pi/skills/forge-2-tech/references/shared-conventions.md +33 -22
  351. package/adapters/pi/skills/forge-2-tech/references/stage-exit-protocol.md +63 -19
  352. package/adapters/pi/skills/forge-3-specs/SKILL.md +5 -1
  353. package/adapters/pi/skills/forge-3-specs/references/shared-conventions.md +33 -22
  354. package/adapters/pi/skills/forge-3-specs/references/stage-exit-protocol.md +63 -19
  355. package/adapters/pi/skills/forge-4-backlog/SKILL.md +41 -3
  356. package/adapters/pi/skills/forge-4-backlog/references/shared-conventions.md +33 -22
  357. package/adapters/pi/skills/forge-4-backlog/references/stage-exit-protocol.md +63 -19
  358. package/adapters/pi/skills/forge-5-loop/SKILL.md +36 -36
  359. package/adapters/pi/skills/forge-5-loop/references/agent-selection.md +16 -0
  360. package/adapters/pi/skills/forge-5-loop/references/ralph-loop-contract.md +6 -3
  361. package/adapters/pi/skills/forge-5-loop/references/recovery-procedure.md +349 -0
  362. package/adapters/pi/skills/forge-5-loop/references/result-reporting.md +40 -11
  363. package/adapters/pi/skills/forge-5-loop/references/runner-contract.md +25 -7
  364. package/adapters/pi/skills/forge-5-loop/references/shared-conventions.md +33 -22
  365. package/adapters/pi/skills/forge-5-loop/references/stage-exit-protocol.md +63 -19
  366. package/adapters/pi/skills/forge-6-docs/SKILL.md +29 -6
  367. package/adapters/pi/skills/forge-6-docs/references/shared-conventions.md +33 -22
  368. package/adapters/pi/skills/forge-6-docs/references/stage-exit-protocol.md +63 -19
  369. package/adapters/pi/skills/forge-fix/SKILL.md +34 -0
  370. package/adapters/pi/skills/forge-fix/references/shared-conventions.md +33 -22
  371. package/adapters/pi/skills/forge-fix/references/stage-exit-protocol.md +63 -19
  372. package/adapters/pi/skills/forge-guide/references/forge-config-schema.json +20 -2
  373. package/adapters/pi/skills/forge-guide/references/process-overview.md +2 -2
  374. package/adapters/pi/skills/forge-guide/references/ralph-loop-contract.md +6 -3
  375. package/adapters/pi/skills/forge-guide/references/shared-conventions.md +33 -22
  376. package/adapters/pi/skills/forge-verify/SKILL.md +10 -11
  377. package/adapters/pi/skills/forge-verify/references/decisions/single-writer-threat-model.md +53 -0
  378. package/adapters/pi/skills/forge-verify/references/findings-template.md +31 -1
  379. package/adapters/pi/skills/forge-verify/references/shared-conventions.md +33 -22
  380. package/adapters/pi/skills/forge-verify/references/stage-exit-protocol.md +63 -19
  381. package/adapters/pi/skills/forge-verify/references/verification-checklists/backlog.md +73 -0
  382. package/adapters/pi/skills/forge-verify/references/verification-checklists/epic.md +1 -1
  383. package/adapters/pi/skills/forge-verify/references/verification-checklists/impl.md +85 -0
  384. package/adapters/pi/skills/forge-verify/references/verification-checklists/specs.md +43 -1
  385. package/dist/manifest.d.ts +1 -1
  386. package/dist/rauf.d.ts +3 -3
  387. package/dist/rauf.js +2 -2
  388. package/dist/types.d.ts +1 -1
  389. package/package.json +1 -1
@@ -45,6 +45,8 @@ python3 "$R/scripts/forge-session.py" effective-config --config ./forge.config.j
45
45
 
46
46
  **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.
47
47
 
48
+ **Carried-over note check.** If that state's top-level `notes` is a non-empty string, surface it verbatim before proceeding and treat it as input to this stage — it was persisted for exactly this cross-session handoff (often at the previous stage's exit), and it can carry backlog-shaping constraints (e.g. "no item may create file X"). It never overrides the specs or config; raise any conflict instead of silently following either side.
49
+
48
50
  After the prerequisite check, invoke the **Stage-Entry Guard** block in `references/shared-conventions.md` with `{stage}` = `forge-4-backlog` — it detects an interrupted or complete `backlog.json`, runs the resume/restart or new-version gate, and stamps entry before Step 2 loads the specs. (The backlog is a single artifact, so "resume" means: reuse the existing `backlog.json` if the previous run wrote it, rather than re-authoring from scratch.)
49
51
 
50
52
  Then invoke the **Epic-Member Base Guard** block in `references/shared-conventions.md` (this stage does not run Epic Context Injection, so invoke it explicitly here). It self-gates to a no-op for standalone features; for a nested epic member on a branch that lacks the epic manifest it stops with a home-branch pointer (Issue #125).
@@ -92,6 +94,8 @@ After presenting the plan as text, use `AskUserQuestion` following the **Decisio
92
94
 
93
95
  `author-backlog` owns all item-quality rules (granularity hard limits, self-contained descriptions, acceptance criteria, `agentDelegation`, the correct `type`/`status` enums, `dependsOn`, `specReferences`, the schema source). Do not re-encode them here — follow whatever it produces.
94
96
 
97
+ **Return contract.** This is the **delegate-and-resume** posture of "Caller-side resumption: the declared resume point" in `references/stage-exit-protocol.md`. `author-backlog` is a sub-skill of this stage, not its terminal: when it returns, control returns to **this skill, at Step 5** — forge-4 still owns the stage and its terminal output. Two of the sub-skill's own instructions do not apply on this delegated path (it also serves direct user invocation, and those instructions are its direct-invocation posture): its wait-for-user-approval-before-writing gate is already satisfied by Step 3's approved plan — do not re-ask; and its closing "run `rauf backlog validate` … and confirm the validated result" posture is subsumed by Step 5, which owns validation (see Step 5's ownership note). Do not adopt the sub-skill's report-and-stop terminal — it is the freshest instruction in context after the return, but it belongs to the sub-skill: continue to Step 5 in the same turn; Steps 6 and 7 still run, and the stage closes only at Step 7's exit.
98
+
95
99
  > **If the rauf plugin / `author-backlog` skill is not available:** fall back to
96
100
  > authoring inline using the schema source rule (prefer the project's installed
97
101
  > `{stateDir}/backlog.schema.json`, else the published `$id`
@@ -108,6 +112,8 @@ After presenting the plan as text, use `AskUserQuestion` following the **Decisio
108
112
 
109
113
  ## Step 5: Validate via the loop runner
110
114
 
115
+ **Validation ownership.** This step is authoritative for validation, whether or not `author-backlog` already ran its own `rauf backlog validate`: this stage carries the degradation rules for a missing/old/not-set-up runner (below) that the sub-skill does not, and this step's result is what Step 6 reports. A validate the sub-skill already ran cleanly makes this a cheap idempotent re-run, never a reason to skip it — and the sub-skill's validate never discharges this step.
116
+
111
117
  Validate the generated backlog by running the runner's **validate command**
112
118
  (`loopRunner.validateCommand`), rendered with `{resolvedBacklogDir}` and `{specsDir}`
113
119
  substituted — the rauf default:
@@ -132,11 +138,43 @@ Interpret the result:
132
138
  > (`validate` reports the project marker missing), likewise warn and continue
133
139
  > — validation will run cleanly once `rauf install .` has been done.
134
140
 
141
+ ## Step 5b: Topology Report (advisory)
142
+
143
+ After validation (or a recorded skip), report the backlog's dependency topology. Pipe the runner's **list command** (`loopRunner.listCommand`, rendered with `{resolvedBacklogDir}` — the rauf default shown below) into the topology verb. It is a pure function over the runner's item array and never takes a `backlog.json` path:
144
+
145
+ ```bash
146
+ R="$(bash -c 'for d in "${CLAUDE_PLUGIN_ROOT:-}" "$HOME"/.claude/skills/feature-forge "$HOME"/.claude/plugins/cache/*/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
+ [ -n "$R" ] || { echo "feature-forge: cannot locate plugin root" >&2; exit 1; }
148
+ rauf backlog list . --backlog {resolvedBacklogDir} --json | python3 "$R/scripts/forge-session.py" backlog-topology --items-stdin --json
149
+ ```
150
+
151
+ ALWAYS print the metrics, citing the runner counts from the payload:
152
+
153
+ ```
154
+ Topology: {itemCount} items, {rootCount} roots, max chain depth {maxChainDepth}.
155
+ Per-root fan-out (gated subtree size): {id}→{gatedCount}, … (largest first).
156
+ ```
157
+
158
+ Only when the payload's `warnings` array is non-empty, also render this block, including only the bullet(s) for warnings that actually fired:
159
+
160
+ ```
161
+ ⚠️ Fragile topology (advisory — does not block authoring):
162
+ - single-root-fanout: root {id} gates {gatedCount}/{itemCount} items (≥50%).
163
+ - chain-depth: max chain depth {maxChainDepth} is ≥50% of {itemCount} items.
164
+ A single defect in a high-fan-out root or a long chain can strand most of the backlog
165
+ (the loop-recovery incident: 3 roots gating 81%, 13-deep chain). Consider splitting the
166
+ gating root's subtree or flattening the chain — this is a heads-up, not a gate.
167
+ ```
168
+
169
+ This step is **guidance only — it never fails authoring**. If the topology command itself errors, note the error and continue to Step 6 (advisory).
170
+
135
171
  ## Step 6: Review with User
136
172
 
137
173
  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).
138
174
 
139
- 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.
175
+ This is a **non-blocking review (invitation)** — per the **Stage Review Gate** in `references/shared-conventions.md`: sibling stages block here; this stage deliberately does not, and the invitation obliges you to continue, not stop.
176
+
177
+ 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 in this same turn** unless the user asks for changes — emitting the invitation and stopping strands the stage before Step 7 runs.
140
178
 
141
179
  ## Step 7: Update Pipeline State and Commit
142
180
 
@@ -145,7 +183,7 @@ Before writing state or running the stage exit, invoke the **Stage-Completion Re
145
183
  Pipeline state is written by the `state-*` verbs — see the Pipeline State Protocol in `references/shared-conventions.md`. Follow the Git Commit Protocol in `references/shared-conventions.md`.
146
184
 
147
185
  1. Record completion by running `state-complete` (below) with `--version`, `--artifact backlog.json`, and `--based-on forge-1-prd=<current version> --based-on forge-2-tech=<current version> --based-on forge-3-specs=<current version>`. It sets `status: "complete"`, `completedAt`, the version and `basedOnVersions`, and applies the downstream staleness cascade deterministically, so no downstream status is set by hand.
148
- 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.
186
+ 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 via `state-note` — it **overwrites** the single `notes` string (latest note wins), so fold any still-relevant existing note into the one combined string; otherwise proceed. The next stage's Step 1 reads and surfaces this note.
149
187
  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`.
150
188
  4. If verification was available but the user chose to skip it, persist that skip through `state-verify` using the fence below — never by hand. The choice to proceed unverified is durable state owned by the scripted writer.
151
189
  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:
@@ -164,7 +202,7 @@ python3 "$R/scripts/forge-session.py" state-note \
164
202
  --feature "{feature}" --note "<what the user volunteered>" --specs-dir "{specsDir}"
165
203
  ```
166
204
 
167
- The `state-verify` call for item 4 — **only** when verification was available and the user explicitly chose to skip it. A verifier that could not be dispatched is not a skip, so do not run this on an unavailable-tool path. Add `--epic "{epic}"` when this feature is an epic member — required, per the Pipeline State Protocol in `references/shared-conventions.md`:
205
+ The `state-verify` call for item 4 — **only** when verification was available and the user explicitly chose to skip it. A verifier that could not be dispatched is not a skip, so do not run this on an unavailable-tool path. And only over an entry that is absent or unresolved: if `stages.forge-verify-backlog` already records `passed` or `findings-applied`, do **not** run the call — those statuses are resolved, the verb refuses to demote them to `skipped` (#203), and the existing result stands with nothing written. Add `--epic "{epic}"` when this feature is an epic member — required, per the Pipeline State Protocol in `references/shared-conventions.md`:
168
206
 
169
207
  ```bash
170
208
  R="$(bash -c 'for d in "${CLAUDE_PLUGIN_ROOT:-}" "$HOME"/.claude/skills/feature-forge "$HOME"/.claude/plugins/cache/*/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')"
@@ -36,7 +36,7 @@ I found that the codebase uses React and TanStack Router.
36
36
 
37
37
  ### Decision Support: Help the User Choose
38
38
 
39
- When an `AskUserQuestion` carries substantive options (a real choice — not a trivial yes/no confirmation), do not just list them. The interview stages have already done codebase research and integration analysis; surfacing that synthesis at the decision moment is the whole point. For every such question:
39
+ When a question posed through `AskUserQuestion` carries substantive options (a real choice — not a trivial yes/no confirmation), do not just list them. The interview stages have already done codebase research and integration analysis; surfacing that synthesis at the decision moment is the whole point. For every such question:
40
40
 
41
41
  - **Lead with a recommended option.** Place it first and label it `(recommended)` (matching the `AskUserQuestion` "(Recommended)" convention).
42
42
  - **Put the trade-off in each option's `description`.** Say why you'd pick it and what you give up versus the alternatives — the cost, not just the benefit.
@@ -53,6 +53,17 @@ For genuinely comparable artifacts (competing module structures, two code snippe
53
53
 
54
54
  The **Branch Setup** block below is the reference pattern: a strong recommendation as the first option, rationale inline, the alternative still available, never a hard-stop.
55
55
 
56
+ ## Stage Review Gate
57
+
58
+ Every authoring stage ends its "Review with User" step in exactly one of two shapes. Which shape a stage uses is declared **here, once** — each stage's review step points at this block by title, and the shape is never re-derived from the surrounding prose or inferred from how sibling stages behave (three stages block and one does not; majority-shape inference is precisely the failure this block exists to prevent):
59
+
60
+ - **Blocking review (gate).** The stage presents the artifact and collects feedback through `AskUserQuestion`; it does **not** proceed until the user answers, iterating until they confirm. Stages: **forge-1-prd** (Step 5), **forge-2-tech** (Step 6), **forge-3-specs** (Step 6).
61
+ - **Non-blocking review (invitation).** The stage states the artifact is ready and invites adjustments **as a statement, not a question** — and then **proceeds to the next step in the same turn unless the user asks for changes**. The invitation obliges the agent to *continue*: emitting the invitation sentence and stopping treats the non-gate as a gate and strands the stage `in-progress` with its completion step unrun — a defect, not caution. Stage: **forge-4-backlog** (Step 6).
62
+
63
+ **Why the shapes differ.** A blocking review guards an artifact whose content was just authored from open-ended interview or synthesis — the user is the only authority on "complete", so the stage must wait. forge-4's backlog is *derived* from specs the user already approved, was planned interactively in its Step 3, and is machine-validated in its Step 5; a second hard gate would re-ask a settled question, and the loop never launches without forge-5-loop's own Step 2d confirmation anyway. The invitation is a courtesy checkpoint, not an approval gate (removed deliberately in #78's consistency sweep).
64
+
65
+ A stage that changes shape changes it **in this block first**; the per-stage pointer stays a pointer.
66
+
56
67
  ## Configuration Reading
57
68
 
58
69
  Read `forge.config.json` from the project root. If it doesn't exist, use defaults.
@@ -130,7 +141,7 @@ mkdir -p "<specsDir>"
130
141
  [ -f "<specsDir>/AGENTS.md" ] || cp "$R/references/templates/specs-hygiene/AGENTS.md" "<specsDir>/AGENTS.md"
131
142
  ```
132
143
 
133
- If the host is Claude (the `AskUserQuestion` tool is available), also ensure the Claude-framed variant:
144
+ If the host is Claude (the Claude-native question tool is available), also ensure the Claude-framed variant:
134
145
 
135
146
  ```bash
136
147
  R="$(bash -c 'for d in "${CLAUDE_PLUGIN_ROOT:-}" "$HOME"/.claude/skills/feature-forge "$HOME"/.claude/plugins/cache/*/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')"
@@ -191,7 +202,7 @@ Pipeline state is written by the `state-*` verbs of `scripts/forge-session.py`
191
202
 
192
203
  If a `state-*` verb exits 2, surface the plain `Error:` line from stderr verbatim, do **not** proceed to the next step of the surrounding protocol, and do **not** hand-author the JSON as a workaround. The stage remains resumable because the entry stamp is already on disk — re-run the verb once the cause is fixed.
193
204
 
194
- **The eight `state-*` verbs.** `state-enter` (Stage-Entry Guard), `state-artifact` (incremental artifact tracking), `state-complete` (Git Commit Protocol), `state-branch` (Branch Setup and Branch Reconciliation), `state-note` (the Immediate Downstream Note below, and the optional completion note at stage closure), `state-decision` (deferred decisions), `state-ecr` (epic change requests), and `state-verify` (one `forge-verify-*` verification transition — below). The `--epic` member requirement and the exit-2 failure protocol above apply to **every** one of them, `state-verify` included; no verify entry is ever hand-authored.
205
+ **The nine `state-*` verbs.** `state-enter` (Stage-Entry Guard), `state-artifact` (incremental artifact tracking), `state-complete` (Git Commit Protocol), `state-skip` (the deliberate forge-6-docs documentation skip — scoped to that one stage; writes `status: "skipped"` + `skippedAt`, refuses to erase a record of docs that exist, and is the only sanctioned writer of a skipped docs stage), `state-branch` (Branch Setup and Branch Reconciliation), `state-note` (the Immediate Downstream Note below, and the optional completion note at stage closure), `state-decision` (deferred decisions), `state-ecr` (epic change requests), and `state-verify` (one `forge-verify-*` verification transition — below). The `--epic` member requirement and the exit-2 failure protocol above apply to **every** one of them, `state-verify` included; no verify entry is ever hand-authored.
195
206
 
196
207
  ### `state-verify` — verification results and provenance
197
208
 
@@ -395,7 +406,7 @@ Invoke this block **at the head of any post-entry step that writes a stage artif
395
406
 
396
407
  1. **Proceed** when `stages.{stage}.status` is `"in-progress"` (this session's Entry Stamp — you are finishing the run you started) or absent/`pending`. Run the write / exit normally.
397
408
 
398
- 2. **Detect-and-refuse** when ALL of these hold: `stages.{stage}.status ∈ {"complete", "stale"}` **AND** the stage's artifacts (incl. `TRACEABILITY.md` for forge-3-specs) exist on disk **AND** a `commitHash` is recorded for the stage **AND** you did **not** author this stage earlier in the current session. This is a stale/replayed continuation of an already-finished, committed stage. Do **not** overwrite the artifact or re-run the exit. Route instead to the **Stage-Entry Guard**'s *Re-authoring* path: surface the same `AskUserQuestion` warning ("A completed {stage} artifact already exists for '{feature}' (v{n}{, marked stale}). Continuing will create a new version. Proceed?"). Only on explicit confirmation re-enter from the Entry Stamp (the version bumps at exit); otherwise **stop** and report that the stage is already complete — cite the recorded `commitHash` and offer `/feature-forge:forge {feature}` to see true state.
409
+ 2. **Detect-and-refuse** when ALL of these hold: `stages.{stage}.status ∈ {"complete", "stale"}` **AND** the stage's artifacts (incl. `TRACEABILITY.md` for forge-3-specs) exist on disk **AND** a `commitHash` is recorded for the stage **AND** you did **not** author this stage earlier in the current session. This is a stale/replayed continuation of an already-finished, committed stage. Do **not** overwrite the artifact or re-run the exit. Route instead to the **Stage-Entry Guard**'s *Re-authoring* path: surface the same warning via `AskUserQuestion` ("A completed {stage} artifact already exists for '{feature}' (v{n}{, marked stale}). Continuing will create a new version. Proceed?"). Only on explicit confirmation re-enter from the Entry Stamp (the version bumps at exit); otherwise **stop** and report that the stage is already complete — cite the recorded `commitHash` and offer `/feature-forge:forge {feature}` to see true state.
399
410
 
400
411
  When you cannot confirm you authored the current run, treat it as a replay and refuse: a false refuse costs one confirmation click; a false proceed overwrites a committed artifact and re-churns a stage version. `--force` follows Force Mode (skip the gate, treat as a deliberate re-author).
401
412
 
@@ -47,8 +47,8 @@ an epic member. Only the flags below are stage-specific; pass no others.
47
47
  |---|---|---|
48
48
  | `forge-0-epic` | `forge-0-epic` | `--next-feature "{member}"` when a concrete member exists |
49
49
  | `forge-1-prd` … `forge-4-backlog` | that stage's own id | none beyond identity/capability |
50
- | `forge-5-loop` | `forge-5-loop` | `--outcome` — one of `complete`, `partial`, `blocked`, `needs-human`, `deferred` |
51
- | `forge-6-docs` | `forge-6-docs` | `--outcome` — `complete` or `blocked` |
50
+ | `forge-5-loop` | `forge-5-loop` | `--outcome` — one of `complete`, `partial`, `blocked`, `needs-human`, `deferred`, `resolved`; optional `--cause dependency-starvation` with `--outcome partial` |
51
+ | `forge-6-docs` | `forge-6-docs` | `--outcome` — `complete`, `blocked`, or `skipped` (deliberate docs skip, persisted via `state-skip` before the exit; routes like `complete` with honest wording) |
52
52
  | direct `forge-verify` | `forge-verify` | `--owner direct`, `--outcome` (`passed`, `findings`, `skipped`, `failed`), and served-stage metadata |
53
53
  | nested `forge-verify` | `forge-verify` | `--owner nested`, plus the same outcome and served-stage metadata |
54
54
  | direct/nested `forge-fix` | `forge-fix` | the matching `--owner`, a `FixOutcome` (`no-findings`, `decisions`, `failed`, `applied`, `reverified`, `reverify-findings`, `deferred`), and served-stage metadata |
@@ -100,9 +100,9 @@ Obey the DIRECTIVES it prints, in the consumption order this protocol fixes: sur
100
100
 
101
101
  The stamp is shown with `--host claude`; the adapter build substitutes `pi`/`generic` per
102
102
  target, and §"Host and capability determination" below governs the value. The literal is
103
- deliberate — `scripts/build-adapters.py` keys its host translation on the exact string
104
- `--host claude`, and the stamp sites are compared byte-for-byte, so it is the one token in
105
- that line that is not a placeholder.
103
+ deliberate — `scripts/build-adapters.py` keys its host translation on the exact canon
104
+ value of that flag, and the stamp sites are compared byte-for-byte, so it is the one token
105
+ in that line that is not a placeholder.
106
106
 
107
107
  ## Host and capability determination
108
108
 
@@ -110,8 +110,9 @@ Before the call, compute the two inputs independently. They are unrelated: **a h
110
110
  implies a capability**, and the script takes `--verify-capability` at face value.
111
111
 
112
112
  **`--host`** describes only the active adapter command surface — `claude`, `pi`, or
113
- `generic`. It selects command syntax (`/feature-forge:` vs `/skill:` vs host-neutral) and
114
- fresh-session wording (`/clear` vs `/new` vs neutral prose). Nothing else.
113
+ `generic`. It selects command syntax (Claude's stage-command prefix vs Pi's `/skill:` vs
114
+ host-neutral) and fresh-session wording (Claude's clear command vs Pi's `/new` vs neutral
115
+ prose). Nothing else.
115
116
 
116
117
  **`--verify-capability interactive`** is passed only when **both** of these hold:
117
118
 
@@ -151,7 +152,8 @@ production successor** while verification is unresolved.
151
152
  - a capable Pi session is `--host pi --verify-capability interactive`, and receives the
152
153
  same logical gate a capable Claude session does;
153
154
  - Pi without a dispatchable verifier is `--host pi --verify-capability manual`;
154
- - a Claude session that cannot dispatch is `--host claude --verify-capability manual`.
155
+ - a Claude session that cannot dispatch keeps the Claude host value with
156
+ `--verify-capability manual`.
155
157
 
156
158
  Interactive gate options keep their explicit labels, their recommended default, and their
157
159
  one-line trade-off descriptions (below). The manual path prints the verify command as the
@@ -199,6 +201,44 @@ second sentinel-terminated block **inside** an outer stage's exit, breaking the
199
201
  exactly-one-terminal-block rule — and the canon guard cannot catch it, because both
200
202
  wordings legitimately appear in the same file. Judge the token, not the phrasing.
201
203
 
204
+ ## Caller-side resumption: the declared resume point
205
+
206
+ The `owner:` token and `terminalOwnedBy` arbitrate who prints — but they specify only
207
+ the **callee** side: a nested skill stays quiet and returns its structured result. This
208
+ section is the reciprocal, caller-side half of that contract.
209
+
210
+ **On a sub-skill's return, the caller re-owns the terminal.** Every closing instruction
211
+ in the callee's own body — its report-and-stop posture, its "confirm the result" close,
212
+ its own next-steps habits — is void for this turn. The caller resumes at its **declared
213
+ resume point**, in the same turn, and its remaining steps run to its own terminal.
214
+
215
+ **Every Skill-tool delegation site declares, at the invocation, what happens on
216
+ return.** Suppression without resumption is the failure mode this section closes: the
217
+ callee's closing posture is the freshest instruction in context while the caller's next
218
+ step is the oldest, so an undeclared return silently ends the run one layer too early —
219
+ the caller's remaining steps (validation, state writes, commit, stage exit) dropped,
220
+ with no error surfaced. An implicit "let it run to its natural stopping point" is that
221
+ bug spelled politely, and it is banned on delegation sites. A site takes one of two
222
+ declared postures:
223
+
224
+ - **Delegate-and-resume** — the callee is a sub-step of the caller: the site names the
225
+ caller's own step that control returns to, and the caller continues there in the same
226
+ turn. The callee never owns the caller's terminal. The worked instance is
227
+ `forge-4-backlog` Step 4's **Return contract** for the `author-backlog` delegation
228
+ (control returns at Step 5; the sub-skill's direct-invocation posture — its approval
229
+ gate and its validate-and-confirm close — is explicitly disapplied on the delegated
230
+ path). New delegation sites follow that pattern rather than re-deriving it.
231
+ - **Terminal handoff** — the caller's job ends at the invocation and the invoked skill
232
+ owns the terminal from there on (e.g. the navigator's `autoInvokeNextStage`
233
+ "continue in this session" advance into the next production stage). Declaring the
234
+ handoff is what keeps it distinct from an accidental drop.
235
+
236
+ Scope: this contract governs **Skill-tool delegation within one session**. The
237
+ truncated-verifier-return guard (forge-verify's `findings-template.md`, "Truncated
238
+ Verifier Returns") is a different mechanism — it polices what an **Agent-dispatched
239
+ subagent's** return payload must contain, not where a caller resumes. A dispatch site
240
+ can be subject to both; satisfy each on its own terms.
241
+
202
242
  ## Directive consumption order
203
243
 
204
244
  `stage-exit` emits a DIRECTIVES object and (for a direct owner) a NEXT-STEPS block. The
@@ -299,7 +339,11 @@ first:
299
339
  a stage's artifact commit.
300
340
  - **Skip for now** — go straight to the NEXT-STEPS block without verifying. Record this
301
341
  stage's verify status as `skipped` in pipeline state (via `state-verify`, never by hand)
302
- **only** on an explicit skip — a skip does not go stale.
342
+ **only** on an explicit skip — a skip does not go stale. Exception: if the existing
343
+ entry records `passed` or `findings-applied` (a resolved result whose freshness has
344
+ merely lapsed), write **nothing** — `state-verify` refuses to demote a resolved status
345
+ to `skipped` (#203), and the recorded result stands on its own; the user's decline is
346
+ honored by simply not re-verifying.
303
347
 
304
348
  **Advancement is allowed only after a pass, or after an explicit skip has been
305
349
  persisted.** Choosing to stop, or losing the interaction, produces no advancing terminal
@@ -358,8 +402,8 @@ directive is informational — you do **not** re-derive the wording:
358
402
  unchanged; the block appends a non-blocking reminder line ("You also flagged N epic
359
403
  change(s) to reconcile when convenient …"). This is *finish-then-edit*.
360
404
 
361
- Either way the added lines are host-neutral (no literal `/clear`) and sit **above** the
362
- sentinel; just print the NEXT-STEPS block verbatim as always.
405
+ Either way the added lines are host-neutral (they name no fresh-session command) and sit
406
+ **above** the sentinel; just print the NEXT-STEPS block verbatim as always.
363
407
 
364
408
  ### Deferred decisions — do not solicit next-stage decisions at this exit
365
409
 
@@ -9,7 +9,7 @@ argument-hint: <feature-name>
9
9
 
10
10
  Execute the autonomous coding loop against a forge feature's backlog. The loop spawns a fresh agent session per backlog item, implementing each task with full verification.
11
11
 
12
- The loop **runner** is configured, not hardcoded. feature-forge talks to it through the `loopRunner` block in `forge.config.json`; rauf is the default and reference implementation (see `references/ralph-loop-contract.md`). Every command below is rendered from `loopRunner` with token substitution — there are no hardcoded `rauf …` commands in this skill, and even the human log filename is tokenized as `{loopRunner.logFile}`.
12
+ The loop **runner** is configured, not hardcoded. feature-forge talks to it through the `loopRunner` block in `forge.config.json`; rauf is the default and reference implementation (see `references/ralph-loop-contract.md`). Every command below is rendered from `loopRunner` with token substitution — no hardcoded `rauf …` commands; even the human log filename is tokenized (`{loopRunner.logFile}`).
13
13
 
14
14
  ## Resolve the loop runner
15
15
 
@@ -42,13 +42,15 @@ Read and follow `references/shared-conventions.md` for feature name validation,
42
42
 
43
43
  Read `{resolvedFeatureDir}/.pipeline-state.json`. If not in force mode, `stages.forge-4-backlog` must be `complete`. If not, STOP and tell the user: "Backlog hasn't been created yet. Run `/feature-forge:forge-4-backlog {feature}` first."
44
44
 
45
+ If the state's `notes` is non-empty, surface it before proceeding and treat it as run input — often backlog-time constraints; it never overrides specs or config (raise any conflict).
46
+
45
47
  ### 1b. Verification Check
46
48
 
47
49
  Read `stages.forge-verify-backlog` and branch on its status — **four** cases, in this order (the pending case must be tested *before* the generic one, or owed-and-dropped debt gets reported as never-scheduled):
48
50
 
49
51
  1. **`passed`** — proceed with no prompt.
50
- 2. **`findings-applied`** — fixes were applied but nothing re-verified them: this status deliberately clears freshness, so the backlog's verification is still outstanding, not silently satisfied. Use `AskUserQuestion` to offer: **Re-verify first (recommended)** (`/feature-forge:forge-verify {feature} backlog`) · **Continue without re-verifying** — an explicit deferral, persisted via `state-verify --status skipped` (never by hand; add `--epic "{epic}"` for members) before the loop starts, so it is a recorded decision and not a walked-past gate.
51
- 3. **`auto-verify-pending`** — automatic verification *was* scheduled for the backlog stage and the debt *was* durably recorded; it simply has not run. Say exactly that, naming the served stage and the retry command: *"{feature}: automatic verification is still pending for forge-4-backlog; run `/feature-forge:forge-verify {feature} backlog` to resolve it."* Then use `AskUserQuestion` to offer the same two choices as case 4. Never report this as "hasn't been verified yet" — "nobody ever asked for this" and "this was owed and dropped" are different facts and the operator acts on them differently.
52
+ 2. **`findings-applied`** — fixes were applied but nothing re-verified them: this status deliberately clears freshness, so the backlog's verification is still outstanding, not silently satisfied. Use `AskUserQuestion` to offer: **Re-verify first (recommended)** (`/feature-forge:forge-verify {feature} backlog`) · **Continue without re-verifying**. On continue, write **nothing**: `state-verify` refuses demoting `findings-applied` to `skipped` (#203); the recorded status already says re-verification is outstanding.
53
+ 3. **`auto-verify-pending`** — automatic verification *was* scheduled for the backlog stage and the debt *was* durably recorded; it simply has not run. Say exactly that, naming the served stage and the retry command: *"{feature}: automatic verification is still pending for forge-4-backlog; run `/feature-forge:forge-verify {feature} backlog` to resolve it."* Then use `AskUserQuestion` to offer the same two choices as case 4. Never report this as "hasn't been verified yet" — "nobody ever asked for this" and "this was owed and dropped" are different facts.
52
54
  4. **Anything else** (absent, `pending`, `skipped`, `findings-reported`) — use `AskUserQuestion` to warn with the cost of skipping: "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?"
53
55
 
54
56
  Cases 3 and 4 offer the same choices: **Verify first (recommended)** · **Continue without verifying**. The proceed-anyway path is unchanged.
@@ -115,13 +117,17 @@ Verify the file exists on disk. If not, STOP and tell the user: "No backlog.json
115
117
 
116
118
  The runner commits each item onto the current branch. Skip if not a git repo or `branchPerFeature` is false. Otherwise run the **Branch Reconciliation** block in `references/shared-conventions.md` (it runs `reconcile-branch` and, on `warn-drift` — you are on the default branch — strongly recommends creating `{branchPrefix}{feature}` via `AskUserQuestion` before the loop commits; on `adopt-current` it updates the recorded branch to the current one, never pushing you back to a stale/imposed branch). Never hard-stop.
117
119
 
120
+ ### 1g. Stranded-Work Pre-flight (if using git)
121
+
122
+ Run `git status --porcelain`. If it reports changes **and** `{backlogDir}/{loopRunner.stateDir}/state.json` exists from a previous run, **STOP**: name that run (its `startedAt`, `currentItem`, and `blockedItems` from `state.json`) and point the user at the **Post-Run Tree Reconciliation** section of `references/recovery-procedure.md` to commit / stash / discard the stranded work before relaunch — never auto-pass `--force`. If the tree is dirty with **no** prior-run `state.json`, keep today's behavior (surface it; let the user commit/stash or pass `--force`). A clean tree is silent. rauf's own launch refusal remains the backstop.
123
+
118
124
  ## Step 2: Construct the Loop Command
119
125
 
120
126
  ### 2a. Analyze Backlog
121
127
 
122
- Run the **list command** (`loopRunner.listCommand`, default `rauf backlog list . --backlog {backlogDir} --json`) and count items by status: `pending`, `in_progress`, `done`, `blocked`.
128
+ Run the **list command** (`loopRunner.listCommand`, default `rauf backlog list . --backlog {backlogDir} --json`) and count items by status: `pending`, `in_progress`, `done`, `blocked`. Pipe that same list-command JSON into `backlog-topology --items-stdin --json` (a `forge-session.py` verb — invoke it via Step 3a's `$R` fence) and read `maxChainDepth` to report alongside the iteration count — advisory only: no prompt, no operator decision.
123
129
 
124
- Calculate the iteration count: `ceil((pending + in_progress) * loopIterationMultiplier)` where `loopIterationMultiplier` comes from `forge.config.json` (default: 1.5). This headroom allows retries without exhausting iterations.
130
+ Calculate the iteration count: `ceil((pending + in_progress) * loopIterationMultiplier)` where `loopIterationMultiplier` comes from `forge.config.json` (default: 1.5, headroom for retries).
125
131
 
126
132
  If there are no pending or in_progress items, STOP and tell the user: "All backlog items are already done or blocked. Nothing to run."
127
133
 
@@ -134,8 +140,6 @@ If there are `blocked` items, note them — the user may want `--retry-blocked`.
134
140
  - If `backlogDir` is set in config: use the per-feature subpath `{backlogDir}/{feature}` (matching the 1e composition rule and forge-4-backlog §6.2).
135
141
  - Otherwise: use `{resolvedFeatureDir}` (the directory containing `backlog.json`).
136
142
 
137
- **Example:** If `specsDir` is `./specs` and feature is `auth`, `{backlogDir}` is `specs/auth`.
138
-
139
143
  ### 2c. Build Command
140
144
 
141
145
  Render the **run command** (`loopRunner.runCommand`) with token substitution, e.g. the rauf default becomes:
@@ -159,19 +163,20 @@ Backlog summary:
159
163
  - Done: {done}
160
164
  - Blocked: {blocked}
161
165
  - Iterations: {iterationCount} ({activeItems} items x {loopIterationMultiplier} multiplier)
166
+ - Max chain depth: {maxChainDepth} — depth bounds achievable progress regardless of iteration budget
162
167
 
163
168
  For the model-selection precedence (item.model > --model/options > project default >
164
169
  provider default), read references/runner-contract.md.
165
170
  ```
166
171
 
167
- **Run mode and full loop-runner contract:** follow `## Run mode (Step 2d, rauf)` and the remaining sections in `references/runner-contract.md` verbatim.
172
+ **Run mode and full loop-runner contract:** follow `## Run mode (Step 2d, rauf)` and the remaining sections in `references/runner-contract.md` verbatim; `loopRunner.reviewMode` (`"always"`/`"never"`) suppresses the Run-mode question — semantics live there.
168
173
 
169
174
  #### Agent selection (gated on `loopRunner.agentArgument`)
170
175
 
171
176
  **Capability gate.** Everything below applies **only when** the effective `loopRunner.agentArgument` is present and non-empty. **When it is absent or empty, Step 2d is exactly the confirmation above — no probe, no agent question, no availability listing, no `Agent:` line — byte-identical to today** (REQ-PLUG-02, REQ-COMPAT-01). The full algorithm, precedence, and verbatim message shapes are in `## Agent selection` of `references/agent-selection.md`; read it. When the gate is on, augment Step 2d in order:
172
177
 
173
178
  - **(a) Probe once.** Before confirming, run `loopRunner.agentsProbeCommand` (default `{bin} agents --json`) **exactly once** (no retries, no second probe); it exits 0 with `{ agents: [...] }`. Parse `agents[]`; build the advertised set `{ row.id }` — this one parsed array drives (b)–(d).
174
- - **(b) Agent question.** Add an **"agent"** question to the same `AskUserQuestion` surface: **one option per advertised row** labelled `"{displayName} ({id}) — available/not found"`, **plus an explicit `"default (claude-cli)"` choice mapping to `run_selection = None`**. Resolve the pick (run > project, empty/whitespace unset, an explicit runner-default pick collapses to the default path) into `{resolved.agent, resolved.source}`. Precedence: `item.provider > --agent > project defaultAgent > runner default` (forge never reads a backlog item's provider).
179
+ - **(b) Agent question.** Add an **"agent"** question to the same `AskUserQuestion` surface: **one option per advertised row** labelled `"{displayName} ({id}) — available/not found"`, **plus an explicit `"default (claude-cli)"` choice mapping to `run_selection = None`**. Resolve the pick (run > project, empty/whitespace unset, an explicit runner-default pick collapses to the default path) into `{resolved.agent, resolved.source}`. Precedence: `item.provider > --agent > project defaultAgent > runner default` (forge never reads a backlog item's provider). Under `loopRunner.agentMode: "auto"`, skip this question (`run_selection = None`); (a)/(c)/(d)/(d-model) still run — see `references/agent-selection.md`.
175
180
  - **(c) Availability listing.** From the **same** parsed `agents[]` (no second probe), list `id` / `displayName` / available (`yes`/`no`, `detail` on unavailable rows).
176
181
  - **(d) Verdict** — only for a **non-default** resolved agent (default path `None`/`claude-cli` → no probe, byte-identical to today). Classify by **membership** then `available` (never by exit code): **UNKNOWN** (`∉` set) → **hard-reject BEFORE any loop side-effect**, error lists the **sorted** valid ids, **NO proceed-anyway**; **UNAVAILABLE** (member, `available False`) → warn with `detail`, `AskUserQuestion` offering **proceed-anyway OR choose-another** (re-presents the same `agents[]`), never silent; **AVAILABLE** → proceed, the validated id fills `{agent}`; **probe failure** (non-zero exit / unparseable / missing or empty `agents[]` / row lacking `id`) → surface it, offer **choose-another OR abort**, **never launch the non-default agent unvalidated** and never silently fall back to the default.
177
182
  - **(d-model) Claude-only model-alias guard.** Runs **only** when the resolved agent is **non-default** (not the default / `claude-cli` path). Read the backlog.json (Step 1e path); collect items whose `model` is a **Claude-specific alias** (tier `opus`/`sonnet`/`haiku` or a `claude-*` id). **If none, skip silently.** Otherwise warn before launch via `AskUserQuestion` (NOT prose): `item.model` outranks `--agent`, so the alias is forwarded verbatim to `{agent}`, which will likely reject it (e.g. codex 400 *"The 'sonnet' model is not supported…"*) — every spawn exits 1 and rauf circuit-breaks (*"3 consecutive infra failures — halting"*) with no hint of the cause. Offer: **(1) Strip `model` for this run (recommended)** — rewrite backlog.json removing the `model` key from each affected item (persistent edit; re-run forge-4-backlog to restore), then proceed; **(2) Proceed as-is** — only safe if `{agent}` understands the pinned ids. forge touches only `model`, never `provider`. Full rationale: `references/agent-selection.md`.
@@ -194,7 +199,7 @@ Then commit this state write before launching (mandatory). The runner refuses to
194
199
 
195
200
  ### 3b. Launch Background Process
196
201
 
197
- Launch the loop **backgrounded** (`run_in_background: true`) so it survives session end and does not block the session. For a runner that **persists its own structured event file** (the default — rauf writes `{stateDir}/events.ndjson` natively and rotates it per run), launch the **plain `runCommand`** with **no stdout redirect** and supervise the runner's **native** `events.ndjson` directly; do **not** redirect `--ndjson` into `{stateDir}` (it is redundant and collides with the runner's own writer — see `references/runner-contract.md`). Only a stdout-only runner (no native event file) uses `eventStreamCommand`, redirected to a file **outside** `{stateDir}`. The background task's exit notification is the single authoritative terminal signal (Step 4). Loop runs can take significant time (minutes to hours depending on backlog size). For the exact launch commands (incl. the `mkdir -p` state-dir guard and the root→`IS_SANDBOX` sandbox guard) and the self-persisting vs. stdout-only detail, read `references/runner-contract.md`.
202
+ Launch the loop **backgrounded** (`run_in_background: true`) so it survives session end and does not block the session. For a runner that **persists its own structured event file** (the default — rauf writes `{stateDir}/events.ndjson` natively and rotates it per run), launch the **plain `runCommand`** with **no stdout redirect** and supervise the runner's **native** `events.ndjson` directly; do **not** redirect `--ndjson` into `{stateDir}` (it is redundant and collides with the runner's own writer — see `references/runner-contract.md`). Only a stdout-only runner (no native event file) uses `eventStreamCommand`, redirected to a file **outside** `{stateDir}`. The background task's exit notification is the single authoritative terminal signal (Step 4). For the exact launch commands (incl. the `mkdir -p` state-dir guard and the root→`IS_SANDBOX` sandbox guard) and the self-persisting vs. stdout-only detail, read `references/runner-contract.md`.
198
203
 
199
204
  ### 3c. Inform User
200
205
 
@@ -203,21 +208,12 @@ Follow the **Inform-user output template (Step 3c)** section of `references/runn
203
208
  ### 3d. Arm a Monitor on the event stream, and react to events
204
209
 
205
210
  Arm the **`Monitor` tool** on the structured event stream (the NDJSON file, or the
206
- human log as fallback) so events flow back into this session as they happen. Use
207
- **`persistent: true`** — runs can exceed `Monitor`'s maximum `timeout_ms` (1 hour),
208
- and a bounded timeout would silently stop watching a still-running loop. The filter
209
- MUST match every terminal and exception state, not just the happy path (silence is
210
- not success). Monitor the **structured** surface, never raw `RAUF_*` tokens.
211
-
212
- Each Monitor event arrives as a message; react per type — surface `needs_human` /
213
- `loop_error` immediately with a `PushNotification`, coalesce `item_completed` into
214
- milestones, and treat `llm_stuck_warning` as a hang warning. A `needs_human` /
215
- `blocked` signal does **not** pause the loop — the runner sets the item aside and
216
- keeps going.
217
-
218
- For the exact Monitor commands (NDJSON `jq` filter and the log-fallback `grep`
219
- prefixes), the coverage-complete filter event list, and the full per-event reaction
220
- rules, read `references/runner-contract.md`.
211
+ human log as fallback) with **`persistent: true`**, a coverage-complete filter
212
+ matching every terminal and exception state (silence is not success), and react to
213
+ each event as it arrives. The exact Monitor commands, the filter event list, and the
214
+ full per-event reaction rules (`needs_human` / `loop_error` surfaced immediately with
215
+ a `PushNotification`, `item_completed` coalesced into milestones, `llm_stuck_warning`
216
+ as a hang warning) are in `references/runner-contract.md` — follow them verbatim.
221
217
 
222
218
  ### 3f. Reach completion
223
219
 
@@ -233,12 +229,16 @@ Run the **status-json command** (`loopRunner.statusJsonCommand`) and read
233
229
  `backlogSummary` for the authoritative counts — it separates the three non-done
234
230
  outcomes: genuine `blocked`, `needsHuman`, and runner-`deferred` ("false blocks").
235
231
  Fall back to the **list command** (`loopRunner.listCommand`) if `statusJsonCommand`
236
- is not configured. You will already have most of this from the live tally in 3e. If the run used a review flag (e.g. rauf's `--review`), also read any `review_completed` event (event stream, or `{loopRunner.stateDir}/events.ndjson`) for its `itemsCreated`/`summary` to surface in 4b — see `references/result-reporting.md`.
232
+ is not configured. If the run used a review flag (e.g. rauf's `--review`), also read any `review_completed` event (event stream, or `{loopRunner.stateDir}/events.ndjson`) for its `itemsCreated`/`summary` to surface in 4b — see `references/result-reporting.md`.
237
233
 
238
234
  ### 4b. Report Results
239
235
 
240
236
  Present a summary to the user. Pick **every** branch that applies (a run can be both
241
- blocked and needs-human) and render its report. The five verbatim result-report output templates — **all-done**, **needs-human**, **blocked**, **deferred**, and **pending** (iteration limit reached) — are in `references/result-reporting.md`, together with the Step 7 `LoopOutcome` ladder these same counts feed. The reports are descriptive only: they carry no next command, and the run does not end here. If the authoritative counts cannot be obtained at all (4a failed or its output does not parse), follow **Operational failure before the counts are known** in that same file: surface the failure and its recovery, and close nothing — no outcome, no stage exit, no terminal block.
237
+ blocked and needs-human) and render its report. The five verbatim result-report output templates — **all-done**, **needs-human**, **blocked**, **deferred**, and **pending** (with a conditional cause) — are in `references/result-reporting.md`, together with the Step 7 `LoopOutcome` ladder these same counts feed. The reports are descriptive only: they carry no next command, and the run does not end here. If the authoritative counts cannot be obtained at all (4a failed or its output does not parse), follow **Operational failure before the counts are known** in that same file: surface the failure and its recovery, and close nothing — no outcome, no stage exit, no terminal block.
238
+
239
+ ### 4c. Post-Run Recovery Pass (unconditional)
240
+
241
+ Run the **Post-Run Recovery Procedure** (`references/recovery-procedure.md`) now — on **every** run close, before Step 5 writes state, so the tree it inspects is exactly what the run left. The live `needs_human` handler (3d) collects answers early but is **not** the entry condition: a run that emitted no event still enters here — this is what makes the plain-blocked unblock reachable on blocked-only runs. With nothing to decide, its step 1 skips straight to the §4 tree reconciliation — silent on a clean tree. A run can strand uncommitted work with no signal (items failing a shared final acceptance criterion are never committed); this pass reconciles it — 1g's pre-flight is only the next-launch backstop. Its step-7 gate feeds Step 7's `resolved` rung; the stage still closes exactly once, in Step 7.
242
242
 
243
243
  ## Step 5: Update Pipeline State
244
244
 
@@ -254,9 +254,9 @@ python3 "$R/scripts/forge-session.py" state-complete --feature "{feature}" --sta
254
254
 
255
255
  ## Step 5b: Offer Impl-Verify (standalone path)
256
256
 
257
- **Gate:** run only if (a) the feature's `.pipeline-state.json` has **no** `epic` key **and** (b) Step 5 set `stages.forge-5-loop.status` to `complete`. Otherwise **skip** straight to Step 7 — a non-complete run has nothing to verify yet, and epic members get the equivalent offer in Step 6.1 (do **not** prompt twice). This standalone counterpart to Step 6.1 nudges verification interactively rather than via the easily-missed "Next steps" text. Use `AskUserQuestion` (NOT inline prose) to offer: *"{feature}'s loop is complete. Recommended: run `/feature-forge:forge-verify {feature} impl` to audit the implementation before generating docs. Run it now, or skip to forge-6-docs?"* On **run**, invoke `feature-forge:forge-verify {feature} impl` with the literal `owner: nested` token in the dispatching prompt — this dispatch happens inside the loop stage, so **you** remain the sole terminal owner and the branch skill returns its structured result and prints no terminal block of its own (see "Branch ownership: the `owner:` token" in `references/stage-exit-protocol.md`). On **skip**, persist the skip through `state-verify` using the fence below (mirrors `forge-4-backlog`'s skip handling) — the forge-6-docs backstop re-surfaces the skip. Either way, do **not** name a next command here: Step 7 routes, and it routes differently depending on what this step recorded.
257
+ **Gate:** run only if (a) the feature's `.pipeline-state.json` has **no** `epic` key **and** (b) Step 5 set `stages.forge-5-loop.status` to `complete`. Otherwise **skip** straight to Step 7 — a non-complete run has nothing to verify yet, and epic members get the equivalent offer in Step 6.1 (do **not** prompt twice). This standalone counterpart to Step 6.1 nudges verification interactively. Use `AskUserQuestion` (NOT inline prose) to offer: *"{feature}'s loop is complete. Recommended: run `/feature-forge:forge-verify {feature} impl` to audit the implementation before generating docs. Run it now, or skip to forge-6-docs?"* On **run**, invoke `feature-forge:forge-verify {feature} impl` with the literal `owner: nested` token in the dispatching prompt — this dispatch happens inside the loop stage, so **you** remain the sole terminal owner and the branch skill returns its structured result and prints no terminal block of its own (see "Branch ownership" and "Caller-side resumption" in `references/stage-exit-protocol.md`; a delegate-and-resume site — on return, control resumes here). A verifier return without its report structure is a dropped digest, not a result (issue #183) — apply "Truncated Verifier Returns" in forge-verify's `findings-template.md` reference (resume or re-dispatch) before recording anything. On **skip**, persist the skip through `state-verify` using the fence below (mirrors `forge-4-backlog`'s skip handling) — the forge-6-docs backstop re-surfaces the skip. Either way, do **not** name a next command here: Step 7 routes, and it routes differently depending on what this step recorded.
258
258
 
259
- **The skip is written by `state-verify`, never by hand.** Add `--epic "{epic}"` when this feature is an epic member — required, per the Pipeline State Protocol in `references/shared-conventions.md`. On exit 2, surface the plain `Error:` line verbatim and stop: the skip is not persisted, so Step 7 would route on state that is not on disk.
259
+ **The skip is written by `state-verify`, never by hand — and never over a resolved entry** (`passed`/`findings-applied`: the verb refuses that demotion, #203 — skip the fence and continue). Add `--epic "{epic}"` when this feature is an epic member — required, per the Pipeline State Protocol in `references/shared-conventions.md`. On exit 2, surface the plain `Error:` line verbatim and stop: the skip is not persisted, so Step 7 would route on state that is not on disk.
260
260
 
261
261
  ```bash
262
262
  R="$(bash -c 'for d in "${CLAUDE_PLUGIN_ROOT:-}" "$HOME"/.claude/skills/feature-forge "$HOME"/.claude/plugins/cache/*/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')"
@@ -268,7 +268,7 @@ python3 "$R/scripts/forge-session.py" state-verify --feature "{feature}" --stage
268
268
 
269
269
  **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** straight to Step 7 — standalone completed features are handled by Step 5b, and a non-complete run has no handoff to make (REQ-COMPAT-01).
270
270
 
271
- 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 `AskUserQuestion` (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?"* On **run**, invoke `feature-forge:forge-verify {feature} impl` with the literal `owner: nested` token in the dispatching prompt — this dispatch happens inside the loop stage, so **you** remain the sole terminal owner and the branch skill returns its structured result and prints no terminal block of its own (see "Branch ownership: the `owner:` token" in `references/stage-exit-protocol.md`). On **skip**, persist the skip through `state-verify --status skipped` using Step 5b's fence (add `--epic "{epic}"` — required for members) so the Step 7 exit reads a recorded decision instead of re-asking the question the user just answered; completion is then judged on the §7 rule with impl-verify explicitly skipped.
271
+ 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 `AskUserQuestion` (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?"* On **run**, dispatch exactly as Step 5b does — the same literal `owner: nested` token in the dispatching prompt (you remain the sole terminal owner), the same truncated-return guard before recording anything, and the same declared resume (control returns here; the handoff continues at 2). On **skip**, persist the skip through `state-verify --status skipped` using Step 5b's fence (add `--epic "{epic}"` — required for members) so the Step 7 exit reads a recorded decision instead of re-asking the question the user just answered; completion is then judged on the §7 rule with impl-verify explicitly skipped.
272
272
  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.
273
273
  3. **Announce what is actionable — do not route.** Read `render-status`'s `actionable` set (every dependency now complete, not itself complete) and say plainly which members can start now, or which are still blocked and on which dependencies. This is context for the user, not a handoff: the Step 7 exit consumes the same live payload and fences the one authoritative next command itself, so do **not** present a next-feature picker, offer to author a member's PRD, or repeat a member's `nextCommand` here. Two competing actions is exactly the ambiguity the scripted exit removes.
274
274
  4. **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. Then fall through to Step 7 — the epic handoff closes there, once, like every other path.
@@ -277,7 +277,7 @@ python3 "$R/scripts/forge-session.py" state-verify --feature "{feature}" --stage
277
277
 
278
278
  Every loop run ends here, and ends here **exactly once** — standalone or epic member, complete or not.
279
279
 
280
- First select the single `LoopOutcome` with the ladder in `references/result-reporting.md` (`needs-human` → `blocked` → `deferred` → `partial` → `complete`, first match wins), reading it from Step 4a's authoritative counts and never from the runner's process exit code. If those counts were never obtained, follow that file's operational-failure rule instead: report the failure and its recovery and run no exit at all.
280
+ First select the single `LoopOutcome` with the ladder in `references/result-reporting.md` (`resolved` → `needs-human` → `blocked` → `deferred` → `partial` → `complete`, first match wins), reading it from Step 4a's authoritative counts and never from the runner's process exit code. If those counts were never obtained, follow that file's operational-failure rule instead: report the failure and its recovery and run no exit at all.
281
281
 
282
282
  **Close this stage with the Scripted Stage Exit** (contract: `references/stage-exit-protocol.md`; do not improvise a "Next steps" list). Run:
283
283
 
@@ -293,10 +293,10 @@ Add `--epic "{epic}"` when this feature is an epic member — required, per the
293
293
 
294
294
  ## Gotchas
295
295
 
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/cache/*/feature-forge/*` (marketplace-cache installs), `~/.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`.
296
+ - **Plugin-root discovery (1b-epic helper) covers installed paths, not workspace-dev checkouts.** The `forge-root.sh` search probes the locations of an **installed** plugin only, so a feature-forge **source checkout** (e.g. `~/workspace/feature-forge`) exits "cannot locate plugin root." Expected in a dev environment; 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`.
297
297
  - `{backlogDir}` is a **directory path**, not a file path. Pass `specs/auth`, not `specs/auth/backlog.json`.
298
- - rauf resolves `RAUF.md` with fallback (`{backlogDir}/.rauf/RAUF.md` first, then the project's `.rauf/RAUF.md`) — found as long as the runner is installed in the project. State files (state.json, {loopRunner.logFile}, etc.) are created at `{backlogDir}/{loopRunner.stateDir}/`, within the feature's spec directory (expected) and isolated per backlog dir, so concurrent features don't collide.
299
- - 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. If a previous run left a stale lock, the user may need to pass `--force` to clear it (rauf reports this error clearly).
300
- - Never run the run command in the foreground (without `run_in_background`) — 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 `Monitor` tool (3d), never `sleep`/poll in the foreground. The `Monitor` 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.
298
+ - rauf resolves `RAUF.md` with fallback (`{backlogDir}/.rauf/RAUF.md` first, then the project's `.rauf/RAUF.md`). State files (state.json, {loopRunner.logFile}, etc.) land at `{backlogDir}/{loopRunner.stateDir}/`, isolated per backlog dir, so concurrent features don't collide.
299
+ - If the session disconnects mid-loop, the runner process continues independently — check results later with the status / list commands. A stale lock from a previous run may need `--force` to clear.
300
+ - Never run the run command in the foreground (without `run_in_background`) — 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 `Monitor` tool (3d) — `persistent: true`, the **structured** surface (`events.ndjson`), never raw `RAUF_*` tokens (they false-match in agent prose). 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
301
  - The version gate (1c) uses the `--json` form on purpose; never parse `rauf version`'s human output.
302
- - **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.
302
+ - **Implementation artifacts must not cite specs.** The loop should **read** specs and `backlog.json` freely — they are the source of truth, and the backlog rightly cites specs for provenance. But artifacts the loop **writes into the target repo** (source code, generated `SKILL.md`/agent files, configs, code comments) must be **self-contained**: no references to feature-forge spec files (no `See specs/{feature}/NN-*.md`, no "source spec" provenance notes) — specs are pre-implementation inputs that may be archived or deleted once the feature ships. This applies only to shipped implementation output, never to the backlog or spec documents, which keep citing specs.
@@ -21,6 +21,22 @@ Step 3c are byte-identical to today (capability gate;
21
21
  item.provider > --agent (run selection) > loopRunner.defaultAgent (project) > runner default (claude-cli)
22
22
  ```
23
23
 
24
+ **`loopRunner.agentMode` gate (`"prompt"` default | `"auto"`).** `"prompt"`
25
+ presents the Step 2d agent question (SKILL sub-step b) — byte-identical to today.
26
+ `"auto"` suppresses **only the interactive pick**: skip the agent question and
27
+ resolve as if the user made no per-run selection (`run_selection = None`, so
28
+ `defaultAgent` — or the runner default when unset — applies). Everything else on
29
+ this surface **still runs under `"auto"`**: the single probe, the availability
30
+ listing, the verdict classification below (UNKNOWN hard-reject before any loop
31
+ side-effect, UNAVAILABLE with its proceed-anyway/choose-another question,
32
+ probe-failure handling), and the Claude-only model-alias guard — those questions
33
+ are safety surfaces, not the pick, and are never suppressed. The resolved
34
+ `Agent: {id} (source: …)` line still shows in the confirmation and the Step 3c
35
+ template, so the choice is never hidden. Meaningless when
36
+ `loopRunner.agentArgument` is absent — the capability gate above already removes
37
+ the entire surface, and `agentMode` adds no second gate. An unrecognized value
38
+ behaves as `"prompt"`.
39
+
24
40
  **Run-layer mapping — why forge never re-implements rauf's resolver.** forge owns
25
41
  **only** its run and project layers and collapses them into **one** value
26
42
  (`resolve()`: `run_selection or defaultAgent or none`), which it emits as a single
@@ -58,9 +58,12 @@ defined authoritatively in rauf's
58
58
  > item aside and **keeps working other runnable items to completion** (rauf:
59
59
  > `runner.ts` needs_human handler). So a supervising session can surface those
60
60
  > events live (visibility) and cancel early, but it cannot inject an answer and
61
- > resume the set-aside item mid-run — resolution is a follow-up retry pass. A
62
- > first-class pause/resume-with-answer capability is a desirable runner
63
- > enhancement (see `plans/rauf-enhancement-recommendations.md`).
61
+ > resume the set-aside item mid-run — resolution is the **Post-Run Recovery
62
+ > Procedure** (`skills/forge-5-loop/references/recovery-procedure.md`): record the
63
+ > answer via `decision-record` at the moment of collection, then drive recovery
64
+ > from the record after the run ends. A first-class pause/resume-with-answer
65
+ > capability is a desirable runner enhancement (see
66
+ > `plans/rauf-enhancement-recommendations.md`).
64
67
 
65
68
  ## rauf is the default and reference implementation
66
69