Claude Code 的 60% 上下文压缩规则
Claude Code 重度用户经常遇到上下文溢出导致模型变笨的问题,这个 60% 规则和手动压缩技巧能帮你精准控制保留内容,避免自动压缩丢失关键信息,建议试试。
开发者 Santiago 分享了一个 Claude Code 的使用技巧:当上下文利用率超过 60% 时,模型性能会下降,且自动压缩可能丢失重要信息。
他建议通过 /statusline 命令实时监控上下文百分比,并在超过阈值时手动运行 /compact 命令,附带提示词指定保留内容(如项目描述和变更指令)。这样能更精准地控制上下文压缩,避免关键信息丢失。
The 60% rule to compact your context:
Don't let your sessions go above 60% in context utilization. After that, your model will start feeling drunk and you'll risk Claude Code to trigger auto-compact for you.
Auto-compact is not good if you want control on what context stays and what goes.
Instead:
• Run /statusline to permanently display context % • When > 60%, run /compact with instructions on what to keep • For even more control, dump session context to a file and edit it
Many people don't know this:
You can run /compact with a prompt explaining what you want to keep. For example:
"/compact Keep the project description and change instructions"
This will anchor Claude Code's summary around those topics and will compress everything else more aggressively.
This report is categorized under AITOP's "How-to" desk, focusing on US frontier AI labs and Silicon Valley technology leaders. Within our cross-regional analytical framework, it directly maps to AI developer toolchains, coding agents, and engineering workflows. Key entities and technical topics under continuous tracking include Claude Code, context management, efficiency, coding assistants.
Source attribution: curated from Ate-a-Pi (@svpino).