Robert Youssef(@rryssf)
People losing so much tokens and have no idea about this: Subagent caches expire in five minutes. In Claude Code, a subagent that sits idle longer than 5 minutes loses its prompt cache. The next call rewrites the whole context from scratch and burns several times more tokens than a cache hit would. Anthropic's guide covers a single setting that stretches that window to an hour: "subagentPromptCacheTtl": "1h" The trade-off is in the write price. Each write to the 1-hour cache costs more than a write to
6.6内容质量

TL;DR · AI 摘要
Robert Youssef on X: "People losing so much tokens and have no idea about this: Subagent caches expire in five minutes....
核心要点
- 主题聚焦:People losing so much tokens and have no idea ab
- 来源:Robert Youssef(@rryssf),建议结合原文判断细节。
- AI 分析暂不可用,本条为保底评分与摘要。
#AI#编程
打开原文Robert Youssef on X: "许多人因不了解这一机制而损失了大量token:Subagent缓存5分钟后过期。在Claude Code中,闲置时间超过5分钟的Subagent会丢失其提示缓存。下一次调用将从头开始重写整个上下文,消耗的token数量是缓存命中情况下的数倍…… / X
Robert Youssef
@rryssf
许多人因不了解这一机制而损失了大量token:Subagent缓存5分钟后过期。在Claude Code中,闲置时间超过5分钟的Subagent会丢失其提示缓存。下一次调用将从头开始重写整个上下文,消耗的token数量是缓存命中情况下的数倍。Anthropic的指南中提到了一个可将该时间窗口延长至1小时的配置项:"subagentPromptCacheTtl": "1h"。代价体现在写入成本上:写入1小时缓存的费用高于写入5分钟缓存。但好处是,当Subagent暂停时,你无需每次都支付完整重写费用。对于Subagent调用间隔较长的工作流,据称可节省高达总token消耗25%的费用。这些节省效果高度依赖于你的使用方式:如果Subagent执行速度快且很少闲置超过5分钟,你将为更贵的写入操作支付不必要的费用,账单反而会上升。切换配置前请先检查自己的使用情况。已存在一个对比脚本,可估算1小时TTL在你的实际会话中是节省开支还是增加成本。如果暂停时间保持在5分钟以内,请保留默认设置。
$
00:00
/$
9:33 AM · Oct 13, 2026
·
4,659
Views
24
11
46
55 /think