Adding memory to Claude Code
the MCP server, the hook, and the plugin marketplace
Claude Code writes every session to disk and starts the next one empty. The work is still there — and so is whatever you did that week in Cursor, Codex or any other agent you had open.
The two things people mean by memory here
Claude Code has one memory surface of its own: files you write. CLAUDE.md in the repository, ~/.claude/CLAUDE.md for everything you do on the machine, @path imports to pull in more, /memory to edit them and a #-prefixed message to append a line without leaving the session. It is read in full at the start of every session, which is what makes it reliable for standing instructions — the build command, the conventions, the directories to leave alone — and what makes it the wrong place for history. Every line costs context on every turn, and a rule that stopped being true arrives with the same authority as one that did not. When CLAUDE.md grows is that trade in detail.
The other thing people mean is the session you had last Tuesday: the error you already diagnosed, the command that finally worked, the reason you gave up on an approach. Nothing writes that into CLAUDE.md, and you would not want it there. It is already on disk in the transcript, and the gap is that nothing reads it back.
What Claude Code already has
Transcripts live under ${CLAUDE_CONFIG_DIR:-~/.claude}/projects/ as JSONL, one file per session, complete down to the tool calls. Nothing reads them back, including Claude Code's own next session. How Claude's store is read has the format, the quirks and the date it was last checked against a real store.
Adding recall
deja install claude-auto
That writes three things: the deja MCP server into ~/.claude.json, a /deja command at ~/.claude/commands/deja.md, and seven hooks in ~/.claude/settings.json: SessionStart, so a new session opens already carrying what the last ones settled; UserPromptSubmit, which searches for what the prompt is about; PreToolUse, which names a file's or command's prior decision before the action and puts memory into a spawned subagent's instructions; PostToolUse and PostToolUseFailure, which answer a failed command with what ran after the same error here before; PreCompact; and SessionEnd, so the session just closed is one the next session's MCP recall can answer with. The MCP server on its own is deja install claude-code.
This repository is also a Claude plugin marketplace, if you would rather install it the way Claude Code installs everything else:
claude plugin marketplace add vshulcz/deja-vu claude plugin install deja-vu@deja-vu
Running both is safe rather than doubled. Claude keys MCP servers by name, and every manifest we ship names this one deja, so the two collapse into a single server instead of listing every tool twice.
Either path needs the binary — a plugin ships files, not runtimes:
brew install deja-vu # or curl -fsSL https://raw.githubusercontent.com/vshulcz/deja-vu/main/install.sh | sh
What the hook actually changes
Without it, recall depends on the agent deciding to search. The hook moves the decision earlier: the session opens with what this project already settled, so the first exchange is not spent re-deriving it. Claude Code also hands a hook the transcript before it compacts, which is the one seam that makes the working context recoverable: deja keeps the task, the conclusions, each command with whether it passed and what is still open, and gives them back once after the summary lands. After compaction covers that half.
The part that is not about this harness
The index covers every agent's transcripts on the machine — forty-one of them today, each in its own format — so a fix found in one tool answers a question asked in another, including sessions from before any of this was installed. That is the reason to index rather than to capture.
Nothing here writes memories, so there is nothing to hallucinate into your history; indexing and search are local, and credentials are stripped as the index is built (privacy). An injection is capped at 1,536 bytes per prompt and about 4 KB per tool call — what memory costs has the measured comparison.
Getting started · How Claude's store is read · When CLAUDE.md grows
Found this useful? Star deja-vu on GitHub.