| name | context-diet |
| description | Cut agent token spend by shrinking what enters the context window. Index the repo or corpus once and query it instead of re-reading files on every question. Use when the user complains their coding agent burns tokens, the context fills up fast, the same files get read repeatedly, or the bill scales with conversation length. |
Feed the agent less, not a smarter model
When an agent re-reads the same files into context on every question, the bill scales with repetition, not with difficulty. The structural fix is a queryable index: the agent asks for the two facts it needs instead of swallowing whole files. One published reference point (arXiv:2603.27277, evaluated across 31 real repos, using a knowledge-graph MCP server): ~10x fewer tokens and 2.1x fewer tool calls at 83% answer quality versus file-by-file exploration. Treat those numbers as a ceiling from someone else's benchmark, not a promise; the whole skill is: measure your own drop.
Steps
- Baseline first. Pick one representative task (a real question about the codebase or corpus) and record tokens used and tool calls made, straight from the session's usage stats. Without this number, step 5 is theater.
- Wire an index the agent can query instead of reading raw files. For codebases over MCP,
codebase-memory-mcp is the worked example below; a repo map, a knowledge bundle, or a RAG index over docs serve the same role. What matters is the shape: query in, small answer out, instead of file in, everything in.
- Validate the MCP config parses and points at a real binary (proof below), then run the initial index (a few minutes on a large repo, sub-millisecond queries after).
- Re-run the exact same task from step 1. Record tokens and tool calls again.
- Keep the index only if the drop is real and answer quality held. Report both numbers side by side. If quality dropped more than the bill, the diet was too aggressive: the agent needs some raw context, and hybrid is a fine outcome.
Prove it
> mcp-config.json <<
{
: {
: {
: ,
: []
}
}
}
JSON
node -e