← All tools

PromptWake for Codex CLI

Codex writes the most complete transcript of any tool in this category — and writes it to one laptop, in a directory that grows without limit until someone deletes it. PromptWake keeps it somewhere that survives the cleanup.

How Codex CLI loses history

Nothing prunes ~/.codex/sessions, so it grows until a person deletes it — usually all of it, usually in a hurry.

~/.codex/sessions/YYYY/MM/DD/rollout-*.jsonl
Format
JSONL rollout files, partitioned by date
Contents
Prompts, responses, tool calls and their results
Retention
None — it grows until deleted by hand
Index
session_index.jsonl plus a state_N.sqlite thread table
What PromptWake captures
  • Every prompt and response from each rollout file
  • The patches Codex applied, as file diffs
  • Session, project and timestamp, so the timeline is chronological
  • A copy that is unaffected by the sessions directory being cleaned up

Codex deserves credit here: saving is always on, the transcripts are plain text, they include tool calls and their results, and nothing deletes them on a timer. As an on-disk record it is the best of the group.

find ~/.codex/sessions -name 'rollout-*.jsonl' | wc -l
du -sh ~/.codex/sessions

Which makes the failure mode a human one

Because nothing prunes it, the directory grows for as long as you use the tool. Eventually someone needs disk, finds a large directory in their home folder full of files with machine-generated names, and removes it. That is how Codex histories are lost — not to a policy, to a Sunday afternoon.

The second, quieter loss is a new laptop. The sessions live in your home directory; a fresh machine starts empty and nothing carries the archive across.

The SQLite index is worth knowing about

Recent Codex builds keep a thread index in the same directory, and its schema records more than the transcripts do — the rollout path, working directory, title, first user message, model, tokens used, and the git branch, commit and origin the session happened on.

sqlite3 -readonly ~/.codex/state_5.sqlite ".schema threads"

That branch-and-commit link is exactly the join a provenance question needs. It is also an index rather than the record: what you keep is whatever is still in sessions/.

What PromptWake does with Codex specifically

The daemon reads the rollout files as they are written, turns each turn into prompt, response and the diff of the patch that was applied, and stores it outside ~/.codex. Delete the sessions directory afterwards and the timeline is still there — which, given that deleting it is the normal way this history ends, is the entire point.

npx promptwake doctor
npx promptwake init .

When it matters

Deeper on where Codex CLI keeps its history, and how to back it up without PromptWake: read the guide.