Claude’s memory system lets it persist information across sessions. Take it further by having Claude automatically curate what it learns.
The Auto-Memory Pattern
Add this to your CLAUDE.md:
## Self-Improvement Rules
After completing any task:
1. If you made a mistake and had to correct it, save a memory
about what went wrong and the right approach
2. If you discovered a project pattern not documented here,
save it as a memory
3. If the user corrected you, save their preference as a memory
Keep memories concise. One pattern per memory file.
Memory Health Assessment
Periodically ask Claude to audit its own memories:
Review all files in ~/.claude/projects/*/memory/.
For each memory:
1. Is it still accurate given the current codebase?
2. Is it redundant with CLAUDE.md or other memories?
3. Should it be promoted to CLAUDE.md if it's universally true?
Delete stale memories. Merge redundant ones.
Pattern Promotion
When a memory proves useful across 3+ sessions, promote it to CLAUDE.md:
Check your memories. Any pattern you've referenced 3+ times
should be a rule in CLAUDE.md, not just a memory. Move it.
What to Auto-Save
- Test runner quirks (“always use —forceExit with Jest in this project”)
- Build gotchas (“CSS modules need .module.css extension”)
- Team preferences (“we prefer explicit returns over implicit”)
- API patterns (“all endpoints return {data, error, meta}“)
What NOT to Auto-Save
- Ephemeral task context (what you’re working on right now)
- Information already in the code or git history
- Debugging specifics (the fix is in the commit)