@garygentry/feature-forge 0.2.12 → 0.2.13

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 (323) hide show
  1. package/adapters/GENERATION-REPORT.md +1 -0
  2. package/adapters/claude/.feature-forge-bundle.json +1 -1
  3. package/adapters/claude/references/forge-config-schema.json +5 -0
  4. package/adapters/claude/scripts/epic-manifest.py +209 -0
  5. package/adapters/claude/scripts/forge-bootstrap.py +1 -0
  6. package/adapters/claude/scripts/forge-init.sh +2 -0
  7. package/adapters/claude/skills/forge/SKILL.md +9 -1
  8. package/adapters/claude/skills/forge/references/pipeline-state-schema.json +191 -0
  9. package/adapters/claude/skills/forge/references/process-overview.md +143 -0
  10. package/adapters/claude/skills/forge/references/shared-conventions.md +283 -0
  11. package/adapters/claude/skills/forge/references/stage-exit-protocol.md +258 -0
  12. package/adapters/claude/skills/forge-0-epic/references/epic-manifest-subcommands.md +11 -0
  13. package/adapters/claude/skills/forge-0-epic/references/pipeline-state-schema.json +191 -0
  14. package/adapters/claude/skills/forge-0-epic/references/portable-root.md +71 -0
  15. package/adapters/claude/skills/forge-0-epic/references/shared-conventions.md +283 -0
  16. package/adapters/claude/skills/forge-0-epic/references/stage-exit-protocol.md +258 -0
  17. package/adapters/claude/skills/forge-1-prd/references/pipeline-state-schema.json +191 -0
  18. package/adapters/claude/skills/forge-1-prd/references/shared-conventions.md +283 -0
  19. package/adapters/claude/skills/forge-1-prd/references/stage-exit-protocol.md +258 -0
  20. package/adapters/claude/skills/forge-2-tech/SKILL.md +1 -1
  21. package/adapters/claude/skills/forge-2-tech/references/pipeline-state-schema.json +191 -0
  22. package/adapters/claude/skills/forge-2-tech/references/shared-conventions.md +283 -0
  23. package/adapters/claude/skills/forge-2-tech/references/stack-resolution.md +54 -0
  24. package/adapters/claude/skills/forge-2-tech/references/stacks/_generic.md +90 -0
  25. package/adapters/claude/skills/forge-2-tech/references/stacks/go.md +138 -0
  26. package/adapters/claude/skills/forge-2-tech/references/stacks/python.md +163 -0
  27. package/adapters/claude/skills/forge-2-tech/references/stacks/rust.md +151 -0
  28. package/adapters/claude/skills/forge-2-tech/references/stacks/typescript.md +111 -0
  29. package/adapters/claude/skills/forge-2-tech/references/stage-exit-protocol.md +258 -0
  30. package/adapters/claude/skills/forge-3-specs/references/pipeline-state-schema.json +191 -0
  31. package/adapters/claude/skills/forge-3-specs/references/shared-conventions.md +283 -0
  32. package/adapters/claude/skills/forge-3-specs/references/stacks/_generic.md +90 -0
  33. package/adapters/claude/skills/forge-3-specs/references/stacks/go.md +138 -0
  34. package/adapters/claude/skills/forge-3-specs/references/stacks/python.md +163 -0
  35. package/adapters/claude/skills/forge-3-specs/references/stacks/rust.md +151 -0
  36. package/adapters/claude/skills/forge-3-specs/references/stacks/typescript.md +111 -0
  37. package/adapters/claude/skills/forge-3-specs/references/stage-exit-protocol.md +258 -0
  38. package/adapters/claude/skills/forge-4-backlog/references/forge-config-schema.json +236 -0
  39. package/adapters/claude/skills/forge-4-backlog/references/pipeline-state-schema.json +191 -0
  40. package/adapters/claude/skills/forge-4-backlog/references/shared-conventions.md +283 -0
  41. package/adapters/claude/skills/forge-4-backlog/references/stage-exit-protocol.md +258 -0
  42. package/adapters/claude/skills/forge-5-loop/references/forge-config-schema.json +236 -0
  43. package/adapters/claude/skills/forge-5-loop/references/ralph-loop-contract.md +221 -0
  44. package/adapters/claude/skills/forge-5-loop/references/shared-conventions.md +283 -0
  45. package/adapters/claude/skills/forge-5-loop/references/stage-exit-protocol.md +258 -0
  46. package/adapters/claude/skills/forge-6-docs/SKILL.md +4 -1
  47. package/adapters/claude/skills/forge-6-docs/references/pipeline-state-schema.json +191 -0
  48. package/adapters/claude/skills/forge-6-docs/references/shared-conventions.md +283 -0
  49. package/adapters/claude/skills/forge-fix/references/shared-conventions.md +283 -0
  50. package/adapters/claude/skills/forge-fix/references/stage-exit-protocol.md +258 -0
  51. package/adapters/claude/skills/forge-guide/references/forge-config-schema.json +236 -0
  52. package/adapters/claude/skills/forge-guide/references/process-overview.md +143 -0
  53. package/adapters/claude/skills/forge-guide/references/ralph-loop-contract.md +221 -0
  54. package/adapters/claude/skills/forge-guide/references/shared-conventions.md +283 -0
  55. package/adapters/claude/skills/forge-guide/references/stack-resolution.md +54 -0
  56. package/adapters/claude/skills/forge-guide/references/stacks/_generic.md +90 -0
  57. package/adapters/claude/skills/forge-guide/references/stacks/go.md +138 -0
  58. package/adapters/claude/skills/forge-guide/references/stacks/python.md +163 -0
  59. package/adapters/claude/skills/forge-guide/references/stacks/rust.md +151 -0
  60. package/adapters/claude/skills/forge-guide/references/stacks/typescript.md +111 -0
  61. package/adapters/claude/skills/forge-init/SKILL.md +1 -0
  62. package/adapters/claude/skills/forge-verify/SKILL.md +4 -3
  63. package/adapters/claude/skills/forge-verify/references/pipeline-state-schema.json +191 -0
  64. package/adapters/claude/skills/forge-verify/references/shared-conventions.md +283 -0
  65. package/adapters/claude/skills/forge-verify/references/verification-checklists.md +7 -0
  66. package/adapters/codex/.feature-forge-bundle.json +1 -1
  67. package/adapters/codex/references/forge-config-schema.json +5 -0
  68. package/adapters/codex/scripts/epic-manifest.py +209 -0
  69. package/adapters/codex/scripts/forge-bootstrap.py +1 -0
  70. package/adapters/codex/scripts/forge-init.sh +2 -0
  71. package/adapters/codex/skills/forge/SKILL.md +9 -1
  72. package/adapters/codex/skills/forge/references/pipeline-state-schema.json +191 -0
  73. package/adapters/codex/skills/forge/references/process-overview.md +143 -0
  74. package/adapters/codex/skills/forge/references/shared-conventions.md +283 -0
  75. package/adapters/codex/skills/forge/references/stage-exit-protocol.md +258 -0
  76. package/adapters/codex/skills/forge-0-epic/references/epic-manifest-subcommands.md +11 -0
  77. package/adapters/codex/skills/forge-0-epic/references/pipeline-state-schema.json +191 -0
  78. package/adapters/codex/skills/forge-0-epic/references/portable-root.md +71 -0
  79. package/adapters/codex/skills/forge-0-epic/references/shared-conventions.md +283 -0
  80. package/adapters/codex/skills/forge-0-epic/references/stage-exit-protocol.md +258 -0
  81. package/adapters/codex/skills/forge-1-prd/references/pipeline-state-schema.json +191 -0
  82. package/adapters/codex/skills/forge-1-prd/references/shared-conventions.md +283 -0
  83. package/adapters/codex/skills/forge-1-prd/references/stage-exit-protocol.md +258 -0
  84. package/adapters/codex/skills/forge-2-tech/SKILL.md +1 -1
  85. package/adapters/codex/skills/forge-2-tech/references/pipeline-state-schema.json +191 -0
  86. package/adapters/codex/skills/forge-2-tech/references/shared-conventions.md +283 -0
  87. package/adapters/codex/skills/forge-2-tech/references/stack-resolution.md +54 -0
  88. package/adapters/codex/skills/forge-2-tech/references/stacks/_generic.md +90 -0
  89. package/adapters/codex/skills/forge-2-tech/references/stacks/go.md +138 -0
  90. package/adapters/codex/skills/forge-2-tech/references/stacks/python.md +163 -0
  91. package/adapters/codex/skills/forge-2-tech/references/stacks/rust.md +151 -0
  92. package/adapters/codex/skills/forge-2-tech/references/stacks/typescript.md +111 -0
  93. package/adapters/codex/skills/forge-2-tech/references/stage-exit-protocol.md +258 -0
  94. package/adapters/codex/skills/forge-3-specs/references/pipeline-state-schema.json +191 -0
  95. package/adapters/codex/skills/forge-3-specs/references/shared-conventions.md +283 -0
  96. package/adapters/codex/skills/forge-3-specs/references/stacks/_generic.md +90 -0
  97. package/adapters/codex/skills/forge-3-specs/references/stacks/go.md +138 -0
  98. package/adapters/codex/skills/forge-3-specs/references/stacks/python.md +163 -0
  99. package/adapters/codex/skills/forge-3-specs/references/stacks/rust.md +151 -0
  100. package/adapters/codex/skills/forge-3-specs/references/stacks/typescript.md +111 -0
  101. package/adapters/codex/skills/forge-3-specs/references/stage-exit-protocol.md +258 -0
  102. package/adapters/codex/skills/forge-4-backlog/references/forge-config-schema.json +236 -0
  103. package/adapters/codex/skills/forge-4-backlog/references/pipeline-state-schema.json +191 -0
  104. package/adapters/codex/skills/forge-4-backlog/references/shared-conventions.md +283 -0
  105. package/adapters/codex/skills/forge-4-backlog/references/stage-exit-protocol.md +258 -0
  106. package/adapters/codex/skills/forge-5-loop/references/forge-config-schema.json +236 -0
  107. package/adapters/codex/skills/forge-5-loop/references/ralph-loop-contract.md +221 -0
  108. package/adapters/codex/skills/forge-5-loop/references/shared-conventions.md +283 -0
  109. package/adapters/codex/skills/forge-5-loop/references/stage-exit-protocol.md +258 -0
  110. package/adapters/codex/skills/forge-6-docs/SKILL.md +4 -1
  111. package/adapters/codex/skills/forge-6-docs/references/pipeline-state-schema.json +191 -0
  112. package/adapters/codex/skills/forge-6-docs/references/shared-conventions.md +283 -0
  113. package/adapters/codex/skills/forge-fix/references/shared-conventions.md +283 -0
  114. package/adapters/codex/skills/forge-fix/references/stage-exit-protocol.md +258 -0
  115. package/adapters/codex/skills/forge-guide/references/forge-config-schema.json +236 -0
  116. package/adapters/codex/skills/forge-guide/references/process-overview.md +143 -0
  117. package/adapters/codex/skills/forge-guide/references/ralph-loop-contract.md +221 -0
  118. package/adapters/codex/skills/forge-guide/references/shared-conventions.md +283 -0
  119. package/adapters/codex/skills/forge-guide/references/stack-resolution.md +54 -0
  120. package/adapters/codex/skills/forge-guide/references/stacks/_generic.md +90 -0
  121. package/adapters/codex/skills/forge-guide/references/stacks/go.md +138 -0
  122. package/adapters/codex/skills/forge-guide/references/stacks/python.md +163 -0
  123. package/adapters/codex/skills/forge-guide/references/stacks/rust.md +151 -0
  124. package/adapters/codex/skills/forge-guide/references/stacks/typescript.md +111 -0
  125. package/adapters/codex/skills/forge-init/SKILL.md +1 -0
  126. package/adapters/codex/skills/forge-verify/SKILL.md +4 -3
  127. package/adapters/codex/skills/forge-verify/references/pipeline-state-schema.json +191 -0
  128. package/adapters/codex/skills/forge-verify/references/shared-conventions.md +283 -0
  129. package/adapters/codex/skills/forge-verify/references/verification-checklists.md +7 -0
  130. package/adapters/copilot/.feature-forge-bundle.json +1 -1
  131. package/adapters/copilot/references/forge-config-schema.json +5 -0
  132. package/adapters/copilot/scripts/epic-manifest.py +209 -0
  133. package/adapters/copilot/scripts/forge-bootstrap.py +1 -0
  134. package/adapters/copilot/scripts/forge-init.sh +2 -0
  135. package/adapters/copilot/skills/forge/forge.md +9 -1
  136. package/adapters/copilot/skills/forge/references/pipeline-state-schema.json +191 -0
  137. package/adapters/copilot/skills/forge/references/process-overview.md +143 -0
  138. package/adapters/copilot/skills/forge/references/shared-conventions.md +283 -0
  139. package/adapters/copilot/skills/forge/references/stage-exit-protocol.md +258 -0
  140. package/adapters/copilot/skills/forge-0-epic/references/epic-manifest-subcommands.md +11 -0
  141. package/adapters/copilot/skills/forge-0-epic/references/pipeline-state-schema.json +191 -0
  142. package/adapters/copilot/skills/forge-0-epic/references/portable-root.md +71 -0
  143. package/adapters/copilot/skills/forge-0-epic/references/shared-conventions.md +283 -0
  144. package/adapters/copilot/skills/forge-0-epic/references/stage-exit-protocol.md +258 -0
  145. package/adapters/copilot/skills/forge-1-prd/references/pipeline-state-schema.json +191 -0
  146. package/adapters/copilot/skills/forge-1-prd/references/shared-conventions.md +283 -0
  147. package/adapters/copilot/skills/forge-1-prd/references/stage-exit-protocol.md +258 -0
  148. package/adapters/copilot/skills/forge-2-tech/forge-2-tech.md +1 -1
  149. package/adapters/copilot/skills/forge-2-tech/references/pipeline-state-schema.json +191 -0
  150. package/adapters/copilot/skills/forge-2-tech/references/shared-conventions.md +283 -0
  151. package/adapters/copilot/skills/forge-2-tech/references/stack-resolution.md +54 -0
  152. package/adapters/copilot/skills/forge-2-tech/references/stacks/_generic.md +90 -0
  153. package/adapters/copilot/skills/forge-2-tech/references/stacks/go.md +138 -0
  154. package/adapters/copilot/skills/forge-2-tech/references/stacks/python.md +163 -0
  155. package/adapters/copilot/skills/forge-2-tech/references/stacks/rust.md +151 -0
  156. package/adapters/copilot/skills/forge-2-tech/references/stacks/typescript.md +111 -0
  157. package/adapters/copilot/skills/forge-2-tech/references/stage-exit-protocol.md +258 -0
  158. package/adapters/copilot/skills/forge-3-specs/references/pipeline-state-schema.json +191 -0
  159. package/adapters/copilot/skills/forge-3-specs/references/shared-conventions.md +283 -0
  160. package/adapters/copilot/skills/forge-3-specs/references/stacks/_generic.md +90 -0
  161. package/adapters/copilot/skills/forge-3-specs/references/stacks/go.md +138 -0
  162. package/adapters/copilot/skills/forge-3-specs/references/stacks/python.md +163 -0
  163. package/adapters/copilot/skills/forge-3-specs/references/stacks/rust.md +151 -0
  164. package/adapters/copilot/skills/forge-3-specs/references/stacks/typescript.md +111 -0
  165. package/adapters/copilot/skills/forge-3-specs/references/stage-exit-protocol.md +258 -0
  166. package/adapters/copilot/skills/forge-4-backlog/references/forge-config-schema.json +236 -0
  167. package/adapters/copilot/skills/forge-4-backlog/references/pipeline-state-schema.json +191 -0
  168. package/adapters/copilot/skills/forge-4-backlog/references/shared-conventions.md +283 -0
  169. package/adapters/copilot/skills/forge-4-backlog/references/stage-exit-protocol.md +258 -0
  170. package/adapters/copilot/skills/forge-5-loop/references/forge-config-schema.json +236 -0
  171. package/adapters/copilot/skills/forge-5-loop/references/ralph-loop-contract.md +221 -0
  172. package/adapters/copilot/skills/forge-5-loop/references/shared-conventions.md +283 -0
  173. package/adapters/copilot/skills/forge-5-loop/references/stage-exit-protocol.md +258 -0
  174. package/adapters/copilot/skills/forge-6-docs/forge-6-docs.md +4 -1
  175. package/adapters/copilot/skills/forge-6-docs/references/pipeline-state-schema.json +191 -0
  176. package/adapters/copilot/skills/forge-6-docs/references/shared-conventions.md +283 -0
  177. package/adapters/copilot/skills/forge-fix/references/shared-conventions.md +283 -0
  178. package/adapters/copilot/skills/forge-fix/references/stage-exit-protocol.md +258 -0
  179. package/adapters/copilot/skills/forge-guide/references/forge-config-schema.json +236 -0
  180. package/adapters/copilot/skills/forge-guide/references/process-overview.md +143 -0
  181. package/adapters/copilot/skills/forge-guide/references/ralph-loop-contract.md +221 -0
  182. package/adapters/copilot/skills/forge-guide/references/shared-conventions.md +283 -0
  183. package/adapters/copilot/skills/forge-guide/references/stack-resolution.md +54 -0
  184. package/adapters/copilot/skills/forge-guide/references/stacks/_generic.md +90 -0
  185. package/adapters/copilot/skills/forge-guide/references/stacks/go.md +138 -0
  186. package/adapters/copilot/skills/forge-guide/references/stacks/python.md +163 -0
  187. package/adapters/copilot/skills/forge-guide/references/stacks/rust.md +151 -0
  188. package/adapters/copilot/skills/forge-guide/references/stacks/typescript.md +111 -0
  189. package/adapters/copilot/skills/forge-init/forge-init.md +1 -0
  190. package/adapters/copilot/skills/forge-verify/forge-verify.md +4 -3
  191. package/adapters/copilot/skills/forge-verify/references/pipeline-state-schema.json +191 -0
  192. package/adapters/copilot/skills/forge-verify/references/shared-conventions.md +283 -0
  193. package/adapters/copilot/skills/forge-verify/references/verification-checklists.md +7 -0
  194. package/adapters/cursor/.feature-forge-bundle.json +1 -1
  195. package/adapters/cursor/references/forge-config-schema.json +5 -0
  196. package/adapters/cursor/scripts/epic-manifest.py +209 -0
  197. package/adapters/cursor/scripts/forge-bootstrap.py +1 -0
  198. package/adapters/cursor/scripts/forge-init.sh +2 -0
  199. package/adapters/cursor/skills/forge/forge.mdc +9 -1
  200. package/adapters/cursor/skills/forge/references/pipeline-state-schema.json +191 -0
  201. package/adapters/cursor/skills/forge/references/process-overview.md +143 -0
  202. package/adapters/cursor/skills/forge/references/shared-conventions.md +283 -0
  203. package/adapters/cursor/skills/forge/references/stage-exit-protocol.md +258 -0
  204. package/adapters/cursor/skills/forge-0-epic/references/epic-manifest-subcommands.md +11 -0
  205. package/adapters/cursor/skills/forge-0-epic/references/pipeline-state-schema.json +191 -0
  206. package/adapters/cursor/skills/forge-0-epic/references/portable-root.md +71 -0
  207. package/adapters/cursor/skills/forge-0-epic/references/shared-conventions.md +283 -0
  208. package/adapters/cursor/skills/forge-0-epic/references/stage-exit-protocol.md +258 -0
  209. package/adapters/cursor/skills/forge-1-prd/references/pipeline-state-schema.json +191 -0
  210. package/adapters/cursor/skills/forge-1-prd/references/shared-conventions.md +283 -0
  211. package/adapters/cursor/skills/forge-1-prd/references/stage-exit-protocol.md +258 -0
  212. package/adapters/cursor/skills/forge-2-tech/forge-2-tech.mdc +1 -1
  213. package/adapters/cursor/skills/forge-2-tech/references/pipeline-state-schema.json +191 -0
  214. package/adapters/cursor/skills/forge-2-tech/references/shared-conventions.md +283 -0
  215. package/adapters/cursor/skills/forge-2-tech/references/stack-resolution.md +54 -0
  216. package/adapters/cursor/skills/forge-2-tech/references/stacks/_generic.md +90 -0
  217. package/adapters/cursor/skills/forge-2-tech/references/stacks/go.md +138 -0
  218. package/adapters/cursor/skills/forge-2-tech/references/stacks/python.md +163 -0
  219. package/adapters/cursor/skills/forge-2-tech/references/stacks/rust.md +151 -0
  220. package/adapters/cursor/skills/forge-2-tech/references/stacks/typescript.md +111 -0
  221. package/adapters/cursor/skills/forge-2-tech/references/stage-exit-protocol.md +258 -0
  222. package/adapters/cursor/skills/forge-3-specs/references/pipeline-state-schema.json +191 -0
  223. package/adapters/cursor/skills/forge-3-specs/references/shared-conventions.md +283 -0
  224. package/adapters/cursor/skills/forge-3-specs/references/stacks/_generic.md +90 -0
  225. package/adapters/cursor/skills/forge-3-specs/references/stacks/go.md +138 -0
  226. package/adapters/cursor/skills/forge-3-specs/references/stacks/python.md +163 -0
  227. package/adapters/cursor/skills/forge-3-specs/references/stacks/rust.md +151 -0
  228. package/adapters/cursor/skills/forge-3-specs/references/stacks/typescript.md +111 -0
  229. package/adapters/cursor/skills/forge-3-specs/references/stage-exit-protocol.md +258 -0
  230. package/adapters/cursor/skills/forge-4-backlog/references/forge-config-schema.json +236 -0
  231. package/adapters/cursor/skills/forge-4-backlog/references/pipeline-state-schema.json +191 -0
  232. package/adapters/cursor/skills/forge-4-backlog/references/shared-conventions.md +283 -0
  233. package/adapters/cursor/skills/forge-4-backlog/references/stage-exit-protocol.md +258 -0
  234. package/adapters/cursor/skills/forge-5-loop/references/forge-config-schema.json +236 -0
  235. package/adapters/cursor/skills/forge-5-loop/references/ralph-loop-contract.md +221 -0
  236. package/adapters/cursor/skills/forge-5-loop/references/shared-conventions.md +283 -0
  237. package/adapters/cursor/skills/forge-5-loop/references/stage-exit-protocol.md +258 -0
  238. package/adapters/cursor/skills/forge-6-docs/forge-6-docs.mdc +4 -1
  239. package/adapters/cursor/skills/forge-6-docs/references/pipeline-state-schema.json +191 -0
  240. package/adapters/cursor/skills/forge-6-docs/references/shared-conventions.md +283 -0
  241. package/adapters/cursor/skills/forge-fix/references/shared-conventions.md +283 -0
  242. package/adapters/cursor/skills/forge-fix/references/stage-exit-protocol.md +258 -0
  243. package/adapters/cursor/skills/forge-guide/references/forge-config-schema.json +236 -0
  244. package/adapters/cursor/skills/forge-guide/references/process-overview.md +143 -0
  245. package/adapters/cursor/skills/forge-guide/references/ralph-loop-contract.md +221 -0
  246. package/adapters/cursor/skills/forge-guide/references/shared-conventions.md +283 -0
  247. package/adapters/cursor/skills/forge-guide/references/stack-resolution.md +54 -0
  248. package/adapters/cursor/skills/forge-guide/references/stacks/_generic.md +90 -0
  249. package/adapters/cursor/skills/forge-guide/references/stacks/go.md +138 -0
  250. package/adapters/cursor/skills/forge-guide/references/stacks/python.md +163 -0
  251. package/adapters/cursor/skills/forge-guide/references/stacks/rust.md +151 -0
  252. package/adapters/cursor/skills/forge-guide/references/stacks/typescript.md +111 -0
  253. package/adapters/cursor/skills/forge-init/forge-init.mdc +1 -0
  254. package/adapters/cursor/skills/forge-verify/forge-verify.mdc +4 -3
  255. package/adapters/cursor/skills/forge-verify/references/pipeline-state-schema.json +191 -0
  256. package/adapters/cursor/skills/forge-verify/references/shared-conventions.md +283 -0
  257. package/adapters/cursor/skills/forge-verify/references/verification-checklists.md +7 -0
  258. package/adapters/gemini/.feature-forge-bundle.json +1 -1
  259. package/adapters/gemini/gemini-extension.json +1 -1
  260. package/adapters/gemini/references/forge-config-schema.json +5 -0
  261. package/adapters/gemini/scripts/epic-manifest.py +209 -0
  262. package/adapters/gemini/scripts/forge-bootstrap.py +1 -0
  263. package/adapters/gemini/scripts/forge-init.sh +2 -0
  264. package/adapters/gemini/skills/forge/forge.md +9 -1
  265. package/adapters/gemini/skills/forge/references/pipeline-state-schema.json +191 -0
  266. package/adapters/gemini/skills/forge/references/process-overview.md +143 -0
  267. package/adapters/gemini/skills/forge/references/shared-conventions.md +283 -0
  268. package/adapters/gemini/skills/forge/references/stage-exit-protocol.md +258 -0
  269. package/adapters/gemini/skills/forge-0-epic/references/epic-manifest-subcommands.md +11 -0
  270. package/adapters/gemini/skills/forge-0-epic/references/pipeline-state-schema.json +191 -0
  271. package/adapters/gemini/skills/forge-0-epic/references/portable-root.md +71 -0
  272. package/adapters/gemini/skills/forge-0-epic/references/shared-conventions.md +283 -0
  273. package/adapters/gemini/skills/forge-0-epic/references/stage-exit-protocol.md +258 -0
  274. package/adapters/gemini/skills/forge-1-prd/references/pipeline-state-schema.json +191 -0
  275. package/adapters/gemini/skills/forge-1-prd/references/shared-conventions.md +283 -0
  276. package/adapters/gemini/skills/forge-1-prd/references/stage-exit-protocol.md +258 -0
  277. package/adapters/gemini/skills/forge-2-tech/forge-2-tech.md +1 -1
  278. package/adapters/gemini/skills/forge-2-tech/references/pipeline-state-schema.json +191 -0
  279. package/adapters/gemini/skills/forge-2-tech/references/shared-conventions.md +283 -0
  280. package/adapters/gemini/skills/forge-2-tech/references/stack-resolution.md +54 -0
  281. package/adapters/gemini/skills/forge-2-tech/references/stacks/_generic.md +90 -0
  282. package/adapters/gemini/skills/forge-2-tech/references/stacks/go.md +138 -0
  283. package/adapters/gemini/skills/forge-2-tech/references/stacks/python.md +163 -0
  284. package/adapters/gemini/skills/forge-2-tech/references/stacks/rust.md +151 -0
  285. package/adapters/gemini/skills/forge-2-tech/references/stacks/typescript.md +111 -0
  286. package/adapters/gemini/skills/forge-2-tech/references/stage-exit-protocol.md +258 -0
  287. package/adapters/gemini/skills/forge-3-specs/references/pipeline-state-schema.json +191 -0
  288. package/adapters/gemini/skills/forge-3-specs/references/shared-conventions.md +283 -0
  289. package/adapters/gemini/skills/forge-3-specs/references/stacks/_generic.md +90 -0
  290. package/adapters/gemini/skills/forge-3-specs/references/stacks/go.md +138 -0
  291. package/adapters/gemini/skills/forge-3-specs/references/stacks/python.md +163 -0
  292. package/adapters/gemini/skills/forge-3-specs/references/stacks/rust.md +151 -0
  293. package/adapters/gemini/skills/forge-3-specs/references/stacks/typescript.md +111 -0
  294. package/adapters/gemini/skills/forge-3-specs/references/stage-exit-protocol.md +258 -0
  295. package/adapters/gemini/skills/forge-4-backlog/references/forge-config-schema.json +236 -0
  296. package/adapters/gemini/skills/forge-4-backlog/references/pipeline-state-schema.json +191 -0
  297. package/adapters/gemini/skills/forge-4-backlog/references/shared-conventions.md +283 -0
  298. package/adapters/gemini/skills/forge-4-backlog/references/stage-exit-protocol.md +258 -0
  299. package/adapters/gemini/skills/forge-5-loop/references/forge-config-schema.json +236 -0
  300. package/adapters/gemini/skills/forge-5-loop/references/ralph-loop-contract.md +221 -0
  301. package/adapters/gemini/skills/forge-5-loop/references/shared-conventions.md +283 -0
  302. package/adapters/gemini/skills/forge-5-loop/references/stage-exit-protocol.md +258 -0
  303. package/adapters/gemini/skills/forge-6-docs/forge-6-docs.md +4 -1
  304. package/adapters/gemini/skills/forge-6-docs/references/pipeline-state-schema.json +191 -0
  305. package/adapters/gemini/skills/forge-6-docs/references/shared-conventions.md +283 -0
  306. package/adapters/gemini/skills/forge-fix/references/shared-conventions.md +283 -0
  307. package/adapters/gemini/skills/forge-fix/references/stage-exit-protocol.md +258 -0
  308. package/adapters/gemini/skills/forge-guide/references/forge-config-schema.json +236 -0
  309. package/adapters/gemini/skills/forge-guide/references/process-overview.md +143 -0
  310. package/adapters/gemini/skills/forge-guide/references/ralph-loop-contract.md +221 -0
  311. package/adapters/gemini/skills/forge-guide/references/shared-conventions.md +283 -0
  312. package/adapters/gemini/skills/forge-guide/references/stack-resolution.md +54 -0
  313. package/adapters/gemini/skills/forge-guide/references/stacks/_generic.md +90 -0
  314. package/adapters/gemini/skills/forge-guide/references/stacks/go.md +138 -0
  315. package/adapters/gemini/skills/forge-guide/references/stacks/python.md +163 -0
  316. package/adapters/gemini/skills/forge-guide/references/stacks/rust.md +151 -0
  317. package/adapters/gemini/skills/forge-guide/references/stacks/typescript.md +111 -0
  318. package/adapters/gemini/skills/forge-init/forge-init.md +1 -0
  319. package/adapters/gemini/skills/forge-verify/forge-verify.md +4 -3
  320. package/adapters/gemini/skills/forge-verify/references/pipeline-state-schema.json +191 -0
  321. package/adapters/gemini/skills/forge-verify/references/shared-conventions.md +283 -0
  322. package/adapters/gemini/skills/forge-verify/references/verification-checklists.md +7 -0
  323. package/package.json +1 -1
@@ -0,0 +1,283 @@
1
+ # Shared Pipeline Conventions
2
+
3
+ These conventions apply to every forge pipeline skill. Skills reference this file to avoid duplicating shared logic.
4
+
5
+ ## Feature Name Requirement
6
+
7
+ Every pipeline skill requires a feature name as the first argument (e.g., `/feature-forge:forge-1-prd auth`).
8
+
9
+ If no feature name is provided:
10
+ 1. STOP IMMEDIATELY
11
+ 2. Do NOT attempt to guess or infer a feature name
12
+ 3. Ask the user to provide one
13
+ 4. Do NOT proceed until a feature name is explicitly given
14
+ 5. The feature name must be a single kebab-case token. If the user provides multiple words (e.g., "user auth flow"), convert to kebab-case: `user-auth-flow`.
15
+
16
+ ## User Input Protocol
17
+
18
+ ### CRITICAL GUARDRAIL: Use AskUserQuestion for All Questions
19
+
20
+ You MUST use the `AskUserQuestion` tool whenever you need the user's input before proceeding. This includes yes/no confirmations, choices between options, interview questions, and feedback on artifacts. NEVER output questions as inline prose text — the user may not be prompted and the session will stall.
21
+
22
+ **Required turn structure:** Output your analysis, findings, or context as regular text. Then call `AskUserQuestion` with your questions. Do NOT mix questions into your text output.
23
+
24
+ **WRONG — questions as inline prose (causes stalling):**
25
+ ```
26
+ I found that the codebase uses React and TanStack Router. Here are my questions:
27
+ 1. Where should this component live?
28
+ 2. Should we use server-side rendering?
29
+ ```
30
+
31
+ **RIGHT — context as text, questions via tool:**
32
+ ```
33
+ I found that the codebase uses React and TanStack Router.
34
+ [then call AskUserQuestion with: "1. Where should this component live? 2. Should we use server-side rendering?"]
35
+ ```
36
+
37
+ ### Decision Support: Help the User Choose
38
+
39
+ When an `AskUserQuestion` carries substantive options (a real choice — not a trivial yes/no confirmation), do not just list them. The interview stages have already done codebase research and integration analysis; surfacing that synthesis at the decision moment is the whole point. For every such question:
40
+
41
+ - **Lead with a recommended option.** Place it first and label it `(recommended)` (matching the `AskUserQuestion` "(Recommended)" convention).
42
+ - **Put the trade-off in each option's `description`.** Say why you'd pick it and what you give up versus the alternatives — the cost, not just the benefit.
43
+ - **State a one-line rationale** in the text before the question for *why* the recommendation wins.
44
+
45
+ Two modes, and make clear which one you're in:
46
+
47
+ - **Evidence-backed** — codebase evidence, an established convention, or a clear technical rationale favors one option. Recommend it with confidence and cite the evidence ("the codebase already uses X, so…").
48
+ - **Preference** — no option clearly wins (taste, team workflow, risk appetite). Still offer a sensible **default** and the trade-offs, but say plainly this is a judgment call / the user's preference, so you don't manufacture false confidence.
49
+
50
+ **The only thing to avoid is false confidence** — recommending as if evidence-backed when it's really preference. Never respond to the absence of a clear winner by going silent: a defaulted recommendation with honest trade-offs always beats a neutral option dump.
51
+
52
+ For genuinely comparable artifacts (competing module structures, two code snippets, layout variants), use the `AskUserQuestion` `preview` field to show them side-by-side.
53
+
54
+ The **Branch Setup** block below is the reference pattern: a strong recommendation as the first option, rationale inline, the alternative still available, never a hard-stop.
55
+
56
+ ## Configuration Reading
57
+
58
+ Read `forge.config.json` from the project root. If it doesn't exist, use defaults.
59
+
60
+ If `forge.config.json` does not exist and no `.pipeline-state.json` files exist anywhere in `{specsDir}/`, suggest: "No forge.config.json found. Run `/feature-forge:forge-init` to create one with defaults, or I'll use built-in defaults. Want me to continue with defaults?"
61
+
62
+ Extract these config values (use defaults if not present):
63
+ - `specsDir` (default: `./specs`)
64
+ - `docsDir` (default: `./docs/architecture`)
65
+ - `backlogDir` (default: null — backlog lives at `{specsDir}/{feature}/backlog.json`; when `backlogDir` is configured, forge-4 composes `{backlogDir}/{feature}/`)
66
+ - `gitCommitAfterStage` (default: true)
67
+ - `commitPrefix` (default: `forge`)
68
+ - `branchPerFeature` (default: true)
69
+ - `branchPrefix` (default: `forge/`)
70
+ - `loopIterationMultiplier` (default: `1.5`)
71
+ - `autoInvokeNextStage` (default: `true` — the `/feature-forge:forge` navigator auto-invokes the next stage via the `Skill` tool after the user confirms; `false` keeps copy-paste behavior. Navigator-only.)
72
+ - `contextWindowTokens` (default: `null` — context window used by the navigator's context-usage check; `null` infers from the session model and falls back to 200000. Set to the model's window, e.g. `1000000` on a 1M model. Navigator-only.)
73
+ - `contextWarnThreshold` (default: `0.7` — fraction of the window past which the navigator recommends a clean session. Navigator-only.)
74
+ - `autoVerify` (default: `false` — when `true`, `forge-verify` runs automatically after a stage completes, no prompt. **In-stage-primary:** the just-completed authoring stage runs it itself, in-session, before the exit block (honoring the verify-before-clear principle). The navigator runs it only as a **catch-up** when verify is still pending (a host that could not dispatch a clean-room subagent, or a stage run before this behavior landed). Either way it runs in a fresh clean-room subagent, so it never needs a `/clear` and costs only a compact digest.)
75
+ - `autoVerifyStages` (default: `{}` — per-stage overrides for `autoVerify`, e.g. `{"forge-1-prd": false}`. Effective value = `autoVerifyStages[stage]` if present, else `autoVerify`. Keys are constrained to the five verify-capable stages; a typo is a config error surfaced as `invalidAutoVerifyKeys`. Both the in-stage run and the navigator catch-up read this same effective value.)
76
+ - `autoFix` (default: `false` — when `true`, `forge-fix` is chained after an auto-verify that finds issues — by the in-stage run (primary) or the navigator catch-up — but only when auto-verify is on for that stage AND preconditions hold (zero unresolved decisions, clean tree, passing re-verify); otherwise a digest is surfaced and the gate is presented.)
77
+ - `loopRunner` (optional object — the loop runner to drive; **defaults to rauf** when absent, with every command templated. See `references/forge-config-schema.json` and `references/ralph-loop-contract.md`.)
78
+
79
+ ## Feature Directory Resolution
80
+
81
+ Before any file I/O against a feature's artifacts, resolve its directory through the deterministic helper rather than hardcoding `{specsDir}/{feature}/`. This makes flat (`{specsDir}/{feature}/`) and nested (`{specsDir}/{epic}/{feature}/`) layouts both resolve from a bare feature name (REQ-DIR-03), with standalone features behaving exactly as today.
82
+
83
+ ```bash
84
+ 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')"
85
+ [ -n "$R" ] || { echo "feature-forge: cannot locate plugin root" >&2; exit 1; }
86
+ resolvedFeatureDir=$(python3 "$R/scripts/epic-manifest.py" \
87
+ resolve "<feature>" --specs-dir "<specsDir>")
88
+ ```
89
+
90
+ - **Exit 0:** stdout is the absolute feature directory. Use it everywhere this skill previously wrote `{specsDir}/{feature}/`.
91
+ - **Exit 1:** the helper reports a structured finding (`not-found`, `ambiguous` — see `00-core-definitions.md §4`). Because this `resolve` call passes **no `--json`** (the subcommand has no such flag), the finding is a plain `not-found:`/`ambiguous:` line on **stderr** with empty stdout — there is no findings JSON to parse. **STOP** and surface that stderr line verbatim. (The `{valid, findings[]}`-on-stdout envelope is the `--json` shape used by `render-status`/`validate`, not by `resolve`.)
92
+ - **Exit 2:** a usage / safety error (`unsafe-name`, a path-containment escape, missing file). The message is a plain `Error: …` line on **stderr** with empty stdout — there is no findings JSON to parse. **STOP** and surface that stderr line verbatim.
93
+
94
+ In both failure cases, do not fall back to a guessed path.
95
+
96
+ **On `not-found`, check other branches before stopping.** With `branchPerFeature`, the feature's directory (and its `.pipeline-state.json`) may exist only on its topic branch — invisible from the default branch of a fresh clone. Before concluding the pipeline does not exist, run the read-only cross-branch discovery:
97
+
98
+ ```bash
99
+ 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')"
100
+ [ -n "$R" ] || { echo "feature-forge: cannot locate plugin root" >&2; exit 1; }
101
+ python3 "$R/scripts/forge-session.py" discover-feature "<feature>" --specs-dir "<specsDir>" --json
102
+ ```
103
+
104
+ - **Candidates found** (`candidates` and/or `remoteCandidates` non-empty): summarize them as text (branch, recorded stage, whether the state's own `branch` field matches), then use `AskUserQuestion`: **Switch to `{branch}` (recommended)** — run the candidate's `switchCommand` · **Fetch + switch** — for a `needsFetch` remote candidate, run its `fetchCommand` then `switchCommand` (note its contents were matched by name only, not inspected) · **Treat `{feature}` as new on this branch** · **Stop**. A checkout is a mutation inside an otherwise read-only flow: perform it ONLY on the user's explicit accept AND with a clean working tree (`git status --porcelain` prints nothing) — never auto-switch, never with uncommitted changes. After a successful switch, re-run this Feature Directory Resolution block from the top.
105
+ - **Nothing found** (both lists empty): the pipeline genuinely does not exist anywhere discoverable — STOP and surface the original `not-found` stderr line verbatim (or, where the caller offers to start a new pipeline, offer that).
106
+
107
+ **Anti-fabrication guard.** Never describe pipeline state that resolution or discovery did not return: if both come back empty, the pipeline does not exist — say exactly that, and never reconstruct stages, backlogs, or history from conversational memory.
108
+
109
+ **Resolution algorithm (summary; full spec in `02-manifest-helper-cli.md §4`):**
110
+ 1. Reject the name if unsafe (path separator, `..`, absolute, or failing `SAFE_NAME_RE`) — before any filesystem access.
111
+ 2. If `{specsDir}/{name}/.pipeline-state.json` exists → return that flat path.
112
+ 3. Else if exactly one `{specsDir}/*/{name}/.pipeline-state.json` exists → return that nested path.
113
+ 4. More than one match anywhere → `ambiguous` error listing all matching paths (uniqueness violation, REQ-DIR-04).
114
+ 5. Zero matches → `not-found` error.
115
+
116
+ A directory counts as a **feature** only if it directly contains a `.pipeline-state.json` (the *feature-shaped-dir bound*, `00-core-definitions.md §6`). Non-feature subtrees (`.verification/`, `tests/`, fixture dirs, and the epic root itself — which holds `epic-manifest.json` but no `.pipeline-state.json`) are therefore never matched as features.
117
+
118
+ **Compatibility:** for a standalone feature the resolver returns its flat path with no epic logic engaged (REQ-COMPAT-01/02) — standalone-feature behavior is unchanged. A pre-existing latent name collision is reported for manual cleanup by the navigator / forge-verify epic mode (CHECK-E08), not by aborting an unrelated command whose name resolves to exactly one dir (tech-spec §3.4).
119
+
120
+ ## Specs Directory Hygiene
121
+
122
+ Whenever a stage creates the specs tree for the first time (the first PRD or epic written under `{specsDir}/`), ensure a spec-directory agent-instruction file exists at the **specsDir root**. This tells coding agents in the project that the specs here are pre-implementation artifacts — not live contracts to enforce against the code. It is **idempotent: never overwrite an existing file** (the project may have edited it).
123
+
124
+ Run this after creating the feature/epic directory, before the stage's git commit:
125
+
126
+ ```bash
127
+ 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')"
128
+ [ -n "$R" ] || { echo "feature-forge: cannot locate plugin root" >&2; exit 1; }
129
+ mkdir -p "<specsDir>"
130
+ [ -f "<specsDir>/AGENTS.md" ] || cp "$R/references/templates/specs-hygiene/AGENTS.md" "<specsDir>/AGENTS.md"
131
+ ```
132
+
133
+ If the host is Claude (the `AskUserQuestion` tool is available), also ensure the Claude-framed variant:
134
+
135
+ ```bash
136
+ [ -f "<specsDir>/CLAUDE.md" ] || cp "$R/references/templates/specs-hygiene/CLAUDE.md" "<specsDir>/CLAUDE.md"
137
+ ```
138
+
139
+ Stage any file this writes (`{specsDir}/AGENTS.md`, and `{specsDir}/CLAUDE.md` when written) as part of the stage's existing git commit.
140
+
141
+ ## Epic Context Injection
142
+
143
+ After resolving the feature directory, check the feature's `.pipeline-state.json` for an `epic` back-pointer. **If absent, skip this block entirely** (standalone feature — REQ-COMPAT-01; standalone-feature behavior is unchanged). **If present**, load exactly the following context, and nothing transitive (REQ-CTX-01):
144
+
145
+ 1. **`{specsDir}/{epic}/EPIC.md`** — the epic narrative, including the per-feature Contracts sections.
146
+ 2. **This feature's `charter`** — read from `{specsDir}/{epic}/epic-manifest.json` (the `features[]` entry whose `name` matches), together with its `exposes` and `consumes` arrays. These are the feature's **contract obligations** (REQ-CTX-02): what it must expose to dependents and what it consumes from dependencies.
147
+ 3. **Direct completed dependencies only** — for each `name` in this feature's `dependsOn`, resolve that sibling's directory and, **only if it is complete-for-orchestration** (`00-core-definitions.md §7`), load its `PRD.md` and `tech-spec.md`.
148
+
149
+ **Do NOT load** transitive (indirect) dependencies' specs. Indirect contracts reach this feature only through the *direct* deps' Contracts sections in `EPIC.md`. This bounds context size and keeps the injected set deterministic (REQ-CTX-01).
150
+
151
+ To obtain the manifest contracts and the live completion status of each dependency in one deterministic call, run `render-status` and read the per-feature `status` and the `consumes`/`exposes` arrays rather than re-deriving them:
152
+
153
+ ```bash
154
+ 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')"
155
+ [ -n "$R" ] || { echo "feature-forge: cannot locate plugin root" >&2; exit 1; }
156
+ python3 "$R/scripts/epic-manifest.py" \
157
+ render-status "<epic>" --specs-dir "<specsDir>" --json
158
+ ```
159
+
160
+ If `render-status` fails, proceed with **only** EPIC.md + charter (a corrupt manifest must not silently inject stale dep specs — REQ-ROBUST-02): on **exit 1**, parse the `{findings[]}` JSON from stdout and surface each; on **exit 2**, surface the plain `Error:` line from stderr verbatim. Do not attempt to parse findings JSON on an exit-2 failure (stdout is empty).
161
+
162
+ **After injecting context, invoke the Epic-Member Base Guard block below** (it self-gates to a no-op for standalone features and features that do not resolve as a nested member).
163
+
164
+ ## Epic-Member Base Guard
165
+
166
+ Defense-in-depth for the split-brain-epic failure (Issue #125). Invoke this block in the authoring stages (`forge-1-prd`..`forge-4-backlog`) once the feature has resolved — right after **Epic Context Injection** for the stages that run it (`forge-1-prd`..`forge-3-specs`), and right after **Feature Directory Resolution** for `forge-4-backlog`. It confirms that a **resolved nested epic member** actually sits on a branch that contains the epic's manifest. Without this, a member reached from a branch cut *before* the epic-manifest commit (or that otherwise lacks it) would author specs against an epic decomposition that is not present — the exact drift that produces a disjoint, split-brain member. **Skip if not a git repo or `branchPerFeature` is false.**
167
+
168
+ ```bash
169
+ 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')"
170
+ [ -n "$R" ] || { echo "feature-forge: cannot locate plugin root" >&2; exit 1; }
171
+ python3 "$R/scripts/forge-session.py" check-epic-base --feature "{feature}" --specs-dir "{specsDir}" --json
172
+ ```
173
+
174
+ Act on the emitted `action`:
175
+ - **`none`** — a standalone feature (no epic to check) or the manifest is present on the current branch. Proceed silently. This is the no-op path for standalone features (REQ-COMPAT-01), so standalone behavior is unchanged.
176
+ - **`not-resolved`** — the feature does not resolve on the current branch. Proceed silently (the caller's own resolution already handled that case).
177
+ - **`warn-detached-base`** — a nested member resolves here but the epic's `epic-manifest.json` is **absent on this branch**. **STOP** unless `--force` was passed, and surface verbatim (filling `{epic}` and `{homeBranch}` from the payload's `epic` and `homeBranch`):
178
+ > `{feature}` is a member of epic `{epic}`, but this branch does not contain the epic manifest (`{specsDir}/{epic}/epic-manifest.json`). This base predates or lacks the epic. Switch to the epic's home branch `{homeBranch}` and re-run, or pass `--force` to author against a detached base anyway.
179
+
180
+ With `--force`, log a one-line warning ("Authoring `{feature}` against a detached epic base — manifest not on this branch") and proceed, consistent with the other guards.
181
+
182
+ If the helper is unavailable (a non-Claude host without the resolver), skip this block — it is best-effort defense in depth, not a hard prerequisite.
183
+
184
+ ## Pipeline State Protocol
185
+
186
+ Write pipeline state conforming to `references/pipeline-state-schema.json`. Always update `updatedAt` when modifying pipeline state.
187
+
188
+ ### Staleness Detection (Read-Time)
189
+
190
+ When loading upstream artifacts as prerequisites, check `basedOnVersions` in the pipeline state for this stage. If any upstream stage's current version is newer than the version recorded in `basedOnVersions`, warn the user before proceeding:
191
+
192
+ > "This stage was built against {upstream} v{old}, but {upstream} is now at v{new}. The current artifacts may be outdated. Consider re-running this stage, or use --force to proceed with potentially stale inputs."
193
+
194
+ 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
+
196
+ ## Branch Setup
197
+
198
+ 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.
199
+
200
+ **Gate.** Run this block only when the project uses git (a `.git` directory resolves) **and** `branchPerFeature` is true. It is **independent of `gitCommitAfterStage`** — branch isolation matters whether or not forge auto-commits. If `branchPerFeature` is false, skip silently.
201
+
202
+ **Epic-member inheritance.** In `forge-1-prd`, if the feature has an `epic` back-pointer (an `epic` field resolves via Epic Context Injection, or the directory is nested under an epic), the epic already established the branch in `forge-0-epic`. Skip the prompt — inherit the current branch.
203
+
204
+ **Detection, then a branch-aware prompt:**
205
+
206
+ 1. Read the current branch: `git rev-parse --abbrev-ref HEAD`.
207
+ 2. Determine the default branch: `git symbolic-ref --quiet refs/remotes/origin/HEAD` (strip to the last path segment); if that fails, fall back to `main`, else `master` — whichever the repo has.
208
+ 3. **If the current branch is NOT the default branch** (the user is already on a topic/`{branchPrefix}*` branch) → record it (see below) and proceed silently. Do not prompt.
209
+ 4. **If the current branch IS the default branch** → use `AskUserQuestion` with a **strong recommendation** (still optional):
210
+
211
+ > "You're on `{defaultBranch}`. Strongly recommended: create `{branchPrefix}{label}` so this {scope}'s work stays isolated and reviewable as one branch. Create it?"
212
+ > Options: **Create `{branchPrefix}{label}` (recommended)** · **Stay on `{defaultBranch}`**
213
+
214
+ - **Create** → `git switch -c {branchPrefix}{label}` (or `git checkout -b` if `switch` is unavailable). If the branch already exists, `git switch {branchPrefix}{label}`.
215
+ - **Stay** → proceed on the default branch; note that subsequent commits (and any `forge-5-loop` run) will land directly on `{defaultBranch}`.
216
+
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.
218
+
219
+ ## Branch Reconciliation
220
+
221
+ The recorded `branch` is a **self-healing hint, not gospel.** A hosted environment (Claude.ai remote, cloud agents) can impose an arbitrary session branch (e.g. `claude/<slug>`) that Branch Setup silently records; the user may then move the work to the intended topic branch, leaving the recorded field stale. Every branch-aware mechanism (the `forge-5-loop` guard, `discover-feature`) keys off that field, so a stale value actively misleads — the loop would offer to switch you *back* to the imposed branch. Invoke this block from `forge-5-loop`'s pre-flight (and any stage that acts on the recorded branch) to reconcile deterministically. Skip if not a git repo or `branchPerFeature` is false.
222
+
223
+ ```bash
224
+ 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')"
225
+ [ -n "$R" ] || { echo "feature-forge: cannot locate plugin root" >&2; exit 1; }
226
+ python3 "$R/scripts/forge-session.py" reconcile-branch --feature "{feature}" --specs-dir "{specsDir}" --json
227
+ ```
228
+
229
+ 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).
231
+ - **`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
+ - **`none`** / **`not-resolved`** — nothing to do; proceed.
233
+
234
+ 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
+
236
+ ## Git Commit Protocol
237
+
238
+ When `gitCommitAfterStage` is true, follow this exact order to avoid state inconsistency.
239
+
240
+ **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
+
242
+ 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:
246
+ - **Pre-commit hook failure:** Report the hook output. Never use `--no-verify` to bypass. Help the user fix the underlying issue.
247
+ - **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.
249
+ 5. **Never** use `git add -A`, `--amend`, `--no-verify`, or `--force` flags
250
+
251
+ ## Stage-Entry Guard
252
+
253
+ 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`).
254
+
255
+ **Read, then classify** this stage's entry in `{resolvedFeatureDir}/.pipeline-state.json` (`stages.{stage}.status`):
256
+
257
+ 1. **Fresh** — no state file yet, or `stages.{stage}` is absent/`pending`. First run of this stage. Proceed to the **Entry Stamp** below, then author normally. No prompt.
258
+
259
+ 2. **Interrupted** (`status: "in-progress"`) — a previous run of THIS stage was interrupted before it committed (the exit commit is what flips it to `complete`, so `in-progress` on entry always means a crash/abandon). Do **not** silently re-author. Instead:
260
+ - **Inventory on-disk artifacts:** list the files this stage produces that already exist in `{resolvedFeatureDir}/` (e.g. `PRD.md`; `tech-spec.md`; the `##-*.md` suite + `TRACEABILITY.md`; `backlog.json`), and cross-check against the `stages.{stage}.artifacts` array (written incrementally during the previous run).
261
+ - **Gate via `AskUserQuestion`** (Decision Support protocol): present the inventory as text, then ask "This {stage} run was interrupted — {N} artifact(s) from the previous run are on disk: {list}. Resume the in-progress draft, or start a new version from scratch?" Options: **Resume (recommended)** — continue from the first artifact not yet written/complete, reusing the existing files; do **not** re-stamp or bump the version. · **Start a new version** — treat it as a fresh authoring pass (proceed to the Entry Stamp; the version increments at exit).
262
+ - Skip artifact regeneration for files that already exist and are complete (non-empty, properly structured); continue from the next unwritten artifact.
263
+
264
+ 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
+
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)
270
+
271
+ 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
+
273
+ **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
+
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.
276
+
277
+ ## Force Mode
278
+
279
+ If the user passes `--force` as an argument, skip prerequisite validation with a warning:
280
+
281
+ > Force mode: skipping prerequisite checks. Pipeline state tracking may be incomplete — this stage may build on prior stages that were never completed or verified, so its output can be silently wrong. Recommend running `/feature-forge:forge {feature}` after to verify status.
282
+
283
+ Continue with the stage even if prior stages are not marked complete. Still read any existing artifacts (PRD.md, tech-spec.md, etc.) if they exist on disk — force mode skips the pipeline state check, not the artifact loading.
@@ -185,6 +185,13 @@ Detailed checklists for each verification mode. Execute EVERY check — do not s
185
185
  - [ ] **CHECK-I19**: Exported functions/classes have documentation comments (JSDoc, docstrings, godoc, etc.)
186
186
  - [ ] **CHECK-I20**: Configuration options are documented
187
187
 
188
+ ### Runnability
189
+
190
+ > **When these fire:** only at impl-verify **completion** (impl mode runs post-loop), never mid-loop — an early skeleton that only compiles is not punished. **Both degrade gracefully:** a feature with no runnable surface (a pure library with no bootstrap contract) or no configured `smokeCommand` yields an **advisory not-applicable** finding, never a hard fail — the same way a null `{typeCheckCommand}` is handled. These exist because `CHECK-I01..I20` are all static reads + typecheck/lint + "tests exist"; nothing here asserts the assembled application actually **runs**. A bootstrap that is exported and unit-tested (each test calls it manually) but never wired into a runtime entrypoint passes every other check yet serves no real request (#121).
191
+
192
+ - [ ] **CHECK-I21**: **End-to-end smoke passes.** If `smokeCommand` from forge.config.json is set, execute it — it boots the wired entrypoint and drives one happy-path request end-to-end; **pass iff exit 0**. A non-zero exit is an `error` finding (the assembled app does not run — quote the command's failing output). If `smokeCommand` is `null`, this is **advisory**: emit a `not-applicable` finding recommending the user configure a `smokeCommand` so "clean" means "it runs" (never fabricate or guess a command — run only the user-configured one, exactly as `CHECK-I11` runs only a configured `{typeCheckCommand}`).
193
+ - [ ] **CHECK-I22**: **Runtime-required bootstrap has a non-test caller.** Every exported bootstrap / `init*` / singleton-populator the specs mark as **required for runtime** must have ≥1 **non-test** call site on a runtime path — an entrypoint such as `main` / `instrumentation` / a route / a layout / a worker, NOT only test files. Statically grep for each such symbol's references (use the stack profile `references/stacks/{stack}.md` for what counts as a runtime entrypoint in this language). A symbol that is exported and covered by tests but referenced **only** from test files is a `gap` — the #121 walking-skeleton (bootstrap wired to nothing). Degrades naturally: a feature whose specs mark no bootstrap symbol as runtime-required is `not-applicable`. Weaker than `CHECK-I21` (it proves a call site exists, not that the boot succeeds), so it complements rather than replaces the smoke.
194
+
188
195
  ## Epic Mode Checklist
189
196
 
190
197
  Run `epic-manifest.py validate "{epic}" --specs-dir "{specsDir}" --json` once; map its
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "feature-forge",
3
- "version": "0.12.7",
3
+ "version": "0.12.8",
4
4
  "agent": "codex",
5
5
  "generatedBy": "python3 scripts/build-adapters.py"
6
6
  }
@@ -51,6 +51,11 @@
51
51
  "type": ["string", "null"],
52
52
  "description": "Command to run tests. Null until set. Examples: 'bun test', 'pytest', 'go test ./...'. Used in acceptance criteria and verification."
53
53
  },
54
+ "smokeCommand": {
55
+ "type": ["string", "null"],
56
+ "default": null,
57
+ "description": "Optional end-to-end smoke command that boots the wired application entrypoint and drives one happy-path request, exiting 0 on success. DISTINCT from testCommand (unit tests, which may self-bootstrap) and loopRunner.runCommand (the loop launcher). Consumed by impl-verify's runnability check (CHECK-I21): when set it is executed (pass iff exit 0); when null the check degrades to an advisory not-applicable finding, never a hard fail (mirrors how a null typeCheckCommand is treated). Examples: 'npm run smoke', './scripts/smoke.sh', 'curl -fsS localhost:3000/health'."
58
+ },
54
59
  "loopIterationMultiplier": {
55
60
  "type": "number",
56
61
  "default": 1.5,
@@ -27,6 +27,7 @@ import argparse
27
27
  import json
28
28
  import os
29
29
  import re
30
+ import shutil
30
31
  import sys
31
32
  import tempfile
32
33
  from datetime import datetime, timezone
@@ -1195,6 +1196,180 @@ def set_status(epic_dir: Path, specs_dir: Path, status: str) -> list[Finding]:
1195
1196
  return _bump_and_write(epic_dir, specs_dir, manifest)
1196
1197
 
1197
1198
 
1199
+ def _load_state_strict(state_path: Path) -> dict:
1200
+ """Read a .pipeline-state.json, raising UsageError on a missing/corrupt file.
1201
+
1202
+ Unlike ``_read_state_safely`` (which downgrades a torn read to ``{}`` for the
1203
+ read-only dashboard), an adopt mutation must NOT silently discard the
1204
+ standalone's stage history — a corrupt source is a hard stop (exit 2) so the
1205
+ human fixes it before the irreversible move.
1206
+ """
1207
+ try:
1208
+ parsed = json.loads(state_path.read_text(encoding="utf-8"))
1209
+ except OSError as exc:
1210
+ raise UsageError(f"cannot read {state_path}: {exc}")
1211
+ except json.JSONDecodeError as exc:
1212
+ raise UsageError(f"{state_path} is not valid JSON: {exc}")
1213
+ if not isinstance(parsed, dict):
1214
+ raise UsageError(f"{state_path} is not a JSON object")
1215
+ return parsed
1216
+
1217
+
1218
+ def _merge_member_state(stub: dict, standalone: dict, epic_name: str) -> dict:
1219
+ """Merge a detached standalone's state onto an epic member stub (Issue #126).
1220
+
1221
+ The **stub** is the base — it carries the correct ``epic`` and ``branch``
1222
+ back-pointers that the epic minted. The **standalone** holds the real work, so
1223
+ its stage history / artifacts / currentStage overlay the stub. The ``epic``
1224
+ back-pointer is forced to the target epic; the stub's ``branch`` is preserved
1225
+ (only falling back to the standalone's when the stub has none).
1226
+ """
1227
+ merged = dict(stub)
1228
+ for key in ("currentStage", "artifacts", "notes",
1229
+ "deferredDecisions", "epicChangeRequests"):
1230
+ if key in standalone:
1231
+ merged[key] = standalone[key]
1232
+ stages = dict(stub.get("stages") or {})
1233
+ stages.update(standalone.get("stages") or {})
1234
+ merged["stages"] = stages
1235
+ merged["epic"] = epic_name
1236
+ if not (isinstance(stub.get("branch"), str) and stub["branch"]) and \
1237
+ isinstance(standalone.get("branch"), str) and standalone["branch"]:
1238
+ merged["branch"] = standalone["branch"]
1239
+ return merged
1240
+
1241
+
1242
+ def adopt_feature(
1243
+ epic_dir: Path,
1244
+ specs_dir: Path,
1245
+ feature: str,
1246
+ charter: str | None,
1247
+ deps: list[str],
1248
+ ) -> dict:
1249
+ """Reconcile a detached standalone feature into an epic member (Issue #126).
1250
+
1251
+ The scripted recovery for a **split-brain epic** (#125): a feature that should
1252
+ be an epic member was forged as a flat standalone at ``{specsDir}/{feature}/``.
1253
+ This relocates it into the member slot ``{epicDir}/{feature}/``, merging state
1254
+ so the stub's ``epic``/``branch`` back-pointers survive, removes the flat dir
1255
+ (no residual), and adds the feature to the manifest if absent.
1256
+
1257
+ Operates on the CURRENT tree/branch — both the flat standalone and the epic
1258
+ manifest must already be present (the human brings a cross-branch standalone
1259
+ onto the epic's home branch first, per ``docs/recovery-detached-epic-member.md``;
1260
+ EPIC.md prose is regenerated separately via forge-0-epic). Deliberately ordered
1261
+ **relocate-then-manifest**: after the flat dir is gone the feature name maps to
1262
+ exactly one dir, so ``add_feature``'s global-uniqueness re-validation stays
1263
+ clean. Re-entrant — a half-finished run (files moved, manifest not yet updated)
1264
+ completes on re-run.
1265
+
1266
+ Args:
1267
+ epic_dir: The target epic subtree directory (must hold epic-manifest.json).
1268
+ specs_dir: The configured specs directory.
1269
+ feature: The detached standalone feature name to adopt.
1270
+ charter: Charter for the manifest entry when the feature is not yet a
1271
+ member; a default is used when omitted.
1272
+ deps: dependsOn for the new manifest entry (ignored if already a member).
1273
+
1274
+ Returns:
1275
+ A summary dict (``adopted``/``relocated``/``manifestUpdated``/…) on success.
1276
+
1277
+ Raises:
1278
+ UsageError: Unsafe name, missing manifest, nothing to adopt, or an I/O
1279
+ failure (exit 2).
1280
+ FindingsError: A blocking manifest finding from ``add_feature`` (e.g. an
1281
+ unknown dependency) after relocation — exit 1; re-run after fixing.
1282
+ """
1283
+ assert_safe_name(feature)
1284
+ for dep in deps:
1285
+ assert_safe_name(dep)
1286
+
1287
+ # The epic manifest must exist on this tree (exit 2 if not — nothing to adopt into).
1288
+ load_manifest(epic_dir)
1289
+
1290
+ flat_dir = contained_path(specs_dir, feature)
1291
+ member_dir = contained_path(epic_dir, feature)
1292
+ if flat_dir == member_dir:
1293
+ raise UsageError(f"feature {feature!r} resolves to the epic dir itself")
1294
+
1295
+ flat_state = flat_dir / PIPELINE_STATE_FILENAME
1296
+ member_state = member_dir / PIPELINE_STATE_FILENAME
1297
+ flat_exists = flat_state.is_file()
1298
+ member_exists = member_state.is_file()
1299
+
1300
+ if not flat_exists and not member_exists:
1301
+ raise UsageError(
1302
+ f"nothing to adopt: neither a standalone {flat_dir} nor a member "
1303
+ f"{member_dir} has a {PIPELINE_STATE_FILENAME}"
1304
+ )
1305
+
1306
+ relocated = False
1307
+ if flat_exists:
1308
+ standalone = _load_state_strict(flat_state)
1309
+ if member_exists:
1310
+ merged = _merge_member_state(
1311
+ _read_state_safely(member_state), standalone, epic_dir.name
1312
+ )
1313
+ else:
1314
+ merged = dict(standalone)
1315
+ merged["epic"] = epic_dir.name
1316
+ # Move every artifact except the state file (merged separately) into the
1317
+ # member slot; the standalone (real work) wins on any name collision.
1318
+ member_dir.mkdir(parents=True, exist_ok=True)
1319
+ for child in sorted(flat_dir.iterdir()):
1320
+ if child.name == PIPELINE_STATE_FILENAME:
1321
+ continue
1322
+ dest = member_dir / child.name
1323
+ if dest.is_dir():
1324
+ shutil.rmtree(dest)
1325
+ elif dest.exists():
1326
+ dest.unlink()
1327
+ shutil.move(str(child), str(dest))
1328
+ atomic_write(member_state, merged)
1329
+ shutil.rmtree(flat_dir)
1330
+ relocated = True
1331
+ else:
1332
+ # Already nested (a prior run moved the files) — only ensure the back-pointer.
1333
+ stub = _read_state_safely(member_state)
1334
+ if stub.get("epic") != epic_dir.name:
1335
+ stub["epic"] = epic_dir.name
1336
+ atomic_write(member_state, stub)
1337
+
1338
+ # Ensure the feature is a manifest member (idempotent — the flat dir is gone now,
1339
+ # so add_feature's tree-uniqueness re-check sees exactly one dir for the name).
1340
+ manifest = load_manifest(epic_dir)
1341
+ already_member = any(
1342
+ isinstance(f, dict) and f.get("name") == feature
1343
+ for f in manifest.get("features", [])
1344
+ )
1345
+ manifest_updated = False
1346
+ if not already_member:
1347
+ findings = add_feature(
1348
+ epic_dir, specs_dir, feature,
1349
+ charter or f"Adopted into the {epic_dir.name} epic from a detached standalone.",
1350
+ deps,
1351
+ )
1352
+ if findings:
1353
+ raise FindingsError(findings)
1354
+ manifest_updated = True
1355
+
1356
+ return {
1357
+ "adopted": True,
1358
+ "epic": epic_dir.name,
1359
+ "feature": feature,
1360
+ "memberDir": str(member_dir),
1361
+ "relocated": relocated,
1362
+ "manifestUpdated": manifest_updated,
1363
+ "wasAlreadyMember": already_member,
1364
+ "nextSteps": [
1365
+ f"Regenerate EPIC.md prose via /feature-forge:forge-0-epic {epic_dir.name}",
1366
+ f"Confirm the dashboard via /feature-forge:forge {epic_dir.name}",
1367
+ f"Verify the member via /feature-forge:forge-verify {feature}",
1368
+ "Commit the surgery (stage the epic subtree and the removed flat dir).",
1369
+ ],
1370
+ }
1371
+
1372
+
1198
1373
  # --------------------------------------------------------------------------- #
1199
1374
  # CLI Dispatch (02 §9)
1200
1375
  # --------------------------------------------------------------------------- #
@@ -1285,6 +1460,25 @@ def _dispatch(args: argparse.Namespace, specs_dir: Path) -> int:
1285
1460
  _print_status_table(status)
1286
1461
  return 0
1287
1462
 
1463
+ if cmd == "adopt-feature":
1464
+ epic_dir = contained_path(specs_dir, args.epic)
1465
+ summary = adopt_feature(
1466
+ epic_dir, specs_dir, args.name, args.charter,
1467
+ _split_list(args.depends_on),
1468
+ )
1469
+ if args.json_output:
1470
+ print(json.dumps(summary, indent=2, ensure_ascii=False))
1471
+ else:
1472
+ print(f"Adopted {summary['feature']!r} into epic {summary['epic']!r}.")
1473
+ print(f" member dir: {summary['memberDir']}")
1474
+ print(f" relocated files: {summary['relocated']}")
1475
+ print(f" manifest added: {summary['manifestUpdated']}"
1476
+ f"{' (already a member)' if summary['wasAlreadyMember'] else ''}")
1477
+ print("Next steps:")
1478
+ for step in summary["nextSteps"]:
1479
+ print(f" - {step}")
1480
+ return 0
1481
+
1288
1482
  # Mutators ---------------------------------------------------------------
1289
1483
  if cmd in {"add-feature", "remove-feature", "reorder", "set-dep", "set-status"}:
1290
1484
  epic_dir = contained_path(specs_dir, args.epic)
@@ -1358,6 +1552,21 @@ def _build_parser() -> argparse.ArgumentParser:
1358
1552
  add_specs_dir(p_add)
1359
1553
  add_json(p_add)
1360
1554
 
1555
+ # adopt-feature --------------------------------------------------------- #
1556
+ p_adopt = sub.add_parser(
1557
+ "adopt-feature",
1558
+ help="Reconcile a detached standalone feature into an epic member (#126)",
1559
+ )
1560
+ p_adopt.add_argument("epic")
1561
+ p_adopt.add_argument("name")
1562
+ p_adopt.add_argument(
1563
+ "--charter", default=None,
1564
+ help="Charter for the manifest entry when the feature is not yet a member",
1565
+ )
1566
+ p_adopt.add_argument("--depends-on", dest="depends_on", default="", help="Comma list")
1567
+ add_specs_dir(p_adopt)
1568
+ add_json(p_adopt)
1569
+
1361
1570
  # remove-feature -------------------------------------------------------- #
1362
1571
  p_remove = sub.add_parser("remove-feature", help="Remove a member feature")
1363
1572
  p_remove.add_argument("epic")
@@ -568,6 +568,7 @@ def write_config(answers: Answers, target: Path, sentinel: Sentinel) -> None:
568
568
  "stack": None,
569
569
  "typeCheckCommand": None,
570
570
  "testCommand": None,
571
+ "smokeCommand": None,
571
572
  "loopIterationMultiplier": 1.5,
572
573
  # Navigator keys — kept in lockstep with forge-init.sh's emitted field set
573
574
  # (00 §7, REQ-CFG-02) so a bootstrapped config == forge-init's + loopRunner.
@@ -21,6 +21,7 @@ cat > "$CONFIG_FILE" << 'EOF'
21
21
  "stack": null,
22
22
  "typeCheckCommand": null,
23
23
  "testCommand": null,
24
+ "smokeCommand": null,
24
25
  "loopIterationMultiplier": 1.5,
25
26
  "autoInvokeNextStage": true,
26
27
  "contextWindowTokens": null,
@@ -42,6 +43,7 @@ echo " commitPrefix: forge"
42
43
  echo " stack: null (auto-detected during forge-2-tech)"
43
44
  echo " typeCheckCommand: null (auto-detected during forge-2-tech)"
44
45
  echo " testCommand: null (auto-detected during forge-2-tech)"
46
+ echo " smokeCommand: null (optional end-to-end smoke; enables impl-verify runnability check)"
45
47
  echo " loopIterationMultiplier: 1.5 (multiplier for loop iterations)"
46
48
  echo " autoInvokeNextStage: true (navigator auto-starts the next stage after you confirm)"
47
49
  echo " contextWindowTokens: null (infer; set to 1000000 on a 1M-context model)"
@@ -88,10 +88,18 @@ Use these status indicators:
88
88
 
89
89
  After rendering a **per-feature** dashboard for an **active** pipeline (skip this for paused/abandoned pipelines and for the Epic Dashboard), don't stop at a text suggestion — actively offer to start the next stage. This removes the copy-paste-after-clear your session / start a fresh session chore that makes long, multi-stage runs painful (especially on mobile).
90
90
 
91
- **1. Read the next step.** From the `rank-features --json` output (above), find this feature's row and read its `nextStage`, `nextCommand`, `verifyPending`, `verifyCommand`, `verifyStage`, `verifyState`, `autoVerify`, `autoFix`, and `verifyGate` (the resolved gate: `none` → no verify action; `auto` → the §2b catch-up; `standard` → the §3 gate). If the feature is not in the `active` list (paused/abandoned), or `nextStage` is `null` (every production stage complete), skip the drive prompt — instead congratulate the user and, if `forge-6-docs` has not run, offer it; otherwise note the pipeline is complete. If the payload has a non-empty `invalidAutoVerifyKeys`, print a one-line warning first (e.g. "⚠️ forge.config.json `autoVerifyStages` has unknown keys: … — they are ignored; fix the typo").
91
+ **1. Read the next step.** From the `rank-features --json` output (above), find this feature's row and read its `nextStage`, `nextCommand`, `verifyPending`, `verifyCommand`, `verifyStage`, `verifyState`, `autoVerify`, `autoFix`, and `verifyGate` (the resolved gate: `none` → no verify action; `auto` → the §2b catch-up; `standard` → the §3 gate). If the feature is not in the `active` list (paused/abandoned), or `nextStage` is `null` (every production stage complete), skip the drive prompt — instead congratulate the user and, if `forge-6-docs` has not run, offer it; otherwise the whole pipeline is done, so **route into the Completion hand-off block below instead of dead-ending** (steps 2/2b/3 do not apply — there is no next stage to drive). If the payload has a non-empty `invalidAutoVerifyKeys`, print a one-line warning first (e.g. "⚠️ forge.config.json `autoVerifyStages` has unknown keys: … — they are ignored; fix the typo").
92
92
 
93
93
  **Detached-epic hint (completion of a *standalone* feature, Issue #125).** When `nextStage` is `null` for a feature whose row has no `epic` (a standalone completion), run `discover-feature "{feature}" --json` (via the standard prelude) *before* congratulating. If any candidate has `isEpicMember: true` on another branch, add an **additive, non-blocking** hint — it does not change the completion, only flags a likely split-brain: "⚠️ Heads-up: `{feature}` matches a member of epic `{epic}` on branch `{stateBranch}`. This standalone pipeline may have been forged detached from that epic. To reconcile, see `docs/recovery-detached-epic-member.md` (or continue — this is only a heads-up)." Skip the hint for epic-member rows (their `epic` is non-null) and when discovery surfaces no epic-member candidate.
94
94
 
95
+ **Completion hand-off (fires when `nextStage` is `null` AND `forge-6-docs` has run — the pipeline is fully complete, Issue #124).** Do not dead-end on "pipeline is complete" — after congratulating, point the user at the next unit of work. This is a **terminal branch**: the drive steps (2/2b/3) do not run.
96
+
97
+ - **Epic member** (this feature's `rank-features` row has a non-null `epic`, i.e. its `.pipeline-state.json` carries an `epic` back-pointer): run `epic-manifest.py render-status "{epic}" --specs-dir "{specsDir}" --json` (standard prelude; you likely already have this from the Tier-1 epic rollup — reuse it rather than re-running). Then:
98
+ - If `actionable` is non-empty, offer the next member via the host's question mechanism: *"Epic '{epic}' has {total−complete} feature(s) left — next up: **{actionable[0].name}** (`{actionable[0].nextCommand}`). Start it now?"* On accept, drive it exactly like a normal next stage (honor `autoInvokeNextStage` + `Skill`-tool availability per step 3's Continue-in-this-session rule; else print `{nextCommand}`). List any remaining `actionable` members as also-available.
99
+ - If `actionable` is empty but the epic is **not** fully complete (members blocked on unmet `dependsOn`), say so and point at the blockers rather than offering a start.
100
+ - If the epic is **fully complete** (`rollup.complete == rollup.total`, `total > 0`), congratulate on the whole epic and offer the epic-level architecture doc (`/feature-forge:forge-6-docs` already surfaces this — mention it) and/or that the epic can be marked complete (`/feature-forge:forge {epic}` renders the finished dashboard).
101
+ - **Standalone** (row's `epic` is null): offer to start a fresh feature — *"Start a new feature: `/feature-forge:forge-1-prd <feature-name>` (or group several with `/feature-forge:forge-0-epic <epic-name>`)."* Then, from the `rank-features` `active` list, surface any **other** active pipelines (exclude this just-completed one) as a one-line list with their `nextCommand`s so the user can jump straight back into in-flight work. If the **detached-epic hint above fired** for this feature, lead with that recovery path (`docs/recovery-detached-epic-member.md`) — the split-brain reconcile is the more likely next action than starting something new.
102
+
95
103
  **2. Check the context window.** Run the context-usage helper so you can advise whether to continue here or start the next stage in a fresh session:
96
104
  ```bash
97
105
  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')"