◉CLAUDE LABJP
●CC 2.1.331 — 2.1.331 adds an API connectivity check to claude doctor and fixes MCP tool calls hanging for up to 30 minutes●SONNET 4.5 — Sonnet 4.5 retires from the Claude API on 11/30, 6 days left. Move to claude-sonnet-5-5●OFFICE — Users report the Microsoft 365 add-in disappearing seconds after install on macOS●NEW — New: Count how many input tokens one more tool costs with count_tokens●GEMINI 2.5 — Using Gemini 2.5 alongside Claude? From 12/1 requests reroute to newer models, billed at their rates. 7 days left●WORKBENCH — Trying the API in Workbench for the first time? Check the billing pages before you start●CC 2.1.331 — 2.1.331 adds an API connectivity check to claude doctor and fixes MCP tool calls hanging for up to 30 minutes●SONNET 4.5 — Sonnet 4.5 retires from the Claude API on 11/30, 6 days left. Move to claude-sonnet-5-5●OFFICE — Users report the Microsoft 365 add-in disappearing seconds after install on macOS●NEW — New: Count how many input tokens one more tool costs with count_tokens●GEMINI 2.5 — Using Gemini 2.5 alongside Claude? From 12/1 requests reroute to newer models, billed at their rates. 7 days left●WORKBENCH — Trying the API in Workbench for the first time? Check the billing pages before you start
Articles/Claude Code
⟐ Claude Code/2026-08-26Advanced

I decide the prompt cache TTL by where I come back to, not how long I was away

Claude Code v2.1.242 added promptCacheTtl and subagentPromptCacheTtl. Whether the one-hour cache pays off depends on returning to the same directory and the same git state, not on how long the break was. Here is the order I check things in.

claude-code134prompt-caching15promptCacheTtlcost-optimization31statusline

✦ Premium Article

Mornings in the iOS wallpaper app repo, afternoons on the web side, back into Xcode by evening. Running several products as an indie developer means moving between working directories many times a day. Every switch, Claude Code seemed to be re-reading the conversation from the top, and the waiting added up.

Claude Code v2.1.242 introduced two settings: promptCacheTtl and subagentPromptCacheTtl. They let you stretch the prompt cache lifetime from five minutes to one hour. My first reaction was that this would suit someone who steps away as often as I do.

Then I read the specification before writing the setting, and the deciding factor turned out not to be the length of the break. Whether the cache is still there when you return depends less on how long you waited and more on where you return to. If the destination has changed, stretching the TTL buys you a cache that never gets read once.

Two knobs, two buckets

Claude Code does not let you place cache_control yourself. It decides both the position and the boundaries. What you get to set is the lifetime, for requests split into two fixed buckets.

BucketRequests it coversSetting key
Main conversationInteractive turns, non-interactive -p runs, Agent SDK turns, and the helpers that run inline with thempromptCacheTtl
Everything elseSubagents, workflows, in-process teammates, forks, compaction, session titlessubagentPromptCacheTtl

Both accept exactly two values, 5m and 1h. Anything else is ignored. Write 30m and it is not rejected with an error; it quietly falls back to the default. That quiet fallback matters later, so keep it in mind.

{
  "promptCacheTtl": "1h",
  "subagentPromptCacheTtl": "5m"
}

The defaults, meanwhile, depend on how you are billed. This table, and every version number and setting name in this piece, is what I checked against the official documentation as of November 2026.

BucketClaude subscription, within plan usageUsage credits, API key, or cloud provider
Main conversationOne hourFive minutes
Everything elseFive minutes, except a small set of server-controlled helper requests that get one hourFive minutes

While you are on a subscription and inside your plan's included usage, the main conversation already runs on the one-hour cache. The moment you go over the limit and start drawing on usage credits, that usage is billed to you, so Claude Code drops back to the cheaper five-minute TTL. Sign in with an API key or go through a cloud provider and everything starts at five minutes.

So writing promptCacheTtl explicitly is worth doing in two situations: you are on an API key or a cloud provider, or you are on a subscription and want to keep the hour after passing your plan's limit. If you are comfortably inside your plan, setting "1h" changes nothing that was not already true.

Subagents start at five minutes no matter what you pay

This is where I tripped first. On a subscription, the main conversation is running on a one-hour cache. Call a subagent and that child lands in the five-minute bucket. Exactly when you fan work out in parallel, the side that would benefit most from a warm cache is the side that starts cold.

The reasoning makes sense once you read it. A subagent opens its own conversation with its own system prompt and tool set, separate from the parent's. The prefixes differ, so it cannot read the parent's cache at all. It warms one of its own across its turns instead.

A fork inverts this. A fork inherits the parent's system prompt, tools, and conversation history exactly, so its first request reads the parent's cache. Two ways of splitting work, and from the cache's point of view they are not the same thing. I wrote about their broader differences in branching cuts loose, delegation stays in the session, but the caching behaviour alone is enough to change the choice sometimes.

Does that mean you should set subagentPromptCacheTtl to "1h"? I do not. One-hour writes are billed at a higher rate than five-minute writes, and subagents are short-lived — most finish their job in a handful of turns. There is no reason to pay the expensive write for something that disappears before it can earn it back.

The one case that flips this is calling the same subagent definition repeatedly within an hour. Even then, you don't have to move the whole bucket. Since v2.1.248, a subagent's own definition file can set the lifetime for that one agent:

---
name: repo-auditor
description: Audits a large repository and reports what it finds
experimental:
  cacheTtl: 1h
---

cacheTtl has to live inside the experimental map; at the top level of the frontmatter it is simply not read. It accepts 5m or 1h, and while a subscription is drawing on usage credits, a 1h here is ignored too.

So my line is this: the one agent I call over and over gets the hour, everything else stays at five minutes. Setting subagentPromptCacheTtl to 1h would drag compaction and the short-lived helpers onto the expensive write as well. Which agent earns the exception is something I decide with the break-even formula further down.

✦

Thank you for reading this far.

Continue Reading

What follows includes implementation code, benchmarks, and practical content we hope you'll find useful. This site runs without ads — server and development costs are supported entirely by members like you. If it's been helpful, we'd be truly grateful for your support.

WHAT YOU'LL LEARN
✦You'll be able to tell, before flipping the switch, whether your own working rhythm can actually benefit from a one-hour cache
✦You'll understand why subagents and forks are treated differently by the cache, and pick the right one when you split work
✦You'll avoid the quiet days where a setting is in place but doing nothing, by checking precedence and unsupported environments up front
Secure payment via Stripe · Cancel anytime
✦

Unlock This Article

Get full access to the rest of this article. Buy once, read anytime. This site is ad-free — your support goes directly toward keeping it running.

or
Unlock all articles with Membership →
Share

Thank You for Reading

Claude Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.

  • ✦Copy-paste ready implementation code
  • ✦New advanced guides published daily
  • ✦$5/mo or $10 for lifetime access
View Membership →

Related Articles

⟐ Claude Code2026-11-10
How Far Behind Is Your Claude Code on the stable Channel? I Counted Published Versions Instead of Subtracting Numbers
Subtracting version numbers overstates the gap between stable and latest. Here is a short Python script that counts published versions from the npm registry, plus the channel settings worth knowing.
⟐ Claude Code2026-11-03
When Claude Code dies with a Bus error on a shared home directory, check this before you turn off auto-update
Why Claude Code crashes with a Bus error on an NFS-style shared home, how the official cleanup rule and update switches work, and two small scripts to check your setup.
⟐ Claude Code2026-08-28
A small script that catches invisible characters in plugin names before you install
Control characters and zero-width characters hiding in plugin or skill names are invisible in a terminal listing. I built six deliberately confusing names, compared what ls actually shows, and wrote a short check you can run before installing anything — plus an honest note on what that check misses.