Aletheia

Claude Code memory options: CLAUDE.md, auto memory, MCP servers and Aletheia

Claude Code starts every session with a fresh context window, and it carries knowledge between sessions with two built-in mechanisms: CLAUDE.md files that you write and auto memory that Claude writes. Aletheia (aletheia-mem) is a local memory and rules hub that sits beside them. It adds a memory store that other hosts can read too, and it writes a managed block of rules into your CLAUDE.md without touching the rest of the file.

Every statement about Claude Code on this page comes from Anthropic's documentation and was fetched on 2026-10-29. The URL is next to each statement.

Persistent memory in Claude Code, in short

CLAUDE.md files

A CLAUDE.md file is a Markdown file of persistent instructions. Claude reads it at the start of every session. Source: https://code.claude.com/docs/en/memory, 2026-10-29.

The same page lists these locations, from the broadest scope to the narrowest:

ScopeLocation
Managed policy/etc/claude-code/CLAUDE.md on Linux and WSL, with other paths on macOS and Windows
User~/.claude/CLAUDE.md
Project./CLAUDE.md or ./.claude/CLAUDE.md
Local./CLAUDE.local.md

What else the page says:

AGENTS.md

Claude Code can read AGENTS.md as project instructions from version 2.1.277. By default it does so only when there is no CLAUDE.md or CLAUDE.local.md in the working directory or above it. If both exist, Claude reads the CLAUDE.md files only, unless the CLAUDE.md imports AGENTS.md or you change the Project instructions setting in /config. Source: https://code.claude.com/docs/en/memory, 2026-10-29.

Auto memory

Auto memory is notes that Claude writes for itself. Source for this whole section: https://code.claude.com/docs/en/memory, 2026-10-29.

MCP servers

MCP is an open standard for connecting AI tools to other systems. The Claude Code docs say MCP servers give it access to tools, databases and APIs. Source: https://code.claude.com/docs/en/mcp, 2026-10-29.

An MCP memory server is one that stores and returns memories through these tools. Aletheia has one: 13 tools, listed in MCP tools. An MCP server gives Claude tools to call, such as a memory search. Loading context at the start of a session is the job of a hook.

Plugins and hooks

A plugin is a directory of skills, agents, hooks and MCP servers that Claude Code installs as one unit, usually from a marketplace. Source: https://code.claude.com/docs/en/plugins, 2026-10-29.

A hook is a command that Claude Code runs at a point in the session. A SessionStart hook can return hookSpecificOutput.additionalContext, and Claude Code inserts it as a system reminder at the start of the conversation. The other events include UserPromptSubmit, PostToolUse, Stop and SessionEnd. Source: https://code.claude.com/docs/en/hooks, 2026-10-29.

Hooks are how a memory tool loads context without waiting for Claude to ask, and how it captures what happened. Aletheia is not a Claude Code plugin. Its installer edits your settings files directly. See below.

Where Aletheia fits

MechanismWho writes itWhere it livesHow it reaches Claude
CLAUDE.mdYouFiles on diskLoaded at session start
Auto memoryClaude~/.claude/projects/<project>/memory/Index loaded at session start
Aletheia managed blockYou, in the hubInside ~/.claude/CLAUDE.md or a project CLAUDE.mdLoaded as part of that file
Aletheia memory storeHooks and you~/.aletheia/hub.dbSessionStart hook and MCP tools

Aletheia does not replace either built-in mechanism. It does not read or write the auto memory folder, and a search of src/ and bin/ for MEMORY.md finds nothing. It can read Claude Code session transcripts under ~/.claude/projects/ to back-fill memories, read-only, with aletheia import transcripts claude-code.

Install it for Claude Code with:

aletheia install claude-code          # dry run: lists every file, writes nothing
aletheia install claude-code --write

On a throwaway home directory, the dry run printed this. Paths are shortened to ~, and ... marks two lines left out.

Claude Code (claude-code) — full, mcp-verified
  write  mcp      ~/.claude.json  (mcpServers.aletheia)
  write  hooks    ~/.claude/settings.json  (SessionStart, UserPromptSubmit, PostToolUse, Stop, SessionEnd)
  write  rules    ~/.claude/CLAUDE.md  (1 rule)
  ...
Dry run: nothing was written. Add --write to apply.

What has been checked on a real Claude Code:

Nothing here shows that an answer was better with Aletheia than without it. Answer accuracy is not measured. See Benchmarks and Claude Code setup.

How the managed block coexists with your own text

Aletheia writes its rules between two HTML comment markers, <!-- aletheia:rules:begin --> and <!-- aletheia:rules:end -->. Everything outside the markers is yours and is not changed ([src/hub/rules-sync.mjs](https://github.com/mohamed-ashraf-elsaed/aletheia-mem/blob/main/src/hub/rules-sync.mjs)). Each write to an existing file keeps a timestamped backup of the old file.

A real run, with a temporary home directory and a ~/.claude/CLAUDE.md that held a heading and one sentence of the user's text. Paths are shortened to ~.

aletheia rules add "Run the test suite before committing."
aletheia rules add "Use two-space indents" --when "editing JavaScript"
aletheia rules sync --tools claude-code --global           # dry run
aletheia rules sync --tools claude-code --global --write
- claude-code: ~/.claude/CLAUDE.md — 2 rules, would change (add --write)
- claude-code: ~/.claude/CLAUDE.md — 2 rules, written (backup ~/.claude/CLAUDE.md.aletheia-2026-10-29T19-49-03-236Z.bak)

The file after the write:

# My notes

Always answer in short sentences.

<!-- aletheia:rules:begin -->
# Rules

Managed by aletheia-mem. Edit them in the Rules page; this block is rewritten on sync.

## Everywhere

- Run the test suite before committing.
- When editing JavaScript: use two-space indents
<!-- aletheia:rules:end -->

Then the user added a line below the block, a third rule was added and the sync ran again. The new rule appeared inside the block and the user's line stayed where it was.

Things to know:

Next steps