free · open-source · MIT · zero runtime

Stop paying Opus prices
for grunt work.

tokentrim drops a few cost-optimized subagents into Claude Code. Search, reading, tests and trivial edits get routed to cheap Haiku — your expensive model only does the hard 10%. No /model dance, no new tool to learn.

"Find every call site of useAuth and read the 3 biggest."

without tokentrim

~38k tokens · Opus

grep + 3 full files land in your main context — all at frontier price.

with tokentrim

~3k · Opus
the rest · Haiku

trim-scout finds it, trim-reader digests — cheap, and your main context stays lean.

expensive main model cheap Haiku offload

Illustrative of the mechanism, not a benchmark — real savings depend on your codebase and how Claude routes.

Eight agents. Four tiers.

Each is pinned to the cheapest model that can do its job. Claude routes automatically — cheap by default, climbing only when the task earns it.

🔴 fable🟠 opus🟡 sonnet🟢 haiku· priciest → cheapest

trim-scout

haiku

Find files, symbols, usages — returns paths only, never whole files.

"where is…" · "find all…"

trim-reader

haiku

Reads big or many files in its own context and hands back a tight digest.

logs · lockfiles · "summarize this"

trim-runner

haiku

Runs tests/build/lint and reports only pass/fail + the failing lines.

"run the tests" · "does it build"

trim-edit

haiku

Trivial mechanical edits — rename, typo, import path, version bump.

rename · find-and-replace

trim-deps

haiku

Looks up a version, an API signature, or digests a docs page.

"what version" · "what's the signature"

trim-coder

sonnet

The workhorse — everyday features, tests, moderate refactors, diff reviews.

implement · review · refactor

trim-architect

opus

The hard 10% — architecture and subtle, cross-cutting bugs. Returns a plan.

design · deep debugging

trim-marathon

fable

The heavy hauler — huge long-horizon jobs that must stay coherent. Use sparingly.

migrations · sweeping refactors

Set it up once — then just code

Paste this into Claude Code · Cursor · Codex — or any AI agent — and it installs tokentrim for you.

setup prompt — paste & go
# paste me into your AI agent ↓
Set up tokentrim for me — a pack of cost-optimized Claude Code subagents that route
grunt work (search, reading, tests, trivial edits) to cheap Haiku so my expensive
model only does the hard parts (github.com/ahkamboh/tokentrim). Do this:

1. git clone https://github.com/ahkamboh/tokentrim ~/tokentrim
2. Ask me: install to THIS project or globally? then run
   bash ~/tokentrim/install.sh --project   (from my project root)   OR
   bash ~/tokentrim/install.sh --global
3. Confirm .claude/agents/trim-*.md lists 8 agents.

Or do it yourself: git clone … && bash tokentrim/install.sh --project

Roughly how much: ballpark ~30–60% lower spend on an Opus-main session (illustrative, not a benchmark) — less on Sonnet, ~0 if your main is already Haiku. Speed gains are modest and situational; the reliable win is cost, not raw speed.

Honest about it: delegation is Claude's choice from each agent's description — raised odds, not forced. Nothing changes your main-loop model; the win is offloaded sub-tasks + a leaner context. The opus/fable tiers cost more when used — only on the rare hard or huge job.