How do I reduce Claude Code's token usage?

Updated

Short answer

Ask for an outline before reading a whole file. On 8 pinned large files, signatures were 79.7 to 97.1% smaller than full reads, median 94.5%, with tokens estimated from UTF-8 bytes divided by four. This does not measure total session tokens or billed cost.

What the agent spends tokens on

Before Claude Code edits anything, it finds out where to work: it searches, opens files, follows imports and opens more files. Each file it opens stays in the context and is read again, as input, on every later turn. The fewer whole files enter, the less every turn costs.

What changes with an index

With Pixel wired in, the agent asks instead of opening: pixel scope-task for the files a task touches, pixel list-signatures for what a file contains, pixel who-calls for the callers of a function. Each answer is fitted to a budget and says whether it is complete. An outline locates definitions; an edit still needs their bodies. File/signature volumes do not establish token or cost savings for a whole session.

pixel setup wires it into Claude Code with hooks in ~/.claude/settings.json that add a source-cited brief to each code prompt, and a pixel skill; no guard is added and Claude Code keeps its native tools. The Claude Code page lists every file it writes and how to remove it.

Measure it on your sessions

pixel token-savings (a command plugin) reads the local action log and reports measured Pixel output volumes and versioned workflow estimates. It does not observe all agent reads, model context or billed cost. Run it after a few days of normal work; it tells you more about your code than any benchmark of ours.

The figures

File versus signatures, estimated tokens79.7 to 97.1% less, median 94.5%
Opus 5.5 medium trial, median duration42.9 s without Pixel, 47.6 s with hooks (+11%)

Every figure above is on the benchmarks page, with its sample size and its method: Well-known files, On whole agent tasks.

Where Pixel does not win

Edits still need code bodies. In one Opus 5.5 medium trial on a low-research scoping task, install hooks were slower (+11%), with more tokens read (+12%) and higher provider-reported API cost (+31%); raw runs are not archived. This does not establish a general result. File/signature volumes do not establish whole-session token or cost savings.