qfai 1.7.14 → 1.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/README.md +30 -5
  2. package/assets/init/.qfai/assistant/instructions/agent-selection.md +2 -0
  3. package/assets/init/.qfai/assistant/instructions/shared-skill-delegation-baseline.md +88 -0
  4. package/assets/init/.qfai/assistant/instructions/shared-skill-operating-baseline.md +49 -0
  5. package/assets/init/.qfai/assistant/skills/qfai-atdd/SKILL.md +28 -88
  6. package/assets/init/.qfai/assistant/skills/qfai-configure/SKILL.md +50 -114
  7. package/assets/init/.qfai/assistant/skills/qfai-discussion/SKILL.md +134 -231
  8. package/assets/init/.qfai/assistant/skills/qfai-discussion/references/design-md-brand-catalog.md +90 -0
  9. package/assets/init/.qfai/assistant/skills/qfai-discussion/references/discussion-completion-matrix.md +26 -0
  10. package/assets/init/.qfai/assistant/skills/qfai-discussion/references/discussion-coverage-checklist.md +20 -0
  11. package/assets/init/.qfai/assistant/skills/qfai-discussion/references/example-mapping-guide.md +18 -0
  12. package/assets/init/.qfai/assistant/skills/qfai-discussion/references/oq-and-deferred-rules.md +41 -0
  13. package/assets/init/.qfai/assistant/skills/qfai-discussion/references/review-cycle-playbook.md +22 -0
  14. package/assets/init/.qfai/assistant/skills/qfai-discussion/references/ui-bearing-playbook.md +50 -0
  15. package/assets/init/.qfai/assistant/skills/qfai-discussion/references/ui_ux/platform_baselines.md +107 -0
  16. package/assets/init/.qfai/assistant/skills/qfai-discussion/references/ui_ux/review_audit_playbook.md +104 -0
  17. package/assets/init/.qfai/assistant/skills/qfai-discussion/references/ui_ux/trend_scan_playbook.md +76 -0
  18. package/assets/init/.qfai/assistant/skills/qfai-discussion/references/ui_ux_best_practices.md +143 -1005
  19. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/04_Sources.md +79 -28
  20. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/prototyping.yaml +12 -4
  21. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/uiux/12_design_system.md +115 -0
  22. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/uiux/21_design_eval_trend_derived.md +86 -24
  23. package/assets/init/.qfai/assistant/skills/qfai-implement/SKILL.md +22 -26
  24. package/assets/init/.qfai/assistant/skills/qfai-prototyping/SKILL.md +141 -381
  25. package/assets/init/.qfai/assistant/skills/qfai-sdd/SKILL.md +118 -355
  26. package/assets/init/.qfai/assistant/skills/qfai-sdd/references/review-cycle-playbook.md +30 -0
  27. package/assets/init/.qfai/assistant/skills/qfai-sdd/references/sdd-execution-playbook.md +29 -0
  28. package/assets/init/.qfai/assistant/skills/qfai-sdd/references/sdd-phase-checklists.md +37 -0
  29. package/assets/init/.qfai/assistant/skills/qfai-sdd/references/sdd-quality-gate.md +32 -0
  30. package/assets/init/.qfai/assistant/skills/qfai-sdd/references/spec-traceability-rules.md +33 -0
  31. package/assets/init/.qfai/assistant/skills/qfai-verify/SKILL.md +50 -115
  32. package/assets/init/.qfai/assistant/skills/web-research/SKILL.md +323 -0
  33. package/assets/init/.qfai/assistant/steering/agent-routing.yml +20 -8
  34. package/assets/init/.qfai/assistant/steering/ui-definition-protocol.md +6 -6
  35. package/assets/init/.qfai/contracts/README.md +15 -8
  36. package/assets/init/.qfai/contracts/ui/README.md +23 -25
  37. package/assets/init/.qfai/discussion/README.md +23 -12
  38. package/assets/init/.qfai/evidence/README.md +65 -190
  39. package/assets/init/.qfai/evidence/calibration.yaml +26 -0
  40. package/assets/init/.qfai/review/README.md +62 -11
  41. package/assets/init/.qfai/review_archive/.gitignore +3 -0
  42. package/assets/init/.qfai/review_archive/README.md +30 -0
  43. package/assets/init/.qfai/specs/README.md +2 -2
  44. package/assets/init/root/qfai.config.yaml +5 -6
  45. package/assets/mcp-templates/brave-search/.mcp.json +11 -0
  46. package/assets/mcp-templates/brave-search/config.toml +6 -0
  47. package/assets/mcp-templates/brave-search/mcp-config.json +9 -0
  48. package/assets/mcp-templates/firecrawl/.mcp.json +13 -0
  49. package/assets/mcp-templates/firecrawl/config.toml +10 -0
  50. package/assets/mcp-templates/firecrawl/mcp-config.json +11 -0
  51. package/assets/mcp-templates/playwright/.mcp.json +8 -0
  52. package/assets/mcp-templates/playwright/config.toml +3 -0
  53. package/assets/mcp-templates/playwright/mcp-config.json +6 -0
  54. package/assets/sandbox-templates/default-deny.yaml +53 -0
  55. package/assets/scripts/capture-screenshots.js +128 -0
  56. package/dist/cli/index.cjs +8313 -4699
  57. package/dist/cli/index.cjs.map +1 -1
  58. package/dist/cli/index.mjs +8308 -4694
  59. package/dist/cli/index.mjs.map +1 -1
  60. package/dist/index.cjs +7732 -4176
  61. package/dist/index.cjs.map +1 -1
  62. package/dist/index.d.cts +393 -216
  63. package/dist/index.d.ts +393 -216
  64. package/dist/index.mjs +7720 -4177
  65. package/dist/index.mjs.map +1 -1
  66. package/package.json +1 -1
  67. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/uiux/20_trend_scan.md +0 -41
package/README.md CHANGED
@@ -17,8 +17,12 @@ The agent reads the repository, produces the required artifacts, and iterates un
17
17
 
18
18
  ## Release status
19
19
 
20
- - Current package version: `1.7.14`
21
- - Release posture: v1.7.14 converges init assets, validators, and docs on the canonical sidecar model.
20
+ - Current package version: `1.7.15`
21
+ - Release posture: v1.7.15 enforces runtime truthfulness.
22
+ - Prototyping is UI-only; `full-harness` is measurement-driven iteration accumulation for UI-bearing surfaces only.
23
+ - Runtime observation is observed-only (no synthetic 200 / API / DB prototyping coverage).
24
+ - Browser QA is mandatory per screen in full-harness, and `actionsWired` reports action coverage rather than finding count.
25
+ - Calibration SSOT is the calibration pack referenced by `calibrationRef.packPath`.
22
26
  - Current repo note: some repo-wide `qfai validate --fail-on error` blockers still come from historical review/evidence/ATDD/TDD artifacts and are being cleaned incrementally.
23
27
 
24
28
  ## Quick start
@@ -54,8 +58,27 @@ npx qfai report
54
58
  - `npx qfai doctor`
55
59
  - Diagnoses configuration discovery, path resolution, glob scanning, and `validate.json` inputs before running validate/report; use `--fail-on` to enforce failures in CI.
56
60
  Note: prototyping evidence (`.qfai/evidence/prototyping.json`) is produced by the AI workflow / skills
57
- (`/qfai-prototyping` with `mode=low-cost|standard|full-harness`), not by a CLI command.
61
+ (`/qfai-prototyping` with `mode=full-harness` for supported UI surfaces only), not by a general-purpose end-user CLI flow.
58
62
  `qfai validate` consumes the resulting evidence files, including `mode.effective` and `fullHarness` metadata when present.
63
+ Traceability refs inside prototyping evidence must use repo-root-relative concrete artifact refs (for example `.qfai/specs/spec-0001/01_Spec.md#L3` or `.qfai/evidence/render.json#/screens/0`).
64
+ Absolute paths are invalid. The same strict ref grammar is enforced for top-level and leaf evidence-bearing fields, including
65
+ `runtimeGate.evidenceRefs`, `runtimeGate.ui[].declaredRef`, `runtimeGate.ui[].renderEvidenceRefs[]`,
66
+ `runtimeGate.ui[].browserQaEvidenceRefs[]`, `specs[].coverageRefs[].declaredRef`, `specs[].coverageRefs[].observedRefs[]`,
67
+ `fullHarness.iterations[].evidenceRefs.runtimeGate`, `fullHarness.iterations[].evidenceRefs.specCoverage`,
68
+ `fullHarness.iterations[].evidenceRefs.render`, `fullHarness.iterations[].evidenceRefs.browserQa`,
69
+ `fullHarness.iterations[].evidenceRefs.uiObservation`, `fullHarness.iterations[].evidenceRefs.discussion`,
70
+ `fullHarness.iterations[].evidenceRefs.screenContract`, `fullHarness.iterations[].evidenceRefs.trend`,
71
+ `fullHarness.iterations[].l1.axes[].evidenceRefs[]`, `fullHarness.iterations[].l2.axes[].evidenceRefs[]`, and
72
+ `fullHarness.reviewerLogs[].evidenceRefs[]`.
73
+ Semantic rules are also strict: `runtimeGate.ui[].declaredRef` and `fullHarness.iterations[].evidenceRefs.screenContract[]`
74
+ must use the canonical screen contract sourceRef `.qfai/discussion/<pack>/uiux/40_screen_contracts.md#<screenId>`,
75
+ and `specs[].coverageRefs[].declaredRef` must use the canonical spec declaration form
76
+ `.qfai/specs/<specId>/01_Spec.md#L<line>` (for example `.qfai/specs/spec-0001/01_Spec.md#L3`);
77
+ `notes.md`, `appendix.md`, anchor-fragment forms such as `#route-home`, discussion refs, and screen contract refs
78
+ are NOT valid `declaredRef` values.
79
+ `fullHarness` follows a terminal-first state machine: `status="in-progress"` requires `finalDecision="pending"`,
80
+ `reviewerSignoff.status="pending"`, and no `terminationReason`; `status="completed"` requires `terminationReason`,
81
+ a non-pending `finalDecision`, and a terminal `reviewerSignoff`.
59
82
 
60
83
  ## ATDD annotation hard gate
61
84
 
@@ -89,7 +112,7 @@ QFAI includes a small set of custom skills (stored under `.qfai/assistant/skills
89
112
  as 15 required markdown files under `.qfai/discussion/discussion-<ts>/`.
90
113
  UI-bearing discussion packs require `prototyping.yaml`; non-ui discussion packs do not.
91
114
  - **qfai-sdd**: Unified SDD entrypoint with discussion-pack preflight guard (missing/incomplete/blocking OQ causes stop + next action guidance).
92
- - **qfai-prototyping**: Build a contract-aligned implementation skeleton with static-first evidence by default, and escalate to full-harness only when explicitly justified.
115
+ - **qfai-prototyping**: Build a contract-aligned UI prototype under the `full-harness` only / UI-only contract, with calibration-pack SSOT and screen-level Browser QA evidence.
93
116
  - **qfai-atdd**: Implement acceptance tests driven by specs/scenarios.
94
117
  - **qfai-implement**: Unified TDD micro-cycle (Red/Green/Refactor) one test at a time using `test-list.md` as the execution ledger, including ledger status updates and exception closure.
95
118
  - **qfai-verify**: Run full-scan local quality gates (`validate --fail-on error`, `report`, repo gates) and produce reviewer-approved evidence under `.qfai/evidence/`.
@@ -191,7 +214,9 @@ Notes.
191
214
 
192
215
  - `validate.json`, `report.json`, `doctor.json`, and `run-*` JSON logs are internal exports and are not a stable external contract; prefer `report.md` for integrations that must survive tool upgrades.
193
216
  - Scenario files are expected to use the Gherkin extension `*.feature` (not `*.md`).
194
- - `prototyping.calibration` in `qfai.config.yaml` connects full-harness scoring thresholds to the report and validator.
217
+ - `prototyping.calibration.packPath` points to the calibration pack SSOT; runtime and validator both resolve thresholds and iteration parameters from that pack.
218
+ - `prototyping.calibration.thresholds`, `maxIterations`, `plateauDelta`, and `plateauLookback` are unsupported public config fields in v1.7.15.
219
+ Put calibration values in the referenced pack instead of `qfai.config.yaml`.
195
220
  - Observability modules (`src/core/observability/`) exist as foundation code but are **not integrated into blocking validation** in v1.7.14. They are reserved for future operational instrumentation.
196
221
 
197
222
  ## Specifications and contracts (SDD)
@@ -7,6 +7,8 @@ dependencies:
7
7
  version: 2.0.0
8
8
  ---
9
9
 
10
+ <!-- markdownlint-disable MD041 -->
11
+
10
12
  > **言語指示(厳守)**
11
13
  >
12
14
  > - 報告・出力: 日本語(Plan も含む)
@@ -0,0 +1,88 @@
1
+ # Shared Skill Delegation Baseline
2
+
3
+ Use this document to keep SKILL bodies compact.
4
+ Skill files should reference this baseline and only add role-, stage-, or gate-specific rules.
5
+
6
+ ## Sub-agent Delegation (MANDATORY)
7
+
8
+ ### Orchestrator Protocol (MUST)
9
+
10
+ - The orchestrator may create work orders, delegate tasks, integrate outputs, and present results.
11
+ - The orchestrator must not generate the primary artifact first draft.
12
+ - The orchestrator must not self-approve or act as reviewer for convenience.
13
+
14
+ ### Capability Probe (MUST)
15
+
16
+ 1. Attempt the first required delegation at stage start using the platform's native delegation mechanism.
17
+ 2. Treat that first real delegation attempt as the capability check. Do not gate execution on preflight availability questions or synthetic probe-only checks.
18
+ 3. If the delegation fails, stop the stage immediately. Do not simulate roles and do not continue with self-execution.
19
+
20
+ ### Delegation Failure (Hard Stop)
21
+
22
+ - Report all of:
23
+ - `Delegation failure: <raw reason or concise summary>`
24
+ - `Attempted role: <role>`
25
+ - `Attempted task: <task title>`
26
+ - `Why stopped: QFAI requires real sub-agent delegation in this environment.`
27
+ - `User action needed: <settings or tooling changes required>`
28
+ - `Retry condition: rerun after the required delegation succeeds`
29
+
30
+ ## Work Orders Summary
31
+
32
+ Every major artifact in the stage should include this table schema:
33
+
34
+ | Step | Role (sub-agent) | Task title | Input (refs) | Output (refs) | Status (PASS/REVISE) |
35
+ | ---- | ---------------- | ---------- | ------------ | ------------- | -------------------- |
36
+ | 1 | <role> | <task> | <refs> | <refs> | PASS/REVISE |
37
+
38
+ - `Output (refs)` should point to in-file anchors or relative evidence paths.
39
+
40
+ ## Reviewer Gate Baseline
41
+
42
+ - Final completion gate must be delegated to an independent reviewer.
43
+ - Reviewers must verify Drift Protocol enforcement.
44
+ - Reviewers must verify test-layer policy enforcement when relevant.
45
+ - Do not treat test volume ratios or floors as hard gates unless the skill explicitly says so.
46
+ - Do not declare DONE until all routed blocking reviewers return `PASS`.
47
+ - Every reviewer returning `FAIL` or `REVISE` must include a concrete fix proposal.
48
+
49
+ ## Work order template
50
+
51
+ ```text
52
+ Task title: <short>
53
+ Role: <sub-agent role>
54
+ Goal: <what to decide/produce>
55
+ Inputs (refs):
56
+ - <file/section>
57
+ Constraints:
58
+ - must: enforce Drift Protocol
59
+ - must: follow applicable test-layer or validation policy
60
+ - must_not: patch upstream artifacts directly when owner rerun is required
61
+ Output format:
62
+ - <headings / bullet schema>
63
+ Quality bar:
64
+ - PASS if ...
65
+ - REVISE if ...
66
+ ```
67
+
68
+ ## Reviewer response template
69
+
70
+ ```text
71
+ Result: PASS | REVISE
72
+ Findings:
73
+ - <issue>
74
+ Required fixes:
75
+ - <action>
76
+ Evidence checked:
77
+ - <refs>
78
+ ```
79
+
80
+ ### Verdict vocabulary
81
+
82
+ - Reviewer responses in-flight use `Result: PASS | REVISE` (this file).
83
+ - `summary.json` archived into review packs historically uses
84
+ `status: "PASS|FAIL"` (validated by
85
+ `packages/qfai/src/core/validators/reviewArtifacts.ts`).
86
+ - A `REVISE` verdict during iteration maps to `status: "FAIL"` when the
87
+ final `summary.json` is written; they represent the same outcome.
88
+ Review packs should not invent a third verdict.
@@ -0,0 +1,49 @@
1
+ # Shared Skill Operating Baseline
2
+
3
+ Use this document to keep SKILL bodies compact.
4
+ Skill files should reference this baseline and only restate skill-specific additions or overrides.
5
+
6
+ ## User Questions (AskUserQuestion Protocol)
7
+
8
+ - When a question to the user is needed, use AskUserQuestion if the tool is available.
9
+ - When AskUserQuestion supports structured choices, prefer structured choices over free-text input.
10
+ - If AskUserQuestion is unavailable, ask the same question in a normal message with explicit numbered choices.
11
+ - Preserve structured choice semantics when falling back.
12
+ - State why AskUserQuestion was unavailable.
13
+
14
+ ## FORMAT SSOT (Mandatory)
15
+
16
+ - Before writing or editing `.qfai/**`, read the relevant README/template/sample for the target artifact.
17
+ - Do not copy templates or samples into prompt markdown.
18
+ - Generated artifacts must match README-defined structure, headings, ordering, and table columns.
19
+ - Completion requires a format self-check in evidence.
20
+
21
+ ## Stage 0 - Steering completion refresh (mandatory)
22
+
23
+ Refresh these files before or during the stage when facts are missing or stale:
24
+
25
+ - `.qfai/assistant/steering/manifest.md`
26
+ - `.qfai/assistant/steering/product.md`
27
+ - `.qfai/assistant/steering/structure.md`
28
+ - `.qfai/assistant/steering/tech.md`
29
+
30
+ Rules:
31
+
32
+ - Detect incomplete content such as empty sections, placeholder-only text, `<...>`, `TBD`, or stale facts.
33
+ - Fill only what is verifiable from repository evidence.
34
+ - If something cannot be verified, record an Open Question and ask the user.
35
+ - Update steering when new facts are discovered during the stage.
36
+
37
+ ## Delta Rejected Guard (Mandatory)
38
+
39
+ - Do not reintroduce options marked as rejected in `09_delta.md`.
40
+ - If a rejected option must be reconsidered, create a `[RE-OPEN]` decision record that references the prior DR-ID, states what changed, and includes explicit approval.
41
+
42
+ ## Completion Contract (Shared)
43
+
44
+ Before declaring completion, you MUST:
45
+
46
+ - resolve or explicitly defer undefined or ambiguous items with rationale;
47
+ - verify every expected artifact exists and required sections are populated;
48
+ - scan generated artifacts for unresolved placeholders such as `TBD`, `TODO`, `TBA`, `TBC`, `XXX`, `???`, `OQ`, `OPEN QUESTION`, `UNDEFINED`, and `PLACEHOLDER`;
49
+ - run the smallest applicable smoke check, or state "not applicable" with a short rationale.
@@ -30,21 +30,16 @@ QFAI Skill Body (SSOT)
30
30
 
31
31
  ## User Questions (AskUserQuestion Protocol)
32
32
 
33
- - When a question to the user is needed (e.g., test scope decisions, runtime environment confirmation),
34
- the agent MUST use AskUserQuestion if the tool is available.
35
- - When AskUserQuestion supports structured choices (radio/multi-select),
36
- the agent MUST prefer structured choices over free-text input.
37
- - If AskUserQuestion is technically unavailable, present the same question as a normal message
38
- with explicit numbered choices.
39
- The agent SHOULD preserve structured choice semantics (enumerated options, selection constraints).
40
- The reason for unavailability MUST be stated.
33
+ Follow `.qfai/assistant/instructions/shared-skill-operating-baseline.md#user-questions-askuserquestion-protocol`.
34
+
35
+ Skill-specific examples:
36
+
37
+ - test scope decisions
38
+ - runtime environment confirmation
41
39
 
42
40
  ## FORMAT SSOT (Mandatory)
43
41
 
44
- - Before writing or editing any `.qfai/**` artifact, read and follow the relevant directory README template and sample.
45
- - Do not copy templates/samples into this prompt or other prompt markdown.
46
- - Generated artifacts must match README-defined structure (headings, ordering, table columns).
47
- - Completion requires a format self-check in evidence.
42
+ Follow `.qfai/assistant/instructions/shared-skill-operating-baseline.md#format-ssot-mandatory`.
48
43
 
49
44
  ## Inputs Priority (Preflight)
50
45
 
@@ -78,36 +73,26 @@ When unsure, read inputs in this order:
78
73
 
79
74
  ## Sub-agent Delegation (MANDATORY)
80
75
 
81
- This section is mandatory and overrides any conflicting fallback text in this file.
76
+ Follow `.qfai/assistant/instructions/shared-skill-delegation-baseline.md`.
82
77
 
83
78
  ### Orchestrator Protocol (MUST)
84
79
 
85
- - Orchestrator may only create work orders, delegate tasks, integrate outputs, and present results.
80
+ - Follow the shared baseline.
81
+ - Orchestrator MUST NOT self-approve.
86
82
  - Orchestrator MUST NOT generate the primary artifact first draft.
87
- - Orchestrator MUST NOT serve as Reviewer or skip delegation for convenience.
88
83
 
89
84
  ### Capability Probe (MUST)
90
85
 
91
- 1. Run one harmless Probe Task (for example: "reply with ok") once at stage start.
92
- 2. If subagents are unavailable, explicitly ask the user for Simulation mode approval.
93
- 3. Without explicit approval, stop the stage and do not continue.
86
+ - No additional overrides.
94
87
 
95
- ### Simulation mode (Opt-in only)
88
+ ### Delegation Failure (Hard Stop)
96
89
 
97
- - Allowed only when the user explicitly states `Simulation mode allowed`.
98
- - When used, record both in outputs/evidence:
99
- - `Subagents: simulated (reason: <why unavailable>)`
100
- - `User approval: <quote or reference>`
90
+ - No additional overrides.
91
+ - Do not simulate roles. If the first required delegation fails, stop the stage and report remediation.
101
92
 
102
93
  ## Work Orders Summary
103
94
 
104
- Every major artifact in this stage MUST include this fixed table schema:
105
-
106
- | Step | Role (sub-agent) | Task title | Input (refs) | Output (refs) | Status (PASS/REVISE) |
107
- | ---- | ---------------- | ---------- | ------------ | ------------- | -------------------- |
108
- | 1 | <role> | <task> | <refs> | <refs> | PASS/REVISE |
109
-
110
- - `Output (refs)` must point to in-file anchors or relative evidence file paths.
95
+ Use the shared schema.
111
96
 
112
97
  ### Stage Minimum Roles (MUST)
113
98
 
@@ -120,77 +105,37 @@ Every major artifact in this stage MUST include this fixed table schema:
120
105
 
121
106
  ### Reviewer Gate (MUST)
122
107
 
108
+ - Follow `.qfai/assistant/instructions/shared-skill-delegation-baseline.md#reviewer-gate-baseline`.
123
109
  - Final completion gate MUST be delegated to an independent `completion-reviewer`.
124
- - Reviewer checks (minimum):
125
- - Required roles were delegated (no orchestrator self-authoring).
126
- - Drift Protocol enforced (no upstream edits without approval and owner rerun).
127
- - Test-layer policy enforced via `test-layers.md`.
128
- - Coverage obligations met: E2E covers `US`, Integration covers `TC`, API covers `CON-API`.
129
- - **Test-case quality depth verified**: Coverage Depth Matrix reviewed; no unjustified ❌ cells remain (see `references/test-case-depth-checklist.md`).
130
- - Validation evidence exists and `qfai validate --fail-on error` passes.
131
- - Floors/ratios are signals, not gates.
132
- - `scenario.feature` and coverage ledgers are optional legacy inputs, not completion gates.
110
+ - ATDD-specific reviewer checks:
111
+ - coverage obligations met: E2E covers `US`, Integration covers `TC`, API covers `CON-API`;
112
+ - Coverage Depth Matrix is reviewed and no unjustified `X` cells remain;
113
+ - validation evidence exists and `qfai validate --fail-on error` passes;
114
+ - `scenario.feature` and coverage ledgers remain optional legacy inputs, not completion gates.
133
115
  - Route specialist reviewers from `.qfai/assistant/steering/agent-routing.yml`.
134
116
  - Default ATDD review set:
135
117
  - `completion-reviewer`
136
118
  - `qa-gatekeeper`
137
119
  - Add `implementation-reviewer` only when helper/runtime support code changed.
138
120
  - Do not declare DONE until all routed blocking reviewers return `PASS`.
139
- - Every reviewer MUST provide a concrete alternative or fix proposal when returning FAIL.
140
121
 
141
122
  ### Work order template (copy/paste)
142
123
 
143
- ```text
144
- Task title: <short>
145
- Role: <sub-agent role>
146
- Goal: <what to decide/produce>
147
- Inputs (refs):
148
- - <file/section>
149
- Constraints:
150
- - must: enforce Drift Protocol (no upstream edits without user approval + CR)
151
- - must: verify test-layer obligations from `steering/test-layers.md`
152
- - must: provide validation evidence (`qfai validate --fail-on error`)
153
- - must_not: treat volume ratios/floors as hard gates
154
- - must_not: accept upstream edits made directly by downstream phase
155
- Output format:
156
- - <headings / bullet schema>
157
- Quality bar:
158
- - PASS if ...
159
- - REVISE if ...
160
- ```
124
+ Use the shared template.
161
125
 
162
126
  ### Reviewer response template
163
127
 
164
- ```text
165
- Result: PASS | REVISE
166
- Findings:
167
- - <issue>
168
- Required fixes:
169
- - <action>
170
- Evidence checked:
171
- - <refs>
172
- ```
128
+ Use the shared template.
173
129
 
174
- ## Stage 0 Steering completion refresh (mandatory)
175
-
176
- Before moving forward in this stage, refresh:
177
-
178
- - `.qfai/assistant/steering/manifest.md`
179
- - `.qfai/assistant/steering/product.md`
180
- - `.qfai/assistant/steering/structure.md`
181
- - `.qfai/assistant/steering/tech.md`
130
+ - Required field: `Status (PASS/REVISE)`.
182
131
 
183
- Rules:
132
+ ## Stage 0 — Steering completion refresh (mandatory)
184
133
 
185
- - Detect incomplete content (empty sections, placeholder-only lines, `<...>`, `TBD`, stale facts).
186
- - Fill what is verifiable from repository evidence.
187
- - If something cannot be verified, record an Open Question and ask the user.
188
- - Update steering when new facts are discovered during this stage.
134
+ Follow `.qfai/assistant/instructions/shared-skill-operating-baseline.md#stage-0---steering-completion-refresh-mandatory`.
189
135
 
190
136
  ## Delta Rejected Guard (Mandatory)
191
137
 
192
- - Do not reintroduce options marked as rejected in 09_delta.md.
193
- - If a rejected option must be reconsidered, create a `[RE-OPEN]` Decision Record that references prior DR-ID and explicit approval.
138
+ Follow `.qfai/assistant/instructions/shared-skill-operating-baseline.md#delta-rejected-guard-mandatory`.
194
139
 
195
140
  ## CRITICAL CONSTRAINTS (Read First)
196
141
 
@@ -212,12 +157,7 @@ Rules:
212
157
 
213
158
  ## Completion Contract (Shared)
214
159
 
215
- Before declaring completion, you MUST:
216
-
217
- - Resolve or explicitly defer undefined/ambiguous items with rationale.
218
- - Verify every expected artifact exists and required sections are populated.
219
- - Scan generated artifacts for unresolved placeholders (`TBD`, `TODO`, `???`, etc.).
220
- - Run the smallest smoke check proving runnable behavior (or state "not applicable" with rationale).
160
+ Follow `.qfai/assistant/instructions/shared-skill-operating-baseline.md#completion-contract-shared`.
221
161
 
222
162
  ## Goal
223
163
 
@@ -29,25 +29,22 @@ QFAI Skill Body (SSOT)
29
29
 
30
30
  ## User Questions (AskUserQuestion Protocol)
31
31
 
32
- - When a question to the user is needed (e.g., configuration decisions, glob pattern confirmation),
33
- the agent MUST use AskUserQuestion if the tool is available.
34
- - When AskUserQuestion supports structured choices (radio/multi-select),
35
- the agent MUST prefer structured choices over free-text input.
36
- - If AskUserQuestion is technically unavailable, present the same question as a normal message
37
- with explicit numbered choices.
38
- The agent SHOULD preserve structured choice semantics (enumerated options, selection constraints).
39
- The reason for unavailability MUST be stated.
32
+ Follow `.qfai/assistant/instructions/shared-skill-operating-baseline.md#user-questions-askuserquestion-protocol`.
33
+
34
+ Skill-specific examples:
35
+
36
+ - configuration decisions
37
+ - glob pattern confirmation
40
38
 
41
39
  ## FORMAT SSOT (Mandatory)
42
40
 
43
- - **Before writing or editing any `.qfai/**` artifact\*\*, read and follow the relevant directory README template and sample:
41
+ - Follow `.qfai/assistant/instructions/shared-skill-operating-baseline.md#format-ssot-mandatory`.
42
+
43
+ - Before writing or editing any `.qfai/**` artifact, read and follow the relevant directory README template and sample:
44
44
  - `.qfai/discussion/README.md`
45
45
  - `.qfai/specs/README.md`
46
46
  - `.qfai/contracts/**/README.md`
47
47
  - `.qfai/evidence/README.md`
48
- - **Do NOT copy** templates/samples into this prompt or into other prompt markdown.
49
- - The generated artifacts must match the README-defined structure (headings, ordering, table columns).
50
- - Completion requires a **Format Self-Check** in the evidence: list each artifact and confirm “matches README template”.
51
48
 
52
49
  ## Inputs Priority (Preflight)
53
50
 
@@ -60,36 +57,24 @@ When unsure, read inputs in this order:
60
57
 
61
58
  ## Sub-agent Delegation (MANDATORY)
62
59
 
63
- This section is mandatory and overrides any conflicting fallback text in this file.
60
+ Follow `.qfai/assistant/instructions/shared-skill-delegation-baseline.md`.
64
61
 
65
62
  ### Orchestrator Protocol (MUST)
66
63
 
67
- - Orchestrator may only create work orders, delegate tasks, integrate outputs, and present results to the user.
68
- - Orchestrator MUST NOT generate the primary artifact first draft.
69
- - Orchestrator MUST NOT serve as Reviewer or skip delegation for convenience.
64
+ - No additional overrides.
70
65
 
71
66
  ### Capability Probe (MUST)
72
67
 
73
- 1. Run one harmless Probe Task (for example: "reply with ok") once at stage start.
74
- 2. If subagents are unavailable, explicitly ask the user for Simulation mode approval.
75
- 3. Without explicit approval, stop the stage and do not continue.
68
+ - No additional overrides.
76
69
 
77
- ### Simulation mode (Opt-in only)
70
+ ### Delegation Failure (Hard Stop)
78
71
 
79
- - Allowed only when the user explicitly states `Simulation mode allowed`.
80
- - When used, record both of the following in outputs/evidence:
81
- - `Subagents: simulated (reason: <why unavailable>)`
82
- - `User approval: <quote or reference>`
72
+ - No additional overrides.
73
+ - Do not simulate roles. If the first required delegation fails, stop the stage and report remediation.
83
74
 
84
75
  ### Work Orders Summary (MANDATORY evidence)
85
76
 
86
- Every major artifact in this stage MUST include a `## Work Orders Summary` section with this fixed table schema:
87
-
88
- | Step | Role (sub-agent) | Task title | Input (refs) | Output (refs) | Status (PASS/REVISE) |
89
- | ---- | ---------------- | ---------- | ------------ | ------------- | -------------------- |
90
- | 1 | <role> | <task> | <refs> | <refs> | PASS/REVISE |
91
-
92
- - `Output (refs)` must point to in-file anchors or relative evidence file paths.
77
+ Use the shared schema.
93
78
 
94
79
  ### Stage Minimum Roles (MUST)
95
80
 
@@ -100,80 +85,37 @@ Every major artifact in this stage MUST include a `## Work Orders Summary` secti
100
85
 
101
86
  ### Reviewer Gate (MUST)
102
87
 
103
- - Final completion gate MUST be delegated to an independent `completion-reviewer`.
104
- - Reviewer checks (minimum):
105
- - Required roles were delegated (no orchestrator self-authoring).
106
- - DoD satisfied (validate gate, test-layer hard gate, evidence, DR-IDs).
107
- - Validate gate evidence exists: `qfai validate --fail-on error` completed with `error=0`.
108
- - **Drift Protocol enforced**:
109
- - No upstream artifact edits were made without an explicit user-approved Change Request.
110
- - If upstream changes exist, the correct owner skill was re-run after approval; downstream did not patch upstream directly.
111
- - **Test-layer policy enforced**:
112
- - E2E/API/Integration coverage aligns with `steering/test-layers.md` and the project’s plan.
113
- - Do not use pyramid ratios as a gate; use floors/ratios only as signals. Coverage obligations are the gate.
88
+ - Follow `.qfai/assistant/instructions/shared-skill-delegation-baseline.md#reviewer-gate-baseline`.
89
+ - Reviewer checks:
90
+ - required roles were delegated;
91
+ - validate evidence exists: `qfai validate --fail-on error` completed with `error=0`;
92
+ - Drift Protocol enforced;
93
+ - test-layer policy enforced where applicable.
114
94
  - Route specialist reviewers from `.qfai/assistant/steering/agent-routing.yml`.
115
95
  - Default configure review set:
116
96
  - `completion-reviewer`
117
97
  - `qa-gatekeeper`
118
98
  - Do not declare DONE or handoff until all routed blocking reviewers return `PASS`.
119
- - Every reviewer MUST provide a concrete alternative or fix proposal when returning FAIL.
120
99
 
121
100
  ### Work order template (copy/paste)
122
101
 
123
- ```text
124
- Task title: <short>
125
- Role: <sub-agent role>
126
- Goal: <what to decide/produce>
127
- Inputs (refs):
128
- - <file/section>
129
- Constraints:
130
- - must: enforce Drift Protocol (no upstream edits without user approval + CR)
131
- - must: verify plan/test-layer adherence (`steering/test-layers.md` + plan)
132
- - must: check `qfai validate --fail-on error` passes with evidence (`error=0`)
133
- - must: enforce `.qfai/assistant/steering/test-layers.md` hard gates
134
- - must_not: accept test-volume ratios/floors as a hard gate
135
- - must_not: accept upstream edits made directly by downstream phase
136
- Output format:
137
- - <headings / bullet schema>
138
- Quality bar:
139
- - PASS if ...
140
- - REVISE if ...
141
- ```
102
+ Use the shared template.
142
103
 
143
104
  ### Reviewer response template
144
105
 
145
- ```text
146
- Result: PASS | REVISE
147
- Findings:
148
- - <issue>
149
- Required fixes:
150
- - <action>
151
- Evidence checked:
152
- - <refs>
153
- ```
154
-
155
- ## Stage 0 — Steering completion refresh (mandatory)
106
+ Use the shared template.
156
107
 
157
- Before moving forward in this stage, refresh these files:
108
+ - Required field: `Status (PASS/REVISE)`.
158
109
 
159
- - `.qfai/assistant/steering/manifest.md`
160
- - `.qfai/assistant/steering/product.md`
161
- - `.qfai/assistant/steering/structure.md`
162
- - `.qfai/assistant/steering/tech.md`
110
+ ## Stage 0 — Steering completion refresh (mandatory)
163
111
 
164
- Rules:
112
+ Follow `.qfai/assistant/instructions/shared-skill-operating-baseline.md#stage-0---steering-completion-refresh-mandatory`.
165
113
 
166
- - Detect incomplete content (empty sections, placeholder-only lines, `<...>`, `TBD`, stale facts).
167
- - Fill what is verifiable from repository evidence (tree, docs, require/spec artifacts, package.json, CI definitions).
168
- - If something cannot be verified, record it as an Open Question and ask the user.
169
- - Even if steering is already complete, update it when new facts are discovered in this stage.
114
+ - Fill steering from verifiable repository evidence first; when evidence is missing, mark the field `TBD` and record the gap in the evidence file.
170
115
 
171
116
  ## Delta Rejected Guard (Mandatory)
172
117
 
173
- - Do NOT reintroduce options marked as rejected in 09_delta.md.
174
- - If a rejected option must be reconsidered, create a **[RE-OPEN]** Decision
175
- Record in 09_delta.md that references the prior DR-ID, states what changed +
176
- new criteria, and includes explicit approval (user or instructions/steering).
118
+ Follow `.qfai/assistant/instructions/shared-skill-operating-baseline.md#delta-rejected-guard-mandatory`.
177
119
 
178
120
  ## CRITICAL CONSTRAINTS (Read First)
179
121
 
@@ -187,19 +129,7 @@ Rules:
187
129
 
188
130
  ## Completion Contract (Shared)
189
131
 
190
- Before declaring completion, you MUST:
191
-
192
- - 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.
193
- - Deliverable completeness: verify every expected artifact listed in this prompt (and required README templates) exists and is fully populated; no missing required sections.
194
- - OQ / placeholder scan: scan all generated artifacts (including evidence) for
195
- placeholders such as "TBD", "TODO", "TBA", "TBC", "XXX", "???", "OQ",
196
- "OPEN QUESTION", "UNDEFINED", "PLACEHOLDER", and localized equivalents in
197
- the user's language. Resolve or explicitly defer; do not leave silent
198
- placeholders.
199
- - Smoke check (if applicable): when the prompt produces runnable code, tests,
200
- or configs, execute the smallest command that proves basic run/start/operate
201
- and record evidence. If not applicable, state "not applicable" with a short
202
- rationale.
132
+ Follow `.qfai/assistant/instructions/shared-skill-operating-baseline.md#completion-contract-shared`.
203
133
 
204
134
  ## Goal
205
135
 
@@ -327,29 +257,35 @@ Do not edit any `.qfai/**/README.md` file; raise an Open Question instead.
327
257
 
328
258
  ## Multi-Role Orchestration (Subagents)
329
259
 
330
- This workflow assumes the environment _may_ support subagents (e.g., Claude Code "Task" tool) or may not.
260
+ Use the platform's native sub-agent delegation mechanism for Claude Code, GitHub Copilot, and Codex.
331
261
 
332
- ### If subagents are supported
262
+ ### Delegation order
333
263
 
334
- Delegate to multiple roles and then merge the results. Use a "real-world workflow" order:
264
+ Use `.qfai/assistant/steering/agent-routing.yml` as the routing SSOT.
335
265
 
336
- - discovery-analyst -> requirements-analyst -> delivery-planner -> solution-architect -> test-design-analyst -> qa-strategist -> devops-ci-engineer -> completion-reviewer / qa-gatekeeper
266
+ - First required delegation / Capability Probe: `delivery-planner` in the `analysis` phase.
267
+ - Then follow routed phases in order: `analysis` (`delivery-planner`, `qa-strategist`) -> `config` (`devops-ci-engineer`) -> `review` (`completion-reviewer`, `qa-gatekeeper`).
268
+ - Do not prepend non-routed roles before the first required delegation attempt.
337
269
 
338
- **Pseudo-invocation pattern** (adjust to your tool):
270
+ ### Delegation contract (tool-neutral)
339
271
 
340
272
  ```text
341
- Task(
342
- subagent_type="planner",
343
- description="Analyze repo and propose testFileGlobs",
344
- prompt="Context: ...\nGoal: Tune qfai.config.yaml\nConstraints: minimal diff\nReturn: globs + evidence"
345
- )
273
+ Role: delivery-planner
274
+ Task title: Analyze repo and propose testFileGlobs
275
+ Goal: Tune qfai.config.yaml with a minimal diff
276
+ Inputs:
277
+ - relevant steering and repo layout
278
+ Constraints:
279
+ - minimal diff
280
+ - evidence-first
281
+ Return:
282
+ - proposed globs + rationale + evidence refs
346
283
  ```
347
284
 
348
- ### If subagents are NOT supported
349
-
350
- Only with explicit user approval (`Simulation mode allowed`), simulate roles by running the same sequence yourself:
285
+ ### Failure rule
351
286
 
352
- - Write a short "role output" section per role, then consolidate into the final deliverable(s).
287
+ - The first required delegation attempt doubles as the capability check.
288
+ - If that delegation fails, stop immediately. Do not simulate roles or continue with self-execution.
353
289
 
354
290
  ## Completion Separation (mandatory)
355
291