qfai 1.9.2 → 1.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (136) hide show
  1. package/README.md +67 -6
  2. package/assets/init/.qfai/assistant/README.md +27 -0
  3. package/assets/init/.qfai/assistant/agents/acceptance-test-engineer.md +1 -0
  4. package/assets/init/.qfai/assistant/agents/backend-engineer.md +1 -0
  5. package/assets/init/.qfai/assistant/agents/completion-reviewer.md +29 -2
  6. package/assets/init/.qfai/assistant/agents/delivery-planner.md +17 -0
  7. package/assets/init/.qfai/assistant/agents/frontend-engineer.md +1 -0
  8. package/assets/init/.qfai/assistant/agents/implementation-reviewer.md +17 -0
  9. package/assets/init/.qfai/assistant/agents/orchestrator.md +2 -2
  10. package/assets/init/.qfai/assistant/agents/qa-gatekeeper.md +183 -5
  11. package/assets/init/.qfai/assistant/agents/test-design-analyst.md +22 -3
  12. package/assets/init/.qfai/assistant/catalog/cli-ux-guidelines.md +2 -2
  13. package/assets/init/.qfai/assistant/catalog/spec_required_files.json +2 -1
  14. package/assets/init/.qfai/assistant/catalog/test-layers-ci-lanes.md +60 -0
  15. package/assets/init/.qfai/assistant/catalog/test-layers.md +430 -13
  16. package/assets/init/.qfai/assistant/catalog/worklog-entry.schema.md +165 -0
  17. package/assets/init/.qfai/assistant/constitution/communication.md +1 -1
  18. package/assets/init/.qfai/assistant/constitution/constitution.md +1 -1
  19. package/assets/init/.qfai/assistant/constitution/drift-protocol.md +359 -10
  20. package/assets/init/.qfai/assistant/constitution/quality.md +35 -5
  21. package/assets/init/.qfai/assistant/constitution/requirements-decomposition.md +37 -0
  22. package/assets/init/.qfai/assistant/constitution/shared-skill-delegation-baseline.md +419 -8
  23. package/assets/init/.qfai/assistant/constitution/shared-skill-operating-baseline.md +122 -5
  24. package/assets/init/.qfai/assistant/constitution/workflow.md +53 -7
  25. package/assets/init/.qfai/assistant/manifest/agent-catalog.yml +439 -946
  26. package/assets/init/.qfai/assistant/manifest/agent-routing.yml +116 -4
  27. package/assets/init/.qfai/assistant/manifest/review-profiles.yml +9 -0
  28. package/assets/init/.qfai/assistant/process/migrations/v1.4.27-atdd-alignment.md +1 -1
  29. package/assets/init/.qfai/assistant/skills/qfai-atdd/SKILL.md +150 -53
  30. package/assets/init/.qfai/assistant/skills/qfai-atdd/references/credential-reuse.md +146 -0
  31. package/assets/init/.qfai/assistant/skills/qfai-atdd/references/red-provenance.md +456 -0
  32. package/assets/init/.qfai/assistant/skills/qfai-atdd/references/review-fix-rounds.md +128 -0
  33. package/assets/init/.qfai/assistant/skills/qfai-atdd/references/scaffolding.md +29 -0
  34. package/assets/init/.qfai/assistant/skills/qfai-atdd/references/shared-test-artifacts.md +96 -0
  35. package/assets/init/.qfai/assistant/skills/qfai-atdd/references/stale-manifest.md +34 -0
  36. package/assets/init/.qfai/assistant/skills/qfai-atdd/references/test-case-depth-checklist.md +52 -5
  37. package/assets/init/.qfai/assistant/skills/qfai-configure/SKILL.md +16 -8
  38. package/assets/init/.qfai/assistant/skills/qfai-discussion/SKILL.md +8 -4
  39. package/assets/init/.qfai/assistant/skills/qfai-discussion/references/design-md-brand-catalog.md +2 -2
  40. package/assets/init/.qfai/assistant/skills/qfai-discussion/references/discussion-completion-matrix.md +17 -7
  41. package/assets/init/.qfai/assistant/skills/qfai-discussion/references/rcp_footer.md +10 -4
  42. package/assets/init/.qfai/assistant/skills/qfai-discussion/references/review-cycle-playbook.md +5 -1
  43. package/assets/init/.qfai/assistant/skills/qfai-discussion/references/ui-bearing-playbook.md +4 -4
  44. package/assets/init/.qfai/assistant/skills/qfai-discussion/references/ui_ux/review_audit_playbook.md +1 -1
  45. package/assets/init/.qfai/assistant/skills/qfai-discussion/references/ui_ux/trend_scan_playbook.md +1 -1
  46. package/assets/init/.qfai/assistant/skills/qfai-discussion/references/ui_ux_best_practices.md +17 -7
  47. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/01_Context.md +1 -1
  48. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/02_Inception-Deck.md +1 -1
  49. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/03_Story-Workshop.md +11 -3
  50. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/05_Scope.md +5 -2
  51. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/07_NFR.md +1 -1
  52. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/09_Constraints.md +7 -4
  53. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/10_Policy.md +1 -1
  54. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/11_OQ-Register.md +1 -1
  55. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/12_OQ-Resolution-Log.md +1 -1
  56. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/14_Review-Request.md +14 -7
  57. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/99_delta.md +1 -1
  58. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/review/Rxx_reviewer.md +16 -7
  59. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/review/review_request.md +9 -6
  60. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/review/summary.json +2 -0
  61. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/uiux/40_screen_contracts.md +3 -2
  62. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/uiux/50_review_input_bundle.md +4 -2
  63. package/assets/init/.qfai/assistant/skills/qfai-implement/SKILL.md +252 -130
  64. package/assets/init/.qfai/assistant/skills/qfai-implement/references/change-request-reset.md +93 -0
  65. package/assets/init/.qfai/assistant/skills/qfai-implement/references/checkpoint-verification.md +210 -0
  66. package/assets/init/.qfai/assistant/skills/qfai-implement/references/cross-spec-ownership.md +73 -0
  67. package/assets/init/.qfai/assistant/skills/qfai-implement/references/evidence-revision.md +291 -0
  68. package/assets/init/.qfai/assistant/skills/qfai-implement/references/execution-ledger.md +389 -0
  69. package/assets/init/.qfai/assistant/skills/qfai-implement/references/final-checklist.md +28 -0
  70. package/assets/init/.qfai/assistant/skills/qfai-implement/references/finding-classification.md +49 -0
  71. package/assets/init/.qfai/assistant/skills/qfai-implement/references/ledger-preconditions.md +55 -0
  72. package/assets/init/.qfai/assistant/skills/qfai-implement/references/oracle-strength.md +81 -0
  73. package/assets/init/.qfai/assistant/skills/qfai-implement/references/parallelization-policy.md +235 -0
  74. package/assets/init/.qfai/assistant/skills/qfai-implement/references/red-admissibility.md +91 -0
  75. package/assets/init/.qfai/assistant/skills/qfai-implement/references/red-not-observable.md +112 -0
  76. package/assets/init/.qfai/assistant/skills/qfai-implement/references/relevant-test-suite.md +87 -0
  77. package/assets/init/.qfai/assistant/skills/qfai-implement/references/review-artifact-layout.md +44 -0
  78. package/assets/init/.qfai/assistant/skills/qfai-implement/references/round-evidence.md +118 -0
  79. package/assets/init/.qfai/assistant/skills/qfai-implement/references/selector-granularity.md +24 -0
  80. package/assets/init/.qfai/assistant/skills/qfai-implement/references/upstream-artifact-ordering.md +33 -0
  81. package/assets/init/.qfai/assistant/skills/qfai-implement/references/volume-policy.md +149 -0
  82. package/assets/init/.qfai/assistant/skills/qfai-prototyping/SKILL.md +35 -18
  83. package/assets/init/.qfai/assistant/skills/qfai-prototyping/references/evidence-requirements.md +1 -1
  84. package/assets/init/.qfai/assistant/skills/qfai-prototyping/references/generator-prompt.md +106 -7
  85. package/assets/init/.qfai/assistant/skills/qfai-prototyping/references/handoff.md +40 -11
  86. package/assets/init/.qfai/assistant/skills/qfai-prototyping/references/iteration-loop.md +48 -1
  87. package/assets/init/.qfai/assistant/skills/qfai-prototyping/templates/DESIGN.md.sample +6 -0
  88. package/assets/init/.qfai/assistant/skills/qfai-sdd/SKILL.md +87 -22
  89. package/assets/init/.qfai/assistant/skills/qfai-sdd/references/contract-artifact-rules.md +148 -0
  90. package/assets/init/.qfai/assistant/skills/qfai-sdd/references/rcp_footer.md +10 -4
  91. package/assets/init/.qfai/assistant/skills/qfai-sdd/references/review-cycle-playbook.md +5 -1
  92. package/assets/init/.qfai/assistant/skills/qfai-sdd/references/sdd-execution-playbook.md +4 -2
  93. package/assets/init/.qfai/assistant/skills/qfai-sdd/references/sdd-phase-checklists.md +18 -0
  94. package/assets/init/.qfai/assistant/skills/qfai-sdd/references/sdd-quality-gate.md +44 -3
  95. package/assets/init/.qfai/assistant/skills/qfai-sdd/references/sdd-triage.md +60 -7
  96. package/assets/init/.qfai/assistant/skills/qfai-sdd/references/spec-traceability-rules.md +171 -6
  97. package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/change-request.md +125 -0
  98. package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/contracts/db-contract.sample.sql +6 -0
  99. package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/evidence/sdd-spec.md +92 -0
  100. package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/specs/_policies/01_Objective.md +27 -0
  101. package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/specs/_policies/02_Initiative.md +30 -0
  102. package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/specs/_policies/05_Contracts.md +16 -6
  103. package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/specs/_policies/06_Glossary.md +19 -0
  104. package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/specs/_policies/07_Constraints.md +25 -0
  105. package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/specs/_policies/08_Decisions.md +22 -2
  106. package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/specs/_policies/11_Slice-Policy.md +37 -10
  107. package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/specs/spec/02_User-stories.md +20 -0
  108. package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/specs/spec/03_Acceptance-Criteria.md +19 -0
  109. package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/specs/spec/04_Business-Rules.md +32 -3
  110. package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/specs/spec/06_Test-Cases.md +56 -0
  111. package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/specs/spec/07_Decisions.md +29 -2
  112. package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/specs/spec/10_Plan.md +41 -0
  113. package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/specs/spec/16_Traceability-ledger.md +58 -0
  114. package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/specs/spec/tdd/test-list.md +56 -0
  115. package/assets/init/.qfai/assistant/skills/qfai-verify/SKILL.md +57 -102
  116. package/assets/init/.qfai/assistant/skills/qfai-verify/references/articles.md +24 -0
  117. package/assets/init/.qfai/assistant/skills/qfai-verify/references/context-load.md +22 -0
  118. package/assets/init/.qfai/assistant/skills/qfai-verify/references/verify-output-contract.md +48 -0
  119. package/assets/init/.qfai/assistant/skills/qfai-verify/templates/verify-evidence.md +48 -0
  120. package/assets/init/.qfai/assistant/skills/web-research/SKILL.md +25 -7
  121. package/assets/init/.qfai/waivers.yml +11 -5
  122. package/assets/init/root/.github/workflows/qfai-tests.yml +318 -0
  123. package/assets/init/root/.github/workflows/qfai-validate.yml +327 -24
  124. package/assets/init/root/DESIGN.md +6 -0
  125. package/assets/init/root/qfai.config.yaml +15 -12
  126. package/dist/cli/index.cjs +20646 -13620
  127. package/dist/cli/index.cjs.map +1 -1
  128. package/dist/cli/index.mjs +22101 -15061
  129. package/dist/cli/index.mjs.map +1 -1
  130. package/dist/index.cjs +13954 -8829
  131. package/dist/index.cjs.map +1 -1
  132. package/dist/index.d.cts +423 -14
  133. package/dist/index.d.ts +423 -14
  134. package/dist/index.mjs +9330 -4224
  135. package/dist/index.mjs.map +1 -1
  136. package/package.json +22 -19
@@ -22,17 +22,58 @@ Use this file for the full quality gate checklist behind `/qfai-sdd`.
22
22
  - UPDATE rows carry a Sub-op of APPEND / MODIFY / REMOVE.
23
23
  - CREATE / DELETE / SPLIT / MERGE / SUPERSEDE and UPDATE:REMOVE rows record an `Approved By` value.
24
24
 
25
+ ## Contract Checks
26
+
27
+ Phase 0 is a mandatory output of this skill, so its own artifacts belong on this page.
28
+
29
+ - Every `api/`, `db/` and `ui/` contract declares a unique, correctly-prefixed `QFAI-CONTRACT-ID`.
30
+ - Every `db/` contract has been **applied to a scratch database**, and every declared write path
31
+ **driven at least twice** — the second traversal is what exercises head-advance and
32
+ expected-version guards. Applying cleanly is the floor, not the gate: a contract that applies
33
+ without error still fails at runtime, because the failure is a resolution error inside a PL/pgSQL
34
+ body rather than a syntax error.
35
+ - The command and result are recorded in `.qfai/evidence/sdd-<spec-id>.md`; `QFAI-CONTRACT-031`
36
+ (`warning`) reports a `db/` contract with no such record.
37
+ - `QFAI-DB-001` dangerous-SQL warnings are resolved or explicitly triaged.
38
+ - Full rule: `references/contract-artifact-rules.md#executability-must`.
39
+
40
+ ## Cross-contract Checks
41
+
42
+ - Every terminal state, status enum value, and error code an API contract mandates has a
43
+ representable counterpart in the paired DB contract (`references/contract-artifact-rules.md#cross-contract-reconciliation-must`).
44
+ - Failure / rejection paths in particular: the DB has an honest terminal value for each API-mandated
45
+ failure outcome, rather than a success state whose preconditions cannot hold on failure.
46
+ - The reconciled API↔DB pairing is recorded in `_policies/05_Contracts.md`.
47
+ - `QFAI-CONTRACT-040` warnings are resolved or explicitly triaged before sign-off.
48
+
25
49
  ## Traceability Checks
26
50
 
27
- - `US -> AC -> BR -> EX -> TC` edges exist.
51
+ - `US -> AC -> BR -> EX -> TC` edges exist. Check this against `.qfai/report/run-*/traceability.json`,
52
+ which is built from the parsed spec pack on every run, clean or failing. Table-layout specs
53
+ (`05_Examples.md` + `06_Test-Cases.md`) carry `BR_TO_AC`, `EX_TO_BR`, `TC_TO_AC` and `TC_TO_EX`
54
+ edges; the older `Examples.feature` layouts carry `AC_TO_US`, `BR_TO_AC` and either
55
+ `EX_TO_BR` / `TC_TO_EX` or `SC_TO_AC` / `CASE_TO_SC`. `EX_TO_AC` also appears: in v1417 an
56
+ `EX` may hang off an `AC` directly rather than off a `BR`, and the graph builder emits both
57
+ edge kinds — it is a normal edge type, not an unknown one. An empty `edges` array on a spec
58
+ pack that has specs is a finding, not a tool limitation.
28
59
  - `05_Examples.md` includes `EX-ID` and `BR-Ref`.
29
- - `06_Test-Cases.md` includes `TC-ID`, `EX-Ref`, `AC-Refs`, and `Type`.
60
+ - `06_Test-Cases.md` includes `TC-ID`, `Level`, `EX-Ref`, `AC-Refs`, and `Type`. `Level` holds exactly one code from `.qfai/assistant/catalog/test-layers.md#layer-definitions`, which defines all five (`L1`-`L5`); the template's list is a reading aid pointing back at it.
30
61
  - Error or boundary coverage is present, not only normal-path coverage.
62
+ - **The chain does not terminate at `TC`.** Every `BR` / `AC` names the contract that realizes it,
63
+ and every persisted attribute it names resolves to a column, field or enum member in that
64
+ contract — directly or by a stated join. Phase 0 authors contracts before these obligations
65
+ exist, so an obligation the contract cannot express passes every other check on this page: the
66
+ SQL is valid, the `US -> AC -> BR -> EX -> TC` edges are complete, `npx qfai validate` is clean.
67
+ Driving the declared path succeeds, so execution-based checking does not find it either. See
68
+ `references/contract-artifact-rules.md#obligation-reconciliation-must--phase-2c`.
31
69
 
32
70
  ## Validation Checks
33
71
 
34
- - `qfai validate --profile sdd --fail-on error --format github | tee .qfai/report/validate.log`
72
+ - `npx qfai validate --profile sdd --fail-on error --format github`
35
73
  - `error=0`
74
+ - `<paths.outDir>/validate.log` (`.qfai/report/validate.log` by default) — written automatically by the
75
+ command above (no `tee` redirect); its `run_log:` line points at the `run-*/` directory of that run.
76
+ A project that changed `paths.outDir` in `qfai.config.yaml` finds both under its configured directory
36
77
  - `.qfai/report/specs-coverage/spec-*.md` reviewed
37
78
  - Density-smell warnings triaged
38
79
 
@@ -18,8 +18,16 @@ Concretely, before persisting any Triage row:
18
18
  and `04_Business-Rules.md`. The classifier output is a _proposal_; the
19
19
  final decision must be informed by reading the candidate spec body.
20
20
  2. Pick the spec whose scope most closely absorbs the new requirement.
21
- 3. Append a new BR/AC/EX/TC there. If the spec is over the size threshold,
22
- propose **SPLIT**, never CREATE-as-shortcut.
21
+ 3. Append a new BR/AC/EX/TC there. Never CREATE-as-shortcut. A spec over the
22
+ size threshold is a **signal, not an operation**: record the breach in the
23
+ row's `Rationale` — for a MERGE row, every breaching target — and start a
24
+ capability-ownership review. Propose **SPLIT** only if that review shows the
25
+ spec genuinely owns more than one `CAP-NNNN`; if it owns exactly one, the
26
+ operation already selected is unchanged (MERGE stays MERGE, APPEND stays
27
+ APPEND) and the reasoned non-split is recorded. A count-driven SPLIT of a
28
+ single-capability spec is illegal — `validateSpecSplitByCapability` raises
29
+ `QFAI-SPLIT-102` / `QFAI-SPLIT-104` at `error`, so it has no legal end
30
+ state. See `_policies/11_Slice-Policy.md` step 4.
23
31
  4. Only when no active spec's scope can absorb the requirement, AND the
24
32
  underlying capability is itself new, propose **CREATE**. Add the new
25
33
  `CAP-NNNN` to `_policies/03_Capabilities.md` _first_, then cite it in
@@ -37,14 +45,53 @@ shares the most subject tokens. CREATE is emitted only when there is
37
45
  | Operation | Sub-op | When to choose | Approval |
38
46
  | --------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- |
39
47
  | CREATE | - | New subject; no active spec owns the capability | Required |
40
- | UPDATE | APPEND | Add new US/AC/BR/EX/TC to an active spec (no semantic change) | - |
41
- | UPDATE | MODIFY | Change the meaning of an existing US/AC/BR/EX/TC | - |
48
+ | UPDATE | APPEND | Add new US/AC/BR/EX/TC to an active spec (no semantic change). Item-level only. With UPDATE:MODIFY this is also how an item is decomposed into N siblings — see Operation scope below | - |
49
+ | UPDATE | MODIFY | Change the meaning of an existing US/AC/BR/EX/TC. Item-level only | - |
42
50
  | UPDATE | REMOVE | Delete an existing US/AC/BR/EX/TC (cuts downstream refs) | Required |
43
- | DELETE | - | Subject was removed from the product; the spec itself goes away | Required |
44
- | SPLIT | - | One spec carries >1 capability; split into N specs | Required |
45
- | MERGE | - | Multiple specs converge on one capability; collapse them | Required |
51
+ | DELETE | - | Subject was removed from the product; the spec itself goes away. **Spec-scoped only** — deleting one item is UPDATE:REMOVE (QFAI-TRIAGE-007) | Required |
52
+ | SPLIT | - | One spec carries >1 capability; split into N specs. **Spec-scoped only** — never use it to split an item (QFAI-TRIAGE-007) | Required |
53
+ | MERGE | - | Multiple specs converge on one capability; collapse them. **Spec-scoped only** (QFAI-TRIAGE-007) | Required |
46
54
  | SUPERSEDE | - | Responsibilities move to a new spec; flip status, keep history. Also covers single-spec **RENAME** (subject change at the same ID is normally UPDATE:MODIFY; if the spec ID itself must change while scope stays the same — i.e. **RENUMBER** — emit SUPERSEDE: create the new ID, mark the old as superseded). MERGE handles multi-spec consolidation. | Required |
47
55
 
56
+ ### Operation scope (spec-level vs item-level)
57
+
58
+ `SPLIT`, `MERGE`, `SUPERSEDE` and `DELETE` operate on a **whole spec
59
+ directory**. `UPDATE:APPEND / MODIFY / REMOVE` operate on **items inside one
60
+ spec**. There is no operation for decomposing one `US/AC/BR/EX/TC` into N
61
+ siblings within the same spec — that is encoded as `UPDATE:MODIFY` (narrow the
62
+ original) plus one `UPDATE:APPEND` row per new sibling.
63
+
64
+ Do not reach for `SPLIT` to mean "split this business rule": `SPLIT` asserts
65
+ that the spec itself must become N specs, which
66
+ `validateSpecSplitByCapability` then enforces as one `CAP-NNNN` per spec.
67
+ Likewise do not reach for `DELETE` to remove one item — that is
68
+ `UPDATE:REMOVE`.
69
+
70
+ `QFAI-TRIAGE-007` (error) rejects a `SPLIT` / `MERGE` / `SUPERSEDE` / `DELETE`
71
+ row whose `Subject` names an item ID **as the operation's object**. The object
72
+ is decided structurally, by **brackets, not by word order**: an item ID inside
73
+ `(...)` / `(...)` / `[...]` / `【...】` is a citation, and any item ID outside
74
+ brackets is what the operation acts on.
75
+
76
+ - `delete BR-0006-0004 from spec-0006` -> bare item: rejected. Co-occurring
77
+ with a spec name is not an exemption.
78
+ - `in spec-0006, delete BR-0006-0004` -> bare item: rejected. Naming the spec
79
+ first does not help — there it is only the item's location, which is why word
80
+ order cannot decide the object.
81
+ - `split spec-0006 (motivated by BR-0006-0004)` -> item bracketed: accepted.
82
+ - `separate CAP-0003 (driven by BR-0006-0004)` -> item bracketed: accepted.
83
+
84
+ So a genuinely spec-level row names only its `spec-NNNN` / `CAP-NNNN` target
85
+ outside brackets and puts the motivating item inside them. Item IDs are matched
86
+ with the shared digit semantics of `specPackIds.ts`, so `BR-1` and `TC-12345`
87
+ are caught alongside the canonical 4-digit form.
88
+
89
+ Because `UPDATE:MODIFY` and `UPDATE:APPEND` are approval-free by operation
90
+ type, an item decomposition carries no approval-required row. Record the
91
+ conservation statement — which obligations existed before, which exist after,
92
+ and that none were added or dropped — in the `Rationale` column of the
93
+ `UPDATE:MODIFY` row so a reviewer can check it.
94
+
48
95
  ## Inputs
49
96
 
50
97
  1. Latest discussion-pack `06_REQ.md` / `07_NFR.md` / `99_delta.md`.
@@ -122,6 +169,12 @@ ops), `Rationale` (recommended for every row).
122
169
  (APPEND / MODIFY / REMOVE).
123
170
  - `QFAI-TRIAGE-005` (error): approval-required Operation has no
124
171
  `Approved By` value.
172
+ - `QFAI-TRIAGE-007` (error): `SPLIT` / `MERGE` / `SUPERSEDE` / `DELETE` row
173
+ whose `Subject` names a `US/AC/BR/EX/TC` ID as the operation's object. All
174
+ four are spec-scoped: item decomposition is `UPDATE:MODIFY` +
175
+ `UPDATE:APPEND`, and deleting one item is `UPDATE:REMOVE`.
176
+ `QFAI-TRIAGE-003` is a membership check on the Operation label and provably
177
+ cannot catch this.
125
178
  - `QFAI-TRIAGE-006` (error): CREATE row without a `CAP-NNNN` reference
126
179
  in the Rationale column, or referencing a CAP that is not registered
127
180
  in `_policies/03_Capabilities.md`. This is the structural gate that
@@ -4,7 +4,7 @@ Use this file when working on traceability-heavy parts of `/qfai-sdd`.
4
4
 
5
5
  ## Required Layered Layout
6
6
 
7
- `qfai validate` treats specs as a layered package:
7
+ `npx qfai validate` treats specs as a layered package:
8
8
 
9
9
  - Shared policies: `.qfai/specs/_policies/**`
10
10
  - Capability specs: `.qfai/specs/spec-*/**`
@@ -72,21 +72,186 @@ ID reference direction (the value of `Refs:` columns) must be lower-to-upper onl
72
72
  - `US-0001` -> Parent: `CAP-0001`
73
73
  - `AC-0001` -> defined in `03_Acceptance-Criteria.md`
74
74
  - `BR-0001` -> `AC-Refs` in `04_Business-Rules.md`
75
+ - `BR-0001` -> `Contract-Refs` in `04_Business-Rules.md` (comma-separated
76
+ `CON-*` IDs; `-` when the rule binds no contract). Contract IDs recorded
77
+ only in `Notes` are untraced.
75
78
  - `EX-0001` -> `BR-Ref` in `05_Examples.md`
76
79
  - `TC-0001` -> `EX-Ref` and `AC-Refs` in `06_Test-Cases.md`
77
- - `_policies/**` must not contain lower-layer IDs (`US/AC/BR/EX/TC`) or per-spec references.
80
+ - `_policies/**` must not **define or own** lower-layer items. Concretely: no
81
+ traceability edge in `_policies/**` may name a lower-layer ID — no `Parent:`,
82
+ `Refs:`, `AC-Refs`, `BR-Ref` or `EX-Ref` value, and no heading that declares a
83
+ `US/AC/BR/EX/TC` item.
84
+ - **How this is enforced today is broader than that intent.** `QFAI-LAYER-100`
85
+ and `TRACE_SHARED_SCOPE_VIOLATION` are a token scan: they match any
86
+ `US/AC/BR/EX/TC-NNNN` anywhere in a `_policies/**` file, not only in an
87
+ ownership or definition position. Outside the Triage carve-out below, a plain
88
+ prose citation is therefore reported too. Treat the ownership/definition rule
89
+ as the _intent_ and the token scan as the _current mechanism_; when you need
90
+ to name a lower-layer item in `_policies/**`, put it in the Triage table rows,
91
+ which is the one place the scan skips.
92
+ - _Citing_ a lower-layer ID or a `spec-NNNN` inside the **Triage table rows** of
93
+ `_policies/10_delta.md` is explicitly allowed. `sdd-triage.md` requires
94
+ cross-spec and policy-only Triage rows to be persisted there, and
95
+ `QFAI-TRIAGE-002` makes `Existing Spec` (a `spec-NNNN` value) a required
96
+ column — so the `Existing Spec`, `Approved By` and `Rationale` cells must be
97
+ able to name what actually changed, verbatim. `QFAI-LAYER-100` and
98
+ `TRACE_SHARED_SCOPE_VIOLATION` skip those rows for this reason.
99
+ - The carve-out is exactly that narrow, so it cannot be used as an escape
100
+ hatch:
101
+ - **file** — `_policies/10_delta.md` only. A `## Triage` heading anywhere
102
+ else under `_policies/**` (`11_Slice-Policy.md`, `01_Objective.md`, ...)
103
+ gets no exemption.
104
+ - **heading** — the canonical `## Triage` H2 only, matching what
105
+ `QFAI-TRIAGE-001..007` validate. `# Triage`, `### Triage` and
106
+ `## Triage notes` are not exempt.
107
+ - **line shape** — markdown table rows only. A heading that declares an item
108
+ (`### AC-0001-0001`) or a traceability edge (`- Parent: US-0001-0001`)
109
+ inside the Triage section is still a violation, because it defines or owns
110
+ rather than cites.
111
+ - **table identity** — the mandated Triage table only. A second table under
112
+ `## Triage` is exempt only when its header carries the full canonical
113
+ column set (`Source`, `Subject`, `Existing Spec`, `Operation`, `Sub-op`,
114
+ `Approved By`, `Rationale`); order may differ, since the Triage validators
115
+ resolve columns by name. A table reusing only one or two of those names
116
+ earns no exemption.
117
+ - **column** — within an exempt table, only cells under a canonical column
118
+ are skipped. An author-added column (`Parent`, `Refs`, ...) keeps its cells
119
+ visible to the scan.
120
+ - Discussion-layer IDs (`DUS-001`, `DAC-001-01`, `DTC-1`, `DSC-001`) are a different
121
+ namespace and are explicitly allowed in `_policies/**` and in `Source` fields. They are
122
+ how provenance back to the discussion pack stays machine-checkable; do not rewrite them
123
+ into prose to satisfy the rule above.
124
+ - A `Source` value is always the pair `<pack-id>#<discussion-id>`, e.g.
125
+ `discussion-20260415101112123#DUS-001`. The pack half is not optional: pack IDs are the
126
+ only thing that makes a discussion ID unique, because every pack restarts its numbering at
127
+ `DUS-001` / `DAC-001-01`. A spec that two packs have updated therefore carries two `Source`
128
+ values that differ only in the pack half.
129
+ - `Source` is recorded once per item, in the required artifact: the `- Source:` line of each
130
+ `## US-NNNN` block in `02_User-stories.md`, and the `# Source:` comment inside each AC's
131
+ Gherkin block in `03_Acceptance-Criteria.md`. The optional `AC Catalog` table carries no
132
+ `Source` column, so there is no second copy to drift.
133
+
134
+ ### Item granularity
135
+
136
+ Depth expectations answer how many layers; item granularity answers how big one
137
+ item may be. It is defined in
138
+ `.qfai/assistant/constitution/requirements-decomposition.md#item-granularity-acbrextc`
139
+ and signalled by `QFAI-DENSITY-005`.
78
140
 
79
141
  ## TDD Execution Ledger
80
142
 
81
143
  Each `.qfai/specs/<spec-id>/tdd/test-list.md` is the execution ledger for the TDD micro-cycle.
82
144
 
83
145
  - Required columns: TDD-ID, TC-Refs, Layer, Test file, Selector, Status, DR-ID, Evidence
84
- - Coverage is measured as unit/component TC references from `06_Test-Cases.md` appearing in TC-Refs.
146
+ - Optional columns: `US-Refs`, `CON-API-Refs`, `Blocked-By`. `Blocked-By` names what a
147
+ `blocked` row is waiting on and is required on those rows.
148
+ - Legal `Status` values: `todo`, `blocked`, `red`, `green`, `refactor`, `review-fix`,
149
+ `done`, `exception`. `blocked` is completion-prohibiting and is never selected by
150
+ Phase Red.
151
+ - **Ownership split.** `/qfai-sdd` owns the rows — which obligations exist and what each
152
+ covers. `/qfai-implement` owns the `Status`, `DR-ID` and `Evidence` cells unconditionally,
153
+ plus two cells only while a stated condition holds: `Test file` while the seeded value is
154
+ empty or a dash placeholder, and `Selector` while the seeded value does not resolve against
155
+ the row's named test file. It owns nothing else — `TC-Refs`, `Layer`, `US-Refs` and
156
+ `CON-API-Refs` carry the row's obligation identity and stay upstream. This is the carve-out
157
+ in `constitution/drift-protocol.md#allowed-exceptions-minimal-whitelist`, which states both
158
+ conditions; adding, removing or re-scoping a row is an upstream change and takes the Change
159
+ Request path.
160
+ - `Evidence` is a **pointer**: the one-word RED/GREEN outcome plus an anchor into
161
+ `.qfai/evidence/implement-<spec-id>.md`. A GFM cell is one physical line and ends at
162
+ every unescaped `|`, so it cannot hold command output. Encoding rules and the cell
163
+ contract: `qfai-implement/references/execution-ledger.md#evidence-cell-contract`.
164
+ - Optional columns detail: `US-Refs`, `CON-API-Refs` — the E2E and API obligations a
165
+ row implements. Required when the row carries one, since `TC-*` annotations
166
+ are forbidden in `tests/e2e/**` and `tests/api/**`.
167
+ - TC coverage reads **`TC-*` tokens only**. `US-*` and `CON-API-*` IDs are
168
+ explicitly inert to it — recording one does not raise or lower TC coverage.
169
+ - Legal `Layer` values: `Unit`, `Component`, `Integration`, `API`, `E2E`.
170
+ Legal obligation kinds per layer: `TC-*` on Unit / Component / Integration,
171
+ `US-*` on E2E, `CON-API-*` on API.
172
+ - `Selector` may hold one entry, a comma-separated list, or a glob pattern. It is not limited to a single test function.
173
+ - `TC-Refs` is many-to-many with `TDD-ID`: one `TC-*` may be decomposed across several TDD rows, and each of those rows carries that `TC-*`.
174
+ - A matrix-shaped `TC-*` (many rejection reasons, a status-code matrix, several independent state transitions) MUST be split across multiple TDD rows before RED begins — one falsifying oracle per row, one row per independently observable boundary. Do not accumulate unrelated boundaries behind a single selector; doing so invalidates the RED observation, because only the first failing assert is ever observed.
175
+ - Coverage is measured as unit/component TC references from `06_Test-Cases.md`
176
+ appearing in TC-Refs. That measures which TCs need a `tdd/test-list.md` row;
177
+ it says nothing about where the test file lives. A `TC-*` whose declared
178
+ `Level` is `L3` routes its `QFAI-ATDD-112` annotation to
179
+ `tests/integration/**` (`L4` to `tests/api/**`, `L5` to `tests/e2e/**`, no
180
+ declared `Level` to `tests/integration/**`). **`L1`/`L2` owe no ATDD
181
+ annotation at all** — they are out of `/qfai-atdd`'s scope and have no
182
+ mandated directory, so this ledger row is their whole obligation and
183
+ `TDDLIST_TC_NOT_COVERED` is the gate that enforces it. See
184
+ `catalog/test-layers.md`.
85
185
  - If `06_Test-Cases.md` has no test-case classification column, every TC is treated as a coverage target.
86
- - `Status=exception` requires a non-empty DR-ID.
87
- - `Status` in `green`, `refactor`, or `done` requires an existing Test file resolved from project root.
186
+ - `Status=exception` requires a non-empty DR-ID. An `exception` row is not a
187
+ dead end: a Drift Protocol sweep may reset it to `todo` like any other status
188
+ when the rerun changed the obligation it was raised against.
189
+ - `Status` in `green`, `refactor`, or `done` requires an existing Test file
190
+ resolved from project root. The upstream reset does not relax this: a swept
191
+ row returns to `todo`, where no file is required, and writes its test in the
192
+ following `red` phase.
193
+ - **The converse also holds.** A `todo` row whose Test file exists _and_ whose
194
+ `Selector` resolves inside it is a stale ledger row, not a not-started one
195
+ (`TDDLIST_STALE_STATUS`, `warning`). Stated in one direction only, the rule
196
+ could catch the ledger over-reporting and never under-reporting — and
197
+ under-reporting is what actually happens, because work lands from parallel
198
+ worktrees and the ledger is reconciled by hand afterwards. A stale `todo` and
199
+ a genuinely not-started row are indistinguishable to every downstream
200
+ consumer, including the completion gate that reads the ledger. A project that
201
+ declares test paths and selectors up front waives `TDDLIST-005`.
202
+ - `Selector` is read, not merely required: on a row claiming completion it must
203
+ resolve inside the named Test file (`TDDLIST_SELECTOR_UNRESOLVED`, `warning`).
204
+ Resolution is a containment check over the selector text and its last
205
+ identifier token, not a runner-specific parse; waive `TDDLIST-006` for a
206
+ selector form it cannot resolve.
207
+ - `DR-ID` carries Decision Record (`DR-*`) **and** Change Request (`CR-*`)
208
+ references, so it carries the approval that authorised an upstream reset, not
209
+ only `Status = exception`. A row reset by a Drift Protocol sweep records the
210
+ approved `CR-*` / `DR-*` ID there and **retains it through `red`, `green`,
211
+ `refactor` and `done`** — the ledger is the audit trail for why a completed
212
+ row was reopened. Change Requests live at
213
+ `.qfai/decisions/CR-YYYYMMDD-NNNN-<slug>.md` (`CR-\d{8}-\d{4}`).
214
+ - `Layer` must be consistent with `Test file`: an `Integration` row may not
215
+ point into `tests/e2e/**` or `tests/api/**`, and vice versa.
216
+ - More than one `TDD-*` row MAY reference the same `TC-*` — a TC split across
217
+ several test modules is legitimate. `TDD-ID` uniqueness is the only
218
+ identity constraint.
88
219
  - `TDD-ID` must match `TDD-NNNN` and be unique within the spec.
89
- - Missing `tdd/test-list.md` is a warning; missing DR-ID/Evidence columns is an error.
220
+ - Missing `tdd/test-list.md` is a warning **only when the spec declares no
221
+ coverage-target TC**. If it declares any, the absent file also raises
222
+ `TDDLIST_TC_NOT_COVERED` (error) naming them: the obligations do not
223
+ disappear with the ledger, and `QFAI-ATDD-112` no longer covers L1/L2, so
224
+ this is their only gate. Missing DR-ID/Evidence columns is an error.
225
+ - The `Evidence` **cell** is checked too, not only the header: on a row at
226
+ `green` / `refactor` / `review-fix` / `done`, an empty-or-dash cell is
227
+ `TDDLIST_EVIDENCE_EMPTY` and a verdict with no command is
228
+ `TDDLIST_EVIDENCE_STATUS_ONLY`, both at `error`.
229
+
230
+ ## Traceability Ledger (`16_Traceability-ledger.md`)
231
+
232
+ Optional per-spec artifact linking `BR-*` / `AC-*` to the implementation file that realizes them.
233
+ Template: `templates/specs/spec/16_Traceability-ledger.md`.
234
+
235
+ - It is **optional**. Without it `npx qfai validate` emits `QFAI-TRACE-002` (`warning`) and skips the
236
+ implementation-integrity check; the spec is still valid.
237
+ - With it, `QFAI-TRACE-001` (`error`) fires when a spec's `03_Acceptance-Criteria.md` or
238
+ `04_Business-Rules.md` changed on the branch but a linked implementation file did not.
239
+ - Schema for the **layered** layout — the first Markdown table is the one read; header needs ≥3
240
+ columns, one named `Implementation File`:
241
+
242
+ | BR/AC | Implementation File | Test File |
243
+ | ------- | ------------------- | --------- |
244
+ | AC-0001 | src/… | tests/… |
245
+
246
+ First cell must be a `BR-NNNN` / `AC-NNNN` ID; second cell one repo-root-relative path (no globs,
247
+ no `./`). One row per BR/AC ↔ file pair. Extra trailing columns are ignored.
248
+
249
+ - The legacy **spec-pack** layout uses the same filename with a different schema
250
+ (`trace_id, obj_id, init_id, cap_id, flow_id, us_id, ac_id, ex_ids, tc_ids`, checked by
251
+ `QFAI-LEDGER-001`). That check runs only on spec-pack layouts — the two schemas never apply to the
252
+ same file. Do not merge them.
253
+ - Authored and refreshed by `/qfai-sdd` in the same change as the BR/AC it links. It is upstream
254
+ SSOT; downstream skills must not edit it.
90
255
 
91
256
  ## Depth Expectations
92
257
 
@@ -0,0 +1,125 @@
1
+ # Change Request
2
+
3
+ <!--
4
+ Canonical path: `.qfai/decisions/CR-YYYYMMDD-NNNN-<slug>.md`
5
+ ID pattern: `CR-\d{8}-\d{4}`
6
+ A Change Request is the mandatory precondition for any upstream SSOT edit
7
+ (`constitution/drift-protocol.md`). `qfai-implement` blocks spec completion
8
+ while an unresolved CR exists, so `Status` must be a real, checkable field.
9
+ -->
10
+
11
+ - ID: `CR-YYYYMMDD-NNNN`
12
+ - Title: `<one-line summary>`
13
+ - Raised by: `<skill or agent>`
14
+ - Raised at: `YYYY-MM-DDThh:mm:ssZ`
15
+ - Class: `intent` <!-- intent | defect; see constitution/drift-protocol.md#drift-classes -->
16
+ - Status: `open` <!-- open | approved | rejected | superseded -->
17
+ - Approved by: `-` <!-- required whenever Status leaves `open` (approved / rejected / superseded) -->
18
+ - Approved at: `-` <!-- YYYY-MM-DDThh:mm:ssZ -->
19
+ - Approved option: `-` <!-- the option number below that was chosen; stays `-` when Class is defect -->
20
+ - Applied at: `-` <!-- YYYY-MM-DDThh:mm:ssZ; set only after the owner-skill rerun below completed and upstream artifacts are updated -->
21
+ - Superseded by: `-` <!-- CR-ID, required when Status is superseded -->
22
+
23
+ <!--
24
+ `Status: approved` records the operator's decision; `Applied at` records that
25
+ the approved actions were carried out. `qfai-implement` treats an approved CR
26
+ as unresolved until `Applied at` and `Resolution` are both filled, because
27
+ `constitution/drift-protocol.md` resumes downstream work only after the
28
+ upstream artifacts have been updated.
29
+ -->
30
+
31
+ ## Context
32
+
33
+ <!--
34
+ Class `intent`: the upstream SSOT statement and the downstream fact that
35
+ contradicts it. Cite both by path and ID.
36
+ Class `defect`: what the artifact declares, and how it breaks that declaration
37
+ on its own terms. A defect conflicts with nothing external — say what it
38
+ contradicts in itself.
39
+ -->
40
+
41
+ ## Reproduction
42
+
43
+ <!--
44
+ REQUIRED when Class is `defect`; delete this section when Class is `intent`.
45
+ The command and its verbatim output, or the two artifact excerpts that
46
+ contradict each other, with paths and line numbers. A defect claim without a
47
+ reproduction is an intent-drift CR that skipped its options
48
+ (`constitution/drift-protocol.md#drift-classes`).
49
+ -->
50
+
51
+ ## Proposed change
52
+
53
+ <!--
54
+ What must change in the upstream artifact. When Class is `defect` this is the
55
+ single correct fix, and it is what the operator approves.
56
+ -->
57
+
58
+ ## Options (at least 3) and recommendation
59
+
60
+ <!--
61
+ Class `intent` only — delete this section when Class is `defect`. A change with
62
+ exactly one correct answer has no option set; manufacturing a second and third
63
+ so the table is full asks the operator to ratify a comparison its author knew
64
+ was fabricated.
65
+ -->
66
+
67
+ | # | Option | Cost | Risk | Recommended |
68
+ | --- | ---------- | -------- | -------- | ----------- |
69
+ | 1 | `<option>` | `<cost>` | `<risk>` | |
70
+ | 2 | `<option>` | `<cost>` | `<risk>` | ✅ |
71
+ | 3 | `<option>` | `<cost>` | `<risk>` | |
72
+
73
+ ## Blocked downstream items
74
+
75
+ <!--
76
+ The set STOP covers for THIS Change Request
77
+ (`constitution/drift-protocol.md#when-drift-is-detected`, step 1). Enumerate it
78
+ — an item not listed here is not blocked by this CR and continues. The halt is
79
+ not repository-wide, and this section is what makes that checkable.
80
+
81
+ Also state what this CR does NOT block when it would otherwise be assumed, and
82
+ name any other open CR whose blocked set overlaps: the effective halt is the
83
+ union of the open CRs' blocked sets.
84
+ -->
85
+
86
+ | Item | Kind | Why it depends on the artifact |
87
+ | -------------------------- | ---------------------------------- | ------------------------------ |
88
+ | `<spec-NNNN / TDD-NNNN />` | `spec` / `ledger-row` / `contract` | `<TC-Refs names …>` |
89
+
90
+ - Not blocked by this CR: `<items a reader would expect to be blocked, and why they are not>`
91
+ - Overlapping open CRs: `<CR-ID, …>` or `none`
92
+
93
+ ## Impact scope
94
+
95
+ - Specs: `<spec-NNNN, ...>`
96
+ - Plans: `<paths>`
97
+ - Tests: `<paths / TDD-IDs>`
98
+ - Contracts: `<CON-*>`
99
+ - Schema: `<paths>`
100
+
101
+ ## Decision needed from user
102
+
103
+ <!-- The exact question to put to the user. -->
104
+
105
+ ## Approved actions (owner skill rerun plan)
106
+
107
+ 1. `<owner skill>` rerun scope: `<what>`
108
+ 2. Downstream ledger sweep: reset these `tdd/test-list.md` rows, recording this
109
+ CR's ID in their `DR-ID` column. **Enumerate them here, before approval** —
110
+ list the `TDD-ID`s (or a verifiable selection rule such as "every row whose
111
+ `TC-Refs` names TC-0007"), because what the operator approves is this list.
112
+ A reset of any row not covered by it is not operator-approved, and
113
+ `Resolution` must match this list.
114
+ - `<TDD-NNNN>`, `<TDD-NNNN>`, …
115
+ This is the only sanctioned backward status transition — see
116
+ `.qfai/assistant/skills/qfai-implement/SKILL.md`, "Approved Change Request
117
+ reset".
118
+
119
+ ## Resolution
120
+
121
+ <!--
122
+ Filled in when Status leaves `open`. Record what was actually done: the owner
123
+ skill that was rerun and the upstream artifacts it updated, and the ledger rows
124
+ reset (by TDD-ID). Set `Applied at` in the header once this section is true.
125
+ -->
@@ -1,5 +1,11 @@
1
1
  -- QFAI-CONTRACT-ID: CON-DB-0001
2
2
  -- Purpose: Sample order draft persistence contract
3
+ -- Depends on: -
4
+ -- Apply-order dependencies as a comma-separated list of CON-DB-* ids, or `-`
5
+ -- when there are none. List only what must be applied BEFORE this file.
6
+ -- A reference resolved at run time (a deferred FK, a view a later query
7
+ -- reads) is NOT an apply-order dependency: the apply graph is acyclic by
8
+ -- construction, the runtime graph need not be.
3
9
 
4
10
  CREATE TABLE order_drafts (
5
11
  id TEXT PRIMARY KEY,
@@ -0,0 +1,92 @@
1
+ # Evidence: /qfai-sdd (<spec-id>)
2
+
3
+ > Canonical layout for `.qfai/evidence/sdd-<spec-id>.md`, a Mandatory Output of
4
+ > `/qfai-sdd`. Keep every `##` heading below, in this order, even when a section
5
+ > is empty — write `- none` rather than deleting the heading. The completion
6
+ > reviewer grades this file's shape against this template.
7
+
8
+ ## Objective
9
+
10
+ - Spec target: <spec-id>
11
+ - Objective: <what this SDD cycle set out to change for this spec>
12
+
13
+ ## Inputs reviewed
14
+
15
+ - <path or pack id>
16
+ - <path or pack id>
17
+
18
+ ## Preflight summary path
19
+
20
+ - `.qfai/report/preflight_summary.md`
21
+
22
+ ## Triage decisions
23
+
24
+ > One row per incoming REQ/NFR handled for this spec, mirroring the Triage table
25
+ > persisted in `09_delta.md` (per-spec) or `_policies/10_delta.md` (cross-spec).
26
+ > Operation: `CREATE` | `UPDATE` | `DELETE` | `SPLIT` | `MERGE` | `SUPERSEDE`.
27
+ > Sub-op (UPDATE only): `APPEND` | `MODIFY` | `REMOVE`.
28
+ > Approved By is required for CREATE / DELETE / SPLIT / MERGE / SUPERSEDE /
29
+ > UPDATE:REMOVE; use `-` when approval is not required.
30
+
31
+ | Source | Subject | Operation | Sub-op | Approved By | Rationale |
32
+ | -------- | ----------- | --------- | ------ | ----------- | --------- |
33
+ | REQ-XXXX | <one-liner> | UPDATE | APPEND | - | <why> |
34
+
35
+ ## Open questions
36
+
37
+ - OQ-XXXX: <question> — Disposition: open | resolved | deferred
38
+ - <or> none
39
+
40
+ ## Decisions made
41
+
42
+ - DEC-XXXX / DELTA-XXXX: <decision> — <rationale>
43
+ - <or> none
44
+
45
+ ## Work performed
46
+
47
+ - <artifact created or updated, with path>
48
+ - <artifact created or updated, with path>
49
+
50
+ ## Commands executed
51
+
52
+ ```
53
+ npx qfai validate --profile sdd --fail-on error --format github
54
+ ```
55
+
56
+ > No redirect. `npx qfai validate` writes `<paths.outDir>/validate.log` itself on
57
+ > every run, always pointing at that run's `run-*/` directory, so a `| tee` is
58
+ > both unnecessary and not portable to PowerShell. Same command as `SKILL.md`
59
+ > step 8 and `references/sdd-quality-gate.md`.
60
+
61
+ ## Validate evidence paths
62
+
63
+ - `.qfai/report/validate.log`
64
+ - `.qfai/report/run-<timestamp>/` (run id: <run-id>, status: pass | fail)
65
+ - `.qfai/report/specs-coverage/<spec-id>.md`
66
+
67
+ ## Work Orders Summary
68
+
69
+ > Fixed 6-column schema from
70
+ > `.qfai/assistant/constitution/shared-skill-delegation-baseline.md#work-orders-summary`.
71
+ > Do not add, remove or rename columns.
72
+ > `Status` accepts exactly `PASS` or `REVISE` — no other value (no `PENDING`,
73
+ > no `N/A`, no `FAIL`). A work order that has not been reviewed yet is `REVISE`.
74
+
75
+ | Step | Role (sub-agent) | Task title | Input (refs) | Output (refs) | Status (PASS/REVISE) |
76
+ | ---- | ---------------- | ---------- | ------------ | ------------- | -------------------- |
77
+ | 1 | <role> | <task> | <refs> | <refs> | PASS |
78
+
79
+ ## Gaps / Open risks
80
+
81
+ - <residual risk, or the OQ that carries it>
82
+ - <or> none
83
+
84
+ ## Final status
85
+
86
+ - Final status: PASS | REVISE
87
+ - Rationale: <one line>
88
+
89
+ > `Final status` accepts exactly `PASS` or `REVISE`, matching the reviewer
90
+ > vocabulary in `shared-skill-delegation-baseline.md#verdict-vocabulary`. A
91
+ > `REVISE` here maps to `status: "FAIL"` when a review pack's `summary.json` is
92
+ > written; they are the same outcome. Do not invent a third verdict.
@@ -0,0 +1,27 @@
1
+ # 01 Objective
2
+
3
+ The product-level "why" the whole spec pack serves. One objective per project;
4
+ every `CAP-*` in `03_Capabilities.md` traces up to it.
5
+
6
+ ## Objective
7
+
8
+ - <one sentence: the outcome this product exists to produce>
9
+
10
+ ## Success criteria
11
+
12
+ | ID | Criterion | How it is measured |
13
+ | ------ | ---------------------- | ------------------------- |
14
+ | OBJ-01 | `<observable outcome>` | `<metric or observation>` |
15
+
16
+ ## Out of scope
17
+
18
+ - `<what this objective explicitly does not cover>`
19
+
20
+ ## Authoring rules
21
+
22
+ - Outcome only. No solution, no architecture, no delivery sequencing — those
23
+ live in `02_Initiative.md` and `10_Plan.md` respectively.
24
+ - Do not name `US` / `AC` / `BR` / `EX` / `TC` IDs here: `_policies/**` must not
25
+ define or own lower-layer items (`references/spec-traceability-rules.md`).
26
+ - An empty success-criteria table is a finding, not a default. An objective no
27
+ one can measure cannot adjudicate a capability.
@@ -0,0 +1,30 @@
1
+ # 02 Initiative
2
+
3
+ The initiative is the bounded effort undertaken to reach `01_Objective.md`. It
4
+ answers "what are we doing about it", one layer above capabilities.
5
+
6
+ ## Initiative
7
+
8
+ - <one sentence: the bounded effort, not the product>
9
+
10
+ ## Scope
11
+
12
+ | In scope | Out of scope | Why |
13
+ | -------- | -------------------------- | ------------------------- |
14
+ | `<area>` | `<adjacent area excluded>` | `<reason for the border>` |
15
+
16
+ ## Assumptions
17
+
18
+ - `<assumption this initiative rests on, and what falsifies it>`
19
+
20
+ ## Dependencies
21
+
22
+ - `<external system, team, or decision this initiative waits on>`
23
+
24
+ ## Authoring rules
25
+
26
+ - The scope table's `Out of scope` column is load-bearing: a border with no
27
+ stated reason is a border no one can defend when it is challenged.
28
+ - Record a stated assumption here rather than an open question when the work
29
+ proceeds on it. Genuine questions belong in `09_Open-questions.md`.
30
+ - No lower-layer IDs (`references/spec-traceability-rules.md`).