MEMORY.md: how it works
Agents start each session without memory of the last one. MEMORY.md is a Markdown file where decisions (as numbered architecture decision records), known gotchas and important paths are written down, so the next session starts from them instead of rediscovering them. It is a convention: tell the agent in CLAUDE.md or AGENTS.md to read it at the start and add lessons at the end.
Where the file goes
./MEMORY.mdRepo rootRead at session start; agents append lessons and decisions, when your rules file says so.
What goes in it
### ADR-001: Process files in the browser - Decision: All parsing runs client-side; no upload endpoints. - Reason: Users paste secrets and private code. - Consequence: Large files are limited by browser memory.
## Gotchas - Monaco must be imported with next/dynamic and ssr: false. - `npm run build` uses webpack, not Turbopack; do not change it.
Tips
- Number decisions (ADR-001, ADR-002) and never rewrite old ones; add a new one that supersedes it.
- Write down gotchas the moment an agent hits them.
- Keep entries short and factual so the file stays cheap to load.
- Remove entries that are no longer true.
Not sure MEMORY.md is the file you need? Each AI coding tool reads its own file from its own place.
Which file do I need?Frequently asked questions
How does MEMORY.md help AI agents?
It gives each new session the decisions and lessons from earlier ones: what was decided and why, and which traps to avoid. Without it, agents repeat past mistakes or reopen settled questions.
Do agents read MEMORY.md automatically?
No. Add 'Read MEMORY.md at the start of each session and record new lessons in it' to your CLAUDE.md or AGENTS.md.