qfai 2.1.2 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. package/assets/defaults/agent-routing/qfai-implement.yml +9 -0
  2. package/assets/defaults/agent-routing/qfai-triage.yml +9 -0
  3. package/assets/defaults/workflows/answer-in-session.yml +8 -0
  4. package/assets/defaults/workflows/quarantine-flaky.yml +3 -0
  5. package/assets/defaults/workflows/repair-consistency.yml +1 -0
  6. package/assets/defaults/workflows/run-operation.yml +11 -0
  7. package/assets/defaults/workflows/write-procedure.yml +18 -0
  8. package/assets/graph/codegraph-native.mjs +174 -0
  9. package/assets/graph/graphify-native.py +72 -0
  10. package/assets/init/.claude/settings.json +2 -20
  11. package/assets/init/.codex/hooks.json +0 -12
  12. package/assets/init/.qfai/assistant/rule/constitution.md +31 -15
  13. package/assets/init/.qfai/assistant/rule/drift-protocol.md +62 -1
  14. package/assets/init/.qfai/assistant/rule/references/codex-delegation.md +27 -0
  15. package/assets/init/.qfai/assistant/rule/references/griller-recommendations.md +21 -9
  16. package/assets/init/.qfai/assistant/rule/review-convergence.md +25 -12
  17. package/assets/init/.qfai/assistant/rule/shared-skill-delegation-baseline.md +1 -0
  18. package/assets/init/.qfai/assistant/rule/shared-skill-operating-baseline.md +8 -3
  19. package/assets/init/.qfai/assistant/rule/workflow.md +2 -1
  20. package/assets/init/.qfai/assistant/skill/qfai-discussion/SKILL.md +6 -0
  21. package/assets/init/.qfai/assistant/skill/qfai-discussion/references/discussion-completion-matrix.md +18 -9
  22. package/assets/init/.qfai/assistant/skill/qfai-grilling/SKILL.md +30 -20
  23. package/assets/init/.qfai/assistant/skill/qfai-grilling/references/delegated-session.md +4 -3
  24. package/assets/init/.qfai/assistant/skill/qfai-grilling/references/session-record.md +8 -2
  25. package/assets/init/.qfai/assistant/skill/qfai-implement/SKILL.md +7 -0
  26. package/assets/init/.qfai/assistant/skill/qfai-implement/references/ui-affecting.md +2 -2
  27. package/assets/init/.qfai/assistant/skill/qfai-run/SKILL.md +41 -39
  28. package/assets/init/.qfai/assistant/skill/qfai-run/references/codex-cloud-install.md +80 -0
  29. package/assets/init/.qfai/assistant/skill/qfai-run/references/extraction.md +36 -25
  30. package/assets/init/.qfai/assistant/skill/qfai-run/references/operator-screens.md +9 -1
  31. package/assets/init/.qfai/assistant/skill/qfai-run/references/plan.md +2 -0
  32. package/assets/init/.qfai/assistant/skill/qfai-run/references/reached-step-observations.md +132 -0
  33. package/assets/init/.qfai/assistant/skill/qfai-run/scripts/codex-cloud-install.mjs +117 -0
  34. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/design-md-authoring.md +20 -7
  35. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/sdd-phase-checklists.md +1 -1
  36. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/sdd-pre-draft-grilling.md +4 -1
  37. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/sdd-quality-gate.md +1 -1
  38. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/sdd-triage.md +29 -2
  39. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/ui-contract-guide.md +36 -4
  40. package/assets/init/.qfai/assistant/skill/qfai-sdd/templates/spec/decisions.md +9 -0
  41. package/assets/init/.qfai/assistant/skill/qfai-triage/SKILL.md +10 -7
  42. package/assets/init/.qfai/assistant/skill/qfai-verify/references/verify-output-contract.md +7 -7
  43. package/assets/init/.qfai/assistant/step/common-design-md/STEP.md +33 -16
  44. package/assets/init/.qfai/assistant/step/common-gate-run/STEP.md +26 -0
  45. package/assets/init/.qfai/assistant/step/common-grilling-record/STEP.md +10 -2
  46. package/assets/init/.qfai/assistant/step/common-policy-check/STEP.md +1 -0
  47. package/assets/init/.qfai/assistant/step/common-review-cycle/STEP.md +23 -7
  48. package/assets/init/.qfai/assistant/step/discussion-interview/STEP.md +15 -8
  49. package/assets/init/.qfai/assistant/step/discussion-oq/STEP.md +5 -1
  50. package/assets/init/.qfai/assistant/step/discussion-pack/STEP.md +5 -1
  51. package/assets/init/.qfai/assistant/step/discussion-uiux/STEP.md +5 -1
  52. package/assets/init/.qfai/assistant/step/implement-dep-bump/STEP.md +8 -2
  53. package/assets/init/.qfai/assistant/step/implement-procedure/STEP.md +69 -0
  54. package/assets/init/.qfai/assistant/step/implement-quarantine/STEP.md +21 -4
  55. package/assets/init/.qfai/assistant/step/implement-regression-fix/STEP.md +3 -3
  56. package/assets/init/.qfai/assistant/step/implement-stress-harness/STEP.md +33 -2
  57. package/assets/init/.qfai/assistant/step/prototyping-preflight/STEP.md +8 -0
  58. package/assets/init/.qfai/assistant/step/sdd-triage/STEP.md +4 -2
  59. package/assets/init/.qfai/assistant/step/triage-answer/STEP.md +2 -2
  60. package/assets/init/.qfai/assistant/step/triage-operate/STEP.md +50 -0
  61. package/assets/init/.qfai/assistant/step/verify-qfai-gate/STEP.md +8 -1
  62. package/assets/init/.qfai/assistant/step/verify-repeat-run/STEP.md +40 -0
  63. package/assets/init/.qfai/assistant/step/verify-repo-gate/STEP.md +12 -0
  64. package/assets/init/root/.agents/rules/document-schema.md +17 -0
  65. package/assets/init/root/.agents/rules/documentation-clarity.md +1 -1
  66. package/assets/init/root/.agents/rules/graph-exploration.md +150 -0
  67. package/assets/init/root/.agents/rules/grilling.md +100 -43
  68. package/assets/init/root/.agents/rules/reminders.json +14 -18
  69. package/assets/init/root/.agents/rules/session-feedback.md +6 -11
  70. package/assets/init/root/.agents/rules/untrusted-content.md +2 -2
  71. package/assets/init/root/.agents/rules/user-questions.md +3 -3
  72. package/assets/init/root/.github/workflows/qfai-docs.yml +2 -2
  73. package/assets/init/root/.github/workflows/qfai-tests.yml +88 -35
  74. package/assets/init/root/.github/workflows/qfai-validate.yml +2 -2
  75. package/assets/init/root/AGENTS.md +1 -0
  76. package/assets/schemas/workflow/extraction.schema.json +6 -2
  77. package/assets/scripts/check-mdschema.mjs +77 -8
  78. package/dist/cli/index.cjs +2616 -1130
  79. package/dist/cli/index.cjs.map +1 -1
  80. package/dist/cli/index.mjs +2617 -1121
  81. package/dist/cli/index.mjs.map +1 -1
  82. package/dist/graph/cli.cjs +1568 -0
  83. package/dist/graph/cli.cjs.map +1 -0
  84. package/dist/graph/cli.d.cts +9 -0
  85. package/dist/graph/cli.d.ts +9 -0
  86. package/dist/graph/cli.mjs +1541 -0
  87. package/dist/graph/cli.mjs.map +1 -0
  88. package/dist/graph/hook.cjs +817 -0
  89. package/dist/graph/hook.cjs.map +1 -0
  90. package/dist/graph/hook.d.cts +9 -0
  91. package/dist/graph/hook.d.ts +9 -0
  92. package/dist/graph/hook.mjs +792 -0
  93. package/dist/graph/hook.mjs.map +1 -0
  94. package/dist/index.cjs +2734 -818
  95. package/dist/index.cjs.map +1 -1
  96. package/dist/index.d.cts +129 -1
  97. package/dist/index.d.ts +129 -1
  98. package/dist/index.mjs +2707 -789
  99. package/dist/index.mjs.map +1 -1
  100. package/dist/process-C21nTvkT.d.cts +12 -0
  101. package/dist/process-C21nTvkT.d.ts +12 -0
  102. package/package.json +1 -1
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: qfai-triage
3
3
  title: QFAI Triage (Requests that end without a tracked change)
4
- description: "Use when invoked by name or handed a QFAI work order for a request that ends without a tracked change: a question, a duplicate, missing information, a split, automated reports, a security report, an operation only a person can run, or authorized cleanup of current-task temporary directories."
4
+ description: "Use when invoked by name or handed a QFAI work order for a request that ends without a tracked change: a question, a duplicate, missing information, a split, automated reports, a security report, an operation only a person can run, an operation the user named on finished work, or authorized cleanup of current-task temporary directories."
5
5
  argument-hint: "<the request, as it was reported>"
6
6
  allowed-tools: [Read, Glob, Grep, Write, Bash, TodoWrite, Task, Agent]
7
7
  roles:
@@ -25,6 +25,7 @@ steps:
25
25
  - triage-security-intake
26
26
  - triage-handoff
27
27
  - triage-owned-cleanup
28
+ - triage-operate
28
29
  - triage-close
29
30
  requires: []
30
31
  mode: execution-focused
@@ -38,12 +39,13 @@ Run the entry check of
38
39
  `.qfai/assistant/rule/shared-skill-operating-baseline.md#workflow-run-entry-check-mandatory`
39
40
  first.
40
41
 
41
- This skill answers, closes, splits or hands over a request, and changes no
42
- file git tracks. Work the request needs is recorded as a follow-up request,
42
+ This skill answers, closes, splits or hands over a request, or carries out an
43
+ operation the user named, and changes no file git tracks. Work the request needs is recorded as a follow-up request,
43
44
  never done here except the exact current-task temporary cleanup that
44
- `triage-owned-cleanup` permits. That step rechecks existing user authority and
45
- repository-local scope before any deletion. No other triage step executes an
46
- operation, and `triage-handoff` still waits for the person's reported result.
45
+ `triage-owned-cleanup` permits, after rechecking existing user authority and
46
+ repository-local scope, and the named operation `triage-operate` runs. No other
47
+ triage step executes an operation, and `triage-handoff` still waits for the
48
+ person's reported result.
47
49
 
48
50
  ## Inputs
49
51
 
@@ -74,6 +76,7 @@ run it, then move to the next.
74
76
  | `triage-security-intake` | Takes a vulnerability report in privately | The request reports no exploitable weakness |
75
77
  | `triage-handoff` | Gives a person the steps of an operation only they can run | The request needs no operation that only a person can run |
76
78
  | `triage-owned-cleanup` | Removes authorized current-task temporary directories and verifies absence | The request is not the specific repository-local cleanup the step permits |
79
+ | `triage-operate` | Runs the operation the user named on finished work, and reports its result | The request names no operation |
77
80
  | `triage-close` | Records the outcome and each follow-up, and closes | Only `triage-security-intake` ran: the fix follows it, so the request stays open |
78
81
 
79
82
  Invoked by name, the skill ends at this stage. It starts no other stage and
@@ -114,7 +117,7 @@ list any remaining actions instead.
114
117
 
115
118
  project_memory:
116
119
 
117
- - Triage changes no tracked file; only `triage-owned-cleanup` executes its bounded cleanup.
120
+ - Triage changes no tracked file; only `triage-owned-cleanup` and `triage-operate` execute an operation.
118
121
  - Other work it finds is a follow-up request.
119
122
  - A follow-up is recorded, never routed inside the run that found it.
120
123
  - A security report stays private until the fix is ready to disclose.
@@ -36,13 +36,13 @@ completion rules stay unchanged.
36
36
 
37
37
  Each entry of `gates` is `{ name, status, command }`, plus these optional fields:
38
38
 
39
- | Field | Type | Meaning |
40
- | ---------- | ------ | --------------------------------------------------------------------------------------------------------------------------------- |
41
- | `status` | string | `"PASS"`, `"FAIL"`, `"UNRUN"` or `"DELEGATED"`. `"UNRUN"` is a gate with no command, launcher or environment; it is never a pass. |
42
- | `baseline` | string | On a `"FAIL"`: `"same"` when the base commit fails identically, `"different"` when it does not, `"unrun"` when it cannot run. |
43
- | `reason` | string | On an `"UNRUN"` gate, or a `baseline` of `"unrun"`: what is missing. |
44
- | `check` | string | On a `"DELEGATED"` gate: the CI check that runs it. |
45
- | `ci` | string | On a `"DELEGATED"` gate: `"green"`, `"red"` or `"pending"`, the state of that check when the file is written. |
39
+ | Field | Type | Meaning |
40
+ | ---------- | ------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
41
+ | `status` | string | `"PASS"`, `"FAIL"`, `"UNRUN"` or `"DELEGATED"`. `"UNRUN"` is a gate with no command, launcher or environment; it is never a pass. |
42
+ | `baseline` | string | On a `"FAIL"`: `"same"` when the base commit fails identically, `"different"` when it does not, `"unrun"` when it cannot run. |
43
+ | `reason` | string | On an `"UNRUN"` gate, or a `baseline` of `"unrun"`: what is missing. On a `baseline` of `"same"`: the failing test identifiers and the environment, in one or two sentences (see `verify-repo-gate`). |
44
+ | `check` | string | On a `"DELEGATED"` gate: the CI check that runs it. |
45
+ | `ci` | string | On a `"DELEGATED"` gate: `"green"`, `"red"` or `"pending"`, the state of that check when the file is written. |
46
46
 
47
47
  ## CI-only checks
48
48
 
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: common-design-md
3
3
  owner: common
4
- purpose: "Author the root DESIGN.md from the recorded design direction when it is missing, validate it, and check it again before anything is built from it."
4
+ purpose: "Author a missing root DESIGN.md or repair its authorized part from the recorded design direction, validate it, and check it again before anything is built from it."
5
5
  requires: []
6
6
  roles: [product-experience-architect]
7
7
  routing-profile: default
@@ -17,8 +17,8 @@ checks every literal of every iteration against them.
17
17
 
18
18
  Only to a flow on a visual prototyping surface: its classified surface set —
19
19
  `primary_surface` and every `secondary_surfaces` entry — names `web`, `mobile`,
20
- `desktop` or `mixed`. A cli-only target has no root `DESIGN.md`; skip this step
21
- for it.
20
+ `desktop` or `mixed`. A cli-only target writes no root `DESIGN.md` and leaves
21
+ any existing file unchanged; skip this step for it.
22
22
 
23
23
  ## Reads
24
24
 
@@ -41,18 +41,30 @@ for it.
41
41
 
42
42
  ## Author and validate
43
43
 
44
- 1. **Stop on an unchosen brand.** A pack that records no design direction
45
- leaves the brand unchosen. Brand intent is `hard-required`: ask for it, and
46
- under `--auto` stop and name it. Never adopt the sample design.
47
- 2. **Write only when the file is missing.** `npx qfai init` seeds the sample and
48
- never overwrites it, and a project may have written its own. An existing file
49
- is validated as it stands; an unreplaced sample is refused.
50
- 3. **Author from the direction**, following
44
+ 1. **Stop on an unchosen brand.** For initial authoring
45
+ of a missing file, a pack that records no design direction leaves the brand
46
+ unchosen. Brand intent is `hard-required`: ask for it, and under `--auto`
47
+ stop and name it. Never adopt the sample design. For an existing valid file,
48
+ validation and authorized repairs that preserve its brand and tokens
49
+ require no new brand selection. A brand or token change needs the
50
+ authorization and source values in step 2.
51
+ 2. **Bound an existing-file repair.** Write a missing file from the recorded
52
+ direction. For an existing file, SDD triage must name its exact path and the
53
+ requested change, and a new WIP change request must authorize both. Apply
54
+ only the authorized change; preserve existing brand and tokens unless their
55
+ change is authorized and supported by recorded direction or named theme
56
+ values. Stop without writing unsupported values. Without that authorization,
57
+ validate the existing file without an overwrite; an inherited DONE row
58
+ authorizes no new change. An unreplaced sample is refused.
59
+ 3. **Author a missing file or the authorized fields of an existing file**,
60
+ following
51
61
  `.qfai/assistant/skill/qfai-sdd/references/design-md-authoring.md#output-mapping`:
52
62
  the intent fields first, then the archetype, then `brand.theme`, then the
53
63
  `visual.*` tokens taken from the named theme's published values
54
64
  (`.qfai/assistant/skill/qfai-sdd/references/design-md-authoring.md#taking-the-values-from-the-theme`).
55
- Do not compose token values by taste.
65
+ Do not compose token values by taste. For a repair, record the source of each
66
+ changed value and leave unrelated content unchanged. Validation without an
67
+ authorized change writes nothing and does not repeat brand selection.
56
68
  4. **Parse and validate.** `parseDesignMd(text)` must succeed; pass its `data`
57
69
  to `validateDesignMd` and halt on any issue. Both are exported from the
58
70
  `qfai` package entry.
@@ -61,7 +73,8 @@ for it.
61
73
  `.qfai/assistant/skill/qfai-sdd/references/design-anti-patterns.md` and its
62
74
  Displacement section. A token that prescribes a listed pattern fails unless
63
75
  `01_Context.md#Design Direction` asks for it. Name the pattern in the
64
- finding, replace the value, and check the file again.
76
+ finding. For an existing-file repair, stop unless the authorized change
77
+ includes its replacement. Replace the value and check the file again.
65
78
 
66
79
  ## Check before building
67
80
 
@@ -77,7 +90,8 @@ Before anything is generated from `DESIGN.md`:
77
90
  3. On any of these, stop and fix `DESIGN.md` through § Author and validate.
78
91
 
79
92
  Once a prototyping loop has started, `DESIGN.md` is read-only for it. To change
80
- it, edit it; the next iteration is built from it.
93
+ it, return to SDD for a triaged and authorized repair; the next iteration is
94
+ built from the validated result.
81
95
 
82
96
  ## Passes when
83
97
 
@@ -89,13 +103,16 @@ for. The pass names the surface set and the validation result.
89
103
 
90
104
  ## Writes
91
105
 
92
- - Root `DESIGN.md`, only when it was missing.
106
+ - Root `DESIGN.md`, when missing or only within an authorized existing-file
107
+ change.
93
108
  - In the stage report: the source of each brand field and the validation
94
- result.
109
+ result; for a repair, the authorization and source of each changed value.
95
110
 
96
111
  ## Gate
97
112
 
98
113
  `DESIGN.md` parses and validates with no issue, no value was written that
99
114
  the recorded direction or the named theme does not supply, and no token
100
115
  prescribes a pattern from `design-anti-patterns.md` that the recorded direction
101
- does not ask for. A reviewer fails the gate by naming the pattern.
116
+ does not ask for. An existing-file repair changes only its authorized part
117
+ and preserves unrelated content. A reviewer fails the gate by naming the pattern.
118
+ An unauthorized change also fails the gate.
@@ -188,3 +188,29 @@ not read from a stale one.
188
188
  The comparison is between the failing tests or findings, not the exit code.
189
189
  The result stays `FAIL`; a baseline of `same` explains it and never turns it
190
190
  into a pass. The run did not cause it, so it is reported and not repaired.
191
+
192
+ ### A suite whose result depends on timing or load
193
+
194
+ A browser suite or another timing-dependent suite can fail differently from run
195
+ to run, so one base run made under other conditions is not a fair comparison.
196
+
197
+ - Run the gate on the base commit under the conditions of the run it is
198
+ compared with, and record the parallelism and the load of both runs in the
199
+ stage report. A comparison whose conditions are not recorded is not made.
200
+ - Count a chain of failures once. A failure is folded into a chain only when
201
+ it follows an earlier failure of the same file and reads as a consequence of
202
+ it, such as a closed browser or a timeout. Match a failure with the base by
203
+ test identity, and a folded chain by its file.
204
+ - Run alone the files that hold a failure the base run did not show. A failure
205
+ that passes alone but fails in the suite on the changed branch, and not on the
206
+ base under the same conditions, is reported as a possible order or
207
+ shared-state effect of the change, with a suspected cause, as
208
+ `.qfai/assistant/rule/references/gate-failure-autorepair.md#nondeterministic-gates`
209
+ says. It is left out of the comparison only after a full-suite rerun of the
210
+ changed branch under the same conditions that does not show it. Record every
211
+ run in order.
212
+ - The baseline is still `same`, `different` or `unrun`, and the result is still
213
+ `FAIL`. A failure left out is not in the base set, so the `reason` of the gate
214
+ and the final report list each one with its result run alone and in the
215
+ full-suite rerun, and the user who decides whether to commit sees that list.
216
+ No other state or field is recorded.
@@ -53,5 +53,13 @@ The stage holds one session per run. The row goes in the stage report, under
53
53
  | confirmed | <ISO8601> | <ISO8601> | empty | none in flight | <n> | <n> |
54
54
  ```
55
55
 
56
- Only `confirmed`, `user-closed` and `no-question` authorize authoring.
57
- `Authoring began` is later than `Ended at`.
56
+ The authoring endings are `confirmed`, `user-closed`, `no-question`, and
57
+ conditionally `adopted`. For `adopted`, verify
58
+ `.agents/rules/grilling.md#explicit-delegation-for-a-discussion`: actual user
59
+ delegation with source, scope and authority; actual griller-to-author rounds
60
+ with reasons and dissent; no open node or running lookup; all consumed required
61
+ inputs present; and actual human authority for every reserved decision.
62
+ Record these in the stage evidence, not as a fictional human option answer.
63
+ `Ended at` and `Authoring began` are actual timestamps, with authoring later.
64
+ A missing hard-required consumed input authorizes no authoring ending.
65
+ Allowing authoring is not a completion or validation receipt.
@@ -12,6 +12,7 @@ Design, tests and code fit a project only when its facts are current. The
12
12
  contract this step serves is
13
13
  `.qfai/assistant/rule/workflow.md#policy-check-mandatory`:
14
14
  it runs once per run, at the start, and no affected work continues on stale policy.
15
+ The ultra-light routes `answer-in-session` and `run-operation` do not run it.
15
16
 
16
17
  ## Reads
17
18
 
@@ -22,12 +22,27 @@ them; it is the procedure that applies them.
22
22
 
23
23
  ## Reads
24
24
 
25
- - **The reviewer set.** In a route, the specification review:
26
- `requirements-reviewer`, joined by `architecture-reviewer` when a contract
27
- changed; the code review of the whole diff: `implementation-reviewer`. On a
28
- flow a UI contract with screens serves, `product-surface-reviewer` joins
29
- either review. A parent skill invoked by name uses the reviewers its own
30
- `## Review` section names, such as `qfai-discussion`'s.
25
+ - **The reviewer set.** In a route, each review takes exactly these reviewers,
26
+ each once in that review, with no threshold to judge:
27
+ - one reviewer for its kind: `requirements-reviewer` for the specification
28
+ review, `implementation-reviewer` for the code review of the whole diff;
29
+ - `architecture-reviewer` too, only when the target holds a contract change
30
+ no earlier review of the route read;
31
+ - `product-surface-reviewer` too, only when the target holds a screen change
32
+ no earlier review of the route read: an edit to a UI contract's screen, or
33
+ to the code, tests or styles that render one, or to a path `uiux.surfacePaths`
34
+ declares. An uncertain case counts as a screen change
35
+ (`.qfai/assistant/skill/qfai-implement/references/ui-affecting.md#routing`);
36
+ - no other reviewer. A stage the plan marks with no review gets none.
37
+
38
+ A review whose target's only edits resolve the conflicts of a merge or a
39
+ branch update between sides that were each already reviewed gets no
40
+ reviewer. A side is reviewed when it is on the default branch or a review of
41
+ this route or its pull request covered its commits. A resolution that adds
42
+ content neither side had is not conflict-only. The stage report names the
43
+ merge and why no reviewer ran. A parent skill invoked by name uses the
44
+ reviewers its own `## Review` section names, such as `qfai-discussion`'s.
45
+
31
46
  - **The review target.** The specification review: every path and ID the
32
47
  stage it follows wrote or changed, and the source it was written from. The
33
48
  code review: the route's whole diff against the revision the route started
@@ -66,6 +81,7 @@ them; it is the procedure that applies them.
66
81
  ## Gate
67
82
 
68
83
  Every routed reviewer responded once, every finding is fixed or answered, and
69
- the stage report names each verdict and each answer. A finding the author
84
+ the stage report names each verdict and each answer, or says why the review
85
+ dispatched no reviewer. A finding the author
70
86
  cannot fix is in the stage's final report, and a critical decision has gone to
71
87
  the user.
@@ -10,8 +10,10 @@ routing-profile: default
10
10
  # discussion-interview
11
11
 
12
12
  The core interview for concept, scope, stakeholders and constraints. It is a
13
- user session: the interview is this stage's work, so every decision is put to
14
- the user. An interview with no method is the agent deciding and reporting.
13
+ user session by default: every decision is put to the user. The only delegated
14
+ exception is `.agents/rules/grilling.md#explicit-delegation-for-a-discussion`,
15
+ with actual user authority recorded before agent-to-agent rounds.
16
+ An interview with no method is the agent deciding and reporting.
15
17
 
16
18
  ## Reads
17
19
 
@@ -78,13 +80,14 @@ Where each outcome is recorded is
78
80
 
79
81
  ## How the session ends
80
82
 
81
- A user session reaches four of the five endings the rule names — `adopted` ends
82
- only a delegated session — and three of them let authoring start:
83
+ The default user session reaches four of the five endings. An explicitly
84
+ delegated discussion may also end `adopted` under the master's conditions:
83
85
 
84
86
  | Ended | What the user did | Authoring |
85
87
  | ------------- | ---------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
86
88
  | `confirmed` | Confirmed on the session's own condition: no node open — the frontier empty **and** no fact lookup still running | Starts |
87
89
  | `user-closed` | Said `proceed`, `done`, or words to that effect | Starts. Lookups already running are finished and each decision still open becomes a labelled assumption, except one a document requires the user to make and record |
90
+ | `adopted` | Explicitly delegated judgment for this scope | Starts only after the recorded delegation conditions are met; no open node, lookup or unsupported human decision remains |
88
91
  | `no-question` | Nothing — `--auto` reached nobody | Starts. Every node still open is registered — a decision, and a fact only the user holds, which nothing else can supply, and the open count is then what blocks completion |
89
92
  | `stopped` | Said `stop` | **Does not start.** Report every open decision as open and end the run |
90
93
 
@@ -101,11 +104,14 @@ still there, so a decision they own is put again rather than assumed. The
101
104
  run consumes, and this is a decision the run is not permitted to take. The
102
105
  visual direction is the case here —
103
106
  `.qfai/assistant/skill/qfai-discussion/references/design-dna-intake.md` says
104
- only the user may choose a theme. The rule states the same bound from its side:
107
+ only the user may choose a theme by default. Only an actual specifically
108
+ applicable user instruction can override that request under the master's
109
+ authority conditions; the agents' choice is never labelled `chosen_by: user`.
110
+ The rule states the same bound from its side:
105
111
  closing the questions waives the agent's own uncertainty, never an
106
112
  authorization the user has not given.
107
113
 
108
- **`--auto` is the other case, and its answer is already written.** Nobody is
114
+ **`--auto` without qualifying explicit delegation is the other case.** Nobody is
109
115
  there to put the question to, so the documented path holds: take the most
110
116
  conventional candidate, record it `chosen_by: assumption`, open it in
111
117
  `11_OQ-Register.md`, and author — the open count is what blocks completion.
@@ -136,8 +142,9 @@ runs.
136
142
  The reviewer confirms:
137
143
 
138
144
  - the stage report's `## Grilling Session` row shows the session ended before
139
- authoring began, with `Ended` one of `confirmed`, `user-closed` or
140
- `no-question`;
145
+ authoring began, with `Ended` one of `confirmed`, `user-closed`,
146
+ `no-question`, or `adopted` with the recorded explicit-delegation conditions
147
+ verified;
141
148
  - every decision the session settled is recorded where
142
149
  `.qfai/assistant/skill/qfai-discussion/references/oq-and-deferred-rules.md`
143
150
  says;
@@ -16,7 +16,11 @@ discussion from completing, so a decision nobody took cannot close the pack.
16
16
 
17
17
  The same as `discussion-pack`: this run's stage report holds the
18
18
  `## Grilling Session` row, its `Ended at` is written, and `Ended` is
19
- `confirmed`, `user-closed` or `no-question`. Without that row, or with
19
+ `confirmed`, `user-closed`, `no-question`, or `adopted` meeting
20
+ `.agents/rules/grilling.md#explicit-delegation-for-a-discussion`.
21
+ Check the actual delegation and rounds, required inputs, empty tree and
22
+ human authority in the stage evidence; the ending label alone is insufficient.
23
+ Without that row, or with
20
24
  `Ended: stopped`, write nothing and stop.
21
25
 
22
26
  ## Reads
@@ -16,7 +16,11 @@ conversational summaries, are the handoff.
16
16
 
17
17
  **Authoring the pack** does not start until the session has ended. This run's
18
18
  stage report holds the `## Grilling Session` row, its `Ended at` is written,
19
- and `Ended` is `confirmed`, `user-closed` or `no-question`. Without that row,
19
+ and `Ended` is `confirmed`, `user-closed`, `no-question`, or `adopted` meeting
20
+ `.agents/rules/grilling.md#explicit-delegation-for-a-discussion`.
21
+ Check the actual delegation and rounds, required inputs, empty tree and
22
+ human authority in the stage evidence; the ending label alone is insufficient.
23
+ Without that row,
20
24
  or with `Ended: stopped`, write no pack file and stop. A pack drafted
21
25
  mid-session records a design that was still being decided, and the draft is
22
26
  what the rest of the run then defends.
@@ -16,7 +16,11 @@ read, without forcing an early visual direction.
16
16
 
17
17
  The same as `discussion-pack`: this run's stage report holds the
18
18
  `## Grilling Session` row, its `Ended at` is written, and `Ended` is
19
- `confirmed`, `user-closed` or `no-question`. Without that row, or with
19
+ `confirmed`, `user-closed`, `no-question`, or `adopted` meeting
20
+ `.agents/rules/grilling.md#explicit-delegation-for-a-discussion`.
21
+ Check the actual delegation and rounds, required inputs, empty tree and
22
+ human authority in the stage evidence; the ending label alone is insufficient.
23
+ Without that row, or with
20
24
  `Ended: stopped`, write nothing and stop.
21
25
 
22
26
  ## Reads
@@ -45,12 +45,18 @@ into the repository, so steps 5 and 6 are replaced by the upgrade procedure in
45
45
  the section "Keeping QFAI itself up to date" of `node_modules/qfai/README.md`:
46
46
  `init --force`, the retired files the release notes list, then `doctor` and
47
47
  `validate`. `init --force` replaces the skills and steps in use, so read the
48
- next step from disk after it runs.
48
+ next step from disk after it runs. What `doctor` and `validate` report is part
49
+ of the update: a new required key in `qfai.config.yaml`, and an edit to a spec
50
+ contract, which needs its change request in `decisions.md` under
51
+ `paths.specsDir`, as `.qfai/assistant/rule/drift-protocol.md` describes, before
52
+ the contract file changes.
49
53
 
50
54
  ## What it writes
51
55
 
52
56
  - The actual changed paths for the manifest, lockfile and any adapted call,
53
- listed in the stage report.
57
+ listed in the stage report. When the dependency is `qfai` itself, they also
58
+ include a new key in `qfai.config.yaml` and a spec-contract edit with its
59
+ change request.
54
60
  - A record of the versions, the breaking changes read and how each was met, in the stage report.
55
61
 
56
62
  ## Gate
@@ -0,0 +1,69 @@
1
+ ---
2
+ name: implement-procedure
3
+ owner: qfai-implement
4
+ purpose: Write an authorized operational procedure within existing policy.
5
+ requires: [common-gate-run]
6
+ roles: [doc-steward]
7
+ routing-profile: default
8
+ ---
9
+
10
+ # implement-procedure
11
+
12
+ ## What this is for
13
+
14
+ Write instructions a person can follow within the project's existing policy.
15
+ Do not invent a business flow, code, tests, specifications or contracts to
16
+ support this document.
17
+
18
+ ## Reads
19
+
20
+ - The request and work order: resolve the authorized write scope and target
21
+ documents before editing.
22
+ - The existing policy and procedures governing the actions: preserve their
23
+ authority limits and required checks.
24
+ - For every document edit, read `.agents/rules/documentation-clarity.md`.
25
+
26
+ ## Before writing
27
+
28
+ If the needed edit belongs to policy, a story, a contract or QFAI assistant
29
+ instructions, stop before writing and name its owning stage. Markdown does not
30
+ confer ownership of those surfaces.
31
+
32
+ If required facts or values are missing, stop the dependent work and report
33
+ what is needed to resume. Never invent values, commands or permission.
34
+
35
+ ## Procedure
36
+
37
+ 1. Identify the inputs, actions, commands, required values, order, failure
38
+ conditions and recovery steps the request needs.
39
+ 2. Check them against existing policy and actual known facts. Write only the
40
+ authorized documents within the work order's scope.
41
+ 3. Keep the instructions usable: name the actor, prerequisites, expected
42
+ result, stop conditions and recovery for each action.
43
+ 4. Run the applicable document lint and link checks through
44
+ `.qfai/assistant/step/common-gate-run/STEP.md`. Keep actual evidence;
45
+ unavailable required checks remain UNRUN with their blocker and resume
46
+ condition. Follow the plan's existing independent code review and closing
47
+ verification stages.
48
+
49
+ ## Action authority
50
+
51
+ Authoring does not authorize execution. Do not perform publication, deletion,
52
+ login or permission expansion while writing their instructions. Those actions
53
+ need separate authority and their own applicable route. Required values are
54
+ facts to verify, not authority to act.
55
+
56
+ ## Stage report
57
+
58
+ Report the changed paths, the procedure authored and the checks actually
59
+ performed with their evidence. State that the documented actions were not
60
+ executed; their outcome is unobserved. Record unavailable checks as UNRUN,
61
+ with the blocker, owner and condition for resuming. Static instructions do not
62
+ prove an adopter's operation succeeded.
63
+
64
+ ## Gate
65
+
66
+ The authorized document is complete and consistent with existing policy.
67
+ Applicable lint and link checks have actual results through
68
+ `common-gate-run`; failures and unavailable checks prevent completion.
69
+ Protected edits and uncovered actions were stopped before writing or acting.
@@ -24,15 +24,29 @@ it.
24
24
 
25
25
  ## Procedure
26
26
 
27
- 1. Show the flakiness: run the test a recorded number of times at one
28
- revision and count the failures. A test that fails every time is not
29
- flaky; stop and report it as failing.
27
+ 1. Show the flakiness: run the test at one revision at least five times,
28
+ record the number of runs and count the failures. A test that fails every
29
+ run is not flaky: see
30
+ [A test that fails every run](#a-test-that-fails-every-run).
30
31
  2. Quarantine it with the project's own mechanism. Add one only where the
31
32
  project has none.
32
33
  3. Keep it running where it blocks nothing, such as a non-gating job, where
33
34
  the project can.
34
35
  4. Change neither what it asserts nor the code it tests. Delete nothing.
35
36
 
37
+ ## A test that fails every run
38
+
39
+ When all of at least five recorded runs fail, nothing is quarantined, no marker
40
+ is written and no non-gating job is added: a skip would hide a failure that is
41
+ real, and a failure rate the runs do not show cannot be invented. With fewer
42
+ runs, or with one passing run, the test is not shown to fail every run, so run
43
+ it again or quarantine it as flaky. Record the runs, their count and the
44
+ failure's signature in the stage report, then report the outcome
45
+ `failing-consistently` with an extraction of the report as a test that fails
46
+ every run, so the decision rules route it again. The stage ends there: the
47
+ stages after it do not run, and the next route's diagnosis and test repair take
48
+ over.
49
+
36
50
  ## What it writes
37
51
 
38
52
  - The changed file path for the quarantine entry or marker, listed in the
@@ -43,4 +57,7 @@ it.
43
57
  ## Gate
44
58
 
45
59
  The step is done when the flakiness is shown by a recorded failure rate, the
46
- test no longer gates, and its quarantine entry states what lifts it.
60
+ test no longer gates, and its quarantine entry states what lifts it. It is also
61
+ done when a test that failed all of at least five recorded runs is reported as
62
+ `failing-consistently`, with the runs in the stage report and nothing
63
+ quarantined.
@@ -31,9 +31,9 @@ else.
31
31
  3. Re-run the same test. The same test turning GREEN again confirms the fix.
32
32
  4. The fix and the re-run are reported in the stage report.
33
33
 
34
- The route's code review judges the fix. A UI-affecting fix, as
35
- `.qfai/assistant/skill/qfai-implement/references/ui-affecting.md` defines it,
36
- adds the product-surface-reviewer to that review. The full suite and the
34
+ The route's code review judges the fix. A fix that changes a screen, as
35
+ `common-review-cycle`'s reviewer set defines it, adds `product-surface-reviewer`
36
+ to that review. The full suite and the
37
37
  project gates run once, in the verify stage.
38
38
 
39
39
  The example stays annotated by the same test. No `Change request:` row is
@@ -22,9 +22,37 @@ be checked against something more than one lucky run.
22
22
  the failure appears.
23
23
  - The commands of `common-gate-run`, and the test tools the project already
24
24
  carries.
25
+ - Existing Red evidence with its command, signature and revision, and the
26
+ evidence that establishes its cause.
25
27
 
26
28
  ## Procedure
27
29
 
30
+ ### Applicability on entry
31
+
32
+ This step always checks the evidence on entry. Pressure is unnecessary only
33
+ when a prior executed Red reproduces the same failure signature and a verified
34
+ ordinary cause explains it without clock, operation order, parallelism, load,
35
+ timing or race dependence. A verified ordinary cause is one demonstrated with
36
+ fixed inputs and a directly constructed failing state: the test sets up that
37
+ state itself instead of waiting for it, and fails on it. One recorded Red
38
+ cannot show a failure on every run, so cite the recorded Red results, or state
39
+ why the failing state is deterministic. The original report of an intermittent
40
+ failure, a single observed failure or a Red that fails only sometimes is not
41
+ that proof. A fixed seed or controlled schedule that exposes a race is not an
42
+ ordinary cause.
43
+ Uncertainty requires the real harness below. Missing or unexecuted Red,
44
+ another signature or an unknown cause cannot justify omitting pressure.
45
+ Stale or pending CI, unavailable tools, waits and limited time do not supply
46
+ missing proof. A cause found later cannot justify claiming that an earlier
47
+ harness was unnecessary or not performed.
48
+
49
+ When the entry evidence qualifies, build no harness and run no pressure. In
50
+ the stage report, cite the inspected Red and cause evidence, record why load
51
+ or soak is unnecessary, and state that the stress run was not performed. The
52
+ gate checks this applicability reason and its proof; report no stress PASS.
53
+
54
+ ### When a harness is required
55
+
28
56
  1. Pick the cheapest pressure that reaches the failure:
29
57
  - a deterministic schedule: a fixed seed, an injected clock, or a
30
58
  controlled order of the operations that interleave;
@@ -49,5 +77,8 @@ be checked against something more than one lucky run.
49
77
 
50
78
  ## Gate
51
79
 
52
- The step is done when the harness reproduces the reported failure at a
53
- recorded rate, and no production code changed.
80
+ When a harness is required, the step is done when it reproduces the reported
81
+ failure at a recorded rate, and no production code changed.
82
+ For the ordinary-cause case, the entry proof and applicability reason are
83
+ recorded, and no production code changed. No unperformed stress run counts
84
+ as passed.
@@ -42,6 +42,14 @@ Nothing. The CLI checks are read-only.
42
42
  - Confirm a dev server or a static file server can serve
43
43
  `.qfai/prototype/` at the URL passed to
44
44
  `npx qfai doctor --profile prototyping --target-url <url>`.
45
+ - Doctor sends one `GET` to exactly the URL it is given, without following a
46
+ redirect, and waits 3 seconds. A status from 200 to 399 passes; a 404 or any
47
+ other status fails the check, and so does no answer. It probes that one URL,
48
+ not a file under it. A server that serves `.qfai/prototype/` with no
49
+ `index.html` at its root can answer 404 on `/`, so pass a URL that answers
50
+ 200, for example `http://localhost:3100/iter-01/<screen>.html`. A server on
51
+ one address family while `localhost` resolves to the other also fails the
52
+ probe.
45
53
  - Confirm every declared screen ID matches `[A-Za-z0-9._-]+` and does not
46
54
  contain `..`. The loop builds file names from it, so an ID that fails either
47
55
  test stops the run, naming the contract and the ID.
@@ -101,8 +101,10 @@ before the dependent write and report pending approvals.
101
101
  UI-bearing is a property of the affected flow, not of the files this run
102
102
  happened to edit. Resolve it from the source's surface classification and the UI
103
103
  contracts linked to that flow, and record it for each affected flow. Route
104
- `product-experience-architect` during design and `product-surface-reviewer`
105
- during review whenever either signal identifies the flow as UI-bearing.
104
+ `product-experience-architect` during design whenever either signal identifies
105
+ the flow as UI-bearing. `product-surface-reviewer` joins a review in a route
106
+ only for a screen change, as `common-review-cycle`'s reviewer set says;
107
+ `qfai-sdd` invoked by name keeps the reviewers its own `## Review` section names.
106
108
 
107
109
  ## Which surface owns the truth
108
110
 
@@ -25,8 +25,8 @@ Answers a question about the project from what the project already says.
25
25
  2. Cite each source it rests on: a document section, a file and line, or an
26
26
  evidence record. An answer with no source is a guess, and is not given.
27
27
  3. Where a source is missing or wrong, such as an option the documentation
28
- never mentions, record it as a follow-up for `triage-close`. Do not fix it
29
- here.
28
+ never mentions, record it as a follow-up for `triage-close`, or for the
29
+ final report where no close step follows. Do not fix it here.
30
30
 
31
31
  ## What it writes
32
32