[Bug] Prompt cache drops to 7,085-token system floor across runs of 43–58 calls
Bug Description
Title: [BUG] Prompt cache collapses to the system floor (7,085 tokens) on every request for 43 and 58 consecutive calls; no images, no compaction, 1h TTL (2.1.285, macOS)
## Environment
- Claude Code 2.1.285 on macOS. The session started on 2.1.284 and auto-updated mid-session.
- Model claude-opus-5-5, effort medium
- Subscription (OAuth) login, promptCacheTtl 1h: every write is ephemeral_1h_input_tokens
- One interactive CLI session, not resumed. There were 0 compactions and 7 background general-purpose subagents.
- Several plugins add PreToolUse/PostToolUse hooks. Their hook_additional_context is appended as attachments.
## What's wrong
Across 359 main-thread API calls, 110 are full cache misses. On each of them, cache_read_input_tokens falls to exactly 7,085, which is the system-prompt floor. cache_creation_input_tokens then re-writes the whole conversation (up to ~500k tokens).
Most of the misses do not stand alone. They come in two long runs, and every call in a run misses, even when the gap between calls is 8–60 seconds:
| Run | Calls | Time (UTC, 2026-09-30) | Re-written per call |
|---|---|---|---|
| A | 43 consecutive | 02:52:54 – 04:45:23 | ~285k–330k |
| B | 58 consecutive | 05:24:21 – 06:51:47 | ~438k–500k |
Impact: 42.4M of the session's 42.9M cache-write tokens (99%) are these re-writes. If the cache had held, the same session would have written ~0.4M.
## Evidence that the client mutates the prefix
Let promptTotal = input_tokens + cache_read_input_tokens + cache_creation_input_tokens. For an append-only conversation, this value can only grow. Inside the runs it shrinks between consecutive calls:
| Call | promptTotal before → after | Delta |
|---|---|---|
| #162 → #163 | 309,114 → 292,224 | −16,890 |
| #178 → #179 | 328,336 → 310,625 | −17,711 |
| #191 → #192 | 349,562 → 330,714 | −18,848 |
| #203 → #204 | 340,994 → 334,409 | −6,585 |
Content of roughly 17k tokens appears to be added to and removed from the request between calls. Nothing is removed from the transcript at those points.
## Causes ruled out
- TTL: the 1h tier is in use, and the gaps inside the runs are mostly seconds.
- Compaction: none happened.
- Images / image eviction (#90716): only 2 images entered the context in the whole session.
- Persisting cd (#91706): every Bash cd result carries "Shell cwd was reset", and the transcript cwd never changes.
- Resume: the session was never resumed.
## Isolated misses that do have a visible trigger (for completeness)
- Mid-session auto-update from 2.1.284 to 2.1.285: one miss.
- First ToolSearch that loaded Playwright MCP tools: one miss, same signature as #91514.
- Usage-limit wait followed by /login, which brought MCP deltas: one miss.
## What started and ended the runs
- Run A: starts on a plain user text message with no tool change visible in the transcript. It ends ~2h later, again with no visible event.
- Run B: starts mid tool loop, right after a Bash tool_result. It ends only after the usage-limit wait and /login.
## Request IDs
Good call → first miss:
- req_011CfYmX31zV9TtuGTAg87BC → req_011CfYmgPERCQrhmkMkhJMhw (01:39Z)
- req_011CfZ4nCoFzxptRHv2Cnkij → start of run B (05:24:21Z)
Misses inside the runs:
- req_011CfYsFGapPKoqFX33ueHzt: first call of run A
- req_011CfYxFADfUxVZXJzgYTmkU, req_011CfYxFq7VY1NsdWgxfPctL: consecutive misses in run A with the promptTotal drop above
- req_011CfYph88wibV25nToCZbtV: the ToolSearch-triggered miss
## Related
#91514 (collapse to the system+tools floor after ToolSearch / Skill / tool_result), #90716, #91706, #91151. None of them explains a run of consecutive misses with no images and no cd.
I can share the per-call usage table (timestamps, read/write/input) if useful. I will not share the raw transcript, because it contains private code.
Environment Info
- Platform: darwin
- Terminal: Orca
- Version: 2.1.286
- Feedback ID: 847e96d8-3d13-474f-9963-9101757808ed
Errors
[]This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗