ALL INTELLIGENCE
宝玉 (@dotey)T2·Tools

Claude Code Adds Idle Compaction to Auto-Run /compact Before Cache Expiry

Original title: Claude Code 添加了空闲压缩功能,也就是缓存即将失效的时候主动帮你运行一下 /compact,这样过了一小时再用就不用担心第一次请求会因为缓存失效 token 费用飙升,很实用的功能👍
42AI Score

Anthropic introduced 'idle compaction' in Claude Code, automatically triggering the /compact command just before prompt cache expiration (~1 hour). This summarizes long sessions so returning users only process the summary instead of full context, significantly reducing token costs from cache misses. The feature can be disabled via settings.

Full Report

Claude Code 添加了空闲压缩功能,也就是缓存即将失效的时候主动帮你运行一下 /compact,这样过了一小时再用就不用担心第一次请求会因为缓存失效 token 费用飙升,很实用的功能👍

如果想关闭,需要在 ~/.claude/settings.json 中设置 "idleCompaction": false

↳ 引用 @lydiahallie (Lydia Hallie ✨): 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.