Back to all articles
TutorialDecember 2, 2026·11 min read

Why Claude Code Is Slow After a Break and How to Keep Its Prompt Cache Warm (2026)

You've been working with Claude Code all morning, and responses come back quickly. You step away for lunch, come back, type your next message, and wait. And wait. The reply eventually arrives, and after that everything is quick again. Nothing changed in your project, so why was that one turn so slow?

The short answer: Claude Code relies on prompt caching to avoid reprocessing your whole conversation on every turn, and that cache expires after a period of inactivity. Anthropic's documentation says that after a long enough gap, "the next request recomputes the full input and re-establishes the cache, which is why the first turn back after stepping away can be noticeably slower." How long the cache lasts depends on how you pay for Claude Code, and you can choose a longer lifetime yourself.

This guide covers how Claude Code's prompt cache works, why it's slow after a break, the other actions that cause a slow turn, how to check whether the cache is warm, and how to keep it warm through longer breaks.

How Claude Code's prompt cache works

Every message you send is a new request. Anthropic's prompt caching page explains: "The model doesn't remember anything between requests, so Claude Code re-sends the full context: the system prompt, your project context, every prior message and tool result, and your new message."

Most of that is the same as the last request, so the API reuses what it already processed. Anthropic's page says that with caching, the API "reuses what it already processed, bills the re-read at the cached token rate, and fully processes only what changed."

The cache matches the start of each request, called the prefix. Anthropic's page is specific: "The match is exact, so a change anywhere in the prefix recomputes everything after it. There is no per-file or per-segment caching."

Claude Code orders each request so the parts that rarely change come first:

LayerWhat's in itChanges when
System promptCore instructions, tool definitionsThe set of loaded tool definitions changes
Project contextCLAUDE.md, auto memory, unscoped rulesSession starts, or after /clear or /compact
ConversationYour messages, responses, tool resultsEvery turn

A new message adds to the conversation layer, so everything before it stays cached. That's why most turns are quick.

Why Claude Code is slow after a break

The cache expired while you were away

This is the main cause. Anthropic's page explains: "Cached prefixes expire after a period of inactivity. Each request that hits the cache resets the timer, so the cache stays warm as long as you keep working."

The time a cache survives is called its time to live, or TTL. The API offers two: five minutes and one hour. When you come back after the TTL has passed, there's no cache left, so the whole conversation is processed again. The longer the conversation, the more there is to reprocess.

After that one slow turn, the new prefix is cached, and the following turns are quick again.

Your TTL is five minutes, not an hour

Which TTL you get depends on how you use Claude Code. Anthropic's page says that unless you choose one yourself, "Claude Code requests the one-hour TTL only on a Claude subscription within your plan's included usage."

Here's the default for your main conversation:

How you use Claude CodeMain conversation TTL
Claude subscription, within plan usageOne hour
Usage credits, API key, or cloud providerFive minutes

So if you sign in with an API key or use a cloud provider, a coffee break can be long enough for the cache to expire.

There's one more case. Anthropic's page says that once you go over your plan's usage limit and Claude Code draws on usage credits, "Claude Code drops the main conversation to the five-minute TTL".

You resumed an old session

Resuming works the same way. Anthropic's page says that when you resume a session, Claude Code "sends the whole conversation again, and the request reads from the cache whatever part of its prefix is unchanged and still within the cache lifetime." An old session's cache has usually expired, so the first turn reprocesses it.

Something else changed during the break

If you upgraded Claude Code, started a new session after an update, or changed settings while away, the first turn may rebuild the cache for a different reason. Anthropic's page notes that a new version "typically updates the system prompt or tool definitions," so the first conversation after an upgrade builds its cache from the top.

Other actions that cause one slow turn

A break isn't the only trigger. Anthropic's page lists actions that "can cause the next request to miss part or all of the cache." Each causes one slower, more expensive turn, after which the new prefix is cached:

  • Switching models. Each model has its own cache.
  • Changing effort level. On most models, each effort level has its own cache. Anthropic's page says that with an API key or a Claude subscription, changing effort keeps the cache on Fable 5.1 and later, Opus 5.5, Sonnet 5.5, and Haiku 5.5.
  • Turning fast mode on or off. Fast mode and standard speed keep separate caches.
  • Connecting or removing an MCP server. This depends on whether tool search defers the session's MCP tools, which is the default on supported models.
  • Enabling or disabling a plugin. This depends on what the plugin provides.
  • Denying an entire tool. When tool search is unavailable or disabled.
  • Compacting the conversation. Compaction replaces your history with a summary.
  • Accumulating many images. Claude Code removes a batch of the oldest images when a request would pass the limits.
  • Upgrading Claude Code.

Some actions keep the cache. Anthropic's page lists editing files in your repository, editing CLAUDE.md mid-session, changing permission mode, changing output style, invoking skills and commands, running /recap, rewinding the conversation, and spawning a subagent.

Why compacting after a break is slow too

If you come back after a break and run /compact, it can take a while. Anthropic's page explains why: "After a break longer than the cache lifetime, there is no cache left to read, so the summarization request reprocesses that history as uncached input."

That's also why compaction is cheapest mid-session. While the cache is warm, the summary request reads your history from the cache. Anthropic's page suggests running /compact "at a natural break in your work, such as between tasks, instead of waiting for auto-compaction to trigger mid-task."

On the one-hour TTL, Claude Code can also compact a long conversation you leave idle. Anthropic's page says you can turn this off by setting idleCompaction to false, which requires Claude Code v2.1.290 or later.

How to check whether the cache is warm

You don't have to guess. Anthropic's page says that after the main conversation's first response, running /usage adds a Prompt cache (main) line to the Session block, "showing the session's hit ratio, miss count, and whether the cache is warm right now." This requires Claude Code v2.1.251 or later.

The same line can explain a miss. Anthropic's page says it "also names the likely cause of the last miss when Claude Code can identify one". The likely-cause text requires v2.1.260 or later.

For a live view, a status line script can read the cache numbers from the response. Anthropic's page describes the key signal: "A high read-to-creation ratio means caching is working well. If creation stays high turn after turn, something is changing in your prefix."

What people try first

Expecting the cache to survive an upgrade. A new version typically updates the system prompt or tool definitions, so the first conversation after it builds its cache from the top.

Running /compact right after a long break. With no cache left, the summary request reprocesses the history uncached.

Switching models to get a faster reply. A model switch reads the whole conversation with no cache hits.

Turning fast mode on and off mid-task. Each toggle can read uncached what the other speed doesn't have.

Assuming an API key gets the same TTL as a subscription. The default is five minutes with an API key.

The Fix: Keep Claude Code's prompt cache warm

Step 1: Know your default TTL

If you're on a Claude subscription within plan usage, your main conversation gets one hour. With usage credits, an API key, or a cloud provider, it's five minutes.

Step 2: Choose the TTL yourself

Anthropic's page says you can set the main conversation's TTL with the promptCacheTtl setting or the CLAUDE_CODE_PROMPT_CACHE_TTL environment variable. Each takes 5m or 1h. Both require Claude Code v2.1.242 or later. Anthropic's page adds: "If you sign in with an API key or use a cloud provider, set promptCacheTtl to 1h to give the main conversation a one-hour cache."

Keep the trade-off in mind. Anthropic's page says the one-hour TTL "charges a higher rate for cache writes", and that it "costs more on short bursts of work that never idle past five minutes". It pays off when you leave a session idle and come back.

Step 3: Set the TTL for subagents and workflows if you use them

Requests outside the main conversation, such as subagents and workflows, get five minutes by default. Anthropic's page says to use the subagentPromptCacheTtl setting or the CLAUDE_CODE_SUBAGENT_PROMPT_CACHE_TTL environment variable for that bucket.

Step 4: Check for overrides

Anthropic's page lists the order Claude Code uses when more than one control applies. The first is FORCE_PROMPT_CACHING_5M=1, which forces five minutes for both buckets. If you or your organization set it, it wins over your other settings.

Step 5: Make changes at the start of a session

Anthropic's page advises: "Pick your model and effort level at the top of a session, then save /compact for natural breaks between tasks."

Step 6: Check /usage when it feels slow

Look at the Prompt cache (main) line to see whether the cache is warm and the likely cause of the last miss.

Setting this up in MemoryLake

A warm cache helps within one conversation. But the cache is tied to that conversation, that machine, and that directory. Anthropic's page says: "In Claude Code, the cache is effectively scoped to one machine and directory." When you start fresh, the context you explained in the old session doesn't come with it, apart from what's in CLAUDE.md or auto memory.

MemoryLake is a memory layer for project context you want to keep across sessions and tools, kept in one place you maintain and available to the assistants you connect, such as ChatGPT, Claude Code, and Codex.

You write the entries yourself. Nothing is read out of, written to, or deleted from Claude Code's prompt cache, its sessions, your CLAUDE.md, auto memory, settings, or any vendor's store. Prompt caching works the way Anthropic describes it.

Step 1: Create an API key

Sign in and generate a key from the dashboard. Keep it somewhere private.

The MemoryLake console showing the API keys screen, where a new key is created and copied for use in an agent
The MemoryLake console showing the API keys screen, where a new key is created and copied for use in an agent

Step 2: Upload your first memories

Start with the decisions and background you find yourself repeating at the start of new sessions, one topic per entry.

The MemoryLake workspace with the first documents uploaded, listing each file as it becomes searchable memory
The MemoryLake workspace with the first documents uploaded, listing each file as it becomes searchable memory

Step 3: Connect your AI & agents

Connect Claude Code, ChatGPT, Codex, and the other assistants you use, so the same context is there in each.

The MemoryLake integrations screen listing the AI clients and agent frameworks that can be connected to the memory layer
The MemoryLake integrations screen listing the AI clients and agent frameworks that can be connected to the memory layer

What this changes in practice

The first difference is fewer long sessions kept alive just for context. You can start a new session without losing the background.

The second is shorter conversations. When background lives in a short set of entries, there's less history to reprocess after a break.

The third is reach. The same context is there in the other assistants you use.

Best practices for Claude Code's prompt cache

Know your TTL. One hour on a subscription within plan usage, five minutes otherwise.

Set promptCacheTtl to 1h if you take long breaks. Especially with an API key or a cloud provider.

Leave it at five minutes for short bursts. The longer TTL costs more when you never idle.

Pick model and effort early. Changing them mid-task can cost a full re-read.

Compact between tasks, not after a break. A warm cache makes compaction cheaper.

Use /rewind instead of /compact to abandon a path. Anthropic says rewinding returns to a prefix that's already cached.

Check /usage when a turn is slow. It shows whether the cache is warm.

Conclusion

Claude Code is slow after a break because its prompt cache expires after a period of inactivity, and the first turn back reprocesses the whole conversation. On a Claude subscription within plan usage, the main conversation gets a one-hour TTL by default. With usage credits, an API key, or a cloud provider, it's five minutes. Model switches, effort changes, fast mode toggles, MCP and plugin changes, compaction, images, and upgrades can also cause one slow turn.

To keep the cache warm, set promptCacheTtl to 1h if you take longer breaks, choose your model and effort at the start, compact between tasks, and check /usage to see whether the cache is warm.

Frequently asked questions

Why is Claude Code slow after I step away?

The prompt cache expired while you were away, so the first turn back reprocesses the full conversation. Later turns are quick again.

How long does Claude Code's prompt cache last?

On a Claude subscription within plan usage, the main conversation gets one hour by default. With usage credits, an API key, or a cloud provider, it's five minutes.

How do I make Claude Code's cache last longer?

Set promptCacheTtl to 1h, or set CLAUDE_CODE_PROMPT_CACHE_TTL to 1h. Both require Claude Code v2.1.242 or later.

Does a one-hour cache cost more?

Anthropic says the one-hour TTL charges a higher rate for cache writes, so it costs more on short bursts that never idle past five minutes.

How can I tell if the cache is warm?

Run /usage. The Prompt cache (main) line shows the hit ratio, miss count, and whether the cache is warm right now.

Why is /compact slow after a break?

With no cache left, the summarization request reprocesses the history as uncached input.

Does switching models make Claude Code slower?

For one turn. Each model has its own cache, so the next request reads the whole conversation with no cache hits.