tokenmiser
Fifteen skills that teach Claude Code to spend fewer tokens on the same work, and two scripts that prove whether it actually worked.
- 01The pile, not the reply
- 02Fifteen skills, one lever each
- 03The filter hook
- 04Exit codes survive the filter
- 05Measure before you type
- 06Session accounting
Architecture Overview
A model has no memory, so every message re-sends the entire conversation from the beginning. That is what you are billed for, and it means message forty in a long session can cost fifteen times what message one cost even if you only typed “yes, do that”. tokenmiser goes after the size of that pile rather than the length of the reply, which is where most advice stops and where under a tenth of the tokens live. Fifteen Markdown skills each take one contributor to the pile — the always-on rulebook, the conversation history, the tool output, the reply — and squeeze it, and a PreToolUse hook cuts the noisiest tool output before it ever gets into the context. Nothing runs in the background, nothing leaves the machine, and every claim it makes is checked against the session logs Claude Code already writes.
How it works
Core mechanics, failure recovery paths, and system design decisions.
The pile, not the reply
Each turn re-sends the rulebook, the whole session so far, and everything any tool printed. A single test run that dumped 10,000 lines is not paid for once — it is re-sent with every message for the rest of the session. That is the trap the whole toolkit is built around.
Fifteen skills, one lever each
Every skill is a Markdown file of instructions and nothing else, and Claude reads the full file only when you invoke it. They split across the four buckets: context size (audit, compress, tools), history (session, prompt), retrieval and tool output (read, delegate, hooks), and the reply itself (speak, git, model).
The filter hook
A PreToolUse hook rewrites a noisy command before its output reaches the model: test runners keep failures plus context, builds keep errors, installers keep the tail, git log gets an --oneline head. Anything already piped, redirected or joined with && is left completely alone, because appending a pipe there would change what actually runs.
Exit codes survive the filter
Every rewritten command ends with exit ${PIPESTATUS[0]} and a one-line marker, so a hidden failure can never read as a pass. Custom rules go in a JSON file rather than the script, an environment variable turns it off for one shell, and the hook ships a --selftest.
Measure before you type
A report totals the always-on context — the CLAUDE.md, the settings, the description of every installed skill — and names what is fat. That number is paid at the start of every session, forever, whether any of it gets used or not.
Session accounting
The bench script reads the usage the API already reported into the local session logs, deduplicated by request id because Claude Code writes several lines per reply. It compares two runs per turn rather than in total, since a harder task honestly costs more — totals are not a score.
Engineering Highlights
- •The filter hook is usually the biggest single win, because it removes tokens from every later turn as well as this one
- •Filtered commands preserve the real exit status, so a quiet failure can never be mistaken for a pass
- •Bench figures are deduplicated by request id; tools that skip that step report sessions two to three times larger than they are
- •A change that saves 30% and gets the answer wrong is recorded as a loss — the results log has a column for saying so
- •Honest about its own cost: fifteen installed skills advertise roughly 1.5k tokens per session, and status prints your figure
- •No network call anywhere in the repository, and the installer prints its plan and asks before writing
- •20 automated smoke tests running in CI on push and PR with zero external network dependencies