Shabash
Blog · Claude Code guides

Codex CLI: how to resume a session and where your history is stored

Every way to resume an OpenAI Codex CLI session, where Codex keeps transcripts and prompt history, how long they last, and how to search them.

By Robin Mehta · September 25, 2026

Codex CLI keeps every session on your machine and can pick any of them back up. Here's how, checked against the Codex docs and source code as of September 2026 (release rust-v0.157.0).

Resuming

codex resume            # pick from a list
codex resume --last     # most recent session in this folder
codex resume --all      # include sessions from every folder
codex resume <id>       # a specific session, by ID or name

If you resume a session from a different folder than it started in, Codex asks which folder to use. Set tui.resume_cwd to "current" or "session" to stop it asking.

Two related commands:

Where history is stored

WhatWhere
Full session transcripts ("rollouts")~/.codex/sessions/YYYY/MM/DD/rollout-<date>-<uuid>.jsonl
Archived sessions~/.codex/archived_sessions/
Your prompts, across all sessions~/.codex/history.jsonl

Set CODEX_HOME to move all of it somewhere else.

One thing the docs get wrong: the commands page says transcripts are kept in "history.jsonl format." The source code shows history.jsonl holds only your prompts (session ID, timestamp, text). The full transcripts are the rollout files.

How long it lasts

We found no automatic deletion of sessions in Codex. Archiving moves a rollout to archived_sessions rather than removing it. Recent source code adds background compression of rollouts older than seven days (to .jsonl.zst, still readable by Codex) when compression is enabled. We couldn't confirm which release turned it on by default.

For prompt history, history.persistence = "none" stops saving it, and history.max_bytes caps its size by dropping the oldest entries.

Searching your Codex history

There's no official search command we could verify, but the files are plain JSON lines:

rg -l "rate limit" ~/.codex/sessions --glob '*.jsonl'

and for prompts, with dates:

python3 - "rate limit" <<'EOF'
import json, sys, datetime, os
term = sys.argv[1].lower()
for line in open(os.path.expanduser("~/.codex/history.jsonl")):
    d = json.loads(line)
    if term in d.get("text", "").lower():
        print(datetime.datetime.fromtimestamp(d["ts"]).strftime("%Y-%m-%d"), d["session_id"][:8], d["text"][:100])
EOF

Moving a session to another machine

Not officially documented. Copying the rollout file into the same date folder under ~/.codex/sessions on the other machine and running codex resume <id> is the likely route, but treat it as an experiment.

If you use Claude Code too, the equivalent guides are resuming a Claude Code session and where Claude Code stores history. Shabash organizes Claude Code work into threads today; support for Codex sessions is on the roadmap.

Questions

How do I resume a Codex CLI session?

Run codex resume to pick from a list, codex resume --last for the most recent session in the current folder, or codex resume <session-id> for a specific one. Add --all to include sessions from other folders.

Where does Codex CLI store session history?

Full transcripts are in ~/.codex/sessions/YYYY/MM/DD/, one rollout-...jsonl file per session. Your prompts are also kept in ~/.codex/history.jsonl.

Does Codex delete old sessions?

We found no automatic deletion. Archived sessions move to ~/.codex/archived_sessions/, and newer versions can compress older rollouts, which Codex still reads.

How do I stop Codex saving prompt history?

Set history.persistence = "none" in your Codex config. history.max_bytes caps the file size by dropping the oldest entries.