DEV Community

Cover image for Share one memory between Claude Code and Codex (remote MCP)
杨青峰
杨青峰

Posted on Originally published at ownmem.ai Fully Autonomous

Share one memory between Claude Code and Codex (remote MCP)

If you use both Claude Code and Codex, you've probably noticed that they don't share context. Claude Code reads CLAUDE.md, Codex reads AGENTS.md, and every time you switch tools you end up re-explaining things like "this repo uses pnpm, not npm" or "we decided against an ORM here".

Project files are still the right place for repository rules. But preferences and decisions that should follow you across projects, machines and tools need somewhere that isn't tied to one tool. One way to get that is to point both agents at the same MCP memory server.

This post walks through doing that with ownmem, a hosted remote MCP memory server I build. Disclosure up front: it's my project. The setup pattern works the same with any remote MCP memory server.

TL;DR

# Claude Code
claude mcp add --transport http --scope user ownmem https://mcp.ownmem.ai/mcp

# Codex CLI
codex mcp add ownmem --url https://mcp.ownmem.ai/mcp
codex mcp login ownmem
Enter fullscreen mode Exit fullscreen mode

Sign in once with OAuth, keep the ownmem tab open and unlocked, and both agents read and write the same memory. MCP calls don't run a model on the server side, so they use no credits.

Commands checked in November 2026. They may vary slightly by Claude Code and Codex version.

How it works

The memory doesn't live in either tool. It's a set of Markdown files in an encrypted vault, exposed through one remote MCP endpoint:

https://mcp.ownmem.ai/mcp
Enter fullscreen mode Exit fullscreen mode
  • Transport: Streamable HTTP
  • Auth: OAuth 2.1 with dynamic client registration and PKCE (no API key to copy)
  • Tools: memory_search, memory_view, memory_create, memory_str_replace, memory_insert, vault_status

Both agents connect to the same URL, like two people sharing one notebook. Something Codex saves is searchable from Claude Code in the next session, and the other way round.

Step 0: create a vault

  1. Sign up at ownmem.ai/chat, set a passphrase and save the 12-word recovery phrase.
  2. In Settings → Agents (MCP), make sure Allow agents (MCP) on this device is on.
  3. Keep ownmem.ai/chat open and unlocked while your agents work. By default, tool calls are executed in that tab (more on why below).

Step 1: Claude Code

claude mcp add --transport http --scope user ownmem https://mcp.ownmem.ai/mcp
Enter fullscreen mode Exit fullscreen mode

--scope user makes the server available in every project, not just the folder you ran it in.

Then inside Claude Code run /mcp, pick ownmem and choose Authenticate. Your browser opens a consent page; check that it names the app you're connecting and click Allow.

Step 2: Codex CLI

codex mcp add ownmem --url https://mcp.ownmem.ai/mcp
codex mcp login ownmem
Enter fullscreen mode Exit fullscreen mode

The login command opens the same consent page. Check the app, click Allow.

Step 3: tell the agents when to use it

Connecting the server only gives the agents tools. They still need to know when to search and what to save. The app has a ready-made prompt under Settings → Agents (MCP) → Copy a prompt for your agent. Paste it into each agent once and it asks the agent to add standing rules to its own instructions file (CLAUDE.md for Claude Code, AGENTS.md for Codex). The core of those rules:

- At the start of every task, call memory_search with a few keywords about the task,
  then memory_view the most relevant files; if unsure what exists, memory_view /memories.
- Prefer retrieved facts over guessing my preferences, projects and past decisions;
  if memory conflicts with what I ask now, ask me.
- At the end of a task, save durable new facts, preferences and decisions:
  memory_search first to avoid duplicates, update an existing file with
  memory_str_replace or memory_insert, or create a short topic file under
  /memories/ with memory_create.
- Never save secrets (passwords, API keys, tokens, private keys) or one-off details.
- If a tool says the vault is unavailable, call vault_status and remind me to
  open https://ownmem.ai/chat and unlock my vault.
Enter fullscreen mode Exit fullscreen mode

A good split: build commands and code conventions stay in CLAUDE.md / AGENTS.md (they travel with the repo), while "who I am, what I decided and why" goes into the shared memory.

Test it: save in one, find in the other

  1. In Claude Code: "Remember: this project uses pnpm, not npm." It should call memory_create or memory_insert.
  2. Open Codex and ask: "Which package manager does this project use?" It should call memory_search first and find the note.
  3. The same file shows up in the file list at ownmem.ai/chat.

Where the data goes

This part matters for a memory tool, so here's exactly what happens:

  • Default (zero-knowledge): the vault is encrypted in your browser and the server stores ciphertext. When an agent calls a tool, the request is relayed to your open, unlocked tab, which decrypts and runs the search locally, and only the result (a few matching lines, or the file the agent asked for) goes back. That result passes through the server in memory and isn't stored; only tool names and paths are logged. Whatever the agent receives becomes part of that conversation with its model provider, as with any MCP server.
  • Optional Agent share: if you want agents to read memory with the browser closed, you can share selected folders. Those folders are kept in a server-readable copy, so they are not zero-knowledge, and agents get read-only access. Turning it off deletes the server copy.

There's no delete or rename over MCP. Limits are 60 calls per minute and 3,000 per day per account, and a free account stores up to 2 MB.

Troubleshooting

  • "Vault unavailable": open ownmem.ai/chat, unlock, and check Allow agents (MCP) on this device.
  • Codex login didn't finish: make sure you're logged in to ownmem in your default browser and run codex mcp login ownmem again.
  • ownmem missing in Claude Code: run claude mcp list. Without --scope user, it only exists in the project where you added it.
  • Client only supports stdio: bridge with mcp-remote: command npx, args ["-y", "mcp-remote", "https://mcp.ownmem.ai/mcp"].
  • Revoke an app: Settings → Agents (MCP) → Connected apps → Revoke.

When something else fits better

  • Everything offline on one machine: a local server like the reference @modelcontextprotocol/server-memory keeps data in a local file.
  • Rules for one repo: CLAUDE.md / AGENTS.md need no server at all.
  • Only one AI app: its built-in memory needs no setup.

A remote server is for the case in between: one memory that Claude Code, Codex, Cursor and the Claude and ChatGPT web apps share across machines. Setup for every client (Cursor, VS Code, Claude.ai, ChatGPT) is on the remote MCP memory server page, and the full reference is in the MCP docs.

Questions or setups I haven't covered? Happy to answer in the comments.

Top comments (0)