# Can Claude Code and Codex Share Memory?

> Not natively: every vendor memory is per person, per tool, and per machine. A repo AGENTS.md is the only context that crosses agents, and history crosses nothing.

Published October 18, 2026 · by the AQ team · Canonical: https://aq.dev/guides/shared-memory-across-coding-agents/

No, not natively: Claude Code and Codex each keep their own memory, in their own format, on the machine where they ran, and neither reads the other's. As of October 2026 the only context that reliably crosses from one coding agent to another is an instruction file checked into the repository (AGENTS.md, which Claude Code, Codex, Cursor, OpenCode, and Google's Antigravity all read). Everything else each tool remembers (Claude Code's auto memory, Codex memories, Cursor's rules set in the app) is private to one person, one tool, and usually one machine, and conversation history crosses nothing at all. This guide covers what each harness remembers today and how to share context across them anyway.

## What "memory" means for a coding agent

A coding agent starts every session with an empty context window, so anything it "remembers" is text some mechanism loads back in. Three mechanisms exist, and they have very different sharing properties:

- **Instruction files** (AGENTS.md, CLAUDE.md, GEMINI.md, rules files): plain Markdown you write, loaded at session start. The ones in the repository travel with git, so they cross people and tools. The ones in your home directory do not.
- **Self-written memory** (Claude Code auto memory, Codex memories): notes the agent writes about your project and preferences. Stored per person, per tool, per machine.
- **Session history**: the transcript of past runs, used for resuming a session. Local to the tool and machine that ran it, in a format no other tool reads.

When people ask "can my agents share memory," they usually want all three: the same rules everywhere, the same learned conventions everywhere, and some way for the next agent to know what the last one did. The vendor answer today covers only the first, and only through the repository.

## What each harness remembers today (October 2026)

| Harness | Instruction files it reads | Memory it writes itself | Crosses tools or teammates? |
| --- | --- | --- | --- |
| Claude Code | CLAUDE.md (project, user, enterprise); reads repo AGENTS.md too | Auto memory, per repository, machine-local | Only files checked into the repo |
| Codex | AGENTS.md: global in its home directory, then root to working directory | Memories (preview, off by default), machine-local | Only files checked into the repo |
| Cursor | .cursor/rules, User Rules, Team Rules, AGENTS.md | Memories feature retired in late 2025 | Team Rules share across the team, inside Cursor only |
| Antigravity (agy) | Global GEMINI.md, workspace GEMINI.md and AGENTS.md | None documented | Only files checked into the repo |
| OpenCode | Global AGENTS.md in its config directory, plus the repo's | None documented | Only files checked into the repo |

**Claude Code** has two systems, both loaded at session start. CLAUDE.md files are instructions you write, in three scopes: a project file at the repo root (shared through source control), a personal file at ~/.claude/CLAUDE.md, and an enterprise policy file. It can also read a repository's AGENTS.md in place of CLAUDE.md. Auto memory is the part Claude writes itself: notes on your corrections and preferences, kept per repository (shared across that repo's worktrees) in a directory under your home folder, with the first 200 lines or 25 KB of its index file loaded each session. Auto memory is machine-local: Anthropic's docs do not sync it across machines, and your teammates never see it. The mechanics are covered in depth in [how coding agents remember](https://aq.dev/guides/coding-agent-memory-explained/).

**Codex** builds its instructions from AGENTS.md files: a global one in its home directory (~/.codex by default), then one per directory from the project root down to where you are working, concatenated with the nearest file winning and a 32 KiB default cap on the combined size. Its newer memories feature (a preview, off by default as of October 2026) has Codex write notes about recurring workflows and conventions after a thread ends; the files live under ~/.codex/memories on that machine, and OpenAI's own guidance is to keep required team rules in AGENTS.md or checked-in docs rather than rely on memories.

**Cursor** is rules-first: project rules in .cursor/rules (version-controlled), personal User Rules, and on Team and Enterprise plans, Team Rules managed from the dashboard that admins can enforce, with precedence Team, then Project, then User. It also reads AGENTS.md at the root and in subdirectories. Cursor's automatically generated Memories feature was retired when 2.1 shipped in November 2025 (staff pointed users at exporting memories into Rules), and the current docs describe only Rules and AGENTS.md. Team Rules are the one genuinely team-shared vendor memory on this list, but they apply only inside Cursor.

**Antigravity** (Google's agy CLI, the successor to Gemini CLI) parses and enforces the rules in your workspace's GEMINI.md and AGENTS.md files plus a global ~/.gemini/GEMINI.md, unchanged from Gemini CLI. No self-written memory feature is documented. **OpenCode** reads a global AGENTS.md from its config directory and the repository's own, with an /init command that generates one from the codebase; again, instruction files only.

## How do I share context between coding agents?

Given those mechanics, context crosses agents at exactly three layers, and it is worth being deliberate about what belongs in each:

1. **The repository layer: one AGENTS.md, checked in.** Since every major harness now reads AGENTS.md (see [what AGENTS.md is](https://aq.dev/glossary/agents-md/)), a single file at the repo root is the portable core: build and test commands, conventions, the map of the codebase. If you also keep a CLAUDE.md, [keep the two in sync](https://aq.dev/guides/keep-agents-md-and-claude-md-in-sync/) rather than letting them drift. This layer crosses every tool and every teammate, but only per repository, and only for rules you deliberately write down.
2. **The personal layer: each tool's global file.** Your preferences (commit style, language quirks you care about) have to be copied into ~/.claude/CLAUDE.md, ~/.codex/AGENTS.md, Cursor's User Rules, ~/.gemini/GEMINI.md, and OpenCode's global AGENTS.md separately. Nothing syncs these for you; most people maintain one master file and paste it around, or script the copy.
3. **The learned layer: nothing crosses.** Claude Code's auto memory and Codex's memories are useful inside their own tool, but there is no export from one to the other, no sync between your laptop and your desktop (both vendors keep them machine-local), and no way for a teammate to benefit from what your agent learned. A lesson your Claude Code learned on Monday is invisible to your Codex on Tuesday and to your colleague forever.

Session history is even more closed: you can [carry context between Claude Code and Codex](https://aq.dev/guides/carry-context-between-claude-code-and-codex/) by hand (summaries, handoff notes, pointing the next agent at the last PR), and a generic memory service wired in over MCP (see [MCP servers explained](https://aq.dev/guides/mcp-servers-for-coding-agents-explained/)) can give several tools one store to read and write, but that is infrastructure you assemble and operate yourself.

## Why per-person memory quietly fragments a team

The sharper version of this problem appears at team scale. If five engineers run agents on one repository, each accumulates a private pile of corrections: one person's Claude Code has learned the test database quirk, another's Codex memories know the deploy convention, a third wrote it into their personal rules file. The team's real conventions end up scattered across memory stores nobody else can read, and every new person (and every new tool) relearns them from zero. The only durable fix is moving what matters up a layer: out of private memory and into something shared, reviewed, and visible.

## Where AQ fits

AQ is the multiplayer coding harness where engineering teams run AI coding agents like Claude Code and Codex together: shared live terminals, a code editor, and app previews, in your own cloud. AQ keeps one memory across every harness it runs, live since October 16, 2026, in both of the layers that vendors leave fragmented.

For rules, your organization keeps one shared rules file, and AQ syncs it into each CLI's own home on the workspace machine: ~/.codex/AGENTS.md, ~/.config/opencode/AGENTS.md, ~/.kimi-code/AGENTS.md, ~/.grok/rules/AGENTS.md, ~/.gemini/GEMINI.md, and ~/.claude/CLAUDE.md (as an import, so CLAUDE.md no longer shadows it). The synced section lives between markers, so anything personal in those files is preserved, and the rules land in a workspace's checkout only when the repository has no AGENTS.md of its own: a file tracked in git is never modified. Write the rule once, and every agent CLI on the team reads it.

For learned context, AQ adds memory notes that live with the repository instead of with one person's laptop: organization notes are shared with the whole team per repository, personal notes stay yours, and any agent AQ runs can search them and save new ones mid-run through AQ's MCP server (one tool surface that reaches Claude Code, Codex, Cursor, OpenCode, Kimi, and Grok alike; see [AQ's MCP docs](https://aq.dev/docs/mcp/)). Nothing is injected into a session uninvited: agents retrieve notes when relevant, secret-shaped values are refused at save time, and notes nobody has used for 28 days expire. Because agents run as real CLIs in persistent sessions on your team's VM, the same memory is there whichever device you resume from; [managing Claude Code sessions across a team](https://aq.dev/guides/manage-claude-code-sessions-across-a-team/) covers that side. The Free plan is a personal sandbox with nothing to install; team memory ships with the AQ Pro plan at $50 per user per month early access pricing (standard $200, billed monthly).

## Frequently asked questions

### Does Claude Code read AGENTS.md?

Yes. As of October 2026, Claude Code can read a repository's AGENTS.md files in place of CLAUDE.md, so a repo standardized on AGENTS.md does not need a duplicate CLAUDE.md for project instructions. Personal and enterprise scopes still use CLAUDE.md files.

### Are Codex memories shared between my laptop and my desktop?

No. Codex memories are a local store under the Codex home directory (~/.codex by default) on each machine, enabled per machine, and off by default as of October 2026. OpenAI recommends keeping rules that must always apply in AGENTS.md or checked-in docs instead.

### Can my teammates see what my Claude Code auto memory has learned?

No. Auto memory is written per repository under your own home directory on your own machine. Teammates, other machines, and other tools never see it. Anything a team should know belongs in a checked-in CLAUDE.md or AGENTS.md, or in a shared memory layer like AQ's per-repository organization notes.

### What happened to Cursor's Memories feature?

Cursor retired it when version 2.1 shipped in November 2025: the management UI was removed, staff pointed users at exporting existing memories into Rules, and the current documentation describes Rules and AGENTS.md as the persistence mechanisms. Team Rules on Team and Enterprise plans are the shared replacement inside Cursor.

### Can two coding agents share one conversation history?

Not directly. Each harness stores transcripts in its own format (Codex as JSONL under ~/.codex/sessions, Claude Code in its own session store) and none reads another's. The practical handoff is a written summary, a commit or PR the next agent can read, or a shared note store both agents can query, such as a memory MCP server or AQ's memory notes.

---

About AQ: AQ is the multiplayer coding harness where engineering teams run AI coding agents like Claude Code and Codex together: shared live terminals, a code editor, and app previews, in your own cloud. Start at [aq.dev](https://aq.dev/).
