Claude Code memory or a Markdown wiki: where each one stops
By ReviewRamble editors ·
Claude Code's memory is a set of notes the model reads, not a set of rules it must obey. CLAUDE.md holds your instructions, Auto Memory holds what Claude has learned about you, and neither can stop an action. When the job grows into many sources you want kept, cited and checked, a Markdown wiki is the better shape, and hooks that fill it automatically are an option to add last, with care.
This post draws the line between those layers. Every claim about Claude Code comes from Anthropic's documentation on memory, hooks and the Agent SDK; the wiki pattern comes from Andrej Karpathy's LLM Wiki gist, and the automation from the claude-memory-compiler README. We have not run these setups ourselves.
CLAUDE.md: the instructions you write
CLAUDE.md is a Markdown file you write and Claude Code reads at the start of every session. It can live in a project, in your home folder or at organisation level, and it can pull in other files with @path imports, up to four hops deep. Anthropic suggests keeping each file under 200 lines, because longer files take more context and are followed less reliably, and it offers .claude/rules/ for instructions that matter only for some file types.

Think of it as the briefing you would give a new colleague: build commands, house style, the folder nobody should touch. It is not a place for a growing pile of facts.
Auto Memory: the notes Claude keeps for itself
Auto Memory is on by default in local sessions. Claude writes its own notes as it works, from your corrections and preferences, into ~/.claude/projects/<project>/memory/. A MEMORY.md file indexes them, one line per memory, and each memory sits in its own topic file. Only the first 200 lines or 25KB of MEMORY.md, whichever comes first, load at the start of a session; topic files are read when Claude decides it needs them.
Two details matter. The memory is machine-local, so it does not follow you to another computer or a cloud session. And it is plain Markdown, so you can open /memory, read what Claude has decided about you, and delete what is wrong. You can switch it off per project with autoMemoryEnabled set to false.
Context is not enforcement
Anthropic's memory page says it directly: Claude treats both CLAUDE.md and Auto Memory as context, not enforced configuration. A line saying "never delete the migrations folder" is advice the model usually follows. If two instructions contradict each other, the docs warn that Claude may pick one arbitrarily.
The thing that actually blocks an action is a PreToolUse hook. It runs before a tool call, and if it exits with code 2, or returns a permissionDecision of deny, Claude Code stops the call. So the split is simple: preferences go in memory, and anything that must never happen goes in a hook or the permission settings.
Where a wiki takes over
Memory answers "how do I like to work". It is poor at "what do these forty papers, meeting notes and vendor pages say, and where did each claim come from". That is the job of Karpathy's LLM Wiki pattern, published in April 2026 as an idea file to paste into your own agent.
It has three layers. A raw/ folder holds your sources, which the model reads but never changes, so they stay the source of truth. A wiki/ folder holds Markdown pages the model writes and maintains: summaries, pages for people and concepts, comparisons. A schema file, CLAUDE.md for Claude Code, sets the structure and the steps for adding a source, answering a question and tidying up. Two files keep it navigable: index.md lists every page with a link and a one-line summary, and log.md is an append-only record of each ingest, query and check.
The tidying step is what turns notes into knowledge you can trust. Karpathy calls it linting: a periodic pass that looks for contradictions between pages, claims a newer source has replaced, pages nothing links to, concepts that deserve their own page and missing cross-references. One new source, he notes, might touch 10 to 15 pages.
Two of our reviews show the pattern in practice. claude-obsidian (3.8) builds a cited Obsidian wiki on Karpathy's idea, with planned, journalled writes that make it trustworthy and slow to adopt. OpenWiki (4.2) applies the same thinking to a codebase and tracks which of its own sentences have gone stale when code changes. For a one-off map of an unfamiliar repo, Understand Anything (3.5) builds a knowledge graph instead, at a high token cost on the first run.

Hooks that fill the wiki for you
The next step is to stop curating by hand. claude-memory-compiler adapts Karpathy's pattern so the raw material is your own Claude Code sessions. A SessionEnd hook captures the transcript when a session closes, a PreCompact hook captures it again before automatic compaction summarises the middle away, and a background script asks the model to pull out decisions, lessons and gotchas into a daily log. A compile step turns those logs into linked concept articles, and a SessionStart hook puts the index into your next session. A lint script runs seven checks.
It is a clever loop, and it carries real risks that the README does not dwell on.
- Hooks run shell code. A hook is a command Claude Code runs with its own environment, which means your user account's access. Copying someone's .claude/settings.json into your project, as the setup asks, means running their scripts every time a session starts or ends. Read them first.
- Transcripts hold secrets. A session transcript contains whatever passed through it: pasted keys, the contents of a .env file Claude read, customer data from a log. The compiler sends that text to the model and writes the extracts to Markdown files, and in our reading of its README and AGENTS.md there is no redaction step.
- The compile step writes without asking. Its AGENTS.md shows compile.py running with permission_mode set to acceptEdits, which auto-approves every file operation inside its folder.
- The billing claim conflicts with Anthropic's docs. The README says Anthropic "has clarified that personal use of the Claude Agent SDK is covered under your existing Claude subscription", and AGENTS.md says no API key is needed because it uses Claude Code's stored credentials. It cites no source. Anthropic's Agent SDK overview and quickstart tell you to set an API key, and say that unless previously approved, third-party developers may not offer claude.ai login or rate limits in agents built on the SDK. Treat the subscription claim as unconfirmed and budget for API usage; the project's own table puts compiling one daily log at $0.45 to $0.65.
The repository is also young and quiet: created on 6 April 2026, two commits, about 1,300 stars and no licence file, which means you have no stated right to reuse the code.
There is no magic size for RAG
Every source here names a threshold, and they disagree. Karpathy says reading the index works well at about 100 sources and hundreds of pages, then suggests a proper search tool. The compiler's notes say index reading beats vector search at 50 to 500 articles and that hybrid search becomes necessary at about 2,000 articles or 2 million tokens. Neither offers a measurement.
The useful number is your own. Keep a list of twenty questions you know the answers to, ask them every few weeks, and note which pages the model opened and whether it cited the right source. When answers start missing pages that exist, or the index no longer fits comfortably in a session, add search. Hosted memory such as Supermemory (4.0) or a local graph like the Memory reference server (3.5) are different tools for that point; MemoryBase (3.2) solves a separate problem, carrying chat context between ChatGPT and Claude.
Which layer does which job
| Layer | Who writes it | What it is for | Can it stop an action |
|---|---|---|---|
| CLAUDE.md | You | Working instructions and house rules | No, it is context |
| Auto Memory | Claude | Learned preferences and corrections | No, it is context |
| PreToolUse hook | You | Rules that must hold | Yes |
| LLM Wiki | Claude, from your sources | Curated knowledge with provenance | No |
| Transcript capture hooks | Scripts, automatically | Filling the wiki from your sessions | No, and they run code |
A staged rollout
- Start with CLAUDE.md. Write the instructions you repeat most, keep the file under 200 lines, and move file-specific rules into .claude/rules/.
- Let Auto Memory run, and read it. Open /memory every week or two and delete anything wrong or stale.
- Move hard rules into hooks. Anything you would be upset to see broken becomes a PreToolUse hook or a permission deny, not a sentence.
- Start a wiki by hand. Create raw/, wiki/, index.md and log.md, put the rules in CLAUDE.md, ingest one source at a time and run a lint pass on a schedule.
- Measure before adding search. Keep your test questions and add retrieval only when they start failing.
- Automate capture last, if at all. Read every hook script, keep the wiki out of shared folders, check what lands in the logs, and use an API key with a spending limit.
The catch: a wiki maintained by a model is only as good as its lint passes and your reading of them. Lint can flag a contradiction but cannot tell which side is right, and a confident summary of a misread source looks exactly like a correct one. Keeping raw/ unchanged is what lets you check, and that only helps if someone does.
Our take: treat CLAUDE.md as the note on the fridge, Auto Memory as the habits a housemate picks up, a hook as the lock on the door, and the wiki as the filing cabinet with receipts. Most people need the first three this week and the cabinet only once the receipts pile up. The robot that files everything for you can wait until you have read its code.