token-hygiene
Skill9 starsChanged 9 months agoMITView on GitHub
Audits Claude Code system token overhead (CLAUDE.md, MEMORY.md, skills, MCP servers, daily logs) and generates a report with cleanup recommendations. Use monthly or when sessions feel slow. Trigger: "token hygiene", "context audit", "audit tokens".
1 other project uses a version of this.
Adopted by
Most recently taken up by
- leogallego/claude-skills-tokenstheir own version, first seen Oct 15, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- leogallego/claude-skills-tokens★ 1same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
The file
We split this skill into the rules it gives an agent
9 rules. About 0 are common, 9 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈9
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 15
Every Claude Code conversation loads your system context before you type anything:
- Distinctive: line 73
Look for reference sections (tables, examples, long command lists)
- Distinctive: line 75
Remove stale content (tools you've uninstalled, old client lists)
- Distinctive: line 79
Keep only operational rules and pointers in MEMORY.md
- Distinctive: line 80
Remove entries older than 2 months that aren't actively referenced
- Distinctive: line 83
Check for duplicates (same skill from different sources)
- Distinctive: line 88
Remove servers with expired credentials
- Distinctive: line 90
Check for duplicates (e.g., plugin playwright + project playwright)
- Distinctive: line 153
Run monthly, or whenever conversations feel slower than usual.
≈ “Common” is an estimate: at least 1 in 5 of the 372,429 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Token Hygiene — Context Overhead Audit
Monthly audit of system files that inflate every Claude Code conversation's token cost. Reports metrics, flags issues, and recommends actions. Does NOT modify files automatically.
Why This Matters
Every Claude Code conversation loads your system context before you type anything:
| Source | What it is | Typical size |
| CLAUDE.md | Project instructions | 2,000-10,000 tokens |
| MEMORY.md | Auto-memory (if enabled) | 1,000-6,000 tokens |
| Skill descriptions | One line per installed skill | 50-80 tokens each |
| MCP tool listings | Every registered tool | ~15 tokens each |
| Hooks & plugins | System reminders | 500-2,500 tokens |
A typical setup can burn 15,000-35,000 tokens per conversation just on system context — before you ask a single question. This skill measures that overhead and tells you where to cut.
Thresholds
| Check | What it measures | Green | Yellow | Red |
| CLAUDE.md size | Bytes of project instructions | <10KB | 10-20KB | >20KB |
| MEMORY.md lines | Lines in auto-memory file | <150 | 150-200 | >200 |
| Skills count | Folders in ~/.claude/skills/ | <80 | 80-100 | >100 |
| MCP servers | Servers in .mcp.json | <=5 | 6-7 | >7 |
| Stale daily logs | memory/*.md files older than 30 days | 0-5 | 6-15 | >15 |
Workflow
Step 1: Measure All Sources
# CLAUDE.md
wc -l CLAUDE.md && wc -c CLAUDE.md
# MEMORY.md (auto-memory location varies by project)
wc -l ~/.claude/projects/*/memory/MEMORY.md
wc -c ~/.claude/projects/*/memory/MEMORY.md
# Skills count
ls -d ~/.claude/skills/*/ 2>/dev/null | wc -l
# MCP servers
grep -c '"command"' .mcp.json 2>/dev/null
# Stale daily logs (if you use daily memory logs)
find memory/ -name "20*.md" -mtime +30 2>/dev/null | wc -lStep 2: Estimate Token Impact
| Source | Formula |
| CLAUDE.md | bytes × 0.28 |
| MEMORY.md | bytes × 0.33 |
| Skills | count × 65 |
| MCP tools | servers × avg_tools × 15 |
Step 3: Identify Issues
For each metric in Yellow or Red:
CLAUDE.md too large:
- Look for reference sections (tables, examples, long command lists)
- Move them to a separate file and add a one-line pointer
- Remove stale content (tools you've uninstalled, old client lists)
MEMORY.md too large:
- Extract detailed content into topic files (e.g.,
memory/client-details.md) - Keep only operational rules and pointers in MEMORY.md
- Remove entries older than 2 months that aren't actively referenced
Too many skills:
- Check for duplicates (same skill from different sources)
- Uninstall skills you haven't used in 30+ days
- Each removed skill saves ~65 tokens per conversation
Too many MCP servers:
- Remove servers with expired credentials
- Disable servers you use rarely (re-enable when needed)
- Check for duplicates (e.g., plugin playwright + project playwright)
Step 4: Generate Report
The report uses a traffic-light dashboard:
# Token Hygiene Report — [DATE]
## Dashboard
| Metric | Value | Status | Tokens Est. |
|--------|-------|--------|-------------|
| CLAUDE.md | X lines / Y KB | [status] | ~N tokens |
| MEMORY.md | X lines / Y KB | [status] | ~N tokens |
| Skills installed | X | [status] | ~N tokens |
| MCP servers | X | [status] | ~N tokens |
| Stale logs | X files | [status] | — |
| **Total overhead** | | | **~N tokens** |
## Issues Found
[Details per issue with recommended action and estimated savings]
## Recommended Actions (Priority Order)
1. [Action] — saves ~N tokens
2. [Action] — saves ~N tokensStep 5: Track Progress
Save results to compare month-over-month:
{
"last_audit": "2026-03-05",
"metrics": {
"claude_md_bytes": 5669,
"memory_md_lines": 90,
"skills_count": 82,
"mcp_servers": 5,
"stale_logs": 0,
"estimated_overhead_tokens": 17000
}
}Common Wins
Based on real-world optimization (40-50% reduction achieved):
| Action | Typical Savings | Effort |
| Move CLAUDE.md reference sections to separate file | 3,000-6,000 tokens | 30 min |
| Compress MEMORY.md, extract to topic files | 2,000-4,000 tokens | 20 min |
| Remove duplicate skills | 200-500 tokens | 5 min |
| Remove unused MCP servers | 500-2,500 tokens | 5 min |
| Disable cloud MCP integrations (Supabase, etc.) | 500-1,500 tokens | 2 min |
| Archive old daily logs | Reduces file scan time | 5 min |
Notes
- This skill is read-only. It never modifies files automatically.
- You review the report and decide which actions to take.
- Run monthly, or whenever conversations feel slower than usual.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

