qfai 2.1.1 → 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 (185) hide show
  1. package/README.md +56 -36
  2. package/assets/defaults/agent-routing/qfai-implement.yml +9 -0
  3. package/assets/defaults/agent-routing/qfai-triage.yml +18 -0
  4. package/assets/defaults/workflows/answer-in-session.yml +8 -0
  5. package/assets/defaults/workflows/quarantine-flaky.yml +3 -0
  6. package/assets/defaults/workflows/repair-consistency.yml +1 -0
  7. package/assets/defaults/workflows/run-operation.yml +11 -0
  8. package/assets/defaults/workflows/run-owned-cleanup.yml +12 -0
  9. package/assets/defaults/workflows/write-procedure.yml +18 -0
  10. package/assets/graph/codegraph-native.mjs +174 -0
  11. package/assets/graph/graphify-native.py +72 -0
  12. package/assets/init/.claude/settings.json +9 -9
  13. package/assets/init/.codex/hooks.json +8 -8
  14. package/assets/init/.qfai/assistant/agent/frontend-engineer.md +5 -0
  15. package/assets/init/.qfai/assistant/agent/product-experience-architect.md +4 -0
  16. package/assets/init/.qfai/assistant/agent/product-surface-reviewer.md +7 -0
  17. package/assets/init/.qfai/assistant/agent/requirements-analyst.md +8 -0
  18. package/assets/init/.qfai/assistant/rule/communication.md +18 -8
  19. package/assets/init/.qfai/assistant/rule/constitution.md +31 -15
  20. package/assets/init/.qfai/assistant/rule/drift-protocol.md +119 -2
  21. package/assets/init/.qfai/assistant/rule/references/asset-authoring.md +6 -4
  22. package/assets/init/.qfai/assistant/rule/references/codex-delegation.md +27 -0
  23. package/assets/init/.qfai/assistant/rule/references/griller-recommendations.md +21 -9
  24. package/assets/init/.qfai/assistant/rule/references/worker-edit-boundary.md +48 -0
  25. package/assets/init/.qfai/assistant/rule/review-convergence.md +25 -12
  26. package/assets/init/.qfai/assistant/rule/shared-skill-delegation-baseline.md +16 -25
  27. package/assets/init/.qfai/assistant/rule/shared-skill-operating-baseline.md +16 -11
  28. package/assets/init/.qfai/assistant/rule/ui-definition-protocol.md +6 -1
  29. package/assets/init/.qfai/assistant/rule/workflow.md +2 -1
  30. package/assets/init/.qfai/assistant/skill/qfai-configure/SKILL.md +3 -3
  31. package/assets/init/.qfai/assistant/skill/qfai-discussion/SKILL.md +6 -0
  32. package/assets/init/.qfai/assistant/skill/qfai-discussion/references/discussion-completion-matrix.md +20 -15
  33. package/assets/init/.qfai/assistant/skill/qfai-discussion/references/ui-bearing-playbook.md +2 -4
  34. package/assets/init/.qfai/assistant/skill/qfai-discussion/references/ui_ux_best_practices.md +1 -6
  35. package/assets/init/.qfai/assistant/skill/qfai-discussion/templates/uiux/00_index.md +0 -16
  36. package/assets/init/.qfai/assistant/skill/qfai-grilling/SKILL.md +30 -20
  37. package/assets/init/.qfai/assistant/skill/qfai-grilling/references/delegated-session.md +4 -3
  38. package/assets/init/.qfai/assistant/skill/qfai-grilling/references/session-record.md +8 -2
  39. package/assets/init/.qfai/assistant/skill/qfai-implement/SKILL.md +16 -3
  40. package/assets/init/.qfai/assistant/skill/qfai-implement/references/parallelization-policy.md +9 -1
  41. package/assets/init/.qfai/assistant/skill/qfai-implement/references/red-admissibility.md +46 -0
  42. package/assets/init/.qfai/assistant/skill/qfai-implement/references/ui-affecting.md +5 -2
  43. package/assets/init/.qfai/assistant/skill/qfai-maintain/SKILL.md +3 -3
  44. package/assets/init/.qfai/assistant/skill/qfai-migration-v1-to-v2/SKILL.md +12 -6
  45. package/assets/init/.qfai/assistant/skill/qfai-migration-v1-to-v2/references/migration-guide.md +1 -265
  46. package/assets/init/.qfai/assistant/skill/qfai-migration-v1-to-v2/references/migration-placement.md +273 -0
  47. package/assets/init/.qfai/assistant/skill/qfai-prototyping/SKILL.md +4 -3
  48. package/assets/init/.qfai/assistant/skill/qfai-prototyping/references/review-payload-schema.md +2 -3
  49. package/assets/init/.qfai/assistant/skill/qfai-prototyping/references/reviewer-prompt.md +17 -1
  50. package/assets/init/.qfai/assistant/skill/qfai-run/SKILL.md +52 -37
  51. package/assets/init/.qfai/assistant/skill/qfai-run/references/codex-cloud-install.md +80 -0
  52. package/assets/init/.qfai/assistant/skill/qfai-run/references/evidence-delivery.md +322 -0
  53. package/assets/init/.qfai/assistant/skill/qfai-run/references/extraction.md +83 -49
  54. package/assets/init/.qfai/assistant/skill/qfai-run/references/operator-screens.md +226 -11
  55. package/assets/init/.qfai/assistant/skill/qfai-run/references/plan.md +6 -3
  56. package/assets/init/.qfai/assistant/skill/qfai-run/references/reached-step-observations.md +132 -0
  57. package/assets/init/.qfai/assistant/skill/qfai-run/references/stage-points.md +14 -0
  58. package/assets/init/.qfai/assistant/skill/qfai-run/scripts/codex-cloud-install.mjs +117 -0
  59. package/assets/init/.qfai/assistant/skill/qfai-sdd/SKILL.md +4 -3
  60. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/contract-artifact-rules.md +1 -0
  61. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/design-anti-patterns.md +23 -5
  62. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/design-md-authoring.md +20 -7
  63. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/requirements-decomposition.md +8 -0
  64. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/sdd-execution-playbook.md +29 -4
  65. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/sdd-phase-checklists.md +1 -1
  66. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/sdd-pre-draft-grilling.md +4 -1
  67. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/sdd-quality-gate.md +1 -1
  68. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/sdd-triage.md +159 -4
  69. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/spec-traceability-rules.md +14 -2
  70. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/ui-contract-guide.md +146 -0
  71. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/ui-design-contract-normalization.md +4 -29
  72. package/assets/init/.qfai/assistant/skill/qfai-sdd/templates/change-request.md +38 -1
  73. package/assets/init/.qfai/assistant/skill/qfai-sdd/templates/contracts/ui-contract.sample.yaml +52 -5
  74. package/assets/init/.qfai/assistant/skill/qfai-sdd/templates/spec/decisions.md +12 -0
  75. package/assets/init/.qfai/assistant/skill/qfai-triage/SKILL.md +34 -21
  76. package/assets/init/.qfai/assistant/skill/qfai-verify/SKILL.md +5 -4
  77. package/assets/init/.qfai/assistant/skill/qfai-verify/references/context-load.md +9 -6
  78. package/assets/init/.qfai/assistant/skill/qfai-verify/references/verify-output-contract.md +80 -15
  79. package/assets/init/.qfai/assistant/skill/web-research/SKILL.md +35 -21
  80. package/assets/init/.qfai/assistant/skill/web-research/mcp-templates/brave-search/config.toml +2 -4
  81. package/assets/init/.qfai/assistant/skill/web-research/mcp-templates/brave-search/mcp-config.json +9 -5
  82. package/assets/init/.qfai/assistant/skill/web-research/mcp-templates/firecrawl/.mcp.json +1 -2
  83. package/assets/init/.qfai/assistant/skill/web-research/mcp-templates/firecrawl/config.toml +3 -3
  84. package/assets/init/.qfai/assistant/skill/web-research/mcp-templates/firecrawl/mcp-config.json +11 -8
  85. package/assets/init/.qfai/assistant/skill/web-research/mcp-templates/playwright/config.toml +1 -1
  86. package/assets/init/.qfai/assistant/skill/web-research/mcp-templates/playwright/mcp-config.json +7 -3
  87. package/assets/init/.qfai/assistant/step/common-design-md/STEP.md +33 -20
  88. package/assets/init/.qfai/assistant/step/common-gate-run/STEP.md +124 -8
  89. package/assets/init/.qfai/assistant/step/common-grilling-record/STEP.md +10 -2
  90. package/assets/init/.qfai/assistant/step/common-policy-check/STEP.md +1 -0
  91. package/assets/init/.qfai/assistant/step/common-review-cycle/STEP.md +26 -9
  92. package/assets/init/.qfai/assistant/step/discussion-interview/STEP.md +15 -8
  93. package/assets/init/.qfai/assistant/step/discussion-oq/STEP.md +5 -1
  94. package/assets/init/.qfai/assistant/step/discussion-pack/STEP.md +6 -1
  95. package/assets/init/.qfai/assistant/step/discussion-research/STEP.md +2 -0
  96. package/assets/init/.qfai/assistant/step/discussion-uiux/STEP.md +6 -4
  97. package/assets/init/.qfai/assistant/step/implement-backport/STEP.md +1 -1
  98. package/assets/init/.qfai/assistant/step/implement-benchmark/STEP.md +7 -4
  99. package/assets/init/.qfai/assistant/step/implement-dep-bump/STEP.md +11 -2
  100. package/assets/init/.qfai/assistant/step/implement-diagnose/STEP.md +2 -0
  101. package/assets/init/.qfai/assistant/step/implement-oracle-parity/STEP.md +2 -2
  102. package/assets/init/.qfai/assistant/step/implement-procedure/STEP.md +69 -0
  103. package/assets/init/.qfai/assistant/step/implement-quarantine/STEP.md +24 -7
  104. package/assets/init/.qfai/assistant/step/implement-refactor/STEP.md +2 -2
  105. package/assets/init/.qfai/assistant/step/implement-regression-fix/STEP.md +7 -6
  106. package/assets/init/.qfai/assistant/step/implement-retire/STEP.md +6 -3
  107. package/assets/init/.qfai/assistant/step/implement-revert/STEP.md +4 -3
  108. package/assets/init/.qfai/assistant/step/implement-seam/STEP.md +6 -5
  109. package/assets/init/.qfai/assistant/step/implement-stress-harness/STEP.md +34 -3
  110. package/assets/init/.qfai/assistant/step/implement-sweep/STEP.md +4 -3
  111. package/assets/init/.qfai/assistant/step/implement-tdd/STEP.md +39 -5
  112. package/assets/init/.qfai/assistant/step/implement-tooling/STEP.md +22 -2
  113. package/assets/init/.qfai/assistant/step/maintain-edit/STEP.md +18 -14
  114. package/assets/init/.qfai/assistant/step/prototyping-grill/STEP.md +4 -3
  115. package/assets/init/.qfai/assistant/step/prototyping-loop/STEP.md +4 -0
  116. package/assets/init/.qfai/assistant/step/prototyping-preflight/STEP.md +9 -3
  117. package/assets/init/.qfai/assistant/step/sdd-contract/STEP.md +11 -0
  118. package/assets/init/.qfai/assistant/step/sdd-flow/STEP.md +2 -0
  119. package/assets/init/.qfai/assistant/step/sdd-story/STEP.md +10 -0
  120. package/assets/init/.qfai/assistant/step/sdd-triage/STEP.md +34 -10
  121. package/assets/init/.qfai/assistant/step/triage-answer/STEP.md +7 -6
  122. package/assets/init/.qfai/assistant/step/triage-close/STEP.md +33 -23
  123. package/assets/init/.qfai/assistant/step/triage-cluster/STEP.md +5 -3
  124. package/assets/init/.qfai/assistant/step/triage-decompose/STEP.md +2 -0
  125. package/assets/init/.qfai/assistant/step/triage-dedupe/STEP.md +4 -0
  126. package/assets/init/.qfai/assistant/step/triage-handoff/STEP.md +13 -4
  127. package/assets/init/.qfai/assistant/step/triage-investigate/STEP.md +8 -5
  128. package/assets/init/.qfai/assistant/step/triage-operate/STEP.md +50 -0
  129. package/assets/init/.qfai/assistant/step/triage-owned-cleanup/STEP.md +86 -0
  130. package/assets/init/.qfai/assistant/step/triage-request-info/STEP.md +2 -0
  131. package/assets/init/.qfai/assistant/step/triage-security-intake/STEP.md +6 -3
  132. package/assets/init/.qfai/assistant/step/verify-change-note/STEP.md +1 -0
  133. package/assets/init/.qfai/assistant/step/verify-commit/STEP.md +37 -9
  134. package/assets/init/.qfai/assistant/step/verify-external/STEP.md +5 -2
  135. package/assets/init/.qfai/assistant/step/verify-qfai-gate/STEP.md +14 -16
  136. package/assets/init/.qfai/assistant/step/verify-release-notes/STEP.md +1 -0
  137. package/assets/init/.qfai/assistant/step/verify-repeat-run/STEP.md +46 -4
  138. package/assets/init/.qfai/assistant/step/verify-repo-gate/STEP.md +133 -30
  139. package/assets/init/root/.agents/rules/ai-readable-markdown.md +2 -2
  140. package/assets/init/root/.agents/rules/api-budget.md +187 -8
  141. package/assets/init/root/.agents/rules/document-schema.md +17 -0
  142. package/assets/init/root/.agents/rules/documentation-clarity.md +163 -34
  143. package/assets/init/root/.agents/rules/graph-exploration.md +150 -0
  144. package/assets/init/root/.agents/rules/grilling.md +100 -43
  145. package/assets/init/root/.agents/rules/minimal-implementation.md +3 -3
  146. package/assets/init/root/.agents/rules/reminders.json +27 -18
  147. package/assets/init/root/.agents/rules/session-feedback.md +131 -0
  148. package/assets/init/root/.agents/rules/temporary-files.md +33 -0
  149. package/assets/init/root/.agents/rules/untrusted-content.md +2 -2
  150. package/assets/init/root/.agents/rules/user-questions.md +51 -40
  151. package/assets/init/root/.github/workflows/qfai-docs.yml +3 -3
  152. package/assets/init/root/.github/workflows/qfai-tests.yml +88 -35
  153. package/assets/init/root/.github/workflows/qfai-validate.yml +2 -2
  154. package/assets/init/root/AGENTS.md +24 -22
  155. package/assets/sandbox-templates/default-deny.yaml +9 -3
  156. package/assets/schemas/workflow/extraction.schema.json +89 -5
  157. package/assets/scripts/check-mdschema.mjs +77 -8
  158. package/assets/uix-rev/comparison-review.md +1 -1
  159. package/assets/uix-rev/contracts-review.md +1 -2
  160. package/dist/cli/index.cjs +9444 -10071
  161. package/dist/cli/index.cjs.map +1 -1
  162. package/dist/cli/index.mjs +9421 -10041
  163. package/dist/cli/index.mjs.map +1 -1
  164. package/dist/graph/cli.cjs +1568 -0
  165. package/dist/graph/cli.cjs.map +1 -0
  166. package/dist/graph/cli.d.cts +9 -0
  167. package/dist/graph/cli.d.ts +9 -0
  168. package/dist/graph/cli.mjs +1541 -0
  169. package/dist/graph/cli.mjs.map +1 -0
  170. package/dist/graph/hook.cjs +817 -0
  171. package/dist/graph/hook.cjs.map +1 -0
  172. package/dist/graph/hook.d.cts +9 -0
  173. package/dist/graph/hook.d.ts +9 -0
  174. package/dist/graph/hook.mjs +792 -0
  175. package/dist/graph/hook.mjs.map +1 -0
  176. package/dist/index.cjs +7634 -8517
  177. package/dist/index.cjs.map +1 -1
  178. package/dist/index.d.cts +146 -658
  179. package/dist/index.d.ts +146 -658
  180. package/dist/index.mjs +7462 -8318
  181. package/dist/index.mjs.map +1 -1
  182. package/dist/process-C21nTvkT.d.cts +12 -0
  183. package/dist/process-C21nTvkT.d.ts +12 -0
  184. package/package.json +4 -6
  185. package/assets/init/root/CLAUDE.md +0 -46
@@ -6,6 +6,52 @@ A RED observation belongs to one example and one test selector. The test must lo
6
6
 
7
7
  A collection error, import error, syntax error, missing fixture, timeout before the assertion, or unconditional throw is a missing seam. Repair the seam and repeat RED before production behavior is added.
8
8
 
9
+ ### Selected-case execution
10
+
11
+ For each focused Red, Green and Refactor invocation, keep this human receipt
12
+ under the target example in the existing stage report:
13
+
14
+ - The exact command with argument boundaries, cwd, file selection and case
15
+ selector. Preserve the Standard Test command's quoted arguments; a name
16
+ pattern does not select files.
17
+ - The actual runtime version, reporter, input revision and raw output/log
18
+ reference. Explain intentional input changes between invocations.
19
+ - The target EX, test source declaration and full file/parent/case identity.
20
+ Resolve duplicate short names through their full hierarchy; account for the
21
+ runner's actual parent selection rather than assuming a leaf-only pattern
22
+ runs every nesting shape.
23
+ - Evidence that this selected case's body executed, linked to its actual
24
+ terminal result. Retain skip, TODO, cancellation, interruption and any
25
+ expected-failure inversion explicitly.
26
+ - Process exit, aggregate counts and file/container results, apart from that
27
+ case evidence. An annotation and static scanner linkage prove a declaration,
28
+ not runtime execution or a behavioral result.
29
+
30
+ Compare actual TAP start and terminal records, spec named results or JUnit
31
+ nodes with the declared target and its full hierarchy. A TAP label, spec glyph
32
+ or JUnit testcase can belong to a container; none alone proves the selected
33
+ leaf body ran. Dots, coverage and summaries alone are also insufficient. If
34
+ output is unfamiliar, incomplete or cannot identify the selected case, retain
35
+ it, name the missing observation and obtain supported case-level evidence.
36
+ Do not guess a parser or invent a receipt format.
37
+
38
+ Zero selected executions, skip, TODO, cancellation, interruption or missing
39
+ identifiable body evidence cannot close a phase, even with exit zero or a
40
+ passing file/container. Correct selection or observation and repeat the
41
+ focused invocation. Failure of a parent, another case, an import or an
42
+ unconditional throw is not the selected assertion's ordinary RED. An
43
+ expected-failure inversion is recorded separately; its reported pass is not
44
+ ordinary behavior success. Existing approved alternative RED routes remain
45
+ available.
46
+
47
+ Ordinary RED reaches and fails the selected intended assertion or expected
48
+ exception on its stated behavior. GREEN and Refactor must observe that same
49
+ selected behavior succeeding on the intended input. Do not reuse another
50
+ case's result or a prior input revision's result as proof for this invocation.
51
+ The normal verify run establishes full collection coverage; no extra full suite is
52
+ required for each focused cycle. This receipt adds no ledger, JSON field,
53
+ gate status, runtime parser or runner.
54
+
9
55
  ## Assertion control
10
56
 
11
57
  Temporarily neutralize only the example assertion while keeping the test compilable and runnable. The same command must pass. Capture the changed lines and result, then restore the assertion before recording RED. This control shows that the reported failure came from the assertion.
@@ -5,6 +5,7 @@
5
5
  Read the UI surface paths `uiux.surfacePaths` declares in qfai.config.yaml, and resolve paths.contractsDir from the same file. Read every UI contract under its ui/ directory, and the root DESIGN.md if present for the brand tokens.
6
6
  When a prototyping loop ran in this checkout, read its handoff at .qfai/prototype/final/handoff.json: the final prototype, its procurement and the implementation notes.
7
7
  Read the flow, story, acceptance criterion, and example that the implementation changes.
8
+ For each screen the change renders, read its `supplements` and `structure` in the UI contract before adding text: the screen shows its title, group headings, labels and declared supplements, and no other text.
8
9
 
9
10
  ## Routing
10
11
 
@@ -19,6 +20,8 @@ product-surface-reviewer. Do not infer that a change has no UI effect from its d
19
20
 
20
21
  ## Evidence
21
22
 
22
- For a UI affecting example, report the screen state, action, expected and observed result, and a capture or rendered artifact. The artifact must identify the source revision. In the stage review, product-surface-reviewer judges each UI affecting example, its UI contracts, and its captured state. The review verdict refers to that revision.
23
+ For a UI affecting example, report the screen state, action, expected and observed result, and a capture or rendered artifact. The artifact must identify the source revision. In the review that reads the change, product-surface-reviewer judges each UI affecting example, its UI contracts, and its captured state. The review verdict refers to that revision.
23
24
 
24
- If the implementation or capture changes after the verdict, refresh the capture and review. A passing code test cannot substitute for the visual and interaction evidence that the acceptance criterion requires.
25
+ A fix made for a finding of that review refreshes the capture it changes and is not reviewed again (`.qfai/assistant/rule/review-convergence.md#one-review`). A passing code test cannot substitute for the visual and interaction evidence that the acceptance criterion requires.
26
+
27
+ Capture each declared task at a desktop width and a narrow width, in the normal state and in every declared empty, error, loading and success state the screen has. A text the contract declares that the capture lacks, or a text the capture shows that the contract does not declare, is a finding.
@@ -57,9 +57,9 @@ Markdown and link checks run over the changed files, each exiting 0. A check the
57
57
  project does not have is UNRUN, not a pass.
58
58
 
59
59
  The stage returns what `maintain-edit` lists under "What the stage returns".
60
- The report ends with a question listing the next actions, as
61
- `.agents/rules/user-questions.md` § 6 sets out.
62
- Under a no-question mode, list them in the report instead.
60
+ Ask for the next action only when proceeding requires the user's answer, as
61
+ `.agents/rules/user-questions.md` § 6 sets out. A completion-only report needs
62
+ no question. Under a no-question mode, list any remaining actions instead.
63
63
 
64
64
  ## Default Autopilot Policy
65
65
 
@@ -24,10 +24,16 @@ Follow `.qfai/assistant/rule/shared-skill-operating-baseline.md#user-questions-a
24
24
  for every user question. With `--auto`, ask nothing and record
25
25
  explicit assumptions in the migration report.
26
26
 
27
- Read `references/migration-guide.md` before changing the project. Run this
28
- skill from the project root, where `qfai.config.yaml` and a locally installed
29
- `qfai` package are available. The twelve scripts use the installed package.
30
- They do not add a `qfai` subcommand or make network calls.
27
+ Read `references/migration-guide.md` before changing the project.
28
+
29
+ Read `references/migration-placement.md` when you write `plan.yaml`, when a
30
+ step reports a retired configuration key, and when a step lists a document that
31
+ does not fit its template's shape. It holds the plan format, the retired keys,
32
+ the contract numbers, the business rules and what each document keeps.
33
+
34
+ Run this skill from the project root, where `qfai.config.yaml` and a locally
35
+ installed `qfai` package are available. The twelve scripts use the installed
36
+ package. They do not add a `qfai` subcommand or make network calls.
31
37
 
32
38
  The skill serves two runs, and the steps tell them apart from the project
33
39
  itself:
@@ -81,7 +87,7 @@ keep authors separate from reviewers.
81
87
  each old business rule's destination contract. Name that contract by its
82
88
  current path under `cli/`, `api/`, `db/`, `ui/` or `design/` of the
83
89
  contracts directory: step 3 gives every contract a new ID and file name,
84
- and later steps find it from that path. Use the format in the guide. The plan
90
+ and later steps find it from that path. Use the format in `references/migration-placement.md`. The plan
85
91
  may be written before step 1, from the old contract paths.
86
92
  2. Before the first real run, tell the person that the migration deletes
87
93
  every 1.x file that has no destination and replaces every customised
@@ -112,7 +118,7 @@ keep authors separate from reviewers.
112
118
  5. Resolve every reported item with the person responsible for the content.
113
119
  Preserve any item the scripts could not place. Before step 4 writes
114
120
  `id-map.json`, settle an example that cites several criteria and a rule that
115
- binds no contract through the plan keys the guide names. After it, do not
121
+ binds no contract through the plan keys `references/migration-placement.md` names. After it, do not
116
122
  change `plan.yaml` to move a mapped item. Place remaining content in the new
117
123
  tree through `/qfai-sdd`, and finish each listed item as the guide's
118
124
  "Resolve the reports" section says.
@@ -8,11 +8,6 @@ the 2.x validation and authoring workflow.
8
8
  ## Contents
9
9
 
10
10
  - Prepare
11
- - Place stories and rules
12
- - Retired configuration keys
13
- - Contract IDs
14
- - Business rules
15
- - Documents in their template's shape
16
11
  - Run the bundled steps
17
12
  - Write boundary
18
13
  - Resolve the reports
@@ -45,265 +40,6 @@ the 2.x validation and authoring workflow.
45
40
  Do not run `npx qfai init --force` to migrate. It can write beyond the migration
46
41
  scripts' allowed paths and replace local edits.
47
42
 
48
- ## Place stories and rules
49
-
50
- The AI writes `tmp/qfai-migration/plan.yaml` before running
51
- step 4. `plan.yaml` may be written before step 1, because only steps 4 and 7
52
- read it and a contract is named by the path it has in the contracts directory
53
- before step 3, which is also a key of `contract-map.json` once step 3 has run.
54
-
55
- The plan states the decisions the scripts cannot make. `flows` says which
56
- business flow holds each old story. `rules` says which existing contract
57
- enforces each old business rule, or that it enforces none. The optional
58
- `examples` list places an example whose criterion the test cases leave open.
59
- Flow order and story order determine the new IDs.
60
-
61
- - **`from`.** A `from` value identifies an old flow to continue; omit it for a
62
- new flow. It is the exact title of any H2 section of the old
63
- `_policies/04_Business-Flow.md`, and no other H2 of that file has the same
64
- title. For the unnamed opening flow, which is the text before the first
65
- `CHG-` heading or the whole file where it has none, use the reserved value
66
- `_policies/04_Business-Flow.md`. Several flows may continue the same section,
67
- and each takes that section's prose and diagram. If `from` is omitted, the
68
- script writes a template flow and reports that its diagram needs a person.
69
- - **`criteria`.** An old criterion belongs to the story its `Parent:` line
70
- names or, where it has none, to the story its row of the criteria catalog
71
- table names in the `US Ref`, `US-Refs` or `Maps To` column. Add `criteria`
72
- to a story only when the criterion has no such reference, the reference
73
- names several stories, or the two disagree.
74
- - **`contract`.** A contract path is relative to the configured contracts
75
- directory, lies under `cli/`, `api/`, `db/` or `ui/`, and names the contract
76
- file as it is before step 3 renames it. A Markdown file under `api/`, `db/`
77
- or `ui/` and a file under `design/` hold no contract, so a rule cannot be
78
- placed in one.
79
- - **`binds: none` and `retire`.** A rule with no contract takes one of these
80
- instead of `contract`. `binds: none` is allowed only where the rule's
81
- `Contract-Refs` cell is `-`. `retire` takes a reason. Step 7 removes such a
82
- rule from its `04_Business-Rules.md`, lists it under `## Operations` with
83
- its old ID and, for `retire`, the reason, and gives it no new ID.
84
- - **`examples`.** An entry names an old example ID and a `criterion`, one of
85
- the old criterion IDs that the `AC-Refs` of the test cases citing the example
86
- name. Step 4 places the example under that criterion's story, and its test
87
- cases enter the ID map, so that step 8 rewrites their annotations.
88
-
89
- ```yaml
90
- flows:
91
- - title: Place an order
92
- stories:
93
- - id: US-0001-0001
94
- criteria: [AC-0001-0001]
95
- examples:
96
- - id: EX-0001-0002
97
- criterion: AC-0001-0001
98
- rules:
99
- - id: BR-0006-0001
100
- contract: api/orders.yaml
101
- - id: BR-0006-0002
102
- binds: none
103
- - id: BR-0006-0003
104
- retire: The payment provider enforces this limit.
105
- ```
106
-
107
- Use IDs from the old files in this plan. Assign each old story, rule, example
108
- and criterion at most once. A `from` value that matches no old flow or matches
109
- several, an invalid plan, a duplicate assignment, an `examples` criterion that
110
- none of the citing test cases names, a rule with none or more than one of
111
- `contract`, `binds` and `retire`, or a contract path that is outside the four
112
- contract directories or names no contract stops step 4 before writing. Check
113
- the step-4 dry run before accepting its numbering. Step 4 writes
114
- `tmp/qfai-migration/id-map.json` once, and later steps use
115
- that map. Write the `examples` entries and the rule marks before step 4: once
116
- the map exists, an `examples` entry and a mark on a rule the map holds are
117
- refused. A mark on a rule step 4 left unplaced is still accepted while a spec
118
- pack is left. Place any other unplaced content in the new tree through `/qfai-sdd`. While the
119
- map exists and no spec pack is left, steps 4 and 7 read no plan, so a missing or
120
- rewritten `plan.yaml` stops nothing.
121
-
122
- ## Retired configuration keys
123
-
124
- Three keys of `qfai.config.yaml` no longer exist in 2.x. Each is handled by the
125
- step named here:
126
-
127
- | Key | What the migration does |
128
- | --------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- |
129
- | `validation.traceability.scMustHaveTest` | Step 1 removes it and lists it under `## Operations` |
130
- | `validation.traceability.unknownContractIdSeverity` | Step 1 removes it and lists it under `## Operations` |
131
- | `prototyping.primarySpecId` | Step 3 replaces it with `prototyping.primaryUiContract` where exactly one UI contract is tied to that spec |
132
-
133
- Step 1 also removes a `validation.traceability` or `validation` mapping that
134
- the removal leaves empty. Steps 1 to 3 run although the configuration loader
135
- reports these keys. Steps 4 to 12 refuse with exit 2 before writing, naming the
136
- key, while `qfai.config.yaml` still holds one of the three. That refusal does
137
- not mean an earlier step has not run.
138
-
139
- A UI contract is tied to a spec when the contract IDs named by the
140
- `Contract-Refs` of that spec's business rules translate, through the contract
141
- map, to one UI contract. Step 3 lists the replacement under `## Operations`.
142
- Where `prototyping.primaryUiContract` is already set, step 3 removes the old key
143
- instead. Where no UI contract is tied, more than one is, or the spec pack is
144
- gone, step 3 leaves `prototyping.primarySpecId` and lists it under
145
- `## For a person` with its old value, and exits 3. Replace it by hand with
146
- `prototyping.primaryUiContract: UI-NNNN` naming the contract. Steps 4 to 12 then
147
- run.
148
-
149
- When a step cannot load `qfai.config.yaml` for any other reason, it exits 2
150
- before writing and prints on standard error the message of each configuration
151
- issue, one per line.
152
-
153
- ## Contract IDs
154
-
155
- Step 3 gives every contract file that has no 2.x contract ID one, and renames
156
- the file to match:
157
-
158
- | Old contract | Declares | New ID | New file |
159
- | -------------------------- | -------------- | -------- | -------------------------- |
160
- | `cli/orders.md` | nothing | CLI-0001 | `cli/cli-0001-orders.md` |
161
- | `api/api-0001-orders.yaml` | `CON-API-0001` | API-0002 | `api/api-0002-orders.yaml` |
162
- | `db/db-0001-orders.sql` | `CON-DB-0001` | DB-0003 | `db/db-0003-orders.sql` |
163
-
164
- - Numbers run across all contracts, in the order CLI, API, DB, UI, then by
165
- the old number, then by path. No two contracts share a number.
166
- - The new ID replaces the old one in the file's declaration: the H1 of a
167
- Markdown contract, as `# CLI-0001: <title>`, and the `QFAI-CONTRACT-ID` line
168
- of any other. The old IDs in `-- Depends on:` and `x-qfai-depends-on` become
169
- the new ones, and a YAML contract keeps its `x-qfai-depends-on` list on one
170
- line.
171
- - `contracts.md` becomes one index table listing every contract. The old
172
- index's other sections are reported for a person.
173
- - `tmp/qfai-migration/contract-map.json` records each old
174
- path and old ID with the new ones, and step 4 copies it into the ID map.
175
- - Step 7 writes the new IDs into rule statements, and step 8 changes a
176
- `QFAI:CON-API-0001` test annotation to `QFAI:API-0002`.
177
-
178
- Step 3 gives no ID to a file that is not a 2.x contract, and does not write it
179
- into the new tree:
180
-
181
- | Old file | Why it is not a contract |
182
- | -------------------------------------------- | ------------------------------------------------------------------------------------------------------- |
183
- | A Markdown file under `api/`, `db/` or `ui/` | Those directories hold OpenAPI YAML or JSON, SQL and UI YAML contracts |
184
- | Any file under `design/` | The directory no longer exists: the brand belongs in the root `DESIGN.md`, a screen in a `ui/` contract |
185
-
186
- Step 3 deletes each one, `design/` as one directory, and lists each file under
187
- `## For a person`. Rewrite what the file stated, from git history, in the form
188
- its row names.
189
-
190
- The old `design/prototype-handoff.yaml` is now
191
- `.qfai/prototype/final/handoff.json`, which `/qfai-prototyping` writes when
192
- the user confirms the prototype. The migration does not convert
193
- the old file into it.
194
-
195
- Step 3 also replaces every old `CON-*` ID that the contract map translates inside
196
- the contract files it writes, wherever it stands in the file, and lists none of
197
- them. It writes nothing outside those files. An old ID the map cannot translate,
198
- such as an ID no contract declared or that several declared, stays as written
199
- and is reported for a person with its file and line, as is a UI marker in
200
- application code.
201
-
202
- Step 3 groups its `## For a person` items under `### Content` and
203
- `### Identifiers`. `### Content` comes first and holds what a person rewrites
204
- or decides. `### Identifiers` holds an item that only pairs an old ID with its
205
- new one, such as a changed constraint ID. A group with no item is not printed.
206
-
207
- Step 3 writes a `routing:` override into `qfai.config.yaml` only for an entry
208
- of `agent-routing.yml` that differs from the installed default. It writes none
209
- for an entry equal to a default or to an entry a 1.x release shipped. Step 3
210
- lists each routing entry it does write under `## For a person`, with its name
211
- and a warning that a routing entry copied from a 1.x manifest hides the roles
212
- the 2.x skills declare.
213
-
214
- ## Business rules
215
-
216
- Rules are numbered per contract, `BR-<contract number>-NNNN` from `0001` in plan
217
- order: the first rule step 4 places in API-0006 is BR-0006-0001. Step 7 writes
218
- each rule into its contract in the form the contract's format takes:
219
-
220
- | Contract format | Where the rule goes |
221
- | --------------- | ----------------------------------------------------------------------- |
222
- | Markdown | A row of the `## Business rules` table: BR-ID, Statement and Examples |
223
- | YAML or JSON | An entry `{ id, statement, examples }` of the top-level `x-qfai-rules:` |
224
- | SQL | A `-- Rule BR-0006-0001: <statement>` line, then an `-- Examples:` line |
225
-
226
- A Markdown contract without a `## Business rules` section gets one as its last
227
- section. A rule's examples are the new IDs of the examples that cited it. A
228
- rule written as a heading section takes the value of its `Rule` field as its
229
- statement, and a SQL contract holds that statement on one line.
230
-
231
- ## Documents in their template's shape
232
-
233
- Each story-tree document the steps write takes the shape of its `qfai-sdd`
234
- template, which is the shape the document schema checks:
235
-
236
- | Documents | Step |
237
- | --------------------------------------------------------------------------------------- | ---- |
238
- | `decisions.md` and `open-questions.md` rows | 2 |
239
- | `objective.md`, `initiative.md`, `principle.md`, `glossary.md` and `constraint.md` | 3 |
240
- | `contracts.md` and `tech.md` | 3 |
241
- | Markdown contracts under `cli/` | 3 |
242
- | `business-flows.md`, `business-flow.md`, `user-stories.md` and each story's three files | 4 |
243
- | Examples turned from test cases | 5 |
244
-
245
- Content that does not fit that shape is listed under `## For a person`, and the
246
- step exits 3:
247
-
248
- - Step 3 leaves it out of the policy file, `tech.md` or CLI contract, and names the source
249
- file and, where one fits, the template section that takes the content once a
250
- person rewrites it. The source file is deleted, so the content is read from
251
- git history.
252
- - Step 3 also leaves as it is a policy file or `tech.md` that already exists
253
- and differs from what it would write.
254
- - A constraint row keeps only its ID, Constraint and Rationale. Step 3 lists
255
- an Impact column, whose content belongs to the contract or `tech.md` that
256
- owns it, and a row that names a file, a command or a rule ID, to be rewritten
257
- in plain words.
258
- - Step 3 numbers each constraint section from 01 in table order, and lists
259
- every ID that changed with the ID that replaces it.
260
- - Steps 4 and 5 write a story sentence or an example cell of another form as it
261
- stands, for a person to rewrite.
262
- - Step 4 lists every business flow, so that a person writes its alternate and
263
- exception paths.
264
-
265
- The steps do not write these into the new tree. Each stays in its old spec-pack
266
- file, which stays in the pack while any of its content is unplaced and is then
267
- deleted, kept in git history only:
268
-
269
- - a spec pack's scope and source provenance;
270
- - a story block's `Parent`, `Source` and `Flow` fields;
271
- - a criterion's `# Parent:` line, since its directory names the story;
272
- - a `Background:`, any scenario after a criterion's first named one, and a
273
- `Scenario Outline:`, each listed for a person.
274
-
275
- Step 3 writes no structure document. It routes the old `catalog/structure.md`
276
- section by section:
277
-
278
- | Old content | New home |
279
- | ------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------- |
280
- | An entrypoint with a smoke or skeleton command | A `- Skeleton:` line in `tech.md`'s Standard commands |
281
- | A layer row of an `## Architecture` or `## Architecture constraints` table of Layer, Responsibility and Depends on columns, naming no path | The `## Architecture` table of `tech.md` |
282
- | The `ui_paths:` globs of `## UI surface paths` | `uiux.surfacePaths` in `qfai.config.yaml`, if unset |
283
- | Anything else | `## For a person` |
284
-
285
- Step 3 writes the moved layers in the shape of the Architecture section: a
286
- `flowchart TD` with a node per layer and an edge per dependency, then the table
287
- with the rows ordered from the uppermost layer down. Where the rows cannot be
288
- ordered, because a layer depends on one that has no row or layers depend on each
289
- other, none of them moves: the section is listed under `## For a person` with
290
- the reason, and `tech.md` keeps the template's Architecture section.
291
-
292
- Step 3 writes each Markdown contract under `cli/` in the shape of the CLI
293
- contract template: its `# CLI-0001: <title>` heading, `## Ownership boundary`
294
- and a `## Business rules` table, and nothing else.
295
-
296
- - An old `## Ownership boundary` of one to three paragraphs that name no rule is
297
- kept as it stands.
298
- - Where the old contract has none, the section holds the template's placeholder,
299
- and the contract is listed for a person to write it.
300
- - The text before the first section, lines such as `Status:` or `Rule refs:`,
301
- and every other section are left out. Each is listed with the old file.
302
-
303
- Step 7 then writes the contract's rules into that table. A rule whose statement
304
- names another rule is written and listed for a person, because a CLI contract's
305
- rule cites only examples.
306
-
307
43
  ## Run the bundled steps
308
44
 
309
45
  For each row, run the script with `--dry-run`, read its operations, and then run
@@ -509,7 +245,7 @@ installed package's copy. A copy the project changed is replaced, an untracked
509
245
  file and an uncommitted edit included, and the replacement is listed under
510
246
  `## Operations`. A skill the package does not ship and
511
247
  `.qfai/assistant/skill.local/` are left alone. Step 11 also adds each missing
512
- host skill link and the `.qfai/run/` line of the managed `.gitignore` block. A
248
+ host skill link and brings the managed `.gitignore` block up to date. A
513
249
  path it cannot write is reported with the reason. It leaves `AGENTS.md` and
514
250
  `CLAUDE.md` as they are, a line an earlier `npx qfai init` wrote included.
515
251