This skill should be used throughout every session to track estimated token usage, warn when context is getting heavy, suggest compaction points, and ensure efficient use of the context window. It activates automatically and runs in the background.
Track and optimize token usage across the session. Warn before context overflow. Suggest compaction at the right moments.
Claude Code's context window is finite. Without tracking, you discover you've run out of context mid-task — the worst possible time. This skill maintains a running estimate and optimizes usage proactively.
Maintain a mental running tally of tokens consumed:
| Operation | Estimated Tokens |
|---|---|
| File read (per 100 lines) | ~500 tokens |
| Grep results (per 10 matches) | ~200 tokens |
| Glob listing (per 50 files) | ~150 tokens |
| Skill invocation overhead | ~300 tokens |
| Agent spawn (base cost) | ~1,000 tokens |
| User message (per 100 words) | ~150 tokens |
| Your response (per 100 words) | ~150 tokens |
These are rough estimates. The goal is awareness, not precision.
| Usage | Action |
|---|---|
| 0-40% | ✅ Normal operation |
| 40-60% | 📊 Report budget in next response |
| 60-80% | ⚠️ Warn: "Context at ~X%. Consider compacting." |
| 80-90% | 🔶 Strongly suggest: "Run /compact now to free context." |
| 90%+ | 🔴 Emergency: summarize all working state, then compact |
Include in responses when threshold triggers:
📊 Context: ~42,000 / 200,000 tokens (21%)
File reads: ~15,000 (8 files)
Skill overhead: ~4,000 (3 invocations)
Conversation: ~23,000
When suggesting compaction, prepare first:
recent.md via memory-manager.Post-compaction checkpoint:
📊 Context: ~8,000 / 200,000 tokens (4%) — compacted from 65%
Working state preserved in memory
Ready to continue
Inform routing decisions based on budget:
sigs and diff reading strategies when budget is >50%