Codex CLI guide: session storage

Where Codex CLI stores its sessions

Codex calls a stored session a rollout, and it files rollouts by date rather than by project. That one decision changes how you find them: you cannot compute the path from a project directory, so everything resolves by session id instead.

OpenAI

On Codex CLI

The root

Everything lives under $CODEX_HOME, which defaults to ~/.codex. Sessions sit in sessions/ beneath it.

The dated tree

A rollout is written to sessions/YYYY/MM/DD/rollout-<local-time>-<uuid>.jsonl. The date is the day the session started, in local time, so a session that runs past midnight stays filed under the day it began.

Cold rollouts get compressed

Older rollouts are compressed in place to .jsonl.zst. Anything reading the history has to handle both extensions, which is the single most common reason a homegrown Codex log reader stops finding old sessions.

Paths are not derivable

Because the tree is keyed on date and not on the working directory, there is no way to compute where a project stores its sessions. You resolve by id, which in practice means scanning the tree or reading the index.

The index files

Codex keeps session_index.jsonl and history.jsonl at the root of the home directory. The index is what makes a lookup by id cheap instead of a full walk.

Compare

Where each engine writes a session

 Claude CodeCodex CLIGrok CLI
Root directory~/.claude/projects$CODEX_HOME/sessions$GROK_HOME/sessions
One session isOne .jsonl fileOne .jsonl rollout fileA directory of files
Grouped bySlugged project pathDate, as YYYY/MM/DDSlugged project path
Path from project + idDerivableNot derivable, resolve by idDerivable
Old sessionsLeft as plain .jsonlCompressed to .jsonl.zstLeft as plain files
Built-in indexNone, scan the treesession_index.jsonlsummary.json per session

Termdeck drives all three from one console, so the differences above stop being three separate habits to remember.

FAQ

Codex CLI session storage, answered

Why can I not find my Codex sessions by project name?

Codex files rollouts by date, not by working directory. The path contains the day the session started and a UUID, and nothing about the project, so a session is found by id or by scanning the dated tree.

What is a .jsonl.zst file in my Codex sessions folder?

It is an older rollout that Codex has compressed with zstandard. The content is the same line-delimited JSON, just compressed. Any reader that only looks for .jsonl will silently miss every archived session.

Can I move CODEX_HOME somewhere else?

Yes. Set the CODEX_HOME environment variable and Codex reads and writes there instead of the default. Move the existing directory with it or the previous history will look like it vanished.

Does the rollout include the working directory?

Yes, inside the file rather than in its path. That is how a tool can group rollouts by project even though the directory tree gives no hint.

Claude Code, Codex and Grok in one browser console

Read any session, from anywhere.