RepoMemory.

How to give Claude Code memory between sessions

Updated

Claude Code doesn't remember your last session: each one starts with a fresh context window. Three things carry knowledge over. CLAUDE.md holds the instructions you write. Auto memory holds notes Claude writes for itself on your machine. A shared ledger over MCP, such as RepoMemory, holds the decisions, lessons and tasks that every agent and teammate on the project should see. Use the first two for how to work in the repository, and the third for what has happened in it.

What Claude Code carries over by itself

Anthropic's memory docs (checked on 30 October 2026) describe two mechanisms, both loaded at the start of every session:

CLAUDE.md Auto memory
Who writes it You Claude
Where it lives ./CLAUDE.md in the repo, ~/.claude/CLAUDE.md for you, or an organisation-wide file ~/.claude/projects/<project>/memory/
Shared with The team, through git Nobody: it is machine-local
Loaded Every session, in full The first 200 lines or 25 KB of MEMORY.md
Good for Build commands, conventions, layout, "always do X" Your preferences and the corrections you gave Claude

Both are context, not enforced rules. The docs suggest keeping each CLAUDE.md under about 200 lines, because longer files cost context and are followed less reliably.

Where they stop

Add a shared ledger over MCP

RepoMemory is an MCP server that keeps a project's decisions, lessons, guardrails, notes and tasks. Claude Code calls brief at the start of a session, recall before a change, and record_entry when something is worth keeping. Recall searches, so only the entries about the change at hand come back, and the ledger can grow without filling the context.

  1. Create a free key on the API keys page and add the server:

    claude mcp add --transport http repomemory https://api.repomemory.dev/mcp \
      --header "X-API-Key: $REPOMEMORY_KEY"
    
  2. Add this to the repository's CLAUDE.md or AGENTS.md, so every session knows the project's ledger and when to use it:

    ## Project memory (RepoMemory, project "acme/shop")
    - At the start of a session, call `brief` for the project: it returns every guardrail, the open tasks and the latest decisions. Never break a guardrail.
    - Before planning a change, removing code that looks unneeded or retrying an approach, call `recall` with words about the change. Follow what it returns.
    - When a change is reverted, a fix took real digging, or you choose one approach over another, call `record_entry` (kind lesson or decision) saying what happened, why, and what to do instead, with your name in `agent`.
    
  3. Or do both at once in the repository with the command line tool (Node.js 22 or newer):

    export REPOMEMORY_KEY=sk_live_...
    npx @plexsicity/repomemory init
    

The next session starts with a call like this one, made for you by Claude:

curl -s https://api.repomemory.dev/v1/brief \
  -H "X-API-Key: $REPOMEMORY_KEY" -H "Content-Type: application/json" \
  -d '{"project":"acme/shop"}'

It returns every active guardrail in full, the open tasks and the newest decisions and lessons, so the session begins where the last one stopped.

What to keep where

Limits to know

Recall matches words, not meaning: "captcha checkout" finds a lesson titled "Captcha on checkout", while "why did orders drop" may not. Agents only record what they are told to, which is what the CLAUDE.md lines are for. RepoMemory is hosted only. The free plan allows 300 new entries a month; recall, claims and retires are free. See pricing and the docs for other clients.