Blog

Where Claude Code Sessions Spend Tokens

Anthropic published Maximizing the value of your Claude Code sessions this week. It explains what a session bills: prefill and decode, cache reads and writes, and which habits decide how many tokens each turn drags along. Worth reading in full. What struck us is how much of the bill it describes is exploration, the agent hunting for code before it can change anything. That part has a fix the post can't reach, because it lives outside the session.

What a session actually bills

Input tokens are cheap because the model reads them in parallel. Output tokens generate one at a time, which is why they cost about five times as much. Caching discounts the input side: a cache read costs a tenth of the normal input price, a write up to double, and the cache expires after an hour on a subscription. Model and effort level multiply all of it, so the post says to set both once at the start of a session; switching midway breaks the cache and re-bills the whole prefix.

The line worth keeping is about session shape: "One long session costs more than the same work spread over a few short ones, and by more than you'd think, because turn 40 is also re-reading the 39 turns before it." A file read on turn 3 is still there at turn 40, discounted while the cache holds, full price when it breaks.

The advice converges on one habit

The tips sound scattered until you notice they all protect the same thing. @-mention files so they land in the first request without a Read call. Put quiet flags on chatty commands, and write them into CLAUDE.md so the agent picks them up on its own. /clear between unrelated tasks, /compact before a long break, /rewind to drop turns that led nowhere. Push log-reading into a subagent so the noise never touches your main window. Check /context in a fresh session and turn off MCP servers you don't need.

All of it is the same move: keep things out of the window, because whatever gets in stays in, and bills again on every turn.

The reference you cannot type

The @-mention tip has a precondition: you already know which file matters. On code you wrote last month, sure. The expensive sessions are the ones where the agent has to find the code first, and finding is where the window fills up.

Watch a transcript of that. A text search comes back with forty matches, pasted in full. Figuring out which ones are live call sites means opening files, and every opened file sits in the conversation for the rest of the session. "Who calls this function" has a three-line answer; the search route to it can cost tens of thousands of tokens, and per the arithmetic above, those tokens land on every later turn's bill too. We covered the attention cost of this loop in context engineering for coding agents. This post adds the price tag.

A graph lookup skips the loop. Symvanta parses the repository into symbols and edges, so "who calls this" is a traversal, and the answer is a short list of file paths, line bounds, and signatures. When we measured this on cal.com at commit 8418db7 for an earlier post, "is this eight-line helper safe to edit" came back as 2 direct callers and 30 downstream symbols across 30 files, named, in a few hundred tokens. That's the precise reference the @-mention tip wants, produced by a tool when you don't have a path to type. Source enters the window once, at the spans the graph pointed to.

Two sessions of four turns drawn as bars. In the search-and-read session each turn's bar grows taller, because every turn resends the search output and files earlier turns pulled in. In the graph session the bars stay small: lookups return short caller lists and one located span, so each turn resends almost nothing.
Each turn resends what earlier turns let in, so the bill is the area under the bars. Search output and opened files stack; graph answers barely move it. Link to this diagram Open full size

The subagent tip, taken further

A subagent gets its own window, does the messy work there, and only its conclusion comes back. The post suggests it for reading logs, and it's fair about the trade: a subagent sometimes re-reads things the main session already had. Exploration fits the same shape. Search output and opened files exist to answer a question, and none of it needs to outlive the answer.

A graph server goes one step further. The traversal behind a caller list runs in the database, so the intermediate work never enters any window at all, yours or a subagent's. Behavior questions ("how does retry work here") run the same way: retrieval and synthesis happen server-side, and the session gets back an answer with citations. The subagent tip moves exploration somewhere cheaper. Retrieval on the server removes it from the bill, and the subagent slot stays free for jobs that need a model actually reading in bulk.

Tool schemas count too

The /mcp advice cuts toward tool vendors, ours included. A connected server loads its tool definitions and instructions into the session before you type anything, and if it never earns that back, turning it off is the right call.

We ran that audit on our own server in July: cut the instruction block from about 3,000 characters to under 2,000, halved the tool descriptions, and shrank result rows for the text-search tool by about 40 percent. The math a server has to survive is simple. Its schema overhead has to come in under the exploration it replaces, and one avoided whole-file read covers a lot of tool definitions. Run /context with your own stack loaded and see what each server costs you at turn zero.

What the tokens were for

The post ends well: "Being efficient with tokens doesn't mean using fewer of them overall. It means making sure the ones you do use go towards the thing you actually asked for." In a coding session, what you asked for is the change. Exploration is overhead on the way there, and some of it is irreducible, since the agent has to know what it's changing. But that knowledge can arrive as forty pasted matches or as a caller list with line bounds, and only one of those is still billing you at turn 40.

Open one of your own transcripts and count the file reads that were never referenced again. That number, times every turn that followed, is the part of the bill this post is about.

Symvanta serves the caller-list kind of answer over MCP: callers, dependencies, blast radius, and test coverage from a live graph of your repositories, per branch, sized for the window. Setup for Claude Code and the other MCP clients is in our integrations guides. Start a free trial and watch a session of yours run without the search loop: 7 days, no credit card.

Start free trial →