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

User
Who the user is — their role, goals, knowledge — so future work can be tailored to them specifically.
e.g. a data scientist investigating logging, vs. a Go veteran new to React
Feedback
Guidance the user has given about approach — both corrections AND confirmations of something unusual that worked.
e.g. "don't mock the database in these tests" — with the reason why
Project
Who's doing what, why, or by when — context that isn't otherwise derivable from the code.
e.g. a merge freeze starting on a specific date, and why
Reference
Pointers to where information lives in an external system.
e.g. "bugs are tracked in Linear project INGEST"

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:

--- name: short-kebab-case-slug description: one-line summary, specific enough to judge relevance later metadata: type: user | feedback | project | reference --- (the actual memory content goes here)

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.

A real, honest overlap between memory and a rules file
This project's own memory index currently includes a feedback memory titled "HTML Course Header Comment Rule," stating that every course HTML file needs a banner comment before <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.

QuestionRules FileMemory
Applies toEvery course, every session, identicallyThis specific user, project, or fact
Changes howDeliberately, by editing the rule itselfGradually, as new things are learned
Loaded via@rules/ lines in CLAUDE.md (Chapter 1)MEMORY.md's own index
Trust it becauseIt's the current, deliberately-maintained standardIt was true when saved — verify it's still true
Not every persistence mechanism is memory
Plans and Tasks are separate, session-scoped tools — a Plan is for reaching alignment on an approach before a big implementation task, and Tasks track in-progress work within the current conversation. Neither is meant to be recalled in a future conversation the way memory is; using memory for something that's really just "what am I doing right now" would clutter a system meant to hold durable, cross-session facts.

Coding Challenges

Challenge 1

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 solution
Challenge 2

Explain, 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 solution
Challenge 3

A 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 solution

Chapter 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