The biggest source of context growth in Claude Code is not tool output. In three of my own projects, thinking tokens ranked first every time: 70.2%, 46.8%, and 57.3% of growth. But you cannot see that by counting bytes in the transcript, and my first attempt at this measurement was wrong in three different ways. Here is the method that held up, the numbers it produced, and what actually lowers the bill.

The full write-up, with the retracted tables and per-tool detail, is in the original post on my-blog.org.

Why counting bytes gives the wrong answer

Thinking blocks in a Claude Code transcript have an empty text body. Only a signature field is kept. If you sum the bytes of each block type, thinking looks tiny, because you are measuring the length of a signature and not the volume of reasoning.

My first pass did exactly that. It produced three attribution tables, 36.1%, 29.9%, and 90.7%, that disagreed wildly with each other, and one of them even ranked tool results first. I retracted all three. If your own analysis of thinking cost comes from block sizes, treat it with suspicion.

Measure the usage delta instead

The transcript does carry something reliable: per-response usage values. The method works on those.

  1. Deduplicate entries by requestId. Entries repeat two to three times per request, and skipping this inflates usage by roughly 1.9x.
  2. For each response, compute context occupancy as input + cache_read + cache_creation. Field names depend on your transcript schema, so check yours.
  3. For each adjacent pair of responses, take the difference in occupancy. Subtract the visible bytes (tool results, user input, visible output) converted to tokens with a fixed factor. Whatever is left is attributed to thinking.
  4. Use the per-pair median as the verdict statistic. The aggregate ratio can be distorted by a few extreme pairs.

A minimal sketch of the core loop, assuming you have already parsed your transcript into a list of dicts with these keys:

import statistics BYTES_PER_TOKEN = 4.5 # a chosen constant, not a verified one def dedupe(entries): seen, out = set(), [] for e in entries: if e["requestId"] in seen: continue seen.add(e["requestId"]) out.append(e) return out def occupancy(e): u = e["usage"] return u["input"] + u["cache_read"] + u["cache_creation"] def thinking_ratio(entries): rows = dedupe(entries) ratios = [] for prev, cur in zip(rows, rows[1:]): growth = occupancy(cur) - occupancy(prev) visible = cur["visible_bytes"] / BYTES_PER_TOKEN if growth > 0: ratios.append((growth - visible) / growth) return statistics.median(ratios) 

The visible_bytes field is whatever you computed from tool results, user text, and visible output for that pair. Always report the factor next to the result.

What I found in three projects

Thinking share of context growth: Project A 70.2%, Project B 46.8%, Project C 57.3%

I ran this on 3,710 adjacent response pairs across three projects, measured on 2026-08-10, with the factor fixed at 4.5 bytes per token.

Project Thinking Tool results + user input
A 70.2% 16.8%
B 46.8% 36.7%
C 57.3% 8.1%

All three agree on first place. They disagree on the second driver and on which lever helps most, which is the reason to run the script on your own data instead of copying these percentages.

A second check supports the direction. The per-pair median ratios came out at 1.083, 1.063, and 1.051 to 1.072. A value above 1 means there is persistent growth that visible content cannot explain, and the carry-over of thinking into the next turn's prefix reproduced in 3 of 3 projects.

The conversion factor is the biggest error source

At 3.5 bytes per token thinking share is 31.6% to 61.7%; at 4.5 it is 46.8% to 70.2%

The byte-to-token factor is a constant I picked, and the result is sensitive to it. At 3.5 bytes per token, thinking's share ranges from 31.6% to 61.7%. At 4.5 it ranges from 46.8% to 70.2%. The same data gives a statistic of 0.670 at 3.5 and 0.902 at 4.5.

I fixed it at 4.5 and I do not claim it is verified. The practical consequence: quote the factor with every number, and trust the ranking more than the percentages.

There are two other traps worth knowing:

  • Characters are not tokens. Base64 images inflate character counts while costing few tokens.
  • Frequent beats large. In one project Bash accounted for 43.8% of tool-result growth because it was called 316 times, not because any single call was big. Edit was 11.5%, Write 11.3%, agent reports 10%, and Read 7.3%. These per-tool shares are specific to that workload.

What actually lowers the cost

Trimming your output does not help much. Compaction's first stage drops old tool outputs, but thinking persists in the next turn's prefix. So the levers are about session shape, in this order:

  1. Split work into separate sessions. Cost is roughly quadratic in session length, so halving a session cuts it to about a quarter. A sanity check on a 471-request session: total cache_read is about average context times turn count, 458k x 471, which is roughly 216M and matched what I observed.
  2. Run /clear when the topic changes. It is free. Use /rename first if you want a label, and /resume later if you need the session back.
  3. Lower effort for routine work. /effort low for mechanical edits, /effort xhigh kept for design, debugging, and verification. Turning thinking off entirely with alwaysThinkingEnabled=false in /config can make the model less eager to use tools and add round trips, so I treat that as the last resort.

Shrinking the fixed prefix (global instructions, project instructions, memory) is secondary. A 46.6k prefix amounted to only 0.26 percentage points of total usage over that 471-turn session.

Turn count matters more than output

In the same session, cache_read was 216.5M, which was 2.54 points of total usage. Output was 0.43M, or 0.05 points. That is about 50x more reading than writing, and context grew from 102k to 814k over the session.

Two habits follow directly. Batch independent commands into a single turn. And do not spend a turn checking status after spawning a subagent, because every turn re-reads the full context.

Limits

  • You need transcripts with per-response usage values.
  • Attribution is a residual. Any visible bytes you fail to subtract get credited to thinking.
  • The 4.5 factor is chosen, not validated.
  • Shares from one project do not transfer to another. Take the script, not my table.

For the retracted attribution tables and the longer discussion, see the full post on my-blog.org.

Free tools I keep on my own site: 34 calculators and how-to guides - loans, severance pay, take-home salary, savings vs deposits. New ones go out in one email, no ads.