{"version":"2.1.248","anchor":"agents-can-set-their-own-prompt-cache-lifetime-in-frontmatte","canonical_anchor":"agents-can-set-their-own-prompt-cache-lifetime-in-frontmatte","heading":"Agents can set their own prompt cache lifetime in frontmatter","tier":"use","area":"Subagents","scope":null,"heads_up":null,"url":"https:\/\/changelogs.core-directive.com\/v\/2.1.248\/e\/agents-can-set-their-own-prompt-cache-lifetime-in-frontmatte","release_url":"https:\/\/changelogs.core-directive.com\/v\/2.1.248","markdown":"### Agents can set their own prompt cache lifetime in frontmatter\n\nAn agent file can set its own prompt cache lifetime under experimental cacheTtl.\n\n**What**\n\nAn 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.\n\n**Details**\n\n- 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`.\n- 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.\n- The `experimental` object is permissive: unrecognised keys inside it are ignored rather than rejected by the otherwise strict agent frontmatter check.\n- The override is only passed along when the agent actually sets it, so the default path is unchanged.\n\n**Evidence**\n\n`{ ttl: t, reason: \"agent_frontmatter\" }`, `agentCacheTtlOverride`, `Experimental per-agent options; unknown keys are ignored.`\n\n- Area: Subagents\n- Names: `cacheTtl`, `experimental`\n- Tier: Use it now\n- Useful: 3\/5\n- Signal: 4\/5"}