Codex CLI memory & config.toml hooks setup

wire ~/.codex/config.toml MCP and hooks.json across Codex rollouts and 51 other agents

Codex CLI gives you three built-in places for context: AGENTS.md (capped at 32 KiB by default via project_doc_max_bytes), features.memories (Codex-only LLM summaries of recent rollouts), and ~/.codex/config.toml MCP servers plus ~/.codex/hooks.json. Pairing Codex with deja-vu adds verbatim search across historical Codex rollouts, Claude Code, Cursor, opencode, and 48 other tools on disk.

Configure Codex MCP and hooks cleanly: deja-vu writes the [mcp_servers.deja] block into ~/.codex/config.toml, installs lifecycle hooks into ~/.codex/hooks.json, and indexes existing rollout-*.jsonl transcripts.
$brew install deja-vu && deja install codex-auto
$npx @vshulcz/deja-vu install codex-auto
deja-vu on GitHubCodex overview →

~/.codex/config.toml MCP block

deja install codex or deja install codex-auto appends a single stdio MCP server entry in ~/.codex/config.toml without altering your model provider or approval policy:

[mcp_servers.deja]
command = "deja"
args = ["mcp"]

Codex sees one tool named deja with 8 modes (recall, context, blame, fix, how, orient, remember, handoff) for 477 tokens instead of loading eight separate tool schemas.

Codex features.memories vs deja-vu

DimensionCodex features.memoriesdeja-vu
Day-zero past historyBuilds forward from new summariesIndexes existing ${CODEX_HOME:-~/.codex}/sessions/YYYY/MM/DD/rollout-*.jsonl on disk immediately (13.6 s on 19,195 sessions)
Cross-agent recallCodex CLI onlyCodex + Claude Code, Cursor, opencode, Gemini CLI, and 47 other coding agents
Verbatim error & diff lookupCompressed natural-language proseSQLite + FTS5 verbatim commands, exit codes, stack traces, and secret-redacted transcripts (~15 ms query latency)
Team repo sharingLocal per-user state.deja/memory.jsonl tracked in git with merge=union

~/.codex/hooks.json and /hooks approval

deja install codex-auto registers 6 lifecycle hooks in ~/.codex/hooks.json: SessionStart, UserPromptSubmit (up to 1,536 bytes per prompt), PreToolUse, PostToolUse (matching Bash and apply_patch, about 4 KB per tool call), PreCompact (4 KB handoff packet), and SessionEnd (3-second timeout cap).

One required interactive step: Codex refuses to run unapproved entries from ~/.codex/hooks.json. Open interactive codex once after installing and approve the hook under /hooks — before that confirmation, neither interactive turns nor codex exec invoke hooks. Alternatively, use codex plugin marketplace add inside Codex or keep AGENTS.md small for static rules.

Found this useful? Star deja-vu on GitHub.