[supermemory](https://supermemory.ai/) · Guides

# Does Codex have memory across sessions?

Reviewed November 10, 2026 [Docs for this setup](https://supermemory.ai/docs/integrations/codex) 

Yes, if you turn it on, and only on that machine. Codex has an official Memories feature, off by default: enable it in Settings under Personalization, or with `memories = true` under `[features]` in `config.toml`, and Codex distils eligible past chats into memory files under `$CODEX_HOME/memories_v2/` and adds them to later sessions. `AGENTS.md` persists the instructions you write. For memory that is searched by relevance on each prompt and shared across machines and with Claude Code, Cursor and OpenCode, the codex-supermemory plugin installs with one command and works through Codex's hooks; any MCP memory server can be added in `config.toml` as tools the model calls.

## What does Codex keep between sessions on its own?

**AGENTS.md.** Codex reads `~/.codex/AGENTS.md`, then the `AGENTS.md` files from the repository root down to the working directory, one per directory, up to 32 KiB by default, and treats them as instructions. They persist because they are files; keeping them current is your job, and a decision made in a session is in them only if someone wrote it there.

**Memories.** Off by default. Enable it in Settings under Personalization, or with `[features] memories = true` in `~/.codex/config.toml`. Codex then turns context from eligible earlier chats into memory files under `$CODEX_HOME/memories_v2/` in the background, with secrets redacted, and adds them to future sessions; `/memories` toggles it for one chat. It works in the desktop app, the CLI and the IDE extension. The files stay on that machine, are not searched against your prompt, and are not visible to Claude Code, Cursor or any other tool.

**Configuration and hooks.** `config.toml` also holds the model, approvals and MCP servers, and `~/.codex/hooks.json` holds hooks that run at session start, on each prompt, before tool calls and at stop. The hooks are how a memory plugin attaches.

## How do I add persistent memory to Codex?

1. Install the plugin: `npx codex-supermemory@latest install`. It copies the hook scripts and an MCP proxy to `~/.codex/supermemory/`, registers the `supermemory` MCP server in `config.toml`, registers SessionStart, UserPromptSubmit, PreToolUse and Stop hooks in `hooks.json`, and installs the `supermemory-status` and `supermemory-index` skills. Restart Codex.
2. Start Codex. A browser window opens to sign in to supermemory. To use an API key instead, set `SUPERMEMORY_CODEX_API_KEY` in your shell.
3. Check it with `npx codex-supermemory status`, then ask Codex to index the repository with the `supermemory-index` skill so the first sessions have something to recall.

```
npx codex-supermemory@latest install
npx codex-supermemory status
```

## What does the plugin do in each session?

| Hook           | When                    | What it does                                                                |
| -------------- | ----------------------- | --------------------------------------------------------------------------- |
| session-start  | Session starts          | Loads your persistent profile and recent context                            |
| recall         | Each substantive prompt | Searches supermemory with the prompt and injects fresh, relevant memories   |
| recall-approve | Before a tool call      | Auto-approves the read-only memory tools; other supermemory tools still ask |
| flush          | Stop                    | Saves completed turns in the background                                     |

Set `recallMode` to `"advisory"` in `~/.codex/supermemory.json` to let the model decide when to search, or `"off"` to stop prompt recall. Anything wrapped in `<private>…</private>` is redacted before storage. Search, save, list and forget are also available on demand through the supermemory MCP tools, with the same credentials as the hooks.

## Is the memory shared with Claude Code, Cursor and OpenCode?

Yes. A plugin keys memory to the repository: one container named `repo_<project>__<hash>`, where the hash comes from the normalised Git remote. Clones and worktrees of the same repository share it; two repositories with the same folder name do not collide. The Claude Code, Cursor, Codex and OpenCode plugins all write to the same container, so a decision saved in one tool is there when you open the next. Automatic captures carry `sm_scope: personal` metadata; explicit saves through the MCP tools land in your account's active space. Set `SUPERMEMORY_ISOLATE_WORKTREES=true` to keep each worktree apart.

## Which memory options work with Codex?

| Option                   | What it is                                                                       | Automatic                | Across tools                                                         |
| ------------------------ | -------------------------------------------------------------------------------- | ------------------------ | -------------------------------------------------------------------- |
| AGENTS.md                | Instruction files Codex reads each session                                       | Read, yes; written, no   | Claude Code, Cursor and OpenCode read AGENTS.md too                  |
| Codex Memories           | Built in; memory files distilled from earlier chats, on this machine             | Yes, once enabled        | No; Codex only, one machine                                          |
| codex-supermemory        | Hooks that recall before each prompt and capture after each turn, plus MCP tools | Yes                      | Yes, one memory per repository with Claude Code, Cursor and OpenCode |
| supermemory MCP server   | https://mcp.supermemory.ai/mcp in config.toml; nine memory tools                 | No, the model calls them | Yes, any MCP client                                                  |
| Mem0 MCP server          | Mem0's hosted MCP server at mcp.mem0.ai                                          | No, the model calls them | Yes, any MCP client                                                  |
| A notes file in the repo | A Markdown file the agent is told to update                                      | No                       | Anyone who reads the file                                            |

## Can I run it against a local supermemory?

Run `npx supermemory local`, point the plugin at it with `SUPERMEMORY_API_URL="http://localhost:6767"` (or `baseUrl` in its config file) and use the API key printed on first boot. supermemory local is free for up to 10,000 stored documents and keeps everything on your machine; it is not open source, and memories do not move between it and the hosted service.

## Questions

### Does Codex remember previous conversations?

Only if you enable Codex Memories, which is off by default. It then keeps memory files distilled from earlier chats on that machine and adds them to new sessions. It does not search by relevance against your prompt or share with other tools; the codex-supermemory plugin adds both through Codex's hooks.

### Does the plugin need an API key?

No. Starting Codex after the install opens a browser sign-in. SUPERMEMORY\_CODEX\_API\_KEY works as an alternative.

### Can I stop the plugin from recalling on every prompt?

Yes. Set recallMode to "advisory" so the model decides when to search, or "off" to disable prompt recall, in \~/.codex/supermemory.json.

### How do I keep something out of memory?

Wrap it in <private> tags. It is redacted before anything is stored.

### How do I remove the plugin?

npx codex-supermemory uninstall removes the hooks, the MCP server entry and the skills. Your memories in supermemory are kept.

Plugin facts from the supermemory docs and github.com/supermemoryai/codex-supermemory. AGENTS.md, Memories, config.toml and hooks from the Codex documentation at developers.openai.com/codex. Mem0's MCP server from docs.mem0.ai. Checked November 10, 2026\. The setup steps restate the [docs page for this integration](https://supermemory.ai/docs/integrations/codex); when the two differ, the docs are current.

[All guides](https://supermemory.ai/guides/)
