FishMem for Codex
Configure the OpenAI Codex CLI to use the FishMem MCP server for persistent memory.
Configure the OpenAI Codex CLI to use the FishMem MCP server and it gains persistent memory across sessions. Codex recalls your project's conventions and decisions instead of rediscovering them on every run, and stores new facts as it works.
Codex reads MCP servers from its config TOML, usually ~/.codex/config.toml.
You declare the FishMem server under an [mcp_servers.fishmem] table.
Setup
Get an API key
Create a project key in the dashboard. It looks
like fm_.... Keep it server-side — see Authentication.
Add the server to config
Add an [mcp_servers.fishmem] table to ~/.codex/config.toml:
[mcp_servers.fishmem]
command = "npx"
args = ["-y", "@fishmem/mcp"]
[mcp_servers.fishmem.env]
FISHMEM_API_KEY = "<your-key>"
FISHMEM_PROJECT = "acme-api"The command and args are identical to every other FishMem plugin —
npx -y @fishmem/mcp. Only the config file format differs between hosts.
Verify
Start the Codex CLI in your repository and list available tools. The fishmem
server should report three: search_memory, add_memory, and list_memories.
Use it
Codex calls the tools on its own. Tell it something worth keeping, or ask it to recall:
> Note that migrations live in db/migrate and run with `make migrate`.Codex calls add_memory. Next session, "how do I apply a migration?" triggers
search_memory and Codex answers from memory rather than scanning the tree
again.
Recommended scoping
Set FISHMEM_PROJECT to the repository so memory is per-project. This maps to a
run_id scope — facts learned in one repo never leak into another. Pair it with
FISHMEM_USER_ID if you want memories attributed to you across projects:
[mcp_servers.fishmem.env]
FISHMEM_API_KEY = "<your-key>"
FISHMEM_PROJECT = "acme-api"
FISHMEM_USER_ID = "alex"See Scoping for how user_id, agent_id, and
run_id combine.