Repository navigation
v0.1.4
Measure the context your AI coding agent loads before you type a single word — and fail the build when it grows.
agentdiet is a single static binary that walks a repository, finds every file your agent runtime injects into the prompt — AGENTS.md, CLAUDE.md, .cursorrules, copilot-instructions.md, skills, MCP declarations — and reports what that costs: always-on tokens paid on every request, the on-demand surface, cost per 1,000 sessions, and an A–F grade against a budget you can enforce in CI.
It does not lint your code. It lints the instructions: the one part of the repository that every agent pays for on every turn, and the part nobody measures.
ALWAYS-ON paid on every request, before you type
442 0.22% 41 L .claude/CLAUDE.md
TOTAL 442 always-on tokens (0.22% of a 200,000-token window)
GRADE A (budget 1,500) on-demand surface: 76,533 tokens
COST $1.33 per 1,000 sessions at $3.00 per 1M input tokens
Use it as a step
- uses: indraoverflow/agentdiet@v0.1.4
with:
max-tokens: 4000 # fail the job above this always-on budget; 0 disables the gate
window: 200000 # context window for the share column| input | default | meaning |
|---|---|---|
path |
. |
repository path to audit |
max-tokens |
4000 |
fail when always-on tokens exceed this; 0 disables the gate |
window |
200000 |
context window used for the share column |
version |
latest |
agentdiet version to install |
| output | meaning |
|---|---|
always-on-tokens |
tokens injected into every request |
grade |
A–F against the budget |
Deterministic and offline: no API key, no network at audit time. The estimator (prose chars/4.5 + fenced-code chars/3.4, rounded up per segment) is calibrated against cl100k_base at a measured MAE of 8%.
Why this exists
Every agent runtime has a folder of files it loads unconditionally. They grow by accretion — a rule per incident, a table per architecture decision — until the agent spends 12k tokens of attention on stale instructions before it has read the question. agentdiet turns that into a number in the CI log and a budget that fails the pull request that would have made it worse.
MIT licensed. Source, docs, and real sample output: https://github.com/indraoverflow/agentdiet