context-budget-audit

context-budget-audit is a skill for Claude Code, Codex from zorost/AI-Engineering-Lab. It costs 45 tokens per session (932 once invoked), scanned A, original, MIT.

A method for auditing the pieces of an AI request that consume the model’s context window—the amount of text it can handle at once.

In plain words
What is it for?
It helps set a working limit, measure instructions, tools, memory, history, retrieved material, planning state, and output space, then reduce them in order.
Why use it?
It makes hidden token use visible, preserves room for the model’s answer, and helps explain forgetting, rising costs, or slower requests.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit It helps set a working limit, measure instructions, tools, memory, history, retrieved material, planning state, and output space, then reduce them in order.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/zorost/ai-engineering-lab/context-budget-audit
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 zorost/AI-Engineering-Lab --skill context-budget-audit
Clone the repo
git clone --depth 1 https://github.com/zorost/AI-Engineering-Lab

Made for: Claude Code, Codex.

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 context-budget-audit

README.md
[![agentmods](https://agentmods.dev/badge/skills/zorost/ai-engineering-lab/context-budget-audit/github.svg)](https://agentmods.dev/skills/zorost/ai-engineering-lab/context-budget-audit)
Your own site
<a href="https://agentmods.dev/skills/zorost/ai-engineering-lab/context-budget-audit"><img src="https://agentmods.dev/badge/skills/zorost/ai-engineering-lab/context-budget-audit/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 context-budget-audit

Your own site · 80×15
<a href="https://agentmods.dev/skills/zorost/ai-engineering-lab/context-budget-audit"><img src="https://agentmods.dev/badge/skills/zorost/ai-engineering-lab/context-budget-audit.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 45 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 932 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. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
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.00045 $0.00932
Opus 5 $0.00023 $0.00466
Sonnet 5 $0.00009 $0.00186
Haiku 4.5 $0.00005 $0.00093

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

Security

Grade A, and why

context-budget-audit 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 10d ago.

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.

reference/skills/agent-skills/context-budget-audit/SKILL.md · 87 lines

How it starts

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

Context Budget Audit

1 · Purpose

Make the context window a managed budget, allocated, measured, and alerted, instead of an invisible resource that fails silently when it runs out.

2 · When to use

  • Designing any new LLM call or agent step.
  • When an agent "forgets" instructions it was given earlier (the classic symptom).
  • When token cost or latency climbs without a quality gain.

3 · Inputs

  • The model's advertised context limit (from its card or API docs).
  • One real captured request (log, trace, or print of the assembled messages).
  • The actual tokenizer for the model, or tiktoken/the provider's usage field.

4 · Procedure

  1. Set the working ceiling: 80% of the advertised limit. The last 20% is headroom you never plan against, models degrade near the wall.
  2. Measure, do not estimate, the seven claimants with the real tokenizer: system instructions, tool schemas, durable memory, conversation history, retrieved evidence, scratchpad/plan state, and the reservation for the model's own output.
  3. Write the budget table: claimant × tokens × percent of ceiling. Total must be under 100% with output space reserved as a real line item.
  4. Order the material: stable content first (cache-friendly), background in the middle, decisive evidence last, next to the instruction it decides.
  5. Set the compaction policy for anything that grows: summarize older turns, keep decisions and commitments, drop scaffolding. Tier every claimant as pinned, compressible, or disposable.
  6. Add the runtime guard: log ctx=used/ceiling on every call; alert above 90%.
  7. When over budget, cut in this order, disposable history first, then compressible memory, then retrieved evidence (retrieve less, rerank harder). Never cut the output reservation or the decisive evidence last-mile.
  8. Re-measure after the cut and record both budgets in the design note.

5 · Anti-rationalization

Excuse Answer
"The window is huge; budgeting is premature." Huge windows still fail silently, "lost in the middle" does not throw an error.
"I'll estimate tokens by eye." Four characters per token is a folk average, wrong per model and per language. Tokenize for real.
"Compaction loses information." Unbounded growth loses the instruction the agent stops honoring. Compaction chooses what to keep.
"The API will error if we're over." Some APIs truncate silently. The 90% alert is the only honest signal.

Read the full file on GitHub · 87 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. 10d ago First seen · 87 lines · 45 tokens per session scan A a71840086c83

Subscribe to this mod's changes

context-budget-audit is a skill published in the GitHub repository zorost/AI-Engineering-Lab (302 stars, last pushed 23d ago), licensed MIT. It adds 45 tokens to every session and 932 once invoked, about $0.0002 per session on Opus 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-08-30.

Related

Other skills, from other repositories

ai-engineering-toolkit

6 production-ready AI engineering workflows: prompt evaluation (8-dimension scoring), context budget planning, RAG pipeline design, agent security audit (65-point checklist), eval harness building, and product sense coaching.

sickn33/agentic-awesome-skills · 47 tokens

llm-ops

LLM Operations -- RAG, embeddings, vector databases, fine-tuning, prompt engineering avancado, custos de LLM, evals de qualidade e arquiteturas de IA para producao.

davila7/claude-code-templates · 44 tokens

llm-integration

LLM integration patterns for function calling, streaming responses, local inference with Ollama, and fine-tuning customization. Use when implementing tool use, SSE streaming, local model deployment, LoRA/QLoRA fine-tuning, or multi-provider LLM APIs.

yonatangross/orchestkit · 58 tokens

ai-engineering-toolkit

AI Engineering Toolkit workflow skill. Use this skill when the user needs 6 production-ready AI engineering workflows: prompt evaluation (8-dimension scoring), context budget planning, RAG pipeline design, agent security audit (65-point checklist), eval harness building, and product sense coaching and the operator…

diegosouzapw/awesome-omni-skills · 81 tokens

fine-tuning-os

Use this skill when conducting a professional LLM fine-tuning engagement in Zero-Data mode via the MCP server fine-tuning-os. Triggers on: prestation de fine-tuning LLM, livraison de modèle affiné, pipeline Zero-Data, orchestration des 64 outils fine-tuning-os, cycle de vie entraînement (préparation / données…

Casius999/fine-tuning-os · 125 tokens

ai-engineering-toolkit

6 production-ready AI engineering workflows: prompt evaluation (8-dimension scoring), context budget planning, RAG pipeline design, agent security audit (65-point checklist), eval harness building, and product sense coaching.

henryalouf/ruflow · 47 tokens