Nothing prunes ~/.codex/sessions, so it grows until a person deletes it — usually all of it, usually in a hurry.
Where this tool keeps its history
~/.codex/sessions/YYYY/MM/DD/rollout-*.jsonlNothing 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-*.jsonlCodex 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/sessionsBecause 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.
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/.
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 .