qfai 1.0.3 → 1.0.5

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 (99) hide show
  1. package/README.md +53 -74
  2. package/assets/init/.qfai/README.md +17 -82
  3. package/assets/init/.qfai/assistant/README.md +9 -0
  4. package/assets/init/.qfai/assistant/agents/README.md +34 -0
  5. package/assets/init/.qfai/assistant/agents/architect.md +73 -0
  6. package/assets/init/.qfai/assistant/agents/backend-engineer.md +73 -0
  7. package/assets/init/.qfai/assistant/agents/code-reviewer.md +73 -0
  8. package/assets/init/.qfai/assistant/agents/contract-designer.md +73 -0
  9. package/assets/init/.qfai/assistant/agents/devops-ci-engineer.md +73 -0
  10. package/assets/init/.qfai/assistant/agents/facilitator.md +74 -0
  11. package/assets/init/.qfai/assistant/agents/frontend-engineer.md +73 -0
  12. package/assets/init/.qfai/assistant/agents/interviewer.md +72 -0
  13. package/assets/init/.qfai/assistant/agents/planner.md +73 -0
  14. package/assets/init/.qfai/assistant/agents/qa-engineer.md +73 -0
  15. package/assets/init/.qfai/assistant/agents/requirements-analyst.md +73 -0
  16. package/assets/init/.qfai/assistant/agents/test-engineer.md +73 -0
  17. package/assets/init/.qfai/assistant/instructions/README.md +6 -0
  18. package/assets/init/.qfai/assistant/instructions/constitution.md +131 -0
  19. package/assets/init/.qfai/assistant/instructions/workflow.md +75 -0
  20. package/assets/init/.qfai/assistant/prompts/README.md +19 -0
  21. package/assets/init/.qfai/assistant/prompts/qfai-discuss.md +173 -0
  22. package/assets/init/.qfai/assistant/prompts/qfai-implement.md +239 -0
  23. package/assets/init/.qfai/assistant/prompts/qfai-pr.md +218 -0
  24. package/assets/init/.qfai/assistant/prompts/qfai-require.md +273 -0
  25. package/assets/init/.qfai/assistant/prompts/qfai-scenario-test.md +229 -0
  26. package/assets/init/.qfai/assistant/prompts/qfai-spec.md +287 -0
  27. package/assets/init/.qfai/assistant/prompts/qfai-unit-test.md +202 -0
  28. package/assets/init/.qfai/assistant/prompts/qfai-verify.md +231 -0
  29. package/assets/init/.qfai/assistant/prompts.local/README.md +6 -0
  30. package/assets/init/.qfai/assistant/steering/README.md +33 -0
  31. package/assets/init/.qfai/assistant/steering/product.md +32 -0
  32. package/assets/init/.qfai/assistant/steering/structure.md +34 -0
  33. package/assets/init/.qfai/assistant/steering/tech.md +37 -0
  34. package/assets/init/.qfai/contracts/README.md +7 -87
  35. package/assets/init/.qfai/contracts/api/README.md +8 -0
  36. package/assets/init/.qfai/contracts/db/README.md +8 -0
  37. package/assets/init/.qfai/contracts/ui/README.md +8 -0
  38. package/assets/init/.qfai/report/README.md +13 -0
  39. package/assets/init/.qfai/require/README.md +4 -26
  40. package/assets/init/.qfai/require/require.md +74 -0
  41. package/assets/init/.qfai/specs/README.md +6 -57
  42. package/assets/init/root/.github/workflows/qfai.yml +1 -1
  43. package/assets/init/root/qfai.config.yaml +3 -4
  44. package/dist/cli/index.cjs +313 -472
  45. package/dist/cli/index.cjs.map +1 -1
  46. package/dist/cli/index.mjs +295 -454
  47. package/dist/cli/index.mjs.map +1 -1
  48. package/dist/index.cjs +37 -63
  49. package/dist/index.cjs.map +1 -1
  50. package/dist/index.d.cts +0 -1
  51. package/dist/index.d.ts +0 -1
  52. package/dist/index.mjs +37 -63
  53. package/dist/index.mjs.map +1 -1
  54. package/package.json +1 -1
  55. package/assets/init/.qfai/contracts/api/api-0001-sample.yaml +0 -15
  56. package/assets/init/.qfai/contracts/db/db-0001-sample.sql +0 -7
  57. package/assets/init/.qfai/contracts/ui/assets/thema-001-facebook-like/assets.yaml +0 -6
  58. package/assets/init/.qfai/contracts/ui/assets/thema-001-facebook-like/palette.png +0 -0
  59. package/assets/init/.qfai/contracts/ui/assets/ui-0001-sample/assets.yaml +0 -6
  60. package/assets/init/.qfai/contracts/ui/assets/ui-0001-sample/snapshots/login__desktop__light__default.png +0 -0
  61. package/assets/init/.qfai/contracts/ui/thema-001-facebook-like.yml +0 -13
  62. package/assets/init/.qfai/contracts/ui/ui-0001-sample.yaml +0 -17
  63. package/assets/init/.qfai/out/README.md +0 -17
  64. package/assets/init/.qfai/promptpack/commands/implement.md +0 -8
  65. package/assets/init/.qfai/promptpack/commands/plan.md +0 -11
  66. package/assets/init/.qfai/promptpack/commands/release.md +0 -6
  67. package/assets/init/.qfai/promptpack/commands/review.md +0 -7
  68. package/assets/init/.qfai/promptpack/constitution.md +0 -15
  69. package/assets/init/.qfai/promptpack/modes/change.md +0 -5
  70. package/assets/init/.qfai/promptpack/modes/compatibility.md +0 -6
  71. package/assets/init/.qfai/promptpack/roles/qa.md +0 -4
  72. package/assets/init/.qfai/promptpack/roles/spec.md +0 -4
  73. package/assets/init/.qfai/promptpack/roles/test.md +0 -4
  74. package/assets/init/.qfai/promptpack/steering/compatibility-vs-change.md +0 -42
  75. package/assets/init/.qfai/promptpack/steering/naming.md +0 -7
  76. package/assets/init/.qfai/promptpack/steering/traceability.md +0 -25
  77. package/assets/init/.qfai/prompts/README.md +0 -70
  78. package/assets/init/.qfai/prompts/analyze/README.md +0 -21
  79. package/assets/init/.qfai/prompts/analyze/scenario_test_consistency.md +0 -8
  80. package/assets/init/.qfai/prompts/analyze/scenario_to_test.md +0 -56
  81. package/assets/init/.qfai/prompts/analyze/spec_contract_consistency.md +0 -8
  82. package/assets/init/.qfai/prompts/analyze/spec_scenario_consistency.md +0 -8
  83. package/assets/init/.qfai/prompts/analyze/spec_to_contract.md +0 -54
  84. package/assets/init/.qfai/prompts/analyze/spec_to_scenario.md +0 -56
  85. package/assets/init/.qfai/prompts/makeBusinessFlow.md +0 -34
  86. package/assets/init/.qfai/prompts/makeOverview.md +0 -27
  87. package/assets/init/.qfai/prompts/qfai-classify-change.md +0 -33
  88. package/assets/init/.qfai/prompts/qfai-generate-test-globs.md +0 -29
  89. package/assets/init/.qfai/prompts/qfai-maintain-contracts.md +0 -35
  90. package/assets/init/.qfai/prompts/qfai-maintain-traceability.md +0 -36
  91. package/assets/init/.qfai/prompts/require-to-spec.md +0 -41
  92. package/assets/init/.qfai/prompts.local/README.md +0 -31
  93. package/assets/init/.qfai/rules/conventions.md +0 -27
  94. package/assets/init/.qfai/rules/pnpm.md +0 -29
  95. package/assets/init/.qfai/samples/analyze/analysis.md +0 -38
  96. package/assets/init/.qfai/samples/analyze/input_bundle.md +0 -54
  97. package/assets/init/.qfai/specs/spec-0001/delta.md +0 -30
  98. package/assets/init/.qfai/specs/spec-0001/scenario.feature +0 -11
  99. package/assets/init/.qfai/specs/spec-0001/spec.md +0 -40
@@ -0,0 +1,218 @@
1
+ <!--
2
+ QFAI Prompt Body (SSOT)
3
+ - This file is intended to be referenced by tool-specific custom prompt definitions (e.g., Copilot .prompt.md, Claude Code slash commands).
4
+ - Keep tool-specific wrappers thin: "Read this file and follow it."
5
+ -->
6
+
7
+ ---
8
+
9
+ id: qfai-pr
10
+ title: QFAI PR (Prepare PR Description)
11
+ description: "Generate a PR description that matches the project template and includes evidence."
12
+ argument-hint: "<title> [--auto]"
13
+ allowed-tools: [Read, Glob, Write, Task]
14
+ roles: [Planner, QAEngineer, DevOpsCIEngineer, CodeReviewer]
15
+ mode: doc-focused
16
+
17
+ ---
18
+
19
+ # /qfai-pr — Prepare PR Description
20
+
21
+ ## Purpose
22
+
23
+ Generate a PR description that helps reviewers approve quickly:
24
+
25
+ - What changed / why
26
+ - Impact and migration notes
27
+ - How to verify (commands + evidence)
28
+ - Risk areas to pay attention to
29
+
30
+ ## Success Criteria
31
+
32
+ - PR body matches the repository’s PR template (if any).
33
+ - Includes verification evidence from /qfai-verify.
34
+
35
+ ## Non‑Negotiable Principles (QFAI Articles)
36
+
37
+ These principles are inspired by “constitution / articles” patterns used by other agent frameworks, but tailored to QFAI.
38
+
39
+ 1. **SDD First (Specification is the source of truth)**
40
+ If there is a conflict between code and spec, treat the spec as authoritative and either (a) fix code or (b) raise an explicit Open Question to change the spec.
41
+
42
+ 2. **Traceability is mandatory**
43
+ Every meaningful change must be traceable: **Require → Spec → Scenario → Tests → Code → Verification evidence**.
44
+
45
+ 3. **Evidence over confidence**
46
+ Prefer observable proof (logs, commands, file diffs, test results). If you cannot verify, say so and record it.
47
+
48
+ 4. **Minimize scope, but never hide gaps**
49
+ Keep changes minimal, but do not “paper over” missing decisions. If something blocks correctness, stop and ask.
50
+
51
+ 5. **Quality gates are the decision mechanism**
52
+ Use tests/lint/typecheck/build/pack verification (whatever the repo defines) as the primary guardrail. Fix until PASS.
53
+
54
+ 6. **Make it runnable**
55
+ Outputs must be executable in terminal/CI. Provide copy‑paste commands.
56
+
57
+ 7. **User time is expensive**
58
+ Ask only the questions that are truly blocking. Everything else: make reasonable assumptions and label them clearly.
59
+
60
+ ## Absolute Rule — Output Language
61
+
62
+ **All outputs MUST be written in the user’s working language for this session.**
63
+
64
+ - If the user writes in Japanese, output Japanese.
65
+ - If the user writes in English, output English.
66
+ - If the user mixes languages, prefer the dominant language unless explicitly instructed otherwise.
67
+ This rule overrides all other stylistic preferences.
68
+
69
+ ## Multi‑Role Orchestration (Subagents)
70
+
71
+ This workflow assumes the environment _may_ support subagents (e.g., Claude Code “Task” tool) or may not.
72
+
73
+ ### If subagents are supported
74
+
75
+ Delegate to multiple roles and then merge the results. Use a “real‑world workflow” order:
76
+
77
+ - Facilitator → Interviewer → Requirements Analyst → Planner → Architect → (Contract Designer) → Test Engineer → QA Engineer → Code Reviewer → DevOps/CI Engineer
78
+
79
+ **Pseudo‑invocation pattern** (adjust to your tool):
80
+
81
+ ```text
82
+ Task(
83
+ subagent_type="planner",
84
+ description="Create an execution plan and DoD",
85
+ prompt="Context: ...\nGoal: ...\nConstraints: ...\nReturn: phases + risks + DoD"
86
+ )
87
+ ```
88
+
89
+ ### If subagents are NOT supported
90
+
91
+ Simulate roles by running the same sequence yourself:
92
+
93
+ - Write a short “role output” section per role, then consolidate into the final deliverable(s).
94
+
95
+ ## Behavior Rules (high leverage)
96
+
97
+ - **Language**: Output MUST follow the user’s working language for this session.
98
+ - **Question budget**: Ask at most **5** clarifying questions total. Prioritize blockers. If `--auto`, proceed with explicit assumptions.
99
+ - **No hallucination**: Do not invent file paths, commands, or policies. Confirm via repo inspection.
100
+ - **Evidence**: Do not claim completion without commands/results (format/lint/type/test/pack as applicable).
101
+ - **Subagent contract**: When delegating, require the subagent response structure:
102
+ 1. Findings 2) Recommendations 3) Proposed edits 4) Open Questions/Risks 5) Confidence
103
+
104
+ ## Step 0 — Load Context (always)
105
+
106
+ 1. Read relevant **project steering** (if present):
107
+ - `.qfai/assistant/steering/structure.md`
108
+ - `.qfai/assistant/steering/tech.md`
109
+ - `.qfai/assistant/steering/product.md`
110
+ - any additional files under `.qfai/assistant/steering/`
111
+
112
+ 2. Read **project constitution / instructions** (if present):
113
+ - `.qfai/assistant/instructions/constitution.md`
114
+ - `.qfai/assistant/instructions/workflow.md` (or equivalent)
115
+
116
+ 3. Read existing artifacts for the current work item (if present):
117
+ - `.qfai/require/`
118
+ - `.qfai/specs/spec-*/`
119
+ - `.qfai/contracts/`
120
+
121
+ 4. Inspect repo conventions:
122
+ - package manager (pnpm/npm/yarn), test runner, lint/typecheck scripts, CI definitions
123
+ - existing test patterns (unit/integration/e2e)
124
+
125
+ ## Step 0 — Project Analysis (mandatory)
126
+
127
+ Before producing any deliverable, **thoroughly analyze the current project** so your outputs fit the repo’s:
128
+
129
+ - background and goals
130
+ - directory structure and conventions
131
+ - chosen technologies and versions (runtime, package manager, test runner)
132
+ - architecture boundaries (packages, CLI, core modules)
133
+ - existing patterns for tests, docs, and CI
134
+
135
+ ### Minimum analysis checklist
136
+
137
+ - [ ] Read key repo docs: README / CHANGELOG / RELEASE (if present)
138
+ - [ ] Inspect `.qfai/` layout and existing SDD/ATDD/TDD artifacts (if present)
139
+ - [ ] Inspect `packages/qfai` structure (CLI entrypoints, core modules, validators, assets/init)
140
+ - [ ] Identify standard gate commands (format/lint/type/test/verify-pack) and where they are defined
141
+ - [ ] Search for existing examples/patterns of similar changes in tests (if available)
142
+ - [ ] Note constraints: Node versions, CI matrix, packaging rules, verify-pack expectations
143
+
144
+ If analysis cannot be performed (missing access), clearly state what could not be verified and proceed with minimal-risk assumptions.
145
+
146
+ ## Step 0.5 — Steering Bootstrap / Refresh (mandatory when incomplete)
147
+
148
+ QFAI expects `assistant/steering/` to contain **project‑specific facts** so all subsequent design/test/implementation fits this repository.
149
+
150
+ ### What to do
151
+
152
+ 1. Open these files:
153
+
154
+ - `.qfai/assistant/steering/product.md`
155
+ - `.qfai/assistant/steering/tech.md`
156
+ - `.qfai/assistant/steering/structure.md`
157
+
158
+ 2. If they are missing, mostly empty, or still have placeholders (e.g., `- ` only), **populate them by analyzing the current repository**:
159
+
160
+ - derive “what/why/users/success/non-goals” from README/docs/issues (product.md)
161
+ - derive runtime/tooling versions + constraints from package.json, CI config, lockfiles (tech.md)
162
+ - derive repo layout + key directories + gate commands from the file tree and scripts (structure.md)
163
+
164
+ 3. Do **not** invent facts. If something cannot be verified, write it as:
165
+
166
+ - `TBD` + what evidence is missing, or
167
+ - an Open Question (if it blocks correctness)
168
+
169
+ ### Steering refresh checklist
170
+
171
+ - [ ] product.md: what we build / users / success / non-goals / release posture
172
+ - [ ] tech.md: Node / package manager / TS / test / lint / CI constraints
173
+ - [ ] structure.md: repo layout, key packages, entrypoints, standard gate commands, how to run locally
174
+
175
+ ## Step 1 — Locate PR template
176
+
177
+ Search for:
178
+
179
+ - `PULL_REQUEST_TEMPLATE.md`
180
+ - `.github/PULL_REQUEST_TEMPLATE.md`
181
+ - repo-specific templates
182
+
183
+ If none exists, use the standard structure in Step 3.
184
+
185
+ ## Step 2 — Collect evidence
186
+
187
+ Read the latest verification evidence (from /qfai-verify output or logs).
188
+
189
+ ## Step 3 — Write PR body
190
+
191
+ Use this structure (adapt to template if present):
192
+
193
+ ### Summary
194
+
195
+ ### Motivation / Context
196
+
197
+ ### Changes
198
+
199
+ ### Impact / Migration
200
+
201
+ ### Verification
202
+
203
+ (copy‑paste commands + results)
204
+
205
+ ### Risks / Notes
206
+
207
+ ### Reviewer Focus
208
+
209
+ (what to review carefully)
210
+
211
+ ## Step 4 — Final review
212
+
213
+ - QA: acceptance coverage and risk notes
214
+ - Code Reviewer: clarity, missing information, misleading claims
215
+
216
+ ## Output
217
+
218
+ - Ready-to-paste PR title + body
@@ -0,0 +1,273 @@
1
+ <!--
2
+ QFAI Prompt Body (SSOT)
3
+ - This file is intended to be referenced by tool-specific custom prompt definitions (e.g., Copilot .prompt.md, Claude Code slash commands).
4
+ - Keep tool-specific wrappers thin: "Read this file and follow it."
5
+ -->
6
+
7
+ ---
8
+
9
+ id: qfai-require
10
+ title: QFAI Require (Create Requirements Artifact)
11
+ description: "Generate a concrete requirements artifact (EARS + NFR) as a project deliverable."
12
+ argument-hint: "<work-item-name> [--auto]"
13
+ allowed-tools: [Read, Glob, Write, TodoWrite, Task]
14
+ roles: [RequirementsAnalyst, Interviewer, QAEngineer, CodeReviewer, Planner]
15
+ mode: approval-gated
16
+
17
+ ---
18
+
19
+ # /qfai-require — Create Requirements Artifact
20
+
21
+ ## Purpose
22
+
23
+ Turn the Requirements Seed (from /qfai-discuss or user input) into a **versioned, reviewable requirements artifact** under `.qfai/require/`.
24
+
25
+ ## Success Criteria (Definition of Done)
26
+
27
+ - `.qfai/require/require.md` exists and is readable by a newcomer.
28
+ - Requirements are **testable** (EARS style) and include **NFR** (security/performance/etc).
29
+ - Blocking Open Questions are explicitly listed with requested answers.
30
+
31
+ ## Non‑Negotiable Principles (QFAI Articles)
32
+
33
+ These principles are inspired by “constitution / articles” patterns used by other agent frameworks, but tailored to QFAI.
34
+
35
+ 1. **SDD First (Specification is the source of truth)**
36
+ If there is a conflict between code and spec, treat the spec as authoritative and either (a) fix code or (b) raise an explicit Open Question to change the spec.
37
+
38
+ 2. **Traceability is mandatory**
39
+ Every meaningful change must be traceable: **Require → Spec → Scenario → Tests → Code → Verification evidence**.
40
+
41
+ 3. **Evidence over confidence**
42
+ Prefer observable proof (logs, commands, file diffs, test results). If you cannot verify, say so and record it.
43
+
44
+ 4. **Minimize scope, but never hide gaps**
45
+ Keep changes minimal, but do not “paper over” missing decisions. If something blocks correctness, stop and ask.
46
+
47
+ 5. **Quality gates are the decision mechanism**
48
+ Use tests/lint/typecheck/build/pack verification (whatever the repo defines) as the primary guardrail. Fix until PASS.
49
+
50
+ 6. **Make it runnable**
51
+ Outputs must be executable in terminal/CI. Provide copy‑paste commands.
52
+
53
+ 7. **User time is expensive**
54
+ Ask only the questions that are truly blocking. Everything else: make reasonable assumptions and label them clearly.
55
+
56
+ ## Absolute Rule — Output Language
57
+
58
+ **All outputs MUST be written in the user’s working language for this session.**
59
+
60
+ - If the user writes in Japanese, output Japanese.
61
+ - If the user writes in English, output English.
62
+ - If the user mixes languages, prefer the dominant language unless explicitly instructed otherwise.
63
+ This rule overrides all other stylistic preferences.
64
+
65
+ ## Multi‑Role Orchestration (Subagents)
66
+
67
+ This workflow assumes the environment _may_ support subagents (e.g., Claude Code “Task” tool) or may not.
68
+
69
+ ### If subagents are supported
70
+
71
+ Delegate to multiple roles and then merge the results. Use a “real‑world workflow” order:
72
+
73
+ - Facilitator → Interviewer → Requirements Analyst → Planner → Architect → (Contract Designer) → Test Engineer → QA Engineer → Code Reviewer → DevOps/CI Engineer
74
+
75
+ **Pseudo‑invocation pattern** (adjust to your tool):
76
+
77
+ ```text
78
+ Task(
79
+ subagent_type="planner",
80
+ description="Create an execution plan and DoD",
81
+ prompt="Context: ...\nGoal: ...\nConstraints: ...\nReturn: phases + risks + DoD"
82
+ )
83
+ ```
84
+
85
+ ### If subagents are NOT supported
86
+
87
+ Simulate roles by running the same sequence yourself:
88
+
89
+ - Write a short “role output” section per role, then consolidate into the final deliverable(s).
90
+
91
+ ## Behavior Rules (high leverage)
92
+
93
+ - **Language**: Output MUST follow the user’s working language for this session.
94
+ - **Question budget**: Ask at most **5** clarifying questions total. Prioritize blockers. If `--auto`, proceed with explicit assumptions.
95
+ - **No hallucination**: Do not invent file paths, commands, or policies. Confirm via repo inspection.
96
+ - **Evidence**: Do not claim completion without commands/results (format/lint/type/test/pack as applicable).
97
+ - **Subagent contract**: When delegating, require the subagent response structure:
98
+ 1. Findings 2) Recommendations 3) Proposed edits 4) Open Questions/Risks 5) Confidence
99
+
100
+ ## Step 0 — Load Context (always)
101
+
102
+ 1. Read relevant **project steering** (if present):
103
+ - `.qfai/assistant/steering/structure.md`
104
+ - `.qfai/assistant/steering/tech.md`
105
+ - `.qfai/assistant/steering/product.md`
106
+ - any additional files under `.qfai/assistant/steering/`
107
+
108
+ 2. Read **project constitution / instructions** (if present):
109
+ - `.qfai/assistant/instructions/constitution.md`
110
+ - `.qfai/assistant/instructions/workflow.md` (or equivalent)
111
+
112
+ 3. Read existing artifacts for the current work item (if present):
113
+ - `.qfai/require/`
114
+ - `.qfai/specs/spec-*/`
115
+ - `.qfai/contracts/`
116
+
117
+ 4. Inspect repo conventions:
118
+ - package manager (pnpm/npm/yarn), test runner, lint/typecheck scripts, CI definitions
119
+ - existing test patterns (unit/integration/e2e)
120
+
121
+ ## Step 0 — Project Analysis (mandatory)
122
+
123
+ Before producing any deliverable, **thoroughly analyze the current project** so your outputs fit the repo’s:
124
+
125
+ - background and goals
126
+ - directory structure and conventions
127
+ - chosen technologies and versions (runtime, package manager, test runner)
128
+ - architecture boundaries (packages, CLI, core modules)
129
+ - existing patterns for tests, docs, and CI
130
+
131
+ ### Minimum analysis checklist
132
+
133
+ - [ ] Read key repo docs: README / CHANGELOG / RELEASE (if present)
134
+ - [ ] Inspect `.qfai/` layout and existing SDD/ATDD/TDD artifacts (if present)
135
+ - [ ] Inspect `packages/qfai` structure (CLI entrypoints, core modules, validators, assets/init)
136
+ - [ ] Identify standard gate commands (format/lint/type/test/verify-pack) and where they are defined
137
+ - [ ] Search for existing examples/patterns of similar changes in tests (if available)
138
+ - [ ] Note constraints: Node versions, CI matrix, packaging rules, verify-pack expectations
139
+
140
+ If analysis cannot be performed (missing access), clearly state what could not be verified and proceed with minimal-risk assumptions.
141
+
142
+ ## Step 0.5 — Steering Bootstrap / Refresh (mandatory when incomplete)
143
+
144
+ QFAI expects `assistant/steering/` to contain **project‑specific facts** so all subsequent design/test/implementation fits this repository.
145
+
146
+ ### What to do
147
+
148
+ 1. Open these files:
149
+
150
+ - `.qfai/assistant/steering/product.md`
151
+ - `.qfai/assistant/steering/tech.md`
152
+ - `.qfai/assistant/steering/structure.md`
153
+
154
+ 2. If they are missing, mostly empty, or still have placeholders (e.g., `- ` only), **populate them by analyzing the current repository**:
155
+
156
+ - derive “what/why/users/success/non-goals” from README/docs/issues (product.md)
157
+ - derive runtime/tooling versions + constraints from package.json, CI config, lockfiles (tech.md)
158
+ - derive repo layout + key directories + gate commands from the file tree and scripts (structure.md)
159
+
160
+ 3. Do **not** invent facts. If something cannot be verified, write it as:
161
+
162
+ - `TBD` + what evidence is missing, or
163
+ - an Open Question (if it blocks correctness)
164
+
165
+ ### Steering refresh checklist
166
+
167
+ - [ ] product.md: what we build / users / success / non-goals / release posture
168
+ - [ ] tech.md: Node / package manager / TS / test / lint / CI constraints
169
+ - [ ] structure.md: repo layout, key packages, entrypoints, standard gate commands, how to run locally
170
+
171
+ ## Step 1 — Ensure repository location
172
+
173
+ Create (or update) these files:
174
+
175
+ - `.qfai/require/README.md` — what this folder is, how to use it
176
+ - `.qfai/require/require.md` — the requirements artifact (single-file SSOT)
177
+
178
+ ## Step 2 — Requirements format: EARS (Requirements Analyst)
179
+
180
+ Use EARS patterns (inspired by SDD frameworks):
181
+
182
+ - **Ubiquitous**: “The system shall …”
183
+ - **Event‑driven**: “When <event>, the system shall …”
184
+ - **State‑driven**: “While <state>, the system shall …”
185
+ - **Unwanted behavior**: “If <undesired>, the system shall …”
186
+ - **Optional feature**: “Where <feature>, the system shall …”
187
+
188
+ ### Requirement ID scheme
189
+
190
+ Use stable IDs:
191
+
192
+ - `REQ-FUNC-###` for functional requirements
193
+ - `REQ-NFR-SEC-###`, `REQ-NFR-PERF-###`, `REQ-NFR-REL-###` etc for non-functional
194
+
195
+ IDs must be unique and never reused.
196
+
197
+ ## Step 3 — Write `require.md` with this template
198
+
199
+ Use this exact structure:
200
+
201
+ # Requirements
202
+
203
+ ## 1. Overview
204
+
205
+ - Problem / opportunity
206
+ - Target users
207
+ - Success definition (business + technical)
208
+
209
+ ## 2. Scope
210
+
211
+ ### In scope
212
+
213
+ ### Out of scope
214
+
215
+ ## 3. Constraints & Assumptions
216
+
217
+ - Constraints
218
+ - Assumptions (explicit)
219
+
220
+ ## 4. Glossary (optional but recommended)
221
+
222
+ ## 5. Functional Requirements (EARS)
223
+
224
+ ### REQ-FUNC-001: <title>
225
+
226
+ - Statement (EARS)
227
+ - Rationale
228
+ - Acceptance criteria (testable)
229
+ - Notes / edge cases
230
+
231
+ (repeat)
232
+
233
+ ## 6. Non‑Functional Requirements
234
+
235
+ ### Security
236
+
237
+ ### Performance
238
+
239
+ ### Reliability / Availability
240
+
241
+ ### Observability
242
+
243
+ ### Compliance / Privacy (if relevant)
244
+
245
+ ## 7. Acceptance Criteria (summary)
246
+
247
+ A bullet list of what must be true to accept the change.
248
+
249
+ ## 8. Open Questions
250
+
251
+ ### Blocking
252
+
253
+ ### Non‑blocking
254
+
255
+ ## Step 4 — Review cycle (QA + Code Reviewer)
256
+
257
+ - QA Engineer checks testability and missing failure cases.
258
+ - Code Reviewer checks ambiguity, contradictions, and “non‑testable language”.
259
+
260
+ ## Step 5 — Approval gate
261
+
262
+ If interactive mode:
263
+
264
+ - Ask the user for approval: “Approve requirements? (yes/no)”
265
+ - If no: update and repeat.
266
+ If `--auto`:
267
+ - Proceed, but highlight assumptions and warn about rework risk.
268
+
269
+ ## Output
270
+
271
+ - Updated `.qfai/require/README.md`
272
+ - Updated `.qfai/require/require.md`
273
+ - A short “next command” suggestion (typically /qfai-spec)