Codex Memory: How AGENTS.md and Memories Work, and How to Share Memory Across a Team (2026)
Guide · · Published November 2026 · 7 min read
By Ashwin Gopinath, CEO
TL;DR
OpenAI Codex has two built-in ways to remember. AGENTS.md files are instructions you write, which Codex reads at the start of every session. Memories are notes Codex generates from past chats, off by default and stored on your machine. Both work per person and per machine. For memory a whole team and every coding agent share, connect an organization memory such as Sentra over MCP.
How does Codex memory work?
Codex starts each session with a fresh context. Anything it should know from before has to be loaded in, and there are two mechanisms that do it.
AGENTS.md: instructions you write
Codex reads AGENTS.md files when a session starts: a global one in the Codex home directory, then the files from the repository root down to the folder you are working in. This is where build commands, conventions and rules belong. Codex reads these files and does not write to them, and by default it loads up to 32 KiB of them.
Memories: notes Codex writes
Memories are generated. Codex summarises eligible past chats in the background and brings relevant notes into later sessions. OpenAI's memories documentation states that local Codex memories are off by default. You turn them on in the app under Settings, Personalization, or in config.toml:
[features]
memories = trueTwo settings control the behaviour separately: memories.generate_memories decides whether new chats feed memory, and memories.use_memories decides whether existing memories are loaded. The /memories command changes memory use for the current chat.
Where Codex stores memory
Memories are stored locally in the Codex home directory, which is ~/.codex by default. They belong to that machine. OpenAI's documentation advises against editing the files by hand and suggests reviewing them before you share your Codex home with anyone.
The documentation is also clear about the division of labour: keep required team guidance in AGENTS.md or checked-in documentation, and treat memories as a helpful recall layer.
AGENTS.md vs memories vs shared team memory
| Sentra (organization memory over MCP) | AGENTS.md | Codex memories | |
|---|---|---|---|
| Who writes it | Built from the team's code, tickets, docs and conversations | You | Codex, from your past chats |
| What it holds | Decisions, their reasons, owners and current facts | Rules and conventions | Notes from earlier sessions |
| Where it lives | One memory for the organization | In the repository and your Codex home | On your machine |
| Who shares it | Every teammate and every agent, within source permissions | Everyone who clones the repository | You, on that machine |
| Loaded | On request, only the facts a task needs | At the start of every session | When relevant to a session |
The three fit together. AGENTS.md carries the rules. Memories carry your own recent work. Shared memory carries what the team knows.
What built-in memory covers, and what a team adds
AGENTS.md and memories handle conventions and personal recall well. A team usually wants three more things.
- The reason behind a decision. Why the service was split, why a library was dropped, what the customer asked for. That reasoning was given in a review, a thread or a call.
- The same answer for every agent. A team often runs Codex next to Claude Code and Cursor. Each has its own memory. See our guides to Claude Code memory and Cursor memory over MCP.
- Current facts. A convention that changed last week should replace the old one for everyone at once.
Our guide to persistent memory for coding agents covers the general pattern, and the best MCP memory servers compares the servers that plug in this way.
How to add shared memory to Codex
- Keep AGENTS.md short and current. Put rules there, and move history out.
- Turn on memories if you want personal recall. Decide per machine.
- Connect a shared memory over MCP. Codex supports MCP servers, so a memory server appears to it as a set of tools it can call when a task needs context.
- Tell Codex when to use it. One line in AGENTS.md, such as asking it to check team memory before changing an interface, is enough.
- Check the interaction. Codex has a setting,
disable_on_external_context, that keeps chats which used MCP or web search out of memory generation. Decide whether you want it on.
Where Sentra fits
Sentra is organization memory that Codex reads over MCP. It takes in code, tickets, documents and the conversations around them from GitHub, Linear, Jira, Slack, email and meetings, and keeps what was decided as facts with a source and a date. When Codex asks why something is the way it is, it gets the few facts that answer the question, with the pull request, ticket or meeting behind them.
The same memory serves Cursor, Claude Code and Windsurf, so every agent on the team works from the same current facts, and each person's agent sees only what that person could already open. On Terminal-Bench 2.1, agents using Sentra scored 88.31% against an 83.37% baseline, at 72.6% lower model cost and with 41.2% fewer tokens.
Connection details are on the developers page. To see Codex working with your team's memory, book a demo.
FAQ
Does Codex have memory?
Yes. Codex reads AGENTS.md instruction files at the start of every session, and it has an opt-in memories feature that summarises past chats and brings relevant notes into later ones.
Is Codex memory on by default?
No. OpenAI's documentation says local Codex memories are off by default. Turn them on in Settings, Personalization, or set memories to true under features in config.toml.
Where are Codex memories stored?
Locally in the Codex home directory, which is ~/.codex by default. They stay on that machine.
What is the difference between AGENTS.md and Codex memories?
AGENTS.md is written by you and holds rules Codex must follow. Memories are generated by Codex from past chats. OpenAI recommends keeping required team guidance in AGENTS.md.
How do I share Codex memory across a team?
Commit AGENTS.md to the repository for shared rules, and connect an organization memory such as Sentra over MCP for shared decisions and context. Every teammate's Codex then reads the same facts.