Context Budget Guard
by Ali Ahmed
Audit and optimize Claude Code context usage by identifying overlapping skills, unused plugins, and bloated configs.
Free
Context Budget Guard
Example session with this skill installed
My Claude Code sessions are getting really slow and hitting limits. Can you audit my context budget and tell me what's eating my tokens?
- Read your context and instructions
- Compiled the context budget guard
I have audited your Claude Code configuration. Your always-loaded context is currently estimated at
14,250 tokens, which is high for a standard project.
Context Audit Report
| Component | Est. Tokens | Finding | Recommendation |
|---|---|---|---|
CLAUDE.md | 5,800 | Large reference section found | Move 'API Spec' to a project skill |
skills/db-helper.md | 150 | 85% overlap with sql-query.md | Merge into a single database skill |
mcp-server-jira | 4,000 | Never used in last 30 days | Disable via .claude/settings.json |
subagents/writer | 2,100 | Redundant system prompt | Shorten description to < 80 tokens |
Top 3 Savings
- Disable Unused MCP: Saving ~4,000 tokens.
- Refactor CLAUDE.md: Saving ~3,500 tokens.
- Merge Overlapping Skills: Saving ~150 tokens and improving tool selection accuracy.
The audit shows that
70% of your budget is spent on tools and documentation you haven't touched in the last 30 sessions. Reducing this will significantly lower your latency.
Next steps
- Run
python3 scripts/cbg.py --save-baseline cbg-baseline.jsonto lock these stats. - Approve moving the 'API Spec' section from
CLAUDE.mdto a new skill file. - Disable the Jira MCP server for this project.
Connects securely to your tools. The creator never sees your data.
About this skill
Bloated context windows lead to slow responses, high token costs, and agents selecting the wrong tools. This skill audits your Claude Code environment to identify exactly what is consuming your always-on token budget and provides a path to a leaner setup.
What it does
- Analyze token consumption by scanning
CLAUDE.md, project skills, subagents, and MCP configurations. - Detect skill overlap using lexical similarity checks to find descriptions that confuse the agent.
- Identify unused assets by cross-referencing local session transcripts to see which plugins or skills haven't been invoked.
- Calculate budget baselines to track how configuration changes affect your permanent context load over time.
- Surface high-impact fixes by ranking findings based on potential token savings.
How it works
- Run the
cbg.pyscript against your project root or an uploaded configuration bundle to generate acontext-report.md. - Review the always-loaded estimate and top three findings surfaced by the agent.
- Save a baseline snapshot before applying suggested fixes like merging overlapping skills or moving reference docs to on-demand skills.
- Execute a comparison run to verify token reduction and confirm the agent's improved focus.
Frameworks & tools
Python 3 standard library. Integrates with Claude Code, .claude configuration folders, CLAUDE.md files, and .mcp.json server definitions.
Why this beats prompting it yourself
Standard prompts cannot see your local session history or calculate cross-file token estimates with consistency. This skill uses a specialized script to parse local transcripts and configurations that are normally invisible to a generic chat session.
Use cases
- Reducing "token fever" when sessions hit limits too early in the workday.
- Debugging why an agent picks the wrong skill for a specific task.
- Auditing a complex multi-agent workspace before a production deployment.
- Cleaning up legacy plugins and MCP servers that are no longer in use.
Known limitations
Token counts are ±25% estimates as no tokenizer is bundled. MCP tool schemas are not fetched; costs are based on flat estimates. Overlap detection uses TF-IDF, which may miss some semantic clashes.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Free to use
No account required to browse
Trust & safety
Security scan
Security scan passed 6 days ago
- Free with an Agensi account
- Software
Python 3.10+
Permissions
Read-only audit. Reads CLAUDE.md, skill/agent files, MCP server names and (optionally) local session logs to count skill usage. Never opens .credentials.json or .env. Writes only context-report.md and optional baseline JSON. No network calls.
What's inside
Frequently Asked Questions
New in LLM Ops
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for LLM Ops.