Codex CLI
Where OpenAI Codex CLI stores your session history
Codex CLI saves each session as a rollout JSONL file in ~/.codex/sessions by date and compresses old ones to .jsonl.zst. How to find, resume, archive and delete them.
Updated October 29, 2026 // Markdown
- Made by
- OpenAI
- History lives in
- All
~/.codex/sessions/YYYY/MM/DD/rollout-<timestamp>-<id>.jsonl - Archived
~/.codex/archived_sessions/
- All
- Format
- JSONL; older files compressed in place to .jsonl.zst
- Kept for
- No automatic deletion documented
- Resume
codex resume [--last | ID]- Cloud copy
- Local CLI sessions; Codex cloud tasks are a separate remote product
Codex CLI records each session as a rollout file, filed by date. Unlike Claude Code, it does not delete old sessions; it compresses them.
Where the files are
~/.codex/
├── sessions/
│ └── 2026/10/29/
│ ├── rollout-2026-10-29T09-14-02-<id>.jsonl
│ └── rollout-2026-10-21T17-40-55-<id>.jsonl.zst # compressed when cold
├── archived_sessions/
├── session_index.jsonl # id, thread name, last update
├── state_*.sqlite # thread list: path, cwd, title, model, tokens
└── config.toml
The layout is the same on macOS, Linux and Windows. Set CODEX_HOME to move it.
Count your sessions, compressed ones included:
find ~/.codex/sessions -name 'rollout-*.jsonl*' | wc -l
What is inside a rollout file
Each line is a record with a type and a payload:
| Record | What it holds |
|---|---|
session_meta |
Session id, working directory, CLI version, model |
turn_context |
Settings for a turn: model, approval and sandbox policy |
response_item |
Messages, reasoning, and tool calls (function_call) with their output |
event_msg |
Events such as task start, token counts, task complete |
Shell commands appear as function_call items named shell or exec_command, with the command in the arguments.
Compressed sessions
A background worker compresses cold rollouts in place to .jsonl.zst. Older sessions are usually the compressed ones. To read one:
zstd -dc ~/.codex/sessions/2026/10/21/rollout-...jsonl.zst | head
Resume, fork and archive
codex resume # pick from a list
codex resume --last # the most recent session
codex resume <ID>
codex fork # start a new session from an old one
codex archive <ID> # hide from the list, keep the file
codex unarchive <ID>
codex exec resume and codex exec fork do the same for non-interactive runs.
Delete history
codex delete <SESSION>
codex exec --ephemeral "..." # a run that saves nothing
The prompt history file is controlled by history.persistence (save-all or none) and history.max_bytes in config.toml.
Privacy notes
- Rollouts include command output and file contents the agent read. Redact before sharing.
- On personal ChatGPT plans, the "Improve the model for everyone" setting also covers Codex. Business, Enterprise and Edu workspaces are not used for training by default.
Measure it
The evaluator reads ~/.codex/sessions, compressed files included, and counts sessions, hours and tool calls in your browser.
Questions
Where does Codex CLI save conversations?+
In ~/.codex/sessions, sorted into year, month and day folders. Each session is a file named rollout-<date-time>-<id>.jsonl. CODEX_HOME moves the whole ~/.codex folder.
Why do some Codex session files end in .zst?+
Codex compresses older rollout files in place with zstd to save space. Tools that only read .jsonl files miss them; the groundedby evaluator reads both.
How do I resume a Codex session?+
Run codex resume to pick from a list, codex resume --last for the most recent one, or codex resume <ID>. codex fork starts a new session from an old one.
How do I delete Codex history?+
Run codex delete <SESSION>, or codex archive to move a session out of the list without deleting it. To run without saving, use codex exec --ephemeral.
Sources
Waitlist
Your sessions, your call.
We are building an opt-in marketplace where developers license redacted sessions they pick, one by one. Join to hear first.
Read next
- Claude CodeWhere Claude Code stores your session historyClaude Code keeps every session as a JSONL file in ~/.claude/projects and deletes them after 30 days by default. How to find, resume, export, keep and delete them.Read +
- CursorWhere Cursor stores your chat and agent historyCursor keeps agent and chat history in a SQLite database, state.vscdb. Where it is on macOS, Windows and Linux, how to read a copy, and how to clear it.Read +
- Market$500, then $200: what one posting tells us about the price of a coding sessionIn October 2026 Mercor paid developers $500 per recorded coding session, then cut it to $200 within a week. What the price says about the market for agent session data.Read +