技巧精选73°

Claude.md文件膨胀问题研究

精选理由

Kushal Chakrabarti研究AI代理文件膨胀问题,提出添加注释记录规则原因,可大幅减少提示长度。

研究跟踪了1,867个仓库中的247,694条指令生命周期,发现Claude.md等文件大小增长超过3倍。问题源于"灾难性记忆"现象,即添加规则后无人记得原因。测试显示,未注释的提示比理想提示长211%,而添加注释后仅长1.4%。

原文 · AlphaSignal

An agent repeats a mistake, so you add a rule.

Months later, nobody remembers why it exists.

“Why Does CLAUDE.md Keep Growing?” calls this “catastrophic remembering.”

The study tracks 247,694 instruction lifetimes across 1,867 repositories.

Files like CLAUDE.md more than triple over their lifetime. The cause is lost reasoning, not changing requirements.

Without the reason, deleting anything feels risky. The paper tests attaching a comment to each rule.

Those comments record:

> The failure behind the instruction > The hypothesis behind the fix > Evidence from previous attempts

The author built tests where the ideal prompt was known. Uncommented prompts ended 211% longer than that ideal.

Informative comments cut the excess to 1.4%. The agent followed constraints equally well both ways.

In an interview with AlphaSignal, author Kushal Chakrabarti (@kushalc) recommends a cache approach.

“The cache should have triggers and pointers, not summaries.”