Local CLI + MCP for AI coding agents

Keep the signal.
Cut the noise.

UsageTrim folds verbose tool and MCP output before your agent reads it. Values, errors and safety boundaries survive, and anything folded is recoverable by reference.

MITno model callsnothing leaves your machineClaude Code · Codex · Claude Desktop
UsageTrim mascot, a small mint robot with a leaf

Measured on real sessions, not promised

14 days of the maintainer's Claude Code transcripts, replayed offline through the same function the hook runs. Token counts are local o200k_base estimates, not billing.

MCP output tokens before and after UsageTrim
Tool resultsCountTokensCut
All third-party MCP results11,0587.17M → 5.85M18.3%
Supabase execute_sql6,5714.97M → 4.03M18.9%
Search Console analytics223702k → 434k38.2%
Vercel list_deployments43250k → 210k16.1%

Lossless, checked

All 3,144 SQL results rewritten as tables decoded back to the original rows. Run the replay on your own transcripts.

Where it did not help

Bash output in the same sessions was mostly ad-hoc scripts, and the filters saved under 1% there. Test and build logs are where they pay off. Your numbers depend on what your tools print.

What your agent actually receives

A Supabase-style SQL result. The rows become TSV with the keys once, the escaped {"result": …} wrapper goes, and the untrusted-data warnings stay word for word.

Before448 tokens

      
After UsageTrim365 tokens · −18.5%

      

Generated by compact_mcp_text from a six-row fixture. The fixed warning text is most of what remains, so larger results cut further. A cell that parses as JSON is JSON, so null, 51 and "51" stay distinct.

What you get

Every feature earns its place with a measurement or a recovery path.

MCP

Lossless MCP compaction

A PostToolUse hook rewrites other servers' JSON rows, wrappers and indentation. Output is never allowed to grow.

Bash

Keep the failure

pytest, cargo, go, Docker, kubectl, eslint, tsc and CI logs fold their routine output. Errors stay verbatim, and usagetrim retrieve restores the rest.

Models

Haiku for reading

scout and runner agents return conclusions, not files and logs. --cheap-explore moves Explore back to Haiku.

Code

Read less

Symbol-level reads, an ast-grep index, hash-guarded symbol edits, and task checkpoints across compaction.

Install where you work

Plugins run the pinned release wheel through uv. The Claude Desktop extension installs its own copy.

/plugin marketplace add 00200200/usagetrim
/plugin install usagetrim@usagetrim

Adds the MCP tools, the Bash and MCP output hooks, the Haiku agents, and the usagetrim:lean output style.

Next, once it measures well

Ideas from the strongest tools in this space. None ships without a measurement behind it.

  • Ranked repo mapAider-style PageRank over the symbol graph, fitted to a token budget.
  • LSP references and renameSerena-style precision, falling back to the ast-grep index.
  • Lossless log templatingDrain-style folding for dev-server, Docker and CI logs.
  • Paired A/B harnessProvider-reported tokens and task pass rate, because smaller output can hide extra turns.