MEMORY.md loses its tail, CLAUDE.md does not
He asks why the agent forgets what is written in CLAUDE.md and AGENTS.md, and whether MEMORY.md is only read up to some number of lines. Checked on 30 November against his own measurements: the two files have different problems. CLAUDE.md reaches the model whole, while MEMORY.md loses its tail, and on this laptop it already has
1. ⭐⭐⭐ CLAUDE.md is not cut. On 25 July he tested it with marker lines placed through the file: it reached the model whole at 61, 88, 96, 120, 201 and 401 kilobytes. So forgetting instructions from CLAUDE.md is not truncation, it is how the model spreads attention over a long text.
2. ⭐⭐⭐ MEMORY.md is cut, and the limit is measured. Same test: the model gets the first 200 lines or the first 25,000 bytes, whichever comes first. Everything below disappears silently.
3. ⭐⭐⭐ It has already happened here. The memory file on this laptop is 30,746 bytes over 146 lines. The 25,000-byte limit ends at line 128, so the model does not see the last 19 entries. New entries are appended at the end, so the freshest ones are exactly the ones lost.
4. ⭐⭐ What follows. MEMORY.md should hold a one-line pointer per topic, with the rule itself in a separate file. Fresh and important lines go higher, not at the tail.
5. ⚠️ Limits. The measurement is from July, on one Claude Code version. The limit may differ in another version, and it says nothing about how memory works in Codex.
📖 Longread: https://github.com/tonydzi/clawrush/blob/main/longreads/20261126.md
🤖 Devlog: https://github.com/tonydzi/clawrush/blob/main/devlog/20261126.md
🔗 All our channels and contacts in one place: https://linktr.ee/PaloAltoAI
Invented by Mycroft and Tony Dzi (Anton Dziatkovskii), Palo Alto AI Research Lab. Proudly made in Silicon Valley.
原文:https://www.a8q9.cn/en/article/memory-md-loses-its-tail-claude-md-does-not-23c9b9.html