qfai 2.2.0 → 2.2.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 (117) hide show
  1. package/README.md +46 -6
  2. package/assets/defaults/workflows/bump-dependency.yml +4 -1
  3. package/assets/defaults/workflows/decide-design.yml +5 -1
  4. package/assets/defaults/workflows/rename-concept.yml +30 -0
  5. package/assets/defaults/workflows/resolve-conflicts.yml +14 -0
  6. package/assets/defaults/workflows/retire-feature.yml +26 -0
  7. package/assets/defaults/workflows/run-release.yml +12 -0
  8. package/assets/init/.claude/settings.json +11 -11
  9. package/assets/init/.codex/hooks.json +9 -9
  10. package/assets/init/.qfai/assistant/agent/backend-engineer.md +1 -1
  11. package/assets/init/.qfai/assistant/agent/frontend-engineer.md +1 -1
  12. package/assets/init/.qfai/assistant/agent/implementation-reviewer.md +5 -0
  13. package/assets/init/.qfai/assistant/agent/product-surface-reviewer.md +8 -3
  14. package/assets/init/.qfai/assistant/rule/constitution.md +5 -3
  15. package/assets/init/.qfai/assistant/rule/drift-protocol.md +18 -0
  16. package/assets/init/.qfai/assistant/rule/references/gate-failure-autorepair.md +1 -1
  17. package/assets/init/.qfai/assistant/rule/review-convergence.md +9 -3
  18. package/assets/init/.qfai/assistant/rule/shared-skill-delegation-baseline.md +11 -2
  19. package/assets/init/.qfai/assistant/rule/shared-skill-operating-baseline.md +6 -4
  20. package/assets/init/.qfai/assistant/rule/ui-definition-protocol.md +2 -1
  21. package/assets/init/.qfai/assistant/skill/qfai-discussion/SKILL.md +5 -2
  22. package/assets/init/.qfai/assistant/skill/qfai-discussion/references/discussion-completion-matrix.md +15 -2
  23. package/assets/init/.qfai/assistant/skill/qfai-discussion/references/ui-bearing-playbook.md +17 -0
  24. package/assets/init/.qfai/assistant/skill/qfai-discussion/references/ui_ux/trend_scan_playbook.md +3 -1
  25. package/assets/init/.qfai/assistant/skill/qfai-discussion/templates/01_Context.md +4 -1
  26. package/assets/init/.qfai/assistant/skill/qfai-discussion/templates/04_Sources.md +5 -1
  27. package/assets/init/.qfai/assistant/skill/qfai-discussion/templates/uiux/00_index.md +4 -1
  28. package/assets/init/.qfai/assistant/skill/qfai-implement/SKILL.md +2 -2
  29. package/assets/init/.qfai/assistant/skill/qfai-implement/references/parallelization-policy.md +10 -0
  30. package/assets/init/.qfai/assistant/skill/qfai-implement/references/red-admissibility.md +35 -0
  31. package/assets/init/.qfai/assistant/skill/qfai-implement/references/test-runner-recipes.md +445 -0
  32. package/assets/init/.qfai/assistant/skill/qfai-implement/references/ui-affecting.md +2 -2
  33. package/assets/init/.qfai/assistant/skill/qfai-prototyping/SKILL.md +10 -9
  34. package/assets/init/.qfai/assistant/skill/qfai-prototyping/references/generator-prompt.md +33 -2
  35. package/assets/init/.qfai/assistant/skill/qfai-prototyping/references/handoff.md +77 -2
  36. package/assets/init/.qfai/assistant/skill/qfai-prototyping/references/iteration-loop.md +12 -3
  37. package/assets/init/.qfai/assistant/skill/qfai-prototyping/references/review-payload-schema.md +3 -1
  38. package/assets/init/.qfai/assistant/skill/qfai-prototyping/references/reviewer-prompt.md +31 -5
  39. package/assets/init/.qfai/assistant/skill/qfai-run/SKILL.md +17 -17
  40. package/assets/init/.qfai/assistant/skill/qfai-run/references/extraction.md +194 -129
  41. package/assets/init/.qfai/assistant/skill/qfai-run/references/operator-screens.md +29 -14
  42. package/assets/init/.qfai/assistant/skill/qfai-run/references/plan.md +46 -22
  43. package/assets/init/.qfai/assistant/skill/qfai-run/references/reached-step-observations.md +2 -0
  44. package/assets/init/.qfai/assistant/skill/qfai-run/references/stage-points.md +7 -4
  45. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/concrete-abstract-cycle.md +2 -1
  46. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/contract-artifact-rules.md +1 -1
  47. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/sdd-execution-playbook.md +2 -2
  48. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/sdd-phase-checklists.md +1 -1
  49. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/sdd-pre-draft-grilling.md +1 -0
  50. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/sdd-quality-gate.md +1 -1
  51. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/sdd-triage.md +83 -6
  52. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/spec-traceability-rules.md +1 -1
  53. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/ui-contract-guide.md +23 -5
  54. package/assets/init/.qfai/assistant/skill/qfai-sdd/templates/change-request.md +1 -1
  55. package/assets/init/.qfai/assistant/skill/qfai-sdd/templates/spec/decisions/page-NNNN.md +6 -0
  56. package/assets/init/.qfai/assistant/skill/qfai-sdd/templates/spec/decisions.md +9 -0
  57. package/assets/init/.qfai/assistant/skill/qfai-sdd/templates/spec/open-questions.md +13 -0
  58. package/assets/init/.qfai/assistant/skill/qfai-verify/references/verify-output-contract.md +15 -9
  59. package/assets/init/.qfai/assistant/skill/web-research/SKILL.md +1 -1
  60. package/assets/init/.qfai/assistant/step/common-gate-run/STEP.md +11 -8
  61. package/assets/init/.qfai/assistant/step/common-grilling-record/STEP.md +15 -2
  62. package/assets/init/.qfai/assistant/step/common-review-cycle/STEP.md +48 -11
  63. package/assets/init/.qfai/assistant/step/discussion-interview/STEP.md +11 -3
  64. package/assets/init/.qfai/assistant/step/discussion-oq/STEP.md +12 -0
  65. package/assets/init/.qfai/assistant/step/discussion-pack/STEP.md +18 -2
  66. package/assets/init/.qfai/assistant/step/discussion-uiux/STEP.md +4 -0
  67. package/assets/init/.qfai/assistant/step/implement-acceptance/STEP.md +3 -0
  68. package/assets/init/.qfai/assistant/step/implement-credentials/STEP.md +4 -0
  69. package/assets/init/.qfai/assistant/step/implement-dep-bump/STEP.md +31 -7
  70. package/assets/init/.qfai/assistant/step/implement-diagnose/STEP.md +12 -3
  71. package/assets/init/.qfai/assistant/step/implement-procedure/STEP.md +35 -6
  72. package/assets/init/.qfai/assistant/step/implement-refactor/STEP.md +25 -5
  73. package/assets/init/.qfai/assistant/step/implement-retire/STEP.md +26 -0
  74. package/assets/init/.qfai/assistant/step/implement-scaffold/STEP.md +28 -5
  75. package/assets/init/.qfai/assistant/step/implement-tdd/STEP.md +20 -5
  76. package/assets/init/.qfai/assistant/step/maintain-edit/STEP.md +70 -6
  77. package/assets/init/.qfai/assistant/step/prototyping-grill/STEP.md +39 -6
  78. package/assets/init/.qfai/assistant/step/prototyping-handoff/STEP.md +12 -3
  79. package/assets/init/.qfai/assistant/step/prototyping-loop/STEP.md +56 -6
  80. package/assets/init/.qfai/assistant/step/prototyping-preflight/STEP.md +5 -0
  81. package/assets/init/.qfai/assistant/step/sdd-contract/STEP.md +8 -0
  82. package/assets/init/.qfai/assistant/step/sdd-cycle/STEP.md +9 -4
  83. package/assets/init/.qfai/assistant/step/sdd-story/STEP.md +22 -1
  84. package/assets/init/.qfai/assistant/step/sdd-triage/STEP.md +48 -12
  85. package/assets/init/.qfai/assistant/step/triage-close/STEP.md +7 -2
  86. package/assets/init/.qfai/assistant/step/triage-handoff/STEP.md +6 -0
  87. package/assets/init/.qfai/assistant/step/triage-operate/STEP.md +76 -3
  88. package/assets/init/.qfai/assistant/step/verify-commit/STEP.md +35 -10
  89. package/assets/init/.qfai/assistant/step/verify-repo-gate/STEP.md +65 -7
  90. package/assets/init/root/.agents/rules/api-budget.md +8 -3
  91. package/assets/init/root/.agents/rules/graph-exploration.md +18 -4
  92. package/assets/init/root/.agents/rules/reminders.json +20 -28
  93. package/assets/init/root/.agents/rules/user-questions.md +21 -11
  94. package/assets/init/root/.gitattributes +2 -0
  95. package/assets/init/root/AGENTS.md +1 -1
  96. package/assets/mdschema/manifest.yml +3 -0
  97. package/assets/mdschema/story/03_contract/tech.mdschema.yml +1 -1
  98. package/assets/mdschema/story/decisions/page-NNNN.mdschema.yml +32 -0
  99. package/assets/mdschema/story/decisions.mdschema.yml +12 -0
  100. package/assets/schemas/workflow/extraction.schema.json +94 -2
  101. package/assets/schemas/workflow/plan.schema.json +34 -1
  102. package/assets/scripts/check-mdschema.mjs +434 -45
  103. package/dist/cli/index.cjs +4930 -2264
  104. package/dist/cli/index.cjs.map +1 -1
  105. package/dist/cli/index.mjs +4690 -2016
  106. package/dist/cli/index.mjs.map +1 -1
  107. package/dist/graph/cli.cjs.map +1 -1
  108. package/dist/graph/cli.mjs.map +1 -1
  109. package/dist/graph/hook.cjs.map +1 -1
  110. package/dist/graph/hook.mjs.map +1 -1
  111. package/dist/index.cjs +3338 -1830
  112. package/dist/index.cjs.map +1 -1
  113. package/dist/index.d.cts +59 -3
  114. package/dist/index.d.ts +59 -3
  115. package/dist/index.mjs +3154 -1649
  116. package/dist/index.mjs.map +1 -1
  117. package/package.json +1 -1
package/README.md CHANGED
@@ -59,6 +59,11 @@ pnpm approve-builds # pnpm: adds it to `onlyBuiltDependencies`
59
59
  `npx qfai doctor` runs `mdschema --help` and reports an error, naming these
60
60
  fixes, when the binary does not start.
61
61
 
62
+ QFAI pins this dependency to an exact version. A release that moves the pin
63
+ says so in its [release notes](#keeping-qfai-itself-up-to-date), so a project
64
+ that approves the script for each version can approve the new one before it
65
+ upgrades.
66
+
62
67
  ## Quick start
63
68
 
64
69
  > **Windows users:** `qfai init` creates symlinks internally.
@@ -106,10 +111,12 @@ The `qfai-run` skill reads it into facts: what it asks for, its risks, and how s
106
111
  and returns the route's plan, writing nothing. The session runs each step of the plan in order and
107
112
  asks you only the decisions that are yours and each release. You type no stage name.
108
113
 
109
- `npx qfai init` adds a hook that repeats this on every prompt: a request that names no skill goes
110
- to `qfai-run`. Claude Code reads it from `.claude/settings.json` and Codex from `.codex/hooks.json`.
111
- A question that one command or one file read answers is answered directly, with no plan. Any other
112
- question about the project that changes no file plans a route that answers it and changes nothing.
114
+ `npx qfai init` adds a hook that states this on a session's first prompt and repeats it in one line
115
+ on every later prompt: a request that names no skill goes to `qfai-run`. Claude Code reads it from `.claude/settings.json` and Codex from `.codex/hooks.json`.
116
+ `qfai-run` plans every such request, the lightest included: a question that one command or one
117
+ file read answers gets a plan too, and a question about the project plans an answer without
118
+ changes. A message that is not a request, such as an automated notice, gets no plan; a notice that
119
+ delivers a result a step was waiting for resumes that step.
113
120
  An existing `.codex/hooks.json` gains the hooks the way `.claude/settings.json` does.
114
121
  Codex runs a project's hooks only after you review and trust them with `/hooks`.
115
122
 
@@ -578,6 +585,26 @@ cp node_modules/qfai/assets/init/root/.github/workflows/qfai-docs.yml .github/wo
578
585
  Read your own edits out of the old copy before you replace it. Neither route
579
586
  merges them.
580
587
 
588
+ `npx qfai doctor` warns about each installed workflow whose text differs from
589
+ the packaged copy. The warning gives the number of differing lines, the jobs
590
+ that differ, each pinned action whose version differs and the file's current
591
+ digest. To keep a difference on purpose, list the file with that digest and a
592
+ reason in `qfai.config.yaml`; doctor then reports it as `info` with that reason
593
+ instead of a warning:
594
+
595
+ ```yaml
596
+ workflow:
597
+ acceptedDrift:
598
+ - file: qfai-docs.yml
599
+ digest: <the digest doctor printed, sha256:…>
600
+ reason: We run our own docs lane.
601
+ ```
602
+
603
+ When the file changes again its digest no longer matches, and doctor warns
604
+ again with the new digest. An entry without a digest or a
605
+ reason, or a file outside the shipped set or listed twice, is a configuration
606
+ error and accepts nothing.
607
+
581
608
  On any other CI platform, configure the job yourself and run:
582
609
 
583
610
  ```bash
@@ -864,6 +891,11 @@ Moving a project from the spec-pack layout to the story tree also requires
864
891
  `/qfai-migration-v1-to-v2`. `init --force` refreshes shipped assets; the
865
892
  migration skill moves project content and reports items that need a person.
866
893
 
894
+ The release notes of each version are the body of its GitHub Release, listed
895
+ at <https://github.com/aganesy/QFAI/releases>. Read them before you upgrade:
896
+ they name the files a version retires and any change to the exact version of a
897
+ dependency the package pins, such as `@jackchuka/mdschema`.
898
+
867
899
  To upgrade by hand:
868
900
 
869
901
  1. Install the new version with your package manager, for example
@@ -876,8 +908,12 @@ To upgrade by hand:
876
908
  afterwards.
877
909
  4. Delete the files the release notes of the new version list as retired, once
878
910
  nothing you keep reads them.
879
- 5. Run `npx qfai doctor` and `npx qfai validate`, and fix what they report.
880
- 6. Commit the result in one change.
911
+ 5. `init --force` does not touch the workflows under `.github/workflows/`. For
912
+ each one `npx qfai doctor` reports as differing, copy the packaged file over
913
+ it, or list it under `workflow.acceptedDrift` with the digest doctor prints
914
+ and a reason if you keep your own version.
915
+ 6. Run `npx qfai doctor` and `npx qfai validate`, and fix what they report.
916
+ 7. Commit the result in one change.
881
917
 
882
918
  An agent asked to upgrade `qfai` follows these steps as a dependency update.
883
919
 
@@ -1030,6 +1066,10 @@ file prints nothing. `qfai init` refreshes that file wherever the project has
1030
1066
  not edited it, so a new release's wording reaches an existing project without
1031
1067
  changing `.claude/settings.json`. Remove the entries from that file and from
1032
1068
  `.codex/hooks.json` to turn the reminder off; the rule still applies.
1069
+ The free-text entry reminder prints in full on a session's first prompt and in one line
1070
+ on every later prompt. Every other rule reminder prints at most once per session. Both
1071
+ are counted per `session_id` in the operating system's temporary directory, and there is
1072
+ no setting to change that.
1033
1073
 
1034
1074
  Codex gets the same reminders from `.codex/hooks.json` once you trust the
1035
1075
  project's hooks with `/hooks`. Each is one command line that runs the same under
@@ -15,4 +15,7 @@ stages:
15
15
  steps: [verify-qfai-gate, verify-repo-gate, verify-commit]
16
16
  after: [note]
17
17
  decisionPoints: []
18
- branchPoints: []
18
+ branchPoints:
19
+ - step: implement-dep-bump
20
+ outcomes:
21
+ - { outcome: contract-finding, routes: [apply-settled] }
@@ -17,4 +17,8 @@ decisionPoints: [discussion-interview]
17
17
  branchPoints:
18
18
  - step: triage-close
19
19
  outcomes:
20
- - { outcome: adopted, routes: [add-feature, prototype-feature, change-compatibility] }
20
+ - {
21
+ outcome: adopted,
22
+ routes:
23
+ [add-feature, prototype-feature, change-compatibility, retire-feature, rename-concept],
24
+ }
@@ -0,0 +1,30 @@
1
+ route: rename-concept
2
+ family: change
3
+ stages:
4
+ - id: spec
5
+ kind: sdd
6
+ steps:
7
+ - sdd-triage
8
+ - { step: sdd-flow, passThrough: true }
9
+ - { step: sdd-story, passThrough: true }
10
+ - { step: sdd-contract, passThrough: true }
11
+ review: spec
12
+ - id: rename
13
+ kind: implement
14
+ steps: [implement-refactor]
15
+ after: [spec]
16
+ - id: note
17
+ kind: verify
18
+ steps:
19
+ - { step: verify-change-note, passThrough: true }
20
+ after: [rename]
21
+ review: code
22
+ - id: verify
23
+ kind: verify
24
+ steps: [verify-qfai-gate, verify-repo-gate, verify-commit]
25
+ after: [note]
26
+ decisionPoints: [sdd-triage]
27
+ branchPoints:
28
+ - step: implement-refactor
29
+ outcomes:
30
+ - { outcome: behaviour-change, routes: [add-feature, change-compatibility] }
@@ -0,0 +1,14 @@
1
+ route: resolve-conflicts
2
+ family: change
3
+ stages:
4
+ - id: edit
5
+ kind: maintenance
6
+ steps: [maintain-edit]
7
+ review: code
8
+ serves: [spec, contract]
9
+ - id: verify
10
+ kind: verify
11
+ steps: [verify-qfai-gate, verify-repo-gate, verify-commit]
12
+ after: [edit]
13
+ decisionPoints: []
14
+ branchPoints: []
@@ -0,0 +1,26 @@
1
+ route: retire-feature
2
+ family: change
3
+ stages:
4
+ - id: spec
5
+ kind: sdd
6
+ steps:
7
+ - sdd-triage
8
+ - sdd-story
9
+ - { step: sdd-contract, passThrough: true }
10
+ review: spec
11
+ - id: remove
12
+ kind: implement
13
+ steps: [implement-retire]
14
+ after: [spec]
15
+ - id: note
16
+ kind: verify
17
+ steps:
18
+ - { step: verify-change-note, passThrough: true }
19
+ after: [remove]
20
+ review: code
21
+ - id: verify
22
+ kind: verify
23
+ steps: [verify-qfai-gate, verify-repo-gate, verify-commit]
24
+ after: [note]
25
+ decisionPoints: [sdd-triage]
26
+ branchPoints: []
@@ -0,0 +1,12 @@
1
+ route: run-release
2
+ family: release
3
+ stages:
4
+ - id: release
5
+ kind: triage
6
+ steps: [triage-operate]
7
+ decisionPoints: []
8
+ releasePoint: triage-operate
9
+ branchPoints:
10
+ - step: triage-operate
11
+ outcomes:
12
+ - { outcome: needs-change, routes: decision-table }
@@ -30,7 +30,7 @@
30
30
  "command": "node",
31
31
  "args": [
32
32
  "-e",
33
- "try{const f=require('fs');let i={};try{i=JSON.parse(f.readFileSync(0,'utf8'))||{}}catch{}const p=i.prompt;if(!(typeof p==='string'&&/^[ \\t]*(<(task-notification|wake|ci-monitor-event)[\\s>]|\\[SYSTEM NOTIFICATION)/m.test(p))){let n=1;if(typeof i.session_id==='string'){try{const t=require('path').join(require('os').tmpdir(),['qfai-reminder',i.session_id,i.agent_id||'main',process.argv[2]].join('-').replace(/[^\\w.-]/g,'_'));f.appendFileSync(t,'.');n=f.statSync(t).size}catch{}}const e=JSON.parse(f.readFileSync(process.argv[1],'utf8'))[process.argv[2]];if(e!==undefined){const {briefContext,...m}=e;if(n>1&&typeof briefContext==='string')m.hookSpecificOutput.additionalContext=briefContext;console.log(JSON.stringify(m))}}}catch{}",
33
+ "try{const f=require('fs');let i={};try{i=JSON.parse(f.readFileSync(0,'utf8'))||{}}catch{}const p=i.prompt;if(!(typeof p==='string'&&/^[ \\t]*(<(task-notification|wake|ci-monitor-event)[\\s>]|\\[SYSTEM NOTIFICATION)/m.test(p))){let n=1;if(typeof i.session_id==='string'){const t=require('path').join(require('os').tmpdir(),['qfai-reminder',i.session_id,i.agent_id||'main',process.argv[2]].join('-').replace(/[^\\w.-]/g,'_'));try{f.writeFileSync(t,'',{flag:'wx'})}catch(q){try{if(q.code==='EEXIST'&&f.statSync(t).isFile())n=2}catch{}}}const e=JSON.parse(f.readFileSync(process.argv[1],'utf8'))[process.argv[2]];if(e!==undefined){if(n===1)console.log(JSON.stringify(e))}}}catch{}",
34
34
  "${CLAUDE_PROJECT_DIR}/.agents/rules/reminders.json",
35
35
  "structured-question"
36
36
  ]
@@ -46,7 +46,7 @@
46
46
  "command": "node",
47
47
  "args": [
48
48
  "-e",
49
- "try{const f=require('fs');let i={};try{i=JSON.parse(f.readFileSync(0,'utf8'))||{}}catch{}const p=i.prompt;if(!(typeof p==='string'&&/^[ \\t]*(<(task-notification|wake|ci-monitor-event)[\\s>]|\\[SYSTEM NOTIFICATION)/m.test(p))){let n=1;if(typeof i.session_id==='string'){try{const t=require('path').join(require('os').tmpdir(),['qfai-reminder',i.session_id,i.agent_id||'main',process.argv[2]].join('-').replace(/[^\\w.-]/g,'_'));f.appendFileSync(t,'.');n=f.statSync(t).size}catch{}}const e=JSON.parse(f.readFileSync(process.argv[1],'utf8'))[process.argv[2]];if(e!==undefined){const {briefContext,...m}=e;if(n>1&&typeof briefContext==='string')m.hookSpecificOutput.additionalContext=briefContext;console.log(JSON.stringify(m))}}}catch{}",
49
+ "try{const f=require('fs');let i={};try{i=JSON.parse(f.readFileSync(0,'utf8'))||{}}catch{}const p=i.prompt;if(!(typeof p==='string'&&/^[ \\t]*(<(task-notification|wake|ci-monitor-event)[\\s>]|\\[SYSTEM NOTIFICATION)/m.test(p))){let n=1;if(typeof i.session_id==='string'){const t=require('path').join(require('os').tmpdir(),['qfai-reminder',i.session_id,i.agent_id||'main',process.argv[2]].join('-').replace(/[^\\w.-]/g,'_'));try{f.writeFileSync(t,'',{flag:'wx'})}catch(q){try{if(q.code==='EEXIST'&&f.statSync(t).isFile())n=2}catch{}}}const e=JSON.parse(f.readFileSync(process.argv[1],'utf8'))[process.argv[2]];if(e!==undefined){const {briefContext,...m}=e;if(n>1&&typeof briefContext==='string')m.hookSpecificOutput.additionalContext=briefContext;console.log(JSON.stringify(m))}}}catch{}",
50
50
  "${CLAUDE_PROJECT_DIR}/.agents/rules/reminders.json",
51
51
  "free-text-entry"
52
52
  ]
@@ -80,7 +80,7 @@
80
80
  "command": "node",
81
81
  "args": [
82
82
  "-e",
83
- "try{const m=JSON.parse(require('fs').readFileSync(process.argv[1],'utf8'))[process.argv[2]];if(m!==undefined)console.log(JSON.stringify(m))}catch{}",
83
+ "try{const f=require('fs');let i={};try{i=JSON.parse(f.readFileSync(0,'utf8'))||{}}catch{}let n=1;if(typeof i.session_id==='string'){const t=require('path').join(require('os').tmpdir(),['qfai-reminder',i.session_id,i.agent_id||'main',process.argv[2]].join('-').replace(/[^\\w.-]/g,'_'));try{f.writeFileSync(t,'',{flag:'wx'})}catch(q){try{if(q.code==='EEXIST'&&f.statSync(t).isFile())n=2}catch{}}}const e=JSON.parse(f.readFileSync(process.argv[1],'utf8'))[process.argv[2]];if(e!==undefined){if(n===1)console.log(JSON.stringify(e))}}catch{}",
84
84
  "${CLAUDE_PROJECT_DIR}/.agents/rules/reminders.json",
85
85
  "documentation-clarity-before-post"
86
86
  ]
@@ -96,7 +96,7 @@
96
96
  "command": "node",
97
97
  "args": [
98
98
  "-e",
99
- "try{const f=require('fs');let i={};try{i=JSON.parse(f.readFileSync(0,'utf8'))||{}}catch{}let n=1;if(typeof i.session_id==='string'){try{const t=require('path').join(require('os').tmpdir(),['qfai-reminder',i.session_id,i.agent_id||'main',process.argv[2]].join('-').replace(/[^\\w.-]/g,'_'));f.appendFileSync(t,'.');n=f.statSync(t).size}catch{}}const e=JSON.parse(f.readFileSync(process.argv[1],'utf8'))[process.argv[2]];if(e!==undefined){const {briefContext,...m}=e;if(n>1&&typeof briefContext==='string')m.hookSpecificOutput.additionalContext=briefContext;console.log(JSON.stringify(m))}}catch{}",
99
+ "try{const f=require('fs');let i={};try{i=JSON.parse(f.readFileSync(0,'utf8'))||{}}catch{}let n=1;if(typeof i.session_id==='string'){const t=require('path').join(require('os').tmpdir(),['qfai-reminder',i.session_id,i.agent_id||'main',process.argv[2]].join('-').replace(/[^\\w.-]/g,'_'));try{f.writeFileSync(t,'',{flag:'wx'})}catch(q){try{if(q.code==='EEXIST'&&f.statSync(t).isFile())n=2}catch{}}}const e=JSON.parse(f.readFileSync(process.argv[1],'utf8'))[process.argv[2]];if(e!==undefined){if(n===1)console.log(JSON.stringify(e))}}catch{}",
100
100
  "${CLAUDE_PROJECT_DIR}/.agents/rules/reminders.json",
101
101
  "grilling-design-artifact"
102
102
  ]
@@ -112,7 +112,7 @@
112
112
  "command": "node",
113
113
  "args": [
114
114
  "-e",
115
- "try{const f=require('fs');let i={};try{i=JSON.parse(f.readFileSync(0,'utf8'))||{}}catch{}let n=1;if(typeof i.session_id==='string'){try{const t=require('path').join(require('os').tmpdir(),['qfai-reminder',i.session_id,i.agent_id||'main',process.argv[2]].join('-').replace(/[^\\w.-]/g,'_'));f.appendFileSync(t,'.');n=f.statSync(t).size}catch{}}const e=JSON.parse(f.readFileSync(process.argv[1],'utf8'))[process.argv[2]];if(e!==undefined){const {briefContext,...m}=e;if(n>1&&typeof briefContext==='string')m.hookSpecificOutput.additionalContext=briefContext;console.log(JSON.stringify(m))}}catch{}",
115
+ "try{const f=require('fs');let i={};try{i=JSON.parse(f.readFileSync(0,'utf8'))||{}}catch{}let n=1;if(typeof i.session_id==='string'){const t=require('path').join(require('os').tmpdir(),['qfai-reminder',i.session_id,i.agent_id||'main',process.argv[2]].join('-').replace(/[^\\w.-]/g,'_'));try{f.writeFileSync(t,'',{flag:'wx'})}catch(q){try{if(q.code==='EEXIST'&&f.statSync(t).isFile())n=2}catch{}}}const e=JSON.parse(f.readFileSync(process.argv[1],'utf8'))[process.argv[2]];if(e!==undefined){if(n===1)console.log(JSON.stringify(e))}}catch{}",
116
116
  "${CLAUDE_PROJECT_DIR}/.agents/rules/reminders.json",
117
117
  "grilling-delegation"
118
118
  ]
@@ -128,7 +128,7 @@
128
128
  "command": "node",
129
129
  "args": [
130
130
  "-e",
131
- "try{const f=require('fs');let i={};try{i=JSON.parse(f.readFileSync(0,'utf8'))||{}}catch{}let n=1;if(typeof i.session_id==='string'){try{const t=require('path').join(require('os').tmpdir(),['qfai-reminder',i.session_id,i.agent_id||'main',process.argv[2]].join('-').replace(/[^\\w.-]/g,'_'));f.appendFileSync(t,'.');n=f.statSync(t).size}catch{}}const e=JSON.parse(f.readFileSync(process.argv[1],'utf8'))[process.argv[2]];if(e!==undefined){const {briefContext,...m}=e;if(n>1&&typeof briefContext==='string')m.hookSpecificOutput.additionalContext=briefContext;console.log(JSON.stringify(m))}}catch{}",
131
+ "try{const f=require('fs');let i={};try{i=JSON.parse(f.readFileSync(0,'utf8'))||{}}catch{}let n=1;if(typeof i.session_id==='string'){const t=require('path').join(require('os').tmpdir(),['qfai-reminder',i.session_id,i.agent_id||'main',process.argv[2]].join('-').replace(/[^\\w.-]/g,'_'));try{f.writeFileSync(t,'',{flag:'wx'})}catch(q){try{if(q.code==='EEXIST'&&f.statSync(t).isFile())n=2}catch{}}}const e=JSON.parse(f.readFileSync(process.argv[1],'utf8'))[process.argv[2]];if(e!==undefined){if(n===1)console.log(JSON.stringify(e))}}catch{}",
132
132
  "${CLAUDE_PROJECT_DIR}/.agents/rules/reminders.json",
133
133
  "grilling-plan"
134
134
  ]
@@ -136,7 +136,7 @@
136
136
  ]
137
137
  },
138
138
  {
139
- "matcher": "Bash",
139
+ "matcher": "Bash|PowerShell",
140
140
  "hooks": [
141
141
  {
142
142
  "type": "command",
@@ -144,7 +144,7 @@
144
144
  "command": "node",
145
145
  "args": [
146
146
  "-e",
147
- "try{const f=require('fs');let i={};try{i=JSON.parse(f.readFileSync(0,'utf8'))||{}}catch{}const c=i.tool_input&&i.tool_input.command;if(typeof c==='string'&&/(^|[^\\w.-])gh([^\\w.-]|$)|api\\.github\\.com/.test(c)){let n=1;if(typeof i.session_id==='string'){try{const t=require('path').join(require('os').tmpdir(),['qfai-reminder',i.session_id,i.agent_id||'main',process.argv[2]].join('-').replace(/[^\\w.-]/g,'_'));f.appendFileSync(t,'.');n=f.statSync(t).size}catch{}}const e=JSON.parse(f.readFileSync(process.argv[1],'utf8'))[process.argv[2]];if(e!==undefined){const {briefContext,...m}=e;if(n>1&&typeof briefContext==='string')m.hookSpecificOutput.additionalContext=briefContext;console.log(JSON.stringify(m))}}}catch{}",
147
+ "try{const f=require('fs');let i={};try{i=JSON.parse(f.readFileSync(0,'utf8'))||{}}catch{}const c=i.tool_input&&i.tool_input.command;if(typeof c==='string'&&/(^|[^\\w.-])(gh|curl|wget|iwr|irm|invoke-webrequest|invoke-restmethod)(\\.exe)?([^\\w.-]|$)|api\\.github\\.com/i.test(c)){let n=1;if(typeof i.session_id==='string'){const t=require('path').join(require('os').tmpdir(),['qfai-reminder',i.session_id,i.agent_id||'main',process.argv[2]].join('-').replace(/[^\\w.-]/g,'_'));try{f.writeFileSync(t,'',{flag:'wx'})}catch(q){try{if(q.code==='EEXIST'&&f.statSync(t).isFile())n=2}catch{}}}const e=JSON.parse(f.readFileSync(process.argv[1],'utf8'))[process.argv[2]];if(e!==undefined){if(n===1)console.log(JSON.stringify(e))}}}catch{}",
148
148
  "${CLAUDE_PROJECT_DIR}/.agents/rules/reminders.json",
149
149
  "api-budget"
150
150
  ]
@@ -163,7 +163,7 @@
163
163
  "command": "node",
164
164
  "args": [
165
165
  "-e",
166
- "try{const f=require('fs');let i={};try{i=JSON.parse(f.readFileSync(0,'utf8'))}catch{}let n=1;if(typeof i.session_id==='string'){try{const t=require('path').join(require('os').tmpdir(),['qfai-reminder',i.session_id,i.agent_id||'main',process.argv[2]].join('-').replace(/[^\\w.-]/g,'_'));f.appendFileSync(t,'.');n=f.statSync(t).size}catch{}}const e=JSON.parse(f.readFileSync(process.argv[1],'utf8'))[process.argv[2]];if(e!==undefined){const {briefContext,...m}=e;if(n>1&&typeof briefContext==='string')m.hookSpecificOutput.additionalContext=briefContext;console.log(JSON.stringify(m))}}catch{}",
166
+ "try{const f=require('fs');let i={};try{i=JSON.parse(f.readFileSync(0,'utf8'))}catch{}let n=1;if(typeof i.session_id==='string'){const t=require('path').join(require('os').tmpdir(),['qfai-reminder',i.session_id,i.agent_id||'main',process.argv[2]].join('-').replace(/[^\\w.-]/g,'_'));try{f.writeFileSync(t,'',{flag:'wx'})}catch(q){try{if(q.code==='EEXIST'&&f.statSync(t).isFile())n=2}catch{}}}const e=JSON.parse(f.readFileSync(process.argv[1],'utf8'))[process.argv[2]];if(e!==undefined){if(n===1)console.log(JSON.stringify(e))}}catch{}",
167
167
  "${CLAUDE_PROJECT_DIR}/.agents/rules/reminders.json",
168
168
  "documentation-clarity-after-write"
169
169
  ]
@@ -175,7 +175,7 @@
175
175
  "command": "node",
176
176
  "args": [
177
177
  "-e",
178
- "try{const f=require('fs');let i={};try{i=JSON.parse(f.readFileSync(0,'utf8'))}catch{}let n=1;if(typeof i.session_id==='string'){try{const t=require('path').join(require('os').tmpdir(),['qfai-reminder',i.session_id,i.agent_id||'main',process.argv[2]].join('-').replace(/[^\\w.-]/g,'_'));f.appendFileSync(t,'.');n=f.statSync(t).size}catch{}}const e=JSON.parse(f.readFileSync(process.argv[1],'utf8'))[process.argv[2]];if(e!==undefined){const {briefContext,...m}=e;if(n>1&&typeof briefContext==='string')m.hookSpecificOutput.additionalContext=briefContext;console.log(JSON.stringify(m))}}catch{}",
178
+ "try{const f=require('fs');let i={};try{i=JSON.parse(f.readFileSync(0,'utf8'))}catch{}let n=1;if(typeof i.session_id==='string'){const t=require('path').join(require('os').tmpdir(),['qfai-reminder',i.session_id,i.agent_id||'main',process.argv[2]].join('-').replace(/[^\\w.-]/g,'_'));try{f.writeFileSync(t,'',{flag:'wx'})}catch(q){try{if(q.code==='EEXIST'&&f.statSync(t).isFile())n=2}catch{}}}const e=JSON.parse(f.readFileSync(process.argv[1],'utf8'))[process.argv[2]];if(e!==undefined){if(n===1)console.log(JSON.stringify(e))}}catch{}",
179
179
  "${CLAUDE_PROJECT_DIR}/.agents/rules/reminders.json",
180
180
  "documentation-clarity-after-edit"
181
181
  ]
@@ -191,7 +191,7 @@
191
191
  "command": "node",
192
192
  "args": [
193
193
  "-e",
194
- "try{const f=require('fs'),p=require('path'),R=p.dirname(p.dirname(p.dirname(process.argv[1])));let i={};try{i=JSON.parse(f.readFileSync(0,'utf8'))}catch{}const u=i.tool_input&&i.tool_input.file_path;let src=true;if(typeof u==='string'&&(x=>{const s=x.split(p.sep),b=s.pop();return p.isAbsolute(x)||s[0]==='..'||s.some(y=>['tmp','test','tests','__tests__','node_modules','.qfai','.agents'].includes(y))||b[0]==='.'||/\\.(test|spec)\\./.test(b)||['.md','.mdx','.markdown','.txt','.rst','.yml','.yaml','.json','.jsonc','.json5','.toml','.ini','.csv','.tsv','.lock','.svg','.png','.jpg','.jpeg','.gif'].includes(p.extname(b).toLowerCase())})(p.relative(R,p.resolve(R,u))))src=false;if(src){let n=1;if(typeof i.session_id==='string'){try{const t=require('path').join(require('os').tmpdir(),['qfai-reminder',i.session_id,i.agent_id||'main',process.argv[2]].join('-').replace(/[^\\w.-]/g,'_'));f.appendFileSync(t,'.');n=f.statSync(t).size}catch{}}const e=JSON.parse(f.readFileSync(process.argv[1],'utf8'))[process.argv[2]];if(e!==undefined){const {briefContext,...m}=e;if(n>1&&typeof briefContext==='string')m.hookSpecificOutput.additionalContext=briefContext;console.log(JSON.stringify(m))}}}catch{}",
194
+ "try{const f=require('fs'),p=require('path'),R=p.dirname(p.dirname(p.dirname(process.argv[1])));let i={};try{i=JSON.parse(f.readFileSync(0,'utf8'))}catch{}const u=i.tool_input&&i.tool_input.file_path;let src=true;if(typeof u==='string'&&(x=>{const s=x.split(p.sep),b=s.pop();return p.isAbsolute(x)||s[0]==='..'||s.some(y=>['tmp','test','tests','__tests__','node_modules','.qfai','.agents'].includes(y))||b[0]==='.'||/\\.(test|spec)\\./.test(b)||['.md','.mdx','.markdown','.txt','.rst','.yml','.yaml','.json','.jsonc','.json5','.toml','.ini','.csv','.tsv','.lock','.svg','.png','.jpg','.jpeg','.gif'].includes(p.extname(b).toLowerCase())})(p.relative(R,p.resolve(R,u))))src=false;if(src){let n=1;if(typeof i.session_id==='string'){const t=require('path').join(require('os').tmpdir(),['qfai-reminder',i.session_id,i.agent_id||'main',process.argv[2]].join('-').replace(/[^\\w.-]/g,'_'));try{f.writeFileSync(t,'',{flag:'wx'})}catch(q){try{if(q.code==='EEXIST'&&f.statSync(t).isFile())n=2}catch{}}}const e=JSON.parse(f.readFileSync(process.argv[1],'utf8'))[process.argv[2]];if(e!==undefined){if(n===1)console.log(JSON.stringify(e))}}}catch{}",
195
195
  "${CLAUDE_PROJECT_DIR}/.agents/rules/reminders.json",
196
196
  "minimal-implementation"
197
197
  ]
@@ -6,7 +6,7 @@
6
6
  {
7
7
  "type": "command",
8
8
  "statusMessage": "QFAI structured-question reminder",
9
- "command": "node -e \"try{const f=require('fs'),p=require('path');let d=process.cwd(),r;for(;;){const c=p.join(d,'.agents','rules','reminders.json');if(r===undefined&&f.existsSync(c))r=c;if(f.existsSync(p.join(d,'.git')))break;const u=p.dirname(d);if(u===d){r=undefined;break}d=u}if(r){let j={};try{j=JSON.parse(f.readFileSync(0,'utf8'))||{}}catch{}let n=1;if(typeof j.session_id==='string'){try{const t=p.join(require('os').tmpdir(),['qfai-reminder',j.session_id,j.agent_id||'main',process.argv[1]].join('-').replace(/[^\\w.-]/g,'_'));f.appendFileSync(t,'.');n=f.statSync(t).size}catch{}}const e=JSON.parse(f.readFileSync(r,'utf8'))[process.argv[1]];if(e===undefined){}else{const {briefContext,...m}=e;if(n>1&&typeof briefContext==='string')m.hookSpecificOutput.additionalContext=briefContext;console.log(JSON.stringify(m))}}}catch{}\" structured-question",
9
+ "command": "node -e \"try{const f=require('fs'),p=require('path');let d=process.cwd(),r;for(;;){const c=p.join(d,'.agents','rules','reminders.json');if(r===undefined&&f.existsSync(c))r=c;if(f.existsSync(p.join(d,'.git')))break;const u=p.dirname(d);if(u===d){r=undefined;break}d=u}if(r){let j={};try{j=JSON.parse(f.readFileSync(0,'utf8'))||{}}catch{}let n=1;if(typeof j.session_id==='string'){const t=p.join(require('os').tmpdir(),['qfai-reminder',j.session_id,j.agent_id||'main',process.argv[1]].join('-').replace(/[^\\w.-]/g,'_'));try{f.writeFileSync(t,'',{flag:'wx'})}catch(q){try{if(q.code==='EEXIST'&&f.statSync(t).isFile())n=2}catch{}}}const e=JSON.parse(f.readFileSync(r,'utf8'))[process.argv[1]];if(e===undefined){}else{if(n===1)console.log(JSON.stringify(e))}}}catch{}\" structured-question",
10
10
  "timeout": 10
11
11
  }
12
12
  ]
@@ -16,7 +16,7 @@
16
16
  {
17
17
  "type": "command",
18
18
  "statusMessage": "QFAI free-text entry reminder",
19
- "command": "node -e \"try{const f=require('fs'),p=require('path');let d=process.cwd(),r;for(;;){const c=p.join(d,'.agents','rules','reminders.json');if(r===undefined&&f.existsSync(c))r=c;if(f.existsSync(p.join(d,'.git')))break;const u=p.dirname(d);if(u===d){r=undefined;break}d=u}if(r){let j={};try{j=JSON.parse(f.readFileSync(0,'utf8'))||{}}catch{}let n=1;if(typeof j.session_id==='string'){try{const t=p.join(require('os').tmpdir(),['qfai-reminder',j.session_id,j.agent_id||'main',process.argv[1]].join('-').replace(/[^\\w.-]/g,'_'));f.appendFileSync(t,'.');n=f.statSync(t).size}catch{}}const e=JSON.parse(f.readFileSync(r,'utf8'))[process.argv[1]];if(e===undefined){}else{const {briefContext,...m}=e;if(n>1&&typeof briefContext==='string')m.hookSpecificOutput.additionalContext=briefContext;console.log(JSON.stringify(m))}}}catch{}\" free-text-entry",
19
+ "command": "node -e \"try{const f=require('fs'),p=require('path');let d=process.cwd(),r;for(;;){const c=p.join(d,'.agents','rules','reminders.json');if(r===undefined&&f.existsSync(c))r=c;if(f.existsSync(p.join(d,'.git')))break;const u=p.dirname(d);if(u===d){r=undefined;break}d=u}if(r){let j={};try{j=JSON.parse(f.readFileSync(0,'utf8'))||{}}catch{}let n=1;if(typeof j.session_id==='string'){const t=p.join(require('os').tmpdir(),['qfai-reminder',j.session_id,j.agent_id||'main',process.argv[1]].join('-').replace(/[^\\w.-]/g,'_'));try{f.writeFileSync(t,'',{flag:'wx'})}catch(q){try{if(q.code==='EEXIST'&&f.statSync(t).isFile())n=2}catch{}}}const e=JSON.parse(f.readFileSync(r,'utf8'))[process.argv[1]];if(e===undefined){}else{const {briefContext,...m}=e;if(n>1&&typeof briefContext==='string')m.hookSpecificOutput.additionalContext=briefContext;console.log(JSON.stringify(m))}}}catch{}\" free-text-entry",
20
20
  "timeout": 10
21
21
  }
22
22
  ]
@@ -39,7 +39,7 @@
39
39
  {
40
40
  "type": "command",
41
41
  "statusMessage": "QFAI documentation-clarity reminder",
42
- "command": "node -e \"try{const f=require('fs'),p=require('path');let d=process.cwd(),r;for(;;){const c=p.join(d,'.agents','rules','reminders.json');if(r===undefined&&f.existsSync(c))r=c;if(f.existsSync(p.join(d,'.git')))break;const u=p.dirname(d);if(u===d){r=undefined;break}d=u}if(r){const m=JSON.parse(f.readFileSync(r,'utf8'))[process.argv[1]];m===undefined||console.log(JSON.stringify(m))}}catch{}\" documentation-clarity-before-post",
42
+ "command": "node -e \"try{const f=require('fs'),p=require('path');let d=process.cwd(),r;for(;;){const c=p.join(d,'.agents','rules','reminders.json');if(r===undefined&&f.existsSync(c))r=c;if(f.existsSync(p.join(d,'.git')))break;const u=p.dirname(d);if(u===d){r=undefined;break}d=u}if(r){let j={};try{j=JSON.parse(f.readFileSync(0,'utf8'))||{}}catch{}let n=1;if(typeof j.session_id==='string'){const t=p.join(require('os').tmpdir(),['qfai-reminder',j.session_id,j.agent_id||'main',process.argv[1]].join('-').replace(/[^\\w.-]/g,'_'));try{f.writeFileSync(t,'',{flag:'wx'})}catch(q){try{if(q.code==='EEXIST'&&f.statSync(t).isFile())n=2}catch{}}}const e=JSON.parse(f.readFileSync(r,'utf8'))[process.argv[1]];if(e===undefined){}else{if(n===1)console.log(JSON.stringify(e))}}}catch{}\" documentation-clarity-before-post",
43
43
  "timeout": 10
44
44
  }
45
45
  ]
@@ -50,7 +50,7 @@
50
50
  {
51
51
  "type": "command",
52
52
  "statusMessage": "QFAI grilling reminder: design artifact",
53
- "command": "node -e \"try{const f=require('fs'),p=require('path');let d=process.cwd(),r;for(;;){const c=p.join(d,'.agents','rules','reminders.json');if(r===undefined&&f.existsSync(c))r=c;if(f.existsSync(p.join(d,'.git')))break;const u=p.dirname(d);if(u===d){r=undefined;break}d=u}if(r){let j={};try{j=JSON.parse(f.readFileSync(0,'utf8'))||{}}catch{}let n=1;if(typeof j.session_id==='string'){try{const t=p.join(require('os').tmpdir(),['qfai-reminder',j.session_id,j.agent_id||'main',process.argv[1]].join('-').replace(/[^\\w.-]/g,'_'));f.appendFileSync(t,'.');n=f.statSync(t).size}catch{}}const e=JSON.parse(f.readFileSync(r,'utf8'))[process.argv[1]];if(e===undefined){}else{const {briefContext,...m}=e;if(n>1&&typeof briefContext==='string')m.hookSpecificOutput.additionalContext=briefContext;console.log(JSON.stringify(m))}}}catch{}\" grilling-design-artifact",
53
+ "command": "node -e \"try{const f=require('fs'),p=require('path');let d=process.cwd(),r;for(;;){const c=p.join(d,'.agents','rules','reminders.json');if(r===undefined&&f.existsSync(c))r=c;if(f.existsSync(p.join(d,'.git')))break;const u=p.dirname(d);if(u===d){r=undefined;break}d=u}if(r){let j={};try{j=JSON.parse(f.readFileSync(0,'utf8'))||{}}catch{}let n=1;if(typeof j.session_id==='string'){const t=p.join(require('os').tmpdir(),['qfai-reminder',j.session_id,j.agent_id||'main',process.argv[1]].join('-').replace(/[^\\w.-]/g,'_'));try{f.writeFileSync(t,'',{flag:'wx'})}catch(q){try{if(q.code==='EEXIST'&&f.statSync(t).isFile())n=2}catch{}}}const e=JSON.parse(f.readFileSync(r,'utf8'))[process.argv[1]];if(e===undefined){}else{if(n===1)console.log(JSON.stringify(e))}}}catch{}\" grilling-design-artifact",
54
54
  "timeout": 10
55
55
  }
56
56
  ]
@@ -61,7 +61,7 @@
61
61
  {
62
62
  "type": "command",
63
63
  "statusMessage": "QFAI grilling reminder: delegation",
64
- "command": "node -e \"try{const f=require('fs'),p=require('path');let d=process.cwd(),r;for(;;){const c=p.join(d,'.agents','rules','reminders.json');if(r===undefined&&f.existsSync(c))r=c;if(f.existsSync(p.join(d,'.git')))break;const u=p.dirname(d);if(u===d){r=undefined;break}d=u}if(r){let j={};try{j=JSON.parse(f.readFileSync(0,'utf8'))||{}}catch{}let n=1;if(typeof j.session_id==='string'){try{const t=p.join(require('os').tmpdir(),['qfai-reminder',j.session_id,j.agent_id||'main',process.argv[1]].join('-').replace(/[^\\w.-]/g,'_'));f.appendFileSync(t,'.');n=f.statSync(t).size}catch{}}const e=JSON.parse(f.readFileSync(r,'utf8'))[process.argv[1]];if(e===undefined){}else{const {briefContext,...m}=e;if(n>1&&typeof briefContext==='string')m.hookSpecificOutput.additionalContext=briefContext;console.log(JSON.stringify(m))}}}catch{}\" grilling-delegation",
64
+ "command": "node -e \"try{const f=require('fs'),p=require('path');let d=process.cwd(),r;for(;;){const c=p.join(d,'.agents','rules','reminders.json');if(r===undefined&&f.existsSync(c))r=c;if(f.existsSync(p.join(d,'.git')))break;const u=p.dirname(d);if(u===d){r=undefined;break}d=u}if(r){let j={};try{j=JSON.parse(f.readFileSync(0,'utf8'))||{}}catch{}let n=1;if(typeof j.session_id==='string'){const t=p.join(require('os').tmpdir(),['qfai-reminder',j.session_id,j.agent_id||'main',process.argv[1]].join('-').replace(/[^\\w.-]/g,'_'));try{f.writeFileSync(t,'',{flag:'wx'})}catch(q){try{if(q.code==='EEXIST'&&f.statSync(t).isFile())n=2}catch{}}}const e=JSON.parse(f.readFileSync(r,'utf8'))[process.argv[1]];if(e===undefined){}else{if(n===1)console.log(JSON.stringify(e))}}}catch{}\" grilling-delegation",
65
65
  "timeout": 10
66
66
  }
67
67
  ]
@@ -72,7 +72,7 @@
72
72
  {
73
73
  "type": "command",
74
74
  "statusMessage": "QFAI api-budget reminder",
75
- "command": "node -e \"try{const j=JSON.parse(require('fs').readFileSync(0,'utf8')),i=j.tool_input.command;if(typeof i==='string'&&/[^\\w.-]gh[^\\w.-]|api\\.github\\.com/.test(' '+i+' ')){const f=require('fs'),p=require('path');let d=process.cwd(),r;for(;;){const c=p.join(d,'.agents','rules','reminders.json');if(r===undefined&&f.existsSync(c))r=c;if(f.existsSync(p.join(d,'.git')))break;const u=p.dirname(d);if(u===d){r=undefined;break}d=u}if(r){let n=1;if(typeof j.session_id==='string'){try{const t=p.join(require('os').tmpdir(),['qfai-reminder',j.session_id,j.agent_id||'main',process.argv[1]].join('-').replace(/[^\\w.-]/g,'_'));f.appendFileSync(t,'.');n=f.statSync(t).size}catch{}}const e=JSON.parse(f.readFileSync(r,'utf8'))[process.argv[1]];if(e===undefined){}else{const {briefContext,...m}=e;if(n>1&&typeof briefContext==='string')m.hookSpecificOutput.additionalContext=briefContext;console.log(JSON.stringify(m))}}}}catch{}\" api-budget",
75
+ "command": "node -e \"try{const j=JSON.parse(require('fs').readFileSync(0,'utf8')),i=j.tool_input.command;if(typeof i==='string'&&/[^\\w.-](gh|curl|wget|iwr|irm|invoke-webrequest|invoke-restmethod)(\\.exe)?[^\\w.-]|api\\.github\\.com/i.test(' '+i+' ')){const f=require('fs'),p=require('path');let d=process.cwd(),r;for(;;){const c=p.join(d,'.agents','rules','reminders.json');if(r===undefined&&f.existsSync(c))r=c;if(f.existsSync(p.join(d,'.git')))break;const u=p.dirname(d);if(u===d){r=undefined;break}d=u}if(r){let n=1;if(typeof j.session_id==='string'){const t=p.join(require('os').tmpdir(),['qfai-reminder',j.session_id,j.agent_id||'main',process.argv[1]].join('-').replace(/[^\\w.-]/g,'_'));try{f.writeFileSync(t,'',{flag:'wx'})}catch(q){try{if(q.code==='EEXIST'&&f.statSync(t).isFile())n=2}catch{}}}const e=JSON.parse(f.readFileSync(r,'utf8'))[process.argv[1]];if(e===undefined){}else{if(n===1)console.log(JSON.stringify(e))}}}}catch{}\" api-budget",
76
76
  "timeout": 10
77
77
  }
78
78
  ]
@@ -85,13 +85,13 @@
85
85
  {
86
86
  "type": "command",
87
87
  "statusMessage": "QFAI documentation-clarity reminder",
88
- "command": "node -e \"try{const j=JSON.parse(require('fs').readFileSync(0,'utf8')),i=j.tool_input.command;if(typeof i==='string'&&/^\\*\\*\\* Add File: .*\\.md\\r?\\n/m.test(i)){const f=require('fs'),p=require('path');let d=process.cwd(),r;for(;;){const c=p.join(d,'.agents','rules','reminders.json');if(r===undefined&&f.existsSync(c))r=c;if(f.existsSync(p.join(d,'.git')))break;const u=p.dirname(d);if(u===d){r=undefined;break}d=u}if(r){let n=1;if(typeof j.session_id==='string'){try{const t=p.join(require('os').tmpdir(),['qfai-reminder',j.session_id,j.agent_id||'main',process.argv[1]].join('-').replace(/[^\\w.-]/g,'_'));f.appendFileSync(t,'.');n=f.statSync(t).size}catch{}}const e=JSON.parse(f.readFileSync(r,'utf8'))[process.argv[1]];if(e===undefined){}else{const {briefContext,...m}=e;if(n>1&&typeof briefContext==='string')m.hookSpecificOutput.additionalContext=briefContext;console.log(JSON.stringify(m))}}}}catch{}\" documentation-clarity-after-write",
88
+ "command": "node -e \"try{const j=JSON.parse(require('fs').readFileSync(0,'utf8')),i=j.tool_input.command;if(typeof i==='string'&&/^\\*\\*\\* Add File: .*\\.md\\r?\\n/m.test(i)){const f=require('fs'),p=require('path');let d=process.cwd(),r;for(;;){const c=p.join(d,'.agents','rules','reminders.json');if(r===undefined&&f.existsSync(c))r=c;if(f.existsSync(p.join(d,'.git')))break;const u=p.dirname(d);if(u===d){r=undefined;break}d=u}if(r){let n=1;if(typeof j.session_id==='string'){const t=p.join(require('os').tmpdir(),['qfai-reminder',j.session_id,j.agent_id||'main',process.argv[1]].join('-').replace(/[^\\w.-]/g,'_'));try{f.writeFileSync(t,'',{flag:'wx'})}catch(q){try{if(q.code==='EEXIST'&&f.statSync(t).isFile())n=2}catch{}}}const e=JSON.parse(f.readFileSync(r,'utf8'))[process.argv[1]];if(e===undefined){}else{if(n===1)console.log(JSON.stringify(e))}}}}catch{}\" documentation-clarity-after-write",
89
89
  "timeout": 10
90
90
  },
91
91
  {
92
92
  "type": "command",
93
93
  "statusMessage": "QFAI documentation-clarity reminder",
94
- "command": "node -e \"try{const j=JSON.parse(require('fs').readFileSync(0,'utf8')),i=j.tool_input.command;if(typeof i==='string'&&/^\\*\\*\\* Update File: .*\\.md\\r?\\n/m.test(i)){const f=require('fs'),p=require('path');let d=process.cwd(),r;for(;;){const c=p.join(d,'.agents','rules','reminders.json');if(r===undefined&&f.existsSync(c))r=c;if(f.existsSync(p.join(d,'.git')))break;const u=p.dirname(d);if(u===d){r=undefined;break}d=u}if(r){let n=1;if(typeof j.session_id==='string'){try{const t=p.join(require('os').tmpdir(),['qfai-reminder',j.session_id,j.agent_id||'main',process.argv[1]].join('-').replace(/[^\\w.-]/g,'_'));f.appendFileSync(t,'.');n=f.statSync(t).size}catch{}}const e=JSON.parse(f.readFileSync(r,'utf8'))[process.argv[1]];if(e===undefined){}else{const {briefContext,...m}=e;if(n>1&&typeof briefContext==='string')m.hookSpecificOutput.additionalContext=briefContext;console.log(JSON.stringify(m))}}}}catch{}\" documentation-clarity-after-edit",
94
+ "command": "node -e \"try{const j=JSON.parse(require('fs').readFileSync(0,'utf8')),i=j.tool_input.command;if(typeof i==='string'&&/^\\*\\*\\* Update File: .*\\.md\\r?\\n/m.test(i)){const f=require('fs'),p=require('path');let d=process.cwd(),r;for(;;){const c=p.join(d,'.agents','rules','reminders.json');if(r===undefined&&f.existsSync(c))r=c;if(f.existsSync(p.join(d,'.git')))break;const u=p.dirname(d);if(u===d){r=undefined;break}d=u}if(r){let n=1;if(typeof j.session_id==='string'){const t=p.join(require('os').tmpdir(),['qfai-reminder',j.session_id,j.agent_id||'main',process.argv[1]].join('-').replace(/[^\\w.-]/g,'_'));try{f.writeFileSync(t,'',{flag:'wx'})}catch(q){try{if(q.code==='EEXIST'&&f.statSync(t).isFile())n=2}catch{}}}const e=JSON.parse(f.readFileSync(r,'utf8'))[process.argv[1]];if(e===undefined){}else{if(n===1)console.log(JSON.stringify(e))}}}}catch{}\" documentation-clarity-after-edit",
95
95
  "timeout": 10
96
96
  }
97
97
  ]
@@ -102,7 +102,7 @@
102
102
  {
103
103
  "type": "command",
104
104
  "statusMessage": "QFAI minimal-implementation reminder",
105
- "command": "node -e \"try{const f=require('fs'),p=require('path');let d=process.cwd(),r;for(;;){const c=p.join(d,'.agents','rules','reminders.json');if(r===undefined&&f.existsSync(c))r=c;if(f.existsSync(p.join(d,'.git')))break;const u=p.dirname(d);if(u===d){r=undefined;break}d=u}if(r){let go=true,j={};try{j=JSON.parse(f.readFileSync(0,'utf8'))}catch{}try{const R=p.dirname(p.dirname(p.dirname(r))),n=(x=>{const s=x.split(p.sep),b=s.pop();return p.isAbsolute(x)||s[0]==='..'||s.some(y=>['tmp','test','tests','__tests__','node_modules','.qfai','.agents'].includes(y))||b[0]==='.'||/\\.(test|spec)\\./.test(b)||['.md','.mdx','.markdown','.txt','.rst','.yml','.yaml','.json','.jsonc','.json5','.toml','.ini','.csv','.tsv','.lock','.svg','.png','.jpg','.jpeg','.gif'].includes(p.extname(b).toLowerCase())}),a=[...j.tool_input.command.matchAll(/^\\*\\*\\* (?:(?:Add|Update|Delete) File|Move to): (.+)/gm)].map(m=>p.relative(R,p.resolve(process.cwd(),m[1].trim())));if(a.length>0&&a.every(n))go=false}catch{}if(go){let n=1;if(typeof j.session_id==='string'){try{const t=p.join(require('os').tmpdir(),['qfai-reminder',j.session_id,j.agent_id||'main',process.argv[1]].join('-').replace(/[^\\w.-]/g,'_'));f.appendFileSync(t,'.');n=f.statSync(t).size}catch{}}const e=JSON.parse(f.readFileSync(r,'utf8'))[process.argv[1]];if(e===undefined){}else{const {briefContext,...m}=e;if(n>1&&typeof briefContext==='string')m.hookSpecificOutput.additionalContext=briefContext;console.log(JSON.stringify(m))}}}}catch{}\" minimal-implementation",
105
+ "command": "node -e \"try{const f=require('fs'),p=require('path');let d=process.cwd(),r;for(;;){const c=p.join(d,'.agents','rules','reminders.json');if(r===undefined&&f.existsSync(c))r=c;if(f.existsSync(p.join(d,'.git')))break;const u=p.dirname(d);if(u===d){r=undefined;break}d=u}if(r){let go=true,j={};try{j=JSON.parse(f.readFileSync(0,'utf8'))}catch{}try{const R=p.dirname(p.dirname(p.dirname(r))),n=(x=>{const s=x.split(p.sep),b=s.pop();return p.isAbsolute(x)||s[0]==='..'||s.some(y=>['tmp','test','tests','__tests__','node_modules','.qfai','.agents'].includes(y))||b[0]==='.'||/\\.(test|spec)\\./.test(b)||['.md','.mdx','.markdown','.txt','.rst','.yml','.yaml','.json','.jsonc','.json5','.toml','.ini','.csv','.tsv','.lock','.svg','.png','.jpg','.jpeg','.gif'].includes(p.extname(b).toLowerCase())}),a=[...j.tool_input.command.matchAll(/^\\*\\*\\* (?:(?:Add|Update|Delete) File|Move to): (.+)/gm)].map(m=>p.relative(R,p.resolve(process.cwd(),m[1].trim())));if(a.length>0&&a.every(n))go=false}catch{}if(go){let n=1;if(typeof j.session_id==='string'){const t=p.join(require('os').tmpdir(),['qfai-reminder',j.session_id,j.agent_id||'main',process.argv[1]].join('-').replace(/[^\\w.-]/g,'_'));try{f.writeFileSync(t,'',{flag:'wx'})}catch(q){try{if(q.code==='EEXIST'&&f.statSync(t).isFile())n=2}catch{}}}const e=JSON.parse(f.readFileSync(r,'utf8'))[process.argv[1]];if(e===undefined){}else{if(n===1)console.log(JSON.stringify(e))}}}}catch{}\" minimal-implementation",
106
106
  "timeout": 10
107
107
  }
108
108
  ]
@@ -63,7 +63,7 @@ specialization_tags:
63
63
  - Backend implementation summary
64
64
  - Changed files and affected contracts
65
65
  - Local verification notes
66
- - Test path, selector, observed RED/GREEN/Refactor results and changed files, in the stage report
66
+ - Test path, selector, observed RED/GREEN/Refactor results (or `ci-deferred`) and changed files, in the stage report
67
67
  - Notes on invariants, validation, and why added abstractions/configuration are necessary now
68
68
 
69
69
  ## Stop conditions
@@ -67,7 +67,7 @@ specialization_tags:
67
67
  - Frontend implementation summary
68
68
  - Changed files and affected flows
69
69
  - Local verification notes
70
- - Test path, selector, observed RED/GREEN/Refactor results and changed files, in the stage report
70
+ - Test path, selector, observed RED/GREEN/Refactor results (or `ci-deferred`) and changed files, in the stage report
71
71
  - Notes on how simplicity, necessity, and reuse were preserved in the chosen implementation
72
72
 
73
73
  ## Stop conditions
@@ -60,6 +60,9 @@ specialization_tags:
60
60
  This is the one reach beyond the touched files, and it covers only the inputs the change handles.
61
61
  A security finding the review demonstrates traces to `defect:security`.
62
62
  - Check the EX test's oracle, selector and RED/GREEN/Refactor evidence.
63
+ - When the change adds, moves or copies an AC or EX annotation, read the annotated test's body and confirm that it asserts the example's observable outcome,
64
+ or for an AC annotation that it asserts the criterion.
65
+ An annotation on a test that checks something else is a finding and traces to `defect:correctness`.
63
66
  - Check for code written only to pass a test: no value hard-coded to the test's
64
67
  inputs and no branch written only for the test, and a wrong test or infeasible
65
68
  task raised as a Change Request, not worked around
@@ -74,6 +77,8 @@ specialization_tags:
74
77
  - `<paths.specsDir>/03_contract/tech.md`, plus the active API, DB or UI contracts this change affects.
75
78
  - The changed code and tests, their diff, repository review instructions, and actual quality-gate results.
76
79
  - The stage report for the reviewed EX: its test, selector and observed results. A missing required observation prevents PASS.
80
+ A `ci-deferred` Red or Green is not a missing observation: read the test against the code before the fix instead,
81
+ as `.qfai/assistant/skill/qfai-implement/references/red-admissibility.md#ci-only-test-gate` states.
77
82
 
78
83
  ## Deliverables
79
84
 
@@ -39,8 +39,11 @@ specialization_tags:
39
39
  - Audit visual design, token alignment, and service-level UX coherence.
40
40
  - Reconcile sidecar artifacts (screen contracts), design tokens, mermaid flows, and rendered output consistency.
41
41
  HTML mock is optional fallback evidence only. Design tokens are supporting input.
42
- - For UI implementation, compare rendered output against the prototype handoff, canonical prototype screenshots, HTML snapshots, and the final prototype the handoff's `finalArtifact` names (`.qfai/prototype/final/index.html`).
43
- - Check the implementation against the handoff's `procurement` before judging
42
+ - For UI implementation, compare rendered output against the prototype handoff, canonical prototype
43
+ screenshots, HTML snapshots, and the final prototype the handoff's `finalArtifact` names
44
+ (`.qfai/prototype/final/index.html`), or, for a `restyle` handoff, its `liveRoutes` (compare in
45
+ the running app) and `entryPoints`.
46
+ - Check the implementation against the handoff's `procurement` (a restyle handoff has none) before judging
44
47
  resemblance: a region the manifest says was procured and the code rebuilt is a finding
45
48
  with a name, and an authored region the manifest does not list is one too.
46
49
  - Reject prototype parity when implementation loses CTA hierarchy, spacing rhythm, information density,
@@ -81,7 +84,9 @@ specialization_tags:
81
84
  - UI contract files: every `.yaml` / `.yml` under `<paths.contractsDir>/ui/**`, walked recursively.
82
85
  `paths.contractsDir` comes from `qfai.config.yaml` (default `.qfai/spec/03_contract`).
83
86
  Read the same contracts that routed the review here (`skill/qfai-implement/references/ui-affecting.md`).
84
- - Prototype handoff at `.qfai/prototype/final/handoff.json` when a prototyping loop ran: the final prototype, `procurement` and implementation notes.
87
+ - Prototype handoff at `.qfai/prototype/final/handoff.json` when a prototyping loop ran: the final
88
+ prototype, `procurement` and implementation notes, or, for a `restyle` handoff, its `liveRoutes`
89
+ (compare in the running app) and `entryPoints`.
85
90
  Read it in the checkout that ran the loop.
86
91
  - Root `DESIGN.md` for the brand tokens.
87
92
  - Runtime screenshots / HTML evidence / relevant diffs
@@ -294,9 +294,11 @@ should exist is a Change Request.
294
294
 
295
295
  ### Prototyping exception (scope floor)
296
296
 
297
- For `/qfai-prototyping`, the minimum allowed scope includes every declared UI
298
- contract and screen in the configured story tree. Shrinking the loop to one
299
- contract is prohibited unless a documented Change Request approves it.
297
+ For `/qfai-prototyping`, the confirmed prototype in `.qfai/prototype/final/`
298
+ covers every declared UI contract and screen in the configured story tree.
299
+ Shrinking what it covers is prohibited unless a documented Change Request
300
+ approves it. A run scoped per `prototyping-grill` § Run scope rebuilds part of
301
+ a confirmed `final/` and merges it back, so it does not shrink the floor.
300
302
 
301
303
  ---
302
304
 
@@ -2,6 +2,24 @@
2
2
 
3
3
  This rule governs changes discovered after a specification or contract has been approved.
4
4
 
5
+ ## Decision-register pages
6
+
7
+ Listed decision pages and their root index are protected project artifacts.
8
+ Read pages in list order, followed by the root table, before interpreting a
9
+ request. A page preserves the same row identity and Status permissions as the
10
+ root. New rows are appended only to the root table. Missing, unsafe or unreadable
11
+ members stop permission decisions; a partial history grants no authority.
12
+
13
+ A historical DONE row is not permission to relocate the register again.
14
+ Physical relocation requires a separately adopted execution change request and
15
+ a reviewed raw-byte receipt for the exact source and target. Preserve every row
16
+ occurrence, cell, Status, order and line ending, plus the current root tail.
17
+ Relocation does not permit duplicate cleanup, Status repair or normalization of
18
+ inherited cells. Relocation changes physical home only; it neither adds nor removes
19
+ a logical row. A migration projection grants no write authority. Never rotate
20
+ automatically. Each physical file still meets the inclusive 500-line limit;
21
+ formatting exclusions preserve bytes and never waive schema or semantic checks.
22
+
5
23
  ## Core rule
6
24
 
7
25
  A downstream skill does not edit an approved specification, policy, contract, or QFAI-owned rule on its own authority. It records the discrepancy and returns the affected artifact to its owner. A discussion pack is discovery material; the story tree and contracts are the current specification.
@@ -4,7 +4,7 @@ Read when a gate fails.
4
4
 
5
5
  ## Gate Failure Autorepair Protocol
6
6
 
7
- Follow this protocol when any of the validate, doctor, test, lint, typecheck, build, capture, or report gates fail. A reviewer's `REVISE` is not a gate failure and is not rerun: the author fixes or answers each finding once, as `.qfai/assistant/rule/review-convergence.md` sets out.
7
+ Follow this protocol when any of the validate, doctor, test, lint, typecheck, build, capture, or report gates fail. A reviewer's `REVISE` is not a gate failure and is not rerun as one: the author fixes or answers each finding, with a behaviour fix's one focused re-review, as `.qfai/assistant/rule/review-convergence.md` sets out.
8
8
 
9
9
  - inspect exit code, logs, `validate.json`, and cited files before reporting — in `validate.json`, read `counts` for the verdict and `issues[].code` for each finding; the array is `issues`, not `findings`;
10
10
  - classify each finding as skill-owned artifact, upstream spec/contract, code/test defect, environment/tooling, or user decision;
@@ -9,8 +9,12 @@ which owns the delegation rules these sit beside.
9
9
  - The review runs once, after the stage's last step.
10
10
  - The author fixes or answers every finding: a fix in the finding's owning
11
11
  source, or a reasoned answer recorded beside the finding.
12
- - There is no re-review and no `REVISE` loop. Once every finding is fixed or
13
- answered, the work proceeds.
12
+ - There is no `REVISE` loop. A fix that changes behaviour (code, a test's
13
+ assertions or a contract statement, not wording alone) gets one focused
14
+ re-review: each reviewer whose findings had a behaviour fix reads only the
15
+ combined diff of those fixes, once. Each finding of that re-review is fixed or answered with no further
16
+ re-review, and a fix that changes wording only gets none. Once every finding
17
+ is fixed or answered, the work proceeds.
14
18
  - A finding the author cannot fix is reported in the stage's final report, with
15
19
  the finding and why it stays open.
16
20
  - A critical decision requires actual user authority under
@@ -27,7 +31,9 @@ which owns the delegation rules these sit beside.
27
31
  Within a stage there is one review, so no demand comes back in it. The rules
28
32
  below are for a later, separate stage whose own one review reads an artifact an
29
33
  earlier stage's review already answered on; they never start a second review in
30
- the same stage.
34
+ the same stage. The focused re-review of a behaviour fix,
35
+ under One review above, is not a second review: it may not re-raise a demand the first
36
+ review answered unless the fix changed what that answer rests on.
31
37
 
32
38
  Record each finding's fix or answer, and its evidence, in the Response and
33
39
  Evidence cells. When a later stage reviews the same artifact, its