智能编码提示不断膨胀,因删除旧指令成本过高。
Why Does CLAUDE.md Keep Growing? Catastrophic Remembering in Agentic Coding
- 删除指令需评估所有历史上下文,代价指数级增长。
- 真实仓库中指令量平均增长226%,每提交增加4.9条新指令。
- 添加推理注释可减少99.3%冗余指令,提升实际执行效率。
智能编码的README文件如CLAUDE.md在真实仓库中无限制增长,仅在仓库退役或重写时停止。我们将其归因于记忆不完整:添加指令始终廉价,但一旦丢失其理由,删除它又不引发正确性下降的成本高达O(2^|D|),其中|D|为指令数量。我们称此现象为‘灾难性记忆’,与持续学习中的‘灾难性遗忘’相反。首先,在1,867个仓库的247,694条指令生命周期中分析发现,提示内容无边界增长,寿命内指令数增加226%,平均每提交新增4.9条;且指令越老,越难被删除(每提交对数风险降低-0.032)。其次,通过IFEval逆向构建可验证环境,发现编码隐式推理的注释能消除99.3%的冗余指令(从+211.3%降至+1.4%)。最后,在WildIFEval上应用相同方法,显示提示注释可使真实场景下的指令遵循能力提升达23.1%。若英语是新代码,为何我们仍无注释?
原文摘要 · Abstract (English)
Agentic coding READMEs like CLAUDE.md grow without bound in real repositories, stopping only when the repository retires or someone rewrites the file wholesale. We trace this to imperfect recall: appending an instruction is always cheap, but once an instruction's rationale is gone, deleting it without risking a correctness regression costs O(2^|D|) in a prompt of |D| instructions. We name the resulting divergence catastrophic remembering, the inverse of catastrophic forgetting around which continual learning is organized. First, we characterize this phenomenon across 247,694 instruction lifetimes in 1,867 repositories: agentic prompts grow without bound, more than tripling over their lifetime (+226%), gaining +4.9 net instructions every commit; further, the older an instruction gets, the less likely it is to be deleted (log-hazard -0.032/commit). Then, we show that prompt comments can halt the growth: inverting IFEval yields verifiable worlds whose optimal prompts are known, and there comments encoding latent reasoning remove 99.3% of excess instructions (+211.3% to +1.4%). Finally, applying the same inversion to WildIFEval, we show that prompt comments can improve real-world agentic instruction-following by up to 23.1%. If English is the new code, why don't we have comments yet?
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。