---
title: Give Claude Code and Codex the same memory
url: https://onadit.com/docs/claude-code-codex-memory
summary: Claude Code and Codex keep separate rules, notes and session history, so neither knows what you worked out in the other. Share 1 AGENTS.md between them, then give both a memory they can search.
last_updated: 2026-10-31
---

# Give Claude Code and Codex the same memory

Claude Code and Codex keep separate rules, notes and session history, so neither knows what you worked out in the other. Share 1 AGENTS.md between them, then give both a memory they can search.

Checked against the Claude Code and Codex documentation on 31 October 2026.

## What each one remembers on its own

| | Claude Code | Codex |
|---|---|---|
| Rules | `CLAUDE.md`, or `AGENTS.md` | `AGENTS.md` |
| Its own notes | Auto memory, on by default | Memories, off by default |
| Transcripts | `~/.claude/projects/`, 30 days by default | `~/.codex/sessions/` |

- Claude Code reads `AGENTS.md` from v2.1.277, and only when no `CLAUDE.md`, `.claude/CLAUDE.md` or `CLAUDE.local.md` is in the working folder or above it
- Codex reads `AGENTS.md`, or `AGENTS.override.md`, in `~/.codex` and in each folder from the project root down to the current one
- Claude Code's auto memory is in `~/.claude/projects/<project>/memory/`
- Codex memories are in `~/.codex/memories/`. `memories = true` under `[features]` in `config.toml` turns them on
- Codex keeps archived sessions in `~/.codex/archived_sessions/`

Neither reads the other's rules file by default, nor its notes or transcripts. A decision you reached with Codex on Monday is not in Claude Code's context on Tuesday, unless you wrote it into a file both read.

## Step 1: a shared rule file

Codex reads `AGENTS.md`. When Claude Code would read `CLAUDE.md` instead, import the shared file from it:

```md CLAUDE.md
@AGENTS.md
```

Rules for Claude Code alone go below that line. To see which files loaded, run `/context` in Claude Code and look under Memory files.

Keep the shared file short. Codex stops adding rule files once they reach 32 KiB together, and an imported file costs Claude Code the same context as text written in `CLAUDE.md`.

A rule file holds what you chose to write down. The reasons, the options you dropped and the fixes that worked stay in the transcripts, and each tool keeps its own.

## Step 2: a memory MCP server both can search

Onadit is a Mac app that keeps your sessions from both tools in 1 archive, which both search over MCP. Connect them:

```sh
~/.rift/bin/onadit mcp install --client claude-code
~/.rift/bin/onadit mcp install --client codex
```

A package install does not put `onadit` on your `PATH`, hence the full path. Restart both tools. Each one starts Onadit's MCP server as a local process, and both talk to the same Onadit engine and archive on your Mac. [Connect an agent](https://onadit.com/docs/connect.md) shows the entry each tool gets and covers Cursor and the Claude desktop app.

Then turn on [Capture](https://onadit.com/docs/capture.md). Every hour it reads new and changed Claude Code and Codex sessions, and saves the ones the judging tool rates worth keeping. A saved Codex session can then be found from Claude Code, and the other way round. An agent can also file a session or a note at once with [`onadit_save`](https://onadit.com/docs/save.md).

Its limits:

- Capture starts on the day you turn it on. Sessions already on your Mac are not imported, unless you resume one later
- A trivial session is not stored, and one the judge is unsure about waits in the review queue until you promote it
- Capture needs Search by meaning, and Claude Code or Codex signed in to judge each session. Session text goes to that tool's provider and to an embedding service, see [What leaves your Mac](https://onadit.com/docs/egress.md). The judging calls count against your plan with that provider
- What Onadit returns to an agent becomes part of that agent's conversation, so it goes to the agent's provider like the rest of the session

## Step 3: ask both to look first

Each agent decides when to call a tool. A line in the shared `AGENTS.md` asks both to look before a task:

```md AGENTS.md
Before a task, call onadit_context_pack with a 1-line description of it.
```

`onadit_context_pack` returns earlier decisions, constraints and related sessions, in at most 6 KB by default. For Claude Code and Codex, `onadit mcp install` also offers 2 optional hooks: a brief for the current project at the start of each session, and a check that the agent asks for a pack before it searches broadly. Codex skips new hooks until you run `/hooks` once. See [The optional hooks](https://onadit.com/docs/connect.md#the-optional-hooks) and [Agent instructions](https://onadit.com/docs/instructions.md).

## Check that it works

```sh
~/.rift/bin/onadit status
```

The `MCP:` line shows a check mark next to `codex` and `claude-code`, which means the connections are written. To test the memory itself, settle something in a new Claude Code session, wait for the next Capture run, then ask Codex about it. A result from that session names its source, `claude_code`. [MCP tools](https://onadit.com/docs/mcp-tools.md) shows real calls and responses.

## What it costs

Onadit is free for 7 days, then €5 a month until 31 December 2026 and €9 a month after, VAT excluded. Without a license, capture and Search by meaning pause, and your archive and keyword search stay. See [Your free week and your license](https://onadit.com/docs/license.md). It needs a Mac with Apple silicon and macOS 14 or later.

Claude Code deletes a terminal session's transcript after 30 days by default, see [Why your Claude Code history disappears](https://onadit.com/docs/claude-code-history.md).
