@event4u/agent-config 9.0.0 → 9.2.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 (93) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/CHANGELOG.md +22 -204
  3. package/MIGRATION.md +14 -0
  4. package/README.md +2 -2
  5. package/dist/agent-src/commands/explain-run.md +88 -0
  6. package/dist/agent-src/commands/implement-ticket.md +2 -0
  7. package/dist/agent-src/commands/pr/create/description-only.md +138 -8
  8. package/dist/agent-src/commands/pr/create.md +16 -5
  9. package/dist/agent-src/commands/review/changes.md +22 -0
  10. package/dist/agent-src/contexts/execution/subagent-modes-detail.md +41 -6
  11. package/dist/agent-src/contexts/execution/verify-budget.md +15 -0
  12. package/dist/agent-src/rules/cross-source-consistency.md +92 -0
  13. package/dist/agent-src/rules/delegation-policy.md +1 -1
  14. package/dist/agent-src/skills/estimate-ticket/SKILL.md +2 -0
  15. package/dist/agent-src/skills/feature-planning/SKILL.md +1 -1
  16. package/dist/agent-src/skills/llm-provider-knowledge/SKILL.md +146 -0
  17. package/dist/agent-src/skills/llm-provider-knowledge/evals/triggers.json +20 -0
  18. package/dist/agent-src/skills/po-discovery/SKILL.md +2 -0
  19. package/dist/agent-src/skills/refine-ticket/SKILL.md +7 -0
  20. package/dist/agent-src/skills/roadmap-writing/SKILL.md +14 -0
  21. package/dist/agent-src/skills/subagent-orchestration/SKILL.md +26 -5
  22. package/dist/agent-src/skills/subagent-orchestration/evals/evals.json +18 -0
  23. package/dist/agent-src/skills/subagent-orchestration/prompts/README.md +14 -2
  24. package/dist/agent-src/skills/subagent-orchestration/prompts/adversarial-verification-council.md +79 -0
  25. package/dist/agent-src/skills/subagent-orchestration/schemas/adversarial-findings.json +56 -0
  26. package/dist/agent-src/skills/token-optimizer/SKILL.md +10 -4
  27. package/dist/agent-src/templates/agent-settings.md +28 -0
  28. package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
  29. package/dist/agent-src/templates/scripts/work_engine/_lib/agent_settings.ts +4 -1
  30. package/dist/discovery/deprecation-report.md +1 -1
  31. package/dist/discovery/discovery-manifest.json +105 -28
  32. package/dist/discovery/discovery-manifest.json.sha256 +1 -1
  33. package/dist/discovery/discovery-manifest.summary.md +5 -5
  34. package/dist/discovery/orphan-report.md +1 -1
  35. package/dist/discovery/packs.json +16 -12
  36. package/dist/discovery/trust-report.md +8 -8
  37. package/dist/discovery/workspaces.json +12 -8
  38. package/dist/install/install.mjs +47 -31
  39. package/dist/mcp/registry-manifest.json +3 -3
  40. package/dist/router.json +1 -1
  41. package/dist/scripts/_lib/agent_settings.js +4 -1
  42. package/dist/scripts/_lib/agent_settings.js.map +1 -1
  43. package/dist/server/schemas/settings.js +10 -0
  44. package/dist/server/schemas/settings.js.map +1 -1
  45. package/docs/CLAIMS.md +10 -3
  46. package/docs/MIGRATION.md +20 -0
  47. package/docs/architecture.md +4 -4
  48. package/docs/archive/CHANGELOG-pre-9.2.0.md +276 -0
  49. package/docs/benchmark.md +24 -0
  50. package/docs/command-flows.md +1 -1
  51. package/docs/contracts/agents-layout.md +1 -1
  52. package/docs/contracts/consumer-bridge.md +55 -63
  53. package/docs/contracts/install-layout.md +1 -1
  54. package/docs/contracts/migrate-command.md +1 -1
  55. package/docs/customization.md +22 -1
  56. package/docs/decisions/ADR-020-global-only-consumer-scope.md +34 -0
  57. package/docs/decisions/ADR-122-adversarial-verification-council.md +136 -0
  58. package/docs/decisions/INDEX.md +1 -0
  59. package/docs/design/adversarial-council-eval.md +106 -0
  60. package/docs/featured-skills.md +2 -2
  61. package/docs/getting-started-by-role.md +1 -1
  62. package/docs/getting-started.md +2 -2
  63. package/docs/governance-advantage.md +1 -1
  64. package/docs/guidelines/agent-infra/api-cost-levers.md +126 -0
  65. package/docs/guidelines/agent-infra/cross-source-consistency-mechanics.md +109 -0
  66. package/docs/installation.md +2 -1
  67. package/docs/maintainers/dev-mode.md +3 -2
  68. package/docs/proof.md +7 -7
  69. package/package.json +1 -1
  70. package/src/agent-src/templates/scripts/work_engine/_lib/agent_settings.ts +4 -1
  71. package/src/config/agent-settings.template.yml +81 -0
  72. package/src/config/gitignore-block.txt +16 -6
  73. package/src/scripts/_cli/cmd_conformance.ts +2 -2
  74. package/src/scripts/_cli/cmd_doctor.ts +162 -13
  75. package/src/scripts/_cli/cmd_refresh.ts +35 -118
  76. package/src/scripts/_lib/adversarial_council_gate.test.ts +112 -0
  77. package/src/scripts/_lib/adversarial_council_gate.ts +98 -0
  78. package/src/scripts/_lib/adversarial_reconcile.test.ts +197 -0
  79. package/src/scripts/_lib/adversarial_reconcile.ts +187 -0
  80. package/src/scripts/_lib/agent_settings.ts +4 -1
  81. package/src/scripts/_lib/verify_budget.ts +4 -1
  82. package/src/scripts/ai_council/clients.ts +68 -6
  83. package/src/scripts/ai_council/pricing.ts +62 -0
  84. package/src/scripts/council_cli.ts +19 -3
  85. package/src/scripts/install.ts +44 -45
  86. package/src/scripts/lint_agents_layout.ts +10 -4
  87. package/src/scripts/lint_breaking_changes_index.ts +303 -0
  88. package/src/scripts/mcp_server/tools.ts +1 -3
  89. package/src/scripts/schemas/agent-settings.schema.json +28 -0
  90. package/src/scripts/self_review_gate.test.ts +11 -0
  91. package/src/scripts/self_review_gate.ts +7 -1
  92. package/src/scripts/skill_eval_coverage.ts +4 -1
  93. package/src/server/schemas/settings.ts +24 -0
@@ -0,0 +1,136 @@
1
+ ---
2
+ adr: 122
3
+ status: accepted
4
+ date: 2026-07-14
5
+ decision: adversarial-verification-council
6
+ supersedes: —
7
+ superseded_by: —
8
+ phase: adversarial-verification-council
9
+ type: structural
10
+ ---
11
+
12
+ # ADR-122 — Adversarial verification council: finding-coverage scope, advisory-only, default-off
13
+
14
+ ## Status
15
+
16
+ Accepted (2026-07-14).
17
+
18
+ ## Context
19
+
20
+ The verify/council family is mature: the external council engine, multi-round
21
+ debate, chairman mode (ADR-120), stance tally, `verify-repair-loop` (the
22
+ judge→revise→re-judge loop), the seven `judge-*` skills, `judge-synthesis`, the
23
+ `subagent-orchestration` mode set, and the `verify-budget` routing all ship. A
24
+ three-strand research pass (surface map + archived-roadmap autopsy + infra
25
+ inventory, 2026-07-14) confirmed that almost every *decision-consensus*
26
+ mechanism in this space is either built or is a recorded honest-null:
27
+
28
+ - recursive self-correction as a capability/discipline lever — honest-null,
29
+ council-terminal (ADR-106);
30
+ - the judge→revise→re-judge loop — shipped as `verify-repair-loop`;
31
+ - personas / named-figure agents — placebo-null (Δ=0.17, p=0.607); provider
32
+ diversity moved quality ~15× more than persona identity;
33
+ - browser-automation council members — maintainer-killed (council-modes 2c);
34
+ - a `--council` in-flow UX product surface — stub, gated on the
35
+ orchestration-scope decision + a demand signal;
36
+ - "council beats a solo strong model on decision quality" —
37
+ `council-vs-solo-baseline`, pre-registered `unbacked`, spend-gated.
38
+
39
+ The one un-mined, evidence-supported wedge is **adversarial verification as
40
+ defect FINDING coverage** (not decision quality). The `cross-vendor-parity`
41
+ claim is *backed*: different providers surface different real findings on
42
+ multi-file analysis; both catch a planted hollow impl; both stay silent on a
43
+ clean control. No wired surface exists that runs a model-diverse skeptic panel
44
+ adversarially against a real change to maximise defect-finding coverage — the
45
+ nearest kin (`judge-with-debate`, strict-er-wins on one verdict;
46
+ `judge-synthesis`, consume-only consensus) do something categorically different.
47
+
48
+ ## Decision
49
+
50
+ Ship an **adversarial verification council** as a distinct, opt-in,
51
+ **advisory-only** surface, scoped to **finding coverage, not decision quality**:
52
+
53
+ 1. **A 9th `subagent-orchestration` mode** `adversarial-verification-council`:
54
+ N (default 2) distinct-model skeptics red-team a real, already-verified
55
+ change through the `judge-*` lenses; each returns findings; results are
56
+ reconciled into a findings-by-severity verdict with per-finding provenance and
57
+ a cross-model confidence signal. Distinct from Mode 6 because the output is a
58
+ **findings-union with provenance**, not a strict-er-wins single verdict.
59
+ 2. **A machine-readable findings envelope** `adversarial-findings.json` (draft-07,
60
+ hand-validated like `subagent-status.json`) — filling the gap of no shared
61
+ judge-verdict schema.
62
+ 3. **Countable reconciliation in TS with tests** (`adversarial_reconcile.ts`):
63
+ dedup, severity-quorum confidence, and false-positive suppression. Never
64
+ LLM-computed prose (anti-lesson). Never gates the change — only ranks and
65
+ annotates findings.
66
+ 4. **Opt-in wiring, default-off**: a `subagents.adversarial_council: off|ask|on`
67
+ setting (default `off`); an opt-in escalation tier in `verify-budget` for
68
+ explicitly high-risk changes; an opt-in flag on `/review-changes` (or
69
+ `/judge`). The panel never auto-gates a change (Hard Floor: advisory only).
70
+ 5. **Prove-or-drop against a pre-registered finding-coverage claim**
71
+ (`adversarial-council-finding-coverage`, `unbacked` at start). The benchmark
72
+ is a **two-stage residual-detection protocol** (single strong judge first →
73
+ panel on the judge-passed residual subset), on a corpus with published
74
+ judge-survivable subtlety distribution, with a **dual threshold** (relative
75
+ ≥ +25% AND absolute ≥ +8 pp residual-recall lift) and a
76
+ **controversial-but-correct FP control**. Honest-null is an accepted outcome
77
+ and keeps the surface inert-by-default permanently.
78
+
79
+ ### Skeptic transport (fork F1)
80
+
81
+ Everyday mode uses an in-session subagent panel with enforced model diversity.
82
+ The **registered benchmark run and the opt-in high-risk tier require
83
+ cross-*vendor* skeptics** (via `council_cli.ts`, artefact/diff-as-text,
84
+ read-only) — the backed `cross-vendor-parity` signal is provider-level, so the
85
+ claim cannot rest on same-vendor model diversity alone.
86
+
87
+ ## Consequences
88
+
89
+ - The package gains a defect-finding verification surface that composes existing
90
+ primitives — no rebuilt engine, no recursion loop, no persona layer, no
91
+ browser automation, no `--council` UX product.
92
+ - A new shared findings schema exists that future judge-panel work can reuse.
93
+ - The value claim is measurable (finding coverage on a static corpus, unlike
94
+ orchestration value in the no-runtime harness), and its resolution is honest:
95
+ a null keeps the surface off by default, like recursive-verification.
96
+ - Default-off means zero cost/behaviour change until a consumer opts in.
97
+
98
+ ## Landmine-clearance (do-not-relitigate map)
99
+
100
+ Each settled decision this roadmap does NOT touch:
101
+
102
+ - **Recursion / re-attempt loop** — not added; the panel is single-pass finding
103
+ generation, not a self-correction loop.
104
+ - **judge→revise→re-judge** — reused (`verify-repair-loop`), not rebuilt.
105
+ - **Council engine / debate / budget / redaction / chairman** — reused, not
106
+ re-proposed.
107
+ - **Personas / named-figure agents / persona panel-mode** — not used; skeptics
108
+ are model-diverse, not persona-diverse.
109
+ - **Browser-automation / web-subscription scraping** — not revived.
110
+ - **`--council` in-flow UX product / verdict-report product layer** — not built;
111
+ the findings envelope is an engineering contract, not a productized report.
112
+ - **council-vs-solo decision-quality claim** — out of scope; the claim here is
113
+ finding coverage, resting on the backed `cross-vendor-parity` signal.
114
+ - **Orchestration value measured in a no-runtime harness** — not claimed; the
115
+ benchmark measures finding coverage on a static planted-defect corpus.
116
+ - **Prose-computed reconciliation** — reconciliation is TS with tests.
117
+
118
+ ## Alternatives
119
+
120
+ - **Extend Mode 6 `judge-with-debate`** — rejected: its strict-er-wins single
121
+ verdict is a go/no-go decision, categorically different from a findings-union;
122
+ overloading it would blur two contracts.
123
+ - **Build on the external `ai-council` for the everyday path** — rejected: the
124
+ external council is artefact-only / read-only by Hard-Floor contract; the
125
+ everyday code path is in-session `subagent-orchestration`. External
126
+ cross-vendor is reserved for the registered claim + high-risk tier.
127
+ - **Default-on** — rejected: no evidence yet; default-off until the
128
+ pre-registered claim is `backed`.
129
+
130
+ ## References
131
+
132
+ - `agents/roadmaps/road-to-adversarial-verification-council.md` — the roadmap.
133
+ - ADR-106 (recursive-verification honest-null), ADR-117 (subagents.auto flip),
134
+ ADR-120 (council chairman mode), ADR-109 (subagent-v1 contract).
135
+ - `docs/CLAIMS.md#adversarial-council-finding-coverage` — the pre-registered claim.
136
+ - `cross-vendor-parity` (backed) — the evidence the finding-coverage scope rests on.
@@ -125,6 +125,7 @@ _Auto-generated by `scripts/adr/regenerate_index.py`. Do not edit._
125
125
  | [ADR-119](ADR-119-global-knowledge-default-on.md) | Global Knowledge Default On | accepted | 2026-07-12 | 103 |
126
126
  | [ADR-120](ADR-120-council-chairman-mode.md) | Council Chairman Mode | accepted | 2026-07-12 | — |
127
127
  | [ADR-121](ADR-121-knowledge-sensitivity-classes.md) | Knowledge Sensitivity Classes | accepted | 2026-07-12 | — |
128
+ | [ADR-122](ADR-122-adversarial-verification-council.md) | Adversarial Verification Council | accepted | 2026-07-14 | — |
128
129
  | [ADR-200](ADR-200-python-to-typescript-migration.md) | Python To Typescript Migration | accepted | 2026-06-11 | — |
129
130
 
130
131
  ## Unnumbered (legacy)
@@ -0,0 +1,106 @@
1
+ # Adversarial verification council eval — two-stage residual-detection design
2
+
3
+ > Design artifact for `road-to-adversarial-verification-council` Phase 4. It
4
+ > pins the benchmark that resolves the pre-registered `adversarial-council-
5
+ > finding-coverage` claim (docs/CLAIMS.md, ADR-122). Writing this design is
6
+ > autonomous; **curating the corpus and running the paid cross-vendor arm is a
7
+ > maintainer cost decision**, gated on the corpus-validity check below.
8
+
9
+ ## What the claim is — and is not
10
+
11
+ - **Is:** does a cross-vendor skeptic panel find materially more of the defects
12
+ that **survive a single strong judge** (the residual pool), at a false-positive
13
+ rate no worse than that judge on a controversial-but-correct control?
14
+ - **Is not:** whether the council beats a solo model on *decision quality* — that
15
+ is the separate, `unbacked`, spend-gated `council-vs-solo-baseline`
16
+ (docs/design/council-vs-solo-baseline.md), explicitly out of scope.
17
+
18
+ ## The council's load-bearing critique (folded in)
19
+
20
+ The AI-council debate (2026-07-14, anthropic/claude-sonnet-4-5 + openai/gpt-4o)
21
+ converged on one real risk: the existing `cross-model-parity` corpus was built
22
+ to show that different vendors catch different **obvious** things (parity), not
23
+ to simulate the **residual** state after a competent first pass. Running the
24
+ registered claim on it would force an honest-null as a *measurement artifact*,
25
+ not a mechanism result. This design answers that with a two-stage protocol, a
26
+ corpus-subtlety bar, a dual threshold, and a controversial-clean FP control.
27
+
28
+ ## Two-stage protocol
29
+
30
+ 1. **Stage 1 — single strong judge.** A single cross-model judge runs on every
31
+ planted-defect change. The defects it CATCHES are removed from scope.
32
+ 2. **Stage 2 — the panel on the residual.** Only the changes that PASS stage 1
33
+ (defect not caught) proceed to the Mode 9 panel. Recall is measured on this
34
+ **judge-passed residual pool** — the production-relevant quantity.
35
+
36
+ This makes "residual detection" explicit rather than implicit in corpus
37
+ selection.
38
+
39
+ ## Corpus-validity gate (blocks the registered run)
40
+
41
+ The corpus must contain **judge-survivable subtleties**, published as a
42
+ distribution before the registered run:
43
+
44
+ - multi-file interaction defects,
45
+ - subtle logic inversions that read as plausible,
46
+ - security masked by correct-looking patterns,
47
+ - edge cases in complex state.
48
+
49
+ Publish the severity/subtlety distribution (share single-file <5 LoC vs
50
+ multi-file interaction). A corpus skewed to trivially-detectable defects fails
51
+ this gate — the registered run does not proceed until it passes.
52
+
53
+ ### Assessment of the existing corpus (2026-07-14)
54
+
55
+ `internal/bench/orchestration/corpus/` (5 tasks: orch-01..03, pv-01 hollow,
56
+ pv-02 control) was purpose-built for the parity signal and for A3
57
+ production-validator Gate-A. `pv-01` is a deliberately **obvious** hollow impl
58
+ (a floor sanity check), and none of the five tasks is designed as a
59
+ judge-survivable residual defect. **Conclusion: this corpus does NOT meet the
60
+ subtlety bar** — so the registered run is **blocked** pending a curated
61
+ residual-defect corpus. The claim stays `unbacked` until then (no false
62
+ `backed`).
63
+
64
+ ## Controversial-but-correct FP control
65
+
66
+ The clean control includes correct-but-non-obvious cases (real perf/security
67
+ design tradeoffs, uncommon patterns) — not only obviously-clean code — so the
68
+ red-team posture's true FP cost is measured. Panel FP is compared to the
69
+ single-judge FP on the SAME control.
70
+
71
+ ## Panel = cross-vendor
72
+
73
+ The registered run and the opt-in high-risk tier use >=2 distinct **providers**
74
+ (e.g. anthropic + openai), via the council transport (`council_cli.ts`,
75
+ artefact/diff-as-text, read-only). The backed `cross-vendor-parity` signal is
76
+ provider-level; same-vendor model diversity is insufficient for the claim.
77
+
78
+ ## The gate (locked at pre-registration)
79
+
80
+ Encoded in [`src/scripts/_lib/adversarial_council_gate.ts`](../../src/scripts/_lib/adversarial_council_gate.ts)
81
+ (`evaluateCouncilBench`), covered by `adversarial_council_gate.test.ts`:
82
+
83
+ - (a) relative residual-recall lift >= **+25%**, AND
84
+ - (b) absolute residual-recall lift >= **+8 pp**, AND
85
+ - panel FP not worse than single-judge FP within the noise margin.
86
+
87
+ Both recall thresholds are required — the dual gate guards the base-rate
88
+ compression the council flagged (a high single-judge baseline makes relative
89
+ lift easy but absolute must still clear). Threshold values are **locked**;
90
+ corpus/protocol may be refined *before* the registered run, never the threshold
91
+ after seeing results.
92
+
93
+ ## Outcome handling
94
+
95
+ - **Pass** → flip `docs/CLAIMS.md#adversarial-council-finding-coverage` to
96
+ `backed` with the report pointer; document the recommended cross-vendor config.
97
+ - **Honest-null** → record it (ADR-122 addendum + `docs/benchmark.md`), keep the
98
+ surface `off` by default permanently, mark the roadmap null-but-shipped-inert
99
+ (like recursive-verification).
100
+
101
+ ## Status
102
+
103
+ - Gate logic: **built + tested** (deterministic TS).
104
+ - Corpus-validity gate: **assessed — existing corpus fails the subtlety bar.**
105
+ - Registered paid cross-vendor run: **deferred**, blocked on curating a
106
+ judge-survivable-subtlety corpus. Claim remains `unbacked`.
@@ -1,6 +1,6 @@
1
1
  # Featured Skills
2
2
 
3
- A curated subset of the 274 skills. Three tiers, one per primary audience. Full catalog lives in [`dist/agent-src/skills/`](../dist/agent-src/skills/); see also [`docs/catalog.md`](catalog.md) for the complete index and [`docs/featured-commands.md`](featured-commands.md) for command-level highlights.
3
+ A curated subset of the 275 skills. Three tiers, one per primary audience. Full catalog lives in [`dist/agent-src/skills/`](../dist/agent-src/skills/); see also [`docs/catalog.md`](catalog.md) for the complete index and [`docs/featured-commands.md`](featured-commands.md) for command-level highlights.
4
4
 
5
5
  > **Eval-gated messaging note.** Until `task bench --corpus non-dev` reports `selection_accuracy >= 0.60` (see `road-to-product-adoption.md` Phase 1), this page is documentation, not marketing. The entries below are the candidates the corpus tests against; their description quality is what the eval validates.
6
6
 
@@ -92,4 +92,4 @@ task lint-featured-skills
92
92
 
93
93
  CI runs this in `taskfiles/ci-fast.yml`. Stale entries (renamed / removed skill or command) fail the build. See [`scripts/lint_featured_skills.py`](../src/scripts/lint_featured_skills.py) for the matcher.
94
94
 
95
- → Browse all 274 skills: [`dist/agent-src/skills/`](../dist/agent-src/skills/) · all 183 commands: [`dist/agent-src/commands/`](../dist/agent-src/commands/)
95
+ → Browse all 275 skills: [`dist/agent-src/skills/`](../dist/agent-src/skills/) · all 184 commands: [`dist/agent-src/commands/`](../dist/agent-src/commands/)
@@ -2,7 +2,7 @@
2
2
 
3
3
  > Pick the entry that matches what you do day-to-day. Each section names the three skills you will reach for first and shows whether MCP (no terminal) or CLI (terminal) is the simpler install path for that role.
4
4
 
5
- `agent-config` ships 274 skills, 104 governed rules, and 183 commands. You do not need all of them. Each role below filters to the slice that pays back in week one; the rest stays available and shows up on demand when a task references it.
5
+ `agent-config` ships 275 skills, 105 governed rules, and 184 commands. You do not need all of them. Each role below filters to the slice that pays back in week one; the rest stays available and shows up on demand when a task references it.
6
6
 
7
7
  > **Taglines at a glance →** [`docs/role-experiences.md`](role-experiences.md) — the one-line pitch per role experience, in one table.
8
8
 
@@ -134,7 +134,7 @@ Your agent is now:
134
134
  - **Respecting your codebase** — no conflicting patterns
135
135
  - **Following standards** — consistent code quality
136
136
 
137
- This is enforced automatically by 104 rules. No configuration needed.
137
+ This is enforced automatically by 105 rules. No configuration needed.
138
138
 
139
139
  ---
140
140
 
@@ -174,7 +174,7 @@ Your agent now understands slash commands:
174
174
  | `/fix quality` | Run and fix all quality checks |
175
175
  | `/chat-history import` | Pull a prior session into the current chat (resume) |
176
176
 
177
- → [Browse all 183 active commands](../dist/agent-src/commands/)
177
+ → [Browse all 184 active commands](../dist/agent-src/commands/)
178
178
 
179
179
  ---
180
180
 
@@ -33,7 +33,7 @@ the host lacks (a static host gives it no runtime attention guarantee, but a
33
33
  runtime-only system gives it nothing at all here). A runtime-only system contributes *nothing* on these hosts.
34
34
 
35
35
  ### 2. Intent routing, not a 500-artefact dump
36
- A prompt does not load all 274 skills. `dist/router.json` (100 routed rules, intent →
36
+ A prompt does not load all 275 skills. `dist/router.json` (101 routed rules, intent →
37
37
  skill, keyword/phrase/path triggers) carries the right skill on intent. The
38
38
  governance value is *selection discipline* — the host gets the relevant rule
39
39
  set, not the whole catalogue as context ballast.
@@ -0,0 +1,126 @@
1
+ # API Cost Levers
2
+
3
+ Reference material for a downstream AI-coding agent that wants to cut its own
4
+ Claude API dollar bill. Four platform-level billing levers, the exact economics
5
+ of each, and how they interact. Read on demand — not always-loaded.
6
+
7
+ Facts sourced from the in-repo `claude-api` plugin skill plus platform research
8
+ (2026-07-14). Do not invent an API shape beyond what is stated here.
9
+
10
+ ## The four levers at a glance
11
+
12
+ | Lever | Cuts | Best for | Watch out for |
13
+ |---|---|---|---|
14
+ | Prompt caching | Repeated input tokens | Stable prefix reused across calls (system prompt, tools, repo map) | Any byte change in the prefix invalidates the rest |
15
+ | Batch API | 50% input + output | Non-interactive bulk work (classification, summarization, evals) | Async, up to 24h, results unordered |
16
+ | Model tiering | Per-token price | Routine work on a cheaper model | Switching model is a cache miss |
17
+ | Effort / output sizing | Thinking + output tokens | Routine turns that don't need deep reasoning | Oversized `max_tokens` risks runaway output |
18
+
19
+ ## 1. Prompt caching
20
+
21
+ Put the large, byte-**stable** context first — system prompt, tool definitions,
22
+ a corpus or repo map, few-shot examples — behind a
23
+ `cache_control: {type: 'ephemeral'}` breakpoint. Keep volatile content (the
24
+ varying question, timestamps, per-request IDs) **after** the last breakpoint.
25
+ The cache is a **prefix match**: any byte change in the cached prefix
26
+ invalidates everything after it. Render order is tools then system then
27
+ messages.
28
+
29
+ Caching is GA — **no beta header needed**.
30
+
31
+ Economics:
32
+
33
+ - Cache reads cost approximately 0.1x the base input price.
34
+ - Cache writes cost 1.25x (5-minute TTL) or 2x (1-hour TTL).
35
+ - Break-even is after **one** read on the 5-minute TTL.
36
+
37
+ Constraints:
38
+
39
+ - The minimum cacheable prefix is model-dependent (approximately 1024–4096
40
+ tokens). Shorter prefixes silently do not cache.
41
+ - The cache is workspace-isolated (since February 2026).
42
+
43
+ Verify a hit with `usage.cache_read_input_tokens > 0`.
44
+
45
+ ```json
46
+ {
47
+ "system": [
48
+ { "type": "text", "text": "<large stable system prompt>",
49
+ "cache_control": { "type": "ephemeral" } }
50
+ ],
51
+ "messages": [
52
+ { "role": "user", "content": "<the varying question>" }
53
+ ]
54
+ }
55
+ ```
56
+
57
+ ## 2. Batch API
58
+
59
+ For **non-interactive, non-latency-sensitive bulk work** — bulk classification,
60
+ mass file summarization, eval runs. Not chatbots or interactive assistants.
61
+
62
+ - **50% off both input and output tokens.**
63
+ - Async: results within 24h (usually much less), keyed by `custom_id`, arriving
64
+ **unordered** — key results by `custom_id`, never by position.
65
+ - **Stacks with prompt caching**: a cached-batch input token can reach
66
+ approximately 0.05x the standard input price.
67
+
68
+ ## 3. Model tiering
69
+
70
+ Treat models like a team — a cheap model for mechanical or routine work, the
71
+ expensive model only for hard judgment. Approximate input / output price per 1M
72
+ tokens:
73
+
74
+ | Model | Input | Output |
75
+ |---|---|---|
76
+ | Haiku | $1 | $5 |
77
+ | Sonnet | $3 | $15 |
78
+ | Opus | $5 | $25 |
79
+ | Fable | $10 | $50 |
80
+
81
+ Opus input is approximately 5x Haiku. Tier by task **difficulty**, not blindly:
82
+ a cheaper model that gives wrong answers on judgment tasks costs correction
83
+ cycles, which erases the saving.
84
+
85
+ **Interaction with caching.** The prompt cache is keyed by `(model, prefix)`, so
86
+ switching a call to a cheaper model is a cache **miss**. Weigh the downgrade
87
+ saving against the lost cache-read saving before routing a cached call to a
88
+ different model.
89
+
90
+ ## 4. Effort and output right-sizing
91
+
92
+ - `output_config.effort` (low through max) controls thinking and output depth,
93
+ and therefore spend. Dial effort **down** on routine turns; reserve high / max
94
+ for hard reasoning.
95
+ - Right-size `max_tokens` — do not leave a huge ceiling. An unrealistically
96
+ large `max_tokens` does not cost tokens by itself, but it risks runaway output
97
+ and defeats pre-flight budgeting.
98
+
99
+ ## When to reach for which
100
+
101
+ | Situation | Lever |
102
+ |---|---|
103
+ | Same large context reused across many calls | Prompt caching |
104
+ | Thousands of independent, non-urgent jobs | Batch API (+ caching) |
105
+ | Turn is mechanical / narrow / well-specified | Cheaper model tier |
106
+ | Turn is routine and does not need deep thinking | Lower `effort` |
107
+ | Output could balloon unnecessarily | Cap `max_tokens` |
108
+ | Interactive latency matters | Caching + tiering; not Batch |
109
+
110
+ ## Claude Code note
111
+
112
+ In Claude Code, prompt caching is automatic — resending the same context prefix
113
+ is cheap, so keeping a stable prefix pays off without any explicit
114
+ `cache_control`. The session-level hygiene levers are `/clear` and `/compact` to
115
+ shed accumulated context, plus subagent delegation for verbose output so it
116
+ never lands in the main context window.
117
+
118
+ ## See also
119
+
120
+ - [`model-recommendation.md`](model-recommendation.md) — tier routing (the
121
+ capability band behind lever 3).
122
+ - [`size-and-scope.md`](size-and-scope.md) — token discipline for the artifacts
123
+ that become the cached prefix.
124
+ - The Claude Code `claude-api` plugin skill (external, not vendored here) — the
125
+ authoritative, versioned API reference these figures derive from; re-check it
126
+ when Anthropic pricing or the caching/batch surface changes.
@@ -0,0 +1,109 @@
1
+ # Cross-Source Consistency — Mechanics
2
+
3
+ > The discrepancy taxonomy, the scan procedure, the confidence-tiered noise control, worked examples, and the precedence table for the `cross-source-consistency` rule
4
+
5
+ _Companion to `src/rules/cross-source-consistency.md` (P4 pattern of `road-to-kernel-and-router.md`). The Iron Law, the fire/not-fire scope, and the subordination clauses stay in the rule; this file carries the taxonomy detail, the scan procedure, and the examples._
6
+
7
+ ## The discrepancy taxonomy
8
+
9
+ | # | Class | Definition | Canonical example |
10
+ |---|---|---|---|
11
+ | a | **text ↔ image** | The ticket/spec text contradicts an attached mockup, screenshot, or diagram. | Text: "show birthdays **today**". Mockup: a birthday from two days ago. |
12
+ | b | **silent-but-needed** | The spec is silent on a behavior that is clearly required for the feature to be correct. | Spec: weekend-shifting only. Clearly also needed: public-holiday shifting — but never specified. |
13
+ | c | **spec ↔ codebase/reality** | The spec contradicts what the code, DB, API, or a real source actually does. | Spec: "the endpoint returns `dueDate`". The DTO has no such field. |
14
+ | d | **intra-ticket** | Acceptance criteria, description, and comments contradict each other. | Description: real-time. AC: "nightly batch is fine." |
15
+
16
+ Type (a) and (d) are **contradictions between present sources** — the agent
17
+ must not pick one silently. Type (b) is a **scope decision** — the inferred
18
+ behavior may be right, but adding it is a scope expansion the user owns. Type
19
+ (c) routes the *verification* to `source-discovery` (read the real source); this
20
+ rule only owns *surfacing the conflict and asking*.
21
+
22
+ ## The scan procedure
23
+
24
+ Run this whenever planning, refining, estimating, roadmapping, or implementing
25
+ from a ticket/spec that carries a second source:
26
+
27
+ 1. **Enumerate the sources.** Ticket text, every attachment (mockup / screenshot
28
+ / diagram), the AC block, description, comments, and — for implementation —
29
+ the relevant codebase/DB/API surface. If an attachment cannot be read,
30
+ say so; do not assume it agrees.
31
+ 2. **Compare pairwise for type (a), (c), (d).** For each pair, ask: do they state
32
+ the same thing about the same requirement? A mismatch is a discrepancy.
33
+ 3. **Scan for type (b) — silence.** List the behaviors the feature obviously
34
+ needs but the spec never mentions (weekend/holiday shifts, empty states,
35
+ error paths, permission edges, pagination, timezone). Each unstated-but-needed
36
+ behavior is a candidate to surface — not to implement.
37
+ 4. **Classify confidence.** High = the sources plainly disagree, or the missing
38
+ behavior is clearly load-bearing. Low = the "conflict" is a plausible
39
+ re-reading, or the missing behavior may be intentionally out of scope.
40
+ 5. **Decide per the setting** (below), then **batch** every surviving discrepancy
41
+ into ONE question folded into this turn's single `ask-when-uncertain` prompt.
42
+
43
+ ## Confidence-tiered noise control (`consistency.cross_source`)
44
+
45
+ The rule fires only under a real trade-off (it must pass the
46
+ `no-cheap-questions` Pre-Send Self-Check). The setting tunes how aggressively:
47
+
48
+ | Value | High-confidence discrepancy | Low-confidence discrepancy |
49
+ |---|---|---|
50
+ | `on` (default) | Surface + ask before proceeding. | Surface + ask (batched into the same question). |
51
+ | `auto` | Surface + ask. | State as an explicit assumption and proceed (no question). |
52
+ | `off` | No cross-source checking — legacy behavior. | No cross-source checking. |
53
+
54
+ Batching is the anti-noise mechanism: N discrepancies for one artefact become
55
+ one numbered-options block, never N prompts. Plain vagueness (a single unclear
56
+ source, no second source to compare) is **not** a discrepancy — it stays with
57
+ `ask-when-uncertain` so the two disciplines never double-fire on the same input.
58
+
59
+ ## Worked examples
60
+
61
+ ### Example 1 — text ↔ image (type a)
62
+
63
+ Ticket: *"The tile shows employees who have their birthday **today**."* Attached
64
+ mockup: a card with a birthday dated **two days ago**.
65
+
66
+ - Wrong: implement "today" (or implement "recent, like the mockup") and move on.
67
+ Both are silent guesses on a real contradiction — a violation even if the
68
+ chosen reading turns out correct.
69
+ - Right: *"The ticket text says 'today' but the mockup shows a birthday from two
70
+ days ago. Which is authoritative — (1) strictly today, (2) a recent window as
71
+ the mockup implies, (3) something else?"* Then implement the confirmed reading;
72
+ `design-fidelity` governs building it 1:1 afterwards.
73
+
74
+ ### Example 2 — silent-but-needed (type b)
75
+
76
+ Ticket update: *"If a birthday falls on the weekend, show it on the next
77
+ workday."* The spec never mentions public holidays.
78
+
79
+ - Wrong: also shift birthdays that fall on a public holiday, because it is
80
+ "obviously" consistent with the weekend rule — a silent scope expansion.
81
+ - Right: *"The spec covers weekend-shifting but is silent on public holidays.
82
+ Should birthdays on a public holiday also shift to the next workday? (1) yes,
83
+ same as weekends, (2) no, holidays are out of scope, (3) only regional
84
+ holidays."* Obvious-to-the-agent ≠ in-scope; `scope-control` owns the
85
+ expansion permission.
86
+
87
+ ## Precedence & subordination
88
+
89
+ | Neighbour rule | Relationship |
90
+ |---|---|
91
+ | `ask-when-uncertain` | **Parent ask discipline.** This rule folds its discrepancy into that rule's single question. `ask-when-uncertain` fires on *missing* info; this adds *conflicting present* sources. Never a second question block. |
92
+ | `scope-control` | **Permission authority** for the type-(b) silent-scope-expansion. This rule surfaces the expansion; `scope-control` gates it. |
93
+ | `design-fidelity` | **Fires after** this rule. This rule resolves a text↔image conflict at decision time; `design-fidelity` then enforces build-time 1:1 fidelity to the resolved design. |
94
+ | `source-discovery` / `source-discovery-gate` | **Owns verification** for type (c). This rule surfaces the spec↔code conflict; `source-discovery` provides the evidence procedure. |
95
+ | `no-cheap-questions` | **Floor.** A discrepancy ask must carry a real trade-off; batch, never nag. |
96
+ | `active-remediation` | **Sibling shape.** Its never-silently-ignore ladder is the response model this rule applies to source discrepancies rather than code issues. |
97
+
98
+ ## Failure modes
99
+
100
+ - **Silent-correct-guess.** Picking the right reading of a contradiction without
101
+ asking. Correct output, wrong process — still a violation.
102
+ - **Double-firing.** Emitting a discrepancy question AND a separate
103
+ `ask-when-uncertain` / `improve-before-implement` question about the same
104
+ underlying uncertainty. Fold into one turn's one question.
105
+ - **Noise creep.** Surfacing plausible re-readings as if they were hard
106
+ contradictions. Use the confidence tier; `auto` states low-confidence as an
107
+ assumption instead of asking.
108
+ - **Silent scope expansion.** Implementing an inferred-but-unspecified behavior
109
+ because it seems obvious. It is a scope decision the user owns.
@@ -3,7 +3,8 @@
3
3
  **Principle:** Global is the only consumer scope. `init` writes to
4
4
  user-scope paths (`~/.event4u/agent-config/`, `~/.claude/`,
5
5
  `~/.cursor/`, …); the project tree only gets `agents/overrides/`
6
- and `agents/.event4u-bridge.yml`. Opt-in `export` if a team wants
6
+ (the bridge marker was retired — ADR-020 amendment 2026-07-13; the
7
+ global root resolves from `~/.event4u/agent-config`). Opt-in `export` if a team wants
7
8
  a tool's config committed to a repo. No Task, no Make, no build
8
9
  tools required.
9
10
 
@@ -23,8 +23,9 @@ With the flag set, the installer:
23
23
  1. Allows project-scope writes back into the repo tree (so a
24
24
  maintainer can run `task dev:install-global` and iterate on the
25
25
  working copy).
26
- 2. **Skips** writing `agents/.event4u-bridge.yml` into the package
27
- repo (per `consumer-bridge § Writer contract`). The repo is the
26
+ 2. **Skips** consumer-surface writes into the package repo. (The
27
+ `agents/.event4u-bridge.yml` marker is retired — ADR-020 amendment
28
+ 2026-07-13 — and no longer written at all.) The repo is the
28
29
  source, not a consumer of itself.
29
30
  3. Treats `~/.event4u/agent-config/` as a peer install — touches are
30
31
  limited to the working-copy projection.
package/docs/proof.md CHANGED
@@ -27,7 +27,7 @@ evidence pointer, or `task check-claims` fails the build.
27
27
  | Claim | Kind | Evidence | Resolves |
28
28
  |---|---|---|---|
29
29
  | The release process is documented as an inheritable runbook + succession doc, and the project's bus-factor (trailing-90-day distinct human reviewers) is tracked and reported truthfully — currently 1, not implied to be more. | qual | `docs/succession.md#trailing 90 days` | ✅ |
30
- | 183 commands. | quant | `src/scripts/check_artefact_count_messaging.ts#Artefact-count messaging gate` | ✅ |
30
+ | 184 commands. | quant | `src/scripts/check_artefact_count_messaging.ts#Artefact-count messaging gate` | ✅ |
31
31
  | A MEASURED-BUT-NOT-SHIPPED experiment — the thin rule projection reduced eager rule load 78,513 → 13,881 GPT-tokens (whole always-loaded projection 98,529 → 33,897, ~65.6%), but FAILED the quality gate (thin win-rate 36.2% vs required 48%) and does not ship; it un-defers only behind `discipline_profile: essential`. Shipped behavior does NOT include this reduction. Method: `agent-config benchmark` over the pinned token baseline; the baseline is the honest "what the user pays if everything loads eagerly", NOT a synthetic full-corpus strawman (council Q4); quality gate per the Phase-0 paired judge run. | quant | `internal/bench/reports/token-baseline.json#eager_rule_load` | ✅ |
32
32
  | The first cross-vendor parity pass (5 orchestration-corpus tasks × 2 vendors × 3 repeats, identical prompts via the council transport, $0.16) measured real per-host finding-count differences — claude-sonnet-4-5 surfaced ~2× the findings of gpt-4o on the multi-file analysis task (median 11 vs 5) while both vendors were identical on the planted hollow-implementation task (2 vs 2) and perfectly silent on the clean-code negative control (0 vs 0, no spurious findings). The per-task `finding_floor` values are calibrated from the cross-host lower envelope and the gate is armed. | quant | `internal/bench/reports/parity-count.json#min over hosts of median` | ✅ |
33
33
  | On a weak host (claude-haiku-4-5) the package produces a significant, placebo-controlled discipline lift on scope/downstream traps; on a strong host the same measurement is a published null — the package transplants discipline a weak model lacks, not model intelligence. | quant | `docs/benchmark.md#weak-host-specific` | ✅ |
@@ -41,11 +41,11 @@ evidence pointer, or `task check-claims` fails the build.
41
41
  | The whole layer is compiled into host agents with zero runtime daemon. | qual | `docs/contracts/no-runtime-boundary.md#file-first, no-runtime suite` | ✅ |
42
42
  | On a 12-fixture option-decision corpus (3 arms × 2 providers, blind rubric judge claude-opus-4-8, pre-registered hypotheses), famous-figure identity framing added nothing beyond the underlying method text (method 5.04 vs figure 4.88, Δ=0.17, sign-test p=0.607), and provider diversity moved judged quality ~15× more than persona identity (provider Δ=2.58 vs identity Δ=0.17); the whole persona layer lifted only +0.08 over bare prompts. Honest null — persona panel-mode stays CUT, evidence-closed. | quant | `internal/bench/reports/persona-placebo.json#honest-null` | ✅ |
43
43
  | On the live end-to-end retrieval benchmark (9 tasks × 3 arms × 3 seeds on claude-haiku, fixture store with keyword-overlapping confusers), the memory retrieval substrate scored precision@5 = 100% (9/9) with 100% poisoned-entry rejection, and the retrieval-on arm passed 27/27 model-scored tasks vs 2/27 with retrieval off and 4/27 with a placebo injection. Known limit stays published: mean tie-set 4.1 means top-k ties break by store order, not relevance (the ADR-116/FTS5 signal). | quant | `internal/bench/reports/second-brain-retrieval.json#retrieval-on` | ✅ |
44
- | 104 governed rules. | quant | `src/scripts/check_artefact_count_messaging.ts#Artefact-count messaging gate` | ✅ |
44
+ | 105 governed rules. | quant | `src/scripts/check_artefact_count_messaging.ts#Artefact-count messaging gate` | ✅ |
45
45
  | On a deterministic multi-session recall corpus, the memory substrate produces a measured, placebo-controlled recall lift — memory-on 27/27 vs no-memory 10/27 and vs equal-byte placebo 9/27 (claude-haiku-4-5, n=9 tasks x 3 seeds, sign test p=0.031 for BOTH pairings). Scoped honestly: this is the context-value upper bound (perfect retrieval on a one-fact-per-task corpus), not retrieval precision under a large store. | quant | `internal/bench/reports/second-brain-delta.json` | ✅ |
46
46
  | Removing the perfect-retrieval assumption, the substrate's REAL keyword retrieval recalls the needed decision into the top-5 under keyword-overlapping confusers (precision@5 9/9) and the model disambiguates it from the co-injected confusers — retrieval-on 27/27 vs no-memory 5/27 and vs equal-count placebo 5/27 (claude-haiku-4-5, 9 tasks x 3 seeds, sign test p=0.008 both). Named limit: retrieval RECALLS but does not RANK (mean tie-set 3.3, ties broken by store order, not relevance) — the discrimination gap that motivates the SQLite-FTS5 activation path (ADR-116) at larger scale. | quant | `internal/bench/reports/second-brain-retrieval.json` | ✅ |
47
47
  | Every artifact the package ships — source AND the condensed projection that reaches consumers — is machine-scanned in CI for hidden-Unicode, mixed-script-confusable, and instruction-smuggling payloads (the rules-file-backdoor class); a finding blocks the release before `npm publish`, not just the merge. | qual | `.github/workflows/publish-npm.yml#lint_agent_security` | ✅ |
48
- | 274 skills. | quant | `src/scripts/check_artefact_count_messaging.ts#Artefact-count messaging gate` | ✅ |
48
+ | 275 skills. | quant | `src/scripts/check_artefact_count_messaging.ts#Artefact-count messaging gate` | ✅ |
49
49
  | Removes only its own keys from a shared host config (matched by JSON-pointer + SHA-256), never a neighbour tool's entries. | qual | `docs/contracts/install-layout.md#JSON-pointer` | ✅ |
50
50
 
51
51
  **21 backed claim(s)** — all evidence pointers resolve in CI.
@@ -56,7 +56,7 @@ guidelines, personas) are **generated from source and CI-drift-checked**:
56
56
  fails the build on any count-shaped prose mention that drifts from the
57
57
  source count — or on two different numbers for the same artefact kind.
58
58
 
59
- We also publish our **debt**: 4 claim(s) are logged as
59
+ We also publish our **debt**: 5 claim(s) are logged as
60
60
  `unbacked` inventory in the ledger — not yet bound, and therefore not
61
61
  allowed to carry a marker in public prose. Hiding them would be the
62
62
  opposite of the point.
@@ -77,11 +77,11 @@ shipping theater; the full per-cell data is committed at
77
77
  `internal/bench/reports/persona-placebo.json`.
78
78
 
79
79
  **Behavioural-eval coverage — the honest baseline.** Skill *quality* is only
80
- as good as its measurement. Today **42 of 274** skills carry a behavioural
80
+ as good as its measurement. Today **42 of 275** skills carry a behavioural
81
81
  `evals.json`; the highest-traffic / highest-cost tiers (default-surface +
82
82
  `rich` + routers) are **fully covered (35 of 35)**, the long tail
83
- (7 of 239) is not. We publish that gap rather than imply
84
- "274 evaluated skills": coverage is measured per tier
83
+ (7 of 240) is not. We publish that gap rather than imply
84
+ "275 evaluated skills": coverage is measured per tier
85
85
  (`./scripts-run src/scripts/skill_eval_coverage`), **CI-ratcheted so it can
86
86
  only rise**, and the priority tiers carry a hard **tier floor**: every
87
87
  rich / default-surface / router skill MUST have a behavioural eval or an
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@event4u/agent-config",
3
- "version": "9.0.0",
3
+ "version": "9.2.0",
4
4
  "description": "Universal AI Agent OS — audited skills, governance rules, commands, and templates for AI coding tools (Claude Code, Cursor, Windsurf, Copilot).",
5
5
  "license": "MIT",
6
6
  "private": false,
@@ -252,7 +252,10 @@ const _AGENTS_DIR_MARKERS: readonly string[] = [
252
252
  'roadmaps',
253
253
  'settings/.ai-council.yml',
254
254
  'roadmaps-progress.md',
255
- '.event4u-bridge.yml',
255
+ // `overrides/` is the guaranteed minimal-consumer surface (ADR-020).
256
+ // Replaced the retired `.event4u-bridge.yml` marker (ADR-020 amendment
257
+ // 2026-07-13) so a bare consumer `agents/` dir stays anchorable.
258
+ 'overrides',
256
259
  ];
257
260
 
258
261
  /**