Skip to content
groundedby
Waitlist

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

Quick factsas of October 2026 (v0.166.0)
Made by
OpenAI
History lives in
  • All~/.codex/sessions/YYYY/MM/DD/rollout-<timestamp>-<id>.jsonl
  • Archived~/.codex/archived_sessions/
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

  1. OpenAI Codex docs, developer commands
  2. OpenAI Codex docs, config reference
  3. openai/codex source, rollout storage

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.

Your email and the side you picked. Nothing else. Privacy