Source Intelligence

DisclaimerUnofficial, and not affiliated with Anthropic. Nearly all of this is read straight out of what ships: npm bundles, captured prompts, published docs. Anthropic's own notes go in verbatim, marked as theirs. The rest is my reading, and every entry carries the strings behind it. If one looks wrong, vote it down and say why.

All of v2.1.242 Home All releases olderv2.1.241 v2.1.243newer
Claude Code v2.1.242

Prompt cache lifetime is now configurable

Use it now
Useful4 Signal3
Performance Notable

You can pin the prompt cache to five minutes or an hour, separately for subagents.

promptCacheTtlsubagentPromptCacheTtlCLAUDE_CODE_PROMPT_CACHE_TTLCLAUDE_CODE_SUBAGENT_PROMPT_CACHE_TTL
What

Two new settings, promptCacheTtl and subagentPromptCacheTtl, pin the prompt cache to "5m" or "1h". The first covers the main conversation (interactive, -p and SDK turns and the helpers that run inline with it), the second covers subagents, workflows and background requests. CLAUDE_CODE_PROMPT_CACHE_TTL and CLAUDE_CODE_SUBAGENT_PROMPT_CACHE_TTL override the settings. No experiment gate; available to everyone on this build.

Details
  • Unset means automatic: 1 hour on a Claude subscription within usage limits, 5 minutes on an API key, Bedrock, Vertex or Foundry for the main conversation; 5 minutes for subagents unless ENABLE_PROMPT_CACHING_1H=1.
  • Resolution order is FORCE_PROMPT_CACHING_5M, then the environment variable, then the setting, then the 1h environment flags.
  • Both environment names were added to the allowlist, and request telemetry gained prompt_cache_ttl and prompt_cache_ttl_reason.
Usage
# in settings.json
{ "promptCacheTtl": "1h", "subagentPromptCacheTtl": "5m" }

# or per run
CLAUDE_CODE_PROMPT_CACHE_TTL=1h claude
Evidence

CLAUDE_CODE_SUBAGENT_PROMPT_CACHE_TTL, Prompt cache TTL for the main conversation (interactive, -p and SDK turns, plus the helpers that run inline with it), Prompt cache TTL for the main conversation (interactive, -p and SDK turns, plus the helpers that run inline with it): "5m" or "1h".

Strings lifted out of the shipped bundle, so the claim above can be checked against them.

Related

Other releases about the same thing. Found by shared names or similar wording; neither means one caused the other.

See this entry in the whole of v2.1.242 →