context-budget

Token overhead audit for UltraThink context window. Inventories skills, MCPs, hooks, and rules to detect bloat and optimize token usage.

39 stars

Best use case

context-budget is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Token overhead audit for UltraThink context window. Inventories skills, MCPs, hooks, and rules to detect bloat and optimize token usage.

Teams using context-budget should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/context-budget/SKILL.md --create-dirs "https://raw.githubusercontent.com/InugamiDev/ultrathink-oss/main/.claude/skills/context-budget/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/context-budget/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How context-budget Compares

Feature / Agentcontext-budgetStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Token overhead audit for UltraThink context window. Inventories skills, MCPs, hooks, and rules to detect bloat and optimize token usage.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# Context Budget — Token Overhead Audit

Audit your UltraThink context window to find bloat and reclaim tokens.

## When to Use

- Context window filling up (responses slowing, truncation)
- Hit token limits mid-task
- Adding new MCPs or skills and want to check overhead
- Periodic hygiene check

## 4-Phase Audit

### Phase 1: Inventory

List every context consumer and its approximate token cost:

| Component | Source | Est. Tokens |
|-----------|--------|-------------|
| CLAUDE.md (global) | `~/.claude/CLAUDE.md` | 500–2000 |
| CLAUDE.md (project) | `./CLAUDE.md` | 500–2000 |
| Auto-triggered skills | Hook scores top 5 | 100–300 each |
| MCP tool schemas | Always loaded per server | 200–500 per tool |
| Hook outputs | `additionalContext` injection | 50–200 each |
| System prompt rules | Built-in instructions | ~1000 fixed |
| Memory context | Session start recall | 200–800 |
| Conversation history | Messages so far | Varies |

**Quick inventory command:**
```bash
# Count CLAUDE.md tokens (rough: words × 1.3)
wc -w ~/.claude/CLAUDE.md ./CLAUDE.md
# Count MCP tools
grep -c '"name"' .mcp.json
# Count active skills
cat .claude/skills/_registry.json | grep '"name"' | wc -l
```

### Phase 2: Classify

Categorize each consumer:

- **Essential**: Core task context, active skill, required MCP
- **Helpful**: Nice-to-have context, occasionally used MCP
- **Deadweight**: Unused MCP, irrelevant skill, stale memory

### Phase 3: Detect Bloat

Common bloat patterns:

1. **Unused MCPs**: Server registered but tools never called this session → ~200-500 tokens wasted per tool
2. **Oversized CLAUDE.md**: Project instructions exceeding 1500 tokens → trim or move to reference docs
3. **Redundant skills**: Multiple skills covering same domain auto-triggered simultaneously
4. **Stale memory**: Old session memories recalled but irrelevant to current task
5. **Verbose hook output**: Hooks injecting large context blocks on every prompt
6. **Full file reads**: Reading entire files instead of using VFS signatures (60–98% savings)

### Phase 4: Report

Generate a budget report:

```
## Context Budget Report

**Total estimated overhead**: ~X,XXX tokens
**Conversation usage**: ~XX,XXX tokens
**Available headroom**: ~XX,XXX tokens

### Bloat Detected
- [ ] MCP "calendar" loaded but unused (est. 1,200 tokens for 6 tools)
- [ ] 3 skills auto-triggered with overlapping coverage
- [ ] CLAUDE.md project file at 2,100 tokens (consider splitting)

### Recommendations
1. Disable unused MCP servers for this session
2. Consolidate overlapping skills
3. Move reference docs out of CLAUDE.md into .claude/references/
4. Use VFS instead of full file reads
5. Compact conversation if >50% of context is stale
```

## Token Estimation Reference

| Item | Tokens (approx) |
|------|-----------------|
| 1 MCP tool schema | 200–500 |
| 1 auto-triggered skill | 100–300 |
| CLAUDE.md (typical) | 500–2000 |
| Memory recall block | 200–800 |
| VFS signature output | 100–300 per file |
| Full file read | 1000–5000 per file |
| Hook context injection | 50–200 per hook |

## Integration with UltraThink

- Use `mcp__vfs__stats` to get project overview without reading files
- Check `.claude/hooks/prompt-analyzer.ts` for auto-trigger overhead
- Review `_registry.json` to see which skills have high trigger overlap
- After audit, consider running `strategic-compact` to reclaim space

Related Skills

performance-budget

39
from InugamiDev/ultrathink-oss

Performance budgets — bundle size limits, LCP/FID/CLS targets, lighthouse CI, size-limit, bundlephobia

context-engineering

39
from InugamiDev/ultrathink-oss

Context window optimization, token budget management, and information compression for AI-assisted workflows

ultrathink

39
from InugamiDev/ultrathink-oss

UltraThink Workflow OS — 4-layer skill mesh with persistent memory and privacy hooks for complex engineering tasks. Routes prompts through intent detection to activate the right domain skills automatically.

ultrathink_review

39
from InugamiDev/ultrathink-oss

Multi-pass code review powered by UltraThink's quality gate — checks correctness, security (OWASP), performance, readability, and project conventions in a single structured pass.

ultrathink_memory

39
from InugamiDev/ultrathink-oss

Persistent memory system for UltraThink — search, save, and recall project context, decisions, and patterns across sessions using Postgres-backed fuzzy search with synonym expansion.

ui-design

39
from InugamiDev/ultrathink-oss

Comprehensive UI design system: 230+ font pairings, 48 themes, 65 design systems, 23 design languages, 30 UX laws, 14 color systems, Swiss grid, Gestalt principles, Pencil.dev workflow. Inherits ui-ux-pro-max (99 UX rules) + impeccable-frontend-design (anti-AI-slop). Triggers on any design, UI, layout, typography, color, theme, or styling task.

Zod

39
from InugamiDev/ultrathink-oss

> TypeScript-first schema validation with static type inference.

webinar-registration-page

39
from InugamiDev/ultrathink-oss

Build a webinar or live event registration page as a self-contained HTML file with countdown timer, speaker bio, agenda, and registration form. Triggers on: "build a webinar registration page", "create a webinar sign-up page", "event registration landing page", "live training registration page", "workshop sign-up page", "create a webinar page", "build an event page", "free webinar landing page", "live demo registration page", "online event page", "create a registration page for my webinar", "build a training event page".

webhooks

39
from InugamiDev/ultrathink-oss

Webhook design patterns — delivery, retry with exponential backoff, HMAC signature verification, payload validation, idempotency keys

web-workers

39
from InugamiDev/ultrathink-oss

Offload heavy computation from the main thread using Web Workers, SharedWorkers, and Comlink — structured messaging, transferable objects, and off-main-thread architecture patterns

web-vitals

39
from InugamiDev/ultrathink-oss

Core Web Vitals monitoring (LCP, FID, CLS, INP, TTFB), measurement with web-vitals library, reporting to analytics, and optimization strategies for Next.js

web-components

39
from InugamiDev/ultrathink-oss

Native Web Components, custom elements API, Shadow DOM, HTML templates, slots, lifecycle callbacks, and framework-agnostic design patterns