qfai 2.1.0 → 2.1.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 (124) hide show
  1. package/README.md +272 -20
  2. package/assets/defaults/workflows/change-tooling.yml +0 -4
  3. package/assets/init/.claude/settings.json +8 -8
  4. package/assets/init/.codex/hooks.json +6 -6
  5. package/assets/init/.qfai/assistant/agent/implementation-reviewer.md +14 -1
  6. package/assets/init/.qfai/assistant/agent/qa-gatekeeper.md +29 -0
  7. package/assets/init/.qfai/assistant/rule/constitution.md +5 -4
  8. package/assets/init/.qfai/assistant/rule/drift-protocol.md +14 -3
  9. package/assets/init/.qfai/assistant/rule/references/asset-authoring.md +70 -0
  10. package/assets/init/.qfai/assistant/rule/references/context-summary.md +30 -0
  11. package/assets/init/.qfai/assistant/rule/references/gate-failure-autorepair.md +42 -0
  12. package/assets/init/.qfai/assistant/rule/references/griller-recommendations.md +23 -0
  13. package/assets/init/.qfai/assistant/rule/references/host-backstops.md +60 -0
  14. package/assets/init/.qfai/assistant/rule/references/placeholder-scan.md +25 -0
  15. package/assets/init/.qfai/assistant/rule/references/reviewer-findings.md +41 -0
  16. package/assets/init/.qfai/assistant/rule/references/reviewer-remit.md +35 -0
  17. package/assets/init/.qfai/assistant/rule/shared-skill-delegation-baseline.md +26 -139
  18. package/assets/init/.qfai/assistant/rule/shared-skill-operating-baseline.md +6 -137
  19. package/assets/init/.qfai/assistant/rule/stage-cost.md +1 -1
  20. package/assets/init/.qfai/assistant/rule/test-layers.md +42 -0
  21. package/assets/init/.qfai/assistant/skill/qfai-configure/SKILL.md +8 -42
  22. package/assets/init/.qfai/assistant/skill/qfai-configure/references/principles.md +25 -0
  23. package/assets/init/.qfai/assistant/skill/qfai-discussion/SKILL.md +1 -1
  24. package/assets/init/.qfai/assistant/skill/qfai-discussion/references/discussion-completion-matrix.md +9 -2
  25. package/assets/init/.qfai/assistant/skill/qfai-discussion/references/ui_ux/platform_baselines.md +11 -0
  26. package/assets/init/.qfai/assistant/skill/qfai-discussion/references/ui_ux/review_audit_playbook.md +11 -0
  27. package/assets/init/.qfai/assistant/skill/qfai-discussion/references/ui_ux_best_practices.md +12 -36
  28. package/assets/init/.qfai/assistant/skill/qfai-grill/SKILL.md +1 -1
  29. package/assets/init/.qfai/assistant/skill/qfai-grilling/SKILL.md +16 -88
  30. package/assets/init/.qfai/assistant/skill/qfai-grilling/references/delegated-session.md +58 -0
  31. package/assets/init/.qfai/assistant/skill/qfai-grilling/references/session-record.md +42 -0
  32. package/assets/init/.qfai/assistant/skill/qfai-implement/SKILL.md +8 -1
  33. package/assets/init/.qfai/assistant/skill/qfai-implement/references/credential-reuse.md +9 -0
  34. package/assets/init/.qfai/assistant/skill/qfai-implement/references/cross-spec-ownership.md +41 -0
  35. package/assets/init/.qfai/assistant/skill/qfai-implement/references/oracle-strength.md +6 -1
  36. package/assets/init/.qfai/assistant/skill/qfai-implement/references/red-admissibility.md +1 -1
  37. package/assets/init/.qfai/assistant/skill/qfai-implement/references/ui-affecting.md +1 -3
  38. package/assets/init/.qfai/assistant/skill/qfai-maintain/SKILL.md +1 -1
  39. package/assets/init/.qfai/assistant/skill/qfai-migration-v1-to-v2/SKILL.md +4 -4
  40. package/assets/init/.qfai/assistant/skill/qfai-migration-v1-to-v2/references/migration-guide.md +19 -5
  41. package/assets/init/.qfai/assistant/skill/qfai-prototyping/SKILL.md +1 -1
  42. package/assets/init/.qfai/assistant/skill/qfai-prototyping/references/design-md-spec.md +14 -5
  43. package/assets/init/.qfai/assistant/skill/qfai-prototyping/references/generator-prompt.md +10 -0
  44. package/assets/init/.qfai/assistant/skill/qfai-prototyping/references/handoff.md +1 -1
  45. package/assets/init/.qfai/assistant/skill/qfai-prototyping/references/iteration-loop.md +3 -4
  46. package/assets/init/.qfai/assistant/skill/qfai-prototyping/references/review-payload-schema.md +10 -2
  47. package/assets/init/.qfai/assistant/skill/qfai-prototyping/references/reviewer-prompt.md +16 -3
  48. package/assets/init/.qfai/assistant/skill/qfai-run/SKILL.md +6 -21
  49. package/assets/init/.qfai/assistant/skill/qfai-run/references/extraction.md +30 -10
  50. package/assets/init/.qfai/assistant/skill/qfai-run/references/operator-screens.md +34 -0
  51. package/assets/init/.qfai/assistant/skill/qfai-run/references/plan.md +28 -5
  52. package/assets/init/.qfai/assistant/skill/qfai-run/references/stage-points.md +29 -0
  53. package/assets/init/.qfai/assistant/skill/qfai-sdd/SKILL.md +1 -1
  54. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/concrete-abstract-cycle.md +10 -1
  55. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/contract-artifact-rules.md +21 -9
  56. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/design-anti-patterns.md +19 -2
  57. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/design-md-authoring.md +11 -5
  58. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/design-md-brand-catalog.md +17 -2
  59. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/requirements-decomposition.md +2 -2
  60. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/sdd-execution-playbook.md +5 -5
  61. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/sdd-phase-checklists.md +4 -4
  62. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/sdd-quality-gate.md +2 -2
  63. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/sdd-triage.md +47 -5
  64. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/spec-traceability-rules.md +15 -3
  65. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/ui-contract-guide.md +16 -1
  66. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/ui-design-contract-normalization.md +1 -2
  67. package/assets/init/.qfai/assistant/skill/qfai-sdd/templates/change-request.md +2 -2
  68. package/assets/init/.qfai/assistant/skill/qfai-sdd/templates/contracts/db-contract.sample.sql +2 -2
  69. package/assets/init/.qfai/assistant/skill/qfai-sdd/templates/spec/03_contract/cli/cli-NNNN-title.md +2 -2
  70. package/assets/init/.qfai/assistant/skill/qfai-sdd/templates/spec/03_contract/tech.md +1 -1
  71. package/assets/init/.qfai/assistant/skill/qfai-sdd/templates/spec/decisions.md +4 -0
  72. package/assets/init/.qfai/assistant/skill/qfai-triage/SKILL.md +1 -1
  73. package/assets/init/.qfai/assistant/skill/qfai-verify/SKILL.md +1 -1
  74. package/assets/init/.qfai/assistant/skill/qfai-verify/references/verify-output-contract.md +22 -8
  75. package/assets/init/.qfai/assistant/skill/web-research/SKILL.md +2 -10
  76. package/assets/init/.qfai/assistant/step/common-design-md/STEP.md +17 -3
  77. package/assets/init/.qfai/assistant/step/common-gate-run/STEP.md +30 -7
  78. package/assets/init/.qfai/assistant/step/discussion-uiux/STEP.md +11 -1
  79. package/assets/init/.qfai/assistant/step/implement-dep-bump/STEP.md +7 -0
  80. package/assets/init/.qfai/assistant/step/implement-scaffold/STEP.md +3 -3
  81. package/assets/init/.qfai/assistant/step/implement-seam/STEP.md +3 -1
  82. package/assets/init/.qfai/assistant/step/implement-tdd/STEP.md +3 -1
  83. package/assets/init/.qfai/assistant/step/implement-test-fix/STEP.md +2 -0
  84. package/assets/init/.qfai/assistant/step/sdd-flow/STEP.md +2 -0
  85. package/assets/init/.qfai/assistant/step/sdd-gate/STEP.md +4 -0
  86. package/assets/init/.qfai/assistant/step/sdd-triage/STEP.md +7 -3
  87. package/assets/init/.qfai/assistant/step/verify-change-note/STEP.md +8 -5
  88. package/assets/init/.qfai/assistant/step/verify-commit/STEP.md +6 -1
  89. package/assets/init/.qfai/assistant/step/verify-qfai-gate/STEP.md +20 -3
  90. package/assets/init/.qfai/assistant/step/verify-repeat-run/STEP.md +1 -1
  91. package/assets/init/.qfai/assistant/step/verify-repo-gate/STEP.md +23 -6
  92. package/assets/init/.qfai/waivers.yml +1 -1
  93. package/assets/init/root/.agents/rules/ai-readable-markdown.md +98 -0
  94. package/assets/init/root/.agents/rules/api-budget.md +4 -5
  95. package/assets/init/root/.agents/rules/documentation-clarity.md +30 -2
  96. package/assets/init/root/.agents/rules/grilling.md +4 -4
  97. package/assets/init/root/.agents/rules/interface-clarity.md +5 -5
  98. package/assets/init/root/.agents/rules/minimal-implementation.md +8 -0
  99. package/assets/init/root/.agents/rules/reminders.json +2 -2
  100. package/assets/init/root/.agents/rules/temporary-files.md +14 -5
  101. package/assets/init/root/.agents/rules/untrusted-content.md +3 -3
  102. package/assets/init/root/.agents/rules/user-questions.md +34 -7
  103. package/assets/init/root/.gitattributes +9 -0
  104. package/assets/init/root/.github/workflows/qfai-docs.yml +43 -11
  105. package/assets/init/root/.github/workflows/qfai-tests.yml +58 -15
  106. package/assets/init/root/.github/workflows/qfai-validate.yml +49 -42
  107. package/assets/init/root/AGENTS.md +1 -0
  108. package/assets/init/root/CLAUDE.md +1 -0
  109. package/assets/mdschema/story/03_contract/tech.mdschema.yml +7 -3
  110. package/assets/sandbox-templates/default-deny.yaml +0 -2
  111. package/assets/schemas/workflow/plan.schema.json +9 -2
  112. package/assets/scripts/check-mdschema.mjs +172 -5
  113. package/dist/cli/index.cjs +3979 -3055
  114. package/dist/cli/index.cjs.map +1 -1
  115. package/dist/cli/index.mjs +3167 -2243
  116. package/dist/cli/index.mjs.map +1 -1
  117. package/dist/index.cjs +3024 -2500
  118. package/dist/index.cjs.map +1 -1
  119. package/dist/index.d.cts +23 -9
  120. package/dist/index.d.ts +23 -9
  121. package/dist/index.mjs +2881 -2358
  122. package/dist/index.mjs.map +1 -1
  123. package/docs/MIGRATION-2.0.0.md +1 -1
  124. package/package.json +3 -3
@@ -1,6 +1,6 @@
1
1
  # SDD Execution Playbook
2
2
 
3
- Use this sequence for /qfai-sdd. The shipped templates under ../templates/spec/ define each file's shape, and spec-traceability-rules.md#document-shapes states what a template cannot show.
3
+ Use this sequence for /qfai-sdd. The shipped templates under ../templates/spec/ define each file's shape, and the `Document shapes` section of the spec traceability rules states what a template cannot show.
4
4
 
5
5
  ## Stage 0: source inventory
6
6
 
@@ -11,7 +11,7 @@ Use this sequence for /qfai-sdd. The shipped templates under ../templates/spec/
11
11
 
12
12
  ## Stage 1: triage and decisions
13
13
 
14
- Follow sdd-triage.md. Classify each requirement against existing policy, flow, story, example, and contract content.
14
+ Follow the triage reference. Classify each requirement against existing policy, flow, story, example, and contract content.
15
15
  Identify every affected flow. Put each approval-required operation to the user through the shared user-question
16
16
  protocol before a dependent write, and append its change request row to decisions.md once approved; record unresolved
17
17
  questions in open-questions.md. In --auto, ask nothing and stop dependent work. A declined change request is appended at REJECTED.
@@ -22,7 +22,7 @@ questions in open-questions.md. In --auto, ask nothing and stop dependent work.
22
22
  A constraint is a limit in plain words; its ID is its place in its section, so removing a row renumbers the rows after it.
23
23
  A layer boundary is a row of tech.md `## Architecture`, written from the technical decisions the pack records and, in an existing codebase, its module layout and import directions: what each layer does and the layers below it that it may import from.
24
24
  A layer is a group of modules whose dependencies point one way: down. The section draws the layers as one `flowchart TD`, then lists them in the table from the uppermost down, and the two name the same layers and edges.
25
- Implementation places new code by that table and reviewers judge a change against it, as spec-traceability-rules.md#architecture states.
25
+ Implementation places new code by that table and reviewers judge a change against it, as the `Architecture` section of the spec traceability rules states.
26
26
  2. Write 02_business-flow/business-flows.md and the affected business-flow-NNNN/business-flow.md files. Each flow's `## Flow` section is exactly one Mermaid flowchart or sequenceDiagram.
27
27
  3. Allocate BF and US IDs from the highest existing ID in their scopes, counting retired IDs named in decisions rows. Add rows to the flow and story indexes.
28
28
 
@@ -37,12 +37,12 @@ questions in open-questions.md. In --auto, ask nothing and stop dependent work.
37
37
 
38
38
  1. Write the 03_contract/ view and each contract file from its paired template or contract-specific template. tech.md holds the stack, the runtime dependencies and, in its Standard commands section, the only quality-gate command definitions. It holds no BR.
39
39
  2. Put each BR inside the contract that enforces it, numbered `BR-<contract number>-NNNN`. Cite at least one EX already written. Every EX is cited by at least one BR. A shared rule has one authoritative definition, and no other contract cites it.
40
- 3. Give each new contract the next contract number, declare its `<KIND>-NNNN` ID, name the file `<kind>-NNNN-<slug>.<ext>`, and add its row to contracts.md in the same change. Reconcile API and DB fields, state transitions, errors, and persisted attributes. Run the executable DB contract checks required by contract-artifact-rules.md.
40
+ 3. Give each new contract the next contract number, declare its `<KIND>-NNNN` ID, name the file `<kind>-NNNN-<slug>.<ext>`, and add its row to contracts.md in the same change. Reconcile API and DB fields, state transitions, errors, and persisted attributes. Run the executable DB contract checks required by the contract artifact rules.
41
41
  4. For a visual UI surface, the root DESIGN.md is written and validated by .qfai/assistant/step/common-design-md/STEP.md. A CLI-only surface does not require one.
42
42
 
43
43
  ## Concrete-abstract cycle
44
44
 
45
- When Stage 4 wrote or changed a BR Statement or Examples cell, run the cycle in concrete-abstract-cycle.md before the gate: a sub-agent that wrote none of the BRs raises findings against the tree, the session agent decides them, the adopted changes are applied, and the affected BRs are rewritten. At most two cycles run.
45
+ When Stage 4 wrote or changed a BR Statement or Examples cell, run the concrete-abstract cycle before the gate: a sub-agent that wrote none of the BRs raises findings against the tree, the session agent decides them, the adopted changes are applied, and the affected BRs are rewritten. At most two cycles run.
46
46
 
47
47
  ## Stage 5: gate, review, and completion
48
48
 
@@ -1,6 +1,6 @@
1
1
  # SDD Phase Checklists
2
2
 
3
- Use these checkpoints with the ordered stages in sdd-execution-playbook.md. A checked item requires evidence in the story tree or the SDD report.
3
+ Use these checkpoints with the ordered stages of the SDD steps. A checked item requires evidence in the story tree or the SDD report.
4
4
 
5
5
  ## Source and triage
6
6
 
@@ -14,7 +14,7 @@ Use these checkpoints with the ordered stages in sdd-execution-playbook.md. A ch
14
14
 
15
15
  ## Policy and business flow
16
16
 
17
- - Files in 01_policy/ and 02_business-flow/ were copied from paired templates and hold their headings and nothing else, as spec-traceability-rules.md#document-shapes sets out. No section records history.
17
+ - Files in 01_policy/ and 02_business-flow/ were copied from paired templates and hold their headings and nothing else, as the `Document shapes` section of the spec traceability rules sets out. No section records history.
18
18
  - Objective, initiative, principle, and tech state each fact in one place. Gate commands occur only in tech.md Standard commands.
19
19
  - Every affected business-flow.md has exactly one Mermaid flowchart or sequenceDiagram in `## Flow`, and at least one alternate or exception path.
20
20
  - business-flows.md and user-stories.md index actual flows and stories with their assigned BF and US IDs and the titles in their H1s after the ID, word for word.
@@ -37,12 +37,12 @@ The one example a diagnosed missing test needs is appended by the implement stag
37
37
  - No contract names an implementation file.
38
38
  - Every written contract file has a contracts.md index row in the same change, with the columns `ID`, `Title`, `File`, `Depends On`, `Reconciled With` and `Purpose`.
39
39
  - Contract state, errors, and persisted attributes can realize the AC and EX outcomes, including required joins.
40
- - Changed DB contracts were applied to a scratch database and their declared write paths exercised as contract-artifact-rules.md requires. Record the command and result under Contract executability in the SDD repdence.
40
+ - Changed DB contracts were applied to a scratch database and their declared write paths exercised as the contract artifact rules require. Record the command and result under Contract executability in the SDD repdence.
41
41
  - UI contracts follow the product's own root `DESIGN.md`; the sample design was not adopted.
42
42
 
43
43
  ## Concrete-abstract cycle
44
44
 
45
- Follow concrete-abstract-cycle.md.
45
+ Follow the cycle the `sdd-cycle` step sets out.
46
46
 
47
47
  - A cycle ran when this invocation wrote or changed a BR Statement or Examples cell, and did not run otherwise or in an append stage.
48
48
  - The finder is a sub-agent that wrote none of the BRs it read. The session agent decided each finding that is not critical.
@@ -8,7 +8,7 @@ The gate checks the story-tree files against their shipped templates, the docume
8
8
  - Quality-gate commands occur only in the Standard commands section of <paths.contractsDir>/tech.md. Other files point there.
9
9
  - 02_business-flow/business-flows.md indexes real BF directories. Each business-flow.md has exactly one Mermaid flowchart or sequenceDiagram, in `## Flow`.
10
10
  - Each story directory holds exactly 01_User-story.md, 02_Acceptance-Criteria.md, and 03_Example.md.
11
- - The story tree was written from its paired templates under ../templates/spec/ and holds no heading, section, content kind or history they do not show, as spec-traceability-rules.md#document-shapes sets out.
11
+ - The story tree was written from its paired templates under ../templates/spec/ and holds no heading, section, content kind or history they do not show, as the `Document shapes` section of the spec traceability rules sets out.
12
12
  - decisions.md and open-questions.md have four cells per row: ID, Content, Approach, Status. Existing rows changed only in Status.
13
13
  - Each change the user approved, retirement included, has its `Change request:` decision row recording who approved it, when, and the option chosen. No row records a decision the agent took. Unanswered critical decisions have open-question rows and prevent completion.
14
14
 
@@ -22,7 +22,7 @@ The gate checks the story-tree files against their shipped templates, the docume
22
22
  - Every contract file written has a contracts.md row from the same change.
23
23
  - Every persisted attribute and state named by an AC, EX, or BR is realizable by its contract directly or through a stated join.
24
24
  - Paired API and DB contracts agree on terminal states and error outcomes.
25
- - Each changed DB contract was applied to a scratch database and its declared write paths were exercised as contract-artifact-rules.md requires. The result appears under Contract executability in the SDD repdence.
25
+ - Each changed DB contract was applied to a scratch database and its declared write paths were exercised as the contract artifact rules require. The result appears under Contract executability in the SDD repdence.
26
26
  - UI work uses a product-owned DESIGN.md that parses and validates; a sample design is not adopted.
27
27
 
28
28
  ## Flow validation
@@ -2,6 +2,16 @@
2
2
 
3
3
  Triage selects the smallest story-tree change that answers each incoming requirement. The source may be the discussion pack selected by preflight, an imported specification, or the user's explicit requirement. Treat the pack as reference material and resolve a conflict in an SDD-owned artifact.
4
4
 
5
+ ## Contents
6
+
7
+ - Inputs
8
+ - Operation choice
9
+ - Decision and question rows
10
+ - Approval and no-question mode
11
+ - Retiring an EX, AC or BR
12
+ - ID allocation
13
+ - Completion of triage
14
+
5
15
  ## Inputs
6
16
 
7
17
  - The selected source and its requirement IDs, if present.
@@ -14,7 +24,7 @@ Read the flow and story indexes plus concrete files. A subject match alone is in
14
24
  ## Operation choice
15
25
 
16
26
  Choose one primary operation for each affected BF or US. UPDATE is the default when the existing item keeps its identity
17
- and purpose. Its sub-operation is APPEND, MODIFY, or REMOVE. CREATE is used when no existing item represents the new
27
+ and purpose. Its sub-operation is written UPDATE:APPEND, UPDATE:MODIFY, or UPDATE:REMOVE. CREATE is used when no existing item represents the new
18
28
  outcome. DELETE, SPLIT, MERGE, and SUPERSEDE change identity or scope and require explicit approval. UPDATE:REMOVE also
19
29
  requires approval. A supporting contract update is named in the same decision's Approach or in a linked row; it is not a
20
30
  second fictional flow.
@@ -23,7 +33,8 @@ Inspect the impact cascade: policy → BF → US → AC → EX → enforcing con
23
33
 
24
34
  ## Decision and question rows
25
35
 
26
- Use <paths.specsDir>/decisions.md and <paths.specsDir>/open-questions.md, each with exactly ID, Content, Approach, Status. Append a row; later only Status may change. Do not edit the first three cells or remove the row. Use the next highest ID in the table plus one. A retired item still reserves its BF or US ID.
36
+ Use <paths.specsDir>/decisions.md and <paths.specsDir>/open-questions.md, each with exactly ID, Content, Approach, Status. Append a row; later only Status may change, including to `PARTLY SUPERSEDED (by DEC-NNNN)` when a later row narrows a decision without replacing it.
37
+ Do not edit the first three cells or remove the row. Use the next highest ID in the table plus one. A retired item still reserves its BF or US ID.
27
38
 
28
39
  decisions.md records only what the user decided: each change request the user approved or declined,
29
40
  and each critical decision the user made. A row is appended once the user has decided what it records.
@@ -49,7 +60,7 @@ in Approach. It takes effect only at DONE; it never exempts descendant items.
49
60
 
50
61
  ## Approval and no-question mode
51
62
 
52
- Use the shared user-question protocol for CREATE, DELETE, SPLIT, MERGE, SUPERSEDE, and UPDATE:REMOVE. Present the target and rationale. Do not self-approve.
63
+ Use the shared user-question protocol for CREATE, DELETE, SPLIT, MERGE, SUPERSEDE, and UPDATE:REMOVE. Present the target and rationale. Do not self-approve. A request from the user in the session that names the operation and its effect is the approval, and no second question is asked.
53
64
  In --auto, ask no question: append one `open-questions.md` row per pending operation naming it and its target, at TODO with its Content opening Unadjudicated:; stop before the dependent writes, and report every pending operation with its target as open.
54
65
  Approval-free changes may proceed only if they do not depend on a pending operation.
55
66
 
@@ -60,7 +71,10 @@ Clarifications follow the constitution's question budget. Approval questions are
60
71
  A story-tree or contract file changes only on the user's approval:
61
72
 
62
73
  1. Show the user the files the stage would change and the proposed change, and
63
- change nothing until the user answers.
74
+ change nothing until the user answers. A request from the user in the
75
+ session that names the change and its effect is that answer: the stage lists
76
+ the files in its announcement, asks no second question, and records the
77
+ request as the option chosen.
64
78
  2. On approval, write the change and append one `decisions.md` row whose Content
65
79
  opens `Change request:` and names every story-tree and contract file it
66
80
  changed, and `decisions.md` when it appended any other row. Its Approach
@@ -70,12 +84,40 @@ A story-tree or contract file changes only on the user's approval:
70
84
  A row present before the stage started keeps its ID, Content and Approach.
71
85
  Only a row this stage appended changes its Status.
72
86
 
87
+ ## Retiring an EX, AC or BR
88
+
89
+ A retirement touches every place the ID is written. Do all of them in one change:
90
+
91
+ 1. Get the user's approval of the UPDATE:REMOVE and append its `Change request:` decision row, whose Content names every retired ID.
92
+ 2. Delete the EX row from 03_Example.md, the AC scenario from 02_Acceptance-Criteria.md, or the BR row from its contract.
93
+ 3. Remove a retired EX from the Examples cell of every BR that cites it. A BR left with no example gets another example or is retired in the same row.
94
+ 4. Remove each QFAI:EX annotation of a retired EX from the tests, or point it at the example the test now proves.
95
+ 5. An AC left with no example gets one or is retired in the same row.
96
+ 6. Retiring an AC also retires each EX whose AC-Ref names it, or moves that EX to another AC of the story by changing its AC-Ref, then applies steps 3 and 4 to each EX retired. Remove each QFAI:AC annotation of the retired AC from the tests, or point it at the AC the test now proves.
97
+ 7. Never reuse a retired ID. The decision row keeps it counted.
98
+
99
+ `npx qfai validate` reports what steps 3 to 6 left behind: a BR citing an unknown example (`QFAI-STORY-005`), a test annotation naming an undeclared ID (`QFAI-STORY-008`), and an AC with no example or an EX with an invalid AC-Ref (`QFAI-STORY-004`).
100
+
73
101
  ## ID allocation
74
102
 
75
- Read all IDs of the kind in the relevant scope, including IDs named by retirement rows. The next ID is the highest plus one. BF spans the project. US is inside its BF. AC and EX are inside their US.
103
+ Read all IDs of the kind in the relevant scope, including IDs named by retirement rows. The next ID is the highest plus one. A project that also counts the IDs its open pull requests add takes the highest across the tree and those pull requests, so a gap above the tree's own highest is allowed. BF spans the project. US is inside its BF. AC and EX are inside their US.
76
104
  A contract number spans every contract kind, and a BR is numbered inside its contract. DEC and OQ each span their table.
77
105
  Empty numeric scopes begin at 0001, and AC/EX tails begin at 01. Do not reuse an ID because its file was removed or a row was rejected.
78
106
 
107
+ Two branches can take the same next ID. When a merge leaves one ID on two items:
108
+
109
+ 1. The merge target's item keeps the ID. Renumber the incoming item, the one the merge brings in.
110
+ 2. Give it the next ID of its scope.
111
+ A renumbered BF or US takes its child IDs and its directory names with it, as a move to another BF does below.
112
+ 3. Change every citation of the old ID in the same commit.
113
+ 4. State the old ID, the new ID and the renamed record's subject or path in the commit message.
114
+ A citation of the old ID elsewhere is then told apart from the item that kept it.
115
+
116
+ A `decisions.md` or `open-questions.md` row already on the target keeps its ID, Content and Approach.
117
+ A row the incoming branch added takes the next ID of its table.
118
+ An ID that two merged records already share is not renumbered:
119
+ ask the user for a change request row that states which record each citation meant.
120
+
79
121
  A move to another BF changes the story's US ID and all child AC and EX IDs. Record the old IDs as retired, allocate new IDs in the destination scope, and update every citation before the move is complete.
80
122
 
81
123
  ## Completion of triage
@@ -2,6 +2,18 @@
2
2
 
3
3
  The story tree makes business intent concrete before a rule is attached to an enforcing contract. The required chain is BF → US → AC → EX ← BR. A policy, index, or decision row cites an ID; it does not declare a second copy of the item.
4
4
 
5
+ ## Contents
6
+
7
+ - Layout and ownership
8
+ - Document shapes
9
+ - Architecture
10
+ - Identifier scopes
11
+ - Edge rules
12
+ - Contract forms and index
13
+ - Test-layer handoff
14
+ - Decision provenance and drift
15
+ - Gate
16
+
5
17
  ## Layout and ownership
6
18
 
7
19
  - <paths.specsDir>/01_policy/ owns objective, initiative, principles, constraints, and glossary.
@@ -48,7 +60,7 @@ A layer is a group of modules with a dependency direction. An upper layer may us
48
60
 
49
61
  The section holds two things, in this order:
50
62
 
51
- 1. One `mermaid` block, `flowchart TD`, with one node per layer and one `Upper --> Lower` edge per dependency, and nothing else. A node is an ID, or an ID with its label in square brackets when the layer's name is not an ID.
63
+ 1. One `mermaid` block, `flowchart TD`, with one node per layer and one `Upper --> Lower` edge per dependency, and nothing else. A node is an ID, or an ID with its label in square brackets and double quotes, as in `Upper["Domain (core)"]`, when the layer's name is not an ID.
52
64
  2. One table of Layer, Responsibility and Depends on, one row per layer, from the uppermost layer to the lowermost. Depends on names only layers in rows below its own, comma-separated, or `-` for none. Peers at the same height may come in any order.
53
65
 
54
66
  `npx qfai validate` reports a Depends on that names a layer not below its row, and any node or edge the diagram and the table do not share.
@@ -95,7 +107,7 @@ Do not substitute an AC for an EX in a BR citation. The examples are concrete ev
95
107
 
96
108
  ## Contract forms and index
97
109
 
98
- YAML and JSON contracts put rules under x-qfai-rules. SQL contracts use -- Rule and -- Examples: lines. Markdown contracts use a ## Business rules table. Each rule includes ID, statement, and full example IDs. Follow contract-artifact-rules.md and the contract's paired template for syntax.
110
+ YAML and JSON contracts put rules under x-qfai-rules. SQL contracts use -- Rule and -- Examples: lines. Markdown contracts use a ## Business rules table. Each rule includes ID, statement, and full example IDs. Follow the contract artifact rules and the contract's paired template for syntax.
99
111
 
100
112
  Each contract file written has a contracts.md row in the same change. The index cites the file and its ID; it is not another rule definition. Confirm that a contract can realize each persisted attribute in its cited AC and EX directly or through a stated join. Reconcile paired contracts' state and error vocabularies.
101
113
 
@@ -116,7 +128,7 @@ a later decision explicitly reopens it.
116
128
 
117
129
  A decisions.md row's Approach takes the form stated at the top of templates/spec/decisions.md.
118
130
 
119
- Use .qfai/assistant/rule/change-classification.md for Primary and Tags and references/requirements-decomposition.md for turning source requirements into concrete outcomes. Apply .qfai/assistant/rule/drift-protocol.md before accepting a direction that conflicts with a previous decision. Do not silently promote discussion material into a governing spec.
131
+ Use .qfai/assistant/rule/change-classification.md for Primary and Tags and the requirements decomposition procedure for turning source requirements into concrete outcomes. Apply .qfai/assistant/rule/drift-protocol.md before accepting a direction that conflicts with a previous decision. Do not silently promote discussion material into a governing spec.
120
132
 
121
133
  ## Gate
122
134
 
@@ -3,6 +3,21 @@
3
3
  Write UI contracts under `<paths.contractsDir>/ui/**/*.{yaml,yml}`, each named `ui-NNNN-<slug>.yaml` after its ID. A UI-bearing contract declares exactly one full `# QFAI-CONTRACT-ID: UI-NNNN` and a nonempty `screens[]` list. Add its row to `<paths.contractsDir>/contracts.md` in the same change.
4
4
  The flows a UI contract serves are the flows whose examples its rules cite; the file name does not select them.
5
5
 
6
+ ## Contents
7
+
8
+ - `screens[].primary_tasks` shape
9
+ - Recommended ceiling: at most 7
10
+ - `elements[].id` naming policy
11
+ - `elements[].label` is inspection-target text
12
+ - `data-qfai` marker convention
13
+ - Prototype metadata
14
+ - Screen contract rules
15
+ - Template
16
+ - Typical failures
17
+ - Prototyping coverage
18
+ - Root DESIGN.md
19
+ - Review checklist
20
+
6
21
  ## `screens[].primary_tasks` shape
7
22
 
8
23
  Each entry in `screens[]` must carry a `primary_tasks:` slot. Each
@@ -185,7 +200,7 @@ A malformed UI contract or an empty screen list is an authoring failure. Fix the
185
200
 
186
201
  ## Root DESIGN.md
187
202
 
188
- For a UI-bearing visual flow, the root `DESIGN.md` is authored and validated by `.qfai/assistant/step/common-design-md/STEP.md`. Normalize approved screen decisions with `ui-design-contract-normalization.md`. A CLI-only flow without a visual secondary surface does not need one.
203
+ For a UI-bearing visual flow, the root `DESIGN.md` is authored and validated by `.qfai/assistant/step/common-design-md/STEP.md`. Normalize approved screen decisions with the UI design contract normalization reference. A CLI-only flow without a visual secondary surface does not need one.
189
204
 
190
205
  ## Review checklist
191
206
 
@@ -50,8 +50,7 @@ The remaining UI-bearing sidecar maps to its contract as follows:
50
50
 
51
51
  Project-specific anti-pattern notes live in `audience.do_not_look_like`
52
52
  of `DESIGN.md`. Evaluator axes are fixed by the review validation the
53
- QFAI CLI applies (restated in
54
- `.qfai/assistant/skill/qfai-prototyping/references/reviewer-prompt.md`)
53
+ QFAI CLI applies
55
54
  and are no longer authored as sidecar files.
56
55
 
57
56
  ## Normalization Rules
@@ -9,7 +9,7 @@ Record a change request as one row in `<paths.specsDir>/decisions.md`. The row h
9
9
  - Allocate `DEC-NNNN` as the highest decision ID in this tree plus one. Never reuse an ID, including a retired one.
10
10
  - Begin `Content` with `Change request:` and name every repository-relative path the decision can change; an ID there authorizes nothing. A path mentioned only in a discussion or an alternative does not authorize an edit.
11
11
  - Describe the actual contradiction and its source in `Content`. In `Approach`, state the proposed correction, affected work, and the gate that proves it is applied, inside the form stated at the top of `templates/spec/decisions.md`. Keep both cells concise enough to review as a table row.
12
- - Append the row only once the user approves the change, at `WIP`, and record in `Approach` who approved it, when, and the option chosen. Move it to `DONE` only after the owner rerun, affected artifacts, and validation evidence are complete. Use `SUPERSEDED (by DEC-NNNN)` when a later decision replaces the row.
12
+ - Append the row only once the user approves the change, at `WIP`, and record in `Approach` who approved it, when, and the option chosen. Move it to `DONE` only after the owner rerun, affected artifacts, and validation evidence are complete. Use `SUPERSEDED (by DEC-NNNN)` when a later decision replaces the row, and `PARTLY SUPERSEDED (by DEC-NNNN)` when it replaces only part of it.
13
13
  - Append a declined change at `REJECTED`, recording in `Approach` who declined it and when. It authorizes no edit.
14
- - After appending, change only `Status`. Never rewrite `ID`, `Content`, or `Approach`, and never delete the row. If its scope or proposed correction changes, append a new decision row and supersede the old one.
14
+ - After appending, change only `Status`. Never rewrite `ID`, `Content`, or `Approach`, and never delete the row. A row the base holds at DONE authorizes nothing at any Status, so a later change needs a new row. If its scope or proposed correction changes, append a new decision row and supersede the old one.
15
15
  - Keep open questions in `<paths.specsDir>/open-questions.md`. Use the same four columns there, with `OQ-NNNN` IDs and the statuses permitted by that template.
@@ -1,9 +1,9 @@
1
- -- QFAI-CONTRACT-ID: DB-0002
1
+ -- QFAI-CONTRACT-ID: DB-0006
2
2
  -- Replace the sample IDs: the contract takes the next contract number, its
3
3
  -- rules are numbered under it, and its examples come from the story tree.
4
4
  -- Purpose: Sample order draft persistence contract
5
5
  -- Depends on: -
6
- -- Rule BR-0002-0001: An order draft stores a nonempty customer ID.
6
+ -- Rule BR-0006-0001: An order draft stores a nonempty customer ID.
7
7
  -- Examples: EX-0001-0001-02
8
8
  -- Apply-order dependencies as a comma-separated list of DB-* ids, or `-`
9
9
  -- when there are none. List only what must be applied BEFORE this file.
@@ -1,4 +1,4 @@
1
- # CLI-0001: Example command
1
+ # CLI-0006: Example command
2
2
 
3
3
  ## Ownership boundary
4
4
 
@@ -8,4 +8,4 @@
8
8
 
9
9
  | BR-ID | Statement | Examples |
10
10
  | ------------ | ------------ | --------------- |
11
- | BR-0001-0001 | Example rule | EX-0001-0001-01 |
11
+ | BR-0006-0001 | Example rule | EX-0001-0001-01 |
@@ -19,7 +19,7 @@
19
19
 
20
20
  ```mermaid
21
21
  flowchart TD
22
- Upper[<upper layer>] --> Lower[<lower layer>]
22
+ Upper["<upper layer>"] --> Lower["<lower layer>"]
23
23
  ```
24
24
 
25
25
  | Layer | Responsibility | Depends on |
@@ -13,6 +13,10 @@ No item is empty, and only the last two may take `none — <reason>`. What a
13
13
  kind of row must state in its Approach, such as a change request's proposed
14
14
  correction, goes inside these items. Write a `|` inside a cell as `\|`.
15
15
 
16
+ A row that records a spec change following from an earlier approval may name
17
+ that earlier decision by its ID in `Grounds:`, in place of a new answer from
18
+ the user. Its `Evidence:` still lists what supports the change.
19
+
16
20
  A stage that does not own this file records its decisions in its own final
17
21
  report, with the same four items under the same rules.
18
22
  -->
@@ -31,7 +31,7 @@ mode: execution-focused
31
31
 
32
32
  ## /qfai-triage - Requests that end without a change
33
33
 
34
- [DRIFT-PROTOCOL:MANDATORY]
34
+ [DRIFT-PROTOCOL:REQUIRED]
35
35
 
36
36
  Run the entry check of
37
37
  `.qfai/assistant/rule/shared-skill-operating-baseline.md#workflow-run-entry-check-mandatory`
@@ -32,7 +32,7 @@ mode: evidence-focused
32
32
 
33
33
  ## /qfai-verify — Quality Gates and Evidence
34
34
 
35
- [DRIFT-PROTOCOL:MANDATORY]
35
+ [DRIFT-PROTOCOL:REQUIRED]
36
36
 
37
37
  Run the entry check of
38
38
  `.qfai/assistant/rule/shared-skill-operating-baseline.md#workflow-run-entry-check-mandatory`
@@ -6,17 +6,31 @@ Canonical path: `.qfai/report/verify.json` (NOT `.qfai/output/`). Create the `.q
6
6
 
7
7
  `.qfai/output/verify.json` is the legacy location, history for projects created before the move. Never write there.
8
8
 
9
- | Field | Type | Required | Meaning |
10
- | ------------ | ---------------- | -------- | -------------------------------------------------------------------------------------------------------- |
11
- | `status` | string | yes | `"PASS"` when every gate in scope passed; `"FAIL"` otherwise. Only `"PASS"` satisfies a downstream gate. |
12
- | `scope` | string | yes | Which stage's gate set this run covers. See the enum below. |
13
- | `flowId` | string | no | The business flow this run targeted, when scoped to one (e.g. `"BF-0001"`). |
14
- | `recordedAt` | ISO-8601 string | no | When the run completed. |
15
- | `summary` | string | no | One or two sentences an operator can read without opening the stage report. |
16
- | `gates` | array of objects | no | Per-gate results: `{ name, status, command }`. Advisory; no reader gates on it today. |
9
+ | Field | Type | Required | Meaning |
10
+ | ------------ | ---------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
11
+ | `status` | string | yes | `"PASS"` when every gate in scope passed, or is delegated to a CI check that is not red; `"FAIL"` otherwise. Only `"PASS"` satisfies a downstream gate. |
12
+ | `scope` | string | yes | Which stage's gate set this run covers. See the enum below. |
13
+ | `flowId` | string | no | The business flow this run targeted, when scoped to one (e.g. `"BF-0001"`). |
14
+ | `recordedAt` | ISO-8601 string | no | When the run completed. |
15
+ | `summary` | string | no | One or two sentences an operator can read without opening the stage report. |
16
+ | `gates` | array of objects | no | Per-gate results: as set out below. Advisory; no reader gates on it today. |
17
17
 
18
18
  `status` is a closed two-value enum: `"PASS"` / `"FAIL"`. There is no `"WARN"` — a run with only `warning` / `info` findings is `"PASS"` (waivers apply to those severities only). Any `error` finding makes it `"FAIL"`.
19
19
 
20
+ Each entry of `gates` is `{ name, status, command }`, plus these optional fields:
21
+
22
+ | Field | Type | Meaning |
23
+ | ---------- | ------ | --------------------------------------------------------------------------------------------------------------------------------- |
24
+ | `status` | string | `"PASS"`, `"FAIL"`, `"UNRUN"` or `"DELEGATED"`. `"UNRUN"` is a gate with no command, launcher or environment; it is never a pass. |
25
+ | `baseline` | string | On a `"FAIL"`: `"same"` when the base commit fails identically, `"different"` when it does not, `"unrun"` when it cannot run. |
26
+ | `reason` | string | On an `"UNRUN"` gate, or a `baseline` of `"unrun"`: what is missing. |
27
+ | `check` | string | On a `"DELEGATED"` gate: the CI check that runs it. |
28
+ | `ci` | string | On a `"DELEGATED"` gate: `"green"`, `"red"` or `"pending"`, the state of that check when the file is written. |
29
+
30
+ A gate the project runs in CI only is recorded `"DELEGATED"` with its `check` and `ci`. A `"red"` check makes the top-level `status` `"FAIL"`. A `"pending"` one does not, and `summary` names it, so a reader sees what the run left to CI. A gate that can run here is never delegated to avoid running it.
31
+
32
+ A gate that fails identically on the base, or did not run and is not delegated, still makes the top-level `status` `"FAIL"`. The fields let a reader tell it from a failure the run caused.
33
+
20
34
  `scope` is a closed enum. Write the one that matches the stage you were invoked for:
21
35
 
22
36
  | `scope` | Written by | validate profile |
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: web-research
3
3
  title: "Web Research Pipeline"
4
- description: "8-stage web research pipeline with MCP integration, caching, and citation generation."
4
+ description: "8-stage web research pipeline with MCP integration, caching, and citation generation. Use when asked to research a topic on the web and report the findings with cited sources."
5
5
  argument-hint: "[query] [--max-depth N] [--yolo]"
6
6
  allowed-tools: [Read, Glob, Bash, Write, Task, Agent, WebSearch, WebFetch]
7
7
  roles: [Researcher, Analyst, FactChecker]
@@ -16,7 +16,7 @@ QFAI Skill Body (SSOT)
16
16
 
17
17
  ## /web-research — Web Research Pipeline
18
18
 
19
- [DRIFT-PROTOCOL:MANDATORY]
19
+ [DRIFT-PROTOCOL:REQUIRED]
20
20
 
21
21
  ## User Questions (AskUserQuestion Protocol)
22
22
 
@@ -38,14 +38,6 @@ baseline overlap, the baseline governs.
38
38
  - The orchestrator may write the research artifact itself, or give independent searches to sub-agents that run in parallel.
39
39
  - It never approves its own work.
40
40
 
41
- ### Capability Probe
42
-
43
- - No additional overrides.
44
-
45
- ### Delegation Failure (Hard Stop)
46
-
47
- - No additional overrides.
48
-
49
41
  ## Work Orders Summary
50
42
 
51
43
  Every major research artifact must include a `## Work Orders Summary` table.
@@ -27,12 +27,17 @@ for it.
27
27
  lists it: `01_Context.md#Design Direction`, the reference registries in
28
28
  `04_Sources.md`, and the `uiux/` sidecars. For an imported tree, the surface
29
29
  the import source names, or the user's answer.
30
+ - The questions behind those answers:
31
+ `.qfai/assistant/skill/qfai-discussion/references/design-dna-intake.md`.
30
32
  - The schema and validation rules:
31
33
  `.qfai/assistant/skill/qfai-prototyping/references/design-md-spec.md`.
32
34
  - The archetype catalog:
33
35
  `.qfai/assistant/skill/qfai-sdd/references/design-md-brand-catalog.md`.
34
36
  - The starting sample:
35
37
  `.qfai/assistant/skill/qfai-prototyping/templates/DESIGN.md.sample`.
38
+ - The patterns that mark a design as generated, and their displacement table:
39
+ `.qfai/assistant/skill/qfai-sdd/references/design-anti-patterns.md`. Read it
40
+ for § Author and validate step 5.
36
41
 
37
42
  ## Author and validate
38
43
 
@@ -51,6 +56,12 @@ for it.
51
56
  4. **Parse and validate.** `parseDesignMd(text)` must succeed; pass its `data`
52
57
  to `validateDesignMd` and halt on any issue. Both are exported from the
53
58
  `qfai` package entry.
59
+ 5. **Check the finished file against the pattern list.** Review root
60
+ `DESIGN.md` against every aspect of
61
+ `.qfai/assistant/skill/qfai-sdd/references/design-anti-patterns.md` and its
62
+ Displacement section. A token that prescribes a listed pattern fails unless
63
+ `01_Context.md#Design Direction` asks for it. Name the pattern in the
64
+ finding, replace the value, and check the file again.
54
65
 
55
66
  The retired per-aspect brand contracts are not regenerated; their content lives
56
67
  in `DESIGN.md`
@@ -77,7 +88,8 @@ it, edit it; the next iteration is built from it.
77
88
  Read first: the flow's classified surface set and root `DESIGN.md`. The step
78
89
  passes when the flow is not on a visual prototyping surface, or when root
79
90
  `DESIGN.md` exists, is not the unreplaced sample, and parses and validates with
80
- no issue. The pass names the surface set and the validation result.
91
+ no issue and shows no listed pattern that the recorded direction does not ask
92
+ for. The pass names the surface set and the validation result.
81
93
 
82
94
  ## Writes
83
95
 
@@ -87,5 +99,7 @@ no issue. The pass names the surface set and the validation result.
87
99
 
88
100
  ## Gate
89
101
 
90
- `DESIGN.md` parses and validates with no issue, and no value was written that
91
- the recorded direction or the named theme does not supply.
102
+ `DESIGN.md` parses and validates with no issue, no value was written that
103
+ the recorded direction or the named theme does not supply, and no token
104
+ prescribes a pattern from `design-anti-patterns.md` that the recorded direction
105
+ does not ask for. A reviewer fails the gate by naming the pattern.
@@ -38,6 +38,9 @@ Neither is restated here.
38
38
  gate is the matching entry of the Standard commands section, used as
39
39
  written. An entry that is missing makes the gate UNRUN: record it and route
40
40
  the gap as the rule says; never substitute a command from another stack.
41
+ An entry written `CI only: <check name>` instead of a command is not run
42
+ here: record the gate DELEGATED with that check name, and read the check's
43
+ state from the pull request when one exists.
41
44
  3. **Run it** on the tree the stage will hand to its reviewer, in the
42
45
  environment the `Runtime` and `Platform` rows declare.
43
46
  4. **Report** in the stage report: the exact
@@ -66,12 +69,32 @@ Neither is restated here.
66
69
 
67
70
  ## Outcomes
68
71
 
69
- | Outcome | Means |
70
- | ------- | ------------------------------------------------------------------ |
71
- | `PASS` | The command ran on the reviewed tree and exited 0 with zero errors |
72
- | `FAIL` | The command ran and reported an error or a non-zero exit |
73
- | `UNRUN` | No command, no launcher, or no environment to run it in |
72
+ | Outcome | Means |
73
+ | ----------- | ------------------------------------------------------------------ |
74
+ | `PASS` | The command ran on the reviewed tree and exited 0 with zero errors |
75
+ | `FAIL` | The command ran and reported an error or a non-zero exit |
76
+ | `UNRUN` | No command, no launcher, or no environment to run it in |
77
+ | `DELEGATED` | The project runs the gate in CI only, by the check its entry names |
74
78
 
75
- Only `PASS` satisfies a gate. `FAIL` and `UNRUN` go in the stop report with the
76
- reason and the retry condition. Do not weaken a profile, lower `--fail-on`,
79
+ Only `PASS` satisfies a gate here. A `DELEGATED` gate is satisfied by its CI
80
+ check, which runs on the pull request: it is not a pass, and it is not a
81
+ failure until that check is red. `FAIL` and `UNRUN` go in the stop report with
82
+ the reason and the retry condition. Do not weaken a profile, lower `--fail-on`,
77
83
  waive an error or invent a result to reach `PASS`.
84
+
85
+ ## A failure that predates the change
86
+
87
+ Before a failing gate is attributed to the change, run it again on the base
88
+ commit: the revision the change branched from, in a clean checkout that holds
89
+ none of the change. Build it the same way, so a failure that needs a build is
90
+ not read from a stale one.
91
+
92
+ | Base result | Record |
93
+ | -------------------------------------- | -------------------------------------------- |
94
+ | The same failures | `FAIL`, baseline `same`: it predates the run |
95
+ | Fewer, other or no failures | `FAIL`, baseline `different`: the run's own |
96
+ | The gate cannot run on the base either | `FAIL`, baseline `unrun`, with the reason |
97
+
98
+ The comparison is between the failing tests or findings, not the exit code.
99
+ The result stays `FAIL`; a baseline of `same` explains it and never turns it
100
+ into a pass. The run did not cause it, so it is reported and not repaired.
@@ -26,7 +26,17 @@ The same as `discussion-pack`: this run's stage report holds the
26
26
  - `.qfai/assistant/skill/qfai-discussion/references/design-dna-intake.md`.
27
27
  - `.qfai/assistant/skill/qfai-discussion/references/ui_ux_best_practices.md`
28
28
  for the durable decision rules. Open only the `ui_ux/` appendix the current
29
- task needs.
29
+ task needs:
30
+ - `.qfai/assistant/skill/qfai-discussion/references/ui_ux/platform_baselines.md`
31
+ for touch target sizes, breakpoint heuristics, platform navigation baselines,
32
+ and dark mode and cross-platform adaptation notes;
33
+ - `.qfai/assistant/skill/qfai-discussion/references/ui_ux/review_audit_playbook.md`
34
+ for heuristic review structure, anti-pattern checklists, screen-spec
35
+ documentation rules and audit guidance;
36
+ - `.qfai/assistant/skill/qfai-discussion/references/ui_ux/trend_scan_playbook.md`
37
+ for trend-scan category coverage, freshness and citation rules, and turning
38
+ references into local decisions without letting trends overwhelm
39
+ product-specific needs.
30
40
  - The templates under `.qfai/assistant/skill/qfai-discussion/templates/uiux/`.
31
41
 
32
42
  ## Writes
@@ -38,6 +38,13 @@ advisory to clear.
38
38
  publishes to its own users as wide as the new version allows.
39
39
  6. Run the relevant suite.
40
40
 
41
+ When the dependency is `qfai` itself, the package also wrote assistant files
42
+ into the repository, so steps 5 and 6 are replaced by the upgrade procedure in
43
+ the section "Keeping QFAI itself up to date" of `node_modules/qfai/README.md`:
44
+ `init --force`, the retired files the release notes list, then `doctor` and
45
+ `validate`. `init --force` replaces the skills and steps in use, so read the
46
+ next step from disk after it runs.
47
+
41
48
  ## What it writes
42
49
 
43
50
  - The manifest, the lockfile and any adapted call, listed in `changedFiles`.
@@ -16,9 +16,9 @@ the system's shape has settled.
16
16
 
17
17
  ## Reads
18
18
 
19
- - The active flow, one `BF-NNNN`. Inside a workflow run the work order's
20
- `target` names it. A flow that cannot be resolved stops this step: report
21
- the missing source.
19
+ - The active flow, one `BF-NNNN`, which the invocation's BF argument or the
20
+ request names. A flow that cannot be resolved stops this step: report the
21
+ missing source.
22
22
  - The flow's stories and acceptance criteria under `paths.specsDir`. The
23
23
  default tree is `.qfai/spec/`.
24
24
  - `.qfai/assistant/rule/test-layers.md` for the layer each ID maps to.
@@ -20,7 +20,9 @@ waits until the acceptance stage has taken RED.
20
20
 
21
21
  - The acceptance result's seam request and the target test it names.
22
22
  - `.qfai/assistant/skill/qfai-implement/references/walking-skeleton.md` and
23
- `.qfai/assistant/skill/qfai-implement/references/red-admissibility.md`.
23
+ `.qfai/assistant/skill/qfai-implement/references/red-admissibility.md`, and
24
+ `.qfai/assistant/skill/qfai-implement/references/red-not-observable.md` where
25
+ production already satisfies the example.
24
26
  - The commands of `common-gate-run`.
25
27
 
26
28
  ## Procedure
@@ -134,7 +134,9 @@ writes, a passing technical gate, and the required user consent.
134
134
  ## Red, Green, Refactor
135
135
 
136
136
  For the selected EX, create or strengthen a test in a non-acceptance layer and
137
- annotate it `QFAI:EX-NNNN-NNNN-NN`. Preserve the BF E2E and AC integration
137
+ annotate it `QFAI:EX-NNNN-NNNN-NN` on the comment line directly before its
138
+ `it(`, `test(` or `describe(`, or the equivalent test declaration of another
139
+ framework. Preserve the BF E2E and AC integration
138
140
  or API tests `implement-scaffold` wrote. Put the test where the observable
139
141
  behavior belongs. Use
140
142
  `.qfai/assistant/skill/qfai-implement/references/walking-skeleton.md` and