feat(mcp): per-symbol adaptive codegraph_explore sizing (#569)
Sizes codegraph_explore to the answer, not the file count: shows the mechanism + the exact methods you named in full (even buried in a large file) while collapsing redundant interchangeable implementations to signatures. Adds uniqueness-aware spare, per-symbol focused rendering of family files, all-tier test-file exclusion, and named-method cluster survival in non-sibling god-files. Validated A/B (Opus 4.8, 7-repo sweep): avg 25%% cheaper / 57%% fewer tokens / 23%% faster / 62%% fewer tool calls. Django 9->23%% cheaper (0 reads), OkHttp 4->11%% cheaper; gains across small/medium/large, inert repos unchanged. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
f1b14f021b
commit
b026e64b41
@@ -29,6 +29,33 @@ source.
|
||||
> its budget; it is now an *override* of the named-callable spare. The
|
||||
> single-condition history below is kept for context.
|
||||
|
||||
> **Further refinement (2026-05-29) — per-symbol focused view + named-cluster
|
||||
> survival.** Whole-file skeleton/spare was still too coarse on a real Django
|
||||
> A/B: the agent Read back `compiler.py` (collapsed → its `execute_sql`/`as_sql`
|
||||
> bodies elided) and `query.py` (a non-sibling god-file whose `_fetch_all` cluster
|
||||
> got trimmed). Four changes took both repos from ~9–10% to **~14–17% cheaper**
|
||||
> with **median 0 reads**:
|
||||
> 1. **Uniqueness-aware spare** — only a (near-)UNIQUE named callable spares a
|
||||
> file. `as_sql` has **110 defs** across every Compiler/Expression subclass;
|
||||
> naming it must not keep every backend variant full (it was flooding Django's
|
||||
> budget). `getResponseWithInterceptorChain` (1 def) still spares RealCall.
|
||||
> 2. **Per-symbol focused view** — a collapsed family file shows the **full body**
|
||||
> of on-spine / unique-named / canonical-base-supertype methods and only
|
||||
> **signatures** for the rest. So `SQLCompiler.execute_sql`/`as_sql` survive
|
||||
> while the 80 other symbols + redundant subclasses collapse → no Read-back.
|
||||
> 3. **Test-file exclusion on all tiers** — a test file (`custom_lookups/tests.py`)
|
||||
> was eating 2.3 KB of Django's 28 KB budget; tests rarely answer an
|
||||
> architecture question. (Previously only the <500-file tiers excluded them.)
|
||||
> 4. **Named-cluster survival in non-sibling files** — inject agent-named method
|
||||
> defs into a file's clusters even when the gather missed them, rank them at
|
||||
> importance 9, and cap cluster selection at `min(per-file, remaining-total)`
|
||||
> so high-importance named clusters survive instead of being source-order
|
||||
> trimmed (Django's `_fetch_all`, L2237, the last of four big files emitted).
|
||||
> Controls held: OkHttp 14% cheaper / 0 RealCall read-backs; Excalidraw 31%
|
||||
> cheaper / 0 reads (god-file clustering unaffected — its big file is emitted
|
||||
> first, so the budget cap never binds it). OkHttp's interceptors stay a pure
|
||||
> signature skeleton (no named callable in them, don't define a supertype).
|
||||
|
||||
---
|
||||
|
||||
## TL;DR
|
||||
|
||||
Reference in New Issue
Block a user