AI Coding Agents
What Claude Code cache miss GitHub issues show
Claude Code cache miss GitHub issues describe tool order changes, repeated writes of startup context, and changes to earlier messages on resume. Use the reports to choose a test, then use /usage to compare reads, writes, misses, and expected rebuilds while holding your model, tools, and billing mode steady.
Claude Code cache miss GitHub issues describe several different patterns. Tools arrive in a different order, startup context gets written again, or earlier messages change on resume. Use the reports to choose a test, then use /usage to compare reads, writes, misses, and expected rebuilds while holding your model, tools, and billing mode steady.
What the Claude Code issue reports show
Issue states below are as of November 30, 2026. The observations and measurements belong to the reporters. A report can point you to a useful comparison on your own setup, even when it leaves the cause unresolved.
| User report | State and open date | What the title or body reports |
|---|---|---|
| #112901 | Open, Nov. 28, 2026 | On the first load of a deferred MCP tool, the reporter saw the tail of the tools array reorder and an already cached tool move, with a tools_changed miss. The same report describes a separate history rewrite when media was evicted. |
| #110258 | Open, Nov. 15, 2026 | The first fork or resume request listed deferred MCP tools in a different order while servers were still connecting. One request wrote 169,933 tokens, and the next request, with the servers connected, read 209,475. |
| #110344 | Open, Nov. 16, 2026 | New sessions with different opening prompts wrote the deferred tool names again. The reporter found the list after the first user message in the transcript and observed no writes on the second run when repeating the same opening prompt. |
| #98513 | Open, Sept. 30, 2026 | The Agent SDK reporter found environment text, deferred tools, agents, and skills after the first user prompt. Project memory preceded the prompt inside the same first message, with no breakpoint between the memory and prompt in the captured request. |
| #105564 | Open, Oct. 28, 2026 | The second turn repeatedly rewrote roughly 17,000 tokens of startup context and returned messages_changed. In the reporter’s normal setup, writes fell from 17,528 on turn two to 223 on turn three. |
| #109399 | Open, Nov. 12, 2026 | A wake-up roughly 55 minutes after a hit on a one-hour cache read the system layer and rewrote message history. The reporter saw messages_changed and described the request as byte-identical. |
| #112264 | Open, Nov. 25, 2026 | The reporter traced Code Mode resume misses to event nonces generated with a per-process key. They showed an earlier tool result rendered with different nonce text across successive processes. |
| #46917 | Open, Apr. 12, 2026 | In a cold single-call comparison, version 2.1.100 wrote 69,922 tokens versus 49,726 on 2.1.98, despite sending fewer bytes. The reporter suspected a server-side explanation. |
| #46829 | Closed Apr. 12, 2026, opened Apr. 12, 2026 | The reporter’s historical session logs showed a transition from one-hour writes toward predominantly five-minute writes in March 2026. The snapshot records closure on the filing date. |
| #112856 | Open, Nov. 28, 2026 | The reporter describes roughly 45,000 tokens re-cached on the second turn of a fresh session and separately reports a mismatch between changes in the plan meter and session cost. |
The MCP reports suggest three different comparisons. Use #112901 when a miss follows the first use of a deferred tool inside a running conversation. Use #110258 when the difference appears on the first request after a fork or resume, especially while servers are still connecting. Use #110344 when a batch of short, fresh sessions keeps writing a similar deferred tool list behind different first prompts. The shared word “deferred” describes the tools involved. The point at which the reported requests diverge differs across the three cases.
The session-start reports also have different denominators. #98513 compares separate sessions that start with different prompts. #105564 and #112856 describe a jump between turns of one new session. A first-turn write that grows with project context and a second-turn write that repeats that context produce different shapes in a log. Record the first three turns before deciding which pattern you’re seeing. A session total taken after all three turns hides the jump you need to inspect.
The idle and resume reports suggest recording both elapsed time and whether you restarted the process. #109399 describes a miss in an idle main session inside the reported TTL. #112264 compares how old results were serialized when the process changed. For #46917, content length in bytes and cache creation in tokens are two separate measurements. The reported discrepancy gives you a version comparison to look for, while the suggested server-side explanation remains the reporter’s interpretation. Use #46829 as a historical observation and check the TTL on your own run. Its closure date alone gives you no fix version.
Which actions change the cached prefix
As of November 30, 2026, Claude Code documents a system prompt layer, a project context layer, and the growing conversation. The Claude API matches the request prefix in tools, system, then messages order. An early tools change can cut off reuse for the messages that follow. A change inside message history can leave an earlier prefix available if it was cached and still matches. See Claude Code caching and Claude API caching.
| Action | Documented effect to check |
|---|---|
| Switch models or toggle fast mode | Switching models makes the next request read the entire conversation uncached. Fast and standard speeds use separate caches. The first switch to fast mode reads the whole history uncached. Later toggles can reuse any still-warm history at the destination speed. |
| Change effort mid-session | Most models rebuild. On an API key or Claude subscription, the docs specify exceptions for Fable 5.1 and later, Opus 5.5, Sonnet 5.5, and Haiku 5.5. Check the provider and configuration caveats in the caching docs. |
| Connect or remove an MCP server | With deferred tools, Claude Code says it preserves the initial tool list for the conversation. With tools loaded upfront, adding definitions or deliberately removing them invalidates the cache. |
| Change plugins or deny a whole tool | Skills, commands, agents, hooks, monitors, and themes preserve the prefix when applied as documented. Plugin MCP servers follow the MCP rules. Enabling a code intelligence plugin adds the LSP tool definition. A deny rule that removes a definition breaks reuse when tool search is off or unavailable. |
| Compact, drop old image batches, or upgrade | Compaction replaces the conversation. Image eviction rewrites the messages that held the images. An upgrade typically changes the system prompt or tool definitions for new conversations. |
| Change permission mode, output style, or invoke a skill | Permission mode and appended instructions preserve the prefix. A skill that changes the model, or a plan-mode toggle with opusplan, is subject to the model-switch rule. |
Edit a file, use /recap, use /rewind, or spawn a subagent | Edits leave previously read text in history intact, and /recap appends its result. /rewind returns to a prior prefix, and subagent calls and results append to the parent. A subagent has its own cache. |
Editing project-root or user-level CLAUDE.md illustrates the difference between editing a file and updating a request. Claude Code holds what it loaded at session start in memory. The edit leaves the cached copy in place until a reload, such as /compact, /clear, or a restart. If a documented cache-safe operation coincides with a write spike, check whether it also changed the model, reloaded context, or changed the tools sent.
Run a three-turn check with /usage
- Start a disposable session in the project you use normally. Record the Claude Code version, model, billing mode, and active MCP setup. Keep model, effort, speed, and tools steady through the baseline.
- Send a short prompt that requires no tool use. Run
/usageafter the reply. Save the main cache line and the model’s cumulative cache reads and writes. Use the first turn as your startup baseline. - Send two more short prompts inside the active TTL. Check
/usageafter each and subtract the previous cumulative read and write totals. A large turn-two write followed by a much smaller turn-three write is the shape to compare with #105564 and #112856. - Repeat with one change chosen from your actual workflow. For example, use a deferred MCP tool for the first time, or resume the same test session after recording its last activity. Compare the first request after that change with the plain continuation. Keep the idle time and the event you introduced in the same note.
- Classify what the client counted.
Prompt cache (main)shows the share of input served from cache, misses, and the current warm or cold status. Compaction and clearing old tool results can appear under expected rebuilds. The line covers the main conversation, so use the relevant request data when looking at a helper or subagent.
The main cache line appears on version 2.1.251 and later. Likely-cause text requires 2.1.260 or later and appears when Claude Code can identify a likely cause. For API usage, price from the usage counters. The Claude API’s diagnostic cache_missed_input_tokens is an estimate of how much of the prefix lay after the divergence, and billing uses usage counts. For included subscription use, follow the plan meter and usage breakdown independently of the session’s list-price estimate. See Claude Code cost and usage.
What to check next
- The miss follows an idle gap. Confirm the TTL before comparing elapsed times. Claude Code defaults the main conversation to one hour inside included subscription usage and five minutes on an API key, cloud provider, or usage credits. The documented
claude -p "hello" --output-format jsoncheck shows the write tier underusage.cache_creation. See Claude Code cache settings and the five-minute versus one-hour TTL comparison. - The miss follows tool loading or a resume. Save the before-and-after tool order if your request records expose it. Check the position of the first changed definition and whether the turn was a continuation or a reconstructed first request. See MCP tool order and prompt caching.
- The client counted an expected rebuild. Compare the first and subsequent turns after the rewrite to see whether the shorter history now stays warm. See context compaction and prompt cache cost.
- The cause is still unclear and you control the API calls. Use comparative diagnostics to locate the first divergence, and keep the usage counters beside that result. See the Claude API cache diagnostics guide.
Sources
- Claude Code prompt caching (Anthropic, accessed 2026-11-30)
- Claude Code cost and usage documentation (Anthropic, accessed 2026-11-30)
- Claude API prompt caching (Anthropic, accessed 2026-11-30)
- Claude API cache diagnostics (Anthropic, accessed 2026-11-30)
- Claude Code report on deferred tool ordering (GitHub, accessed 2026-11-30)
- Claude Code report on second-turn startup writes (GitHub, accessed 2026-11-30)
- Claude Code report on the historical TTL change (GitHub, accessed 2026-11-30)
Interactive report
- The Cache Breakers: The agent sends another ordinary-looking request. A timestamp, a shuffled tool list, or a model switch just changed what the API can reuse. See what each edit puts on the invoice.
How this note was produced
Drafted with AI assistance from committed ByteCosts pricing snapshots and deterministic cost formulas. Figures are grounded in the linked sources (last updated 2026-11-30). Read our editorial & automation policy, inspect the methodology, or report a discrepancy.
What Claude Code cache miss GitHub issues show. ByteCosts. Updated 2026-11-30. https://bytecosts.com/blog/claude-code-prompt-cache-misses/