Claude Code repeated compaction drops 33%–57% of instructions
Developer Murooka tested repeated compaction on two real Japanese coding conversations using Claude Code 2.1.319–2.1.322 with Opus 5.5. The first compaction retained all selected user instructions, but by the third round the two conversations had lost 33% and 57% of them because earlier user-message lists were not carried into the next summary. Adding a prompt that requires every user message to be copied verbatim reduced instruction loss to 0% across the tested rounds, although very long histories still produced omissions and truncation.
The experiment identifies a recurring-compaction failure in Claude Code and shows why durable rules should be stored outside conversational summaries, while also testing a practical workaround for preserving task instructions.
在 Claude Code 里跑长任务,对话长到一定程度就会触发自动压缩(compaction),把之前的对话替换成一份摘要;平时也可以手动输入 /compact 触发压缩。很多项目周期长,一个会话里往往会经历多次压缩。
但不少关键决定只存在于对话里——比如「这个词别用」「这个话题不写」。它们不会直接写进产出的代码或文档里,一旦在压缩时被摘要漏掉,后面就哪里都找不回来了。
开发者 Murooka(dev.to 账号 murooka_az_dev)先在日文技术社区 Zenn 发布了自己的实测,随后于 2026-11-13 在 dev.to 发布了英文版文章「Claude Code Forgets My Instructions as Compactions Pile Up. One Added Prompt Stopped It: 0 Lost After 3 Compactions」。他用自己开发 VS Code 插件时的真实对话做了多轮压缩实验,测出了两个关键结论:
- 第 1 次压缩没有丢掉任何用户指令,但连续压缩到第 3 次时,两段对话分别丢掉了 33% 和 57% 的指令。 原因不是单次摘要写得差,而是摘要不会把「上一轮摘要里的历史用户消息列表」接力抄到下一轮。
- 只要在
/compact后面加一段提示词,要求把包括上一轮摘要在内的全部用户消息原样抄录下来,连续 3 轮压缩后的指令丢失率可以直接降到 0%。