# Why Claude Code Feels Slow: Cache Misses, Context, and Fixes

> Claude Code gets slow when the prompt cache goes cold or context bloats. Diagnose with /usage and /context, then fix it with /clear and steady settings.

Claude Code feels slow most often when the prompt cache goes cold: every turn re-sends your whole conversation, and a cache miss means the API reprocesses all of it before answering. The fix is usually a habit, not a setting — keep the prefix stable, clear context between tasks, and diagnose with `/usage` before changing anything.

**The short answer:** each request contains the system prompt, your project context, and the full conversation. Prompt caching reuses the unchanged prefix at the cached token rate. Switching models or effort mid-session, changing the loaded tool set, or pausing long enough for the cache to expire forces a slow uncached turn. Run `/clear` between unrelated tasks and `/compact` at natural breaks.

![Anatomy of a Claude Code request: cached prefix layers versus new tokens, and cache invalidation triggers](/blog/claude-code-slow/request-anatomy.svg)

## Why a turn is slow: the full-context resend

The model remembers nothing between requests, so Claude Code re-sends everything each turn: system prompt, project context, every prior message and tool result, plus your new message ([prompt caching docs](https://code.claude.com/docs/en/prompt-caching)). Prompt caching matches the start of the request — the prefix — against recently processed content and bills the re-read at the cached rate. The match is exact: a change anywhere in the prefix recomputes everything after it.

Claude Code orders requests so rarely-changing content comes first:

| Layer | Content | Changes when |
| --- | --- | --- |
| System prompt | Core instructions, tool definitions | The loaded tool set changes |
| Project context | CLAUDE.md, auto memory, unscoped rules | Session start, or after /clear or /compact |
| Conversation | Messages, responses, tool results | Every turn |

Appending to the conversation keeps the first two layers cached. That is why a normal turn is fast and a turn right after a settings change is not.

## What makes the next turn slow

- **Switching models.** Each model has its own cache; a switch recomputes the whole request even when the content is identical.
- **Changing effort level mid-session.** On most models each effort level has its own cache. On Fable 5.1 and later, Opus 5.5, Sonnet 5.5, and Haiku 5.5 the cache stays intact by default.
- **A long pause.** Cached prefixes expire after inactivity. Every request that hits the cache resets the timer, so steady work keeps it warm; coming back after a break pays one cold turn.
- **Editing CLAUDE.md mid-session.** The edit does not apply until you start a new session or clear — and the project-context layer rebuilds then.
- **/compact itself.** Compaction reads the entire conversation to summarize it, so it is a large request — more expensive still after the cache has expired. Run it at natural breaks between tasks, not mid-task.

Pick your model and effort level at the start of a session and change them as little as possible mid-task; that single habit keeps the cache hit rate high.

## Diagnose before you change anything

Run `/usage`. On Pro, Max, Ultra, Team, and Enterprise it breaks usage down by skill, subagent, plugin, and MCP server, and flags patterns like long context or frequent cache failures when one exceeds 10% of your usage ([best practices](https://code.claude.com/docs/en/best-practices)). Run `/context` to see how full the window is.

Two common findings:

- **One MCP server or plugin dominates usage.** Its tool definitions sit in the system prompt layer; every loaded tool is re-sent each turn. Disable what the task does not need.
- **Frequent cache failures.** Something keeps changing the prefix — model switches, effort changes, or long gaps. Stabilize the session rather than adding more context.

## The fixes that work

- **`/clear` between unrelated tasks.** It costs nothing and stops the next task from paying for the previous task's history. `/clear oauth-migration` names the session you are leaving so you can return to it later.
- **`/compact` with a focus**, e.g. `/compact keep the API changes and the test commands`, at a natural break in a long session.
- **Watch background work.** A `/loop`, a goal check after each turn, and subagents keep sending requests while you are not looking. Each subagent also costs extra tokens — use them for parallel work, noisy output, and independent review, not to make a single answer better.
- **Keep CLAUDE.md short.** Claude reads the repo itself; write down only what is not in it. A focused context gets better answers and costs less.

## When it is not the cache

If messages fail with `Context exceeds` or `Prompt is too long`, you have hit the window, not a slow turn. Auto-compact is on by default: send your next message and it compacts; with auto-compact off, run `/compact` or `/clear` yourself ([errors reference](https://code.claude.com/docs/en/errors)). A separate `Request too large (max 32MB)` error means accumulated images and attachments pushed the raw request body past the API limit — compact, or double-press esc to remove attachments.

For scale: Anthropic reports enterprise Claude Code usage averages around $13 per developer per active day, with 90% of users below $30 per active day ([costs docs](https://code.claude.com/docs/en/costs)). If your spend sits far above that band, the `/usage` breakdown above is where the leak shows.

## Sources

- [Claude Code: How prompt caching works](https://code.claude.com/docs/en/prompt-caching)
- [Claude Code: Best practices](https://code.claude.com/docs/en/best-practices)
- [Claude Code: Costs](https://code.claude.com/docs/en/costs)
- [Claude Code: Errors reference](https://code.claude.com/docs/en/errors)
