@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
@@ -8,28 +8,27 @@ description: Apply fixes from the most recent forge-verify findings document. Us
8
8
 
9
9
  Apply fixes from the most recent forge-verify findings document, with step-level tracking for crash recovery.
10
10
 
11
- Usually invoked by the user, but an **`autoFix` caller** may also invoke this skill automatically
12
- when `autoFix: true` is configured **and** its preconditions hold (the findings document has zero
13
- unresolved decision points, the working tree is clean, and a mandatory re-verify passes afterward).
14
- Two callers drive that chain: an **authoring stage's in-stage auto-verify** (the primary path — see
15
- `references/stage-exit-protocol.md`, the in-stage verify block) and the **`/feature-forge:forge`
16
- navigator's catch-up** (§3b). The **fix application** below is identical either way — this skill is
17
- not "auto-aware" about *applying* findings; it always applies the latest findings document. The
18
- **caller** owns the gating decisions, including the closing re-verify: the Step 6 gate is presented
19
- **only on a direct invocation**, because under an `autoFix` chain the caller (stage skill or
20
- navigator) runs the mandatory re-verify itself.
11
+ Usually invoked by the user. An **`autoFix` caller** may also dispatch this skill automatically when `autoFix: true` is configured **and** its preconditions hold (the findings document has zero unresolved decision points, the working tree is clean, and a mandatory re-verify passes afterward). Two callers drive that chain: an **authoring stage's in-stage auto-verify** (the primary path — see `references/stage-exit-protocol.md`, the in-stage verify block) and the **`/feature-forge:forge` navigator's catch-up** (§3b). The **fix application** below is identical either way — this skill is not "auto-aware" about *applying* findings; it always applies the selected findings document. What differs is **branch ownership**, and ownership is read from the literal `owner:` token described under Prerequisites, never inferred from how the invocation happened to be phrased.
21
12
 
22
13
  ## Prerequisites
23
14
 
24
15
  Read and follow `references/shared-conventions.md` for feature name validation, configuration reading, and force mode handling before proceeding.
25
16
 
17
+ **Ownership.** Determine branch ownership **at entry**, from the literal `owner: nested` / `owner: direct` token in the prompt that dispatched you. **Absent the token you are `direct`** — a user-typed `/feature-forge:forge-fix` is the only path that carries no dispatcher. Judge the token, never the phrasing of the invocation. Preserve that value unchanged through any re-verify and pass it straight through as `--owner` in Step 7. A **direct** fix stays the terminal owner through its optional re-verify; a **nested** fix invokes nested verify and returns its structured result to the outer stage, printing no terminal block at all. `references/stage-exit-protocol.md` § "Branch ownership: the `owner:` token" owns this rule.
18
+
26
19
  **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.
27
20
 
28
- ## Step 1: Locate Findings Document
21
+ ## Step 1: Locate Findings and Establish the Served Stage
29
22
 
30
23
  1. Read `forge.config.json` for `specsDir` (default: `./specs`)
31
24
  2. Resolve the feature directory via the **Feature Directory Resolution** block in `references/shared-conventions.md` (a standalone feature resolves to its flat `{specsDir}/{feature}/` path exactly as today; an epic member resolves to its nested path). Then find the most recent `VERIFY-*-*.md` file in `{resolvedFeatureDir}/.verification/`.
32
- 3. If no findings document exists, tell the user: "No verification findings found. Run `/feature-forge:forge-verify {feature}` first."
25
+ 3. **Establish the served production stage before any mutation**, in this order:
26
+ - An explicit `--served-stage {stage}` argument on this invocation is authoritative — that is what `forge-verify` and the scripted exit pass when they route here.
27
+ - Otherwise read it from the **selected report's own mode/header**: the `{mode}` in its `VERIFY-{mode}-{YYYY-MM-DD}.md` name together with the mode recorded in the report header, mapped as `epic` → `forge-0-epic`, `prd` → `forge-1-prd`, `tech` → `forge-2-tech`, `specs` → `forge-3-specs`, `backlog` → `forge-4-backlog`, `impl` → `forge-5-loop`.
28
+ - If both are present and disagree, fail closed rather than picking one.
29
+ - Never derive the served stage from conversational context, from `currentStage`, or from whichever feature stage happens to be newest. The report you are applying decides which stage this diversion serves.
30
+ 4. **An unestablishable served stage is a fail-closed error, not a guess.** If a report exists but its mode is missing, malformed, or ambiguous (for example two same-day reports for different modes, or a header whose mode does not match the filename) and no explicit `--served-stage` was supplied, mutate nothing: list the reports you found and tell the user to re-invoke as `/feature-forge:forge-fix {feature} --served-stage {stage}` or to re-run `/feature-forge:forge-verify {feature} {stage}`. Stop there — with no served stage there is no stage to close against, so do not run Step 7.
31
+ 5. **No applicable findings → `no-findings`.** If `.verification/` holds no findings document, or none whose steps still apply, the outcome is `no-findings`: mutate nothing and take the served stage from **authoritative pipeline state** — the production stage whose `stages.forge-verify-*` entry is unresolved (`findings-reported`, `findings-applied`, `auto-verify-pending`, or `pending`) — then close through Step 7. If no verification is outstanding either, there is nothing for this pass to serve: tell the user "No verification findings found. Run `/feature-forge:forge-verify {feature}` first." and stop without closing a stage.
33
32
 
34
33
  ## Step 2: Parse Fix Execution Plan
35
34
 
@@ -44,6 +43,8 @@ If the "User Decisions Required" section has unresolved items:
44
43
  2. Wait for answers before proceeding
45
44
  3. Record decisions in the findings document under the "User Decisions Required" section (mark each as resolved)
46
45
 
46
+ If any decision is still unresolved when you stop — the user deferred it, the question mechanism was unavailable, or no answer arrived — do **not** apply the steps that depend on it. Close with `decisions` in Step 7: that is the specific outcome for unanswered decisions, it never advances the pipeline, and its resume action names the unresolved work. A user who explicitly defers the **whole fix pass** is `deferred` instead; an operational failure that is not merely an unanswered decision is `failed` (Step 7).
47
+
47
48
  ## Step 4: Execute Fix Steps
48
49
 
49
50
  For each step in the "Execution Steps" section, in order:
@@ -56,35 +57,86 @@ For each step in the "Execution Steps" section, in order:
56
57
  ```
57
58
  - Step {N}: [APPLIED] {date} — {short summary of what was done}
58
59
  ```
59
- 6. If a step fails or produces unexpected results, STOP. Report the issue to the user. Do not continue to dependent steps.
60
+ 6. If a step fails or produces unexpected results, STOP. Report the issue to the user. Do not continue to dependent steps. Any applied step stays recorded in `## Fix Progress` so a later run resumes rather than repeats, and this run closes with `failed` in Step 7 — no advancement.
61
+
62
+ **Shipped comments state intent, never measurement (anti-churn).** A fix pass writes **no empirical or quantified claims** into comments, docstrings, or test narration — no "measured", "probed and confirmed", no counts of what was checked, no blanket claims over enumerated cases. Every such claim is a fresh falsifiable surface for the next verify round; a chain of them is exactly how a fix loop stops converging. Shipped prose states what the code intends and what constraint binds it. The evidence — what was probed, how, with what result — belongs in the findings document's `## Fix Progress` entry (and the commit message), which are the sanctioned records for acceptance evidence.
63
+
64
+ ## Step 5: Record the Fixes Through `state-verify` and Commit
65
+
66
+ Never hand-author a verify entry, and never write a `verifiedStageVersion` value by hand. Record the fix pass with the `state-verify` verb described in the **Pipeline State Protocol** in `references/shared-conventions.md`, which owns its full flag surface, its status matrix, and the exit-2 failure protocol. `--stage` names the **served production stage** established in Step 1. `findings-applied` deliberately **clears** `verifiedStageVersion` and refuses `--verified-stage-version`: applying fixes is not verifying them, so the served stage's verification stays outstanding until a re-verify passes. Add `--epic "{epic}"` when the feature is an epic member — required, per the Pipeline State Protocol; omitting it for a member is an error and must never fall back to a same-named flat feature.
60
67
 
61
- ## Step 5: Update Pipeline State and Commit
68
+ ```bash
69
+ 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')"
70
+ [ -n "$R" ] || { echo "feature-forge: cannot locate plugin root" >&2; exit 1; }
71
+ python3 "$R/scripts/forge-session.py" state-verify \
72
+ --feature "{feature}" --stage "{servedStage}" --status findings-applied \
73
+ --specs-dir "{specsDir}"
74
+ ```
62
75
 
63
- Follow the Git Commit Protocol in `references/shared-conventions.md`.
76
+ Then follow the Git Commit Protocol in `references/shared-conventions.md`. If `gitCommitAfterStage` is true, stage files (`git add {resolvedFeatureDir}/` — or `{specsDir}/{epic}/` for an epic member so the member-state change commits atomically with the epic subtree) and commit with message `"{commitPrefix}({feature}): apply {mode} verification fixes"`. That is Commit 1, and the write above already recorded `commitHash: null` for it.
64
77
 
65
- 1. Update `{resolvedFeatureDir}/.pipeline-state.json`:
66
- - Set the relevant `forge-verify-*` entry status to `findings-applied`
67
- - Record `fixedAt` timestamp
68
- - Record `verifiedStageVersion` = the current `version` of the production stage entry
69
- this verify covers (e.g. fixing `tech` findings → `stages["forge-2-tech"].version`).
70
- This keeps the navigator's freshness ledger accurate after a fix, so the verified
71
- stage reads as `fresh` and auto-verify does not needlessly re-fire on an unchanged
72
- artifact. (If the fix itself bumped the production stage's `version`, use the new
73
- value so the ledger reflects what was actually verified/fixed.)
74
- 2. If `gitCommitAfterStage` is true, follow the Git Commit Protocol: stage files (`git add {resolvedFeatureDir}/` — or `{specsDir}/{epic}/` for an epic member so the member-state change commits atomically with the epic subtree), attempt commit with message `"{commitPrefix}({feature}): apply {mode} verification fixes"` (writing `commitHash: null` in that commit), then record the artifact-commit hash via the protocol's two-commit follow-up (never `--amend`) only on success.
78
+ **Two-commit provenance — never `--amend`.** Record the provenance of Commit 1 in a second `state-verify` call, passing the **full 40-character** hash — an abbreviation is refused rather than expanded, and this call touches nothing but `commitHash`. Add `--epic "{epic}"` when the feature is an epic member — required, per the Pipeline State Protocol.
79
+
80
+ ```bash
81
+ 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')"
82
+ [ -n "$R" ] || { echo "feature-forge: cannot locate plugin root" >&2; exit 1; }
83
+ python3 "$R/scripts/forge-session.py" state-verify \
84
+ --feature "{feature}" --stage "{servedStage}" \
85
+ --commit-hash "$(git rev-parse HEAD)" --specs-dir "{specsDir}"
86
+ ```
87
+
88
+ On exit 2 **nothing was recorded**: surface the `Error:` line verbatim together with the named feature (and epic), do not claim the fixes were persisted, and close with `failed` in Step 7 — the verify entry is unchanged, so no success block may be printed. A failed validation or a failed commit is `failed` for the same reason.
75
89
 
76
90
  ## Step 6: Re-verify Gate
77
91
 
78
- Fixes are applied and recorded (`findings-applied`), so the stage reads **fresh** in the navigator's ledger (Step 5 set `verifiedStageVersion` to the current version). A re-verify is nonetheless the only thing that *confirms* the fixes actually resolved the findings, so on a **direct/manual** `forge-fix` invocation, **prompt** it rather than leaving it as a passive suggestion — this is the same **Standard Verify Gate** the stage skills stamp (`references/stage-exit-protocol.md`).
92
+ Fixes are applied and recorded as `findings-applied`. That status makes **no** claim of freshness: the writer clears `verifiedStageVersion`, so the served stage's verification stays **outstanding** in the navigator's ledger, and only a re-verify that passes resolves it. Because a re-verify is the one thing that confirms the fixes actually resolved the findings, on a **direct** invocation **prompt** for it rather than leaving it as a passive suggestion — this is the same **Standard Verify Gate** the stage skills stamp (`references/stage-exit-protocol.md`).
93
+
94
+ **A nested owner presents no gate.** Return your structured result (served stage, outcome `applied`, findings file, steps applied) to the outer caller — it performs the mandatory re-verify itself — and print no terminal block of your own. This follows from the `owner:` token read at entry; it is never decided by how the invocation was phrased.
95
+
96
+ On a **direct** invocation, present the gate with the host's question mechanism using these three options — but only when your verify capability is `interactive` (Step 7):
97
+ - **Re-verify {feature} now** *(recommended)* — dispatch the clean-room `forge-verifier` subagent from this session in require-clean mode to confirm every finding is resolved. The dispatch is **scoped** per "Re-verify scope and convergence" in `references/stage-exit-protocol.md`: it confirms the prior report's findings against their acceptance evidence and examines this fix's delta — never a fresh full-checklist sweep — a finding with a recorded decision is never re-filed, and only an unresolved prior finding or a new blocking defect the fix introduced may block. The digest returns here so any remaining issue keeps its context. One-time — it does **not** change config. A clean-or-advisory-only result closes as `reverified`; unresolved prior findings or new blocking defects close as `reverify-findings` for the same served stage. **Escalation:** if that would be the second consecutive `reverify-findings` for this served stage (count the round-discriminated reports in `.verification/`), follow "Escalation (the round ledger)" in `references/stage-exit-protocol.md` before closing — present the digest and offer explicit acceptance of the residual findings; do not recommend another fix pass.
98
+ - **Re-verify now + enable auto-verify going forward** — re-verify now **and** patch `"autoVerify": true` into `forge.config.json` in place (preserve formatting and every other key) so future stages verify automatically, no prompt. This complements the `forge-init` opt-in. **Do not auto-commit this config change** — treat it like `notes`: a user-facing edit the user commits on their own cadence, never folded into a stage's artifact commit. Its outcome mapping is identical to the option above.
99
+ - **Skip for now** — an explicit deferral of the re-verify. It closes as **`deferred`**, never `reverified`: the fixes are recorded but nothing has confirmed them, and the served stage's verification stays outstanding until a re-verify passes, so the pipeline does not advance on this pass. Run `/feature-forge:forge {feature}` when you want pipeline status.
100
+
101
+ **Manual capability is not a skip, and not a deferral.** When your capability is `manual` (Step 7 — no question mechanism **and** no permitted dispatch), do not run clean-room and do not fabricate a choice nobody made: close with `applied`, and the script prints `/feature-forge:forge-verify {feature} --served-stage {servedStage}` as the primary action for the user to run. Offer the auto-verify enable as plain text only if a config write is possible.
102
+
103
+ **A re-verify that cannot run is an operational failure.** If the user chose to re-verify and the dispatch is refused, returns the `CLEAN_ROOM_UNAVAILABLE` sentinel, or returns no answer, the fixes remain recorded but nothing was confirmed: close with `failed`. Never report `reverified` on an unrun verify, and never treat an unavailable tool as an explicit user skip.
104
+
105
+ ## Step 7: Close the Stage
106
+
107
+ **Ownership.** Pass the `owner: nested` / `owner: direct` value read at entry (absent the token: `direct`) straight through as `--owner`. As a **direct** owner you print the script's NEXT-STEPS block verbatim as your absolute final output, with nothing after its sentinel line. As a **nested** owner the payload carries `terminalOwnedBy: "outer"` and `nextSteps: null`: return your structured result to the caller and print no terminal block at all.
108
+
109
+ **Served stage.** Pass the stage established in Step 1 as `--served-stage`, so every branch command carries the diversion's thread forward. Never re-derive it here.
110
+
111
+ **Capability.** Determine `--verify-capability` before running the exit (full rule: `references/stage-exit-protocol.md`; summary: **Verify Capability** in `references/shared-conventions.md`). Pass `interactive` only when a question mechanism equivalent to the host's question mechanism is available **and** a clean-room `forge-verifier` may actually be dispatched right now; otherwise pass `manual`. Dispatch capability means **permitted** dispatch, not a listed tool — the test is "may I dispatch `forge-verifier` right now", not "is a dispatch tool in my tool surface". A session that bars *unsolicited* dispatch while offering a question mechanism is therefore **`interactive`, not `manual`**: the gate's affirmative choice is the user request that authorizes the dispatch. An auto-verify or re-verify directive under a no-unsolicited-dispatch bar is presented through the Step 6 gate and dispatched on the affirmative choice — never skipped, and never resolved by closing with an outcome that advances the pipeline.
112
+
113
+ **Outcome.** Invoke the exit **exactly once**, with the `--outcome` this run maps to. Every path lands on exactly one row; none may be left open:
114
+
115
+ | This run's result | `--outcome` | Authoritative action |
116
+ |---|---|---|
117
+ | No applicable findings document or steps (Step 1.5) | `no-findings` | Re-verify while verification is still owed; otherwise the live production successor |
118
+ | User decisions remain unresolved (Step 3) | `decisions` | Resume `forge-fix` naming the unresolved decisions; no advancement |
119
+ | A fix step, a validation, a commit, or a state write failed (Steps 4–6) | `failed` | Fix/navigator recovery; no advancement |
120
+ | Fixes persisted and re-verify has not been run (nested, or manual capability) | `applied` | Re-run `forge-verify` for the same served stage — re-verification is mandatory |
121
+ | A mandatory re-verify passed | `reverified` | The live production successor |
122
+ | A mandatory re-verify reported an unresolved prior finding or a new blocking defect (a clean-or-advisory-only result is `reverified`) | `reverify-findings` | `forge-fix` for the same served stage |
123
+ | The user explicitly deferred the fix pass or the re-verify (Steps 3, 6) | `deferred` | Deterministic `forge-fix`/navigator resume stating the findings remain unresolved; no advancement |
124
+
125
+ A cancellation, an unavailable tool, or a non-answer is `deferred` **only** when it was an explicit user choice and `failed` when it was an operational failure — an unavailable tool is never an explicit user skip, and neither ever becomes `reverified`. `applied` is not `reverified`: `findings-applied` cleared the freshness the writer deliberately dropped, so only `reverified` after a passing verify permits advancement.
126
+
127
+ **Round-ledger escalation binds this row on every capability.** Before closing `reverify-findings` that is the SECOND consecutive for this served stage (count the round-discriminated reports in `.verification/`), present the escalation dispositions per "Escalation (the round ledger)" in `references/stage-exit-protocol.md` — through the question mechanism when `interactive`, or printed as text (digest + the three dispositions, "Accept the residual findings" first) BEFORE the terminal block when `manual`. Never recommend another fix pass at this point.
128
+
129
+ Add `--epic "{epic}"` when the feature is an epic member. Pass no other flags.
79
130
 
80
- **Skip this gate when an `autoFix` caller invoked you as part of a chain** — the authoring stage's in-stage auto-verify (`references/stage-exit-protocol.md`, in-stage verify block) or the navigator's catch-up (`skills/forge/SKILL.md` §3b step 2b): there the caller owns the mandatory re-verify, so a second gate here would block the unattended flow or double the re-verify. Just return and let the caller proceed.
131
+ **Close this stage with the Scripted Stage Exit** (contract: `references/stage-exit-protocol.md`; do not improvise a "Next steps" list). Run:
81
132
 
82
- On a direct invocation, present the gate using the host's question mechanism with these three options — but only when the host has a question mechanism **and** the clean-room path is available (the host's subagent mechanism plus a dispatchable `forge-verifier` subagent):
83
- - **Re-verify {feature} now** *(recommended)* — dispatch the clean-room `forge-verifier` subagent from this session in require-clean mode to confirm every finding is resolved; the digest returns here so any remaining issue keeps its context. One-time — it does **not** change config.
84
- - **Re-verify now + enable auto-verify going forward** — re-verify now **and** patch `"autoVerify": true` into `forge.config.json` in place (preserve formatting and every other key) so future stages verify automatically, no prompt. This complements the `forge-init` opt-in. **Do not auto-commit this config change** — treat it like `notes`: a user-facing edit the user commits on their own cadence, never folded into a stage's artifact commit.
85
- - **Skip for now** — proceed without re-verifying; the fixes are already recorded, so the stage stays `findings-applied` (fresh in the ledger). Run `/feature-forge:forge {feature}` when you want pipeline status.
133
+ ```bash
134
+ 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')"
135
+ [ -n "$R" ] || { echo "feature-forge: cannot locate plugin root" >&2; exit 1; }
136
+ python3 "$R/scripts/forge-session.py" stage-exit --feature "{feature}" --stage forge-fix --owner "{owner}" --outcome "{FixOutcome}" --served-stage "{servedStage}" --specs-dir "{specsDir}" --host generic --verify-capability "{verify-capability}"
137
+ ```
86
138
 
87
- **Host / clean-room fallback (not a user-selectable option):** if the question mechanism, the host's subagent mechanism, or the `forge-verifier` subagent is unavailable, do **not** run clean-room — degrade to printing `/feature-forge:forge-verify {feature}` for the user to run inline/manually (mirroring `autoInvokeNextStage`), and offer the auto-verify enable as plain text only if a config write is possible.
139
+ 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.
88
140
 
89
141
  ---
90
142
 
@@ -133,6 +133,8 @@ mkdir -p "<specsDir>"
133
133
  If the host is Claude (the `AskUserQuestion` tool is available), also ensure the Claude-framed variant:
134
134
 
135
135
  ```bash
136
+ 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')"
137
+ [ -n "$R" ] || { echo "feature-forge: cannot locate plugin root" >&2; exit 1; }
136
138
  [ -f "<specsDir>/CLAUDE.md" ] || cp "$R/references/templates/specs-hygiene/CLAUDE.md" "<specsDir>/CLAUDE.md"
137
139
  ```
138
140
 
@@ -183,7 +185,49 @@ If the helper is unavailable (a non-Claude host without the resolver), skip this
183
185
 
184
186
  ## Pipeline State Protocol
185
187
 
186
- Write pipeline state conforming to `references/pipeline-state-schema.json`. Always update `updatedAt` when modifying pipeline state.
188
+ Pipeline state is written by the `state-*` verbs of `scripts/forge-session.py` — never by hand. Each verb writes `{resolvedFeatureDir}/.pipeline-state.json` atomically, conforms to `references/pipeline-state-schema.json` by construction, and refreshes `updatedAt` for you, so no stage needs to read the schema in order to author state.
189
+
190
+ **Epic members MUST pass `--epic`.** Every `state-*` verb takes an optional `--epic "{epic}"`, and it is **required** whenever the feature is an epic member (its resolved directory is `{specsDir}/{epic}/{feature}/`, i.e. its state carries an `epic` back-pointer) — append it to **every** `state-*` call in this file and in every skill body, exactly as the `state-ecr` calls already do. Omit it only for a standalone feature. Without it the verb resolves the bare name itself and, mirroring `epic-manifest.py resolve`, refuses with exit 2 whenever more than one directory carries a state file rather than guessing which feature to write — so a same-named standalone feature can never be mutated in a member's place.
191
+
192
+ 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
+
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.
195
+
196
+ ### `state-verify` — verification results and provenance
197
+
198
+ `state-verify` writes exactly one `stages.forge-verify-{token}` entry — the verification result for the production stage named by `--stage` — plus the top-level `updatedAt`, and nothing else. `--stage` takes the **served production stage** (`forge-0-epic` through `forge-5-loop`; `forge-6-docs` has no verification token and is rejected). Add `--epic "{epic}"` when the feature is an epic member — required, per the member rule above. Result mode passes `--status` (`auto-verify-pending`, `passed`, `findings-reported`, `findings-applied`, or `skipped`) with whatever `--findings-file`, `--findings-count`, and `--verified-stage-version` that status requires; contradictory metadata is refused before any write. `passed` may additionally carry `--findings-file` + `--findings-count` together for an **advisory-only** report (`inconsistency`/`improvement` findings only, per forge-verify's severity floor) — the stage resolves without a fix round and the report stays attached:
199
+
200
+ **`auto-verify-pending` is not a skill-facing status.** It is written by `stage-exit`'s scheduling boundary, which records the debt automatically when auto-verify is effective for a stage. The value is accepted on this CLI so the entry stays inspectable and repairable, not so a skill can hand-schedule verification: no skill body and no reference passes it, and none should. Every other status in the list is the recorded *result* of a verification that ran (or was explicitly skipped); this one records that one was *owed*.
201
+
202
+ ```bash
203
+ 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')"
204
+ [ -n "$R" ] || { echo "feature-forge: cannot locate plugin root" >&2; exit 1; }
205
+ python3 "$R/scripts/forge-session.py" state-verify \
206
+ --feature "{feature}" --stage "{served-production-stage}" --status "<status>" \
207
+ --specs-dir "{specsDir}"
208
+ ```
209
+
210
+ Provenance follows the same two-commit sequence as `state-complete`: the result transition above writes `commitHash: null`, Commit 1 records the findings document and the state, and a second `state-verify` call records the full 40-hex hash of Commit 1 and touches nothing else (never `--amend`; an abbreviated hash is refused rather than expanded). Add `--epic "{epic}"` for an epic member — required, per the member rule above:
211
+
212
+ ```bash
213
+ 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')"
214
+ [ -n "$R" ] || { echo "feature-forge: cannot locate plugin root" >&2; exit 1; }
215
+ python3 "$R/scripts/forge-session.py" state-verify \
216
+ --feature "{feature}" --stage "{served-production-stage}" \
217
+ --commit-hash "$(git rev-parse HEAD)" --specs-dir "{specsDir}"
218
+ ```
219
+
220
+ Epic-scoped verification is the single exception to the member rule: with `--stage forge-0-epic`, `--feature` names the **epic** and `--epic` must be absent or exactly equal to it. That call writes `{specsDir}/{epic}/.epic-state.json` and never a member's `.pipeline-state.json`, and its freshness version is the epic manifest's `revision`, never a member's stage version:
221
+
222
+ ```bash
223
+ 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')"
224
+ [ -n "$R" ] || { echo "feature-forge: cannot locate plugin root" >&2; exit 1; }
225
+ python3 "$R/scripts/forge-session.py" state-verify \
226
+ --feature "{epic}" --stage forge-0-epic --status "<status>" \
227
+ --specs-dir "{specsDir}"
228
+ ```
229
+
230
+ On exit 2 the verification result is **not** recorded: surface the `Error:` line verbatim, name the feature (and epic), and do not claim the verification was persisted or advance past it.
187
231
 
188
232
  ### Staleness Detection (Read-Time)
189
233
 
@@ -193,6 +237,31 @@ When loading upstream artifacts as prerequisites, check `basedOnVersions` in the
193
237
 
194
238
  Frame the choice with its cost: re-running re-derives this stage from the current upstream (safest, but discards any hand-edits to this stage's artifacts); proceeding stale is faster but risks baking outdated assumptions into everything downstream. Recommend re-running unless the user knows the upstream change doesn't affect this stage.
195
239
 
240
+ ## Immediate Downstream Note (Parking Lot)
241
+
242
+ When an interview raises a concern that belongs to a *later stage of this same feature*, acknowledge it and persist it **immediately, at the moment it is raised** — not at stage closure — by running `state-note` with a concise one-line statement of the concern. Add `--epic "{epic}"` when this feature is an epic member — required, per the Pipeline State Protocol above; omitting it for a member is an error and must never be allowed to fall back to a same-named flat feature.
243
+
244
+ ```bash
245
+ 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')"
246
+ [ -n "$R" ] || { echo "feature-forge: cannot locate plugin root" >&2; exit 1; }
247
+ python3 "$R/scripts/forge-session.py" state-note \
248
+ --feature "{feature}" --note "<concise downstream concern>" \
249
+ --specs-dir "{specsDir}"
250
+ ```
251
+
252
+ `state-note` **overwrites** the single top-level `notes` string — it does not append. To preserve an earlier note, read the current `notes` value out of the feature's `.pipeline-state.json` first and pass one combined concise string in a single `--note`; never edit or round-trip the JSON by hand. This interview-time call is separate from the optional completion note offered at stage closure and must not be deferred until then — a session that ends before closure would otherwise lose the concern entirely.
253
+
254
+ On `UsageError`/exit 2, surface the `Error:` line verbatim together with the named feature (and epic) and the recovery instruction, and **stop claiming the concern was recorded** — it was not. Epic *decomposition* changes are not notes: they go through `state-ecr` into `epicChangeRequests`, never into `notes`.
255
+
256
+ ## Verify Capability
257
+
258
+ Skills that close a stage pass `--verify-capability interactive|manual` to `stage-exit`. The full determination rule, the Standard Verify Gate, and the recovery path live in `references/stage-exit-protocol.md`; the two facts that are most often gotten wrong:
259
+
260
+ - **Dispatch capability is *permitted* dispatch, not a listed tool.** The question is "**may I dispatch `forge-verifier` right now**", not "is a subagent-dispatch tool in my tool surface". A session can carry a standing host instruction against dispatching subagents unless the user asked; such instructions are injected by the harness, sit outside this project's control, and outrank skill prose. Classify on permission, up front.
261
+ - **A consent requirement is `interactive`, not `manual`.** When dispatch is barred only *unless the user asked* and a question mechanism is available, pass `interactive`: the gate's own affirmative choice supplies the missing user request. Pass `manual` only when there is **no** question mechanism **and** **no** permitted dispatch.
262
+
263
+ A bar on unsolicited dispatch is never grounds to skip verification, and never grounds to fence the production successor while verification is unresolved. On the `runInStageVerify: true` path the emitted `verifyGate` stays `none`: reuse the Standard Verify Gate block for consent with **choice 2 omitted** (auto-verify is already effective, so "enable auto-verify going forward" is a no-op), leaving exactly two choices: *Verify now* (recommended) and *Skip for now*. The clean-room `forge-verifier` is **dispatched on the affirmative choice**, never merely printed for the user to run later; *Skip for now* is persisted as an explicit `skipped` before any advancing block.
264
+
196
265
  ## Branch Setup
197
266
 
198
267
  Invoke this block at the **very start** of a pipeline entry point — `forge-1-prd` (standalone feature) and `forge-0-epic` (epic) — **before** any directory resolution or interview, so the rest of the run lands on the intended branch. `{label}` is the feature name (forge-1-prd) or epic name (forge-0-epic); `{scope}` is `feature` or `epic` correspondingly.
@@ -214,7 +283,16 @@ Invoke this block at the **very start** of a pipeline entry point — `forge-1-p
214
283
  - **Create** → `git switch -c {branchPrefix}{label}` (or `git checkout -b` if `switch` is unavailable). If the branch already exists, `git switch {branchPrefix}{label}`.
215
284
  - **Stay** → proceed on the default branch; note that subsequent commits (and any `forge-5-loop` run) will land directly on `{defaultBranch}`.
216
285
 
217
- **Record the branch.** After this block resolves, write the resulting branch name to the feature's `.pipeline-state.json` top-level `branch` field (create/update it when the state file is first written for this stage). Downstream stages and `forge-5-loop` read it to detect drift back onto the default branch.
286
+ **Record the branch.** After this block resolves, record the resulting branch name in the feature's top-level `branch` field by running `state-branch` (create/update it when the state file is first written for this stage). Emit the call **once the feature directory exists** — i.e. after Feature Directory Resolution and the Entry Stamp, **not** at this block: Branch Setup runs at the very start of the entry point, before any directory resolution, and a brand-new standalone feature may have no directory yet. Add `--epic "{epic}"` to the call when this feature is an epic member — required, per the Pipeline State Protocol.
287
+
288
+ ```bash
289
+ 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')"
290
+ [ -n "$R" ] || { echo "feature-forge: cannot locate plugin root" >&2; exit 1; }
291
+ python3 "$R/scripts/forge-session.py" state-branch \
292
+ --feature "{feature}" --branch "<name>" --specs-dir "{specsDir}"
293
+ ```
294
+
295
+ Downstream stages and `forge-5-loop` read it to detect drift back onto the default branch.
218
296
 
219
297
  ## Branch Reconciliation
220
298
 
@@ -227,10 +305,19 @@ python3 "$R/scripts/forge-session.py" reconcile-branch --feature "{feature}" --s
227
305
  ```
228
306
 
229
307
  Act on the emitted `action` (source of truth is where the state actually resolves, not the recorded field):
230
- - **`adopt-current`** — you are on a non-default topic branch where the state resolves, and the recorded `branch` differs (a stale/imposed value). Write `newBranch` into the state `branch` field with a **visible one-line note** ("recorded branch was `{stateBranch}`; work is on `{currentBranch}` — updating to match") — never silently, and **never push the user back** to the recorded branch (offer that only as a plain alternative).
308
+ - **`adopt-current`** — you are on a non-default topic branch where the state resolves, and the recorded `branch` differs (a stale/imposed value). Run `state-branch` (below) to write `newBranch` into the state `branch` field, with a **visible one-line note** ("recorded branch was `{stateBranch}`; work is on `{currentBranch}` — updating to match") — never silently, and **never push the user back** to the recorded branch (offer that only as a plain alternative).
231
309
  - **`warn-drift`** — you are on the **default** branch and the state records a topic branch. Via `AskUserQuestion`, strongly recommend creating/switching to `{branchPrefix}{feature}` (then record it), still allowing **proceed on the default branch**. Never hard-stop.
232
310
  - **`none`** / **`not-resolved`** — nothing to do; proceed.
233
311
 
312
+ The `adopt-current` write, with the portable plugin-root prelude. Add `--epic "{epic}"` when this feature is an epic member — required, per the Pipeline State Protocol:
313
+
314
+ ```bash
315
+ 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')"
316
+ [ -n "$R" ] || { echo "feature-forge: cannot locate plugin root" >&2; exit 1; }
317
+ python3 "$R/scripts/forge-session.py" state-branch \
318
+ --feature "{feature}" --branch "{newBranch}" --specs-dir "{specsDir}"
319
+ ```
320
+
234
321
  If the helper is unavailable (non-Claude host without the resolver), fall back to the manual check: current branch differs from recorded → adopt the current branch unless it is the default, in which case recommend creating `{branchPrefix}{feature}`.
235
322
 
236
323
  ## Git Commit Protocol
@@ -240,14 +327,29 @@ When `gitCommitAfterStage` is true, follow this exact order to avoid state incon
240
327
  **Why two commits.** The stage's `.pipeline-state.json` is itself part of the staged commit, but the stage's `commitHash` cannot be known until *after* that commit is made. Recording it *inside* the same commit is a chicken-and-egg with no single-commit solution. Resolve it with a **deterministic two-commit sequence**, and **never** with `git commit --amend`: amending rewrites HEAD, so a hash captured before the amend points at an orphaned commit that is not in the final history (the exact defect this protocol exists to prevent).
241
328
 
242
329
  1. **Stage specific files only:** `git add {specsDir}/{feature}/` — never use `git add -A` or `git add .`
243
- 2. **Commit 1 — artifacts + state, hash not yet known:** In `.pipeline-state.json`, set this stage's `status: "complete"` and `commitHash: null`, then `git commit -m "{commitPrefix}({feature}): <action>"`. This is the stage's **artifact commit**; its hash is the provenance hash callers rely on.
244
- 3. **If Commit 1 succeeds — Commit 2 records the hash:** Capture the hash of Commit 1 (`git rev-parse HEAD`). Write it into this stage's `commitHash` in `.pipeline-state.json`, then commit only that one-line change: `git add {specsDir}/{feature}/.pipeline-state.json && git commit -m "{commitPrefix}({feature}): record stage commit hash"`. The stored `commitHash` now points at the artifact commit (Commit 1) — never at Commit 2, and never at an orphaned amend. The working tree is clean afterward, so the next stage's dirty-tree check passes.
245
- 4. **If Commit 1 fails:** do NOT update pipeline state to complete. Report the error to the user and leave state as `in-progress` so the stage can be resumed. Common failure causes:
330
+ 2. **Commit 1 — artifacts + state, hash not yet known:** Run `state-complete --feature {feature} --stage {stage} --version N …` (which sets this stage's `status: "complete"`, `completedAt`, `version`, `basedOnVersions`, `artifacts` and `commitHash: null`, and applies the downstream staleness cascade), then `git commit -m "{commitPrefix}({feature}): <action>"`. This is the stage's **artifact commit**; its hash is the provenance hash callers rely on.
331
+ 3. **If Commit 1 succeeds — Commit 2 records the hash:** Capture the hash of Commit 1 (`git rev-parse HEAD`) by running `state-complete --feature {feature} --stage {stage} --version N --commit-hash $(git rev-parse HEAD)`, which writes it into this stage's `commitHash` and touches nothing else, then commit only that one-line change: `git add {specsDir}/{feature}/.pipeline-state.json && git commit -m "{commitPrefix}({feature}): record stage commit hash"`. The stored `commitHash` now points at the artifact commit (Commit 1) — never at Commit 2, and never at an orphaned amend. The working tree is clean afterward, so the next stage's dirty-tree check passes.
332
+ 4. **If Commit 1 fails:** do NOT update pipeline state to complete. Report the error to the user and leave state as `in-progress` so the stage can be resumed. Do that with `state-complete --feature {feature} --stage {stage} --version N --resumable`, which records **only** `status` — no `completedAt`, no version bump, no `basedOnVersions`/`artifacts`, no `commitHash` reset, and no staleness cascade, so the stage stays resumable. (`--version` is still REQUIRED by argparse and must be passed even though `--resumable` does not write it; omitting it makes the recovery command exit 2 every time.) Common failure causes:
246
333
  - **Pre-commit hook failure:** Report the hook output. Never use `--no-verify` to bypass. Help the user fix the underlying issue.
247
334
  - **Merge conflicts:** Report conflicting files. Suggest resolution steps appropriate to the conflict.
248
- - **Nothing to commit:** If all artifacts were already committed, this is fine — mark the stage `complete`, leave `commitHash` at its existing value (or `null` if there was never an artifact commit), and skip Commit 2. There is no new artifact commit to record.
335
+ - **Nothing to commit:** If all artifacts were already committed, this is fine — mark the stage `complete`, leave `commitHash` at its existing value (or `null` if there was never an artifact commit), and skip Commit 2. Pass `--preserve-commit-hash` on the Commit-1 `state-complete` call so the recorded hash is left alone instead of being reset to `null`. There is no new artifact commit to record.
249
336
  5. **Never** use `git add -A`, `--amend`, `--no-verify`, or `--force` flags
250
337
 
338
+ The two `state-complete` calls, with the portable plugin-root prelude. Add `--epic "{epic}"` to each when this feature is an epic member — required, per the Pipeline State Protocol:
339
+
340
+ ```bash
341
+ 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')"
342
+ [ -n "$R" ] || { echo "feature-forge: cannot locate plugin root" >&2; exit 1; }
343
+ # Commit 1 — before `git commit`
344
+ python3 "$R/scripts/forge-session.py" state-complete \
345
+ --feature "{feature}" --stage "{stage}" --version {n} \
346
+ --based-on "<upstream>=<n>" --artifact "<file>" --specs-dir "{specsDir}"
347
+ # Commit 2 — after Commit 1 lands, so its hash exists
348
+ python3 "$R/scripts/forge-session.py" state-complete \
349
+ --feature "{feature}" --stage "{stage}" --version {n} \
350
+ --commit-hash "$(git rev-parse HEAD)" --specs-dir "{specsDir}"
351
+ ```
352
+
251
353
  ## Stage-Entry Guard
252
354
 
253
355
  Invoke this block at the **start of an authoring stage** (`forge-1-prd`..`forge-4-backlog`), **after** Feature Directory Resolution and **before** any interview or (re-)authoring. It prevents a re-entered stage — an injected skill body or a re-invoked `Skill` — from blindly re-running the interview over an in-progress or already-complete draft. `{stage}` is the invoking skill's id (e.g. `forge-2-tech`).
@@ -263,16 +365,27 @@ Invoke this block at the **start of an authoring stage** (`forge-1-prd`..`forge-
263
365
 
264
366
  3. **Re-authoring** (`status: "complete"` or `"stale"`) — a finished draft exists. Warn via `AskUserQuestion` before overwriting: "A completed {stage} artifact already exists for '{feature}' (v{n}{, marked stale}). Continuing will create a new version. Proceed?" On confirm, proceed to the Entry Stamp and author a new version (the version increments at exit, per that stage's Update-Pipeline-State step).
265
367
 
266
- **Entry Stamp** (fresh, restart, and re-author paths — NOT the resume path). Before authoring, write to `{resolvedFeatureDir}/.pipeline-state.json` and update `updatedAt`:
267
- - `stages.{stage}.status` → `"in-progress"`
268
- - `stages.{stage}.startedAt` → current ISO-8601 UTC timestamp
269
- - top-level `currentStage` → `"{stage}"` (where the pipeline IS, per O1)
368
+ **Entry Stamp** (fresh, restart, and re-author paths — NOT the resume path). Before authoring, record the entry stamp by running `state-enter` — one atomic write that sets `stages.{stage}.status` → `"in-progress"`, `stages.{stage}.startedAt` → current ISO-8601 UTC timestamp, top-level `currentStage` → `"{stage}"` (where the pipeline IS, per O1), and refreshes `updatedAt`. Add `--epic "{epic}"` when this feature is an epic member — required, per the Pipeline State Protocol:
369
+
370
+ ```bash
371
+ 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')"
372
+ [ -n "$R" ] || { echo "feature-forge: cannot locate plugin root" >&2; exit 1; }
373
+ python3 "$R/scripts/forge-session.py" state-enter \
374
+ --feature "{feature}" --stage "{stage}" --specs-dir "{specsDir}"
375
+ ```
270
376
 
271
377
  This write is **left uncommitted**: it is staged and committed as part of this stage's existing exit commit (Git Commit Protocol), so no extra commit is needed at entry. If the run is interrupted after the stamp but before the exit commit, the marker survives on disk (uncommitted) and the next entry classifies as **Interrupted** — which is exactly the intent.
272
378
 
273
379
  **Force Mode.** When `--force` is passed, skip the interactive gate: do not prompt for resume-vs-restart or the re-author warning. Treat entry as a fresh restart — apply the Entry Stamp and author. (`--force` already skips prerequisite checks; here it likewise bypasses the self-stage gate. Existing on-disk artifacts are still loaded per Force Mode.)
274
380
 
275
- **Incremental artifact tracking:** When a stage writes multiple files (e.g. forge-3-specs writing a suite of spec documents), update the `stages.{stage}.artifacts` array in `.pipeline-state.json` after writing each file — not just at stage completion. This is what makes the Interrupted inventory above precise about which files were successfully written.
381
+ **Incremental artifact tracking:** When a stage writes multiple files (e.g. forge-3-specs writing a suite of spec documents), run `state-artifact --feature {feature} --stage {stage} --path <file>` after writing each file — not just at stage completion. This is what makes the Interrupted inventory above precise about which files were successfully written. Add `--epic "{epic}"` when this feature is an epic member — required, per the Pipeline State Protocol.
382
+
383
+ ```bash
384
+ 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')"
385
+ [ -n "$R" ] || { echo "feature-forge: cannot locate plugin root" >&2; exit 1; }
386
+ python3 "$R/scripts/forge-session.py" state-artifact \
387
+ --feature "{feature}" --stage "{stage}" --path "<file>" --specs-dir "{specsDir}"
388
+ ```
276
389
 
277
390
  ## Stage-Completion Re-check
278
391