@event4u/agent-config 9.27.0 → 9.29.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 (220) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/AGENTS.md +13 -12
  3. package/CHANGELOG.md +165 -0
  4. package/README.md +1 -1
  5. package/agents/templates/.ai-council.yml.example +55 -24
  6. package/dist/agent-src/commands/analyze/conformance.md +24 -0
  7. package/dist/agent-src/commands/cost/report.md +2 -2
  8. package/dist/agent-src/commands/team/adversarial.md +8 -7
  9. package/dist/agent-src/commands/team/delegate.md +13 -12
  10. package/dist/agent-src/commands/team/review.md +9 -8
  11. package/dist/agent-src/commands/team/status.md +9 -8
  12. package/dist/agent-src/commands/team.md +29 -19
  13. package/dist/agent-src/contexts/execution/auto-dispatch-classification.md +88 -2
  14. package/dist/agent-src/contexts/execution/auto-orchestration-activation.md +29 -21
  15. package/dist/agent-src/contexts/execution/host-capability-manifest.md +26 -15
  16. package/dist/agent-src/contexts/execution/orchestration-telemetry.md +28 -3
  17. package/dist/agent-src/contexts/execution/subagent-response-contract.md +54 -0
  18. package/dist/agent-src/contexts/execution/subagent-routing.md +13 -11
  19. package/dist/agent-src/contexts/execution/subagent-spawn-contract.md +25 -0
  20. package/dist/agent-src/contexts/execution/subagent-steering.md +6 -3
  21. package/dist/agent-src/rules/artifact-engagement-recording.md +4 -1
  22. package/dist/agent-src/rules/autonomous-execution.md +1 -1
  23. package/dist/agent-src/rules/brand-source-of-truth.md +33 -6
  24. package/dist/agent-src/rules/context-hygiene.md +3 -1
  25. package/dist/agent-src/rules/council-availability.md +93 -0
  26. package/dist/agent-src/rules/cross-source-consistency.md +3 -0
  27. package/dist/agent-src/rules/delegation-policy.md +38 -10
  28. package/dist/agent-src/rules/design-fidelity.md +3 -0
  29. package/dist/agent-src/rules/evaluator-independence.md +2 -1
  30. package/dist/agent-src/rules/external-code-graph-interop.md +2 -1
  31. package/dist/agent-src/rules/finance-safety-floor.md +1 -1
  32. package/dist/agent-src/rules/git-history-discipline.md +1 -1
  33. package/dist/agent-src/rules/history-discipline.md +3 -1
  34. package/dist/agent-src/rules/legal-safety-floor.md +1 -1
  35. package/dist/agent-src/rules/no-pr-progress-comments.md +3 -1
  36. package/dist/agent-src/rules/onboarding-gate.md +3 -1
  37. package/dist/agent-src/rules/roadmap-ci-steps-policy.md +4 -1
  38. package/dist/agent-src/rules/role-mode-adherence.md +1 -1
  39. package/dist/agent-src/rules/scale-discipline.md +3 -1
  40. package/dist/agent-src/rules/self-repair-loop.md +103 -0
  41. package/dist/agent-src/rules/session-canary.md +2 -1
  42. package/dist/agent-src/rules/settings-ask-protocol.md +8 -7
  43. package/dist/agent-src/rules/strategy-safety-floor.md +1 -1
  44. package/dist/agent-src/rules/token-budget-discipline.md +4 -2
  45. package/dist/agent-src/rules/tool-safety.md +5 -1
  46. package/dist/agent-src/skills/adversarial-review/SKILL.md +1 -1
  47. package/dist/agent-src/skills/analysis-autonomous-mode/SKILL.md +1 -1
  48. package/dist/agent-src/skills/forensics-report/SKILL.md +114 -0
  49. package/dist/agent-src/skills/forensics-report/evals/triggers.json +17 -0
  50. package/dist/agent-src/skills/performance-analysis/SKILL.md +1 -1
  51. package/dist/agent-src/skills/persona-improvement/SKILL.md +1 -1
  52. package/dist/agent-src/skills/premortem/SKILL.md +30 -1
  53. package/dist/agent-src/skills/project-analyzer/SKILL.md +1 -1
  54. package/dist/agent-src/skills/reasoning-orchestrator/SKILL.md +2 -1
  55. package/dist/agent-src/skills/security-audit/SKILL.md +1 -1
  56. package/dist/agent-src/skills/sequential-thinking/SKILL.md +1 -1
  57. package/dist/agent-src/skills/skill-improvement-pipeline/SKILL.md +1 -1
  58. package/dist/agent-src/skills/subagent-orchestration/SKILL.md +7 -5
  59. package/dist/agent-src/skills/subagent-orchestration/schemas/subagent-status.json +61 -3
  60. package/dist/agent-src/skills/test-case-discovery/SKILL.md +1 -1
  61. package/dist/agent-src/skills/universal-project-analysis/SKILL.md +1 -1
  62. package/dist/agent-src/templates/AGENTS.md +8 -12
  63. package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
  64. package/dist/agent-src/templates/roadmaps.md +23 -0
  65. package/dist/cli/registry.js +7 -0
  66. package/dist/cli/registry.js.map +1 -1
  67. package/dist/cli-delegate/chunk-66OVWGB5.js +270 -0
  68. package/dist/cli-delegate/{chunk-HJ6DAJHR.js → chunk-LCFJIQ4J.js} +89 -7
  69. package/dist/cli-delegate/{chunk-VSYT7OHO.js → chunk-LVRYBKTI.js} +31 -2
  70. package/dist/cli-delegate/{chunk-DVRS2KVR.js → chunk-MMXA5GY7.js} +10 -17
  71. package/dist/cli-delegate/{chunk-WR6GTRHJ.js → chunk-MP3JT3IU.js} +3 -3
  72. package/dist/cli-delegate/{chunk-3KJIMFTB.js → chunk-NZ5N2XQL.js} +467 -305
  73. package/dist/cli-delegate/{chunk-AIIUU73N.js → chunk-OJM3MBJM.js} +1 -1
  74. package/dist/cli-delegate/{chunk-BCPIOAGV.js → chunk-RCIA67XN.js} +117 -96
  75. package/dist/cli-delegate/chunk-REKCMYOU.js +2991 -0
  76. package/dist/cli-delegate/cmd_analyze_session.js +1 -1
  77. package/dist/cli-delegate/cmd_brand_status.js +134 -0
  78. package/dist/cli-delegate/cmd_conformance.js +10 -47
  79. package/dist/cli-delegate/cmd_converge.js +3 -3
  80. package/dist/cli-delegate/cmd_doctor.js +10 -6
  81. package/dist/cli-delegate/cmd_explain.js +80 -330
  82. package/dist/cli-delegate/cmd_export.js +6 -6
  83. package/dist/cli-delegate/cmd_fleet.js +3 -3
  84. package/dist/cli-delegate/cmd_handoff.js +3 -3
  85. package/dist/cli-delegate/cmd_mcp_available.js +433 -0
  86. package/dist/cli-delegate/cmd_migrate.js +3 -3
  87. package/dist/cli-delegate/cmd_packs_active.js +153 -0
  88. package/dist/cli-delegate/cmd_preflight.js +1 -1
  89. package/dist/cli-delegate/cmd_prune.js +6 -6
  90. package/dist/cli-delegate/cmd_route_audit.js +8 -8
  91. package/dist/cli-delegate/cmd_route_explain.js +4 -4
  92. package/dist/cli-delegate/cmd_settings_get.js +266 -0
  93. package/dist/cli-delegate/cmd_settings_migrate.js +6 -6
  94. package/dist/cli-delegate/cmd_settings_set.js +8 -2968
  95. package/dist/cli-delegate/cmd_sync.js +6 -6
  96. package/dist/cli-delegate/cmd_uninstall.js +6 -6
  97. package/dist/cli-delegate/cmd_update.js +4 -4
  98. package/dist/cli-delegate/cmd_upgrade.js +4 -4
  99. package/dist/cli-delegate/cmd_validate.js +6 -6
  100. package/dist/cli-delegate/cmd_versions.js +4 -4
  101. package/dist/discovery/deprecation-report.md +1 -1
  102. package/dist/discovery/discovery-manifest.json +164 -55
  103. package/dist/discovery/discovery-manifest.json.sha256 +1 -1
  104. package/dist/discovery/discovery-manifest.summary.md +4 -3
  105. package/dist/discovery/orphan-report.md +1 -1
  106. package/dist/discovery/packs.json +44 -5
  107. package/dist/discovery/trust-report.md +11 -11
  108. package/dist/discovery/workspaces.json +16 -6
  109. package/dist/hooks/dispatch.js +9341 -6131
  110. package/dist/install/install.mjs +739 -524
  111. package/dist/mcp/registry-manifest.json +3 -3
  112. package/dist/mcp/server.json +2 -2
  113. package/dist/mcp/server.mjs +777 -281
  114. package/dist/router.json +1 -1
  115. package/dist/scripts/_lib/agent_settings.js +134 -15
  116. package/dist/scripts/_lib/agent_settings.js.map +1 -1
  117. package/dist/scripts/condense.js +147 -2
  118. package/dist/scripts/condense.js.map +1 -1
  119. package/dist/server/schemas/settings.js +6 -7
  120. package/dist/server/schemas/settings.js.map +1 -1
  121. package/dist/shared/settingsCarveOut.js +0 -9
  122. package/dist/shared/settingsCarveOut.js.map +1 -1
  123. package/dist/shared/settingsClasses.js +11 -9
  124. package/dist/shared/settingsClasses.js.map +1 -1
  125. package/dist/ui/assets/{index-DmR0mbk4.js → index-JDAF00bC.js} +2 -2
  126. package/dist/ui/assets/{index-DmR0mbk4.js.map → index-JDAF00bC.js.map} +1 -1
  127. package/dist/ui/index.html +1 -1
  128. package/docs/contracts/settings-classes.md +68 -17
  129. package/docs/guidelines/agent-infra/memory-access.md +14 -3
  130. package/package.json +1 -1
  131. package/src/agent-src/templates/AGENTS.md +8 -12
  132. package/src/config/agent-settings.template.yml +52 -66
  133. package/src/config/budgets.yml +29 -0
  134. package/src/config/discovery/packs.yml +11 -0
  135. package/src/config/discovery/workspaces.yml +1 -1
  136. package/src/config/evaluator-budgets.json +4 -4
  137. package/src/config/gate-coverage.yml +26 -0
  138. package/src/config/gate-violation-baselines.json +3 -3
  139. package/src/scripts/_cli/cmd_brand_status.ts +174 -0
  140. package/src/scripts/_cli/cmd_conformance.ts +14 -42
  141. package/src/scripts/_cli/cmd_doctor.ts +65 -48
  142. package/src/scripts/_cli/cmd_mcp_available.ts +266 -0
  143. package/src/scripts/_cli/cmd_packs_active.ts +225 -0
  144. package/src/scripts/_cli/cmd_settings_get.ts +324 -0
  145. package/src/scripts/_dispatch.bash +57 -0
  146. package/src/scripts/_lib/agent_settings.ts +140 -16
  147. package/src/scripts/_lib/auto_dispatch.corpus.test.ts +1 -1
  148. package/src/scripts/_lib/auto_dispatch.ts +23 -18
  149. package/src/scripts/_lib/capsule_trigger.ts +124 -0
  150. package/src/scripts/_lib/carrier_divergence.ts +135 -0
  151. package/src/scripts/_lib/host_capability.ts +144 -4
  152. package/src/scripts/_lib/judgment_ladder.ts +382 -0
  153. package/src/scripts/_lib/orchestration_gate.ts +8 -0
  154. package/src/scripts/_lib/orchestration_record.ts +37 -0
  155. package/src/scripts/_lib/orchestration_savings.ts +1 -1
  156. package/src/scripts/_lib/prompt_shape.ts +88 -0
  157. package/src/scripts/_lib/review_skipped_record.ts +102 -0
  158. package/src/scripts/_lib/rule_layer_overlap.ts +254 -0
  159. package/src/scripts/_lib/self_repair.ts +489 -0
  160. package/src/scripts/_lib/self_repair_store.ts +128 -0
  161. package/src/scripts/_lib/subagent_capsule.ts +182 -0
  162. package/src/scripts/_lib/subagent_response.ts +19 -0
  163. package/src/scripts/_lib/subagent_spawn.ts +13 -0
  164. package/src/scripts/_lib/subagent_steering.ts +9 -4
  165. package/src/scripts/_lib/tier_budget_routing.ts +6 -1
  166. package/src/scripts/_lib/transcript_entry.ts +80 -0
  167. package/src/scripts/_lib/worker_budget.ts +37 -2
  168. package/src/scripts/ai_council/clients.ts +76 -54
  169. package/src/scripts/ai_council/config.ts +94 -6
  170. package/src/scripts/ai_council/handoff.ts +113 -0
  171. package/src/scripts/ai_council/modes.ts +19 -4
  172. package/src/scripts/ai_council/orchestrator.ts +105 -0
  173. package/src/scripts/ai_council/quorum.ts +84 -0
  174. package/src/scripts/ai_council/session.ts +44 -0
  175. package/src/scripts/ai_council/transport_resolver.ts +127 -1
  176. package/src/scripts/ai_team/availability.ts +110 -0
  177. package/src/scripts/ai_team/config.ts +34 -14
  178. package/src/scripts/ai_team/team_dispatch.ts +71 -29
  179. package/src/scripts/bench_critic_protocol.ts +396 -0
  180. package/src/scripts/check_branch_freshness.ts +255 -0
  181. package/src/scripts/check_council_config_location.ts +125 -1
  182. package/src/scripts/check_detector_corpus.ts +202 -0
  183. package/src/scripts/check_hook_bundle_freshness.ts +4 -1
  184. package/src/scripts/check_standing_rule_delivery.ts +314 -0
  185. package/src/scripts/condense.ts +162 -2
  186. package/src/scripts/config/profiles.ts +13 -3
  187. package/src/scripts/conformance_scan.ts +272 -24
  188. package/src/scripts/council_availability_hook.ts +188 -0
  189. package/src/scripts/council_cli.ts +527 -32
  190. package/src/scripts/forensics_report.ts +333 -0
  191. package/src/scripts/hook_manifest.yaml +107 -26
  192. package/src/scripts/hooks/block_no_verify.ts +39 -2
  193. package/src/scripts/hooks/block_unauthorized_git.ts +156 -7
  194. package/src/scripts/hooks/concern_registry.ts +10 -0
  195. package/src/scripts/hooks/delegation_nudge_hook.ts +484 -0
  196. package/src/scripts/hooks/end_review_nudge_hook.ts +726 -0
  197. package/src/scripts/hooks/orchestration_record_hook.ts +342 -0
  198. package/src/scripts/install.ts +151 -0
  199. package/src/scripts/language_mirror_hook.ts +30 -37
  200. package/src/scripts/lint_discovery_vocabulary.ts +2 -0
  201. package/src/scripts/lint_never_silent.ts +276 -0
  202. package/src/scripts/lint_no_activation_gates.ts +271 -0
  203. package/src/scripts/measure_scope_dedup.ts +19 -13
  204. package/src/scripts/onboarding_gate_hook.ts +40 -1
  205. package/src/scripts/orchestration_record.ts +12 -1
  206. package/src/scripts/preamble_byte_census.ts +9 -20
  207. package/src/scripts/rebuild_hook_bundle.ts +177 -0
  208. package/src/scripts/release.ts +74 -2
  209. package/src/scripts/report_carrier_divergence.ts +364 -0
  210. package/src/scripts/report_skill_activation.ts +257 -0
  211. package/src/scripts/report_skill_obligation_violations.ts +579 -0
  212. package/src/scripts/routing_doctor.ts +95 -39
  213. package/src/scripts/score_skill_selection.ts +19 -5
  214. package/src/scripts/self_repair_cli.ts +470 -0
  215. package/src/scripts/self_repair_hook.ts +241 -0
  216. package/src/scripts/team_events_spike.ts +271 -0
  217. package/src/scripts/team_review_gate_hook.ts +31 -9
  218. package/src/server/schemas/settings.ts +10 -17
  219. package/src/shared/settingsCarveOut.ts +0 -10
  220. package/src/shared/settingsClasses.ts +11 -9
@@ -0,0 +1,270 @@
1
+ import { createRequire as __acCreateRequire } from 'node:module'; const require = globalThis.require ?? __acCreateRequire(import.meta.url);
2
+ import {
3
+ DEFAULT_PROJECT_FILE,
4
+ logger
5
+ } from "./chunk-LCFJIQ4J.js";
6
+
7
+ // src/scripts/config/profiles.ts
8
+ import * as fs2 from "node:fs";
9
+ import { createRequire } from "node:module";
10
+ import * as path2 from "node:path";
11
+
12
+ // src/scripts/_lib/agent_src.ts
13
+ import * as fs from "node:fs";
14
+ import * as path from "node:path";
15
+ import { fileURLToPath } from "node:url";
16
+ var _HERE = path.dirname(fileURLToPath(import.meta.url));
17
+ var _DEFAULT_ROOT = path.resolve(_HERE, "..", "..", "..");
18
+ function _deriveRoots(root) {
19
+ const packages = path.join(root, "packages");
20
+ const src = path.join(root, "src");
21
+ return {
22
+ ROOT: root,
23
+ LEGACY_SRC: path.join(root, ".agent-src.uncondensed"),
24
+ PACKAGES: packages,
25
+ PACKAGE_CORE: path.join(packages, "core"),
26
+ SRC: src,
27
+ SRC_SKILLS: path.join(src, "skills"),
28
+ SRC_RULES: path.join(src, "rules"),
29
+ SRC_AGENT: path.join(src, "agent-src"),
30
+ SRC_DOMAINS: path.join(src, "domains")
31
+ };
32
+ }
33
+ var _roots = _deriveRoots(_DEFAULT_ROOT);
34
+ function _isDir(p) {
35
+ try {
36
+ return fs.statSync(p).isDirectory();
37
+ } catch {
38
+ return false;
39
+ }
40
+ }
41
+ function _exists(p) {
42
+ try {
43
+ fs.statSync(p);
44
+ return true;
45
+ } catch {
46
+ return false;
47
+ }
48
+ }
49
+ function _iterdirSorted(p) {
50
+ let names;
51
+ try {
52
+ names = fs.readdirSync(p);
53
+ } catch {
54
+ return [];
55
+ }
56
+ names.sort();
57
+ return names.map((name) => path.join(p, name));
58
+ }
59
+ function artefact_roots() {
60
+ const roots = [];
61
+ if (_exists(_roots.LEGACY_SRC)) {
62
+ roots.push(_roots.LEGACY_SRC);
63
+ }
64
+ if (_exists(_roots.PACKAGES)) {
65
+ for (const pkg of _iterdirSorted(_roots.PACKAGES)) {
66
+ const sub = path.join(pkg, ".agent-src.uncondensed");
67
+ if (_isDir(sub)) {
68
+ roots.push(sub);
69
+ }
70
+ }
71
+ }
72
+ if (_isDir(_roots.SRC_AGENT)) {
73
+ roots.push(_roots.SRC_AGENT);
74
+ }
75
+ if (_isDir(_roots.SRC_SKILLS) || _isDir(_roots.SRC_RULES)) {
76
+ roots.push(_roots.SRC);
77
+ }
78
+ return roots;
79
+ }
80
+
81
+ // src/scripts/config/profiles.ts
82
+ var _require = createRequire(import.meta.url);
83
+ var PROFILE_ID_ENV = "AGENT_CONFIG_PROFILE_ID";
84
+ var DEFAULT_PROFILE_ID = "developer";
85
+ var PROFILES_DIRNAME = ".agent-src.uncondensed/profiles";
86
+ var SOURCE_PACK = "pack";
87
+ var SOURCE_USER = "user-settings";
88
+ var SOURCE_ENV = "env";
89
+ var SOURCE_RUNTIME = "runtime";
90
+ var SOURCE_DEFAULT = "default";
91
+ var SOURCE_MISSING = "missing";
92
+ var ResolvedProfile = class {
93
+ id;
94
+ audience;
95
+ preset_id;
96
+ packs;
97
+ personas;
98
+ skills_hint;
99
+ commands_hint;
100
+ docs_first_pointer;
101
+ source;
102
+ warning;
103
+ constructor(params) {
104
+ this.id = params.id;
105
+ this.audience = params.audience ?? {};
106
+ this.preset_id = params.preset_id ?? null;
107
+ this.packs = params.packs ?? [];
108
+ this.personas = params.personas ?? [];
109
+ this.skills_hint = params.skills_hint ?? [];
110
+ this.commands_hint = params.commands_hint ?? [];
111
+ this.docs_first_pointer = params.docs_first_pointer ?? null;
112
+ this.source = params.source ?? SOURCE_DEFAULT;
113
+ this.warning = params.warning ?? null;
114
+ }
115
+ };
116
+ var ProfileError = class extends Error {
117
+ constructor(message) {
118
+ super(message);
119
+ this.name = "ProfileError";
120
+ }
121
+ };
122
+ function _load_yaml(p) {
123
+ let YAML;
124
+ try {
125
+ YAML = _require("yaml");
126
+ } catch {
127
+ logger.info("PyYAML unavailable; profile %s returned empty", p);
128
+ return {};
129
+ }
130
+ let text;
131
+ try {
132
+ text = fs2.readFileSync(p, "utf-8");
133
+ } catch (exc) {
134
+ logger.warning("profile read failed for %s: %s", p, String(exc));
135
+ return {};
136
+ }
137
+ let data;
138
+ try {
139
+ data = YAML.parse(text, { version: "1.1" });
140
+ if (data === null || data === void 0) {
141
+ data = {};
142
+ }
143
+ } catch (exc) {
144
+ logger.warning("profile parse failed for %s: %s", p, String(exc));
145
+ return {};
146
+ }
147
+ return _isPlainDict(data) ? data : {};
148
+ }
149
+ function profile_file(project_root, profile_id) {
150
+ const legacy = path2.join(project_root, PROFILES_DIRNAME, `${profile_id}.yml`);
151
+ if (_exists2(legacy)) {
152
+ return legacy;
153
+ }
154
+ let roots;
155
+ try {
156
+ roots = artefact_roots();
157
+ } catch {
158
+ return legacy;
159
+ }
160
+ for (const root of roots) {
161
+ const candidate = path2.join(root, "profiles", `${profile_id}.yml`);
162
+ if (_exists2(candidate)) {
163
+ return candidate;
164
+ }
165
+ }
166
+ return legacy;
167
+ }
168
+ function _build_resolved(profile_id, raw, options) {
169
+ const block = _isPlainDict(raw["profile"]) ? raw["profile"] : {};
170
+ const audience_raw = _isPlainDict(block["audience"]) ? block["audience"] : {};
171
+ const defaults = _isPlainDict(block["defaults"]) ? block["defaults"] : {};
172
+ const surface = _isPlainDict(block["surface"]) ? block["surface"] : {};
173
+ const audience = {};
174
+ for (const k of Object.keys(audience_raw)) {
175
+ audience[String(k)] = String(audience_raw[k]);
176
+ }
177
+ const packs = _strTuple(block["packs"]);
178
+ const personas = _strTuple(defaults["personas"]);
179
+ const skills_hint = _strTuple(defaults["skills_hint"]);
180
+ const commands_hint = _strTuple(surface["commands_hint"]);
181
+ const docs_pointer = surface["docs_first_pointer"];
182
+ return new ResolvedProfile({
183
+ id: profile_id,
184
+ audience,
185
+ preset_id: defaults["preset_id"] ?? null,
186
+ packs,
187
+ personas,
188
+ skills_hint,
189
+ commands_hint,
190
+ docs_first_pointer: docs_pointer ? String(docs_pointer) : null,
191
+ source: options.source,
192
+ warning: options.warning ?? null
193
+ });
194
+ }
195
+ function _pick_id(pack_profile_id, user_settings, runtime_id) {
196
+ if (runtime_id) {
197
+ return [runtime_id, SOURCE_RUNTIME];
198
+ }
199
+ const env_id = process.env[PROFILE_ID_ENV];
200
+ if (env_id) {
201
+ return [env_id, SOURCE_ENV];
202
+ }
203
+ const block = _isPlainDict(user_settings) ? user_settings["profile"] : void 0;
204
+ if (_isPlainDict(block) && block["id"]) {
205
+ return [String(block["id"]), SOURCE_USER];
206
+ }
207
+ if (pack_profile_id) {
208
+ return [pack_profile_id, SOURCE_PACK];
209
+ }
210
+ return [null, SOURCE_MISSING];
211
+ }
212
+ function resolve_profile(params) {
213
+ const settings = params.user_settings ?? {};
214
+ const settings_file = path2.join(params.project_root, DEFAULT_PROJECT_FILE);
215
+ const [profile_id, source] = _pick_id(
216
+ params.pack_profile_id ?? null,
217
+ settings,
218
+ params.runtime_id ?? null
219
+ );
220
+ if (profile_id === null) {
221
+ if (_exists2(settings_file)) {
222
+ return new ResolvedProfile({
223
+ id: DEFAULT_PROFILE_ID,
224
+ source: SOURCE_MISSING,
225
+ warning: "no profile.id in .agent-settings.yml \u2014 run /onboard to pick an audience deliberately"
226
+ });
227
+ }
228
+ return _build_resolved(
229
+ DEFAULT_PROFILE_ID,
230
+ _load_yaml(profile_file(params.project_root, DEFAULT_PROFILE_ID)),
231
+ { source: SOURCE_DEFAULT }
232
+ );
233
+ }
234
+ const yaml_path = profile_file(params.project_root, profile_id);
235
+ if (!_exists2(yaml_path)) {
236
+ throw new ProfileError(
237
+ `profile.id=${_repr(profile_id)} (${source}) but ${yaml_path} not found`
238
+ );
239
+ }
240
+ return _build_resolved(profile_id, _load_yaml(yaml_path), { source });
241
+ }
242
+ function _exists2(p) {
243
+ try {
244
+ fs2.statSync(p);
245
+ return true;
246
+ } catch {
247
+ return false;
248
+ }
249
+ }
250
+ function _isPlainDict(value) {
251
+ return typeof value === "object" && value !== null && !Array.isArray(value) && !(value instanceof Map);
252
+ }
253
+ function _strTuple(value) {
254
+ if (!Array.isArray(value)) {
255
+ return [];
256
+ }
257
+ return value.map((v) => String(v));
258
+ }
259
+ function _repr(s) {
260
+ return `'${s.replace(/\\/g, "\\\\").replace(/'/g, "\\'")}'`;
261
+ }
262
+
263
+ export {
264
+ artefact_roots,
265
+ PROFILE_ID_ENV,
266
+ SOURCE_MISSING,
267
+ ProfileError,
268
+ profile_file,
269
+ resolve_profile
270
+ };
@@ -68,19 +68,42 @@ var USER_GLOBAL_FILENAME = "agent-settings.yml";
68
68
  function DEFAULT_USER_GLOBAL_FILE() {
69
69
  return write_target(USER_GLOBAL_FILENAME);
70
70
  }
71
- function _resolve_user_global_file() {
72
- const found = resolve_with_fallback(USER_GLOBAL_FILENAME);
73
- if (found !== null) {
74
- return found;
71
+ var USER_GLOBAL_CANONICAL_RELATIVE = "settings/.agent-settings.yml";
72
+ function user_global_settings_paths() {
73
+ const paths = [];
74
+ const flat = resolve_with_fallback(USER_GLOBAL_FILENAME);
75
+ if (flat !== null) {
76
+ paths.push(flat);
77
+ }
78
+ const canonical = resolve_with_fallback(USER_GLOBAL_CANONICAL_RELATIVE);
79
+ if (canonical !== null) {
80
+ paths.push(canonical);
81
+ }
82
+ if (paths.length === 0) {
83
+ paths.push(DEFAULT_USER_GLOBAL_FILE());
75
84
  }
76
- return DEFAULT_USER_GLOBAL_FILE();
85
+ return paths;
77
86
  }
78
87
  var MERGEABLE_KEYS = [
88
+ // `name`, `ide` and `personal.bot_icon` are the PRE-MIGRATION spellings.
89
+ // `install.ts` migrates `ide` → `personal.ide` and `pr_comment_bot_icon`
90
+ // into its `personal.` home, and this list was never moved with them — so
91
+ // the whitelist named keys the template does not have while the keys it
92
+ // does have were filtered out silently. A user setting either preference
93
+ // user-globally got no error, no warning, and no effect
94
+ // (road-to-capability-answerability 4.3, ADR-219).
95
+ //
96
+ // Both spellings are listed rather than replaced: a legacy file that still
97
+ // uses the old name keeps working, and nothing that resolved before
98
+ // resolves differently. `name` has no reader anywhere and no template key;
99
+ // it is kept only so this change stays purely additive.
79
100
  "name",
80
101
  "ide",
102
+ "personal.ide",
81
103
  "rule_loading_tier",
82
104
  "memory.cadence",
83
105
  "personal.bot_icon",
106
+ "personal.pr_comment_bot_icon",
84
107
  "personal.autonomy",
85
108
  "telegraph.speak_scope",
86
109
  // Knowledge-card global cross-project sharing is a USER-GLOBAL setting
@@ -363,7 +386,10 @@ function load_agent_settings(options = {}) {
363
386
  const user_global_path = options.user_global_path ?? null;
364
387
  const verbose = options.verbose ?? false;
365
388
  const cwd = options.cwd ?? null;
366
- const user_global_raw = _read_yaml(user_global_path ? user_global_path : _resolve_user_global_file()) ?? {};
389
+ const user_global_raw = {};
390
+ for (const p of user_global_path ? [user_global_path] : user_global_settings_paths()) {
391
+ _deep_merge(user_global_raw, _read_yaml(p) ?? {});
392
+ }
367
393
  const [user_global_filtered, ignored] = _filter_whitelist(user_global_raw, MERGEABLE_KEYS);
368
394
  if (verbose && ignored.length > 0) {
369
395
  logger.info(
@@ -380,8 +406,61 @@ function load_agent_settings(options = {}) {
380
406
  _deep_merge(merged, layer);
381
407
  }
382
408
  }
409
+ _warn_removed_always_on_keys(merged);
383
410
  return merged;
384
411
  }
412
+ var REMOVED_ALWAYS_ON_KEYS = [
413
+ "subagents.enabled",
414
+ "subagents.auto",
415
+ "subagents.host_capabilities",
416
+ "subagents.budget_routing",
417
+ "ai_team.enabled"
418
+ ];
419
+ var _warnedRemovedAlwaysOnKeys = /* @__PURE__ */ new Set();
420
+ function _readDottedSettingsPath(root, dotted) {
421
+ let node = root;
422
+ for (const part of dotted.split(".")) {
423
+ if (typeof node !== "object" || node === null || Array.isArray(node)) {
424
+ return void 0;
425
+ }
426
+ node = node[part];
427
+ }
428
+ return node;
429
+ }
430
+ function _warn_removed_always_on_keys(merged) {
431
+ for (const key of REMOVED_ALWAYS_ON_KEYS) {
432
+ if (_warnedRemovedAlwaysOnKeys.has(key)) {
433
+ continue;
434
+ }
435
+ if (_readDottedSettingsPath(merged, key) === void 0) {
436
+ continue;
437
+ }
438
+ _warnedRemovedAlwaysOnKeys.add(key);
439
+ process.stderr.write(`${key} was removed (always-on orchestration); ignored.
440
+ `);
441
+ }
442
+ }
443
+ function* iter_setting_overrides(options = {}) {
444
+ const project_path = options.project_path ?? null;
445
+ const user_global_path = options.user_global_path ?? null;
446
+ const cwd = options.cwd ?? null;
447
+ for (const p of user_global_path ? [user_global_path] : user_global_settings_paths()) {
448
+ const raw = _read_yaml(p) ?? {};
449
+ const [filtered] = _filter_whitelist(raw, MERGEABLE_KEYS);
450
+ for (const key of _leaf_paths(filtered)) {
451
+ yield [key, _get_dotted(filtered, key), p];
452
+ }
453
+ }
454
+ for (const p of _resolve_cascade_paths(cwd, project_path)) {
455
+ const layer = _read_yaml(p);
456
+ if (!layer || Object.keys(layer).length === 0) {
457
+ continue;
458
+ }
459
+ for (const key of _leaf_paths(layer)) {
460
+ yield [key, _get_dotted(layer, key), p];
461
+ }
462
+ }
463
+ }
385
464
  function _read_yaml(p) {
386
465
  if (!_is_file(p)) {
387
466
  return null;
@@ -491,6 +570,8 @@ export {
491
570
  LOCAL_PROJECT_FILE,
492
571
  LOCAL_PROJECT_SUBDIR,
493
572
  project_settings_path,
573
+ USER_GLOBAL_FILENAME,
574
+ MERGEABLE_KEYS,
494
575
  find_project_root_with_anchor,
495
576
  find_project_root,
496
577
  find_project_root_with_trace,
@@ -498,5 +579,6 @@ export {
498
579
  ROOT_OVERRIDE_ENV,
499
580
  ProjectRootError,
500
581
  resolve_project_root,
501
- load_agent_settings
582
+ load_agent_settings,
583
+ iter_setting_overrides
502
584
  };
@@ -343,6 +343,7 @@ function _build_config(raw, source_path) {
343
343
  const cli_call_budget = _build_cli_call_budget(
344
344
  _asDict(_getOr(raw, "cli_call_budget", {}))
345
345
  );
346
+ const quorum = _build_quorum(_get(raw, "quorum", "majority"));
346
347
  const necessity_classifier = _build_necessity_classifier(
347
348
  _asDict(_getOr(raw, "necessity_classifier", {}))
348
349
  );
@@ -368,6 +369,7 @@ function _build_config(raw, source_path) {
368
369
  "debate_gates"
369
370
  );
370
371
  const restate = _build_restate(_asDict(_getOr(raw, "restate", {})), "restate");
372
+ const critic_protocol = _build_critic_protocol(_getOr(raw, "critic_protocol", "legacy"));
371
373
  const decision_resolution = _build_decision_resolution(
372
374
  _asDict(_getOr(raw, "decision_resolution", {}))
373
375
  );
@@ -389,6 +391,7 @@ function _build_config(raw, source_path) {
389
391
  advisors,
390
392
  consensus_scoring: consensus,
391
393
  cli_call_budget,
394
+ quorum,
392
395
  necessity_classifier,
393
396
  model_downgrade,
394
397
  debate,
@@ -397,6 +400,7 @@ function _build_config(raw, source_path) {
397
400
  chairman,
398
401
  debate_gates,
399
402
  restate,
403
+ critic_protocol,
400
404
  decision_resolution,
401
405
  routing,
402
406
  low_impact,
@@ -598,6 +602,16 @@ function _build_restate(d, scope) {
598
602
  }
599
603
  return { enabled: Boolean(enabled) };
600
604
  }
605
+ var _VALID_CRITIC_PROTOCOLS = /* @__PURE__ */ new Set(["legacy", "load_bearing"]);
606
+ function _build_critic_protocol(v) {
607
+ if (v === void 0 || v === null) return "legacy";
608
+ if (!(_isStr(v) && _VALID_CRITIC_PROTOCOLS.has(v))) {
609
+ throw new CouncilConfigError(
610
+ `\`critic_protocol\`=${_pyRepr(v)} not in ${_sortedListRepr(_VALID_CRITIC_PROTOCOLS)}.`
611
+ );
612
+ }
613
+ return v;
614
+ }
601
615
  var _VALID_RESOLUTION_MODES = /* @__PURE__ */ new Set([
602
616
  "agent",
603
617
  "council",
@@ -873,7 +887,7 @@ function _build_defaults(d) {
873
887
  if (!_isDict(d)) {
874
888
  throw new CouncilConfigError("`defaults` must be a mapping.");
875
889
  }
876
- const mode = _get(d, "mode", "api");
890
+ const mode = _get(d, "mode", "auto");
877
891
  if (!(_isStr(mode) && _VALID_MODES.has(mode))) {
878
892
  throw new CouncilConfigError(
879
893
  `defaults.mode=${_pyRepr(mode)} not in ${_sortedListRepr(_VALID_MODES)}.`
@@ -1035,7 +1049,7 @@ function _build_cost_budget(d) {
1035
1049
  }
1036
1050
  return cb;
1037
1051
  }
1038
- function _build_member(name, cfg, default_mode = "api") {
1052
+ function _build_member(name, cfg, default_mode = "auto") {
1039
1053
  if (!_VALID_PROVIDERS.has(name)) {
1040
1054
  throw new CouncilConfigError(
1041
1055
  `members.${name}: unknown provider; valid: ${_sortedListRepr(_VALID_PROVIDERS)}.`
@@ -1152,6 +1166,7 @@ function _build_member(name, cfg, default_mode = "api") {
1152
1166
  prompt_cache_ttl
1153
1167
  };
1154
1168
  }
1169
+ var _DEFAULT_CLI_CALLS_PER_DAY = 50;
1155
1170
  function _build_cli_call_budget(d) {
1156
1171
  if (!_isDict(d)) {
1157
1172
  throw new CouncilConfigError("`cli_call_budget` must be a mapping.");
@@ -1163,6 +1178,9 @@ function _build_cli_call_budget(d) {
1163
1178
  );
1164
1179
  }
1165
1180
  const caps = /* @__PURE__ */ new Map();
1181
+ for (const provider of _VALID_PROVIDERS) {
1182
+ caps.set(provider, _DEFAULT_CLI_CALLS_PER_DAY);
1183
+ }
1166
1184
  for (const [provider, value] of Object.entries(raw_caps)) {
1167
1185
  if (!_VALID_PROVIDERS.has(provider)) {
1168
1186
  throw new CouncilConfigError(
@@ -1190,6 +1208,17 @@ function _build_cli_call_budget(d) {
1190
1208
  }
1191
1209
  return { max_calls_per_day: caps, warn_at };
1192
1210
  }
1211
+ function _build_quorum(raw) {
1212
+ if (raw === "majority") {
1213
+ return "majority";
1214
+ }
1215
+ if (_isInt(raw) && !_isBool(raw) && raw >= 1) {
1216
+ return raw;
1217
+ }
1218
+ throw new CouncilConfigError(
1219
+ `\`quorum\`=${_pyRepr(raw)} must be 'majority' or an integer >= 1 (got ${_pyTypeName(raw)}).`
1220
+ );
1221
+ }
1193
1222
  function _build_advisor(name, cfg) {
1194
1223
  if (!_isDict(cfg)) {
1195
1224
  throw new CouncilConfigError(`advisors.${name}: must be a mapping.`);
@@ -4355,18 +4355,9 @@ var settingsSchema = external_exports.object({
4355
4355
  }).default({})
4356
4356
  }).default({}),
4357
4357
  subagents: external_exports.object({
4358
- enabled: external_exports.boolean().default(true).describe(
4359
- "Global master switch for the subagent layer. true (default) = available; false = fully disabled (the canonical kill-switch \u2014 no auto-dispatch, no routing, everything runs in-session)."
4360
- ),
4361
- auto: external_exports.enum(["off", "ask", "on"]).default("on").describe(
4362
- "Automatic-dispatch mode. off = subagents only via explicit command. ask = classify the task and ask once before dispatching. on = auto-dispatch delegable tasks (surface the choice in one line). Shipped default is on on subagent-capable hosts (flipped from ask 2026-07-09, ADR-117), off elsewhere; no-op where the host has no subagent primitive."
4363
- ),
4364
4358
  downshift: external_exports.boolean().default(true).describe(
4365
4359
  "Route delegable sub-tasks to the lowest-capable model tier (cost + speed via model downshift). false = every subagent runs on the session tier."
4366
4360
  ),
4367
- budget_routing: external_exports.enum(["ask", "auto", "off"]).default("ask").describe(
4368
- "Budget-aware cheap-request delegation (docs/contracts/budget-routing.md): pick the cheapest classifier-adequate tier WITH available budget (cost.budgets.per_tier); cheap exhausted but strong funded \u2192 strong tier; all exhausted \u2192 session model + notice. Work is never blocked to save money; the session model is never switched (delegation with a model override). ask = confirm the first budget-motivated downshift per session (default). auto = apply silently with telemetry. off = today's behavior (single-flip rollback). Distinct from downshift: that is the quality/cost knob, this is the resource-availability gate."
4369
- ),
4370
4361
  quota_arbitrage: external_exports.boolean().default(true).describe(
4371
4362
  "Prefer a separate quota-pool model for delegable sub-tasks where the host manifest reports one. Optional bonus only \u2014 identical behaviour (minus the quota win) where unsupported. Never load-bearing."
4372
4363
  ),
@@ -4377,9 +4368,6 @@ var settingsSchema = external_exports.object({
4377
4368
  }).default({}).describe(
4378
4369
  "Per-tier model map for downshift routing. Each empty value uses the tier runtime default (no vendor model baked in)."
4379
4370
  ),
4380
- host_capabilities: external_exports.object({}).passthrough().default({}).describe(
4381
- "Optional override of the host-capability manifest (subagent_spawn / parallel_spawn / status_polling / separate_quota_pool). Any field set wins; omitted fields fall back to the all-false safe default. Empty = the agent resolves the manifest from host knowledge."
4382
- ),
4383
4371
  implementer_model: external_exports.string().default("").describe(
4384
4372
  "Override the model the orchestrator dispatches to subagents that write code (e.g. claude-sonnet-4, gpt-5). Empty (default) = inherit the session's primary model \u2014 cheapest and usually right."
4385
4373
  ),
@@ -4399,14 +4387,11 @@ var settingsSchema = external_exports.object({
4399
4387
  )
4400
4388
  }),
4401
4389
  ai_team: external_exports.object({
4402
- enabled: external_exports.boolean().default(false).describe(
4403
- "Master switch for the /team cross-model review family (docs/contracts/ai-team-config.md). false (default) = commands are never suggested and every invocation refuses with an enable pointer. true = the family is live; individual gates (allow_delegate) still apply."
4404
- ),
4405
4390
  model: external_exports.string().default("auto").describe(
4406
4391
  "Model handed to the codex CLI. 'auto' (default) = pass no --model flag so the CLI's own default applies \u2014 tracks the subscription's current strongest model instead of pinning a stale ID. Any other value passes through verbatim as `--model <value>`."
4407
4392
  ),
4408
4393
  allow_delegate: external_exports.boolean().default(false).describe(
4409
- "Second opt-in for the only wrapper that delegates write access (/team:delegate). false (default) = delegate refuses even when ai_team.enabled is true. Both keys must be true before delegation is reachable."
4394
+ "Second opt-in for the only wrapper that delegates write access (/team:delegate). false (default) = delegate refuses even when /team itself is available. Availability (codex CLI installed + authenticated) is necessary but not sufficient \u2014 this key must ALSO be true before delegation is reachable."
4410
4395
  ),
4411
4396
  max_calls_per_day: external_exports.number().int().min(0).default(50).describe(
4412
4397
  "Per-day cap on team calls, read against the EXISTING cli_call_budget openai bucket (~/.event4u/agent-config/cli-calls.json, daily UTC reset) \u2014 one subscription, one counter, never a parallel count. 0 = block all team calls."
@@ -4422,7 +4407,15 @@ var settingsSchema = external_exports.object({
4422
4407
  "Circuit-breaker bound: after this many CONSECUTIVE BLOCK verdicts in one session, a visible notice is injected exactly once and the managed layer stops re-blocking \u2014 the user decides, never an infinite Claude\u2194Codex loop. An ALLOW verdict resets the counter. Positive integer."
4423
4408
  )
4424
4409
  }).default({ managed: false, max_consecutive_blocks: 3 })
4425
- }).default({ enabled: false, model: "auto", allow_delegate: false, max_calls_per_day: 50, suppress_setup_hint: false, review_gate: { managed: false, max_consecutive_blocks: 3 } }),
4410
+ }).default({ model: "auto", allow_delegate: false, max_calls_per_day: 50, suppress_setup_hint: false, review_gate: { managed: false, max_consecutive_blocks: 3 } }),
4411
+ emergency: external_exports.object({
4412
+ orchestration_halt: external_exports.boolean().default(false).describe(
4413
+ "The one audited incident switch over the always-on orchestration stack (subagents, council, team). NOT an activation gate: false (default) = the stack runs normally. true = halted; arming requires no ceremony. Disarming (returning to false) requires orchestration_halt_justification to be a non-empty string. Both transitions emit one telemetry line."
4414
+ ),
4415
+ orchestration_halt_justification: external_exports.string().default("").describe(
4416
+ "Required non-empty before orchestration_halt may return to false. Ignored while arming the halt."
4417
+ )
4418
+ }).default({ orchestration_halt: false, orchestration_halt_justification: "" }),
4426
4419
  onboarding: external_exports.object({
4427
4420
  onboarded: external_exports.boolean().default(false).describe(
4428
4421
  "Set to true once the developer has completed `agent-config setup`. The onboarding-gate rule blocks the first turn of every chat until this is true. Toggle back to false to re-trigger the wizard."
@@ -1,10 +1,10 @@
1
1
  import { createRequire as __acCreateRequire } from 'node:module'; const require = globalThis.require ?? __acCreateRequire(import.meta.url);
2
+ import {
3
+ resolve_project_root
4
+ } from "./chunk-LCFJIQ4J.js";
2
5
  import {
3
6
  resolvePackageRoot
4
7
  } from "./chunk-MCJYCQPF.js";
5
- import {
6
- resolve_project_root
7
- } from "./chunk-HJ6DAJHR.js";
8
8
 
9
9
  // src/scripts/_cli/cmd_migrate.ts
10
10
  import { spawnSync } from "node:child_process";