token-budget-auditor

token-budget-auditor is a skill for Claude Code from bonigarcia/context-engineering. It costs 105 tokens per session (799 once invoked), scanned A, original, Apache-2.0.

A procedure for measuring how much of an AI agent's context comes from instructions, tools, documents, memory, history, and user input.

In plain words
What is it for?
Use it to audit context size, compare sources with a budget, and identify the largest sources to reduce.
Why use it?
It shows what is filling the model's token budget, so you can remove, shorten, or isolate unnecessary context. Tokens are the small text units used to measure model input.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the context-engineering-skills plugin — 12 skills shipped together

Good fit Use it to audit context size, compare sources with a budget, and identify the largest sources to reduce.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/bonigarcia/context-engineering/token-budget-auditor
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add bonigarcia/context-engineering --skill token-budget-auditor
Clone the repo
git clone --depth 1 https://github.com/bonigarcia/context-engineering

Made for: Claude Code.

Or install context-engineering-skills, the plugin that ships this one along with the rest of its 12 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for token-budget-auditor

README.md
[![agentmods](https://agentmods.dev/badge/skills/bonigarcia/context-engineering/token-budget-auditor/github.svg)](https://agentmods.dev/skills/bonigarcia/context-engineering/token-budget-auditor)
Your own site
<a href="https://agentmods.dev/skills/bonigarcia/context-engineering/token-budget-auditor"><img src="https://agentmods.dev/badge/skills/bonigarcia/context-engineering/token-budget-auditor/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for token-budget-auditor

Your own site · 80×15
<a href="https://agentmods.dev/skills/bonigarcia/context-engineering/token-budget-auditor"><img src="https://agentmods.dev/badge/skills/bonigarcia/context-engineering/token-budget-auditor.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 105 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 799 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00105 $0.00799
Opus 5.5 $0.00042 $0.00320
Sonnet 5.5 $0.00021 $0.00160
Haiku 4.5 $0.00011 $0.00080

Measured 11d ago against content hash d7ce720a2cd7, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

token-budget-auditor scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 11d ago.

The scan reads SKILL.md. This mod also ships 2 executable files (scripts/count_tokens.py, scripts/test_count_tokens.py), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/token-budget-auditor/SKILL.md · 59 lines

How it starts

The opening of the file, as written. The whole thing — 59 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Token budget auditor

Measure what fills this agent's context, compare it with the token budget, and tell the user what to remove, compress, or move out of the main context.

Procedure

  1. Map each input file or block to a context source: instructions (system prompt, instruction artifacts, loaded skills), tools (tool definitions), knowledge (retrieved or stuffed documents), memory (conversation history, stored memories, state), or input (the current user message).
  2. Find the token budget: use the number the user gives. Otherwise ask for it, or use 25% of the model's context window and state that assumption.
  3. From the user's project root, run python3 <this skill's directory>/scripts/count_tokens.py --budget <N> <source>=<path> ..., with one argument per file or folder and paths relative to the project root. Copy its JSON output into the tokens field. If Python is not available, estimate characters divided by four per source and say so in the summary.
  4. Read references/checklist.md and look for the patterns it lists, starting with the largest source.
  5. Write the report described below, with a ## Token budget section after the summary: a table with one row per source and the columns Source, Files, Tokens, and Share of total, followed by the total and the budget.

Report format

Write the report in Markdown, in this order:

  1. ## Summary: two to four sentences on the overall state and the most important change.
  2. ## Findings: one bullet per finding, most severe first, in the form - [severity] location: problem. Fix: suggested fix. (book section). Severity is high when the problem causes wrong or unsafe behavior, medium when it makes results unreliable or costly, and low for clarity or maintenance issues. If there are no problems, write No findings.
  3. Any skill-specific section named in the procedure.
  4. A final fenced json block with the same content, as in this example.
{
  "skill": "token-budget-auditor",
  "summary": "...",
  "tokens": {
    "method": "estimate:chars/4",
    "budget": 8000,
    "sources": [],
    "total": 0,
    "over_budget": false
  },
  "findings": [
    {
      "severity": "high",
      "location": "retrieved.md",
      "problem": "...",
      "fix": "...",
      "book_section": "Chapter 7, Context selection"
    }
  ]
}

Read the full file on GitHub · 59 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 11d ago First seen · 59 lines · 105 tokens per session scan A d7ce720a2cd7

Subscribe to this mod's changes

token-budget-auditor is a skill published in the GitHub repository bonigarcia/context-engineering (196 stars, last pushed 2d ago), licensed Apache-2.0. It adds 105 tokens to every session and 799 once invoked, about $0.0004 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-11-19.

Related

token-budget-auditor compared with skills from other repositories

token-budget-auditor next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
token-budget-auditorbonigarcia/context-engineeringSkill1962d agoApache-2.0A105Claude Code
memmachine-memoryMemMachine/MemMachineSkill3.1k3d agoApache-2.0A96Codex
persistxg-gh-25/SwarmAISkill66yesterdayMITA63Claude Code, Codex
ddd-persistxg-gh-25/SwarmAISkill66yesterdayMITA59Claude Code, Codex
libraryxg-gh-25/SwarmAISkill66yesterdayMITA68Claude Code, Codex
memory-distillxg-gh-25/SwarmAISkill66yesterdayMITA54Claude Code, Codex
context-hygienexg-gh-25/SwarmAISkill66yesterdayMITA64Claude Code, Codex