Guides · Checked on 2026-10-04, with codex-cli 0.155
Codex's memory between sessions
Each Codex session starts fresh. Three things can carry over: your AGENTS.md, Codex's own
memories, and a session you resume. Here's what each keeps, where each stops, and what DMN adds.
1. AGENTS.md: what you tell it
Codex reads ~/.codex/AGENTS.md for every project, then each AGENTS.md from the
repository's root down to the folder you started in, and joins them.
Good for: rules that must always apply: how to build and test, what not to touch.
Where it stops: you write it and keep it current, and Codex stops adding files once they reach 32 KiB together, by default. The AGENTS.md checker measures yours.
2. Memories: what Codex notes for itself
Codex can keep memories of its own: summaries and lasting entries drawn from earlier chats, kept under
~/.codex/memories/. They're off by default. Turn them on in the app under Settings ▸
Personalization, or in ~/.codex/config.toml:
[features] memories = true
In a session, /memories chooses whether that chat uses them, and whether it feeds future ones.
Good for: your preferences and recurring ways of working, without writing them down.
Where it stops:
- Codex writes them in the background, once a chat has been idle for a while, and skips short or active chats. What you found an hour ago may not be there yet.
- They live in your home folder on this machine, and only Codex reads them. Claude Code and Gemini CLI don't see them.
- OpenAI's own advice: keep rules that must always apply in
AGENTS.md, and treat memories as a recall layer.
3. Resume: the conversation itself
codex resume --last # the most recent session in this folder codex resume # pick one from a list codex resume --all # include sessions from other folders
Good for: finishing a task you stopped in the middle of.
Where it stops: it brings back one whole conversation. That's heavy for one fact from last week, and another agent gets none of it.
4. What DMN adds
DMN keeps what agents learn about the code in the project, where Codex and Claude Code both read it. It sits
alongside AGENTS.md and Codex's memories rather than replacing them.
-
Notes in the project. Short markdown files in
.dmn/memories: why a test is flaky, that a webhook must read the raw body. A note Claude Code saved yesterday is in Codex's briefing today. - A briefing at session start. Your rules first, then the newest notes. A note whose code changed since it was written is flagged.
-
Past sessions you can search.
dmn memory search "<question>"finds what earlier Claude Code and Codex sessions were asked, ran and concluded, read from their logs on your machine. - Where the last session left off. With Claude Code's hand-off hook, its final message is saved, and the next session in the same checkout, Codex included, starts with it.
Agents don't always save notes unprompted, so ask at the end of a task: “save what you learned as a DMN note”. To connect Codex:
dmn skill-init --apply --agent codex dmn hook-init --apply --agent codex
The first teaches Codex the dmn command line; the second adds the session-start briefing. Leave
out --apply to see what either would change. More on DMN for Codex.
DMN for Windows is coming soon. The commands work once it's installed.
Which one to use
| AGENTS.md | Memories | Resume | DMN | |
|---|---|---|---|---|
| Who writes it | You | Codex, in the background | Nobody: it's the conversation | Agents, when asked; hand-offs on their own |
| Is it on? | Always | Off by default | When you resume | Once connected |
| Where it lives | Your repository and ~/.codex | ~/.codex/memories/ | ~/.codex/sessions/ | The project's .dmn folder |
| Who reads it | Codex, and Claude Code if CLAUDE.md imports it | Codex | Codex | Every agent connected to DMN |
If you use only Codex, AGENTS.md and its memories cover a lot. DMN earns its place when Claude Code
or another agent works on the same project. For that case, see
share context between Claude Code and Codex.