Unclear What CLAUDE_CODE_MESSAGES_PROMPT_CACHE_TTL actually changes when set is not shown.
What
The prompt cache lets the model reuse earlier parts of a conversation instead of processing them again, for a set time called the TTL (time to live). CLAUDE_CODE_MESSAGES_PROMPT_CACHE_TTL is a new environment variable, a setting handed to Claude Code when it starts:
- When it equals
5m, the main conversation's cache TTL is forced to 5 minutes. Otherwise the usual TTL,1hor5m, is used unchanged. - When the variable would change the TTL, the main conversation no longer gets its usual cache setting.
- It sits on the same list as
CLAUDE_CODE_PROMPT_CACHE_TTL,CLAUDE_CODE_SUBAGENT_PROMPT_CACHE_TTL,CLAUDE_CODE_EFFORT_LEVELandDISABLE_INTERLEAVED_THINKING, and in the configuration map.
Why
It is a separate control from CLAUDE_CODE_PROMPT_CACHE_TTL and FORCE_PROMPT_CACHING_5M, so you can shorten caching for the main conversation's messages on their own.
Documented inclaude-code/agent-sdk/cost-tracking
Something disagreesSomething we can check disagrees with this entry, or the writer said they could not settle it.
The writer flagged doubt
What `CLAUDE_CODE_MESSAGES_PROMPT_CACHE_TTL` actually changes when set is not shown.
The name it cites is new in this build
New in this build: CLAUDE_CODE_MESSAGES_PROMPT_CACHE_TTL