What does it cost an AI agent to read your repository — and how much of that is waste?

Free, open source (MIT), runs entirely locally. No tokenizer dependency.

$ uvx contextcost .
# no install, no config, results in seconds

Measured on 17 well-known open-source repositories

RepositoryTokens to readAfter proposalSavedShare
moby/buildkit14,600,5691,529,63713,070,93289.5%
jesseduffield/lazygit5,766,1901,278,9934,487,19777.8%
sharkdp/bat53,715,38923,737,44329,977,94655.8%
astral-sh/uv8,855,6184,331,8424,523,77651.1%
astral-sh/ruff20,978,63410,531,46210,447,17249.8%
plotly.js63,831,05937,008,91726,822,14242.0%
dask4,315,0002,308,3632,006,63746.5%
pandas10,105,5777,929,2822,176,29521.5%
rclone7,889,0816,169,6731,719,40821.8%
trufflesecurity/trufflehog4,456,1813,011,7601,444,42132.4%
gitleaks300,980199,238101,74233.8%
keycloak18,687,55617,290,3371,397,2197.5%
pydata/xarray2,133,2762,007,117126,1595.9%
restic1,054,9891,005,18249,8074.7%
astropy7,881,7277,669,606212,1212.7%
mikefarah/yq420,446417,4572,9890.7%
contextcost itself175,18991,87283,31747.6%

The "after" number is not arithmetic on guesses: contextcost proposes cuts, then walks the repository again with the proposal applied. Estimates carry a measured error bound (see ERROR_BOUND in estimate.py — currently ±23%, measured over real source, config and lockfiles); --accurate gives exact cl100k_base counts (on plotly.js the estimate landed 0.7% off).

The spread is the finding

Make it permanent

$ contextcost . --write-ignore
# accept the proposal, confirm the saving once

$ contextcost . --fail-over 8000000
# then let CI fail when the budget creeps back

Or gate pull requests automatically with the GitHub Action — every PR gets a comment with its token delta. There is also an MCP server mode so Claude Code, Cursor and Codex can call it directly.