Static-analysis-powered context compiler for LLM coding agents. Parses Python repos into dependency graphs, selects the minimal code context for a change (callers, callees, related functions), and packs it into a token budget with a disclosure header. Optionally biases retrieval from the bug report text. Includes verify which mines your repo's git history and grades retrieval β printing NULL RESULT when it doesn't fit. Zero runtime dependencies. pip install "diffcontext[mcp]".
Copy the AI prompt to install this server into Claude Code, Cursor, or another agent β or use 1-click editor setup below.
π‘ Paste the JSON block into your client's configuration file under mcpServers, then restart the application.
Show an AI coding assistant only the code that matters for the change it is making.
DiffContext is a context compiler for LLM coding agents. Give it a Python repository and a change β a git diff, a branch, or a single function name β and it returns the small set of functions the model actually needs to make that change safely: the callers that will break, the subclasses that override it, the tests that cover it. It fits them to whatever token budget you have, and it tells the model what it had to leave out.
It is built for people wiring LLMs into real codebases β agent loops, PR review bots, CI checks β anywhere you have to decide what goes in the prompt and the repository is far too large to send.
And it grades itself: point it at your repo and it mines your git history, runs retrieval against real co-change pairs, and prints NULL RESULT when it doesn't fit β finding that out is the feature.
Ask an assistant to change one function in a 50,000-line project and you have
three bad options: paste the whole repository (it does not fit, and models get
worse in very large contexts), paste just that one function (the model breaks
three callers it never saw), or grep for the name (grep cannot find the
subclass that overrides it, or the handler that receives it through
functools.partial β we measured grep's recall plateauing no matter how
much budget you give it).
DiffContext is the fourth option. Parse the repository once into a real dependency graph, then for any change select the few functions that actually matter and pack them into the smallest useful prompt.
Zero runtime dependencies, Python 3.9+.
For MCP integration (Claude Code / Cursor / Windsurf):
See docs/MCP.md for the server config.
From source for development:
More commands: USAGE.md. Production recipes: docs/USE_CASES.md.
diffcontext verify --from-history 20 --calibrate mines test cases from
your repo's git history and grades retrieval against them β and prints
NULL RESULT rather than a decorative number when the tool doesn't fit
your repo. Finding that out is the feature.
Yes β measured end to end, not by proxy. On 128 ContextBench Python tasks judged by each repository's own test suite (no LLM-as-judge), context roughly quadruples pass@1: 5.5% β 25.8%, exact McNemar p < 0.0001.
Two qualifiers, both in benchmarks/contextbench/RESULTS.md
Β§6: (a) the seed functions given to every arm are oracle β extracted
from the gold patch β so this measures "given correct localization, does
context quality matter?", not end-to-end issue solving (localization is
handed to every arm for free); (b) 121 of the 128 effective tasks are
django, so this is largely a django result.
The honest companion: the three context variants (default / gap / depboost)
are statistically indistinguishable from each other, p = 0.36β0.81. The
win is context versus no context β not this selector versus that one. Full
results: benchmarks/contextbench/RESULTS.md.
--cutoff gap if you pay per token.Ground truth is mined from git history β a developer changed these functions together in one commit; shown one, does the tool find the others? Measured on 701 real commits across 9 Python repositories, and re-run as a CI gate on every push so quality cannot silently regress.
Per-commit hit / recall of real co-change partners, hybrid retrieval:
| django | click | flask | httpx | pydantic | black* | requests* | |
|---|---|---|---|---|---|---|---|
| Hit | 0.894 | 0.889 | 0.863 | 0.935 | 0.758 | 0.897 | 0.953 |
| Recall | 0.774 | 0.750 | 0.694 | 0.772 | 0.536 | 0.712 | 0.762 |
* validation repos, never used for tuning. Full table across all 9 repos: benchmarks/README.md.
Head-to-head vs grep at identical token budgets, grep plateaus at
0.215 recall past 4k tokens while DiffContext reaches 0.576 at 8k
(2.7Γ). The honest flip side: mean precision is under 0.1 at the default
top-k β most retrieved symbols are supporting context, not the exact
co-change set. --cutoff gap cuts at the largest score drop for ~4Γ
precision at ~30% recall cost (co-change benchmark; 2.2Γ / ~14% on
ContextBench).
A 2026-07 pass attacked the evaluation instead of the tool. Three published numbers did not survive:
Full write-up: docs/auditing-my-own-benchmark.md Β· raw pass: benchmarks/RIGOR_REPORT_2026-07.md.
Incremental API (idx.update([...])), structured output, pluggable tokenizer:
docs/ARCHITECTURE.md.
| Language | Status | Retrieval quality |
|---|---|---|
| Python | Full | Benchmarked: 701 commits, 5 repos + 4 validation repos |
| TypeScript / JS (ESM) | Prototype | Mean recall 0β68% depending on code style |
| JavaScript (CommonJS) | Unsupported | Measured 0.0% on express β do not use |
Static analysis has a ceiling: thematic siblings with no call between them,
cross-subsystem conceptual links (all methods score 0/20), and dynamic
dispatch are measured blind spots β itemized in
docs/BENCHMARKS.md. When in doubt:
grep -rn "function_name(" --include="*.py" . before fully trusting
"no callers found."
MIT
No reviews yet β be the first to share how this listing worked for you.
Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.
[](https://allmcps.com/mcp/trakshan-mishra-diffcontext)<a href="https://allmcps.com/mcp/trakshan-mishra-diffcontext"><img src="https://allmcps.com/api/badge/trakshan-mishra-diffcontext?style=directory" alt="Diffcontext on AllMCPs" /></a>