[BUG] Abnormal prompt-cache token growth across two consecutive turns in a single sessio
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
Description
In a single Claude Code session with no other activity, sending "hi" twice
in a row produced prompt-cache token usage that grows far more than expected
between the two turns — the second turn's cache_read is ~5x larger than
anything the first turn wrote, with nothing else happening in between
(no tool calls, no file edits, no additional messages).
Observed usage (from session cost summary)
Turn 1:
- Total cost: $0.1355
- API duration: 2s / Wall duration: 10s
- claude-sonnet-5: 3.6k input, 13 output, 29.9k cache read, 30.8k cache write
Turn 2:
- Total cost: $0.1895
- API duration: 8s / Wall duration: 2m 12s
- claude-sonnet-5: 4.1k input, 95 output, 154.8k cache read, 34.5k cache write
Why this looks wrong
Within one session, turn 2 should mostly read what turn 1 wrote (~30k),
writing only a small delta for the new exchange. Instead:
- cache_read on turn 2 (154.8k) is ~5x turn 1's cache_write (30.8k)
- turn 2 also independently writes another 34.5k
- there is a large gap between API duration (8s) and wall duration (2m12s)
on turn 2, suggesting significant local time was spent on something not
reflected in the billed API call
No other Claude Code sessions, background agents, or MCP activity were
running during this test. No changes were made to CLAUDE.md, memory files,
or .claude/settings.json between the two turns.
Impact
$0.1355 + $0.1895 = ~$0.33 for two consecutive "hi" messages with no other
activity, which is disproportionate to the actual work done
What Should Happen?
Expected Behaviour
It should not write cache other than the input and also reads should have happened only against whatever was present.
Error Messages/Logs
Steps to Reproduce
Environment
- Claude Code version: 2.1.199
- OS: Windows 11 Home Single Language 10.0.26200 (win32)
- Model: claude-sonnet-5
Repro steps
- Start a fresh Claude Code session
- Send "hi"
- Send "hi" again
- Nothing else — no tools, no other sessions running concurrently
Claude Model
Sonnet (default)
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.1.199
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
PowerShell
Additional Information
_No response_