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.248 Home All releases olderv2.1.247 v2.1.250newer
Claude Code v2.1.248

Agents can set their own prompt cache lifetime in frontmatter

Use it now
Useful3 Signal4
Subagents Notable

An agent file can set its own prompt cache lifetime under experimental cacheTtl.

cacheTtlexperimental
What

An agent definition file can declare a prompt cache time-to-live under experimental: { cacheTtl }, and that value is carried into the query as an agent-level override of how long the prompt cache entry lives. It only takes effect when no higher-precedence setting is present, so agents that leave it out behave exactly as before. Nothing like this existed in the previous build.

Details
  • The CLAUDE_CODE_PROMPT_CACHE_TTL environment variable and the promptCacheTtl setting both win over the frontmatter value, which applies only when the subagentPromptCacheTtl setting and its environment variable are both absent, and is recorded with the reason agent_frontmatter.
  • A value of "1h" is rejected when the caller is in a mode where a one-hour cache is not permitted, and the field's own description notes that a one-hour value is ignored while a Claude subscription is in overage.
  • The experimental object is permissive: unrecognised keys inside it are ignored rather than rejected by the otherwise strict agent frontmatter check.
  • The override is only passed along when the agent actually sets it, so the default path is unchanged.
Evidence

{ ttl: t, reason: "agent_frontmatter" }, agentCacheTtlOverride, Experimental per-agent options; unknown keys are ignored.

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

See this entry in the whole of v2.1.248 →