qfai 1.5.2 → 1.5.3

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 (30) hide show
  1. package/README.md +1 -1
  2. package/assets/init/.qfai/README.md +2 -1
  3. package/assets/init/.qfai/assistant/agents/prototyping-coverage-auditor.md +1 -1
  4. package/assets/init/.qfai/assistant/instructions/drift-protocol.md +1 -1
  5. package/assets/init/.qfai/assistant/instructions/requirements-decomposition.md +4 -4
  6. package/assets/init/.qfai/assistant/instructions/workflow.md +2 -2
  7. package/assets/init/.qfai/assistant/skills/qfai-atdd/SKILL.md +17 -2
  8. package/assets/init/.qfai/assistant/skills/qfai-prototyping/SKILL.md +15 -4
  9. package/assets/init/.qfai/assistant/skills/qfai-sdd/SKILL.md +43 -41
  10. package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/specs/{_shared → _policies}/03_Capabilities.md +1 -1
  11. package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/specs/{_shared → _policies}/04_Business-Flow.md +1 -1
  12. package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/specs/{_shared → _policies}/05_Contracts.md +1 -1
  13. package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/specs/spec/01_Spec.md +38 -0
  14. package/assets/init/.qfai/assistant/skills/qfai-tdd-green/SKILL.md +1 -0
  15. package/assets/init/.qfai/assistant/skills/qfai-tdd-red/SKILL.md +1 -0
  16. package/assets/init/.qfai/assistant/skills/qfai-tdd-refactor/SKILL.md +1 -0
  17. package/assets/init/.qfai/specs/README.md +14 -7
  18. package/assets/init/.qfai/specs/_policies/.gitkeep +1 -0
  19. package/dist/cli/index.cjs +73 -66
  20. package/dist/cli/index.cjs.map +1 -1
  21. package/dist/cli/index.mjs +73 -66
  22. package/dist/cli/index.mjs.map +1 -1
  23. package/dist/index.cjs +71 -64
  24. package/dist/index.cjs.map +1 -1
  25. package/dist/index.mjs +71 -64
  26. package/dist/index.mjs.map +1 -1
  27. package/package.json +1 -1
  28. /package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/specs/{_shared → _policies}/08_Decisions.md +0 -0
  29. /package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/specs/{_shared → _policies}/09_Open-questions.md +0 -0
  30. /package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/specs/{_shared → _policies}/10_delta.md +0 -0
package/README.md CHANGED
@@ -246,7 +246,7 @@ flowchart LR
246
246
  - Contracts SSOT: `.qfai/contracts/**`
247
247
  - Report outputs (`.qfai/report/**`) are derived artifacts and not SSOT.
248
248
 
249
- ## Minimal tutorial (v1.5.2)
249
+ ## Minimal tutorial (v1.5.3)
250
250
 
251
251
  1. `npx qfai init`
252
252
  2. Run `/qfai-discussion` to structure scope, open questions, and produce a discussion pack under `.qfai/discussion/discussion-<ts>/`.
@@ -98,7 +98,8 @@ It is useful for local review but should not pollute version control.
98
98
 
99
99
  ### R4. Layered specs are runtime SSOT
100
100
 
101
- - Runtime validators and downstream skills consume `_shared/**` and `spec-XXXX/**`.
101
+ - Runtime validators consume `_policies/**` and `spec-XXXX/**`.
102
+ - Execution skills enter from `spec-XXXX/01_Spec.md` and read `_policies/**` only through the spec's Escalation Hook.
102
103
  - Split rule is fixed: `1 CAP = 1 spec`.
103
104
  - Parent chain is fixed: `US -> CAP`, `AC -> US`, `BR -> AC`, `EX -> BR|AC`, `TC -> EX`.
104
105
  - Derived outputs under `.qfai/report/**` are non-SSOT.
@@ -9,7 +9,7 @@
9
9
  - `.qfai/assistant/instructions/*`
10
10
  - `.qfai/assistant/steering/*`
11
11
  - `.qfai/specs/spec-*`
12
- - `.qfai/specs/_shared/05_Contracts.md`
12
+ - `.qfai/specs/_policies/05_Contracts.md`
13
13
  - prototyping markdown evidence artifact in the evidence directory
14
14
  - prototyping json evidence artifact in the evidence directory
15
15
 
@@ -9,7 +9,7 @@ This file defines mandatory change control for all downstream execution phases.
9
9
  Upstream artifacts include, at minimum:
10
10
 
11
11
  - `01_Spec.md`, `02_User-stories.md`, `03_Acceptance-Criteria.md`, `04_Business-Rules.md`, `05_Examples.md`, `06_Test-Cases.md`, `07_Decisions.md`, `08_Open-questions.md`, `09_delta.md`
12
- - `_shared/*` layered artifacts and `11_Contracts.md` (or project-equivalent contract index)
12
+ - `_policies/*` layered artifacts and `11_Contracts.md` (or project-equivalent contract index)
13
13
  - `10_Plan.md` and other owner-phase planning outputs
14
14
  - Legacy spec-pack SSOT files when present: `spec.md`, `delta.md`, `plan.md`, `traceability-matrix.md`, `scenario.feature`, `case-catalogue.md`, and numbered pack files (for example `01_Spec.md`..`18_delta.md`)
15
15
  - contracts and schema decisions owned by earlier phases
@@ -15,7 +15,7 @@ This document is the decision rule SSOT for AI and humans when answering:
15
15
  1. **Source registry** (`require/require-*/01_Sources.md`)
16
16
  2. **Requirement index** (`require/require-*/03_REQ.md`)
17
17
  3. **Input gaps / Open Questions** (`require/require-*/08_OQ.md`)
18
- 4. **Shared specs** (`specs/_shared/01..04`)
18
+ 4. **Policy layer** (`specs/_policies/01..04`)
19
19
  5. **Capability slices** (`specs/spec-*/01..05` minimum)
20
20
  6. **ATDD / TDD** (tests + code)
21
21
 
@@ -35,21 +35,21 @@ This document is the decision rule SSOT for AI and humans when answering:
35
35
  ### Rule 3 - Keep ambiguity explicit
36
36
 
37
37
  - Unknowns remain explicit as Open Questions.
38
- - Resolved answers are promoted to `_shared` or `spec-XXXX` artifacts, then OQ status is updated.
38
+ - Resolved answers are promoted to `_policies` or `spec-XXXX` artifacts, then OQ status is updated.
39
39
 
40
40
  ## How to decompose (mechanical procedure)
41
41
 
42
42
  1. Register source documents and assumptions in `require-*/01_Sources.md`.
43
43
  2. Extract concise requirement index entries in `require-*/03_REQ.md`.
44
44
  3. Capture missing information in `require-*/08_OQ.md`.
45
- 4. Build `_shared` layer (`Objective`, `Initiative`, `Capabilities`, `Business Flow`).
45
+ 4. Build `_policies` layer (`Objective`, `Initiative`, `Capabilities`, `Business Flow`).
46
46
  5. Split by capability (`1 CAP = 1 spec-XXXX`) and produce slice files.
47
47
  6. Derive acceptance tests and implementation from the finalized slices.
48
48
 
49
49
  ## Example
50
50
 
51
51
  - Requirement index entry: `REQ-0003` linked to `SRC-0002`
52
- - Capability mapping: `CAP-0003` in `_shared/03_Capabilities.md`
52
+ - Capability mapping: `CAP-0003` in `_policies/03_Capabilities.md`
53
53
  - Spec slice: `spec-0003/01_Spec.md` through `06_Test-Cases.md`
54
54
 
55
55
  ## Non-goals
@@ -49,7 +49,7 @@ Do not proceed without a declared Change Type.
49
49
  0. Steering refresh (project memory bootstrap)
50
50
  1. Discussion (optional): clarify idea → requirement seed
51
51
  2. Requirements: requirements document in `.qfai/require/`
52
- 3. Specification (SDD): unified preflight + `_shared` / `spec-XXXX/01..10`
52
+ 3. Specification (SDD): unified preflight + `_policies` / `spec-XXXX/01..10`
53
53
  4. Prototyping (optional): contract-aligned implementation skeleton
54
54
  5. Acceptance tests (ATDD): runnable E2E/API/Integration tests derived from specs/contracts obligations (`US` / `TC` / `CON-API`)
55
55
  6. Verify: run quality gates and provide evidence
@@ -57,7 +57,7 @@ Do not proceed without a declared Change Type.
57
57
  Stage 3 (`/qfai-sdd`) target policy:
58
58
 
59
59
  - With argument (`/qfai-sdd <spec-id-or-name>`): scope is the matched single spec only.
60
- - Without argument (`/qfai-sdd`): scope is all capabilities from `.qfai/specs/_shared/03_Capabilities.md` in order.
60
+ - Without argument (`/qfai-sdd`): scope is all capabilities from `.qfai/specs/_policies/03_Capabilities.md` in order.
61
61
  - For no-argument batch runs, execute Contracts-first and Outline once, then delegate Slice/Plan/Delta in parallel per `spec-XXXX`.
62
62
 
63
63
  Prototyping stage policy:
@@ -33,15 +33,30 @@ When unsure, read inputs in this order:
33
33
 
34
34
  - P1: `.qfai/assistant/instructions/*`
35
35
  - P2: `.qfai/assistant/steering/*`
36
- - P3: `.qfai/specs/<spec-id>/09_delta.md` (Decision Records; if no spec yet, state "not applicable")
36
+ - P3: `.qfai/specs/<spec-id>/01_Spec.md` (Primary SSOT / Consumer View)
37
37
  - P4: specs/contracts obligations
38
38
  - `.qfai/specs/<spec-id>/02_User-stories.md` (US)
39
+ - `.qfai/specs/<spec-id>/03_Acceptance-Criteria.md` (AC)
40
+ - `.qfai/specs/<spec-id>/05_Examples.md` (EX)
39
41
  - `.qfai/specs/<spec-id>/06_Test-Cases.md` (TC)
40
42
  - `.qfai/contracts/api/**` (CON-API)
41
- - P5: legacy artifacts (optional only)
43
+ - P5: `.qfai/specs/<spec-id>/09_delta.md` (Decision Records; if no spec yet, state "not applicable")
44
+ - P6: legacy artifacts (optional only)
42
45
  - `.qfai/specs/<spec-id>/scenario.feature`
43
46
  - coverage ledger files
44
47
 
48
+ ## Read Set Contract (Mandatory)
49
+
50
+ - Default Mode:
51
+ - `.qfai/specs/<spec-id>/01_Spec.md`
52
+ - `.qfai/specs/<spec-id>/03_Acceptance-Criteria.md`
53
+ - `.qfai/specs/<spec-id>/05_Examples.md`
54
+ - `.qfai/specs/<spec-id>/06_Test-Cases.md`
55
+ - Escalation Mode:
56
+ - allowed only when `01_Spec.md` Escalation Hook signals ambiguity / conflict / missing constraint / trade-off
57
+ - read only `.qfai/specs/_policies/01_Objective.md` and `.qfai/specs/_policies/08_Decisions.md`
58
+ - Do not read `_policies/**` by default.
59
+
45
60
  ## Sub-agent Delegation (MANDATORY)
46
61
 
47
62
  This section is mandatory and overrides any conflicting fallback text in this file.
@@ -59,9 +59,20 @@ When unsure, read inputs in this order:
59
59
 
60
60
  - P1: `.qfai/assistant/instructions/*`
61
61
  - P2: `.qfai/assistant/steering/*`
62
- - P3: `.qfai/specs/spec-*/09_delta.md` (Decision Records)
63
- - P4: `.qfai/specs/_shared/05_Contracts.md` and each `spec-*/11_Contracts.md`
64
- - P5: `.qfai/contracts/**` and existing evidence
62
+ - P3: `.qfai/specs/spec-*/01_Spec.md` (Primary SSOT / Consumer View)
63
+ - P4: `.qfai/contracts/ui/**`, `.qfai/specs/_policies/05_Contracts.md`, and each `spec-*/11_Contracts.md`
64
+ - P5: `.qfai/specs/spec-*/09_delta.md` (Decision Records)
65
+ - P6: existing evidence
66
+
67
+ ## Read Set Contract (Mandatory)
68
+
69
+ - Default Mode:
70
+ - `.qfai/specs/spec-*/01_Spec.md`
71
+ - relevant `.qfai/contracts/ui/**`
72
+ - Escalation Mode:
73
+ - allowed only when `01_Spec.md` Escalation Hook signals ambiguity / conflict / missing constraint / trade-off
74
+ - read only `.qfai/specs/_policies/01_Objective.md`, `.qfai/specs/_policies/07_Constraints.md`, `.qfai/specs/_policies/08_Decisions.md`
75
+ - Do not read `_policies/**` by default.
65
76
 
66
77
  ## Sub-agent Delegation (MANDATORY)
67
78
 
@@ -195,7 +206,7 @@ Build the minimum runnable vertical slice for **all specs** so `/qfai-atdd` can
195
206
  ## Scope SSOT (ALL contracts -> ALL specs)
196
207
 
197
208
  1. Enumerate all specs from `.qfai/specs/spec-*`.
198
- 2. Resolve each spec's contracts via `_shared/05_Contracts.md` and/or `spec-*/11_Contracts.md`.
209
+ 2. Resolve each spec's contracts via `_policies/05_Contracts.md` and/or `spec-*/11_Contracts.md`.
199
210
  3. Do not declare completion while any spec lacks contract assignment.
200
211
 
201
212
  ## Preflight (required)
@@ -8,7 +8,7 @@ QFAI Skill Body (SSOT)
8
8
 
9
9
  name: qfai-sdd
10
10
  title: QFAI SDD Unified (Outline/Slice/Plan/Delta)
11
- description: "Create and update layered SDD artifacts (\_shared + spec-XXXX) in one workflow."
11
+ description: "Create and update layered SDD artifacts (\_policies + spec-XXXX) in one workflow."
12
12
  argument-hint: "[<spec-id-or-name>] [--auto]"
13
13
  allowed-tools: [Read, Glob, Write, TodoWrite, Task, Bash]
14
14
  roles: [Planner, Architect, RequirementsAnalyst, SpecWriter, TraceabilityBuilder, TestStrategist, QAEngineer, CodeReviewer]
@@ -94,7 +94,7 @@ Every major artifact in this stage MUST include a `## Work Orders Summary` secti
94
94
  ### No-argument batch delegation (MUST)
95
95
 
96
96
  - If `/qfai-sdd` is invoked without `<spec-id-or-name>`, treat the run as an all-capability batch.
97
- - Enumerate targets from `.qfai/specs/_shared/03_Capabilities.md` and keep `spec-0001..N` mapping stable by Capability order.
97
+ - Enumerate targets from `.qfai/specs/_policies/03_Capabilities.md` and keep `spec-0001..N` mapping stable by Capability order.
98
98
  - In batch mode, run Contracts-first and Outline exactly once as shared outputs.
99
99
  - Delegate Slice in parallel per spec:
100
100
  - `SpecWriter + TraceabilityBuilder` own `spec-XXXX/01..08`.
@@ -203,14 +203,14 @@ Rules:
203
203
  - **Upper-to-lower references are forbidden. Lower-to-upper references are allowed.**
204
204
  - **Connections between layers MUST be represented by IDs and required edges (`US->AC->BR->EX->TC`).**
205
205
  - **Plan finalize MUST happen after at least one user-story slice is grounded.**
206
- - **Unresolved items MUST be moved to `08_Open-questions.md` (spec scope) or `_shared/09_Open-questions.md` (shared scope).**
206
+ - **Unresolved items MUST be moved to `08_Open-questions.md` (spec scope) or `_policies/09_Open-questions.md` (shared scope).**
207
207
 
208
208
  ## Arguments and Target Selection (Mandatory)
209
209
 
210
210
  - With argument (`/qfai-sdd <spec-id-or-name> [--auto]`): update only the matched single spec target.
211
- - Without argument (`/qfai-sdd`): target all capabilities listed in `_shared/03_Capabilities.md`.
212
- - If `_shared/03_Capabilities.md` does not exist, bootstrap shared templates first, then enumerate capabilities.
213
- - Capability order in `_shared/03_Capabilities.md` is SSOT for `spec-0001..N` assignment and ID stability.
211
+ - Without argument (`/qfai-sdd`): target all capabilities listed in `_policies/03_Capabilities.md`.
212
+ - If `_policies/03_Capabilities.md` does not exist, bootstrap shared templates first, then enumerate capabilities.
213
+ - Capability order in `_policies/03_Capabilities.md` is SSOT for `spec-0001..N` assignment and ID stability.
214
214
  - Reordering capability-to-spec mapping is a Change Request decision and must not be done implicitly.
215
215
  - Batch policy (no argument):
216
216
  - Contracts-first/Outline: once per batch.
@@ -226,7 +226,7 @@ Rules:
226
226
  - Always write `.qfai/report/preflight_summary.md` before generating shared/spec artifacts.
227
227
  - Contracts are contract-first mandatory outputs in this skill:
228
228
  - create/update `.qfai/contracts/(api|db|ui)/**` before shared/spec slices
229
- - `_shared/05_Contracts.md` must include a Contract Index with short IDs (`DB-001`, `API-001`, `UI-001`)
229
+ - `_policies/05_Contracts.md` must include a Contract Index with short IDs (`DB-001`, `API-001`, `UI-001`)
230
230
  - every indexed short ID must map to a declared file with `QFAI-CONTRACT-ID`:
231
231
  - `DB-001 -> CON-DB-0001 -> db-0001-<slug>.sql`
232
232
  - `API-001 -> CON-API-0001 -> api-0001-<slug>.yaml`
@@ -238,7 +238,7 @@ Rules:
238
238
  - `/qfai-sdd` must stop when discussion-pack is missing/incomplete or has blocking OQ (guide to `/qfai-discussion` first).
239
239
  - Review roster is fixed by `.qfai/assistant/steering/review-roster.yml` and must be executed in full.
240
240
  - RCP wording must be sourced from `.qfai/assistant/skills/qfai-sdd/references/rcp_footer.md`.
241
- - `_shared/04_Business-Flow.md` must be Markdown and include at least one Mermaid `flowchart` or `sequenceDiagram`.
241
+ - `_policies/04_Business-Flow.md` must be Markdown and include at least one Mermaid `flowchart` or `sequenceDiagram`.
242
242
  - Business Flow must not be authored as Gherkin (`*Business-flow*.feature` is deprecated).
243
243
  - If diagrams are written in discuss/require/spec/evidence artifacts, Mermaid syntax must be inside ` ```mermaid ` fences only.
244
244
  - `05_Examples.md` must include `EX-ID` and `BR-Ref` mappings.
@@ -266,12 +266,12 @@ Create/update:
266
266
  - `.qfai/contracts/api/**`
267
267
  - `.qfai/contracts/db/**`
268
268
  - `.qfai/contracts/ui/**`
269
- - `_shared/05_Contracts.md` Contract Index table (DB/API/UI short IDs)
269
+ - `_policies/05_Contracts.md` Contract Index table (DB/API/UI short IDs)
270
270
 
271
271
  Rules:
272
272
 
273
273
  - This phase MUST complete before Outline/Slice.
274
- - If `_shared/05_Contracts.md` lists an ID, the corresponding declared contract file MUST exist.
274
+ - If `_policies/05_Contracts.md` lists an ID, the corresponding declared contract file MUST exist.
275
275
  - If a contract is empty, create a valid minimal stub and include `QFAI-CONTRACT-ID`.
276
276
  - `none` is allowed only when there is no contract impact and rationale is written.
277
277
 
@@ -279,22 +279,22 @@ Rules:
279
279
 
280
280
  Create/update:
281
281
 
282
- - `_shared/01_Objective.md`
283
- - `_shared/02_Initiative.md`
284
- - `_shared/03_Capabilities.md`
285
- - `_shared/04_Business-Flow.md`
286
- - `_shared/05_Contracts.md`
287
- - `_shared/06_Glossary.md`
288
- - `_shared/07_Constraints.md`
289
- - `_shared/08_Decisions.md`
290
- - `_shared/09_Open-questions.md`
291
- - `_shared/10_delta.md`
282
+ - `_policies/01_Objective.md`
283
+ - `_policies/02_Initiative.md`
284
+ - `_policies/03_Capabilities.md`
285
+ - `_policies/04_Business-Flow.md`
286
+ - `_policies/05_Contracts.md`
287
+ - `_policies/06_Glossary.md`
288
+ - `_policies/07_Constraints.md`
289
+ - `_policies/08_Decisions.md`
290
+ - `_policies/09_Open-questions.md`
291
+ - `_policies/10_delta.md`
292
292
 
293
293
  Rules:
294
294
 
295
- - Temporary `TBD` is allowed, but each `TBD` must be mirrored into `_shared/09_Open-questions.md`.
296
- - `_shared/04_Business-Flow.md` must include Mermaid and keep diagram syntax inside ` ```mermaid ` fences.
297
- - `_shared/08_Decisions.md` and `_shared/10_delta.md` must exist even when empty, and must explicitly state `0 items`.
295
+ - Temporary `TBD` is allowed, but each `TBD` must be mirrored into `_policies/09_Open-questions.md`.
296
+ - `_policies/04_Business-Flow.md` must include Mermaid and keep diagram syntax inside ` ```mermaid ` fences.
297
+ - `_policies/08_Decisions.md` and `_policies/10_delta.md` must exist even when empty, and must explicitly state `0 items`.
298
298
 
299
299
  ### Phase 2 - Slice (slice-first)
300
300
 
@@ -316,6 +316,7 @@ Slice gate (must pass before Phase 3):
316
316
  - For each TC, EX reference must exist.
317
317
  - `SC` tags must align with the target `spec-XXXX` namespace.
318
318
  - `07_Decisions.md` and `08_Open-questions.md` must exist even when empty and include explicit `0 items` statements.
319
+ - `01_Spec.md` is the execution Primary SSOT and MUST copy down applicable NFR, policy, evidence summary, relevant requirements, and an Escalation Hook to `_policies`.
319
320
 
320
321
  ### Phase 3 - Plan finalize
321
322
 
@@ -366,16 +367,16 @@ Create or update layered SDD artifacts in one run so downstream execution phases
366
367
 
367
368
  ## Mandatory Outputs
368
369
 
369
- - `.qfai/specs/_shared/01_Objective.md`
370
- - `.qfai/specs/_shared/02_Initiative.md`
371
- - `.qfai/specs/_shared/03_Capabilities.md`
372
- - `.qfai/specs/_shared/04_Business-Flow.md`
373
- - `.qfai/specs/_shared/05_Contracts.md`
374
- - `.qfai/specs/_shared/06_Glossary.md`
375
- - `.qfai/specs/_shared/07_Constraints.md`
376
- - `.qfai/specs/_shared/08_Decisions.md`
377
- - `.qfai/specs/_shared/09_Open-questions.md`
378
- - `.qfai/specs/_shared/10_delta.md`
370
+ - `.qfai/specs/_policies/01_Objective.md`
371
+ - `.qfai/specs/_policies/02_Initiative.md`
372
+ - `.qfai/specs/_policies/03_Capabilities.md`
373
+ - `.qfai/specs/_policies/04_Business-Flow.md`
374
+ - `.qfai/specs/_policies/05_Contracts.md`
375
+ - `.qfai/specs/_policies/06_Glossary.md`
376
+ - `.qfai/specs/_policies/07_Constraints.md`
377
+ - `.qfai/specs/_policies/08_Decisions.md`
378
+ - `.qfai/specs/_policies/09_Open-questions.md`
379
+ - `.qfai/specs/_policies/10_delta.md`
379
380
  - `.qfai/specs/spec-XXXX/01_Spec.md`
380
381
  - `.qfai/specs/spec-XXXX/02_User-stories.md`
381
382
  - `.qfai/specs/spec-XXXX/03_Acceptance-Criteria.md`
@@ -396,7 +397,7 @@ Create or update layered SDD artifacts in one run so downstream execution phases
396
397
  2. If readiness checks fail, stop and show blockers with `/qfai-discussion`.
397
398
  3. Analyze repository context, existing artifacts, constraints, and open decisions.
398
399
  4. Write `.qfai/report/preflight_summary.md` from `templates/report/preflight_summary.md`.
399
- 5. Execute Phase 0 (Contracts-first) and ensure `_shared/05_Contracts.md` index and `.qfai/contracts/**` are aligned.
400
+ 5. Execute Phase 0 (Contracts-first) and ensure `_policies/05_Contracts.md` index and `.qfai/contracts/**` are aligned.
400
401
  6. Execute Phase 1 (Outline) in layer-first order.
401
402
  7. Execute Phase 2 (Slice) and pass slice gate for each target spec (single target: at least one user-story slice; no-argument batch: all enumerated specs).
402
403
  8. Execute Phase 3 (Plan finalize) and make every target `10_Plan.md` actionable as How-only.
@@ -410,8 +411,9 @@ Create or update layered SDD artifacts in one run so downstream execution phases
410
411
 
411
412
  Run static checks:
412
413
 
413
- - Confirm required `_shared` and `spec-XXXX` layered files exist.
414
- - Confirm `_shared/04_Business-Flow.md` includes Mermaid and at least one `flowchart` or `sequenceDiagram`.
414
+ - Confirm required `_policies` and `spec-XXXX` layered files exist.
415
+ - Confirm `_policies/04_Business-Flow.md` includes Mermaid and at least one `flowchart` or `sequenceDiagram`.
416
+ - Confirm `01_Spec.md` includes copy-down context and Escalation Hook to `_policies`.
415
417
  - Confirm Mermaid syntax is not written in ` ```text ` or language-less fences.
416
418
  - Confirm `05_Examples.md` provides `EX-ID` + `BR-Ref` mappings.
417
419
  - Confirm `06_Test-Cases.md` provides `TC-ID` + `EX-Ref` + `AC-Refs`.
@@ -457,11 +459,11 @@ When declaring DONE, include:
457
459
  - [ ] CRITICAL CONSTRAINTS were followed.
458
460
  - [ ] `.qfai/report/preflight_summary.md` was generated before spec authoring.
459
461
  - [ ] Contracts-first -> Outline -> Slice -> Plan finalize -> Delta update order was preserved.
460
- - [ ] `_shared/05_Contracts.md` index and `.qfai/contracts/**` declared files are aligned.
462
+ - [ ] `_policies/05_Contracts.md` index and `.qfai/contracts/**` declared files are aligned.
461
463
  - [ ] Upper-to-lower references were not introduced.
462
464
  - [ ] At least one user-story slice passed gate before plan finalization.
463
- - [ ] Required `_shared` + `spec-XXXX` outputs exist and are internally consistent.
464
- - [ ] `_shared/04_Business-Flow.md` is Markdown + Mermaid (`flowchart` or `sequenceDiagram`).
465
+ - [ ] Required `_policies` + `spec-XXXX` outputs exist and are internally consistent.
466
+ - [ ] `_policies/04_Business-Flow.md` is Markdown + Mermaid (`flowchart` or `sequenceDiagram`).
465
467
  - [ ] Mermaid syntax was not written in ` ```text ` or language-less fences.
466
468
  - [ ] `10_Plan.md` is finalized with implementation/test strategy (How-only).
467
469
  - [ ] `specs/plan.md` was not created.
@@ -493,6 +495,6 @@ When this skill is complete, provide a final user-facing completion message and
493
495
  - Test-first path: `/qfai-atdd`.
494
496
  Action: implement acceptance tests from the finalized spec pack.
495
497
  - Contracts status:
496
- Action: confirm contracts were created/updated under `.qfai/contracts/**` and referenced by `_shared/05_Contracts.md`.
498
+ Action: confirm contracts were created/updated under `.qfai/contracts/**` and referenced by `_policies/05_Contracts.md`.
497
499
  - Spec pack needs correction: rerun `/qfai-sdd`.
498
- Action: fix layered `_shared + spec-XXXX` consistency and decision records, then regenerate evidence.
500
+ Action: fix layered `_policies + spec-XXXX` consistency and decision records, then regenerate evidence.
@@ -15,5 +15,5 @@
15
15
 
16
16
  ## Authoring rules
17
17
 
18
- - This file is shared SSOT across all specs.
18
+ - This file is the policy-layer SSOT for capability mapping across all specs.
19
19
  - Do not copy spec-level details (US/AC/BR/EX/TC) into this file.
@@ -2,7 +2,7 @@
2
2
 
3
3
  ## Purpose
4
4
 
5
- - Describe the high-level business process as shared SSOT.
5
+ - Describe the high-level business process as policy-layer SSOT.
6
6
  - Keep acceptance scenarios in `spec-XXXX/03_Acceptance-Criteria.md`.
7
7
 
8
8
  ## Actors / Systems
@@ -3,7 +3,7 @@
3
3
  ## Purpose
4
4
 
5
5
  - Keep contracts as SSOT under `.qfai/contracts/**` with deterministic IDs.
6
- - Use this file as a readable index with short IDs for planning and review.
6
+ - Use this file as a readable policy-layer index with short IDs for planning and review.
7
7
 
8
8
  ## Contract Index
9
9
 
@@ -3,13 +3,51 @@
3
3
  - Spec: spec-0001
4
4
  - Parent: CAP-0001
5
5
 
6
+ ## Consumer View
7
+
8
+ - Primary SSOT for execution: `spec-0001/01_Spec.md`
9
+ - Default read set: this file + relevant contracts only
10
+ - `_policies` is read-only escalation context and must not be read by default
11
+
6
12
  ## Scope
7
13
 
8
14
  - In:
9
15
  - Out:
10
16
 
17
+ ## Applicable NFR
18
+
19
+ - NFR:
20
+
21
+ ## Applicable Policy
22
+
23
+ - Policy:
24
+
25
+ ## Evidence Summary
26
+
27
+ - Evidence:
28
+
29
+ ## Relevant Requirements
30
+
31
+ - REQ:
32
+
11
33
  ## Entry points
12
34
 
13
35
  - US range in this spec: US-0001..
14
36
  - Primary actors:
15
37
  - Notes:
38
+
39
+ ## Escalation Hook (Read \_policies only when needed)
40
+
41
+ ### When to Escalate
42
+
43
+ - Ambiguous: multiple valid implementations exist.
44
+ - Conflict: NFR / Policy / AC conflict.
45
+ - Missing: required constraints or policy are unclear.
46
+ - Trade-off: performance vs security vs DX must be decided.
47
+
48
+ ### Escalation Targets (Read-only, decision basis)
49
+
50
+ - specs/\_policies/01_Objective.md
51
+ - specs/\_policies/02_Initiative.md
52
+ - specs/\_policies/07_Constraints.md
53
+ - specs/\_policies/08_Decisions.md
@@ -26,6 +26,7 @@ mode: approval-gated
26
26
  - Fixed response: "This command is deprecated. Use /qfai-atdd and /qfai-verify."
27
27
  - Completion gate is `qfai validate --fail-on error` with evidence.
28
28
  - `scenario.feature` and coverage ledgers are legacy optional artifacts and not completion gates.
29
+ - Canonical execution entry is `.qfai/specs/spec-*/01_Spec.md`; policy escalation, if needed, follows its `_policies` hook.
29
30
  - Canonical policy source: `.qfai/assistant/steering/test-layers.md`.
30
31
 
31
32
  ## Sub-agent Delegation (MANDATORY)
@@ -26,6 +26,7 @@ mode: approval-gated
26
26
  - Fixed response: "This command is deprecated. Use /qfai-atdd and /qfai-verify."
27
27
  - Completion gate is `qfai validate --fail-on error` with evidence.
28
28
  - `scenario.feature` and coverage ledgers are legacy optional artifacts and not completion gates.
29
+ - Canonical execution entry is `.qfai/specs/spec-*/01_Spec.md`; policy escalation, if needed, follows its `_policies` hook.
29
30
  - Canonical policy source: `.qfai/assistant/steering/test-layers.md`.
30
31
 
31
32
  ## Sub-agent Delegation (MANDATORY)
@@ -26,6 +26,7 @@ mode: approval-gated
26
26
  - Fixed response: "This command is deprecated. Use /qfai-atdd and /qfai-verify."
27
27
  - Completion gate is `qfai validate --fail-on error` with evidence.
28
28
  - `scenario.feature` and coverage ledgers are legacy optional artifacts and not completion gates.
29
+ - Canonical execution entry is `.qfai/specs/spec-*/01_Spec.md`; policy escalation, if needed, follows its `_policies` hook.
29
30
  - Canonical policy source: `.qfai/assistant/steering/test-layers.md`.
30
31
 
31
32
  ## Sub-agent Delegation (MANDATORY)
@@ -4,7 +4,7 @@
4
4
 
5
5
  `qfai validate` treats specs as a layered package:
6
6
 
7
- - shared definitions: `.qfai/specs/_shared/**`
7
+ - upper-layer policies and decision bases: `.qfai/specs/_policies/**`
8
8
  - capability-specific details: `.qfai/specs/spec-XXXX/**`
9
9
 
10
10
  The split policy is fixed: **1 CAP = 1 spec directory**.
@@ -13,7 +13,7 @@ The split policy is fixed: **1 CAP = 1 spec directory**.
13
13
 
14
14
  ```text
15
15
  specs/
16
- ├── _shared/
16
+ ├── _policies/
17
17
  │ ├── 01_Objective.md
18
18
  │ ├── 02_Initiative.md
19
19
  │ ├── 03_Capabilities.md
@@ -37,10 +37,17 @@ specs/
37
37
  └── 10_Plan.md (optional, How-only)
38
38
  ```
39
39
 
40
+ Execution Consumer View is fixed:
41
+
42
+ - Primary SSOT for execution is `spec-XXXX/01_Spec.md`.
43
+ - Execution skills must not read `_policies/**` by default.
44
+ - Read `_policies/**` only when `01_Spec.md` explicitly triggers the Escalation Hook.
45
+
40
46
  ## ID and parent rules
41
47
 
42
- - Shared capability ID: `CAP-0001` (defined in `_shared/03_Capabilities.md`)
48
+ - Shared capability ID: `CAP-0001` (defined in `_policies/03_Capabilities.md`)
43
49
  - Spec root (`01_Spec.md`) must include `Parent: CAP-0001`.
50
+ - `01_Spec.md` must also copy down applicable NFR/policy/requirements/evidence summary and include an Escalation Hook to `_policies`.
44
51
  - Item IDs are file-local and parent-driven:
45
52
  - `US-0001` -> Parent: `CAP-0001`
46
53
  - `AC-0001` -> defined in `03_Acceptance-Criteria.md` (Gherkin/comment/table)
@@ -57,7 +64,7 @@ Each `spec-XXXX/` must satisfy:
57
64
  - `BR -> EX`
58
65
  - `EX -> TC`
59
66
 
60
- `_shared/` files must not contain lower-layer IDs (`US/AC/BR/EX/TC`) or `spec-XXXX` references.
67
+ `_policies/` files must not contain lower-layer IDs (`US/AC/BR/EX/TC`) or `spec-XXXX` references.
61
68
 
62
69
  ## Notes
63
70
 
@@ -66,12 +73,12 @@ Each `spec-XXXX/` must satisfy:
66
73
  - `/qfai-sdd` requires a complete `discussion/discussion-*/` pack and stops if it is missing or incomplete.
67
74
  - Blocking OQ in `discussion-*/11_OQ-Register.md` (`Disposition: open`) must be resolved before SDD proceeds.
68
75
  - Preflight writes `.qfai/report/preflight_summary.md` before spec generation to record selected inputs and open gaps.
69
- - `_shared/04_Business-Flow.md` must include at least one ` ```mermaid ` block and at least one `flowchart` or `sequenceDiagram`.
70
- - Business Flow must be documented in `_shared/04_Business-Flow.md` (Markdown). Legacy `*Business-flow*.feature` is deprecated.
76
+ - `_policies/04_Business-Flow.md` must include at least one ` ```mermaid ` block and at least one `flowchart` or `sequenceDiagram`.
77
+ - Business Flow must be documented in `_policies/04_Business-Flow.md` (Markdown). Legacy `*Business-flow*.feature` is deprecated.
71
78
  - Gherkin is documented in `spec-XXXX/03_Acceptance-Criteria.md`.
72
79
  - If diagrams are written in discussion/spec/evidence artifacts, use ` ```mermaid ` fences only (do not use ` ```text ` or language-less fences).
73
80
  - Delta file accepts `09_delta.md` or any `*_delta.md`.
74
- - `07_Decisions.md` / `08_Open-questions.md` and `_shared/08_Decisions.md` / `_shared/09_Open-questions.md` / `_shared/10_delta.md` are required even when empty.
81
+ - `07_Decisions.md` / `08_Open-questions.md` and `_policies/08_Decisions.md` / `_policies/09_Open-questions.md` / `_policies/10_delta.md` are required even when empty.
75
82
  - When empty, explicitly write `0 items` (or equivalent wording) in each file.
76
83
  - Contracts SSOT remains `.qfai/contracts/**`.
77
84
  - Report artifacts under `.qfai/report/**` are derived outputs (non-SSOT).