Claude Code memory

Persistent memory for Claude Code, beyond CLAUDE.md

Claude Code starts every session with a fresh context window, so nothing carries across sessions unless something puts it there. It has two ways of doing that: CLAUDE.md files that you write, and auto memory, where it writes notes for itself. Both are useful, and both stop short of what a long project needs. This page covers what each one does, where it runs out, and how to give Claude Code memory it can search, across every project and machine you use, with OmniMem.

What Claude Code remembers on its own

CLAUDE.md is a markdown file Claude Code reads at the start of every session. There's one for you in ~/.claude/CLAUDE.md that applies everywhere, and one per project in the repository, usually checked into git. CLAUDE.md files in subfolders, and path-scoped rules, load on demand when Claude works in those parts of the project. It's the right place for rules: how to run the tests, which branch to work on, how you like commits written. You write it and you keep it up to date.

Auto memory is Claude Code writing its own notes. It saves markdown files in ~/.claude/projects/<project>/memory/, with a MEMORY.md index that gets loaded into the next session. Only the first 200 lines or 25KB of that index are loaded, whichever comes first, so it works best as a short list of pointers. The other notes in that folder aren't loaded at the start: Claude reads them with its ordinary file tools when it decides they're relevant. Anthropic's own memory documentation covers both.

Both are plain markdown files, and that's their strength: you can open them and see exactly what Claude knows. Your project's CLAUDE.md travels with the repository through git, but auto memory and your own ~/.claude/CLAUDE.md stay on the machine they were written on (Anthropic's docs say of auto memory that "files are not shared across machines").

Where that runs out

What OmniMem adds

OmniMem is an open-source MCP memory server that runs on your own hardware, as a desktop app or one binary on a server. Claude Code talks to it over MCP, so the memory sits outside any one session, project or machine.

Set it up in two minutes

  1. Install OmniMem. Download the app for macOS, Windows or Linux, or run the server in Docker. It serves MCP at http://127.0.0.1:8765/mcp.

  2. Connect Claude Code. From the app's tray or menu bar icon, pick Add to Claude Code. Or run it yourself:

    claude mcp add --transport http --scope user omnimem http://127.0.0.1:8765/mcp
  3. Install the hooks, so every session starts briefed and known dead ends are stopped before they run. This adds them to ~/.claude/settings.json and keeps a backup of the old file:

    omnimem install-hooks

    With the Mac app, the omnimem binary lives inside the app bundle rather than on your PATH, so run /Applications/OmniMem.app/Contents/MacOS/omnimem install-hooks instead. The hooks documentation covers adding the entries by hand.

The Claude Code guide covers access tokens, project-level config and troubleshooting, and the other setup guides cover servers, a Raspberry Pi and the cloud.

Keep CLAUDE.md as well

OmniMem doesn't replace CLAUDE.md, and you shouldn't delete yours. A short file of standing rules, loaded every time, is exactly what it's good at. Let CLAUDE.md say how the project works, and let OmniMem hold what you've learnt while working on it: the decisions, the bugs, the dead ends and the context that's too big to load whole.

OmniMem is MIT licensed and free. The source is on Forgejo, with a mirror on GitHub.

By Ric HarveyUpdated Setup guides