[BUG] new sessions will **never** hit a (full)cache

Open 💬 12 comments Opened Apr 12, 2026 by wadabum

What's Wrong?

relaunching claude / clearing the session costs 6505 cache-create tokens
even after "just seconds" and super short messages (so this is not about the ongoing 5 minutes vs 1 hour discussion!)

What Should Happen?

assuming no changes where made (looking at you CLAUDE_CODE_DISABLE_GIT_INSTRUCTIONS destroying the system-prompt...)
relaunch/clear should be a 99% cachehit.
but neither skills nor project/CLAUDE.md get cached:

Error Messages/Logs

Traffic-inspection shows

"messages": [
 {
  "role": "user",
  "content": [
   {
    "type": "text",
    "text": "<system-reminder>\nThe following skills are available ...."
   },
   {
    "type": "text",
    "text": "<system-reminder>\nAs you answer the user's questions, you can use the following context:\n# claudeMd\n...."
   },
   {
    "type": "text",
    "text": "alive?",
    "cache_control": {
     "type": "ephemeral"
    }
   }
  ]
 }
],

Steps to Reproduce

Have a statusline show/log you usage.

claude
> alive?
> -> Yes, alive and ready. What do you need? 
# (11k cache read, 6k cache write)
> nice
> -> What are we working on? 
# (18k cache read, 19 cache write)
> /exit
claude
> alive?
> -> Yes, I'm here. What can I help you with?  
# (18k cache read)
> /exit
claude
> are you here?
> -> Yes, I'm here. What can I help you with? 
# (11k cache read, 6k cache write)

-> note that the two string-matched "alive?"´s do hit,
so one can start every claude session with a claude "Hello" and then do the actual work to get the full cache hits ? 🤔
but the "two different questions" gets a 6k token penalty
EDIT: as of 2.1.113 - "cch= started ticking" - ANTHROPIC_BASE_URL-users must set CLAUDE_CODE_ATTRIBUTION_HEADER=0

-> the "initial 11k" is likely some publicly shared tool cache that is hit.

there is no cache marker between system-prompt-part1 (base-prompt + user/CLAUDE.md) and the first user message.
but a whole lot of tokens for skills, and system-prompt-part2 (memory + project/CLAUDE.md)

Claude Model

Sonnet (default)

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.1.104

Platform

Anthropic API

Operating System

Ubuntu/Debian Linux

Terminal/Shell

Xterm

Additional Information

also came across the discussion here https://news.ycombinator.com/item?id=47740381
"keeping your context small" (and clearing often) is(used to?) be the way to go - but without cachepoint the reverse would be true? -> more compute for you, less expensive for users - what sounds wrong...

Note that this is especially NOT about the 5-minute vs 1 hour discussion,
the claude launches above where all within 15 seconds ;)

View original on GitHub ↗

This issue has 12 comments on GitHub. Read the full discussion on GitHub ↗