qfai 1.8.4 → 1.8.7

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 (95) hide show
  1. package/README.md +39 -56
  2. package/assets/init/.qfai/assistant/agents/acceptance-test-engineer.md +6 -0
  3. package/assets/init/.qfai/assistant/agents/architecture-reviewer.md +6 -2
  4. package/assets/init/.qfai/assistant/agents/backend-engineer.md +6 -3
  5. package/assets/init/.qfai/assistant/agents/completion-reviewer.md +6 -0
  6. package/assets/init/.qfai/assistant/agents/delivery-planner.md +6 -0
  7. package/assets/init/.qfai/assistant/agents/devops-ci-engineer.md +6 -0
  8. package/assets/init/.qfai/assistant/agents/discovery-analyst.md +6 -0
  9. package/assets/init/.qfai/assistant/agents/doc-steward.md +6 -0
  10. package/assets/init/.qfai/assistant/agents/frontend-engineer.md +6 -3
  11. package/assets/init/.qfai/assistant/agents/implementation-reviewer.md +6 -1
  12. package/assets/init/.qfai/assistant/agents/orchestrator.md +6 -0
  13. package/assets/init/.qfai/assistant/agents/product-experience-architect.md +6 -2
  14. package/assets/init/.qfai/assistant/agents/product-surface-reviewer.md +11 -2
  15. package/assets/init/.qfai/assistant/agents/qa-gatekeeper.md +6 -0
  16. package/assets/init/.qfai/assistant/agents/qa-strategist.md +6 -0
  17. package/assets/init/.qfai/assistant/agents/requirements-analyst.md +6 -0
  18. package/assets/init/.qfai/assistant/agents/requirements-reviewer.md +6 -0
  19. package/assets/init/.qfai/assistant/agents/solution-architect.md +6 -2
  20. package/assets/init/.qfai/assistant/agents/test-design-analyst.md +6 -0
  21. package/assets/init/.qfai/assistant/instructions/requirements-decomposition.md +1 -1
  22. package/assets/init/.qfai/assistant/instructions/shared-skill-operating-baseline.md +13 -0
  23. package/assets/init/.qfai/assistant/instructions/workflow.md +2 -2
  24. package/assets/init/.qfai/assistant/skills/qfai-atdd/SKILL.md +3 -0
  25. package/assets/init/.qfai/assistant/skills/qfai-configure/SKILL.md +7 -6
  26. package/assets/init/.qfai/assistant/skills/qfai-discussion/SKILL.md +12 -8
  27. package/assets/init/.qfai/assistant/skills/qfai-discussion/references/design-dna-intake.md +30 -0
  28. package/assets/init/.qfai/assistant/skills/qfai-discussion/references/discussion-artifact-rules.md +62 -0
  29. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/prototyping.yaml +4 -12
  30. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/uiux/31_reference_pool.md +6 -6
  31. package/assets/init/.qfai/assistant/skills/qfai-implement/SKILL.md +23 -12
  32. package/assets/init/.qfai/assistant/skills/qfai-prototyping/SKILL.md +67 -321
  33. package/assets/init/.qfai/assistant/skills/qfai-prototyping/references/generator-prompt.md +35 -0
  34. package/assets/init/.qfai/assistant/skills/qfai-prototyping/references/handoff.md +41 -0
  35. package/assets/init/.qfai/assistant/skills/qfai-prototyping/references/iteration-loop.md +51 -0
  36. package/assets/init/.qfai/assistant/skills/qfai-prototyping/references/reviewer-prompt.md +75 -0
  37. package/assets/init/.qfai/assistant/skills/qfai-prototyping/templates/contracts/prototype-handoff.sample.yaml +14 -0
  38. package/assets/init/.qfai/assistant/skills/qfai-sdd/SKILL.md +19 -16
  39. package/assets/init/.qfai/assistant/skills/qfai-sdd/references/contract-artifact-rules.md +30 -0
  40. package/assets/init/.qfai/assistant/skills/qfai-sdd/references/review-cycle-playbook.md +5 -0
  41. package/assets/init/.qfai/assistant/skills/qfai-sdd/references/sdd-phase-checklists.md +2 -2
  42. package/assets/init/.qfai/assistant/skills/qfai-sdd/references/sdd-quality-gate.md +1 -1
  43. package/assets/init/.qfai/assistant/skills/qfai-sdd/references/spec-traceability-rules.md +75 -0
  44. package/assets/init/.qfai/assistant/skills/qfai-sdd/references/ui-design-contract-normalization.md +45 -0
  45. package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/contracts/brand-design.sample.yaml +20 -0
  46. package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/contracts/reference-pool.sample.yaml +15 -0
  47. package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/specs/_policies/04_Business-Flow.md +1 -1
  48. package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/specs/spec/01_Spec.md +2 -2
  49. package/assets/init/.qfai/assistant/skills/qfai-verify/SKILL.md +11 -8
  50. package/assets/init/.qfai/assistant/steering/agent-routing.yml +17 -28
  51. package/assets/init/.qfai/assistant/steering/review-profiles.yml +0 -3
  52. package/assets/init/.qfai/assistant/steering/structure.md +1 -1
  53. package/assets/init/.qfai/assistant/steering/ui-definition-protocol.md +53 -49
  54. package/assets/uix-rev/comparison-review.md +3 -4
  55. package/dist/cli/index.cjs +11312 -12951
  56. package/dist/cli/index.cjs.map +1 -1
  57. package/dist/cli/index.mjs +11041 -12681
  58. package/dist/cli/index.mjs.map +1 -1
  59. package/dist/index.cjs +5941 -8100
  60. package/dist/index.cjs.map +1 -1
  61. package/dist/index.d.cts +11 -370
  62. package/dist/index.d.ts +11 -370
  63. package/dist/index.mjs +5904 -8055
  64. package/dist/index.mjs.map +1 -1
  65. package/package.json +5 -6
  66. package/assets/init/.qfai/README.md +0 -117
  67. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/uiux/33_exploration_rubric.md +0 -27
  68. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/uiux/34_evaluator_calibration.md +0 -17
  69. package/assets/init/.qfai/assistant/skills/qfai-prototyping/references/design-system-compliance.md +0 -22
  70. package/assets/init/.qfai/assistant/skills/qfai-prototyping/references/evidence-requirements.md +0 -62
  71. package/assets/init/.qfai/assistant/skills/qfai-prototyping/references/iteration-cycle.md +0 -57
  72. package/assets/init/.qfai/assistant/skills/qfai-prototyping/references/l1-review-guide.md +0 -37
  73. package/assets/init/.qfai/assistant/skills/qfai-prototyping/references/l2-review-guide.md +0 -45
  74. package/assets/init/.qfai/assistant/skills/qfai-prototyping/references/reviewer-gate.md +0 -45
  75. package/assets/init/.qfai/assistant/skills/qfai-prototyping/templates/contracts/ui-0001-order-mockable.yaml +0 -67
  76. package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/contracts/absorption-policy.sample.yaml +0 -7
  77. package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/contracts/design-system.sample.yaml +0 -22
  78. package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/contracts/evaluation-rubric.sample.yaml +0 -35
  79. package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/contracts/evaluator-calibration.sample.yaml +0 -15
  80. package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/contracts/selected-direction.sample.yaml +0 -7
  81. package/assets/init/.qfai/assistant/skills.local/README.md +0 -26
  82. package/assets/init/.qfai/contracts/README.md +0 -67
  83. package/assets/init/.qfai/contracts/api/README.md +0 -68
  84. package/assets/init/.qfai/contracts/db/README.md +0 -32
  85. package/assets/init/.qfai/contracts/design/README.md +0 -45
  86. package/assets/init/.qfai/contracts/ui/README.md +0 -162
  87. package/assets/init/.qfai/discussion/README.md +0 -160
  88. package/assets/init/.qfai/evidence/README.md +0 -99
  89. package/assets/init/.qfai/evidence/calibration.yaml +0 -26
  90. package/assets/init/.qfai/report/README.md +0 -26
  91. package/assets/init/.qfai/review/README.md +0 -128
  92. package/assets/init/.qfai/review_archive/.gitignore +0 -3
  93. package/assets/init/.qfai/review_archive/README.md +0 -30
  94. package/assets/init/.qfai/specs/README.md +0 -100
  95. package/assets/init/.qfai/specs/spec-XXXX/tdd/test-list.md +0 -4
@@ -0,0 +1,62 @@
1
+ # Discussion Artifact Rules
2
+
3
+ Use this file when `/qfai-discussion` creates or reviews `.qfai/discussion/discussion-*` packs.
4
+
5
+ ## Required Pack
6
+
7
+ Each pack uses immutable timestamp naming: `.qfai/discussion/discussion-YYYYMMDDhhmmssSSS/`.
8
+
9
+ Required files:
10
+
11
+ - `01_Context.md`
12
+ - `02_Inception-Deck.md`
13
+ - `03_Story-Workshop.md`
14
+ - `04_Sources.md`
15
+ - `05_Scope.md`
16
+ - `06_REQ.md`
17
+ - `07_NFR.md`
18
+ - `08_Glossary.md`
19
+ - `09_Constraints.md`
20
+ - `10_Policy.md`
21
+ - `11_OQ-Register.md`
22
+ - `12_OQ-Resolution-Log.md`
23
+ - `13_Deferred.md`
24
+ - `14_Review-Request.md`
25
+ - `99_delta.md`
26
+
27
+ UI-bearing discussion packs may include `prototyping.yaml` as an optional recommendation artifact; non-ui discussion packs typically omit it. For `ui_bearing: false`, typically omit `prototyping.yaml`. Current discussion-pack readiness does not block on missing `prototyping.yaml`.
28
+
29
+ ## Rules
30
+
31
+ - Run interview and requirement capture until `Disposition: open` is zero in `11_OQ-Register.md`.
32
+ - OQ `Gate` values are `discussion`, `sdd`, `atdd`, `tdd`, or `ops`.
33
+ - `deferred` is allowed only when `13_Deferred.md` has complete metadata.
34
+ - Discussion outputs are rationale and intake logs; do not duplicate `.qfai/specs/**` SSOT.
35
+ - `03_Story-Workshop.md` must include at least one Mermaid diagram.
36
+ - Use Mermaid fences only for diagrams.
37
+ - `14_Review-Request.md` must reference `.qfai/assistant/steering/agent-routing.yml` and `review-profiles.yml`.
38
+
39
+ ## UI/UX Exploration Family
40
+
41
+ For UI-bearing packs, use:
42
+
43
+ - `04_Sources.md` for trend translation and competitive reference registry
44
+ - `uiux/30_exploration_brief.md`
45
+ - `uiux/31_reference_pool.md`
46
+ - `uiux/32_design_anti_goals.md`
47
+ - `uiux/40_screen_contracts.md`
48
+
49
+ Discussion is exploration-first and must not choose a single visual winner or final design system. Those are downstream prototyping outputs.
50
+
51
+ ## `prototyping.yaml`
52
+
53
+ When `prototyping.yaml` is present, use the v2.0 single-thread schema:
54
+
55
+ ```yaml
56
+ prototyping:
57
+ surface: web # web | mobile | desktop | mixed
58
+ ```
59
+
60
+ The v1.x `recommended_mode` / `allowed_modes` / `mode_expectations` fields
61
+ were removed in spec-0017 P3 (the single-thread evolution loop fixes
62
+ iteration count globally to 15).
@@ -1,17 +1,9 @@
1
1
  prototyping:
2
- recommended_mode: full-harness
3
- rationale: >
4
- Fill this with a concrete reason tied to the full-harness evidence obligations.
5
- allowed_modes:
6
- - full-harness
2
+ # v2.0 single-thread evolution loop (spec-0017): mode/maxCycles concepts
3
+ # are removed; iteration count is fixed at 15 globally in
4
+ # `core/prototyping/iteration.ts#MAX_ITERATIONS`.
7
5
  # Replace `web` with one of the prototyping-supported surfaces if needed:
8
6
  # web | mobile | desktop | mixed
9
7
  # (discussion classification also allows `cli` and `non-ui`, but those are
10
- # not valid prototyping execution surfaces; see
11
- # `packages/qfai/src/core/prototyping/surfacePolicy.ts` — PROTOTYPING_SUPPORTED_SURFACES.)
8
+ # not valid prototyping execution surfaces.)
12
9
  surface: web
13
- mode_expectations:
14
- full-harness:
15
- expected_iterations: "2+"
16
- process: "measure -> score -> fix code -> re-run"
17
- calibration_ref: "qfai.config.yaml#prototyping.calibration"
@@ -2,12 +2,12 @@
2
2
 
3
3
  ## Exploration References
4
4
 
5
- | Ref | Type | Why it matters | Adopted points | Rejected points | Local translation |
6
- | ------- | ------- | -------------- | -------------- | --------------- | ----------------- |
7
- | REF-001 | Product | [why] | [adopted] | [rejected] | [translation] |
5
+ | Ref | Kind | Source URL | Why it matters | Adopted points | Rejected points | Local translation | Copy risk | Template usage policy |
6
+ | ------- | ---------- | ----------- | -------------- | -------------- | --------------- | ----------------- | --------- | --------------------- |
7
+ | REF-001 | competitor | https://... | ... | ... | ... | ... | medium | reference-only |
8
8
 
9
9
  ## Design Guideline Research
10
10
 
11
- | Ref | Guideline | Rule refs | Why it matters | Local translation |
12
- | ------ | ----------- | ----------- | -------------- | ----------------- |
13
- | GL-001 | [guideline] | [rule refs] | [why] | [translation] |
11
+ | Ref | Guideline | Rule refs | Why it matters | Local translation |
12
+ | ------ | --------- | --------- | -------------- | ----------------- |
13
+ | GL-001 | ... | ... | ... | ... |
@@ -60,7 +60,7 @@ Skill-specific examples:
60
60
 
61
61
  - This skill processes **one test at a time** from `test-list.md`.
62
62
  - Each item goes through the full TDD micro-cycle: write a **failing test** first, then make it pass, then refactor.
63
- - The execution ledger is located at `.qfai/specs/spec-XXXX/tdd/test-list.md`.
63
+ - The execution ledger is located at `.qfai/specs/<spec-id>/tdd/test-list.md`.
64
64
  - Items are processed **serially** by default. Parallel processing is allowed only when items target independent SUT slices with no shared state.
65
65
  - Status transitions follow a strict forward-only lifecycle: `todo` -> `red` -> `green` -> `refactor` -> `done`.
66
66
  - The `exception` status can be reached from any active status when an anomaly is detected.
@@ -76,13 +76,21 @@ Execute the TDD micro-cycle for each pending item in `test-list.md`, transitioni
76
76
 
77
77
  - Review rendered output, screenshot evidence, or HTML output before closing any UI-affecting item.
78
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` →
79
+ - Read order (v2.0, spec-0017 P11): `01_Spec.md` → `03_Acceptance-Criteria.md` → `05_Examples.md` →
80
80
  `.qfai/contracts/design/exploration-brief.yaml` →
81
- `.qfai/contracts/design/anchor-selection.yaml` (legacy alias, when present)
82
- `.qfai/contracts/design/evaluation-axes.yaml` (legacy alias, when present) →
83
- `.qfai/contracts/design/evaluation-rubric.yaml` → `.qfai/contracts/design/evaluator-calibration.yaml` →
84
- `.qfai/contracts/design/selected-direction.yaml` `.qfai/contracts/design/design-system.yaml` → `.qfai/contracts/ui/*.yaml` →
85
- optional design tokens → optional fallback mock → mermaid flows.
81
+ `.qfai/contracts/design/reference-pool.yaml` `.qfai/contracts/design/brand-design.yaml`
82
+ `.qfai/contracts/design/design-system.yaml` (extracted from final iter) →
83
+ `.qfai/contracts/design/prototype-handoff.yaml` → `.qfai/contracts/ui/*.yaml` →
84
+ canonical prototype evidence under `.qfai/evidence/prototyping/iter-NN/<screen>.{png,html}` →
85
+ `.qfai/prototypes/final/index.html`.
86
+ - The v1.x evaluation-rubric / evaluator-calibration / selected-direction contracts and
87
+ `prototypes/winner/index.html` were removed in spec-0017 P4/P8.
88
+ - Do not read discussion-pack UI/UX sidecars, fallback mocks, or legacy design aliases.
89
+ - Prototype HTML is analysis input, not production source. Reimplement with project-native
90
+ patterns while preserving the visual identity captured in `prototype-handoff.yaml`
91
+ `implementationNotes` (free-form prose); the v1.x mustPreserve / mayAdapt / mustNotCopy
92
+ three-category split is removed.
93
+ - UI-affecting items require product-surface-reviewer prototype parity review before `done`.
86
94
  - If code intent and rendered output diverge, treat the rendered/HTML result as the blocking review input and reconcile before DONE.
87
95
 
88
96
  ## Non-goals
@@ -94,7 +102,7 @@ Execute the TDD micro-cycle for each pending item in `test-list.md`, transitioni
94
102
 
95
103
  ## Execution Ledger: test-list.md
96
104
 
97
- The execution ledger at `.qfai/specs/spec-XXXX/tdd/test-list.md` tracks progress with these required columns:
105
+ The execution ledger at `.qfai/specs/<spec-id>/tdd/test-list.md` tracks progress with these required columns:
98
106
 
99
107
  | Column | Description |
100
108
  | --------- | -------------------------------------------------------- |
@@ -253,8 +261,9 @@ Use the shared schema (per-row `Status (PASS/REVISE)` column, reviewer response
253
261
  ## Completion Contract (Shared)
254
262
 
255
263
  Follow `.qfai/assistant/instructions/shared-skill-operating-baseline.md#completion-contract-shared`.
264
+ Follow `.qfai/assistant/instructions/shared-skill-operating-baseline.md#gate-failure-autorepair-protocol` for validate, doctor, and quality-gate failures.
256
265
 
257
- ### Item completion checklist (10-point gate)
266
+ ### Item completion checklist (11-point gate)
258
267
 
259
268
  An item in `test-list.md` may transition to `done` only when ALL of the following are satisfied:
260
269
 
@@ -266,8 +275,9 @@ An item in `test-list.md` may transition to `done` only when ALL of the followin
266
275
  6. Refactor was performed and GREEN was re-confirmed after refactor
267
276
  7. `completion-reviewer` returned PASS (spec / completion review gate)
268
277
  8. `implementation-reviewer` returned PASS (code quality review gate)
269
- 9. `test-list.md` Status and Evidence columns are updated with fresh evidence
270
- 10. Checkpoint verification passed
278
+ 9. UI-affecting items have prototype parity PASS from `product-surface-reviewer`
279
+ 10. `test-list.md` Status and Evidence columns are updated with fresh evidence
280
+ 11. Checkpoint verification passed
271
281
 
272
282
  ### Spec completion conditions
273
283
 
@@ -293,7 +303,7 @@ Completion MUST NOT be declared when any of the following are true:
293
303
 
294
304
  ## Evidence (MANDATORY)
295
305
 
296
- Create/update: `.qfai/evidence/implement-spec-XXXX.md`
306
+ Create/update: `.qfai/evidence/implement-<spec-id>.md`
297
307
 
298
308
  Required sections:
299
309
 
@@ -317,6 +327,7 @@ Each TDD item MUST have fresh evidence containing at minimum:
317
327
  - `Refactor verify result` — the output confirming GREEN is maintained
318
328
  - `Spec review` — completion-reviewer result (PASS or FAIL)
319
329
  - `Code quality review` — implementation-reviewer result (PASS or FAIL)
330
+ - `Prototype parity` — product-surface-reviewer result for UI-affecting items (PASS or REVISE)
320
331
 
321
332
  ### Evidence hard rules
322
333
 
@@ -1,21 +1,10 @@
1
1
  ---
2
2
  name: qfai-prototyping
3
- title: QFAI Prototyping (Exploration-First Harness)
4
- description: "Run a planner/generator/evaluator UI harness with a 5→3→2→1 direction funnel, breakthrough detection, and final design-system extraction."
5
- argument-hint: "[--auto]"
3
+ title: QFAI Prototyping (Single-Thread Design Evolution Loop)
4
+ description: "Iterate one prototype through up to 15 cycles of generate-capture-review with explicit pivot permission, until 4 axes reach exceptional or the budget is exhausted."
5
+ argument-hint: ""
6
6
  allowed-tools: [Read, Glob, Write, TodoWrite, Task, Bash]
7
- roles:
8
- [
9
- orchestrator,
10
- delivery-planner,
11
- product-experience-architect,
12
- frontend-engineer,
13
- backend-engineer,
14
- devops-ci-engineer,
15
- completion-reviewer,
16
- product-surface-reviewer,
17
- qa-gatekeeper,
18
- ]
7
+ roles: [orchestrator, product-experience-architect, product-surface-reviewer, devops-ci-engineer]
19
8
  routing-profile: ui-surface-aware
20
9
  mode: execution-focused
21
10
  ---
@@ -24,341 +13,98 @@ mode: execution-focused
24
13
 
25
14
  [DRIFT-PROTOCOL:MANDATORY]
26
15
 
27
- This skill owns prototyping orchestration directly.
28
- Do not rely on a CLI entrypoint or package runtime loop.
16
+ This skill runs one prototype through up to 15 iterations. There is no funnel, no parallel candidates, no mode. Iteration count is fixed at 15.
29
17
 
30
- ## CRITICAL CONSTRAINTS (Read First)
31
-
32
- - Scope is all specs from `.qfai/specs/spec-*`.
33
- - The AI evaluator sub-agent performs visual evaluation. QFAI does not score visual quality. (per the resolved primary prototyping spec — see `qfai prototyping show-spec`)
34
- - Playwright CLI (`playwright-cli`) is the sole standard browser tool. Playwright MCP, Node Playwright direct invocation, and screenshot-capture shell scripts are not used. (per the resolved primary prototyping spec)
35
- - QFAI pre-assigns evidence paths. The evaluator MUST use the paths in the command plan (`review-bundle.json` → `command-plans.json`); it MUST NOT invent paths.
36
- - For every declared screen and every active candidate in every round, 4 evidence artifacts are mandatory:
37
- - screenshot: `.qfai/evidence/prototyping/rounds/<round>/candidates/<candidate-id>/<screen-id>.png`
38
- - HTML: `.qfai/evidence/prototyping/rounds/<round>/candidates/<candidate-id>/<screen-id>.html`
39
- - accessibility snapshot: `.qfai/evidence/prototyping/rounds/<round>/candidates/<candidate-id>/<screen-id>.snapshot.txt`
40
- - command log: `.qfai/evidence/prototyping/rounds/<round>/candidates/<candidate-id>/<screen-id>.commands.json`
41
- - Canonical latest screenshot path: `.qfai/evidence/prototyping/screenshots/<screen-id>.png`
42
- - Canonical latest HTML path: `.qfai/evidence/prototyping/html/<screen-id>.html`
43
- - Canonical latest paths MUST mirror the latest accepted winner/polish artifacts.
44
- - If any of the 4 artifacts is missing for a declared screen, the round is incomplete; rerun is mandatory, not waiver.
45
- - Mode differences are limited to `maxCycles` only (low-cost=1, standard=3, full-harness=20). Every other gate, obligation, reviewer severity, and completion criterion is identical across modes. (per the resolved primary prototyping spec)
46
- - DONE is forbidden until `qfai validate --profile prototyping --fail-on error` passes and `/qfai-verify` can approve the run.
47
- - Supported UI prototyping surfaces are `web`, `mobile`, `desktop`, and `mixed`.
48
- - `cli`, API-only, backend-only, and `ui_bearing: false` classifications are not prototyping execution targets.
49
- - Machine checks are limited to schema/evidence validation, mode invariant enforcement, review-cycle completeness, and breakthrough trigger detection.
50
- - Shared evidence vocabulary: `prototyping.json`, `review-bundle.json`, `command-plans.json`, `evaluator-reviews/<candidate-id>.json`, `harvest.json`, `absorption-plan.json`, `reimplementation.json`, `breakthrough.json`.
51
- - Direction funnel completion is not stage completion.
52
- - Selecting the first winner does not satisfy completion. Completion review is forbidden until at least one post-selection polish cycle has completed.
53
- - Completion requires every reviewer sub-agent to score every evaluation axis at `100/100`; `95` is not a completion border.
54
- - Do not use `complete`, `completed`, `done`, or equivalent completion wording in other languages before the completion checklist passes. Use `exploration complete`, `winner selected`, `polishing`, `breakthrough checking`, or `reviewer gate pending` for interim states.
18
+ The workflow is static-first and file-based by default. Supported UI prototyping surfaces are: web, mobile, desktop, mixed. `cli` is not a prototyping execution target and is rejected. `ui_bearing: false` specs are excluded from prototyping execution.
55
19
 
56
20
  ## Goal
57
21
 
58
- Generate multiple design directions, converge on a winner, extract the selected direction and final design system, and keep the winner open to breakthrough pivots during later polish iterations.
59
-
60
- ## Surface / Mode
61
-
62
- - surface / mode routing uses `standard` as the default execution path.
63
- - **Mode Invariant**: modes differ only by `maxCycles`. Review gate, evidence requirements, reviewer severity, best-of-history, breakthrough detection, and completion criteria are identical across modes.
64
- - `low-cost`: `maxCycles = 1`
65
- - `standard`: `maxCycles = 3` (default)
66
- - `full-harness`: `maxCycles = 20`
67
- - No mode weakens obligations. Choosing a lower mode buys fewer chances to iterate, not a looser gate.
22
+ Produce an artifact in which a creative breakthrough has emerged through serial iteration — the kind of self-driven "scrap and reimagine" that arises when the model accumulates enough critique signal that staying on the current path is worse than rebuilding (Anthropic Dutch art museum pattern).
68
23
 
69
24
  ## Required References
70
25
 
71
- Read and follow these references before execution:
26
+ - `references/iteration-loop.md` flow + evidence paths
27
+ - `references/generator-prompt.md` — generator system prompt + pivot permission
28
+ - `references/reviewer-prompt.md` — reviewer output schema + global anti-slop list
29
+ - `references/handoff.md` — design-system extraction + handoff yaml
72
30
 
73
- - **Primary SSOT for the prototyping harness**: resolve at runtime by running
74
- `qfai prototyping show-spec` from the repo root. The output gives you the
75
- resolved spec ID and `01_Spec.md` path (configured via
76
- `qfai.config.yaml: prototyping.primarySpecId`, or auto-detected via the
77
- `surface_type: ui-bearing` marker in `01_Spec.md`). Do not assume any
78
- particular spec ID exists — read whatever `show-spec` returns.
79
- - `.qfai/assistant/skills/qfai-prototyping/references/evidence-requirements.md`
80
- - `.qfai/assistant/skills/qfai-prototyping/references/iteration-cycle.md`
81
- - `.qfai/assistant/skills/qfai-prototyping/references/l1-review-guide.md`
82
- - `.qfai/assistant/skills/qfai-prototyping/references/l2-review-guide.md`
83
- - `.qfai/contracts/design/anchor-selection.yaml` when legacy validator slices are exercised
84
- - `.qfai/contracts/design/evaluation-axes.yaml` when legacy validator slices are exercised
85
- - `.qfai/assistant/skills/qfai-prototyping/references/design-system-compliance.md`
86
- - `.qfai/assistant/skills/qfai-prototyping/references/reviewer-gate.md`
87
- - `.qfai/assistant/steering/test-layers.md`
88
-
89
- ## Delegation Scope Table
31
+ ## Required Contracts
90
32
 
91
- All sub-agent delegation in this skill MUST follow the category-to-role mapping below.
92
- Assigning a task to a role not listed for the category is a violation and MUST be flagged.
93
- Evaluation scoring and screenshot capture must use only the allowed roles below.
94
-
95
- | Category | Allowed Role(s) |
96
- | ---------------------------------- | ------------------------------------------------------ |
97
- | UI implementation | frontend-engineer, product-experience-architect |
98
- | Playwright CLI execution & capture | product-surface-reviewer, product-experience-architect |
99
- | Evaluation scoring | product-surface-reviewer, product-experience-architect |
100
- | Build | devops-ci-engineer, backend-engineer |
101
- | Breakthrough planning | product-experience-architect, frontend-engineer |
102
-
103
- 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.
104
-
105
- ## Required Process
106
-
107
- ### Step 0 — Execution Plan
108
-
109
- Before any code is written, create an execution plan record in the work evidence.
110
-
111
- Required fields:
112
-
113
- - `targetRounds`: ordered array; default funnel is `["r5", "r3", "r2", "r1"]`
114
- - `funnelPolicy`: `5->3->2->1`
115
- - `evaluationAxesSource`: ref to `.qfai/contracts/design/evaluation-rubric.yaml`
116
- - `delegationMap`: category-to-role assignments per Delegation Scope Table
117
- - `plannedAt`: ISO-8601 timestamp
118
-
119
- ### Step 1 — Read Inputs
120
-
121
- Read the downstream-ready spec/contract inputs and verify:
122
-
123
- - `.qfai/specs/<spec-id>/01_Spec.md`
124
- - `.qfai/specs/<spec-id>/03_Acceptance-Criteria.md`
125
- - `.qfai/contracts/design/exploration-brief.yaml`
126
- - `.qfai/contracts/design/evaluation-rubric.yaml`
127
- - `.qfai/contracts/design/evaluator-calibration.yaml`
128
- - `.qfai/contracts/design/anchor-selection.yaml` when legacy validator slices are exercised
129
- - `.qfai/contracts/design/evaluation-axes.yaml` when legacy validator slices are exercised
130
- - `.qfai/contracts/design/selected-direction.yaml` when already created
131
- - `.qfai/contracts/design/design-system.yaml` when already created
33
+ - `.qfai/specs/spec-*/{01_Spec.md, 03_Acceptance-Criteria.md}`
132
34
  - `.qfai/contracts/ui/*.yaml`
35
+ - `.qfai/contracts/design/exploration-brief.yaml`
36
+ - `.qfai/contracts/design/reference-pool.yaml`
37
+ - `.qfai/contracts/design/brand-design.yaml`
133
38
 
134
- Read order:
135
-
136
- 1. `.qfai/specs/<spec-id>/01_Spec.md`
137
- 2. `.qfai/specs/<spec-id>/03_Acceptance-Criteria.md`
138
- 3. `.qfai/contracts/design/exploration-brief.yaml`
139
- 4. `.qfai/contracts/design/evaluation-rubric.yaml`
140
- 5. `.qfai/contracts/design/evaluator-calibration.yaml`
141
- 6. `.qfai/contracts/design/anchor-selection.yaml` (legacy validator alias, when present)
142
- 7. `.qfai/contracts/design/evaluation-axes.yaml` (legacy validator alias, when present)
143
- 8. `.qfai/contracts/design/selected-direction.yaml`
144
- 9. `.qfai/contracts/design/design-system.yaml`
145
- 10. `.qfai/contracts/ui/*.yaml`
146
-
147
- ### Step 2 — Verify Execution Preconditions
148
-
149
- Confirm all of the following before any evaluation:
150
-
151
- - classification is UI-bearing
152
- - surface is `web`, `mobile`, `desktop`, or `mixed`
153
- - every declared screen has a stable `screen-id`
154
- - the exploration brief, evaluation rubric, and evaluator calibration contracts satisfy the required schema
155
-
156
- ### Step 3 — Generate Divergent Directions
157
-
158
- Generate 5 clearly distinct design directions before selecting a winner.
159
- Do not begin with a single incumbent direction.
160
-
161
- ### Step 4 — Round Start: Prepare Candidate Review Bundle & Command Plans
162
-
163
- Before launching the evaluator, prepare the round-scoped artifacts via QFAI (not by hand):
164
-
165
- - Run `qfai prototyping round-start --round <rN> --candidates <csv> --target-url <url> --mode <mode>`.
166
- - QFAI produces:
167
- - `.qfai/evidence/prototyping/rounds/<rN>/command-plans.json` — the candidate-aware Playwright CLI command plans
168
- - `.qfai/evidence/prototyping/rounds/<rN>/review-bundle.json` — the evaluator input bundle (candidates, axisDefs, designSystemChecklist, commandPlanRef)
169
- - Do not invent evidence paths. Paths are fixed by QFAI per the resolved primary prototyping spec.
170
-
171
- ### Step 5 — AI Evaluator Executes the Command Plans and Captures Evidence
172
-
173
- For every declared screen of every active candidate in the current round, the AI evaluator sub-agent:
174
-
175
- 1. Reads `command-plans.json` for the round
176
- 2. Runs `playwright-cli goto <url>` for the candidate route
177
- 3. Runs `playwright-cli snapshot --save <candidate-path>/<screen-id>.snapshot.txt`
178
- 4. Performs interaction commands (click/fill) to exercise `primaryTasks` noted in the plan
179
- 5. Runs `playwright-cli screenshot --full-page --save <candidate-path>/<screen-id>.png`
180
- 6. Runs `playwright-cli eval "document.documentElement.outerHTML" > <candidate-path>/<screen-id>.html`
181
- 7. Saves the sequence of executed commands to `<candidate-path>/<screen-id>.commands.json`
182
-
183
- If any capture step fails, the evaluator records the failure and stops pretending the screen was evaluated. The round is incomplete and must be rerun.
184
-
185
- ### Step 6 — Launch Evaluation Reviewers
186
-
187
- Launch evaluation reviewer sub-agents with the full context bundle. Inputs are read from `review-bundle.json`:
188
-
189
- - per-screen screenshot, HTML, accessibility snapshot, and command log under `rounds/<round>/candidates/<candidate-id>/`
190
- - `axisDefs` (from `.qfai/contracts/design/evaluation-rubric.yaml`)
191
- - `previousScore` from the prior round when available
192
- - `designSystemChecklist` (from `.qfai/contracts/design/design-system.yaml`)
193
- - `commandPlanRef` pointing at `command-plans.json`
194
-
195
- The reviewer writes `rounds/<round>/evaluator-reviews/<candidate-id>.json` with concrete `evidenceRefs[]` for every score. Placeholder refs are rejected.
196
-
197
- ### Step 7 — Harvest and Direction Funnel
198
-
199
- Run the mandatory convergence funnel:
200
-
201
- - `r5`: 5 directions -> top 3
202
- - `r3`: top 3 remixed -> top 2
203
- - `r2`: top 2 -> selected winner `r1`
204
-
205
- At the end of each harvestable round:
206
-
207
- - run `qfai prototyping round-harvest --round <rN>`
208
- - record survivors with `qfai prototyping round-narrow --round <rN> --survivors <csv>`
209
- - for `r3|r2|r1`, generate absorption templates with `qfai prototyping round-absorb --round <rN> --survivors <csv>`
210
-
211
- ### Step 8 — Extract Winner Contracts
212
-
213
- After the first winner is selected:
214
-
215
- - write `.qfai/contracts/design/selected-direction.yaml`
216
- - extract `.qfai/contracts/design/design-system.yaml`
217
-
218
- Selecting the first winner is not completion. Do not start completion review and do not use completion wording until Step 9, Step 10, Step 12, reviewer gate, and the perfect-100 score gate pass.
219
-
220
- ### Step 9 — Polish the Winner
221
-
222
- Iterate on the selected winner with normal critique/rework loops.
223
- Do not assume the latest iteration is automatically best; keep best-of-history in evidence.
224
- At least one full post-selection polish loop is mandatory. Each polish loop must include critique, fix, re-capture, re-review, and breakthrough check evidence.
225
-
226
- ## Cycle Gate
39
+ `reference-pool.yaml` is read as **deviate-from**, not imitate-this.
227
40
 
228
- - Completion requires at least one `polish` cycle after winner selection (per the resolved primary prototyping spec). This applies to all modes.
229
- - The same gate applies in every mode; modes differ only in `maxCycles` (low-cost=1, standard=3, full-harness=20).
230
- - If the polish-cycle budget is exhausted before the gate is satisfied, the run does NOT complete. The evaluator returns `REVISE` and the developer may re-run at a higher mode.
231
- - Any phase transition to completion must pass through the cycle gate and the reviewer gate.
41
+ ## Required Process
232
42
 
233
- ### Step 10Breakthrough Detection
43
+ ### Step 2-AVerify Contract Preconditions
234
44
 
235
- After each polish iteration, run the mechanical breakthrough detector.
236
- If `allReviewerAxesPerfect100` is false and score improvement is below the configured plateau threshold and code change is below the configured diff threshold, trigger breakthrough branching.
45
+ - Confirm the selected spec is UI-bearing and has a supported `surface` value.
46
+ - Confirm `.qfai/contracts/ui/*.yaml` and design contracts exist before generation.
47
+ - Run `qfai prototyping preflight --target-url <url>` or `qfai doctor --profile prototyping`.
237
48
 
238
- ### Step 11Breakthrough Branch Loop
49
+ ### Step 2-BVerify Environment Preconditions
239
50
 
240
- When breakthrough is triggered:
51
+ - Confirm a capture route exists for each declared screen.
52
+ - Use `npx --no-install playwright-cli` or `node_modules/.bin/playwright-cli` when PATH reachability is uncertain.
241
53
 
242
- - generate exactly 2 branch directions
243
- - compare incumbent + 2 branches
244
- - replace the mainline if a branch wins
245
- - refresh selected-direction/design-system if the winner changes
246
- - record the decision in `.qfai/evidence/breakthrough.json`
54
+ 1. **Seed (cycle 0)**
55
+ - Run `qfai prototyping iterate --cycle 0 --target-url <url>`.
56
+ - Generator (product-experience-architect) reads contracts + `references/generator-prompt.md`.
57
+ - Generator writes `.qfai/prototypes/iter-00/index.html` (one self-contained file).
58
+ - Capture + review (steps 2-a / 2-b).
59
+ - Append entry to `prototyping.json#iterations[]`. Commit `prototyping: iter-00`.
247
60
 
248
- ### Step 12 — Validate and Verify
61
+ 2. **Loop (cycle 1..14)**
62
+ - **(a) Capture** (devops-ci-engineer): playwright-cli writes `iter-NN/<screen>.{png,html}`.
63
+ - **(b) Review** (product-surface-reviewer): per `references/reviewer-prompt.md`, write `iter-NN/review.json` with 4-axis ordinal scores, 200–500 word prose critique, `slopPatternsDetected[]`, and `pivotDirective`.
64
+ - **(c) Update** `prototyping.json#iterations[]` and `progress.md`. Commit `prototyping: iter-NN`.
65
+ - **(d) Iterate**: run `qfai prototyping iterate --cycle <n+1>`.
66
+ - exit `0` → continue. Generator reads `pivotDirective` and produces iter-(n+1).
67
+ - exit `64` → all axes exceptional, go to step 3.
68
+ - exit `65` → 15 cycles reached, go to step 3.
249
69
 
250
- - Run `qfai validate --profile prototyping --fail-on error`.
251
- - Route `/qfai-verify` or its equivalent gate workflow for final quality approval.
252
- - Do not declare completion until the reviewer result is `PASS`.
70
+ 3. **Handoff**
71
+ - Mirror latest iter to `.qfai/prototypes/final/index.html`.
72
+ - Per `references/handoff.md`: extract `design-system.yaml`, write `prototype-handoff.yaml`.
73
+ - Run `qfai prototyping certify`.
74
+ - Run `qfai validate --profile prototyping --fail-on error` and `/qfai-verify`.
253
75
 
254
76
  ## Evaluator Inputs (Mandatory)
255
77
 
256
- Evaluation reviewer sub-agents MUST be launched with the `review-bundle.json` for the current round. The bundle contains all required inputs. At a minimum, the bundle MUST reference:
257
-
258
- 1. screenshots (per declared screen, round/candidate path)
259
- 2. HTML snapshots (per declared screen, round/candidate path)
260
- 3. accessibility snapshots (`<screen-id>.snapshot.txt` per declared screen, round/candidate path)
261
- 4. Playwright CLI command log (`<screen-id>.commands.json` per declared screen, round/candidate path)
262
- 5. `axisDefs` from `.qfai/contracts/design/evaluation-rubric.yaml`
263
- 6. `previousScore` from the prior round when available
264
- 7. `designSystemChecklist` from `.qfai/contracts/design/design-system.yaml`
265
- 8. `commandPlanRef` pointing at `command-plans.json`
266
-
267
- The evaluator writes `evaluator-reviews/<candidate-id>.json` with per-axis `score`, `rationale`, and `evidenceRefs[]`. Every `evidenceRefs[]` entry MUST point to an existing artifact; placeholder strings (`""`, `"tbd"`, `"TBD"`) are rejected by `qfai validate`.
268
-
269
- ## Visual Quality Structural Checklist
78
+ - Screenshot evidence path: `.qfai/evidence/prototyping/iter-NN/<screen>.png`
79
+ - HTML snapshot path: `.qfai/evidence/prototyping/iter-NN/<screen>.html`
80
+ - Review inputs: latest screenshot, latest HTML snapshot, prior `review.json` files, `progress.md`, and `reference-pool.yaml` as deviate-from input.
270
81
 
271
- Each iteration evaluation MUST score all 6 visual categories:
82
+ ## Critical Constraints
272
83
 
273
- 1. Design quality
274
- 2. Originality
275
- 3. Craft
276
- 4. Functionality
277
- 5. Accessibility risk
278
- 6. Implementation plausibility
84
+ - DO NOT generate parallel candidates. One lineage only.
85
+ - DO NOT preserve elements out of caution; the latest iter is always accepted.
86
+ - DO NOT declare DONE before `qfai prototyping certify --check` returns 0.
87
+ - DO NOT add `mode/round/polish/branch/concept-fit/design-system-compliance` artifacts.
88
+ - DO NOT score similarity to `reference-pool` positively; it is deviate-from input.
279
89
 
280
- ### Reviewer Gate (MUST)
281
-
282
- Reviewer checks are defined in:
283
-
284
- - `.qfai/assistant/skills/qfai-prototyping/references/reviewer-gate.md`
285
- - `.qfai/assistant/steering/test-layers.md`
286
-
287
- Minimum reviewer responsibilities:
288
-
289
- - enforce the Drift Protocol before approving a completion transition
290
- - verify mandatory screenshot/HTML evidence exists for every declared screen
291
- - verify exploration brief, evaluation rubric, and evaluator calibration were used
292
- - verify missing evidence caused rerun rather than waiver
293
- - verify `qfai validate --profile prototyping --fail-on error` completed successfully
294
- - verify breakthrough trigger evidence is present
295
- - verify best-of-history handling is documented
296
- - verify at least one post-selection polish iteration completed after winner selection
297
- - verify every reviewer sub-agent scored every evaluation axis at `100/100`
298
- - reject completion claims based on any 95-point threshold
299
- - treat score/volume heuristics as signals, not gates
300
- - return `Result: PASS | REVISE`
301
-
302
- ## Sub-agent Delegation (MANDATORY)
303
-
304
- Follow `.qfai/assistant/instructions/shared-skill-delegation-baseline.md`.
305
-
306
- ### Orchestrator Protocol (MUST)
307
-
308
- - do not self-approve
309
- - keep evidence paths canonical
310
- - integrate delegated results only
311
-
312
- ### Capability Probe (MUST)
313
-
314
- - No additional overrides.
315
-
316
- ### Delegation Failure (Hard Stop)
317
-
318
- - No additional overrides.
319
- - Do not simulate roles. If the first required delegation fails, stop the stage and report remediation.
320
-
321
- ## Work Orders Summary
322
-
323
- Use the shared schema (per-row `Status (PASS/REVISE)` column, reviewer response `Result: PASS | REVISE`).
324
-
325
- ## Completion Contract (Shared)
326
-
327
- Follow `.qfai/assistant/instructions/shared-skill-operating-baseline.md#completion-contract-shared`.
90
+ ## Delegation Scope Table
328
91
 
329
- Prototyping-specific additions (apply to all modes identically):
92
+ | Work | Allowed Role |
93
+ | ---------------------------------- | ---------------------------- |
94
+ | Generation | product-experience-architect |
95
+ | Playwright CLI execution & capture | devops-ci-engineer |
96
+ | Evaluation scoring | product-surface-reviewer |
330
97
 
331
- - all specs are covered
332
- - all declared screens have 4 artifacts per active candidate / round: screenshot, HTML, accessibility snapshot, Playwright CLI command log
333
- - canonical latest paths mirror the latest accepted winner/polish state
334
- - `review-bundle.json`, `command-plans.json`, and per-candidate evaluator reviews exist for every round
335
- - `selected-direction.yaml` exists
336
- - `design-system.yaml` exists
337
- - `breakthrough.json` exists
338
- - `bestOfHistory` and `breakthrough` sections present in `prototyping.json`
339
- - at least one post-selection polish cycle completed after winner selection
340
- - every reviewer sub-agent scored every evaluation axis at `100/100`
341
- - independent reviewer gate returned `PASS`
342
- - `qfai validate --profile prototyping --fail-on error` passes
98
+ ### Reviewer Gate
343
99
 
344
- ## FINAL CHECKLIST (Check Last)
100
+ - Check Drift Protocol compliance before DONE.
101
+ - Check `.qfai/assistant/steering/test-layers.md` alignment.
102
+ - Treat reviewer findings as signals, not gates, unless certify/validate/verify fails.
345
103
 
346
- - All specs are covered in the Coverage Matrix.
347
- - Every declared screen has screenshot, HTML, accessibility snapshot, and command log evidence per active candidate / round.
348
- - Canonical latest paths mirror the latest accepted winner/polish artifacts.
349
- - Mode invariant: `maxCycles` is the only mode-dependent field in `prototyping.json` (validated by `QFAI-PROT-MODE-001`).
350
- - Missing evidence triggered rerun instead of waiver.
351
- - Direction funnel `5->3->2->1` completed.
352
- - Direction funnel completion was not treated as stage completion.
353
- - At least one post-selection polish cycle completed with critique/fix/re-capture/re-review/breakthrough checks.
354
- - Every reviewer sub-agent scored every evaluation axis at `100/100`.
355
- - Breakthrough detector ran after polish cycles.
356
- - Independent reviewer returned PASS; otherwise status is REVISE.
104
+ ## Completion
357
105
 
358
- ## Completion Message & Next Actions (MUST)
106
+ DONE = `completion-certificate.json` exists AND `qfai prototyping certify --check` returns 0 AND `/qfai-verify` returns PASS.
359
107
 
360
- Action:
108
+ ## Next
361
109
 
362
- - Proceed: `/qfai-atdd`
363
- - Quality gate: `/qfai-verify`
364
- - Rework prototyping: rerun `/qfai-prototyping` with corrected screenshot/HTML evidence
110
+ - `/qfai-atdd` / `/qfai-implement` / `/qfai-verify`