← ClaudeAtlas

token-doctorlisted

Audits and reduces token usage in context files (CLAUDE.md, AGENTS.md, memory files, docs). Measures token cost per file, finds waste (filler words, verbose phrases, blank bloat, oversized blocks), and safely compresses prose while preserving all code, inline code, URLs, file paths and tables. Use when your context files feel bloated, prompts are expensive, or you want to trim CLAUDE.md without losing meaning. Trigger: "reduce tokens", "token usage", "trim my CLAUDE.md", "compress context", "shrink memory file", "context too big", "save tokens", "audit token cost", /token-doctor. For skill description collisions, see skill-doctor.
enmr10/token-doctor · ★ 0 · AI & Automation · score 75
Install: claude install-skill enmr10/token-doctor
# Token-Doctor Measure and cut the token cost of the files that load into every prompt. ## When to run - A `CLAUDE.md` / `AGENTS.md` / memory file has grown large - Prompts feel expensive or context fills up fast - Before committing context files (keep them lean) - As a CI gate so no context file silently bloats ## Input A single file, or a directory (scans `*.md`, `*.txt`, `CLAUDE.md`, `AGENTS.md`, `llms.txt`, etc.; skips code, `node_modules`, `.git`). ## How to run The engine lives in `scripts/` (Python 3.8+ stdlib, zero dependencies). ```bash # Audit (read-only) — see token cost + savings python3 -m scripts /path/to/project # Audit a single file python3 -m scripts CLAUDE.md # Apply the reductions (keeps a .bak backup per file) python3 -m scripts CLAUDE.md --apply # CI gate: fail if any context file exceeds a token budget python3 -m scripts /path/to/project --fail-over 1500 # Machine-readable python3 -m scripts /path/to/project --format json --out audit.json ``` ## What it does 1. **Measures** estimated tokens per file (offline heuristic; % saved is reliable). 2. **Splits** each file into prose vs protected regions (code, inline code, URLs, paths, tables, frontmatter). 3. **Reduces** ONLY prose: drops filler, shortens verbose phrases, collapses blank bloat, removes duplicate adjacent lines. 4. **Reports** before/after tokens, % saved, biggest-savings files, and waste findings. 5. **Applies** safely on `--apply` (writes `<file>.bak` first). ## Guarantees