@garygentry/feature-forge 0.3.0 → 0.3.1

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 (344) 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/pipeline-state-schema.json +1 -1
  4. package/adapters/claude/references/shared-conventions.md +62 -12
  5. package/adapters/claude/references/stage-exit-protocol.md +14 -4
  6. package/adapters/claude/references/vendor-construct-inventory.md +1 -1
  7. package/adapters/claude/scripts/epic-manifest.py +49 -6
  8. package/adapters/claude/scripts/forge-session.py +1149 -1
  9. package/adapters/claude/scripts/validate-traceability.py +6 -1
  10. package/adapters/claude/skills/forge/SKILL.md +11 -5
  11. package/adapters/claude/skills/forge/references/pipeline-state-schema.json +1 -1
  12. package/adapters/claude/skills/forge/references/shared-conventions.md +62 -12
  13. package/adapters/claude/skills/forge/references/stage-exit-protocol.md +14 -4
  14. package/adapters/claude/skills/forge-0-epic/SKILL.md +1 -1
  15. package/adapters/claude/skills/forge-0-epic/references/pipeline-state-schema.json +1 -1
  16. package/adapters/claude/skills/forge-0-epic/references/shared-conventions.md +62 -12
  17. package/adapters/claude/skills/forge-0-epic/references/stage-exit-protocol.md +14 -4
  18. package/adapters/claude/skills/forge-1-prd/SKILL.md +25 -8
  19. package/adapters/claude/skills/forge-1-prd/references/shared-conventions.md +62 -12
  20. package/adapters/claude/skills/forge-1-prd/references/stage-exit-protocol.md +14 -4
  21. package/adapters/claude/skills/forge-2-tech/SKILL.md +25 -7
  22. package/adapters/claude/skills/forge-2-tech/references/shared-conventions.md +62 -12
  23. package/adapters/claude/skills/forge-2-tech/references/stage-exit-protocol.md +14 -4
  24. package/adapters/claude/skills/forge-3-specs/SKILL.md +24 -7
  25. package/adapters/claude/skills/forge-3-specs/references/shared-conventions.md +62 -12
  26. package/adapters/claude/skills/forge-3-specs/references/stage-exit-protocol.md +14 -4
  27. package/adapters/claude/skills/forge-4-backlog/SKILL.md +23 -7
  28. package/adapters/claude/skills/forge-4-backlog/references/shared-conventions.md +62 -12
  29. package/adapters/claude/skills/forge-4-backlog/references/stage-exit-protocol.md +14 -4
  30. package/adapters/claude/skills/forge-5-loop/SKILL.md +25 -25
  31. package/adapters/claude/skills/forge-5-loop/references/agent-selection.md +116 -0
  32. package/adapters/claude/skills/forge-5-loop/references/runner-contract.md +14 -107
  33. package/adapters/claude/skills/forge-5-loop/references/shared-conventions.md +62 -12
  34. package/adapters/claude/skills/forge-5-loop/references/stage-exit-protocol.md +14 -4
  35. package/adapters/claude/skills/forge-6-docs/SKILL.md +11 -5
  36. package/adapters/claude/skills/forge-6-docs/references/shared-conventions.md +62 -12
  37. package/adapters/claude/skills/forge-fix/references/shared-conventions.md +62 -12
  38. package/adapters/claude/skills/forge-fix/references/stage-exit-protocol.md +14 -4
  39. package/adapters/claude/skills/forge-guide/references/shared-conventions.md +62 -12
  40. package/adapters/claude/skills/forge-verify/SKILL.md +22 -12
  41. package/adapters/claude/skills/forge-verify/references/findings-template.md +157 -0
  42. package/adapters/claude/skills/forge-verify/references/pipeline-state-schema.json +1 -1
  43. package/adapters/claude/skills/forge-verify/references/shared-conventions.md +62 -12
  44. package/adapters/claude/skills/forge-verify/references/verification-checklists/backlog.md +97 -0
  45. package/adapters/claude/skills/forge-verify/references/verification-checklists/epic.md +79 -0
  46. package/adapters/claude/skills/forge-verify/references/verification-checklists/impl.md +48 -0
  47. package/adapters/claude/skills/forge-verify/references/verification-checklists/prd.md +31 -0
  48. package/adapters/claude/skills/forge-verify/references/verification-checklists/specs.md +64 -0
  49. package/adapters/claude/skills/forge-verify/references/verification-checklists/tech.md +35 -0
  50. package/adapters/codex/.feature-forge-bundle.json +1 -1
  51. package/adapters/codex/agents/forge-verifier.toml +1 -1
  52. package/adapters/codex/references/pipeline-state-schema.json +1 -1
  53. package/adapters/codex/references/shared-conventions.md +62 -12
  54. package/adapters/codex/references/stage-exit-protocol.md +14 -4
  55. package/adapters/codex/references/vendor-construct-inventory.md +1 -1
  56. package/adapters/codex/scripts/epic-manifest.py +49 -6
  57. package/adapters/codex/scripts/forge-session.py +1149 -1
  58. package/adapters/codex/scripts/validate-traceability.py +6 -1
  59. package/adapters/codex/skills/forge/SKILL.md +11 -5
  60. package/adapters/codex/skills/forge/references/pipeline-state-schema.json +1 -1
  61. package/adapters/codex/skills/forge/references/shared-conventions.md +62 -12
  62. package/adapters/codex/skills/forge/references/stage-exit-protocol.md +14 -4
  63. package/adapters/codex/skills/forge-0-epic/SKILL.md +1 -1
  64. package/adapters/codex/skills/forge-0-epic/references/pipeline-state-schema.json +1 -1
  65. package/adapters/codex/skills/forge-0-epic/references/shared-conventions.md +62 -12
  66. package/adapters/codex/skills/forge-0-epic/references/stage-exit-protocol.md +14 -4
  67. package/adapters/codex/skills/forge-1-prd/SKILL.md +25 -8
  68. package/adapters/codex/skills/forge-1-prd/references/shared-conventions.md +62 -12
  69. package/adapters/codex/skills/forge-1-prd/references/stage-exit-protocol.md +14 -4
  70. package/adapters/codex/skills/forge-2-tech/SKILL.md +25 -7
  71. package/adapters/codex/skills/forge-2-tech/references/shared-conventions.md +62 -12
  72. package/adapters/codex/skills/forge-2-tech/references/stage-exit-protocol.md +14 -4
  73. package/adapters/codex/skills/forge-3-specs/SKILL.md +24 -7
  74. package/adapters/codex/skills/forge-3-specs/references/shared-conventions.md +62 -12
  75. package/adapters/codex/skills/forge-3-specs/references/stage-exit-protocol.md +14 -4
  76. package/adapters/codex/skills/forge-4-backlog/SKILL.md +23 -7
  77. package/adapters/codex/skills/forge-4-backlog/references/shared-conventions.md +62 -12
  78. package/adapters/codex/skills/forge-4-backlog/references/stage-exit-protocol.md +14 -4
  79. package/adapters/codex/skills/forge-5-loop/SKILL.md +25 -25
  80. package/adapters/codex/skills/forge-5-loop/references/agent-selection.md +116 -0
  81. package/adapters/codex/skills/forge-5-loop/references/runner-contract.md +14 -107
  82. package/adapters/codex/skills/forge-5-loop/references/shared-conventions.md +62 -12
  83. package/adapters/codex/skills/forge-5-loop/references/stage-exit-protocol.md +14 -4
  84. package/adapters/codex/skills/forge-6-docs/SKILL.md +11 -5
  85. package/adapters/codex/skills/forge-6-docs/references/shared-conventions.md +62 -12
  86. package/adapters/codex/skills/forge-fix/references/shared-conventions.md +62 -12
  87. package/adapters/codex/skills/forge-fix/references/stage-exit-protocol.md +14 -4
  88. package/adapters/codex/skills/forge-guide/references/shared-conventions.md +62 -12
  89. package/adapters/codex/skills/forge-verify/SKILL.md +22 -12
  90. package/adapters/codex/skills/forge-verify/references/findings-template.md +157 -0
  91. package/adapters/codex/skills/forge-verify/references/pipeline-state-schema.json +1 -1
  92. package/adapters/codex/skills/forge-verify/references/shared-conventions.md +62 -12
  93. package/adapters/codex/skills/forge-verify/references/verification-checklists/backlog.md +97 -0
  94. package/adapters/codex/skills/forge-verify/references/verification-checklists/epic.md +79 -0
  95. package/adapters/codex/skills/forge-verify/references/verification-checklists/impl.md +48 -0
  96. package/adapters/codex/skills/forge-verify/references/verification-checklists/prd.md +31 -0
  97. package/adapters/codex/skills/forge-verify/references/verification-checklists/specs.md +64 -0
  98. package/adapters/codex/skills/forge-verify/references/verification-checklists/tech.md +35 -0
  99. package/adapters/copilot/.feature-forge-bundle.json +1 -1
  100. package/adapters/copilot/agents/forge-verifier.md +1 -1
  101. package/adapters/copilot/references/pipeline-state-schema.json +1 -1
  102. package/adapters/copilot/references/shared-conventions.md +62 -12
  103. package/adapters/copilot/references/stage-exit-protocol.md +14 -4
  104. package/adapters/copilot/references/vendor-construct-inventory.md +1 -1
  105. package/adapters/copilot/scripts/epic-manifest.py +49 -6
  106. package/adapters/copilot/scripts/forge-session.py +1149 -1
  107. package/adapters/copilot/scripts/validate-traceability.py +6 -1
  108. package/adapters/copilot/skills/forge/forge.md +11 -5
  109. package/adapters/copilot/skills/forge/references/pipeline-state-schema.json +1 -1
  110. package/adapters/copilot/skills/forge/references/shared-conventions.md +62 -12
  111. package/adapters/copilot/skills/forge/references/stage-exit-protocol.md +14 -4
  112. package/adapters/copilot/skills/forge-0-epic/forge-0-epic.md +1 -1
  113. package/adapters/copilot/skills/forge-0-epic/references/pipeline-state-schema.json +1 -1
  114. package/adapters/copilot/skills/forge-0-epic/references/shared-conventions.md +62 -12
  115. package/adapters/copilot/skills/forge-0-epic/references/stage-exit-protocol.md +14 -4
  116. package/adapters/copilot/skills/forge-1-prd/forge-1-prd.md +25 -8
  117. package/adapters/copilot/skills/forge-1-prd/references/shared-conventions.md +62 -12
  118. package/adapters/copilot/skills/forge-1-prd/references/stage-exit-protocol.md +14 -4
  119. package/adapters/copilot/skills/forge-2-tech/forge-2-tech.md +25 -7
  120. package/adapters/copilot/skills/forge-2-tech/references/shared-conventions.md +62 -12
  121. package/adapters/copilot/skills/forge-2-tech/references/stage-exit-protocol.md +14 -4
  122. package/adapters/copilot/skills/forge-3-specs/forge-3-specs.md +24 -7
  123. package/adapters/copilot/skills/forge-3-specs/references/shared-conventions.md +62 -12
  124. package/adapters/copilot/skills/forge-3-specs/references/stage-exit-protocol.md +14 -4
  125. package/adapters/copilot/skills/forge-4-backlog/forge-4-backlog.md +23 -7
  126. package/adapters/copilot/skills/forge-4-backlog/references/shared-conventions.md +62 -12
  127. package/adapters/copilot/skills/forge-4-backlog/references/stage-exit-protocol.md +14 -4
  128. package/adapters/copilot/skills/forge-5-loop/forge-5-loop.md +25 -25
  129. package/adapters/copilot/skills/forge-5-loop/references/agent-selection.md +116 -0
  130. package/adapters/copilot/skills/forge-5-loop/references/runner-contract.md +14 -107
  131. package/adapters/copilot/skills/forge-5-loop/references/shared-conventions.md +62 -12
  132. package/adapters/copilot/skills/forge-5-loop/references/stage-exit-protocol.md +14 -4
  133. package/adapters/copilot/skills/forge-6-docs/forge-6-docs.md +11 -5
  134. package/adapters/copilot/skills/forge-6-docs/references/shared-conventions.md +62 -12
  135. package/adapters/copilot/skills/forge-fix/references/shared-conventions.md +62 -12
  136. package/adapters/copilot/skills/forge-fix/references/stage-exit-protocol.md +14 -4
  137. package/adapters/copilot/skills/forge-guide/references/shared-conventions.md +62 -12
  138. package/adapters/copilot/skills/forge-verify/forge-verify.md +22 -12
  139. package/adapters/copilot/skills/forge-verify/references/findings-template.md +157 -0
  140. package/adapters/copilot/skills/forge-verify/references/pipeline-state-schema.json +1 -1
  141. package/adapters/copilot/skills/forge-verify/references/shared-conventions.md +62 -12
  142. package/adapters/copilot/skills/forge-verify/references/verification-checklists/backlog.md +97 -0
  143. package/adapters/copilot/skills/forge-verify/references/verification-checklists/epic.md +79 -0
  144. package/adapters/copilot/skills/forge-verify/references/verification-checklists/impl.md +48 -0
  145. package/adapters/copilot/skills/forge-verify/references/verification-checklists/prd.md +31 -0
  146. package/adapters/copilot/skills/forge-verify/references/verification-checklists/specs.md +64 -0
  147. package/adapters/copilot/skills/forge-verify/references/verification-checklists/tech.md +35 -0
  148. package/adapters/cursor/.feature-forge-bundle.json +1 -1
  149. package/adapters/cursor/agents/forge-verifier.mdc +1 -1
  150. package/adapters/cursor/references/pipeline-state-schema.json +1 -1
  151. package/adapters/cursor/references/shared-conventions.md +62 -12
  152. package/adapters/cursor/references/stage-exit-protocol.md +14 -4
  153. package/adapters/cursor/references/vendor-construct-inventory.md +1 -1
  154. package/adapters/cursor/scripts/epic-manifest.py +49 -6
  155. package/adapters/cursor/scripts/forge-session.py +1149 -1
  156. package/adapters/cursor/scripts/validate-traceability.py +6 -1
  157. package/adapters/cursor/skills/forge/forge.mdc +11 -5
  158. package/adapters/cursor/skills/forge/references/pipeline-state-schema.json +1 -1
  159. package/adapters/cursor/skills/forge/references/shared-conventions.md +62 -12
  160. package/adapters/cursor/skills/forge/references/stage-exit-protocol.md +14 -4
  161. package/adapters/cursor/skills/forge-0-epic/forge-0-epic.mdc +1 -1
  162. package/adapters/cursor/skills/forge-0-epic/references/pipeline-state-schema.json +1 -1
  163. package/adapters/cursor/skills/forge-0-epic/references/shared-conventions.md +62 -12
  164. package/adapters/cursor/skills/forge-0-epic/references/stage-exit-protocol.md +14 -4
  165. package/adapters/cursor/skills/forge-1-prd/forge-1-prd.mdc +25 -8
  166. package/adapters/cursor/skills/forge-1-prd/references/shared-conventions.md +62 -12
  167. package/adapters/cursor/skills/forge-1-prd/references/stage-exit-protocol.md +14 -4
  168. package/adapters/cursor/skills/forge-2-tech/forge-2-tech.mdc +25 -7
  169. package/adapters/cursor/skills/forge-2-tech/references/shared-conventions.md +62 -12
  170. package/adapters/cursor/skills/forge-2-tech/references/stage-exit-protocol.md +14 -4
  171. package/adapters/cursor/skills/forge-3-specs/forge-3-specs.mdc +24 -7
  172. package/adapters/cursor/skills/forge-3-specs/references/shared-conventions.md +62 -12
  173. package/adapters/cursor/skills/forge-3-specs/references/stage-exit-protocol.md +14 -4
  174. package/adapters/cursor/skills/forge-4-backlog/forge-4-backlog.mdc +23 -7
  175. package/adapters/cursor/skills/forge-4-backlog/references/shared-conventions.md +62 -12
  176. package/adapters/cursor/skills/forge-4-backlog/references/stage-exit-protocol.md +14 -4
  177. package/adapters/cursor/skills/forge-5-loop/forge-5-loop.mdc +25 -25
  178. package/adapters/cursor/skills/forge-5-loop/references/agent-selection.md +116 -0
  179. package/adapters/cursor/skills/forge-5-loop/references/runner-contract.md +14 -107
  180. package/adapters/cursor/skills/forge-5-loop/references/shared-conventions.md +62 -12
  181. package/adapters/cursor/skills/forge-5-loop/references/stage-exit-protocol.md +14 -4
  182. package/adapters/cursor/skills/forge-6-docs/forge-6-docs.mdc +11 -5
  183. package/adapters/cursor/skills/forge-6-docs/references/shared-conventions.md +62 -12
  184. package/adapters/cursor/skills/forge-fix/references/shared-conventions.md +62 -12
  185. package/adapters/cursor/skills/forge-fix/references/stage-exit-protocol.md +14 -4
  186. package/adapters/cursor/skills/forge-guide/references/shared-conventions.md +62 -12
  187. package/adapters/cursor/skills/forge-verify/forge-verify.mdc +22 -12
  188. package/adapters/cursor/skills/forge-verify/references/findings-template.md +157 -0
  189. package/adapters/cursor/skills/forge-verify/references/pipeline-state-schema.json +1 -1
  190. package/adapters/cursor/skills/forge-verify/references/shared-conventions.md +62 -12
  191. package/adapters/cursor/skills/forge-verify/references/verification-checklists/backlog.md +97 -0
  192. package/adapters/cursor/skills/forge-verify/references/verification-checklists/epic.md +79 -0
  193. package/adapters/cursor/skills/forge-verify/references/verification-checklists/impl.md +48 -0
  194. package/adapters/cursor/skills/forge-verify/references/verification-checklists/prd.md +31 -0
  195. package/adapters/cursor/skills/forge-verify/references/verification-checklists/specs.md +64 -0
  196. package/adapters/cursor/skills/forge-verify/references/verification-checklists/tech.md +35 -0
  197. package/adapters/gemini/.feature-forge-bundle.json +1 -1
  198. package/adapters/gemini/agents/forge-verifier.md +1 -1
  199. package/adapters/gemini/gemini-extension.json +1 -1
  200. package/adapters/gemini/references/pipeline-state-schema.json +1 -1
  201. package/adapters/gemini/references/shared-conventions.md +62 -12
  202. package/adapters/gemini/references/stage-exit-protocol.md +14 -4
  203. package/adapters/gemini/references/vendor-construct-inventory.md +1 -1
  204. package/adapters/gemini/scripts/epic-manifest.py +49 -6
  205. package/adapters/gemini/scripts/forge-session.py +1149 -1
  206. package/adapters/gemini/scripts/validate-traceability.py +6 -1
  207. package/adapters/gemini/skills/forge/forge.md +11 -5
  208. package/adapters/gemini/skills/forge/references/pipeline-state-schema.json +1 -1
  209. package/adapters/gemini/skills/forge/references/shared-conventions.md +62 -12
  210. package/adapters/gemini/skills/forge/references/stage-exit-protocol.md +14 -4
  211. package/adapters/gemini/skills/forge-0-epic/forge-0-epic.md +1 -1
  212. package/adapters/gemini/skills/forge-0-epic/references/pipeline-state-schema.json +1 -1
  213. package/adapters/gemini/skills/forge-0-epic/references/shared-conventions.md +62 -12
  214. package/adapters/gemini/skills/forge-0-epic/references/stage-exit-protocol.md +14 -4
  215. package/adapters/gemini/skills/forge-1-prd/forge-1-prd.md +25 -8
  216. package/adapters/gemini/skills/forge-1-prd/references/shared-conventions.md +62 -12
  217. package/adapters/gemini/skills/forge-1-prd/references/stage-exit-protocol.md +14 -4
  218. package/adapters/gemini/skills/forge-2-tech/forge-2-tech.md +25 -7
  219. package/adapters/gemini/skills/forge-2-tech/references/shared-conventions.md +62 -12
  220. package/adapters/gemini/skills/forge-2-tech/references/stage-exit-protocol.md +14 -4
  221. package/adapters/gemini/skills/forge-3-specs/forge-3-specs.md +24 -7
  222. package/adapters/gemini/skills/forge-3-specs/references/shared-conventions.md +62 -12
  223. package/adapters/gemini/skills/forge-3-specs/references/stage-exit-protocol.md +14 -4
  224. package/adapters/gemini/skills/forge-4-backlog/forge-4-backlog.md +23 -7
  225. package/adapters/gemini/skills/forge-4-backlog/references/shared-conventions.md +62 -12
  226. package/adapters/gemini/skills/forge-4-backlog/references/stage-exit-protocol.md +14 -4
  227. package/adapters/gemini/skills/forge-5-loop/forge-5-loop.md +25 -25
  228. package/adapters/gemini/skills/forge-5-loop/references/agent-selection.md +116 -0
  229. package/adapters/gemini/skills/forge-5-loop/references/runner-contract.md +14 -107
  230. package/adapters/gemini/skills/forge-5-loop/references/shared-conventions.md +62 -12
  231. package/adapters/gemini/skills/forge-5-loop/references/stage-exit-protocol.md +14 -4
  232. package/adapters/gemini/skills/forge-6-docs/forge-6-docs.md +11 -5
  233. package/adapters/gemini/skills/forge-6-docs/references/shared-conventions.md +62 -12
  234. package/adapters/gemini/skills/forge-fix/references/shared-conventions.md +62 -12
  235. package/adapters/gemini/skills/forge-fix/references/stage-exit-protocol.md +14 -4
  236. package/adapters/gemini/skills/forge-guide/references/shared-conventions.md +62 -12
  237. package/adapters/gemini/skills/forge-verify/forge-verify.md +22 -12
  238. package/adapters/gemini/skills/forge-verify/references/findings-template.md +157 -0
  239. package/adapters/gemini/skills/forge-verify/references/pipeline-state-schema.json +1 -1
  240. package/adapters/gemini/skills/forge-verify/references/shared-conventions.md +62 -12
  241. package/adapters/gemini/skills/forge-verify/references/verification-checklists/backlog.md +97 -0
  242. package/adapters/gemini/skills/forge-verify/references/verification-checklists/epic.md +79 -0
  243. package/adapters/gemini/skills/forge-verify/references/verification-checklists/impl.md +48 -0
  244. package/adapters/gemini/skills/forge-verify/references/verification-checklists/prd.md +31 -0
  245. package/adapters/gemini/skills/forge-verify/references/verification-checklists/specs.md +64 -0
  246. package/adapters/gemini/skills/forge-verify/references/verification-checklists/tech.md +35 -0
  247. package/adapters/pi/.feature-forge-bundle.json +1 -1
  248. package/adapters/pi/agents/forge-verifier.md +1 -1
  249. package/adapters/pi/references/pipeline-state-schema.json +1 -1
  250. package/adapters/pi/references/shared-conventions.md +62 -12
  251. package/adapters/pi/references/stage-exit-protocol.md +14 -4
  252. package/adapters/pi/references/vendor-construct-inventory.md +1 -1
  253. package/adapters/pi/scripts/epic-manifest.py +49 -6
  254. package/adapters/pi/scripts/forge-session.py +1149 -1
  255. package/adapters/pi/scripts/validate-traceability.py +6 -1
  256. package/adapters/pi/skills/forge/SKILL.md +11 -5
  257. package/adapters/pi/skills/forge/references/pipeline-state-schema.json +1 -1
  258. package/adapters/pi/skills/forge/references/shared-conventions.md +62 -12
  259. package/adapters/pi/skills/forge/references/stage-exit-protocol.md +14 -4
  260. package/adapters/pi/skills/forge-0-epic/SKILL.md +1 -1
  261. package/adapters/pi/skills/forge-0-epic/references/pipeline-state-schema.json +1 -1
  262. package/adapters/pi/skills/forge-0-epic/references/shared-conventions.md +62 -12
  263. package/adapters/pi/skills/forge-0-epic/references/stage-exit-protocol.md +14 -4
  264. package/adapters/pi/skills/forge-1-prd/SKILL.md +25 -8
  265. package/adapters/pi/skills/forge-1-prd/references/shared-conventions.md +62 -12
  266. package/adapters/pi/skills/forge-1-prd/references/stage-exit-protocol.md +14 -4
  267. package/adapters/pi/skills/forge-2-tech/SKILL.md +25 -7
  268. package/adapters/pi/skills/forge-2-tech/references/shared-conventions.md +62 -12
  269. package/adapters/pi/skills/forge-2-tech/references/stage-exit-protocol.md +14 -4
  270. package/adapters/pi/skills/forge-3-specs/SKILL.md +24 -7
  271. package/adapters/pi/skills/forge-3-specs/references/shared-conventions.md +62 -12
  272. package/adapters/pi/skills/forge-3-specs/references/stage-exit-protocol.md +14 -4
  273. package/adapters/pi/skills/forge-4-backlog/SKILL.md +23 -7
  274. package/adapters/pi/skills/forge-4-backlog/references/shared-conventions.md +62 -12
  275. package/adapters/pi/skills/forge-4-backlog/references/stage-exit-protocol.md +14 -4
  276. package/adapters/pi/skills/forge-5-loop/SKILL.md +25 -25
  277. package/adapters/pi/skills/forge-5-loop/references/agent-selection.md +116 -0
  278. package/adapters/pi/skills/forge-5-loop/references/runner-contract.md +14 -107
  279. package/adapters/pi/skills/forge-5-loop/references/shared-conventions.md +62 -12
  280. package/adapters/pi/skills/forge-5-loop/references/stage-exit-protocol.md +14 -4
  281. package/adapters/pi/skills/forge-6-docs/SKILL.md +11 -5
  282. package/adapters/pi/skills/forge-6-docs/references/shared-conventions.md +62 -12
  283. package/adapters/pi/skills/forge-fix/references/shared-conventions.md +62 -12
  284. package/adapters/pi/skills/forge-fix/references/stage-exit-protocol.md +14 -4
  285. package/adapters/pi/skills/forge-guide/references/shared-conventions.md +62 -12
  286. package/adapters/pi/skills/forge-verify/SKILL.md +22 -12
  287. package/adapters/pi/skills/forge-verify/references/findings-template.md +157 -0
  288. package/adapters/pi/skills/forge-verify/references/pipeline-state-schema.json +1 -1
  289. package/adapters/pi/skills/forge-verify/references/shared-conventions.md +62 -12
  290. package/adapters/pi/skills/forge-verify/references/verification-checklists/backlog.md +97 -0
  291. package/adapters/pi/skills/forge-verify/references/verification-checklists/epic.md +79 -0
  292. package/adapters/pi/skills/forge-verify/references/verification-checklists/impl.md +48 -0
  293. package/adapters/pi/skills/forge-verify/references/verification-checklists/prd.md +31 -0
  294. package/adapters/pi/skills/forge-verify/references/verification-checklists/specs.md +64 -0
  295. package/adapters/pi/skills/forge-verify/references/verification-checklists/tech.md +35 -0
  296. package/package.json +1 -1
  297. package/adapters/claude/skills/forge-1-prd/references/pipeline-state-schema.json +0 -191
  298. package/adapters/claude/skills/forge-2-tech/references/pipeline-state-schema.json +0 -191
  299. package/adapters/claude/skills/forge-3-specs/references/pipeline-state-schema.json +0 -191
  300. package/adapters/claude/skills/forge-4-backlog/references/forge-config-schema.json +0 -236
  301. package/adapters/claude/skills/forge-4-backlog/references/pipeline-state-schema.json +0 -191
  302. package/adapters/claude/skills/forge-5-loop/references/forge-config-schema.json +0 -236
  303. package/adapters/claude/skills/forge-6-docs/references/pipeline-state-schema.json +0 -191
  304. package/adapters/claude/skills/forge-verify/references/verification-checklists.md +0 -477
  305. package/adapters/codex/skills/forge-1-prd/references/pipeline-state-schema.json +0 -191
  306. package/adapters/codex/skills/forge-2-tech/references/pipeline-state-schema.json +0 -191
  307. package/adapters/codex/skills/forge-3-specs/references/pipeline-state-schema.json +0 -191
  308. package/adapters/codex/skills/forge-4-backlog/references/forge-config-schema.json +0 -236
  309. package/adapters/codex/skills/forge-4-backlog/references/pipeline-state-schema.json +0 -191
  310. package/adapters/codex/skills/forge-5-loop/references/forge-config-schema.json +0 -236
  311. package/adapters/codex/skills/forge-6-docs/references/pipeline-state-schema.json +0 -191
  312. package/adapters/codex/skills/forge-verify/references/verification-checklists.md +0 -477
  313. package/adapters/copilot/skills/forge-1-prd/references/pipeline-state-schema.json +0 -191
  314. package/adapters/copilot/skills/forge-2-tech/references/pipeline-state-schema.json +0 -191
  315. package/adapters/copilot/skills/forge-3-specs/references/pipeline-state-schema.json +0 -191
  316. package/adapters/copilot/skills/forge-4-backlog/references/forge-config-schema.json +0 -236
  317. package/adapters/copilot/skills/forge-4-backlog/references/pipeline-state-schema.json +0 -191
  318. package/adapters/copilot/skills/forge-5-loop/references/forge-config-schema.json +0 -236
  319. package/adapters/copilot/skills/forge-6-docs/references/pipeline-state-schema.json +0 -191
  320. package/adapters/copilot/skills/forge-verify/references/verification-checklists.md +0 -477
  321. package/adapters/cursor/skills/forge-1-prd/references/pipeline-state-schema.json +0 -191
  322. package/adapters/cursor/skills/forge-2-tech/references/pipeline-state-schema.json +0 -191
  323. package/adapters/cursor/skills/forge-3-specs/references/pipeline-state-schema.json +0 -191
  324. package/adapters/cursor/skills/forge-4-backlog/references/forge-config-schema.json +0 -236
  325. package/adapters/cursor/skills/forge-4-backlog/references/pipeline-state-schema.json +0 -191
  326. package/adapters/cursor/skills/forge-5-loop/references/forge-config-schema.json +0 -236
  327. package/adapters/cursor/skills/forge-6-docs/references/pipeline-state-schema.json +0 -191
  328. package/adapters/cursor/skills/forge-verify/references/verification-checklists.md +0 -477
  329. package/adapters/gemini/skills/forge-1-prd/references/pipeline-state-schema.json +0 -191
  330. package/adapters/gemini/skills/forge-2-tech/references/pipeline-state-schema.json +0 -191
  331. package/adapters/gemini/skills/forge-3-specs/references/pipeline-state-schema.json +0 -191
  332. package/adapters/gemini/skills/forge-4-backlog/references/forge-config-schema.json +0 -236
  333. package/adapters/gemini/skills/forge-4-backlog/references/pipeline-state-schema.json +0 -191
  334. package/adapters/gemini/skills/forge-5-loop/references/forge-config-schema.json +0 -236
  335. package/adapters/gemini/skills/forge-6-docs/references/pipeline-state-schema.json +0 -191
  336. package/adapters/gemini/skills/forge-verify/references/verification-checklists.md +0 -477
  337. package/adapters/pi/skills/forge-1-prd/references/pipeline-state-schema.json +0 -191
  338. package/adapters/pi/skills/forge-2-tech/references/pipeline-state-schema.json +0 -191
  339. package/adapters/pi/skills/forge-3-specs/references/pipeline-state-schema.json +0 -191
  340. package/adapters/pi/skills/forge-4-backlog/references/forge-config-schema.json +0 -236
  341. package/adapters/pi/skills/forge-4-backlog/references/pipeline-state-schema.json +0 -191
  342. package/adapters/pi/skills/forge-5-loop/references/forge-config-schema.json +0 -236
  343. package/adapters/pi/skills/forge-6-docs/references/pipeline-state-schema.json +0 -191
  344. package/adapters/pi/skills/forge-verify/references/verification-checklists.md +0 -477
@@ -20,7 +20,12 @@ import re
20
20
  import sys
21
21
  from pathlib import Path
22
22
 
23
- REQ_PATTERN = re.compile(r"REQ-[A-Z]+-\d+")
23
+ #: The category segment may contain digits after its first letter — `REQ-R1-01`,
24
+ #: `REQ-R6-03`. The original `[A-Z]+` could not match those, so whole requirement
25
+ #: families were invisible to this checker and reported as "all covered" while never
26
+ #: having been looked at (context-efficiency: 12 of 29 requirements seen). The first
27
+ #: character stays `[A-Z]` so a lowercase or digit-led token is still not an ID.
28
+ REQ_PATTERN = re.compile(r"REQ-[A-Z][A-Z0-9]*-\d+")
24
29
 
25
30
 
26
31
  def extract_req_ids(text: str) -> set[str]:
@@ -15,10 +15,10 @@ You are the navigator for the feature-forge development pipeline. Your job is to
15
15
 
16
16
  Read and follow `references/shared-conventions.md` for configuration reading (feature name validation, config defaults, force mode).
17
17
 
18
- For pipeline architecture details, read `references/process-overview.md`.
19
-
20
18
  ### 2. Determine Context
21
19
 
20
+ **Only if the user is asking how the pipeline works** — architecture, stage ordering, what a stage does, or "explain forge" — read `references/process-overview.md` for the details before answering. For routine status/dashboard rendering, do **not** read it.
21
+
22
22
  **If a feature name is provided** (e.g., `/feature-forge:forge auth`):
23
23
  - **First test whether the name is an epic:** if `{specsDir}/{name}/epic-manifest.json` exists, render the **Epic Dashboard** (see format below) and stop — do not treat it as a feature.
24
24
  - Otherwise, resolve the name via the **Feature Directory Resolution** block in `references/shared-conventions.md` (so a nested epic-member name finds its dashboard too). On a resolution failure (`not-found` / `ambiguous` at exit 1; `unsafe-name` or a path-containment escape at exit 2), surface it verbatim.
@@ -50,8 +50,6 @@ The feature name must be a single kebab-case token. If the user provides multipl
50
50
 
51
51
  ### 3. Pipeline Status Dashboard
52
52
 
53
- Write pipeline state conforming to `references/pipeline-state-schema.json`.
54
-
55
53
  Display a clear, scannable status for the feature:
56
54
 
57
55
  ```
@@ -182,7 +180,13 @@ All of this is reconstructed **purely from disk** — the manifest plus each mem
182
180
 
183
181
  ### 4. Notes Management
184
182
 
185
- If the user says something like "note: switching to jose for JWT" or "remember: we decided X", update the `notes` field in `.pipeline-state.json`. This helps preserve context across session clears.
183
+ If the user says something like "note: switching to jose for JWT" or "remember: we decided X", update the `notes` field by running `state-note` (below). This helps preserve context across session clears. Add `--epic "{epic}"` when the feature is an epic member — required, per the Pipeline State Protocol in `references/shared-conventions.md`.
184
+
185
+ ```bash
186
+ 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')"
187
+ [ -n "$R" ] || { echo "feature-forge: cannot locate plugin root" >&2; exit 1; }
188
+ python3 "$R/scripts/forge-session.py" state-note --feature "{feature}" --note "<what the user said>" --specs-dir "{specsDir}"
189
+ ```
186
190
 
187
191
  ### 5. Available Commands Reference
188
192
 
@@ -201,6 +205,8 @@ Commands:
201
205
 
202
206
  ### 6. Pipeline Lifecycle Commands
203
207
 
208
+ > **Deliberate R4 exclusion.** The `pipelineStatus` writes below (`pause` / `resume` / `abandon`, and the member-pause under **Epic lifecycle**) stay hand-authored on purpose: the `state-*` verbs cover the seven stage and array touch points, and none of them writes `pipelineStatus`. These are the sanctioned exception to the Pipeline State Protocol in `references/shared-conventions.md` — everywhere else, state is written by a verb, never by hand. When authoring one of these `pipelineStatus` writes, conform to `references/pipeline-state-schema.json` — this is the one navigator path that still reads it.
209
+
204
210
  Support these sub-commands for pipeline lifecycle management:
205
211
  - `/feature-forge:forge pause {feature}` — Set `pipelineStatus` to `"paused"`. Do NOT modify `currentStage` or any stage statuses. The pipeline freezes exactly as-is. Show a confirmation.
206
212
  - `/feature-forge:forge resume {feature}` — Set `pipelineStatus` back to `"active"`. Calculate how long the feature was paused (from `updatedAt` to now). If paused for more than 24 hours, show a hint: "This feature was paused for {duration}. Session context may have been lost — consider re-running `/feature-forge:forge-{currentStage} {feature}` to rebuild context."
@@ -33,7 +33,7 @@
33
33
  "currentStage": {
34
34
  "type": "string",
35
35
  "enum": ["forge-1-prd", "forge-2-tech", "forge-3-specs", "forge-4-backlog", "forge-5-loop", "forge-6-docs", "complete", "forge-verify-prd", "forge-verify-tech", "forge-verify-specs", "forge-verify-backlog", "forge-verify-impl", "forge-0-epic", "forge-verify-epic"],
36
- "description": "Where the pipeline IS: the most recently started stage — its `stages[<currentStage>].status` is `in-progress` while that stage is being authored, then `complete` once its artifacts are committed. A stage skill sets this to its own id when it starts. This is deliberately NOT 'the next stage to run': the next stage is DERIVED, never stored — it is the first production stage whose `stages[].status` is not `complete` (see `next_stage()` in forge-session.py, surfaced as the navigator/doctor `nextStage`). Consumers that need 'what runs next' compute it from `stages[].status`, not from this field. `complete` here means the whole pipeline is done. (Legacy/absent value: tools fall back to the derived next stage for display only — `build_rows` in forge-session.py.)"
36
+ "description": "Where the pipeline IS: the most recently started stage — its `stages[<currentStage>].status` is `in-progress` while that stage is being authored, then `complete` once its artifacts are committed. A stage skill sets this to its own id when it starts. This is deliberately NOT 'the next stage to run': the next stage is DERIVED, never stored — it is the first production stage whose `stages[].status` is not `complete` (see `next_stage()` in forge-session.py, surfaced as the navigator/doctor `nextStage`). Consumers that need 'what runs next' compute it from `stages[].status`, not from this field. `complete` is a LEGACY enum value, retained so pre-0.14 state files still validate: no writer produces it (the `state-*` verbs are the only writers, and only `state-enter` touches this field, setting it to the stage being entered). A finished pipeline therefore records the last stage it started — `forge-6-docs` — and 'the whole pipeline is done' is DERIVED too: `next_stage()` returns null (surfaced as `nextStage: null` / `complete: true`). Never test this field against `complete` to decide whether a pipeline finished. (Legacy/absent value: tools fall back to the derived next stage for display only — `build_rows` in forge-session.py.)"
37
37
  },
38
38
  "notes": {
39
39
  "type": "string",
@@ -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,11 @@ 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.
187
193
 
188
194
  ### Staleness Detection (Read-Time)
189
195
 
@@ -214,7 +220,16 @@ Invoke this block at the **very start** of a pipeline entry point — `forge-1-p
214
220
  - **Create** → `git switch -c {branchPrefix}{label}` (or `git checkout -b` if `switch` is unavailable). If the branch already exists, `git switch {branchPrefix}{label}`.
215
221
  - **Stay** → proceed on the default branch; note that subsequent commits (and any `forge-5-loop` run) will land directly on `{defaultBranch}`.
216
222
 
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.
223
+ **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.
224
+
225
+ ```bash
226
+ 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')"
227
+ [ -n "$R" ] || { echo "feature-forge: cannot locate plugin root" >&2; exit 1; }
228
+ python3 "$R/scripts/forge-session.py" state-branch \
229
+ --feature "{feature}" --branch "<name>" --specs-dir "{specsDir}"
230
+ ```
231
+
232
+ Downstream stages and `forge-5-loop` read it to detect drift back onto the default branch.
218
233
 
219
234
  ## Branch Reconciliation
220
235
 
@@ -227,10 +242,19 @@ python3 "$R/scripts/forge-session.py" reconcile-branch --feature "{feature}" --s
227
242
  ```
228
243
 
229
244
  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).
245
+ - **`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
246
  - **`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
247
  - **`none`** / **`not-resolved`** — nothing to do; proceed.
233
248
 
249
+ 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:
250
+
251
+ ```bash
252
+ 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')"
253
+ [ -n "$R" ] || { echo "feature-forge: cannot locate plugin root" >&2; exit 1; }
254
+ python3 "$R/scripts/forge-session.py" state-branch \
255
+ --feature "{feature}" --branch "{newBranch}" --specs-dir "{specsDir}"
256
+ ```
257
+
234
258
  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
259
 
236
260
  ## Git Commit Protocol
@@ -240,14 +264,29 @@ When `gitCommitAfterStage` is true, follow this exact order to avoid state incon
240
264
  **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
265
 
242
266
  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:
267
+ 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.
268
+ 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.
269
+ 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
270
  - **Pre-commit hook failure:** Report the hook output. Never use `--no-verify` to bypass. Help the user fix the underlying issue.
247
271
  - **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.
272
+ - **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
273
  5. **Never** use `git add -A`, `--amend`, `--no-verify`, or `--force` flags
250
274
 
275
+ 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:
276
+
277
+ ```bash
278
+ 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')"
279
+ [ -n "$R" ] || { echo "feature-forge: cannot locate plugin root" >&2; exit 1; }
280
+ # Commit 1 — before `git commit`
281
+ python3 "$R/scripts/forge-session.py" state-complete \
282
+ --feature "{feature}" --stage "{stage}" --version {n} \
283
+ --based-on "<upstream>=<n>" --artifact "<file>" --specs-dir "{specsDir}"
284
+ # Commit 2 — after Commit 1 lands, so its hash exists
285
+ python3 "$R/scripts/forge-session.py" state-complete \
286
+ --feature "{feature}" --stage "{stage}" --version {n} \
287
+ --commit-hash "$(git rev-parse HEAD)" --specs-dir "{specsDir}"
288
+ ```
289
+
251
290
  ## Stage-Entry Guard
252
291
 
253
292
  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 +302,27 @@ Invoke this block at the **start of an authoring stage** (`forge-1-prd`..`forge-
263
302
 
264
303
  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
304
 
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)
305
+ **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:
306
+
307
+ ```bash
308
+ 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')"
309
+ [ -n "$R" ] || { echo "feature-forge: cannot locate plugin root" >&2; exit 1; }
310
+ python3 "$R/scripts/forge-session.py" state-enter \
311
+ --feature "{feature}" --stage "{stage}" --specs-dir "{specsDir}"
312
+ ```
270
313
 
271
314
  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
315
 
273
316
  **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
317
 
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.
318
+ **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.
319
+
320
+ ```bash
321
+ 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')"
322
+ [ -n "$R" ] || { echo "feature-forge: cannot locate plugin root" >&2; exit 1; }
323
+ python3 "$R/scripts/forge-session.py" state-artifact \
324
+ --feature "{feature}" --stage "{stage}" --path "<file>" --specs-dir "{specsDir}"
325
+ ```
276
326
 
277
327
  ## Stage-Completion Re-check
278
328
 
@@ -182,10 +182,20 @@ concrete cache backend that `forge-2-tech` will design). Soliciting it here gues
182
182
  of the stage that owns the context, and the answer has nowhere durable to live.
183
183
 
184
184
  Instead, when you notice a decision that belongs downstream, **record it structurally** as
185
- a `deferredDecisions[]` entry on this feature's `.pipeline-state.json` (schema in
186
- `references/pipeline-state-schema.json`; same direct-edit path as `notes` /
187
- `epicChangeRequests[]`): `question` (phrased for the target stage), optional `rationale`
188
- and `targetStage`, `raisedBy` (this stage), `raisedAt` (ISO-8601 UTC), `status: "open"`.
185
+ a `deferredDecisions[]` entry on this feature's `.pipeline-state.json` by running
186
+ `state-decision` (`--rationale` and `--target-stage` are optional; the verb stamps
187
+ `raisedAt` and `status: "open"` for you). Add `--epic "{epic}"` when this feature is an
188
+ epic member — required, per the Pipeline State Protocol in `references/shared-conventions.md`:
189
+
190
+ ```bash
191
+ 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')"
192
+ [ -n "$R" ] || { echo "feature-forge: cannot locate plugin root" >&2; exit 1; }
193
+ python3 "$R/scripts/forge-session.py" state-decision \
194
+ --feature "{feature}" --question "<phrased for the target stage>" \
195
+ --rationale "<why it belongs downstream>" --target-stage "<owning stage>" \
196
+ --raised-by "{stage}" --specs-dir "{specsDir}"
197
+ ```
198
+
189
199
  This keeps the exit focused on *this* stage's next-step routing while carrying the open
190
200
  question forward for the owning stage to resolve (it flips `status` to `addressed` when it
191
201
  does). Prefer a `deferredDecisions[]` entry over stuffing the same thing into the free-text
@@ -231,7 +231,7 @@ so the navigator and resolver can see them before any stage runs. For each `feat
231
231
  standalone feature. **No per-feature `status` beyond the stage entry** — the member state
232
232
  holds derived stage progress only.
233
233
 
234
- For an example member state, read `references/edit-mode.md` (Member State Example section).
234
+ For an example member state, read `references/edit-mode.md` (Member State Example section). This stub is written by hand rather than by a `state-*` verb — deliberately: no verb writes the `epic` back-pointer a brand-new member needs, so this is a sanctioned exception to the Pipeline State Protocol.
235
235
 
236
236
  The member subtree holds the **same** artifact set a standalone feature holds; only
237
237
  `.pipeline-state.json` exists at creation. No PRD/specs are authored here. The epic subtree is
@@ -33,7 +33,7 @@
33
33
  "currentStage": {
34
34
  "type": "string",
35
35
  "enum": ["forge-1-prd", "forge-2-tech", "forge-3-specs", "forge-4-backlog", "forge-5-loop", "forge-6-docs", "complete", "forge-verify-prd", "forge-verify-tech", "forge-verify-specs", "forge-verify-backlog", "forge-verify-impl", "forge-0-epic", "forge-verify-epic"],
36
- "description": "Where the pipeline IS: the most recently started stage — its `stages[<currentStage>].status` is `in-progress` while that stage is being authored, then `complete` once its artifacts are committed. A stage skill sets this to its own id when it starts. This is deliberately NOT 'the next stage to run': the next stage is DERIVED, never stored — it is the first production stage whose `stages[].status` is not `complete` (see `next_stage()` in forge-session.py, surfaced as the navigator/doctor `nextStage`). Consumers that need 'what runs next' compute it from `stages[].status`, not from this field. `complete` here means the whole pipeline is done. (Legacy/absent value: tools fall back to the derived next stage for display only — `build_rows` in forge-session.py.)"
36
+ "description": "Where the pipeline IS: the most recently started stage — its `stages[<currentStage>].status` is `in-progress` while that stage is being authored, then `complete` once its artifacts are committed. A stage skill sets this to its own id when it starts. This is deliberately NOT 'the next stage to run': the next stage is DERIVED, never stored — it is the first production stage whose `stages[].status` is not `complete` (see `next_stage()` in forge-session.py, surfaced as the navigator/doctor `nextStage`). Consumers that need 'what runs next' compute it from `stages[].status`, not from this field. `complete` is a LEGACY enum value, retained so pre-0.14 state files still validate: no writer produces it (the `state-*` verbs are the only writers, and only `state-enter` touches this field, setting it to the stage being entered). A finished pipeline therefore records the last stage it started — `forge-6-docs` — and 'the whole pipeline is done' is DERIVED too: `next_stage()` returns null (surfaced as `nextStage: null` / `complete: true`). Never test this field against `complete` to decide whether a pipeline finished. (Legacy/absent value: tools fall back to the derived next stage for display only — `build_rows` in forge-session.py.)"
37
37
  },
38
38
  "notes": {
39
39
  "type": "string",
@@ -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,11 @@ 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.
187
193
 
188
194
  ### Staleness Detection (Read-Time)
189
195
 
@@ -214,7 +220,16 @@ Invoke this block at the **very start** of a pipeline entry point — `forge-1-p
214
220
  - **Create** → `git switch -c {branchPrefix}{label}` (or `git checkout -b` if `switch` is unavailable). If the branch already exists, `git switch {branchPrefix}{label}`.
215
221
  - **Stay** → proceed on the default branch; note that subsequent commits (and any `forge-5-loop` run) will land directly on `{defaultBranch}`.
216
222
 
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.
223
+ **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.
224
+
225
+ ```bash
226
+ 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')"
227
+ [ -n "$R" ] || { echo "feature-forge: cannot locate plugin root" >&2; exit 1; }
228
+ python3 "$R/scripts/forge-session.py" state-branch \
229
+ --feature "{feature}" --branch "<name>" --specs-dir "{specsDir}"
230
+ ```
231
+
232
+ Downstream stages and `forge-5-loop` read it to detect drift back onto the default branch.
218
233
 
219
234
  ## Branch Reconciliation
220
235
 
@@ -227,10 +242,19 @@ python3 "$R/scripts/forge-session.py" reconcile-branch --feature "{feature}" --s
227
242
  ```
228
243
 
229
244
  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).
245
+ - **`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
246
  - **`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
247
  - **`none`** / **`not-resolved`** — nothing to do; proceed.
233
248
 
249
+ 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:
250
+
251
+ ```bash
252
+ 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')"
253
+ [ -n "$R" ] || { echo "feature-forge: cannot locate plugin root" >&2; exit 1; }
254
+ python3 "$R/scripts/forge-session.py" state-branch \
255
+ --feature "{feature}" --branch "{newBranch}" --specs-dir "{specsDir}"
256
+ ```
257
+
234
258
  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
259
 
236
260
  ## Git Commit Protocol
@@ -240,14 +264,29 @@ When `gitCommitAfterStage` is true, follow this exact order to avoid state incon
240
264
  **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
265
 
242
266
  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:
267
+ 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.
268
+ 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.
269
+ 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
270
  - **Pre-commit hook failure:** Report the hook output. Never use `--no-verify` to bypass. Help the user fix the underlying issue.
247
271
  - **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.
272
+ - **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
273
  5. **Never** use `git add -A`, `--amend`, `--no-verify`, or `--force` flags
250
274
 
275
+ 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:
276
+
277
+ ```bash
278
+ 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')"
279
+ [ -n "$R" ] || { echo "feature-forge: cannot locate plugin root" >&2; exit 1; }
280
+ # Commit 1 — before `git commit`
281
+ python3 "$R/scripts/forge-session.py" state-complete \
282
+ --feature "{feature}" --stage "{stage}" --version {n} \
283
+ --based-on "<upstream>=<n>" --artifact "<file>" --specs-dir "{specsDir}"
284
+ # Commit 2 — after Commit 1 lands, so its hash exists
285
+ python3 "$R/scripts/forge-session.py" state-complete \
286
+ --feature "{feature}" --stage "{stage}" --version {n} \
287
+ --commit-hash "$(git rev-parse HEAD)" --specs-dir "{specsDir}"
288
+ ```
289
+
251
290
  ## Stage-Entry Guard
252
291
 
253
292
  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 +302,27 @@ Invoke this block at the **start of an authoring stage** (`forge-1-prd`..`forge-
263
302
 
264
303
  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
304
 
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)
305
+ **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:
306
+
307
+ ```bash
308
+ 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')"
309
+ [ -n "$R" ] || { echo "feature-forge: cannot locate plugin root" >&2; exit 1; }
310
+ python3 "$R/scripts/forge-session.py" state-enter \
311
+ --feature "{feature}" --stage "{stage}" --specs-dir "{specsDir}"
312
+ ```
270
313
 
271
314
  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
315
 
273
316
  **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
317
 
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.
318
+ **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.
319
+
320
+ ```bash
321
+ 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')"
322
+ [ -n "$R" ] || { echo "feature-forge: cannot locate plugin root" >&2; exit 1; }
323
+ python3 "$R/scripts/forge-session.py" state-artifact \
324
+ --feature "{feature}" --stage "{stage}" --path "<file>" --specs-dir "{specsDir}"
325
+ ```
276
326
 
277
327
  ## Stage-Completion Re-check
278
328
 
@@ -182,10 +182,20 @@ concrete cache backend that `forge-2-tech` will design). Soliciting it here gues
182
182
  of the stage that owns the context, and the answer has nowhere durable to live.
183
183
 
184
184
  Instead, when you notice a decision that belongs downstream, **record it structurally** as
185
- a `deferredDecisions[]` entry on this feature's `.pipeline-state.json` (schema in
186
- `references/pipeline-state-schema.json`; same direct-edit path as `notes` /
187
- `epicChangeRequests[]`): `question` (phrased for the target stage), optional `rationale`
188
- and `targetStage`, `raisedBy` (this stage), `raisedAt` (ISO-8601 UTC), `status: "open"`.
185
+ a `deferredDecisions[]` entry on this feature's `.pipeline-state.json` by running
186
+ `state-decision` (`--rationale` and `--target-stage` are optional; the verb stamps
187
+ `raisedAt` and `status: "open"` for you). Add `--epic "{epic}"` when this feature is an
188
+ epic member — required, per the Pipeline State Protocol in `references/shared-conventions.md`:
189
+
190
+ ```bash
191
+ 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')"
192
+ [ -n "$R" ] || { echo "feature-forge: cannot locate plugin root" >&2; exit 1; }
193
+ python3 "$R/scripts/forge-session.py" state-decision \
194
+ --feature "{feature}" --question "<phrased for the target stage>" \
195
+ --rationale "<why it belongs downstream>" --target-stage "<owning stage>" \
196
+ --raised-by "{stage}" --specs-dir "{specsDir}"
197
+ ```
198
+
189
199
  This keeps the exit focused on *this* stage's next-step routing while carrying the open
190
200
  question forward for the owning stage to resolve (it flips `status` to `addressed` when it
191
201
  does). Prefer a `deferredDecisions[]` entry over stuffing the same thing into the free-text
@@ -99,7 +99,16 @@ Before moving to Step 4, summarize your coverage as text, then use `AskUserQuest
99
99
 
100
100
  **Parking lot:** If the user raises a concern that belongs to a different pipeline stage, acknowledge it and note it in the pipeline state's `notes` field: "Good point — I've noted that for the [tech spec/implementation specs]. Let's continue with [current stage]."
101
101
 
102
- **Epic-level concern (backflow):** The parking lot above is for concerns about a *later stage of THIS feature*. If instead the interview reveals the **epic decomposition itself** is wrong — a **sibling feature must be added**, a **frozen boundary between features must move**, a feature must **split**, or a **dependency edge is wrong** — that is an *epic-level* concern and does **not** go in `notes`. It only applies when this feature is an epic member (its `.pipeline-state.json` has an `epic` back-pointer); for a standalone feature there is no epic to reconcile, so treat the concern as same-feature or out of scope. To record one, append an entry to the member state's `epicChangeRequests[]` array (same direct-edit path as `notes`; schema in `references/pipeline-state-schema.json`): `kind` (`add-feature`|`redep`|`move-boundary`|`split`), `target`, `rationale`, `raisedBy: "forge-1-prd"`, `raisedAt` (ISO-8601 UTC), `status: "open"`, and `blocksCurrent`. Set `blocksCurrent: true` when the change alters a contract (`exposes`/`consumes`) or dependency edge this feature relies on for its *next* stage (proceeding would build specs on a soon-to-change decomposition); `false` for a peer/downstream change this feature does not consume. When the change touches a contract/dep edge and the classification is genuinely ambiguous, confirm `blocksCurrent` with a single `AskUserQuestion`, defaulting to `true` (a false negative silently diverges two members' contracts). **Do not** edit `epic-manifest.json` here — recording is not applying; only `/feature-forge:forge-0-epic` edit mode mutates the epic. Then acknowledge without blocking: "That's an epic-level change — I've recorded it so `forge-0-epic` can reconcile it. [Blocking: We'll want to reconcile the epic before writing specs. | Non-blocking: We can finish this feature first and reconcile when convenient.]" and continue the interview.
102
+ **Epic-level concern (backflow):** The parking lot above is for concerns about a *later stage of THIS feature*. If instead the interview reveals the **epic decomposition itself** is wrong — a **sibling feature must be added**, a **frozen boundary between features must move**, a feature must **split**, or a **dependency edge is wrong** — that is an *epic-level* concern and does **not** go in `notes`. It only applies when this feature is an epic member (its `.pipeline-state.json` has an `epic` back-pointer); for a standalone feature there is no epic to reconcile, so treat the concern as same-feature or out of scope. To record one, run `state-ecr` (fenced below) with `--kind` (`add-feature`|`redep`|`move-boundary`|`split`), `--target`, `--rationale`, `--raised-by forge-1-prd` and `--blocks-current` — it appends the entry to the member state's `epicChangeRequests[]` array, filling in `raisedAt` (ISO-8601 UTC) and `status: "open"` for you. Set `blocksCurrent: true` when the change alters a contract (`exposes`/`consumes`) or dependency edge this feature relies on for its *next* stage (proceeding would build specs on a soon-to-change decomposition); `false` for a peer/downstream change this feature does not consume. When the change touches a contract/dep edge and the classification is genuinely ambiguous, confirm `blocksCurrent` with a single `AskUserQuestion`, defaulting to `true` (a false negative silently diverges two members' contracts). **Do not** edit `epic-manifest.json` here — recording is not applying; only `/feature-forge:forge-0-epic` edit mode mutates the epic. Then acknowledge without blocking: "That's an epic-level change — I've recorded it so `forge-0-epic` can reconcile it. [Blocking: We'll want to reconcile the epic before writing specs. | Non-blocking: We can finish this feature first and reconcile when convenient.]" and continue the interview.
103
+
104
+ ```bash
105
+ 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')"
106
+ [ -n "$R" ] || { echo "feature-forge: cannot locate plugin root" >&2; exit 1; }
107
+ python3 "$R/scripts/forge-session.py" state-ecr \
108
+ --feature "{feature}" --epic "{epic}" --kind "<kind>" --target "<target>" \
109
+ --rationale "<why>" --raised-by forge-1-prd --blocks-current "<true|false>" \
110
+ --specs-dir "{specsDir}"
111
+ ```
103
112
 
104
113
  ## Step 4: Write the PRD
105
114
 
@@ -124,18 +133,26 @@ Iterate until the user confirms the PRD is complete.
124
133
 
125
134
  Before writing state or running the stage exit, invoke the **Stage-Completion Re-check** block in `references/shared-conventions.md` with `{stage}` = `forge-1-prd` — a resumed mid-stage continuation must not overwrite a committed `PRD.md` or re-fire a finished exit.
126
135
 
127
- Write pipeline state conforming to `references/pipeline-state-schema.json`.
136
+ Pipeline state is written by the `state-*` verbs — see the Pipeline State Protocol in `references/shared-conventions.md`.
128
137
 
129
- 1. Create or update `{resolvedFeatureDir}/.pipeline-state.json`:
130
- - Set `currentStage` to `forge-2-tech`
131
- - Set `stages.forge-1-prd.version` to 1 (or increment if revising)
132
- - Record `artifacts`, `completedAt`
133
- - Set `stages.forge-1-prd.basedOnVersions` to `{}` (no upstream dependencies)
134
- - Check downstream stages (`forge-2-tech`, `forge-3-specs`, `forge-4-backlog`, `forge-5-loop`, `forge-6-docs`). If any have `basedOnVersions` referencing an older version of `forge-1-prd`, set their status to `stale`.
138
+ 1. Record completion by running `state-complete` (below) with `--version` 1 (or the incremented version if revising) and one `--artifact` per file this stage produced. It sets `status: "complete"`, `completedAt`, the version and `basedOnVersions` (`{}` here — no upstream dependencies), and applies the downstream staleness cascade deterministically, so no downstream status is set by hand.
135
139
  2. **Offer a note — don't force one.** As a statement (not a blocking question), let the user know they can jot anything worth preserving across sessions and you'll store it in the `notes` field. If they volunteer something, store it; otherwise proceed.
136
140
  3. If `gitCommitAfterStage` is true, follow the Git Commit Protocol in `references/shared-conventions.md`: stage files (including `{specsDir}/AGENTS.md` / `{specsDir}/CLAUDE.md` if the Specs Directory Hygiene step just wrote them), attempt commit with message `"{commitPrefix}({feature}): complete PRD v{n}"` (marking `stages.forge-1-prd.status` `complete` with `commitHash: null` in that commit), then record the artifact-commit hash via the protocol's two-commit follow-up (never `--amend`) only on success. If commit fails, leave status as `in-progress`.
137
141
  4. **Close with the Stage Exit Protocol** (single-sourced in `references/stage-exit-protocol.md`; do not improvise a "Next steps" list):
138
142
 
143
+ The `state-complete` call for item 1 — and the `state-note` call only when the user volunteered a note in item 2 — with the portable plugin-root prelude. Add `--epic "{epic}"` to each call when this feature is an epic member — required, per the Pipeline State Protocol in `references/shared-conventions.md`:
144
+
145
+ ```bash
146
+ R="$(bash -c 'for d in "${CLAUDE_PLUGIN_ROOT:-}" "$HOME"/.claude/skills/feature-forge "$HOME"/.claude/plugins/cache/*/feature-forge/* "$HOME"/.claude/plugins/*/feature-forge "$HOME"/.agents/skills/feature-forge ./.agents/skills/feature-forge; do [ -x "$d/scripts/forge-root.sh" ] && exec "$d/scripts/forge-root.sh"; done')"
147
+ [ -n "$R" ] || { echo "feature-forge: cannot locate plugin root" >&2; exit 1; }
148
+ python3 "$R/scripts/forge-session.py" state-complete \
149
+ --feature "{feature}" --stage forge-1-prd --version {n} \
150
+ --artifact PRD.md --specs-dir "{specsDir}"
151
+ # ONLY run the next call if the user volunteered a note in item 2 — otherwise stop here.
152
+ python3 "$R/scripts/forge-session.py" state-note \
153
+ --feature "{feature}" --note "<what the user volunteered>" --specs-dir "{specsDir}"
154
+ ```
155
+
139
156
  **Close this stage with the Scripted Stage Exit** (contract: `references/stage-exit-protocol.md`; do not improvise a "Next steps" list). Run:
140
157
 
141
158
  ```bash