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.

How to delete Codex sessions

There is no command; the sessions are files. The path is dated, so a day of work is a directory.

# 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
rm -rf ~/.codex/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.

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 the file goes; only deja forget drops one on purpose. That is a reason to index before deleting, not a reason to keep gigabytes.

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.