claude-diet
v0.1.2
Published
See which skills, plugins, memory, and MCP servers are eating your Claude Code context — before your bill does.
Maintainers
Readme
🥗 claude-diet
See which skills, plugins, memory, and MCP configs are eating your Claude Code context — before your bill does.
A 1-second audit of your
~/.claude/folder. Terminal bars. Screenshot-friendly HTML report. Actionable "diet suggestions." Zero network calls. Zero API keys. Runs on your machine.
npx claude-diet🩻 What it tells you
Every Claude Code session loads your skills, plugins, memory, agent definitions, and MCP schemas into the model's context. Most of that content silently costs you tokens on every turn — and it's very hard to see what's actually earning its cost.
claude-diet scans your ~/.claude/ folder, tokenizes every artifact, and shows you a ranked breakdown so you can see, in one screenshot:
- Which skills eat the most context — and which ones you haven't touched in 60 days
- Which plugin packs are quietly bloating every session
- Which memory files have drifted into essay-length
- Whether your task-output cache is eating disk you'll never use again
- A ranked "heaviest files" table so you know exactly what to trim
⚡ Quick start
Zero-config, zero installation:
npx claude-dietOr install globally:
npm install -g claude-diet
claude-dietThat's it. Reads ~/.claude/ by default. Nothing gets uploaded anywhere.
🖥 Usage
Usage: claude-diet [options]
See which skills, plugins, memory, and MCP configs are eating your
Claude Code context.
Options:
-r, --root <path> Path to scan (default: ~/.claude)
--html [file] Write a shareable HTML report
--json Emit machine-readable JSON to stdout
--days <n> Only include artifacts modified in the last N days
--project <name> Restrict scan to one project directory
--top <n> How many heaviest artifacts to show (default: 15)
--suggest Only print diet suggestions
-v, --version output the version number
-h, --help display help for commandCommon recipes:
# See the full report
claude-diet
# Screenshot-friendly HTML report (opens in your browser)
claude-diet --html && open claude-diet-report.html
# Show only what changed in the last 30 days
claude-diet --days 30
# Focus on one project
claude-diet --project my-app
# Machine-readable for CI or scripts
claude-diet --json > diet.json🩺 What "diet suggestions" look like
The tool doesn't just show numbers — it flags what to trim:
CRITICAL— a single artifact carrying more than 5,000 tokens. That's almost always over-budget for one skill or memory file.WARN— three or more skills untouched in 60+ days. You probably forgot they're installed.WARN— memory files that have drifted past 1,000 tokens. Time to break them into linked files.INFO— large task-output caches (50k+ tokens) or transcript stores (500k+ tokens) that are burning disk.
Each suggestion includes an estimated token savings so you can decide what's worth the click.
🔍 What it scans
| Category | Files | Notes |
|---|---|---|
| Skills | ~/.claude/skills/**/SKILL.md and linked files | Every skill's SKILL.md loads into every session |
| Plugin skills | ~/.claude/plugins/*/skills/**/*.md | Same, but bundled from plugin packs |
| Agents | ~/.claude/agents/*.md | Custom subagent definitions |
| Memory | ~/.claude/projects/*/memory/*.md | Per-project persistent memory |
| Settings | settings.json, settings.local.json | Hooks, permissions, model choice |
| MCP configs | mcp_settings.json, mcp.json, .mcp.json | Configured Model Context Protocol servers |
| Keybindings | keybindings.json | Custom keyboard shortcuts |
| Transcripts | ~/.claude/projects/*/transcripts/*.jsonl | Local conversation history |
| Task outputs | ~/.claude/projects/*/tasks/*.output | Background command output caches |
🔐 Privacy
Nothing leaves your machine. claude-diet reads files from ~/.claude/ (or whichever path you point it at), tokenizes them in-memory, and prints a report. No telemetry. No network calls. No API keys. See the source — the tool has zero HTTP dependencies.
The tokenizer uses cl100k_base (OpenAI's cl100k) as a fast local approximation of Claude's tokenizer. Absolute counts are within ~5-10% of Anthropic's actual count in practice, and the relative shares between categories are unchanged. That's what matters for pruning decisions.
📦 Programmatic API
claude-diet also exports its core functions if you want to embed it in another tool:
import {
scanClaudeDir,
analyze,
renderHtml,
countTokens,
defaultRoot,
} from 'claude-diet';
const artifacts = await scanClaudeDir(
{ root: defaultRoot(), top: 15 },
countTokens,
);
const report = analyze(artifacts, defaultRoot(), 0, 15);
console.log(report.suggestions);Types are shipped with the package.
🛠 Development
git clone https://github.com/unusdon/claude-diet.git
cd claude-diet
npm install
npm run dev # run against your own ~/.claude
npm test # run vitest
npm run typecheck # tsc --noEmit
npm run build # emit dist/Tests cover the scanner (fixture-based), tokenizer, and the analyzer's suggestion logic. CI runs on Node 20 and 22.
🗺 Roadmap
claude-diet --watch— live token cost as you workclaude-diet prune— interactive pruner that moves stale files to.claude/archive/- Anthropic tokenizer — swap in the official Claude tokenizer when it's available for JS
- Team cloud — optional hosted dashboard where teams can share their reports (opt-in, self-hostable)
Suggestions welcome — open an issue or start a discussion.
🤝 Contributing
Small, focused PRs are welcome. Please:
- Open an issue first if the change is bigger than a bug fix.
- Add or update tests. The bar is genuine coverage of scanner rules and analyzer thresholds.
- Run
npm run typecheck,npm test, andnpm run lintbefore opening the PR.
See CONTRIBUTING if it exists (coming soon).
📜 License
🥗 Ship a leaner Claude Code setup. ⭐ If this saved you tokens, a star is the tip jar.
