CRUSTS CLI
The claude-crusts CLI splits a Claude Code context into six categories, finds waste and writes a /compact command for the session.
- 82 ★ on the repository
- Last commit
- MIT
Extended access
Why this level
- The hook and the `optimize --apply` command change Claude Code settings, including read deny rules in `.claude/settings.local.json`.
- The tool reads Claude Code session logs with the content of your conversations.
Install
- Works in
In your terminal, with SkillFoxx CLI
npx skillfoxx add cli/crustsDetects the agents on your machine, shows the access level and pins the version.
Other ways to install
Access and checks
How we reviewExtended accessThe tool runs code or makes network calls and only reads external data.
- The hook and the `optimize --apply` command change Claude Code settings, including read deny rules in `.claude/settings.local.json`.
- The tool reads Claude Code session logs with the content of your conversations.
This is third-party code. Review the repository files before installing.
What it does
CRUSTS analyzes Claude Code session logs offline, with no API calls and no token cost. It splits the context window into six categories (Conversation, Retrieved, User, System, Tools, State/Memory), finds stale and unused content and ranks findings by possible token savings. Findings include repeated reads of the same files, unused tool schemas, resolved exchanges, cache rewrites, bloated `CLAUDE.md` files and unused MCP servers. The `hooks auto-inject enable` command installs a hook: when the window nears auto-compaction, CRUSTS writes a ready `/compact focus` command for the session and shows it as a line. The `optimize --apply` command adds read deny rules for noisy paths (`node_modules/`, `dist/`, lock files) to `.claude/settings.local.json`, with backups in `~/.claude-crusts/backups/`. An interactive `tui` shell and a `/crusts` slash command are included.
Who it is for. Claude Code users with long sessions whose context fills quickly and whose token burn is hard to trace.
Good fit when
- A session nears auto-compaction and a ready `/compact focus` command for the current work is needed.
- An agent keeps reading `index.ts` and noisy paths must be denied.
- You suspect connected MCP servers occupy context and are never called.
- A weekly context burn report is needed in HTML or Markdown.
Not a fit when
- You need billing-level token accuracy: part of the breakdown is estimated rather than measured.
- Edits to `settings.local.json` are forbidden by policy: `optimize --apply` writes rules there.
- You need optimization for another agent: the tool parses Claude Code logs.
Example request
Analyze the latest session through claude-crusts, show the top waste by tokens and prepare a /compact focus command for the current task.Limitations
The tool estimates part of the breakdown from logs, so the accuracy section of the README advises comparing with `/context` through `claude-crusts calibrate`. The `auto-inject` hook changes Claude Code settings and puts a hint into the reply, and `optimize --apply` writes read deny rules to `.claude/settings.local.json`: each edit has a confirmation and atomic backups. Node.js or bun is required. CRUSTS does not run `/compact` itself, you run the command. The project is not affiliated with Anthropic.
How to disable. Disable the hook with `claude-crusts hooks disable`, and `hooks auto-inject status` shows the auto-inject state. Remove the deny rules from `.claude/settings.local.json` or restore them from backups in `~/.claude-crusts/backups/`. Remove the package with `npm uninstall -g claude-crusts`.
FAQ
How do I try it without installing?
Run `npx claude-crusts analyze`. Install globally with `npm install -g claude-crusts`, and with bun use `bunx claude-crusts analyze` and `bun install -g claude-crusts`.
What does auto-inject do?
The `hooks auto-inject enable` hook writes a `/compact focus` command for the session when the window nears the auto-compaction threshold and shows it as one line. You run it.
Which context categories does CRUSTS show?
Six: Conversation, Retrieved, User, System, Tools and State/Memory. They sum to the total window reconciled with the API data.
Do I need an API key?
No. The tool works offline, makes zero API calls and spends no tokens.
How do I use it from inside Claude Code?
Through the `/crusts` slash command: the `.claude/commands/crusts.md` file lives in the repository.
Discussion
No questions or reviews yet.
Related
CLI toolsclaude-history searches and opens past Claude Code, Codex and Pi conversations in the terminal and gives Claude a history skill
claudetop shows session cost, cache hit rate, plan limit windows and overspend alerts in the Claude Code status line
A local CLI that shows where tokens go in Claude Code, Codex and opencode and holds back expensive messages
A Python CLI that turns Claude Code JSONL transcripts into readable HTML and Markdown with search, filters and a timeline.
A Claude Code plugin that picks the model's effort level for every prompt and shows the prompt cache countdown
Local memory for Claude Code: a single binary indexes past conversations and injects relevant context into new sessions.
README in short
The README starts with a before and after comparison and the three main commands, then covers features, installation, a reference for 23 commands, the CRUSTS framework, how it works, a comparison with `/context` and accuracy limits.