Skip to content
BENIBIX Learn

CLAUDE_CODE_PROMPT_CACHE_TTL

AI⌨️ Claude CodeConfiguration

Also known as CLAUDE_CODE_SUBAGENT_PROMPT_CACHE_TTL

It sets the cache time for the main chat: 5m or 1h.

Think of it like

It is like you choose how long the shop keeps your bag at the desk.

Example

Jack's main chat sits idle for long spells, but his subagents finish fast. He gives the main chat 1h and the subagents 5m.

Why it matters

The main chat and the helpers have different gaps between calls, so one time does not fit both.

Definition

CLAUDE_CODE_PROMPT_CACHE_TTL sets how long a saved prompt lasts for the main chat. It takes 5m or 1h and nothing else. Its twin with SUBAGENT in the name does the same for subagents, workflows and work in the back. Both win over the one-hour switch and the settings. It needs version 2.1.242 or later.

Example code

bash
export CLAUDE_CODE_PROMPT_CACHE_TTL=1h
export CLAUDE_CODE_SUBAGENT_PROMPT_CACHE_TTL=5m
claude
A long cache for you, a short one for helpers.
The TTL variables are second in line.

Common mistake

Writing 60m or 3600. It only takes 5m or 1h.

Key takeaways

  1. 1
    5m or 1h. Nothing else.
  2. 2
    Main and subagent. Two variables.
  3. 3
    Beats the 1h switch. But not the force.

Compare