@event4u/agent-config 9.30.0 → 9.32.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 (94) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/CHANGELOG.md +60 -292
  3. package/dist/agent-src/contexts/execution/host-capability-manifest.md +32 -1
  4. package/dist/agent-src/rules/delegation-policy.md +11 -1
  5. package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
  6. package/dist/agent-src/templates/scripts/work_engine/delivery_state.ts +6 -0
  7. package/dist/agent-src/templates/scripts/work_engine/directives/backend/_self_fix.ts +332 -0
  8. package/dist/agent-src/templates/scripts/work_engine/directives/backend/refine.ts +106 -1
  9. package/dist/agent-src/templates/scripts/work_engine/directives/backend/test.ts +50 -15
  10. package/dist/agent-src/templates/scripts/work_engine/directives/backend/verify.ts +49 -15
  11. package/dist/agent-src/templates/scripts/work_engine/state.ts +74 -0
  12. package/dist/agent-src/templates/scripts/work_engine/state_io.ts +6 -0
  13. package/dist/cli-delegate/chunk-2WELHO3P.js +582 -0
  14. package/dist/cli-delegate/{chunk-IYTGIG2Y.js → chunk-542DZR4P.js} +118 -148
  15. package/dist/cli-delegate/{chunk-66OVWGB5.js → chunk-AG47LAGQ.js} +1 -1
  16. package/dist/cli-delegate/{chunk-MP3JT3IU.js → chunk-DS6BLDMG.js} +1 -1
  17. package/dist/cli-delegate/{chunk-O3CO5BFB.js → chunk-EJITJBJX.js} +12 -1
  18. package/dist/cli-delegate/{chunk-EQY4FLJB.js → chunk-ITIQSGOQ.js} +3 -3
  19. package/dist/cli-delegate/{chunk-LCFJIQ4J.js → chunk-JEJABGKB.js} +110 -6
  20. package/dist/cli-delegate/chunk-PZWRPRWP.js +38 -0
  21. package/dist/cli-delegate/{chunk-BTJNRUX3.js → chunk-QEEB4LHO.js} +1 -1
  22. package/dist/cli-delegate/{chunk-DDUNNFYX.js → chunk-UVKNIJH2.js} +2 -2
  23. package/dist/cli-delegate/cmd_analyze_session.js +1 -1
  24. package/dist/cli-delegate/cmd_brand_status.js +1 -1
  25. package/dist/cli-delegate/cmd_conformance.js +154 -41
  26. package/dist/cli-delegate/cmd_doctor.js +4 -3
  27. package/dist/cli-delegate/cmd_explain.js +2 -2
  28. package/dist/cli-delegate/cmd_export.js +4 -4
  29. package/dist/cli-delegate/cmd_handoff.js +168 -59
  30. package/dist/cli-delegate/cmd_mcp_available.js +1 -1
  31. package/dist/cli-delegate/cmd_migrate.js +2 -2
  32. package/dist/cli-delegate/cmd_packs_active.js +2 -2
  33. package/dist/cli-delegate/cmd_prune.js +4 -4
  34. package/dist/cli-delegate/cmd_route_audit.js +2 -2
  35. package/dist/cli-delegate/cmd_route_explain.js +1 -1
  36. package/dist/cli-delegate/cmd_session_recycle.js +19 -4
  37. package/dist/cli-delegate/cmd_settings_get.js +2 -55
  38. package/dist/cli-delegate/cmd_settings_migrate.js +4 -4
  39. package/dist/cli-delegate/cmd_settings_set.js +1 -1
  40. package/dist/cli-delegate/cmd_sync.js +4 -4
  41. package/dist/cli-delegate/cmd_uninstall.js +4 -4
  42. package/dist/cli-delegate/cmd_update.js +1 -1
  43. package/dist/cli-delegate/cmd_upgrade.js +1 -1
  44. package/dist/cli-delegate/cmd_validate.js +4 -4
  45. package/dist/cli-delegate/cmd_versions.js +1 -1
  46. package/dist/discovery/deprecation-report.md +1 -1
  47. package/dist/discovery/discovery-manifest.json +3 -3
  48. package/dist/discovery/discovery-manifest.json.sha256 +1 -1
  49. package/dist/discovery/discovery-manifest.summary.md +1 -1
  50. package/dist/discovery/orphan-report.md +1 -1
  51. package/dist/discovery/packs.json +2 -2
  52. package/dist/discovery/trust-report.md +1 -1
  53. package/dist/discovery/workspaces.json +2 -2
  54. package/dist/hooks/dispatch.js +1411 -810
  55. package/dist/install/install.mjs +121 -16
  56. package/dist/mcp/registry-manifest.json +1 -1
  57. package/dist/mcp/server.json +2 -2
  58. package/dist/mcp/server.mjs +365 -143
  59. package/dist/scripts/_lib/agent_settings.js +111 -2
  60. package/dist/scripts/_lib/agent_settings.js.map +1 -1
  61. package/dist/server/schemas/settings.js +2 -2
  62. package/dist/server/schemas/settings.js.map +1 -1
  63. package/package.json +1 -1
  64. package/src/agent-src/templates/scripts/work_engine/delivery_state.ts +6 -0
  65. package/src/agent-src/templates/scripts/work_engine/directives/backend/_self_fix.ts +332 -0
  66. package/src/agent-src/templates/scripts/work_engine/directives/backend/refine.ts +106 -1
  67. package/src/agent-src/templates/scripts/work_engine/directives/backend/test.ts +50 -15
  68. package/src/agent-src/templates/scripts/work_engine/directives/backend/verify.ts +49 -15
  69. package/src/agent-src/templates/scripts/work_engine/state.ts +74 -0
  70. package/src/agent-src/templates/scripts/work_engine/state_io.ts +6 -0
  71. package/src/config/pack-size-budget.json +3 -2
  72. package/src/scripts/_cli/cmd_session_recycle.ts +25 -0
  73. package/src/scripts/_cli/explain_last/inputs.ts +13 -0
  74. package/src/scripts/_cli/handoff_generate.ts +36 -1
  75. package/src/scripts/_cli/handoff_sessions.ts +140 -9
  76. package/src/scripts/_lib/agent_settings.ts +119 -2
  77. package/src/scripts/_lib/carrier_divergence.ts +120 -2
  78. package/src/scripts/_lib/envelope_grounding.ts +206 -0
  79. package/src/scripts/_lib/host_capability.ts +79 -0
  80. package/src/scripts/_lib/session_eol.ts +85 -0
  81. package/src/scripts/_lib/subagent_capsule.ts +256 -1
  82. package/src/scripts/check_secret_leak.test.ts +43 -0
  83. package/src/scripts/check_secret_leak.ts +12 -0
  84. package/src/scripts/handoff_context_hook.ts +66 -18
  85. package/src/scripts/hooks/session_eol_hook.ts +12 -12
  86. package/src/scripts/hooks/turn_end_gate_hook.ts +296 -88
  87. package/src/scripts/language_mirror_hook.ts +69 -16
  88. package/src/scripts/measure_turn_end_gate.ts +129 -51
  89. package/src/scripts/report_carrier_divergence.ts +143 -30
  90. package/src/scripts/report_conformance_funnel.ts +18 -4
  91. package/src/scripts/routing_doctor.ts +25 -2
  92. package/src/scripts/schemas/dod.schema.json +45 -0
  93. package/src/server/schemas/settings.ts +2 -2
  94. package/dist/cli-delegate/chunk-RVGBH4XK.js +0 -142
@@ -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,37 @@ function comparePair(a, b) {
30206
30318
  }
30207
30319
  return "body-diff";
30208
30320
  }
30321
+ function splitFrontmatter(text) {
30322
+ if (!text.startsWith("---")) return { hadFrontmatter: false, frontmatter: "", body: text };
30323
+ const end = text.indexOf("\n---", 3);
30324
+ if (end === -1) return { hadFrontmatter: false, frontmatter: "", body: text };
30325
+ const afterFence = text.indexOf("\n", end + 1);
30326
+ return {
30327
+ hadFrontmatter: true,
30328
+ frontmatter: text.slice(3, end),
30329
+ body: afterFence === -1 ? "" : text.slice(afterFence + 1)
30330
+ };
30331
+ }
30332
+ function proseEqual(a, b) {
30333
+ const sa = splitFrontmatter(a);
30334
+ const sb = splitFrontmatter(b);
30335
+ if (!sa.hadFrontmatter && !sb.hadFrontmatter) return false;
30336
+ const leading = /^\n+/;
30337
+ return sa.body.replace(leading, "") === sb.body.replace(leading, "");
30338
+ }
30339
+ function frontmatterPaths(text) {
30340
+ const { hadFrontmatter, frontmatter } = splitFrontmatter(text);
30341
+ if (!hadFrontmatter) return null;
30342
+ const lines = frontmatter.split("\n");
30343
+ const start = lines.findIndex((l) => /^paths:/.test(l));
30344
+ if (start === -1) return null;
30345
+ const block = [lines[start]];
30346
+ for (const line of lines.slice(start + 1)) {
30347
+ if (/^\s/.test(line) && line.trim() !== "") block.push(line);
30348
+ else break;
30349
+ }
30350
+ return block.map((l) => l.trim()).join(" ");
30351
+ }
30209
30352
  function censusRuleDir(dir) {
30210
30353
  let files = 0;
30211
30354
  let chars = 0;
@@ -30301,7 +30444,11 @@ var init_prompt_shape = __esm({
30301
30444
  // src/scripts/language_mirror_hook.ts
30302
30445
  import fs48 from "node:fs";
30303
30446
  import path46 from "node:path";
30304
- import { fileURLToPath as fileURLToPath25, pathToFileURL as pathToFileURL16 } from "node:url";
30447
+ import { fileURLToPath as fileURLToPath26, pathToFileURL as pathToFileURL16 } from "node:url";
30448
+ function pinLostMarker(session_id) {
30449
+ const safe = (session_id || "unknown-session").replace(/[^A-Za-z0-9._-]/g, "_");
30450
+ return path46.join(PIN_LOST_DIR, `${safe}.marker`);
30451
+ }
30305
30452
  function _isObject2(v) {
30306
30453
  return typeof v === "object" && v !== null && !Array.isArray(v);
30307
30454
  }
@@ -30432,35 +30579,49 @@ function _extractPrompt(payload) {
30432
30579
  }
30433
30580
  return "";
30434
30581
  }
30435
- function _setPinLost(consumer_root) {
30582
+ function _sessionId(envelope) {
30583
+ const v = envelope["session_id"];
30584
+ return typeof v === "string" && v.trim() !== "" ? v : "unknown-session";
30585
+ }
30586
+ function _migrateLegacyMarker(consumer_root) {
30587
+ const legacy = path46.join(consumer_root, PIN_LOST_DIR);
30588
+ try {
30589
+ if (fs48.statSync(legacy).isFile()) {
30590
+ fs48.rmSync(legacy, { force: true });
30591
+ }
30592
+ } catch {
30593
+ }
30594
+ }
30595
+ function _setPinLost(consumer_root, session_id) {
30596
+ if (is_replay_mode()) return;
30597
+ _migrateLegacyMarker(consumer_root);
30436
30598
  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());
30599
+ atomic_write_text(path46.join(consumer_root, pinLostMarker(session_id)), (/* @__PURE__ */ new Date()).toISOString());
30440
30600
  } catch {
30441
30601
  }
30442
30602
  }
30443
- function _pinLost(consumer_root) {
30603
+ function _pinLost(consumer_root, session_id) {
30444
30604
  try {
30445
- return fs48.existsSync(path46.join(consumer_root, PIN_LOST_MARKER));
30605
+ return fs48.existsSync(path46.join(consumer_root, pinLostMarker(session_id)));
30446
30606
  } catch {
30447
30607
  return false;
30448
30608
  }
30449
30609
  }
30450
- function _clearPinLost(consumer_root) {
30610
+ function _clearPinLost(consumer_root, session_id) {
30611
+ if (is_replay_mode()) return;
30451
30612
  try {
30452
- fs48.rmSync(path46.join(consumer_root, PIN_LOST_MARKER), { force: true });
30613
+ fs48.rmSync(path46.join(consumer_root, pinLostMarker(session_id)), { force: true });
30453
30614
  } catch {
30454
30615
  }
30455
30616
  }
30456
- function _reEmitAfterCompaction(consumer_root) {
30457
- if (!_pinLost(consumer_root)) {
30617
+ function _reEmitAfterCompaction(consumer_root, session_id) {
30618
+ if (!_pinLost(consumer_root, session_id)) {
30458
30619
  return EXIT_ALLOW;
30459
30620
  }
30460
30621
  const previous = _loadState(path46.join(consumer_root, STATE_FILE));
30461
30622
  const language = previous.language;
30462
30623
  const source = previous.source === "system-locale" ? "system-locale" : "prompt";
30463
- _clearPinLost(consumer_root);
30624
+ _clearPinLost(consumer_root, session_id);
30464
30625
  if (language !== "de" && language !== "en") {
30465
30626
  return EXIT_ALLOW;
30466
30627
  }
@@ -30489,11 +30650,11 @@ function run(stdin_text, options) {
30489
30650
  const payload = _isObject2(envelope["payload"]) ? envelope["payload"] : envelope;
30490
30651
  const event = typeof envelope["event"] === "string" ? envelope["event"] : "";
30491
30652
  if (event === "pre_compact") {
30492
- _setPinLost(options.consumer_root);
30653
+ _setPinLost(options.consumer_root, _sessionId(envelope));
30493
30654
  return EXIT_ALLOW;
30494
30655
  }
30495
30656
  if (event === "post_tool_use") {
30496
- return _reEmitAfterCompaction(options.consumer_root);
30657
+ return _reEmitAfterCompaction(options.consumer_root, _sessionId(envelope));
30497
30658
  }
30498
30659
  const prompt = _extractPrompt(payload);
30499
30660
  if (!prompt) {
@@ -30560,14 +30721,14 @@ function _isCliEntry16() {
30560
30721
  return true;
30561
30722
  }
30562
30723
  try {
30563
- const here = fs48.realpathSync(fileURLToPath25(import.meta.url));
30724
+ const here = fs48.realpathSync(fileURLToPath26(import.meta.url));
30564
30725
  const argv = fs48.realpathSync(path46.resolve(process.argv[1]));
30565
30726
  return here === argv;
30566
30727
  } catch {
30567
30728
  return false;
30568
30729
  }
30569
30730
  }
30570
- var EXIT_ALLOW, EXIT_WARN, STATE_FILE, PIN_LOST_MARKER, DE_MARKERS, EN_MARKERS, MIN_MARKERS, LANGUAGE_NAME, LOCALE_ENV_KEYS;
30731
+ var EXIT_ALLOW, EXIT_WARN, STATE_FILE, PIN_LOST_DIR, DE_MARKERS, EN_MARKERS, MIN_MARKERS, LANGUAGE_NAME, LOCALE_ENV_KEYS;
30571
30732
  var init_language_mirror_hook = __esm({
30572
30733
  "src/scripts/language_mirror_hook.ts"() {
30573
30734
  "use strict";
@@ -30577,7 +30738,7 @@ var init_language_mirror_hook = __esm({
30577
30738
  EXIT_ALLOW = 0;
30578
30739
  EXIT_WARN = 2;
30579
30740
  STATE_FILE = path46.join("agents", "state", "language-mirror.json");
30580
- PIN_LOST_MARKER = path46.join("agents", "state", "language-mirror.pin-lost");
30741
+ PIN_LOST_DIR = path46.join("agents", "state", "language-mirror.pin-lost");
30581
30742
  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
30743
  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
30744
  MIN_MARKERS = 2;
@@ -30595,7 +30756,7 @@ var init_language_mirror_hook = __esm({
30595
30756
  // src/scripts/git_authorization_hook.ts
30596
30757
  import fs49 from "node:fs";
30597
30758
  import path47 from "node:path";
30598
- import { fileURLToPath as fileURLToPath26, pathToFileURL as pathToFileURL17 } from "node:url";
30759
+ import { fileURLToPath as fileURLToPath27, pathToFileURL as pathToFileURL17 } from "node:url";
30599
30760
  function _isObject3(v) {
30600
30761
  return typeof v === "object" && v !== null && !Array.isArray(v);
30601
30762
  }
@@ -30716,7 +30877,7 @@ function _isCliEntry17() {
30716
30877
  return true;
30717
30878
  }
30718
30879
  try {
30719
- const here = fs49.realpathSync(fileURLToPath26(import.meta.url));
30880
+ const here = fs49.realpathSync(fileURLToPath27(import.meta.url));
30720
30881
  const argv = fs49.realpathSync(path47.resolve(process.argv[1]));
30721
30882
  return here === argv;
30722
30883
  } catch {
@@ -30772,7 +30933,7 @@ var init_git_authorization_hook = __esm({
30772
30933
  // src/scripts/hooks/block_unauthorized_git.ts
30773
30934
  import fs50 from "node:fs";
30774
30935
  import path48 from "node:path";
30775
- import { fileURLToPath as fileURLToPath27, pathToFileURL as pathToFileURL18 } from "node:url";
30936
+ import { fileURLToPath as fileURLToPath28, pathToFileURL as pathToFileURL18 } from "node:url";
30776
30937
  function _isObject4(v) {
30777
30938
  return typeof v === "object" && v !== null && !Array.isArray(v);
30778
30939
  }
@@ -31051,7 +31212,7 @@ function _isCliEntry18() {
31051
31212
  return true;
31052
31213
  }
31053
31214
  try {
31054
- const here = fs50.realpathSync(fileURLToPath27(import.meta.url));
31215
+ const here = fs50.realpathSync(fileURLToPath28(import.meta.url));
31055
31216
  const argv = fs50.realpathSync(path48.resolve(process.argv[1]));
31056
31217
  return here === argv;
31057
31218
  } catch {
@@ -31116,7 +31277,7 @@ var init_block_unauthorized_git = __esm({
31116
31277
  // src/scripts/before_complete_hook.ts
31117
31278
  import fs51 from "node:fs";
31118
31279
  import path49 from "node:path";
31119
- import { fileURLToPath as fileURLToPath28, pathToFileURL as pathToFileURL19 } from "node:url";
31280
+ import { fileURLToPath as fileURLToPath29, pathToFileURL as pathToFileURL19 } from "node:url";
31120
31281
  function _now2() {
31121
31282
  return (/* @__PURE__ */ new Date()).toISOString().replace(/\.\d{3}Z$/, "+00:00");
31122
31283
  }
@@ -31370,7 +31531,7 @@ function _isCliEntry19() {
31370
31531
  return true;
31371
31532
  }
31372
31533
  try {
31373
- const here = fs51.realpathSync(fileURLToPath28(import.meta.url));
31534
+ const here = fs51.realpathSync(fileURLToPath29(import.meta.url));
31374
31535
  const argv = fs51.realpathSync(path49.resolve(process.argv[1]));
31375
31536
  return here === argv;
31376
31537
  } catch {
@@ -31430,7 +31591,7 @@ var init_before_complete_hook = __esm({
31430
31591
  import crypto7 from "node:crypto";
31431
31592
  import fs52 from "node:fs";
31432
31593
  import path50 from "node:path";
31433
- import { fileURLToPath as fileURLToPath29, pathToFileURL as pathToFileURL20 } from "node:url";
31594
+ import { fileURLToPath as fileURLToPath30, pathToFileURL as pathToFileURL20 } from "node:url";
31434
31595
  function _isObject5(v) {
31435
31596
  return typeof v === "object" && v !== null && !Array.isArray(v);
31436
31597
  }
@@ -31589,7 +31750,7 @@ function _isCliEntry20() {
31589
31750
  return true;
31590
31751
  }
31591
31752
  try {
31592
- const here = fs52.realpathSync(fileURLToPath29(import.meta.url));
31753
+ const here = fs52.realpathSync(fileURLToPath30(import.meta.url));
31593
31754
  const argv = fs52.realpathSync(path50.resolve(process.argv[1]));
31594
31755
  return here === argv;
31595
31756
  } catch {
@@ -31648,7 +31809,7 @@ import { createHash as createHash8 } from "node:crypto";
31648
31809
  import fs53 from "node:fs";
31649
31810
  import os12 from "node:os";
31650
31811
  import path51 from "node:path";
31651
- import { fileURLToPath as fileURLToPath30, pathToFileURL as pathToFileURL21 } from "node:url";
31812
+ import { fileURLToPath as fileURLToPath31, pathToFileURL as pathToFileURL21 } from "node:url";
31652
31813
  function bandVerdict(rate_pct, assistant_turns) {
31653
31814
  if (assistant_turns < BAND_MIN_TURNS) {
31654
31815
  return "corpus-too-small";
@@ -32024,7 +32185,7 @@ function _isCliEntry21() {
32024
32185
  return true;
32025
32186
  }
32026
32187
  try {
32027
- const here = fs53.realpathSync(fileURLToPath30(import.meta.url));
32188
+ const here = fs53.realpathSync(fileURLToPath31(import.meta.url));
32028
32189
  const argv = fs53.realpathSync(path51.resolve(process.argv[1]));
32029
32190
  return here === argv;
32030
32191
  } catch {
@@ -32043,7 +32204,7 @@ var init_conformance_scan = __esm({
32043
32204
  init_block_unauthorized_git();
32044
32205
  init_before_complete_hook();
32045
32206
  init_evidence_independence();
32046
- REPO_ROOT2 = path51.resolve(path51.dirname(fileURLToPath30(import.meta.url)), "..", "..");
32207
+ REPO_ROOT2 = path51.resolve(path51.dirname(fileURLToPath31(import.meta.url)), "..", "..");
32047
32208
  OBSERVED_BAND = { low: 9.1, high: 39.2 };
32048
32209
  BAND_MIN_TURNS = 1978;
32049
32210
  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 +32227,7 @@ import * as fs54 from "node:fs";
32066
32227
  import * as os13 from "node:os";
32067
32228
  import * as path52 from "node:path";
32068
32229
  import process16 from "node:process";
32069
- import { fileURLToPath as fileURLToPath31, pathToFileURL as pathToFileURL22 } from "node:url";
32230
+ import { fileURLToPath as fileURLToPath32, pathToFileURL as pathToFileURL22 } from "node:url";
32070
32231
  function _listRules(dir) {
32071
32232
  try {
32072
32233
  return fs54.readdirSync(dir).filter((f) => f.endsWith(".md")).sort();
@@ -32081,10 +32242,7 @@ function _ruleType(file) {
32081
32242
  } catch {
32082
32243
  return "";
32083
32244
  }
32084
- if (!text.startsWith("---")) return "";
32085
- const end = text.indexOf("\n---", 3);
32086
- const fm = end === -1 ? text : text.slice(0, end);
32087
- const m = /^type:\s*"?([a-z]+)"?/m.exec(fm);
32245
+ const m = /^type:\s*"?([a-z]+)"?/m.exec(splitFrontmatter(text).frontmatter);
32088
32246
  return m === null ? "" : m[1];
32089
32247
  }
32090
32248
  function compareCarriers(projectDir, globalDir, sourceDir) {
@@ -32096,6 +32254,8 @@ function compareCarriers(projectDir, globalDir, sourceDir) {
32096
32254
  shared: 0,
32097
32255
  identical: [],
32098
32256
  provenanceOnly: [],
32257
+ frontmatterOnly: [],
32258
+ pathsScopeDiff: [],
32099
32259
  bodyDiff: [],
32100
32260
  projectOnly: [],
32101
32261
  globalOnly: [],
@@ -32120,11 +32280,12 @@ function compareCarriers(projectDir, globalDir, sourceDir) {
32120
32280
  }
32121
32281
  out.shared += 1;
32122
32282
  let verdict;
32283
+ let projectCopy;
32284
+ let globalCopy;
32123
32285
  try {
32124
- verdict = comparePair(
32125
- fs54.readFileSync(path52.join(projectDir, rule)),
32126
- fs54.readFileSync(path52.join(globalDir, rule))
32127
- );
32286
+ projectCopy = fs54.readFileSync(path52.join(projectDir, rule));
32287
+ globalCopy = fs54.readFileSync(path52.join(globalDir, rule));
32288
+ verdict = comparePair(projectCopy, globalCopy);
32128
32289
  } catch {
32129
32290
  out.shared -= 1;
32130
32291
  out.unreadable.push(rule);
@@ -32132,7 +32293,16 @@ function compareCarriers(projectDir, globalDir, sourceDir) {
32132
32293
  }
32133
32294
  if (verdict === "identical") out.identical.push(rule);
32134
32295
  else if (verdict === "provenance-only") out.provenanceOnly.push(rule);
32135
- else out.bodyDiff.push(rule);
32296
+ else {
32297
+ const projectText = projectCopy.toString("utf-8");
32298
+ const globalText = globalCopy.toString("utf-8");
32299
+ if (proseEqual(projectText, globalText)) {
32300
+ out.frontmatterOnly.push(rule);
32301
+ if (frontmatterPaths(projectText) !== frontmatterPaths(globalText)) {
32302
+ out.pathsScopeDiff.push(rule);
32303
+ }
32304
+ } else out.bodyDiff.push(rule);
32305
+ }
32136
32306
  }
32137
32307
  return out;
32138
32308
  }
@@ -32160,7 +32330,9 @@ function render3(d) {
32160
32330
  lines.push(` shared rule names ${d.shared}`);
32161
32331
  lines.push(` byte-identical ${d.identical.length}`);
32162
32332
  lines.push(` differ ONLY in the install stamp ${d.provenanceOnly.length}`);
32163
- lines.push(` differ in BODY ${d.bodyDiff.length}`);
32333
+ lines.push(` differ ONLY in frontmatter ${d.frontmatterOnly.length}`);
32334
+ lines.push(` of which disagree on \`paths:\` ${d.pathsScopeDiff.length} \u2190 ACTIONABLE`);
32335
+ lines.push(` differ in PROSE ${d.bodyDiff.length}`);
32164
32336
  if (d.unreadable.length > 0) {
32165
32337
  lines.push(` unreadable on one side ${d.unreadable.length} (${d.unreadable.join(", ")})`);
32166
32338
  lines.push(" Not counted as shared and NOT a body difference \u2014 a dangling entry is");
@@ -32170,15 +32342,43 @@ function render3(d) {
32170
32342
  lines.push(` present at global scope only ${d.globalOnly.length}`);
32171
32343
  lines.push("");
32172
32344
  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.");
32345
+ lines.push(" PROSE DIVERGENCE \u2014 the two carriers deliver different governed text for");
32346
+ lines.push(" these rules. Both copies reach the model, and the host resolves NOTHING:");
32347
+ lines.push(" rules without a `paths` key load at launch with the same priority as");
32348
+ lines.push(" CLAUDE.md, with no precedence marker between the layers, so a claim one");
32349
+ lines.push(" copy retracts can be re-asserted by the other and which text binds is");
32350
+ lines.push(" UNDEFINED. Cited, not inferred \u2014 agents/evidence/analysis/");
32351
+ lines.push(" claude-code-rules-dir-contract.md (host 2.1.226, the host's own docs plus");
32352
+ lines.push(" a first-party observation). The project copy is the NEWER text, which is a");
32353
+ lines.push(" fact about recency and NOT a host precedence rule: close the divergence by");
32354
+ lines.push(" reinstalling the global copy, or decide which text binds \u2014 do not assume");
32355
+ lines.push(" the newer one already won.");
32179
32356
  for (const r of d.bodyDiff) lines.push(` - ${r}`);
32180
32357
  lines.push("");
32181
32358
  }
32359
+ if (d.pathsScopeDiff.length > 0) {
32360
+ lines.push(` \`paths:\` SCOPE DISAGREEMENT (${String(d.pathsScopeDiff.length)}) \u2014 same prose, different load schedule.`);
32361
+ lines.push(" ACT ON THESE. `paths` is the one frontmatter key this host reads: with it, a");
32362
+ lines.push(" rule fires when a matching file is read and is NOT re-injected after");
32363
+ lines.push(" /compact; without it, the rule loads unconditionally at launch. So the copy");
32364
+ lines.push(" that lacks `paths` DEFEATS the other copy's scoping \u2014 the rule the project");
32365
+ lines.push(" layer meant to deliver conditionally is delivered always, and an obligation");
32366
+ lines.push(" a maintainer deliberately scoped is silently unscoped on any machine that");
32367
+ lines.push(" carries both. Identical prose does not make this inert.");
32368
+ for (const r of d.pathsScopeDiff) lines.push(` - ${r}`);
32369
+ lines.push("");
32370
+ }
32371
+ const inert = d.frontmatterOnly.length - d.pathsScopeDiff.length;
32372
+ if (inert > 0) {
32373
+ lines.push(` ${String(inert)} further pair(s) differ ONLY in frontmatter the host does not read \u2014`);
32374
+ lines.push(" prose byte-identical, `paths` in agreement, nothing to act on. Two writers,");
32375
+ lines.push(" two policies: `generate-tools` emits `paths` where a rule is path-scoped and");
32376
+ lines.push(" nothing otherwise; `install.ts` writes agent-config's own vocabulary plus its");
32377
+ lines.push(" ownership stamp, and none of those keys is one this host reads");
32378
+ lines.push(" (claude-code-rules-dir-contract.md). Reported as a count on purpose: naming");
32379
+ lines.push(" every pair would bury the two classes above, which are the actionable ones.");
32380
+ lines.push("");
32381
+ }
32182
32382
  if (d.provenanceOnly.length > 0) {
32183
32383
  lines.push(` ${String(d.provenanceOnly.length)} pair(s) differ only by the installer's package:/source_path: stamp.`);
32184
32384
  lines.push(" Not a content difference and NOT a defect: install.ts stamps every installed");
@@ -32214,9 +32414,18 @@ function render3(d) {
32214
32414
  }
32215
32415
  if (d.bodyDiff.length === 0) {
32216
32416
  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.");
32417
+ lines.push(" No prose divergence \u2014 no rule's governed text differs between the carriers.");
32418
+ if (d.pathsScopeDiff.length > 0) {
32419
+ lines.push(" NOT an all-clear: the `paths:` disagreements above are still open, and they");
32420
+ lines.push(" change when a rule loads rather than what it says.");
32421
+ }
32422
+ lines.push(" The condition is transient \u2014 it returns whenever the checkout moves ahead of");
32423
+ lines.push(" the installed release \u2014 so this is a reading of right now, not a property of");
32424
+ lines.push(" the repo. Re-run it, do not cite it. That holds doubly here: the reading also");
32425
+ lines.push(" depends on WHICH GENERATION of the emitter produced the project tree (a");
32426
+ lines.push(" frontmatter-carrying symlink tree and a frontmatter-less real-file tree");
32427
+ lines.push(" classify the same commit differently), so a number from another checkout is");
32428
+ lines.push(" not comparable to this one.");
32220
32429
  }
32221
32430
  return lines.join("\n");
32222
32431
  }
@@ -32272,7 +32481,7 @@ var init_report_carrier_divergence = __esm({
32272
32481
  "src/scripts/report_carrier_divergence.ts"() {
32273
32482
  "use strict";
32274
32483
  init_carrier_divergence();
32275
- _HERE13 = fileURLToPath31(import.meta.url);
32484
+ _HERE13 = fileURLToPath32(import.meta.url);
32276
32485
  REPO_ROOT3 = path52.resolve(path52.dirname(_HERE13), "..", "..");
32277
32486
  PROJECT_RULES = path52.join(".claude", "rules");
32278
32487
  PROJECTION_SOURCE = path52.join("dist", "agent-src", "rules");
@@ -32287,7 +32496,7 @@ var init_report_carrier_divergence = __esm({
32287
32496
  import * as fs55 from "node:fs";
32288
32497
  import * as os14 from "node:os";
32289
32498
  import * as path53 from "node:path";
32290
- import { fileURLToPath as fileURLToPath32, pathToFileURL as pathToFileURL23 } from "node:url";
32499
+ import { fileURLToPath as fileURLToPath33, pathToFileURL as pathToFileURL23 } from "node:url";
32291
32500
  function censusSkills(root) {
32292
32501
  const out = { total: 0, withTriggerKey: [], withDeterministicObligation: [] };
32293
32502
  if (!fs55.existsSync(root)) {
@@ -32447,7 +32656,7 @@ var _HERE14, REPO_ROOT4, SKILLS_ROOT, TRIGGER_KEYS, DETERMINISTIC_RE;
32447
32656
  var init_report_skill_activation = __esm({
32448
32657
  "src/scripts/report_skill_activation.ts"() {
32449
32658
  "use strict";
32450
- _HERE14 = fileURLToPath32(import.meta.url);
32659
+ _HERE14 = fileURLToPath33(import.meta.url);
32451
32660
  REPO_ROOT4 = path53.resolve(path53.dirname(_HERE14), "..", "..");
32452
32661
  SKILLS_ROOT = "src/skills";
32453
32662
  TRIGGER_KEYS = ["triggers:", "trigger_description:", "file_pattern:", "path_prefix:"];
@@ -32463,7 +32672,7 @@ import * as fs56 from "node:fs";
32463
32672
  import * as os15 from "node:os";
32464
32673
  import * as path54 from "node:path";
32465
32674
  import process17 from "node:process";
32466
- import { fileURLToPath as fileURLToPath33, pathToFileURL as pathToFileURL24 } from "node:url";
32675
+ import { fileURLToPath as fileURLToPath34, pathToFileURL as pathToFileURL24 } from "node:url";
32467
32676
  function _verb(line) {
32468
32677
  const m = /\b(NEVER|MUST|ALWAYS)\b/.exec(line);
32469
32678
  return m?.[1] ?? "NEVER";
@@ -32756,7 +32965,7 @@ var init_report_skill_obligation_violations = __esm({
32756
32965
  "use strict";
32757
32966
  init_transcript_entry();
32758
32967
  init_report_skill_activation();
32759
- _HERE15 = fileURLToPath33(import.meta.url);
32968
+ _HERE15 = fileURLToPath34(import.meta.url);
32760
32969
  REPO_ROOT5 = path54.resolve(path54.dirname(_HERE15), "..", "..");
32761
32970
  OBLIGATION_LINE_RE = new RegExp(`${DETERMINISTIC_RE.source}.*`, "gm");
32762
32971
  PATH_RE = /`([A-Za-z0-9_./-]*\/[A-Za-z0-9_.-]+\.[a-z]{2,6})`/g;
@@ -32802,7 +33011,7 @@ import * as fs57 from "node:fs";
32802
33011
  import * as os16 from "node:os";
32803
33012
  import * as path55 from "node:path";
32804
33013
  import process18 from "node:process";
32805
- import { fileURLToPath as fileURLToPath34, pathToFileURL as pathToFileURL25 } from "node:url";
33014
+ import { fileURLToPath as fileURLToPath35, pathToFileURL as pathToFileURL25 } from "node:url";
32806
33015
  function buildFunnel(opts = {}) {
32807
33016
  const repoRoot = opts.repoRoot ?? REPO_ROOT6;
32808
33017
  const projectRulesDir = opts.projectRulesDir ?? path55.join(repoRoot, PROJECT_RULES);
@@ -32846,12 +33055,25 @@ function render6(r) {
32846
33055
  lines.push(" substituted with dist/, which would answer a different question.");
32847
33056
  } else {
32848
33057
  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)` : "")
33058
+ ` Divergence: ${d.shared} shared \xB7 ${d.bodyDiff.length} prose-diff \xB7 ${d.frontmatterOnly.length} frontmatter-only (${d.pathsScopeDiff.length} on \`paths:\`) \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
33059
  );
32851
33060
  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.");
33061
+ lines.push(` PROSE DIVERGENCE \u2014 both copies reach the model: ${d.bodyDiff.join(", ")}`);
33062
+ lines.push(" The host resolves nothing: both layers load at launch at the same");
33063
+ lines.push(" priority with no precedence marker, so which text binds is UNDEFINED");
33064
+ lines.push(" (claude-code-rules-dir-contract.md). The project copy is merely the");
33065
+ lines.push(" newer one \u2014 recency, not precedence.");
33066
+ }
33067
+ if (d.pathsScopeDiff.length > 0) {
33068
+ lines.push(` \`paths:\` SCOPE DISAGREEMENT (${String(d.pathsScopeDiff.length)}) \u2014 same prose, different load`);
33069
+ lines.push(" schedule. `paths` is the one frontmatter key the host reads, so the copy");
33070
+ lines.push(" without it defeats the other copy's scoping: a deliberately scoped");
33071
+ lines.push(" obligation is delivered unconditionally. Act on these.");
33072
+ }
33073
+ const inertFm = d.frontmatterOnly.length - d.pathsScopeDiff.length;
33074
+ if (inertFm > 0) {
33075
+ lines.push(` ${String(inertFm)} further pair(s) differ only in frontmatter the host does not read \u2014`);
33076
+ lines.push(" prose byte-identical, `paths` in agreement, nothing to act on.");
32855
33077
  }
32856
33078
  if (d.unreadable.length > 0) {
32857
33079
  lines.push(` Unreadable on one side (${d.unreadable.length}) \u2014 a broken install, not a disagreement.`);
@@ -32971,7 +33193,7 @@ var init_report_conformance_funnel = __esm({
32971
33193
  init_report_carrier_divergence();
32972
33194
  init_report_skill_activation();
32973
33195
  init_report_skill_obligation_violations();
32974
- _HERE16 = fileURLToPath34(import.meta.url);
33196
+ _HERE16 = fileURLToPath35(import.meta.url);
32975
33197
  REPO_ROOT6 = path55.resolve(path55.dirname(_HERE16), "..", "..");
32976
33198
  if (_isCliEntry24()) {
32977
33199
  process18.exit(main25());
@@ -33004,7 +33226,7 @@ import * as os17 from "node:os";
33004
33226
  import * as path56 from "node:path";
33005
33227
  import process19 from "node:process";
33006
33228
  import { spawnSync as spawnSync9 } from "node:child_process";
33007
- import { fileURLToPath as fileURLToPath35, pathToFileURL as pathToFileURL26 } from "node:url";
33229
+ import { fileURLToPath as fileURLToPath36, pathToFileURL as pathToFileURL26 } from "node:url";
33008
33230
  function print2(s = "") {
33009
33231
  process19.stdout.write(`${s}
33010
33232
  `);
@@ -33470,7 +33692,7 @@ function _isCliEntry25() {
33470
33692
  return true;
33471
33693
  }
33472
33694
  try {
33473
- const here = fs58.realpathSync(fileURLToPath35(import.meta.url));
33695
+ const here = fs58.realpathSync(fileURLToPath36(import.meta.url));
33474
33696
  const argv = fs58.realpathSync(path56.resolve(process19.argv[1]));
33475
33697
  return here === argv;
33476
33698
  } catch {
@@ -33490,7 +33712,7 @@ var init_cmd_conformance = __esm({
33490
33712
  init_router_target_paths();
33491
33713
  init_report_conformance_funnel();
33492
33714
  init_cmd_doctor();
33493
- _HERE17 = fileURLToPath35(import.meta.url);
33715
+ _HERE17 = fileURLToPath36(import.meta.url);
33494
33716
  PACKAGE_ROOT2 = resolvePackageRoot(import.meta.url);
33495
33717
  CONFORMANCE_CHECK_IDS = [
33496
33718
  "txlog-clean",
@@ -37660,7 +37882,7 @@ __export(pricing_exports, {
37660
37882
  });
37661
37883
  import * as fs65 from "node:fs";
37662
37884
  import * as path59 from "node:path";
37663
- import { fileURLToPath as fileURLToPath36 } from "node:url";
37885
+ import { fileURLToPath as fileURLToPath37 } from "node:url";
37664
37886
  function prices_file_for(repo_root) {
37665
37887
  return path59.join(repo_root, "agents", "runtime", ".agent-prices.md");
37666
37888
  }
@@ -37887,7 +38109,7 @@ var init_pricing = __esm({
37887
38109
  "src/scripts/ai_council/pricing.ts"() {
37888
38110
  "use strict";
37889
38111
  init_default_prices();
37890
- _HERE18 = fileURLToPath36(import.meta.url);
38112
+ _HERE18 = fileURLToPath37(import.meta.url);
37891
38113
  REPO_ROOT7 = path59.resolve(path59.dirname(_HERE18), "..", "..", "..");
37892
38114
  PRICES_FILE = path59.join(REPO_ROOT7, "agents", "runtime", ".agent-prices.md");
37893
38115
  _CHARS_PER_TOKEN = 4;
@@ -40960,7 +41182,7 @@ __export(council_cli_exports, {
40960
41182
  });
40961
41183
  import * as fs68 from "node:fs";
40962
41184
  import * as path61 from "node:path";
40963
- import { fileURLToPath as fileURLToPath37, pathToFileURL as pathToFileURL27 } from "node:url";
41185
+ import { fileURLToPath as fileURLToPath38, pathToFileURL as pathToFileURL27 } from "node:url";
40964
41186
  function _pyFixed6(x, ndigits) {
40965
41187
  if (!Number.isFinite(x)) {
40966
41188
  return String(x);
@@ -43708,7 +43930,7 @@ function _isCliEntry26() {
43708
43930
  return true;
43709
43931
  }
43710
43932
  try {
43711
- const here = fs68.realpathSync(fileURLToPath37(import.meta.url));
43933
+ const here = fs68.realpathSync(fileURLToPath38(import.meta.url));
43712
43934
  const argv = fs68.realpathSync(path61.resolve(process.argv[1]));
43713
43935
  return here === argv;
43714
43936
  } catch {
@@ -43767,7 +43989,7 @@ var init_council_cli = __esm({
43767
43989
  "xai",
43768
43990
  "perplexity"
43769
43991
  ]);
43770
- _HERE19 = path61.dirname(fileURLToPath37(import.meta.url));
43992
+ _HERE19 = path61.dirname(fileURLToPath38(import.meta.url));
43771
43993
  [REPO_ROOT8] = resolve_project_root(null);
43772
43994
  SETTINGS_FILE2 = project_settings_path(REPO_ROOT8);
43773
43995
  AI_COUNCIL_FILE = resolve_config_path(REPO_ROOT8);
@@ -43876,7 +44098,7 @@ var init_safety_envelope = __esm({
43876
44098
 
43877
44099
  // src/scripts/mcp_server/__main__.ts
43878
44100
  import * as path63 from "node:path";
43879
- import { fileURLToPath as fileURLToPath39 } from "node:url";
44101
+ import { fileURLToPath as fileURLToPath40 } from "node:url";
43880
44102
 
43881
44103
  // src/scripts/mcp_server/index.ts
43882
44104
  var __version__ = "0.1.0";
@@ -43925,7 +44147,7 @@ init_resources();
43925
44147
  // src/scripts/mcp_server/tools.ts
43926
44148
  import * as fs69 from "node:fs";
43927
44149
  import * as path62 from "node:path";
43928
- import { fileURLToPath as fileURLToPath38 } from "node:url";
44150
+ import { fileURLToPath as fileURLToPath39 } from "node:url";
43929
44151
 
43930
44152
  // src/scripts/chat_history.ts
43931
44153
  init_memory_lookup();
@@ -43934,7 +44156,7 @@ init_hook_stdin();
43934
44156
  import { createHash as createHash3 } from "node:crypto";
43935
44157
  import * as fs14 from "node:fs";
43936
44158
  import * as path13 from "node:path";
43937
- import { fileURLToPath as fileURLToPath8, pathToFileURL as pathToFileURL5 } from "node:url";
44159
+ import { fileURLToPath as fileURLToPath9, pathToFileURL as pathToFileURL5 } from "node:url";
43938
44160
  var DEFAULT_FILE = "agents/runtime/.agent-chat-history";
43939
44161
  var DEFAULT_SETTINGS_FILE = ".agent-settings.yml";
43940
44162
  var SCHEMA_VERSION3 = 4;
@@ -45951,7 +46173,7 @@ function _isCliEntry5() {
45951
46173
  return true;
45952
46174
  }
45953
46175
  try {
45954
- const here = fs14.realpathSync(fileURLToPath8(import.meta.url));
46176
+ const here = fs14.realpathSync(fileURLToPath9(import.meta.url));
45955
46177
  const argv = fs14.realpathSync(path13.resolve(process.argv[1]));
45956
46178
  return here === argv;
45957
46179
  } catch {
@@ -45976,16 +46198,16 @@ if (_invokedDirectly) {
45976
46198
  // src/scripts/mcp_server/catalog.ts
45977
46199
  import * as fs15 from "node:fs";
45978
46200
  import * as path14 from "node:path";
45979
- import { fileURLToPath as fileURLToPath9 } from "node:url";
46201
+ import { fileURLToPath as fileURLToPath10 } from "node:url";
45980
46202
  var _CATALOG_FILE = path14.join(
45981
46203
  true ? path14.resolve(
45982
- path14.dirname(fileURLToPath9(import.meta.url)),
46204
+ path14.dirname(fileURLToPath10(import.meta.url)),
45983
46205
  "..",
45984
46206
  "..",
45985
46207
  "src",
45986
46208
  "scripts",
45987
46209
  "mcp_server"
45988
- ) : path14.dirname(fileURLToPath9(import.meta.url)),
46210
+ ) : path14.dirname(fileURLToPath10(import.meta.url)),
45989
46211
  "consumer_tool_catalog.json"
45990
46212
  );
45991
46213
  var NOT_IMPLEMENTED_CODE = "not_implemented";
@@ -46431,8 +46653,8 @@ async function _memoryStatusHandler(_args, consumerRoot) {
46431
46653
  }
46432
46654
  return result;
46433
46655
  }
46434
- var _PACKAGE_ROOT2 = path62.resolve(
46435
- path62.dirname(fileURLToPath38(import.meta.url)),
46656
+ var _PACKAGE_ROOT3 = path62.resolve(
46657
+ path62.dirname(fileURLToPath39(import.meta.url)),
46436
46658
  "..",
46437
46659
  "..",
46438
46660
  ".."
@@ -46535,7 +46757,7 @@ async function _roadmapArchiveHandler(_args, consumerRoot) {
46535
46757
  async function _capabilitiesIndexHandler(args, consumerRoot) {
46536
46758
  const check = _pyTruthy6(args.check ?? false);
46537
46759
  const cap = await Promise.resolve().then(() => (init_generate_capabilities_index(), generate_capabilities_index_exports));
46538
- const out = path62.join(_PACKAGE_ROOT2, "CAPABILITIES.yaml");
46760
+ const out = path62.join(_PACKAGE_ROOT3, "CAPABILITIES.yaml");
46539
46761
  const content = cap.build();
46540
46762
  const onDisk = fs69.existsSync(out) ? fs69.readFileSync(out, "utf-8") : "";
46541
46763
  const drift = onDisk !== content;
@@ -47556,7 +47778,7 @@ function main28() {
47556
47778
  }
47557
47779
 
47558
47780
  // src/scripts/mcp_server/__main__.ts
47559
- var _selfPath = fileURLToPath39(import.meta.url);
47781
+ var _selfPath = fileURLToPath40(import.meta.url);
47560
47782
  var _invokedDirectly2 = globalThis.__AC_MCP_BUNDLE_DIRECT === true || process.argv[1] !== void 0 && path63.resolve(process.argv[1]) === path63.resolve(_selfPath);
47561
47783
  if (_invokedDirectly2) {
47562
47784
  main28();