Context and cost
- 01The four levers of a long session8 min
A long session does not endlessly swell the text sent to the model, thanks to distinct levers: the cache, which reuses an identical start of conversation, clearing out useless tool outputs, compaction, which replaces the history with a summary, and delegation to sub-agents, which return only their conclusion.
- 02Compacting, clearing, reading just what is needed7 min
The /compact command replaces the message history with a summary and carries on the same conversation, the /clear command wipes that history and starts from scratch, and in both cases the project files on disk do not move: the move that saves the most remains getting Claude to read only the relevant slice of a file.
- 03Prompt cache and the Batch API, two discounts worth knowing8 min
The prompt cache and the Batch API are two different discounts on the same token cost. The cache rewards a start of conversation that does not change, the Batch API a volume of requests that can wait. The cache's lifetime depends on your offering: a paid subscription or an API key.
- 04The auto-compact threshold does not do what you think7 min
The auto-compact threshold triggers a summary of the conversation when the context reaches it, it is not a wall that closes the window: a value set above the real window of the active model is capped at that window, a documented behaviour whose lack of an on-screen warning still needs to be checked for yourself.
- 05A context window does not follow the model7 min
The context window is a property of the model: recent models have the large window as their base, two older models ask for it through the [1m] suffix, and every model change is checked on screen with /model then /context.
- 06Where the bill really comes from, and why a token count lies9 min
A session's cost comes not from the volume of work but from the number of times the accumulated history is sent back: every tool call rereads it, at the cache's reduced rate but never for free. A count that confuses a cached reread with a first read gives a false impression of the bill.
- 07Quota, throughput, and routing to the cheapest model8 min
Two distinct caps govern a session, the money cost and the throughput in tokens per minute, and both are handled by the same reflex: route repetitive tasks to Haiku or Sonnet, keep Opus for difficult reasoning, and wait according to a growing delay after a 429 error rather than retrying at once.
- 08A sub-agent costs before it has done any work8 min
A subagent costs before it has done any work, because its conversation already contains items you did not write, loaded again at every launch. With no tools field it inherits every tool, and with no model named it runs on the same model as you. List its tools and name its model by role.