Claude Code 推出空闲压缩功能,缓存失效前自动运行 /compact
Claude Code 新增空闲压缩,缓存过期前自动帮你 compact,隔一小时回来继续用能省不少 token 费,不想用可在 settings.json 里关掉。
Anthropic 的 Claude Code 新增了 idle compaction(空闲压缩)功能,会在提示词缓存约 1 小时即将失效前,自动对长时间空闲的会话运行 /compact。这样用户之后回来继续会话时,只需重新处理压缩后的摘要,而不用重新处理整个对话历史,从而节省 token 用量和费用。如果想关闭该功能,可以在 ~/.claude/settings.json 中把 idleCompaction 设为 false。
Claude Code 添加了空闲压缩功能,也就是缓存即将失效的时候主动帮你运行一下 /compact,这样过了一小时再用就不用担心第一次请求会因为缓存失效 token 费用飙升,很实用的功能👍 如果想关闭,需要在 ~/.claude/settings.json 中设置 "idleCompaction": false Lydia Hallie ✨ @lydiahallie We recently added idle compaction to Claude Code! It now compacts long idle sessions right before the prompt cache expires (~1h). If you come back to it later, it only has to reprocess the summary instead of the entire conversation, which saves you some usage. 🔗 View Quoted Tweet 💬 11 🔄 0 ❤️ 15 👀 3050 📊 10 ⚡