@jamie-tam/forge 6.0.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 (213) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +389 -0
  3. package/agents/architect.md +92 -0
  4. package/agents/builder.md +122 -0
  5. package/agents/code-reviewer.md +107 -0
  6. package/agents/concept-designer.md +207 -0
  7. package/agents/craft-reviewer.md +132 -0
  8. package/agents/critic.md +130 -0
  9. package/agents/doc-writer.md +85 -0
  10. package/agents/dreamer.md +129 -0
  11. package/agents/e2e-runner.md +89 -0
  12. package/agents/gotcha-hunter.md +127 -0
  13. package/agents/prototype-builder.md +193 -0
  14. package/agents/prototype-codifier.md +204 -0
  15. package/agents/prototype-reviewer.md +163 -0
  16. package/agents/security-reviewer.md +108 -0
  17. package/agents/spec-reviewer.md +94 -0
  18. package/agents/tracer.md +98 -0
  19. package/agents/wireframer.md +109 -0
  20. package/commands/abort.md +25 -0
  21. package/commands/bugfix.md +151 -0
  22. package/commands/evolve.md +118 -0
  23. package/commands/feature.md +236 -0
  24. package/commands/forge.md +100 -0
  25. package/commands/greenfield.md +185 -0
  26. package/commands/hotfix.md +98 -0
  27. package/commands/refactor.md +147 -0
  28. package/commands/resume.md +25 -0
  29. package/commands/setup.md +201 -0
  30. package/commands/status.md +27 -0
  31. package/commands/task-force.md +110 -0
  32. package/commands/validate.md +12 -0
  33. package/dist/__tests__/active-manifest.test.js +272 -0
  34. package/dist/__tests__/copy.test.js +96 -0
  35. package/dist/__tests__/gate-check.test.js +384 -0
  36. package/dist/__tests__/wiki.test.js +472 -0
  37. package/dist/__tests__/work-manifest.test.js +304 -0
  38. package/dist/active-manifest.js +229 -0
  39. package/dist/cli.js +158 -0
  40. package/dist/copy.js +124 -0
  41. package/dist/gate-check.js +326 -0
  42. package/dist/hooks.js +60 -0
  43. package/dist/init.js +140 -0
  44. package/dist/manifest.js +90 -0
  45. package/dist/merge.js +77 -0
  46. package/dist/paths.js +36 -0
  47. package/dist/uninstall.js +216 -0
  48. package/dist/update.js +158 -0
  49. package/dist/verify-manifest.js +65 -0
  50. package/dist/verify.js +98 -0
  51. package/dist/wiki-ui.js +310 -0
  52. package/dist/wiki.js +364 -0
  53. package/dist/work-manifest.js +798 -0
  54. package/hooks/config/gate-requirements.json +79 -0
  55. package/hooks/hooks.json +143 -0
  56. package/hooks/scripts/analyze-telemetry.sh +114 -0
  57. package/hooks/scripts/gate-enforcer.sh +164 -0
  58. package/hooks/scripts/pre-compact.sh +90 -0
  59. package/hooks/scripts/session-start.sh +81 -0
  60. package/hooks/scripts/telemetry.sh +41 -0
  61. package/hooks/scripts/wiki-lint.sh +87 -0
  62. package/hooks/templates/AGENTS.md.template +48 -0
  63. package/hooks/templates/CLAUDE.md.template +45 -0
  64. package/package.json +55 -0
  65. package/protocols/README.md +40 -0
  66. package/protocols/codex.md +151 -0
  67. package/protocols/graphify.md +156 -0
  68. package/references/common/agent-coordination.md +65 -0
  69. package/references/common/coding-standards.md +54 -0
  70. package/references/common/feature-tracking.md +21 -0
  71. package/references/common/io-protocol.md +36 -0
  72. package/references/common/phases.md +57 -0
  73. package/references/common/quality-gates.md +130 -0
  74. package/references/common/skill-authoring.md +154 -0
  75. package/references/common/skill-compliance.md +30 -0
  76. package/references/python/standards.md +44 -0
  77. package/references/react/standards.md +61 -0
  78. package/references/typescript/standards.md +42 -0
  79. package/rules/common/forge-system.md +59 -0
  80. package/rules/common/git-workflow.md +40 -0
  81. package/rules/common/guardrails.md +37 -0
  82. package/rules/common/quality-gates.md +18 -0
  83. package/rules/common/security.md +50 -0
  84. package/rules/common/skill-selection.md +78 -0
  85. package/rules/common/testing.md +58 -0
  86. package/rules/common/verification.md +39 -0
  87. package/skills/build-pr-workflow/SKILL.md +301 -0
  88. package/skills/build-pr-workflow/references/pr-template.md +62 -0
  89. package/skills/build-pr-workflow/references/subagent-merge.md +47 -0
  90. package/skills/build-pr-workflow/references/worktree-setup.md +125 -0
  91. package/skills/build-prototype/SKILL.md +264 -0
  92. package/skills/build-scaffold/SKILL.md +340 -0
  93. package/skills/build-tdd/SKILL.md +89 -0
  94. package/skills/build-wireframe/SKILL.md +110 -0
  95. package/skills/build-wireframe/assets/baseline-template.html +486 -0
  96. package/skills/build-wireframe/references/demo-walkthroughs.md +170 -0
  97. package/skills/build-wireframe/references/gotchas.md +188 -0
  98. package/skills/build-wireframe/references/legend-lines.md +141 -0
  99. package/skills/concept-slides/SKILL.md +192 -0
  100. package/skills/deliver-db-migration/SKILL.md +466 -0
  101. package/skills/deliver-deploy/SKILL.md +407 -0
  102. package/skills/deliver-onboarding/SKILL.md +198 -0
  103. package/skills/deliver-onboarding/references/document-templates.md +393 -0
  104. package/skills/deliver-onboarding/templates/getting-started.md +122 -0
  105. package/skills/discover-codebase-analysis/SKILL.md +448 -0
  106. package/skills/discover-requirements/SKILL.md +418 -0
  107. package/skills/discover-requirements/templates/prd.md +99 -0
  108. package/skills/discover-requirements/templates/technical-spec.md +123 -0
  109. package/skills/discover-requirements/templates/user-stories.md +76 -0
  110. package/skills/harden/SKILL.md +214 -0
  111. package/skills/iterate-prototype/SKILL.md +241 -0
  112. package/skills/plan-architecture/SKILL.md +457 -0
  113. package/skills/plan-architecture/templates/adr-template.md +52 -0
  114. package/skills/plan-architecture/templates/api-contract.md +99 -0
  115. package/skills/plan-architecture/templates/db-schema.md +81 -0
  116. package/skills/plan-architecture/templates/system-design.md +111 -0
  117. package/skills/plan-brainstorm/SKILL.md +433 -0
  118. package/skills/plan-design-system/SKILL.md +279 -0
  119. package/skills/plan-task-decompose/SKILL.md +454 -0
  120. package/skills/quality-code-review/SKILL.md +286 -0
  121. package/skills/quality-security-audit/SKILL.md +292 -0
  122. package/skills/quality-security-audit/references/audit-report-template.md +89 -0
  123. package/skills/quality-security-audit/references/owasp-checks.md +178 -0
  124. package/skills/quality-test-execution/SKILL.md +435 -0
  125. package/skills/quality-test-plan/SKILL.md +297 -0
  126. package/skills/quality-test-plan/references/test-type-guide.md +263 -0
  127. package/skills/quality-test-plan/templates/e2e-test-plan.md +72 -0
  128. package/skills/quality-test-plan/templates/integration-test-plan.md +74 -0
  129. package/skills/quality-test-plan/templates/load-test-plan.md +111 -0
  130. package/skills/quality-test-plan/templates/smoke-test-plan.md +68 -0
  131. package/skills/quality-test-plan/templates/unit-test-plan.md +56 -0
  132. package/skills/quality-uiux/SKILL.md +481 -0
  133. package/skills/support-debug/SKILL.md +464 -0
  134. package/skills/support-dream/SKILL.md +213 -0
  135. package/skills/support-gotcha/SKILL.md +249 -0
  136. package/skills/support-runtime-reachability/SKILL.md +190 -0
  137. package/skills/support-runtime-reachability/scripts/__fixtures__/case-01-passes-app-use/src/app.ts +7 -0
  138. package/skills/support-runtime-reachability/scripts/__fixtures__/case-01-passes-app-use/src/handlers/cases.ts +7 -0
  139. package/skills/support-runtime-reachability/scripts/__fixtures__/case-02-orphan-no-app-use/src/app.ts +8 -0
  140. package/skills/support-runtime-reachability/scripts/__fixtures__/case-02-orphan-no-app-use/src/handlers/cases.ts +7 -0
  141. package/skills/support-runtime-reachability/scripts/__fixtures__/case-03-orphan-import-only/src/App.tsx +5 -0
  142. package/skills/support-runtime-reachability/scripts/__fixtures__/case-03-orphan-import-only/src/components/RingingBanner.tsx +7 -0
  143. package/skills/support-runtime-reachability/scripts/__fixtures__/case-03-orphan-import-only/src/hooks/useTwilio.ts +6 -0
  144. package/skills/support-runtime-reachability/scripts/__fixtures__/case-04-jsx-component-rendered/src/App.tsx +5 -0
  145. package/skills/support-runtime-reachability/scripts/__fixtures__/case-04-jsx-component-rendered/src/components/MyComp.tsx +3 -0
  146. package/skills/support-runtime-reachability/scripts/__fixtures__/case-05-jsx-component-not-rendered/src/App.tsx +3 -0
  147. package/skills/support-runtime-reachability/scripts/__fixtures__/case-05-jsx-component-not-rendered/src/components/Orphan.tsx +3 -0
  148. package/skills/support-runtime-reachability/scripts/__fixtures__/case-06-class-instantiated/src/lib/Service.ts +6 -0
  149. package/skills/support-runtime-reachability/scripts/__fixtures__/case-06-class-instantiated/src/main.ts +4 -0
  150. package/skills/support-runtime-reachability/scripts/__fixtures__/case-07-class-not-instantiated/src/lib/Lonely.ts +5 -0
  151. package/skills/support-runtime-reachability/scripts/__fixtures__/case-07-class-not-instantiated/src/main.ts +2 -0
  152. package/skills/support-runtime-reachability/scripts/__fixtures__/case-08-default-export-imported-and-called/src/handler.ts +3 -0
  153. package/skills/support-runtime-reachability/scripts/__fixtures__/case-08-default-export-imported-and-called/src/main.ts +3 -0
  154. package/skills/support-runtime-reachability/scripts/__fixtures__/case-09-default-export-orphan/src/handler.ts +3 -0
  155. package/skills/support-runtime-reachability/scripts/__fixtures__/case-09-default-export-orphan/src/main.ts +2 -0
  156. package/skills/support-runtime-reachability/scripts/__fixtures__/case-10-aliased-named-export/src/lib.ts +5 -0
  157. package/skills/support-runtime-reachability/scripts/__fixtures__/case-10-aliased-named-export/src/main.ts +3 -0
  158. package/skills/support-runtime-reachability/scripts/__fixtures__/case-11-re-export-chain/src/lib/index.ts +1 -0
  159. package/skills/support-runtime-reachability/scripts/__fixtures__/case-11-re-export-chain/src/lib/internal.ts +3 -0
  160. package/skills/support-runtime-reachability/scripts/__fixtures__/case-11-re-export-chain/src/main.ts +3 -0
  161. package/skills/support-runtime-reachability/scripts/__fixtures__/case-12-test-only-caller/src/util.test.ts +5 -0
  162. package/skills/support-runtime-reachability/scripts/__fixtures__/case-12-test-only-caller/src/util.ts +3 -0
  163. package/skills/support-runtime-reachability/scripts/__fixtures__/case-13-gated-pending-annotation/src/future.ts +4 -0
  164. package/skills/support-runtime-reachability/scripts/__fixtures__/case-14-untraceable-annotation/src/decorated.ts +4 -0
  165. package/skills/support-runtime-reachability/scripts/__fixtures__/case-15-untraceable-empty/src/lazy.ts +4 -0
  166. package/skills/support-runtime-reachability/scripts/__fixtures__/case-16-python-module/src/lib.py +15 -0
  167. package/skills/support-runtime-reachability/scripts/__fixtures__/case-16-python-module/src/main.py +5 -0
  168. package/skills/support-runtime-reachability/scripts/__fixtures__/case-17-router-use/src/parent.ts +5 -0
  169. package/skills/support-runtime-reachability/scripts/__fixtures__/case-17-router-use/src/routes/cases.ts +5 -0
  170. package/skills/support-runtime-reachability/scripts/__fixtures__/case-18-shadowed-name-fp/src/lib/foo.ts +3 -0
  171. package/skills/support-runtime-reachability/scripts/__fixtures__/case-18-shadowed-name-fp/src/other.ts +8 -0
  172. package/skills/support-runtime-reachability/scripts/__fixtures__/case-19-same-name-different-module/src/handlers/cases.ts +4 -0
  173. package/skills/support-runtime-reachability/scripts/__fixtures__/case-19-same-name-different-module/src/handlers/users.ts +4 -0
  174. package/skills/support-runtime-reachability/scripts/__fixtures__/case-19-same-name-different-module/src/main.ts +5 -0
  175. package/skills/support-runtime-reachability/scripts/__fixtures__/case-20-aliased-import-usage/src/handlers/cases.ts +3 -0
  176. package/skills/support-runtime-reachability/scripts/__fixtures__/case-20-aliased-import-usage/src/main.ts +4 -0
  177. package/skills/support-runtime-reachability/scripts/__fixtures__/case-21-mixed-default-and-named/src/lib.ts +5 -0
  178. package/skills/support-runtime-reachability/scripts/__fixtures__/case-21-mixed-default-and-named/src/main.ts +5 -0
  179. package/skills/support-runtime-reachability/scripts/__fixtures__/case-22-dynamic-import-then-caller/src/lib.ts +3 -0
  180. package/skills/support-runtime-reachability/scripts/__fixtures__/case-22-dynamic-import-then-caller/src/main.ts +8 -0
  181. package/skills/support-runtime-reachability/scripts/__fixtures__/case-23-dynamic-import-with-space/src/lib.ts +3 -0
  182. package/skills/support-runtime-reachability/scripts/__fixtures__/case-23-dynamic-import-with-space/src/main.ts +7 -0
  183. package/skills/support-runtime-reachability/scripts/check.mjs +638 -0
  184. package/skills/support-runtime-reachability/scripts/check.test.mjs +244 -0
  185. package/skills/support-skill-validator/SKILL.md +194 -0
  186. package/skills/support-skill-validator/references/false-positives.md +59 -0
  187. package/skills/support-skill-validator/references/validation-checks.md +280 -0
  188. package/skills/support-system-guide/SKILL.md +311 -0
  189. package/skills/support-task-force/SKILL.md +265 -0
  190. package/skills/support-task-force/references/dispatch-pattern.md +178 -0
  191. package/skills/support-task-force/references/synthesis-template.md +126 -0
  192. package/skills/support-wiki-bootstrap/SKILL.md +37 -0
  193. package/skills/support-wiki-lint/SKILL.md +196 -0
  194. package/skills/support-wiki-lint/scripts/lint.mjs +488 -0
  195. package/skills/support-wiki-lint/scripts/lint.test.mjs +196 -0
  196. package/templates/README.md +23 -0
  197. package/templates/aiwiki/CLAUDE.md.template +78 -0
  198. package/templates/aiwiki/schemas/architecture.md +118 -0
  199. package/templates/aiwiki/schemas/convention.md +112 -0
  200. package/templates/aiwiki/schemas/decision.md +144 -0
  201. package/templates/aiwiki/schemas/gotcha.md +118 -0
  202. package/templates/aiwiki/schemas/oracle.md +105 -0
  203. package/templates/aiwiki/schemas/session.md +125 -0
  204. package/templates/manifests/bugfix.yaml +41 -0
  205. package/templates/manifests/feature.yaml +69 -0
  206. package/templates/manifests/greenfield.yaml +61 -0
  207. package/templates/manifests/hotfix.yaml +45 -0
  208. package/templates/manifests/refactor.yaml +44 -0
  209. package/templates/manifests/v5/SCHEMA.md +327 -0
  210. package/templates/manifests/v5/feature.yaml +77 -0
  211. package/templates/manifests/v6/SCHEMA.md +199 -0
  212. package/templates/wiki-html/dream-detail.html +378 -0
  213. package/templates/wiki-html/dreams-list.html +155 -0
@@ -0,0 +1,418 @@
1
+ ---
2
+ name: discover-requirements
3
+ description: "Use when raw input (meeting notes, tickets, PRDs, screenshots) needs structuring into requirements with acceptance criteria."
4
+ ---
5
+
6
+ # Discover Requirements
7
+
8
+ Transform any raw input into structured, actionable requirements documents using **Socratic deep-interview methodology**. Accept meeting notes, emails, screenshots, existing documents, verbal descriptions, voice transcripts, or any other unstructured input and produce formal requirements with user stories, acceptance criteria, and MoSCoW priorities.
9
+
10
+ **Announce at start:** "I'm using the discover-requirements skill with deep-interview methodology to structure your input into formal requirements."
11
+
12
+ <HARD-GATE>
13
+ Do NOT proceed to brainstorming, architecture, or any planning skill until:
14
+ 1. Requirements have been documented and approved by the user
15
+ 2. Ambiguity score is at or below 20% (see Ambiguity Scoring below)
16
+ Every feature starts here or with an explicit user description.
17
+ </HARD-GATE>
18
+
19
+ ---
20
+
21
+ ## I/O Contract
22
+
23
+ | Field | Value |
24
+ |---|---|
25
+ | **Requires** | Raw input from user (any format: text, images, documents, verbal description) |
26
+ | **Produces** | `.forge/work/{type}/{name}/requirements.md` |
27
+ | **Feeds into** | `plan-brainstorm`, `plan-architecture` |
28
+ | **Updates manifest** | `artifacts.requirements` |
29
+
30
+ ---
31
+
32
+ ## Checklist
33
+
34
+ Complete these steps in order:
35
+
36
+ 1. **Detect brownfield/greenfield** -- check if existing codebase exists
37
+ 2. **Receive and catalog input** -- identify what was provided and its format
38
+ 3. **Identify input gaps** -- determine what is missing or ambiguous
39
+ 4. **Deep-interview loop** -- Socratic questioning with ambiguity scoring until score ≤ 20%
40
+ 5. **Extract requirements** -- pull structured items from the clarified input
41
+ 6. **Assign priorities** -- MoSCoW classification for every requirement
42
+ 7. **Write acceptance criteria** -- testable criteria for every requirement
43
+ 8. **Select output template** -- user stories, PRD, or technical spec
44
+ 9. **Draft requirements document** -- write to `.forge/work/{type}/{name}/requirements.md`
45
+ 10. **User review and approval** -- present for review, iterate until approved
46
+ 11. **Update feature manifest** -- record artifact path and approval status
47
+
48
+ ---
49
+
50
+ ## Process
51
+
52
+ ### Step 0: Detect Brownfield / Greenfield
53
+
54
+ Before asking the user anything, determine if this is a brownfield (existing code) or greenfield (new project):
55
+
56
+ ```bash
57
+ # Check for existing source code
58
+ ls src/ app/ lib/ packages/ 2>/dev/null
59
+ ```
60
+
61
+ **Brownfield:** Run the `discover-codebase-analysis` skill first (or read existing analysis). Before asking the user questions, explore the codebase to understand existing patterns, auth mechanisms, database schemas, and API conventions. Use evidence-cited questions:
62
+
63
+ > "I found JWT auth with passport.js in src/auth/. Should this feature extend that middleware or use a different approach?"
64
+
65
+ This prevents making the user rediscover what the code already tells you.
66
+
67
+ **Greenfield:** Skip codebase exploration. Proceed directly to input cataloging.
68
+
69
+ ### Step 1: Receive and Catalog Input
70
+
71
+ Accept ANY input format the user provides:
72
+
73
+ - **Meeting notes** -- extract action items, decisions, open questions
74
+ - **Emails/messages** -- identify requests, constraints, stakeholder expectations
75
+ - **Screenshots** -- describe what you see, identify UI requirements or issues
76
+ - **Existing documents** -- parse structure, extract relevant requirements
77
+ - **Verbal descriptions** -- capture intent, ask for confirmation of understanding
78
+ - **Voice transcripts** -- clean up, identify key points, separate signal from noise
79
+ - **Code snippets** -- infer the requirement the code is trying to solve
80
+ - **Bug reports** -- extract the expected behavior as a requirement
81
+
82
+ Summarize what you received back to the user in a brief inventory:
83
+
84
+ > "I received: [list of inputs]. Let me work through some clarifying questions to make sure I capture everything correctly."
85
+
86
+ ### Step 1.5: Codex Mode Check
87
+
88
+ Now that the input is cataloged, run the Codex consent flow from `protocols/codex.md`. The selected mode applies for the rest of this skill's invocation.
89
+
90
+ - **Takeover:** Dispatch Codex with the cataloged input + skill methodology. Claude reviews Codex's draft requirements at the end.
91
+ - **Verify** or **Skip / Codex unavailable:** Proceed with the steps below. The Codex Requirements Verify step will run after Claude's draft (Verify only).
92
+
93
+ ### Step 2: Identify Input Gaps
94
+
95
+ Before asking questions, internally assess:
96
+
97
+ - Who are the users/actors?
98
+ - What are the core actions they need to perform?
99
+ - What are the success conditions?
100
+ - What constraints exist (technical, business, time)?
101
+ - What error scenarios need handling?
102
+ - What is explicitly out of scope?
103
+
104
+ ### Step 3: Deep-Interview Loop (Socratic Questioning with Ambiguity Scoring)
105
+
106
+ This replaces simple clarifying questions with a rigorous, mathematically-gated interview process.
107
+
108
+ **Core framing: Test assumptions, don't gather features.**
109
+
110
+ The goal is NOT to ask "what do you want?" — that produces feature lists. Instead, ask "what are you assuming?" — that exposes hidden requirements. Every question should surface and test an assumption rather than accumulate features.
111
+
112
+ **"No user rediscovery" principle:** If the codebase already tells you something (auth mechanism, database schema, API patterns), do NOT ask the user about it. Explore the code first, then ask the user to CONFIRM or CORRECT, not discover.
113
+
114
+ #### Ambiguity Scoring
115
+
116
+ After EVERY user answer, score clarity across weighted dimensions:
117
+
118
+ **Greenfield projects:**
119
+
120
+ | Dimension | Weight | Score 0.0-1.0 |
121
+ |---|---|---|
122
+ | Goal Clarity | 40% | How precisely is the desired outcome defined? |
123
+ | Constraint Clarity | 30% | Are boundaries, limitations, and non-goals explicit? |
124
+ | Success Criteria | 30% | Can you write a test from the acceptance criteria? |
125
+
126
+ **Brownfield projects (existing codebase):**
127
+
128
+ If `discover-codebase-analysis` has already been completed, use the greenfield weights above — the context dimension is already satisfied. Only use the brownfield weights below when codebase analysis was NOT done:
129
+
130
+ | Dimension | Weight | Score 0.0-1.0 |
131
+ |---|---|---|
132
+ | Goal Clarity | 35% | How precisely is the desired outcome defined? |
133
+ | Constraint Clarity | 25% | Are boundaries, limitations, and non-goals explicit? |
134
+ | Success Criteria | 25% | Can you write a test from the acceptance criteria? |
135
+ | Context Clarity | 15% | Is the existing system understood enough to modify safely? |
136
+
137
+ **Calculate ambiguity:**
138
+ - Greenfield: `1 - (goal×0.40 + constraints×0.30 + criteria×0.30)`
139
+ - Brownfield: `1 - (goal×0.35 + constraints×0.25 + criteria×0.25 + context×0.15)`
140
+
141
+ **Gate rule:** Proceed to Step 4 ONLY when ambiguity ≤ 0.2 (20%). User can force early exit from round 3 onward with a warning.
142
+
143
+ #### Questioning Rules
144
+
145
+ - **One question per round.** Never bundle multiple questions.
146
+ - **Target the weakest dimension.** Before each question, identify which clarity dimension scores lowest and explicitly name it:
147
+ > "Goal clarity is the weakest area right now. Let me ask about that."
148
+ - **Multiple choice preferred** over open-ended when possible. Provide 3-5 options labeled A/B/C/D/E with a description for each.
149
+ - **Include an "Other" option** when the choices might not cover the user's intent.
150
+ - **Build on previous answers** -- each question should reference context from prior answers.
151
+
152
+ #### Challenge Modes (activate at specific rounds)
153
+
154
+ | Round | Mode | Focus |
155
+ |---|---|---|
156
+ | 4+ | **Contrarian** | "What if the opposite were true?" -- tests core assumptions |
157
+ | 6+ | **Simplifier** | "What's the minimal viable version?" -- removes assumed complexity |
158
+ | 8+ (if ambiguity > 0.3) | **Ontologist** | "What IS this, really?" -- finds essence by examining core entities |
159
+
160
+ Each mode activates once per interview, injecting a perspective shift into the question.
161
+
162
+ #### Ontology Tracking
163
+
164
+ Track key entities (nouns) and their relationships across rounds:
165
+
166
+ - **Stable entities:** present in consecutive rounds with same name
167
+ - **Changed entities:** renamed but conceptually identical
168
+ - **New entities:** genuinely new concepts introduced
169
+
170
+ **Stall detection:** If ambiguity score changes by less than ±0.05 for 3 consecutive rounds, the interview is stalling. Activate Ontologist mode to reframe fundamentals. If already past Ontologist mode, suggest the user provide additional context or accept current clarity level.
171
+
172
+ #### Progress Reporting
173
+
174
+ After every 3 rounds (not every single answer — that's noisy), briefly report:
175
+
176
+ ```
177
+ Clarity check (round N): ~XX% clear
178
+ Strongest: [dimension] | Weakest: [dimension] — focusing here next
179
+ ```
180
+
181
+ Keep it short. The user wants to know progress, not see a dashboard.
182
+
183
+ #### Limits
184
+
185
+ - **Round 3+:** User can force early exit with warning about remaining ambiguity
186
+ - **Round 10:** Soft warning — suggest proceeding or continuing
187
+ - **Round 20:** Hard cap — proceed with current clarity, document remaining gaps
188
+
189
+ ### Step 4: Extract Requirements
190
+
191
+ For each requirement extracted, capture:
192
+
193
+ - **ID**: REQ-{feature}-{number} (e.g., REQ-PAYMENTS-001)
194
+ - **Title**: Short descriptive name
195
+ - **Description**: What the system must do (not how)
196
+ - **User story**: As a [role], I want [capability], so that [benefit]
197
+ - **Priority**: Must / Should / Could / Won't (MoSCoW)
198
+ - **Acceptance criteria**: Testable conditions (Given/When/Then format)
199
+ - **Source**: Which input this came from (traceability)
200
+
201
+ ### Step 5: Assign Priorities (MoSCoW)
202
+
203
+ Every requirement gets a priority. Explain the framework to the user if needed:
204
+
205
+ | Priority | Meaning | Guideline |
206
+ |---|---|---|
207
+ | **Must** | Non-negotiable for this release | System is unusable without it |
208
+ | **Should** | Important but not critical | Workaround exists, or can ship without |
209
+ | **Could** | Desirable if time allows | Nice-to-have, enhances UX |
210
+ | **Won't** | Explicitly excluded this time | Documented for future consideration |
211
+
212
+ Present priorities to the user for validation. They may reclassify.
213
+
214
+ ### Step 6: Write Acceptance Criteria
215
+
216
+ Every requirement MUST have at least one acceptance criterion. Use Given/When/Then format:
217
+
218
+ ```
219
+ Given [precondition]
220
+ When [action]
221
+ Then [expected result]
222
+ ```
223
+
224
+ Criteria must be:
225
+
226
+ - **Testable** -- a developer can write an automated test from this
227
+ - **Specific** -- no vague language ("fast", "user-friendly", "intuitive")
228
+ - **Measurable** -- quantify where possible (response time < 200ms, not "fast")
229
+ - **Independent** -- each criterion can be verified on its own
230
+
231
+ ### Step 7: Select Output Template
232
+
233
+ Ask the user which format they prefer:
234
+
235
+ > "Which output format works best for your team?"
236
+ >
237
+ > A) **User Stories** -- Agile-style stories with acceptance criteria (best for dev teams)
238
+ > B) **PRD (Product Requirements Document)** -- Comprehensive product doc (best for stakeholder alignment)
239
+ > C) **Technical Specification** -- Technical focus with system constraints (best for engineering handoff)
240
+
241
+ Use the corresponding template from `templates/`:
242
+
243
+ - `user-stories.md`
244
+ - `prd.md`
245
+ - `technical-spec.md`
246
+
247
+ ### Step 8: Draft Requirements Document
248
+
249
+ Write the complete document to `.forge/work/{type}/{name}/requirements.md`.
250
+
251
+ The document MUST include these sections regardless of template:
252
+
253
+ 1. **Feature Overview** -- one paragraph summary
254
+ 2. **Scope** -- what is in, what is explicitly out
255
+ 3. **Users/Actors** -- who interacts with this feature
256
+ 4. **Requirements** -- numbered list with all fields from Step 4
257
+ 5. **Acceptance Criteria** -- consolidated or per-requirement
258
+ 6. **Priorities** -- MoSCoW summary table
259
+ 7. **Assumptions** -- assumptions exposed during interview and how they were resolved (e.g., "Assumed offline access needed → tested in round 4, user confirmed NOT needed → removed from scope")
260
+ 8. **Open Questions** -- anything still unresolved (must be resolved before brainstorm)
261
+ 9. **Dependencies** -- other features, services, or systems this touches
262
+
263
+ ### Step 9: User Review and Approval
264
+
265
+ Present a summary of the requirements document and ask for explicit approval:
266
+
267
+ > "Requirements document written to `.forge/work/{type}/{name}/requirements.md`. Here is a summary:
268
+ >
269
+ > - **{N} Must-have requirements**
270
+ > - **{N} Should-have requirements**
271
+ > - **{N} Could-have requirements**
272
+ > - **{N} Won't-have items** (documented for future)
273
+ >
274
+ > Please review the document. Let me know if anything needs to change before we proceed to brainstorming."
275
+
276
+ Iterate until the user approves. Track revision count.
277
+
278
+ ### Step 10: Update Feature Manifest
279
+
280
+ After approval, update `.forge/work/{type}/{name}/manifest.yaml`:
281
+
282
+ ```yaml
283
+ artifacts:
284
+ requirements:
285
+ path: requirements.md
286
+ status: approved
287
+ approved_at: YYYY-MM-DD
288
+ revision: N
289
+ requirement_count:
290
+ must: N
291
+ should: N
292
+ could: N
293
+ wont: N
294
+ ```
295
+
296
+ ---
297
+
298
+ ## Date Handling
299
+
300
+ Convert all relative dates to absolute dates based on the current date:
301
+
302
+ - "next week" -> specific date
303
+ - "by end of quarter" -> specific date
304
+ - "ASAP" -> flag for priority discussion, do not assign a date
305
+
306
+ ---
307
+
308
+ ## Key Rules
309
+
310
+ 1. **Every requirement MUST have acceptance criteria.** No exceptions. If a requirement cannot have testable criteria, it is not a requirement -- it is a wish.
311
+ 2. **Every requirement MUST have a priority.** Unprioritized requirements lead to scope creep.
312
+ 3. **No implementation details.** Requirements describe WHAT, not HOW. Architecture decides HOW. If the user provides implementation preferences, capture them in a "Technical Preferences" section but do not let them constrain the requirements.
313
+ 4. **Convert relative dates to absolute.** "Next sprint" is meaningless in a document. Use specific dates.
314
+ 5. **Trace everything.** Every requirement links back to the source input. This is how you verify completeness.
315
+ 6. **Resolve open questions before handoff.** The requirements document that feeds into brainstorm must have zero unresolved questions. If questions remain, flag them and ask the user to resolve.
316
+
317
+ ---
318
+
319
+ ## Anti-Patterns
320
+
321
+ | Anti-Pattern | Why It Is Wrong | What To Do Instead |
322
+ |---|---|---|
323
+ | **Guessing requirements** | Unvalidated assumptions become bugs | Ask the user. Always. |
324
+ | **Adding features the user did not ask for** | Scope creep wastes time and confuses priorities | Document only what was requested. Suggest additions separately. |
325
+ | **Skipping clarification because "it seems obvious"** | "Obvious" requirements have the most hidden complexity | Ask anyway. The question is cheap; the rework is expensive. |
326
+ | **Combining multiple questions in one message** | Overwhelms the user, leads to partial answers | One question per message. Always. |
327
+ | **Using vague acceptance criteria** | "System should be fast" is untestable | Quantify: "Response time < 200ms at p95 under 100 concurrent users" |
328
+ | **Mixing requirements with solutions** | Constrains the design space prematurely | Capture as "Technical Preferences" but keep requirements solution-agnostic |
329
+ | **Skipping Won't-have items** | Undocumented exclusions become scope disputes later | Explicitly list what is NOT included and why |
330
+
331
+ ---
332
+
333
+ ## Handling Edge Cases
334
+
335
+ ### User provides only a vague idea
336
+
337
+ Start with scope questions. Help them articulate what they want before trying to extract formal requirements:
338
+
339
+ > "Let me help you flesh this out. First question: what problem are you trying to solve?"
340
+
341
+ ### User provides an existing spec or PRD
342
+
343
+ Do not re-extract from scratch. Instead:
344
+
345
+ 1. Parse the existing document
346
+ 2. Identify gaps (missing acceptance criteria, unprioritized items, ambiguous language)
347
+ 3. Ask targeted questions to fill the gaps
348
+ 4. Output in the standardized format
349
+
350
+ ### User provides conflicting requirements
351
+
352
+ Flag the conflict explicitly:
353
+
354
+ > "I noticed a potential conflict: Requirement A says [X], but Requirement B implies [Y]. Which takes priority?"
355
+
356
+ Do not silently resolve conflicts. Surface them for user decision and document the resolution.
357
+
358
+ ### User wants to skip to implementation
359
+
360
+ Remind them of the process:
361
+
362
+ > "I understand the urgency, but undocumented requirements lead to rework. Let me ask 3-4 quick clarifying questions to make sure we build the right thing. It will take 2-3 minutes and save hours later."
363
+
364
+ ---
365
+
366
+ ### Codex Requirements Verify
367
+ After drafting the requirements document, check the mode recorded at Step 1.5. If **Verify** was selected, dispatch Codex to review for completeness gaps, contradictions, and missing edge cases. Present findings to user alongside requirements for review. If **Takeover** was selected, skip this step (Codex already drafted). If **Skip**, do nothing. Do NOT re-run the consent flow. See **Codex Integration** section below for full details.
368
+
369
+ ---
370
+
371
+ ## Output Quality Checklist
372
+
373
+ Before presenting the document, verify:
374
+
375
+ - [ ] Every requirement has an ID
376
+ - [ ] Every requirement has acceptance criteria in Given/When/Then format
377
+ - [ ] Every requirement has a MoSCoW priority
378
+ - [ ] No implementation details in requirement descriptions
379
+ - [ ] All relative dates converted to absolute dates
380
+ - [ ] Open questions section is empty (or flagged for resolution)
381
+ - [ ] Dependencies are identified
382
+ - [ ] Scope (in and out) is explicit
383
+ - [ ] Source traceability exists for every requirement
384
+
385
+ ---
386
+
387
+ ## Codex Integration
388
+ **Modes:** Verify or Takeover | **Protocol:** `protocols/codex.md`
389
+
390
+ - **Verify:** Claude drafts requirements, Codex reviews for completeness.
391
+ - **Takeover:** Codex drafts requirements from user input, Claude reviews and refines.
392
+
393
+ **When:** After Claude has produced the requirements document and before user approval.
394
+
395
+ **Context to pass:**
396
+ - Path to `.forge/work/{type}/{name}/requirements.md`
397
+ - Path to `.forge/work/{type}/{name}/codebase-analysis.md` (if available)
398
+
399
+ **What Codex reviews:**
400
+ - Requirements with missing or vague acceptance criteria
401
+ - Contradictions between requirements
402
+ - Missing edge cases (error states, empty states, concurrent access)
403
+ - Requirements that conflict with existing codebase patterns
404
+
405
+ **Prompt focus:** "Review this requirements document for completeness gaps, contradictions, and missing edge cases. Flag any requirements that lack testable acceptance criteria."
406
+
407
+ **Presentation:** Present Codex findings to the user alongside the requirements document for review.
408
+
409
+ ---
410
+
411
+ ## Transition
412
+
413
+ After the user approves the requirements document:
414
+
415
+ - If this is a new project or major feature: invoke `plan-brainstorm` to explore approaches
416
+ - If this is a small change with obvious implementation: user may skip to `plan-architecture` or `plan-task-decompose` (but flag that brainstorming was skipped in the manifest)
417
+
418
+ > "Requirements approved. Next step: brainstorming approaches. I'll use the plan-brainstorm skill to explore 2-3 approaches with you before we commit to an architecture."
@@ -0,0 +1,99 @@
1
+ # Product Requirements Document
2
+
3
+ ## 1. Problem Statement
4
+
5
+ {What problem are we solving? Who has this problem? Why does it matter? What happens if we do not solve it?}
6
+
7
+ ## 2. Goals
8
+
9
+ - {Goal 1: measurable outcome we want to achieve}
10
+ - {Goal 2: measurable outcome we want to achieve}
11
+ - {Goal 3: measurable outcome we want to achieve}
12
+
13
+ ## 3. Non-Goals
14
+
15
+ - {Explicitly out of scope item 1 — and why}
16
+ - {Explicitly out of scope item 2 — and why}
17
+
18
+ ## 4. User Personas
19
+
20
+ ### Persona: {Name}
21
+ - **Role**: {Who they are}
22
+ - **Goals**: {What they want to accomplish}
23
+ - **Pain points**: {What frustrates them today}
24
+ - **Technical level**: {Novice / Intermediate / Expert}
25
+
26
+ ### Persona: {Name}
27
+ - **Role**: {Who they are}
28
+ - **Goals**: {What they want to accomplish}
29
+ - **Pain points**: {What frustrates them today}
30
+ - **Technical level**: {Novice / Intermediate / Expert}
31
+
32
+ ## 5. User Journeys
33
+
34
+ Define the end-to-end flows users perform. Each journey chains multiple requirements into a single testable path. E2E tests are derived from these journeys.
35
+
36
+ ### Journey: {Journey Name}
37
+ **Priority:** Must / Should / Could
38
+ **Persona:** {which persona performs this journey}
39
+
40
+ | Step | User Does | System Response | Requirements |
41
+ |---|---|---|---|
42
+ | 1 | {user action} | {what the system does in response} | {FR-xxx} |
43
+ | 2 | {user action} | {what the system does in response} | {FR-xxx} |
44
+ | 3 | {user action} | {what the system does in response} | {FR-xxx} |
45
+
46
+ **Error paths:**
47
+ - At step {N}, if {error condition}: {expected system behavior}
48
+
49
+ ### Journey: {Journey Name}
50
+ **Priority:** Must / Should / Could
51
+ **Persona:** {which persona performs this journey}
52
+
53
+ | Step | User Does | System Response | Requirements |
54
+ |---|---|---|---|
55
+ | 1 | {user action} | {system response} | {FR-xxx} |
56
+
57
+ ## 6. Requirements
58
+
59
+ ### 6.1 Functional Requirements
60
+
61
+ | ID | Requirement | Priority | Acceptance Criteria |
62
+ |----|------------|----------|-------------------|
63
+ | FR-001 | {requirement description} | Must | {how to verify it works} |
64
+ | FR-002 | {requirement description} | Should | {how to verify it works} |
65
+ | FR-003 | {requirement description} | Could | {how to verify it works} |
66
+
67
+ ### 6.2 Non-Functional Requirements
68
+
69
+ | ID | Requirement | Category | Target |
70
+ |----|------------|----------|--------|
71
+ | NFR-001 | {requirement} | Performance | {e.g., p95 latency < 200ms} |
72
+ | NFR-002 | {requirement} | Reliability | {e.g., 99.9% uptime} |
73
+ | NFR-003 | {requirement} | Security | {e.g., SOC2 compliant} |
74
+ | NFR-004 | {requirement} | Scalability | {e.g., support 10k concurrent users} |
75
+ | NFR-005 | {requirement} | Accessibility | {e.g., WCAG 2.1 AA} |
76
+
77
+ ## 7. Success Metrics
78
+
79
+ | Metric | Current Baseline | Target | Measurement Method |
80
+ |--------|-----------------|--------|-------------------|
81
+ | {metric name} | {current value or N/A} | {target value} | {how we measure} |
82
+ | {metric name} | {current value or N/A} | {target value} | {how we measure} |
83
+
84
+ ## 8. Timeline
85
+
86
+ | Milestone | Target Date | Dependencies |
87
+ |-----------|------------|-------------|
88
+ | Requirements finalized | {date} | Stakeholder approval |
89
+ | Architecture approved | {date} | Requirements |
90
+ | MVP complete | {date} | Architecture |
91
+ | Testing complete | {date} | MVP |
92
+ | Launch | {date} | Testing |
93
+
94
+ ## 9. Open Questions
95
+
96
+ | # | Question | Owner | Status | Answer |
97
+ |---|---------|-------|--------|--------|
98
+ | 1 | {question that needs to be resolved} | {who decides} | Open | — |
99
+ | 2 | {question that needs to be resolved} | {who decides} | Resolved | {answer} |
@@ -0,0 +1,123 @@
1
+ # Technical Specification
2
+
3
+ ## 1. Overview
4
+
5
+ **Feature/Project**: {name}
6
+ **Author**: {name}
7
+ **Date**: {date}
8
+ **Status**: Draft / In Review / Approved
9
+
10
+ ### Summary
11
+ {One paragraph describing what this technical spec covers and why.}
12
+
13
+ ### Background
14
+ {Context needed to understand this spec. What exists today? What prompted this work?}
15
+
16
+ ## 2. Architecture
17
+
18
+ ### System Context
19
+ {How does this feature/system fit into the broader architecture? What systems does it interact with?}
20
+
21
+ ### Component Design
22
+ {Describe the major components, their responsibilities, and how they interact.}
23
+
24
+ ```
25
+ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐
26
+ │ Component A │────>│ Component B │────>│ Component C │
27
+ └──────┬──────┘ └─────────────┘ └─────────────┘
28
+
29
+ v
30
+ ┌─────────────┐
31
+ │ Component D │
32
+ └─────────────┘
33
+ ```
34
+
35
+ ### Key Design Decisions
36
+ {Describe important design decisions and the reasoning behind them. For significant decisions, create a separate ADR.}
37
+
38
+ | Decision | Choice | Rationale | Alternatives Considered |
39
+ |----------|--------|-----------|------------------------|
40
+ | {what was decided} | {what was chosen} | {why} | {what else was considered} |
41
+
42
+ ## 3. API Design
43
+
44
+ ### Endpoint: {METHOD} {/path}
45
+
46
+ **Description**: {what this endpoint does}
47
+ **Authentication**: {required/optional/none}
48
+
49
+ **Request**:
50
+ ```json
51
+ {
52
+ "field": "type — description"
53
+ }
54
+ ```
55
+
56
+ **Response (200)**:
57
+ ```json
58
+ {
59
+ "field": "type — description"
60
+ }
61
+ ```
62
+
63
+ **Error Responses**:
64
+ | Status | Code | Description |
65
+ |--------|------|-------------|
66
+ | 400 | INVALID_INPUT | {when this occurs} |
67
+ | 401 | UNAUTHORIZED | {when this occurs} |
68
+ | 404 | NOT_FOUND | {when this occurs} |
69
+
70
+ ## 4. Data Model
71
+
72
+ ### Table: {table_name}
73
+ {Description of what this table stores.}
74
+
75
+ | Column | Type | Nullable | Default | Description |
76
+ |--------|------|----------|---------|-------------|
77
+ | id | UUID | No | gen_random_uuid() | Primary key |
78
+ | {column} | {type} | {Yes/No} | {default} | {description} |
79
+ | created_at | TIMESTAMP | No | now() | Record creation time |
80
+ | updated_at | TIMESTAMP | No | now() | Last update time |
81
+
82
+ **Indexes**: {index definitions}
83
+ **Foreign Keys**: {FK relationships}
84
+
85
+ ### Migration Plan
86
+ {How to migrate from the current schema to the new schema. Include data migration if needed.}
87
+
88
+ ## 5. Security Considerations
89
+
90
+ - **Authentication**: {how users are authenticated for this feature}
91
+ - **Authorization**: {what permissions are required, how they are enforced}
92
+ - **Data sensitivity**: {what sensitive data is handled, how it is protected}
93
+ - **Input validation**: {what inputs are validated and how}
94
+ - **Audit logging**: {what actions are logged}
95
+
96
+ ## 6. Testing Strategy
97
+
98
+ | Test Type | What It Covers | Tools |
99
+ |-----------|---------------|-------|
100
+ | Unit | {individual functions, edge cases} | {test runner} |
101
+ | Integration | {component interactions, API contracts} | {test runner} |
102
+ | E2E | {user flows, browser interactions} | {Playwright} |
103
+ | Performance | {load, latency, throughput} | {k6/artillery} |
104
+
105
+ ### Key Test Scenarios
106
+ - {Scenario 1: description}
107
+ - {Scenario 2: description}
108
+ - {Scenario 3: description}
109
+
110
+ ## 7. Deployment Plan
111
+
112
+ - **Deploy strategy**: {rolling/blue-green/canary}
113
+ - **Feature flags**: {any feature flags needed}
114
+ - **Rollback plan**: {how to rollback if something goes wrong}
115
+ - **Monitoring**: {what to monitor after deploy}
116
+ - **Runbook**: {link to runbook or inline steps for common issues}
117
+
118
+ ## 8. Risks and Mitigations
119
+
120
+ | Risk | Likelihood | Impact | Mitigation |
121
+ |------|-----------|--------|------------|
122
+ | {what could go wrong} | Low/Med/High | Low/Med/High | {how to prevent or handle it} |
123
+ | {what could go wrong} | Low/Med/High | Low/Med/High | {how to prevent or handle it} |