Opuscule
  1. Home
  2. Journal
  3. Where Codex stores your sessions

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:

The CODEX_HOME variable moves everything out of ~/.codex.

Resume a session

CommandWhat it does
codex resumeOpens a picker of recent sessions in the current directory
codex resume --lastResumes the most recent session, no picker
codex resume --allShows 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 forkBranches 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 copy takes one line:

rsync -a ~/.codex/sessions/ ~/Archives/codex/sessions/

Run it regularly and it only copies new sessions.

Sources

Checked against codex-cli 0.148.0 on September 29, 2026. The date-based tree is what this version writes; it may change.