技巧精选

Claude Code 的 60% 上下文压缩规则

精选理由

Claude Code 重度用户经常遇到上下文溢出导致模型变笨的问题,这个 60% 规则和手动压缩技巧能帮你精准控制保留内容,避免自动压缩丢失关键信息,建议试试。

开发者 Santiago 分享了一个 Claude Code 的使用技巧:当上下文利用率超过 60% 时,模型性能会下降,且自动压缩可能丢失重要信息。

正文

他建议通过 /statusline 命令实时监控上下文百分比,并在超过阈值时手动运行 /compact 命令,附带提示词指定保留内容(如项目描述和变更指令)。这样能更精准地控制上下文压缩,避免关键信息丢失。

原文 · Ate-a-Pi

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.

产业坐标与信源核验

本条情报归属 AITOP「技巧」核心栏目,重点聚焦北美前沿实验室与硅谷科技巨头。在跨区域产业观察坐标中,该动态直接关联「AI 开发者工具链、Coding Agent 与工程化实践」研究主线,反映出当前技术演进与商业落地的最新风向。涉及核心实体与技术议题包括:Claude Code、上下文管理、压缩技巧、效率提升,读者可通过下方标签进入对应专题页查阅历史脉络与关联对比。

信源核验说明:本文原始线索采编自「Ate-a-Pi」(@svpino),经 AITOP 多维评分管线结构化提炼。

发现摘要或翻译有误? 告诉我们