Codex
Where Codex stores your sessions, and how to find them
The Codex CLI keeps every conversation on your Mac, filed by date. How to resume one, archive it, and keep it safe before you switch machines.
Published September 29, 2026 · 5 min read
Like Claude Code, OpenAI's Codex CLI saves your conversations locally so you can pick them up again. Here's where they are and what you can do with them.
The folder: ~/.codex/sessions
The Codex documentation says conversations are stored in ~/.codex/sessions. In practice, on a Mac running Codex 0.148, you'll find a date-based tree with one JSONL file per session:
~/.codex/sessions/2026/09/02/rollout-2026-09-02T10-14-03-<id>.jsonl
The filename gives the start date and time, followed by the session ID. Each line describes an event: your message, the reply, a tool call, its result.
Also in ~/.codex:
archived_sessions/holds the sessions you archive (see below), in the same format.history.jsonlkeeps your prompt history. Two settings in~/.codex/config.tomlcontrol it:history.persistence("save-all"or"none") andhistory.max_bytes, which caps its size by dropping the oldest entries.
The CODEX_HOME variable moves everything out of ~/.codex.
Resume a session
| Command | What it does |
|---|---|
codex resume | Opens a picker of recent sessions in the current directory |
codex resume --last | Resumes the most recent session, no picker |
codex resume --all | Shows sessions from every directory, with their working directory |
codex resume <id or name> | Resumes a specific session |
codex exec resume --last "…" | Resumes a session without the interface, for scripts |
codex fork | Branches off a past session into a new one |
Archive without losing anything
codex archive <id or name> puts a session away so it stops cluttering your list, and codex unarchive brings it back. Archiving isn't deleting: the session stays on your Mac, in archived_sessions/.
How long they stay
Unlike Claude Code, which deletes its sessions after 30 days by default, the Codex documentation doesn't describe any automatic deletion of ~/.codex/sessions as of today. On our test Mac, sessions from March are still there in September. Only history.jsonl can be capped, and only if you set history.max_bytes.
Two things can still cost you your sessions:
- A new Mac or a cleanup of your home folder.
~/.codexis a hidden folder: make sure it's part of what you migrate. - A format change. Recent Codex versions add
codex migrate-rollouts, which inspects or migrates "legacy local sessions" to a paginated thread history. Without the--applyflag, it only prints a report. Before applying a migration, make a copy.
A copy takes one line:
rsync -a ~/.codex/sessions/ ~/Archives/codex/sessions/
Run it regularly and it only copies new sessions.
Sources
- Codex docs: the Codex CLI (
codex resume,codex exec resume, session location) - Codex docs: configuration reference (
history.persistence,history.max_bytes,CODEX_HOME) - Built-in help for
codex resume,codex archive,codex forkandcodex migrate-rollouts, codex-cli 0.148.0
Checked against codex-cli 0.148.0 on September 29, 2026. The date-based tree is what this version writes; it may change.