qfai 1.8.0 → 1.8.1

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 (28) hide show
  1. package/assets/init/.qfai/assistant/skills/qfai-atdd/SKILL.md +1 -0
  2. package/assets/init/.qfai/assistant/skills/qfai-implement/SKILL.md +4 -5
  3. package/assets/init/.qfai/assistant/skills/qfai-prototyping/SKILL.md +170 -130
  4. package/assets/init/.qfai/assistant/skills/qfai-prototyping/references/design-system-compliance.md +22 -0
  5. package/assets/init/.qfai/assistant/skills/qfai-prototyping/references/evidence-requirements.md +31 -0
  6. package/assets/init/.qfai/assistant/skills/qfai-prototyping/references/iteration-cycle.md +25 -0
  7. package/assets/init/.qfai/assistant/skills/qfai-prototyping/references/l1-review-guide.md +36 -0
  8. package/assets/init/.qfai/assistant/skills/qfai-prototyping/references/l2-review-guide.md +39 -0
  9. package/assets/init/.qfai/assistant/skills/qfai-prototyping/references/reviewer-gate.md +24 -0
  10. package/assets/init/.qfai/assistant/skills/qfai-sdd/SKILL.md +16 -9
  11. package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/contracts/anchor-selection.sample.yaml +7 -0
  12. package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/contracts/design-system.sample.yaml +18 -0
  13. package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/contracts/evaluation-axes.sample.yaml +24 -0
  14. package/assets/init/.qfai/assistant/skills/qfai-verify/SKILL.md +2 -0
  15. package/assets/init/.qfai/contracts/README.md +15 -10
  16. package/assets/init/.qfai/contracts/design/README.md +18 -14
  17. package/assets/init/.qfai/contracts/ui/README.md +9 -8
  18. package/dist/cli/index.cjs +7267 -14810
  19. package/dist/cli/index.cjs.map +1 -1
  20. package/dist/cli/index.mjs +7256 -14799
  21. package/dist/cli/index.mjs.map +1 -1
  22. package/dist/index.cjs +14553 -20847
  23. package/dist/index.cjs.map +1 -1
  24. package/dist/index.d.cts +184 -589
  25. package/dist/index.d.ts +184 -589
  26. package/dist/index.mjs +14501 -20783
  27. package/dist/index.mjs.map +1 -1
  28. package/package.json +1 -1
@@ -54,6 +54,7 @@ When unsure, read inputs in this order:
54
54
  - `.qfai/specs/<spec-id>/05_Examples.md` (EX)
55
55
  - `.qfai/specs/<spec-id>/06_Test-Cases.md` (TC)
56
56
  - `.qfai/contracts/api/**` (CON-API)
57
+ - `.qfai/contracts/ui/**` and `.qfai/contracts/design/**` when the target spec is UI-bearing
57
58
  - P5: `.qfai/specs/<spec-id>/09_delta.md` (Decision Records; if no spec yet, state "not applicable")
58
59
  - P6: legacy artifacts (optional only)
59
60
  - `.qfai/specs/<spec-id>/scenario.feature`
@@ -75,11 +75,10 @@ Execute the TDD micro-cycle for each pending item in `test-list.md`, transitioni
75
75
  ## Visual Review Guard
76
76
 
77
77
  - Review rendered output, screenshot evidence, or HTML output before closing any UI-affecting item.
78
- - Read the sidecar family first (selected anchor, strategy, screen contracts) whenever implementation touches UI or critique-driven behavior.
79
- - Read order: option comparison (30_option_comparison.md)selected anchor screen (31_selected_anchor_screen.md)
80
- strategy (10_implementation_strategy.md)taste interview (11_design_taste_interview.md)
81
- trend scan (04_Sources.md#Trend Scan) 3-layer evaluation family (20/21/22/23 + optional 24)
82
- screen contracts (40_screen_contracts.md) → review input bundle (50_review_input_bundle.md) →
78
+ - Read spec + contract inputs first whenever implementation touches UI or critique-driven behavior.
79
+ - Read order: `01_Spec.md` `03_Acceptance-Criteria.md``05_Examples.md`
80
+ `.qfai/contracts/design/anchor-selection.yaml``.qfai/contracts/design/evaluation-axes.yaml`
81
+ `.qfai/contracts/design/design-system.yaml``.qfai/contracts/ui/*.yaml`
83
82
  optional design tokens → optional fallback mock → mermaid flows.
84
83
  - If code intent and rendered output diverge, treat the rendered/HTML result as the blocking review input and reconcile before DONE.
85
84
 
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: qfai-prototyping
3
- title: QFAI Prototyping (Full-Harness Only)
4
- description: "Build a contract-aligned UI prototype and block completion until full-harness evidence and validate gate pass."
3
+ title: QFAI Prototyping (Skill-Orchestrated)
4
+ description: "Build a contract-aligned UI prototype, run agent-led visual evaluation, and gate completion through validate/verify."
5
5
  argument-hint: "[--auto]"
6
6
  allowed-tools: [Read, Glob, Write, TodoWrite, Task, Bash]
7
7
  roles:
@@ -24,173 +24,215 @@ mode: execution-focused
24
24
 
25
25
  [DRIFT-PROTOCOL:MANDATORY]
26
26
 
27
- This skill is static-first for planning and file review, but the package execution contract is `full-harness` only.
28
- Do not default or downgrade prototyping modes.
27
+ This skill owns prototyping orchestration directly.
28
+ Do not rely on a CLI entrypoint or package runtime loop.
29
29
 
30
30
  ## CRITICAL CONSTRAINTS (Read First)
31
31
 
32
32
  - Scope is all specs from `.qfai/specs/spec-*`.
33
- - Evidence is mandatory in markdown + json under `.qfai/evidence/`.
34
- - DONE is forbidden until prototyping evidence, reviewer gate, and `qfai validate --fail-on error` pass.
35
- - Supported prototyping surfaces are `web`, `mobile`, `desktop`, and `mixed`.
33
+ - Screenshot evidence and HTML snapshot evidence are mandatory.
34
+ - Screenshot evidence path: `.qfai/evidence/prototyping/screenshots/<screen-id>.png`
35
+ - HTML snapshot path: `.qfai/evidence/prototyping/html/<screen-id>.html`
36
+ - If either screenshot or HTML is missing for a declared screen, that screen scores `0` and the run is incomplete.
37
+ - Optional evidence is abolished. Missing mandatory evidence must trigger rerun, not waiver.
38
+ - DONE is forbidden until `qfai validate --fail-on error` passes and `/qfai-verify` can approve the run.
39
+ - Supported UI prototyping surfaces are `web`, `mobile`, `desktop`, and `mixed`.
36
40
  - `cli`, API-only, backend-only, and `ui_bearing: false` classifications are not prototyping execution targets.
37
- - Canonical screen contracts in `discussion-*/uiux/40_screen_contracts.md` are mandatory.
38
- - Browser QA, render evidence, runtimeGate, uiFidelity, specCoverage, and `fullHarness` are mandatory.
39
- - `uiFidelity` is screen-level and must be built from real render/browser evidence.
40
- - `mockPaths` is a negative-only issue ledger with `fail|finding` only.
41
- - Calibration pack is the SSOT. Runtime and validator both resolve from `calibrationRef.packPath`.
42
- - `--reviewer <id>` is mandatory and placeholder reviewer ids are rejected.
43
- - L1 and L2 findings must be fixed or dispositioned before PASS.
41
+ - `cli` is not supported and is not an execution target for prototyping.
42
+ - Canonical screen contracts in `.qfai/contracts/ui/*.yaml` are mandatory.
43
+ - Evaluation is performed by sub-agents; machine checks are limited to schema/evidence validation.
44
+ - Evaluation reviewer findings must be fixed or explicitly dispositioned before PASS.
45
+ - Shared evidence vocabulary includes `render.json` and `browser-qa.json` alongside screenshot and HTML evidence.
44
46
 
45
47
  ## Goal
46
48
 
47
- Build the minimum runnable slice for all specs and produce canonical `full-harness` evidence under `.qfai/evidence/`.
49
+ Build the minimum runnable slice for all specs and produce reviewable screenshot/HTML evidence for every declared screen.
48
50
 
49
- ## Mode
51
+ ## Surface / Mode
50
52
 
51
- ### Full-harness
53
+ - surface / mode routing uses `standard` as the default execution path.
54
+ - `standard` is the default when no explicit escalation to `full-harness` is requested.
55
+ - `full-harness` is reserved for explicit escalation and review-heavy obligations.
52
56
 
53
- - Full-harness is the package default when prototyping execution is valid.
54
- - Each `qfai prototyping run --mode full-harness --reviewer <id>` invocation records exactly one measured iteration.
55
- - Multiple iterations are formed only by real code changes between runs.
56
- - The runtime does not self-modify code and does not fabricate evidence.
57
+ ## Required References
57
58
 
58
- ## Obligation matrix
59
-
60
- | surface / mode | specs | runtimeGate | uiFidelity | render evidence | browser QA | fullHarness |
61
- | ---------------------- | -------- | ----------- | ---------- | --------------- | ---------- | ----------- |
62
- | web / full-harness | required | required | required | required | required | required |
63
- | mobile / full-harness | required | required | required | required | required | required |
64
- | desktop / full-harness | required | required | required | required | required | required |
65
- | mixed / full-harness | required | required | required | required | required | required |
66
-
67
- ## Required evidence
68
-
69
- ## Evidence (MANDATORY)
70
-
71
- - `.qfai/evidence/prototyping.md`
72
- - `.qfai/evidence/prototyping.json`
73
- - `.qfai/evidence/render.json`
74
- - `.qfai/evidence/browser-qa.json`
75
- - `.qfai/evidence/fullHarness.exit.json`
76
- - `.qfai/evidence/fullHarness.handoff.json`
77
- - `.qfai/evidence/fullHarness.fakeUiDetection.json`
59
+ Read and follow these references before execution:
78
60
 
79
- ## Truthfulness rules
80
-
81
- - `mode.effective` must be `full-harness`.
82
- - `runtimeGate` is observed-only. Synthetic status codes are invalid.
83
- - `runtimeGate.evidenceRefs` must contain concrete render/browser QA/spec refs only.
84
- - `specCoverage` must use concrete declared refs and concrete observed refs only.
85
- - Browser QA evidence must be preserved per screen.
86
- - `actionsWired` must reflect actionable control coverage, not finding counts.
87
- - `reviewerSignoff.status` represents final decision, not mere completion.
88
- - `reviewerLogs[].verdict` must align with decision/termination semantics.
89
-
90
- ## Review semantics
91
-
92
- - `accepted` -> `approved`
93
- - `rejected` -> `rejected`
94
- - `abandoned` -> `abandoned`
95
- - Plateau stop or max-iterations stop must not produce `approved`.
61
+ - `.qfai/assistant/skills/qfai-prototyping/references/evidence-requirements.md`
62
+ - `.qfai/assistant/skills/qfai-prototyping/references/iteration-cycle.md`
63
+ - `.qfai/assistant/skills/qfai-prototyping/references/l1-review-guide.md`
64
+ - `.qfai/assistant/skills/qfai-prototyping/references/l2-review-guide.md`
65
+ - `.qfai/assistant/skills/qfai-prototyping/references/design-system-compliance.md`
66
+ - `.qfai/assistant/skills/qfai-prototyping/references/reviewer-gate.md`
96
67
 
97
68
  ## Delegation Scope Table
98
69
 
99
70
  All sub-agent delegation in this skill MUST follow the category-to-role mapping below.
100
71
  Assigning a task to a role not listed for the category is a violation and MUST be flagged.
72
+ Evaluation scoring and screenshot capture must use only the allowed roles below.
101
73
 
102
74
  | Category | Allowed Role(s) |
103
75
  | ------------------ | ------------------------------------------------------ |
104
76
  | UI implementation | frontend-engineer, product-experience-architect |
105
77
  | Screenshot capture | devops-ci-engineer |
106
- | Evaluation L1-L2 | product-surface-reviewer, product-experience-architect |
78
+ | Evaluation review | product-surface-reviewer, product-experience-architect |
107
79
  | Build | devops-ci-engineer, backend-engineer |
108
80
 
109
- Any delegation map entry that assigns a category to an undefined or unlisted role (e.g., `"generic-code-writer"`) MUST produce a violation finding naming the undefined role and the category.
81
+ Any delegation map entry that assigns a category to an undefined or unlisted role MUST produce a violation finding naming the undefined role and the category.
82
+
83
+ ## Required Process
110
84
 
111
- ## Required process
85
+ ### Step 0 — Execution Plan
112
86
 
113
- ### Step 0 Execution Plan (executionPlan)
87
+ Before any code is written, create an execution plan record in the work evidence.
114
88
 
115
- Before any code is written, create an `executionPlan` record with the following fields:
89
+ Required fields:
116
90
 
117
- - `targetIterations`: integer; minimum 2 for full-harness
118
- - `evaluationAxesSource`: reference to the discussion pack evaluation-family files (20/21/22/23)
119
- - `delegationMap`: category-to-role assignments per Delegation Scope Table above
91
+ - `targetIterations`: integer; minimum 2
92
+ - `evaluationAxesSource`: ref to `.qfai/contracts/design/evaluation-axes.yaml`
93
+ - `delegationMap`: category-to-role assignments per Delegation Scope Table
120
94
  - `plannedAt`: ISO-8601 timestamp
121
95
 
122
- The executionPlan MUST be present in `prototyping.json` when `mode=full-harness`. A validator MUST reject any full-harness record without an executionPlan.
96
+ ### Step 1 Read Inputs
123
97
 
124
- ### Iteration Gate
98
+ Read the downstream-ready spec/contract inputs and verify:
125
99
 
126
- - full-harness convergence requires a minimum of 2 iterations.
127
- - A single-iteration run that reports `converged=true` is invalid; the iteration gate MUST raise an error with message "minimum 2 iterations required before convergence".
128
- - The phase transition from iteration N to N+1 is blocked until `terminationCondition` is met or the gate explicitly authorizes continuation.
100
+ - `.qfai/specs/<spec-id>/01_Spec.md`
101
+ - `.qfai/specs/<spec-id>/03_Acceptance-Criteria.md`
102
+ - `.qfai/contracts/design/evaluation-axes.yaml`
103
+ - `.qfai/contracts/design/anchor-selection.yaml`
104
+ - `.qfai/contracts/design/design-system.yaml` when required by the spec
105
+ - `.qfai/contracts/ui/*.yaml`
129
106
 
130
- ### 5-Step Iteration Cycle
107
+ Read order:
131
108
 
132
- Each full-harness iteration follows this fixed sequence:
109
+ 1. `.qfai/specs/<spec-id>/01_Spec.md`
110
+ 2. `.qfai/specs/<spec-id>/03_Acceptance-Criteria.md`
111
+ 3. `.qfai/contracts/design/anchor-selection.yaml`
112
+ 4. `.qfai/contracts/design/evaluation-axes.yaml`
113
+ 5. `.qfai/contracts/design/design-system.yaml`
114
+ 6. `.qfai/contracts/ui/*.yaml`
133
115
 
134
- 1. **Capture**Run `packages/qfai/assets/scripts/capture-screenshots.js --url <url> --out <dir>` and record screenshot paths with timestamps under `scoringTrace[i].screenshotDir`.
135
- 2. **Evaluate** — Launch L1 and L2 evaluator sub-agents with full context bundle: (a) screenshots from Step 1, (b) axisDefs from evaluation-family 20/21/22/23, (c) previousScore from prior iteration, (d) designSystemChecklist from `uiux/12_design_system.md`.
136
- 3. **Identify** — Aggregate L1 + L2 findings; flag immediate-fix items.
137
- 4. **Fix** — Apply fixes per finding disposition; do not close items without evidence.
138
- 5. **Re-evaluate** — Re-run Steps 1–4; compare new score to prior score to check plateau.
116
+ ### Step 2 Verify Execution Preconditions
139
117
 
140
- The sequence MUST NOT be permuted. Parallel execution of Capture+Evaluate is prohibited.
118
+ Confirm all of the following before any evaluation:
141
119
 
142
- ### Evaluator Input — 4 Required Elements
120
+ - classification is UI-bearing
121
+ - surface is `web`, `mobile`, `desktop`, or `mixed`
122
+ - every declared screen has a stable `screen-id`
123
+ - the design evaluation contract satisfies the required schema
124
+ - the design system checklist is available when required
143
125
 
144
- When launching any L1 or L2 evaluator sub-agent, all 4 elements MUST be present in the input:
126
+ ### Step 3 Implement the Minimum Runnable Slice
145
127
 
146
- (a) screenshots paths produced by capture-screenshots.js for the current iteration
147
- (b) axisDefs — scoring axes from discussion-pack evaluation-family (20/21/22/23)
148
- (c) previousScore — aggregate score from the prior iteration (null for iteration 1)
149
- (d) designSystemChecklist — the compliance checklist derived from `uiux/12_design_system.md`
128
+ Implement the smallest UI slice that covers all declared screens and primary interactions.
150
129
 
151
- If any element is missing, a reviewer check MUST raise a finding naming the missing element.
152
- Missing element (d) is a common error when `uiux/12_design_system.md` is absent; the reviewer MUST still flag it.
130
+ ### Step 4 Capture Mandatory Evidence
153
131
 
154
- ### Visual Quality Structural Checklist
132
+ For every declared screen:
155
133
 
156
- Each iteration evaluation MUST score all 6 visual categories:
134
+ - capture one screenshot and store it at the canonical screenshot path
135
+ - capture one HTML snapshot and store it at the canonical HTML path
136
+ - record missing evidence immediately; do not continue as if capture succeeded
137
+
138
+ ### Step 5 — Launch Evaluation Reviewers
139
+
140
+ Launch evaluation reviewer sub-agents with the full context bundle:
141
+
142
+ - screenshots from Step 4
143
+ - HTML snapshots from Step 4
144
+ - `axisDefs` from `.qfai/contracts/design/evaluation-axes.yaml`
145
+ - `previousScore` from the prior iteration (`null` for iteration 1)
146
+ - `designSystemChecklist` from `.qfai/contracts/design/design-system.yaml`
147
+
148
+ If any required input is missing, stop the evaluation and classify the screen as `0` points with rerun required.
149
+
150
+ ### Step 6 — Aggregate Findings
151
+
152
+ Aggregate reviewer findings and classify them as:
153
+
154
+ - blocking
155
+ - immediate-fix
156
+ - revise
157
+ - manual-review
158
+
159
+ ### Step 7 — Fix and Re-capture
157
160
 
158
- 1. Color color palette adherence to design system tokens
159
- 2. Typography type scale, weight, line-height compliance
160
- 3. Spacing — spacing scale and grid alignment
161
- 4. Border radius — border-radius consistency across components
162
- 5. Shadow — shadow elevation and opacity standards
163
- 6. Do's&Don'ts — adherence to explicit do/don't rules from `uiux/12_design_system.md`
161
+ Apply fixes per finding disposition, then re-capture screenshot and HTML evidence for every changed screen.
162
+ Do not close a finding without fresh evidence.
164
163
 
165
- ### Lighthouse Gate (MUST for web full-harness)
164
+ ### Step 8 Re-evaluate
166
165
 
167
- When `surface=web` and `mode=full-harness`, a Lighthouse performance/accessibility report MUST be captured and attached to the evidence. The reviewer gate MUST raise an error "Lighthouse Gate is MUST for full-harness + web surface" when the report is absent.
166
+ Repeat Steps 4–7 until:
168
167
 
169
- ### Steps (continued)
168
+ - at least 2 iterations have completed
169
+ - all declared screens have screenshot + HTML evidence
170
+ - blocking findings are closed or dispositioned
171
+ - validate can pass on required schema/evidence gates
170
172
 
171
- 1. Read the latest discussion pack and verify `prototyping.yaml`, `04_Sources.md`, `20/21/22/23`, and `40_screen_contracts.md`.
172
- Read order: option comparison / `30_option_comparison.md` -> selected anchor screen / `31_selected_anchor_screen.md` -> strategy / `10_implementation_strategy.md` -> taste interview / `11_design_taste_interview.md` -> trend scan / `04_Sources.md` -> 3-layer evaluation family (`20/21/22/23`) -> screen contracts / `40_screen_contracts.md`.
173
- 2. Verify the classification is UI-bearing and the surface is `web`, `mobile`, `desktop`, or `mixed`.
174
- 3. Create the executionPlan (Step 0 above).
175
- 4. Implement the minimum runnable slice for all specs.
176
- 5. Run `qfai prototyping run --mode full-harness --reviewer <id>` — this executes the 5-Step Iteration Cycle per iteration.
177
- 6. Review render evidence, HTML snapshots, Browser QA, runtimeGate, uiFidelity, and specCoverage for every declared screen.
178
- 7. Fix findings and rerun until the evidence is coherent.
179
- 8. Run `qfai validate --fail-on error`.
180
- 9. Route an independent reviewer and do not declare completion until the result is `PASS`.
173
+ ## Iteration Gate
181
174
 
182
- ## Reviewer gate
175
+ - minimum 2 iterations are required before phase transition to validation or review.
176
+ - if the iteration gate is not satisfied, phase transition is blocked.
177
+ - terminationCondition cannot bypass the minimum 2 iterations rule.
178
+
179
+ ## Full-harness
180
+
181
+ - `full-harness` applies only after explicit escalation from the default `standard` path.
182
+ - `full-harness` carries review-heavy obligations and stricter evidence checks.
183
+
184
+ ## Obligation matrix
185
+
186
+ | surface / mode | obligation profile |
187
+ | ----------------------- | ----------------------------------- |
188
+ | web / default route | static-first obligations (standard) |
189
+ | web / full-harness | review-heavy obligations |
190
+ | mobile / default route | static-first obligations (standard) |
191
+ | desktop / default route | static-first obligations (standard) |
192
+ | mixed / full-harness | review-heavy obligations |
193
+
194
+ ### Step 9 — Validate and Verify
195
+
196
+ - Run `qfai validate --fail-on error`.
197
+ - Route `/qfai-verify` or its equivalent gate workflow for final quality approval.
198
+ - Do not declare completion until the reviewer result is `PASS`.
199
+
200
+ ## Evaluator Inputs (Mandatory)
201
+
202
+ When launching any evaluation reviewer sub-agent, all 5 elements MUST be present:
203
+
204
+ 1. screenshots
205
+ 2. HTML snapshots
206
+ 3. axisDefs
207
+ 4. previousScore
208
+ 5. designSystemChecklist
209
+
210
+ ## Visual Quality Structural Checklist
211
+
212
+ Each iteration evaluation MUST score all 6 visual categories:
213
+
214
+ 1. Color
215
+ 2. Typography
216
+ 3. Spacing
217
+ 4. Border radius
218
+ 5. Shadow
219
+ 6. Do's&Don'ts
183
220
 
184
221
  ### Reviewer Gate (MUST)
185
222
 
186
- - Reviewer must verify full-harness evidence completeness.
187
- - Reviewer response must include `Result: PASS | REVISE` (matching shared-skill-delegation-baseline.md#reviewer-response-template).
188
- - Reviewer must verify calibration pack usage via `calibrationRef`.
189
- - Reviewer must reject self-reference, synthetic refs, and `mockPaths.status="pass"`.
190
- - Reviewer must verify `reviewerSignoff`, `reviewerLogs`, `terminationReason`, and `finalDecision` are semantically aligned.
191
- - Reviewer must verify Drift Protocol compliance and alignment with `test-layers.md`.
192
- - Review volume guidance remains signals, not gates.
193
- - Reviewer returns PASS or REVISE only.
223
+ Reviewer checks are defined in:
224
+
225
+ - `.qfai/assistant/skills/qfai-prototyping/references/reviewer-gate.md`
226
+
227
+ Minimum reviewer responsibilities:
228
+
229
+ - verify mandatory screenshot/HTML evidence exists for every declared screen
230
+ - verify 3-layer evaluation references were used
231
+ - verify missing evidence caused rerun rather than waiver
232
+ - verify `qfai validate --fail-on error` completed successfully
233
+ - verify Drift Protocol compliance and alignment with `.qfai/assistant/steering/test-layers.md`
234
+ - treat score/volume heuristics as signals, not gates
235
+ - return `Result: PASS | REVISE`
194
236
 
195
237
  ## Sub-agent Delegation (MANDATORY)
196
238
 
@@ -198,9 +240,9 @@ Follow `.qfai/assistant/instructions/shared-skill-delegation-baseline.md`.
198
240
 
199
241
  ### Orchestrator Protocol (MUST)
200
242
 
201
- - Additional prototyping-specific overrides:
202
- - do not self-approve;
203
- - keep evidence paths canonical and integrate delegated results only.
243
+ - do not self-approve
244
+ - keep evidence paths canonical
245
+ - integrate delegated results only
204
246
 
205
247
  ### Capability Probe (MUST)
206
248
 
@@ -221,19 +263,17 @@ Follow `.qfai/assistant/instructions/shared-skill-operating-baseline.md#completi
221
263
 
222
264
  Prototyping-specific additions:
223
265
 
224
- - all specs are covered;
225
- - full-harness evidence is complete and truthful;
226
- - `qfai validate --fail-on error` passes;
227
- - reviewer returns `PASS`.
266
+ - all specs are covered
267
+ - all declared screens have screenshot + HTML evidence
268
+ - `qfai validate --fail-on error` passes
269
+ - reviewer returns `PASS`
228
270
 
229
271
  ## FINAL CHECKLIST (Check Last)
230
272
 
231
- ### Completion Checklist (MUST)
232
-
233
273
  - All specs are covered in the Coverage Matrix.
234
- - Required full-harness evidence is present.
235
- - 404 findings are resolved or the run is not complete.
236
- - uiFidelity is present when required.
274
+ - Every declared screen has screenshot evidence.
275
+ - Every declared screen has HTML evidence.
276
+ - Missing evidence triggered rerun instead of waiver.
237
277
  - Reviewer returned PASS; otherwise status is REVISE.
238
278
 
239
279
  ## Completion Message & Next Actions (MUST)
@@ -242,4 +282,4 @@ Action:
242
282
 
243
283
  - Proceed: `/qfai-atdd`
244
284
  - Quality gate: `/qfai-verify`
245
- - Rework prototyping: rerun `/qfai-prototyping` with corrected evidence
285
+ - Rework prototyping: rerun `/qfai-prototyping` with corrected screenshot/HTML evidence
@@ -0,0 +1,22 @@
1
+ # Design System Compliance
2
+
3
+ When `.qfai/contracts/design/design-system.yaml` exists and is required, evaluators must compare the implementation against:
4
+
5
+ - color palette
6
+ - typography scale and weights
7
+ - spacing scale
8
+ - border radius
9
+ - shadow usage
10
+ - explicit do/don't rules
11
+
12
+ ## Rule
13
+
14
+ If the implementation clearly contradicts the design system on a primary screen, record an immediate-fix finding.
15
+
16
+ ## Evidence
17
+
18
+ Support each finding with:
19
+
20
+ - screenshot evidence
21
+ - HTML snapshot evidence
22
+ - the specific design-system clause or checklist item
@@ -0,0 +1,31 @@
1
+ # Evidence Requirements
2
+
3
+ ## Mandatory evidence
4
+
5
+ For every declared screen in `.qfai/contracts/ui/*.yaml`, collect both:
6
+
7
+ - screenshot: `.qfai/evidence/prototyping/screenshots/<screen-id>.png`
8
+ - HTML snapshot: `.qfai/evidence/prototyping/html/<screen-id>.html`
9
+
10
+ If either artifact is missing:
11
+
12
+ - the screen is scored `0`
13
+ - the run is incomplete
14
+ - rerun is mandatory
15
+
16
+ Optional evidence is not allowed.
17
+
18
+ ## Capture rules
19
+
20
+ - Use stable `screen-id` names from the canonical UI contracts.
21
+ - Overwrite stale evidence with fresh evidence from the current iteration.
22
+ - Do not reuse an older screenshot or HTML snapshot after a fix.
23
+ - If capture fails, record the failure in work evidence and stop pretending the screen was evaluated.
24
+
25
+ ## Validate gate expectations
26
+
27
+ `qfai validate --fail-on error` must be able to confirm:
28
+
29
+ - every declared screen has a screenshot file
30
+ - every declared screen has an HTML snapshot file
31
+ - the file paths follow the canonical directories above
@@ -0,0 +1,25 @@
1
+ # Iteration Cycle
2
+
3
+ Each iteration follows this order:
4
+
5
+ 1. Capture screenshot and HTML for every declared screen.
6
+ 2. Launch L1 and L2 evaluator sub-agents with the required inputs.
7
+ 3. Aggregate findings and classify them by severity and disposition.
8
+ 4. Fix the UI according to findings.
9
+ 5. Re-capture screenshot and HTML evidence for every changed screen.
10
+ 6. Re-run the evaluators.
11
+
12
+ ## Minimum iteration count
13
+
14
+ - Completion requires at least 2 iterations.
15
+ - A single successful-looking pass is not enough.
16
+ - If evidence is missing in any iteration, that iteration does not count as complete.
17
+
18
+ ## Stop conditions
19
+
20
+ You may stop only when all of the following are true:
21
+
22
+ - all declared screens have screenshot + HTML evidence
23
+ - blocking findings are closed or dispositioned
24
+ - validate passes with `--fail-on error`
25
+ - independent reviewer returns `PASS`
@@ -0,0 +1,36 @@
1
+ # L1 Review Guide
2
+
3
+ L1 checks implementation fidelity.
4
+
5
+ ## Inputs
6
+
7
+ - screenshots
8
+ - HTML snapshots
9
+ - canonical UI contracts from `.qfai/contracts/ui/*.yaml`
10
+ - latest code state
11
+
12
+ ## Required checks
13
+
14
+ For each declared screen:
15
+
16
+ - the screen is reachable/rendered
17
+ - screenshot exists
18
+ - HTML snapshot exists
19
+ - required elements are visibly present
20
+ - required actions are wired or explicitly marked missing
21
+ - blocking UI failures are identified
22
+
23
+ ## Failure handling
24
+
25
+ - Missing screenshot or HTML => score `0`, rerun required
26
+ - Missing primary action wiring => blocking finding
27
+ - Severe route/render failure => blocking finding
28
+
29
+ ## Output
30
+
31
+ Return:
32
+
33
+ - per-screen findings
34
+ - blocking/immediate-fix classification
35
+ - a numeric score per axis in the range `0.0..1.0`
36
+ - rationale tied to screenshot/HTML evidence
@@ -0,0 +1,39 @@
1
+ # L2 Review Guide
2
+
3
+ L2 checks product experience and design alignment.
4
+
5
+ ## Inputs
6
+
7
+ - screenshots
8
+ - HTML snapshots
9
+ - `.qfai/contracts/design/evaluation-axes.yaml`
10
+ - `.qfai/contracts/design/anchor-selection.yaml`
11
+ - `.qfai/contracts/design/design-system.yaml`
12
+ - previous iteration score
13
+
14
+ ## 3-layer evaluation family
15
+
16
+ L2 must explicitly use all of:
17
+
18
+ - invariant axes
19
+ - trend-derived axes
20
+ - product-specific axes
21
+ - aggregate rules
22
+
23
+ ## Required checks
24
+
25
+ - visual hierarchy aligns with invariant axes
26
+ - trend-based styling aligns with trend-derived axes
27
+ - product-specific differentiation is visible
28
+ - selected anchor direction is reflected in the current UI
29
+ - design system checklist is respected
30
+ - experience findings are recorded separately from blocking L1 findings
31
+
32
+ ## Output
33
+
34
+ Return:
35
+
36
+ - per-axis findings
37
+ - revise/manual-review classification
38
+ - a numeric score per axis in the range `0.0..1.0`
39
+ - rationale tied to screenshot/HTML evidence and axis refs
@@ -0,0 +1,24 @@
1
+ # Reviewer Gate
2
+
3
+ The reviewer is an independent gate, not the implementation author.
4
+
5
+ ## Reviewer must verify
6
+
7
+ - all declared screens have screenshot evidence
8
+ - all declared screens have HTML snapshot evidence
9
+ - L1 and L2 evaluators used the required inputs
10
+ - the 3-layer evaluation family was referenced
11
+ - missing evidence triggered rerun rather than waiver
12
+ - `qfai validate --fail-on error` passed
13
+
14
+ ## Reviewer output
15
+
16
+ ```text
17
+ Result: PASS | REVISE
18
+ Findings:
19
+ - ...
20
+ Required fixes:
21
+ - ...
22
+ Evidence checked:
23
+ - ...
24
+ ```
@@ -190,9 +190,10 @@ Follow `.qfai/assistant/instructions/shared-skill-operating-baseline.md#delta-re
190
190
  - Use only skill-local templates under `.qfai/assistant/skills/qfai-sdd/templates/`, including `templates/contracts`, `templates/report`, and `templates/specs`.
191
191
  - Always write `.qfai/report/preflight_summary.md` before generating shared/spec artifacts.
192
192
  - Contracts are contract-first mandatory outputs in this skill.
193
+ - UI-bearing targets must be normalized into downstream-ready contracts under `.qfai/contracts/design/**` and `.qfai/contracts/ui/**`.
193
194
  - `_policies/05_Contracts.md` must include a Contract Index.
194
195
  - `/qfai-sdd` must stop when discussion-pack is missing, incomplete, or has blocking OQ.
195
- - Discussion-pack preflight is mandatory, including classification-aware `prototyping.yaml` validation.
196
+ - Discussion-pack preflight is mandatory, including contract-first checks that UI-bearing targets are normalized into required design/ui contracts before downstream generation.
196
197
  - Reviewer routing is fixed by `.qfai/assistant/steering/agent-routing.yml` and `.qfai/assistant/steering/review-profiles.yml`.
197
198
  - RCP wording must be sourced from `.qfai/assistant/skills/qfai-sdd/references/rcp_footer.md`.
198
199
  - `_policies/04_Business-Flow.md` must be Markdown and include Mermaid `flowchart` or `sequenceDiagram`.
@@ -221,6 +222,11 @@ Create or update layered SDD artifacts in one run so downstream execution phases
221
222
  - Shared `_policies/01..11` layered files
222
223
  - Target `spec-XXXX/01..10` layered files
223
224
  - Updated contracts under `.qfai/contracts/**`
225
+ - UI-bearing normalized contracts:
226
+ - `.qfai/contracts/design/design-system.yaml`
227
+ - `.qfai/contracts/design/evaluation-axes.yaml`
228
+ - `.qfai/contracts/design/anchor-selection.yaml`
229
+ - `.qfai/contracts/ui/*.yaml`
224
230
  - `.qfai/report/preflight_summary.md`
225
231
  - Evidence file: `.qfai/evidence/sdd-spec-XXXX.md`
226
232
 
@@ -232,14 +238,15 @@ The canonical file set is defined by skill templates under `.qfai/assistant/skil
232
238
  2. Analyze repository context, existing artifacts, constraints, and open decisions.
233
239
  3. Write `.qfai/report/preflight_summary.md`.
234
240
  4. Execute Phase 0 (Contracts-first).
235
- 5. Execute Phase 1 (Outline).
236
- 6. Ensure `_policies/11_Slice-Policy.md` exists and matches the current slicing model.
237
- 7. Execute Phase 2 (Slice) and pass slice gate for each target spec.
238
- 8. Execute Phase 3 (Plan finalize) after at least one slice gate passes.
239
- 9. Execute Phase 4 (Delta update).
240
- 10. Run `qfai validate --fail-on error --format github | tee .qfai/report/validate.log`.
241
- 11. Review `.qfai/report/specs-coverage/spec-*.md` and triage density-smell warnings.
242
- 12. If validate fails, fix source-layer artifacts and repeat until `error=0`.
241
+ 5. For UI-bearing targets, normalize discussion UIUX artifacts into design/ui contracts for downstream execution.
242
+ 6. Execute Phase 1 (Outline).
243
+ 7. Ensure `_policies/11_Slice-Policy.md` exists and matches the current slicing model.
244
+ 8. Execute Phase 2 (Slice) and pass slice gate for each target spec.
245
+ 9. Execute Phase 3 (Plan finalize) after at least one slice gate passes.
246
+ 10. Execute Phase 4 (Delta update).
247
+ 11. Run `qfai validate --fail-on error --format github | tee .qfai/report/validate.log`.
248
+ 12. Review `.qfai/report/specs-coverage/spec-*.md` and triage density-smell warnings.
249
+ 13. If validate fails, fix source-layer artifacts and repeat until `error=0`.
243
250
 
244
251
  Use:
245
252