Context and cost
- 01The four levers of a long session8 min
A session that runs long rests on just four levers: the cache, which reuses a stable prefix, clearing out stale tool outputs, compaction, which summarises the history, and partitioning, which delegates bulky work to isolated sub agents.
- 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 charges reading of an identical prefix at around ten per cent of the normal input price, with a lifetime that depends on the offering, one hour for the main conversation of a paid subscription used within its plan, five minutes for an API key or a sub agent; the Batch API, for its part, processes a batch of requests asynchronously with a fifty per cent discount, on a separate rate limit quota.
- 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
An extended window does not appear to carry over automatically from one model to another, a point the documentation does not settle explicitly: the size suffix should be retyped as a precaution at every model change through the /model command, except for two named models whose behaviour differs from the general case.
- 06Where the bill really comes from, and why a token count lies9 min
The real cost of a session rarely hides where you look for it: a token count often confuses a reread at cache rate with a first read at full rate, a handful of marathon sessions carry most of the bill because the entire history is reread on every tool call, and any file loaded automatically at startup is paid for in full again at every compaction, not just once at the start.
- 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.