report-token-budget
Skill0 starsChanged 46 days agoMITView on GitHub
Report how a run's token budget was spent from a trace file. Use when a run finished and you need to explain peak versus final tokens, which steps or tools cost the most, or what compaction reclaimed.
In this repository3 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- write-agents-mdSkill
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 2 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 23
Read the trace, never invent it: Every number in the report comes from the trace file.
- Very specific: line 52
Prefer --json when another tool consumes the answer.
- Distinctive: line 71
Start from the template: status, peak versus usable, the biggest step and tool, compaction net, and the one budget change you recommend.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Report a token budget
A trace is the evidence a run left behind. This skill turns that evidence into a one-page answer to "where did the budget go", so the next run spends deliberately instead of by accident.
Token counts are a 4-characters-per-token estimate, never a vendor invoice. Compare runs to each other, never to a bill.
Non-negotiables
- Read the trace, never invent it. Every number in the report comes from the trace file. An absent field is reported as absent.
- Peak decides, final merely remains. Size budgets against
peak, notfinal: compaction can make the final window look cheap. - Name the most expensive step and tool. A report without a biggest spender is a summary, not a diagnosis.
- Say what compaction cost and saved. Dropped messages, reclaimed tokens, and the summary's own cost, or the state "no compaction".
Steps
1. Locate the trace
ls -1t .budgetloop/traces | head -5Traces are generated evidence. Never edit one; copy it first if you must annotate. If there is no trace, re-run with a trace directory instead of guessing.
2. Run the reporter, not your eyes
python skills/report-token-budget/scripts/report_budget.py <trace> [--json]The script reads one trace and prints the whole breakdown: budget and
headroom, per-step growth, per-tool observation cost, and compactions.
Prefer --json when another tool consumes the answer.
3. Read the four sections in order
- Budget —
budget,usable_budget,peak,final, headroom, and utilisation. Over 85% peak utilisation means the next similar run needs a bigger budget or a smaller task. - Steps — which step grew the window most. A single huge jump points at one observation; steady growth points at the task size.
- Tools — which tool's observations cost the most characters and which ones failed. Failures still occupy the window.
- Compactions — what was summarised away and the net reclaimed. Zero compactions on a tight budget is a finding, not an omission.
Field meanings live in budget fields.
4. Write the verdict in one paragraph
Start from the template: status, peak versus usable, the biggest step and tool, compaction net, and the one budget change you recommend. One paragraph, numbers included.
Output shape
A short report (terminal text or JSON with --json): header, budget,
steps, tools, compactions, verdict. No required schema beyond naming
the biggest spender and the compaction net.
Edge cases
- No compactions — say so explicitly; do not leave the section out.
- Budget-exceeded runs — the overflow step is the finding. Report the fixed cost versus the observation that could not fit.
- Failed observations — they cost window space too. List them under tools, not as a footnote.
- Hand-written or partial traces — report which fields are absent rather than filling them with zeros.
Reference
- Budget fields — where each number comes from in the trace, and what the ledger actions mean.
- Report template — the verdict skeleton.
- Script:
scripts/report_budget.py— the only reader you need.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

