Adding memory to Codex CLI
the MCP server, the hook you have to approve, and the marketplace
Codex CLI records every session and opens the next one empty. The rollout files are still on disk, along with the work you did the same week in whichever other agent was open.
AGENTS.md is the whole of it
Codex reads AGENTS.md — the repository's, and ~/.codex/AGENTS.md for every project — at the start of a session, and that is the only memory it has. There is no derived-memory feature, nothing is appended for you, and nothing carries between sessions except what you wrote in that file.
What Codex already has
Rollouts live under ${CODEX_HOME:-~/.codex}/sessions/YYYY/MM/DD/rollout-*.jsonl, with the prompts you typed in history.jsonl beside them. Complete, and read by nothing. How Codex's store is read has the format and the quirks it took to parse it.
Adding recall
deja install codex-auto
That writes the deja MCP server into ~/.codex/config.toml and the hooks that carry recall into the session: at session start, on each prompt, before a command or patch, after a failed command, before a compaction and at session end. The server alone is deja install codex.
One catch worth knowing before you go looking for a bug: Codex will not run a hook it has not been shown. Open Codex once and approve them under /hooks, otherwise every file on disk looks right and no memory ever arrives — codex exec included.
This repository is also a Codex plugin marketplace:
codex plugin marketplace add https://github.com/vshulcz/deja-vu codex plugin add deja-vu@deja-vu
Running both is safe rather than doubled: MCP servers are keyed by name and every manifest we ship calls this one deja, so the two resolve to one server rather than listing every tool twice.
Either path needs the binary, since a plugin ships files and not runtimes:
brew install deja-vu # or curl -fsSL https://raw.githubusercontent.com/vshulcz/deja-vu/main/install.sh | sh
Why this matters more in Codex than most
Codex sessions are short and many — a day's work is spread over a dozen rollout files rather than one long thread. That makes the thing you settled on Tuesday hard to find by scrolling and easy to find by search. Finding a session is the command side of that.
Codex also hands a hook the transcript before a compaction, so the working context is recoverable here: deja keeps the task, the files and each command with whether it passed, and hands them back once in the next turn after the summary. See after compaction.
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 Codex's store is read · Switching agents
Found this useful? Star deja-vu on GitHub.