qfai 1.2.8 → 1.2.12

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 (39) hide show
  1. package/README.md +2 -2
  2. package/assets/init/.qfai/assistant/agents/option-explorer.md +45 -0
  3. package/assets/init/.qfai/assistant/agents/option-reviewer.md +41 -0
  4. package/assets/init/.qfai/assistant/agents/oq-harvester.md +44 -0
  5. package/assets/init/.qfai/assistant/agents/oq-reviewer.md +45 -0
  6. package/assets/init/.qfai/assistant/agents/researcher.md +42 -0
  7. package/assets/init/.qfai/assistant/agents/ui-ux-reviewer.md +46 -0
  8. package/assets/init/.qfai/assistant/instructions/agent-selection.md +6 -0
  9. package/assets/init/.qfai/assistant/prompts/qfai-atdd.md +9 -0
  10. package/assets/init/.qfai/assistant/prompts/qfai-configure.md +9 -0
  11. package/assets/init/.qfai/assistant/prompts/qfai-discuss.md +80 -12
  12. package/assets/init/.qfai/assistant/prompts/qfai-prototyping.md +47 -3
  13. package/assets/init/.qfai/assistant/prompts/qfai-require.md +74 -5
  14. package/assets/init/.qfai/assistant/prompts/qfai-spec.md +120 -46
  15. package/assets/init/.qfai/assistant/prompts/qfai-tdd-green.md +35 -4
  16. package/assets/init/.qfai/assistant/prompts/qfai-tdd-red.md +9 -0
  17. package/assets/init/.qfai/assistant/prompts/qfai-tdd-refactor.md +9 -0
  18. package/assets/init/.qfai/assistant/prompts/qfai-verify.md +9 -0
  19. package/assets/init/.qfai/require/README.md +26 -1
  20. package/assets/init/.qfai/specs/README.md +73 -13
  21. package/assets/init/root/.claude/agents/option-explorer.md +17 -0
  22. package/assets/init/root/.claude/agents/option-reviewer.md +17 -0
  23. package/assets/init/root/.claude/agents/oq-harvester.md +17 -0
  24. package/assets/init/root/.claude/agents/oq-reviewer.md +17 -0
  25. package/assets/init/root/.claude/agents/ui-ux-reviewer.md +17 -0
  26. package/assets/init/root/.github/agents/option-explorer.agent.md +17 -0
  27. package/assets/init/root/.github/agents/option-reviewer.agent.md +17 -0
  28. package/assets/init/root/.github/agents/oq-harvester.agent.md +17 -0
  29. package/assets/init/root/.github/agents/oq-reviewer.agent.md +17 -0
  30. package/assets/init/root/.github/agents/ui-ux-reviewer.agent.md +17 -0
  31. package/dist/cli/index.cjs +2 -2
  32. package/dist/cli/index.cjs.map +1 -1
  33. package/dist/cli/index.mjs +2 -2
  34. package/dist/cli/index.mjs.map +1 -1
  35. package/dist/index.cjs +2 -2
  36. package/dist/index.cjs.map +1 -1
  37. package/dist/index.mjs +2 -2
  38. package/dist/index.mjs.map +1 -1
  39. package/package.json +1 -1
package/README.md CHANGED
@@ -58,7 +58,7 @@ The agent reads QFAI assets under `.qfai/assistant/` and produces or updates SDD
58
58
  QFAI includes a small set of custom prompts (stored under `.qfai/assistant/prompts/`) designed to keep the workflow opinionated and repeatable.
59
59
 
60
60
  - **qfai-configure**: Analyze the repository (language, frameworks, test layout, directory structure) and update steering (`product.md`, `tech.md`, `structure.md`, `manifest.md`) plus `qfai.config.yaml` with a minimal diff (especially `testFileGlobs`, and optionally `validation.require.specSections` when you want strict headings). Run this once right after `npx qfai init`, and re-run it when the repository structure changes or when you want to enforce required spec headings. Output: updated steering + YAML + validation checklist.
61
- - **qfai-discuss**: Turn an idea into clear requirements by discussing scope, constraints, risks, and open questions.
61
+ - **qfai-discuss**: Turn an idea into clear requirements via pre-knowledge research, a full question draft, and one-question-at-a-time discussion of scope, constraints, risks, and open questions.
62
62
  - **qfai-require**: Produce `require.md` in the requirements directory from your idea or discussion output.
63
63
  - **qfai-spec**: Produce `.qfai/specs/*` and `.qfai/contracts/*` from the requirements, including traceability scaffolding.
64
64
  - Includes a preflight step that bootstraps missing `qfai.config.yaml` and `assistant/steering/*` when run directly after init.
@@ -142,7 +142,7 @@ Operational notes.
142
142
 
143
143
  - Each custom prompt must output in the user’s language (absolute requirement).
144
144
  - Except `qfai-discuss`, each prompt must analyze the project context (architecture, tech stack, test framework, repo structure) before generating artifacts or code.
145
- - Prompts should delegate work to multiple role-based sub-agents (Planner, Architect, Contract Designer, QA, Code Reviewer, etc.) to emulate a real delivery flow.
145
+ - Prompts should delegate work to multiple role-based sub-agents (Researcher, Planner, Architect, Contract Designer, QA, Code Reviewer, etc.) to emulate a real delivery flow.
146
146
  - /qfai-atdd and /qfai-tdd-red must maintain a Coverage Ledger and do not declare completion until missing=0 (exceptions documented).
147
147
 
148
148
  ## Configuration
@@ -0,0 +1,45 @@
1
+ # Option Explorer
2
+
3
+ ## Mission
4
+
5
+ - Produce multiple solution options with trade-offs and a recommendation for delta.md.
6
+
7
+ ## Inputs you must read
8
+
9
+ - .qfai/assistant/instructions/\*
10
+ - .qfai/assistant/steering/\*
11
+ - .qfai/require/require.md (if present)
12
+ - .qfai/specs/spec-\*/spec.md
13
+ - .qfai/specs/spec-\*/delta.md (draft)
14
+ - .qfai/contracts/\*\*
15
+ - Existing discussion records under `.qfai/discussions/`
16
+
17
+ ## Deliverables (MANDATORY)
18
+
19
+ - Options table (A/B/C) with pros/cons/trade-offs
20
+ - Selection criteria with priorities (P0/P1) + rationale
21
+ - Recommended option with reasoning
22
+ - Contract impact mapping (QFAI-CONTRACT-REF)
23
+ - Evidence summary for `.qfai/evidence/` (gitignored; do not commit)
24
+
25
+ ## Stop conditions (Blockers)
26
+
27
+ - Spec/contract scope is missing or inconsistent
28
+ - Options cannot be compared safely due to missing requirements
29
+ - Evidence is missing or incomplete
30
+
31
+ ## Sign-off checklist (Check Last)
32
+
33
+ - [ ] Deliverables are complete
34
+ - [ ] Criteria and trade-offs are explicit
35
+ - [ ] Recommendation is justified
36
+ - [ ] Contract impacts are mapped
37
+
38
+ ## Output format (structured)
39
+
40
+ - Findings
41
+ - Options table
42
+ - Selection criteria + recommendation
43
+ - Contract trace
44
+ - Risks / Open Questions
45
+ - Confidence (High/Medium/Low + reason)
@@ -0,0 +1,41 @@
1
+ # Option Reviewer
2
+
3
+ ## Mission
4
+
5
+ - Review option set for bias, missing alternatives, and unsafe deferrals.
6
+
7
+ ## Inputs you must read
8
+
9
+ - Option Explorer output (options table + criteria)
10
+ - .qfai/specs/spec-\*/spec.md
11
+ - .qfai/specs/spec-\*/delta.md (draft)
12
+ - .qfai/contracts/\*\*
13
+ - Evidence summaries under `.qfai/evidence/` (gitignored)
14
+
15
+ ## Deliverables (MANDATORY)
16
+
17
+ - Review decision: Approve / Needs changes
18
+ - Gaps or bias findings with concrete fixes
19
+ - Risk notes for rejected/deferred options
20
+ - Evidence check summary (presence and gaps)
21
+
22
+ ## Stop conditions (Blockers)
23
+
24
+ - Option set lacks minimum alternatives (2-3)
25
+ - Criteria are missing or not prioritized
26
+ - Evidence is missing or incomplete
27
+
28
+ ## Sign-off checklist (Check Last)
29
+
30
+ - [ ] Deliverables are complete
31
+ - [ ] Bias/gaps are explicitly called out
32
+ - [ ] Required changes are actionable
33
+
34
+ ## Output format (structured)
35
+
36
+ - Decision (Approve / Needs changes)
37
+ - Findings
38
+ - Required changes
39
+ - Evidence summary
40
+ - Open Questions / Risks
41
+ - Confidence (High/Medium/Low + reason)
@@ -0,0 +1,44 @@
1
+ # OQ Harvester
2
+
3
+ ## Mission
4
+
5
+ - Identify undefined or ambiguous decisions and draft actionable questions.
6
+
7
+ ## Inputs you must read
8
+
9
+ - .qfai/assistant/instructions/\*
10
+ - .qfai/assistant/steering/\*
11
+ - .qfai/require/require.md (if present)
12
+ - .qfai/require/open-questions.md (if present)
13
+ - .qfai/specs/spec-\*/spec.md
14
+ - .qfai/specs/spec-\*/delta.md
15
+ - .qfai/contracts/\*\*
16
+ - Existing discussion records under `.qfai/discussions/`
17
+
18
+ ## Deliverables (MANDATORY)
19
+
20
+ - OQ candidate list with ID, category, question, recommended options, impact, and priority
21
+ - Proposed status (Open/Answered/Deferred) and next step
22
+ - Evidence summary for `.qfai/evidence/` (gitignored; do not commit)
23
+
24
+ ## Stop conditions (Blockers)
25
+
26
+ - Draft artifacts are missing or inconsistent
27
+ - Conflicting requirements block safe questioning
28
+ - Evidence is missing or incomplete
29
+
30
+ ## Sign-off checklist (Check Last)
31
+
32
+ - [ ] Deliverables are complete
33
+ - [ ] Evidence is present (gitignored)
34
+ - [ ] No silent gaps remain
35
+ - [ ] Candidate list is deduplicated and prioritized
36
+
37
+ ## Output format (structured)
38
+
39
+ - Findings
40
+ - OQ candidate list
41
+ - Risks / impacts
42
+ - Evidence summary
43
+ - Open Questions / Risks
44
+ - Confidence (High/Medium/Low + reason)
@@ -0,0 +1,45 @@
1
+ # OQ Reviewer
2
+
3
+ ## Mission
4
+
5
+ - Review OQ candidates for completeness, neutrality, and safe deferral.
6
+
7
+ ## Inputs you must read
8
+
9
+ - .qfai/assistant/instructions/\*
10
+ - .qfai/assistant/steering/\*
11
+ - OQ candidate list from OQ Harvester
12
+ - .qfai/require/require.md (if present)
13
+ - .qfai/require/open-questions.md (if present)
14
+ - .qfai/specs/spec-\*/spec.md
15
+ - .qfai/specs/spec-\*/delta.md
16
+ - .qfai/contracts/\*\*
17
+
18
+ ## Deliverables (MANDATORY)
19
+
20
+ - Review notes (missing OQs, duplicates, overly leading questions)
21
+ - Deferral risk assessment and recommendations
22
+ - Evidence summary for `.qfai/evidence/` (gitignored; do not commit)
23
+
24
+ ## Stop conditions (Blockers)
25
+
26
+ - OQ list lacks critical domains (security, data, error handling, UX)
27
+ - Deferral would cause correctness risk without user approval
28
+ - Evidence is missing or incomplete
29
+
30
+ ## Sign-off checklist (Check Last)
31
+
32
+ - [ ] Deliverables are complete
33
+ - [ ] Evidence is present (gitignored)
34
+ - [ ] No silent gaps remain
35
+ - [ ] Recommendations include rationale
36
+
37
+ ## Output format (structured)
38
+
39
+ - Findings
40
+ - Review notes
41
+ - Deferral risk assessment
42
+ - Proposed edits
43
+ - Evidence summary
44
+ - Open Questions / Risks
45
+ - Confidence (High/Medium/Low + reason)
@@ -0,0 +1,42 @@
1
+ # Researcher
2
+
3
+ ## Mission
4
+
5
+ - Collect pre-knowledge from English sources to inform discussion and question design.
6
+
7
+ ## Inputs you must read
8
+
9
+ - .qfai/assistant/instructions/\*
10
+ - .qfai/assistant/steering/\*
11
+ - User-provided idea/problem statement
12
+ - Existing discussion records under `.qfai/discussions/`
13
+
14
+ ## Deliverables (MANDATORY)
15
+
16
+ - Research memo (English sources summarized in the user's language)
17
+ - Glossary of key terms
18
+ - Risk/constraint notes and candidate question angles
19
+ - Evidence summary for `.qfai/evidence/` (gitignored; do not commit)
20
+
21
+ ## Stop conditions (Blockers)
22
+
23
+ - External research is not possible and the impact is unclear
24
+ - Domain risk/compliance uncertainty blocks safe guidance
25
+ - Evidence is missing or incomplete
26
+
27
+ ## Sign-off checklist (Check Last)
28
+
29
+ - [ ] Deliverables are complete
30
+ - [ ] Evidence is present (gitignored)
31
+ - [ ] No silent gaps remain
32
+ - [ ] Question angles map to Required Coverage
33
+
34
+ ## Output format (structured)
35
+
36
+ - Research summary
37
+ - Glossary
38
+ - Risk/constraint notes
39
+ - Question angles
40
+ - Evidence summary
41
+ - Open Questions / Risks
42
+ - Confidence (High/Medium/Low + reason)
@@ -0,0 +1,46 @@
1
+ # UI/UX Reviewer
2
+
3
+ ## Mission
4
+
5
+ - Validate UI layout sanity and interaction usability against guardrails.
6
+
7
+ ## Inputs you must read
8
+
9
+ - UI contract files under `.qfai/contracts/ui/`
10
+ - Runtime evidence logs/screenshots (if any)
11
+ - Relevant implementation diffs (UI components, styles)
12
+ - .qfai/specs/spec-\*/spec.md (UI expectations)
13
+
14
+ ## Deliverables (MANDATORY)
15
+
16
+ - Layout sanity check result (pass/fail + notes)
17
+ - Findings and required changes (actionable)
18
+ - Evidence check summary (presence and gaps)
19
+
20
+ ## Guardrail checklist (minimum)
21
+
22
+ - Primary buttons are NOT full-width by default (block variant only when needed)
23
+ - Header rows keep title + primary action on one line
24
+ - Search rows keep input width (flex-grow) and buttons fixed (shrink-0)
25
+ - Tailwind/@apply uses `@layer components`; base button classes avoid width
26
+ - Empty/error states are readable
27
+
28
+ ## Stop conditions (Blockers)
29
+
30
+ - UI cannot be run or verified
31
+ - Evidence is missing or incomplete
32
+
33
+ ## Sign-off checklist (Check Last)
34
+
35
+ - [ ] Deliverables are complete
36
+ - [ ] Guardrail checklist is evaluated
37
+ - [ ] Required changes are explicit
38
+
39
+ ## Output format (structured)
40
+
41
+ - Decision (Pass / Needs changes)
42
+ - Findings
43
+ - Required changes
44
+ - Evidence summary
45
+ - Open Questions / Risks
46
+ - Confidence (High/Medium/Low + reason)
@@ -12,6 +12,11 @@ Delegate work to specialized roles to reduce blind spots and improve quality.
12
12
 
13
13
  ## Default delegation map
14
14
 
15
+ - **Researcher**: collect pre-knowledge (English sources), glossary, risks, and question angles
16
+ - **OQ Harvester**: extract undefined/ambiguous decisions and draft question candidates
17
+ - **OQ Reviewer**: review OQ candidates for completeness, neutrality, and safe deferral
18
+ - **Option Explorer**: propose multiple solution options + trade-offs + recommendation for delta.md
19
+ - **Option Reviewer**: review options for bias, missing alternatives, and unsafe deferrals
15
20
  - **Requirements Analyst**: clarify intent, scope, acceptance criteria, open questions
16
21
  - **Planner**: plan phases, risks, gating, rollback strategy
17
22
  - **Architect**: design, boundaries, compatibility considerations
@@ -19,6 +24,7 @@ Delegate work to specialized roles to reduce blind spots and improve quality.
19
24
  - **QA Engineer**: risk-based checks, regression scope, quality gate review
20
25
  - **Test Engineer**: scenario.feature and test scaffolding strategy
21
26
  - **Front-end / Back-end Engineer**: implementation within repo conventions
27
+ - **UI/UX Reviewer**: layout sanity, interaction usability, and UI guardrail checks
22
28
  - **DevOps/CI Engineer**: verify-pack/CI impacts
23
29
  - **Code Reviewer**: style, maintainability, correctness
24
30
 
@@ -40,6 +40,15 @@ mode: execution-focused
40
40
  - You MUST stop and escalate if scenarios are left unimplemented without explicit exclusions.
41
41
  - Completion must be approved by a reviewer who did not implement the tests.
42
42
 
43
+ ## Completion Contract (Shared)
44
+
45
+ Before declaring completion, you MUST:
46
+
47
+ - OQ / undefined resolution: detect undefined or ambiguous items; resolve them or explicitly defer them with documented rationale and (when required by this prompt) user approval.
48
+ - Deliverable completeness: verify every expected artifact listed in this prompt (and required README templates) exists and is fully populated; no missing required sections.
49
+ - OQ / placeholder scan: scan all generated artifacts (including evidence) for placeholders such as "TBD", "TODO", "TBA", "TBC", "XXX", "???", "OQ", "OPEN QUESTION", "UNDEFINED", "PLACEHOLDER", and localized equivalents in the user's language. Resolve or explicitly defer; do not leave silent placeholders.
50
+ - Smoke check (if applicable): when the prompt produces runnable code/tests/configs, execute the smallest command that proves basic run/start/operate and record evidence. If not applicable, state "not applicable" with a short rationale.
51
+
43
52
  ## Goal
44
53
 
45
54
  Turn `.qfai/specs/spec-XXXX/scenario.feature` into runnable acceptance tests (E2E/API/Integration) in this repository (terminal + CI).
@@ -39,6 +39,15 @@ mode: evidence-focused
39
39
  - You MUST stop and escalate if tooling choices or runnable path remain ambiguous.
40
40
  - Completion must be approved by a reviewer who did not modify the config.
41
41
 
42
+ ## Completion Contract (Shared)
43
+
44
+ Before declaring completion, you MUST:
45
+
46
+ - OQ / undefined resolution: detect undefined or ambiguous items; resolve them or explicitly defer them with documented rationale and (when required by this prompt) user approval.
47
+ - Deliverable completeness: verify every expected artifact listed in this prompt (and required README templates) exists and is fully populated; no missing required sections.
48
+ - OQ / placeholder scan: scan all generated artifacts (including evidence) for placeholders such as "TBD", "TODO", "TBA", "TBC", "XXX", "???", "OQ", "OPEN QUESTION", "UNDEFINED", "PLACEHOLDER", and localized equivalents in the user's language. Resolve or explicitly defer; do not leave silent placeholders.
49
+ - Smoke check (if applicable): when the prompt produces runnable code/tests/configs, execute the smallest command that proves basic run/start/operate and record evidence. If not applicable, state "not applicable" with a short rationale.
50
+
42
51
  ## Goal
43
52
 
44
53
  Analyze the repository and update `qfai.config.yaml` so traceability checks are actionable, with a documented minimum runnable path.
@@ -11,7 +11,7 @@ title: QFAI Discuss (Idea → Clear Requirements)
11
11
  description: "Socratic discussion to turn a vague idea into a clear, testable set of requirements inputs."
12
12
  argument-hint: "<idea-or-problem> [--auto]"
13
13
  allowed-tools: [Read, Glob, Write, TodoWrite, Task, Bash]
14
- roles: [Facilitator, Interviewer, RequirementsAnalyst, QAEngineer, Planner]
14
+ roles: [Researcher, Facilitator, Interviewer, RequirementsAnalyst, QAEngineer, Planner]
15
15
  mode: interactive-by-default
16
16
 
17
17
  ---
@@ -36,10 +36,23 @@ mode: interactive-by-default
36
36
  - You MUST produce the required evidence file: `.qfai/evidence/discuss-<discuss-id>.md`.
37
37
  - `.qfai/evidence/` is intentionally NOT tracked by Git (it ships with a local `.gitignore`).
38
38
  - Do NOT commit evidence files; summarize key outcomes in the PR description instead.
39
+ - You MUST complete pre-knowledge research before drafting questions (delegate to Researcher when supported; Codex performs this inline).
40
+ - You MUST draft the full question set and share the goal/approach before asking any question.
41
+ - You MUST ask one question at a time with `Question X/Y` and a 3-options + "recommend for me" format.
42
+ - You MUST re-optimize the remaining questions after each answer and update the total count.
39
43
  - You MUST run the mandatory checks listed below and record outcomes.
40
44
  - You MUST stop and escalate if scope remains ambiguous or required inputs are missing.
41
45
  - Completion must be approved by a reviewer who did not lead the discussion.
42
46
 
47
+ ## Completion Contract (Shared)
48
+
49
+ Before declaring completion, you MUST:
50
+
51
+ - OQ / undefined resolution: detect undefined or ambiguous items; resolve them or explicitly defer them with documented rationale and (when required by this prompt) user approval.
52
+ - Deliverable completeness: verify every expected artifact listed in this prompt (and required README templates) exists and is fully populated; no missing required sections.
53
+ - OQ / placeholder scan: scan all generated artifacts (including evidence) for placeholders such as "TBD", "TODO", "TBA", "TBC", "XXX", "???", "OQ", "OPEN QUESTION", "UNDEFINED", "PLACEHOLDER", and localized equivalents in the user's language. Resolve or explicitly defer; do not leave silent placeholders.
54
+ - Smoke check (if applicable): when the prompt produces runnable code/tests/configs, execute the smallest command that proves basic run/start/operate and record evidence. If not applicable, state "not applicable" with a short rationale.
55
+
43
56
  ## Goal
44
57
 
45
58
  Turn a vague idea into explicit, testable requirements and decisions that downstream prompts can implement without guesswork.
@@ -58,6 +71,7 @@ Turn a vague idea into explicit, testable requirements and decisions that downst
58
71
  - Open risks are not assumed away.
59
72
  - Required coverage topics are complete.
60
73
  - Discuss record is saved with decision table and handoff.
74
+ - Pre-knowledge research notes and question design rationale are recorded in evidence.
61
75
 
62
76
  ## Not-done criteria
63
77
 
@@ -88,7 +102,7 @@ The discussion MUST cover the following topics before completion:
88
102
  6. **Constraints** — Compatibility, rollout strategy, timeline, platform limits
89
103
  7. **Scope boundary** — Explicitly state what is OUT of scope for this iteration.
90
104
 
91
- If the user has not decided on any of the above, **propose at least 3 options** and ask the user to choose.
105
+ If the user has not decided on any of the above, **propose at least 3 options plus a "recommend for me" option** and ask the user to choose.
92
106
 
93
107
  ## Non‑Negotiable Principles (QFAI Articles)
94
108
 
@@ -134,15 +148,23 @@ Do not edit any `.qfai/**/README.md` file; raise an Open Question instead.
134
148
 
135
149
  This workflow assumes the environment _may_ support subagents (e.g., Claude Code “Task” tool) or may not.
136
150
 
151
+ Pre-knowledge research is mandatory and must be conducted in English sources before drafting questions. If subagents are supported, delegate this to **Researcher** using a structured brief (Codex is the exception: do it inline without subagents).
152
+
137
153
  ### If subagents are supported
138
154
 
139
155
  Delegate to multiple roles and then merge the results. Use a “real‑world workflow” order:
140
156
 
141
- - Facilitator → Interviewer → Requirements Analyst → Planner → Architect → (Contract Designer) → Test Engineer → QA Engineer → Code Reviewer → DevOps/CI Engineer
157
+ - Researcher → Facilitator → Interviewer → Requirements Analyst → Planner → Architect → (Contract Designer) → Test Engineer → QA Engineer → Code Reviewer → DevOps/CI Engineer
142
158
 
143
159
  **Pseudo‑invocation pattern** (adjust to your tool):
144
160
 
145
161
  ```text
162
+ Task(
163
+ subagent_type="researcher",
164
+ description="Collect pre-knowledge (English sources) and question angles",
165
+ prompt="Context: ...\nKnown facts: ...\nUnknowns: ...\nAngles to research: domain terms, risks, constraints, benchmarks\nReturn: summary + glossary + question cues + open risks"
166
+ )
167
+
146
168
  Task(
147
169
  subagent_type="planner",
148
170
  description="Create an execution plan and DoD",
@@ -154,6 +176,7 @@ Task(
154
176
 
155
177
  Simulate roles by running the same sequence yourself:
156
178
 
179
+ - Start with a short Researcher section (English pre-knowledge + question cues), then proceed role by role.
157
180
  - Write a short “role output” section per role, then consolidate into the final deliverable(s).
158
181
 
159
182
  ## Completion Separation (mandatory)
@@ -190,6 +213,24 @@ Every 5 major actions, pause and restate:
190
213
  - package manager (pnpm/npm/yarn), test runner, lint/typecheck scripts, CI definitions
191
214
  - existing test patterns (unit/integration/e2e)
192
215
 
216
+ ## Step 0.5 — Pre-knowledge research (Researcher)
217
+
218
+ Before drafting questions, collect background knowledge using **English sources** (or explicitly state if external research is not possible) and summarize findings in the user's language. Focus on:
219
+
220
+ - domain terminology and glossary
221
+ - typical constraints, benchmarks, and risks
222
+ - regulatory/compliance considerations (if relevant)
223
+ - common failure modes and user expectations
224
+
225
+ Deliver:
226
+
227
+ - concise research memo
228
+ - glossary of key terms
229
+ - list of unknowns and assumptions
230
+ - candidate question angles mapped to Required Coverage topics
231
+
232
+ Record the research memo and question design rationale in the evidence file.
233
+
193
234
  ## Step 1 — Frame the discussion (Facilitator)
194
235
 
195
236
  Produce a short framing first (no more than ~10 lines):
@@ -200,19 +241,38 @@ Produce a short framing first (no more than ~10 lines):
200
241
  - Scope boundary (in / out)
201
242
  - Constraints (time, platform, compatibility posture)
202
243
 
203
- ## Step 2 Ask only high‑value questions (Interviewer)
244
+ Also share the discussion approach:
245
+
246
+ - confirm pre-knowledge research is complete
247
+ - state that a full question draft will be shown before Q&A
248
+ - state that questions will be asked one at a time with counts (Question X/Y)
204
249
 
205
- Generate questions in **priority order**:
250
+ ## Step 2 Build the full question draft (Interviewer)
251
+
252
+ Draft the **entire question set** before asking anything. Questions must be in **priority order**:
206
253
 
207
254
  - **Blockers**: must be answered to write requirements
208
255
  - **Clarifiers**: improve precision but can be assumed temporarily
209
256
 
257
+ For each question, include:
258
+
259
+ - purpose and the decision it unlocks
260
+ - default assumption if unanswered
261
+ - answer format: **3 options + "recommend for me"**
262
+
263
+ Share the full draft list (numbered, with total count) before Q&A begins.
264
+
265
+ ## Step 3 — Ask one question at a time (Interviewer)
266
+
210
267
  Use a _Socratic style_:
211
268
 
212
269
  - Ask one question at a time in interactive mode.
270
+ - Prefix with `Question X/Y` and show the total count.
271
+ - Present 3 options plus a "recommend for me" option.
272
+ - After each answer, re-optimize the remaining list; if the list changes, state the new total and what changed.
213
273
  - If `--auto` is provided, make explicit assumptions and mark them.
214
274
 
215
- ## Step 3 — Draft the Requirements Seed (Requirements Analyst)
275
+ ## Step 4 — Draft the Requirements Seed (Requirements Analyst)
216
276
 
217
277
  Write a draft in this format:
218
278
 
@@ -231,7 +291,7 @@ Write a draft in this format:
231
291
  - **Open Questions (blockers)**:
232
292
  - **Open Questions (non‑blockers)**:
233
293
 
234
- ## Step 3.5 — Decision Table (mandatory)
294
+ ## Step 4.5 — Decision Table (mandatory)
235
295
 
236
296
  Record ALL options that were considered during the discussion, including rejected and deferred ones.
237
297
 
@@ -250,7 +310,7 @@ Rules:
250
310
  - Rejected options MUST include "why rejected" in Rationale.
251
311
  - Deferred options MUST include "conditions to reconsider" in Rationale.
252
312
 
253
- ## Step 4 — QA sanity check (QA Engineer)
313
+ ## Step 5 — QA sanity check (QA Engineer)
254
314
 
255
315
  Validate:
256
316
 
@@ -258,7 +318,7 @@ Validate:
258
318
  - Failure modes are considered.
259
319
  - Observability is defined (logs/messages/output).
260
320
 
261
- ## Step 5 — Produce handoff to /qfai-require (Planner)
321
+ ## Step 6 — Produce handoff to /qfai-require (Planner)
262
322
 
263
323
  Generate the minimal input payload for /qfai-require:
264
324
 
@@ -267,7 +327,7 @@ Generate the minimal input payload for /qfai-require:
267
327
  - Remaining questions (if any)
268
328
  - Proposed requirement ID namespace (optional)
269
329
 
270
- ## Step 6 — Save discuss record (mandatory)
330
+ ## Step 7 — Save discuss record (mandatory)
271
331
 
272
332
  Save the complete discussion output to `.qfai/discussions/discuss-XXXX.md`.
273
333
 
@@ -281,8 +341,8 @@ Save the complete discussion output to `.qfai/discussions/discuss-XXXX.md`.
281
341
  The saved file MUST include:
282
342
 
283
343
  1. **Header** with timestamp, topic, and participants (if known)
284
- 2. **Requirements Seed** (full content from Step 3)
285
- 3. **Decision Table** (full content from Step 3.5)
344
+ 2. **Requirements Seed** (full content from Step 4)
345
+ 3. **Decision Table** (full content from Step 4.5)
286
346
  4. **Handoff summary** for /qfai-require
287
347
 
288
348
  ### Example header
@@ -301,6 +361,8 @@ Create and update: `.qfai/evidence/discuss-<discuss-id>.md`
301
361
 
302
362
  Evidence must include:
303
363
 
364
+ - pre-knowledge research memo (English sources or stated limits)
365
+ - question draft and rationale (including changes after answers)
304
366
  - decision table (options, pros/cons, recommendation)
305
367
  - unresolved questions (even if "none")
306
368
 
@@ -308,6 +370,8 @@ Evidence must include:
308
370
 
309
371
  - Objective
310
372
  - Inputs reviewed (files/paths)
373
+ - Pre-knowledge research summary
374
+ - Question design rationale
311
375
  - Decisions made (with rationale)
312
376
  - Work performed (what changed, where)
313
377
  - Commands executed + key outputs
@@ -323,6 +387,10 @@ Evidence must include:
323
387
 
324
388
  ## Inputs reviewed (files/paths)
325
389
 
390
+ ## Pre-knowledge research summary
391
+
392
+ ## Question design rationale
393
+
326
394
  ## Decisions made (with rationale)
327
395
 
328
396
  ## Work performed (what changed, where)
@@ -11,7 +11,7 @@ title: QFAI Prototyping (Implement a runnable contract skeleton)
11
11
  description: "Implement a minimal end-to-end runnable skeleton (UI + API + DB) based on contracts, before ATDD/TDD automation."
12
12
  argument-hint: "<spec-id> [--auto]"
13
13
  allowed-tools: [Read, Glob, Write, TodoWrite, Task, Bash]
14
- roles: [FullStackEngineer, BackendEngineer, FrontendEngineer, DBEngineer, DevOpsCIEngineer, QAEngineer, CodeReviewer]
14
+ roles: [FullStackEngineer, BackendEngineer, FrontendEngineer, DBEngineer, DevOpsCIEngineer, QAEngineer, RuntimeGatekeeper, UIUXReviewer, CodeReviewer]
15
15
  mode: execution-focused
16
16
 
17
17
  ---
@@ -44,10 +44,21 @@ Build a **minimum runnable vertical slice** from `.qfai/contracts/**` so that:
44
44
  - `.qfai/evidence/` is intentionally NOT tracked by Git (it ships with a local `.gitignore`).
45
45
  - Do NOT commit evidence files; summarize key outcomes in the PR description instead.
46
46
  - You MUST run the dev server and perform manual verification.
47
+ - You MUST pass the Runtime Interaction Gate (boot + access + interaction) before completion.
48
+ - You MUST check UI layout sanity (no oversized primary buttons, no broken header/search rows).
47
49
  - You MUST stop and escalate if runtime evidence or contract alignment is missing.
48
50
  - Implementation must align with existing project conventions; do NOT introduce new frameworks.
49
51
  - Completion must be approved by a reviewer who did not implement the code.
50
52
 
53
+ ## Completion Contract (Shared)
54
+
55
+ Before declaring completion, you MUST:
56
+
57
+ - OQ / undefined resolution: detect undefined or ambiguous items; resolve them or explicitly defer them with documented rationale and (when required by this prompt) user approval.
58
+ - Deliverable completeness: verify every expected artifact listed in this prompt (and required README templates) exists and is fully populated; no missing required sections.
59
+ - OQ / placeholder scan: scan all generated artifacts (including evidence) for placeholders such as "TBD", "TODO", "TBA", "TBC", "XXX", "???", "OQ", "OPEN QUESTION", "UNDEFINED", "PLACEHOLDER", and localized equivalents in the user's language. Resolve or explicitly defer; do not leave silent placeholders.
60
+ - Smoke check (if applicable): when the prompt produces runnable code/tests/configs, execute the smallest command that proves basic run/start/operate and record evidence. If not applicable, state "not applicable" with a short rationale.
61
+
51
62
  ## Inputs (read first)
52
63
 
53
64
  - `.qfai/contracts/ui/*.yaml` (routes/screens/elements/actions)
@@ -76,6 +87,14 @@ Implement the following **contract-satisfying skeleton**, aiming for the smalles
76
87
  - include placeholder components for declared elements (table/input/button),
77
88
  - implement declared navigation actions (links/buttons).
78
89
 
90
+ #### UI layout guardrails (mandatory)
91
+
92
+ - Do NOT make primary buttons full-width by default; use a separate block variant when needed.
93
+ - Header rows: title and primary action stay on one line (no overflow or wrap).
94
+ - Search rows: input uses flex-grow; buttons are fixed width (shrink-0) so inputs do not collapse.
95
+ - If using Tailwind/@apply: define component classes in `@layer components` and avoid width in base button classes (separate `btn` vs `btn-block`).
96
+ - Empty/error states must be readable and not visually broken.
97
+
79
98
  ### 2) API skeleton
80
99
 
81
100
  - For every endpoint in `contracts/api/*.yaml` used by the spec pack:
@@ -112,17 +131,38 @@ Implement the following **contract-satisfying skeleton**, aiming for the smalles
112
131
  5. Implement DB skeleton and connect (or provide clear temporary store).
113
132
  6. Run the dev server and perform a manual “happy path” click-through.
114
133
 
134
+ ## Sub-agent assignments (recommended)
135
+
136
+ - UI Skeleton Builder: FrontendEngineer (apply UI layout guardrails).
137
+ - API/DB Skeleton Builder: BackendEngineer + DBEngineer.
138
+ - Runtime Smoke Checker: RuntimeGatekeeper (boot/access/interaction evidence).
139
+ - UI/UX Reviewer: UIUXReviewer (layout sanity check).
140
+
141
+ ## Runtime Interaction Gate (mandatory)
142
+
143
+ You may declare completion only after capturing evidence for:
144
+
145
+ - Boot: `pnpm dev` (or equivalent) starts without errors.
146
+ - Access: main URL(s) render without runtime errors.
147
+ - Interaction: at least one user interaction succeeds (click/input/submit/navigation).
148
+ - Optional (recommended): Playwright smoke (`@smoke`) if available.
149
+
150
+ Record commands, logs, and interaction steps in evidence.
151
+
115
152
  ## Completion criteria (hard gate)
116
153
 
117
154
  You may declare completion ONLY if:
118
155
 
119
156
  - [ ] Dev server starts locally without errors (`pnpm dev` or project equivalent).
157
+ - [ ] Runtime Interaction Gate evidence is captured (boot/access/interaction).
120
158
  - [ ] All UI routes declared in UI contracts are reachable (no 404).
159
+ - [ ] UI layout guardrails are satisfied (no oversized buttons; header/search rows intact).
121
160
  - [ ] At least one end-to-end happy path works in the UI:
122
161
  - list screen loads data (stub OK),
123
162
  - create/edit screen submits and updates list (stub OK),
124
163
  - navigation works.
125
164
  - [ ] All implemented API endpoints respond with status codes consistent with the contract.
165
+ - [ ] If Playwright smoke exists, `@smoke` passes (or document why it cannot run).
126
166
  - [ ] Evidence file exists: `.qfai/evidence/prototyping-<spec-id>.md`
127
167
  - includes executed commands,
128
168
  - includes “Format Self-Check”,
@@ -133,6 +173,8 @@ You may declare completion ONLY if:
133
173
  - No test automation was added here.
134
174
  - Implementation aligns with project conventions (no new framework added).
135
175
  - UI/API/DB skeleton matches contract definitions.
176
+ - Runtime Interaction Gate evidence is present and reproducible.
177
+ - UI layout guardrails were checked (UI/UX reviewer sign-off).
136
178
  - Completion criteria are objectively satisfied.
137
179
 
138
180
  ## Evidence (MANDATORY)
@@ -142,8 +184,10 @@ You may declare completion ONLY if:
142
184
  1. **Contract Inventory**: list of UI routes, API endpoints, DB tables from contracts.
143
185
  2. **Implementation Summary**: what was implemented for each contract item.
144
186
  3. **Dev Server Startup**: commands executed and result.
145
- 4. **Manual Verification Log**: step-by-step click-through with observations.
146
- 5. **Format Self-Check**: list each artifact and confirm "matches README template".
187
+ 4. **Runtime Interaction Gate**: access + interaction steps with results.
188
+ 5. **UI Layout Sanity Check**: guardrails checked + screenshots/notes if available.
189
+ 6. **Manual Verification Log**: step-by-step click-through with observations.
190
+ 7. **Format Self-Check**: list each artifact and confirm "matches README template".
147
191
 
148
192
  ## FINAL CHECKLIST (Check Last)
149
193