@garygentry/feature-forge 0.1.0

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 (231) hide show
  1. package/LICENSE +21 -0
  2. package/adapters/GENERATION-REPORT.md +128 -0
  3. package/adapters/claude/agents/forge-researcher.md +137 -0
  4. package/adapters/claude/agents/forge-spec-writer.md +115 -0
  5. package/adapters/claude/agents/forge-verifier.md +121 -0
  6. package/adapters/claude/references/epic-manifest-schema.json +120 -0
  7. package/adapters/claude/references/forge-config-schema.json +166 -0
  8. package/adapters/claude/references/pipeline-state-schema.json +110 -0
  9. package/adapters/claude/references/portable-root.md +56 -0
  10. package/adapters/claude/references/process-overview.md +123 -0
  11. package/adapters/claude/references/ralph-loop-contract.md +221 -0
  12. package/adapters/claude/references/shared-conventions.md +144 -0
  13. package/adapters/claude/references/skill-frontmatter.schema.json +17 -0
  14. package/adapters/claude/references/stack-resolution.md +51 -0
  15. package/adapters/claude/references/stacks/_generic.md +90 -0
  16. package/adapters/claude/references/stacks/go.md +138 -0
  17. package/adapters/claude/references/stacks/python.md +163 -0
  18. package/adapters/claude/references/stacks/rust.md +151 -0
  19. package/adapters/claude/references/stacks/typescript.md +111 -0
  20. package/adapters/claude/references/vendor-construct-inventory.md +49 -0
  21. package/adapters/claude/scripts/forge-root.sh +50 -0
  22. package/adapters/claude/skills/forge/SKILL.md +165 -0
  23. package/adapters/claude/skills/forge-0-epic/SKILL.md +303 -0
  24. package/adapters/claude/skills/forge-0-epic/references/edit-mode.md +222 -0
  25. package/adapters/claude/skills/forge-0-epic/references/epic-manifest-subcommands.md +64 -0
  26. package/adapters/claude/skills/forge-1-prd/SKILL.md +121 -0
  27. package/adapters/claude/skills/forge-1-prd/references/prd-template.md +106 -0
  28. package/adapters/claude/skills/forge-2-tech/SKILL.md +198 -0
  29. package/adapters/claude/skills/forge-2-tech/references/stack-discovery-checklist.md +95 -0
  30. package/adapters/claude/skills/forge-3-specs/SKILL.md +154 -0
  31. package/adapters/claude/skills/forge-3-specs/references/spec-archetypes.md +106 -0
  32. package/adapters/claude/skills/forge-3-specs/references/spec-examples.md +71 -0
  33. package/adapters/claude/skills/forge-4-backlog/SKILL.md +146 -0
  34. package/adapters/claude/skills/forge-5-loop/SKILL.md +303 -0
  35. package/adapters/claude/skills/forge-5-loop/references/result-reporting.md +63 -0
  36. package/adapters/claude/skills/forge-5-loop/references/runner-contract.md +214 -0
  37. package/adapters/claude/skills/forge-6-docs/SKILL.md +179 -0
  38. package/adapters/claude/skills/forge-6-docs/references/doc-conventions.md +126 -0
  39. package/adapters/claude/skills/forge-fix/SKILL.md +65 -0
  40. package/adapters/claude/skills/forge-init/SKILL.md +29 -0
  41. package/adapters/claude/skills/forge-verify/SKILL.md +219 -0
  42. package/adapters/claude/skills/forge-verify/references/verification-checklists.md +379 -0
  43. package/adapters/codex/agents/forge-researcher.md +133 -0
  44. package/adapters/codex/agents/forge-spec-writer.md +112 -0
  45. package/adapters/codex/agents/forge-verifier.md +115 -0
  46. package/adapters/codex/agents/openai.yaml +10 -0
  47. package/adapters/codex/references/epic-manifest-schema.json +120 -0
  48. package/adapters/codex/references/forge-config-schema.json +166 -0
  49. package/adapters/codex/references/pipeline-state-schema.json +110 -0
  50. package/adapters/codex/references/portable-root.md +56 -0
  51. package/adapters/codex/references/process-overview.md +123 -0
  52. package/adapters/codex/references/ralph-loop-contract.md +221 -0
  53. package/adapters/codex/references/shared-conventions.md +144 -0
  54. package/adapters/codex/references/skill-frontmatter.schema.json +17 -0
  55. package/adapters/codex/references/stack-resolution.md +51 -0
  56. package/adapters/codex/references/stacks/_generic.md +90 -0
  57. package/adapters/codex/references/stacks/go.md +138 -0
  58. package/adapters/codex/references/stacks/python.md +163 -0
  59. package/adapters/codex/references/stacks/rust.md +151 -0
  60. package/adapters/codex/references/stacks/typescript.md +111 -0
  61. package/adapters/codex/references/vendor-construct-inventory.md +49 -0
  62. package/adapters/codex/scripts/forge-root.sh +50 -0
  63. package/adapters/codex/skills/forge/forge.md +164 -0
  64. package/adapters/codex/skills/forge-0-epic/forge-0-epic.md +302 -0
  65. package/adapters/codex/skills/forge-0-epic/references/edit-mode.md +222 -0
  66. package/adapters/codex/skills/forge-0-epic/references/epic-manifest-subcommands.md +64 -0
  67. package/adapters/codex/skills/forge-1-prd/forge-1-prd.md +120 -0
  68. package/adapters/codex/skills/forge-1-prd/references/prd-template.md +106 -0
  69. package/adapters/codex/skills/forge-2-tech/forge-2-tech.md +197 -0
  70. package/adapters/codex/skills/forge-2-tech/references/stack-discovery-checklist.md +95 -0
  71. package/adapters/codex/skills/forge-3-specs/forge-3-specs.md +153 -0
  72. package/adapters/codex/skills/forge-3-specs/references/spec-archetypes.md +106 -0
  73. package/adapters/codex/skills/forge-3-specs/references/spec-examples.md +71 -0
  74. package/adapters/codex/skills/forge-4-backlog/forge-4-backlog.md +145 -0
  75. package/adapters/codex/skills/forge-5-loop/forge-5-loop.md +302 -0
  76. package/adapters/codex/skills/forge-5-loop/references/result-reporting.md +63 -0
  77. package/adapters/codex/skills/forge-5-loop/references/runner-contract.md +214 -0
  78. package/adapters/codex/skills/forge-6-docs/forge-6-docs.md +178 -0
  79. package/adapters/codex/skills/forge-6-docs/references/doc-conventions.md +126 -0
  80. package/adapters/codex/skills/forge-fix/forge-fix.md +64 -0
  81. package/adapters/codex/skills/forge-init/forge-init.md +29 -0
  82. package/adapters/codex/skills/forge-verify/forge-verify.md +218 -0
  83. package/adapters/codex/skills/forge-verify/references/verification-checklists.md +379 -0
  84. package/adapters/copilot/agents/forge-researcher.md +133 -0
  85. package/adapters/copilot/agents/forge-spec-writer.md +112 -0
  86. package/adapters/copilot/agents/forge-verifier.md +115 -0
  87. package/adapters/copilot/references/epic-manifest-schema.json +120 -0
  88. package/adapters/copilot/references/forge-config-schema.json +166 -0
  89. package/adapters/copilot/references/pipeline-state-schema.json +110 -0
  90. package/adapters/copilot/references/portable-root.md +56 -0
  91. package/adapters/copilot/references/process-overview.md +123 -0
  92. package/adapters/copilot/references/ralph-loop-contract.md +221 -0
  93. package/adapters/copilot/references/shared-conventions.md +144 -0
  94. package/adapters/copilot/references/skill-frontmatter.schema.json +17 -0
  95. package/adapters/copilot/references/stack-resolution.md +51 -0
  96. package/adapters/copilot/references/stacks/_generic.md +90 -0
  97. package/adapters/copilot/references/stacks/go.md +138 -0
  98. package/adapters/copilot/references/stacks/python.md +163 -0
  99. package/adapters/copilot/references/stacks/rust.md +151 -0
  100. package/adapters/copilot/references/stacks/typescript.md +111 -0
  101. package/adapters/copilot/references/vendor-construct-inventory.md +49 -0
  102. package/adapters/copilot/scripts/forge-root.sh +50 -0
  103. package/adapters/copilot/skills/forge/forge.md +164 -0
  104. package/adapters/copilot/skills/forge-0-epic/forge-0-epic.md +302 -0
  105. package/adapters/copilot/skills/forge-0-epic/references/edit-mode.md +222 -0
  106. package/adapters/copilot/skills/forge-0-epic/references/epic-manifest-subcommands.md +64 -0
  107. package/adapters/copilot/skills/forge-1-prd/forge-1-prd.md +120 -0
  108. package/adapters/copilot/skills/forge-1-prd/references/prd-template.md +106 -0
  109. package/adapters/copilot/skills/forge-2-tech/forge-2-tech.md +197 -0
  110. package/adapters/copilot/skills/forge-2-tech/references/stack-discovery-checklist.md +95 -0
  111. package/adapters/copilot/skills/forge-3-specs/forge-3-specs.md +153 -0
  112. package/adapters/copilot/skills/forge-3-specs/references/spec-archetypes.md +106 -0
  113. package/adapters/copilot/skills/forge-3-specs/references/spec-examples.md +71 -0
  114. package/adapters/copilot/skills/forge-4-backlog/forge-4-backlog.md +145 -0
  115. package/adapters/copilot/skills/forge-5-loop/forge-5-loop.md +302 -0
  116. package/adapters/copilot/skills/forge-5-loop/references/result-reporting.md +63 -0
  117. package/adapters/copilot/skills/forge-5-loop/references/runner-contract.md +214 -0
  118. package/adapters/copilot/skills/forge-6-docs/forge-6-docs.md +178 -0
  119. package/adapters/copilot/skills/forge-6-docs/references/doc-conventions.md +126 -0
  120. package/adapters/copilot/skills/forge-fix/forge-fix.md +64 -0
  121. package/adapters/copilot/skills/forge-init/forge-init.md +29 -0
  122. package/adapters/copilot/skills/forge-verify/forge-verify.md +218 -0
  123. package/adapters/copilot/skills/forge-verify/references/verification-checklists.md +379 -0
  124. package/adapters/cursor/agents/forge-researcher.mdc +134 -0
  125. package/adapters/cursor/agents/forge-spec-writer.mdc +113 -0
  126. package/adapters/cursor/agents/forge-verifier.mdc +116 -0
  127. package/adapters/cursor/references/epic-manifest-schema.json +120 -0
  128. package/adapters/cursor/references/forge-config-schema.json +166 -0
  129. package/adapters/cursor/references/pipeline-state-schema.json +110 -0
  130. package/adapters/cursor/references/portable-root.md +56 -0
  131. package/adapters/cursor/references/process-overview.md +123 -0
  132. package/adapters/cursor/references/ralph-loop-contract.md +221 -0
  133. package/adapters/cursor/references/shared-conventions.md +144 -0
  134. package/adapters/cursor/references/skill-frontmatter.schema.json +17 -0
  135. package/adapters/cursor/references/stack-resolution.md +51 -0
  136. package/adapters/cursor/references/stacks/_generic.md +90 -0
  137. package/adapters/cursor/references/stacks/go.md +138 -0
  138. package/adapters/cursor/references/stacks/python.md +163 -0
  139. package/adapters/cursor/references/stacks/rust.md +151 -0
  140. package/adapters/cursor/references/stacks/typescript.md +111 -0
  141. package/adapters/cursor/references/vendor-construct-inventory.md +49 -0
  142. package/adapters/cursor/scripts/forge-root.sh +50 -0
  143. package/adapters/cursor/skills/forge/forge.mdc +165 -0
  144. package/adapters/cursor/skills/forge-0-epic/forge-0-epic.mdc +303 -0
  145. package/adapters/cursor/skills/forge-0-epic/references/edit-mode.md +222 -0
  146. package/adapters/cursor/skills/forge-0-epic/references/epic-manifest-subcommands.md +64 -0
  147. package/adapters/cursor/skills/forge-1-prd/forge-1-prd.mdc +121 -0
  148. package/adapters/cursor/skills/forge-1-prd/references/prd-template.md +106 -0
  149. package/adapters/cursor/skills/forge-2-tech/forge-2-tech.mdc +198 -0
  150. package/adapters/cursor/skills/forge-2-tech/references/stack-discovery-checklist.md +95 -0
  151. package/adapters/cursor/skills/forge-3-specs/forge-3-specs.mdc +154 -0
  152. package/adapters/cursor/skills/forge-3-specs/references/spec-archetypes.md +106 -0
  153. package/adapters/cursor/skills/forge-3-specs/references/spec-examples.md +71 -0
  154. package/adapters/cursor/skills/forge-4-backlog/forge-4-backlog.mdc +146 -0
  155. package/adapters/cursor/skills/forge-5-loop/forge-5-loop.mdc +303 -0
  156. package/adapters/cursor/skills/forge-5-loop/references/result-reporting.md +63 -0
  157. package/adapters/cursor/skills/forge-5-loop/references/runner-contract.md +214 -0
  158. package/adapters/cursor/skills/forge-6-docs/forge-6-docs.mdc +179 -0
  159. package/adapters/cursor/skills/forge-6-docs/references/doc-conventions.md +126 -0
  160. package/adapters/cursor/skills/forge-fix/forge-fix.mdc +65 -0
  161. package/adapters/cursor/skills/forge-init/forge-init.mdc +30 -0
  162. package/adapters/cursor/skills/forge-verify/forge-verify.mdc +219 -0
  163. package/adapters/cursor/skills/forge-verify/references/verification-checklists.md +379 -0
  164. package/adapters/gemini/agents/forge-researcher.md +133 -0
  165. package/adapters/gemini/agents/forge-spec-writer.md +112 -0
  166. package/adapters/gemini/agents/forge-verifier.md +115 -0
  167. package/adapters/gemini/gemini-extension.json +54 -0
  168. package/adapters/gemini/references/epic-manifest-schema.json +120 -0
  169. package/adapters/gemini/references/forge-config-schema.json +166 -0
  170. package/adapters/gemini/references/pipeline-state-schema.json +110 -0
  171. package/adapters/gemini/references/portable-root.md +56 -0
  172. package/adapters/gemini/references/process-overview.md +123 -0
  173. package/adapters/gemini/references/ralph-loop-contract.md +221 -0
  174. package/adapters/gemini/references/shared-conventions.md +144 -0
  175. package/adapters/gemini/references/skill-frontmatter.schema.json +17 -0
  176. package/adapters/gemini/references/stack-resolution.md +51 -0
  177. package/adapters/gemini/references/stacks/_generic.md +90 -0
  178. package/adapters/gemini/references/stacks/go.md +138 -0
  179. package/adapters/gemini/references/stacks/python.md +163 -0
  180. package/adapters/gemini/references/stacks/rust.md +151 -0
  181. package/adapters/gemini/references/stacks/typescript.md +111 -0
  182. package/adapters/gemini/references/vendor-construct-inventory.md +49 -0
  183. package/adapters/gemini/scripts/forge-root.sh +50 -0
  184. package/adapters/gemini/skills/forge/forge.md +164 -0
  185. package/adapters/gemini/skills/forge-0-epic/forge-0-epic.md +302 -0
  186. package/adapters/gemini/skills/forge-0-epic/references/edit-mode.md +222 -0
  187. package/adapters/gemini/skills/forge-0-epic/references/epic-manifest-subcommands.md +64 -0
  188. package/adapters/gemini/skills/forge-1-prd/forge-1-prd.md +120 -0
  189. package/adapters/gemini/skills/forge-1-prd/references/prd-template.md +106 -0
  190. package/adapters/gemini/skills/forge-2-tech/forge-2-tech.md +197 -0
  191. package/adapters/gemini/skills/forge-2-tech/references/stack-discovery-checklist.md +95 -0
  192. package/adapters/gemini/skills/forge-3-specs/forge-3-specs.md +153 -0
  193. package/adapters/gemini/skills/forge-3-specs/references/spec-archetypes.md +106 -0
  194. package/adapters/gemini/skills/forge-3-specs/references/spec-examples.md +71 -0
  195. package/adapters/gemini/skills/forge-4-backlog/forge-4-backlog.md +145 -0
  196. package/adapters/gemini/skills/forge-5-loop/forge-5-loop.md +302 -0
  197. package/adapters/gemini/skills/forge-5-loop/references/result-reporting.md +63 -0
  198. package/adapters/gemini/skills/forge-5-loop/references/runner-contract.md +214 -0
  199. package/adapters/gemini/skills/forge-6-docs/forge-6-docs.md +178 -0
  200. package/adapters/gemini/skills/forge-6-docs/references/doc-conventions.md +126 -0
  201. package/adapters/gemini/skills/forge-fix/forge-fix.md +64 -0
  202. package/adapters/gemini/skills/forge-init/forge-init.md +29 -0
  203. package/adapters/gemini/skills/forge-verify/forge-verify.md +218 -0
  204. package/adapters/gemini/skills/forge-verify/references/verification-checklists.md +379 -0
  205. package/dist/agent-targets.d.ts +70 -0
  206. package/dist/agent-targets.js +111 -0
  207. package/dist/apply.d.ts +49 -0
  208. package/dist/apply.js +246 -0
  209. package/dist/cli.d.ts +94 -0
  210. package/dist/cli.js +508 -0
  211. package/dist/detect.d.ts +45 -0
  212. package/dist/detect.js +72 -0
  213. package/dist/fsutil.d.ts +56 -0
  214. package/dist/fsutil.js +175 -0
  215. package/dist/hash.d.ts +50 -0
  216. package/dist/hash.js +107 -0
  217. package/dist/index.d.ts +8 -0
  218. package/dist/index.js +9 -0
  219. package/dist/manifest.d.ts +72 -0
  220. package/dist/manifest.js +222 -0
  221. package/dist/plan.d.ts +66 -0
  222. package/dist/plan.js +166 -0
  223. package/dist/rauf.d.ts +83 -0
  224. package/dist/rauf.js +118 -0
  225. package/dist/report.d.ts +35 -0
  226. package/dist/report.js +110 -0
  227. package/dist/source.d.ts +69 -0
  228. package/dist/source.js +164 -0
  229. package/dist/types.d.ts +264 -0
  230. package/dist/types.js +57 -0
  231. package/package.json +42 -0
@@ -0,0 +1,221 @@
1
+ # The Loop-Runner Contract (consumer side)
2
+
3
+ feature-forge's pipeline ends by handing a `backlog.json` to an autonomous
4
+ **loop runner** that implements each item. feature-forge does not embed any
5
+ runner's internals — it talks to the runner through one indirection point: the
6
+ **`loopRunner`** block in `forge.config.json`.
7
+
8
+ ## The seam
9
+
10
+ Every command feature-forge runs against the runner is a template in
11
+ `loopRunner`, with `{bin}`, `{backlogDir}`, `{specsDir}`, and `{iterations}`
12
+ substituted at call time. `forge-5-loop` (execution), `forge-4-backlog`
13
+ (validation), and `forge-verify` (backlog validation) all render their commands
14
+ from this block — there are no hardcoded `rauf …` commands in the skills, and
15
+ even the human log filename is tokenized via `{loopRunner.logFile}`.
16
+
17
+ When `forge.config.json` has no `loopRunner` block, feature-forge uses the
18
+ built-in defaults (see `references/forge-config-schema.json`) and announces
19
+ "defaulting to the rauf loop runner."
20
+
21
+ ## The contract a runner MUST satisfy
22
+
23
+ A conforming runner MUST implement the **backlog-tool / loop-runner contract**
24
+ defined authoritatively in rauf's
25
+ [`SPEC-BACKLOG-TOOL-CONTRACT.md`](https://github.com/garygentry/rauf/blob/main/docs/SPEC-BACKLOG-TOOL-CONTRACT.md)
26
+ (Part A). In summary, it must provide:
27
+
28
+ - **A backlog schema** with the published `$id` and an optional `schemaVersion`,
29
+ whose `type`/`status` vocabularies match the contract
30
+ (`type ∈ bug|bugfix|refactor|feature|chore|test`,
31
+ `status ∈ pending|in_progress|done|blocked`).
32
+ - **A `validate` verb** with exit codes `0` (valid) / `1` (findings) / `2`
33
+ (usage/IO) that emits `{ valid, findings[] }` under `--json`. This is the
34
+ single check feature-forge trusts — it never re-implements validation.
35
+ - **The signal protocol** (`RAUF_DONE` / `RAUF_BLOCKED` / `RAUF_NEEDS_HUMAN` /
36
+ `RAUF_REVIEW`). These are emitted by the *coding agent* into its stdout and
37
+ parsed by the runner — they are not runner-authored log lines, so consumers key
38
+ off the runner's parsed events (below), never the raw `RAUF_*` tokens (which can
39
+ also appear inside an agent's prose and produce false matches).
40
+ - **A machine-readable event stream** for live supervision (`loopRunner.eventStreamCommand`,
41
+ rauf: `loop run … --ndjson`): one JSON event per line with a stable `type`
42
+ vocabulary — `item_completed` / `item_blocked` / `needs_human` / `signal_parsed`
43
+ / `loop_completed` / `loop_error` / `loop_cancelled` / `llm_stuck_warning` (a
44
+ circuit-breaker halt surfaces as `loop_error`) — plus a
45
+ derived-status JSON (`loopRunner.statusJsonCommand`, rauf: `status … --json`) and
46
+ per-iteration telemetry with a `stuckWarning` flag (`loopRunner.watchCommand`,
47
+ rauf: `status … --json` — the `loop watch` verb was removed in v0.5.0). `forge-5-loop` supervises the run through these,
48
+ **not** by parsing the human log. `followCommand` / `logCommand` are
49
+ human-formatted streams for a person watching in a terminal, not machine surfaces.
50
+ - **The state-dir layout** (per-`--backlog` isolation under `loopRunner.stateDir`).
51
+ - **The CLI verbs** mapped by `loopRunner`: run (+ event-stream) / validate /
52
+ status (+ `--json`) / list / follow / log / version.
53
+ - **A `version` verb** (`{bin} version --json` → `{ version: <semver> }`) so
54
+ feature-forge can enforce `loopRunner.minRunnerVersion` before running.
55
+
56
+ > **The runner does not pause for human input.** When the coding agent signals
57
+ > `RAUF_NEEDS_HUMAN`/`RAUF_BLOCKED`/`RAUF_REVIEW`, a conforming runner sets that
58
+ > item aside and **keeps working other runnable items to completion** (rauf:
59
+ > `runner.ts` needs_human handler). So a supervising session can surface those
60
+ > events live (visibility) and cancel early, but it cannot inject an answer and
61
+ > resume the set-aside item mid-run — resolution is a follow-up retry pass. A
62
+ > first-class pause/resume-with-answer capability is a desirable runner
63
+ > enhancement (see `plans/rauf-enhancement-recommendations.md`).
64
+
65
+ ## rauf is the default and reference implementation
66
+
67
+ rauf owns the contract spec and is the runner feature-forge defaults to. The
68
+ authoring craft itself (how to decompose specs into well-scoped, verifiable
69
+ items) lives in rauf's **`author-backlog`** skill, which `forge-4-backlog`
70
+ delegates to — so the only thing binding feature-forge to a particular runner is
71
+ the schema + `validate` verb that this contract formalizes. A future runner swap
72
+ supplies its own `loopRunner` block (its own `bin`, schema, and `validate`
73
+ command) without touching any pipeline skill.
74
+
75
+ The coding-agent dimension this contract adds (below) is **additive and
76
+ presence-gated**: it exists only when the `loopRunner` block advertises it via
77
+ `agentArgument`. A runner that omits that field has no agent dimension at all —
78
+ the seam degrades to exactly today's behavior with no error, so default-to-rauf
79
+ and pluggability are unchanged. See `## Agent selection`.
80
+
81
+ ## Agent selection
82
+
83
+ This section is **contract-level**: it states what a conforming runner exposes
84
+ and what forge does with it, and defers every algorithm to the owning specs
85
+ (`02`/`03`/`04`/`05`).
86
+
87
+ ### What a conforming runner exposes (the consumed surface)
88
+
89
+ A runner that carries a coding-agent dimension exposes, in its `loopRunner`
90
+ block:
91
+
92
+ - an **`agentArgument`** template (rauf default `--agent {agent}`) — the
93
+ tokenized launch-time flag; its **presence** advertises the agent surface;
94
+ - an **`agentsProbeCommand`** (rauf default `{bin} agents --json`) emitting
95
+ `{ agents: [{ id, displayName, available, detail? }] }` and **always exiting
96
+ 0**;
97
+ - an optional **`defaultAgent`** project-default id.
98
+
99
+ These three fields are specified in full in `references/forge-config-schema.json`
100
+ and are the schema half of this contract. forge consumes rauf's existing
101
+ `--agent <id>` flag, `rauf agents` probe, `BacklogItem.provider`, and 5-layer
102
+ precedence — it conforms to them, it does not redesign them.
103
+
104
+ ### Precedence and the run-layer mapping
105
+
106
+ The agent-selection precedence is **`item > run > project > default`**,
107
+ deliberately parallel to the model-selection precedence (`item.model >
108
+ --model/options > project default > provider default`). It is realized as:
109
+
110
+ - **item** — `BacklogItem.provider`, applied by **rauf** from the backlog. forge
111
+ **never reads, writes, or overrides** it (pass-through), so a deliberate
112
+ per-item agent always wins.
113
+ - **run** — forge's per-run selector (`forge-5-loop` Step 2d).
114
+ - **project** — forge's `loopRunner.defaultAgent`.
115
+ - **default** — the runner's own default (`claude-cli` for rauf) when forge sends
116
+ nothing.
117
+
118
+ forge owns **only** the run and project layers. It collapses run-over-project
119
+ *inside itself* into the **single** `--agent {agent}` value it emits at the
120
+ **run layer**, and lets rauf apply the item override *above* that. forge **never
121
+ re-implements rauf's resolver**. The resolution algorithm itself lives in
122
+ `03-selection-resolution-observability.md`.
123
+
124
+ ### Availability probe + unknown/unavailable disambiguation
125
+
126
+ When the resolved agent is a **non-default** id, forge runs `agentsProbeCommand`
127
+ **once (no retries)** before any loop side-effect, parses the advertised
128
+ `agents[]`, and builds the advertised id set. Because the probe **always exits
129
+ 0**, an unknown id is distinguished from a known-but-unavailable one **only by
130
+ set membership**, not by exit code:
131
+
132
+ - **Unknown id** (not in the advertised set — a typo or unsupported agent):
133
+ **hard-reject before launch**, listing the valid ids. No proceed-anyway path.
134
+ No value is interpolated into `{agent}`.
135
+ - **Known but unavailable** (`available: false`): **warn** (showing the probe's
136
+ `detail`) and let the user **proceed-anyway or choose another** — never
137
+ silently abort, never silently proceed.
138
+ - **Available**: proceed.
139
+
140
+ The advertised id set is also the **allow-list**: the only value ever
141
+ interpolated into `{agent}` is a validated, advertised id. The **default /
142
+ claude path never reaches the probe** — it incurs no extra cost. The
143
+ `classify(...)` algorithm and the rejection-error text live in
144
+ `04-availability-precheck.md`.
145
+
146
+ ### Capability gate + version floor
147
+
148
+ Agent selection is **capability-gated** on the runner advertising
149
+ `agentArgument`: a runner whose `loopRunner` omits (or empties) that field
150
+ exposes no agent surface, so the per-run selector, the probe, and any `{agent}`
151
+ substitution **vanish entirely** and no agent argument is sent — byte-identical
152
+ to today. Degradation is **silent, not an error**, keeping alternate (non-rauf)
153
+ runners first-class. The gate condition is owned by
154
+ `02-config-schema-and-gating.md`.
155
+
156
+ Independently, the **version gate** floors at the runner version that ships the
157
+ agent surface. For rauf that is **0.6.0** (`loopRunner.minRunnerVersion`): the
158
+ `--agent` flag, the `agents` probe, and the preset agent registry are present in
159
+ rauf source at 0.6.0. A successful gate therefore guarantees those surfaces
160
+ exist before any run. See `## Version gating` and
161
+ `05-runner-discovery-version-gate.md`.
162
+
163
+ **This document — the `## Agent selection` section, the `## Per-stage agent
164
+ applicability` table, and the `## validate is agent-agnostic` note — together
165
+ with the augmented `loopRunner` schema block in
166
+ `references/forge-config-schema.json` constitute the `forge-loop-runner-contract`
167
+ expose, consumed by the `packaging-docs-ci` capstone as documentation input.**
168
+
169
+ ## Per-stage agent applicability
170
+
171
+ Every forge stage that invokes the loop runner is classified here. Only
172
+ `forge-5-loop` (execution) carries the coding-agent dimension; the two
173
+ validation-only stages are agent-agnostic.
174
+
175
+ | Stage | Runner verbs | Agent dimension |
176
+ |-------|-------------|-----------------|
177
+ | `forge-5-loop` | run / eventStream / status / version | **Full** — selector, probe, `--agent` |
178
+ | `forge-4-backlog` | `validate` | **None** — agent-agnostic |
179
+ | `forge-verify` | `validate` | **None** — agent-agnostic |
180
+
181
+ - **`forge-5-loop`** is the executor: it drives the run, so it renders the run /
182
+ event-stream / status / version verbs (and `list`) and carries the full agent
183
+ surface — the Step 2d selector, the availability probe, and the rendered
184
+ `agentArgument`.
185
+ - **`forge-4-backlog`** authors and then *validates* the backlog; its only runner
186
+ call is `validateCommand`. It also reads `versionCommand` for a graceful-degrade
187
+ check, but **passes no agent** and never runs `loop run`.
188
+ - **`forge-verify`** (backlog mode) re-runs the same `validateCommand` to surface
189
+ validation findings. It carries no agent dimension. This is **contract
190
+ coverage** of forge-verify (it is classified here), with an explicit agnostic
191
+ note (below) — **not** a new agent-driven run in forge-verify.
192
+
193
+ ### `validate` is agent-agnostic
194
+
195
+ The `validate` verb (`loopRunner.validateCommand`) checks a `backlog.json`
196
+ against the backlog schema and spec references. **It does not run a coding agent
197
+ and has no agent dimension.** No agent argument — `--agent`, the `{agent}` token,
198
+ or any agent id — may **ever** be passed to backlog validation, in **any** stage
199
+ (`forge-4-backlog`, `forge-verify`, or any future caller). Backlog validation is
200
+ a pure, deterministic check; the coding agent is irrelevant to it. A contributor
201
+ who later adds agent selection to a *new* stage MUST confirm that stage runs the
202
+ *execution* surface (like `forge-5-loop`), not `validate` — agent selection
203
+ belongs to execution only. If you find yourself adding `--agent` near a
204
+ `validateCommand` render, that is a bug.
205
+
206
+ ## Version gating
207
+
208
+ feature-forge requires a runner exposing `backlog validate` + backlog
209
+ `schemaVersion`, and the unified exit-code/status contract it reads. The floor is
210
+ now the **agent-surface floor**: the runner version that ships the `--agent`
211
+ flag, the `agents` probe, and the preset agent registry. For rauf that is
212
+ **0.6.0** (`loopRunner.minRunnerVersion`).
213
+ `forge-5-loop` runs `{bin} version --json`, semver-compares the reported version
214
+ against `minRunnerVersion`, and on a missing-or-too-old runner stops with
215
+ `loopRunner.installHint` (the CLI install/upgrade command) — **before** invoking
216
+ the loop. See `COMPATIBILITY.md` for the version matrix.
217
+
218
+ > **Two different "installs."** `installHint` obtains/upgrades the runner **CLI
219
+ > binary** (e.g. rauf's `install-binary.sh`). `setupHint` installs the runner's
220
+ > **per-project artifacts** (rauf: `rauf install .`). A failing version gate is
221
+ > always the former, never the latter.
@@ -0,0 +1,144 @@
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
+ **Recommendations:** Only recommend a specific option when codebase evidence, established conventions, or strong technical rationale clearly favors it. If options are equally valid, present them neutrally — let the user decide without bias.
38
+
39
+ ## Configuration Reading
40
+
41
+ Read `forge.config.json` from the project root. If it doesn't exist, use defaults.
42
+
43
+ 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?"
44
+
45
+ Extract these config values (use defaults if not present):
46
+ - `specsDir` (default: `./specs`)
47
+ - `docsDir` (default: `./docs/architecture`)
48
+ - `backlogDir` (default: null — backlog lives at `{specsDir}/{feature}/backlog.json`; when `backlogDir` is configured, forge-4 composes `{backlogDir}/{feature}/`)
49
+ - `gitCommitAfterStage` (default: true)
50
+ - `commitPrefix` (default: `forge`)
51
+ - `loopIterationMultiplier` (default: `1.5`)
52
+ - `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`.)
53
+
54
+ ## Feature Directory Resolution
55
+
56
+ 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.
57
+
58
+ ```bash
59
+ R="$(for d in "$HOME"/.claude/skills/feature-forge "$HOME"/.claude/plugins/*/feature-forge; do [ -x "$d/scripts/forge-root.sh" ] && exec "$d/scripts/forge-root.sh"; done)"
60
+ [ -n "$R" ] || { echo "feature-forge: cannot locate plugin root" >&2; exit 1; }
61
+ resolvedFeatureDir=$(python3 "$R/scripts/epic-manifest.py" \
62
+ resolve "<feature>" --specs-dir "<specsDir>")
63
+ ```
64
+
65
+ - **Exit 0:** stdout is the absolute feature directory. Use it everywhere this skill previously wrote `{specsDir}/{feature}/`.
66
+ - **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`.)
67
+ - **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.
68
+
69
+ In both failure cases, do not fall back to a guessed path.
70
+
71
+ **Resolution algorithm (summary; full spec in `02-manifest-helper-cli.md §4`):**
72
+ 1. Reject the name if unsafe (path separator, `..`, absolute, or failing `SAFE_NAME_RE`) — before any filesystem access.
73
+ 2. If `{specsDir}/{name}/.pipeline-state.json` exists → return that flat path.
74
+ 3. Else if exactly one `{specsDir}/*/{name}/.pipeline-state.json` exists → return that nested path.
75
+ 4. More than one match anywhere → `ambiguous` error listing all matching paths (uniqueness violation, REQ-DIR-04).
76
+ 5. Zero matches → `not-found` error.
77
+
78
+ 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.
79
+
80
+ **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).
81
+
82
+ ## Epic Context Injection
83
+
84
+ 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):
85
+
86
+ 1. **`{specsDir}/{epic}/EPIC.md`** — the epic narrative, including the per-feature Contracts sections.
87
+ 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.
88
+ 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`.
89
+
90
+ **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).
91
+
92
+ 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:
93
+
94
+ ```bash
95
+ R="$(for d in "$HOME"/.claude/skills/feature-forge "$HOME"/.claude/plugins/*/feature-forge; do [ -x "$d/scripts/forge-root.sh" ] && exec "$d/scripts/forge-root.sh"; done)"
96
+ [ -n "$R" ] || { echo "feature-forge: cannot locate plugin root" >&2; exit 1; }
97
+ python3 "$R/scripts/epic-manifest.py" \
98
+ render-status "<epic>" --specs-dir "<specsDir>" --json
99
+ ```
100
+
101
+ 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).
102
+
103
+ ## Pipeline State Protocol
104
+
105
+ Write pipeline state conforming to `references/pipeline-state-schema.json`. Always update `updatedAt` when modifying pipeline state.
106
+
107
+ ### Staleness Detection (Read-Time)
108
+
109
+ 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:
110
+
111
+ > "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."
112
+
113
+ ## Git Commit Protocol
114
+
115
+ When `gitCommitAfterStage` is true, follow this exact order to avoid state inconsistency:
116
+
117
+ 1. **Stage specific files only:** `git add {specsDir}/{feature}/` — never use `git add -A` or `git add .`
118
+ 2. **Attempt commit:** `git commit -m "{commitPrefix}({feature}): <action>"`
119
+ 3. **If commit succeeds:** capture the commit hash, then update pipeline state with `status: "complete"` and the `commitHash`
120
+ 4. **If commit 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:
121
+ - **Pre-commit hook failure:** Report the hook output. Never use `--no-verify` to bypass. Help the user fix the underlying issue.
122
+ - **Merge conflicts:** Report conflicting files. Suggest resolution steps appropriate to the conflict.
123
+ - **Nothing to commit:** If all artifacts were already committed, this is fine — proceed with state update but note the absence of a new commit hash.
124
+ 5. **Never** use `git add -A`, `--no-verify`, or `--force` flags
125
+
126
+ ## Crash Recovery
127
+
128
+ When a skill detects that `currentStage` matches itself and the stage status is `in-progress`, a previous run was interrupted. Follow this recovery protocol:
129
+
130
+ 1. **Inventory existing artifacts:** List all files on disk in `{specsDir}/{feature}/` that this stage would produce
131
+ 2. **Compare against state:** Check the `artifacts` array in the pipeline state for this stage — it tracks files written incrementally during the previous run
132
+ 3. **Present options to user:** "This stage was interrupted. Found {N} artifacts from the previous run: {list}. Would you like to resume from where it left off, or restart the stage from scratch?"
133
+ 4. **If resume:** Skip artifact generation for files that already exist and appear complete (non-empty, properly structured). Continue from the next unwritten artifact.
134
+ 5. **If restart:** Proceed normally. The version number will increment.
135
+
136
+ **Incremental artifact tracking:** When a stage writes multiple files (e.g., forge-3-specs writing a suite of spec documents), update the `artifacts` array in `.pipeline-state.json` after writing each file — not just at stage completion. This ensures crash recovery knows exactly which files were successfully written.
137
+
138
+ ## Force Mode
139
+
140
+ If the user passes `--force` as an argument, skip prerequisite validation with a warning:
141
+
142
+ > Force mode: skipping prerequisite checks. Pipeline state tracking may be incomplete. Recommend running `/feature-forge:forge {feature}` after to verify status.
143
+
144
+ 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.
@@ -0,0 +1,17 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://github.com/garygentry/feature-forge/references/skill-frontmatter.schema.json",
4
+ "title": "feature-forge canonical SKILL.md frontmatter",
5
+ "description": "Spec-pure frontmatter for canonical skills/*/SKILL.md. Source of truth for the allowed/required key sets loaded by scripts/check-spec-purity.py. NO version key (REQ-VER-03): versions live in manifests only.",
6
+ "type": "object",
7
+ "required": ["name", "description"],
8
+ "additionalProperties": false,
9
+ "properties": {
10
+ "name": { "type": "string" },
11
+ "description": { "type": "string" },
12
+ "license": { "type": "string" },
13
+ "compatibility": {},
14
+ "metadata": { "type": "object" },
15
+ "allowed-tools": {}
16
+ }
17
+ }
@@ -0,0 +1,51 @@
1
+ # Stack Resolution Protocol
2
+
3
+ How feature-forge resolves stack-specific guidance for a project.
4
+
5
+ ## Resolution Order (highest priority first)
6
+
7
+ 1. **Project-level override**: `.claude/references/stack-decisions.md` in the project root. If this file exists, it takes absolute precedence — it contains the team's explicit technology decisions.
8
+
9
+ 2. **Detected stack profile**: `references/stacks/{stack}.md` in this plugin, where `{stack}` matches the `stack` field in `forge.config.json`. Provides language-specific conventions for spec writing, verification, and examples.
10
+
11
+ 3. **Generic fallback**: `references/stacks/_generic.md` in this plugin. Language-neutral guidance that works for any stack. Used when no stack is detected or no matching profile exists.
12
+
13
+ ## How Stack Detection Works
14
+
15
+ Stack detection happens during **forge-2-tech** (the technical specification stage), which is the natural point where technology decisions are made.
16
+
17
+ 1. The agent examines the project's root manifest and build files
18
+ 2. Identifies the primary language, build tool, package manager, and framework
19
+ 3. Asks the user to confirm: "I detected this as a {stack} project. Correct?"
20
+ 4. Persists the stack identity in `forge.config.json` via the `stack`, `typeCheckCommand`, and `testCommand` fields
21
+ 5. All downstream stages (forge-3-specs, forge-4-backlog, forge-verify, forge-6-docs) read the `stack` field and load the matching profile
22
+
23
+ ## forge.config.json Fields
24
+
25
+ ```json
26
+ {
27
+ "stack": "typescript",
28
+ "typeCheckCommand": "bun run typecheck",
29
+ "testCommand": "bun test"
30
+ }
31
+ ```
32
+
33
+ - `stack` — Identifier matching a profile filename in `references/stacks/` (e.g., "typescript", "python", "go")
34
+ - `typeCheckCommand` — Used in acceptance criteria and verification checks. Null if the stack has no type checker.
35
+ - `testCommand` — Used in acceptance criteria and verification checks.
36
+
37
+ ## Available Profiles
38
+
39
+ | Profile | File | Covers |
40
+ |---------|------|--------|
41
+ | TypeScript | `references/stacks/typescript.md` | Node.js/Bun, npm/pnpm/bun, monorepo patterns, TS-specific spec conventions |
42
+ | Python | `references/stacks/python.md` | Python 3.10+, pip/uv/poetry, pytest, type hints, Pydantic/dataclasses |
43
+ | Generic | `references/stacks/_generic.md` | Any stack — language-neutral guidance using placeholders |
44
+
45
+ ## When No Stack Is Configured
46
+
47
+ If `forge.config.json` has no `stack` field and forge-2-tech hasn't run yet (e.g., when using `--force`), skills should:
48
+
49
+ 1. Attempt basic detection from project files (look for manifest files)
50
+ 2. Use `_generic.md` as fallback
51
+ 3. Note in the pipeline state that stack detection was skipped
@@ -0,0 +1,90 @@
1
+ # Generic Stack Profile
2
+
3
+ Language-neutral guidance for projects without a dedicated stack profile. Use this as a fallback when no matching `references/stacks/{stack}.md` exists.
4
+
5
+ ## Discovery Protocol
6
+
7
+ Identify the project's stack by checking for these manifest and build files:
8
+
9
+ | File | Stack |
10
+ |------|-------|
11
+ | `package.json` | Node.js / Bun (JavaScript/TypeScript) |
12
+ | `pyproject.toml`, `setup.py`, `setup.cfg` | Python |
13
+ | `go.mod` | Go |
14
+ | `Cargo.toml` | Rust |
15
+ | `pom.xml`, `build.gradle`, `build.gradle.kts` | Java / Kotlin |
16
+ | `*.csproj`, `*.sln` | .NET (C#/F#) |
17
+ | `mix.exs` | Elixir |
18
+ | `Gemfile` | Ruby |
19
+ | `Package.swift` | Swift |
20
+
21
+ Also check for:
22
+ - **Lock files**: Reveal the package manager (`bun.lockb`, `uv.lock`, `poetry.lock`, `go.sum`, `Cargo.lock`, etc.)
23
+ - **Workspace/monorepo configs**: `turbo.json`, `nx.json`, `lerna.json`, `pants.toml`, `Cargo workspace`, Go workspace `go.work`
24
+ - **CI configuration**: `.github/workflows/`, `Makefile`, `justfile` — often reveals build and test commands
25
+
26
+ ## Archetype Adaptations
27
+
28
+ ### 00-core-definitions.md
29
+
30
+ The shared type/data contract document. Language-neutral name for what TypeScript calls "core types and interfaces." Contents should include:
31
+
32
+ - **Data structures**: The primary types, classes, structs, records, or models that define the feature's domain. Use the project's idiomatic type system (dataclasses, structs, interfaces, schemas, etc.)
33
+ - **Error/exception hierarchy**: Base error type and domain-specific subtypes with structured properties. Every language has a mechanism for this (exception classes, error types, Result enums, etc.)
34
+ - **Constants and enumerations**: Shared values referenced across the feature
35
+ - **Public contracts**: Function signatures, protocols, interfaces, or traits that define the feature's API surface
36
+
37
+ **Documentation rule**: Every type/structure must have documentation comments in the project's convention (JSDoc, docstrings, godoc, rustdoc, etc.)
38
+
39
+ **Export rule**: Everything must be accessible through the module's entry point following project conventions.
40
+
41
+ ### 01-architecture-layout.md
42
+
43
+ How the feature is structured in the project:
44
+
45
+ - **Directory tree**: Full layout (not abbreviated)
46
+ - **Project manifest**: Dependencies, entry points, build scripts
47
+ - **Build/compiler configuration**: Key options
48
+ - **Module export structure**: What each entry point exposes
49
+ - **Build and deployment considerations**
50
+
51
+ ### NN-testing-strategy.md
52
+
53
+ - **Testing framework and tooling**: Match project conventions
54
+ - **Unit test approach**: What to test, what to mock/stub
55
+ - **Integration test approach**: Cross-module interaction testing
56
+ - **Test fixtures and factories**
57
+ - **Coverage targets**
58
+ - **Test file location conventions**
59
+
60
+ ## Spec Conventions
61
+
62
+ When writing implementation specs:
63
+ - Include complete type definitions and function signatures in the project's language — not pseudocode
64
+ - Include documentation comments on every public type and function
65
+ - Include error handling for every operation
66
+ - Include example usage where it aids clarity
67
+ - Cross-reference other spec documents by filename
68
+
69
+ ## Verification Adaptations
70
+
71
+ Replace stack-specific checks with these generic equivalents:
72
+
73
+ | Stack-specific check | Generic equivalent |
74
+ |---------------------|-------------------|
75
+ | "Valid TypeScript syntax" | "Valid syntax in the project's language" |
76
+ | "Barrel exports (index.ts)" | "Module exports/entry points follow project conventions" |
77
+ | "bun run typecheck passes" | "`{typeCheckCommand}` passes" (from forge.config.json) |
78
+ | "bun test passes" | "`{testCommand}` passes" (from forge.config.json) |
79
+ | "JSDoc on every field" | "Documentation comments on every field" |
80
+ | "tsconfig.json extends root" | "Build configuration follows project conventions" |
81
+
82
+ ## Acceptance Criteria Patterns
83
+
84
+ Use these placeholder patterns in backlog items. Replace `{typeCheckCommand}`, `{testCommand}`, and `{module}` with values from `forge.config.json` and the project structure:
85
+
86
+ - `{typeCheckCommand} passes for {module}`
87
+ - `{testCommand} passes for {module}`
88
+ - `{module}/[entry point] exports [expected symbols]`
89
+ - `[dependency manifest] includes [new dependency]`
90
+ - `[build command] succeeds`