Canonical: https://getacc.dev/guides/claude-code-subagent-cache-lifetime/
Author: [Mykola Maksymenko](https://getacc.dev/about/mykola-maksymenko/)
Reviewed: 2026-11-09 · ACC not-applicable

# Claude Code subagents: when a one-hour cache pays

Claude Code can keep a subagent's prompt cache for one hour instead of five minutes. In this measurement the one-hour cache worked as documented, but it was not a general saving. It paid only for a role that pauses longer than five minutes. Short read-only roles cost more with it.

## What the cache lifetime changes

Claude Code subagents use a five-minute prompt cache by default. The cache lifetime sets the price of writing context into the cache and how long a later request can read it back cheaply. Prices are relative to base input:

| Operation | Cost |
| --- | --- |
| Five-minute cache write | 1.25× |
| One-hour cache write | 2× |
| Cache read | 0.1×, or 0.05× for Opus 5.5 and Sonnet 5.5 |

A one-hour write costs 0.75× more on every token written. That extra cost only pays back when a pause would otherwise let the five-minute cache expire, so the next request rewrites the whole context. If a role never pauses that long, the one-hour cache only adds cost.

## How to set it

Several settings can choose the lifetime. From highest to lowest priority:

1. `FORCE_PROMPT_CACHING_5M=1`
2. `CLAUDE_CODE_SUBAGENT_PROMPT_CACHE_TTL`
3. `subagentPromptCacheTtl` in settings
4. `experimental.cacheTtl` in the subagent's frontmatter (Claude Code 2.1.248 and later; `1h` is ignored while a subscription is using usage credits)
5. `ENABLE_PROMPT_CACHING_1H=1`
6. The default, five minutes

The settings key also covers workflows, forks, compaction and session titles, not only subagents. A global setting outranks a role's frontmatter, so one global value removes the per-role choice.

## What was measured

Everything below is modeled at API list prices, except where it says otherwise. It compares the actual requests with a five-minute counterfactual.

**The setting worked.** After setting `subagentPromptCacheTtl: "1h"`, the session logs showed that every subagent cache write was one-hour and none was five-minute. In this measurement, 57 of 57 pauses longer than five minutes kept the cache. This is a measurement of the logs, not of billing.

**The saving was small and uneven.** Modeled input cost against the five-minute counterfactual:

| Scope | Setting | Input cost vs five-minute |
| --- | --- | --- |
| One night | One hour for all roles | About 20.7% lower |
| One night | One hour only for the implementing role | About 30% lower |
| A longer week of logs | Either choice | About 8% lower |

Input cost is only part of total spend. The net effect was at most about 10% of total spend, and it was not visible in the weekly limit.

**It depended on the role.** One night, by role:

| Role | Effect of a one-hour cache |
| --- | --- |
| Implementing | Cheaper |
| Read-only reviewer | About 50% more |
| Read-only explorer | About 46% more |
| General-purpose | About 40% more that night, about 11% less historically |

The pattern matches the price rule: the implementing role gained where pauses would have rewritten its context, and the read-only roles paid the higher write price without that benefit.

**It did not explain the earlier drop.** The one-hour cache was already on before the drop in limit use reported in [the weekly limit guide](/guides/claude-code-weekly-limit-measured/). That drop did not come from the cache lifetime. The weekly limit guide has the wider result.

## What to do

1. Measure the pauses per role first. Count how often each subagent role waits longer than five minutes between requests.
2. Leave the default for short read-only roles.
3. Set `experimental.cacheTtl` in the frontmatter of the roles that do pause, rather than one global setting.
4. If you use `subagentPromptCacheTtl`, remember that it outranks role frontmatter, so a global value overrides your per-role choices. The environment variables rank higher still.
5. Compare the result on your own work before keeping a change.

The [Agent Policy Kit](/tools/agent-policy-kit/) page describes the tool and its subagent presets. This guide did not test those presets.

## Limits of the measurement

- The counterfactual is modeled. It was not run.
- The result covers one developer.
- How a subscription counts tokens is not published, so modeled units are an approximation.
- The one-night and week-long figures differ, so treat the night as a direction, not a size.
- The role effects come from one night and may change with other work.
