Most advice about Claude Code costs is a list of tips with no way to tell which one matters for you. This guide is for people who use Claude Code every day, on a subscription or an API key, and want to spend less without getting worse results. You will measure first, then change the few things that move the number: cache behavior, effort, context size and caps on unattended runs. The attached pack gives you a status line that logs every session, a hook that shrinks test output, and a cost sheet to track the effect week by week.
What you will have at the end
- A clear picture of where your tokens go, from
/usage and /context.
- A status line that shows model, effort, context use, cache hit rate and session cost, and logs each session to a CSV.
- Habits and settings that keep the prompt cache warm instead of quietly rebuilding it.
- A hook that cuts test output down to the failures before Claude reads it.
- Hard caps on scripted runs, and a weekly sheet that shows whether a change paid off.
Before you start
- Claude Code, updated. Several features here are recent: the
Prompt cache (main) line in /usage needs v2.1.251 or later.
jq and bash, for the status line and hook scripts.
- The attached
token-pack/ folder.
- A normal working week ahead. You need a baseline before any change means anything.
Step 1: Measure where the tokens go
Open a session you have been working in for a while and run:
Read three parts of the screen:
The Session block. It shows total cost, durations and a per-model line with input, output, cache read and cache write tokens. The dollar figure is computed locally at list price, so it is an estimate. On a Pro, Max or Ultra subscription the figure is not what you pay, but it is still the best single measure of how much work a session asked for.
The Prompt cache (main) line. It shows the share of input tokens served from cache, the number of misses and whether the cache is warm right now. When Claude Code can identify why the last miss happened, it names the likely cause, for example changed tool definitions. The caching docs read it simply: a high share of cache reads means caching is working well, and cache writes that stay high turn after turn mean something keeps changing your prefix. Step 3 is where you fix that.
The plan usage breakdown (subscriptions only). It attributes recent usage to skills, subagents, plugins and MCP servers, and lists recommendations for behaviors behind at least 10% of your usage, such as trimming a large CLAUDE.md. Press d or w to switch between the last day and the last week. If the footer offers f to fix (v2.1.305 or later), pressing f lets Claude Code act on the rows it can.
Then look at what fills the context window:
The costs docs point to /context to see what is consuming space. Note the big items: CLAUDE.md and its imports, MCP tool names, skills, and the conversation itself.
Why context size is the number to watch: Claude Code sends your full conversation with every request, and each tool call sends another request carrying that history. A one-line question in a session that has been open all day still pays for the whole day. With caching, that history is re-read at the much lower cached rate, which is why the cache hit share and the context size together explain most of your bill.
Write down three numbers for today: session cost, cache share and context use at the end of your longest session. That is your baseline. Everything after this point exists to move those three numbers, and the pack's status line records them for you automatically from now on.