Context economics

Why a model switch cost 33 cents, what else breaks the cache, and the five commands that keep a session cheap.

Every message you send re-sends the whole session. The API caches the unchanged prefix and bills the re-read at about a tenth of the input rate. Anything that changes the prefix throws the cache away and the next turn reprocesses everything. That is the entire model, and it explains most of the cost advice.

What starts a fresh cache

Each model has its own cache, so /model mid-session re-reads the whole history uncached. That was the 33 cents. Effort level is keyed the same way. Turning on fast mode adds a header that does the same once per session. Connecting or disconnecting an MCP server can do it if its tools are loaded into the prefix. Denying a whole tool by bare name does it. Upgrading Claude Code does it on the first turn after restart, and resuming a long session after an upgrade is the most expensive request you can send.

/compact replaces the history with a summary, so by design it starts the conversation layer over. Done while the cache is warm it is cheap; done after a long break it reprocesses everything first.

What keeps it

Editing files. Editing CLAUDE.md, which also means the edit does not apply until /clear or a new session. Changing output style, same rule. Changing permission mode. Invoking skills. /rewind, which truncates back to a prefix that is already cached. Spawning subagents, which have their own cache and leave yours alone.

The five commands

/context shows what is loaded and how full you are. /btw asks a side question that never enters the history. /compact <instructions> steers the summary toward what you need to keep, at a break between tasks rather than mid-task. /rewind with “summarise from here” condenses a stretch without losing the rest. /clear after two failed corrections, then a better first prompt, beats a third correction every time.

CLAUDE.md, the size question

Under 200 lines. /doctor proposes cuts for anything Claude could derive from the codebase. Instructions that only matter for some files go in .claude/rules/ with a paths: frontmatter so they load when those files are touched, not every session. Imports with @path organise the file but still load at launch, so they do not reduce context.

Read it live

The cache stays warm for an hour on a subscription while you keep working. /usage shows the session’s hit ratio and whether the cache is warm right now. A status line can show cache_read_input_tokens against cache_creation_input_tokens every turn; a high read-to-creation ratio means it is working, and creation staying high turn after turn means something in the prefix keeps changing.

Read more