@event4u/agent-config 9.26.0 → 9.28.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 (252) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/AGENTS.md +12 -11
  3. package/CHANGELOG.md +134 -207
  4. package/README.md +1 -1
  5. package/dist/agent-src/commands/analyze/conformance.md +43 -0
  6. package/dist/agent-src/commands/roadmap/next.md +65 -3
  7. package/dist/agent-src/contexts/execution/orchestration-telemetry.md +10 -3
  8. package/dist/agent-src/rules/active-remediation.md +2 -0
  9. package/dist/agent-src/rules/analysis-skill-routing.md +2 -0
  10. package/dist/agent-src/rules/architecture.md +2 -0
  11. package/dist/agent-src/rules/artifact-drafting-protocol.md +2 -0
  12. package/dist/agent-src/rules/artifact-engagement-recording.md +6 -1
  13. package/dist/agent-src/rules/augment-edit-discipline.md +2 -0
  14. package/dist/agent-src/rules/autonomous-execution.md +3 -1
  15. package/dist/agent-src/rules/brand-consistency.md +2 -0
  16. package/dist/agent-src/rules/brand-source-of-truth.md +35 -6
  17. package/dist/agent-src/rules/broken-access-control.md +2 -0
  18. package/dist/agent-src/rules/cli-output-handling.md +2 -0
  19. package/dist/agent-src/rules/code-comment-discipline.md +2 -0
  20. package/dist/agent-src/rules/code-provenance.md +2 -0
  21. package/dist/agent-src/rules/command-suggestion-policy.md +2 -0
  22. package/dist/agent-src/rules/commit-conventions.md +2 -0
  23. package/dist/agent-src/rules/communication-through-line.md +2 -0
  24. package/dist/agent-src/rules/content-quoting-floor.md +2 -0
  25. package/dist/agent-src/rules/context-hygiene.md +13 -1
  26. package/dist/agent-src/rules/copilot-routing.md +2 -0
  27. package/dist/agent-src/rules/council-availability.md +93 -0
  28. package/dist/agent-src/rules/cross-source-consistency.md +5 -0
  29. package/dist/agent-src/rules/decision-revisit-gate.md +2 -0
  30. package/dist/agent-src/rules/delegation-policy.md +31 -5
  31. package/dist/agent-src/rules/design-fidelity.md +5 -0
  32. package/dist/agent-src/rules/design-review-after-ui-write.md +4 -0
  33. package/dist/agent-src/rules/devcontainer-routing.md +2 -0
  34. package/dist/agent-src/rules/doc-screenshot-hygiene.md +2 -0
  35. package/dist/agent-src/rules/docker-commands.md +2 -0
  36. package/dist/agent-src/rules/domain-adoption-policy.md +2 -0
  37. package/dist/agent-src/rules/domain-safety-disclaimer.md +2 -0
  38. package/dist/agent-src/rules/domain-safety-pii.md +2 -0
  39. package/dist/agent-src/rules/domain-safety-retention.md +2 -0
  40. package/dist/agent-src/rules/downstream-changes.md +2 -0
  41. package/dist/agent-src/rules/engineering-safety-floor.md +2 -0
  42. package/dist/agent-src/rules/evaluator-independence.md +14 -3
  43. package/dist/agent-src/rules/external-code-graph-interop.md +4 -1
  44. package/dist/agent-src/rules/external-reference-deep-dive.md +2 -0
  45. package/dist/agent-src/rules/fast-path-marker-visibility.md +2 -0
  46. package/dist/agent-src/rules/finance-safety-floor.md +3 -1
  47. package/dist/agent-src/rules/framework-neutrality-in-generic-skills.md +2 -0
  48. package/dist/agent-src/rules/git-history-discipline.md +3 -1
  49. package/dist/agent-src/rules/guidelines.md +2 -0
  50. package/dist/agent-src/rules/history-discipline.md +5 -1
  51. package/dist/agent-src/rules/icon-consistency.md +2 -0
  52. package/dist/agent-src/rules/image-likeness-and-rights.md +2 -0
  53. package/dist/agent-src/rules/improve-before-implement.md +2 -0
  54. package/dist/agent-src/rules/invite-challenge.md +2 -0
  55. package/dist/agent-src/rules/laravel-routing.md +2 -0
  56. package/dist/agent-src/rules/laravel-translations.md +2 -0
  57. package/dist/agent-src/rules/legal-safety-floor.md +3 -1
  58. package/dist/agent-src/rules/lethal-trifecta-guard.md +2 -0
  59. package/dist/agent-src/rules/linked-projects-onboarding-gate.md +2 -0
  60. package/dist/agent-src/rules/low-impact-corpus-privacy-floor.md +2 -0
  61. package/dist/agent-src/rules/markdown-safe-codeblocks.md +2 -0
  62. package/dist/agent-src/rules/media-governance-routing.md +2 -0
  63. package/dist/agent-src/rules/media-sync-ground-truth.md +2 -0
  64. package/dist/agent-src/rules/minimal-safe-diff.md +2 -0
  65. package/dist/agent-src/rules/missing-tool-handling.md +2 -0
  66. package/dist/agent-src/rules/model-recommendation.md +2 -0
  67. package/dist/agent-src/rules/no-attribution-footers.md +2 -0
  68. package/dist/agent-src/rules/no-decorative-emojis-in-git-surfaces.md +2 -0
  69. package/dist/agent-src/rules/no-pr-progress-comments.md +5 -1
  70. package/dist/agent-src/rules/no-roadmap-references.md +2 -0
  71. package/dist/agent-src/rules/notes-first-reasoning.md +2 -0
  72. package/dist/agent-src/rules/onboarding-gate.md +5 -1
  73. package/dist/agent-src/rules/output-discipline.md +2 -0
  74. package/dist/agent-src/rules/package-ci-checks.md +2 -0
  75. package/dist/agent-src/rules/persona-governance.md +2 -0
  76. package/dist/agent-src/rules/php-coding.md +2 -0
  77. package/dist/agent-src/rules/prefer-enums-over-literals.md +2 -0
  78. package/dist/agent-src/rules/preservation-guard.md +2 -0
  79. package/dist/agent-src/rules/provider-lifecycle-discipline.md +2 -0
  80. package/dist/agent-src/rules/question-not-instruction.md +2 -0
  81. package/dist/agent-src/rules/reviewer-awareness.md +2 -0
  82. package/dist/agent-src/rules/roadmap-ci-steps-policy.md +6 -1
  83. package/dist/agent-src/rules/roadmap-progress-sync.md +2 -0
  84. package/dist/agent-src/rules/role-mode-adherence.md +3 -1
  85. package/dist/agent-src/rules/rule-type-governance.md +2 -0
  86. package/dist/agent-src/rules/runtime-safety.md +2 -0
  87. package/dist/agent-src/rules/scale-discipline.md +5 -1
  88. package/dist/agent-src/rules/secret-vcs-guard.md +2 -0
  89. package/dist/agent-src/rules/security-sensitive-stop.md +2 -0
  90. package/dist/agent-src/rules/self-repair-loop.md +103 -0
  91. package/dist/agent-src/rules/senior-engineering-discipline.md +2 -0
  92. package/dist/agent-src/rules/session-canary.md +62 -19
  93. package/dist/agent-src/rules/settings-ask-protocol.md +4 -0
  94. package/dist/agent-src/rules/size-enforcement.md +2 -0
  95. package/dist/agent-src/rules/skill-improvement-trigger.md +2 -0
  96. package/dist/agent-src/rules/skill-quality.md +2 -0
  97. package/dist/agent-src/rules/slash-command-routing-policy.md +2 -0
  98. package/dist/agent-src/rules/source-confidentiality.md +2 -0
  99. package/dist/agent-src/rules/source-discovery-gate.md +2 -0
  100. package/dist/agent-src/rules/source-of-truth.md +2 -0
  101. package/dist/agent-src/rules/spreadsheet-source-quality.md +2 -0
  102. package/dist/agent-src/rules/strategy-safety-floor.md +3 -1
  103. package/dist/agent-src/rules/symfony-routing.md +2 -0
  104. package/dist/agent-src/rules/think-before-action.md +2 -0
  105. package/dist/agent-src/rules/token-budget-discipline.md +5 -1
  106. package/dist/agent-src/rules/token-efficiency.md +2 -0
  107. package/dist/agent-src/rules/token-optimizer-maintenance.md +2 -0
  108. package/dist/agent-src/rules/tool-safety.md +7 -1
  109. package/dist/agent-src/rules/ui-audit-gate.md +4 -0
  110. package/dist/agent-src/rules/untrusted-input-defense.md +2 -0
  111. package/dist/agent-src/rules/upstream-proposal.md +2 -0
  112. package/dist/agent-src/rules/user-interaction.md +2 -0
  113. package/dist/agent-src/rules/user-interrupt-priority.md +2 -0
  114. package/dist/agent-src/skills/adversarial-review/SKILL.md +1 -1
  115. package/dist/agent-src/skills/analysis-autonomous-mode/SKILL.md +1 -1
  116. package/dist/agent-src/skills/performance-analysis/SKILL.md +1 -1
  117. package/dist/agent-src/skills/persona-improvement/SKILL.md +1 -1
  118. package/dist/agent-src/skills/project-analyzer/SKILL.md +1 -1
  119. package/dist/agent-src/skills/security-audit/SKILL.md +1 -1
  120. package/dist/agent-src/skills/sequential-thinking/SKILL.md +1 -1
  121. package/dist/agent-src/skills/skill-improvement-pipeline/SKILL.md +1 -1
  122. package/dist/agent-src/skills/universal-project-analysis/SKILL.md +1 -1
  123. package/dist/agent-src/templates/AGENTS.md +6 -10
  124. package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
  125. package/dist/cli/registry.js +9 -0
  126. package/dist/cli/registry.js.map +1 -1
  127. package/dist/cli-delegate/chunk-22GCIJ2O.js +270 -0
  128. package/dist/cli-delegate/{chunk-BSLUHV2F.js → chunk-2BE5I2MN.js} +156 -141
  129. package/dist/cli-delegate/{chunk-AIIUU73N.js → chunk-7OMQCH4V.js} +1 -1
  130. package/dist/cli-delegate/{chunk-HJ6DAJHR.js → chunk-GB2FSUEE.js} +57 -7
  131. package/dist/cli-delegate/{chunk-WR6GTRHJ.js → chunk-JXARCGVN.js} +3 -3
  132. package/dist/cli-delegate/{chunk-SJQMJI7M.js → chunk-PQSAQKHW.js} +467 -305
  133. package/dist/cli-delegate/chunk-REKCMYOU.js +2991 -0
  134. package/dist/cli-delegate/cmd_analyze_session.js +1 -1
  135. package/dist/cli-delegate/cmd_brand_status.js +134 -0
  136. package/dist/cli-delegate/cmd_conformance.js +7 -7
  137. package/dist/cli-delegate/cmd_converge.js +3 -3
  138. package/dist/cli-delegate/cmd_doctor.js +4 -4
  139. package/dist/cli-delegate/cmd_explain.js +80 -330
  140. package/dist/cli-delegate/cmd_export.js +5 -5
  141. package/dist/cli-delegate/cmd_fleet.js +3 -3
  142. package/dist/cli-delegate/cmd_handoff.js +2 -2
  143. package/dist/cli-delegate/cmd_mcp_available.js +433 -0
  144. package/dist/cli-delegate/cmd_migrate.js +3 -3
  145. package/dist/cli-delegate/cmd_packs_active.js +153 -0
  146. package/dist/cli-delegate/cmd_preflight.js +1 -1
  147. package/dist/cli-delegate/cmd_prune.js +5 -5
  148. package/dist/cli-delegate/cmd_route_audit.js +8 -8
  149. package/dist/cli-delegate/cmd_route_explain.js +4 -4
  150. package/dist/cli-delegate/cmd_settings_get.js +272 -0
  151. package/dist/cli-delegate/cmd_settings_migrate.js +5 -5
  152. package/dist/cli-delegate/cmd_settings_set.js +7 -2967
  153. package/dist/cli-delegate/cmd_sync.js +5 -5
  154. package/dist/cli-delegate/cmd_uninstall.js +5 -5
  155. package/dist/cli-delegate/cmd_update.js +4 -4
  156. package/dist/cli-delegate/cmd_upgrade.js +4 -4
  157. package/dist/cli-delegate/cmd_validate.js +5 -5
  158. package/dist/cli-delegate/cmd_versions.js +4 -4
  159. package/dist/discovery/deprecation-report.md +1 -1
  160. package/dist/discovery/discovery-manifest.json +184 -124
  161. package/dist/discovery/discovery-manifest.json.sha256 +1 -1
  162. package/dist/discovery/discovery-manifest.summary.md +3 -3
  163. package/dist/discovery/orphan-report.md +1 -1
  164. package/dist/discovery/packs.json +7 -5
  165. package/dist/discovery/trust-report.md +11 -11
  166. package/dist/discovery/workspaces.json +6 -4
  167. package/dist/hooks/dispatch.js +9080 -5701
  168. package/dist/install/install.mjs +698 -508
  169. package/dist/mcp/registry-manifest.json +3 -3
  170. package/dist/mcp/server.json +2 -2
  171. package/dist/mcp/server.mjs +698 -437
  172. package/dist/router.json +1 -1
  173. package/dist/scripts/_lib/agent_settings.js +80 -15
  174. package/dist/scripts/_lib/agent_settings.js.map +1 -1
  175. package/dist/scripts/condense.js +33 -2
  176. package/dist/scripts/condense.js.map +1 -1
  177. package/dist/server/io/yamlIO.js +85 -0
  178. package/dist/server/io/yamlIO.js.map +1 -1
  179. package/dist/server/routes/settings.js +1 -12
  180. package/dist/server/routes/settings.js.map +1 -1
  181. package/dist/server/routes/wizard.js +52 -2
  182. package/dist/server/routes/wizard.js.map +1 -1
  183. package/dist/shared/settingsCarveOut.js +118 -0
  184. package/dist/shared/settingsCarveOut.js.map +1 -0
  185. package/dist/shared/settingsSurface.js +7 -1
  186. package/dist/shared/settingsSurface.js.map +1 -1
  187. package/dist/ui/assets/index-DmR0mbk4.js.map +1 -1
  188. package/docs/contracts/settings-classes.md +29 -8
  189. package/docs/guidelines/agent-infra/memory-access.md +14 -3
  190. package/package.json +1 -1
  191. package/src/agent-src/templates/AGENTS.md +6 -10
  192. package/src/config/budgets.yml +29 -0
  193. package/src/config/evaluator-budgets.json +4 -4
  194. package/src/config/gate-coverage.yml +26 -0
  195. package/src/scripts/_cli/cmd_brand_status.ts +174 -0
  196. package/src/scripts/_cli/cmd_doctor.ts +6 -21
  197. package/src/scripts/_cli/cmd_mcp_available.ts +266 -0
  198. package/src/scripts/_cli/cmd_packs_active.ts +225 -0
  199. package/src/scripts/_cli/cmd_settings_get.ts +324 -0
  200. package/src/scripts/_dispatch.bash +75 -0
  201. package/src/scripts/_lib/agent_settings.ts +82 -16
  202. package/src/scripts/_lib/carrier_divergence.ts +135 -0
  203. package/src/scripts/_lib/git_common_dir.ts +128 -0
  204. package/src/scripts/_lib/host_capability.ts +84 -1
  205. package/src/scripts/_lib/obligation_frequency.ts +391 -0
  206. package/src/scripts/_lib/prompt_shape.ts +88 -0
  207. package/src/scripts/_lib/review_skipped_record.ts +102 -0
  208. package/src/scripts/_lib/rule_layer_overlap.ts +254 -0
  209. package/src/scripts/_lib/self_repair.ts +342 -0
  210. package/src/scripts/_lib/self_repair_store.ts +100 -0
  211. package/src/scripts/_lib/session_register.ts +361 -0
  212. package/src/scripts/_lib/transcript_entry.ts +80 -0
  213. package/src/scripts/check_branch_freshness.ts +255 -0
  214. package/src/scripts/check_council_config_location.ts +125 -1
  215. package/src/scripts/check_enforcement_coverage.ts +192 -7
  216. package/src/scripts/check_rule_projection_integrity.ts +364 -0
  217. package/src/scripts/check_standing_rule_delivery.ts +314 -0
  218. package/src/scripts/condense.ts +36 -2
  219. package/src/scripts/config/profiles.ts +13 -3
  220. package/src/scripts/conformance_scan.ts +307 -24
  221. package/src/scripts/council_availability_hook.ts +188 -0
  222. package/src/scripts/council_cli.ts +126 -7
  223. package/src/scripts/generate_settings_reference.ts +232 -0
  224. package/src/scripts/hook_manifest.yaml +155 -33
  225. package/src/scripts/hooks/block_no_verify.ts +95 -3
  226. package/src/scripts/hooks/block_unauthorized_git.ts +217 -2
  227. package/src/scripts/hooks/concern_registry.ts +12 -0
  228. package/src/scripts/hooks/delegation_nudge_hook.ts +450 -0
  229. package/src/scripts/hooks/end_review_nudge_hook.ts +726 -0
  230. package/src/scripts/hooks/orchestration_record_hook.ts +342 -0
  231. package/src/scripts/install.ts +151 -0
  232. package/src/scripts/language_mirror_hook.ts +49 -6
  233. package/src/scripts/measure_scope_dedup.ts +19 -13
  234. package/src/scripts/onboarding_gate_hook.ts +40 -1
  235. package/src/scripts/orchestration_backfill.ts +354 -0
  236. package/src/scripts/orchestration_record.ts +4 -1
  237. package/src/scripts/preamble_byte_census.ts +9 -20
  238. package/src/scripts/release.ts +142 -36
  239. package/src/scripts/report_carrier_divergence.ts +364 -0
  240. package/src/scripts/report_skill_activation.ts +257 -0
  241. package/src/scripts/report_skill_obligation_violations.ts +579 -0
  242. package/src/scripts/routing_doctor.ts +77 -6
  243. package/src/scripts/schemas/rule.schema.json +5 -0
  244. package/src/scripts/self_repair_cli.ts +240 -0
  245. package/src/scripts/self_repair_hook.ts +241 -0
  246. package/src/scripts/session_canary_hook.ts +35 -3
  247. package/src/scripts/session_register_hook.ts +288 -0
  248. package/src/scripts/sessions_cli.ts +140 -0
  249. package/src/scripts/validate_frontmatter.ts +68 -0
  250. package/src/server/io/yamlIO.ts +87 -0
  251. package/src/shared/settingsCarveOut.ts +143 -0
  252. package/src/shared/settingsSurface.ts +7 -1
@@ -129,6 +129,7 @@ __export(agent_settings_exports, {
129
129
  PROJECT_ROOT_ENV: () => PROJECT_ROOT_ENV,
130
130
  ProjectRootError: () => ProjectRootError,
131
131
  ROOT_OVERRIDE_ENV: () => ROOT_OVERRIDE_ENV,
132
+ USER_GLOBAL_CANONICAL_RELATIVE: () => USER_GLOBAL_CANONICAL_RELATIVE,
132
133
  USER_GLOBAL_FILENAME: () => USER_GLOBAL_FILENAME,
133
134
  canonical_settings_write_path: () => canonical_settings_write_path,
134
135
  enumerate_modules: () => enumerate_modules,
@@ -140,7 +141,8 @@ __export(agent_settings_exports, {
140
141
  load_agent_settings: () => load_agent_settings,
141
142
  logger: () => logger,
142
143
  project_settings_path: () => project_settings_path,
143
- resolve_project_root: () => resolve_project_root
144
+ resolve_project_root: () => resolve_project_root,
145
+ user_global_settings_paths: () => user_global_settings_paths
144
146
  });
145
147
  import { createRequire } from "node:module";
146
148
  import * as fs3 from "node:fs";
@@ -192,12 +194,20 @@ function canonical_settings_write_path(project_root) {
192
194
  function DEFAULT_USER_GLOBAL_FILE() {
193
195
  return write_target(USER_GLOBAL_FILENAME);
194
196
  }
195
- function _resolve_user_global_file() {
196
- const found = resolve_with_fallback(USER_GLOBAL_FILENAME);
197
- if (found !== null) {
198
- return found;
197
+ function user_global_settings_paths() {
198
+ const paths = [];
199
+ const flat = resolve_with_fallback(USER_GLOBAL_FILENAME);
200
+ if (flat !== null) {
201
+ paths.push(flat);
199
202
  }
200
- return DEFAULT_USER_GLOBAL_FILE();
203
+ const canonical = resolve_with_fallback(USER_GLOBAL_CANONICAL_RELATIVE);
204
+ if (canonical !== null) {
205
+ paths.push(canonical);
206
+ }
207
+ if (paths.length === 0) {
208
+ paths.push(DEFAULT_USER_GLOBAL_FILE());
209
+ }
210
+ return paths;
201
211
  }
202
212
  function _exists(p) {
203
213
  try {
@@ -442,7 +452,10 @@ function load_agent_settings(options = {}) {
442
452
  const user_global_path = options.user_global_path ?? null;
443
453
  const verbose = options.verbose ?? false;
444
454
  const cwd = options.cwd ?? null;
445
- const user_global_raw = _read_yaml(user_global_path ? user_global_path : _resolve_user_global_file()) ?? {};
455
+ const user_global_raw = {};
456
+ for (const p of user_global_path ? [user_global_path] : user_global_settings_paths()) {
457
+ _deep_merge(user_global_raw, _read_yaml(p) ?? {});
458
+ }
446
459
  const [user_global_filtered, ignored] = _filter_whitelist(user_global_raw, MERGEABLE_KEYS);
447
460
  if (verbose && ignored.length > 0) {
448
461
  logger.info(
@@ -595,12 +608,11 @@ function* iter_setting_overrides(options = {}) {
595
608
  const project_path = options.project_path ?? null;
596
609
  const user_global_path = options.user_global_path ?? null;
597
610
  const cwd = options.cwd ?? null;
598
- const user_global_path_resolved = user_global_path ? user_global_path : _resolve_user_global_file();
599
- const user_global_raw = _read_yaml(user_global_path_resolved) ?? {};
600
- const [user_global_filtered] = _filter_whitelist(user_global_raw, MERGEABLE_KEYS);
601
- if (Object.keys(user_global_filtered).length > 0) {
602
- for (const key of _leaf_paths(user_global_filtered)) {
603
- yield [key, _get_dotted(user_global_filtered, key), user_global_path_resolved];
611
+ for (const p of user_global_path ? [user_global_path] : user_global_settings_paths()) {
612
+ const raw = _read_yaml(p) ?? {};
613
+ const [filtered] = _filter_whitelist(raw, MERGEABLE_KEYS);
614
+ for (const key of _leaf_paths(filtered)) {
615
+ yield [key, _get_dotted(filtered, key), p];
604
616
  }
605
617
  }
606
618
  for (const p of _resolve_cascade_paths(cwd, project_path)) {
@@ -741,7 +753,7 @@ function _relative_to(child, root) {
741
753
  function _posix_join(a, b) {
742
754
  return `${a.split(path3.sep).join("/")}/${b}`;
743
755
  }
744
- var _require, Logger, logger, DEFAULT_PROJECT_FILE, LOCAL_PROJECT_FILE, LOCAL_PROJECT_SUBDIR, DEFAULT_TEAM_FILE, USER_GLOBAL_FILENAME, 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;
756
+ 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;
745
757
  var init_agent_settings = __esm({
746
758
  "src/scripts/_lib/agent_settings.ts"() {
747
759
  "use strict";
@@ -763,12 +775,27 @@ var init_agent_settings = __esm({
763
775
  LOCAL_PROJECT_SUBDIR = ["agents", "settings"];
764
776
  DEFAULT_TEAM_FILE = ".agent-project-settings.yml";
765
777
  USER_GLOBAL_FILENAME = "agent-settings.yml";
778
+ USER_GLOBAL_CANONICAL_RELATIVE = "settings/.agent-settings.yml";
766
779
  MERGEABLE_KEYS = [
780
+ // `name`, `ide` and `personal.bot_icon` are the PRE-MIGRATION spellings.
781
+ // `install.ts` migrates `ide` → `personal.ide` and `pr_comment_bot_icon`
782
+ // into its `personal.` home, and this list was never moved with them — so
783
+ // the whitelist named keys the template does not have while the keys it
784
+ // does have were filtered out silently. A user setting either preference
785
+ // user-globally got no error, no warning, and no effect
786
+ // (road-to-capability-answerability 4.3, ADR-219).
787
+ //
788
+ // Both spellings are listed rather than replaced: a legacy file that still
789
+ // uses the old name keeps working, and nothing that resolved before
790
+ // resolves differently. `name` has no reader anywhere and no template key;
791
+ // it is kept only so this change stays purely additive.
767
792
  "name",
768
793
  "ide",
794
+ "personal.ide",
769
795
  "rule_loading_tier",
770
796
  "memory.cadence",
771
797
  "personal.bot_icon",
798
+ "personal.pr_comment_bot_icon",
772
799
  "personal.autonomy",
773
800
  "telegraph.speak_scope",
774
801
  // Knowledge-card global cross-project sharing is a USER-GLOBAL setting
@@ -1669,17 +1696,17 @@ var require_visit = __commonJS({
1669
1696
  visit.BREAK = BREAK;
1670
1697
  visit.SKIP = SKIP;
1671
1698
  visit.REMOVE = REMOVE;
1672
- function visit_(key, node, visitor, path51) {
1673
- const ctrl = callVisitor(key, node, visitor, path51);
1699
+ function visit_(key, node, visitor, path52) {
1700
+ const ctrl = callVisitor(key, node, visitor, path52);
1674
1701
  if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
1675
- replaceNode(key, path51, ctrl);
1676
- return visit_(key, ctrl, visitor, path51);
1702
+ replaceNode(key, path52, ctrl);
1703
+ return visit_(key, ctrl, visitor, path52);
1677
1704
  }
1678
1705
  if (typeof ctrl !== "symbol") {
1679
1706
  if (identity.isCollection(node)) {
1680
- path51 = Object.freeze(path51.concat(node));
1707
+ path52 = Object.freeze(path52.concat(node));
1681
1708
  for (let i = 0; i < node.items.length; ++i) {
1682
- const ci = visit_(i, node.items[i], visitor, path51);
1709
+ const ci = visit_(i, node.items[i], visitor, path52);
1683
1710
  if (typeof ci === "number")
1684
1711
  i = ci - 1;
1685
1712
  else if (ci === BREAK)
@@ -1690,13 +1717,13 @@ var require_visit = __commonJS({
1690
1717
  }
1691
1718
  }
1692
1719
  } else if (identity.isPair(node)) {
1693
- path51 = Object.freeze(path51.concat(node));
1694
- const ck = visit_("key", node.key, visitor, path51);
1720
+ path52 = Object.freeze(path52.concat(node));
1721
+ const ck = visit_("key", node.key, visitor, path52);
1695
1722
  if (ck === BREAK)
1696
1723
  return BREAK;
1697
1724
  else if (ck === REMOVE)
1698
1725
  node.key = null;
1699
- const cv = visit_("value", node.value, visitor, path51);
1726
+ const cv = visit_("value", node.value, visitor, path52);
1700
1727
  if (cv === BREAK)
1701
1728
  return BREAK;
1702
1729
  else if (cv === REMOVE)
@@ -1717,17 +1744,17 @@ var require_visit = __commonJS({
1717
1744
  visitAsync.BREAK = BREAK;
1718
1745
  visitAsync.SKIP = SKIP;
1719
1746
  visitAsync.REMOVE = REMOVE;
1720
- async function visitAsync_(key, node, visitor, path51) {
1721
- const ctrl = await callVisitor(key, node, visitor, path51);
1747
+ async function visitAsync_(key, node, visitor, path52) {
1748
+ const ctrl = await callVisitor(key, node, visitor, path52);
1722
1749
  if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
1723
- replaceNode(key, path51, ctrl);
1724
- return visitAsync_(key, ctrl, visitor, path51);
1750
+ replaceNode(key, path52, ctrl);
1751
+ return visitAsync_(key, ctrl, visitor, path52);
1725
1752
  }
1726
1753
  if (typeof ctrl !== "symbol") {
1727
1754
  if (identity.isCollection(node)) {
1728
- path51 = Object.freeze(path51.concat(node));
1755
+ path52 = Object.freeze(path52.concat(node));
1729
1756
  for (let i = 0; i < node.items.length; ++i) {
1730
- const ci = await visitAsync_(i, node.items[i], visitor, path51);
1757
+ const ci = await visitAsync_(i, node.items[i], visitor, path52);
1731
1758
  if (typeof ci === "number")
1732
1759
  i = ci - 1;
1733
1760
  else if (ci === BREAK)
@@ -1738,13 +1765,13 @@ var require_visit = __commonJS({
1738
1765
  }
1739
1766
  }
1740
1767
  } else if (identity.isPair(node)) {
1741
- path51 = Object.freeze(path51.concat(node));
1742
- const ck = await visitAsync_("key", node.key, visitor, path51);
1768
+ path52 = Object.freeze(path52.concat(node));
1769
+ const ck = await visitAsync_("key", node.key, visitor, path52);
1743
1770
  if (ck === BREAK)
1744
1771
  return BREAK;
1745
1772
  else if (ck === REMOVE)
1746
1773
  node.key = null;
1747
- const cv = await visitAsync_("value", node.value, visitor, path51);
1774
+ const cv = await visitAsync_("value", node.value, visitor, path52);
1748
1775
  if (cv === BREAK)
1749
1776
  return BREAK;
1750
1777
  else if (cv === REMOVE)
@@ -1771,23 +1798,23 @@ var require_visit = __commonJS({
1771
1798
  }
1772
1799
  return visitor;
1773
1800
  }
1774
- function callVisitor(key, node, visitor, path51) {
1801
+ function callVisitor(key, node, visitor, path52) {
1775
1802
  if (typeof visitor === "function")
1776
- return visitor(key, node, path51);
1803
+ return visitor(key, node, path52);
1777
1804
  if (identity.isMap(node))
1778
- return visitor.Map?.(key, node, path51);
1805
+ return visitor.Map?.(key, node, path52);
1779
1806
  if (identity.isSeq(node))
1780
- return visitor.Seq?.(key, node, path51);
1807
+ return visitor.Seq?.(key, node, path52);
1781
1808
  if (identity.isPair(node))
1782
- return visitor.Pair?.(key, node, path51);
1809
+ return visitor.Pair?.(key, node, path52);
1783
1810
  if (identity.isScalar(node))
1784
- return visitor.Scalar?.(key, node, path51);
1811
+ return visitor.Scalar?.(key, node, path52);
1785
1812
  if (identity.isAlias(node))
1786
- return visitor.Alias?.(key, node, path51);
1813
+ return visitor.Alias?.(key, node, path52);
1787
1814
  return void 0;
1788
1815
  }
1789
- function replaceNode(key, path51, node) {
1790
- const parent = path51[path51.length - 1];
1816
+ function replaceNode(key, path52, node) {
1817
+ const parent = path52[path52.length - 1];
1791
1818
  if (identity.isCollection(parent)) {
1792
1819
  parent.items[key] = node;
1793
1820
  } else if (identity.isPair(parent)) {
@@ -2397,10 +2424,10 @@ var require_Collection = __commonJS({
2397
2424
  var createNode = require_createNode();
2398
2425
  var identity = require_identity();
2399
2426
  var Node = require_Node();
2400
- function collectionFromPath(schema, path51, value) {
2427
+ function collectionFromPath(schema, path52, value) {
2401
2428
  let v = value;
2402
- for (let i = path51.length - 1; i >= 0; --i) {
2403
- const k = path51[i];
2429
+ for (let i = path52.length - 1; i >= 0; --i) {
2430
+ const k = path52[i];
2404
2431
  if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
2405
2432
  const a = [];
2406
2433
  a[k] = v;
@@ -2419,7 +2446,7 @@ var require_Collection = __commonJS({
2419
2446
  sourceObjects: /* @__PURE__ */ new Map()
2420
2447
  });
2421
2448
  }
2422
- var isEmptyPath = (path51) => path51 == null || typeof path51 === "object" && !!path51[Symbol.iterator]().next().done;
2449
+ var isEmptyPath = (path52) => path52 == null || typeof path52 === "object" && !!path52[Symbol.iterator]().next().done;
2423
2450
  var Collection = class extends Node.NodeBase {
2424
2451
  constructor(type, schema) {
2425
2452
  super(type);
@@ -2449,11 +2476,11 @@ var require_Collection = __commonJS({
2449
2476
  * be a Pair instance or a `{ key, value }` object, which may not have a key
2450
2477
  * that already exists in the map.
2451
2478
  */
2452
- addIn(path51, value) {
2453
- if (isEmptyPath(path51))
2479
+ addIn(path52, value) {
2480
+ if (isEmptyPath(path52))
2454
2481
  this.add(value);
2455
2482
  else {
2456
- const [key, ...rest] = path51;
2483
+ const [key, ...rest] = path52;
2457
2484
  const node = this.get(key, true);
2458
2485
  if (identity.isCollection(node))
2459
2486
  node.addIn(rest, value);
@@ -2467,8 +2494,8 @@ var require_Collection = __commonJS({
2467
2494
  * Removes a value from the collection.
2468
2495
  * @returns `true` if the item was found and removed.
2469
2496
  */
2470
- deleteIn(path51) {
2471
- const [key, ...rest] = path51;
2497
+ deleteIn(path52) {
2498
+ const [key, ...rest] = path52;
2472
2499
  if (rest.length === 0)
2473
2500
  return this.delete(key);
2474
2501
  const node = this.get(key, true);
@@ -2482,8 +2509,8 @@ var require_Collection = __commonJS({
2482
2509
  * scalar values from their surrounding node; to disable set `keepScalar` to
2483
2510
  * `true` (collections are always returned intact).
2484
2511
  */
2485
- getIn(path51, keepScalar) {
2486
- const [key, ...rest] = path51;
2512
+ getIn(path52, keepScalar) {
2513
+ const [key, ...rest] = path52;
2487
2514
  const node = this.get(key, true);
2488
2515
  if (rest.length === 0)
2489
2516
  return !keepScalar && identity.isScalar(node) ? node.value : node;
@@ -2501,8 +2528,8 @@ var require_Collection = __commonJS({
2501
2528
  /**
2502
2529
  * Checks if the collection includes a value with the key `key`.
2503
2530
  */
2504
- hasIn(path51) {
2505
- const [key, ...rest] = path51;
2531
+ hasIn(path52) {
2532
+ const [key, ...rest] = path52;
2506
2533
  if (rest.length === 0)
2507
2534
  return this.has(key);
2508
2535
  const node = this.get(key, true);
@@ -2512,8 +2539,8 @@ var require_Collection = __commonJS({
2512
2539
  * Sets a value in this collection. For `!!set`, `value` needs to be a
2513
2540
  * boolean to add/remove the item from the set.
2514
2541
  */
2515
- setIn(path51, value) {
2516
- const [key, ...rest] = path51;
2542
+ setIn(path52, value) {
2543
+ const [key, ...rest] = path52;
2517
2544
  if (rest.length === 0) {
2518
2545
  this.set(key, value);
2519
2546
  } else {
@@ -5028,9 +5055,9 @@ var require_Document = __commonJS({
5028
5055
  this.contents.add(value);
5029
5056
  }
5030
5057
  /** Adds a value to the document. */
5031
- addIn(path51, value) {
5058
+ addIn(path52, value) {
5032
5059
  if (assertCollection(this.contents))
5033
- this.contents.addIn(path51, value);
5060
+ this.contents.addIn(path52, value);
5034
5061
  }
5035
5062
  /**
5036
5063
  * Create a new `Alias` node, ensuring that the target `node` has the required anchor.
@@ -5105,14 +5132,14 @@ var require_Document = __commonJS({
5105
5132
  * Removes a value from the document.
5106
5133
  * @returns `true` if the item was found and removed.
5107
5134
  */
5108
- deleteIn(path51) {
5109
- if (Collection.isEmptyPath(path51)) {
5135
+ deleteIn(path52) {
5136
+ if (Collection.isEmptyPath(path52)) {
5110
5137
  if (this.contents == null)
5111
5138
  return false;
5112
5139
  this.contents = null;
5113
5140
  return true;
5114
5141
  }
5115
- return assertCollection(this.contents) ? this.contents.deleteIn(path51) : false;
5142
+ return assertCollection(this.contents) ? this.contents.deleteIn(path52) : false;
5116
5143
  }
5117
5144
  /**
5118
5145
  * Returns item at `key`, or `undefined` if not found. By default unwraps
@@ -5127,10 +5154,10 @@ var require_Document = __commonJS({
5127
5154
  * scalar values from their surrounding node; to disable set `keepScalar` to
5128
5155
  * `true` (collections are always returned intact).
5129
5156
  */
5130
- getIn(path51, keepScalar) {
5131
- if (Collection.isEmptyPath(path51))
5157
+ getIn(path52, keepScalar) {
5158
+ if (Collection.isEmptyPath(path52))
5132
5159
  return !keepScalar && identity.isScalar(this.contents) ? this.contents.value : this.contents;
5133
- return identity.isCollection(this.contents) ? this.contents.getIn(path51, keepScalar) : void 0;
5160
+ return identity.isCollection(this.contents) ? this.contents.getIn(path52, keepScalar) : void 0;
5134
5161
  }
5135
5162
  /**
5136
5163
  * Checks if the document includes a value with the key `key`.
@@ -5141,10 +5168,10 @@ var require_Document = __commonJS({
5141
5168
  /**
5142
5169
  * Checks if the document includes a value at `path`.
5143
5170
  */
5144
- hasIn(path51) {
5145
- if (Collection.isEmptyPath(path51))
5171
+ hasIn(path52) {
5172
+ if (Collection.isEmptyPath(path52))
5146
5173
  return this.contents !== void 0;
5147
- return identity.isCollection(this.contents) ? this.contents.hasIn(path51) : false;
5174
+ return identity.isCollection(this.contents) ? this.contents.hasIn(path52) : false;
5148
5175
  }
5149
5176
  /**
5150
5177
  * Sets a value in this document. For `!!set`, `value` needs to be a
@@ -5161,13 +5188,13 @@ var require_Document = __commonJS({
5161
5188
  * Sets a value in this document. For `!!set`, `value` needs to be a
5162
5189
  * boolean to add/remove the item from the set.
5163
5190
  */
5164
- setIn(path51, value) {
5165
- if (Collection.isEmptyPath(path51)) {
5191
+ setIn(path52, value) {
5192
+ if (Collection.isEmptyPath(path52)) {
5166
5193
  this.contents = value;
5167
5194
  } else if (this.contents == null) {
5168
- this.contents = Collection.collectionFromPath(this.schema, Array.from(path51), value);
5195
+ this.contents = Collection.collectionFromPath(this.schema, Array.from(path52), value);
5169
5196
  } else if (assertCollection(this.contents)) {
5170
- this.contents.setIn(path51, value);
5197
+ this.contents.setIn(path52, value);
5171
5198
  }
5172
5199
  }
5173
5200
  /**
@@ -7127,9 +7154,9 @@ var require_cst_visit = __commonJS({
7127
7154
  visit.BREAK = BREAK;
7128
7155
  visit.SKIP = SKIP;
7129
7156
  visit.REMOVE = REMOVE;
7130
- visit.itemAtPath = (cst, path51) => {
7157
+ visit.itemAtPath = (cst, path52) => {
7131
7158
  let item = cst;
7132
- for (const [field, index] of path51) {
7159
+ for (const [field, index] of path52) {
7133
7160
  const tok = item?.[field];
7134
7161
  if (tok && "items" in tok) {
7135
7162
  item = tok.items[index];
@@ -7138,23 +7165,23 @@ var require_cst_visit = __commonJS({
7138
7165
  }
7139
7166
  return item;
7140
7167
  };
7141
- visit.parentCollection = (cst, path51) => {
7142
- const parent = visit.itemAtPath(cst, path51.slice(0, -1));
7143
- const field = path51[path51.length - 1][0];
7168
+ visit.parentCollection = (cst, path52) => {
7169
+ const parent = visit.itemAtPath(cst, path52.slice(0, -1));
7170
+ const field = path52[path52.length - 1][0];
7144
7171
  const coll = parent?.[field];
7145
7172
  if (coll && "items" in coll)
7146
7173
  return coll;
7147
7174
  throw new Error("Parent collection not found");
7148
7175
  };
7149
- function _visit(path51, item, visitor) {
7150
- let ctrl = visitor(item, path51);
7176
+ function _visit(path52, item, visitor) {
7177
+ let ctrl = visitor(item, path52);
7151
7178
  if (typeof ctrl === "symbol")
7152
7179
  return ctrl;
7153
7180
  for (const field of ["key", "value"]) {
7154
7181
  const token = item[field];
7155
7182
  if (token && "items" in token) {
7156
7183
  for (let i = 0; i < token.items.length; ++i) {
7157
- const ci = _visit(Object.freeze(path51.concat([[field, i]])), token.items[i], visitor);
7184
+ const ci = _visit(Object.freeze(path52.concat([[field, i]])), token.items[i], visitor);
7158
7185
  if (typeof ci === "number")
7159
7186
  i = ci - 1;
7160
7187
  else if (ci === BREAK)
@@ -7165,10 +7192,10 @@ var require_cst_visit = __commonJS({
7165
7192
  }
7166
7193
  }
7167
7194
  if (typeof ctrl === "function" && field === "key")
7168
- ctrl = ctrl(item, path51);
7195
+ ctrl = ctrl(item, path52);
7169
7196
  }
7170
7197
  }
7171
- return typeof ctrl === "function" ? ctrl(item, path51) : ctrl;
7198
+ return typeof ctrl === "function" ? ctrl(item, path52) : ctrl;
7172
7199
  }
7173
7200
  exports.visit = visit;
7174
7201
  }
@@ -8470,14 +8497,14 @@ var require_parser = __commonJS({
8470
8497
  case "scalar":
8471
8498
  case "single-quoted-scalar":
8472
8499
  case "double-quoted-scalar": {
8473
- const fs57 = this.flowScalar(this.type);
8500
+ const fs58 = this.flowScalar(this.type);
8474
8501
  if (atNextItem || it.value) {
8475
- map.items.push({ start, key: fs57, sep: [] });
8502
+ map.items.push({ start, key: fs58, sep: [] });
8476
8503
  this.onKeyLine = true;
8477
8504
  } else if (it.sep) {
8478
- this.stack.push(fs57);
8505
+ this.stack.push(fs58);
8479
8506
  } else {
8480
- Object.assign(it, { key: fs57, sep: [] });
8507
+ Object.assign(it, { key: fs58, sep: [] });
8481
8508
  this.onKeyLine = true;
8482
8509
  }
8483
8510
  return;
@@ -8605,13 +8632,13 @@ var require_parser = __commonJS({
8605
8632
  case "scalar":
8606
8633
  case "single-quoted-scalar":
8607
8634
  case "double-quoted-scalar": {
8608
- const fs57 = this.flowScalar(this.type);
8635
+ const fs58 = this.flowScalar(this.type);
8609
8636
  if (!it || it.value)
8610
- fc.items.push({ start: [], key: fs57, sep: [] });
8637
+ fc.items.push({ start: [], key: fs58, sep: [] });
8611
8638
  else if (it.sep)
8612
- this.stack.push(fs57);
8639
+ this.stack.push(fs58);
8613
8640
  else
8614
- Object.assign(it, { key: fs57, sep: [] });
8641
+ Object.assign(it, { key: fs58, sep: [] });
8615
8642
  return;
8616
8643
  }
8617
8644
  case "flow-map-end":
@@ -13073,6 +13100,109 @@ var init_agent_src = __esm({
13073
13100
  }
13074
13101
  });
13075
13102
 
13103
+ // src/scripts/_lib/kernel_rules.ts
13104
+ var KERNEL_RULE_IDS, KERNEL_RULE_FILENAMES, KERNEL_RULE_ID_SET;
13105
+ var init_kernel_rules = __esm({
13106
+ "src/scripts/_lib/kernel_rules.ts"() {
13107
+ "use strict";
13108
+ KERNEL_RULE_IDS = [
13109
+ "agent-authority",
13110
+ "ask-when-uncertain",
13111
+ "commit-policy",
13112
+ "direct-answers",
13113
+ "language-and-tone",
13114
+ "no-cheap-questions",
13115
+ "non-destructive-by-default",
13116
+ "scope-control",
13117
+ "verify-before-complete"
13118
+ ];
13119
+ KERNEL_RULE_FILENAMES = new Set(
13120
+ KERNEL_RULE_IDS.map((id) => `${id}.md`)
13121
+ );
13122
+ KERNEL_RULE_ID_SET = new Set(KERNEL_RULE_IDS);
13123
+ }
13124
+ });
13125
+
13126
+ // src/scripts/_lib/obligation_frequency.ts
13127
+ function is_frequency(v) {
13128
+ return typeof v === "string" && FREQUENCIES.includes(v);
13129
+ }
13130
+ function covers(carrier, obligation) {
13131
+ if (obligation === "none") return true;
13132
+ if (carrier.mode === "sweep") return SWEEPABLE.has(obligation);
13133
+ if (carrier.frequency === "none") return false;
13134
+ if (CROSS_ROOT_COVERAGE.some(([c, o]) => c === carrier.frequency && o === obligation)) {
13135
+ return true;
13136
+ }
13137
+ if (ROOT_OF[carrier.frequency] !== ROOT_OF[obligation]) return false;
13138
+ return DEPTH[carrier.frequency] <= DEPTH[obligation];
13139
+ }
13140
+ function frequency_prose_conflicts(body, declared) {
13141
+ const out = [];
13142
+ for (const [freq, re] of PROSE_SIGNALS) {
13143
+ if (!re.test(body)) continue;
13144
+ if (covers({ frequency: declared, mode: "point" }, freq)) continue;
13145
+ if (!out.includes(freq)) out.push(freq);
13146
+ }
13147
+ return out;
13148
+ }
13149
+ function has_frequency_override(text) {
13150
+ return /^#\s*frequency-override:\s*\S/m.test(text);
13151
+ }
13152
+ var FREQUENCIES, ROOT_OF, CROSS_ROOT_COVERAGE, DEPTH, SWEEPABLE, PROSE_SIGNALS;
13153
+ var init_obligation_frequency = __esm({
13154
+ "src/scripts/_lib/obligation_frequency.ts"() {
13155
+ "use strict";
13156
+ FREQUENCIES = [
13157
+ "per-edit",
13158
+ "per-turn",
13159
+ "per-task",
13160
+ "per-session",
13161
+ "per-event",
13162
+ "per-commit",
13163
+ "per-file-write",
13164
+ "none"
13165
+ ];
13166
+ ROOT_OF = {
13167
+ "per-turn": "lifecycle",
13168
+ "per-task": "lifecycle",
13169
+ "per-session": "lifecycle",
13170
+ "per-edit": "tool-call",
13171
+ "per-file-write": "tool-call",
13172
+ "per-commit": "repository",
13173
+ "per-event": "external-event",
13174
+ none: "none"
13175
+ };
13176
+ CROSS_ROOT_COVERAGE = [
13177
+ ["per-edit", "per-commit"]
13178
+ ];
13179
+ DEPTH = {
13180
+ "per-turn": 0,
13181
+ "per-task": 1,
13182
+ "per-session": 2,
13183
+ "per-edit": 0,
13184
+ "per-file-write": 1,
13185
+ "per-commit": 0,
13186
+ "per-event": 0,
13187
+ none: 0
13188
+ };
13189
+ SWEEPABLE = /* @__PURE__ */ new Set([
13190
+ "per-edit",
13191
+ "per-file-write",
13192
+ "per-commit"
13193
+ ]);
13194
+ PROSE_SIGNALS = [
13195
+ ["per-turn", /\b(every|each) (reply|turn|answer|response)\b/i],
13196
+ ["per-turn", /\bper (reply|turn)\b/i],
13197
+ ["per-task", /\b(every|each) (new )?task\b/i],
13198
+ ["per-edit", /\bafter every (code )?edit\b/i],
13199
+ ["per-edit", /\b(every|each) edit\b/i],
13200
+ ["per-commit", /\b(in the )?same commit\b/i],
13201
+ ["per-commit", /\b(every|each) commit\b/i]
13202
+ ];
13203
+ }
13204
+ });
13205
+
13076
13206
  // src/scripts/validate_frontmatter.ts
13077
13207
  import * as fs18 from "node:fs";
13078
13208
  import * as path17 from "node:path";
@@ -13642,6 +13772,31 @@ function pyRepr(value) {
13642
13772
  function pyListRepr(values) {
13643
13773
  return `[${values.map((v) => pyRepr(v)).join(", ")}]`;
13644
13774
  }
13775
+ function check_obligation_frequency(filePath, text, data) {
13776
+ const id = path17.basename(filePath).replace(/\.md$/, "");
13777
+ if (KERNEL_RULE_ID_SET.has(id)) return [];
13778
+ const declared = data["obligation_frequency"];
13779
+ if (!is_frequency(declared)) {
13780
+ return [
13781
+ new SchemaError(
13782
+ "$.obligation_frequency",
13783
+ "required",
13784
+ "Missing required property 'obligation_frequency' \u2014 how often this rule's obligation comes due. Without it check_enforcement_coverage cannot join the rule against its carrier's firing frequency and reports it unclassified."
13785
+ )
13786
+ ];
13787
+ }
13788
+ if (has_frequency_override(text)) return [];
13789
+ const conflicts = frequency_prose_conflicts(text, declared);
13790
+ if (conflicts.length === 0) return [];
13791
+ return [
13792
+ new SchemaError(
13793
+ "$.obligation_frequency",
13794
+ "frequency-prose-drift",
13795
+ `declared '${declared}', but the prose reads as ${conflicts.join(" / ")} \u2014 either the declaration or the prose moved. Silence an audited mismatch with a \`# frequency-override: <reason>\` comment in the frontmatter.`,
13796
+ "warning"
13797
+ )
13798
+ ];
13799
+ }
13645
13800
  function _iter_artefacts(root) {
13646
13801
  const targets = [];
13647
13802
  const mapping = [
@@ -13737,6 +13892,9 @@ function _main(argv) {
13737
13892
  const schema = load_schema(artefactType);
13738
13893
  apply_schema_defaults(data, schema);
13739
13894
  const errors = validate(data, schema);
13895
+ if (artefactType === "rule") {
13896
+ errors.push(...check_obligation_frequency(p, text, data));
13897
+ }
13740
13898
  const fatal = errors.filter((e) => e.severity === "error");
13741
13899
  const warnings = errors.filter((e) => e.severity === "warning");
13742
13900
  if (fatal.length > 0) {
@@ -13838,6 +13996,8 @@ var init_validate_frontmatter = __esm({
13838
13996
  "use strict";
13839
13997
  import_yaml3 = __toESM(require_dist(), 1);
13840
13998
  init_agent_src();
13999
+ init_kernel_rules();
14000
+ init_obligation_frequency();
13841
14001
  _FRONTMATTER_RE = /^---\n([\s\S]*?)\n---\n/;
13842
14002
  SchemaError = class {
13843
14003
  path;
@@ -14604,7 +14764,7 @@ function lint_router_frontmatter(ruleId, frontmatter, ruleType) {
14604
14764
  if (ruleType === "manual") {
14605
14765
  return issues;
14606
14766
  }
14607
- const isKernel = KERNEL_RULE_IDS.has(ruleId) || ruleType === "always";
14767
+ const isKernel = KERNEL_RULE_IDS2.has(ruleId) || ruleType === "always";
14608
14768
  if (isKernel) {
14609
14769
  if (triggers !== null) {
14610
14770
  issues.push(
@@ -17684,7 +17844,7 @@ function _isCliEntry7() {
17684
17844
  return false;
17685
17845
  }
17686
17846
  }
17687
- var _HERE4, REQUIRED_PERSONA_SECTIONS_CORE, REQUIRED_PERSONA_SECTIONS_SPECIALIST, VALID_PERSONA_TIERS, PERSONA_LINE_BUDGETS, REQUIRED_USERTYPE_SECTIONS, USERTYPE_LINE_BUDGET, VALID_PERSONA_WINGS, PERSONA_LINE_BUDGETS_BY_WING, REQUIRED_SKILL_SECTIONS, SECTION_ALIASES, RECOMMENDED_SKILL_SECTIONS, RULE_BAD_SIGNS, FRUGALITY_WRITER_SKILLS, FRUGALITY_CHARTER_RELPATH, FRUGALITY_CHARTER_INDEX_RULES, VAGUE_VALIDATION_PATTERNS, TRIGGER_WARNING_PATTERNS, ORDERED_STEP_PATTERN, SECTION_PATTERN, FRONTMATTER_PATTERN, DESCRIPTION_PATTERN, STATUS_PATTERN, REPLACED_BY_PATTERN, TIER_PATTERN, TYPE_PATTERN, SOURCE_PATTERN, SENIOR_RELATED_SKILLS_PATTERN, SENIOR_RELATED_WHEN_PATTERN, SENIOR_RELATED_WHEN_NOT_PATTERN, SENIOR_PROACTIVE_PATTERN, SENIOR_OUTPUT_PATTERN, H1_PATTERN, DOUBLE_BLANK_PATTERN, VALID_RULE_TYPES, VALID_RULE_SOURCES, ROUTER_ALLOWED_TRIGGER_KEYS, KERNEL_RULE_IDS, VALID_EXECUTION_TYPES, VALID_EXECUTION_HANDLERS, VALID_EXECUTION_SAFETY_MODES, VALID_EXECUTION_FIELDS, WING3_SPINE_SLOTS, CONTEXT_SPINE_INLINE_PATTERN, WING3_SAAS_URL_PATTERN, WING3_VENDOR_BLACKLIST, WING3_STACK_LOCKED_PATTERN, WING3_CHANNEL_TACTIC_PATTERN, WING4_SPINE_SLOTS, WING4_SAAS_URL_PATTERN, WING4_VENDOR_BLACKLIST, WING4_STAGE_AGNOSTIC_PATTERN, Issue, LintResult, _ROLE_CONTRACT_CANDIDATES, _ROLE_CONTRACT_SLUGS_CACHE, _ROLE_CONTRACT_REF_PATTERN, PROCEDURE_HEADING_PATTERN, COMMAND_FRONTMATTER_DELEGATION_KEYS, MD_LINK_PATTERN_G, NAME_PATTERN, DISABLE_MODEL_PATTERN, _INSPECT_VERB_PATTERN, last_changed_scope_reason, last_changed_base_diff_ok, _INTERACTION_NAME_PATTERNS, _INTERACTION_CONTENT_KEYWORDS, _EXEC_FILE_SIGNALS, _EXEC_CONTENT_SIGNALS, _TASK_TYPE_SIGNALS, _VERIFICATION_TOOLS, _FRUGALITY_STANDARDS_PATTERN, _FRUGALITY_CHARTER_LINK_PATTERN, _MD_LINK_PATTERN, _MALICE_CRED_EXFIL, _MALICE_REMOTE_EXEC, _MALICE_FORCE_PUSH, _MALICE_CHMOD_SECRETS, _MALICE_SHELL_INJECT, _MALICE_PATTERNS, _NAG_UPDATE_CHECK, _NAG_STAY_CURRENT, _NAG_SELF_PROMO, _NAG_BEST_SKILL, _NAG_MUST_USE, _NAG_ALWAYS_USE, _NAG_PATTERNS, _OUTPUT_SCHEMA_KEY_PATTERN, _SCHEMA_ARTEFACT_TYPES, ArgError, isCliEntry2;
17847
+ var _HERE4, REQUIRED_PERSONA_SECTIONS_CORE, REQUIRED_PERSONA_SECTIONS_SPECIALIST, VALID_PERSONA_TIERS, PERSONA_LINE_BUDGETS, REQUIRED_USERTYPE_SECTIONS, USERTYPE_LINE_BUDGET, VALID_PERSONA_WINGS, PERSONA_LINE_BUDGETS_BY_WING, REQUIRED_SKILL_SECTIONS, SECTION_ALIASES, RECOMMENDED_SKILL_SECTIONS, RULE_BAD_SIGNS, FRUGALITY_WRITER_SKILLS, FRUGALITY_CHARTER_RELPATH, FRUGALITY_CHARTER_INDEX_RULES, VAGUE_VALIDATION_PATTERNS, TRIGGER_WARNING_PATTERNS, ORDERED_STEP_PATTERN, SECTION_PATTERN, FRONTMATTER_PATTERN, DESCRIPTION_PATTERN, STATUS_PATTERN, REPLACED_BY_PATTERN, TIER_PATTERN, TYPE_PATTERN, SOURCE_PATTERN, SENIOR_RELATED_SKILLS_PATTERN, SENIOR_RELATED_WHEN_PATTERN, SENIOR_RELATED_WHEN_NOT_PATTERN, SENIOR_PROACTIVE_PATTERN, SENIOR_OUTPUT_PATTERN, H1_PATTERN, DOUBLE_BLANK_PATTERN, VALID_RULE_TYPES, VALID_RULE_SOURCES, ROUTER_ALLOWED_TRIGGER_KEYS, KERNEL_RULE_IDS2, VALID_EXECUTION_TYPES, VALID_EXECUTION_HANDLERS, VALID_EXECUTION_SAFETY_MODES, VALID_EXECUTION_FIELDS, WING3_SPINE_SLOTS, CONTEXT_SPINE_INLINE_PATTERN, WING3_SAAS_URL_PATTERN, WING3_VENDOR_BLACKLIST, WING3_STACK_LOCKED_PATTERN, WING3_CHANNEL_TACTIC_PATTERN, WING4_SPINE_SLOTS, WING4_SAAS_URL_PATTERN, WING4_VENDOR_BLACKLIST, WING4_STAGE_AGNOSTIC_PATTERN, Issue, LintResult, _ROLE_CONTRACT_CANDIDATES, _ROLE_CONTRACT_SLUGS_CACHE, _ROLE_CONTRACT_REF_PATTERN, PROCEDURE_HEADING_PATTERN, COMMAND_FRONTMATTER_DELEGATION_KEYS, MD_LINK_PATTERN_G, NAME_PATTERN, DISABLE_MODEL_PATTERN, _INSPECT_VERB_PATTERN, last_changed_scope_reason, last_changed_base_diff_ok, _INTERACTION_NAME_PATTERNS, _INTERACTION_CONTENT_KEYWORDS, _EXEC_FILE_SIGNALS, _EXEC_CONTENT_SIGNALS, _TASK_TYPE_SIGNALS, _VERIFICATION_TOOLS, _FRUGALITY_STANDARDS_PATTERN, _FRUGALITY_CHARTER_LINK_PATTERN, _MD_LINK_PATTERN, _MALICE_CRED_EXFIL, _MALICE_REMOTE_EXEC, _MALICE_FORCE_PUSH, _MALICE_CHMOD_SECRETS, _MALICE_SHELL_INJECT, _MALICE_PATTERNS, _NAG_UPDATE_CHECK, _NAG_STAY_CURRENT, _NAG_SELF_PROMO, _NAG_BEST_SKILL, _NAG_MUST_USE, _NAG_ALWAYS_USE, _NAG_PATTERNS, _OUTPUT_SCHEMA_KEY_PATTERN, _SCHEMA_ARTEFACT_TYPES, ArgError, isCliEntry2;
17688
17848
  var init_skill_linter = __esm({
17689
17849
  "src/scripts/skill_linter.ts"() {
17690
17850
  "use strict";
@@ -17793,7 +17953,7 @@ var init_skill_linter = __esm({
17793
17953
  "path_prefix",
17794
17954
  "command"
17795
17955
  ]);
17796
- KERNEL_RULE_IDS = /* @__PURE__ */ new Set([
17956
+ KERNEL_RULE_IDS2 = /* @__PURE__ */ new Set([
17797
17957
  "agent-authority",
17798
17958
  "ask-when-uncertain",
17799
17959
  "commit-policy",
@@ -21250,8 +21410,8 @@ function lockfile_path(env) {
21250
21410
  }
21251
21411
  return write_target("installed.lock", { env: env ?? null });
21252
21412
  }
21253
- function read_lockfile(path51) {
21254
- const target = path51 ?? lockfile_path();
21413
+ function read_lockfile(path52) {
21414
+ const target = path52 ?? lockfile_path();
21255
21415
  let text;
21256
21416
  try {
21257
21417
  text = fs31.readFileSync(target, { encoding: "utf-8" });
@@ -21461,18 +21621,18 @@ function manifest_path(project_root, env) {
21461
21621
  }
21462
21622
  return fsPath.join(project_root, DEFAULT_MANIFEST_RELATIVE);
21463
21623
  }
21464
- function read_manifest(path51) {
21624
+ function read_manifest(path52) {
21465
21625
  let text;
21466
21626
  try {
21467
- text = require_read_text(path51);
21627
+ text = require_read_text(path52);
21468
21628
  } catch {
21469
21629
  return null;
21470
21630
  }
21471
21631
  const data = _parse_manual(text);
21472
21632
  return _normalise_v2_shape(data);
21473
21633
  }
21474
- function require_read_text(path51) {
21475
- return fs33.readFileSync(path51, { encoding: "utf-8" });
21634
+ function require_read_text(path52) {
21635
+ return fs33.readFileSync(path52, { encoding: "utf-8" });
21476
21636
  }
21477
21637
  function _normalise_v2_shape(data) {
21478
21638
  if (data["tools"] === void 0 || data["tools"] === null) {
@@ -21653,9 +21813,9 @@ function stable_sort(items, key) {
21653
21813
  return a.index - b.index;
21654
21814
  }).map((entry) => entry.item);
21655
21815
  }
21656
- function write_manifest(path51, version, tools, options = {}) {
21816
+ function write_manifest(path52, version, tools, options = {}) {
21657
21817
  const rendered = _render(version, tools, { deploy_roots: options.deploy_roots ?? null });
21658
- return write_atomic(path51, rendered);
21818
+ return write_atomic(path52, rendered);
21659
21819
  }
21660
21820
  function upsert_tool(existing, options) {
21661
21821
  const {
@@ -22258,6 +22418,44 @@ var init_duplicate_scope_census = __esm({
22258
22418
  }
22259
22419
  });
22260
22420
 
22421
+ // src/scripts/_lib/git_common_dir.ts
22422
+ import fs36 from "node:fs";
22423
+ import path34 from "node:path";
22424
+ function realpath_or_self(p) {
22425
+ try {
22426
+ return fs36.realpathSync(p);
22427
+ } catch {
22428
+ return p;
22429
+ }
22430
+ }
22431
+ function git_common_dir(project_root) {
22432
+ const dot_git = path34.join(project_root, ".git");
22433
+ try {
22434
+ const st = fs36.statSync(dot_git);
22435
+ if (st.isDirectory()) {
22436
+ return realpath_or_self(dot_git);
22437
+ }
22438
+ const m = fs36.readFileSync(dot_git, "utf-8").match(/^gitdir:\s*(.+)\s*$/m);
22439
+ if (m === null) {
22440
+ return null;
22441
+ }
22442
+ const gitdir = path34.resolve(project_root, m[1].trim());
22443
+ const commondir_file = path34.join(gitdir, "commondir");
22444
+ if (fs36.existsSync(commondir_file)) {
22445
+ const common = path34.resolve(gitdir, fs36.readFileSync(commondir_file, "utf-8").trim());
22446
+ return realpath_or_self(common);
22447
+ }
22448
+ return realpath_or_self(gitdir);
22449
+ } catch {
22450
+ return null;
22451
+ }
22452
+ }
22453
+ var init_git_common_dir = __esm({
22454
+ "src/scripts/_lib/git_common_dir.ts"() {
22455
+ "use strict";
22456
+ }
22457
+ });
22458
+
22261
22459
  // src/scripts/_lib/spawn_env.ts
22262
22460
  function isDeniedByFamily(name) {
22263
22461
  if (name.startsWith("LD_") || name.startsWith("DYLD_")) return true;
@@ -22330,8 +22528,8 @@ var init_spawn_env = __esm({
22330
22528
 
22331
22529
  // src/scripts/ai_council/events_log.ts
22332
22530
  import * as crypto4 from "node:crypto";
22333
- import * as fs36 from "node:fs";
22334
- import * as path34 from "node:path";
22531
+ import * as fs37 from "node:fs";
22532
+ import * as path35 from "node:path";
22335
22533
  import { fileURLToPath as fileURLToPath23 } from "node:url";
22336
22534
  function _hash_original_ask(originalAsk) {
22337
22535
  if (!originalAsk) {
@@ -22427,9 +22625,9 @@ function appendEvent(event, opts = {}) {
22427
22625
  }
22428
22626
  }
22429
22627
  const target = opts.logPath != null ? opts.logPath : _DEFAULT_LOG_PATH;
22430
- fs36.mkdirSync(path34.dirname(target), { recursive: true });
22628
+ fs37.mkdirSync(path35.dirname(target), { recursive: true });
22431
22629
  const line = _pyJsonDumpsCompact(record);
22432
- fs36.appendFileSync(target, line + "\n", { encoding: "utf-8" });
22630
+ fs37.appendFileSync(target, line + "\n", { encoding: "utf-8" });
22433
22631
  return true;
22434
22632
  }
22435
22633
  function _isoSecondsZ(d) {
@@ -22527,8 +22725,8 @@ var init_events_log = __esm({
22527
22725
  ]);
22528
22726
  _KILL_SWITCH_ENV = "AGENT_CONFIG_NO_EVENTS_LOG";
22529
22727
  _HERE11 = fileURLToPath23(import.meta.url);
22530
- _REPO_ROOT = path34.resolve(path34.dirname(_HERE11), "..", "..", "..");
22531
- _DEFAULT_LOG_PATH = path34.join(
22728
+ _REPO_ROOT = path35.resolve(path35.dirname(_HERE11), "..", "..", "..");
22729
+ _DEFAULT_LOG_PATH = path35.join(
22532
22730
  _REPO_ROOT,
22533
22731
  "agents",
22534
22732
  "runtime",
@@ -22594,8 +22792,8 @@ __export(clients_exports, {
22594
22792
  reset_cli_call_counts: () => reset_cli_call_counts
22595
22793
  });
22596
22794
  import { spawnSync as spawnSync7 } from "node:child_process";
22597
- import * as fs37 from "node:fs";
22598
- import * as path35 from "node:path";
22795
+ import * as fs38 from "node:fs";
22796
+ import * as path36 from "node:path";
22599
22797
  function _resolveKeyPath(filename) {
22600
22798
  const found = resolve_with_fallback(filename);
22601
22799
  if (found !== null) {
@@ -22631,13 +22829,13 @@ function _setMonotonicSource(fn) {
22631
22829
  return prev;
22632
22830
  }
22633
22831
  function _loadKey(p, prefix, installScript) {
22634
- if (!fs37.existsSync(p)) {
22832
+ if (!fs38.existsSync(p)) {
22635
22833
  throw new KeyGateError(
22636
22834
  `Key not found at ${p}.
22637
22835
  Install it with: bash ${installScript}`
22638
22836
  );
22639
22837
  }
22640
- const st = fs37.statSync(p);
22838
+ const st = fs38.statSync(p);
22641
22839
  const mode = st.mode & 511;
22642
22840
  if (mode !== 384) {
22643
22841
  throw new KeyGateError(
@@ -22645,7 +22843,7 @@ function _loadKey(p, prefix, installScript) {
22645
22843
  Fix: chmod 600 ${p}`
22646
22844
  );
22647
22845
  }
22648
- const key = fs37.readFileSync(p, { encoding: "utf-8" }).trim();
22846
+ const key = fs38.readFileSync(p, { encoding: "utf-8" }).trim();
22649
22847
  if (!key) {
22650
22848
  throw new KeyGateError(`${p} is empty.`);
22651
22849
  }
@@ -22718,12 +22916,12 @@ function _today_utc_iso() {
22718
22916
  }
22719
22917
  function load_cli_call_counts(p = null) {
22720
22918
  const target = p !== null ? p : _cliCallsStatePath();
22721
- if (!fs37.existsSync(target)) {
22919
+ if (!fs38.existsSync(target)) {
22722
22920
  return {};
22723
22921
  }
22724
22922
  let data;
22725
22923
  try {
22726
- data = JSON.parse(fs37.readFileSync(target, { encoding: "utf-8" }));
22924
+ data = JSON.parse(fs38.readFileSync(target, { encoding: "utf-8" }));
22727
22925
  } catch {
22728
22926
  return {};
22729
22927
  }
@@ -22750,8 +22948,8 @@ function record_cli_call(provider, p = null) {
22750
22948
  const target = p !== null ? p : _cliCallsStatePath();
22751
22949
  const counts = load_cli_call_counts(target);
22752
22950
  counts[provider] = (counts[provider] ?? 0) + 1;
22753
- fs37.mkdirSync(path35.dirname(target), { recursive: true });
22754
- fs37.writeFileSync(
22951
+ fs38.mkdirSync(path36.dirname(target), { recursive: true });
22952
+ fs38.writeFileSync(
22755
22953
  target,
22756
22954
  _jsonDumpsIndent2({ date: _today_utc_iso(), counts }),
22757
22955
  { encoding: "utf-8" }
@@ -22766,8 +22964,8 @@ function reset_cli_call_counts(provider = null, p = null) {
22766
22964
  } else {
22767
22965
  delete counts[provider];
22768
22966
  }
22769
- fs37.mkdirSync(path35.dirname(target), { recursive: true });
22770
- fs37.writeFileSync(
22967
+ fs38.mkdirSync(path36.dirname(target), { recursive: true });
22968
+ fs38.writeFileSync(
22771
22969
  target,
22772
22970
  _jsonDumpsIndent2({ date: _today_utc_iso(), counts }),
22773
22971
  { encoding: "utf-8" }
@@ -23062,7 +23260,7 @@ function _pyJsonStringAscii(s) {
23062
23260
  return out + '"';
23063
23261
  }
23064
23262
  function _which(name) {
23065
- if (name.includes(path35.sep) || path35.sep !== "/" && name.includes("/")) {
23263
+ if (name.includes(path36.sep) || path36.sep !== "/" && name.includes("/")) {
23066
23264
  return _isExecutable(name) ? name : null;
23067
23265
  }
23068
23266
  const pathEnv = process.env.PATH ?? "";
@@ -23070,12 +23268,12 @@ function _which(name) {
23070
23268
  return null;
23071
23269
  }
23072
23270
  const exts = process.platform === "win32" ? (process.env.PATHEXT ?? ".COM;.EXE;.BAT;.CMD").split(";").filter(Boolean) : [""];
23073
- for (const dir of pathEnv.split(path35.delimiter)) {
23271
+ for (const dir of pathEnv.split(path36.delimiter)) {
23074
23272
  if (!dir) {
23075
23273
  continue;
23076
23274
  }
23077
23275
  for (const ext of exts) {
23078
- const candidate = path35.join(dir, name + ext);
23276
+ const candidate = path36.join(dir, name + ext);
23079
23277
  if (_isExecutable(candidate)) {
23080
23278
  return candidate;
23081
23279
  }
@@ -23085,7 +23283,7 @@ function _which(name) {
23085
23283
  }
23086
23284
  function _isExecutable(p) {
23087
23285
  try {
23088
- const st = fs37.statSync(p);
23286
+ const st = fs38.statSync(p);
23089
23287
  if (!st.isFile()) {
23090
23288
  return false;
23091
23289
  }
@@ -23112,7 +23310,7 @@ function _defaultStdin() {
23112
23310
  function ensure() {
23113
23311
  if (buffer === null) {
23114
23312
  try {
23115
- buffer = fs37.readFileSync(0, { encoding: "utf-8" });
23313
+ buffer = fs38.readFileSync(0, { encoding: "utf-8" });
23116
23314
  } catch {
23117
23315
  buffer = "";
23118
23316
  }
@@ -24359,9 +24557,9 @@ __export(config_exports, {
24359
24557
  resolve_api_key: () => resolve_api_key,
24360
24558
  resolve_config_path: () => resolve_config_path
24361
24559
  });
24362
- import * as fs38 from "node:fs";
24560
+ import * as fs39 from "node:fs";
24363
24561
  import * as os8 from "node:os";
24364
- import * as path36 from "node:path";
24562
+ import * as path37 from "node:path";
24365
24563
  function _pyReprStr(s) {
24366
24564
  const hasSingle = s.includes("'");
24367
24565
  const hasDouble = s.includes('"');
@@ -24532,7 +24730,7 @@ function _expanduser2(p) {
24532
24730
  return os8.homedir();
24533
24731
  }
24534
24732
  if (p.startsWith("~/") || process.platform === "win32" && p.startsWith("~\\")) {
24535
- return path36.join(os8.homedir(), p.slice(2));
24733
+ return path37.join(os8.homedir(), p.slice(2));
24536
24734
  }
24537
24735
  return p;
24538
24736
  }
@@ -24561,14 +24759,14 @@ function resolve_config_path(project_root, options = {}) {
24561
24759
  });
24562
24760
  }
24563
24761
  function load_council_config(p) {
24564
- if (!fs38.existsSync(p)) {
24762
+ if (!fs39.existsSync(p)) {
24565
24763
  throw new CouncilConfigError(
24566
24764
  `Council config not found at ${p}. Create it per docs/contracts/ai-council-config.md.`
24567
24765
  );
24568
24766
  }
24569
24767
  let raw;
24570
24768
  try {
24571
- const text = fs38.readFileSync(p, "utf-8");
24769
+ const text = fs39.readFileSync(p, "utf-8");
24572
24770
  const parsed = (0, import_yaml5.parse)(text, { version: "1.1" });
24573
24771
  raw = parsed === null || parsed === void 0 ? {} : parsed;
24574
24772
  } catch (exc) {
@@ -25539,16 +25737,16 @@ function resolve_api_key(ref, scope = "api_key_ref") {
25539
25737
  }
25540
25738
  resolved = found;
25541
25739
  }
25542
- if (!fs38.existsSync(resolved)) {
25740
+ if (!fs39.existsSync(resolved)) {
25543
25741
  throw new CouncilConfigError(`${scope}: key file does not exist at ${resolved}.`);
25544
25742
  }
25545
- const mode = fs38.statSync(resolved).mode & 4095;
25743
+ const mode = fs39.statSync(resolved).mode & 4095;
25546
25744
  if (mode !== 384) {
25547
25745
  throw new CouncilConfigError(
25548
25746
  `${scope}: unsafe permissions on ${resolved}: got ${_pyOct(mode)}, expected 0o600. Fix: chmod 600 ${resolved}`
25549
25747
  );
25550
25748
  }
25551
- const value = fs38.readFileSync(resolved, "utf-8").trim();
25749
+ const value = fs39.readFileSync(resolved, "utf-8").trim();
25552
25750
  if (value === "") {
25553
25751
  throw new CouncilConfigError(`${scope}: key file at ${resolved} is empty.`);
25554
25752
  }
@@ -25759,9 +25957,9 @@ var init_agentSwitchDetection = __esm({
25759
25957
 
25760
25958
  // src/scripts/_lib/environment_detector.ts
25761
25959
  import { spawnSync as spawnSync8 } from "node:child_process";
25762
- import * as fs39 from "node:fs";
25960
+ import * as fs40 from "node:fs";
25763
25961
  import * as os9 from "node:os";
25764
- import * as path37 from "node:path";
25962
+ import * as path38 from "node:path";
25765
25963
  function knownProviders() {
25766
25964
  return Object.keys(PROVIDER_CLI_META);
25767
25965
  }
@@ -25776,7 +25974,7 @@ function classifyBilling(provider, source) {
25776
25974
  function codexHome(env) {
25777
25975
  const map = env ?? process.env;
25778
25976
  const override = (map["CODEX_HOME"] ?? "").trim();
25779
- return override !== "" ? override : path37.join(homeOf(env), ".codex");
25977
+ return override !== "" ? override : path38.join(homeOf(env), ".codex");
25780
25978
  }
25781
25979
  function homeOf(env) {
25782
25980
  const map = env ?? process.env;
@@ -25800,14 +25998,14 @@ ${res.stderr ?? ""}`;
25800
25998
  }
25801
25999
  function isFile2(p) {
25802
26000
  try {
25803
- return fs39.statSync(p).isFile();
26001
+ return fs40.statSync(p).isFile();
25804
26002
  } catch {
25805
26003
  return false;
25806
26004
  }
25807
26005
  }
25808
26006
  function exists2(p) {
25809
26007
  try {
25810
- return fs39.existsSync(p);
26008
+ return fs40.existsSync(p);
25811
26009
  } catch {
25812
26010
  return false;
25813
26011
  }
@@ -25815,7 +26013,7 @@ function exists2(p) {
25815
26013
  function classifyCodexAuth(authPath) {
25816
26014
  let data;
25817
26015
  try {
25818
- data = JSON.parse(fs39.readFileSync(authPath, "utf-8"));
26016
+ data = JSON.parse(fs40.readFileSync(authPath, "utf-8"));
25819
26017
  } catch {
25820
26018
  return "cli-api-key";
25821
26019
  }
@@ -25832,18 +26030,18 @@ function cliSubscriptionEvidence(provider, home, env, claudeConfigDir) {
25832
26030
  if (provider === "anthropic") {
25833
26031
  const configDir = claudeConfigDir;
25834
26032
  for (const rel of [".credentials.json", "credentials.json"]) {
25835
- const p = path37.join(configDir, rel);
26033
+ const p = path38.join(configDir, rel);
25836
26034
  if (isFile2(p)) return { source: "cli-subscription", evidence: p };
25837
26035
  }
25838
26036
  return null;
25839
26037
  }
25840
26038
  if (provider === "openai") {
25841
- const p = path37.join(codexHome(env), "auth.json");
26039
+ const p = path38.join(codexHome(env), "auth.json");
25842
26040
  if (isFile2(p)) return { source: classifyCodexAuth(p), evidence: p };
25843
26041
  return null;
25844
26042
  }
25845
26043
  if (provider === "gemini") {
25846
- const p = path37.join(home, ".gemini", "oauth_creds.json");
26044
+ const p = path38.join(home, ".gemini", "oauth_creds.json");
25847
26045
  if (isFile2(p)) return { source: "cli-subscription", evidence: p };
25848
26046
  return null;
25849
26047
  }
@@ -25875,7 +26073,7 @@ function detectHosts(opts) {
25875
26073
  function detectAuth(opts) {
25876
26074
  const env = opts.env ?? process.env;
25877
26075
  const home = opts.home ?? homeOf(opts.env);
25878
- const claudeConfigDir = opts.home === void 0 && opts.env === void 0 ? claude_config_dir() : (env["CLAUDE_CONFIG_DIR"] ?? "").trim() || path37.join(home, ".claude");
26076
+ const claudeConfigDir = opts.home === void 0 && opts.env === void 0 ? claude_config_dir() : (env["CLAUDE_CONFIG_DIR"] ?? "").trim() || path38.join(home, ".claude");
25879
26077
  const auth = [];
25880
26078
  const keys = [];
25881
26079
  for (const provider of knownProviders()) {
@@ -26080,7 +26278,7 @@ var init_transport_resolver = __esm({
26080
26278
  });
26081
26279
 
26082
26280
  // src/scripts/_cli/detection_report.ts
26083
- import * as path38 from "node:path";
26281
+ import * as path39 from "node:path";
26084
26282
  function envRefResolves(ref, env) {
26085
26283
  if (ref === null || !ref.startsWith("env:")) return false;
26086
26284
  const name = ref.slice("env:".length).trim();
@@ -26155,7 +26353,7 @@ function cliBinaryPresent(environment, provider, binaryOverride) {
26155
26353
  const expected = PROVIDER_CLI_META[provider]?.[0];
26156
26354
  if (expected === void 0) return false;
26157
26355
  return environment.hosts.some(
26158
- (h) => h.binary !== null && stripExe(path38.basename(h.binary)) === expected
26356
+ (h) => h.binary !== null && stripExe(path39.basename(h.binary)) === expected
26159
26357
  );
26160
26358
  }
26161
26359
  function stripExe(name) {
@@ -26353,17 +26551,17 @@ var init_config2 = __esm({
26353
26551
 
26354
26552
  // src/scripts/ai_team/review_gate.ts
26355
26553
  import * as crypto5 from "node:crypto";
26356
- import * as fs40 from "node:fs";
26554
+ import * as fs41 from "node:fs";
26357
26555
  import * as os10 from "node:os";
26358
- import * as path39 from "node:path";
26556
+ import * as path40 from "node:path";
26359
26557
  function _workspace_state_segment(workspace_root) {
26360
26558
  let canonical = workspace_root;
26361
26559
  try {
26362
- canonical = fs40.realpathSync.native(workspace_root);
26560
+ canonical = fs41.realpathSync.native(workspace_root);
26363
26561
  } catch {
26364
26562
  canonical = workspace_root;
26365
26563
  }
26366
- const slug_source = path39.basename(workspace_root) || "workspace";
26564
+ const slug_source = path40.basename(workspace_root) || "workspace";
26367
26565
  const slug = slug_source.replace(/[^a-zA-Z0-9._-]+/g, "-").replace(/^-+|-+$/g, "") || "workspace";
26368
26566
  const hash = crypto5.createHash("sha256").update(canonical).digest("hex").slice(0, 16);
26369
26567
  return `${slug}-${hash}`;
@@ -26373,19 +26571,19 @@ function upstream_state_dir_candidates(workspace_root) {
26373
26571
  const candidates = [];
26374
26572
  const env = (process.env["CLAUDE_PLUGIN_DATA"] ?? "").trim();
26375
26573
  if (env !== "") {
26376
- candidates.push(path39.join(env, "state", segment));
26574
+ candidates.push(path40.join(env, "state", segment));
26377
26575
  }
26378
26576
  candidates.push(
26379
- path39.join(claude_config_dir(), "plugins", "data", _CODEX_PLUGIN_DATA_DIRNAME, "state", segment)
26577
+ path40.join(claude_config_dir(), "plugins", "data", _CODEX_PLUGIN_DATA_DIRNAME, "state", segment)
26380
26578
  );
26381
- candidates.push(path39.join(os10.tmpdir(), "codex-companion", segment));
26579
+ candidates.push(path40.join(os10.tmpdir(), "codex-companion", segment));
26382
26580
  return candidates;
26383
26581
  }
26384
26582
  function upstream_gate_enabled(workspace_root) {
26385
26583
  for (const dir of upstream_state_dir_candidates(workspace_root)) {
26386
26584
  let parsed;
26387
26585
  try {
26388
- parsed = JSON.parse(fs40.readFileSync(path39.join(dir, "state.json"), "utf-8"));
26586
+ parsed = JSON.parse(fs41.readFileSync(path40.join(dir, "state.json"), "utf-8"));
26389
26587
  } catch {
26390
26588
  continue;
26391
26589
  }
@@ -26438,7 +26636,7 @@ var init_review_gate = __esm({
26438
26636
  init_claude_plugin();
26439
26637
  init_state_io();
26440
26638
  init_config2();
26441
- GATE_LEDGER_RELPATH = path39.join("agents", "runtime", "team", "events.log");
26639
+ GATE_LEDGER_RELPATH = path40.join("agents", "runtime", "team", "events.log");
26442
26640
  _CODEX_PLUGIN_DATA_DIRNAME = `${CODEX_PLUGIN_ID}-${CODEX_MARKETPLACE_NAME}`;
26443
26641
  UPSTREAM_GATE_COST_WARNING = "The review gate can create a long-running Claude/Codex loop and may drain usage limits quickly.";
26444
26642
  }
@@ -26452,9 +26650,9 @@ var init_surface_tiers = __esm({
26452
26650
  });
26453
26651
 
26454
26652
  // src/scripts/_lib/scoped_projection.ts
26455
- import * as fs41 from "node:fs";
26653
+ import * as fs42 from "node:fs";
26456
26654
  import { createRequire as createRequire5 } from "node:module";
26457
- import * as path40 from "node:path";
26655
+ import * as path41 from "node:path";
26458
26656
  function isPlainObject2(v) {
26459
26657
  return typeof v === "object" && v !== null && !Array.isArray(v);
26460
26658
  }
@@ -26472,8 +26670,8 @@ function yamlSafeLoad(text) {
26472
26670
  }
26473
26671
  }
26474
26672
  function load_packs_registry(package_root) {
26475
- const vocab_path = path40.join(package_root, PACKS_YML_REL);
26476
- const data = yamlSafeLoad(fs41.readFileSync(vocab_path, "utf-8"));
26673
+ const vocab_path = path41.join(package_root, PACKS_YML_REL);
26674
+ const data = yamlSafeLoad(fs42.readFileSync(vocab_path, "utf-8"));
26477
26675
  if (!Array.isArray(data)) {
26478
26676
  throw new Error(`packs.yml did not parse to a list: ${vocab_path}`);
26479
26677
  }
@@ -26545,13 +26743,13 @@ var init_scoped_projection = __esm({
26545
26743
  "engineering",
26546
26744
  "agent-config-maintainer"
26547
26745
  ]);
26548
- PACKS_YML_REL = path40.join("src", "config", "discovery", "packs.yml");
26746
+ PACKS_YML_REL = path41.join("src", "config", "discovery", "packs.yml");
26549
26747
  RULE_PACKS_AUTO = "auto";
26550
26748
  }
26551
26749
  });
26552
26750
 
26553
26751
  // src/install/ruleInScope.ts
26554
- import * as fs42 from "node:fs";
26752
+ import * as fs43 from "node:fs";
26555
26753
  function parseYaml4(text) {
26556
26754
  try {
26557
26755
  const data = YAML4.parse(text, { version: "1.1" });
@@ -26589,7 +26787,7 @@ function rule_in_scope(source_path, scope, pack_scope = null, role_scope = null)
26589
26787
  if (scope === null && pack_scope === null && role_scope === null) {
26590
26788
  return true;
26591
26789
  }
26592
- const [meta] = parseFrontmatter(fs42.readFileSync(source_path, "utf-8"));
26790
+ const [meta] = parseFrontmatter(fs43.readFileSync(source_path, "utf-8"));
26593
26791
  if (meta["type"] === "always" || meta["alwaysApply"] === true) {
26594
26792
  return true;
26595
26793
  }
@@ -26614,8 +26812,8 @@ var init_ruleInScope = __esm({
26614
26812
  });
26615
26813
 
26616
26814
  // src/install/rule_scope.ts
26617
- import * as fs43 from "node:fs";
26618
- import * as path41 from "node:path";
26815
+ import * as fs44 from "node:fs";
26816
+ import * as path42 from "node:path";
26619
26817
  function _list(value) {
26620
26818
  if (Array.isArray(value) && value.length > 0) {
26621
26819
  return value.map((v) => String(v));
@@ -26647,7 +26845,7 @@ function ruleFileArrives(sourcePath, scope) {
26647
26845
  if (!sourcePath.endsWith(".md")) {
26648
26846
  return true;
26649
26847
  }
26650
- const basename18 = path41.basename(sourcePath);
26848
+ const basename18 = path42.basename(sourcePath);
26651
26849
  if (COMPAT_ALWAYS_EXCLUDED.includes(basename18)) {
26652
26850
  return false;
26653
26851
  }
@@ -26656,7 +26854,7 @@ function ruleFileArrives(sourcePath, scope) {
26656
26854
  function excludedRuleBasenames(rulesDir, scope) {
26657
26855
  let entries;
26658
26856
  try {
26659
- entries = fs43.readdirSync(rulesDir).sort();
26857
+ entries = fs44.readdirSync(rulesDir).sort();
26660
26858
  } catch {
26661
26859
  return [];
26662
26860
  }
@@ -26665,9 +26863,9 @@ function excludedRuleBasenames(rulesDir, scope) {
26665
26863
  if (!name.endsWith(".md")) {
26666
26864
  continue;
26667
26865
  }
26668
- const full = path41.join(rulesDir, name);
26866
+ const full = path42.join(rulesDir, name);
26669
26867
  try {
26670
- if (!fs43.statSync(full).isFile()) {
26868
+ if (!fs44.statSync(full).isFile()) {
26671
26869
  continue;
26672
26870
  }
26673
26871
  } catch {
@@ -26758,21 +26956,21 @@ __export(cmd_doctor_exports, {
26758
26956
  main: () => main15
26759
26957
  });
26760
26958
  import * as crypto6 from "node:crypto";
26761
- import * as fs44 from "node:fs";
26959
+ import * as fs45 from "node:fs";
26762
26960
  import * as os11 from "node:os";
26763
- import * as path42 from "node:path";
26961
+ import * as path43 from "node:path";
26764
26962
  import process15 from "node:process";
26765
26963
  import { fileURLToPath as fileURLToPath24, pathToFileURL as pathToFileURL15 } from "node:url";
26766
26964
  function expanduser5(p) {
26767
26965
  if (p === "~") return os11.homedir();
26768
26966
  if (p.startsWith("~/") || p.startsWith("~\\")) {
26769
- return path42.join(os11.homedir(), p.slice(2));
26967
+ return path43.join(os11.homedir(), p.slice(2));
26770
26968
  }
26771
26969
  return p;
26772
26970
  }
26773
26971
  function pathExists(p) {
26774
26972
  try {
26775
- fs44.statSync(p);
26973
+ fs45.statSync(p);
26776
26974
  return true;
26777
26975
  } catch {
26778
26976
  return false;
@@ -26780,27 +26978,27 @@ function pathExists(p) {
26780
26978
  }
26781
26979
  function isFile3(p) {
26782
26980
  try {
26783
- return fs44.statSync(p).isFile();
26981
+ return fs45.statSync(p).isFile();
26784
26982
  } catch {
26785
26983
  return false;
26786
26984
  }
26787
26985
  }
26788
26986
  function isDir2(p) {
26789
26987
  try {
26790
- return fs44.statSync(p).isDirectory();
26988
+ return fs45.statSync(p).isDirectory();
26791
26989
  } catch {
26792
26990
  return false;
26793
26991
  }
26794
26992
  }
26795
26993
  function resolvePath(p) {
26796
26994
  try {
26797
- return fs44.realpathSync(path42.resolve(p));
26995
+ return fs45.realpathSync(path43.resolve(p));
26798
26996
  } catch {
26799
- return path42.resolve(p);
26997
+ return path43.resolve(p);
26800
26998
  }
26801
26999
  }
26802
27000
  function readText2(p) {
26803
- return fs44.readFileSync(p, "utf-8");
27001
+ return fs45.readFileSync(p, "utf-8");
26804
27002
  }
26805
27003
  function _jsonStrAscii3(s) {
26806
27004
  let out = '"';
@@ -26907,7 +27105,7 @@ function _resolve_project_root(arg) {
26907
27105
  return resolve_project_root(arg);
26908
27106
  }
26909
27107
  function _detect_install_mode(project_root) {
26910
- const marker = path42.join(project_root, _INSTALL_MODE_MARKER_REL);
27108
+ const marker = path43.join(project_root, _INSTALL_MODE_MARKER_REL);
26911
27109
  if (isFile3(marker)) {
26912
27110
  let value;
26913
27111
  try {
@@ -26919,9 +27117,9 @@ function _detect_install_mode(project_root) {
26919
27117
  return [value, "marker-file"];
26920
27118
  }
26921
27119
  }
26922
- const has_agents_md = pathExists(path42.join(project_root, "AGENTS.md"));
27120
+ const has_agents_md = pathExists(path43.join(project_root, "AGENTS.md"));
26923
27121
  const has_copilot = pathExists(
26924
- path42.join(project_root, ".github", "copilot-instructions.md")
27122
+ path43.join(project_root, ".github", "copilot-instructions.md")
26925
27123
  );
26926
27124
  if (has_agents_md && has_copilot) {
26927
27125
  return ["full", "heuristic"];
@@ -26941,7 +27139,7 @@ function _settings_layer_chain(project_root) {
26941
27139
  return layers;
26942
27140
  }
26943
27141
  function _detect_wrapper(project_root) {
26944
- const wrapper = path42.join(project_root, "agent-config");
27142
+ const wrapper = path43.join(project_root, "agent-config");
26945
27143
  if (!pathExists(wrapper)) {
26946
27144
  return { path: String(wrapper), exists: false, embedded_root: null };
26947
27145
  }
@@ -27008,21 +27206,21 @@ function _emit_context_text(ctx) {
27008
27206
  }
27009
27207
  function _resolve_path(project_root, raw) {
27010
27208
  let p = expanduser5(raw);
27011
- if (!path42.isAbsolute(p)) {
27012
- p = path42.join(project_root, p);
27209
+ if (!path43.isAbsolute(p)) {
27210
+ p = path43.join(project_root, p);
27013
27211
  }
27014
27212
  return p;
27015
27213
  }
27016
27214
  function _sha256(p) {
27017
27215
  try {
27018
- const data = fs44.readFileSync(p);
27216
+ const data = fs45.readFileSync(p);
27019
27217
  return crypto6.createHash("sha256").update(data).digest("hex");
27020
27218
  } catch {
27021
27219
  return null;
27022
27220
  }
27023
27221
  }
27024
27222
  function _read_inline_package_tag(p) {
27025
- if (path42.extname(p) !== ".md") {
27223
+ if (path43.extname(p) !== ".md") {
27026
27224
  return NO_FRONTMATTER;
27027
27225
  }
27028
27226
  let text;
@@ -27151,13 +27349,13 @@ function rglob2(root) {
27151
27349
  const walk = (dir) => {
27152
27350
  let entries;
27153
27351
  try {
27154
- entries = fs44.readdirSync(dir, { withFileTypes: true });
27352
+ entries = fs45.readdirSync(dir, { withFileTypes: true });
27155
27353
  } catch {
27156
27354
  return;
27157
27355
  }
27158
27356
  entries.sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0);
27159
27357
  for (const ent of entries) {
27160
- const full = path42.join(dir, ent.name);
27358
+ const full = path43.join(dir, ent.name);
27161
27359
  out.push(full);
27162
27360
  let dirLike = ent.isDirectory();
27163
27361
  if (ent.isSymbolicLink()) {
@@ -27232,19 +27430,19 @@ function _foreign_records(project_root, foreign) {
27232
27430
  return out;
27233
27431
  }
27234
27432
  function relativeTo(p, base) {
27235
- const rel = path42.relative(base, p);
27433
+ const rel = path43.relative(base, p);
27236
27434
  if (rel === "") return rel;
27237
- if (rel.startsWith("..") || path42.isAbsolute(rel)) {
27435
+ if (rel.startsWith("..") || path43.isAbsolute(rel)) {
27238
27436
  return null;
27239
27437
  }
27240
27438
  return rel;
27241
27439
  }
27242
27440
  function _is_global_only_consumer(project_root) {
27243
- return isFile3(path42.join(project_root, INSTALL_MODE_MARKER_RELATIVE)) || isDir2(path42.join(project_root, "agents", "overrides"));
27441
+ return isFile3(path43.join(project_root, INSTALL_MODE_MARKER_RELATIVE)) || isDir2(path43.join(project_root, "agents", "overrides"));
27244
27442
  }
27245
27443
  function _check_scope(project_root) {
27246
27444
  for (const marker of ["pnpm-workspace.yaml", "lerna.json"]) {
27247
- if (pathExists(path42.join(project_root, marker))) {
27445
+ if (pathExists(path43.join(project_root, marker))) {
27248
27446
  return {
27249
27447
  id: "scope",
27250
27448
  status: "warn",
@@ -27253,7 +27451,7 @@ function _check_scope(project_root) {
27253
27451
  };
27254
27452
  }
27255
27453
  }
27256
- const pkg = path42.join(project_root, "package.json");
27454
+ const pkg = path43.join(project_root, "package.json");
27257
27455
  if (pathExists(pkg)) {
27258
27456
  try {
27259
27457
  const data = JSON.parse(readText2(pkg));
@@ -27276,26 +27474,8 @@ function _check_scope(project_root) {
27276
27474
  };
27277
27475
  }
27278
27476
  function _git_config_path(project_root) {
27279
- const gd = path42.join(project_root, ".git");
27280
- try {
27281
- const st = fs44.statSync(gd);
27282
- if (st.isDirectory()) {
27283
- return path42.join(gd, "config");
27284
- }
27285
- const m = readText2(gd).match(/^gitdir:\s*(.+)\s*$/m);
27286
- if (m === null) {
27287
- return null;
27288
- }
27289
- const gdPath = path42.resolve(project_root, m[1].trim());
27290
- const commondirFile = path42.join(gdPath, "commondir");
27291
- if (pathExists(commondirFile)) {
27292
- const common = path42.resolve(gdPath, readText2(commondirFile).trim());
27293
- return path42.join(common, "config");
27294
- }
27295
- return path42.join(gdPath, "config");
27296
- } catch {
27297
- return null;
27298
- }
27477
+ const common = git_common_dir(project_root);
27478
+ return common === null ? null : path43.join(common, "config");
27299
27479
  }
27300
27480
  function _parse_git_user(configText) {
27301
27481
  let inUser = false;
@@ -27325,7 +27505,7 @@ function _check_git_identity(project_root) {
27325
27505
  }
27326
27506
  let ident = _parse_git_user(readText2(cfgPath));
27327
27507
  if (ident.name === null && ident.email === null) {
27328
- const globalCfg = path42.join(os11.homedir(), ".gitconfig");
27508
+ const globalCfg = path43.join(os11.homedir(), ".gitconfig");
27329
27509
  if (pathExists(globalCfg)) {
27330
27510
  ident = _parse_git_user(readText2(globalCfg));
27331
27511
  }
@@ -27386,7 +27566,7 @@ function _package_root() {
27386
27566
  }
27387
27567
  function _current_package_version() {
27388
27568
  try {
27389
- const data = JSON.parse(readText2(path42.join(_package_root(), "package.json")));
27569
+ const data = JSON.parse(readText2(path43.join(_package_root(), "package.json")));
27390
27570
  const v = data["version"];
27391
27571
  if (typeof v === "string" && v.trim()) {
27392
27572
  return v.trim();
@@ -27430,7 +27610,7 @@ function _check_lockfile_freshness(manifest) {
27430
27610
  };
27431
27611
  }
27432
27612
  function shutilWhich(name) {
27433
- if (path42.dirname(name) !== "." && (name.includes("/") || name.includes("\\"))) {
27613
+ if (path43.dirname(name) !== "." && (name.includes("/") || name.includes("\\"))) {
27434
27614
  return isExecutableFile(name) ? name : null;
27435
27615
  }
27436
27616
  const pathEnv = process15.env["PATH"] || "";
@@ -27443,12 +27623,12 @@ function shutilWhich(name) {
27443
27623
  if (seenDirs.has(d)) continue;
27444
27624
  seenDirs.add(d);
27445
27625
  for (const ext of exts) {
27446
- const candidate = path42.join(d, name + (ext === "" ? "" : ext.toLowerCase() === ext ? ext : ext));
27626
+ const candidate = path43.join(d, name + (ext === "" ? "" : ext.toLowerCase() === ext ? ext : ext));
27447
27627
  if (isExecutableFile(candidate)) {
27448
27628
  return candidate;
27449
27629
  }
27450
27630
  if (ext !== "") {
27451
- const upper = path42.join(d, name + ext);
27631
+ const upper = path43.join(d, name + ext);
27452
27632
  if (isExecutableFile(upper)) return upper;
27453
27633
  }
27454
27634
  }
@@ -27457,10 +27637,10 @@ function shutilWhich(name) {
27457
27637
  }
27458
27638
  function isExecutableFile(p) {
27459
27639
  try {
27460
- const st = fs44.statSync(p);
27640
+ const st = fs45.statSync(p);
27461
27641
  if (!st.isFile()) return false;
27462
27642
  if (process15.platform === "win32") return true;
27463
- fs44.accessSync(p, fs44.constants.X_OK);
27643
+ fs45.accessSync(p, fs45.constants.X_OK);
27464
27644
  return true;
27465
27645
  } catch {
27466
27646
  return false;
@@ -27524,7 +27704,7 @@ function _check_claude_plugin() {
27524
27704
  remedy: ""
27525
27705
  };
27526
27706
  }
27527
- const projection = path42.join(os11.homedir(), ".claude", "skills");
27707
+ const projection = path43.join(os11.homedir(), ".claude", "skills");
27528
27708
  const projection_present = isDir2(projection);
27529
27709
  if (projection_present) {
27530
27710
  return {
@@ -27561,8 +27741,8 @@ function _check_claude_command_wrappers() {
27561
27741
  remedy: ""
27562
27742
  };
27563
27743
  }
27564
- const anchor = path42.join(os11.homedir(), ".claude");
27565
- const commands_dir = path42.join(anchor, "commands");
27744
+ const anchor = path43.join(os11.homedir(), ".claude");
27745
+ const commands_dir = path43.join(anchor, "commands");
27566
27746
  if (!isDir2(commands_dir)) {
27567
27747
  return {
27568
27748
  id: "claude-command-wrappers",
@@ -27571,8 +27751,8 @@ function _check_claude_command_wrappers() {
27571
27751
  remedy: ""
27572
27752
  };
27573
27753
  }
27574
- const flat_probe = fs44.existsSync(path42.join(commands_dir, "commit.md"));
27575
- const wrapper_probe = fs44.existsSync(path42.join(anchor, "skills", "commit", "SKILL.md"));
27754
+ const flat_probe = fs45.existsSync(path43.join(commands_dir, "commit.md"));
27755
+ const wrapper_probe = fs45.existsSync(path43.join(anchor, "skills", "commit", "SKILL.md"));
27576
27756
  if (wrapper_probe) {
27577
27757
  return {
27578
27758
  id: "claude-command-wrappers",
@@ -27597,7 +27777,7 @@ function _check_claude_command_wrappers() {
27597
27777
  };
27598
27778
  }
27599
27779
  function _check_surface_state() {
27600
- const matrix_path = path42.join(_package_root(), "src", "config", "surface-matrix.yml");
27780
+ const matrix_path = path43.join(_package_root(), "src", "config", "surface-matrix.yml");
27601
27781
  if (!isFile3(matrix_path)) {
27602
27782
  return {
27603
27783
  id: "surface-state",
@@ -27621,7 +27801,7 @@ function _check_surface_state() {
27621
27801
  remedy: "agent-config upgrade (reinstalls the package data files)"
27622
27802
  };
27623
27803
  }
27624
- const _expand = (p) => p.startsWith("~/") ? path42.join(os11.homedir(), p.slice(2)) : path42.join(_package_root(), p);
27804
+ const _expand = (p) => p.startsWith("~/") ? path43.join(os11.homedir(), p.slice(2)) : path43.join(_package_root(), p);
27625
27805
  const violations = [];
27626
27806
  const remedies = [];
27627
27807
  let checked = 0;
@@ -27663,7 +27843,7 @@ function _check_surface_state() {
27663
27843
  }
27664
27844
  function pathExistsAny(p) {
27665
27845
  try {
27666
- fs44.statSync(p);
27846
+ fs45.statSync(p);
27667
27847
  return true;
27668
27848
  } catch {
27669
27849
  return false;
@@ -27679,13 +27859,13 @@ function _check_hook_wiring() {
27679
27859
  remedy: ""
27680
27860
  };
27681
27861
  }
27682
- const settings_path = path42.join(os11.homedir(), ".claude", "settings.json");
27862
+ const settings_path = path43.join(os11.homedir(), ".claude", "settings.json");
27683
27863
  let missing;
27684
27864
  try {
27685
27865
  const matrix = build_claude_hook_matrix(
27686
- path42.join(_package_root(), "src", "scripts", "hook_manifest.yaml")
27866
+ path43.join(_package_root(), "src", "scripts", "hook_manifest.yaml")
27687
27867
  );
27688
- const settings = pathExists(settings_path) ? JSON.parse(fs44.readFileSync(settings_path, "utf8")) : {};
27868
+ const settings = pathExists(settings_path) ? JSON.parse(fs45.readFileSync(settings_path, "utf8")) : {};
27689
27869
  const hooks = (settings["hooks"] ?? {}) || {};
27690
27870
  missing = Object.keys(matrix).filter((ev) => {
27691
27871
  const groups = hooks[ev];
@@ -27760,7 +27940,7 @@ function _check_mcp_mode(project_root) {
27760
27940
  ];
27761
27941
  const found = [];
27762
27942
  for (const [rel, label] of candidates) {
27763
- const p = path42.join(project_root, rel);
27943
+ const p = path43.join(project_root, rel);
27764
27944
  if (!pathExists(p)) {
27765
27945
  continue;
27766
27946
  }
@@ -27792,7 +27972,7 @@ function _check_mcp_mode(project_root) {
27792
27972
  };
27793
27973
  }
27794
27974
  function _check_offline_readiness() {
27795
- const script = path42.join(_package_root(), "src", "scripts", "hermetic-install.sh");
27975
+ const script = path43.join(_package_root(), "src", "scripts", "hermetic-install.sh");
27796
27976
  if (!pathExists(script)) {
27797
27977
  return {
27798
27978
  id: "offline-readiness",
@@ -27850,7 +28030,7 @@ function _check_stale_orphans() {
27850
28030
  (a, b) => a < b ? -1 : a > b ? 1 : 0
27851
28031
  );
27852
28032
  for (const root_name of ownedSorted) {
27853
- const root = path42.join(anchor, root_name);
28033
+ const root = path43.join(anchor, root_name);
27854
28034
  if (!isDir2(root)) {
27855
28035
  continue;
27856
28036
  }
@@ -27865,7 +28045,7 @@ function _check_stale_orphans() {
27865
28045
  if (rel === null) {
27866
28046
  continue;
27867
28047
  }
27868
- const relPosix2 = rel.split(path42.sep).join("/");
28048
+ const relPosix2 = rel.split(path43.sep).join("/");
27869
28049
  if (recorded_set.has(relPosix2)) {
27870
28050
  continue;
27871
28051
  }
@@ -27914,14 +28094,14 @@ function _check_rule_scope_drift(project_root) {
27914
28094
  let rules_dir = null;
27915
28095
  let found = 0;
27916
28096
  for (const rel of _RULE_PROJECTION_DIRS) {
27917
- const cand = path42.join(project_root, rel);
28097
+ const cand = path43.join(project_root, rel);
27918
28098
  if (!isDir2(cand)) {
27919
28099
  continue;
27920
28100
  }
27921
28101
  let count = 0;
27922
28102
  try {
27923
- for (const name of fs44.readdirSync(cand)) {
27924
- if (name.endsWith(".md") && isFile3(path42.join(cand, name))) {
28103
+ for (const name of fs45.readdirSync(cand)) {
28104
+ if (name.endsWith(".md") && isFile3(path43.join(cand, name))) {
27925
28105
  count += 1;
27926
28106
  }
27927
28107
  }
@@ -27975,14 +28155,14 @@ function _check_rule_scope_drift(project_root) {
27975
28155
  };
27976
28156
  }
27977
28157
  function _check_duplicate_scope_rules(project_root, userRulesDirOverride) {
27978
- const user_rules_dir = userRulesDirOverride ?? path42.join(os11.homedir(), ".claude", "rules");
28158
+ const user_rules_dir = userRulesDirOverride ?? path43.join(os11.homedir(), ".claude", "rules");
27979
28159
  let project_rules_dir = null;
27980
28160
  if (_is_source_repo(project_root)) {
27981
- const cand = path42.join(project_root, "dist", "agent-src", "rules");
28161
+ const cand = path43.join(project_root, "dist", "agent-src", "rules");
27982
28162
  if (isDir2(cand)) project_rules_dir = cand;
27983
28163
  } else {
27984
28164
  for (const rel of _RULE_PROJECTION_DIRS) {
27985
- const cand = path42.join(project_root, rel);
28165
+ const cand = path43.join(project_root, rel);
27986
28166
  if (isDir2(cand)) {
27987
28167
  project_rules_dir = cand;
27988
28168
  break;
@@ -28051,7 +28231,7 @@ function _check_mcp_beta_readiness(project_root) {
28051
28231
  }
28052
28232
  const pending = [];
28053
28233
  for (const [gate_id, rel] of MCP_BETA_GATES) {
28054
- if (!pathExists(path42.join(project_root, rel))) {
28234
+ if (!pathExists(path43.join(project_root, rel))) {
28055
28235
  pending.push(`${gate_id} (${rel})`);
28056
28236
  }
28057
28237
  }
@@ -28072,7 +28252,7 @@ function _check_mcp_beta_readiness(project_root) {
28072
28252
  }
28073
28253
  function _check_tier_usage_readiness(project_root) {
28074
28254
  const settings_file = project_settings_path(project_root);
28075
- let log_path = path42.join(project_root, ".agent-tier-usage.jsonl");
28255
+ let log_path = path43.join(project_root, ".agent-tier-usage.jsonl");
28076
28256
  let enabled = false;
28077
28257
  if (isFile3(settings_file)) {
28078
28258
  let raw;
@@ -28091,7 +28271,7 @@ function _check_tier_usage_readiness(project_root) {
28091
28271
  const outputRaw = tu["output"];
28092
28272
  const output = typeof outputRaw === "object" && outputRaw !== null && !Array.isArray(outputRaw) ? outputRaw : {};
28093
28273
  if (typeof output["path"] === "string" && output["path"].trim()) {
28094
- log_path = path42.join(project_root, output["path"].trim());
28274
+ log_path = path43.join(project_root, output["path"].trim());
28095
28275
  }
28096
28276
  const val = tu["enabled"];
28097
28277
  if (typeof val === "boolean") {
@@ -28116,7 +28296,7 @@ function _check_tier_usage_readiness(project_root) {
28116
28296
  return {
28117
28297
  id: "tier-usage-readiness",
28118
28298
  status: "warn",
28119
- message: `tier-usage telemetry on but ${path42.basename(log_path)} not yet written \u2014 no signal accumulated`,
28299
+ message: `tier-usage telemetry on but ${path43.basename(log_path)} not yet written \u2014 no signal accumulated`,
28120
28300
  remedy: "run any tracked command to seed the log; the dispatcher writes one record per invocation"
28121
28301
  };
28122
28302
  }
@@ -28131,7 +28311,7 @@ function _check_tier_usage_readiness(project_root) {
28131
28311
  return {
28132
28312
  id: "tier-usage-readiness",
28133
28313
  status: "fail",
28134
- message: `cannot read ${path42.basename(log_path)}: ${osErrorStr2(exc)}`,
28314
+ message: `cannot read ${path43.basename(log_path)}: ${osErrorStr2(exc)}`,
28135
28315
  remedy: "fix permissions on the tier-usage log"
28136
28316
  };
28137
28317
  }
@@ -28162,7 +28342,7 @@ function _check_tier_usage_readiness(project_root) {
28162
28342
  return {
28163
28343
  id: "tier-usage-readiness",
28164
28344
  status: "fail",
28165
- message: `${total} record(s) in ${path42.basename(log_path)} but 0 passed the privacy floor \u2014 report would refuse to render`,
28345
+ message: `${total} record(s) in ${path43.basename(log_path)} but 0 passed the privacy floor \u2014 report would refuse to render`,
28166
28346
  remedy: "inspect the log; the dispatcher is writing records the contract forbids (paths, argv, message bodies)"
28167
28347
  };
28168
28348
  }
@@ -28170,19 +28350,19 @@ function _check_tier_usage_readiness(project_root) {
28170
28350
  return {
28171
28351
  id: "tier-usage-readiness",
28172
28352
  status: "warn",
28173
- message: `${path42.basename(log_path)} present but empty \u2014 no signal yet`,
28353
+ message: `${path43.basename(log_path)} present but empty \u2014 no signal yet`,
28174
28354
  remedy: "run any tracked command to seed the log"
28175
28355
  };
28176
28356
  }
28177
28357
  return {
28178
28358
  id: "tier-usage-readiness",
28179
28359
  status: "ok",
28180
- message: `${valid} record(s) past the privacy floor in ${path42.basename(log_path)} \u2014 retiering signal available`,
28360
+ message: `${valid} record(s) past the privacy floor in ${path43.basename(log_path)} \u2014 retiering signal available`,
28181
28361
  remedy: ""
28182
28362
  };
28183
28363
  }
28184
28364
  function readText0(p) {
28185
- return fs44.readFileSync(p, "utf-8");
28365
+ return fs45.readFileSync(p, "utf-8");
28186
28366
  }
28187
28367
  function osErrorStr2(exc) {
28188
28368
  if (exc && typeof exc === "object" && "message" in exc) {
@@ -28354,7 +28534,7 @@ function _epoch_seconds(value) {
28354
28534
  function _codex_auth_expiry(auth_path) {
28355
28535
  let data;
28356
28536
  try {
28357
- data = JSON.parse(fs44.readFileSync(auth_path, "utf-8"));
28537
+ data = JSON.parse(fs45.readFileSync(auth_path, "utf-8"));
28358
28538
  } catch {
28359
28539
  return null;
28360
28540
  }
@@ -28516,7 +28696,7 @@ function _check_team(project_root) {
28516
28696
  if (binary_resolved === null) {
28517
28697
  remedies.push("install the codex CLI: `npm install -g @openai/codex`");
28518
28698
  }
28519
- const auth_path = path42.join(_codex_home(), "auth.json");
28699
+ const auth_path = path43.join(_codex_home(), "auth.json");
28520
28700
  const authed = pathExists(auth_path);
28521
28701
  let auth_str;
28522
28702
  if (!authed) {
@@ -28596,7 +28776,7 @@ function _check_unsupported_combos(manifest) {
28596
28776
  };
28597
28777
  }
28598
28778
  function _wizard_state_path() {
28599
- return path42.join(event4u_root(), "state", "wizard-state.json");
28779
+ return path43.join(event4u_root(), "state", "wizard-state.json");
28600
28780
  }
28601
28781
  function _check_wizard_state() {
28602
28782
  const state_pth = _wizard_state_path();
@@ -28676,7 +28856,7 @@ function _check_wizard_state() {
28676
28856
  };
28677
28857
  }
28678
28858
  function _check_settings_review_pending() {
28679
- const delta_pth = path42.join(event4u_root(), "state", "settings-delta.json");
28859
+ const delta_pth = path43.join(event4u_root(), "state", "settings-delta.json");
28680
28860
  if (!pathExists(delta_pth)) {
28681
28861
  return {
28682
28862
  id: "settings-review-pending",
@@ -28702,7 +28882,7 @@ function _check_settings_review_pending() {
28702
28882
  }
28703
28883
  function _check_memory_merge_union(project_root) {
28704
28884
  const remedy = "run: npx tsx src/scripts/sync_gitattributes.ts (or `agent-config refresh --project`)";
28705
- const target = path42.join(project_root, DEFAULT_GITATTRIBUTES);
28885
+ const target = path43.join(project_root, DEFAULT_GITATTRIBUTES);
28706
28886
  if (!pathExists(target)) {
28707
28887
  return {
28708
28888
  id: "memory-merge-union",
@@ -29169,7 +29349,7 @@ function _run_repair(opts) {
29169
29349
  };
29170
29350
  if (exists3) {
29171
29351
  try {
29172
- fs44.unlinkSync(state_pth);
29352
+ fs45.unlinkSync(state_pth);
29173
29353
  } catch (exc) {
29174
29354
  payload["action"] = "error";
29175
29355
  payload["error"] = osErrorStr2(exc);
@@ -29264,13 +29444,13 @@ function _isCliEntry15() {
29264
29444
  if (process15.argv[1] === void 0) {
29265
29445
  return false;
29266
29446
  }
29267
- const argvUrl = pathToFileURL15(path42.resolve(process15.argv[1])).href;
29447
+ const argvUrl = pathToFileURL15(path43.resolve(process15.argv[1])).href;
29268
29448
  if (import.meta.url === argvUrl) {
29269
29449
  return true;
29270
29450
  }
29271
29451
  try {
29272
- const here = fs44.realpathSync(fileURLToPath24(import.meta.url));
29273
- const argv = fs44.realpathSync(path42.resolve(process15.argv[1]));
29452
+ const here = fs45.realpathSync(fileURLToPath24(import.meta.url));
29453
+ const argv = fs45.realpathSync(path43.resolve(process15.argv[1]));
29274
29454
  return here === argv;
29275
29455
  } catch {
29276
29456
  return false;
@@ -29289,6 +29469,7 @@ var init_cmd_doctor = __esm({
29289
29469
  init_user_global_paths();
29290
29470
  init_global_deploy_inventory();
29291
29471
  init_duplicate_scope_census();
29472
+ init_git_common_dir();
29292
29473
  init_sync_gitattributes();
29293
29474
  init_agent_settings();
29294
29475
  init_clients();
@@ -29478,9 +29659,9 @@ function detectToolPresence(root) {
29478
29659
  agentsMd: existsSync20(join40(root, "AGENTS.md"))
29479
29660
  };
29480
29661
  }
29481
- function isDir3(path51) {
29662
+ function isDir3(path52) {
29482
29663
  try {
29483
- return statSync28(path51).isDirectory();
29664
+ return statSync28(path52).isDirectory();
29484
29665
  } catch {
29485
29666
  return false;
29486
29667
  }
@@ -29542,9 +29723,9 @@ __export(cmd_conformance_exports, {
29542
29723
  routeTargetPaths: () => routeTargetPaths,
29543
29724
  runConformanceChecks: () => runConformanceChecks
29544
29725
  });
29545
- import * as fs45 from "node:fs";
29726
+ import * as fs46 from "node:fs";
29546
29727
  import * as os12 from "node:os";
29547
- import * as path43 from "node:path";
29728
+ import * as path44 from "node:path";
29548
29729
  import process16 from "node:process";
29549
29730
  import { spawnSync as spawnSync9 } from "node:child_process";
29550
29731
  import { fileURLToPath as fileURLToPath25, pathToFileURL as pathToFileURL16 } from "node:url";
@@ -29561,17 +29742,17 @@ function conformanceLogPath() {
29561
29742
  if (override && override.trim().length > 0) {
29562
29743
  return override;
29563
29744
  }
29564
- return path43.join(os12.homedir(), ".event4u", "agent-config", "conformance-log.jsonl");
29745
+ return path44.join(os12.homedir(), ".event4u", "agent-config", "conformance-log.jsonl");
29565
29746
  }
29566
29747
  function installLogPath() {
29567
29748
  const override = process16.env["AGENT_CONFIG_INSTALL_LOG"];
29568
29749
  if (override && override.trim().length > 0) {
29569
29750
  return override;
29570
29751
  }
29571
- return path43.join(os12.homedir(), ".event4u", "agent-config", "install-log.jsonl");
29752
+ return path44.join(os12.homedir(), ".event4u", "agent-config", "install-log.jsonl");
29572
29753
  }
29573
29754
  function _check_txlog_clean(logPath = installLogPath()) {
29574
- if (!fs45.existsSync(logPath)) {
29755
+ if (!fs46.existsSync(logPath)) {
29575
29756
  return {
29576
29757
  id: "txlog-clean",
29577
29758
  status: "ok",
@@ -29605,11 +29786,11 @@ function _check_txlog_clean(logPath = installLogPath()) {
29605
29786
  };
29606
29787
  }
29607
29788
  function routeTargetPaths(target) {
29608
- return routeTargetPathsPosix(target).map((rel) => path43.join(...rel.split("/")));
29789
+ return routeTargetPathsPosix(target).map((rel) => path44.join(...rel.split("/")));
29609
29790
  }
29610
29791
  function _check_router_pointers(packageRoot = PACKAGE_ROOT2) {
29611
- const routerPath = path43.join(packageRoot, "dist", "router.json");
29612
- if (!fs45.existsSync(routerPath)) {
29792
+ const routerPath = path44.join(packageRoot, "dist", "router.json");
29793
+ if (!fs46.existsSync(routerPath)) {
29613
29794
  return {
29614
29795
  id: "router-pointers",
29615
29796
  status: "fail",
@@ -29619,7 +29800,7 @@ function _check_router_pointers(packageRoot = PACKAGE_ROOT2) {
29619
29800
  }
29620
29801
  let router;
29621
29802
  try {
29622
- router = JSON.parse(fs45.readFileSync(routerPath, "utf8"));
29803
+ router = JSON.parse(fs46.readFileSync(routerPath, "utf8"));
29623
29804
  } catch (exc) {
29624
29805
  return {
29625
29806
  id: "router-pointers",
@@ -29628,13 +29809,13 @@ function _check_router_pointers(packageRoot = PACKAGE_ROOT2) {
29628
29809
  remedy: "reinstall the package \u2014 dist/router.json is corrupt"
29629
29810
  };
29630
29811
  }
29631
- const rulesDir = path43.join(packageRoot, "dist", "agent-src", "rules");
29812
+ const rulesDir = path44.join(packageRoot, "dist", "agent-src", "rules");
29632
29813
  const broken = [];
29633
29814
  let ids = 0;
29634
29815
  let targets = 0;
29635
29816
  for (const kernelId of router["kernel"] ?? []) {
29636
29817
  ids += 1;
29637
- if (!fs45.existsSync(path43.join(rulesDir, `${kernelId}.md`))) {
29818
+ if (!fs46.existsSync(path44.join(rulesDir, `${kernelId}.md`))) {
29638
29819
  broken.push(`kernel:${kernelId} \u2192 rules/${kernelId}.md missing`);
29639
29820
  }
29640
29821
  }
@@ -29642,7 +29823,7 @@ function _check_router_pointers(packageRoot = PACKAGE_ROOT2) {
29642
29823
  for (const entry of router[tier] ?? []) {
29643
29824
  const ruleId = String(entry["id"] ?? "");
29644
29825
  ids += 1;
29645
- if (!fs45.existsSync(path43.join(rulesDir, `${ruleId}.md`))) {
29826
+ if (!fs46.existsSync(path44.join(rulesDir, `${ruleId}.md`))) {
29646
29827
  broken.push(`${tier}:${ruleId} \u2192 rules/${ruleId}.md missing`);
29647
29828
  }
29648
29829
  for (const target of entry["routes_to"] ?? []) {
@@ -29652,7 +29833,7 @@ function _check_router_pointers(packageRoot = PACKAGE_ROOT2) {
29652
29833
  broken.push(`${ruleId} \u2192 unparseable routes_to ${JSON.stringify(target)}`);
29653
29834
  continue;
29654
29835
  }
29655
- if (!candidates.some((rel) => fs45.existsSync(path43.join(packageRoot, rel)))) {
29836
+ if (!candidates.some((rel) => fs46.existsSync(path44.join(packageRoot, rel)))) {
29656
29837
  broken.push(`${ruleId} \u2192 ${target} (${candidates[0]} missing)`);
29657
29838
  }
29658
29839
  }
@@ -29684,9 +29865,9 @@ function detectSmokePlatform(projectRoot) {
29684
29865
  return "claude";
29685
29866
  }
29686
29867
  function dispatcherRunner(packageRoot) {
29687
- const localTsx = path43.join(packageRoot, "node_modules", ".bin", "tsx");
29688
- const script = path43.join(packageRoot, "src", "scripts", "hooks", "dispatch_hook.ts");
29689
- if (fs45.existsSync(localTsx)) {
29868
+ const localTsx = path44.join(packageRoot, "node_modules", ".bin", "tsx");
29869
+ const script = path44.join(packageRoot, "src", "scripts", "hooks", "dispatch_hook.ts");
29870
+ if (fs46.existsSync(localTsx)) {
29690
29871
  return [localTsx, script];
29691
29872
  }
29692
29873
  return ["npx", "tsx", script];
@@ -29736,12 +29917,12 @@ function _check_hook_dispatcher(projectRoot, packageRoot = PACKAGE_ROOT2, opts =
29736
29917
  };
29737
29918
  }
29738
29919
  function readSettingsMode(projectRoot) {
29739
- const settingsPath = path43.join(projectRoot, ".agent-settings.yml");
29740
- if (!fs45.existsSync(settingsPath)) {
29920
+ const settingsPath = path44.join(projectRoot, ".agent-settings.yml");
29921
+ if (!fs46.existsSync(settingsPath)) {
29741
29922
  return "eager-all";
29742
29923
  }
29743
29924
  try {
29744
- const parsed = YAML6.parse(fs45.readFileSync(settingsPath, "utf8"));
29925
+ const parsed = YAML6.parse(fs46.readFileSync(settingsPath, "utf8"));
29745
29926
  const lean = parsed?.["lean_projection"] ?? null;
29746
29927
  const mode = lean?.["mode"];
29747
29928
  return typeof mode === "string" && mode.length > 0 ? mode : "eager-all";
@@ -29752,7 +29933,7 @@ function readSettingsMode(projectRoot) {
29752
29933
  function kernelIdsFromRouter(packageRoot) {
29753
29934
  try {
29754
29935
  const router = JSON.parse(
29755
- fs45.readFileSync(path43.join(packageRoot, "dist", "router.json"), "utf8")
29936
+ fs46.readFileSync(path44.join(packageRoot, "dist", "router.json"), "utf8")
29756
29937
  );
29757
29938
  return new Set((router["kernel"] ?? []).map(String));
29758
29939
  } catch {
@@ -29769,8 +29950,8 @@ function _check_lean_projection(projectRoot, packageRoot = PACKAGE_ROOT2, projec
29769
29950
  remedy: "set lean_projection.mode to 'eager-all' or 'thin' in .agent-settings.yml"
29770
29951
  };
29771
29952
  }
29772
- const rulesDir = projectedRulesDir ?? path43.join(projectRoot, ".augment", "rules");
29773
- if (!fs45.existsSync(rulesDir)) {
29953
+ const rulesDir = projectedRulesDir ?? path44.join(projectRoot, ".augment", "rules");
29954
+ if (!fs46.existsSync(rulesDir)) {
29774
29955
  return {
29775
29956
  id: "lean-projection",
29776
29957
  status: "skipped",
@@ -29779,7 +29960,7 @@ function _check_lean_projection(projectRoot, packageRoot = PACKAGE_ROOT2, projec
29779
29960
  };
29780
29961
  }
29781
29962
  const kernel = kernelIdsFromRouter(packageRoot);
29782
- const files = fs45.readdirSync(rulesDir).filter((f) => f.endsWith(".md") && f !== "INDEX.md").sort();
29963
+ const files = fs46.readdirSync(rulesDir).filter((f) => f.endsWith(".md") && f !== "INDEX.md").sort();
29783
29964
  const nonKernel = files.filter((f) => !kernel.has(f.replace(/\.md$/, "")));
29784
29965
  if (nonKernel.length === 0) {
29785
29966
  return {
@@ -29793,7 +29974,7 @@ function _check_lean_projection(projectRoot, packageRoot = PACKAGE_ROOT2, projec
29793
29974
  for (const f of nonKernel) {
29794
29975
  let text = "";
29795
29976
  try {
29796
- text = fs45.readFileSync(path43.join(rulesDir, f), "utf8");
29977
+ text = fs46.readFileSync(path44.join(rulesDir, f), "utf8");
29797
29978
  } catch {
29798
29979
  continue;
29799
29980
  }
@@ -29824,8 +30005,8 @@ function _check_lean_projection(projectRoot, packageRoot = PACKAGE_ROOT2, projec
29824
30005
  function _check_host_manifest(projectRoot) {
29825
30006
  const detected = Object.entries(detectToolPresence(projectRoot)).filter(([, v]) => v === true).map(([k]) => k);
29826
30007
  const detectedNote = detected.length > 0 ? `detected surfaces: ${detected.join(", ")}` : "no surfaces detected";
29827
- const settingsPath = path43.join(projectRoot, ".agent-settings.yml");
29828
- if (!fs45.existsSync(settingsPath)) {
30008
+ const settingsPath = path44.join(projectRoot, ".agent-settings.yml");
30009
+ if (!fs46.existsSync(settingsPath)) {
29829
30010
  return {
29830
30011
  id: "host-manifest",
29831
30012
  status: "ok",
@@ -29835,7 +30016,7 @@ function _check_host_manifest(projectRoot) {
29835
30016
  }
29836
30017
  let parsed = null;
29837
30018
  try {
29838
- parsed = YAML6.parse(fs45.readFileSync(settingsPath, "utf8"));
30019
+ parsed = YAML6.parse(fs46.readFileSync(settingsPath, "utf8"));
29839
30020
  } catch (exc) {
29840
30021
  return {
29841
30022
  id: "host-manifest",
@@ -30032,13 +30213,13 @@ function _isCliEntry16() {
30032
30213
  if (process16.argv[1] === void 0) {
30033
30214
  return false;
30034
30215
  }
30035
- const argvUrl = pathToFileURL16(path43.resolve(process16.argv[1])).href;
30216
+ const argvUrl = pathToFileURL16(path44.resolve(process16.argv[1])).href;
30036
30217
  if (import.meta.url === argvUrl) {
30037
30218
  return true;
30038
30219
  }
30039
30220
  try {
30040
- const here = fs45.realpathSync(fileURLToPath25(import.meta.url));
30041
- const argv = fs45.realpathSync(path43.resolve(process16.argv[1]));
30221
+ const here = fs46.realpathSync(fileURLToPath25(import.meta.url));
30222
+ const argv = fs46.realpathSync(path44.resolve(process16.argv[1]));
30042
30223
  return here === argv;
30043
30224
  } catch {
30044
30225
  return false;
@@ -30102,7 +30283,7 @@ __export(settings_exports, {
30102
30283
  read_tier_usage_settings: () => read_tier_usage_settings
30103
30284
  });
30104
30285
  import { createRequire as createRequire6 } from "node:module";
30105
- import * as fs46 from "node:fs";
30286
+ import * as fs47 from "node:fs";
30106
30287
  function _isPlainObject8(v) {
30107
30288
  return typeof v === "object" && v !== null && !Array.isArray(v) && !(v instanceof Date);
30108
30289
  }
@@ -30139,7 +30320,7 @@ function _coerce_path(value, def) {
30139
30320
  }
30140
30321
  function _isFile13(p) {
30141
30322
  try {
30142
- return fs46.statSync(p).isFile();
30323
+ return fs47.statSync(p).isFile();
30143
30324
  } catch {
30144
30325
  return false;
30145
30326
  }
@@ -30150,7 +30331,7 @@ function read_settings(p) {
30150
30331
  if (_isFile13(p)) {
30151
30332
  let raw = {};
30152
30333
  try {
30153
- raw = YAML7.parse(fs46.readFileSync(p, "utf-8"), { version: "1.1" });
30334
+ raw = YAML7.parse(fs47.readFileSync(p, "utf-8"), { version: "1.1" });
30154
30335
  if (raw === null || raw === void 0) {
30155
30336
  raw = {};
30156
30337
  }
@@ -30184,7 +30365,7 @@ function read_tier_usage_settings(p) {
30184
30365
  if (_isFile13(p)) {
30185
30366
  let raw = {};
30186
30367
  try {
30187
- raw = YAML7.parse(fs46.readFileSync(p, "utf-8"), { version: "1.1" });
30368
+ raw = YAML7.parse(fs47.readFileSync(p, "utf-8"), { version: "1.1" });
30188
30369
  if (raw === null || raw === void 0) {
30189
30370
  raw = {};
30190
30371
  }
@@ -30722,7 +30903,7 @@ __export(aggregator_exports, {
30722
30903
  aggregate: () => aggregate2,
30723
30904
  rank_artefacts: () => rank_artefacts
30724
30905
  });
30725
- import * as fs47 from "node:fs";
30906
+ import * as fs48 from "node:fs";
30726
30907
  function _key(kind, artId) {
30727
30908
  return `${kind}\0${artId}`;
30728
30909
  }
@@ -30759,7 +30940,7 @@ function* _iter_events(log_path) {
30759
30940
  if (!_isFile14(log_path)) {
30760
30941
  return;
30761
30942
  }
30762
- const text = fs47.readFileSync(log_path, "utf-8");
30943
+ const text = fs48.readFileSync(log_path, "utf-8");
30763
30944
  const lines = _pyFileLines(text);
30764
30945
  let lineNo = 0;
30765
30946
  for (const line of lines) {
@@ -30793,7 +30974,7 @@ function _pyFileLines(text) {
30793
30974
  }
30794
30975
  function _isFile14(p) {
30795
30976
  try {
30796
- return fs47.statSync(p).isFile();
30977
+ return fs48.statSync(p).isFile();
30797
30978
  } catch {
30798
30979
  return false;
30799
30980
  }
@@ -31307,7 +31488,7 @@ var init_report_renderer = __esm({
31307
31488
  });
31308
31489
 
31309
31490
  // src/scripts/ai_council/bundler.ts
31310
- import * as fs48 from "node:fs";
31491
+ import * as fs49 from "node:fs";
31311
31492
  function _context(mode, text, manifest = [], excluded = []) {
31312
31493
  return { mode, text, manifest, excluded };
31313
31494
  }
@@ -31365,10 +31546,10 @@ function bundle_prompt(text) {
31365
31546
  return _context("prompt", _enforceSize(redacted, "prompt"), ["<inline prompt>"]);
31366
31547
  }
31367
31548
  function bundle_roadmap(p) {
31368
- if (!fs48.existsSync(p)) {
31549
+ if (!fs49.existsSync(p)) {
31369
31550
  throw new FileNotFoundError2(`Roadmap not found: ${p}`);
31370
31551
  }
31371
- const raw = fs48.readFileSync(p, { encoding: "utf-8" });
31552
+ const raw = fs49.readFileSync(p, { encoding: "utf-8" });
31372
31553
  const redacted = redact(raw);
31373
31554
  return _context(
31374
31555
  "roadmap",
@@ -31931,8 +32112,8 @@ not. Cite the peer-reviewer label and the targeted response label
31931
32112
  });
31932
32113
 
31933
32114
  // src/scripts/ai_council/advisors.ts
31934
- import * as fs49 from "node:fs";
31935
- import * as path44 from "node:path";
32115
+ import * as fs50 from "node:fs";
32116
+ import * as path45 from "node:path";
31936
32117
  function _split_frontmatter(raw) {
31937
32118
  const match = _FRONTMATTER_RE2.exec(raw);
31938
32119
  if (!match) {
@@ -31960,12 +32141,12 @@ function _display_name_from(advisor_name, frontmatter) {
31960
32141
  }
31961
32142
  function resolve_persona_text(persona_path, repo_root) {
31962
32143
  const candidates = [
31963
- path44.join(repo_root, "dist/agent-src", persona_path),
31964
- path44.join(repo_root, ".agent-src.uncondensed", persona_path)
32144
+ path45.join(repo_root, "dist/agent-src", persona_path),
32145
+ path45.join(repo_root, ".agent-src.uncondensed", persona_path)
31965
32146
  ];
31966
32147
  for (const candidate of candidates) {
31967
- if (fs49.existsSync(candidate)) {
31968
- const raw = fs49.readFileSync(candidate, "utf-8");
32148
+ if (fs50.existsSync(candidate)) {
32149
+ const raw = fs50.readFileSync(candidate, "utf-8");
31969
32150
  const [meta, body] = _split_frontmatter(raw);
31970
32151
  return [body.trim(), meta];
31971
32152
  }
@@ -32375,7 +32556,7 @@ __export(low_impact_corpus_exports, {
32375
32556
  load_validated_phrases: () => load_validated_phrases,
32376
32557
  parse_corpus_strict: () => parse_corpus_strict
32377
32558
  });
32378
- import * as fs50 from "node:fs";
32559
+ import * as fs51 from "node:fs";
32379
32560
  function _entry(phrase, normalised, section, line_no, trailing_metadata = "") {
32380
32561
  return { phrase, normalised, section, line_no, trailing_metadata };
32381
32562
  }
@@ -32548,10 +32729,10 @@ function _checkHeadingDrift(text, title) {
32548
32729
  }
32549
32730
  function parse_corpus_strict(corpusPath) {
32550
32731
  const p = corpusPath;
32551
- if (!fs50.existsSync(p)) {
32732
+ if (!fs51.existsSync(p)) {
32552
32733
  return new CorpusParseResult();
32553
32734
  }
32554
- const text = fs50.readFileSync(p, { encoding: "utf-8" });
32735
+ const text = fs51.readFileSync(p, { encoding: "utf-8" });
32555
32736
  const allTitles = _SECTION_KEYS.map((k) => _SECTION_TITLES[k]);
32556
32737
  const resultSections = {
32557
32738
  validated: [],
@@ -32614,10 +32795,10 @@ function load_anti_example_phrases(corpusPath) {
32614
32795
  }
32615
32796
  function load_corpus_lock(yamlPath) {
32616
32797
  const p = yamlPath;
32617
- if (!fs50.existsSync(p)) {
32798
+ if (!fs51.existsSync(p)) {
32618
32799
  return new CorpusParseResult();
32619
32800
  }
32620
- const parsed = (0, import_yaml7.parse)(fs50.readFileSync(p, { encoding: "utf-8" }), { version: "1.1" });
32801
+ const parsed = (0, import_yaml7.parse)(fs51.readFileSync(p, { encoding: "utf-8" }), { version: "1.1" });
32621
32802
  const doc = parsed === null || parsed === void 0 ? {} : parsed;
32622
32803
  const schemaVersion = doc["schema_version"];
32623
32804
  if (schemaVersion !== 1) {
@@ -32679,7 +32860,7 @@ function _deriveLockPath(corpusPath) {
32679
32860
  }
32680
32861
  function _loadSectionFromLock(corpusPath, section) {
32681
32862
  const lockPath = _deriveLockPath(corpusPath);
32682
- if (!fs50.existsSync(lockPath)) {
32863
+ if (!fs51.existsSync(lockPath)) {
32683
32864
  return null;
32684
32865
  }
32685
32866
  try {
@@ -32691,10 +32872,10 @@ function _loadSectionFromLock(corpusPath, section) {
32691
32872
  }
32692
32873
  function _loadSectionLenient(corpusPath, section) {
32693
32874
  const p = corpusPath;
32694
- if (!fs50.existsSync(p)) {
32875
+ if (!fs51.existsSync(p)) {
32695
32876
  return [];
32696
32877
  }
32697
- const text = fs50.readFileSync(p, { encoding: "utf-8" });
32878
+ const text = fs51.readFileSync(p, { encoding: "utf-8" });
32698
32879
  const allTitles = _SECTION_KEYS.map((k) => _SECTION_TITLES[k]);
32699
32880
  const bounds = _sectionBounds(text, _SECTION_TITLES[section], allTitles);
32700
32881
  if (bounds === null) {
@@ -33474,8 +33655,8 @@ var init_necessity = __esm({
33474
33655
  });
33475
33656
 
33476
33657
  // src/scripts/ai_council/budget_guard.ts
33477
- import * as fs51 from "node:fs";
33478
- import * as path45 from "node:path";
33658
+ import * as fs52 from "node:fs";
33659
+ import * as path46 from "node:path";
33479
33660
  function _resolveLedgerPath(p) {
33480
33661
  if (p !== null) {
33481
33662
  return p;
@@ -33490,18 +33671,18 @@ function _nowUtcMs() {
33490
33671
  return Date.now();
33491
33672
  }
33492
33673
  function _ensureLedgerDir(p) {
33493
- const parent = path45.dirname(p);
33674
+ const parent = path46.dirname(p);
33494
33675
  try {
33495
- fs51.mkdirSync(parent, { recursive: true });
33676
+ fs52.mkdirSync(parent, { recursive: true });
33496
33677
  let mode;
33497
33678
  try {
33498
- mode = fs51.statSync(parent).mode & 511;
33679
+ mode = fs52.statSync(parent).mode & 511;
33499
33680
  } catch {
33500
33681
  mode = 448;
33501
33682
  }
33502
33683
  if (mode !== 448) {
33503
33684
  try {
33504
- fs51.chmodSync(parent, 448);
33685
+ fs52.chmodSync(parent, 448);
33505
33686
  } catch {
33506
33687
  }
33507
33688
  }
@@ -33513,18 +33694,18 @@ function _ensureLedgerDir(p) {
33513
33694
  }
33514
33695
  }
33515
33696
  function _ensureLedgerFileMode(p) {
33516
- if (!fs51.existsSync(p)) {
33697
+ if (!fs52.existsSync(p)) {
33517
33698
  return;
33518
33699
  }
33519
33700
  let current;
33520
33701
  try {
33521
- current = fs51.statSync(p).mode & 511;
33702
+ current = fs52.statSync(p).mode & 511;
33522
33703
  } catch {
33523
33704
  return;
33524
33705
  }
33525
33706
  if (current !== 384) {
33526
33707
  try {
33527
- fs51.chmodSync(p, 384);
33708
+ fs52.chmodSync(p, 384);
33528
33709
  } catch {
33529
33710
  }
33530
33711
  }
@@ -33676,11 +33857,11 @@ function pyNumToStr(n) {
33676
33857
  }
33677
33858
  function read_entries2(p = null) {
33678
33859
  const resolved = _resolveLedgerPath(p);
33679
- if (!fs51.existsSync(resolved)) {
33860
+ if (!fs52.existsSync(resolved)) {
33680
33861
  return [];
33681
33862
  }
33682
33863
  const out = [];
33683
- const text = fs51.readFileSync(resolved, "utf-8");
33864
+ const text = fs52.readFileSync(resolved, "utf-8");
33684
33865
  for (const rawLine of text.split(/\r\n|\r|\n/u)) {
33685
33866
  const line = rawLine.trim();
33686
33867
  if (line === "") {
@@ -33783,7 +33964,7 @@ function record_spend(usd, provider, model, options = {}) {
33783
33964
  )}
33784
33965
  `;
33785
33966
  try {
33786
- fs51.appendFileSync(p, entry, { encoding: "utf-8" });
33967
+ fs52.appendFileSync(p, entry, { encoding: "utf-8" });
33787
33968
  } catch (exc) {
33788
33969
  process.stderr.write(`[council:budget_guard] write failed: ${_errStr(exc)}
33789
33970
  `);
@@ -33906,8 +34087,8 @@ function aggregate_scores(findings, scores) {
33906
34087
  by_id.get(s.finding_id).push(s);
33907
34088
  }
33908
34089
  const out = /* @__PURE__ */ new Map();
33909
- for (const [fid, fs57] of by_id) {
33910
- if (fs57.length === 0) {
34090
+ for (const [fid, fs58] of by_id) {
34091
+ if (fs58.length === 0) {
33911
34092
  out.set(
33912
34093
  fid,
33913
34094
  new ConsensusMetadata({
@@ -33923,13 +34104,13 @@ function aggregate_scores(findings, scores) {
33923
34104
  );
33924
34105
  continue;
33925
34106
  }
33926
- const mean = fs57.reduce((acc, s) => acc + s.score, 0) / fs57.length;
33927
- const agree_rate = fs57.filter((s) => s.agree).length / fs57.length;
34107
+ const mean = fs58.reduce((acc, s) => acc + s.score, 0) / fs58.length;
34108
+ const agree_rate = fs58.filter((s) => s.agree).length / fs58.length;
33928
34109
  const strength = mean / 10 * agree_rate;
33929
- const dissent = fs57.filter((s) => !s.agree).length;
33930
- const concur = fs57.filter((s) => s.agree).length;
33931
- const scorers = fs57.map((s) => s.scorer);
33932
- const dissent_reasons = fs57.filter((s) => !s.agree).map((s) => [s.scorer, s.reason]);
34110
+ const dissent = fs58.filter((s) => !s.agree).length;
34111
+ const concur = fs58.filter((s) => s.agree).length;
34112
+ const scorers = fs58.map((s) => s.scorer);
34113
+ const dissent_reasons = fs58.filter((s) => !s.agree).map((s) => [s.scorer, s.reason]);
33933
34114
  const mean_rounded = pyRound(mean, 2);
33934
34115
  out.set(
33935
34116
  fid,
@@ -34310,11 +34491,11 @@ __export(pricing_exports, {
34310
34491
  prices_file_for: () => prices_file_for,
34311
34492
  reprice_with_cache: () => reprice_with_cache
34312
34493
  });
34313
- import * as fs52 from "node:fs";
34314
- import * as path46 from "node:path";
34494
+ import * as fs53 from "node:fs";
34495
+ import * as path47 from "node:path";
34315
34496
  import { fileURLToPath as fileURLToPath26 } from "node:url";
34316
34497
  function prices_file_for(repo_root) {
34317
- return path46.join(repo_root, "agents", "runtime", ".agent-prices.md");
34498
+ return path47.join(repo_root, "agents", "runtime", ".agent-prices.md");
34318
34499
  }
34319
34500
  function lookup(table, provider, model) {
34320
34501
  return table.prices.get(priceKey(provider, model)) ?? null;
@@ -34408,16 +34589,16 @@ function is_stale(table, now) {
34408
34589
  return last < last_monday_utc(now);
34409
34590
  }
34410
34591
  function load_prices(p = PRICES_FILE) {
34411
- if (!fs52.existsSync(p)) {
34592
+ if (!fs53.existsSync(p)) {
34412
34593
  bootstrap_from_defaults(p);
34413
34594
  }
34414
- return _parse4(fs52.readFileSync(p, "utf-8"));
34595
+ return _parse4(fs53.readFileSync(p, "utf-8"));
34415
34596
  }
34416
34597
  function bootstrap_from_defaults(p = PRICES_FILE) {
34417
- fs52.mkdirSync(path46.dirname(p), { recursive: true });
34598
+ fs53.mkdirSync(path47.dirname(p), { recursive: true });
34418
34599
  const rows = as_rows();
34419
34600
  const body = _render_markdown(LAST_UPDATED, "shipped-default", rows);
34420
- fs52.writeFileSync(p, body, "utf-8");
34601
+ fs53.writeFileSync(p, body, "utf-8");
34421
34602
  }
34422
34603
  function _fmt62f(x) {
34423
34604
  const s = x.toFixed(2);
@@ -34540,8 +34721,8 @@ var init_pricing = __esm({
34540
34721
  "use strict";
34541
34722
  init_default_prices();
34542
34723
  _HERE14 = fileURLToPath26(import.meta.url);
34543
- REPO_ROOT2 = path46.resolve(path46.dirname(_HERE14), "..", "..", "..");
34544
- PRICES_FILE = path46.join(REPO_ROOT2, "agents", "runtime", ".agent-prices.md");
34724
+ REPO_ROOT2 = path47.resolve(path47.dirname(_HERE14), "..", "..", "..");
34725
+ PRICES_FILE = path47.join(REPO_ROOT2, "agents", "runtime", ".agent-prices.md");
34545
34726
  _CHARS_PER_TOKEN = 4;
34546
34727
  CACHE_READ_MULTIPLIER = 0.1;
34547
34728
  CACHE_WRITE_MULTIPLIER_5M = 1.25;
@@ -36081,18 +36262,18 @@ __export(project_context_exports, {
36081
36262
  REPO_PURPOSE_MAX_CHARS: () => REPO_PURPOSE_MAX_CHARS,
36082
36263
  detect_project_context: () => detect_project_context
36083
36264
  });
36084
- import * as fs53 from "node:fs";
36085
- import * as path47 from "node:path";
36265
+ import * as fs54 from "node:fs";
36266
+ import * as path48 from "node:path";
36086
36267
  function _isPlainObject11(v) {
36087
36268
  return typeof v === "object" && v !== null && !Array.isArray(v);
36088
36269
  }
36089
36270
  function _read_json(p) {
36090
- if (!fs53.existsSync(p)) {
36271
+ if (!fs54.existsSync(p)) {
36091
36272
  return null;
36092
36273
  }
36093
36274
  let raw;
36094
36275
  try {
36095
- raw = fs53.readFileSync(p, "utf-8");
36276
+ raw = fs54.readFileSync(p, "utf-8");
36096
36277
  } catch {
36097
36278
  return null;
36098
36279
  }
@@ -36114,7 +36295,7 @@ function _name_from(composer, pkg, root) {
36114
36295
  }
36115
36296
  }
36116
36297
  try {
36117
- const base = path47.basename(root);
36298
+ const base = path48.basename(root);
36118
36299
  return base || null;
36119
36300
  } catch {
36120
36301
  return null;
@@ -36183,12 +36364,12 @@ function _splitlines10(text) {
36183
36364
  return parts;
36184
36365
  }
36185
36366
  function _purpose_from_readme(p) {
36186
- if (!fs53.existsSync(p)) {
36367
+ if (!fs54.existsSync(p)) {
36187
36368
  return null;
36188
36369
  }
36189
36370
  let text;
36190
36371
  try {
36191
- text = fs53.readFileSync(p, "utf-8");
36372
+ text = fs54.readFileSync(p, "utf-8");
36192
36373
  } catch {
36193
36374
  return null;
36194
36375
  }
@@ -36272,13 +36453,13 @@ function _rfind(haystack, needle) {
36272
36453
  return -1;
36273
36454
  }
36274
36455
  function detect_project_context(root) {
36275
- const resolvedRoot = path47.resolve(root ?? process.cwd());
36276
- const composer = _read_json(path47.join(resolvedRoot, "composer.json"));
36277
- const pkg = _read_json(path47.join(resolvedRoot, "package.json"));
36456
+ const resolvedRoot = path48.resolve(root ?? process.cwd());
36457
+ const composer = _read_json(path48.join(resolvedRoot, "composer.json"));
36458
+ const pkg = _read_json(path48.join(resolvedRoot, "package.json"));
36278
36459
  return new ProjectContext(
36279
36460
  _name_from(composer, pkg, resolvedRoot),
36280
36461
  _stack_from(composer, pkg),
36281
- _purpose_from_readme(path47.join(resolvedRoot, "README.md"))
36462
+ _purpose_from_readme(path48.join(resolvedRoot, "README.md"))
36282
36463
  );
36283
36464
  }
36284
36465
  var REPO_PURPOSE_MAX_CHARS, _HEADING_RE, _BADGE_RE, _HTML_RE, ProjectContext;
@@ -36548,7 +36729,7 @@ __export(shadow_dispatch_exports, {
36548
36729
  slo_banner: () => slo_banner,
36549
36730
  slo_status: () => slo_status
36550
36731
  });
36551
- import * as fs54 from "node:fs";
36732
+ import * as fs55 from "node:fs";
36552
36733
  import { createHash as createHash9 } from "node:crypto";
36553
36734
  function should_shadow(sampleRate, opts = {}) {
36554
36735
  const rate = Math.max(0, Math.min(1, sampleRate));
@@ -36586,7 +36767,7 @@ function record_shadow_decision(logPath, opts) {
36586
36767
  escalated,
36587
36768
  escalation_reason: escalationReason
36588
36769
  };
36589
- fs54.mkdirSync(_dirname2(logPath), { recursive: true });
36770
+ fs55.mkdirSync(_dirname2(logPath), { recursive: true });
36590
36771
  const row = _pyJsonDumps2({
36591
36772
  timestamp: decision.timestamp,
36592
36773
  query_hash: decision.query_hash,
@@ -36596,7 +36777,7 @@ function record_shadow_decision(logPath, opts) {
36596
36777
  escalated: decision.escalated,
36597
36778
  escalation_reason: decision.escalation_reason
36598
36779
  }) + "\n";
36599
- fs54.appendFileSync(logPath, row, { encoding: "utf-8" });
36780
+ fs55.appendFileSync(logPath, row, { encoding: "utf-8" });
36600
36781
  return decision;
36601
36782
  }
36602
36783
  function _isoNowSeconds() {
@@ -36605,10 +36786,10 @@ function _isoNowSeconds() {
36605
36786
  return `${pad(d.getUTCFullYear(), 4)}-${pad(d.getUTCMonth() + 1)}-${pad(d.getUTCDate())}T${pad(d.getUTCHours())}:${pad(d.getUTCMinutes())}:${pad(d.getUTCSeconds())}+00:00`;
36606
36787
  }
36607
36788
  function* _iterLog(logPath) {
36608
- if (!fs54.existsSync(logPath)) {
36789
+ if (!fs55.existsSync(logPath)) {
36609
36790
  return;
36610
36791
  }
36611
- const content = fs54.readFileSync(logPath, { encoding: "utf-8" });
36792
+ const content = fs55.readFileSync(logPath, { encoding: "utf-8" });
36612
36793
  for (const rawLine of _splitlines11(content)) {
36613
36794
  const line = _strip7(rawLine);
36614
36795
  if (!line) {
@@ -37525,12 +37706,13 @@ __export(council_cli_exports, {
37525
37706
  cmd_replay: () => cmd_replay,
37526
37707
  cmd_run: () => cmd_run,
37527
37708
  cmd_shadow_report: () => cmd_shadow_report,
37709
+ cmd_status: () => cmd_status,
37528
37710
  format_estimate_table: () => format_estimate_table,
37529
37711
  load_settings: () => load_settings,
37530
37712
  main: () => main17
37531
37713
  });
37532
- import * as fs55 from "node:fs";
37533
- import * as path48 from "node:path";
37714
+ import * as fs56 from "node:fs";
37715
+ import * as path49 from "node:path";
37534
37716
  import { fileURLToPath as fileURLToPath27, pathToFileURL as pathToFileURL17 } from "node:url";
37535
37717
  function _pyFixed6(x, ndigits) {
37536
37718
  if (!Number.isFinite(x)) {
@@ -37739,7 +37921,7 @@ function _stderr2(s) {
37739
37921
  function load_settings(p = SETTINGS_FILE2, opts = {}) {
37740
37922
  const ai_council_path = opts.ai_council_path ?? AI_COUNCIL_FILE;
37741
37923
  const settings = load_agent_settings({ project_path: p });
37742
- if (fs55.existsSync(ai_council_path)) {
37924
+ if (fs56.existsSync(ai_council_path)) {
37743
37925
  const cfg = load_council_config(ai_council_path);
37744
37926
  settings["ai_council"] = _synthesize_ai_council_block(cfg);
37745
37927
  }
@@ -37861,7 +38043,7 @@ function build_members(settings, opts = {}) {
37861
38043
  const ai = _isDict3(settings) ? settings["ai_council"] || {} : {};
37862
38044
  if (!_pyBool2(ai["enabled"])) {
37863
38045
  throw new CouncilDisabledError(
37864
- "ai_council.enabled is false in .agent-settings.yml \u2014 flip it on before invoking council:* commands."
38046
+ `enabled is false in the council config (${COUNCIL_CONFIG_USER_GLOBAL_REL} under the user-global agent-config root) \u2014 flip it on before invoking council:* commands. This config is NEVER project-local (ADR-104), so do not look for it, or create it, in the project tree. \`agent-config council:status\` prints the resolved path.`
37865
38047
  );
37866
38048
  }
37867
38049
  const members_cfg = ai["members"] || {};
@@ -37896,7 +38078,7 @@ function build_members(settings, opts = {}) {
37896
38078
  if (!_pyBool2(cfg["enabled"])) {
37897
38079
  if (name in siblings) {
37898
38080
  throw new CouncilDisabledError(
37899
- `--siblings targets member ${_pyReprStr5(name)} but it is not enabled in .agent-settings.yml (ai_council.members.${name}.enabled).`
38081
+ `--siblings targets member ${_pyReprStr5(name)} but it is not enabled in the council config (members.${name}.enabled in ${COUNCIL_CONFIG_USER_GLOBAL_REL} under the user-global root).`
37900
38082
  );
37901
38083
  }
37902
38084
  continue;
@@ -37989,7 +38171,7 @@ function build_members(settings, opts = {}) {
37989
38171
  );
37990
38172
  }
37991
38173
  throw new CouncilDisabledError(
37992
- "no council member has `enabled: true` \u2014 enable at least one in .agent-settings.yml under ai_council.members.*."
38174
+ `no council member has \`enabled: true\` \u2014 enable at least one under members.* in ${COUNCIL_CONFIG_USER_GLOBAL_REL} (user-global root; never the project tree, ADR-104). \`agent-config council:status\` prints the resolved path.`
37993
38175
  );
37994
38176
  }
37995
38177
  return members;
@@ -38115,7 +38297,7 @@ function build_question(opts) {
38115
38297
  let ctx;
38116
38298
  let artefact;
38117
38299
  if (input_mode === "prompt") {
38118
- const text = fs55.readFileSync(input_path, "utf-8");
38300
+ const text = fs56.readFileSync(input_path, "utf-8");
38119
38301
  ctx = bundle_prompt(text);
38120
38302
  artefact = String(input_path);
38121
38303
  } else if (input_mode === "roadmap") {
@@ -38258,9 +38440,9 @@ function _maybe_write_decision_replay(opts) {
38258
38440
  include_member_arguments: include_args
38259
38441
  })
38260
38442
  );
38261
- const target = path48.join(path48.dirname(opts.out_path), "decision-replay.md");
38262
- fs55.mkdirSync(path48.dirname(target), { recursive: true });
38263
- fs55.writeFileSync(target, replay, { encoding: "utf-8" });
38443
+ const target = path49.join(path49.dirname(opts.out_path), "decision-replay.md");
38444
+ fs56.mkdirSync(path49.dirname(target), { recursive: true });
38445
+ fs56.writeFileSync(target, replay, { encoding: "utf-8" });
38264
38446
  return target;
38265
38447
  }
38266
38448
  function _peer_review_active(ai_cfg, args) {
@@ -38873,6 +39055,75 @@ function _emit_shadow_slo_banner() {
38873
39055
  return;
38874
39056
  }
38875
39057
  }
39058
+ function cmd_status(args, opts = {}) {
39059
+ const env = opts.env ?? process.env;
39060
+ const override = env[COUNCIL_CONFIG_ENV];
39061
+ const path_ = resolve_config_path(REPO_ROOT3, { env });
39062
+ const exists3 = fs56.existsSync(String(path_));
39063
+ const provenance = override ? `${COUNCIL_CONFIG_ENV} override` : "user-global";
39064
+ let cfg = null;
39065
+ let parse_error = null;
39066
+ if (exists3) {
39067
+ try {
39068
+ cfg = load_council_config(path_);
39069
+ } catch (exc) {
39070
+ parse_error = exc instanceof Error ? exc.message : String(exc);
39071
+ }
39072
+ }
39073
+ const enabledMembers = cfg === null ? [] : [...cfg.members.entries()].filter(([, m]) => m.enabled);
39074
+ const configured = cfg !== null && cfg.enabled && enabledMembers.length > 0;
39075
+ if (_getattr3(args, "json", false)) {
39076
+ _stdout2(
39077
+ `${JSON.stringify({
39078
+ configured,
39079
+ path: String(path_),
39080
+ exists: exists3,
39081
+ provenance,
39082
+ enabled: cfg?.enabled ?? null,
39083
+ members_total: cfg === null ? null : cfg.members.size,
39084
+ members_enabled: cfg === null ? null : enabledMembers.length,
39085
+ member_names: enabledMembers.map(([n]) => n),
39086
+ parse_error,
39087
+ project_tree_consulted: false
39088
+ })}
39089
+ `
39090
+ );
39091
+ return 0;
39092
+ }
39093
+ _stdout2(`council:status \xB7 ${configured ? "CONFIGURED" : "NOT CONFIGURED"}
39094
+ `);
39095
+ _stdout2(` config path ${String(path_)}
39096
+ `);
39097
+ _stdout2(` resolved by ${provenance}
39098
+ `);
39099
+ _stdout2(` file exists ${exists3 ? "yes" : "no"}
39100
+ `);
39101
+ if (parse_error !== null) {
39102
+ _stdout2(` parse error ${parse_error}
39103
+ `);
39104
+ }
39105
+ if (cfg !== null) {
39106
+ _stdout2(` enabled ${cfg.enabled ? "yes" : "no"}
39107
+ `);
39108
+ _stdout2(` members ${enabledMembers.length} enabled of ${cfg.members.size}
39109
+ `);
39110
+ if (enabledMembers.length > 0) {
39111
+ _stdout2(` ${enabledMembers.map(([n]) => n).join(", ")}
39112
+ `);
39113
+ }
39114
+ }
39115
+ _stdout2("\n");
39116
+ _stdout2(" The project tree is NEVER consulted (ADR-104). No project file \u2014\n");
39117
+ _stdout2(" `.agent-settings.yml` included \u2014 indicates council availability in\n");
39118
+ _stdout2(" either direction. Do not infer it from one; run this instead.\n");
39119
+ if (!configured) {
39120
+ _stdout2(`
39121
+ To configure: write ${COUNCIL_CONFIG_USER_GLOBAL_REL} under the user-global
39122
+ `);
39123
+ _stdout2(" agent-config root, with `enabled: true` and at least one enabled member.\n");
39124
+ }
39125
+ return 0;
39126
+ }
38876
39127
  function _apply_solo_dispatch(members) {
38877
39128
  let cfg;
38878
39129
  try {
@@ -39150,8 +39401,8 @@ function cmd_run(args, opts = {}) {
39150
39401
  kind: "responses",
39151
39402
  subcommand: "run"
39152
39403
  });
39153
- fs55.mkdirSync(path48.dirname(_resolveTarget(out_path)), { recursive: true });
39154
- fs55.writeFileSync(_resolveTarget(out_path), _jsonDumpsIndent22(payload) + "\n", { encoding: "utf-8" });
39404
+ fs56.mkdirSync(path49.dirname(_resolveTarget(out_path)), { recursive: true });
39405
+ fs56.writeFileSync(_resolveTarget(out_path), _jsonDumpsIndent22(payload) + "\n", { encoding: "utf-8" });
39155
39406
  _stdout2(
39156
39407
  `
39157
39408
  council:run \xB7 wrote ${out_path} (estimated $${_pyFixed6(estimated_total, 4)} / actual $${_pyFixed6(actual_total, 4)})
@@ -39176,7 +39427,7 @@ function _debate_round_filename(round_number) {
39176
39427
  return `debate-round-${round_number}.json`;
39177
39428
  }
39178
39429
  function _write_debate_round(out_dir, round_number, responses, opts) {
39179
- fs55.mkdirSync(_resolveTarget(out_dir), { recursive: true });
39430
+ fs56.mkdirSync(_resolveTarget(out_dir), { recursive: true });
39180
39431
  let actual_total = 0;
39181
39432
  for (const r of responses) {
39182
39433
  if (r.error) {
@@ -39200,15 +39451,15 @@ function _write_debate_round(out_dir, round_number, responses, opts) {
39200
39451
  prompt_cache_round_gap_ms: opts.cache_gap_ms_since_previous_round ?? null,
39201
39452
  responses: _serialise_responses(responses)
39202
39453
  };
39203
- const out_path = path48.join(_resolveTarget(out_dir), _debate_round_filename(round_number));
39204
- fs55.writeFileSync(out_path, _jsonDumpsIndent22(payload) + "\n", { encoding: "utf-8" });
39454
+ const out_path = path49.join(_resolveTarget(out_dir), _debate_round_filename(round_number));
39455
+ fs56.writeFileSync(out_path, _jsonDumpsIndent22(payload) + "\n", { encoding: "utf-8" });
39205
39456
  return out_path;
39206
39457
  }
39207
39458
  function _load_debate_seed(p, expected_members) {
39208
- if (!fs55.existsSync(p)) {
39459
+ if (!fs56.existsSync(p)) {
39209
39460
  throw new FileNotFoundError3(`--continue-as-debate path not found: ${p}`);
39210
39461
  }
39211
- const payload = JSON.parse(fs55.readFileSync(p, "utf-8"));
39462
+ const payload = JSON.parse(fs56.readFileSync(p, "utf-8"));
39212
39463
  const source_members = (payload["members"] || []).slice();
39213
39464
  const expected_labels = expected_members.map((m) => `${m.name}/${m.model}`);
39214
39465
  if (!_listEq(source_members, expected_labels)) {
@@ -39254,7 +39505,7 @@ function _readStdinLine() {
39254
39505
  try {
39255
39506
  const buf = Buffer.alloc(4096);
39256
39507
  const fd = 0;
39257
- const n = fs55.readSync(fd, buf, 0, buf.length, null);
39508
+ const n = fs56.readSync(fd, buf, 0, buf.length, null);
39258
39509
  return buf.toString("utf-8", 0, n).split("\n")[0]?.trim().toLowerCase() ?? "";
39259
39510
  } catch {
39260
39511
  return "";
@@ -39480,7 +39731,7 @@ council:debate \xB7 ${all_rounds.length} round(s) complete \xB7 actual $${_pyFix
39480
39731
  return errors_last.length > 0 && errors_last.length === last.length ? 1 : 0;
39481
39732
  }
39482
39733
  function cmd_render(args) {
39483
- const payload = JSON.parse(fs55.readFileSync(args.responses, "utf-8"));
39734
+ const payload = JSON.parse(fs56.readFileSync(args.responses, "utf-8"));
39484
39735
  const items = payload["responses"] || [];
39485
39736
  const explicit = _getattr3(args, "prompt_mode", null);
39486
39737
  const mode = explicit || payload["prompt_mode"] || payload["mode"];
@@ -39506,8 +39757,8 @@ function cmd_render(args) {
39506
39757
  kind: "sessions",
39507
39758
  subcommand: "render"
39508
39759
  });
39509
- fs55.mkdirSync(path48.dirname(_resolveTarget(out_path)), { recursive: true });
39510
- fs55.writeFileSync(_resolveTarget(out_path), body + "\n", { encoding: "utf-8" });
39760
+ fs56.mkdirSync(path49.dirname(_resolveTarget(out_path)), { recursive: true });
39761
+ fs56.writeFileSync(_resolveTarget(out_path), body + "\n", { encoding: "utf-8" });
39511
39762
  _stdout2(`council:render \xB7 wrote ${out_path}
39512
39763
  `);
39513
39764
  return 0;
@@ -39518,15 +39769,15 @@ function cmd_render(args) {
39518
39769
  function _cmd_replay_low_impact_stats(args) {
39519
39770
  const li = low_impact_exports;
39520
39771
  const responses_path = args.responses;
39521
- const log_path = path48.join(path48.dirname(responses_path), "low-impact-resolutions.md");
39522
- if (!fs55.existsSync(log_path)) {
39772
+ const log_path = path49.join(path49.dirname(responses_path), "low-impact-resolutions.md");
39773
+ if (!fs56.existsSync(log_path)) {
39523
39774
  _stdout2(
39524
39775
  `council:replay \xB7 no low-impact-resolutions.md alongside ${responses_path} \u2014 session had no fast-path entries.
39525
39776
  `
39526
39777
  );
39527
39778
  return 0;
39528
39779
  }
39529
- const body = fs55.readFileSync(log_path, "utf-8");
39780
+ const body = fs56.readFileSync(log_path, "utf-8");
39530
39781
  const stats = li.parse_low_impact_log(body);
39531
39782
  const out = li.render_low_impact_stats(stats);
39532
39783
  if (_getattr3(args, "output", null)) {
@@ -39534,8 +39785,8 @@ function _cmd_replay_low_impact_stats(args) {
39534
39785
  kind: "sessions",
39535
39786
  subcommand: "replay"
39536
39787
  });
39537
- fs55.mkdirSync(path48.dirname(_resolveTarget(target)), { recursive: true });
39538
- fs55.writeFileSync(_resolveTarget(target), out, { encoding: "utf-8" });
39788
+ fs56.mkdirSync(path49.dirname(_resolveTarget(target)), { recursive: true });
39789
+ fs56.writeFileSync(_resolveTarget(target), out, { encoding: "utf-8" });
39539
39790
  _stdout2(`council:replay \xB7 wrote ${target}
39540
39791
  `);
39541
39792
  return 0;
@@ -39547,7 +39798,7 @@ function cmd_replay(args) {
39547
39798
  if (_getattr3(args, "low_impact_stats", false)) {
39548
39799
  return _cmd_replay_low_impact_stats(args);
39549
39800
  }
39550
- const payload = JSON.parse(fs55.readFileSync(args.responses, "utf-8"));
39801
+ const payload = JSON.parse(fs56.readFileSync(args.responses, "utf-8"));
39551
39802
  const consensus = _deserialise_consensus(payload["consensus"]);
39552
39803
  if (consensus === null) {
39553
39804
  _stderr2(
@@ -39572,8 +39823,8 @@ function cmd_replay(args) {
39572
39823
  kind: "sessions",
39573
39824
  subcommand: "replay"
39574
39825
  });
39575
- fs55.mkdirSync(path48.dirname(_resolveTarget(out_path)), { recursive: true });
39576
- fs55.writeFileSync(_resolveTarget(out_path), body, { encoding: "utf-8" });
39826
+ fs56.mkdirSync(path49.dirname(_resolveTarget(out_path)), { recursive: true });
39827
+ fs56.writeFileSync(_resolveTarget(out_path), body, { encoding: "utf-8" });
39577
39828
  _stdout2(`council:replay \xB7 wrote ${out_path}
39578
39829
  `);
39579
39830
  } else {
@@ -39630,8 +39881,8 @@ function cmd_quota(args, opts = {}) {
39630
39881
  }
39631
39882
  function _validate_council_output_path(path_str, opts) {
39632
39883
  const expected_rel = COUNCIL_CANONICAL_DIRS[opts.kind];
39633
- const expected_abs = _resolveReal(path48.join(REPO_ROOT3, expected_rel));
39634
- const target = path48.isAbsolute(path_str) ? path_str : path48.join(REPO_ROOT3, path_str);
39884
+ const expected_abs = _resolveReal(path49.join(REPO_ROOT3, expected_rel));
39885
+ const target = path49.isAbsolute(path_str) ? path_str : path49.join(REPO_ROOT3, path_str);
39635
39886
  const target_resolved = _resolveReal(target);
39636
39887
  if (!_isRelativeTo(target_resolved, expected_abs)) {
39637
39888
  throw new ArgumentTypeError(
@@ -39641,12 +39892,12 @@ function _validate_council_output_path(path_str, opts) {
39641
39892
  return path_str;
39642
39893
  }
39643
39894
  function _resolveTarget(path_str) {
39644
- return path48.isAbsolute(path_str) ? path_str : path48.join(REPO_ROOT3, path_str);
39895
+ return path49.isAbsolute(path_str) ? path_str : path49.join(REPO_ROOT3, path_str);
39645
39896
  }
39646
39897
  function _resolveReal(p) {
39647
- const abs = path48.resolve(p);
39898
+ const abs = path49.resolve(p);
39648
39899
  try {
39649
- return fs55.realpathSync(abs);
39900
+ return fs56.realpathSync(abs);
39650
39901
  } catch {
39651
39902
  return abs;
39652
39903
  }
@@ -39655,8 +39906,8 @@ function _isRelativeTo(target, base) {
39655
39906
  if (target === base) {
39656
39907
  return true;
39657
39908
  }
39658
- const rel = path48.relative(base, target);
39659
- return rel !== "" && !rel.startsWith("..") && !path48.isAbsolute(rel);
39909
+ const rel = path49.relative(base, target);
39910
+ return rel !== "" && !rel.startsWith("..") && !path49.isAbsolute(rel);
39660
39911
  }
39661
39912
  function _topError(message) {
39662
39913
  _stderr2(_TOP_USAGE2);
@@ -39708,7 +39959,8 @@ function _defaultArgs() {
39708
39959
  low_impact_stats: false,
39709
39960
  reset: null,
39710
39961
  log: null,
39711
- window_days: 7
39962
+ window_days: 7,
39963
+ json: false
39712
39964
  };
39713
39965
  }
39714
39966
  function _usageFor(cmd) {
@@ -39825,6 +40077,12 @@ function _specsFor(cmd) {
39825
40077
  ],
39826
40078
  requiredOpts: []
39827
40079
  };
40080
+ case "status":
40081
+ return {
40082
+ positionals: [],
40083
+ opts: [{ flag: "--json", takesValue: false, apply: (o) => o.json = true }],
40084
+ requiredOpts: []
40085
+ };
39828
40086
  default:
39829
40087
  return { positionals: [], opts: [], requiredOpts: [] };
39830
40088
  }
@@ -39998,6 +40256,9 @@ function main17(argv = null) {
39998
40256
  if (args.cmd === "shadow-report") {
39999
40257
  return cmd_shadow_report(args);
40000
40258
  }
40259
+ if (args.cmd === "status") {
40260
+ return cmd_status(args);
40261
+ }
40001
40262
  } catch (exc) {
40002
40263
  if (exc instanceof CouncilDisabledError) {
40003
40264
  _stderr2(`\u274C council:${args.cmd}: ${exc.message}
@@ -40017,13 +40278,13 @@ function _isCliEntry17() {
40017
40278
  if (process.argv[1] === void 0) {
40018
40279
  return false;
40019
40280
  }
40020
- const argvUrl = pathToFileURL17(path48.resolve(process.argv[1])).href;
40281
+ const argvUrl = pathToFileURL17(path49.resolve(process.argv[1])).href;
40021
40282
  if (import.meta.url === argvUrl) {
40022
40283
  return true;
40023
40284
  }
40024
40285
  try {
40025
- const here = fs55.realpathSync(fileURLToPath27(import.meta.url));
40026
- const argv = fs55.realpathSync(path48.resolve(process.argv[1]));
40286
+ const here = fs56.realpathSync(fileURLToPath27(import.meta.url));
40287
+ const argv = fs56.realpathSync(path49.resolve(process.argv[1]));
40027
40288
  return here === argv;
40028
40289
  } catch {
40029
40290
  return false;
@@ -40075,7 +40336,7 @@ var init_council_cli = __esm({
40075
40336
  "xai",
40076
40337
  "perplexity"
40077
40338
  ]);
40078
- _HERE15 = path48.dirname(fileURLToPath27(import.meta.url));
40339
+ _HERE15 = path49.dirname(fileURLToPath27(import.meta.url));
40079
40340
  [REPO_ROOT3] = resolve_project_root(null);
40080
40341
  SETTINGS_FILE2 = project_settings_path(REPO_ROOT3);
40081
40342
  AI_COUNCIL_FILE = resolve_config_path(REPO_ROOT3);
@@ -40097,9 +40358,9 @@ var init_council_cli = __esm({
40097
40358
  };
40098
40359
  FileNotFoundError3 = class extends Error {
40099
40360
  };
40100
- _SUBCOMMANDS = ["estimate", "run", "debate", "render", "replay", "quota", "shadow-report"];
40361
+ _SUBCOMMANDS = ["estimate", "run", "debate", "render", "replay", "quota", "shadow-report", "status"];
40101
40362
  _TOP_USAGE2 = `usage: ${_PROG9} [-h]
40102
- {estimate,run,debate,render,replay,quota,shadow-report}
40363
+ {estimate,run,debate,render,replay,quota,shadow-report,status}
40103
40364
  ...
40104
40365
  `;
40105
40366
  if (_isCliEntry17()) {
@@ -40177,7 +40438,7 @@ var init_safety_envelope = __esm({
40177
40438
  });
40178
40439
 
40179
40440
  // src/scripts/mcp_server/__main__.ts
40180
- import * as path50 from "node:path";
40441
+ import * as path51 from "node:path";
40181
40442
  import { fileURLToPath as fileURLToPath29 } from "node:url";
40182
40443
 
40183
40444
  // src/scripts/mcp_server/index.ts
@@ -40225,8 +40486,8 @@ init_prompts();
40225
40486
  init_resources();
40226
40487
 
40227
40488
  // src/scripts/mcp_server/tools.ts
40228
- import * as fs56 from "node:fs";
40229
- import * as path49 from "node:path";
40489
+ import * as fs57 from "node:fs";
40490
+ import * as path50 from "node:path";
40230
40491
  import { fileURLToPath as fileURLToPath28 } from "node:url";
40231
40492
 
40232
40493
  // src/scripts/chat_history.ts
@@ -42474,9 +42735,9 @@ function _strip8(s) {
42474
42735
  }
42475
42736
  function _resolvePath2(p) {
42476
42737
  try {
42477
- return fs56.realpathSync(p);
42738
+ return fs57.realpathSync(p);
42478
42739
  } catch {
42479
- return path49.resolve(p);
42740
+ return path50.resolve(p);
42480
42741
  }
42481
42742
  }
42482
42743
  function _resolveConsumerRoot(override) {
@@ -42486,14 +42747,14 @@ function _resolveConsumerRoot(override) {
42486
42747
  return _resolvePath2(process.cwd());
42487
42748
  }
42488
42749
  function _relativeUnder(target, root) {
42489
- const rel = path49.relative(root, target);
42750
+ const rel = path50.relative(root, target);
42490
42751
  if (rel === "") {
42491
42752
  return "";
42492
42753
  }
42493
- if (rel.startsWith("..") || path49.isAbsolute(rel)) {
42754
+ if (rel.startsWith("..") || path50.isAbsolute(rel)) {
42494
42755
  return null;
42495
42756
  }
42496
- return rel.split(path49.sep).join("/");
42757
+ return rel.split(path50.sep).join("/");
42497
42758
  }
42498
42759
  function _reprStrList(values) {
42499
42760
  return `[${values.map((v) => `'${v}'`).join(", ")}]`;
@@ -42502,11 +42763,11 @@ function _validateInTreePath(raw, consumerRoot) {
42502
42763
  const root = _resolvePath2(consumerRoot);
42503
42764
  let target;
42504
42765
  if (raw === null || raw === void 0 || raw === "") {
42505
- target = path49.join(root, "agents", "runtime", ".agent-chat-history");
42506
- } else if (path49.isAbsolute(raw)) {
42766
+ target = path50.join(root, "agents", "runtime", ".agent-chat-history");
42767
+ } else if (path50.isAbsolute(raw)) {
42507
42768
  target = _resolvePath2(raw);
42508
42769
  } else {
42509
- target = _resolvePath2(path49.join(root, raw));
42770
+ target = _resolvePath2(path50.join(root, raw));
42510
42771
  }
42511
42772
  const rel = _relativeUnder(target, root);
42512
42773
  if (rel === null) {
@@ -42544,11 +42805,11 @@ async function _lintSkillsHandler(args, consumerRoot) {
42544
42805
  if (typeof raw !== "string") {
42545
42806
  throw new Error("'paths' entries must be strings");
42546
42807
  }
42547
- const resolved = path49.isAbsolute(raw) ? _resolvePath2(raw) : _resolvePath2(path49.join(root, raw));
42808
+ const resolved = path50.isAbsolute(raw) ? _resolvePath2(raw) : _resolvePath2(path50.join(root, raw));
42548
42809
  if (_relativeUnder(resolved, root) === null) {
42549
42810
  throw new Error(`path escapes consumer_root: ${resolved}`);
42550
42811
  }
42551
- if (fs56.existsSync(resolved)) {
42812
+ if (fs57.existsSync(resolved)) {
42552
42813
  paths.push(resolved);
42553
42814
  }
42554
42815
  }
@@ -42585,7 +42846,7 @@ async function _chatHistoryAppendHandler(args, consumerRoot) {
42585
42846
  if (typeof minSchema !== "number" || !Number.isInteger(minSchema) || typeof minSchema === "boolean") {
42586
42847
  throw new Error("'min_schema_version' must be an integer");
42587
42848
  }
42588
- const existingHeader = fs56.existsSync(target) ? _chReadHeader(target) : null;
42849
+ const existingHeader = fs57.existsSync(target) ? _chReadHeader(target) : null;
42589
42850
  const observed = existingHeader !== null && typeof existingHeader === "object" ? _pyInt7(existingHeader.v ?? 0) : SCHEMA_VERSION3;
42590
42851
  if (observed < minSchema) {
42591
42852
  throw new Error(`chat-history schema ${observed} below required ${minSchema}`);
@@ -42600,8 +42861,8 @@ async function _chatHistoryAppendHandler(args, consumerRoot) {
42600
42861
  session: session === void 0 ? null : session
42601
42862
  };
42602
42863
  }
42603
- if (!fs56.existsSync(target) || _chReadHeader(target) === null) {
42604
- fs56.mkdirSync(path49.dirname(target), { recursive: true });
42864
+ if (!fs57.existsSync(target) || _chReadHeader(target) === null) {
42865
+ fs57.mkdirSync(path50.dirname(target), { recursive: true });
42605
42866
  _chInit(target);
42606
42867
  }
42607
42868
  _chAppend(entry, target, session ?? null);
@@ -42645,7 +42906,7 @@ async function _chatHistoryReadHandler(args, consumerRoot) {
42645
42906
  if (detail !== "full" && detail !== "index") {
42646
42907
  throw new Error("'detail' must be 'index' or 'full'");
42647
42908
  }
42648
- if (!fs56.existsSync(target)) {
42909
+ if (!fs57.existsSync(target)) {
42649
42910
  return { path: target, entries: [], count: 0 };
42650
42911
  }
42651
42912
  if (around !== void 0 && around !== null) {
@@ -42747,8 +43008,8 @@ async function _memoryStatusHandler(_args, consumerRoot) {
42747
43008
  }
42748
43009
  return result;
42749
43010
  }
42750
- var _PACKAGE_ROOT2 = path49.resolve(
42751
- path49.dirname(fileURLToPath28(import.meta.url)),
43011
+ var _PACKAGE_ROOT2 = path50.resolve(
43012
+ path50.dirname(fileURLToPath28(import.meta.url)),
42752
43013
  "..",
42753
43014
  "..",
42754
43015
  ".."
@@ -42792,10 +43053,10 @@ async function _memorySignalHandler(args, consumerRoot) {
42792
43053
  async function _roadmapProgressHandler(args, consumerRoot) {
42793
43054
  const dryRun = _pyTruthy6(args.dry_run ?? false);
42794
43055
  const root = _resolvePath2(consumerRoot);
42795
- const roadmapRoot = path49.join(root, "agents", "roadmaps");
42796
- const target = path49.join(root, "agents", "roadmaps-progress.md");
43056
+ const roadmapRoot = path50.join(root, "agents", "roadmaps");
43057
+ const target = path50.join(root, "agents", "roadmaps-progress.md");
42797
43058
  const urp = await Promise.resolve().then(() => (init_update_roadmap_progress(), update_roadmap_progress_exports));
42798
- if (!fs56.existsSync(roadmapRoot)) {
43059
+ if (!fs57.existsSync(roadmapRoot)) {
42799
43060
  return {
42800
43061
  written: false,
42801
43062
  path: target,
@@ -42810,7 +43071,7 @@ async function _roadmapProgressHandler(args, consumerRoot) {
42810
43071
  const stepsDone = roadmaps.reduce((s, r) => s + r.done, 0);
42811
43072
  const stepsTotal = roadmaps.reduce((s, r) => s + r.total_active, 0);
42812
43073
  if (!dryRun) {
42813
- fs56.writeFileSync(target, content, "utf-8");
43074
+ fs57.writeFileSync(target, content, "utf-8");
42814
43075
  }
42815
43076
  return {
42816
43077
  written: !dryRun,
@@ -42831,11 +43092,11 @@ async function _roadmapArchiveHandler(_args, consumerRoot) {
42831
43092
  let dashboardRegenerated = false;
42832
43093
  if (archived.length > 0) {
42833
43094
  const urp = await Promise.resolve().then(() => (init_update_roadmap_progress(), update_roadmap_progress_exports));
42834
- const roadmapRoot = path49.join(root, "agents", "roadmaps");
42835
- if (fs56.existsSync(roadmapRoot)) {
43095
+ const roadmapRoot = path50.join(root, "agents", "roadmaps");
43096
+ if (fs57.existsSync(roadmapRoot)) {
42836
43097
  const roadmaps = urp.collect(roadmapRoot);
42837
- fs56.writeFileSync(
42838
- path49.join(root, "agents", "roadmaps-progress.md"),
43098
+ fs57.writeFileSync(
43099
+ path50.join(root, "agents", "roadmaps-progress.md"),
42839
43100
  urp.render(roadmaps, urp.collect_bundles(root)),
42840
43101
  "utf-8"
42841
43102
  );
@@ -42851,9 +43112,9 @@ async function _roadmapArchiveHandler(_args, consumerRoot) {
42851
43112
  async function _capabilitiesIndexHandler(args, consumerRoot) {
42852
43113
  const check = _pyTruthy6(args.check ?? false);
42853
43114
  const cap = await Promise.resolve().then(() => (init_generate_capabilities_index(), generate_capabilities_index_exports));
42854
- const out = path49.join(_PACKAGE_ROOT2, "CAPABILITIES.yaml");
43115
+ const out = path50.join(_PACKAGE_ROOT2, "CAPABILITIES.yaml");
42855
43116
  const content = cap.build();
42856
- const onDisk = fs56.existsSync(out) ? fs56.readFileSync(out, "utf-8") : "";
43117
+ const onDisk = fs57.existsSync(out) ? fs57.readFileSync(out, "utf-8") : "";
42857
43118
  const drift = onDisk !== content;
42858
43119
  if (check) {
42859
43120
  return { check: true, written: false, drift, path: out };
@@ -42864,7 +43125,7 @@ async function _capabilitiesIndexHandler(args, consumerRoot) {
42864
43125
  `CAPABILITIES.yaml path escapes consumer_root: ${out} not under ${root}`
42865
43126
  );
42866
43127
  }
42867
- fs56.writeFileSync(out, content, "utf-8");
43128
+ fs57.writeFileSync(out, content, "utf-8");
42868
43129
  return { check: false, written: true, drift, path: out };
42869
43130
  }
42870
43131
  async function _runDoctorLeg(consumerRoot) {
@@ -42964,11 +43225,11 @@ async function _councilEstimateHandler(args, consumerRoot) {
42964
43225
  throw new Error("'depth' must be 'shallow' or 'deep' when provided");
42965
43226
  }
42966
43227
  const root = _resolvePath2(consumerRoot);
42967
- const target = path49.isAbsolute(inputRaw) ? _resolvePath2(inputRaw) : _resolvePath2(path49.join(root, inputRaw));
43228
+ const target = path50.isAbsolute(inputRaw) ? _resolvePath2(inputRaw) : _resolvePath2(path50.join(root, inputRaw));
42968
43229
  if (_relativeUnder(target, root) === null) {
42969
43230
  throw new Error(`path escapes consumer_root: ${target}`);
42970
43231
  }
42971
- if (!fs56.existsSync(target)) {
43232
+ if (!fs57.existsSync(target)) {
42972
43233
  throw new Error(`input_path not found: ${target}`);
42973
43234
  }
42974
43235
  const cli = await Promise.resolve().then(() => (init_council_cli(), council_cli_exports));
@@ -43030,18 +43291,18 @@ async function _runTestsHandler(args, consumerRoot) {
43030
43291
  if (typeof relPathRaw !== "string" || !_strip8(relPathRaw)) {
43031
43292
  throw new Error("'path' must be a non-empty string when provided");
43032
43293
  }
43033
- const resolved = path49.isAbsolute(relPathRaw) ? _resolvePath2(relPathRaw) : _resolvePath2(path49.join(root, relPathRaw));
43294
+ const resolved = path50.isAbsolute(relPathRaw) ? _resolvePath2(relPathRaw) : _resolvePath2(path50.join(root, relPathRaw));
43034
43295
  const rel = _relativeUnder(resolved, root);
43035
43296
  if (rel === null) {
43036
43297
  throw new Error(`path escapes consumer_root: ${resolved}`);
43037
43298
  }
43038
- if (!fs56.existsSync(resolved)) {
43299
+ if (!fs57.existsSync(resolved)) {
43039
43300
  throw new Error(`path not found: ${resolved}`);
43040
43301
  }
43041
43302
  relArg = rel;
43042
43303
  }
43043
- const vitestEntry = path49.join(root, "node_modules", "vitest", "vitest.mjs");
43044
- if (!fs56.existsSync(vitestEntry)) {
43304
+ const vitestEntry = path50.join(root, "node_modules", "vitest", "vitest.mjs");
43305
+ if (!fs57.existsSync(vitestEntry)) {
43045
43306
  throw new Error(
43046
43307
  "run_tests pilot supports vitest projects only \u2014 node_modules/vitest/vitest.mjs not found under consumer_root"
43047
43308
  );
@@ -43647,8 +43908,8 @@ function _strCmp3(a, b) {
43647
43908
  return a < b ? -1 : a > b ? 1 : 0;
43648
43909
  }
43649
43910
  function _pathlibCompare3(a, b) {
43650
- const pa = a.split(path49.sep);
43651
- const pb = b.split(path49.sep);
43911
+ const pa = a.split(path50.sep);
43912
+ const pb = b.split(path50.sep);
43652
43913
  const n = Math.min(pa.length, pb.length);
43653
43914
  for (let i = 0; i < n; i++) {
43654
43915
  const c = _strCmp3(pa[i], pb[i]);
@@ -43873,7 +44134,7 @@ function main18() {
43873
44134
 
43874
44135
  // src/scripts/mcp_server/__main__.ts
43875
44136
  var _selfPath = fileURLToPath29(import.meta.url);
43876
- var _invokedDirectly2 = globalThis.__AC_MCP_BUNDLE_DIRECT === true || process.argv[1] !== void 0 && path50.resolve(process.argv[1]) === path50.resolve(_selfPath);
44137
+ var _invokedDirectly2 = globalThis.__AC_MCP_BUNDLE_DIRECT === true || process.argv[1] !== void 0 && path51.resolve(process.argv[1]) === path51.resolve(_selfPath);
43877
44138
  if (_invokedDirectly2) {
43878
44139
  main18();
43879
44140
  }