@event4u/agent-config 9.22.0 → 9.23.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 (85) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/CHANGELOG.md +69 -256
  3. package/README.md +1 -1
  4. package/dist/agent-src/commands/optimize/deep.md +13 -0
  5. package/dist/agent-src/contexts/execution/cheap-question-mechanics.md +12 -2
  6. package/dist/agent-src/contexts/execution/mandated-lines.md +180 -0
  7. package/dist/agent-src/rules/context-hygiene.md +17 -0
  8. package/dist/agent-src/rules/downstream-changes.md +26 -0
  9. package/dist/agent-src/rules/think-before-action.md +25 -0
  10. package/dist/agent-src/rules/token-budget-discipline.md +46 -3
  11. package/dist/agent-src/rules/token-efficiency.md +13 -0
  12. package/dist/agent-src/rules/ui-audit-gate.md +33 -2
  13. package/dist/agent-src/skills/adversarial-review/SKILL.md +18 -4
  14. package/dist/agent-src/skills/decision-review/SKILL.md +49 -0
  15. package/dist/agent-src/skills/judge-artifact-completeness/SKILL.md +5 -1
  16. package/dist/agent-src/skills/judge-bug-hunter/SKILL.md +16 -0
  17. package/dist/agent-src/skills/judge-synthesis/SKILL.md +14 -1
  18. package/dist/agent-src/skills/rule-writing/SKILL.md +33 -0
  19. package/dist/agent-src/skills/skill-improvement-pipeline/SKILL.md +31 -0
  20. package/dist/agent-src/skills/skill-reviewer/SKILL.md +1 -1
  21. package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
  22. package/dist/cli/registry.js +1 -0
  23. package/dist/cli/registry.js.map +1 -1
  24. package/dist/cli-delegate/chunk-DVRS2KVR.js +4602 -0
  25. package/dist/cli-delegate/{chunk-ELMFOQPW.js → chunk-SJQMJI7M.js} +8 -4597
  26. package/dist/cli-delegate/cmd_export.js +2 -1
  27. package/dist/cli-delegate/cmd_prune.js +2 -1
  28. package/dist/cli-delegate/cmd_settings_migrate.js +2 -1
  29. package/dist/cli-delegate/cmd_settings_set.js +3370 -0
  30. package/dist/cli-delegate/cmd_sync.js +2 -1
  31. package/dist/cli-delegate/cmd_uninstall.js +2 -1
  32. package/dist/cli-delegate/cmd_validate.js +2 -1
  33. package/dist/discovery/deprecation-report.md +1 -1
  34. package/dist/discovery/discovery-manifest.json +17 -17
  35. package/dist/discovery/discovery-manifest.json.sha256 +1 -1
  36. package/dist/discovery/discovery-manifest.summary.md +1 -1
  37. package/dist/discovery/orphan-report.md +1 -1
  38. package/dist/discovery/packs.json +2 -2
  39. package/dist/discovery/trust-report.md +1 -1
  40. package/dist/discovery/workspaces.json +2 -2
  41. package/dist/hooks/dispatch.js +79 -1
  42. package/dist/mcp/registry-manifest.json +2 -2
  43. package/dist/mcp/server.json +2 -2
  44. package/dist/scripts/condense.js +47 -2
  45. package/dist/scripts/condense.js.map +1 -1
  46. package/dist/server/routes/settings.js +82 -0
  47. package/dist/server/routes/settings.js.map +1 -1
  48. package/dist/shared/settingsClasses.js +191 -0
  49. package/dist/shared/settingsClasses.js.map +1 -0
  50. package/docs/contracts/settings-classes.md +342 -0
  51. package/docs/guidelines/agent-infra/artifact-drafting-protocol-mechanics.md +23 -2
  52. package/docs/guidelines/agent-infra/false-green.md +187 -0
  53. package/docs/guidelines/agent-infra/gate-authoring.md +177 -0
  54. package/package.json +3 -1
  55. package/src/config/ci-local-parity.yml +12 -0
  56. package/src/config/evaluator-budgets.json +4 -4
  57. package/src/config/gate-coverage.yml +54 -12
  58. package/src/config/gate-violation-baselines.json +6 -0
  59. package/src/config/pack-size-budget.json +4 -3
  60. package/src/scripts/_cli/cmd_settings_set.ts +509 -0
  61. package/src/scripts/_dispatch.bash +16 -0
  62. package/src/scripts/_lib/gate_ledger.ts +295 -0
  63. package/src/scripts/_lib/gate_result.ts +101 -0
  64. package/src/scripts/_lib/gate_self_test.ts +129 -0
  65. package/src/scripts/_lib/measured_render.ts +97 -0
  66. package/src/scripts/_lib/ratchet_base_ref.ts +373 -0
  67. package/src/scripts/check_gate_completeness.ts +244 -0
  68. package/src/scripts/check_gate_coverage.ts +35 -6
  69. package/src/scripts/check_references.ts +125 -15
  70. package/src/scripts/check_review_dispositions.ts +14 -1
  71. package/src/scripts/check_suppression_hygiene.ts +503 -0
  72. package/src/scripts/condense.ts +47 -2
  73. package/src/scripts/hook_manifest.yaml +23 -0
  74. package/src/scripts/hooks/dispatch_hook.ts +65 -1
  75. package/src/scripts/hooks/host_semantics.ts +140 -0
  76. package/src/scripts/lint_framework_leakage.ts +147 -15
  77. package/src/scripts/lint_mandated_lines.ts +339 -0
  78. package/src/scripts/lint_roadmap_complexity.ts +102 -11
  79. package/src/scripts/lint_roadmap_family_cap.ts +191 -0
  80. package/src/scripts/lint_settings_classes.ts +397 -0
  81. package/src/scripts/lint_token_budget_discipline.ts +109 -1
  82. package/src/scripts/report_imperative_density.ts +229 -0
  83. package/src/scripts/verify_physical_move.ts +10 -1
  84. package/src/server/io/yamlIO.ts +173 -0
  85. package/src/shared/settingsClasses.ts +235 -0
@@ -1,7 +1,8 @@
1
1
  import { createRequire as __acCreateRequire } from 'node:module'; const require = globalThis.require ?? __acCreateRequire(import.meta.url);
2
2
  import {
3
3
  main
4
- } from "./chunk-ELMFOQPW.js";
4
+ } from "./chunk-SJQMJI7M.js";
5
+ import "./chunk-DVRS2KVR.js";
5
6
  import "./chunk-WR6GTRHJ.js";
6
7
  import "./chunk-BKO2AZ7Z.js";
7
8
  import {
@@ -3,7 +3,8 @@ import {
3
3
  PROJECT_BRIDGE_MARKERS,
4
4
  USER_SCOPE_PATHS,
5
5
  subtract_pointers
6
- } from "./chunk-ELMFOQPW.js";
6
+ } from "./chunk-SJQMJI7M.js";
7
+ import "./chunk-DVRS2KVR.js";
7
8
  import "./chunk-WR6GTRHJ.js";
8
9
  import "./chunk-BKO2AZ7Z.js";
9
10
  import {
@@ -3,7 +3,8 @@ import { createRequire as __acCreateRequire } from 'node:module'; const require
3
3
  import {
4
4
  PROJECT_BRIDGE_MARKERS,
5
5
  USER_SCOPE_PATHS
6
- } from "./chunk-ELMFOQPW.js";
6
+ } from "./chunk-SJQMJI7M.js";
7
+ import "./chunk-DVRS2KVR.js";
7
8
  import "./chunk-WR6GTRHJ.js";
8
9
  import "./chunk-BKO2AZ7Z.js";
9
10
  import {
@@ -1,6 +1,6 @@
1
1
  # Discovery — Deprecation Report
2
2
 
3
- - Generated: `2026-08-05T05:32:20Z`
3
+ - Generated: `2026-08-06T04:46:29Z`
4
4
  - Deprecated artefacts: **0**
5
5
 
6
6
  _None. Tree is clean._
@@ -3895,7 +3895,7 @@
3895
3895
  },
3896
3896
  {
3897
3897
  "category": "command",
3898
- "checksum": "sha256:8d57eccdcbacf29ec8e9496b74c7fea67bccd42f46f87f2583b73b9b1779d184",
3898
+ "checksum": "sha256:3dff6078333dc4e2bd65a31b5bcd4e9b27a47db078512c46089710598f9676af",
3899
3899
  "install": {
3900
3900
  "default": true,
3901
3901
  "removable": false
@@ -5785,7 +5785,7 @@
5785
5785
  },
5786
5786
  {
5787
5787
  "category": "rule",
5788
- "checksum": "sha256:e40b9270844db96ca7a1a9f4cd7d4022422c2b38ddb20c614be3bcd4e67250f5",
5788
+ "checksum": "sha256:d961962cf4f303b5c2b61dc5ad5f58a7810cfc6c735ec1b971f1d31f8910709a",
5789
5789
  "install": {
5790
5790
  "default": true,
5791
5791
  "removable": false
@@ -6139,7 +6139,7 @@
6139
6139
  },
6140
6140
  {
6141
6141
  "category": "rule",
6142
- "checksum": "sha256:7c3edcfe77a3d70428b57a1764a4e2bbfbc78e3d638154f458ddf12aad173550",
6142
+ "checksum": "sha256:069e5a5de50e4bb6cbc5a8bf1b3f6c121ca74f5c92340cb9f92c756e53646eab",
6143
6143
  "install": {
6144
6144
  "default": true,
6145
6145
  "removable": false
@@ -7639,7 +7639,7 @@
7639
7639
  },
7640
7640
  {
7641
7641
  "category": "rule",
7642
- "checksum": "sha256:a443bc5e7fdf06faa3f54e839d21766ce90fe02183a932c6d49ae22247ef0629",
7642
+ "checksum": "sha256:67d557ae3f379a347dea88c6917a6a3ef08a723b34b77df5fb48995974b49634",
7643
7643
  "install": {
7644
7644
  "default": true,
7645
7645
  "removable": false
@@ -7660,7 +7660,7 @@
7660
7660
  },
7661
7661
  {
7662
7662
  "category": "rule",
7663
- "checksum": "sha256:4582c93543e7ca4f0b44bf4456c20d1952b26ab786e88e7de0f640209be02af8",
7663
+ "checksum": "sha256:724249e7b81f90b29f949d90d08f70be0c2885227a10b88db0b525455bca07e5",
7664
7664
  "install": {
7665
7665
  "default": true,
7666
7666
  "removable": false
@@ -7681,7 +7681,7 @@
7681
7681
  },
7682
7682
  {
7683
7683
  "category": "rule",
7684
- "checksum": "sha256:3b170640629262dbab7e68546c55da0a620019e67b8b286f1a54e775bd5ff21f",
7684
+ "checksum": "sha256:a10e1753c1aa893a1149361e18d3511f34273ef424f7ee7bbbf795b0cbd75d6a",
7685
7685
  "install": {
7686
7686
  "default": true,
7687
7687
  "removable": false
@@ -7754,7 +7754,7 @@
7754
7754
  },
7755
7755
  {
7756
7756
  "category": "rule",
7757
- "checksum": "sha256:850560f747198febdb3840c63ca754042efe4f305752678d07d087f9575eaed9",
7757
+ "checksum": "sha256:3091d3577b9f2caaff45c6d96805f932b5833c0713811962a78b7725fb97b7f0",
7758
7758
  "install": {
7759
7759
  "default": true,
7760
7760
  "removable": false
@@ -7966,7 +7966,7 @@
7966
7966
  },
7967
7967
  {
7968
7968
  "category": "skill",
7969
- "checksum": "sha256:cdaa8f128289dbe31843da7ccbefd35bca719cc38d904f0f28505e72380556c8",
7969
+ "checksum": "sha256:e906f289f79df96b79e55c4c664c94c4a860b814c9ec1ddc5535d0655a554278",
7970
7970
  "install": {
7971
7971
  "default": true,
7972
7972
  "removable": false
@@ -9264,7 +9264,7 @@
9264
9264
  },
9265
9265
  {
9266
9266
  "category": "skill",
9267
- "checksum": "sha256:21fe1e1cab3bf7e739a0e3dbfe48ec60c0da59caae1c791b7003e1ccb1f6f42e",
9267
+ "checksum": "sha256:e472a98d0fca4325a390a3825aa93c62718ee3b498ebbb12ae97086d35a50c81",
9268
9268
  "install": {
9269
9269
  "default": false,
9270
9270
  "removable": true
@@ -10474,7 +10474,7 @@
10474
10474
  },
10475
10475
  {
10476
10476
  "category": "skill",
10477
- "checksum": "sha256:347c6d2b24c194b612e81b623a7c82dd2f19177bdc0d374a83576767726819f9",
10477
+ "checksum": "sha256:4cfa4a561b9ac89012273b08b8e2f126a97bacfed1b0ba6cc7db15f08d9e1577",
10478
10478
  "install": {
10479
10479
  "default": true,
10480
10480
  "removable": false
@@ -10496,7 +10496,7 @@
10496
10496
  },
10497
10497
  {
10498
10498
  "category": "skill",
10499
- "checksum": "sha256:ab91a9991075ef6d11c9f7d6fad4d6ad345faf94f51f69b74f461c42ae215756",
10499
+ "checksum": "sha256:bdbc3ecb5c920deed2622704b1a6c0a5f6c6e57a5f90cbbf7befbc6509b30ce1",
10500
10500
  "install": {
10501
10501
  "default": true,
10502
10502
  "removable": false
@@ -10584,7 +10584,7 @@
10584
10584
  },
10585
10585
  {
10586
10586
  "category": "skill",
10587
- "checksum": "sha256:a5e6ac0ab70da7762c4b958cb6c24b75a437c33235a4c39b09b80265de38cbaf",
10587
+ "checksum": "sha256:c125c12dd1d061aaaa36c88a2df187e2bf60376adbb36ef819b1f1752279fb76",
10588
10588
  "install": {
10589
10589
  "default": true,
10590
10590
  "removable": false
@@ -13010,7 +13010,7 @@
13010
13010
  },
13011
13011
  {
13012
13012
  "category": "skill",
13013
- "checksum": "sha256:28728406da80f3d423c8a669ed6ef1e3faccfa19265bd10135297036ae894fcf",
13013
+ "checksum": "sha256:8e31ba9d6efb3beff58d0f5a70b17da12e28dd1521ecc7f87ca3e9e2f7ddb540",
13014
13014
  "install": {
13015
13015
  "default": true,
13016
13016
  "removable": false
@@ -13296,7 +13296,7 @@
13296
13296
  },
13297
13297
  {
13298
13298
  "category": "skill",
13299
- "checksum": "sha256:9cc346f0e7f88185a7639c4cdd08fb35ded3eb1481b80cb8b13fff619fcb14b9",
13299
+ "checksum": "sha256:a2d0b436a6c8d7e5204649c931cfe4061e056042beb4637968d2a61ab6754e1d",
13300
13300
  "install": {
13301
13301
  "default": true,
13302
13302
  "removable": false
@@ -13340,7 +13340,7 @@
13340
13340
  },
13341
13341
  {
13342
13342
  "category": "skill",
13343
- "checksum": "sha256:f97d62367254a4e27aa428ed7940a59e4679a2ac59c8d254b73373033efa1dd6",
13343
+ "checksum": "sha256:1cdc1593d6e137f825e6c07db6356988f00de4a27fc74773f3330c4af3706c79",
13344
13344
  "install": {
13345
13345
  "default": true,
13346
13346
  "removable": false
@@ -14259,7 +14259,7 @@
14259
14259
  "workspaces": []
14260
14260
  }
14261
14261
  ],
14262
- "checksum": "sha256:acdebb0b72b50f8026c14b11df8706155fb82ba5c44cff7fa47b6e019052d156",
14262
+ "checksum": "sha256:4a815bc9d2095c52b4e922686da9463ef535c33725d8ceac6287a60d8beb0e56",
14263
14263
  "deprecations": [
14264
14264
  {
14265
14265
  "key": "tier",
@@ -14402,7 +14402,7 @@
14402
14402
  "reason": "scaffold template for ticket-bundle tickets (ADR-101); carries no runtime frontmatter — emit-tickets fills it in per ticket"
14403
14403
  }
14404
14404
  ],
14405
- "generated_at": "2026-08-05T05:32:20Z",
14405
+ "generated_at": "2026-08-06T04:46:29Z",
14406
14406
  "packs": [
14407
14407
  {
14408
14408
  "artefact_count": 117,
@@ -1 +1 @@
1
- afd8d19ae939ff4cc011583591c8ae9f88601d301d808874f41cfb43f0d1122a discovery-manifest.json
1
+ 1626a243f6c3ec9dcaf68057bec46f5c3a3a78921b0b50995a8b1996ec66b242 discovery-manifest.json
@@ -1,6 +1,6 @@
1
1
  # Discovery Manifest — Summary
2
2
 
3
- - Generated: `2026-08-05T05:32:20Z`
3
+ - Generated: `2026-08-06T04:46:29Z`
4
4
  - Scanner: `c24312e116f8`
5
5
  - Artefacts: **594**
6
6
  - Unassigned: **0**
@@ -1,6 +1,6 @@
1
1
  # Discovery — Orphan Report
2
2
 
3
- - Generated: `2026-08-05T05:32:20Z`
3
+ - Generated: `2026-08-06T04:46:29Z`
4
4
  - Orphan artefacts: **0**
5
5
 
6
6
  > An orphan is an artefact whose declared pack has no other members.
@@ -1,6 +1,6 @@
1
1
  {
2
- "checksum": "sha256:acdebb0b72b50f8026c14b11df8706155fb82ba5c44cff7fa47b6e019052d156",
3
- "generated_at": "2026-08-05T05:32:20Z",
2
+ "checksum": "sha256:4a815bc9d2095c52b4e922686da9463ef535c33725d8ceac6287a60d8beb0e56",
3
+ "generated_at": "2026-08-06T04:46:29Z",
4
4
  "packs": [
5
5
  {
6
6
  "always_on": false,
@@ -1,6 +1,6 @@
1
1
  # Discovery — Trust Report
2
2
 
3
- - Generated: `2026-08-05T05:32:20Z`
3
+ - Generated: `2026-08-06T04:46:29Z`
4
4
  - Workspaces tracked: **10**
5
5
  - Human-review-required artefacts: **3**
6
6
 
@@ -1,6 +1,6 @@
1
1
  {
2
- "checksum": "sha256:acdebb0b72b50f8026c14b11df8706155fb82ba5c44cff7fa47b6e019052d156",
3
- "generated_at": "2026-08-05T05:32:20Z",
2
+ "checksum": "sha256:4a815bc9d2095c52b4e922686da9463ef535c33725d8ceac6287a60d8beb0e56",
3
+ "generated_at": "2026-08-06T04:46:29Z",
4
4
  "scanner_version": "c24312e116f8",
5
5
  "workspaces": [
6
6
  {
@@ -19536,6 +19536,55 @@ var CONCERN_REGISTRY = {
19536
19536
  "src/scripts/hooks/code_graph_nudge_hook.ts": main29
19537
19537
  };
19538
19538
 
19539
+ // src/scripts/hooks/host_semantics.ts
19540
+ var VERIFIED_PLATFORMS = /* @__PURE__ */ new Set(["claude"]);
19541
+ var CLAUDE_HOOK_EVENT_NAME = {
19542
+ pre_tool_use: "PreToolUse",
19543
+ post_tool_use: "PostToolUse",
19544
+ user_prompt_submit: "UserPromptSubmit",
19545
+ session_start: "SessionStart",
19546
+ session_end: "SessionEnd",
19547
+ stop: "Stop",
19548
+ pre_compact: "PreCompact"
19549
+ };
19550
+ var CLAUDE_BLOCK_CAPABLE_EVENTS = /* @__PURE__ */ new Set([
19551
+ "pre_tool_use",
19552
+ "user_prompt_submit",
19553
+ "stop"
19554
+ ]);
19555
+ function _joinReasons(reasons) {
19556
+ return reasons.map((r) => r.trim()).filter((r) => r.length > 0).join(" \xB7 ");
19557
+ }
19558
+ function claudeAdditionalContext(event, text) {
19559
+ const hookEventName = CLAUDE_HOOK_EVENT_NAME[event] ?? event;
19560
+ return `${JSON.stringify({
19561
+ hookSpecificOutput: { hookEventName, additionalContext: text }
19562
+ })}
19563
+ `;
19564
+ }
19565
+ function emitFor(platform, event, severity, reasons, legacyExit) {
19566
+ if (!VERIFIED_PLATFORMS.has(platform)) {
19567
+ return { exit: legacyExit, stdout: "", stderr: "" };
19568
+ }
19569
+ const reason = _joinReasons(reasons);
19570
+ if (severity === "allow") {
19571
+ return { exit: 0, stdout: "", stderr: "" };
19572
+ }
19573
+ if (severity === "block") {
19574
+ if (CLAUDE_BLOCK_CAPABLE_EVENTS.has(event)) {
19575
+ const label2 = reason || "blocked by agent-config hook policy";
19576
+ return { exit: 2, stdout: "", stderr: `${label2}
19577
+ ` };
19578
+ }
19579
+ const label = reason || "agent-config hook reported a blocking finding";
19580
+ return { exit: 0, stdout: claudeAdditionalContext(event, label), stderr: "" };
19581
+ }
19582
+ if (!reason) {
19583
+ return { exit: 0, stdout: "", stderr: "" };
19584
+ }
19585
+ return { exit: 0, stdout: claudeAdditionalContext(event, reason), stderr: "" };
19586
+ }
19587
+
19539
19588
  // src/scripts/hooks/dispatch_hook.ts
19540
19589
  var _IN_BUNDLE = true;
19541
19590
  var REPO_ROOT = path41.resolve(
@@ -19567,6 +19616,9 @@ function _isObject9(v) {
19567
19616
  function _severity_for(rc) {
19568
19617
  return _SEVERITY_BY_EXIT[rc] ?? "error";
19569
19618
  }
19619
+ function _is_advisory(concern) {
19620
+ return String(concern["severity"] ?? "").trim().toLowerCase() === "advisory";
19621
+ }
19570
19622
  function _now_iso3() {
19571
19623
  return (/* @__PURE__ */ new Date()).toISOString().replace(/\.\d{3}Z$/, "Z");
19572
19624
  }
@@ -20166,6 +20218,7 @@ function main30(argv) {
20166
20218
  const rcs = [];
20167
20219
  const feedback_entries = [];
20168
20220
  const context_blocks = [];
20221
+ const concern_messages = [];
20169
20222
  for (const concern of concerns) {
20170
20223
  const concern_started = _now_iso3();
20171
20224
  const { rc: rawRcResult, stderr: stderr_text, stdout: stdout_text, duration_ms } = _run_concern(concern, envelope);
@@ -20181,8 +20234,19 @@ function main30(argv) {
20181
20234
  process.stderr.write(stderr_text);
20182
20235
  }
20183
20236
  }
20237
+ if (rc === EXIT_BLOCK2 && _is_advisory(concern)) {
20238
+ process.stderr.write(
20239
+ `dispatch_hook: concern '${String(concern["name"])}' is declared severity: advisory but returned BLOCK \u2014 downgraded to warn.
20240
+ `
20241
+ );
20242
+ rc = EXIT_WARN7;
20243
+ }
20184
20244
  rcs.push(rc);
20185
20245
  const reply = _parse_concern_stdout(stdout_text);
20246
+ const stated = typeof reply["reason"] === "string" && reply["reason"].trim() ? reply["reason"].trim() : stderr_text.trim();
20247
+ if (stated) {
20248
+ concern_messages.push({ rc, text: stated });
20249
+ }
20186
20250
  if (args.event === "session_start" && rc === EXIT_ALLOW9 && typeof reply["context"] === "string" && reply["context"].trim()) {
20187
20251
  context_blocks.push(reply["context"].trim());
20188
20252
  }
@@ -20205,7 +20269,21 @@ function main30(argv) {
20205
20269
  if (context_blocks.length > 0 && final_rc === EXIT_ALLOW9) {
20206
20270
  process.stdout.write(context_blocks.join("\n\n") + "\n");
20207
20271
  }
20208
- return final_rc;
20272
+ const decidingReasons = concern_messages.filter((m) => m.rc === final_rc).map((m) => m.text);
20273
+ const emission = emitFor(
20274
+ args.platform,
20275
+ args.event,
20276
+ _severity_for(final_rc),
20277
+ decidingReasons,
20278
+ final_rc
20279
+ );
20280
+ if (emission.stdout) {
20281
+ process.stdout.write(emission.stdout);
20282
+ }
20283
+ if (emission.stderr) {
20284
+ process.stderr.write(emission.stderr);
20285
+ }
20286
+ return emission.exit;
20209
20287
  }
20210
20288
  function _isDir4(p) {
20211
20289
  try {
@@ -3,13 +3,13 @@
3
3
  "artefact_count": 594,
4
4
  "scanner_version": "c24312e116f8"
5
5
  },
6
- "generated_at": "2026-08-05",
6
+ "generated_at": "2026-08-06",
7
7
  "package": {
8
8
  "description": "Governed skills, rules and commands for AI coding tools (Claude Code, Cursor, Windsurf, Copilot) \u2014 every claim machine-checked, including \"zero runtime daemon\".",
9
9
  "homepage": "https://event4u-app.github.io/agent-config",
10
10
  "name": "@event4u/agent-config",
11
11
  "repository": "https://github.com/event4u-app/agent-config",
12
- "version": "9.22.0"
12
+ "version": "9.23.0"
13
13
  },
14
14
  "registries": [
15
15
  {
@@ -9,12 +9,12 @@
9
9
  "transport": {
10
10
  "type": "stdio"
11
11
  },
12
- "version": "9.22.0"
12
+ "version": "9.23.0"
13
13
  }
14
14
  ],
15
15
  "repository": {
16
16
  "source": "github",
17
17
  "url": "https://github.com/event4u-app/agent-config"
18
18
  },
19
- "version": "9.22.0"
19
+ "version": "9.23.0"
20
20
  }
@@ -940,12 +940,51 @@ function _read_rule_packs() {
940
940
  * compiles and behaves unchanged.
941
941
  */
942
942
  /** List rule basenames under RULES_SOURCE, workspace/pack scope applied. */
943
+ /**
944
+ * Is this rule `type: manual` (ADR-004 reference-only)?
945
+ *
946
+ * The schema is explicit: `manual` = "no auto-injection (zero workspace-budget
947
+ * cost); file remains as a reference document linkable from skills/contexts."
948
+ * `compile_router` already honours the first half by omitting manual rules from
949
+ * `dist/router.json`. The per-tool projection did NOT: it symlinked them into
950
+ * `.claude/rules/` (and siblings), so under the default `eager-all` projection
951
+ * their full bodies were injected every turn — the exact opposite of "zero
952
+ * workspace-budget cost". `brand-consistency` is the clearest case: its own body
953
+ * says "reference-only, no router emission", and it shipped in context anyway.
954
+ *
955
+ * Excluded from the per-tool trees ONLY. The file keeps its place in
956
+ * `dist/agent-src/rules/`, which is what "remains as a reference document
957
+ * linkable" requires — inbound cross-references must still resolve.
958
+ */
959
+ function _is_manual_rule(rule_path) {
960
+ let content;
961
+ try {
962
+ content = fs.readFileSync(rule_path, 'utf-8');
963
+ }
964
+ catch {
965
+ return false; // unreadable → fail open, same posture as the scope filters
966
+ }
967
+ const [fm_lines] = _split_frontmatter(content);
968
+ if (fm_lines === null) {
969
+ return false;
970
+ }
971
+ for (const line of fm_lines) {
972
+ const m = /^type:\s*["']?([a-z]+)["']?\s*$/.exec(line);
973
+ if (m) {
974
+ return m[1] === 'manual';
975
+ }
976
+ }
977
+ return false;
978
+ }
943
979
  function _scoped_rule_basenames() {
944
980
  const scope = _read_rule_workspaces();
945
981
  const pack_scope = _read_rule_packs();
946
982
  return _iterdirSorted(MODULE_STATE.RULES_SOURCE)
947
983
  .filter((p) => p.endsWith('.md') && _isFile(p))
948
984
  .filter((p) => rule_in_scope(p, scope, pack_scope))
985
+ // ADR-004: a manual rule costs zero workspace budget, so it never gets a
986
+ // per-tool symlink regardless of projection mode. See _is_manual_rule.
987
+ .filter((p) => !_is_manual_rule(p))
949
988
  // A compile-disabled rule has no dist/agent-src/ counterpart, so a per-tool
950
989
  // symlink to it would dangle. The source file still exists, which is why the
951
990
  // scope filters alone let it through — the toggle is a separate axis and this
@@ -1179,7 +1218,10 @@ export function generate_cursor_mdc_rules() {
1179
1218
  const pack_scope = _read_rule_packs();
1180
1219
  const rules = _rglobSorted(MODULE_STATE.RULES_SOURCE, '*.md')
1181
1220
  .filter((p) => _isFile(p))
1182
- .filter((p) => rule_in_scope(p, scope, pack_scope));
1221
+ .filter((p) => rule_in_scope(p, scope, pack_scope))
1222
+ // ADR-004 manual rules are reference-only — never auto-injected into a
1223
+ // per-tool tree. Same predicate as generate_rule_symlinks.
1224
+ .filter((p) => !_is_manual_rule(p));
1183
1225
  const stems = rules.map((r) => path.basename(r, '.md'));
1184
1226
  const valid = new Set([
1185
1227
  ...stems.map((s) => `${s}.mdc`),
@@ -1197,7 +1239,10 @@ export function generate_windsurf_modern_rules() {
1197
1239
  const pack_scope = _read_rule_packs();
1198
1240
  const rules = _rglobSorted(MODULE_STATE.RULES_SOURCE, '*.md')
1199
1241
  .filter((p) => _isFile(p))
1200
- .filter((p) => rule_in_scope(p, scope, pack_scope));
1242
+ .filter((p) => rule_in_scope(p, scope, pack_scope))
1243
+ // ADR-004 manual rules are reference-only — never auto-injected into a
1244
+ // per-tool tree. Same predicate as generate_rule_symlinks.
1245
+ .filter((p) => !_is_manual_rule(p));
1201
1246
  const valid = new Set(rules.map((r) => path.basename(r)));
1202
1247
  _clean_modern_dir(_WINDSURF_RULES_DIR(), valid);
1203
1248
  for (const rule of rules) {