@garygentry/feature-forge 0.3.0 → 0.3.2

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 (404) hide show
  1. package/adapters/claude/.feature-forge-bundle.json +1 -1
  2. package/adapters/claude/agents/forge-verifier.md +1 -1
  3. package/adapters/claude/references/epic-manifest-schema.json +6 -1
  4. package/adapters/claude/references/forge-config-schema.json +1 -1
  5. package/adapters/claude/references/pipeline-state-schema.json +5 -3
  6. package/adapters/claude/references/shared-conventions.md +125 -12
  7. package/adapters/claude/references/stage-exit-protocol.md +358 -144
  8. package/adapters/claude/references/vendor-construct-inventory.md +1 -1
  9. package/adapters/claude/scripts/epic-manifest.py +459 -90
  10. package/adapters/claude/scripts/forge-bootstrap.py +57 -5
  11. package/adapters/claude/scripts/forge-session.py +4346 -201
  12. package/adapters/claude/scripts/validate-traceability.py +92 -6
  13. package/adapters/claude/skills/forge/SKILL.md +18 -11
  14. package/adapters/claude/skills/forge/references/pipeline-state-schema.json +5 -3
  15. package/adapters/claude/skills/forge/references/shared-conventions.md +125 -12
  16. package/adapters/claude/skills/forge/references/stage-exit-protocol.md +358 -144
  17. package/adapters/claude/skills/forge-0-epic/SKILL.md +8 -3
  18. package/adapters/claude/skills/forge-0-epic/references/edit-mode.md +24 -24
  19. package/adapters/claude/skills/forge-0-epic/references/pipeline-state-schema.json +5 -3
  20. package/adapters/claude/skills/forge-0-epic/references/shared-conventions.md +125 -12
  21. package/adapters/claude/skills/forge-0-epic/references/stage-exit-protocol.md +358 -144
  22. package/adapters/claude/skills/forge-1-prd/SKILL.md +39 -11
  23. package/adapters/claude/skills/forge-1-prd/references/shared-conventions.md +125 -12
  24. package/adapters/claude/skills/forge-1-prd/references/stage-exit-protocol.md +358 -144
  25. package/adapters/claude/skills/forge-2-tech/SKILL.md +38 -10
  26. package/adapters/claude/skills/forge-2-tech/references/shared-conventions.md +125 -12
  27. package/adapters/claude/skills/forge-2-tech/references/stage-exit-protocol.md +358 -144
  28. package/adapters/claude/skills/forge-3-specs/SKILL.md +28 -9
  29. package/adapters/claude/skills/forge-3-specs/references/shared-conventions.md +125 -12
  30. package/adapters/claude/skills/forge-3-specs/references/spec-archetypes.md +9 -0
  31. package/adapters/claude/skills/forge-3-specs/references/stage-exit-protocol.md +358 -144
  32. package/adapters/claude/skills/forge-4-backlog/SKILL.md +39 -10
  33. package/adapters/claude/skills/forge-4-backlog/references/shared-conventions.md +125 -12
  34. package/adapters/claude/skills/forge-4-backlog/references/stage-exit-protocol.md +358 -144
  35. package/adapters/claude/skills/forge-5-loop/SKILL.md +65 -67
  36. package/adapters/claude/skills/forge-5-loop/references/agent-selection.md +116 -0
  37. package/adapters/claude/skills/forge-5-loop/references/result-reporting.md +70 -31
  38. package/adapters/claude/skills/forge-5-loop/references/runner-contract.md +18 -109
  39. package/adapters/claude/skills/forge-5-loop/references/shared-conventions.md +125 -12
  40. package/adapters/claude/skills/forge-5-loop/references/stage-exit-protocol.md +358 -144
  41. package/adapters/claude/skills/forge-6-docs/SKILL.md +59 -9
  42. package/adapters/claude/skills/forge-6-docs/references/shared-conventions.md +125 -12
  43. package/adapters/claude/skills/forge-6-docs/references/stage-exit-protocol.md +472 -0
  44. package/adapters/claude/skills/forge-fix/SKILL.md +85 -33
  45. package/adapters/claude/skills/forge-fix/references/shared-conventions.md +125 -12
  46. package/adapters/claude/skills/forge-fix/references/stage-exit-protocol.md +358 -144
  47. package/adapters/claude/skills/forge-guide/references/forge-config-schema.json +1 -1
  48. package/adapters/claude/skills/forge-guide/references/shared-conventions.md +125 -12
  49. package/adapters/claude/skills/forge-verify/SKILL.md +86 -44
  50. package/adapters/claude/skills/forge-verify/references/findings-template.md +147 -0
  51. package/adapters/claude/skills/forge-verify/references/shared-conventions.md +125 -12
  52. package/adapters/claude/skills/forge-verify/references/stage-exit-protocol.md +472 -0
  53. package/adapters/claude/skills/forge-verify/references/verification-checklists/backlog.md +97 -0
  54. package/adapters/claude/skills/forge-verify/references/verification-checklists/epic.md +80 -0
  55. package/adapters/claude/skills/forge-verify/references/verification-checklists/impl.md +48 -0
  56. package/adapters/claude/skills/forge-verify/references/verification-checklists/prd.md +31 -0
  57. package/adapters/claude/skills/forge-verify/references/verification-checklists/specs.md +66 -0
  58. package/adapters/claude/skills/forge-verify/references/verification-checklists/tech.md +35 -0
  59. package/adapters/codex/.feature-forge-bundle.json +1 -1
  60. package/adapters/codex/agents/forge-verifier.toml +1 -1
  61. package/adapters/codex/references/epic-manifest-schema.json +6 -1
  62. package/adapters/codex/references/forge-config-schema.json +1 -1
  63. package/adapters/codex/references/pipeline-state-schema.json +5 -3
  64. package/adapters/codex/references/shared-conventions.md +125 -12
  65. package/adapters/codex/references/stage-exit-protocol.md +358 -144
  66. package/adapters/codex/references/vendor-construct-inventory.md +1 -1
  67. package/adapters/codex/scripts/epic-manifest.py +459 -90
  68. package/adapters/codex/scripts/forge-bootstrap.py +57 -5
  69. package/adapters/codex/scripts/forge-session.py +4346 -201
  70. package/adapters/codex/scripts/validate-traceability.py +92 -6
  71. package/adapters/codex/skills/forge/SKILL.md +18 -11
  72. package/adapters/codex/skills/forge/references/pipeline-state-schema.json +5 -3
  73. package/adapters/codex/skills/forge/references/shared-conventions.md +125 -12
  74. package/adapters/codex/skills/forge/references/stage-exit-protocol.md +358 -144
  75. package/adapters/codex/skills/forge-0-epic/SKILL.md +8 -3
  76. package/adapters/codex/skills/forge-0-epic/references/edit-mode.md +24 -24
  77. package/adapters/codex/skills/forge-0-epic/references/pipeline-state-schema.json +5 -3
  78. package/adapters/codex/skills/forge-0-epic/references/shared-conventions.md +125 -12
  79. package/adapters/codex/skills/forge-0-epic/references/stage-exit-protocol.md +358 -144
  80. package/adapters/codex/skills/forge-1-prd/SKILL.md +39 -11
  81. package/adapters/codex/skills/forge-1-prd/references/shared-conventions.md +125 -12
  82. package/adapters/codex/skills/forge-1-prd/references/stage-exit-protocol.md +358 -144
  83. package/adapters/codex/skills/forge-2-tech/SKILL.md +38 -10
  84. package/adapters/codex/skills/forge-2-tech/references/shared-conventions.md +125 -12
  85. package/adapters/codex/skills/forge-2-tech/references/stage-exit-protocol.md +358 -144
  86. package/adapters/codex/skills/forge-3-specs/SKILL.md +28 -9
  87. package/adapters/codex/skills/forge-3-specs/references/shared-conventions.md +125 -12
  88. package/adapters/codex/skills/forge-3-specs/references/spec-archetypes.md +9 -0
  89. package/adapters/codex/skills/forge-3-specs/references/stage-exit-protocol.md +358 -144
  90. package/adapters/codex/skills/forge-4-backlog/SKILL.md +39 -10
  91. package/adapters/codex/skills/forge-4-backlog/references/shared-conventions.md +125 -12
  92. package/adapters/codex/skills/forge-4-backlog/references/stage-exit-protocol.md +358 -144
  93. package/adapters/codex/skills/forge-5-loop/SKILL.md +65 -67
  94. package/adapters/codex/skills/forge-5-loop/references/agent-selection.md +116 -0
  95. package/adapters/codex/skills/forge-5-loop/references/result-reporting.md +70 -31
  96. package/adapters/codex/skills/forge-5-loop/references/runner-contract.md +18 -109
  97. package/adapters/codex/skills/forge-5-loop/references/shared-conventions.md +125 -12
  98. package/adapters/codex/skills/forge-5-loop/references/stage-exit-protocol.md +358 -144
  99. package/adapters/codex/skills/forge-6-docs/SKILL.md +59 -9
  100. package/adapters/codex/skills/forge-6-docs/references/shared-conventions.md +125 -12
  101. package/adapters/codex/skills/forge-6-docs/references/stage-exit-protocol.md +472 -0
  102. package/adapters/codex/skills/forge-fix/SKILL.md +84 -32
  103. package/adapters/codex/skills/forge-fix/references/shared-conventions.md +125 -12
  104. package/adapters/codex/skills/forge-fix/references/stage-exit-protocol.md +358 -144
  105. package/adapters/codex/skills/forge-guide/references/forge-config-schema.json +1 -1
  106. package/adapters/codex/skills/forge-guide/references/shared-conventions.md +125 -12
  107. package/adapters/codex/skills/forge-verify/SKILL.md +85 -43
  108. package/adapters/codex/skills/forge-verify/references/findings-template.md +147 -0
  109. package/adapters/codex/skills/forge-verify/references/shared-conventions.md +125 -12
  110. package/adapters/codex/skills/forge-verify/references/stage-exit-protocol.md +472 -0
  111. package/adapters/codex/skills/forge-verify/references/verification-checklists/backlog.md +97 -0
  112. package/adapters/codex/skills/forge-verify/references/verification-checklists/epic.md +80 -0
  113. package/adapters/codex/skills/forge-verify/references/verification-checklists/impl.md +48 -0
  114. package/adapters/codex/skills/forge-verify/references/verification-checklists/prd.md +31 -0
  115. package/adapters/codex/skills/forge-verify/references/verification-checklists/specs.md +66 -0
  116. package/adapters/codex/skills/forge-verify/references/verification-checklists/tech.md +35 -0
  117. package/adapters/copilot/.feature-forge-bundle.json +1 -1
  118. package/adapters/copilot/agents/forge-verifier.md +1 -1
  119. package/adapters/copilot/references/epic-manifest-schema.json +6 -1
  120. package/adapters/copilot/references/forge-config-schema.json +1 -1
  121. package/adapters/copilot/references/pipeline-state-schema.json +5 -3
  122. package/adapters/copilot/references/shared-conventions.md +125 -12
  123. package/adapters/copilot/references/stage-exit-protocol.md +358 -144
  124. package/adapters/copilot/references/vendor-construct-inventory.md +1 -1
  125. package/adapters/copilot/scripts/epic-manifest.py +459 -90
  126. package/adapters/copilot/scripts/forge-bootstrap.py +57 -5
  127. package/adapters/copilot/scripts/forge-session.py +4346 -201
  128. package/adapters/copilot/scripts/validate-traceability.py +92 -6
  129. package/adapters/copilot/skills/forge/forge.md +18 -11
  130. package/adapters/copilot/skills/forge/references/pipeline-state-schema.json +5 -3
  131. package/adapters/copilot/skills/forge/references/shared-conventions.md +125 -12
  132. package/adapters/copilot/skills/forge/references/stage-exit-protocol.md +358 -144
  133. package/adapters/copilot/skills/forge-0-epic/forge-0-epic.md +8 -3
  134. package/adapters/copilot/skills/forge-0-epic/references/edit-mode.md +24 -24
  135. package/adapters/copilot/skills/forge-0-epic/references/pipeline-state-schema.json +5 -3
  136. package/adapters/copilot/skills/forge-0-epic/references/shared-conventions.md +125 -12
  137. package/adapters/copilot/skills/forge-0-epic/references/stage-exit-protocol.md +358 -144
  138. package/adapters/copilot/skills/forge-1-prd/forge-1-prd.md +39 -11
  139. package/adapters/copilot/skills/forge-1-prd/references/shared-conventions.md +125 -12
  140. package/adapters/copilot/skills/forge-1-prd/references/stage-exit-protocol.md +358 -144
  141. package/adapters/copilot/skills/forge-2-tech/forge-2-tech.md +38 -10
  142. package/adapters/copilot/skills/forge-2-tech/references/shared-conventions.md +125 -12
  143. package/adapters/copilot/skills/forge-2-tech/references/stage-exit-protocol.md +358 -144
  144. package/adapters/copilot/skills/forge-3-specs/forge-3-specs.md +28 -9
  145. package/adapters/copilot/skills/forge-3-specs/references/shared-conventions.md +125 -12
  146. package/adapters/copilot/skills/forge-3-specs/references/spec-archetypes.md +9 -0
  147. package/adapters/copilot/skills/forge-3-specs/references/stage-exit-protocol.md +358 -144
  148. package/adapters/copilot/skills/forge-4-backlog/forge-4-backlog.md +39 -10
  149. package/adapters/copilot/skills/forge-4-backlog/references/shared-conventions.md +125 -12
  150. package/adapters/copilot/skills/forge-4-backlog/references/stage-exit-protocol.md +358 -144
  151. package/adapters/copilot/skills/forge-5-loop/forge-5-loop.md +65 -67
  152. package/adapters/copilot/skills/forge-5-loop/references/agent-selection.md +116 -0
  153. package/adapters/copilot/skills/forge-5-loop/references/result-reporting.md +70 -31
  154. package/adapters/copilot/skills/forge-5-loop/references/runner-contract.md +18 -109
  155. package/adapters/copilot/skills/forge-5-loop/references/shared-conventions.md +125 -12
  156. package/adapters/copilot/skills/forge-5-loop/references/stage-exit-protocol.md +358 -144
  157. package/adapters/copilot/skills/forge-6-docs/forge-6-docs.md +59 -9
  158. package/adapters/copilot/skills/forge-6-docs/references/shared-conventions.md +125 -12
  159. package/adapters/copilot/skills/forge-6-docs/references/stage-exit-protocol.md +472 -0
  160. package/adapters/copilot/skills/forge-fix/forge-fix.md +84 -32
  161. package/adapters/copilot/skills/forge-fix/references/shared-conventions.md +125 -12
  162. package/adapters/copilot/skills/forge-fix/references/stage-exit-protocol.md +358 -144
  163. package/adapters/copilot/skills/forge-guide/references/forge-config-schema.json +1 -1
  164. package/adapters/copilot/skills/forge-guide/references/shared-conventions.md +125 -12
  165. package/adapters/copilot/skills/forge-verify/forge-verify.md +85 -43
  166. package/adapters/copilot/skills/forge-verify/references/findings-template.md +147 -0
  167. package/adapters/copilot/skills/forge-verify/references/shared-conventions.md +125 -12
  168. package/adapters/copilot/skills/forge-verify/references/stage-exit-protocol.md +472 -0
  169. package/adapters/copilot/skills/forge-verify/references/verification-checklists/backlog.md +97 -0
  170. package/adapters/copilot/skills/forge-verify/references/verification-checklists/epic.md +80 -0
  171. package/adapters/copilot/skills/forge-verify/references/verification-checklists/impl.md +48 -0
  172. package/adapters/copilot/skills/forge-verify/references/verification-checklists/prd.md +31 -0
  173. package/adapters/copilot/skills/forge-verify/references/verification-checklists/specs.md +66 -0
  174. package/adapters/copilot/skills/forge-verify/references/verification-checklists/tech.md +35 -0
  175. package/adapters/cursor/.feature-forge-bundle.json +1 -1
  176. package/adapters/cursor/agents/forge-verifier.mdc +1 -1
  177. package/adapters/cursor/references/epic-manifest-schema.json +6 -1
  178. package/adapters/cursor/references/forge-config-schema.json +1 -1
  179. package/adapters/cursor/references/pipeline-state-schema.json +5 -3
  180. package/adapters/cursor/references/shared-conventions.md +125 -12
  181. package/adapters/cursor/references/stage-exit-protocol.md +358 -144
  182. package/adapters/cursor/references/vendor-construct-inventory.md +1 -1
  183. package/adapters/cursor/scripts/epic-manifest.py +459 -90
  184. package/adapters/cursor/scripts/forge-bootstrap.py +57 -5
  185. package/adapters/cursor/scripts/forge-session.py +4346 -201
  186. package/adapters/cursor/scripts/validate-traceability.py +92 -6
  187. package/adapters/cursor/skills/forge/forge.mdc +18 -11
  188. package/adapters/cursor/skills/forge/references/pipeline-state-schema.json +5 -3
  189. package/adapters/cursor/skills/forge/references/shared-conventions.md +125 -12
  190. package/adapters/cursor/skills/forge/references/stage-exit-protocol.md +358 -144
  191. package/adapters/cursor/skills/forge-0-epic/forge-0-epic.mdc +8 -3
  192. package/adapters/cursor/skills/forge-0-epic/references/edit-mode.md +24 -24
  193. package/adapters/cursor/skills/forge-0-epic/references/pipeline-state-schema.json +5 -3
  194. package/adapters/cursor/skills/forge-0-epic/references/shared-conventions.md +125 -12
  195. package/adapters/cursor/skills/forge-0-epic/references/stage-exit-protocol.md +358 -144
  196. package/adapters/cursor/skills/forge-1-prd/forge-1-prd.mdc +39 -11
  197. package/adapters/cursor/skills/forge-1-prd/references/shared-conventions.md +125 -12
  198. package/adapters/cursor/skills/forge-1-prd/references/stage-exit-protocol.md +358 -144
  199. package/adapters/cursor/skills/forge-2-tech/forge-2-tech.mdc +38 -10
  200. package/adapters/cursor/skills/forge-2-tech/references/shared-conventions.md +125 -12
  201. package/adapters/cursor/skills/forge-2-tech/references/stage-exit-protocol.md +358 -144
  202. package/adapters/cursor/skills/forge-3-specs/forge-3-specs.mdc +28 -9
  203. package/adapters/cursor/skills/forge-3-specs/references/shared-conventions.md +125 -12
  204. package/adapters/cursor/skills/forge-3-specs/references/spec-archetypes.md +9 -0
  205. package/adapters/cursor/skills/forge-3-specs/references/stage-exit-protocol.md +358 -144
  206. package/adapters/cursor/skills/forge-4-backlog/forge-4-backlog.mdc +39 -10
  207. package/adapters/cursor/skills/forge-4-backlog/references/shared-conventions.md +125 -12
  208. package/adapters/cursor/skills/forge-4-backlog/references/stage-exit-protocol.md +358 -144
  209. package/adapters/cursor/skills/forge-5-loop/forge-5-loop.mdc +65 -67
  210. package/adapters/cursor/skills/forge-5-loop/references/agent-selection.md +116 -0
  211. package/adapters/cursor/skills/forge-5-loop/references/result-reporting.md +70 -31
  212. package/adapters/cursor/skills/forge-5-loop/references/runner-contract.md +18 -109
  213. package/adapters/cursor/skills/forge-5-loop/references/shared-conventions.md +125 -12
  214. package/adapters/cursor/skills/forge-5-loop/references/stage-exit-protocol.md +358 -144
  215. package/adapters/cursor/skills/forge-6-docs/forge-6-docs.mdc +59 -9
  216. package/adapters/cursor/skills/forge-6-docs/references/shared-conventions.md +125 -12
  217. package/adapters/cursor/skills/forge-6-docs/references/stage-exit-protocol.md +472 -0
  218. package/adapters/cursor/skills/forge-fix/forge-fix.mdc +84 -32
  219. package/adapters/cursor/skills/forge-fix/references/shared-conventions.md +125 -12
  220. package/adapters/cursor/skills/forge-fix/references/stage-exit-protocol.md +358 -144
  221. package/adapters/cursor/skills/forge-guide/references/forge-config-schema.json +1 -1
  222. package/adapters/cursor/skills/forge-guide/references/shared-conventions.md +125 -12
  223. package/adapters/cursor/skills/forge-verify/forge-verify.mdc +85 -43
  224. package/adapters/cursor/skills/forge-verify/references/findings-template.md +147 -0
  225. package/adapters/cursor/skills/forge-verify/references/shared-conventions.md +125 -12
  226. package/adapters/cursor/skills/forge-verify/references/stage-exit-protocol.md +472 -0
  227. package/adapters/cursor/skills/forge-verify/references/verification-checklists/backlog.md +97 -0
  228. package/adapters/cursor/skills/forge-verify/references/verification-checklists/epic.md +80 -0
  229. package/adapters/cursor/skills/forge-verify/references/verification-checklists/impl.md +48 -0
  230. package/adapters/cursor/skills/forge-verify/references/verification-checklists/prd.md +31 -0
  231. package/adapters/cursor/skills/forge-verify/references/verification-checklists/specs.md +66 -0
  232. package/adapters/cursor/skills/forge-verify/references/verification-checklists/tech.md +35 -0
  233. package/adapters/gemini/.feature-forge-bundle.json +1 -1
  234. package/adapters/gemini/agents/forge-verifier.md +1 -1
  235. package/adapters/gemini/gemini-extension.json +1 -1
  236. package/adapters/gemini/references/epic-manifest-schema.json +6 -1
  237. package/adapters/gemini/references/forge-config-schema.json +1 -1
  238. package/adapters/gemini/references/pipeline-state-schema.json +5 -3
  239. package/adapters/gemini/references/shared-conventions.md +125 -12
  240. package/adapters/gemini/references/stage-exit-protocol.md +358 -144
  241. package/adapters/gemini/references/vendor-construct-inventory.md +1 -1
  242. package/adapters/gemini/scripts/epic-manifest.py +459 -90
  243. package/adapters/gemini/scripts/forge-bootstrap.py +57 -5
  244. package/adapters/gemini/scripts/forge-session.py +4346 -201
  245. package/adapters/gemini/scripts/validate-traceability.py +92 -6
  246. package/adapters/gemini/skills/forge/forge.md +18 -11
  247. package/adapters/gemini/skills/forge/references/pipeline-state-schema.json +5 -3
  248. package/adapters/gemini/skills/forge/references/shared-conventions.md +125 -12
  249. package/adapters/gemini/skills/forge/references/stage-exit-protocol.md +358 -144
  250. package/adapters/gemini/skills/forge-0-epic/forge-0-epic.md +8 -3
  251. package/adapters/gemini/skills/forge-0-epic/references/edit-mode.md +24 -24
  252. package/adapters/gemini/skills/forge-0-epic/references/pipeline-state-schema.json +5 -3
  253. package/adapters/gemini/skills/forge-0-epic/references/shared-conventions.md +125 -12
  254. package/adapters/gemini/skills/forge-0-epic/references/stage-exit-protocol.md +358 -144
  255. package/adapters/gemini/skills/forge-1-prd/forge-1-prd.md +39 -11
  256. package/adapters/gemini/skills/forge-1-prd/references/shared-conventions.md +125 -12
  257. package/adapters/gemini/skills/forge-1-prd/references/stage-exit-protocol.md +358 -144
  258. package/adapters/gemini/skills/forge-2-tech/forge-2-tech.md +38 -10
  259. package/adapters/gemini/skills/forge-2-tech/references/shared-conventions.md +125 -12
  260. package/adapters/gemini/skills/forge-2-tech/references/stage-exit-protocol.md +358 -144
  261. package/adapters/gemini/skills/forge-3-specs/forge-3-specs.md +28 -9
  262. package/adapters/gemini/skills/forge-3-specs/references/shared-conventions.md +125 -12
  263. package/adapters/gemini/skills/forge-3-specs/references/spec-archetypes.md +9 -0
  264. package/adapters/gemini/skills/forge-3-specs/references/stage-exit-protocol.md +358 -144
  265. package/adapters/gemini/skills/forge-4-backlog/forge-4-backlog.md +39 -10
  266. package/adapters/gemini/skills/forge-4-backlog/references/shared-conventions.md +125 -12
  267. package/adapters/gemini/skills/forge-4-backlog/references/stage-exit-protocol.md +358 -144
  268. package/adapters/gemini/skills/forge-5-loop/forge-5-loop.md +65 -67
  269. package/adapters/gemini/skills/forge-5-loop/references/agent-selection.md +116 -0
  270. package/adapters/gemini/skills/forge-5-loop/references/result-reporting.md +70 -31
  271. package/adapters/gemini/skills/forge-5-loop/references/runner-contract.md +18 -109
  272. package/adapters/gemini/skills/forge-5-loop/references/shared-conventions.md +125 -12
  273. package/adapters/gemini/skills/forge-5-loop/references/stage-exit-protocol.md +358 -144
  274. package/adapters/gemini/skills/forge-6-docs/forge-6-docs.md +59 -9
  275. package/adapters/gemini/skills/forge-6-docs/references/shared-conventions.md +125 -12
  276. package/adapters/gemini/skills/forge-6-docs/references/stage-exit-protocol.md +472 -0
  277. package/adapters/gemini/skills/forge-fix/forge-fix.md +84 -32
  278. package/adapters/gemini/skills/forge-fix/references/shared-conventions.md +125 -12
  279. package/adapters/gemini/skills/forge-fix/references/stage-exit-protocol.md +358 -144
  280. package/adapters/gemini/skills/forge-guide/references/forge-config-schema.json +1 -1
  281. package/adapters/gemini/skills/forge-guide/references/shared-conventions.md +125 -12
  282. package/adapters/gemini/skills/forge-verify/forge-verify.md +85 -43
  283. package/adapters/gemini/skills/forge-verify/references/findings-template.md +147 -0
  284. package/adapters/gemini/skills/forge-verify/references/shared-conventions.md +125 -12
  285. package/adapters/gemini/skills/forge-verify/references/stage-exit-protocol.md +472 -0
  286. package/adapters/gemini/skills/forge-verify/references/verification-checklists/backlog.md +97 -0
  287. package/adapters/gemini/skills/forge-verify/references/verification-checklists/epic.md +80 -0
  288. package/adapters/gemini/skills/forge-verify/references/verification-checklists/impl.md +48 -0
  289. package/adapters/gemini/skills/forge-verify/references/verification-checklists/prd.md +31 -0
  290. package/adapters/gemini/skills/forge-verify/references/verification-checklists/specs.md +66 -0
  291. package/adapters/gemini/skills/forge-verify/references/verification-checklists/tech.md +35 -0
  292. package/adapters/pi/.feature-forge-bundle.json +1 -1
  293. package/adapters/pi/agents/forge-verifier.md +1 -1
  294. package/adapters/pi/references/epic-manifest-schema.json +6 -1
  295. package/adapters/pi/references/forge-config-schema.json +1 -1
  296. package/adapters/pi/references/pipeline-state-schema.json +5 -3
  297. package/adapters/pi/references/shared-conventions.md +125 -12
  298. package/adapters/pi/references/stage-exit-protocol.md +358 -144
  299. package/adapters/pi/references/vendor-construct-inventory.md +1 -1
  300. package/adapters/pi/scripts/epic-manifest.py +459 -90
  301. package/adapters/pi/scripts/forge-bootstrap.py +57 -5
  302. package/adapters/pi/scripts/forge-session.py +4346 -201
  303. package/adapters/pi/scripts/validate-traceability.py +92 -6
  304. package/adapters/pi/skills/forge/SKILL.md +18 -11
  305. package/adapters/pi/skills/forge/references/pipeline-state-schema.json +5 -3
  306. package/adapters/pi/skills/forge/references/shared-conventions.md +125 -12
  307. package/adapters/pi/skills/forge/references/stage-exit-protocol.md +358 -144
  308. package/adapters/pi/skills/forge-0-epic/SKILL.md +8 -3
  309. package/adapters/pi/skills/forge-0-epic/references/edit-mode.md +24 -24
  310. package/adapters/pi/skills/forge-0-epic/references/pipeline-state-schema.json +5 -3
  311. package/adapters/pi/skills/forge-0-epic/references/shared-conventions.md +125 -12
  312. package/adapters/pi/skills/forge-0-epic/references/stage-exit-protocol.md +358 -144
  313. package/adapters/pi/skills/forge-1-prd/SKILL.md +39 -11
  314. package/adapters/pi/skills/forge-1-prd/references/shared-conventions.md +125 -12
  315. package/adapters/pi/skills/forge-1-prd/references/stage-exit-protocol.md +358 -144
  316. package/adapters/pi/skills/forge-2-tech/SKILL.md +38 -10
  317. package/adapters/pi/skills/forge-2-tech/references/shared-conventions.md +125 -12
  318. package/adapters/pi/skills/forge-2-tech/references/stage-exit-protocol.md +358 -144
  319. package/adapters/pi/skills/forge-3-specs/SKILL.md +28 -9
  320. package/adapters/pi/skills/forge-3-specs/references/shared-conventions.md +125 -12
  321. package/adapters/pi/skills/forge-3-specs/references/spec-archetypes.md +9 -0
  322. package/adapters/pi/skills/forge-3-specs/references/stage-exit-protocol.md +358 -144
  323. package/adapters/pi/skills/forge-4-backlog/SKILL.md +39 -10
  324. package/adapters/pi/skills/forge-4-backlog/references/shared-conventions.md +125 -12
  325. package/adapters/pi/skills/forge-4-backlog/references/stage-exit-protocol.md +358 -144
  326. package/adapters/pi/skills/forge-5-loop/SKILL.md +65 -67
  327. package/adapters/pi/skills/forge-5-loop/references/agent-selection.md +116 -0
  328. package/adapters/pi/skills/forge-5-loop/references/result-reporting.md +70 -31
  329. package/adapters/pi/skills/forge-5-loop/references/runner-contract.md +18 -109
  330. package/adapters/pi/skills/forge-5-loop/references/shared-conventions.md +125 -12
  331. package/adapters/pi/skills/forge-5-loop/references/stage-exit-protocol.md +358 -144
  332. package/adapters/pi/skills/forge-6-docs/SKILL.md +59 -9
  333. package/adapters/pi/skills/forge-6-docs/references/shared-conventions.md +125 -12
  334. package/adapters/pi/skills/forge-6-docs/references/stage-exit-protocol.md +472 -0
  335. package/adapters/pi/skills/forge-fix/SKILL.md +84 -32
  336. package/adapters/pi/skills/forge-fix/references/shared-conventions.md +125 -12
  337. package/adapters/pi/skills/forge-fix/references/stage-exit-protocol.md +358 -144
  338. package/adapters/pi/skills/forge-guide/references/forge-config-schema.json +1 -1
  339. package/adapters/pi/skills/forge-guide/references/shared-conventions.md +125 -12
  340. package/adapters/pi/skills/forge-verify/SKILL.md +85 -43
  341. package/adapters/pi/skills/forge-verify/references/findings-template.md +147 -0
  342. package/adapters/pi/skills/forge-verify/references/shared-conventions.md +125 -12
  343. package/adapters/pi/skills/forge-verify/references/stage-exit-protocol.md +472 -0
  344. package/adapters/pi/skills/forge-verify/references/verification-checklists/backlog.md +97 -0
  345. package/adapters/pi/skills/forge-verify/references/verification-checklists/epic.md +80 -0
  346. package/adapters/pi/skills/forge-verify/references/verification-checklists/impl.md +48 -0
  347. package/adapters/pi/skills/forge-verify/references/verification-checklists/prd.md +31 -0
  348. package/adapters/pi/skills/forge-verify/references/verification-checklists/specs.md +66 -0
  349. package/adapters/pi/skills/forge-verify/references/verification-checklists/tech.md +35 -0
  350. package/package.json +1 -1
  351. package/adapters/claude/skills/forge-1-prd/references/pipeline-state-schema.json +0 -191
  352. package/adapters/claude/skills/forge-2-tech/references/pipeline-state-schema.json +0 -191
  353. package/adapters/claude/skills/forge-3-specs/references/pipeline-state-schema.json +0 -191
  354. package/adapters/claude/skills/forge-4-backlog/references/forge-config-schema.json +0 -236
  355. package/adapters/claude/skills/forge-4-backlog/references/pipeline-state-schema.json +0 -191
  356. package/adapters/claude/skills/forge-5-loop/references/forge-config-schema.json +0 -236
  357. package/adapters/claude/skills/forge-6-docs/references/pipeline-state-schema.json +0 -191
  358. package/adapters/claude/skills/forge-verify/references/pipeline-state-schema.json +0 -191
  359. package/adapters/claude/skills/forge-verify/references/verification-checklists.md +0 -477
  360. package/adapters/codex/skills/forge-1-prd/references/pipeline-state-schema.json +0 -191
  361. package/adapters/codex/skills/forge-2-tech/references/pipeline-state-schema.json +0 -191
  362. package/adapters/codex/skills/forge-3-specs/references/pipeline-state-schema.json +0 -191
  363. package/adapters/codex/skills/forge-4-backlog/references/forge-config-schema.json +0 -236
  364. package/adapters/codex/skills/forge-4-backlog/references/pipeline-state-schema.json +0 -191
  365. package/adapters/codex/skills/forge-5-loop/references/forge-config-schema.json +0 -236
  366. package/adapters/codex/skills/forge-6-docs/references/pipeline-state-schema.json +0 -191
  367. package/adapters/codex/skills/forge-verify/references/pipeline-state-schema.json +0 -191
  368. package/adapters/codex/skills/forge-verify/references/verification-checklists.md +0 -477
  369. package/adapters/copilot/skills/forge-1-prd/references/pipeline-state-schema.json +0 -191
  370. package/adapters/copilot/skills/forge-2-tech/references/pipeline-state-schema.json +0 -191
  371. package/adapters/copilot/skills/forge-3-specs/references/pipeline-state-schema.json +0 -191
  372. package/adapters/copilot/skills/forge-4-backlog/references/forge-config-schema.json +0 -236
  373. package/adapters/copilot/skills/forge-4-backlog/references/pipeline-state-schema.json +0 -191
  374. package/adapters/copilot/skills/forge-5-loop/references/forge-config-schema.json +0 -236
  375. package/adapters/copilot/skills/forge-6-docs/references/pipeline-state-schema.json +0 -191
  376. package/adapters/copilot/skills/forge-verify/references/pipeline-state-schema.json +0 -191
  377. package/adapters/copilot/skills/forge-verify/references/verification-checklists.md +0 -477
  378. package/adapters/cursor/skills/forge-1-prd/references/pipeline-state-schema.json +0 -191
  379. package/adapters/cursor/skills/forge-2-tech/references/pipeline-state-schema.json +0 -191
  380. package/adapters/cursor/skills/forge-3-specs/references/pipeline-state-schema.json +0 -191
  381. package/adapters/cursor/skills/forge-4-backlog/references/forge-config-schema.json +0 -236
  382. package/adapters/cursor/skills/forge-4-backlog/references/pipeline-state-schema.json +0 -191
  383. package/adapters/cursor/skills/forge-5-loop/references/forge-config-schema.json +0 -236
  384. package/adapters/cursor/skills/forge-6-docs/references/pipeline-state-schema.json +0 -191
  385. package/adapters/cursor/skills/forge-verify/references/pipeline-state-schema.json +0 -191
  386. package/adapters/cursor/skills/forge-verify/references/verification-checklists.md +0 -477
  387. package/adapters/gemini/skills/forge-1-prd/references/pipeline-state-schema.json +0 -191
  388. package/adapters/gemini/skills/forge-2-tech/references/pipeline-state-schema.json +0 -191
  389. package/adapters/gemini/skills/forge-3-specs/references/pipeline-state-schema.json +0 -191
  390. package/adapters/gemini/skills/forge-4-backlog/references/forge-config-schema.json +0 -236
  391. package/adapters/gemini/skills/forge-4-backlog/references/pipeline-state-schema.json +0 -191
  392. package/adapters/gemini/skills/forge-5-loop/references/forge-config-schema.json +0 -236
  393. package/adapters/gemini/skills/forge-6-docs/references/pipeline-state-schema.json +0 -191
  394. package/adapters/gemini/skills/forge-verify/references/pipeline-state-schema.json +0 -191
  395. package/adapters/gemini/skills/forge-verify/references/verification-checklists.md +0 -477
  396. package/adapters/pi/skills/forge-1-prd/references/pipeline-state-schema.json +0 -191
  397. package/adapters/pi/skills/forge-2-tech/references/pipeline-state-schema.json +0 -191
  398. package/adapters/pi/skills/forge-3-specs/references/pipeline-state-schema.json +0 -191
  399. package/adapters/pi/skills/forge-4-backlog/references/forge-config-schema.json +0 -236
  400. package/adapters/pi/skills/forge-4-backlog/references/pipeline-state-schema.json +0 -191
  401. package/adapters/pi/skills/forge-5-loop/references/forge-config-schema.json +0 -236
  402. package/adapters/pi/skills/forge-6-docs/references/pipeline-state-schema.json +0 -191
  403. package/adapters/pi/skills/forge-verify/references/pipeline-state-schema.json +0 -191
  404. package/adapters/pi/skills/forge-verify/references/verification-checklists.md +0 -477
@@ -7,24 +7,19 @@ alwaysApply: false
7
7
 
8
8
  # forge-5-loop — Autonomous Loop Executor
9
9
 
10
- Execute the autonomous coding loop against a forge feature's backlog. The loop
11
- spawns a fresh agent session per backlog item, implementing each task with full
12
- verification.
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.
13
11
 
14
- The loop **runner** is configured, not hardcoded. feature-forge talks to it
15
- through the `loopRunner` block in `forge.config.json`; rauf is the default and
16
- reference implementation (see `references/ralph-loop-contract.md`). Every command
17
- below is rendered from `loopRunner` with token substitution — there are no
18
- hardcoded `rauf …` commands in this skill, and even the human log filename is
19
- 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 — there are no hardcoded `rauf …` commands in this skill, and even the human log filename is tokenized as `{loopRunner.logFile}`.
20
13
 
21
14
  ## Resolve the loop runner
22
15
 
23
- Read `forge.config.json`. Build the effective `loopRunner` by taking its
24
- `loopRunner` block (if present) and filling any missing field from the defaults
25
- in `references/forge-config-schema.json`. **If `forge.config.json` has no
26
- `loopRunner` block at all, state plainly: "No loopRunner configured — defaulting
27
- to the rauf loop runner."** then proceed with the full default block.
16
+ Resolve the effective `loopRunner` with the command below — it merges this project's `loopRunner` block over the schema defaults deterministically, so do not read the config schema for defaults. **If `forge.config.json` has no `loopRunner` block at all, state plainly: "No loopRunner configured — defaulting to the rauf loop runner."** then proceed with the full default block, which is exactly what the call returns. If the call exits 2, surface the plain `Error:` line from stderr verbatim and fall back to the documented rauf defaults.
17
+
18
+ ```bash
19
+ R="$(bash -c 'for d in "${FEATURE_FORGE_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')"
20
+ [ -n "$R" ] || { echo "feature-forge: cannot locate plugin root" >&2; exit 1; }
21
+ python3 "$R/scripts/forge-session.py" effective-config --config ./forge.config.json --json
22
+ ```
28
23
 
29
24
  Token substitution applies to every `*Command` string. Substitute:
30
25
 
@@ -33,8 +28,7 @@ Token substitution applies to every `*Command` string. Substitute:
33
28
  - `{specsDir}` → `specsDir` from config
34
29
  - `{iterations}` → the computed iteration count (Step 2a)
35
30
 
36
- Whenever this skill says "run the **run command**" / "**status command**" /
37
- etc., it means the corresponding substituted `loopRunner.*Command`.
31
+ Whenever this skill says "run the **run command**" / "**status command**" / etc., it means the corresponding substituted `loopRunner.*Command`.
38
32
 
39
33
  **Turn structure reminder:** Output analysis/context as text, then route ALL questions through the host's question mechanism. Never embed questions in text output — the user will not be prompted and the session will stall.
40
34
 
@@ -50,9 +44,14 @@ Read `{resolvedFeatureDir}/.pipeline-state.json`. If not in force mode, `stages.
50
44
 
51
45
  ### 1b. Verification Check
52
46
 
53
- Check if `stages.forge-verify-backlog` exists and has status `passed` or `findings-applied`. If not, use the host's question mechanism to warn with the cost of skipping:
47
+ 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):
54
48
 
55
- "Backlog hasn't been verified yet. Recommended: run `/feature-forge:forge-verify {feature}` first — the loop implements items autonomously and commits as it goes, so a bad item (wrong scope, missing dependency, untestable acceptance criteria) is far cheaper to catch now than after several commits build on it. Continue anyway?" Offer **Verify first (recommended)** · **Continue without verifying**.
49
+ 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 the host's question mechanism 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 the host's question mechanism 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
+ 4. **Anything else** (absent, `pending`, `skipped`, `findings-reported`) — use the host's question mechanism 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
+
54
+ Cases 3 and 4 offer the same choices: **Verify first (recommended)** · **Continue without verifying**. The proceed-anyway path is unchanged.
56
55
 
57
56
  ### 1b-epic. Epic Dependency Gate
58
57
 
@@ -162,34 +161,34 @@ Backlog summary:
162
161
  - Iterations: {iterationCount} ({activeItems} items x {loopIterationMultiplier} multiplier)
163
162
 
164
163
  For the model-selection precedence (item.model > --model/options > project default >
165
- provider default) and the full optional-flags catalog, read references/runner-contract.md.
164
+ provider default), read references/runner-contract.md.
166
165
  ```
167
166
 
168
- **Run mode (gated on `loopRunner.name == "rauf"`).** When the runner is rauf, add a **"Run mode"** question to this same the host's question mechanism surface with these options **in this exact order** (do NOT improvise — deterministic ordering is the point): **(1) "Run with review pass (recommended)"** — append `--review`, and this is the default; **(2) "Run without review"** — the bare rendered command; **(3, only when 2a counted blocked items) "Review + retry blocked"** — append `--review --retry-blocked`. the host's question mechanism's built-in "Other" covers ad-hoc flags (`--model`/`--timeout`); add no separate open-ended option. The command line shown above renders `--review` (the recommended default). **When the runner is not rauf**, add NO Run-mode question — present the bare rendered command and let the user adjust via "Other" (byte-identical to today). Verbatim option labels: `## Run mode (Step 2d, rauf)` in `references/runner-contract.md`.
169
-
170
- For the full loop-runner contract — event-stream vs. log-fallback launch, the live-supervision/monitor rules, and the model-selection precedence — read `references/runner-contract.md`. Whichever Run-mode option (or "Other") the user picks, append its flags to the rendered run command before Step 3.
167
+ **Run mode and full loop-runner contract:** follow `## Run mode (Step 2d, rauf)` and the remaining sections in `references/runner-contract.md` verbatim.
171
168
 
172
169
  #### Agent selection (gated on `loopRunner.agentArgument`)
173
170
 
174
- **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/runner-contract.md`; read it. When the gate is on, augment Step 2d in order:
171
+ **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:
175
172
 
176
173
  - **(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).
177
174
  - **(b) Agent question.** Add an **"agent"** question to the same the host's question mechanism 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).
178
175
  - **(c) Availability listing.** From the **same** parsed `agents[]` (no second probe), list `id` / `displayName` / available (`yes`/`no`, `detail` on unavailable rows).
179
176
  - **(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`, the host's question mechanism 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.
180
- - **(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 the host's question mechanism (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/runner-contract.md`.
181
- - **(e) Optional-flags line.** Augment the confirmation block's closing flags/precedence pointer to list `--agent <id>` first plus the agent precedence pointer (`item.provider > --agent > project defaultAgent > runner default`) alongside the model precedence.
177
+ - **(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 the host's question mechanism (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`.
178
+ - **(e) Optional-flags line.** Augment the confirmation block's closing flags/precedence pointer to list `--agent <id>` first plus the agent precedence pointer (`item.provider > --agent > project defaultAgent > runner default`) alongside the model precedence; the full catalog is `## Optional flags catalog (Step 2d, rauf)` in `references/agent-selection.md`.
182
179
  - **(f) Resolved-agent line.** Add to the confirmation block: `Agent: {resolved.agent or claude-cli} (source: {sourceLabel})` — `sourceLabel`: `RUN` → `"per-run selection"`, `PROJECT` → `"project default (loopRunner.defaultAgent)"`, `DEFAULT` → `"runner default — claude-cli"`.
183
180
 
184
181
  ## Step 3: Execute the Loop
185
182
 
186
183
  ### 3a. Update Pipeline State
187
184
 
188
- Before launching, update `{resolvedFeatureDir}/.pipeline-state.json`:
189
- - Set `stages.forge-5-loop.status` to `in-progress`
190
- - Set `stages.forge-5-loop.startedAt` to current ISO timestamp
191
- - Set `currentStage` to `forge-5-loop`
192
- - Update `updatedAt`
185
+ Before launching, record the pre-launch marker by running `state-enter` — one atomic write that sets `stages.forge-5-loop.status` to `in-progress`, `stages.forge-5-loop.startedAt` to the current ISO timestamp, `currentStage` to `forge-5-loop`, and refreshes `updatedAt`. Add `--epic "{epic}"` when this feature is an epic member — required, per the Pipeline State Protocol in `references/shared-conventions.md`:
186
+
187
+ ```bash
188
+ R="$(bash -c 'for d in "${FEATURE_FORGE_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')"
189
+ [ -n "$R" ] || { echo "feature-forge: cannot locate plugin root" >&2; exit 1; }
190
+ python3 "$R/scripts/forge-session.py" state-enter --feature "{feature}" --stage forge-5-loop --specs-dir "{specsDir}"
191
+ ```
193
192
 
194
193
  Then commit this state write before launching (mandatory). The runner refuses to run with uncommitted changes (*"…pass --force"*), and this marker is itself one — so an otherwise-clean repo fails its first launch unless committed. Commit it via the shared-conventions **Git Commit Protocol** (epic members: stage `{specsDir}/{epic}/`): `{commitPrefix}({feature}): forge-5-loop in-progress` — a launch precondition, required regardless of `gitCommitAfterStage`. Unrelated leftover changes still trip the refusal; surface it, never auto-pass `--force`. See `references/runner-contract.md`.
195
194
 
@@ -199,13 +198,7 @@ Launch the loop **backgrounded** (the host's background-execution mechanism) so
199
198
 
200
199
  ### 3c. Inform User
201
200
 
202
- Tell the user the run has started and that **this session is now actively
203
- supervising it** — they don't need to babysit a terminal — and surface the rendered
204
- `loopRunner` monitoring commands (`statusCommand` / `followCommand` / `logCommand` /
205
- `listCommand`) and the state-file locations under
206
- `{backlogDir}/{loopRunner.stateDir}/` so they can watch directly if they like. The
207
- verbatim "Loop started…" inform-user output template is in
208
- `references/runner-contract.md`.
201
+ Follow the **Inform-user output template (Step 3c)** section of `references/runner-contract.md` — it carries this step's instruction and the verbatim "Loop started…" template.
209
202
 
210
203
  ### 3d. Arm a Monitor on the event stream, and react to events
211
204
 
@@ -228,11 +221,7 @@ rules, read `references/runner-contract.md`.
228
221
 
229
222
  ### 3f. Reach completion
230
223
 
231
- Step 4 is reached when the backgrounded process exits (its completion notification is
232
- authoritative); the `loop_completed` / `loop_error` / `loop_cancelled` event is the live
233
- heads-up that it's imminent. Stop the Monitor (it ends on its own when `tail` sees the
234
- process-ended log, or via `TaskStop`) and proceed to Step 4. Do NOT foreground-sleep
235
- or poll — the harness drives both the Monitor events and the completion notification.
224
+ Step 4 is reached when the backgrounded process exits (its completion notification is authoritative); the `loop_completed` / `loop_error` / `loop_cancelled` event is the live heads-up that it's imminent. Stop the Monitor (it ends on its own when `tail` sees the process-ended log, or via `TaskStop`) and proceed to Step 4. Do NOT foreground-sleep or poll — the harness drives both the Monitor events and the completion notification.
236
225
 
237
226
  ## Step 4: Check Results
238
227
 
@@ -249,49 +238,58 @@ is not configured. You will already have most of this from the live tally in 3e.
249
238
  ### 4b. Report Results
250
239
 
251
240
  Present a summary to the user. Pick **every** branch that applies (a run can be both
252
- blocked and needs-human) and render its report. The five verbatim result-report
253
- output templates — **all-done**, **needs-human**, **blocked**, **deferred**, and
254
- **pending** (iteration limit reached) — are in `references/result-reporting.md`.
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.
255
242
 
256
243
  ## Step 5: Update Pipeline State
257
244
 
258
- Update `{resolvedFeatureDir}/.pipeline-state.json`:
245
+ Record completion by running `state-complete` (below). Evaluate "all backlog items are `done`" yourself and pass the result as `--status`: `complete` if every item is `done`, else `in-progress`. The verb records `completedAt`, the version, `basedOnVersions` and `artifacts`, and refreshes `updatedAt`. Add `--epic "{epic}"` when this feature is an epic member — required, per the Pipeline State Protocol.
259
246
 
260
- 1. Set `stages.forge-5-loop`: `status` = `"complete"` if all backlog items are `done`, else `"in-progress"`; `completedAt` = current ISO timestamp (only if complete); `basedOnVersions` = `{"forge-4-backlog": <current version from pipeline state>}`; `artifacts` = `["{backlogDir}/{loopRunner.stateDir}/state.json"]`.
261
- 2. If all items complete: set `currentStage` to `"forge-6-docs"`
262
- 3. Update `updatedAt`
247
+ ```bash
248
+ R="$(bash -c 'for d in "${FEATURE_FORGE_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')"
249
+ [ -n "$R" ] || { echo "feature-forge: cannot locate plugin root" >&2; exit 1; }
250
+ python3 "$R/scripts/forge-session.py" state-complete --feature "{feature}" --stage forge-5-loop --version {n} --status "<complete|in-progress>" --based-on "forge-4-backlog=<current version from pipeline state>" --artifact "{backlogDir}/{loopRunner.stateDir}/state.json" --specs-dir "{specsDir}"
251
+ ```
263
252
 
264
253
  **No git commit is needed** — the loop runner commits implementation code atomically per completed item during the run. (Step 6's commit, epic members only, is of pipeline state / manifest — a distinct artifact.)
265
254
 
266
255
  ## Step 5b: Offer Impl-Verify (standalone path)
267
256
 
268
- **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** — partial runs end as today, 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 the host's question mechanism (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**, hand off to `/feature-forge:forge-verify {feature} impl`. On **skip**, record `stages.forge-verify-impl.status` as `"skipped"` (mirrors `forge-4-backlog`'s skip handling) and point the user at `/feature-forge:forge-6-docs {feature}` — the forge-6-docs backstop re-surfaces the skip.
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 the host's question mechanism (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.
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.
260
+
261
+ ```bash
262
+ R="$(bash -c 'for d in "${FEATURE_FORGE_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')"
263
+ [ -n "$R" ] || { echo "feature-forge: cannot locate plugin root" >&2; exit 1; }
264
+ python3 "$R/scripts/forge-session.py" state-verify --feature "{feature}" --stage forge-5-loop --status skipped --specs-dir "{specsDir}"
265
+ ```
269
266
 
270
267
  ## Step 6: Epic Handoff
271
268
 
272
- **Gate:** only run this step if (a) the resolved feature's `.pipeline-state.json` has an `epic` key **and** (b) Step 5 set `stages.forge-5-loop.status` to `complete` (all backlog items done). If either is false, **skip** — standalone completed features are handled by Step 5b, and partial runs end as today (REQ-COMPAT-01).
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).
273
270
 
274
- 1. **Offer impl-verify first (recommended, skippable).** Per the completion rule (`00-core-definitions.md §7`), a feature whose `forge-verify-impl.status == findings-reported` does **not** unblock dependents. Use the host's question mechanism (NOT inline prose) to offer: *"{feature}'s loop is done. Recommended: run `/feature-forge:forge-verify {feature} impl` before unblocking dependents. Run it now, or skip and continue the handoff?"* The user may skip (then completion is judged on the §7 rule with impl-verify absent).
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 the host's question mechanism (NOT inline prose) to offer: *"{feature}'s loop is done. Recommended: run `/feature-forge:forge-verify {feature} impl` before unblocking dependents. Run it now, or skip and continue the handoff?"* 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.
275
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.
276
- 3. **Identify the next actionable feature(s).** Read `render-status`'s `actionable` set (every dependency now complete, not itself complete) and `nextCommand`. **None actionable:** say so — if `rollup.total > 0` **AND** `rollup.complete == rollup.total`, suggest `/feature-forge:forge-6-docs {feature}` and note the epic-level documentation offer (§10) (the `rollup.total > 0` guard prevents an **empty epic** `0 == 0` from reading as complete); otherwise list what is still blocked and on which dependencies, then end (do not prompt to start a feature that cannot start). **One or more actionable:** use the host's question mechanism presenting **each actionable feature** as an option (plus "stop here"). Execution is **serial** — the user picks exactly one (REQ-ORCH-03); do **not** autonomously chain into the next pipeline.
277
- 4. **Begin the chosen feature.** **PRD absent** (no `PRD.md`, or `stages.forge-1-prd` not complete): offer to author it now — "Start `/feature-forge:forge-1-prd {chosen}`?" (REQ-ORCH-02); on yes, hand off to forge-1-prd (which injects epic context per §5.1). **PRD present:** point the user at the chosen feature's `nextCommand` from render-status.
278
- 5. **Commit (REQ-OBS-01).** When `gitCommitAfterStage` is true, commit the Step 5 completion write (and any manifest `updatedAt` bump) via the shared-conventions **Git Commit Protocol**, staging the epic subtree so the member state change commits atomically: `git add {specsDir}/{epic}/` then `{commitPrefix}({feature}): complete loop`. If `gitCommitAfterStage` is false, skip the commit.
279
- 6. **Close the handoff with the Stage Exit Protocol.** Finishing feature `{feature}` → starting the picked feature `{chosen}`'s PRD is a **cold** stage boundary (single-sourced in `references/stage-exit-protocol.md`). Feature `{feature}`'s impl-verify was already offered in Step 6.1, so step 1's gate self-suppresses when it ran or was skipped — the block collapses to clear your session / start a fresh session → next-command. Present it only when the chosen feature's PRD is absent (a PRD-present pick just runs its `nextCommand`):
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
+ 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.
280
275
 
281
- **This stage is done — walk the user through the Stage Exit Protocol** before moving on. The order is fixed, and step 2 is something only the user can do:
276
+ ## Step 7: Close the Stage
282
277
 
283
- 1. **Verify feature {feature}'s loop first — if it isn't already verified.** If verify already ran in this session — via the in-stage auto-verify on the authoring stages, or the interactive impl-verify offered above on the loop — or is already fresh on record, or the stage was explicitly skipped, say so and go straight to step 2. Only when `autoVerify` is off for this stage **and** verify is **missing or stale** do you present the **Standard Verify Gate**: verify **now, before clearing**, using the host's question mechanism with exactly these three options — but only when the host has a question mechanism **and** the clean-room path is available (the host's subagent mechanism plus a dispatchable `forge-verifier` subagent):
284
- - **Verify feature {feature}'s loop now** *(recommended)* — dispatch the clean-room `forge-verifier` subagent from this session in require-clean mode; the digest returns here so any fix decision keeps its context. One-time — it does **not** change config.
285
- - **Verify now + enable auto-verify going forward** — verify now **and** patch `"autoVerify": true` into `forge.config.json` in place (preserve formatting and every other key) so future stages verify automatically, no prompt. This complements the `forge-init` opt-in. **Do not auto-commit this config change** — treat it like `notes`: a user-facing edit the user commits on their own cadence, never folded into a stage's artifact commit.
286
- - **Skip for now** — go straight to clear your session / start a fresh session and the next command without verifying. Record this stage's verify status as `"skipped"` in pipeline state (mirroring the existing skip handling) **only** on an explicit skip — a skip does not go stale.
278
+ Every loop run ends here, and ends here **exactly once** — standalone or epic member, complete or not.
287
279
 
288
- **Host / clean-room fallback (not a user-selectable option):** if the question mechanism, the host's subagent mechanism, or the `forge-verifier` subagent is unavailable, do **not** run clean-room — degrade to printing `/feature-forge:forge-verify {feature} impl` for the user to run inline/manually (mirroring `autoInvokeNextStage`), and offer the auto-verify enable as plain text only if a config write is possible.
289
- 2. **Then clear your session / start a fresh session.** Recommended **unconditionally** at this boundary for a clean start — independent of how full the context window is. Every artifact is on disk, so the work survives the clear. **I can't clear your session / start a fresh session for you — you have to run it yourself.**
290
- 3. **Then run the next command** in the fresh session — or re-run `/feature-forge:forge` to let the navigator resume from disk:
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.
291
281
 
292
- ```
293
- /feature-forge:forge-1-prd {chosen}
294
- ```
282
+ **Close this stage with the Scripted Stage Exit** (contract: `references/stage-exit-protocol.md`; do not improvise a "Next steps" list). Run:
283
+
284
+ ```bash
285
+ R="$(bash -c 'for d in "${FEATURE_FORGE_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')"
286
+ [ -n "$R" ] || { echo "feature-forge: cannot locate plugin root" >&2; exit 1; }
287
+ python3 "$R/scripts/forge-session.py" stage-exit --feature "{feature}" --stage forge-5-loop --outcome "{LoopOutcome}" --specs-dir "{specsDir}" --host generic --verify-capability "{verify-capability}"
288
+ ```
289
+
290
+ Obey the DIRECTIVES it prints, in the consumption order this protocol fixes: surface `invalidAutoVerifyKeys` and every `warnings` entry first; `runInStageVerify: true` → run the in-stage clean-room verify chain now (honoring `autoFixEligible`, and asking through the Standard Verify Gate first when you may not dispatch unsolicited); `verifyGate: "standard"` → present the Standard Verify Gate; `verifyGate: "manual-print"` → print the `verifyCommand` for the user and do **not** dispatch inline. Then, and only when `terminalOwnedBy` is `"self"`, **print the NEXT-STEPS block verbatim as your absolute last output — nothing after its sentinel line.** A `terminalOwnedBy: "outer"` payload carries `nextSteps: null`: return your structured result to the caller and print no terminal block at all.
291
+
292
+ Add `--epic "{epic}"` when this feature is an epic member — required, per the Pipeline State Protocol in `references/shared-conventions.md`. Determine `{verify-capability}` per the **Host and capability determination** section of `references/stage-exit-protocol.md`: `interactive` needs both a question mechanism and *permission* to dispatch the clean-room `forge-verifier`, and a session that merely needs consent first is still `interactive`. The script owns the routing for every outcome — the loop resume, the navigator recovery, the docs handoff, and the epic's live next member — so append nothing to its block: no retry line, no rollup restated, no "continue to docs". A non-`complete` outcome deliberately fences no downstream work, and re-adding one here would claim readiness the backlog does not support.
295
293
 
296
294
  ## Gotchas
297
295
 
@@ -0,0 +1,116 @@
1
+ # forge-5-loop — Agent Selection (Step 2d, conditional)
2
+
3
+ The agent-selection surface, its Claude-only model-alias guard, and the optional-
4
+ flags catalog. Loaded ONLY when `loopRunner.agentArgument` is present (the Step 2d
5
+ capability gate); when the gate is off, Step 2d is byte-identical to today and this
6
+ file is never read.
7
+
8
+ ## Agent selection (Step 2d)
9
+
10
+ This section is **parallel** to `## Model selection precedence` in
11
+ `references/runner-contract.md`: it governs which **coding agent** rauf drives for the
12
+ run. The entire surface is
13
+ **presence-gated** on `loopRunner.agentArgument` — when that field is absent or
14
+ empty, there is no selector, no probe, and no `{agent}` substitution, and Step 2d /
15
+ Step 3c are byte-identical to today (capability gate;
16
+ `02-config-schema-and-gating.md`, REQ-PLUG-02). The rest assumes the gate is on.
17
+
18
+ **Precedence (highest wins):**
19
+
20
+ ```
21
+ item.provider > --agent (run selection) > loopRunner.defaultAgent (project) > runner default (claude-cli)
22
+ ```
23
+
24
+ **Run-layer mapping — why forge never re-implements rauf's resolver.** forge owns
25
+ **only** its run and project layers and collapses them into **one** value
26
+ (`resolve()`: `run_selection or defaultAgent or none`), which it emits as a single
27
+ `--agent {agent}` occupying rauf's **run layer only**. rauf alone resolves
28
+ item-vs-run via its own 5-layer resolver, sitting the per-item `BacklogItem.provider`
29
+ **above** forge's run layer — so a run selection can never clobber a deliberate
30
+ per-item agent. forge **never reads, writes, or overrides** `BacklogItem.provider`
31
+ (REQ-AGENT-05). When forge sends nothing (the default path), rauf applies its own
32
+ default `claude-cli`, byte-identical to today. Empty/whitespace selections are
33
+ treated as unset, and an explicit pick of the runner default id collapses to the
34
+ default path (append nothing, run no probe). See
35
+ `03-selection-resolution-observability.md §3–§4`.
36
+
37
+ **Availability pre-check + disambiguation.** For a **non-default** resolved id only,
38
+ forge runs `loopRunner.agentsProbeCommand` **once** (no retries) and classifies the
39
+ id by **membership** in the advertised set (`{ row.id for row in agents }`), then the
40
+ matching row's `available` flag — **never** by exit code, because `rauf agents
41
+ --json` always exits 0 (an unknown id is simply absent; a known-unavailable one is
42
+ present with `available: false`):
43
+
44
+ - **UNKNOWN** (`∉` advertised set): hard-reject **before any loop side-effect**,
45
+ listing the sorted valid ids; **no proceed-anyway**; the value never interpolates
46
+ into `{agent}` (the advertised set IS the allow-list — REQ-SEC-01).
47
+ - **UNAVAILABLE** (member, `available == False`): warn with the row's `detail`, then
48
+ offer **proceed-anyway OR choose-another** — never silent.
49
+ - **AVAILABLE** (member, `available == True`): proceed; the validated id fills
50
+ `{agent}`.
51
+ - **Probe failure** (non-zero exit / unparseable / wrong shape / empty `agents[]` /
52
+ row missing `id`): surface it and offer **choose-another OR abort**; never launch
53
+ the non-default agent unvalidated, never silently fall back to the default.
54
+
55
+ The default / `claude-cli` path runs **no** probe (zero extra cost). See
56
+ `04-availability-precheck.md` for the full pre-check, classification, and allow-list,
57
+ and `02-config-schema-and-gating.md` for the capability gate.
58
+
59
+ > **Probe false-negative for Claude Code installs (advisory).** `rauf agents` may
60
+ > report `claude-cli` **unavailable** (e.g. *"credentials file not found:
61
+ > ~/.config/claude-code/credentials.json"*) even when a working `claude` CLI
62
+ > authenticates elsewhere — the probe's credential heuristic doesn't cover every
63
+ > install. This is a rauf probe concern, not something forge-5-loop fixes. The
64
+ > **default-agent path skips the probe entirely**, so an ordinary default run is
65
+ > unaffected; only an **explicit** `--agent claude-cli` would be flagged UNAVAILABLE,
66
+ > and the existing **proceed-anyway** path (above) covers it. Do not attempt to
67
+ > patch rauf's probe from here.
68
+
69
+ ### Claude-only model-alias guard (Step 2d, sub-step d-model)
70
+
71
+ When the resolved agent is **non-default** (not the default / `claude-cli` path),
72
+ forge must guard against a backlog whose items pin **Claude-specific** model aliases.
73
+ forge-4-backlog (via the rauf author-backlog skill) writes Claude tier aliases
74
+ (`opus` / `sonnet`) into each item's `model`. Because rauf's precedence puts
75
+ `item.model` **above** `--agent`, the alias is forwarded verbatim to the selected
76
+ agent; a non-Claude agent (e.g. codex) then 400s — *"The 'sonnet' model is not
77
+ supported when using Codex with a ChatGPT account."* — so **every** spawn exits 1 and
78
+ rauf reports *"Circuit breaker: 3 consecutive infra failures — halting"* with no hint
79
+ of the real cause. forge-5-loop therefore detects Claude-specific `model` aliases in
80
+ the backlog (tier aliases `opus`/`sonnet`/`haiku` or `claude-*` ids) and, before
81
+ launch, **warns** and offers (via `AskUserQuestion`) to **strip `model` for this run**
82
+ (remove the key from each affected item so each spawn uses the agent's own default) or
83
+ **proceed as-is**. forge only ever touches the `model` field — never `provider`. The
84
+ default / `claude-cli` path skips this guard (the aliases are valid there).
85
+
86
+ > **Follow-up (out of scope here — rauf repo).** The durable fix would be for the
87
+ > rauf `author-backlog` skill to keep `model` **provider-neutral** by default (or to
88
+ > document that writing a tier alias binds the backlog to Claude agents). That lives
89
+ > in the separate rauf plugin/repo, not feature-forge; tracked as a follow-up.
90
+ >
91
+ > **Follow-up (out of scope here — rauf repo).** The durable fix for the root/sandbox
92
+ > refusal (see "Root/sandbox env guard" under
93
+ > `## Launch detail (Step 3b — background process)` in `references/runner-contract.md`)
94
+ > is for **rauf itself** to honor
95
+ > `IS_SANDBOX` when it launches `claude --dangerously-skip-permissions` as root (or to
96
+ > detect root+flag-refused and emit a clear error instead of an opaque circuit-break).
97
+ > feature-forge's launch-time export is the mitigation; the upstream fix lives in the
98
+ > rauf plugin/repo. Track as a follow-up.
99
+
100
+ ## Optional flags catalog (Step 2d, rauf)
101
+
102
+ These are the optional flags the user may add to the rendered run command. If the
103
+ user requests additional flags, append them to the rendered run command.
104
+
105
+ ```
106
+ --agent <id> Coding agent rauf drives this run (see `## Agent selection` above).
107
+ Only the runner's advertised ids are valid; an unknown id is
108
+ rejected before launch. Shown only when the runner advertises
109
+ an agent surface (loopRunner.agentArgument present).
110
+ --review Run a review pass after all iterations (extra agent session)
111
+ --model <model> Override the model (see `## Model selection precedence` in
112
+ `references/runner-contract.md`)
113
+ --timeout <min> Per-session timeout in minutes (default: 60)
114
+ --retry-blocked Unblock and retry previously blocked items
115
+ ```
116
+
@@ -1,32 +1,31 @@
1
- # forge-5-loop — Step 4b Result-Report Templates
1
+ # forge-5-loop — Result Reports and Loop-Outcome Selection
2
2
 
3
- These are the five verbatim result-report output templates for **Step 4b** of
4
- `forge-5-loop/SKILL.md`. Pick **every** branch that applies (a run can be both
5
- blocked and needs-human) and render its report.
3
+ This file carries two things for `forge-5-loop/SKILL.md`:
6
4
 
7
- **All items done.** Print the completion summary, then close with the **warm-acceptable
8
- variant** of the Stage Exit Protocol (single-sourced in
9
- `references/stage-exit-protocol.md`) — the `forge-5-loop → forge-6-docs` boundary is the
10
- one place where clearing before the next stage is optional:
11
- ```
12
- Loop completed for {feature}. All {N} items implemented successfully.
13
- ```
5
+ 1. the verbatim **result-report templates** for **Step 4b** — factual counts only; and
6
+ 2. the deterministic **`LoopOutcome` ladder** for **Step 7**, which picks the single
7
+ value the scripted stage exit is invoked with.
14
8
 
15
- **The loop is complete — this is the one boundary where clearing before the next stage is optional.**
9
+ The reports describe what the run did. They never carry a next command, a retry
10
+ command, or a "continue to docs" suggestion: routing is the scripted stage exit's
11
+ job, and a loop run emits exactly **one** `stage-exit` invocation and **one**
12
+ terminal block.
16
13
 
17
- 1. **Verify is already offered above.** Impl-verify is offered interactively right after this report (Step 5b for a standalone feature, Step 6.1 for an epic member) — run it there rather than as a second gate. It runs clean-room, so it needs no fresh session.
18
- 2. **Clearing is optional here — warm is fine.** `forge-6-docs` benefits from the still-warm context of what the loop actually did, so continuing in this same session is the easy default. A cold start also works — every artifact is on disk — but there is no need to force it.
19
- 3. **Then run the next command** — in this warm session, or a fresh one if you prefer:
14
+ ## Result reports (Step 4b)
20
15
 
21
- ```
22
- /feature-forge:forge-6-docs {feature}
23
- ```
16
+ Pick **every** branch that applies — a run can be both blocked and needs-human — and
17
+ render its report. These are descriptive; none of them ends the turn.
18
+
19
+ **All items done.**
20
+ ```
21
+ Loop completed for {feature}. All {N} items implemented successfully.
22
+ ```
24
23
 
25
24
  **Runner review pass.** A review flag (e.g. rauf's `--review`) makes the runner run
26
25
  a post-loop review that **auto-creates and implements fix items** rather than handing
27
26
  findings to the user — distinct from `forge-verify impl` (a clean-context audit that
28
27
  writes a findings doc). When Step 4a captured a `review_completed` event, add a line
29
- **above** "Next steps" so the pass's effect is visible and not mistaken for "nothing
28
+ below the counts so the pass's effect is visible and not mistaken for "nothing
30
29
  happened":
31
30
  ```
32
31
  Runner review pass: {itemsCreated} fix item(s) created and implemented.
@@ -43,10 +42,6 @@ Loop completed for {feature}.
43
42
 
44
43
  These items asked a question the loop couldn't answer:
45
44
  - {id}: {title} — {reason}
46
-
47
- Resolve, then retry:
48
- - Answer the question(s) above, then re-run `/feature-forge:forge-5-loop {feature}`
49
- (add --retry-blocked to pick the set-aside items back up).
50
45
  ```
51
46
 
52
47
  **Some items blocked:**
@@ -59,10 +54,7 @@ Blocked items:
59
54
  - {id}: {title}
60
55
  - {id}: {title}
61
56
 
62
- Options:
63
- - Re-run with --retry-blocked to retry blocked items
64
- - Review blocked items manually: {bin} backlog show . {id} --backlog {backlogDir}
65
- - Continue to docs if blocking items are non-critical
57
+ Inspect one with: {bin} backlog show . {id} --backlog {backlogDir}
66
58
  ```
67
59
 
68
60
  **Some items deferred (runner gave up after retries — "false blocks"):**
@@ -70,8 +62,6 @@ Options:
70
62
  Loop completed for {feature}.
71
63
  Completed: {done}/{total}
72
64
  Deferred: {deferred} items (no signal after retries — likely just need another pass)
73
-
74
- Re-run `/feature-forge:forge-5-loop {feature}` to retry deferred items.
75
65
  ```
76
66
 
77
67
  **Some items still pending (iteration limit reached):**
@@ -80,6 +70,55 @@ Loop completed for {feature}.
80
70
  Completed: {done}/{total}
81
71
  Pending: {pending} items (iteration limit reached)
82
72
  Blocked: {blocked} items
83
-
84
- Re-run `/feature-forge:forge-5-loop {feature}` to continue with remaining items.
85
73
  ```
74
+
75
+ ## Selecting the one `LoopOutcome` (Step 7)
76
+
77
+ After Step 5's `state-complete`, select exactly **one** `LoopOutcome` from Step 4a's
78
+ authoritative final counts. Walk this ladder in order and stop at the first match:
79
+
80
+ 1. **`needs-human`** — `needsHuman > 0`. This wins even when blocked items also
81
+ exist: a decision only a human can make outranks work that merely could not
82
+ proceed.
83
+ 2. **`blocked`** — otherwise, genuine `blocked > 0`.
84
+ 3. **`deferred`** — otherwise, runner-deferred items exist (the "false blocks" the
85
+ runner gave up on after retries).
86
+ 4. **`partial`** — otherwise, `pending`/`in_progress` items remain because the
87
+ iteration limit was reached.
88
+ 5. **`complete`** — otherwise, and **only** when every item is `done`.
89
+
90
+ This is a priority order, not a set. A run reporting both a needs-human and a blocked
91
+ count renders both reports above and still exits `needs-human`.
92
+
93
+ **The runner's process exit code is not the outcome.** A loop runner that exits 0 has
94
+ reported only that its process finished; the final backlog state decides. A clean
95
+ exit 0 that still leaves pending items is `partial`, never `complete` — and
96
+ `complete` is legitimate only when the counts show every item `done`.
97
+
98
+ **Retrying the non-complete outcomes.** `partial` and `deferred` fence the loop
99
+ resume; `blocked` and `needs-human` fence the navigator. Whichever you land on, the
100
+ runner's own retry flags still apply to the next run — e.g. rauf's `--retry-blocked`
101
+ picks the set-aside blocked and deferred items back up at Step 2d. Mention that as
102
+ plain prose in the report if it helps; never as a second command block.
103
+
104
+ ## Operational failure before the counts are known
105
+
106
+ If the run cannot produce authoritative counts at all — the status/list command fails,
107
+ its output does not parse, the state directory is gone, or the process died in a way
108
+ that leaves the backlog unreadable — **do not pick an outcome and do not close the
109
+ stage.** There is nothing to select from, and guessing one would record a pipeline
110
+ position that never happened.
111
+
112
+ Instead: say plainly what failed, show the command's own output, and name the
113
+ recovery (re-run the status command, or re-run the loop once the runner is healthy).
114
+ Emit no `stage-exit` invocation and no terminal block. The stage stays `in-progress`
115
+ on disk, which is exactly the state the navigator can resume from.
116
+
117
+ ## Closing the stage
118
+
119
+ Pass the selected value to the single scripted stage exit in **Step 7** of
120
+ `forge-5-loop/SKILL.md` as `--outcome {LoopOutcome}`, and print its NEXT-STEPS block
121
+ verbatim as the absolute last output. Append nothing after it — no summary, no retry
122
+ line, no docs suggestion. For a completed epic member, the exit consumes the epic's
123
+ live status itself, so announce the rollup **before** invoking it and add no
124
+ hand-authored handoff of your own afterwards.