Files
Colby McHenry c64c4b3efb feat(mcp): god-file multi-phase explore rendering — send all necessary, cap only noise
A flow whose necessary code spans a god-file (Alamofire's Session.swift build
chain, ~11K) PLUS other files (the validate logic) used to truncate at the fixed
maxOutputChars and drop whichever phase came last — the agent then Read it by
hand. Six coordinated layers in handleExplore render every phase instead:

1. true-spine: an on-spine god-file renders its spine methods in full and
   collapses off-path methods to one-line signatures (Session.swift 11.6K→7.7K;
   the ~4K of off-path methods was noise the per-file cap blindly cut). Spine
   (prio 0) is exempt from the body cap — never collapse the flow path.
2. named-seed gather: each named token's substantive definition (skip empty
   stubs + test files) is injected into the subgraph — FTS buried `validate`
   under the high-frequency build terms, so Validation.swift was never gathered.
3. definition > reference ranking: a named-seed node scores +50, so a file that
   DEFINES a named symbol (Validation=50) outranks one that merely references the
   flow (Combine=23, inflated by connected-node count) and steals its slot.
4+5. the 90%-budget early-break and the total-output cap both EXEMPT necessary
   (named/spine) files — they render past the cap (bounded by maxFiles);
   incidental files stay capped so freed budget never leaks into noise.
6. the final output ceiling is 1.5×maxOutputChars — a safety bound above the
   loop's necessary content, not a hard slice through it (the flat cut was
   dropping the validate phase the loop had assembled).

A sequential flow's spine is irreducible (no redundant siblings for
skeletonization to collapse), so the honest move is to render it, not cap it.

A/B (Opus 4.8): Alamofire renders build+validators-exec+validate in ONE explore
(~16K); WITH-arm reads med 2→0.5, tools 8→5.5 (3/4 runs 0-1 reads). Excalidraw
control held at 0 reads / 3 tools (the +5K of previously-truncated necessary
content is free — fewer round-trips outweigh the bigger single response). Full
suite 1090 pass (only pre-existing npm-shim network fails). NOTE: broad sizing
change — needs the full 7-repo bench sweep before merge.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-05-30 12:55:06 -05:00
..