Instead of pasting whole files, diffctx walks the dependency graph from the changed lines outward — and stops as soon as additional context stops paying for itself. Every trade-off optimized for comprehension-per-token.
This is a live model of the pipeline — a toy repository of 18 fragments, scored and selected in your browser with the same rules the engine uses: relevance decays with graph distance, selection is greedy, and the budget is a hard wall. Step through the stages, then drag the dials.
A diff rarely lives inside one file. Each edge family is a separate builder; their weighted union is the graph relevance flows across.
Pick one with --scoring. All
three feed the same greedy selector.
Bounded ego-network expansion around the changed nodes. Fast, predictable radius, natural decay with distance.
Personalized PageRank with damping α. Global view, smoother decay, catches long-range structure — at a cost in speed.
Lexical retrieval of fragments against the diff hunks. The honest baseline — and the fallback when the graph is sparse.
$ uvx diffctx . --diff HEAD~1zero-install, run once via uv
$ pipx install diffctxrecommended — isolated CLI
$ pipx install 'diffctx[mcp]'+ MCP server for Claude Code / Cursor / Zed
$ diffctx . --diff main..feature -cbranch context → clipboard → any LLM
$ diffctx graph . --summarycycles, hotspots, coupling
Free, local, offline. Works with any LLM. Python API and standalone binaries included. Theory: Context-Selection for Git Diff (Zenodo, 2026).