AI News DailyTipsNEW한국어
← AI tool tips
Claude Code✓ Confirmed in official docsAdded Oct 13

How to give Claude Code subagents a 1-hour prompt cache

In Claude Code, subagents, workflows and background work sit in a different prompt cache TTL bucket from the main conversation. Unless you set it, that bucket gets five minutes, even on a subscription. If a long-running subagent goes more than five minutes between model calls, its cache expires and the next call reprocesses the prompt from scratch.

Add this to ~/.claude/settings.json:

{
  "subagentPromptCacheTtl": "1h"
}

It accepts only 5m or 1h; any other value is ignored. You can also set the environment variable CLAUDE_CODE_SUBAGENT_PROMPT_CACHE_TTL=1h, which takes precedence over the setting. The main conversation has its own control, promptCacheTtl (env CLAUDE_CODE_PROMPT_CACHE_TTL). All of these need v2.1.242 or later.

One-hour cache writes are billed at a higher rate, so a short subagent that finishes in a few minutes may just cost more. Use it for work with long gaps between calls. If FORCE_PROMPT_CACHING_5M=1 is set, it wins and you're back to five minutes.

Get notified when a new tip lands

Tip alerts only go out in the app. Install it and turn notifications on.

Get the app

All tips →