NEWNow a one-command Claude Code plugin

Stop paying Claude to re‑read your whole conversation.

On every step, Claude Code sends everything said so far back to the model. tokentrim keeps that history small. On 135 real conversations that meant 75% less re-read and usage limits that lasted 4.0× longer.

$ git clone https://github.com/suncal/tokentrim && tokentrim/bin/tokentrim replay

Shows what tokentrim would have saved on your own past sessions. Installs nothing.

Nothing leaves your machine Zero dependencies Apache-2.0 One-command uninstall

The author's own sessions. The replay shows you yours.

−75%history re-read, on 135 real conversations
4.0×longer before you hit usage limits
6 CI targetsmacOS and Linux, Python 3.9 to 3.13
0 bytesof your code or prompts sent anywhere

The hidden cost

Your limit isn't spent on new work. It's spent re-reading old work.

An agent loop re-sends the entire conversation on every step. A long session carrying 400k tokens pays for those 400k again on step 301. About 97% of the tokens Claude Code bills are this re-reading.

 Shrinking tool output onlytokentrim
What it targetsTool output sizeThe history re-read on every step
Saving on the same 135 conversations6.9%75% less re-read
Proof before you installUsually a vendor benchmark✓ A replay of your own transcripts

How it works

Measure, trim, prove it. In about a minute.

01 · Measure

See where tokens went

tokentrim audit reads the transcripts Claude Code already keeps on your machine and shows which sessions and habits burn your limit.

02 · Replay

Get your own number

tokentrim replay runs your past sessions through the rules before you install anything. You get your number, not ours.

03 · Install

Keep context small

tokentrim install adds a few Claude Code hooks and an earlier summarise point. It backs up your settings first, and uninstall undoes it exactly.

Earlier summarising

Compacts the conversation before it balloons. This is where most of the savings come from.

3 strengths
Screenshots

Browser screenshots are taken at half scale, which costs a quarter of the tokens. Clicks still land in the right place.

¼ the tokens
Huge files

A whole-file read over 40 KB gets an outline first. Asking again lets the full read through.

lossless
Long command output

Head and tail kept, repeated lines collapsed, progress bars stripped. The full output is saved to disk.

lossless
Connector results

JSON minified, empty fields and base64 blobs dropped. Nothing in a list is ever removed.

full copy on disk
Context meter

Tells you, not Claude, when a conversation is getting heavy and a fresh one would be cheaper.

0 tokens

Live dashboard

A live dashboard that changes Claude Code for you.

Watch usage rise and fall minute by minute, with recommendations based on your own sessions. Each one has an Apply button. Switch a setting off and your own value comes back.

Smart model

Opus while planning, Sonnet while doing the work (Claude Code's opusplan), or Sonnet for everything. One click.

new sessions
Cheaper sub-agents

Explore and Task sub-agents run on Sonnet or Haiku. Your main conversation keeps its model.

new sessions
Thinking effort

Medium or low effort spends fewer thinking tokens on routine work.

new sessions
Daily budget, hard stop

A dollar cap per day across every session. A note at 80%, and new prompts held once you pass it. Start a message with ++ to send it anyway.

next message
Cold-cache alert

Back after the prompt cache expired? It tells you what your next message will re-write, and when /clear is cheaper.

next message
Model advisor

Quick chores like renames, formatting or git running on Opus get a short note that Sonnet does them for less.

next message

The dashboard shows which Claude Code versions on your machine read each setting, so nothing silently does nothing.

Security & privacy

It sees every tool call. So it's built to be boring and safe.

tokentrim runs as Claude Code hooks. Here is exactly what stays on your machine, what leaves it, and how you stay in control.

Never leaves your machine

  • Prompts, code and transcripts. Read locally from ~/.claude to measure usage. Never uploaded.
  • Full tool output. Trimmed for Claude, with the complete copy kept on your disk.
  • Your settings. Backed up before install and restored on uninstall.
  • No network calls by default. Standard-library Python. The only exception is opt-in: live --deploy sends totals to your own Cloudflare page.

Sent only if you choose Pro

  • License check: your key and a machine label, to Polar.
  • Hosted dashboard: usage totals and project folder names. Never prompts or code.
  • Slack: opt-in, weekly totals only, with a test message first.
  • Payment: handled entirely by Polar. We never see your card.

Fails open

If a hook errors, Claude Code carries on as if tokentrim weren't there.

Instant kill switch

"enabled": false in its config turns every hook off at once.

Tested on every change

The full suite runs in CI on macOS and Linux, Python 3.9, 3.11 and 3.13.

Open to audit

Apache-2.0 source. Report issues privately; you get a reply within 3 days.

Read the security policy →

The honest numbers

Why we don't promise 90%.

Claude Code's own system prompt and tool list cost 40–60k tokens on every step, and no setting removes them. Anyone promising 90% across all your work is measuring one noisy command, or not measuring.

So tokentrim shows its working: a replay of real transcripts, every estimate labelled, and three strength settings with the trade-off spelled out.

  • The trade-off is realSummarising sooner means Claude forgets detail sooner. The default, strong, behaves close to Claude Code's old 200k window. Balanced is gentler; max is cheapest.
  • Cost drops less than tokensRe-reads are cheap per token and output isn't touched, so billed cost and limit burn fall about 55–70%, not 75%.
  • Your number will differShort sessions re-read little, so they save little. That's why the replay comes first, before you install anything.
  • Not affiliated with Anthropictokentrim uses Claude Code's public hooks and settings. It doesn't patch Claude Code or touch your account.

Pricing

The token cutting is free. Pro keeps the savings going.

Pro puts the live dashboard on any device with nothing to host, and keeps watch for you with a Monday report and budget alerts.

Free

$0forever

Everything that cuts tokens. Open source.

  • All hooks and 3 strength profiles
  • Audit and replay on your sessions
  • Live dashboard and one-click smart settings
  • Daily budget guard, cold-cache alert, model advisor
  • Shareable savings card
  • Hosted dashboard on your phone
  • Weekly digest and budget
Install free
EARLY-BIRD · FIRST 500

Pro Lifetime

$49once

Pay once, keep it. Only for the first 500 buyers. After that, Pro is monthly only.

  • Everything in Free
  • Hosted live dashboard on any device: sign in with your key
  • Change your settings from your phone
  • Monday digest in plain English
  • Weekly token budget, checked daily, alert at 80%
  • Slack weekly totals (totals only)
  • Up to 3 machines
  • All future Pro updates
Get lifetime Pro →

Pro Monthly

$9/ month

Same Pro features, billed monthly. Cancel any time.

  • Everything in Free
  • Hosted live dashboard on any device: sign in with your key
  • Change your settings from your phone
  • Monday digest in plain English
  • Weekly token budget, checked daily, alert at 80%
  • Slack weekly totals (totals only)
  • Up to 3 machines
Go monthly

For teams

A shared dashboard with everyone's spend, savings and budgets is in the works. Want a teardown of where your team's Claude spend goes now, with a fix list? Ask for a paid audit.

Contact us
Secure checkout by Polar Sales tax handled License key by email Activate with tokentrim pro activate <key>

Questions

Before you install

Something not covered? Email support@boltak.com or ask in Discussions.

Does anything leave my machine?

No. The free tool reads transcripts Claude Code already stores locally and never sends them anywhere. Pro's license check sends only your key and a machine label. The hosted Pro dashboard receives totals and project folder names only, never prompts or code. Slack posting is opt-in and sends weekly totals only.

Plugin or full install: which should I use?

The plugin is one command and adds the hooks plus /tokentrim:replay, /tokentrim:dashboard and /tokentrim:share. A plugin can't set the compaction window, which is where most of the saving comes from, so also run tokentrim install from a clone if you want it. Having both is safe: the plugin's hooks stand down while the full install's hooks are active, so nothing runs twice.

Can it pick the best model for each message?

Not per message: Claude Code has no switch for that. Smart model uses Claude Code's own opusplan (Opus plans, Sonnet does the work), and pairs well with cheaper sub-agents, lower effort and the model advisor. Model changes apply to new sessions; /model in a session still wins.

I'm on a Pro or Max plan, not paying per token. Does this help?

Yes, and it's the main reason most people use it. Plan limits are spent on the same tokens, so re-reading less means hitting the 5-hour and weekly limits later. On the author's usage, limits lasted 4.0× longer.

Will Claude forget things?

It summarises earlier, so very old detail in a long conversation gets condensed sooner. The default profile behaves close to how Claude Code worked with a 200k window. If you notice it, switch to balanced with one command.

How do I undo it?

tokentrim uninstall removes exactly what install added. Your settings were backed up before install, your own hooks are left alone, and one config flag turns every hook off instantly. Remove the plugin with claude plugin uninstall tokentrim@tokentrim.

What do I need?

Claude Code and Python 3.9 or newer. No packages to install. It's tested on macOS and Linux. The Pro Monday digest schedules itself on macOS; elsewhere you can run tokentrim digest from your own scheduler.

How does the lifetime deal work?

$49 once for the first 500 buyers, with all future Pro updates. After that, Pro is $9 a month. Either way you get a license key by email that works on up to 3 machines; move it with tokentrim pro deactivate.

Find out what your conversations are costing you.

One command, about a minute, nothing installed. If the number is small, you've lost nothing.