@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,188 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Council-availability fact — `session_start` concern.
4
+ *
5
+ * Carries ONE fact the context does not otherwise contain: whether an AI council
6
+ * is configured for this machine, and where its config was resolved from.
7
+ *
8
+ * WHY THIS EXISTS — the measured failure, not a general reminder.
9
+ *
10
+ * 2026-08-08, in a consumer project with no project-scope install, an agent
11
+ * announced:
12
+ *
13
+ * "Kein Council konfiguriert (keine `.agent-settings.yml`) — ich nutze
14
+ * Subagenten-Fächer mit gegnerischen Linsen als Ersatz"
15
+ *
16
+ * and substituted a weaker path. The council was configured the whole time. The
17
+ * user's correction was blunt and correct. The inference was wrong twice over:
18
+ *
19
+ * 1. Council config has not lived in `.agent-settings.yml` since the Phase-0
20
+ * migration removed that block.
21
+ * 2. Per ADR-104 the project tree is NEVER searched for council config, so the
22
+ * presence or absence of ANY project file says nothing about availability
23
+ * in either direction.
24
+ *
25
+ * The guidance was not missing. `/council default` states it emphatically in
26
+ * four separate places, and it is correct. But a command file loads only when
27
+ * that command is invoked, and the agent was answering a prior question — "does
28
+ * this capability exist?" — before invoking anything. The always-loaded rule
29
+ * layer refers to the council conditionally ("when the council is enabled")
30
+ * and never says how to determine that. Faced with a conditional and no test,
31
+ * the agent guessed the location every other setting lives in, and that guess
32
+ * is the one location this config specifically is not in.
33
+ *
34
+ * So this is not more prose, and it is deliberately not a rule. It is the
35
+ * language-mirror pattern applied to a capability: a hook can supply a fact the
36
+ * transcript cannot express. `council:status` makes the fact *obtainable*; this
37
+ * makes it *present*, which is the difference between a check an agent could
38
+ * have run and one it did not need to.
39
+ *
40
+ * Advisory, always. It never blocks, and a resolution failure degrades to
41
+ * silence rather than to a claim — a hook that guessed here would reproduce the
42
+ * defect it exists to remove.
43
+ */
44
+
45
+ import * as fs from 'node:fs';
46
+ import * as path from 'node:path';
47
+ import { fileURLToPath, pathToFileURL } from 'node:url';
48
+
49
+ import { readHookStdin } from './hooks/hook_stdin.js';
50
+ import {
51
+ COUNCIL_CONFIG_ENV,
52
+ load_council_config,
53
+ resolve_config_path,
54
+ } from './ai_council/config.js';
55
+
56
+ const EXIT_ALLOW = 0;
57
+
58
+ export interface Availability {
59
+ configured: boolean;
60
+ path: string;
61
+ exists: boolean;
62
+ provenance: 'user-global' | 'env-override';
63
+ membersEnabled: number;
64
+ memberNames: string[];
65
+ }
66
+
67
+ /**
68
+ * Resolve availability without throwing. A malformed or unreadable config is
69
+ * reported as not-configured with `exists: true`, which is the distinction a
70
+ * reader needs: "write a config" and "fix your config" are different actions.
71
+ */
72
+ export function resolveAvailability(
73
+ cwd: string,
74
+ env: Record<string, string | undefined>,
75
+ ): Availability | null {
76
+ let p: string;
77
+ try {
78
+ p = String(resolve_config_path(cwd, { env: env as never }));
79
+ } catch {
80
+ return null; // cannot resolve — say nothing rather than guess
81
+ }
82
+ const exists = fs.existsSync(p);
83
+ const provenance = env[COUNCIL_CONFIG_ENV] ? 'env-override' : 'user-global';
84
+ if (!exists) {
85
+ return { configured: false, path: p, exists: false, provenance, membersEnabled: 0, memberNames: [] };
86
+ }
87
+ try {
88
+ const cfg = load_council_config(p);
89
+ const enabled = [...cfg.members.entries()].filter(([, m]) => m.enabled).map(([n]) => n);
90
+ return {
91
+ configured: cfg.enabled && enabled.length > 0,
92
+ path: p,
93
+ exists: true,
94
+ provenance,
95
+ membersEnabled: enabled.length,
96
+ memberNames: enabled,
97
+ };
98
+ } catch {
99
+ return { configured: false, path: p, exists: true, provenance, membersEnabled: 0, memberNames: [] };
100
+ }
101
+ }
102
+
103
+ export function buildFact(a: Availability): string {
104
+ const head = a.configured
105
+ ? `An AI council IS configured: ${String(a.membersEnabled)} enabled member(s) — ${a.memberNames.join(', ')}.`
106
+ : a.exists
107
+ ? 'An AI council config exists but is NOT usable (unreadable, disabled, or no enabled member).'
108
+ : 'No AI council is configured on this machine.';
109
+ return [
110
+ '<council-availability>',
111
+ head,
112
+ `Resolved from ${a.provenance}: ${a.path}`,
113
+ 'The project tree is NEVER searched for council config (ADR-104), and the',
114
+ 'config has not lived in `.agent-settings.yml` since the Phase-0 migration.',
115
+ 'So do NOT infer council availability from any project file, in either',
116
+ 'direction — this line is the answer, and `agent-config council:status`',
117
+ 're-checks it on demand without spending anything.',
118
+ a.configured
119
+ ? 'Never announce that no council is configured, and never substitute a weaker path on that basis.'
120
+ : 'A substitute is legitimate here — say which one you are using and why.',
121
+ '</council-availability>',
122
+ ].join('\n');
123
+ }
124
+
125
+ function _workspaceRoot(env: Record<string, unknown>): string {
126
+ for (const key of ['project_dir', 'projectDir', 'cwd', 'workspace_root']) {
127
+ const v = env[key];
128
+ if (typeof v === 'string' && v.trim() !== '') {
129
+ return v;
130
+ }
131
+ }
132
+ return process.cwd();
133
+ }
134
+
135
+ export function run(stdin: string, options: { env?: Record<string, string | undefined> } = {}): number {
136
+ let envelope: Record<string, unknown> = {};
137
+ if (stdin.trim() !== '') {
138
+ try {
139
+ const parsed = JSON.parse(stdin) as unknown;
140
+ if (parsed !== null && typeof parsed === 'object') {
141
+ envelope = parsed as Record<string, unknown>;
142
+ }
143
+ } catch {
144
+ return EXIT_ALLOW; // never act on a malformed envelope
145
+ }
146
+ }
147
+ const event = envelope['event'];
148
+ const slot = typeof event === 'string' && event !== '' ? event : 'session_start';
149
+ if (slot !== 'session_start') {
150
+ return EXIT_ALLOW;
151
+ }
152
+ const a = resolveAvailability(_workspaceRoot(envelope), options.env ?? process.env);
153
+ if (a === null) {
154
+ return EXIT_ALLOW;
155
+ }
156
+ process.stdout.write(
157
+ `${JSON.stringify({
158
+ decision: 'allow',
159
+ reason: `council-availability: ${a.configured ? 'configured' : 'not configured'}`,
160
+ context: buildFact(a),
161
+ })}\n`,
162
+ );
163
+ return EXIT_ALLOW;
164
+ }
165
+
166
+ export function main(argv?: string[]): number {
167
+ const args = argv ?? process.argv.slice(2);
168
+ let env = process.env;
169
+ void args;
170
+ return run(readHookStdin(), { env });
171
+ }
172
+
173
+ declare const __AGENT_CONFIG_BUNDLE__: boolean | undefined;
174
+ function _isCliEntry(): boolean {
175
+ if (typeof __AGENT_CONFIG_BUNDLE__ !== 'undefined' && __AGENT_CONFIG_BUNDLE__) {
176
+ return false;
177
+ }
178
+ if (process.argv[1] === undefined) {
179
+ return false;
180
+ }
181
+ return import.meta.url === pathToFileURL(path.resolve(process.argv[1])).href;
182
+ }
183
+
184
+ if (_isCliEntry()) {
185
+ process.exit(main());
186
+ }
187
+
188
+ void fileURLToPath;