agentleFS
Growth4U-systemsGrowth4U-systems/claude-token-hygiene/SKILL.md

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

  • Other versions1 project uses a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 1

    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
  1. Distinctive:

    Every Claude Code conversation loads your system context before you type anything:

    line 15
  2. Distinctive:

    Look for reference sections (tables, examples, long command lists)

    line 73
  3. Distinctive:

    Remove stale content (tools you've uninstalled, old client lists)

    line 75
  4. Distinctive:

    Keep only operational rules and pointers in MEMORY.md

    line 79
  5. Distinctive:

    Remove entries older than 2 months that aren't actively referenced

    line 80
  6. Distinctive:

    Check for duplicates (same skill from different sources)

    line 83
  7. Distinctive:

    Remove servers with expired credentials

    line 88
  8. Distinctive:

    Check for duplicates (e.g., plugin playwright + project playwright)

    line 90
  9. Distinctive:

    Run monthly, or whenever conversations feel slower than usual.

    line 153

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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:

SourceWhat it isTypical size
CLAUDE.mdProject instructions2,000-10,000 tokens
MEMORY.mdAuto-memory (if enabled)1,000-6,000 tokens
Skill descriptionsOne line per installed skill50-80 tokens each
MCP tool listingsEvery registered tool~15 tokens each
Hooks & pluginsSystem reminders500-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

CheckWhat it measuresGreenYellowRed
CLAUDE.md sizeBytes of project instructions<10KB10-20KB>20KB
MEMORY.md linesLines in auto-memory file<150150-200>200
Skills countFolders in ~/.claude/skills/<8080-100>100
MCP serversServers in .mcp.json<=56-7>7
Stale daily logsmemory/*.md files older than 30 days0-56-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 -l

Step 2: Estimate Token Impact

SourceFormula
CLAUDE.mdbytes × 0.28
MEMORY.mdbytes × 0.33
Skillscount × 65
MCP toolsservers × 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 tokens

Step 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):

ActionTypical SavingsEffort
Move CLAUDE.md reference sections to separate file3,000-6,000 tokens30 min
Compress MEMORY.md, extract to topic files2,000-4,000 tokens20 min
Remove duplicate skills200-500 tokens5 min
Remove unused MCP servers500-2,500 tokens5 min
Disable cloud MCP integrations (Supabase, etc.)500-1,500 tokens2 min
Archive old daily logsReduces file scan time5 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.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.