@event4u/agent-config 9.32.0 → 9.33.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 (76) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/CHANGELOG.md +96 -1
  3. package/dist/agent-src/commands/review/routing.md +3 -4
  4. package/dist/agent-src/contexts/communication/rules-auto/reply-close-mechanics.md +65 -0
  5. package/dist/agent-src/contexts/execution/orchestration-telemetry.md +3 -0
  6. package/dist/agent-src/rules/delegation-policy.md +6 -0
  7. package/dist/agent-src/scripts/roadmap_gates.ts +107 -3
  8. package/dist/agent-src/skills/docker/SKILL.md +11 -0
  9. package/dist/agent-src/skills/laravel/SKILL.md +11 -0
  10. package/dist/agent-src/skills/review-routing/SKILL.md +23 -6
  11. package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
  12. package/dist/agent-src/templates/scripts/ownership-map.example.yml +1 -1
  13. package/dist/cli/registry.js +4 -4
  14. package/dist/cli/registry.js.map +1 -1
  15. package/dist/cli-delegate/chunk-HTIU3W56.js +66 -0
  16. package/dist/cli-delegate/{chunk-ITIQSGOQ.js → chunk-MA4GFWDY.js} +7 -4
  17. package/dist/cli-delegate/{chunk-542DZR4P.js → chunk-PMQ6Z3T3.js} +1651 -144
  18. package/dist/cli-delegate/{chunk-PFBV6XRT.js → chunk-Q26HT4QT.js} +1 -63
  19. package/dist/cli-delegate/{chunk-LVRYBKTI.js → chunk-YPAWXXXR.js} +158 -0
  20. package/dist/cli-delegate/cmd_conformance.js +256 -226
  21. package/dist/cli-delegate/cmd_doctor.js +3 -2
  22. package/dist/cli-delegate/cmd_export.js +1 -1
  23. package/dist/cli-delegate/cmd_handoff.js +19 -26
  24. package/dist/cli-delegate/cmd_prune.js +1 -1
  25. package/dist/cli-delegate/cmd_session_recycle.js +13 -3
  26. package/dist/cli-delegate/cmd_settings_get.js +4 -2
  27. package/dist/cli-delegate/cmd_settings_migrate.js +1 -1
  28. package/dist/cli-delegate/cmd_settings_set.js +5 -3
  29. package/dist/cli-delegate/cmd_sync.js +1 -1
  30. package/dist/cli-delegate/cmd_uninstall.js +1 -1
  31. package/dist/cli-delegate/cmd_validate.js +1 -1
  32. package/dist/discovery/deprecation-report.md +1 -1
  33. package/dist/discovery/discovery-manifest.json +8 -8
  34. package/dist/discovery/discovery-manifest.json.sha256 +1 -1
  35. package/dist/discovery/discovery-manifest.summary.md +1 -1
  36. package/dist/discovery/orphan-report.md +1 -1
  37. package/dist/discovery/packs.json +2 -2
  38. package/dist/discovery/trust-report.md +1 -1
  39. package/dist/discovery/workspaces.json +2 -2
  40. package/dist/hooks/dispatch.js +18 -0
  41. package/dist/install/install.mjs +7 -4
  42. package/dist/mcp/registry-manifest.json +2 -2
  43. package/dist/mcp/server.json +2 -2
  44. package/dist/mcp/server.mjs +3637 -1158
  45. package/package.json +1 -1
  46. package/src/agent-src/scripts/roadmap_gates.ts +107 -3
  47. package/src/agent-src/templates/scripts/ownership-map.example.yml +1 -1
  48. package/src/config/cost-parity-budget.json +167 -0
  49. package/src/config/gate-coverage.yml +44 -5
  50. package/src/config/quorum-attendance-budget.json +39 -0
  51. package/src/scripts/_cli/cmd_doctor.ts +69 -1
  52. package/src/scripts/_cli/cmd_session_recycle.ts +19 -3
  53. package/src/scripts/_dispatch.bash +5 -3
  54. package/src/scripts/_lib/orchestration_record.ts +45 -0
  55. package/src/scripts/ai_council/clients.ts +31 -0
  56. package/src/scripts/ai_council/events_log.ts +128 -6
  57. package/src/scripts/ai_council/orchestrator.ts +12 -3
  58. package/src/scripts/ai_council/pricing.ts +48 -1
  59. package/src/scripts/ai_council/quorum.ts +20 -0
  60. package/src/scripts/ai_council/session.ts +11 -0
  61. package/src/scripts/ask_transport.ts +20 -1
  62. package/src/scripts/cache_realization_report.ts +38 -0
  63. package/src/scripts/check_release_highlights.ts +7 -1
  64. package/src/scripts/conformance_scan.ts +105 -0
  65. package/src/scripts/cost/track.mjs +39 -0
  66. package/src/scripts/cost_summary.ts +104 -1
  67. package/src/scripts/council_cli.ts +131 -13
  68. package/src/scripts/dispatch_economy_report.ts +5 -2
  69. package/src/scripts/install.ts +20 -6
  70. package/src/scripts/lint_budget_ownership.ts +81 -0
  71. package/src/scripts/lint_skill_frontmatter_safety.ts +55 -1
  72. package/src/scripts/lint_workflow_paths.ts +384 -0
  73. package/src/scripts/preamble_byte_census.ts +9 -1
  74. package/src/scripts/report_carrier_divergence.ts +10 -0
  75. package/src/scripts/report_conformance_funnel.ts +40 -0
  76. package/src/scripts/schemas/subagent.schema.json +3 -2
@@ -13,15 +13,21 @@ import {
13
13
  _resolve_project_root,
14
14
  _run_checks,
15
15
  _run_checks_no_manifest,
16
- _scan_foreign
17
- } from "./chunk-542DZR4P.js";
16
+ _scan_foreign,
17
+ censusRuleDir,
18
+ comparePair,
19
+ frontmatterPaths,
20
+ proseEqual,
21
+ splitFrontmatter
22
+ } from "./chunk-PMQ6Z3T3.js";
18
23
  import "./chunk-FTAISGDQ.js";
19
24
  import {
20
25
  atomic_write_json,
21
26
  atomic_write_text,
22
27
  is_replay_mode
23
28
  } from "./chunk-EJITJBJX.js";
24
- import "./chunk-LVRYBKTI.js";
29
+ import "./chunk-Q26HT4QT.js";
30
+ import "./chunk-YPAWXXXR.js";
25
31
  import "./chunk-PZWRPRWP.js";
26
32
  import "./chunk-736JCWLM.js";
27
33
  import {
@@ -48,9 +54,9 @@ import {
48
54
 
49
55
  // src/scripts/_cli/cmd_conformance.ts
50
56
  var YAML = __toESM(require_dist(), 1);
51
- import * as fs12 from "node:fs";
57
+ import * as fs11 from "node:fs";
52
58
  import * as os6 from "node:os";
53
- import * as path12 from "node:path";
59
+ import * as path11 from "node:path";
54
60
  import process5 from "node:process";
55
61
  import { spawnSync } from "node:child_process";
56
62
  import { fileURLToPath as fileURLToPath11, pathToFileURL as pathToFileURL11 } from "node:url";
@@ -114,86 +120,19 @@ function routeTargetPathsPosix(target) {
114
120
  }
115
121
 
116
122
  // src/scripts/report_conformance_funnel.ts
117
- import * as fs11 from "node:fs";
123
+ import * as fs10 from "node:fs";
118
124
  import * as os5 from "node:os";
119
- import * as path11 from "node:path";
125
+ import * as path10 from "node:path";
120
126
  import process4 from "node:process";
121
127
  import { fileURLToPath as fileURLToPath10, pathToFileURL as pathToFileURL10 } from "node:url";
122
128
 
123
129
  // src/scripts/conformance_scan.ts
124
130
  import { createHash } from "node:crypto";
125
- import fs7 from "node:fs";
131
+ import fs6 from "node:fs";
126
132
  import os from "node:os";
127
- import path7 from "node:path";
133
+ import path6 from "node:path";
128
134
  import { fileURLToPath as fileURLToPath6, pathToFileURL as pathToFileURL6 } from "node:url";
129
135
 
130
- // src/scripts/_lib/carrier_divergence.ts
131
- import * as fs from "node:fs";
132
- import * as path from "node:path";
133
- var OWNERSHIP_KEYS = ["package", "source_path"];
134
- function stripOwnershipKeys(text) {
135
- return text.split("\n").filter((line) => !OWNERSHIP_KEYS.some((k) => line.startsWith(`${k}:`))).join("\n");
136
- }
137
- function comparePair(a, b) {
138
- if (a.equals(b)) {
139
- return "identical";
140
- }
141
- if (stripOwnershipKeys(a.toString("utf-8")) === stripOwnershipKeys(b.toString("utf-8"))) {
142
- return "provenance-only";
143
- }
144
- return "body-diff";
145
- }
146
- function splitFrontmatter(text) {
147
- if (!text.startsWith("---")) return { hadFrontmatter: false, frontmatter: "", body: text };
148
- const end = text.indexOf("\n---", 3);
149
- if (end === -1) return { hadFrontmatter: false, frontmatter: "", body: text };
150
- const afterFence = text.indexOf("\n", end + 1);
151
- return {
152
- hadFrontmatter: true,
153
- frontmatter: text.slice(3, end),
154
- body: afterFence === -1 ? "" : text.slice(afterFence + 1)
155
- };
156
- }
157
- function proseEqual(a, b) {
158
- const sa = splitFrontmatter(a);
159
- const sb = splitFrontmatter(b);
160
- if (!sa.hadFrontmatter && !sb.hadFrontmatter) return false;
161
- const leading = /^\n+/;
162
- return sa.body.replace(leading, "") === sb.body.replace(leading, "");
163
- }
164
- function frontmatterPaths(text) {
165
- const { hadFrontmatter, frontmatter } = splitFrontmatter(text);
166
- if (!hadFrontmatter) return null;
167
- const lines = frontmatter.split("\n");
168
- const start = lines.findIndex((l) => /^paths:/.test(l));
169
- if (start === -1) return null;
170
- const block = [lines[start]];
171
- for (const line of lines.slice(start + 1)) {
172
- if (/^\s/.test(line) && line.trim() !== "") block.push(line);
173
- else break;
174
- }
175
- return block.map((l) => l.trim()).join(" ");
176
- }
177
- function censusRuleDir(dir) {
178
- let files = 0;
179
- let chars = 0;
180
- let entries;
181
- try {
182
- entries = fs.readdirSync(dir);
183
- } catch {
184
- return { files: 0, chars: 0 };
185
- }
186
- for (const name of entries) {
187
- if (!name.endsWith(".md")) continue;
188
- try {
189
- chars += fs.statSync(path.join(dir, name)).size;
190
- files += 1;
191
- } catch {
192
- }
193
- }
194
- return { files, chars };
195
- }
196
-
197
136
  // src/scripts/_lib/transcript_entry.ts
198
137
  function _isObject(v) {
199
138
  return typeof v === "object" && v !== null && !Array.isArray(v);
@@ -232,8 +171,8 @@ function toolUses(entry) {
232
171
  }
233
172
 
234
173
  // src/scripts/language_mirror_hook.ts
235
- import fs2 from "node:fs";
236
- import path2 from "node:path";
174
+ import fs from "node:fs";
175
+ import path from "node:path";
237
176
  import { fileURLToPath, pathToFileURL } from "node:url";
238
177
 
239
178
  // src/scripts/_lib/prompt_shape.ts
@@ -256,11 +195,11 @@ function humanAuthoredLead(text) {
256
195
  // src/scripts/language_mirror_hook.ts
257
196
  var EXIT_ALLOW = 0;
258
197
  var EXIT_WARN = 2;
259
- var STATE_FILE = path2.join("agents", "state", "language-mirror.json");
260
- var PIN_LOST_DIR = path2.join("agents", "state", "language-mirror.pin-lost");
198
+ var STATE_FILE = path.join("agents", "state", "language-mirror.json");
199
+ var PIN_LOST_DIR = path.join("agents", "state", "language-mirror.pin-lost");
261
200
  function pinLostMarker(session_id) {
262
201
  const safe = (session_id || "unknown-session").replace(/[^A-Za-z0-9._-]/g, "_");
263
- return path2.join(PIN_LOST_DIR, `${safe}.marker`);
202
+ return path.join(PIN_LOST_DIR, `${safe}.marker`);
264
203
  }
265
204
  function _isObject2(v) {
266
205
  return typeof v === "object" && v !== null && !Array.isArray(v);
@@ -356,7 +295,7 @@ This pin exists because the trigger is not observable from the transcript alone:
356
295
  }
357
296
  function _loadState(target) {
358
297
  try {
359
- const raw = fs2.readFileSync(target, "utf8");
298
+ const raw = fs.readFileSync(target, "utf8");
360
299
  const decoded = JSON.parse(raw);
361
300
  return _isObject2(decoded) ? decoded : {};
362
301
  } catch {
@@ -405,10 +344,10 @@ function _sessionId(envelope) {
405
344
  return typeof v === "string" && v.trim() !== "" ? v : "unknown-session";
406
345
  }
407
346
  function _migrateLegacyMarker(consumer_root) {
408
- const legacy = path2.join(consumer_root, PIN_LOST_DIR);
347
+ const legacy = path.join(consumer_root, PIN_LOST_DIR);
409
348
  try {
410
- if (fs2.statSync(legacy).isFile()) {
411
- fs2.rmSync(legacy, { force: true });
349
+ if (fs.statSync(legacy).isFile()) {
350
+ fs.rmSync(legacy, { force: true });
412
351
  }
413
352
  } catch {
414
353
  }
@@ -417,13 +356,13 @@ function _setPinLost(consumer_root, session_id) {
417
356
  if (is_replay_mode()) return;
418
357
  _migrateLegacyMarker(consumer_root);
419
358
  try {
420
- atomic_write_text(path2.join(consumer_root, pinLostMarker(session_id)), (/* @__PURE__ */ new Date()).toISOString());
359
+ atomic_write_text(path.join(consumer_root, pinLostMarker(session_id)), (/* @__PURE__ */ new Date()).toISOString());
421
360
  } catch {
422
361
  }
423
362
  }
424
363
  function _pinLost(consumer_root, session_id) {
425
364
  try {
426
- return fs2.existsSync(path2.join(consumer_root, pinLostMarker(session_id)));
365
+ return fs.existsSync(path.join(consumer_root, pinLostMarker(session_id)));
427
366
  } catch {
428
367
  return false;
429
368
  }
@@ -431,7 +370,7 @@ function _pinLost(consumer_root, session_id) {
431
370
  function _clearPinLost(consumer_root, session_id) {
432
371
  if (is_replay_mode()) return;
433
372
  try {
434
- fs2.rmSync(path2.join(consumer_root, pinLostMarker(session_id)), { force: true });
373
+ fs.rmSync(path.join(consumer_root, pinLostMarker(session_id)), { force: true });
435
374
  } catch {
436
375
  }
437
376
  }
@@ -439,7 +378,7 @@ function _reEmitAfterCompaction(consumer_root, session_id) {
439
378
  if (!_pinLost(consumer_root, session_id)) {
440
379
  return EXIT_ALLOW;
441
380
  }
442
- const previous = _loadState(path2.join(consumer_root, STATE_FILE));
381
+ const previous = _loadState(path.join(consumer_root, STATE_FILE));
443
382
  const language = previous.language;
444
383
  const source = previous.source === "system-locale" ? "system-locale" : "prompt";
445
384
  _clearPinLost(consumer_root, session_id);
@@ -485,7 +424,7 @@ function run(stdin_text, options) {
485
424
  return EXIT_ALLOW;
486
425
  }
487
426
  const session_id = typeof envelope["session_id"] === "string" ? envelope["session_id"] : "";
488
- const target = path2.join(options.consumer_root, STATE_FILE);
427
+ const target = path.join(options.consumer_root, STATE_FILE);
489
428
  const previous = _loadState(target);
490
429
  const classification = classify(prompt);
491
430
  const next = nextState(
@@ -537,13 +476,13 @@ function _isCliEntry() {
537
476
  if (process.argv[1] === void 0) {
538
477
  return false;
539
478
  }
540
- const argvUrl = pathToFileURL(path2.resolve(process.argv[1])).href;
479
+ const argvUrl = pathToFileURL(path.resolve(process.argv[1])).href;
541
480
  if (import.meta.url === argvUrl) {
542
481
  return true;
543
482
  }
544
483
  try {
545
- const here = fs2.realpathSync(fileURLToPath(import.meta.url));
546
- const argv = fs2.realpathSync(path2.resolve(process.argv[1]));
484
+ const here = fs.realpathSync(fileURLToPath(import.meta.url));
485
+ const argv = fs.realpathSync(path.resolve(process.argv[1]));
547
486
  return here === argv;
548
487
  } catch {
549
488
  return false;
@@ -554,11 +493,11 @@ if (_isCliEntry()) {
554
493
  }
555
494
 
556
495
  // src/scripts/git_authorization_hook.ts
557
- import fs3 from "node:fs";
558
- import path3 from "node:path";
496
+ import fs2 from "node:fs";
497
+ import path2 from "node:path";
559
498
  import { fileURLToPath as fileURLToPath2, pathToFileURL as pathToFileURL2 } from "node:url";
560
499
  var EXIT_ALLOW2 = 0;
561
- var STATE_FILE2 = path3.join("agents", "state", "git-authorization.json");
500
+ var STATE_FILE2 = path2.join("agents", "state", "git-authorization.json");
562
501
  function _isObject3(v) {
563
502
  return typeof v === "object" && v !== null && !Array.isArray(v);
564
503
  }
@@ -680,7 +619,7 @@ function run2(stdin_text, options) {
680
619
  prompt_chars: prompt.length
681
620
  };
682
621
  try {
683
- atomic_write_json(path3.join(options.consumer_root, STATE_FILE2), ledger);
622
+ atomic_write_json(path2.join(options.consumer_root, STATE_FILE2), ledger);
684
623
  } catch {
685
624
  }
686
625
  return EXIT_ALLOW2;
@@ -706,13 +645,13 @@ function _isCliEntry2() {
706
645
  if (process.argv[1] === void 0) {
707
646
  return false;
708
647
  }
709
- const argvUrl = pathToFileURL2(path3.resolve(process.argv[1])).href;
648
+ const argvUrl = pathToFileURL2(path2.resolve(process.argv[1])).href;
710
649
  if (import.meta.url === argvUrl) {
711
650
  return true;
712
651
  }
713
652
  try {
714
- const here = fs3.realpathSync(fileURLToPath2(import.meta.url));
715
- const argv = fs3.realpathSync(path3.resolve(process.argv[1]));
653
+ const here = fs2.realpathSync(fileURLToPath2(import.meta.url));
654
+ const argv = fs2.realpathSync(path2.resolve(process.argv[1]));
716
655
  return here === argv;
717
656
  } catch {
718
657
  return false;
@@ -723,8 +662,8 @@ if (_isCliEntry2()) {
723
662
  }
724
663
 
725
664
  // src/scripts/hooks/block_unauthorized_git.ts
726
- import fs4 from "node:fs";
727
- import path4 from "node:path";
665
+ import fs3 from "node:fs";
666
+ import path3 from "node:path";
728
667
  import { fileURLToPath as fileURLToPath3, pathToFileURL as pathToFileURL3 } from "node:url";
729
668
  var EXIT_ALLOW3 = 0;
730
669
  var EXIT_BLOCK = 1;
@@ -951,7 +890,7 @@ function commandOp(command) {
951
890
  var LEDGER_MAX_AGE_MS = 30 * 60 * 1e3;
952
891
  function _loadLedger(consumer_root, session_id, now) {
953
892
  try {
954
- const raw = fs4.readFileSync(path4.join(consumer_root, STATE_FILE2), "utf8");
893
+ const raw = fs3.readFileSync(path3.join(consumer_root, STATE_FILE2), "utf8");
955
894
  const decoded = JSON.parse(raw);
956
895
  if (_isObject4(decoded) && Array.isArray(decoded["authorized"])) {
957
896
  const ledgerSession = typeof decoded["session_id"] === "string" ? decoded["session_id"] : "";
@@ -1042,13 +981,13 @@ function _isCliEntry3() {
1042
981
  if (process.argv[1] === void 0) {
1043
982
  return false;
1044
983
  }
1045
- const argvUrl = pathToFileURL3(path4.resolve(process.argv[1])).href;
984
+ const argvUrl = pathToFileURL3(path3.resolve(process.argv[1])).href;
1046
985
  if (import.meta.url === argvUrl) {
1047
986
  return true;
1048
987
  }
1049
988
  try {
1050
- const here = fs4.realpathSync(fileURLToPath3(import.meta.url));
1051
- const argv = fs4.realpathSync(path4.resolve(process.argv[1]));
989
+ const here = fs3.realpathSync(fileURLToPath3(import.meta.url));
990
+ const argv = fs3.realpathSync(path3.resolve(process.argv[1]));
1052
991
  return here === argv;
1053
992
  } catch {
1054
993
  return false;
@@ -1059,10 +998,10 @@ if (_isCliEntry3()) {
1059
998
  }
1060
999
 
1061
1000
  // src/scripts/before_complete_hook.ts
1062
- import fs5 from "node:fs";
1063
- import path5 from "node:path";
1001
+ import fs4 from "node:fs";
1002
+ import path4 from "node:path";
1064
1003
  import { fileURLToPath as fileURLToPath4, pathToFileURL as pathToFileURL4 } from "node:url";
1065
- var STATE_FILE3 = path5.join("agents", "state", "verify-before-complete.json");
1004
+ var STATE_FILE3 = path4.join("agents", "state", "verify-before-complete.json");
1066
1005
  var COMMAND_TOOLS2 = /* @__PURE__ */ new Set([
1067
1006
  "launch-process",
1068
1007
  "launch_process",
@@ -1104,7 +1043,7 @@ function _empty_state() {
1104
1043
  function _load_state(target) {
1105
1044
  let isFile = false;
1106
1045
  try {
1107
- isFile = fs5.statSync(target).isFile();
1046
+ isFile = fs4.statSync(target).isFile();
1108
1047
  } catch {
1109
1048
  isFile = false;
1110
1049
  }
@@ -1112,7 +1051,7 @@ function _load_state(target) {
1112
1051
  return _empty_state();
1113
1052
  }
1114
1053
  try {
1115
- const decoded = JSON.parse(fs5.readFileSync(target, "utf-8"));
1054
+ const decoded = JSON.parse(fs4.readFileSync(target, "utf-8"));
1116
1055
  if (typeof decoded === "object" && decoded !== null && !Array.isArray(decoded)) {
1117
1056
  return { ..._empty_state(), ...decoded };
1118
1057
  }
@@ -1288,7 +1227,7 @@ function run4(stdin_text, options) {
1288
1227
  }
1289
1228
  }
1290
1229
  const event = envelope["event"] || "";
1291
- const target = path5.join(consumer_root, STATE_FILE3);
1230
+ const target = path4.join(consumer_root, STATE_FILE3);
1292
1231
  let state = _load_state(target);
1293
1232
  state = _update(state, event, envelope);
1294
1233
  try {
@@ -1346,13 +1285,13 @@ function _isCliEntry4() {
1346
1285
  if (process.argv[1] === void 0) {
1347
1286
  return false;
1348
1287
  }
1349
- const argvUrl = pathToFileURL4(path5.resolve(process.argv[1])).href;
1288
+ const argvUrl = pathToFileURL4(path4.resolve(process.argv[1])).href;
1350
1289
  if (import.meta.url === argvUrl) {
1351
1290
  return true;
1352
1291
  }
1353
1292
  try {
1354
- const here = fs5.realpathSync(fileURLToPath4(import.meta.url));
1355
- const argv = fs5.realpathSync(path5.resolve(process.argv[1]));
1293
+ const here = fs4.realpathSync(fileURLToPath4(import.meta.url));
1294
+ const argv = fs4.realpathSync(path4.resolve(process.argv[1]));
1356
1295
  return here === argv;
1357
1296
  } catch {
1358
1297
  return false;
@@ -1365,12 +1304,12 @@ if (isCliEntry) {
1365
1304
 
1366
1305
  // src/scripts/hooks/evidence_independence.ts
1367
1306
  import crypto from "node:crypto";
1368
- import fs6 from "node:fs";
1369
- import path6 from "node:path";
1307
+ import fs5 from "node:fs";
1308
+ import path5 from "node:path";
1370
1309
  import { fileURLToPath as fileURLToPath5, pathToFileURL as pathToFileURL5 } from "node:url";
1371
1310
  var EXIT_ALLOW4 = 0;
1372
1311
  var EXIT_BLOCK2 = 1;
1373
- var STATE_FILE4 = path6.join("agents", "state", "evidence-dispatch.json");
1312
+ var STATE_FILE4 = path5.join("agents", "state", "evidence-dispatch.json");
1374
1313
  function _isObject5(v) {
1375
1314
  return typeof v === "object" && v !== null && !Array.isArray(v);
1376
1315
  }
@@ -1438,8 +1377,8 @@ function extractDispatch(envelope) {
1438
1377
  }
1439
1378
  function _ledgerStamp(consumer_root) {
1440
1379
  try {
1441
- const raw = fs6.readFileSync(
1442
- path6.join(consumer_root, "agents", "state", "git-authorization.json"),
1380
+ const raw = fs5.readFileSync(
1381
+ path5.join(consumer_root, "agents", "state", "git-authorization.json"),
1443
1382
  "utf8"
1444
1383
  );
1445
1384
  const d = JSON.parse(raw);
@@ -1450,7 +1389,7 @@ function _ledgerStamp(consumer_root) {
1450
1389
  }
1451
1390
  function _load(target) {
1452
1391
  try {
1453
- const decoded = JSON.parse(fs6.readFileSync(target, "utf8"));
1392
+ const decoded = JSON.parse(fs5.readFileSync(target, "utf8"));
1454
1393
  if (_isObject5(decoded) && Array.isArray(decoded["evaluations"])) {
1455
1394
  return decoded;
1456
1395
  }
@@ -1505,7 +1444,7 @@ function run5(stdin_text, options) {
1505
1444
  return EXIT_ALLOW4;
1506
1445
  }
1507
1446
  }
1508
- const target = path6.join(options.consumer_root, STATE_FILE4);
1447
+ const target = path5.join(options.consumer_root, STATE_FILE4);
1509
1448
  const state = _load(target);
1510
1449
  const session_id = typeof envelope["session_id"] === "string" ? envelope["session_id"] : "";
1511
1450
  const turnMarker = `${session_id}:${_ledgerStamp(options.consumer_root)}`;
@@ -1556,13 +1495,13 @@ function _isCliEntry5() {
1556
1495
  if (process.argv[1] === void 0) {
1557
1496
  return false;
1558
1497
  }
1559
- const argvUrl = pathToFileURL5(path6.resolve(process.argv[1])).href;
1498
+ const argvUrl = pathToFileURL5(path5.resolve(process.argv[1])).href;
1560
1499
  if (import.meta.url === argvUrl) {
1561
1500
  return true;
1562
1501
  }
1563
1502
  try {
1564
- const here = fs6.realpathSync(fileURLToPath5(import.meta.url));
1565
- const argv = fs6.realpathSync(path6.resolve(process.argv[1]));
1503
+ const here = fs5.realpathSync(fileURLToPath5(import.meta.url));
1504
+ const argv = fs5.realpathSync(path5.resolve(process.argv[1]));
1566
1505
  return here === argv;
1567
1506
  } catch {
1568
1507
  return false;
@@ -1573,7 +1512,7 @@ if (_isCliEntry5()) {
1573
1512
  }
1574
1513
 
1575
1514
  // src/scripts/conformance_scan.ts
1576
- var REPO_ROOT = path7.resolve(path7.dirname(fileURLToPath6(import.meta.url)), "..", "..");
1515
+ var REPO_ROOT = path6.resolve(path6.dirname(fileURLToPath6(import.meta.url)), "..", "..");
1577
1516
  var OBSERVED_BAND = { low: 9.1, high: 39.2 };
1578
1517
  var BAND_MIN_TURNS = 1978;
1579
1518
  function bandVerdict(rate_pct, assistant_turns) {
@@ -1582,6 +1521,46 @@ function bandVerdict(rate_pct, assistant_turns) {
1582
1521
  }
1583
1522
  return rate_pct >= OBSERVED_BAND.low && rate_pct <= OBSERVED_BAND.high ? "inside" : "outside";
1584
1523
  }
1524
+ var CHECK_IDS = [
1525
+ "language-pin",
1526
+ "git-authorization",
1527
+ "vacuous-evidence",
1528
+ "evidence-steering"
1529
+ ];
1530
+ var CHECK_MEANINGS = {
1531
+ "language-pin": "An assistant turn whose user-visible prose is not in the language that turn's own pin named. Carries provenance (turns_since_prompt, compaction_since_prompt) so a pin that was ABSENT because compaction removed it stays distinguishable from one that was present and ignored.",
1532
+ "git-authorization": "A gated git operation performed in a session where no authorization for that operation was observed. Authorization is per-operation and never carries from one to the next.",
1533
+ "vacuous-evidence": "A CI poll read as settled without ever observing an in-flight run \u2014 the poll gap that reports a green settle over a window in which nothing was pending yet.",
1534
+ "evidence-steering": "A self-commissioned evaluation whose prompt pre-loaded its own verdict, or a second self-scoped evaluation of the same subject within one turn."
1535
+ };
1536
+ function renderWhy(report, id) {
1537
+ const hits = report.per_session.flatMap((s) => s.violations.filter((v) => v.check === id));
1538
+ const lines = [
1539
+ `conformance:why \xB7 ${id} \xB7 ${report.sessions} session(s) \xB7 ${report.store}`,
1540
+ "",
1541
+ " What it detects:",
1542
+ ` ${CHECK_MEANINGS[id]}`,
1543
+ ""
1544
+ ];
1545
+ if (hits.length === 0) {
1546
+ lines.push(` Did NOT fire in this window (0 hits over ${report.sessions} session(s)).`);
1547
+ lines.push(" A measured zero, not an unmeasured one \u2014 the check ran.");
1548
+ return lines.join("\n");
1549
+ }
1550
+ lines.push(` Fired ${hits.length} time(s):`);
1551
+ for (const v of hits) {
1552
+ lines.push(` \xB7 ${v.session} @ ${v.at}`);
1553
+ lines.push(` ${v.detail}`);
1554
+ const since = v.turns_since_prompt;
1555
+ const compacted = v.compaction_since_prompt;
1556
+ if (since !== void 0 || compacted !== void 0) {
1557
+ lines.push(
1558
+ ` provenance: turns_since_prompt=${since ?? "\u2014"} \xB7 compaction_since_prompt=${compacted ?? "\u2014"}`
1559
+ );
1560
+ }
1561
+ }
1562
+ return lines.join("\n");
1563
+ }
1585
1564
  function _isObject6(v) {
1586
1565
  return typeof v === "object" && v !== null && !Array.isArray(v);
1587
1566
  }
@@ -1763,7 +1742,7 @@ function scanSession(sessionId, lines) {
1763
1742
  }
1764
1743
  return report;
1765
1744
  }
1766
- var DEFAULT_RATE_SERIES = path7.join(
1745
+ var DEFAULT_RATE_SERIES = path6.join(
1767
1746
  REPO_ROOT,
1768
1747
  "agents",
1769
1748
  "runtime",
@@ -1772,7 +1751,7 @@ var DEFAULT_RATE_SERIES = path7.join(
1772
1751
  );
1773
1752
  function defaultStore(projectDir) {
1774
1753
  const slug = projectDir.replace(/[/.]/g, "-");
1775
- return path7.join(process.env["HOME"] ?? "", ".claude", "projects", slug);
1754
+ return path6.join(process.env["HOME"] ?? "", ".claude", "projects", slug);
1776
1755
  }
1777
1756
  function _tokens(chars) {
1778
1757
  return Math.round(chars / 4);
@@ -1783,13 +1762,13 @@ function measureDelivered(projectRulesDir, globalRulesDir) {
1783
1762
  return {
1784
1763
  project: {
1785
1764
  dir: projectRulesDir,
1786
- present: fs7.existsSync(projectRulesDir),
1765
+ present: fs6.existsSync(projectRulesDir),
1787
1766
  files: p.files,
1788
1767
  tokens: _tokens(p.chars)
1789
1768
  },
1790
1769
  global: {
1791
1770
  dir: globalRulesDir,
1792
- present: fs7.existsSync(globalRulesDir),
1771
+ present: fs6.existsSync(globalRulesDir),
1793
1772
  files: g.files,
1794
1773
  tokens: _tokens(g.chars)
1795
1774
  },
@@ -1797,13 +1776,13 @@ function measureDelivered(projectRulesDir, globalRulesDir) {
1797
1776
  };
1798
1777
  }
1799
1778
  function storeKey(store) {
1800
- return createHash("sha256").update(path7.resolve(store)).digest("hex").slice(0, 12);
1779
+ return createHash("sha256").update(path6.resolve(store)).digest("hex").slice(0, 12);
1801
1780
  }
1802
1781
  function scanStore(store, limit) {
1803
- const files = fs7.readdirSync(store).filter((f) => f.endsWith(".jsonl")).map((f) => ({ f, m: fs7.statSync(path7.join(store, f)).mtimeMs })).sort((a, b) => b.m - a.m).slice(0, limit).map((x) => x.f);
1782
+ const files = fs6.readdirSync(store).filter((f) => f.endsWith(".jsonl")).map((f) => ({ f, m: fs6.statSync(path6.join(store, f)).mtimeMs })).sort((a, b) => b.m - a.m).slice(0, limit).map((x) => x.f);
1804
1783
  const per_session = [];
1805
1784
  for (const f of files) {
1806
- const lines = fs7.readFileSync(path7.join(store, f), "utf8").split("\n");
1785
+ const lines = fs6.readFileSync(path6.join(store, f), "utf8").split("\n");
1807
1786
  const r = scanSession(f.replace(/\.jsonl$/, "").slice(0, 8), lines);
1808
1787
  if (r.assistant_turns > 0) {
1809
1788
  per_session.push(r);
@@ -1824,10 +1803,10 @@ function scanStore(store, limit) {
1824
1803
  const language_pin = totals["language-pin"] ?? 0;
1825
1804
  const rate_pct = assistant_turns === 0 ? 0 : Number((100 * language_pin / assistant_turns).toFixed(1));
1826
1805
  const delivered = measureDelivered(
1827
- path7.join(REPO_ROOT, ".claude", "rules"),
1828
- path7.join(process.env["HOME"] ?? os.homedir(), ".claude", "rules")
1806
+ path6.join(REPO_ROOT, ".claude", "rules"),
1807
+ path6.join(process.env["HOME"] ?? os.homedir(), ".claude", "rules")
1829
1808
  );
1830
- const ownStore = path7.resolve(store) === path7.resolve(defaultStore(REPO_ROOT));
1809
+ const ownStore = path6.resolve(store) === path6.resolve(defaultStore(REPO_ROOT));
1831
1810
  return {
1832
1811
  scanned_at: (/* @__PURE__ */ new Date()).toISOString(),
1833
1812
  store,
@@ -1850,8 +1829,8 @@ function scanStore(store, limit) {
1850
1829
  };
1851
1830
  }
1852
1831
  function recordRate(file, scanned_at, rate) {
1853
- fs7.mkdirSync(path7.dirname(file), { recursive: true });
1854
- fs7.appendFileSync(file, `${JSON.stringify({ measured_at: scanned_at, ...rate })}
1832
+ fs6.mkdirSync(path6.dirname(file), { recursive: true });
1833
+ fs6.appendFileSync(file, `${JSON.stringify({ measured_at: scanned_at, ...rate })}
1855
1834
  `, "utf8");
1856
1835
  }
1857
1836
  function render(report) {
@@ -1915,6 +1894,7 @@ function main6(argv) {
1915
1894
  let json = false;
1916
1895
  let out = null;
1917
1896
  let record = null;
1897
+ let why = null;
1918
1898
  for (let i = 0; i < args.length; i += 1) {
1919
1899
  const a = args[i];
1920
1900
  if (a === "--store" && args[i + 1] !== void 0) {
@@ -1925,25 +1905,56 @@ function main6(argv) {
1925
1905
  json = true;
1926
1906
  } else if (a === "--output" && args[i + 1] !== void 0) {
1927
1907
  out = args[++i];
1908
+ } else if (a === "--why" && args[i + 1] !== void 0) {
1909
+ why = args[++i];
1928
1910
  } else if (a === "--record") {
1929
1911
  record = args[i + 1] !== void 0 && !args[i + 1].startsWith("-") ? args[++i] : DEFAULT_RATE_SERIES;
1930
1912
  }
1931
1913
  }
1914
+ if (why !== null && !CHECK_IDS.includes(why)) {
1915
+ process.stderr.write(
1916
+ `conformance:why: unknown check id ${JSON.stringify(why)} \u2014 known ids: ${CHECK_IDS.join(", ")}
1917
+ `
1918
+ );
1919
+ return 2;
1920
+ }
1932
1921
  const resolved = store ?? defaultStore(process.cwd());
1933
- if (!fs7.existsSync(resolved)) {
1922
+ if (!fs6.existsSync(resolved)) {
1934
1923
  process.stderr.write(`conformance:behavior: no transcript store at ${resolved}
1935
1924
  `);
1936
1925
  return 1;
1937
1926
  }
1938
1927
  const report = scanStore(resolved, Number.isFinite(limit) && limit > 0 ? limit : 30);
1939
1928
  if (out) {
1940
- fs7.writeFileSync(out, `${JSON.stringify(report, null, 2)}
1929
+ fs6.writeFileSync(out, `${JSON.stringify(report, null, 2)}
1941
1930
  `, "utf8");
1942
1931
  }
1943
1932
  if (record) {
1944
1933
  recordRate(record, report.scanned_at, report.rate);
1945
1934
  }
1946
- fs7.writeSync(1, json ? `${JSON.stringify(report, null, 2)}
1935
+ if (why !== null) {
1936
+ const id = why;
1937
+ fs6.writeSync(
1938
+ 1,
1939
+ json ? `${JSON.stringify(
1940
+ {
1941
+ check: id,
1942
+ meaning: CHECK_MEANINGS[id],
1943
+ store: report.store,
1944
+ sessions: report.sessions,
1945
+ hits: report.per_session.flatMap(
1946
+ (s) => s.violations.filter((v) => v.check === id)
1947
+ )
1948
+ },
1949
+ null,
1950
+ 2
1951
+ )}
1952
+ ` : `${renderWhy(report, id)}
1953
+ `
1954
+ );
1955
+ return 0;
1956
+ }
1957
+ fs6.writeSync(1, json ? `${JSON.stringify(report, null, 2)}
1947
1958
  ` : `${render(report)}
1948
1959
  `);
1949
1960
  return 0;
@@ -1955,13 +1966,13 @@ function _isCliEntry6() {
1955
1966
  if (process.argv[1] === void 0) {
1956
1967
  return false;
1957
1968
  }
1958
- const argvUrl = pathToFileURL6(path7.resolve(process.argv[1])).href;
1969
+ const argvUrl = pathToFileURL6(path6.resolve(process.argv[1])).href;
1959
1970
  if (import.meta.url === argvUrl) {
1960
1971
  return true;
1961
1972
  }
1962
1973
  try {
1963
- const here = fs7.realpathSync(fileURLToPath6(import.meta.url));
1964
- const argv = fs7.realpathSync(path7.resolve(process.argv[1]));
1974
+ const here = fs6.realpathSync(fileURLToPath6(import.meta.url));
1975
+ const argv = fs6.realpathSync(path6.resolve(process.argv[1]));
1965
1976
  return here === argv;
1966
1977
  } catch {
1967
1978
  return false;
@@ -1972,19 +1983,19 @@ if (_isCliEntry6()) {
1972
1983
  }
1973
1984
 
1974
1985
  // src/scripts/report_carrier_divergence.ts
1975
- import * as fs8 from "node:fs";
1986
+ import * as fs7 from "node:fs";
1976
1987
  import * as os2 from "node:os";
1977
- import * as path8 from "node:path";
1988
+ import * as path7 from "node:path";
1978
1989
  import process2 from "node:process";
1979
1990
  import { fileURLToPath as fileURLToPath7, pathToFileURL as pathToFileURL7 } from "node:url";
1980
1991
  var _HERE = fileURLToPath7(import.meta.url);
1981
- var REPO_ROOT2 = path8.resolve(path8.dirname(_HERE), "..", "..");
1982
- var PROJECT_RULES = path8.join(".claude", "rules");
1983
- var PROJECTION_SOURCE = path8.join("dist", "agent-src", "rules");
1984
- var GLOBAL_RULES = path8.join(".claude", "rules");
1992
+ var REPO_ROOT2 = path7.resolve(path7.dirname(_HERE), "..", "..");
1993
+ var PROJECT_RULES = path7.join(".claude", "rules");
1994
+ var PROJECTION_SOURCE = path7.join("dist", "agent-src", "rules");
1995
+ var GLOBAL_RULES = path7.join(".claude", "rules");
1985
1996
  function _listRules(dir) {
1986
1997
  try {
1987
- return fs8.readdirSync(dir).filter((f) => f.endsWith(".md")).sort();
1998
+ return fs7.readdirSync(dir).filter((f) => f.endsWith(".md")).sort();
1988
1999
  } catch {
1989
2000
  return [];
1990
2001
  }
@@ -1992,7 +2003,7 @@ function _listRules(dir) {
1992
2003
  function _ruleType(file) {
1993
2004
  let text;
1994
2005
  try {
1995
- text = fs8.readFileSync(file, "utf-8");
2006
+ text = fs7.readFileSync(file, "utf-8");
1996
2007
  } catch {
1997
2008
  return "";
1998
2009
  }
@@ -2003,8 +2014,8 @@ function compareCarriers(projectDir, globalDir, sourceDir) {
2003
2014
  const out = {
2004
2015
  projectDir,
2005
2016
  globalDir,
2006
- globalPresent: fs8.existsSync(globalDir),
2007
- projectPresent: fs8.existsSync(projectDir),
2017
+ globalPresent: fs7.existsSync(globalDir),
2018
+ projectPresent: fs7.existsSync(projectDir),
2008
2019
  shared: 0,
2009
2020
  identical: [],
2010
2021
  provenanceOnly: [],
@@ -2027,7 +2038,7 @@ function compareCarriers(projectDir, globalDir, sourceDir) {
2027
2038
  }
2028
2039
  if (!inP && inG) {
2029
2040
  out.globalOnly.push(rule);
2030
- if (sourceDir !== void 0 && _ruleType(path8.join(sourceDir, rule)) === "manual") {
2041
+ if (sourceDir !== void 0 && _ruleType(path7.join(sourceDir, rule)) === "manual") {
2031
2042
  out.manualOnlyGlobal.push(rule);
2032
2043
  }
2033
2044
  continue;
@@ -2037,8 +2048,8 @@ function compareCarriers(projectDir, globalDir, sourceDir) {
2037
2048
  let projectCopy;
2038
2049
  let globalCopy;
2039
2050
  try {
2040
- projectCopy = fs8.readFileSync(path8.join(projectDir, rule));
2041
- globalCopy = fs8.readFileSync(path8.join(globalDir, rule));
2051
+ projectCopy = fs7.readFileSync(path7.join(projectDir, rule));
2052
+ globalCopy = fs7.readFileSync(path7.join(globalDir, rule));
2042
2053
  verdict = comparePair(projectCopy, globalCopy);
2043
2054
  } catch {
2044
2055
  out.shared -= 1;
@@ -2185,9 +2196,9 @@ function render2(d) {
2185
2196
  }
2186
2197
  function main7(argv) {
2187
2198
  const args = argv ?? process2.argv.slice(2);
2188
- let projectDir = path8.join(REPO_ROOT2, PROJECT_RULES);
2189
- let globalDir = path8.join(os2.homedir(), GLOBAL_RULES);
2190
- let sourceDir = path8.join(REPO_ROOT2, PROJECTION_SOURCE);
2199
+ let projectDir = path7.join(REPO_ROOT2, PROJECT_RULES);
2200
+ let globalDir = path7.join(os2.homedir(), GLOBAL_RULES);
2201
+ let sourceDir = path7.join(REPO_ROOT2, PROJECTION_SOURCE);
2191
2202
  const value = (i) => {
2192
2203
  const v = args[i + 1];
2193
2204
  return v === void 0 || v.startsWith("-") ? null : v;
@@ -2201,7 +2212,7 @@ function main7(argv) {
2201
2212
  `);
2202
2213
  return 1;
2203
2214
  }
2204
- const resolved = path8.resolve(v);
2215
+ const resolved = path7.resolve(v);
2205
2216
  if (a === "--project") projectDir = resolved;
2206
2217
  else if (a === "--global") globalDir = resolved;
2207
2218
  else sourceDir = resolved;
@@ -2223,9 +2234,9 @@ function main7(argv) {
2223
2234
  }
2224
2235
  function _isCliEntry7() {
2225
2236
  if (process2.argv[1] === void 0) return false;
2226
- if (import.meta.url === pathToFileURL7(path8.resolve(process2.argv[1])).href) return true;
2237
+ if (import.meta.url === pathToFileURL7(path7.resolve(process2.argv[1])).href) return true;
2227
2238
  try {
2228
- return fs8.realpathSync(_HERE) === fs8.realpathSync(path8.resolve(process2.argv[1]));
2239
+ return fs7.realpathSync(_HERE) === fs7.realpathSync(path7.resolve(process2.argv[1]));
2229
2240
  } catch {
2230
2241
  return false;
2231
2242
  }
@@ -2235,30 +2246,30 @@ if (_isCliEntry7()) {
2235
2246
  }
2236
2247
 
2237
2248
  // src/scripts/report_skill_activation.ts
2238
- import * as fs9 from "node:fs";
2249
+ import * as fs8 from "node:fs";
2239
2250
  import * as os3 from "node:os";
2240
- import * as path9 from "node:path";
2251
+ import * as path8 from "node:path";
2241
2252
  import { fileURLToPath as fileURLToPath8, pathToFileURL as pathToFileURL8 } from "node:url";
2242
2253
  var _HERE2 = fileURLToPath8(import.meta.url);
2243
- var REPO_ROOT3 = path9.resolve(path9.dirname(_HERE2), "..", "..");
2254
+ var REPO_ROOT3 = path8.resolve(path8.dirname(_HERE2), "..", "..");
2244
2255
  var SKILLS_ROOT = "src/skills";
2245
2256
  var TRIGGER_KEYS = ["triggers:", "trigger_description:", "file_pattern:", "path_prefix:"];
2246
2257
  var DETERMINISTIC_RE = /^\s*(?:[-*]\s*)?(?:\*\*)?(MUST|NEVER|ALWAYS)\b/m;
2247
2258
  function censusSkills(root) {
2248
2259
  const out = { total: 0, withTriggerKey: [], withDeterministicObligation: [] };
2249
- if (!fs9.existsSync(root)) {
2260
+ if (!fs8.existsSync(root)) {
2250
2261
  return out;
2251
2262
  }
2252
- for (const entry of fs9.readdirSync(root, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name))) {
2263
+ for (const entry of fs8.readdirSync(root, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name))) {
2253
2264
  if (!entry.isDirectory()) {
2254
2265
  continue;
2255
2266
  }
2256
- const file = path9.join(root, entry.name, "SKILL.md");
2257
- if (!fs9.existsSync(file)) {
2267
+ const file = path8.join(root, entry.name, "SKILL.md");
2268
+ if (!fs8.existsSync(file)) {
2258
2269
  continue;
2259
2270
  }
2260
2271
  out.total += 1;
2261
- const text = fs9.readFileSync(file, "utf8");
2272
+ const text = fs8.readFileSync(file, "utf8");
2262
2273
  const fmEnd = text.startsWith("---") ? text.indexOf("\n---", 3) : -1;
2263
2274
  const fm = fmEnd === -1 ? "" : text.slice(0, fmEnd);
2264
2275
  if (TRIGGER_KEYS.some((k) => new RegExp(`^${k}`, "m").test(fm))) {
@@ -2272,17 +2283,17 @@ function censusSkills(root) {
2272
2283
  return out;
2273
2284
  }
2274
2285
  function defaultStore2(cwd) {
2275
- return path9.join(os3.homedir(), ".claude", "projects", cwd.replace(/\//g, "-"));
2286
+ return path8.join(os3.homedir(), ".claude", "projects", cwd.replace(/\//g, "-"));
2276
2287
  }
2277
2288
  function measureUsage(store, limit) {
2278
2289
  const rep = { store, sessions: 0, assistantTurns: 0, invocations: 0, bySkill: {} };
2279
- if (!fs9.existsSync(store)) {
2290
+ if (!fs8.existsSync(store)) {
2280
2291
  return rep;
2281
2292
  }
2282
- const files = fs9.readdirSync(store).filter((f) => f.endsWith(".jsonl")).map((f) => path9.join(store, f)).sort((a, b) => fs9.statSync(b).mtimeMs - fs9.statSync(a).mtimeMs).slice(0, limit);
2293
+ const files = fs8.readdirSync(store).filter((f) => f.endsWith(".jsonl")).map((f) => path8.join(store, f)).sort((a, b) => fs8.statSync(b).mtimeMs - fs8.statSync(a).mtimeMs).slice(0, limit);
2283
2294
  rep.sessions = files.length;
2284
2295
  for (const file of files) {
2285
- for (const line of fs9.readFileSync(file, "utf8").split("\n")) {
2296
+ for (const line of fs8.readFileSync(file, "utf8").split("\n")) {
2286
2297
  if (!line.trim()) {
2287
2298
  continue;
2288
2299
  }
@@ -2345,7 +2356,7 @@ function render3(census, usage) {
2345
2356
  }
2346
2357
  totalInv += u.invocations;
2347
2358
  lines.push(
2348
- ` ${path9.basename(u.store).slice(-38).padEnd(38)} sessions=${String(u.sessions).padStart(3)} asst=${String(u.assistantTurns).padStart(6)} Skill calls=${String(u.invocations).padStart(3)}`
2359
+ ` ${path8.basename(u.store).slice(-38).padEnd(38)} sessions=${String(u.sessions).padStart(3)} asst=${String(u.assistantTurns).padStart(6)} Skill calls=${String(u.invocations).padStart(3)}`
2349
2360
  );
2350
2361
  }
2351
2362
  lines.push("");
@@ -2393,24 +2404,24 @@ function main8(argv) {
2393
2404
  if (stores.length === 0) {
2394
2405
  stores.push(defaultStore2(REPO_ROOT3));
2395
2406
  }
2396
- const census = censusSkills(path9.join(REPO_ROOT3, SKILLS_ROOT));
2407
+ const census = censusSkills(path8.join(REPO_ROOT3, SKILLS_ROOT));
2397
2408
  const usage = stores.map((s) => measureUsage(s, limit));
2398
2409
  process.stdout.write(`${render3(census, usage)}
2399
2410
  `);
2400
2411
  return 0;
2401
2412
  }
2402
- if (process.argv[1] !== void 0 && import.meta.url === pathToFileURL8(path9.resolve(process.argv[1])).href) {
2413
+ if (process.argv[1] !== void 0 && import.meta.url === pathToFileURL8(path8.resolve(process.argv[1])).href) {
2403
2414
  process.exit(main8(process.argv.slice(2)));
2404
2415
  }
2405
2416
 
2406
2417
  // src/scripts/report_skill_obligation_violations.ts
2407
- import * as fs10 from "node:fs";
2418
+ import * as fs9 from "node:fs";
2408
2419
  import * as os4 from "node:os";
2409
- import * as path10 from "node:path";
2420
+ import * as path9 from "node:path";
2410
2421
  import process3 from "node:process";
2411
2422
  import { fileURLToPath as fileURLToPath9, pathToFileURL as pathToFileURL9 } from "node:url";
2412
2423
  var _HERE3 = fileURLToPath9(import.meta.url);
2413
- var REPO_ROOT4 = path10.resolve(path10.dirname(_HERE3), "..", "..");
2424
+ var REPO_ROOT4 = path9.resolve(path9.dirname(_HERE3), "..", "..");
2414
2425
  var OBLIGATION_LINE_RE = new RegExp(`${DETERMINISTIC_RE.source}.*`, "gm");
2415
2426
  var PATH_RE = /`([A-Za-z0-9_./-]*\/[A-Za-z0-9_.-]+\.[a-z]{2,6})`/g;
2416
2427
  var CMD_RE = /`([a-z][a-z0-9-]*(?: [a-z][a-z0-9:._-]*){1,3})`/g;
@@ -2448,7 +2459,7 @@ function _artefacts(line) {
2448
2459
  return out;
2449
2460
  }
2450
2461
  function extractObligations(repoRoot) {
2451
- const skillsRoot = path10.join(repoRoot, SKILLS_ROOT);
2462
+ const skillsRoot = path9.join(repoRoot, SKILLS_ROOT);
2452
2463
  const census = censusSkills(skillsRoot);
2453
2464
  const out = {
2454
2465
  skills: census.withDeterministicObligation,
@@ -2462,7 +2473,7 @@ function extractObligations(repoRoot) {
2462
2473
  for (const skill of census.withDeterministicObligation) {
2463
2474
  let text;
2464
2475
  try {
2465
- text = fs10.readFileSync(path10.join(skillsRoot, skill, "SKILL.md"), "utf-8");
2476
+ text = fs9.readFileSync(path9.join(skillsRoot, skill, "SKILL.md"), "utf-8");
2466
2477
  } catch {
2467
2478
  continue;
2468
2479
  }
@@ -2578,7 +2589,7 @@ function scanSessionForViolations(session, lines, forbidden, parsed) {
2578
2589
  return flags;
2579
2590
  }
2580
2591
  function defaultStore3(cwd) {
2581
- return path10.join(os4.homedir(), ".claude", "projects", cwd.replace(/[/.]/g, "-"));
2592
+ return path9.join(os4.homedir(), ".claude", "projects", cwd.replace(/[/.]/g, "-"));
2582
2593
  }
2583
2594
  function scanStore2(repoRoot, store, limit) {
2584
2595
  const census = extractObligations(repoRoot);
@@ -2591,14 +2602,14 @@ function scanStore2(repoRoot, store, limit) {
2591
2602
  };
2592
2603
  let files;
2593
2604
  try {
2594
- files = fs10.readdirSync(store).filter((f) => f.endsWith(".jsonl")).map((f) => ({ p: path10.join(store, f), m: fs10.statSync(path10.join(store, f)).mtimeMs })).sort((a, b) => b.m - a.m).slice(0, limit).map((x) => x.p);
2605
+ files = fs9.readdirSync(store).filter((f) => f.endsWith(".jsonl")).map((f) => ({ p: path9.join(store, f), m: fs9.statSync(path9.join(store, f)).mtimeMs })).sort((a, b) => b.m - a.m).slice(0, limit).map((x) => x.p);
2595
2606
  } catch {
2596
2607
  return report;
2597
2608
  }
2598
2609
  report.sessions = files.length;
2599
2610
  for (const file of files) {
2600
- const lines = fs10.readFileSync(file, "utf-8").split("\n");
2601
- const id = path10.basename(file).replace(/\.jsonl$/, "").slice(0, 8);
2611
+ const lines = fs9.readFileSync(file, "utf-8").split("\n");
2612
+ const id = path9.basename(file).replace(/\.jsonl$/, "").slice(0, 8);
2602
2613
  const entries = _parseSession(lines);
2603
2614
  if (loadedSkillsFrom(entries).size > 0) report.sessionsWithASkill += 1;
2604
2615
  report.flags.push(...scanSessionForViolations(id, lines, census.forbidden, entries));
@@ -2723,9 +2734,9 @@ function main9(argv) {
2723
2734
  }
2724
2735
  function _isCliEntry8() {
2725
2736
  if (process3.argv[1] === void 0) return false;
2726
- if (import.meta.url === pathToFileURL9(path10.resolve(process3.argv[1])).href) return true;
2737
+ if (import.meta.url === pathToFileURL9(path9.resolve(process3.argv[1])).href) return true;
2727
2738
  try {
2728
- return fs10.realpathSync(_HERE3) === fs10.realpathSync(path10.resolve(process3.argv[1]));
2739
+ return fs9.realpathSync(_HERE3) === fs9.realpathSync(path9.resolve(process3.argv[1]));
2729
2740
  } catch {
2730
2741
  return false;
2731
2742
  }
@@ -2736,20 +2747,20 @@ if (_isCliEntry8()) {
2736
2747
 
2737
2748
  // src/scripts/report_conformance_funnel.ts
2738
2749
  var _HERE4 = fileURLToPath10(import.meta.url);
2739
- var REPO_ROOT5 = path11.resolve(path11.dirname(_HERE4), "..", "..");
2750
+ var REPO_ROOT5 = path10.resolve(path10.dirname(_HERE4), "..", "..");
2740
2751
  function buildFunnel(opts = {}) {
2741
2752
  const repoRoot = opts.repoRoot ?? REPO_ROOT5;
2742
- const projectRulesDir = opts.projectRulesDir ?? path11.join(repoRoot, PROJECT_RULES);
2743
- const globalRulesDir = opts.globalRulesDir ?? path11.join(os5.homedir(), GLOBAL_RULES);
2744
- const sourceDir = opts.sourceDir ?? path11.join(repoRoot, PROJECTION_SOURCE);
2753
+ const projectRulesDir = opts.projectRulesDir ?? path10.join(repoRoot, PROJECT_RULES);
2754
+ const globalRulesDir = opts.globalRulesDir ?? path10.join(os5.homedir(), GLOBAL_RULES);
2755
+ const sourceDir = opts.sourceDir ?? path10.join(repoRoot, PROJECTION_SOURCE);
2745
2756
  const store = opts.store ?? defaultStore(repoRoot);
2746
2757
  const limit = opts.limit ?? 30;
2747
2758
  return {
2748
2759
  delivered: measureDelivered(projectRulesDir, globalRulesDir),
2749
2760
  divergence: compareCarriers(projectRulesDir, globalRulesDir, sourceDir),
2750
- skills: censusSkills(path11.join(repoRoot, SKILLS_ROOT)),
2761
+ skills: censusSkills(path10.join(repoRoot, SKILLS_ROOT)),
2751
2762
  usage: measureUsage(store, limit),
2752
- storePresent: fs11.existsSync(store),
2763
+ storePresent: fs10.existsSync(store),
2753
2764
  sk2: scanStore2(repoRoot, store, limit)
2754
2765
  };
2755
2766
  }
@@ -2805,6 +2816,25 @@ function render5(r) {
2805
2816
  }
2806
2817
  }
2807
2818
  lines.push("");
2819
+ lines.push("OPPORTUNITY \u2014 in how many sessions could a skill fire at all?");
2820
+ if (!r.storePresent) {
2821
+ lines.push(" NO DATA: no transcript store \u2014 opportunity is not measurable here.");
2822
+ lines.push(" An absent store is an answer, not a zero.");
2823
+ } else {
2824
+ lines.push(` sessions scanned ${r.sk2.sessions}`);
2825
+ lines.push(
2826
+ ` with a skill in context ${r.sk2.sessionsWithASkill} (${_pct3(r.sk2.sessionsWithASkill, r.sk2.sessions)})`
2827
+ );
2828
+ lines.push(
2829
+ " Skill invocations per such session " + (r.sk2.sessionsWithASkill === 0 ? "n/a" : (r.usage.invocations / r.sk2.sessionsWithASkill).toFixed(2))
2830
+ );
2831
+ }
2832
+ lines.push(` Honest scope: "in context" is the SK-2 scan's reading \u2014 a skill was`);
2833
+ lines.push(" LOADED, not that the task needed it. So this bounds activation from");
2834
+ lines.push(" above; it never claims a missed invocation was a defect. Report-only and");
2835
+ lines.push(" deliberately without a threshold: a joined funnel with a denominator");
2836
+ lines.push(" invites one, and the activation red-baseline null is terminal.");
2837
+ lines.push("");
2808
2838
  lines.push("ACTIVATION \u2014 are the delivered skills invoked?");
2809
2839
  lines.push(` skills shipped ${r.skills.total}`);
2810
2840
  lines.push(
@@ -2871,7 +2901,7 @@ function main10(argv) {
2871
2901
  `);
2872
2902
  return 1;
2873
2903
  }
2874
- const resolved = path11.resolve(v);
2904
+ const resolved = path10.resolve(v);
2875
2905
  if (a === "--store") opts.store = resolved;
2876
2906
  else if (a === "--project") opts.projectRulesDir = resolved;
2877
2907
  else if (a === "--global") opts.globalRulesDir = resolved;
@@ -2903,9 +2933,9 @@ function main10(argv) {
2903
2933
  }
2904
2934
  function _isCliEntry9() {
2905
2935
  if (process4.argv[1] === void 0) return false;
2906
- if (import.meta.url === pathToFileURL10(path11.resolve(process4.argv[1])).href) return true;
2936
+ if (import.meta.url === pathToFileURL10(path10.resolve(process4.argv[1])).href) return true;
2907
2937
  try {
2908
- return fs11.realpathSync(_HERE4) === fs11.realpathSync(path11.resolve(process4.argv[1]));
2938
+ return fs10.realpathSync(_HERE4) === fs10.realpathSync(path10.resolve(process4.argv[1]));
2909
2939
  } catch {
2910
2940
  return false;
2911
2941
  }
@@ -2938,17 +2968,17 @@ function conformanceLogPath() {
2938
2968
  if (override && override.trim().length > 0) {
2939
2969
  return override;
2940
2970
  }
2941
- return path12.join(os6.homedir(), ".event4u", "agent-config", "conformance-log.jsonl");
2971
+ return path11.join(os6.homedir(), ".event4u", "agent-config", "conformance-log.jsonl");
2942
2972
  }
2943
2973
  function installLogPath() {
2944
2974
  const override = process5.env["AGENT_CONFIG_INSTALL_LOG"];
2945
2975
  if (override && override.trim().length > 0) {
2946
2976
  return override;
2947
2977
  }
2948
- return path12.join(os6.homedir(), ".event4u", "agent-config", "install-log.jsonl");
2978
+ return path11.join(os6.homedir(), ".event4u", "agent-config", "install-log.jsonl");
2949
2979
  }
2950
2980
  function _check_txlog_clean(logPath = installLogPath()) {
2951
- if (!fs12.existsSync(logPath)) {
2981
+ if (!fs11.existsSync(logPath)) {
2952
2982
  return {
2953
2983
  id: "txlog-clean",
2954
2984
  status: "ok",
@@ -2982,11 +3012,11 @@ function _check_txlog_clean(logPath = installLogPath()) {
2982
3012
  };
2983
3013
  }
2984
3014
  function routeTargetPaths(target) {
2985
- return routeTargetPathsPosix(target).map((rel) => path12.join(...rel.split("/")));
3015
+ return routeTargetPathsPosix(target).map((rel) => path11.join(...rel.split("/")));
2986
3016
  }
2987
3017
  function _check_router_pointers(packageRoot = PACKAGE_ROOT) {
2988
- const routerPath = path12.join(packageRoot, "dist", "router.json");
2989
- if (!fs12.existsSync(routerPath)) {
3018
+ const routerPath = path11.join(packageRoot, "dist", "router.json");
3019
+ if (!fs11.existsSync(routerPath)) {
2990
3020
  return {
2991
3021
  id: "router-pointers",
2992
3022
  status: "fail",
@@ -2996,7 +3026,7 @@ function _check_router_pointers(packageRoot = PACKAGE_ROOT) {
2996
3026
  }
2997
3027
  let router;
2998
3028
  try {
2999
- router = JSON.parse(fs12.readFileSync(routerPath, "utf8"));
3029
+ router = JSON.parse(fs11.readFileSync(routerPath, "utf8"));
3000
3030
  } catch (exc) {
3001
3031
  return {
3002
3032
  id: "router-pointers",
@@ -3005,13 +3035,13 @@ function _check_router_pointers(packageRoot = PACKAGE_ROOT) {
3005
3035
  remedy: "reinstall the package \u2014 dist/router.json is corrupt"
3006
3036
  };
3007
3037
  }
3008
- const rulesDir = path12.join(packageRoot, "dist", "agent-src", "rules");
3038
+ const rulesDir = path11.join(packageRoot, "dist", "agent-src", "rules");
3009
3039
  const broken = [];
3010
3040
  let ids = 0;
3011
3041
  let targets = 0;
3012
3042
  for (const kernelId of router["kernel"] ?? []) {
3013
3043
  ids += 1;
3014
- if (!fs12.existsSync(path12.join(rulesDir, `${kernelId}.md`))) {
3044
+ if (!fs11.existsSync(path11.join(rulesDir, `${kernelId}.md`))) {
3015
3045
  broken.push(`kernel:${kernelId} \u2192 rules/${kernelId}.md missing`);
3016
3046
  }
3017
3047
  }
@@ -3019,7 +3049,7 @@ function _check_router_pointers(packageRoot = PACKAGE_ROOT) {
3019
3049
  for (const entry of router[tier] ?? []) {
3020
3050
  const ruleId = String(entry["id"] ?? "");
3021
3051
  ids += 1;
3022
- if (!fs12.existsSync(path12.join(rulesDir, `${ruleId}.md`))) {
3052
+ if (!fs11.existsSync(path11.join(rulesDir, `${ruleId}.md`))) {
3023
3053
  broken.push(`${tier}:${ruleId} \u2192 rules/${ruleId}.md missing`);
3024
3054
  }
3025
3055
  for (const target of entry["routes_to"] ?? []) {
@@ -3029,7 +3059,7 @@ function _check_router_pointers(packageRoot = PACKAGE_ROOT) {
3029
3059
  broken.push(`${ruleId} \u2192 unparseable routes_to ${JSON.stringify(target)}`);
3030
3060
  continue;
3031
3061
  }
3032
- if (!candidates.some((rel) => fs12.existsSync(path12.join(packageRoot, rel)))) {
3062
+ if (!candidates.some((rel) => fs11.existsSync(path11.join(packageRoot, rel)))) {
3033
3063
  broken.push(`${ruleId} \u2192 ${target} (${candidates[0]} missing)`);
3034
3064
  }
3035
3065
  }
@@ -3061,9 +3091,9 @@ function detectSmokePlatform(projectRoot) {
3061
3091
  return "claude";
3062
3092
  }
3063
3093
  function dispatcherRunner(packageRoot) {
3064
- const localTsx = path12.join(packageRoot, "node_modules", ".bin", "tsx");
3065
- const script = path12.join(packageRoot, "src", "scripts", "hooks", "dispatch_hook.ts");
3066
- if (fs12.existsSync(localTsx)) {
3094
+ const localTsx = path11.join(packageRoot, "node_modules", ".bin", "tsx");
3095
+ const script = path11.join(packageRoot, "src", "scripts", "hooks", "dispatch_hook.ts");
3096
+ if (fs11.existsSync(localTsx)) {
3067
3097
  return [localTsx, script];
3068
3098
  }
3069
3099
  return ["npx", "tsx", script];
@@ -3113,12 +3143,12 @@ function _check_hook_dispatcher(projectRoot, packageRoot = PACKAGE_ROOT, opts =
3113
3143
  };
3114
3144
  }
3115
3145
  function readSettingsMode(projectRoot) {
3116
- const settingsPath = path12.join(projectRoot, ".agent-settings.yml");
3117
- if (!fs12.existsSync(settingsPath)) {
3146
+ const settingsPath = path11.join(projectRoot, ".agent-settings.yml");
3147
+ if (!fs11.existsSync(settingsPath)) {
3118
3148
  return "eager-all";
3119
3149
  }
3120
3150
  try {
3121
- const parsed = YAML.parse(fs12.readFileSync(settingsPath, "utf8"));
3151
+ const parsed = YAML.parse(fs11.readFileSync(settingsPath, "utf8"));
3122
3152
  const lean = parsed?.["lean_projection"] ?? null;
3123
3153
  const mode = lean?.["mode"];
3124
3154
  return typeof mode === "string" && mode.length > 0 ? mode : "eager-all";
@@ -3129,7 +3159,7 @@ function readSettingsMode(projectRoot) {
3129
3159
  function kernelIdsFromRouter(packageRoot) {
3130
3160
  try {
3131
3161
  const router = JSON.parse(
3132
- fs12.readFileSync(path12.join(packageRoot, "dist", "router.json"), "utf8")
3162
+ fs11.readFileSync(path11.join(packageRoot, "dist", "router.json"), "utf8")
3133
3163
  );
3134
3164
  return new Set((router["kernel"] ?? []).map(String));
3135
3165
  } catch {
@@ -3146,8 +3176,8 @@ function _check_lean_projection(projectRoot, packageRoot = PACKAGE_ROOT, project
3146
3176
  remedy: "set lean_projection.mode to 'eager-all' or 'thin' in .agent-settings.yml"
3147
3177
  };
3148
3178
  }
3149
- const rulesDir = projectedRulesDir ?? path12.join(projectRoot, ".augment", "rules");
3150
- if (!fs12.existsSync(rulesDir)) {
3179
+ const rulesDir = projectedRulesDir ?? path11.join(projectRoot, ".augment", "rules");
3180
+ if (!fs11.existsSync(rulesDir)) {
3151
3181
  return {
3152
3182
  id: "lean-projection",
3153
3183
  status: "skipped",
@@ -3156,7 +3186,7 @@ function _check_lean_projection(projectRoot, packageRoot = PACKAGE_ROOT, project
3156
3186
  };
3157
3187
  }
3158
3188
  const kernel = kernelIdsFromRouter(packageRoot);
3159
- const files = fs12.readdirSync(rulesDir).filter((f) => f.endsWith(".md") && f !== "INDEX.md").sort();
3189
+ const files = fs11.readdirSync(rulesDir).filter((f) => f.endsWith(".md") && f !== "INDEX.md").sort();
3160
3190
  const nonKernel = files.filter((f) => !kernel.has(f.replace(/\.md$/, "")));
3161
3191
  if (nonKernel.length === 0) {
3162
3192
  return {
@@ -3170,7 +3200,7 @@ function _check_lean_projection(projectRoot, packageRoot = PACKAGE_ROOT, project
3170
3200
  for (const f of nonKernel) {
3171
3201
  let text = "";
3172
3202
  try {
3173
- text = fs12.readFileSync(path12.join(rulesDir, f), "utf8");
3203
+ text = fs11.readFileSync(path11.join(rulesDir, f), "utf8");
3174
3204
  } catch {
3175
3205
  continue;
3176
3206
  }
@@ -3201,8 +3231,8 @@ function _check_lean_projection(projectRoot, packageRoot = PACKAGE_ROOT, project
3201
3231
  function _check_host_manifest(projectRoot) {
3202
3232
  const detected = Object.entries(detectToolPresence(projectRoot)).filter(([, v]) => v === true).map(([k]) => k);
3203
3233
  const detectedNote = detected.length > 0 ? `detected surfaces: ${detected.join(", ")}` : "no surfaces detected";
3204
- const settingsPath = path12.join(projectRoot, ".agent-settings.yml");
3205
- if (!fs12.existsSync(settingsPath)) {
3234
+ const settingsPath = path11.join(projectRoot, ".agent-settings.yml");
3235
+ if (!fs11.existsSync(settingsPath)) {
3206
3236
  return {
3207
3237
  id: "host-manifest",
3208
3238
  status: "ok",
@@ -3212,7 +3242,7 @@ function _check_host_manifest(projectRoot) {
3212
3242
  }
3213
3243
  let parsed = null;
3214
3244
  try {
3215
- parsed = YAML.parse(fs12.readFileSync(settingsPath, "utf8"));
3245
+ parsed = YAML.parse(fs11.readFileSync(settingsPath, "utf8"));
3216
3246
  } catch (exc) {
3217
3247
  return {
3218
3248
  id: "host-manifest",
@@ -3386,13 +3416,13 @@ function _isCliEntry10() {
3386
3416
  if (process5.argv[1] === void 0) {
3387
3417
  return false;
3388
3418
  }
3389
- const argvUrl = pathToFileURL11(path12.resolve(process5.argv[1])).href;
3419
+ const argvUrl = pathToFileURL11(path11.resolve(process5.argv[1])).href;
3390
3420
  if (import.meta.url === argvUrl) {
3391
3421
  return true;
3392
3422
  }
3393
3423
  try {
3394
- const here = fs12.realpathSync(fileURLToPath11(import.meta.url));
3395
- const argv = fs12.realpathSync(path12.resolve(process5.argv[1]));
3424
+ const here = fs11.realpathSync(fileURLToPath11(import.meta.url));
3425
+ const argv = fs11.realpathSync(path11.resolve(process5.argv[1]));
3396
3426
  return here === argv;
3397
3427
  } catch {
3398
3428
  return false;