otherwise you will only ever hit on the tools-block, and your first follow-up-question
(Note: setting includeGitInstructions=false in settings.json is an option to and likely the better thing anyhow since that git-status will always be noise - but since one needs the "Hello" remembering one alias is simple same deal ;D)
Currently the whole query is build from 3 cache-able blocks:
{tools | claude-version},
{system-prompt | ~/.claude/claude.md | git-status},
{skills | ./claude.md | user-prompt}
the env-var will allow the system-prompt line go get cached again https://github.com/anthropics/claude-code/issues/47107the "Hello" allows skills & ./claude.md to get cached again https://github.com/anthropics/claude-code/issues/47098
Before:
claude
> alive?
> -> Yes, alive and ready. What do you need?
> /exit
# (11k cache read, 6k cache write)
claude
> are you here?
> -> Yes, I'm here. What can I help you with?
> /exit
# (11k cache read, 6k cache write)
^^ nothing changed, still cashed 6k write tokens
claude
> alive?
> -> Yes, I'm here. What can I help you with?
> /exit
# (18k cache read)
^^ the "exact same question" DOES hit the cache
git commit --allow-empty -m "Dummy"
claude
> alive?
> -> Yes, alive and well. What do you need?
> /exit
# (11k cache read, 6k cache write)
^^ same question, but now git busts the cache....
After: $ CLAUDE_CODE_DISABLE_GIT_INSTRUCTIONS=1 claude "Hello"
Claude Code v2.1.104
Hello
● Hello! How can I help you today?
Alive?
● Yes, alive and ready to help! What are you working on?
# (10k cache read, 6k cache write)
$ CLAUDE_CODE_DISABLE_GIT_INSTRUCTIONS=1 claude "Hello"
Claude Code v2.1.104
Hello
● Hello! How can I help you today?
are you alive?
● I'm an AI, so not alive in the biological sense — but I'm here and ready to help. What can I do for you?
# (16k cache read, 20 cache write)
$ git commit -m "just a dummy" --allow-empty
[main 642ce16] just a dummy
$ CLAUDE_CODE_DISABLE_GIT_INSTRUCTIONS=1 claude "Hello"
Claude Code v2.1.104
Hello
● Hello! How can I help you today?
is this alive?
● Yes, I'm alive and running! Is there something I can help you with?
# (16k cache read, 18 cache write)
Note: This does not address the 5 minutes vs 1 hour discussions from yesterday - but rather that whole discussion is pointless unless these root-causes are fixed....- https://news.ycombinator.com/item?id=47739260 (Pro Max 5x quota exhausted in 1.5 hours despite moderate usage)
- https://news.ycombinator.com/item?id=47736476 (Anthropic downgraded cache TTL on March 6th)
But there has been some news on this too: https://github.com/anthropics/claude-code/issues/46829#issuecomment-4237689126
At this point we have rolled out 1h prompt cache by default in a number of places for subscribers ...
We also are not defaulting API customers to 1h yet -- this needs more testing to make sure it's a net improvement on average.
We will soon be changing the client side default to 1h for a few queries
g4cg54g54•1h ago