@event4u/agent-config 9.28.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 (147) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/AGENTS.md +6 -6
  3. package/CHANGELOG.md +66 -0
  4. package/README.md +1 -1
  5. package/agents/templates/.ai-council.yml.example +55 -24
  6. package/dist/agent-src/commands/cost/report.md +2 -2
  7. package/dist/agent-src/commands/team/adversarial.md +8 -7
  8. package/dist/agent-src/commands/team/delegate.md +13 -12
  9. package/dist/agent-src/commands/team/review.md +9 -8
  10. package/dist/agent-src/commands/team/status.md +9 -8
  11. package/dist/agent-src/commands/team.md +29 -19
  12. package/dist/agent-src/contexts/execution/auto-dispatch-classification.md +88 -2
  13. package/dist/agent-src/contexts/execution/auto-orchestration-activation.md +29 -21
  14. package/dist/agent-src/contexts/execution/host-capability-manifest.md +26 -15
  15. package/dist/agent-src/contexts/execution/orchestration-telemetry.md +18 -0
  16. package/dist/agent-src/contexts/execution/subagent-response-contract.md +54 -0
  17. package/dist/agent-src/contexts/execution/subagent-routing.md +13 -11
  18. package/dist/agent-src/contexts/execution/subagent-spawn-contract.md +25 -0
  19. package/dist/agent-src/contexts/execution/subagent-steering.md +6 -3
  20. package/dist/agent-src/rules/delegation-policy.md +11 -7
  21. package/dist/agent-src/rules/settings-ask-protocol.md +8 -7
  22. package/dist/agent-src/rules/token-budget-discipline.md +1 -1
  23. package/dist/agent-src/skills/forensics-report/SKILL.md +114 -0
  24. package/dist/agent-src/skills/forensics-report/evals/triggers.json +17 -0
  25. package/dist/agent-src/skills/premortem/SKILL.md +30 -1
  26. package/dist/agent-src/skills/reasoning-orchestrator/SKILL.md +2 -1
  27. package/dist/agent-src/skills/subagent-orchestration/SKILL.md +7 -5
  28. package/dist/agent-src/skills/subagent-orchestration/schemas/subagent-status.json +61 -3
  29. package/dist/agent-src/skills/test-case-discovery/SKILL.md +1 -1
  30. package/dist/agent-src/templates/AGENTS.md +4 -4
  31. package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
  32. package/dist/agent-src/templates/roadmaps.md +23 -0
  33. package/dist/cli-delegate/{chunk-22GCIJ2O.js → chunk-66OVWGB5.js} +1 -1
  34. package/dist/cli-delegate/{chunk-GB2FSUEE.js → chunk-LCFJIQ4J.js} +32 -0
  35. package/dist/cli-delegate/{chunk-VSYT7OHO.js → chunk-LVRYBKTI.js} +31 -2
  36. package/dist/cli-delegate/{chunk-DVRS2KVR.js → chunk-MMXA5GY7.js} +10 -17
  37. package/dist/cli-delegate/{chunk-JXARCGVN.js → chunk-MP3JT3IU.js} +1 -1
  38. package/dist/cli-delegate/{chunk-PQSAQKHW.js → chunk-NZ5N2XQL.js} +3 -3
  39. package/dist/cli-delegate/{chunk-7OMQCH4V.js → chunk-OJM3MBJM.js} +1 -1
  40. package/dist/cli-delegate/{chunk-2BE5I2MN.js → chunk-RCIA67XN.js} +111 -90
  41. package/dist/cli-delegate/cmd_analyze_session.js +1 -1
  42. package/dist/cli-delegate/cmd_brand_status.js +1 -1
  43. package/dist/cli-delegate/cmd_conformance.js +6 -43
  44. package/dist/cli-delegate/cmd_doctor.js +9 -5
  45. package/dist/cli-delegate/cmd_explain.js +2 -2
  46. package/dist/cli-delegate/cmd_export.js +4 -4
  47. package/dist/cli-delegate/cmd_handoff.js +3 -3
  48. package/dist/cli-delegate/cmd_mcp_available.js +1 -1
  49. package/dist/cli-delegate/cmd_migrate.js +2 -2
  50. package/dist/cli-delegate/cmd_packs_active.js +2 -2
  51. package/dist/cli-delegate/cmd_prune.js +4 -4
  52. package/dist/cli-delegate/cmd_route_audit.js +2 -2
  53. package/dist/cli-delegate/cmd_route_explain.js +1 -1
  54. package/dist/cli-delegate/cmd_settings_get.js +1 -7
  55. package/dist/cli-delegate/cmd_settings_migrate.js +4 -4
  56. package/dist/cli-delegate/cmd_settings_set.js +1 -1
  57. package/dist/cli-delegate/cmd_sync.js +4 -4
  58. package/dist/cli-delegate/cmd_uninstall.js +4 -4
  59. package/dist/cli-delegate/cmd_update.js +1 -1
  60. package/dist/cli-delegate/cmd_upgrade.js +1 -1
  61. package/dist/cli-delegate/cmd_validate.js +4 -4
  62. package/dist/cli-delegate/cmd_versions.js +1 -1
  63. package/dist/discovery/deprecation-report.md +1 -1
  64. package/dist/discovery/discovery-manifest.json +69 -20
  65. package/dist/discovery/discovery-manifest.json.sha256 +1 -1
  66. package/dist/discovery/discovery-manifest.summary.md +3 -2
  67. package/dist/discovery/orphan-report.md +1 -1
  68. package/dist/discovery/packs.json +39 -2
  69. package/dist/discovery/trust-report.md +2 -2
  70. package/dist/discovery/workspaces.json +12 -4
  71. package/dist/hooks/dispatch.js +373 -35
  72. package/dist/install/install.mjs +42 -17
  73. package/dist/mcp/registry-manifest.json +2 -2
  74. package/dist/mcp/server.json +2 -2
  75. package/dist/mcp/server.mjs +651 -262
  76. package/dist/router.json +1 -1
  77. package/dist/scripts/_lib/agent_settings.js +54 -0
  78. package/dist/scripts/_lib/agent_settings.js.map +1 -1
  79. package/dist/scripts/condense.js +147 -2
  80. package/dist/scripts/condense.js.map +1 -1
  81. package/dist/server/schemas/settings.js +6 -7
  82. package/dist/server/schemas/settings.js.map +1 -1
  83. package/dist/shared/settingsCarveOut.js +0 -9
  84. package/dist/shared/settingsCarveOut.js.map +1 -1
  85. package/dist/shared/settingsClasses.js +11 -9
  86. package/dist/shared/settingsClasses.js.map +1 -1
  87. package/dist/ui/assets/{index-DmR0mbk4.js → index-JDAF00bC.js} +2 -2
  88. package/dist/ui/assets/{index-DmR0mbk4.js.map → index-JDAF00bC.js.map} +1 -1
  89. package/dist/ui/index.html +1 -1
  90. package/docs/contracts/settings-classes.md +39 -9
  91. package/package.json +1 -1
  92. package/src/agent-src/templates/AGENTS.md +4 -4
  93. package/src/config/agent-settings.template.yml +52 -66
  94. package/src/config/discovery/packs.yml +11 -0
  95. package/src/config/discovery/workspaces.yml +1 -1
  96. package/src/config/gate-violation-baselines.json +3 -3
  97. package/src/scripts/_cli/cmd_conformance.ts +14 -42
  98. package/src/scripts/_cli/cmd_doctor.ts +65 -48
  99. package/src/scripts/_lib/agent_settings.ts +58 -0
  100. package/src/scripts/_lib/auto_dispatch.corpus.test.ts +1 -1
  101. package/src/scripts/_lib/auto_dispatch.ts +23 -18
  102. package/src/scripts/_lib/capsule_trigger.ts +124 -0
  103. package/src/scripts/_lib/host_capability.ts +63 -6
  104. package/src/scripts/_lib/judgment_ladder.ts +382 -0
  105. package/src/scripts/_lib/orchestration_gate.ts +8 -0
  106. package/src/scripts/_lib/orchestration_record.ts +37 -0
  107. package/src/scripts/_lib/orchestration_savings.ts +1 -1
  108. package/src/scripts/_lib/self_repair.ts +160 -13
  109. package/src/scripts/_lib/self_repair_store.ts +28 -0
  110. package/src/scripts/_lib/subagent_capsule.ts +182 -0
  111. package/src/scripts/_lib/subagent_response.ts +19 -0
  112. package/src/scripts/_lib/subagent_spawn.ts +13 -0
  113. package/src/scripts/_lib/subagent_steering.ts +9 -4
  114. package/src/scripts/_lib/tier_budget_routing.ts +6 -1
  115. package/src/scripts/_lib/worker_budget.ts +37 -2
  116. package/src/scripts/ai_council/clients.ts +76 -54
  117. package/src/scripts/ai_council/config.ts +94 -6
  118. package/src/scripts/ai_council/handoff.ts +113 -0
  119. package/src/scripts/ai_council/modes.ts +19 -4
  120. package/src/scripts/ai_council/orchestrator.ts +105 -0
  121. package/src/scripts/ai_council/quorum.ts +84 -0
  122. package/src/scripts/ai_council/session.ts +44 -0
  123. package/src/scripts/ai_council/transport_resolver.ts +127 -1
  124. package/src/scripts/ai_team/availability.ts +110 -0
  125. package/src/scripts/ai_team/config.ts +34 -14
  126. package/src/scripts/ai_team/team_dispatch.ts +71 -29
  127. package/src/scripts/bench_critic_protocol.ts +396 -0
  128. package/src/scripts/check_detector_corpus.ts +202 -0
  129. package/src/scripts/check_hook_bundle_freshness.ts +4 -1
  130. package/src/scripts/condense.ts +162 -2
  131. package/src/scripts/council_cli.ts +401 -25
  132. package/src/scripts/forensics_report.ts +333 -0
  133. package/src/scripts/hooks/delegation_nudge_hook.ts +69 -35
  134. package/src/scripts/lint_discovery_vocabulary.ts +2 -0
  135. package/src/scripts/lint_never_silent.ts +276 -0
  136. package/src/scripts/lint_no_activation_gates.ts +271 -0
  137. package/src/scripts/orchestration_record.ts +8 -0
  138. package/src/scripts/rebuild_hook_bundle.ts +177 -0
  139. package/src/scripts/release.ts +74 -2
  140. package/src/scripts/routing_doctor.ts +21 -36
  141. package/src/scripts/score_skill_selection.ts +19 -5
  142. package/src/scripts/self_repair_cli.ts +287 -57
  143. package/src/scripts/team_events_spike.ts +271 -0
  144. package/src/scripts/team_review_gate_hook.ts +31 -9
  145. package/src/server/schemas/settings.ts +10 -17
  146. package/src/shared/settingsCarveOut.ts +0 -10
  147. package/src/shared/settingsClasses.ts +11 -9
@@ -3,14 +3,36 @@
3
3
  * Team Review-Gate governance — `stop` concern (road-to-team-mode Phase 4).
4
4
  *
5
5
  * Minimal call-site for `src/scripts/ai_team/review_gate.ts`. On Stop it
6
- * reads the dispatcher envelope, and — ONLY when `ai_team.enabled` AND
7
- * `ai_team.review_gate.managed` are true — locates the newest stop-gate
8
- * review job the codex plugin persisted for this session, parses its
9
- * first-line ALLOW/BLOCK contract, applies the consecutive-BLOCK counter,
10
- * and prints the circuit-breaker notice (exactly once per trip) to stdout
11
- * for the dispatch layer to render. With `managed: false` (default) the
12
- * hook exits 0 without touching anything — byte-identical pre-Phase-4
13
- * Stop behavior.
6
+ * reads the dispatcher envelope, and — ONLY when `ai_team.review_gate.managed`
7
+ * is true — locates the newest stop-gate review job the codex plugin
8
+ * persisted for this session, parses its first-line ALLOW/BLOCK contract,
9
+ * applies the consecutive-BLOCK counter, and prints the circuit-breaker
10
+ * notice (exactly once per trip) to stdout for the dispatch layer to
11
+ * render. With `managed: false` (default) the hook exits 0 without
12
+ * touching anything — byte-identical pre-Phase-4 Stop behavior.
13
+ *
14
+ * `ai_team.enabled` was DELETED (road-to-always-on-orchestration Phase 1,
15
+ * Step 1.3) — `managed` was previously double-gated behind it, but the two
16
+ * keys govern independent things: `managed` governs the codex PLUGIN's own
17
+ * Stop-hook loop (upstream's mechanism, which does not depend on our codex
18
+ * CLI availability), while `/team`'s own availability is a separate,
19
+ * CLI-resolved fact (`src/scripts/ai_team/availability.ts`) that the
20
+ * conversational `/team` wrappers check, not this passive Stop hook. So the
21
+ * two keys are decoupled: `managed` stands alone.
22
+ *
23
+ * DELIBERATELY NOT GATED ON `emergency.orchestration_halt` (independent
24
+ * review, road-to-always-on-orchestration): unlike `/team`'s own
25
+ * conversational surfaces (`assert_delegate_allowed` / `run_team_review` in
26
+ * `ai_team/team_dispatch.ts`, both of which check `isOrchestrationHalted`
27
+ * before doing anything), this hook never reads that switch. This is
28
+ * intentional, not an oversight — `managed` governs the UPSTREAM codex
29
+ * plugin's OWN Stop-hook loop, a third-party mechanism this hook merely
30
+ * observes and reports on (parsing an already-persisted job record); it
31
+ * never itself dispatches, spends, or calls a provider. The always-on-
32
+ * orchestration incident switch exists to pause OUR dispatch surfaces —
33
+ * there is no dispatch here to pause. Tripping the halt does not, and
34
+ * should not, silence this hook's circuit-breaker notice about the
35
+ * plugin's own loop.
14
36
  *
15
37
  * Composition point (wired): registered as the `team-review-gate` concern
16
38
  * in `src/scripts/hook_manifest.yaml` on the claude `stop` slot, after
@@ -56,7 +78,7 @@ export function main(): number {
56
78
  // owns reporting it. Defaults = managed off = strict no-op.
57
79
  config = AI_TEAM_DEFAULTS;
58
80
  }
59
- if (!config.enabled || !config.review_gate.managed) {
81
+ if (!config.review_gate.managed) {
60
82
  return 0;
61
83
  }
62
84
 
@@ -331,18 +331,9 @@ export const settingsSchema = z.object({
331
331
  }).default({}),
332
332
  }).default({}),
333
333
  subagents: z.object({
334
- enabled: z.boolean().default(true).describe(
335
- 'Global master switch for the subagent layer. true (default) = available; false = fully disabled (the canonical kill-switch — no auto-dispatch, no routing, everything runs in-session).',
336
- ),
337
- auto: z.enum(['off', 'ask', 'on']).default('on').describe(
338
- '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.',
339
- ),
340
334
  downshift: z.boolean().default(true).describe(
341
335
  'Route delegable sub-tasks to the lowest-capable model tier (cost + speed via model downshift). false = every subagent runs on the session tier.',
342
336
  ),
343
- budget_routing: z.enum(['ask', 'auto', 'off']).default('ask').describe(
344
- '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 → strong tier; all exhausted → 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.',
345
- ),
346
337
  quota_arbitrage: z.boolean().default(true).describe(
347
338
  'Prefer a separate quota-pool model for delegable sub-tasks where the host manifest reports one. Optional bonus only — identical behaviour (minus the quota win) where unsupported. Never load-bearing.',
348
339
  ),
@@ -353,9 +344,6 @@ export const settingsSchema = z.object({
353
344
  }).default({}).describe(
354
345
  'Per-tier model map for downshift routing. Each empty value uses the tier runtime default (no vendor model baked in).',
355
346
  ),
356
- host_capabilities: z.object({}).passthrough().default({}).describe(
357
- '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.',
358
- ),
359
347
  implementer_model: z.string().default('').describe(
360
348
  '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 — cheapest and usually right.',
361
349
  ),
@@ -375,14 +363,11 @@ export const settingsSchema = z.object({
375
363
  ),
376
364
  }),
377
365
  ai_team: z.object({
378
- enabled: z.boolean().default(false).describe(
379
- '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.',
380
- ),
381
366
  model: z.string().default('auto').describe(
382
367
  "Model handed to the codex CLI. 'auto' (default) = pass no --model flag so the CLI's own default applies — tracks the subscription's current strongest model instead of pinning a stale ID. Any other value passes through verbatim as `--model <value>`.",
383
368
  ),
384
369
  allow_delegate: z.boolean().default(false).describe(
385
- '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.',
370
+ '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 — this key must ALSO be true before delegation is reachable.',
386
371
  ),
387
372
  max_calls_per_day: z.number().int().min(0).default(50).describe(
388
373
  'Per-day cap on team calls, read against the EXISTING cli_call_budget openai bucket (~/.event4u/agent-config/cli-calls.json, daily UTC reset) — one subscription, one counter, never a parallel count. 0 = block all team calls.',
@@ -398,7 +383,15 @@ export const settingsSchema = z.object({
398
383
  '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 — the user decides, never an infinite Claude↔Codex loop. An ALLOW verdict resets the counter. Positive integer.',
399
384
  ),
400
385
  }).default({ managed: false, max_consecutive_blocks: 3 }),
401
- }).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 } }),
386
+ }).default({ model: 'auto', allow_delegate: false, max_calls_per_day: 50, suppress_setup_hint: false, review_gate: { managed: false, max_consecutive_blocks: 3 } }),
387
+ emergency: z.object({
388
+ orchestration_halt: z.boolean().default(false).describe(
389
+ '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.',
390
+ ),
391
+ orchestration_halt_justification: z.string().default('').describe(
392
+ 'Required non-empty before orchestration_halt may return to false. Ignored while arming the halt.',
393
+ ),
394
+ }).default({ orchestration_halt: false, orchestration_halt_justification: '' }),
402
395
  onboarding: z.object({
403
396
  onboarded: z.boolean().default(false).describe(
404
397
  '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.',
@@ -57,16 +57,6 @@ export const SETTINGS_CARVE_OUT: readonly CarveOutKey[] = [
57
57
  'Same upgrade contract as projection.mode, and the failure is louder: '
58
58
  + 'an absent list widens the projection instead of narrowing it.',
59
59
  },
60
- {
61
- key: 'subagents.auto',
62
- reader: 'src/scripts/routing_doctor.ts:206',
63
- absentResolvesTo: 'ask',
64
- reason:
65
- 'The reader falls back to `ask` while the template ships `on`. Carved out '
66
- + 'rather than fixed at the reader because the doctor reports what the '
67
- + 'RESOLVED configuration is; changing its fallback would make the report '
68
- + 'disagree with what the other readers actually do.',
69
- },
70
60
  {
71
61
  key: 'discipline_profile',
72
62
  reader: 'work_engine/_lib/agent_settings.ts:1263',
@@ -130,11 +130,12 @@ export function isConservativeDefault(value: unknown): boolean {
130
130
  /**
131
131
  * Dotted leaf paths of a parsed settings tree.
132
132
  *
133
- * A leaf is anything that is not a NON-EMPTY map. An empty map is a real
134
- * configurable value with a real default (`subagents.host_capabilities: {}`),
135
- * so it is a leaf — one more than the template↔schema parity walk produces.
136
- * That divergence is deliberate: a key the parity walk skips is exactly the
137
- * key that would otherwise reach the writer with no class.
133
+ * A leaf is anything that is not a NON-EMPTY map. An empty map (e.g. an
134
+ * optional override object with every field left unset) is a real
135
+ * configurable value with a real default, so it is a leaf — one more than
136
+ * the template↔schema parity walk produces. That divergence is deliberate: a
137
+ * key the parity walk skips is exactly the key that would otherwise reach
138
+ * the writer with no class.
138
139
  */
139
140
  export function settingsLeafPaths(value: unknown, prefix = ''): string[] {
140
141
  if (typeof value !== 'object' || value === null || Array.isArray(value)) {
@@ -164,10 +165,11 @@ export function getSettingsLeaf(root: unknown, dotted: string): unknown {
164
165
  *
165
166
  * An exact row wins. Failing that, the longest classified prefix does: a
166
167
  * class-C key whose value is a MAP has children that never appear in a flattened
167
- * diff under the key's own name, so `subagents.host_capabilities.subagent_spawn`
168
- * must inherit the C on `subagents.host_capabilities` rather than read as
169
- * unclassified. Returns `undefined` when nothing on the path is classified —
170
- * and every caller treats that as guarded, not as free.
168
+ * diff under the key's own name (e.g. a hypothetical `foo.overrides: {}` with a
169
+ * class-C row on `foo.overrides` itself), so `foo.overrides.some_field` must
170
+ * inherit the C on `foo.overrides` rather than read as unclassified. Returns
171
+ * `undefined` when nothing on the path is classified — and every caller
172
+ * treats that as guarded, not as free.
171
173
  */
172
174
  export function classOfPath(
173
175
  index: ReadonlyMap<string, SettingsClass>,