feat(scanner): add AGT agent-listing always-loaded budget finding (v5.9 B1)

New AGT scanner flags the aggregate always-loaded cost of the agent listing
(every active agent's name+description is injected each turn so the model
knows what it can delegate to). Mirrors the SKL skill-listing pattern but
encodes the key honesty caveat: the agent-listing mechanism is INFERRED
(agents are absent from Claude Code's documented context breakdown), so the
token figure is an UPPER-BOUND estimate and the aggregate budget is a
config-audit heuristic anchored on 200k — not a CC-documented allotment.

- scanners/agent-listing-scanner.mjs + scanners/lib/agent-listing-budget.mjs
- 8 TDD tests (tests/scanners/agent-listing-scanner.test.mjs)
- AGT folds into the Token Efficiency health area (scoring.mjs)
- byte-stability: AGT added to strip-added-scanner (frozen v5.0.0 baselines
  left untouched, same as OST/OPT); SC-5 default-output snapshot refreshed
- suite 1168 -> 1176 green

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Kjell Tore Guttormsen 2026-06-23 15:02:59 +02:00
commit fcfb2979ef
9 changed files with 399 additions and 13 deletions

View file

@ -1,12 +1,13 @@
/**
* v5.6 C added the OST (Output-Style Validation) scanner a 14th orchestrated
* scanner. The frozen v5.0.0 byte-equal baselines predate it (13 scanners), so
* this strips the additive OST scanner entry before comparison, the same way
* strip-hotspot-load-pattern.mjs handles B2's additive hotspot fields. Stripping
* (rather than re-seeding the frozen snapshots) keeps the strongest invariant:
* the ORIGINAL 13 scanners still emit byte-identical output, and the frozen
* snapshots stay free of post-v5.0.0 drift (the hotspot triple, ancestor token
* counts) that re-seeding would bake in.
* Post-v5.0.0 additive scanners that the frozen v5.0.0 byte-equal baselines
* predate: OST (Output-Style Validation, v5.6 C), OPT (Optimization Lens, v5.7),
* and AGT (Agent-Listing Budget, v5.9 B1). The baselines froze the original
* scanner set, so this strips these additive scanner entries before comparison,
* the same way strip-hotspot-load-pattern.mjs handles B2's additive hotspot
* fields. Stripping (rather than re-seeding the frozen snapshots) keeps the
* strongest invariant: the ORIGINAL scanners still emit byte-identical output,
* and the frozen snapshots stay free of post-v5.0.0 drift (the hotspot triple,
* ancestor token counts) that re-seeding would bake in.
*
* Removing a zero-finding scanner entry only moves `aggregate.scanners_ok`
* (OST is always status 'ok' and emits nothing on the deterministic fixture, so
@ -17,7 +18,7 @@
* return stripAddedScanners(stripHotspotLoadPattern(out));
*/
const ADDED_SCANNERS = new Set(['OST', 'OPT']);
const ADDED_SCANNERS = new Set(['OST', 'OPT', 'AGT']);
function stripFromEnvelope(env) {
if (!env || typeof env !== 'object' || !Array.isArray(env.scanners)) return;
@ -58,5 +59,5 @@ export function stripAddedScanners(payload) {
*/
export function stripAddedScannerStderr(text) {
if (typeof text !== 'string') return text;
return text.replace(/^[ \t]*\[(OST|OPT)\][^\n]*\n/gm, '');
return text.replace(/^[ \t]*\[(OST|OPT|AGT)\][^\n]*\n/gm, '');
}