@event4u/agent-config 9.30.0 → 9.31.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 (62) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/CHANGELOG.md +31 -314
  3. package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
  4. package/dist/cli-delegate/{chunk-IYTGIG2Y.js → chunk-2WCLVDWC.js} +1 -1
  5. package/dist/cli-delegate/{chunk-66OVWGB5.js → chunk-AG47LAGQ.js} +1 -1
  6. package/dist/cli-delegate/{chunk-MP3JT3IU.js → chunk-DS6BLDMG.js} +1 -1
  7. package/dist/cli-delegate/{chunk-O3CO5BFB.js → chunk-EJITJBJX.js} +12 -1
  8. package/dist/cli-delegate/{chunk-EQY4FLJB.js → chunk-ITIQSGOQ.js} +3 -3
  9. package/dist/cli-delegate/{chunk-LCFJIQ4J.js → chunk-JEJABGKB.js} +110 -6
  10. package/dist/cli-delegate/{chunk-BTJNRUX3.js → chunk-QEEB4LHO.js} +1 -1
  11. package/dist/cli-delegate/{chunk-DDUNNFYX.js → chunk-UVKNIJH2.js} +2 -2
  12. package/dist/cli-delegate/cmd_analyze_session.js +1 -1
  13. package/dist/cli-delegate/cmd_brand_status.js +1 -1
  14. package/dist/cli-delegate/cmd_conformance.js +98 -36
  15. package/dist/cli-delegate/cmd_doctor.js +3 -3
  16. package/dist/cli-delegate/cmd_explain.js +2 -2
  17. package/dist/cli-delegate/cmd_export.js +4 -4
  18. package/dist/cli-delegate/cmd_handoff.js +2 -2
  19. package/dist/cli-delegate/cmd_mcp_available.js +1 -1
  20. package/dist/cli-delegate/cmd_migrate.js +2 -2
  21. package/dist/cli-delegate/cmd_packs_active.js +2 -2
  22. package/dist/cli-delegate/cmd_prune.js +4 -4
  23. package/dist/cli-delegate/cmd_route_audit.js +2 -2
  24. package/dist/cli-delegate/cmd_route_explain.js +1 -1
  25. package/dist/cli-delegate/cmd_session_recycle.js +2 -2
  26. package/dist/cli-delegate/cmd_settings_get.js +2 -55
  27. package/dist/cli-delegate/cmd_settings_migrate.js +4 -4
  28. package/dist/cli-delegate/cmd_settings_set.js +1 -1
  29. package/dist/cli-delegate/cmd_sync.js +4 -4
  30. package/dist/cli-delegate/cmd_uninstall.js +4 -4
  31. package/dist/cli-delegate/cmd_update.js +1 -1
  32. package/dist/cli-delegate/cmd_upgrade.js +1 -1
  33. package/dist/cli-delegate/cmd_validate.js +4 -4
  34. package/dist/cli-delegate/cmd_versions.js +1 -1
  35. package/dist/discovery/deprecation-report.md +1 -1
  36. package/dist/discovery/discovery-manifest.json +1 -1
  37. package/dist/discovery/discovery-manifest.json.sha256 +1 -1
  38. package/dist/discovery/discovery-manifest.summary.md +1 -1
  39. package/dist/discovery/orphan-report.md +1 -1
  40. package/dist/discovery/packs.json +1 -1
  41. package/dist/discovery/trust-report.md +1 -1
  42. package/dist/discovery/workspaces.json +1 -1
  43. package/dist/hooks/dispatch.js +347 -174
  44. package/dist/install/install.mjs +121 -16
  45. package/dist/mcp/registry-manifest.json +1 -1
  46. package/dist/mcp/server.json +2 -2
  47. package/dist/mcp/server.mjs +310 -138
  48. package/dist/scripts/_lib/agent_settings.js +111 -2
  49. package/dist/scripts/_lib/agent_settings.js.map +1 -1
  50. package/dist/server/schemas/settings.js +2 -2
  51. package/dist/server/schemas/settings.js.map +1 -1
  52. package/package.json +1 -1
  53. package/src/config/pack-size-budget.json +3 -2
  54. package/src/scripts/_cli/explain_last/inputs.ts +13 -0
  55. package/src/scripts/_lib/agent_settings.ts +119 -2
  56. package/src/scripts/_lib/carrier_divergence.ts +47 -0
  57. package/src/scripts/hooks/turn_end_gate_hook.ts +296 -88
  58. package/src/scripts/language_mirror_hook.ts +69 -16
  59. package/src/scripts/measure_turn_end_gate.ts +129 -51
  60. package/src/scripts/report_carrier_divergence.ts +72 -24
  61. package/src/scripts/report_conformance_funnel.ts +11 -4
  62. package/src/server/schemas/settings.ts +2 -2
@@ -109,6 +109,67 @@ var init_user_global_paths = __esm({
109
109
  }
110
110
  });
111
111
 
112
+ // src/shared/settingsCarveOut.ts
113
+ function carveOutKeys() {
114
+ return SETTINGS_CARVE_OUT.map((c) => c.key);
115
+ }
116
+ var SETTINGS_CARVE_OUT;
117
+ var init_settingsCarveOut = __esm({
118
+ "src/shared/settingsCarveOut.ts"() {
119
+ "use strict";
120
+ SETTINGS_CARVE_OUT = [
121
+ {
122
+ key: "projection.mode",
123
+ reader: "src/scripts/install.ts:3409 _resolve_scoped_projection",
124
+ absentResolvesTo: "legacy-all",
125
+ reason: "The template fallback applies only when NO global settings file exists. Once a file exists, an absent key means legacy-all by documented contract, so an existing install is never silently narrowed on upgrade."
126
+ },
127
+ {
128
+ key: "projection.rule_workspaces",
129
+ reader: "src/install/rule_scope.ts:96 ruleScopeFromSettings",
130
+ absentResolvesTo: "null \u2014 LEGACY_ALL, i.e. every rule ships including maintainer-only ones",
131
+ reason: "Same upgrade contract as projection.mode, and the failure is louder: an absent list widens the projection instead of narrowing it."
132
+ },
133
+ {
134
+ key: "discipline_profile",
135
+ reader: "work_engine/_lib/agent_settings.ts:1263",
136
+ absentResolvesTo: "essential, unconditionally",
137
+ reason: "The template ships `auto`, which resolves to `off` on any measured-null model, any non-Claude host, and any host exposing no model id. Absent skips that resolution entirely and loads the essential tier everywhere."
138
+ },
139
+ {
140
+ key: "chat_history.frequency",
141
+ reader: "src/scripts/chat_history.ts:1140",
142
+ absentResolvesTo: "per_phase",
143
+ reason: "Canonical substitution is `per_turn`. Absent gives coarser capture than the shipped default \u2014 an audit-thinning change, which the class contract's own test 8 (what can the attacker HIDE) names as the severe direction."
144
+ },
145
+ {
146
+ key: "profile.id",
147
+ reader: "src/scripts/config/profiles.ts:221 resolve_profile",
148
+ absentResolvesTo: "the id `developer`, but a DEGRADED profile \u2014 packs: [], personas: [], hints: []",
149
+ reason: "Exactly the projection.mode shape: the template default is honoured only when no settings file exists. With a file present the id resolves but its profile body does not load, so the install silently loses every pack and persona."
150
+ },
151
+ {
152
+ key: "quality.local_auto_run",
153
+ reader: "src/scripts/lint_roadmap_ci_steps.ts:106",
154
+ absentResolvesTo: "true \u2014 which DISABLES the CI-step gate",
155
+ reason: "Inverted polarity, and the most dangerous row in the set: the template ships `false`, which ARMS the gate. Omitting the key would disarm a quality gate for every fresh install while the reference page says it is on."
156
+ },
157
+ {
158
+ key: "onboarding.onboarded",
159
+ reader: "src/scripts/onboarding_gate_hook.ts:99",
160
+ absentResolvesTo: "gate skipped, as if onboarding had already completed",
161
+ reason: "Absent behaves like `onboarded: true`, not like the template default `false`. Omitting it would skip the onboarding gate on precisely the fresh installs the gate exists for."
162
+ },
163
+ {
164
+ key: "chat_history.enabled",
165
+ reader: "src/scripts/chat_history.ts:1025 _read_chat_history_enabled",
166
+ absentResolvesTo: "false",
167
+ reason: "The reader falls back to false while the template ships true. This one is privacy-shaped: fixing the reader would start recording history for every install whose file lacks the key. Writing it explicitly keeps the decision visible in the file the user can read."
168
+ }
169
+ ];
170
+ }
171
+ });
172
+
112
173
  // src/scripts/_lib/agent_settings.ts
113
174
  var agent_settings_exports = {};
114
175
  __export(agent_settings_exports, {
@@ -131,7 +192,9 @@ __export(agent_settings_exports, {
131
192
  ROOT_OVERRIDE_ENV: () => ROOT_OVERRIDE_ENV,
132
193
  USER_GLOBAL_CANONICAL_RELATIVE: () => USER_GLOBAL_CANONICAL_RELATIVE,
133
194
  USER_GLOBAL_FILENAME: () => USER_GLOBAL_FILENAME,
195
+ _reset_template_defaults_cache: () => _reset_template_defaults_cache,
134
196
  canonical_settings_write_path: () => canonical_settings_write_path,
197
+ default_template_path: () => default_template_path,
135
198
  enumerate_modules: () => enumerate_modules,
136
199
  find_project_root: () => find_project_root,
137
200
  find_project_root_with_anchor: () => find_project_root_with_anchor,
@@ -142,12 +205,14 @@ __export(agent_settings_exports, {
142
205
  logger: () => logger,
143
206
  project_settings_path: () => project_settings_path,
144
207
  resolve_project_root: () => resolve_project_root,
208
+ template_defaults: () => template_defaults,
145
209
  user_global_settings_paths: () => user_global_settings_paths
146
210
  });
147
211
  import { createRequire } from "node:module";
148
212
  import * as fs3 from "node:fs";
149
213
  import * as os2 from "node:os";
150
214
  import * as path3 from "node:path";
215
+ import { fileURLToPath } from "node:url";
151
216
  function _format(template, args) {
152
217
  let i = 0;
153
218
  return template.replace(/%s/g, () => {
@@ -209,6 +274,45 @@ function user_global_settings_paths() {
209
274
  }
210
275
  return paths;
211
276
  }
277
+ function default_template_path() {
278
+ return path3.join(_PACKAGE_ROOT, TEMPLATE_RELATIVE);
279
+ }
280
+ function _is_placeholder(value) {
281
+ return typeof value === "string" && /^__[A-Z0-9_]+__$/.test(value);
282
+ }
283
+ function _prune_template(tree, excluded, prefix = "") {
284
+ const out = {};
285
+ for (const [key, value] of Object.entries(tree)) {
286
+ const dotted = prefix === "" ? key : `${prefix}.${key}`;
287
+ if (excluded.has(dotted) || _is_placeholder(value)) {
288
+ continue;
289
+ }
290
+ if (_is_plain_dict(value)) {
291
+ const child = _prune_template(value, excluded, dotted);
292
+ if (Object.keys(child).length > 0) {
293
+ out[key] = child;
294
+ }
295
+ continue;
296
+ }
297
+ out[key] = value;
298
+ }
299
+ return out;
300
+ }
301
+ function template_defaults(template_path) {
302
+ const use_cache = template_path === void 0;
303
+ if (use_cache && _template_defaults_cache !== null) {
304
+ return _deepcopy(_template_defaults_cache);
305
+ }
306
+ const parsed = _read_yaml(template_path ?? default_template_path()) ?? {};
307
+ const pruned = _prune_template(parsed, new Set(carveOutKeys()));
308
+ if (use_cache) {
309
+ _template_defaults_cache = pruned;
310
+ }
311
+ return _deepcopy(pruned);
312
+ }
313
+ function _reset_template_defaults_cache() {
314
+ _template_defaults_cache = null;
315
+ }
212
316
  function _exists(p) {
213
317
  try {
214
318
  fs3.lstatSync(p);
@@ -452,6 +556,7 @@ function load_agent_settings(options = {}) {
452
556
  const user_global_path = options.user_global_path ?? null;
453
557
  const verbose = options.verbose ?? false;
454
558
  const cwd = options.cwd ?? null;
559
+ const template_path = options.template_path ?? null;
455
560
  const user_global_raw = {};
456
561
  for (const p of user_global_path ? [user_global_path] : user_global_settings_paths()) {
457
562
  _deep_merge(user_global_raw, _read_yaml(p) ?? {});
@@ -464,7 +569,7 @@ function load_agent_settings(options = {}) {
464
569
  );
465
570
  }
466
571
  const cascade = _resolve_cascade_paths(cwd, project_path);
467
- const merged = _deep_copy_defaults(_DEFAULTS);
572
+ const merged = template_defaults(template_path ?? void 0);
468
573
  _deep_merge(merged, user_global_filtered);
469
574
  for (const p of cascade) {
470
575
  const layer = _read_yaml(p) ?? {};
@@ -743,11 +848,6 @@ function _deep_merge(dst, src) {
743
848
  }
744
849
  }
745
850
  }
746
- function _deep_copy_defaults(src) {
747
- const out = {};
748
- _deep_merge(out, src);
749
- return out;
750
- }
751
851
  function _deepcopy(value) {
752
852
  if (Array.isArray(value)) {
753
853
  return value.map((v) => _deepcopy(v));
@@ -777,11 +877,12 @@ function _relative_to(child, root) {
777
877
  function _posix_join(a, b) {
778
878
  return `${a.split(path3.sep).join("/")}/${b}`;
779
879
  }
780
- var _require, Logger, logger, DEFAULT_PROJECT_FILE, LOCAL_PROJECT_FILE, LOCAL_PROJECT_SUBDIR, DEFAULT_TEAM_FILE, USER_GLOBAL_FILENAME, USER_GLOBAL_CANONICAL_RELATIVE, MERGEABLE_KEYS, _DEFAULTS, MODULES_DEFAULTS, ANCHOR_AGENT_SETTINGS, ANCHOR_AGENTS_DIR, ANCHOR_GIT, _AGENTS_DIR_MARKERS, _LEGACY_ANCHOR_ENV, ORIGIN_ROOT_FLAG, ORIGIN_EXPLICIT, ORIGIN_ENV, ORIGIN_CWD_FALLBACK, PROJECT_ROOT_ENV, ROOT_OVERRIDE_ENV, ProjectRootError, REMOVED_ALWAYS_ON_KEYS, _warnedRemovedAlwaysOnKeys;
880
+ var _require, Logger, logger, DEFAULT_PROJECT_FILE, LOCAL_PROJECT_FILE, LOCAL_PROJECT_SUBDIR, DEFAULT_TEAM_FILE, USER_GLOBAL_FILENAME, USER_GLOBAL_CANONICAL_RELATIVE, MERGEABLE_KEYS, TEMPLATE_RELATIVE, _PACKAGE_ROOT, _template_defaults_cache, MODULES_DEFAULTS, ANCHOR_AGENT_SETTINGS, ANCHOR_AGENTS_DIR, ANCHOR_GIT, _AGENTS_DIR_MARKERS, _LEGACY_ANCHOR_ENV, ORIGIN_ROOT_FLAG, ORIGIN_EXPLICIT, ORIGIN_ENV, ORIGIN_CWD_FALLBACK, PROJECT_ROOT_ENV, ROOT_OVERRIDE_ENV, ProjectRootError, REMOVED_ALWAYS_ON_KEYS, _warnedRemovedAlwaysOnKeys;
781
881
  var init_agent_settings = __esm({
782
882
  "src/scripts/_lib/agent_settings.ts"() {
783
883
  "use strict";
784
884
  init_user_global_paths();
885
+ init_settingsCarveOut();
785
886
  _require = createRequire(import.meta.url);
786
887
  Logger = class {
787
888
  name = "scripts._lib.agent_settings";
@@ -833,7 +934,9 @@ var init_agent_settings = __esm({
833
934
  "knowledge.global_sharing.freshness.hypothesis_after_days",
834
935
  "knowledge.global_sharing.freshness.stale_after_days"
835
936
  ];
836
- _DEFAULTS = {};
937
+ TEMPLATE_RELATIVE = path3.join("src", "config", "agent-settings.template.yml");
938
+ _PACKAGE_ROOT = path3.resolve(path3.dirname(fileURLToPath(import.meta.url)), "..", "..", "..");
939
+ _template_defaults_cache = null;
837
940
  MODULES_DEFAULTS = {
838
941
  enabled: false,
839
942
  root_paths: [],
@@ -897,12 +1000,12 @@ __export(prompts_exports, {
897
1000
  });
898
1001
  import * as fs4 from "node:fs";
899
1002
  import * as path4 from "node:path";
900
- import { fileURLToPath } from "node:url";
1003
+ import { fileURLToPath as fileURLToPath2 } from "node:url";
901
1004
  function _project_root() {
902
1005
  if (true) {
903
- return path4.resolve(fileURLToPath(import.meta.url), "..", "..", "..");
1006
+ return path4.resolve(fileURLToPath2(import.meta.url), "..", "..", "..");
904
1007
  }
905
- return path4.resolve(fileURLToPath(import.meta.url), "..", "..", "..", "..");
1008
+ return path4.resolve(fileURLToPath2(import.meta.url), "..", "..", "..", "..");
906
1009
  }
907
1010
  function _strip_frontmatter(text) {
908
1011
  if (!text.startsWith("---\n")) {
@@ -8981,7 +9084,7 @@ var require_dist = __commonJS({
8981
9084
  // src/scripts/_lib/security_lint.ts
8982
9085
  import * as fs6 from "node:fs";
8983
9086
  import * as path6 from "node:path";
8984
- import { fileURLToPath as fileURLToPath2 } from "node:url";
9087
+ import { fileURLToPath as fileURLToPath3 } from "node:url";
8985
9088
  function is_example_path(rel_path) {
8986
9089
  return _EXAMPLE_PATH.test(rel_path);
8987
9090
  }
@@ -9321,7 +9424,7 @@ var _HERE, ROOT, EXAMPLE_FENCE_LANG, GUIDELINE, GUIDELINE_EPILOG, DEFAULT_SCAN_R
9321
9424
  var init_security_lint = __esm({
9322
9425
  "src/scripts/_lib/security_lint.ts"() {
9323
9426
  "use strict";
9324
- _HERE = path6.dirname(fileURLToPath2(import.meta.url));
9427
+ _HERE = path6.dirname(fileURLToPath3(import.meta.url));
9325
9428
  ROOT = path6.resolve(_HERE, "..", "..", "..");
9326
9429
  EXAMPLE_FENCE_LANG = "security-example";
9327
9430
  GUIDELINE = "docs/guidelines/agent-infra/security-lint-containment.md";
@@ -9454,7 +9557,7 @@ var init_scan_scope = __esm({
9454
9557
  import * as fs7 from "node:fs";
9455
9558
  import * as path7 from "node:path";
9456
9559
  import { spawnSync } from "node:child_process";
9457
- import { fileURLToPath as fileURLToPath3, pathToFileURL } from "node:url";
9560
+ import { fileURLToPath as fileURLToPath4, pathToFileURL } from "node:url";
9458
9561
  function _classify(cp) {
9459
9562
  if (_BIDI.has(cp)) {
9460
9563
  return "bidi-control";
@@ -9701,7 +9804,7 @@ function _isCliEntry() {
9701
9804
  return true;
9702
9805
  }
9703
9806
  try {
9704
- const here = fs7.realpathSync(fileURLToPath3(import.meta.url));
9807
+ const here = fs7.realpathSync(fileURLToPath4(import.meta.url));
9705
9808
  const argv = fs7.realpathSync(path7.resolve(process.argv[1]));
9706
9809
  return here === argv;
9707
9810
  } catch {
@@ -10229,7 +10332,7 @@ __export(memory_status_exports, {
10229
10332
  import process2 from "node:process";
10230
10333
  import * as fs8 from "node:fs";
10231
10334
  import * as path8 from "node:path";
10232
- import { fileURLToPath as fileURLToPath4, pathToFileURL as pathToFileURL2 } from "node:url";
10335
+ import { fileURLToPath as fileURLToPath5, pathToFileURL as pathToFileURL2 } from "node:url";
10233
10336
  function status(_refresh = false) {
10234
10337
  return {
10235
10338
  status: "file",
@@ -10358,7 +10461,7 @@ function _isCliEntry2() {
10358
10461
  return true;
10359
10462
  }
10360
10463
  try {
10361
- const here = fs8.realpathSync(fileURLToPath4(import.meta.url));
10464
+ const here = fs8.realpathSync(fileURLToPath5(import.meta.url));
10362
10465
  const argv = fs8.realpathSync(path8.resolve(process2.argv[1]));
10363
10466
  return here === argv;
10364
10467
  } catch {
@@ -10400,7 +10503,7 @@ var init_memory_status = __esm({
10400
10503
  import * as fs9 from "node:fs";
10401
10504
  import * as path9 from "node:path";
10402
10505
  import process3 from "node:process";
10403
- import { fileURLToPath as fileURLToPath5, pathToFileURL as pathToFileURL3 } from "node:url";
10506
+ import { fileURLToPath as fileURLToPath6, pathToFileURL as pathToFileURL3 } from "node:url";
10404
10507
  function _setMemoryRoot(p) {
10405
10508
  MEMORY_ROOT = p;
10406
10509
  }
@@ -11032,7 +11135,7 @@ function _isCliEntry3() {
11032
11135
  return true;
11033
11136
  }
11034
11137
  try {
11035
- const here = fs9.realpathSync(fileURLToPath5(import.meta.url));
11138
+ const here = fs9.realpathSync(fileURLToPath6(import.meta.url));
11036
11139
  const argv = fs9.realpathSync(path9.resolve(process3.argv[1]));
11037
11140
  return here === argv;
11038
11141
  } catch {
@@ -11351,7 +11454,7 @@ import { createHash as createHash2 } from "node:crypto";
11351
11454
  import * as fs11 from "node:fs";
11352
11455
  import * as path11 from "node:path";
11353
11456
  import process4 from "node:process";
11354
- import { fileURLToPath as fileURLToPath6 } from "node:url";
11457
+ import { fileURLToPath as fileURLToPath7 } from "node:url";
11355
11458
  function _parseTsMs(ts) {
11356
11459
  const t = Date.parse(ts);
11357
11460
  return Number.isNaN(t) ? null : t;
@@ -11560,7 +11663,7 @@ var init_learning_sidecar = __esm({
11560
11663
  LESSONS_NAME = "LESSONS.md";
11561
11664
  SCHEMA_VERSION2 = 1;
11562
11665
  _bundled = true;
11563
- if (!_bundled && fileURLToPath6(import.meta.url) === path11.resolve(process4.argv[1] ?? "")) {
11666
+ if (!_bundled && fileURLToPath7(import.meta.url) === path11.resolve(process4.argv[1] ?? "")) {
11564
11667
  process4.exit(main4(process4.argv.slice(2)));
11565
11668
  }
11566
11669
  }
@@ -11597,7 +11700,7 @@ __export(memory_lookup_exports, {
11597
11700
  import * as fs12 from "node:fs";
11598
11701
  import * as path12 from "node:path";
11599
11702
  import process5 from "node:process";
11600
- import { fileURLToPath as fileURLToPath7, pathToFileURL as pathToFileURL4 } from "node:url";
11703
+ import { fileURLToPath as fileURLToPath8, pathToFileURL as pathToFileURL4 } from "node:url";
11601
11704
  import { createRequire as createRequire3 } from "node:module";
11602
11705
  function _setMemoryRoot2(p) {
11603
11706
  MEMORY_ROOT2 = p;
@@ -12782,7 +12885,7 @@ function _isCliEntry4() {
12782
12885
  return true;
12783
12886
  }
12784
12887
  try {
12785
- const here = fs12.realpathSync(fileURLToPath7(import.meta.url));
12888
+ const here = fs12.realpathSync(fileURLToPath8(import.meta.url));
12786
12889
  const argv = fs12.realpathSync(path12.resolve(process5.argv[1]));
12787
12890
  return here === argv;
12788
12891
  } catch {
@@ -12895,7 +12998,7 @@ var init_hook_stdin = __esm({
12895
12998
  // src/scripts/_lib/agent_src.ts
12896
12999
  import * as fs17 from "node:fs";
12897
13000
  import * as path16 from "node:path";
12898
- import { fileURLToPath as fileURLToPath10 } from "node:url";
13001
+ import { fileURLToPath as fileURLToPath11 } from "node:url";
12899
13002
  function _deriveRoots(root) {
12900
13003
  const packages = path16.join(root, "packages");
12901
13004
  const src = path16.join(root, "src");
@@ -13145,7 +13248,7 @@ var _HERE2, _DEFAULT_ROOT, _roots;
13145
13248
  var init_agent_src = __esm({
13146
13249
  "src/scripts/_lib/agent_src.ts"() {
13147
13250
  "use strict";
13148
- _HERE2 = path16.dirname(fileURLToPath10(import.meta.url));
13251
+ _HERE2 = path16.dirname(fileURLToPath11(import.meta.url));
13149
13252
  _DEFAULT_ROOT = path16.resolve(_HERE2, "..", "..", "..");
13150
13253
  _roots = _deriveRoots(_DEFAULT_ROOT);
13151
13254
  }
@@ -13258,7 +13361,7 @@ var init_obligation_frequency = __esm({
13258
13361
  import * as fs18 from "node:fs";
13259
13362
  import * as path17 from "node:path";
13260
13363
  import process6 from "node:process";
13261
- import { fileURLToPath as fileURLToPath11, pathToFileURL as pathToFileURL6 } from "node:url";
13364
+ import { fileURLToPath as fileURLToPath12, pathToFileURL as pathToFileURL6 } from "node:url";
13262
13365
  function parse_frontmatter(text) {
13263
13366
  const match = _FRONTMATTER_RE.exec(text);
13264
13367
  if (!match) {
@@ -14034,7 +14137,7 @@ function _isCliEntry6() {
14034
14137
  return true;
14035
14138
  }
14036
14139
  try {
14037
- const here = fs18.realpathSync(fileURLToPath11(import.meta.url));
14140
+ const here = fs18.realpathSync(fileURLToPath12(import.meta.url));
14038
14141
  const argv = fs18.realpathSync(path17.resolve(process6.argv[1]));
14039
14142
  return here === argv;
14040
14143
  } catch {
@@ -14074,7 +14177,7 @@ var init_validate_frontmatter = __esm({
14074
14177
  _defaultYaml = (body) => (0, import_yaml3.parse)(body, { version: "1.1" });
14075
14178
  _yaml = _defaultYaml;
14076
14179
  _KEY_RE = /^([\w-]+):\s*([\s\S]*)$/;
14077
- _HERE3 = path17.dirname(fileURLToPath11(import.meta.url));
14180
+ _HERE3 = path17.dirname(fileURLToPath12(import.meta.url));
14078
14181
  _SCHEMA_DIR = path17.join(_HERE3, "schemas");
14079
14182
  _SCHEMA_CACHE = /* @__PURE__ */ new Map();
14080
14183
  _PROG3 = "validate_frontmatter.py";
@@ -14151,7 +14254,7 @@ var init_counted_probe = __esm({
14151
14254
  // src/scripts/_lib/release_scope.ts
14152
14255
  import { spawnSync as spawnSync3 } from "node:child_process";
14153
14256
  import path18 from "node:path";
14154
- import { fileURLToPath as fileURLToPath12 } from "node:url";
14257
+ import { fileURLToPath as fileURLToPath13 } from "node:url";
14155
14258
  function detectReleaseVersion(patchText) {
14156
14259
  const addedLines = patchText.split("\n").filter((l) => l.startsWith("+") && !l.startsWith("+++")).map((l) => l.slice(1));
14157
14260
  let changelogVersion = null;
@@ -14253,7 +14356,7 @@ var __dirname, REPO_ROOT;
14253
14356
  var init_release_scope = __esm({
14254
14357
  "src/scripts/_lib/release_scope.ts"() {
14255
14358
  "use strict";
14256
- __dirname = path18.dirname(fileURLToPath12(import.meta.url));
14359
+ __dirname = path18.dirname(fileURLToPath13(import.meta.url));
14257
14360
  REPO_ROOT = path18.resolve(__dirname, "..", "..", "..");
14258
14361
  }
14259
14362
  });
@@ -14308,7 +14411,7 @@ __export(skill_linter_exports, {
14308
14411
  import * as fs19 from "node:fs";
14309
14412
  import * as path19 from "node:path";
14310
14413
  import process7 from "node:process";
14311
- import { fileURLToPath as fileURLToPath13, pathToFileURL as pathToFileURL7 } from "node:url";
14414
+ import { fileURLToPath as fileURLToPath14, pathToFileURL as pathToFileURL7 } from "node:url";
14312
14415
  function splitlines(text) {
14313
14416
  if (text === "") {
14314
14417
  return [];
@@ -17888,7 +17991,7 @@ function _isCliEntry7() {
17888
17991
  return true;
17889
17992
  }
17890
17993
  try {
17891
- const here = fs19.realpathSync(fileURLToPath13(import.meta.url));
17994
+ const here = fs19.realpathSync(fileURLToPath14(import.meta.url));
17892
17995
  const argv = fs19.realpathSync(path19.resolve(process7.argv[1]));
17893
17996
  return here === argv;
17894
17997
  } catch {
@@ -17904,7 +18007,7 @@ var init_skill_linter = __esm({
17904
18007
  init_counted_probe();
17905
18008
  init_release_scope();
17906
18009
  init_scan_scope();
17907
- _HERE4 = path19.dirname(fileURLToPath13(import.meta.url));
18010
+ _HERE4 = path19.dirname(fileURLToPath14(import.meta.url));
17908
18011
  REQUIRED_PERSONA_SECTIONS_CORE = [
17909
18012
  "Focus",
17910
18013
  "Mindset",
@@ -18195,7 +18298,7 @@ import * as crypto3 from "node:crypto";
18195
18298
  import * as fs20 from "node:fs";
18196
18299
  import * as path20 from "node:path";
18197
18300
  import process8 from "node:process";
18198
- import { fileURLToPath as fileURLToPath14, pathToFileURL as pathToFileURL8 } from "node:url";
18301
+ import { fileURLToPath as fileURLToPath15, pathToFileURL as pathToFileURL8 } from "node:url";
18199
18302
  function _setIntakeRoot2(p) {
18200
18303
  INTAKE_ROOT3 = p;
18201
18304
  }
@@ -18482,7 +18585,7 @@ function _isCliEntry8() {
18482
18585
  return true;
18483
18586
  }
18484
18587
  try {
18485
- const here = fs20.realpathSync(fileURLToPath14(import.meta.url));
18588
+ const here = fs20.realpathSync(fileURLToPath15(import.meta.url));
18486
18589
  const argv = fs20.realpathSync(path20.resolve(process8.argv[1]));
18487
18590
  return here === argv;
18488
18591
  } catch {
@@ -18542,7 +18645,7 @@ import { createRequire as createRequire4 } from "node:module";
18542
18645
  import { spawnSync as spawnSync4 } from "node:child_process";
18543
18646
  import * as fs21 from "node:fs";
18544
18647
  import * as path21 from "node:path";
18545
- import { fileURLToPath as fileURLToPath15, pathToFileURL as pathToFileURL9 } from "node:url";
18648
+ import { fileURLToPath as fileURLToPath16, pathToFileURL as pathToFileURL9 } from "node:url";
18546
18649
  function _pyRound4(x) {
18547
18650
  const floor = Math.floor(x);
18548
18651
  const diff = x - floor;
@@ -19221,7 +19324,7 @@ function _isCliEntry9() {
19221
19324
  return true;
19222
19325
  }
19223
19326
  try {
19224
- const here = fs21.realpathSync(fileURLToPath15(import.meta.url));
19327
+ const here = fs21.realpathSync(fileURLToPath16(import.meta.url));
19225
19328
  const argv = fs21.realpathSync(path21.resolve(process.argv[1]));
19226
19329
  return here === argv;
19227
19330
  } catch {
@@ -19232,7 +19335,7 @@ var _HERE5, _require3, CHECKBOX_RE, PHASE_RE, TITLE_RE, EXCLUDE_NAMES, EXCLUDE_P
19232
19335
  var init_update_roadmap_progress = __esm({
19233
19336
  "src/agent-src/scripts/update_roadmap_progress.ts"() {
19234
19337
  "use strict";
19235
- _HERE5 = fileURLToPath15(import.meta.url);
19338
+ _HERE5 = fileURLToPath16(import.meta.url);
19236
19339
  _require3 = createRequire4(import.meta.url);
19237
19340
  CHECKBOX_RE = /^[ \t\n\r\f\v]*[-*][ \t\n\r\f\v]+\[([ xX~\-])\][ \t\n\r\f\v]/gm;
19238
19341
  PHASE_RE = /^(#{2,3})[ \t\n\r\f\v]+Phase[ \t\n\r\f\v]+(\d+(?:\.\d+)*[a-z]?|[IVX]+|[A-Z](?:\d+)?)(?:[\s:—\-]+([\s\S]*?))?[ \t\f\v\r]*$/gm;
@@ -19391,7 +19494,7 @@ import { spawnSync as spawnSync5 } from "node:child_process";
19391
19494
  import * as fs22 from "node:fs";
19392
19495
  import * as path22 from "node:path";
19393
19496
  import process9 from "node:process";
19394
- import { fileURLToPath as fileURLToPath16, pathToFileURL as pathToFileURL10 } from "node:url";
19497
+ import { fileURLToPath as fileURLToPath17, pathToFileURL as pathToFileURL10 } from "node:url";
19395
19498
  function _run(cmd, cwd) {
19396
19499
  const res = spawnSync5(cmd[0], cmd.slice(1), { cwd, encoding: "utf-8" });
19397
19500
  if (res.error) {
@@ -19671,7 +19774,7 @@ function _isCliEntry10() {
19671
19774
  return true;
19672
19775
  }
19673
19776
  try {
19674
- const here = fs22.realpathSync(fileURLToPath16(import.meta.url));
19777
+ const here = fs22.realpathSync(fileURLToPath17(import.meta.url));
19675
19778
  const argv = fs22.realpathSync(path22.resolve(process9.argv[1]));
19676
19779
  return here === argv;
19677
19780
  } catch {
@@ -19683,7 +19786,7 @@ var init_archive_completed_roadmaps = __esm({
19683
19786
  "src/agent-src/scripts/archive_completed_roadmaps.ts"() {
19684
19787
  "use strict";
19685
19788
  init_update_roadmap_progress();
19686
- _HERE6 = fileURLToPath16(import.meta.url);
19789
+ _HERE6 = fileURLToPath17(import.meta.url);
19687
19790
  ArgparseExit2 = class extends Error {
19688
19791
  code;
19689
19792
  constructor(code) {
@@ -19722,7 +19825,7 @@ __export(generate_capabilities_index_exports, {
19722
19825
  import * as fs23 from "node:fs";
19723
19826
  import * as path23 from "node:path";
19724
19827
  import process10 from "node:process";
19725
- import { fileURLToPath as fileURLToPath17, pathToFileURL as pathToFileURL11 } from "node:url";
19828
+ import { fileURLToPath as fileURLToPath18, pathToFileURL as pathToFileURL11 } from "node:url";
19726
19829
  function _isFile9(p) {
19727
19830
  try {
19728
19831
  return fs23.statSync(p).isFile();
@@ -20087,7 +20190,7 @@ function _isCliEntry11() {
20087
20190
  return true;
20088
20191
  }
20089
20192
  try {
20090
- const here = fs23.realpathSync(fileURLToPath17(import.meta.url));
20193
+ const here = fs23.realpathSync(fileURLToPath18(import.meta.url));
20091
20194
  const argv = fs23.realpathSync(path23.resolve(process10.argv[1]));
20092
20195
  return here === argv;
20093
20196
  } catch {
@@ -20101,7 +20204,7 @@ var init_generate_capabilities_index = __esm({
20101
20204
  import_yaml4 = __toESM(require_dist(), 1);
20102
20205
  init_agent_src();
20103
20206
  init_validate_frontmatter();
20104
- _HERE7 = fileURLToPath17(import.meta.url);
20207
+ _HERE7 = fileURLToPath18(import.meta.url);
20105
20208
  ROOT2 = path23.resolve(path23.dirname(_HERE7), "..", "..");
20106
20209
  OUT = path23.join(ROOT2, "CAPABILITIES.yaml");
20107
20210
  PACKS_YML = path23.join(ROOT2, "src", "config", "discovery", "packs.yml");
@@ -20326,7 +20429,7 @@ var init_claude_settings_hooks = __esm({
20326
20429
  // src/scripts/_lib/cli_wrapper.ts
20327
20430
  import fs26 from "node:fs";
20328
20431
  import path25 from "node:path";
20329
- import { fileURLToPath as fileURLToPath18 } from "node:url";
20432
+ import { fileURLToPath as fileURLToPath19 } from "node:url";
20330
20433
  function _is_file2(p) {
20331
20434
  try {
20332
20435
  return fs26.statSync(p).isFile();
@@ -20344,18 +20447,18 @@ function install_cli_wrapper(project_root) {
20344
20447
  fs26.chmodSync(target, 493);
20345
20448
  return target;
20346
20449
  }
20347
- var _PACKAGE_ROOT, _TEMPLATE;
20450
+ var _PACKAGE_ROOT2, _TEMPLATE;
20348
20451
  var init_cli_wrapper = __esm({
20349
20452
  "src/scripts/_lib/cli_wrapper.ts"() {
20350
20453
  "use strict";
20351
- _PACKAGE_ROOT = path25.resolve(
20352
- path25.dirname(fileURLToPath18(import.meta.url)),
20454
+ _PACKAGE_ROOT2 = path25.resolve(
20455
+ path25.dirname(fileURLToPath19(import.meta.url)),
20353
20456
  "..",
20354
20457
  "..",
20355
20458
  ".."
20356
20459
  );
20357
20460
  _TEMPLATE = path25.join(
20358
- _PACKAGE_ROOT,
20461
+ _PACKAGE_ROOT2,
20359
20462
  "src",
20360
20463
  "templates",
20361
20464
  "agent-config-wrapper.sh"
@@ -20387,7 +20490,7 @@ __export(sync_gitignore_exports, {
20387
20490
  import * as fs27 from "node:fs";
20388
20491
  import * as path26 from "node:path";
20389
20492
  import process12 from "node:process";
20390
- import { fileURLToPath as fileURLToPath19, pathToFileURL as pathToFileURL12 } from "node:url";
20493
+ import { fileURLToPath as fileURLToPath20, pathToFileURL as pathToFileURL12 } from "node:url";
20391
20494
  function _strip4(ln) {
20392
20495
  return ln.replace(/\n+$/, "").replace(/\s+$/, "");
20393
20496
  }
@@ -20814,7 +20917,7 @@ function _isCliEntry12() {
20814
20917
  return true;
20815
20918
  }
20816
20919
  try {
20817
- const here = fs27.realpathSync(fileURLToPath19(import.meta.url));
20920
+ const here = fs27.realpathSync(fileURLToPath20(import.meta.url));
20818
20921
  const argv = fs27.realpathSync(path26.resolve(process12.argv[1]));
20819
20922
  return here === argv;
20820
20923
  } catch {
@@ -20828,7 +20931,7 @@ var init_sync_gitignore = __esm({
20828
20931
  SECTION_HEADER = "# event4u/agent-config";
20829
20932
  SECTION_FOOTER = "# event4u/agent-config \u2014 END";
20830
20933
  DEFAULT_GITIGNORE = ".gitignore";
20831
- _HERE8 = fileURLToPath19(import.meta.url);
20934
+ _HERE8 = fileURLToPath20(import.meta.url);
20832
20935
  DEFAULT_TEMPLATE = path26.join(
20833
20936
  path26.dirname(_HERE8),
20834
20937
  "..",
@@ -20887,7 +20990,7 @@ __export(sync_gitattributes_exports, {
20887
20990
  import * as fs28 from "node:fs";
20888
20991
  import * as path27 from "node:path";
20889
20992
  import process13 from "node:process";
20890
- import { fileURLToPath as fileURLToPath20, pathToFileURL as pathToFileURL13 } from "node:url";
20993
+ import { fileURLToPath as fileURLToPath21, pathToFileURL as pathToFileURL13 } from "node:url";
20891
20994
  function _strip5(ln) {
20892
20995
  return ln.replace(/\n+$/, "").replace(/\s+$/, "");
20893
20996
  }
@@ -21079,7 +21182,7 @@ function _isCliEntry13() {
21079
21182
  return true;
21080
21183
  }
21081
21184
  try {
21082
- const here = fs28.realpathSync(fileURLToPath20(import.meta.url));
21185
+ const here = fs28.realpathSync(fileURLToPath21(import.meta.url));
21083
21186
  const argv = fs28.realpathSync(path27.resolve(process13.argv[1]));
21084
21187
  return here === argv;
21085
21188
  } catch {
@@ -21093,7 +21196,7 @@ var init_sync_gitattributes = __esm({
21093
21196
  SECTION_HEADER2 = "# --- BEGIN agent-config managed: memory merge attributes ---";
21094
21197
  SECTION_FOOTER2 = "# --- END agent-config managed: memory merge attributes ---";
21095
21198
  DEFAULT_GITATTRIBUTES = ".gitattributes";
21096
- _HERE9 = fileURLToPath20(import.meta.url);
21199
+ _HERE9 = fileURLToPath21(import.meta.url);
21097
21200
  DEFAULT_TEMPLATE2 = path27.join(
21098
21201
  path27.dirname(_HERE9),
21099
21202
  "..",
@@ -21118,9 +21221,9 @@ var init_sync_gitattributes = __esm({
21118
21221
  // src/scripts/_lib/package_root.ts
21119
21222
  import * as fs29 from "node:fs";
21120
21223
  import * as path28 from "node:path";
21121
- import { fileURLToPath as fileURLToPath21 } from "node:url";
21224
+ import { fileURLToPath as fileURLToPath22 } from "node:url";
21122
21225
  function resolvePackageRoot(fromUrlOrPath, legacyHops = 3) {
21123
- const start = fromUrlOrPath.startsWith("file:") ? fileURLToPath21(fromUrlOrPath) : fromUrlOrPath;
21226
+ const start = fromUrlOrPath.startsWith("file:") ? fileURLToPath22(fromUrlOrPath) : fromUrlOrPath;
21124
21227
  const startDir = path28.dirname(start);
21125
21228
  let dir = startDir;
21126
21229
  for (let i = 0; i < MAX_ASCENT; i++) {
@@ -21156,7 +21259,7 @@ import * as fs30 from "node:fs";
21156
21259
  import * as path29 from "node:path";
21157
21260
  import { spawnSync as spawnSync6 } from "node:child_process";
21158
21261
  import process14 from "node:process";
21159
- import { fileURLToPath as fileURLToPath22, pathToFileURL as pathToFileURL14 } from "node:url";
21262
+ import { fileURLToPath as fileURLToPath23, pathToFileURL as pathToFileURL14 } from "node:url";
21160
21263
  function _print2(out, line = "") {
21161
21264
  out.write(line + "\n");
21162
21265
  }
@@ -21410,7 +21513,7 @@ function _isCliEntry14() {
21410
21513
  return true;
21411
21514
  }
21412
21515
  try {
21413
- const here = fs30.realpathSync(fileURLToPath22(import.meta.url));
21516
+ const here = fs30.realpathSync(fileURLToPath23(import.meta.url));
21414
21517
  const argv = fs30.realpathSync(path29.resolve(process14.argv[1]));
21415
21518
  return here === argv;
21416
21519
  } catch {
@@ -21426,7 +21529,7 @@ var init_cmd_refresh = __esm({
21426
21529
  init_sync_gitattributes();
21427
21530
  init_package_root();
21428
21531
  PACKAGE_ROOT = resolvePackageRoot(import.meta.url);
21429
- _HERE10 = fileURLToPath22(import.meta.url);
21532
+ _HERE10 = fileURLToPath23(import.meta.url);
21430
21533
  ArgparseExit3 = class extends Error {
21431
21534
  constructor(code) {
21432
21535
  super(`argparse-exit-${code}`);
@@ -22619,7 +22722,7 @@ var init_session_role = __esm({
22619
22722
  import * as crypto4 from "node:crypto";
22620
22723
  import * as fs37 from "node:fs";
22621
22724
  import * as path35 from "node:path";
22622
- import { fileURLToPath as fileURLToPath23 } from "node:url";
22725
+ import { fileURLToPath as fileURLToPath24 } from "node:url";
22623
22726
  function _hash_original_ask(originalAsk) {
22624
22727
  if (!originalAsk) {
22625
22728
  return "0".repeat(12);
@@ -22813,7 +22916,7 @@ var init_events_log = __esm({
22813
22916
  "block_quota"
22814
22917
  ]);
22815
22918
  _KILL_SWITCH_ENV = "AGENT_CONFIG_NO_EVENTS_LOG";
22816
- _HERE11 = fileURLToPath23(import.meta.url);
22919
+ _HERE11 = fileURLToPath24(import.meta.url);
22817
22920
  _REPO_ROOT = path35.resolve(path35.dirname(_HERE11), "..", "..", "..");
22818
22921
  _DEFAULT_LOG_PATH = path35.join(
22819
22922
  _REPO_ROOT,
@@ -26968,6 +27071,15 @@ function atomic_write_json(target, payload, options = {}) {
26968
27071
  const body = _py_json_dumps(payload, indent) + "\n";
26969
27072
  _atomic_write_text2(targetPath, body);
26970
27073
  }
27074
+ function atomic_write_text(target, text) {
27075
+ if (is_replay_mode()) {
27076
+ return;
27077
+ }
27078
+ const targetPath = path40.resolve(target);
27079
+ const state_dir = path40.dirname(targetPath);
27080
+ fs41.mkdirSync(state_dir, { recursive: true });
27081
+ _atomic_write_text2(targetPath, text);
27082
+ }
26971
27083
  function _acquire_lock(lock_path) {
26972
27084
  const fd = fs41.openSync(lock_path, "a", 420);
26973
27085
  const held = lock_path + ".held";
@@ -27457,7 +27569,7 @@ import * as fs46 from "node:fs";
27457
27569
  import * as os11 from "node:os";
27458
27570
  import * as path44 from "node:path";
27459
27571
  import process15 from "node:process";
27460
- import { fileURLToPath as fileURLToPath24, pathToFileURL as pathToFileURL15 } from "node:url";
27572
+ import { fileURLToPath as fileURLToPath25, pathToFileURL as pathToFileURL15 } from "node:url";
27461
27573
  function expanduser5(p) {
27462
27574
  if (p === "~") return os11.homedir();
27463
27575
  if (p.startsWith("~/") || p.startsWith("~\\")) {
@@ -29937,7 +30049,7 @@ function _isCliEntry15() {
29937
30049
  return true;
29938
30050
  }
29939
30051
  try {
29940
- const here = fs46.realpathSync(fileURLToPath24(import.meta.url));
30052
+ const here = fs46.realpathSync(fileURLToPath25(import.meta.url));
29941
30053
  const argv = fs46.realpathSync(path44.resolve(process15.argv[1]));
29942
30054
  return here === argv;
29943
30055
  } catch {
@@ -29967,7 +30079,7 @@ var init_cmd_doctor = __esm({
29967
30079
  init_review_gate();
29968
30080
  init_package_root();
29969
30081
  init_rule_scope();
29970
- _HERE12 = fileURLToPath24(import.meta.url);
30082
+ _HERE12 = fileURLToPath25(import.meta.url);
29971
30083
  ArgparseExit4 = class extends Error {
29972
30084
  constructor(code) {
29973
30085
  super(`argparse-exit-${code}`);
@@ -30206,6 +30318,16 @@ function comparePair(a, b) {
30206
30318
  }
30207
30319
  return "body-diff";
30208
30320
  }
30321
+ function stripFrontmatter(text) {
30322
+ if (!text.startsWith("---")) return text;
30323
+ const end = text.indexOf("\n---", 3);
30324
+ if (end === -1) return text;
30325
+ const afterFence = text.indexOf("\n", end + 1);
30326
+ return afterFence === -1 ? "" : text.slice(afterFence + 1);
30327
+ }
30328
+ function proseEqual(a, b) {
30329
+ return stripFrontmatter(a).trim() === stripFrontmatter(b).trim();
30330
+ }
30209
30331
  function censusRuleDir(dir) {
30210
30332
  let files = 0;
30211
30333
  let chars = 0;
@@ -30301,7 +30423,11 @@ var init_prompt_shape = __esm({
30301
30423
  // src/scripts/language_mirror_hook.ts
30302
30424
  import fs48 from "node:fs";
30303
30425
  import path46 from "node:path";
30304
- import { fileURLToPath as fileURLToPath25, pathToFileURL as pathToFileURL16 } from "node:url";
30426
+ import { fileURLToPath as fileURLToPath26, pathToFileURL as pathToFileURL16 } from "node:url";
30427
+ function pinLostMarker(session_id) {
30428
+ const safe = (session_id || "unknown-session").replace(/[^A-Za-z0-9._-]/g, "_");
30429
+ return path46.join(PIN_LOST_DIR, `${safe}.marker`);
30430
+ }
30305
30431
  function _isObject2(v) {
30306
30432
  return typeof v === "object" && v !== null && !Array.isArray(v);
30307
30433
  }
@@ -30432,35 +30558,49 @@ function _extractPrompt(payload) {
30432
30558
  }
30433
30559
  return "";
30434
30560
  }
30435
- function _setPinLost(consumer_root) {
30561
+ function _sessionId(envelope) {
30562
+ const v = envelope["session_id"];
30563
+ return typeof v === "string" && v.trim() !== "" ? v : "unknown-session";
30564
+ }
30565
+ function _migrateLegacyMarker(consumer_root) {
30566
+ const legacy = path46.join(consumer_root, PIN_LOST_DIR);
30436
30567
  try {
30437
- const target = path46.join(consumer_root, PIN_LOST_MARKER);
30438
- fs48.mkdirSync(path46.dirname(target), { recursive: true });
30439
- fs48.writeFileSync(target, (/* @__PURE__ */ new Date()).toISOString());
30568
+ if (fs48.statSync(legacy).isFile()) {
30569
+ fs48.rmSync(legacy, { force: true });
30570
+ }
30440
30571
  } catch {
30441
30572
  }
30442
30573
  }
30443
- function _pinLost(consumer_root) {
30574
+ function _setPinLost(consumer_root, session_id) {
30575
+ if (is_replay_mode()) return;
30576
+ _migrateLegacyMarker(consumer_root);
30444
30577
  try {
30445
- return fs48.existsSync(path46.join(consumer_root, PIN_LOST_MARKER));
30578
+ atomic_write_text(path46.join(consumer_root, pinLostMarker(session_id)), (/* @__PURE__ */ new Date()).toISOString());
30579
+ } catch {
30580
+ }
30581
+ }
30582
+ function _pinLost(consumer_root, session_id) {
30583
+ try {
30584
+ return fs48.existsSync(path46.join(consumer_root, pinLostMarker(session_id)));
30446
30585
  } catch {
30447
30586
  return false;
30448
30587
  }
30449
30588
  }
30450
- function _clearPinLost(consumer_root) {
30589
+ function _clearPinLost(consumer_root, session_id) {
30590
+ if (is_replay_mode()) return;
30451
30591
  try {
30452
- fs48.rmSync(path46.join(consumer_root, PIN_LOST_MARKER), { force: true });
30592
+ fs48.rmSync(path46.join(consumer_root, pinLostMarker(session_id)), { force: true });
30453
30593
  } catch {
30454
30594
  }
30455
30595
  }
30456
- function _reEmitAfterCompaction(consumer_root) {
30457
- if (!_pinLost(consumer_root)) {
30596
+ function _reEmitAfterCompaction(consumer_root, session_id) {
30597
+ if (!_pinLost(consumer_root, session_id)) {
30458
30598
  return EXIT_ALLOW;
30459
30599
  }
30460
30600
  const previous = _loadState(path46.join(consumer_root, STATE_FILE));
30461
30601
  const language = previous.language;
30462
30602
  const source = previous.source === "system-locale" ? "system-locale" : "prompt";
30463
- _clearPinLost(consumer_root);
30603
+ _clearPinLost(consumer_root, session_id);
30464
30604
  if (language !== "de" && language !== "en") {
30465
30605
  return EXIT_ALLOW;
30466
30606
  }
@@ -30489,11 +30629,11 @@ function run(stdin_text, options) {
30489
30629
  const payload = _isObject2(envelope["payload"]) ? envelope["payload"] : envelope;
30490
30630
  const event = typeof envelope["event"] === "string" ? envelope["event"] : "";
30491
30631
  if (event === "pre_compact") {
30492
- _setPinLost(options.consumer_root);
30632
+ _setPinLost(options.consumer_root, _sessionId(envelope));
30493
30633
  return EXIT_ALLOW;
30494
30634
  }
30495
30635
  if (event === "post_tool_use") {
30496
- return _reEmitAfterCompaction(options.consumer_root);
30636
+ return _reEmitAfterCompaction(options.consumer_root, _sessionId(envelope));
30497
30637
  }
30498
30638
  const prompt = _extractPrompt(payload);
30499
30639
  if (!prompt) {
@@ -30560,14 +30700,14 @@ function _isCliEntry16() {
30560
30700
  return true;
30561
30701
  }
30562
30702
  try {
30563
- const here = fs48.realpathSync(fileURLToPath25(import.meta.url));
30703
+ const here = fs48.realpathSync(fileURLToPath26(import.meta.url));
30564
30704
  const argv = fs48.realpathSync(path46.resolve(process.argv[1]));
30565
30705
  return here === argv;
30566
30706
  } catch {
30567
30707
  return false;
30568
30708
  }
30569
30709
  }
30570
- var EXIT_ALLOW, EXIT_WARN, STATE_FILE, PIN_LOST_MARKER, DE_MARKERS, EN_MARKERS, MIN_MARKERS, LANGUAGE_NAME, LOCALE_ENV_KEYS;
30710
+ var EXIT_ALLOW, EXIT_WARN, STATE_FILE, PIN_LOST_DIR, DE_MARKERS, EN_MARKERS, MIN_MARKERS, LANGUAGE_NAME, LOCALE_ENV_KEYS;
30571
30711
  var init_language_mirror_hook = __esm({
30572
30712
  "src/scripts/language_mirror_hook.ts"() {
30573
30713
  "use strict";
@@ -30577,7 +30717,7 @@ var init_language_mirror_hook = __esm({
30577
30717
  EXIT_ALLOW = 0;
30578
30718
  EXIT_WARN = 2;
30579
30719
  STATE_FILE = path46.join("agents", "state", "language-mirror.json");
30580
- PIN_LOST_MARKER = path46.join("agents", "state", "language-mirror.pin-lost");
30720
+ PIN_LOST_DIR = path46.join("agents", "state", "language-mirror.pin-lost");
30581
30721
  DE_MARKERS = /\b(der|die|das|den|dem|und|ist|sind|nicht|kein|keine|mach|mache|bitte|warum|wieso|weshalb|weiter|kannst|sollst|soll|musst|muss|hast|habe|haben|wir|ich|du|dann|noch|auch|schon|wenn|aber|alle|mit|ohne|damit|dass|wurde|werden|gibt|nochmal|erstell|erstelle|erstelle|fehler|regeln|arbeite|analysiere|fixe|nimm|lege|prüfe|pruefe|schau|zeig|mir|dir|sich|eine|einen|einem|einer|vom|zum|zur|beim|im)\b|[äöüÄÖÜß]/gi;
30582
30722
  EN_MARKERS = /\b(the|and|is|are|was|were|not|please|why|because|should|would|could|there|these|those|with|from|about|which|that|this|will|have|has|been|they|them|their|your|our|what|when|where|make|need|want|does|doesn't|don't|it's|let's)\b/gi;
30583
30723
  MIN_MARKERS = 2;
@@ -30595,7 +30735,7 @@ var init_language_mirror_hook = __esm({
30595
30735
  // src/scripts/git_authorization_hook.ts
30596
30736
  import fs49 from "node:fs";
30597
30737
  import path47 from "node:path";
30598
- import { fileURLToPath as fileURLToPath26, pathToFileURL as pathToFileURL17 } from "node:url";
30738
+ import { fileURLToPath as fileURLToPath27, pathToFileURL as pathToFileURL17 } from "node:url";
30599
30739
  function _isObject3(v) {
30600
30740
  return typeof v === "object" && v !== null && !Array.isArray(v);
30601
30741
  }
@@ -30716,7 +30856,7 @@ function _isCliEntry17() {
30716
30856
  return true;
30717
30857
  }
30718
30858
  try {
30719
- const here = fs49.realpathSync(fileURLToPath26(import.meta.url));
30859
+ const here = fs49.realpathSync(fileURLToPath27(import.meta.url));
30720
30860
  const argv = fs49.realpathSync(path47.resolve(process.argv[1]));
30721
30861
  return here === argv;
30722
30862
  } catch {
@@ -30772,7 +30912,7 @@ var init_git_authorization_hook = __esm({
30772
30912
  // src/scripts/hooks/block_unauthorized_git.ts
30773
30913
  import fs50 from "node:fs";
30774
30914
  import path48 from "node:path";
30775
- import { fileURLToPath as fileURLToPath27, pathToFileURL as pathToFileURL18 } from "node:url";
30915
+ import { fileURLToPath as fileURLToPath28, pathToFileURL as pathToFileURL18 } from "node:url";
30776
30916
  function _isObject4(v) {
30777
30917
  return typeof v === "object" && v !== null && !Array.isArray(v);
30778
30918
  }
@@ -31051,7 +31191,7 @@ function _isCliEntry18() {
31051
31191
  return true;
31052
31192
  }
31053
31193
  try {
31054
- const here = fs50.realpathSync(fileURLToPath27(import.meta.url));
31194
+ const here = fs50.realpathSync(fileURLToPath28(import.meta.url));
31055
31195
  const argv = fs50.realpathSync(path48.resolve(process.argv[1]));
31056
31196
  return here === argv;
31057
31197
  } catch {
@@ -31116,7 +31256,7 @@ var init_block_unauthorized_git = __esm({
31116
31256
  // src/scripts/before_complete_hook.ts
31117
31257
  import fs51 from "node:fs";
31118
31258
  import path49 from "node:path";
31119
- import { fileURLToPath as fileURLToPath28, pathToFileURL as pathToFileURL19 } from "node:url";
31259
+ import { fileURLToPath as fileURLToPath29, pathToFileURL as pathToFileURL19 } from "node:url";
31120
31260
  function _now2() {
31121
31261
  return (/* @__PURE__ */ new Date()).toISOString().replace(/\.\d{3}Z$/, "+00:00");
31122
31262
  }
@@ -31370,7 +31510,7 @@ function _isCliEntry19() {
31370
31510
  return true;
31371
31511
  }
31372
31512
  try {
31373
- const here = fs51.realpathSync(fileURLToPath28(import.meta.url));
31513
+ const here = fs51.realpathSync(fileURLToPath29(import.meta.url));
31374
31514
  const argv = fs51.realpathSync(path49.resolve(process.argv[1]));
31375
31515
  return here === argv;
31376
31516
  } catch {
@@ -31430,7 +31570,7 @@ var init_before_complete_hook = __esm({
31430
31570
  import crypto7 from "node:crypto";
31431
31571
  import fs52 from "node:fs";
31432
31572
  import path50 from "node:path";
31433
- import { fileURLToPath as fileURLToPath29, pathToFileURL as pathToFileURL20 } from "node:url";
31573
+ import { fileURLToPath as fileURLToPath30, pathToFileURL as pathToFileURL20 } from "node:url";
31434
31574
  function _isObject5(v) {
31435
31575
  return typeof v === "object" && v !== null && !Array.isArray(v);
31436
31576
  }
@@ -31589,7 +31729,7 @@ function _isCliEntry20() {
31589
31729
  return true;
31590
31730
  }
31591
31731
  try {
31592
- const here = fs52.realpathSync(fileURLToPath29(import.meta.url));
31732
+ const here = fs52.realpathSync(fileURLToPath30(import.meta.url));
31593
31733
  const argv = fs52.realpathSync(path50.resolve(process.argv[1]));
31594
31734
  return here === argv;
31595
31735
  } catch {
@@ -31648,7 +31788,7 @@ import { createHash as createHash8 } from "node:crypto";
31648
31788
  import fs53 from "node:fs";
31649
31789
  import os12 from "node:os";
31650
31790
  import path51 from "node:path";
31651
- import { fileURLToPath as fileURLToPath30, pathToFileURL as pathToFileURL21 } from "node:url";
31791
+ import { fileURLToPath as fileURLToPath31, pathToFileURL as pathToFileURL21 } from "node:url";
31652
31792
  function bandVerdict(rate_pct, assistant_turns) {
31653
31793
  if (assistant_turns < BAND_MIN_TURNS) {
31654
31794
  return "corpus-too-small";
@@ -32024,7 +32164,7 @@ function _isCliEntry21() {
32024
32164
  return true;
32025
32165
  }
32026
32166
  try {
32027
- const here = fs53.realpathSync(fileURLToPath30(import.meta.url));
32167
+ const here = fs53.realpathSync(fileURLToPath31(import.meta.url));
32028
32168
  const argv = fs53.realpathSync(path51.resolve(process.argv[1]));
32029
32169
  return here === argv;
32030
32170
  } catch {
@@ -32043,7 +32183,7 @@ var init_conformance_scan = __esm({
32043
32183
  init_block_unauthorized_git();
32044
32184
  init_before_complete_hook();
32045
32185
  init_evidence_independence();
32046
- REPO_ROOT2 = path51.resolve(path51.dirname(fileURLToPath30(import.meta.url)), "..", "..");
32186
+ REPO_ROOT2 = path51.resolve(path51.dirname(fileURLToPath31(import.meta.url)), "..", "..");
32047
32187
  OBSERVED_BAND = { low: 9.1, high: 39.2 };
32048
32188
  BAND_MIN_TURNS = 1978;
32049
32189
  HARNESS_TEXT = /^(API Error:|Request (timed out|was aborted)|\[Request interrupted|Error: |Credit balance is too low|You've hit your|Prompt is too long)/i;
@@ -32066,7 +32206,7 @@ import * as fs54 from "node:fs";
32066
32206
  import * as os13 from "node:os";
32067
32207
  import * as path52 from "node:path";
32068
32208
  import process16 from "node:process";
32069
- import { fileURLToPath as fileURLToPath31, pathToFileURL as pathToFileURL22 } from "node:url";
32209
+ import { fileURLToPath as fileURLToPath32, pathToFileURL as pathToFileURL22 } from "node:url";
32070
32210
  function _listRules(dir) {
32071
32211
  try {
32072
32212
  return fs54.readdirSync(dir).filter((f) => f.endsWith(".md")).sort();
@@ -32096,6 +32236,7 @@ function compareCarriers(projectDir, globalDir, sourceDir) {
32096
32236
  shared: 0,
32097
32237
  identical: [],
32098
32238
  provenanceOnly: [],
32239
+ frontmatterOnly: [],
32099
32240
  bodyDiff: [],
32100
32241
  projectOnly: [],
32101
32242
  globalOnly: [],
@@ -32120,11 +32261,12 @@ function compareCarriers(projectDir, globalDir, sourceDir) {
32120
32261
  }
32121
32262
  out.shared += 1;
32122
32263
  let verdict;
32264
+ let proseSame;
32123
32265
  try {
32124
- verdict = comparePair(
32125
- fs54.readFileSync(path52.join(projectDir, rule)),
32126
- fs54.readFileSync(path52.join(globalDir, rule))
32127
- );
32266
+ const projectCopy = fs54.readFileSync(path52.join(projectDir, rule));
32267
+ const globalCopy = fs54.readFileSync(path52.join(globalDir, rule));
32268
+ verdict = comparePair(projectCopy, globalCopy);
32269
+ proseSame = proseEqual(projectCopy.toString("utf-8"), globalCopy.toString("utf-8"));
32128
32270
  } catch {
32129
32271
  out.shared -= 1;
32130
32272
  out.unreadable.push(rule);
@@ -32132,6 +32274,7 @@ function compareCarriers(projectDir, globalDir, sourceDir) {
32132
32274
  }
32133
32275
  if (verdict === "identical") out.identical.push(rule);
32134
32276
  else if (verdict === "provenance-only") out.provenanceOnly.push(rule);
32277
+ else if (proseSame) out.frontmatterOnly.push(rule);
32135
32278
  else out.bodyDiff.push(rule);
32136
32279
  }
32137
32280
  return out;
@@ -32160,7 +32303,8 @@ function render3(d) {
32160
32303
  lines.push(` shared rule names ${d.shared}`);
32161
32304
  lines.push(` byte-identical ${d.identical.length}`);
32162
32305
  lines.push(` differ ONLY in the install stamp ${d.provenanceOnly.length}`);
32163
- lines.push(` differ in BODY ${d.bodyDiff.length}`);
32306
+ lines.push(` differ ONLY in frontmatter ${d.frontmatterOnly.length}`);
32307
+ lines.push(` differ in PROSE ${d.bodyDiff.length}`);
32164
32308
  if (d.unreadable.length > 0) {
32165
32309
  lines.push(` unreadable on one side ${d.unreadable.length} (${d.unreadable.join(", ")})`);
32166
32310
  lines.push(" Not counted as shared and NOT a body difference \u2014 a dangling entry is");
@@ -32170,15 +32314,32 @@ function render3(d) {
32170
32314
  lines.push(` present at global scope only ${d.globalOnly.length}`);
32171
32315
  lines.push("");
32172
32316
  if (d.bodyDiff.length > 0) {
32173
- lines.push(" BODY DIVERGENCE \u2014 the two carriers deliver different text for these rules.");
32174
- lines.push(" Both copies reach the model, with no precedence marker between them, so a");
32175
- lines.push(" claim one copy retracts can be re-asserted by the other. PRECEDENCE: the");
32176
- lines.push(" project projection is generated from src/ at this commit and wins; the");
32177
- lines.push(" global install is a release snapshot. Close it by reinstalling the global");
32178
- lines.push(" copy, or by reading the project copy as authoritative.");
32317
+ lines.push(" PROSE DIVERGENCE \u2014 the two carriers deliver different governed text for");
32318
+ lines.push(" these rules. Both copies reach the model, and the host resolves NOTHING:");
32319
+ lines.push(" rules without a `paths` key load at launch with the same priority as");
32320
+ lines.push(" CLAUDE.md, with no precedence marker between the layers, so a claim one");
32321
+ lines.push(" copy retracts can be re-asserted by the other and which text binds is");
32322
+ lines.push(" UNDEFINED. Cited, not inferred \u2014 agents/evidence/analysis/");
32323
+ lines.push(" claude-code-rules-dir-contract.md (host 2.1.226, the host's own docs plus");
32324
+ lines.push(" a first-party observation). The project copy is the NEWER text, which is a");
32325
+ lines.push(" fact about recency and NOT a host precedence rule: close the divergence by");
32326
+ lines.push(" reinstalling the global copy, or decide which text binds \u2014 do not assume");
32327
+ lines.push(" the newer one already won.");
32179
32328
  for (const r of d.bodyDiff) lines.push(` - ${r}`);
32180
32329
  lines.push("");
32181
32330
  }
32331
+ if (d.frontmatterOnly.length > 0) {
32332
+ lines.push(` ${String(d.frontmatterOnly.length)} pair(s) differ ONLY in the frontmatter block \u2014 prose byte-identical.`);
32333
+ lines.push(" Not a governed-text difference and nothing to act on: the host delivers the");
32334
+ lines.push(" prose without that block, and none of the keys in it is one this host reads");
32335
+ lines.push(" (claude-code-rules-dir-contract.md: it reads `paths`, and agent-config's own");
32336
+ lines.push(" vocabulary is not read at all). Two writers, two frontmatter policies \u2014");
32337
+ lines.push(" `generate-tools` emits `paths` where a rule is path-scoped and nothing");
32338
+ lines.push(" otherwise; `install.ts` writes the full vocabulary plus its ownership stamp.");
32339
+ lines.push(" Reported as a count on purpose: naming every pair would bury the class");
32340
+ lines.push(" above, which is the one a reader must act on.");
32341
+ lines.push("");
32342
+ }
32182
32343
  if (d.provenanceOnly.length > 0) {
32183
32344
  lines.push(` ${String(d.provenanceOnly.length)} pair(s) differ only by the installer's package:/source_path: stamp.`);
32184
32345
  lines.push(" Not a content difference and NOT a defect: install.ts stamps every installed");
@@ -32214,9 +32375,14 @@ function render3(d) {
32214
32375
  }
32215
32376
  if (d.bodyDiff.length === 0) {
32216
32377
  lines.push("");
32217
- lines.push(" No body divergence. The condition is transient \u2014 it returns whenever the");
32218
- lines.push(" checkout moves ahead of the installed release \u2014 so this is a reading of");
32219
- lines.push(" right now, not a property of the repo. Re-run it, do not cite it.");
32378
+ lines.push(" No prose divergence \u2014 no rule's governed text differs between the carriers.");
32379
+ lines.push(" The condition is transient \u2014 it returns whenever the checkout moves ahead of");
32380
+ lines.push(" the installed release \u2014 so this is a reading of right now, not a property of");
32381
+ lines.push(" the repo. Re-run it, do not cite it. That holds doubly here: the reading also");
32382
+ lines.push(" depends on WHICH GENERATION of the emitter produced the project tree (a");
32383
+ lines.push(" frontmatter-carrying symlink tree and a frontmatter-less real-file tree");
32384
+ lines.push(" classify the same commit differently), so a number from another checkout is");
32385
+ lines.push(" not comparable to this one.");
32220
32386
  }
32221
32387
  return lines.join("\n");
32222
32388
  }
@@ -32272,7 +32438,7 @@ var init_report_carrier_divergence = __esm({
32272
32438
  "src/scripts/report_carrier_divergence.ts"() {
32273
32439
  "use strict";
32274
32440
  init_carrier_divergence();
32275
- _HERE13 = fileURLToPath31(import.meta.url);
32441
+ _HERE13 = fileURLToPath32(import.meta.url);
32276
32442
  REPO_ROOT3 = path52.resolve(path52.dirname(_HERE13), "..", "..");
32277
32443
  PROJECT_RULES = path52.join(".claude", "rules");
32278
32444
  PROJECTION_SOURCE = path52.join("dist", "agent-src", "rules");
@@ -32287,7 +32453,7 @@ var init_report_carrier_divergence = __esm({
32287
32453
  import * as fs55 from "node:fs";
32288
32454
  import * as os14 from "node:os";
32289
32455
  import * as path53 from "node:path";
32290
- import { fileURLToPath as fileURLToPath32, pathToFileURL as pathToFileURL23 } from "node:url";
32456
+ import { fileURLToPath as fileURLToPath33, pathToFileURL as pathToFileURL23 } from "node:url";
32291
32457
  function censusSkills(root) {
32292
32458
  const out = { total: 0, withTriggerKey: [], withDeterministicObligation: [] };
32293
32459
  if (!fs55.existsSync(root)) {
@@ -32447,7 +32613,7 @@ var _HERE14, REPO_ROOT4, SKILLS_ROOT, TRIGGER_KEYS, DETERMINISTIC_RE;
32447
32613
  var init_report_skill_activation = __esm({
32448
32614
  "src/scripts/report_skill_activation.ts"() {
32449
32615
  "use strict";
32450
- _HERE14 = fileURLToPath32(import.meta.url);
32616
+ _HERE14 = fileURLToPath33(import.meta.url);
32451
32617
  REPO_ROOT4 = path53.resolve(path53.dirname(_HERE14), "..", "..");
32452
32618
  SKILLS_ROOT = "src/skills";
32453
32619
  TRIGGER_KEYS = ["triggers:", "trigger_description:", "file_pattern:", "path_prefix:"];
@@ -32463,7 +32629,7 @@ import * as fs56 from "node:fs";
32463
32629
  import * as os15 from "node:os";
32464
32630
  import * as path54 from "node:path";
32465
32631
  import process17 from "node:process";
32466
- import { fileURLToPath as fileURLToPath33, pathToFileURL as pathToFileURL24 } from "node:url";
32632
+ import { fileURLToPath as fileURLToPath34, pathToFileURL as pathToFileURL24 } from "node:url";
32467
32633
  function _verb(line) {
32468
32634
  const m = /\b(NEVER|MUST|ALWAYS)\b/.exec(line);
32469
32635
  return m?.[1] ?? "NEVER";
@@ -32756,7 +32922,7 @@ var init_report_skill_obligation_violations = __esm({
32756
32922
  "use strict";
32757
32923
  init_transcript_entry();
32758
32924
  init_report_skill_activation();
32759
- _HERE15 = fileURLToPath33(import.meta.url);
32925
+ _HERE15 = fileURLToPath34(import.meta.url);
32760
32926
  REPO_ROOT5 = path54.resolve(path54.dirname(_HERE15), "..", "..");
32761
32927
  OBLIGATION_LINE_RE = new RegExp(`${DETERMINISTIC_RE.source}.*`, "gm");
32762
32928
  PATH_RE = /`([A-Za-z0-9_./-]*\/[A-Za-z0-9_.-]+\.[a-z]{2,6})`/g;
@@ -32802,7 +32968,7 @@ import * as fs57 from "node:fs";
32802
32968
  import * as os16 from "node:os";
32803
32969
  import * as path55 from "node:path";
32804
32970
  import process18 from "node:process";
32805
- import { fileURLToPath as fileURLToPath34, pathToFileURL as pathToFileURL25 } from "node:url";
32971
+ import { fileURLToPath as fileURLToPath35, pathToFileURL as pathToFileURL25 } from "node:url";
32806
32972
  function buildFunnel(opts = {}) {
32807
32973
  const repoRoot = opts.repoRoot ?? REPO_ROOT6;
32808
32974
  const projectRulesDir = opts.projectRulesDir ?? path55.join(repoRoot, PROJECT_RULES);
@@ -32846,12 +33012,18 @@ function render6(r) {
32846
33012
  lines.push(" substituted with dist/, which would answer a different question.");
32847
33013
  } else {
32848
33014
  lines.push(
32849
- ` Divergence: ${d.shared} shared \xB7 ${d.bodyDiff.length} body-diff \xB7 ${d.provenanceOnly.length} provenance-only \xB7 ${d.projectOnly.length} project-only \xB7 ${d.globalOnly.length} global-only` + (d.manualOnlyGlobal.length > 0 ? ` (${d.manualOnlyGlobal.length} by design, ADR-004 manual)` : "")
33015
+ ` Divergence: ${d.shared} shared \xB7 ${d.bodyDiff.length} prose-diff \xB7 ${d.frontmatterOnly.length} frontmatter-only \xB7 ${d.provenanceOnly.length} provenance-only \xB7 ${d.projectOnly.length} project-only \xB7 ${d.globalOnly.length} global-only` + (d.manualOnlyGlobal.length > 0 ? ` (${d.manualOnlyGlobal.length} by design, ADR-004 manual)` : "")
32850
33016
  );
32851
33017
  if (d.bodyDiff.length > 0) {
32852
- lines.push(` BODY DIVERGENCE \u2014 both copies reach the model: ${d.bodyDiff.join(", ")}`);
32853
- lines.push(" Precedence: the project projection is generated from src/ at this commit");
32854
- lines.push(" and wins; the global install is a release snapshot.");
33018
+ lines.push(` PROSE DIVERGENCE \u2014 both copies reach the model: ${d.bodyDiff.join(", ")}`);
33019
+ lines.push(" The host resolves nothing: both layers load at launch at the same");
33020
+ lines.push(" priority with no precedence marker, so which text binds is UNDEFINED");
33021
+ lines.push(" (claude-code-rules-dir-contract.md). The project copy is merely the");
33022
+ lines.push(" newer one \u2014 recency, not precedence.");
33023
+ }
33024
+ if (d.frontmatterOnly.length > 0) {
33025
+ lines.push(` ${String(d.frontmatterOnly.length)} pair(s) differ only in frontmatter \u2014 prose byte-identical, nothing`);
33026
+ lines.push(" to act on; the host delivers the prose without that block.");
32855
33027
  }
32856
33028
  if (d.unreadable.length > 0) {
32857
33029
  lines.push(` Unreadable on one side (${d.unreadable.length}) \u2014 a broken install, not a disagreement.`);
@@ -32971,7 +33143,7 @@ var init_report_conformance_funnel = __esm({
32971
33143
  init_report_carrier_divergence();
32972
33144
  init_report_skill_activation();
32973
33145
  init_report_skill_obligation_violations();
32974
- _HERE16 = fileURLToPath34(import.meta.url);
33146
+ _HERE16 = fileURLToPath35(import.meta.url);
32975
33147
  REPO_ROOT6 = path55.resolve(path55.dirname(_HERE16), "..", "..");
32976
33148
  if (_isCliEntry24()) {
32977
33149
  process18.exit(main25());
@@ -33004,7 +33176,7 @@ import * as os17 from "node:os";
33004
33176
  import * as path56 from "node:path";
33005
33177
  import process19 from "node:process";
33006
33178
  import { spawnSync as spawnSync9 } from "node:child_process";
33007
- import { fileURLToPath as fileURLToPath35, pathToFileURL as pathToFileURL26 } from "node:url";
33179
+ import { fileURLToPath as fileURLToPath36, pathToFileURL as pathToFileURL26 } from "node:url";
33008
33180
  function print2(s = "") {
33009
33181
  process19.stdout.write(`${s}
33010
33182
  `);
@@ -33470,7 +33642,7 @@ function _isCliEntry25() {
33470
33642
  return true;
33471
33643
  }
33472
33644
  try {
33473
- const here = fs58.realpathSync(fileURLToPath35(import.meta.url));
33645
+ const here = fs58.realpathSync(fileURLToPath36(import.meta.url));
33474
33646
  const argv = fs58.realpathSync(path56.resolve(process19.argv[1]));
33475
33647
  return here === argv;
33476
33648
  } catch {
@@ -33490,7 +33662,7 @@ var init_cmd_conformance = __esm({
33490
33662
  init_router_target_paths();
33491
33663
  init_report_conformance_funnel();
33492
33664
  init_cmd_doctor();
33493
- _HERE17 = fileURLToPath35(import.meta.url);
33665
+ _HERE17 = fileURLToPath36(import.meta.url);
33494
33666
  PACKAGE_ROOT2 = resolvePackageRoot(import.meta.url);
33495
33667
  CONFORMANCE_CHECK_IDS = [
33496
33668
  "txlog-clean",
@@ -37660,7 +37832,7 @@ __export(pricing_exports, {
37660
37832
  });
37661
37833
  import * as fs65 from "node:fs";
37662
37834
  import * as path59 from "node:path";
37663
- import { fileURLToPath as fileURLToPath36 } from "node:url";
37835
+ import { fileURLToPath as fileURLToPath37 } from "node:url";
37664
37836
  function prices_file_for(repo_root) {
37665
37837
  return path59.join(repo_root, "agents", "runtime", ".agent-prices.md");
37666
37838
  }
@@ -37887,7 +38059,7 @@ var init_pricing = __esm({
37887
38059
  "src/scripts/ai_council/pricing.ts"() {
37888
38060
  "use strict";
37889
38061
  init_default_prices();
37890
- _HERE18 = fileURLToPath36(import.meta.url);
38062
+ _HERE18 = fileURLToPath37(import.meta.url);
37891
38063
  REPO_ROOT7 = path59.resolve(path59.dirname(_HERE18), "..", "..", "..");
37892
38064
  PRICES_FILE = path59.join(REPO_ROOT7, "agents", "runtime", ".agent-prices.md");
37893
38065
  _CHARS_PER_TOKEN = 4;
@@ -40960,7 +41132,7 @@ __export(council_cli_exports, {
40960
41132
  });
40961
41133
  import * as fs68 from "node:fs";
40962
41134
  import * as path61 from "node:path";
40963
- import { fileURLToPath as fileURLToPath37, pathToFileURL as pathToFileURL27 } from "node:url";
41135
+ import { fileURLToPath as fileURLToPath38, pathToFileURL as pathToFileURL27 } from "node:url";
40964
41136
  function _pyFixed6(x, ndigits) {
40965
41137
  if (!Number.isFinite(x)) {
40966
41138
  return String(x);
@@ -43708,7 +43880,7 @@ function _isCliEntry26() {
43708
43880
  return true;
43709
43881
  }
43710
43882
  try {
43711
- const here = fs68.realpathSync(fileURLToPath37(import.meta.url));
43883
+ const here = fs68.realpathSync(fileURLToPath38(import.meta.url));
43712
43884
  const argv = fs68.realpathSync(path61.resolve(process.argv[1]));
43713
43885
  return here === argv;
43714
43886
  } catch {
@@ -43767,7 +43939,7 @@ var init_council_cli = __esm({
43767
43939
  "xai",
43768
43940
  "perplexity"
43769
43941
  ]);
43770
- _HERE19 = path61.dirname(fileURLToPath37(import.meta.url));
43942
+ _HERE19 = path61.dirname(fileURLToPath38(import.meta.url));
43771
43943
  [REPO_ROOT8] = resolve_project_root(null);
43772
43944
  SETTINGS_FILE2 = project_settings_path(REPO_ROOT8);
43773
43945
  AI_COUNCIL_FILE = resolve_config_path(REPO_ROOT8);
@@ -43876,7 +44048,7 @@ var init_safety_envelope = __esm({
43876
44048
 
43877
44049
  // src/scripts/mcp_server/__main__.ts
43878
44050
  import * as path63 from "node:path";
43879
- import { fileURLToPath as fileURLToPath39 } from "node:url";
44051
+ import { fileURLToPath as fileURLToPath40 } from "node:url";
43880
44052
 
43881
44053
  // src/scripts/mcp_server/index.ts
43882
44054
  var __version__ = "0.1.0";
@@ -43925,7 +44097,7 @@ init_resources();
43925
44097
  // src/scripts/mcp_server/tools.ts
43926
44098
  import * as fs69 from "node:fs";
43927
44099
  import * as path62 from "node:path";
43928
- import { fileURLToPath as fileURLToPath38 } from "node:url";
44100
+ import { fileURLToPath as fileURLToPath39 } from "node:url";
43929
44101
 
43930
44102
  // src/scripts/chat_history.ts
43931
44103
  init_memory_lookup();
@@ -43934,7 +44106,7 @@ init_hook_stdin();
43934
44106
  import { createHash as createHash3 } from "node:crypto";
43935
44107
  import * as fs14 from "node:fs";
43936
44108
  import * as path13 from "node:path";
43937
- import { fileURLToPath as fileURLToPath8, pathToFileURL as pathToFileURL5 } from "node:url";
44109
+ import { fileURLToPath as fileURLToPath9, pathToFileURL as pathToFileURL5 } from "node:url";
43938
44110
  var DEFAULT_FILE = "agents/runtime/.agent-chat-history";
43939
44111
  var DEFAULT_SETTINGS_FILE = ".agent-settings.yml";
43940
44112
  var SCHEMA_VERSION3 = 4;
@@ -45951,7 +46123,7 @@ function _isCliEntry5() {
45951
46123
  return true;
45952
46124
  }
45953
46125
  try {
45954
- const here = fs14.realpathSync(fileURLToPath8(import.meta.url));
46126
+ const here = fs14.realpathSync(fileURLToPath9(import.meta.url));
45955
46127
  const argv = fs14.realpathSync(path13.resolve(process.argv[1]));
45956
46128
  return here === argv;
45957
46129
  } catch {
@@ -45976,16 +46148,16 @@ if (_invokedDirectly) {
45976
46148
  // src/scripts/mcp_server/catalog.ts
45977
46149
  import * as fs15 from "node:fs";
45978
46150
  import * as path14 from "node:path";
45979
- import { fileURLToPath as fileURLToPath9 } from "node:url";
46151
+ import { fileURLToPath as fileURLToPath10 } from "node:url";
45980
46152
  var _CATALOG_FILE = path14.join(
45981
46153
  true ? path14.resolve(
45982
- path14.dirname(fileURLToPath9(import.meta.url)),
46154
+ path14.dirname(fileURLToPath10(import.meta.url)),
45983
46155
  "..",
45984
46156
  "..",
45985
46157
  "src",
45986
46158
  "scripts",
45987
46159
  "mcp_server"
45988
- ) : path14.dirname(fileURLToPath9(import.meta.url)),
46160
+ ) : path14.dirname(fileURLToPath10(import.meta.url)),
45989
46161
  "consumer_tool_catalog.json"
45990
46162
  );
45991
46163
  var NOT_IMPLEMENTED_CODE = "not_implemented";
@@ -46431,8 +46603,8 @@ async function _memoryStatusHandler(_args, consumerRoot) {
46431
46603
  }
46432
46604
  return result;
46433
46605
  }
46434
- var _PACKAGE_ROOT2 = path62.resolve(
46435
- path62.dirname(fileURLToPath38(import.meta.url)),
46606
+ var _PACKAGE_ROOT3 = path62.resolve(
46607
+ path62.dirname(fileURLToPath39(import.meta.url)),
46436
46608
  "..",
46437
46609
  "..",
46438
46610
  ".."
@@ -46535,7 +46707,7 @@ async function _roadmapArchiveHandler(_args, consumerRoot) {
46535
46707
  async function _capabilitiesIndexHandler(args, consumerRoot) {
46536
46708
  const check = _pyTruthy6(args.check ?? false);
46537
46709
  const cap = await Promise.resolve().then(() => (init_generate_capabilities_index(), generate_capabilities_index_exports));
46538
- const out = path62.join(_PACKAGE_ROOT2, "CAPABILITIES.yaml");
46710
+ const out = path62.join(_PACKAGE_ROOT3, "CAPABILITIES.yaml");
46539
46711
  const content = cap.build();
46540
46712
  const onDisk = fs69.existsSync(out) ? fs69.readFileSync(out, "utf-8") : "";
46541
46713
  const drift = onDisk !== content;
@@ -47556,7 +47728,7 @@ function main28() {
47556
47728
  }
47557
47729
 
47558
47730
  // src/scripts/mcp_server/__main__.ts
47559
- var _selfPath = fileURLToPath39(import.meta.url);
47731
+ var _selfPath = fileURLToPath40(import.meta.url);
47560
47732
  var _invokedDirectly2 = globalThis.__AC_MCP_BUNDLE_DIRECT === true || process.argv[1] !== void 0 && path63.resolve(process.argv[1]) === path63.resolve(_selfPath);
47561
47733
  if (_invokedDirectly2) {
47562
47734
  main28();