← All stories
● Covered by 1 source · 1 reportLow impact1 neutral

Claude-thermos Tool Prevents Claude Code Prompt Cache Expiration

🔄 Updated 1h ago
New to BrevFeed? We gather this story from every outlet covering it into one summary — ranked by real-world impact, not just the latest headline — so you never miss what matters. What is BrevFeed? →

Key points

  • Claude Code's prompt cache expires after 5 minutes of inactivity.
  • Subagents running longer than 5 minutes cause the main agent's cache to expire.
  • Cache expiration leads to expensive re-encoding of conversation history.
  • claude-thermos keeps the cache warm, preventing re-encoding costs.

Addressing Claude Code Cache Expiration

claude-thermos is a new utility designed to mitigate an issue within Claude Code where the prompt cache can expire. This expiration occurs when the main agent waits on a subagent for more than five minutes, leading to the re-encoding of the entire conversation history at a higher cost rather than retrieving it from the cache at a lower rate.

Mechanism of Cache Expiration

Claude Code's prompt cache has a five-minute Time-To-Live (TTL). If no requests are made on the same cache prefix within this period, the cache expires. The primary cause for this gap is when a main agent is blocked by a subagent. Subagents have different system prompts and tool sets, meaning their requests do not refresh the main agent's cache. While the subagent is active, the main agent's cached history ages and expires, forcing a full re-encode upon the subagent's return.

Cost Implications

Re-encoding large conversation histories after cache expiration can be expensive. Measurements across 185 local sessions indicated that these rebuilds accounted for approximately 22% of the total API bill. This cost is incurred for re-encoding content that was recently cached.

How claude-thermos Works

claude-thermos functions as a local reverse proxy. It intercepts /v1/messages traffic, groups it into sessions and lineages, and identifies when a main lineage is at risk of expiring while a subagent is active. The tool then automatically warms the cache in the background to prevent expiration. Users run Claude Code through claude-thermos, and existing Claude arguments pass through directly. It requires Python 3.11+ and the Claude CLI.

✨ This summary was generated by AI from the outlets' reporting listed below. It is not independently verified and may contain errors — check the original sources. How BrevFeed works →

The daily brief

One email each morning: the day's tech stories, clustered across outlets and summarized. No account needed.

One email a day. Unsubscribe in one click, any time.

Today's brief

Spend a few minutes, get the whole day. Every topic's top stories in one hands-free rundown — listen, watch, or read the transcript.

~39 min · 35 stories · Jul 22

▶ Play today's brief Listen on Spotify

New every morning, and the back catalogue is archived by date.

Reporting from

A new tool called claude-thermos addresses an issue in Claude Code where the prompt cache expires if a subagent runs for more than five minutes, leading to costly re-encoding of conversation history. This tool operates as a local reverse proxy to keep the main agent's cache warm, potentially reducing API costs by approximately 20% for users with long sessions involving multiple subagents.