How to delete Codex CLI sessions, and what you lose

they are rollout files under ~/.codex/sessions, one per session, and prompt history is a separate file

Codex writes each session to disk as it runs. The store is ${CODEX_HOME:-~/.codex}, and there are two separate things in it: the rollouts, which are the conversations, and history.jsonl, which is your prompts. Deleting one does not touch the other — that is the part people get wrong.

Before you delete ~/.codex/sessions: once a rollout file is removed, its replies and tool calls are gone from codex resume. Index them first with deja-vu to keep a compact local copy of every session; deja resume <id> --write-back, or R in deja's Deleted tab, writes a removed session back for codex resume.
$brew install deja-vu && deja index
$npx @vshulcz/deja-vu index
deja-vu on GitHubOther ways to install →

How to delete Codex sessions

Current Codex has a command for one session, codex delete <id>, and codex archive <id> to hide one without deleting it. Beyond that the sessions are files. The path is dated, so a day of work is a directory, and a rollout older than a week has been compressed to .jsonl.zst, which a pattern ending in .jsonl does not match.

# what is there, newest first
ls -t ~/.codex/sessions/*/*/*/rollout-*.jsonl* | head

# one session
rm ~/.codex/sessions/2026/09/15/rollout-*<id>.jsonl*

# one day
rm -rf ~/.codex/sessions/2026/09/15

# every session, including the ones Codex archived
rm -rf ~/.codex/sessions ~/.codex/archived_sessions

# your prompts, which the lines above do not touch
rm ~/.codex/history.jsonl

If CODEX_HOME is set, all of the above moves with it. Codex running inside Xcode keeps its own store under ~/Library/Developer/Xcode/CodingAssistant/codex, and deleting the CLI's sessions leaves that one intact.

Delete one session with deja

If deja is installed, run deja last and copy the session id. Preview the deletion, then run it from a terminal and confirm:

deja delete <id> --dry-run
deja delete <id>

The dry run lists the paths without removing them. After confirmation, deja removes those paths and forgets its own copy of the session. This cannot be undone. It also removes matching compressed rollouts and copies in archived_sessions. The shared prompt log, history.jsonl, stays. deja refuses deletion if a file or directory to be removed was written in the last 5 minutes; end the session and wait before deleting it.

What is in a rollout

JSON Lines, appended as the session runs. The first record is session_meta and carries the session id and the working directory; the rest are events whose payload holds a role and the content. Because the file is appended to while the session is live, the last line of an interrupted session can be torn — a reader has to tolerate that, and rm does not care either way.

It is plain text and it is verbatim: whatever a command printed into the conversation is in the file. Treat the directory the way you treat your shell history. The format registry documents every field.

What you lose

The rollouts are what any later search over your own work reads — including codex resume, which lists what is on disk. Delete them and the record of what the agent ran goes with them: the commands, their output, and the edits, none of which are recoverable from a summary.

deja indexes these files along with every other agent's on the machine, so a decision made in Codex answers a question asked in Claude Code or Cursor. A session it has already indexed stays searchable after you remove the rollout files by hand. Both deja forget and deja delete drop deja's copy on purpose. In the screen bare deja opens, a session whose rollout you removed by hand sits under the Deleted tab, and R writes it back so codex resume reopens it, with the conversation but not the tool calls. That is a reason to index before deleting, not a reason to keep gigabytes.

Reading and searching Codex history · Where every agent stores history · The same question for Claude Code · Giving Codex recall over the rest

Found this useful? Star deja-vu on GitHub.