Reduce Claude Code and Codex token usage with slimctx
A free, open-source plugin that condenses tool output — git, tests, builds, installs, logs, JSON, file lists and grep — before Claude Code or OpenAI Codex CLI reads it. Nothing is lost: every condensed output keeps its original on disk, and the agent can read it back.
View on GitHubInstall in Claude Code
claude plugin marketplace add tauseefahmad/slimctx
claude plugin install slimctx@slimctx
Restart Claude Code. Run /slimctx:gain later to see what it saved, /slimctx:audit to see what loads before your first message, and /slimctx:doctor to check the setup.
Install in OpenAI Codex CLI
codex plugin marketplace add tauseefahmad/slimctx
Enable it in /plugins, then trust its hooks in /hooks.
What it does
- Condenses any command's output after it runs: removes ANSI codes and progress bars, folds repeated and near-identical lines, drops passing tests and download noise, reshapes
git log,git status,git diffandls -l, and condenses large JSON. - Keeps every error line, even one buried in the middle of a 2,000-line log.
- Lossless recovery: the untouched original is saved, and its path is in the footer.
- Skips repeats: identical output seen again becomes a one-line pointer.
- Outline-first reads: reading a 600+ line source file first returns its symbol outline with line numbers.
- Caps Grep and Glob results per file and per directory.
- Short reply style (~60 tokens of rules), with plain language kept for warnings and destructive steps.
Benchmark: slimctx vs rtk
| command | raw | rtk | slimctx |
|---|---|---|---|
| git log -40 | 16,526 | 4,229 | 1,835 |
| git diff HEAD~3 | 50,456 | 11,719 | 4,995 |
| ls -la | 6,628 | 2,550 | 642 |
| find . -name "*.mjs" | 24,339 | — | 1,420 |
| gh api …/issues (JSON) | 42,417 | 42,417 | 13,929 |
| git status | 275 | 147 | 213 |
Estimated tokens. rtk does better on short git status; slimctx does better on long output, and keeps the original recoverable. Full table and method are in the README.
FAQ
How do I reduce Claude Code token usage?
Most tokens in a coding session are tool output. Condense it with slimctx, keep CLAUDE.md short, and clear the context between unrelated tasks.
Does it work with Codex?
Yes. The same repository is a Codex plugin, and it condenses Bash output there too, including failing commands.
Is my code sent anywhere?
No. Everything runs locally in Node.