MCP Context Graph Compresses 90% of Tokens

nascousa · reddit · 2026-07-13

The author open-sourced a local-first MCP context graph tool, **CGA**, which offloads files, symbols, imports, calls, containment relationships, dependencies, and lightweight variable flows from the model context. The MCP client queries the graph based on the task and generates a smaller evidence package for the agent to use. Testing across 3 real code repositories with 34 deterministic cases each showed: - Average prompt tokens dropped from **5,474.95** to **483.29** - An average reduction of **90.44%** - Hallucination Pressure Score dropped from **17.66** to **13.94**, roughly **13.34%** lower However, one repository degraded in contextual risk metrics. The author stresses that graph slicing can be too narrow, meaning "less context" shouldn't automatically be equated with "better." They currently treat the graph as a **routing layer** rather than a source of truth, falling back to source code search or LSP if evidence is too old, weak, or dynamically changing. Current implementation boundaries: Python uses the standard library AST; TypeScript/JavaScript, PowerShell, Go, Rust, and Java still use lightweight extractors rather than full compilation semantics. The author concludes by asking what signal is most useful to the model: freshness, evidence source, fallback reasons, or retrieval latency.

Original post →

More from coding & agent

coding & agent channel →