{"version":"2.1.300","anchor":"new-env-var-claude-code-messages-prompt-cache-ttl-added-to-a","canonical_anchor":"new-env-var-claude-code-messages-prompt-cache-ttl-added-to-a","heading":"New CLAUDE_CODE_MESSAGES_PROMPT_CACHE_TTL variable can force 5-minute caching","tier":"use","area":"Prompt Caching","scope":"individual","heads_up":false,"url":"https:\/\/changelogs.core-directive.com\/v\/2.1.300\/e\/new-env-var-claude-code-messages-prompt-cache-ttl-added-to-a","release_url":"https:\/\/changelogs.core-directive.com\/v\/2.1.300","markdown":"### New CLAUDE_CODE_MESSAGES_PROMPT_CACHE_TTL variable can force 5-minute caching\n\nSetting CLAUDE_CODE_MESSAGES_PROMPT_CACHE_TTL to 5m forces the main conversation's prompt cache to last 5 minutes\n\n**Unclear.** What `CLAUDE_CODE_MESSAGES_PROMPT_CACHE_TTL` actually changes when set is not shown.\n\n**What**\n\nThe 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:\n\n- When it equals `5m`, the main conversation's cache TTL is forced to 5 minutes. Otherwise the usual TTL, `1h` or `5m`, is used unchanged.\n\n- When the variable would change the TTL, the main conversation no longer gets its usual cache setting.\n\n- It sits on the same list as `CLAUDE_CODE_PROMPT_CACHE_TTL`, `CLAUDE_CODE_SUBAGENT_PROMPT_CACHE_TTL`, `CLAUDE_CODE_EFFORT_LEVEL` and `DISABLE_INTERLEAVED_THINKING`, and in the configuration map.\n\n**Why**\n\nIt 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.\n\n- Area: Prompt Caching\n- Names: `CLAUDE_CODE_MESSAGES_PROMPT_CACHE_TTL`, `CLAUDE_CODE_PROMPT_CACHE_TTL`, `CLAUDE_CODE_SUBAGENT_PROMPT_CACHE_TTL`\n- Tier: Use it now\n- Useful: 5\/5\n- Signal: 3\/5\n- Scope: individual\n- Heads-up: no"}