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.
npx skills add zorost/AI-Engineering-Lab --skill context-budget-auditgit clone --depth 1 https://github.com/zorost/AI-Engineering-LabWrote 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.
[](https://agentmods.dev/skills/zorost/ai-engineering-lab/context-budget-audit)<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.
<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>- NVIDIA SkillSpector pass
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.
| Model | Per session | Once 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 |
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.
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
- Set the working ceiling: 80% of the advertised limit. The last 20% is headroom you never plan against, models degrade near the wall.
- 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.
- Write the budget table: claimant × tokens × percent of ceiling. Total must be under 100% with output space reserved as a real line item.
- Order the material: stable content first (cache-friendly), background in the middle, decisive evidence last, next to the instruction it decides.
- 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.
- Add the runtime guard: log
ctx=used/ceilingon every call; alert above 90%. - 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.
- 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. |
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.
- 10d ago First seen · 87 lines · 45 tokens per session scan A a71840086c83
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.
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.
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.
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.
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…
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…
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.