The Auto-Memory System
Claude Rules Workflow
Chapter 8 · The Auto-Memory System
Chapter 1 drew a firm line between memory and rules files: rules are for conventions meant to apply identically, forever, to every course; memory is for the kind of thing that's specific to one conversation or learned gradually over time. This chapter takes that distinction seriously and looks at the memory system itself in the same detail the earlier chapters gave the rules files — including a real, honest case where the two systems overlap more than they probably should.
Where It Lives, and Why It's Still File-Based
Memory in this project is itself a persistent, file-based system, living in its own dedicated folder separate from this repository's own rules/ tree. That's worth noticing: memory isn't some opaque, unreadable internal state — it's plain files too, just organized around a different question than a rules file asks. A rules file asks "what should always be true?" A memory file asks "what have I learned about this specific user, this specific project, or where to find something, that's worth carrying into a future conversation?"
The Four Memory Types
The Two-Step Save Process
Saving a memory is never a single write. First, the memory itself gets its own file, with a small frontmatter block naming it, describing it, and tagging its type:
Second, a single-line pointer gets added to MEMORY.md — the always-loaded index every future session actually reads. A memory file that exists but was never added to that index is exactly as invisible as a rules file that exists but was never added to CLAUDE.md's own @rules/ list from Chapter 1 — the same "one step, easy to forget" failure shape, one level down.
What Doesn't Belong in Memory At All
Code patterns, architecture, and file paths are excluded on purpose — they can be derived by reading the current project state directly, and a memory claiming to know them risks going stale the moment the code actually changes. Debugging solutions are excluded too, for the same reason: the real fix lives in the code itself and the commit message, not in a separate remembered description of it that could drift out of date.
<style> — which is, word for word, the same rule Chapter 3 already covered as P1 in permanent_rules.md. Rather than quietly ignore this, it's worth naming directly: this is exactly the kind of quiet duplication a well-maintained system should eventually retire — once a piece of feedback graduates into a real, permanent rule, the standalone memory describing the same thing has done its job and can be superseded, not left sitting alongside the rule it duplicates indefinitely.
Before Recommending From Memory
A memory that names a specific file, function, or flag is a claim that it existed when the memory was written — not a guarantee it still does. Before acting on it, the same discipline every earlier chapter has already applied to rules files applies here too: check the file still exists, grep for the function, verify the flag before recommending it. "The memory says X exists" and "X exists now" are two different claims, and only the second one is safe to act on.
| Question | Rules File | Memory |
|---|---|---|
| Applies to | Every course, every session, identically | This specific user, project, or fact |
| Changes how | Deliberately, by editing the rule itself | Gradually, as new things are learned |
| Loaded via | @rules/ lines in CLAUDE.md (Chapter 1) | MEMORY.md's own index |
| Trust it because | It's the current, deliberately-maintained standard | It was true when saved — verify it's still true |
Coding Challenges
A user says "I got burned last quarter when a mocked test passed but the real production migration failed — never mock the database in integration tests again." Which of the four memory types does this belong to, and why?
📄 View solutionExplain, using this chapter's own finding about the duplicated "HTML Course Header Comment Rule" memory, what the ideal fix would actually be — not just noticing the duplication, but what should happen to the memory file itself.
📄 View solutionA memory file references a function, formatPrice(), that was recommended as a reusable helper three months ago. Before recommending it again today, what specifically should happen first, and why?
📄 View solutionChapter 8 Quick Reference
- Four memory types: user (who they are), feedback (corrections AND confirmations), project (current context), reference (external pointers)
- Two-step save: a memory file with frontmatter, PLUS a one-line pointer added to MEMORY.md's own index
- A memory file never added to MEMORY.md is invisible — the same failure shape as a rules file never added to @rules/ (Chapter 1)
- Excluded from memory: code patterns, architecture, git history, debugging solutions — all better derived fresh from the current code
- A real, honest finding: this project's own memory currently duplicates P1's banner rule — worth retiring once a feedback memory graduates into a real rule
- Before recommending from memory: verify the named file/function/flag still exists — "it was true when saved" isn't "it's true now"
- Plans and Tasks are separate, session-scoped tools — not memory, and not meant to be recalled later
- Next chapter: what actually happens the moment a brand-new session opens in this repository