Codex session history: where it lives and how to reopen a chat
Codex keeps its local state, sessions included, under CODEX_HOME, which is
~/.codex unless you set it to another folder. To get a chat back, run
codex resume and choose it from the session picker, or run
codex resume --last to skip the picker and reopen the most recent chat from the folder
you are in.
What is in ~/.codex
Codex's environment variables page, read on October 19, 2026, calls CODEX_HOME the
root for Codex state: config, auth, logs, sessions and skills. The CLI, the IDE extension and the
app server all use it. If you point it at another folder, that folder has to exist first.
Codex's advanced configuration page names the files you may see there:
config.toml, your settings.auth.json, when credentials are kept in a file instead of the system keychain.history.jsonl, when history persistence is on, which it is by default.- Logs, caches and other per-user state.
Some resumable state is kept in a SQLite database. It sits in CODEX_HOME too,
unless CODEX_SQLITE_HOME or the sqlite_home key moves it.
What the docs leave out
Blog posts and scripts describe a folder layout for single sessions inside
~/.codex. Codex's documentation does not describe that layout or the format of the
files in it, so this page does not either, and a script built on it can break with any release.
For a copy you can read, open the chat in Codex and type /export session.md. Codex
writes the whole conversation to that file as Markdown. Wait for the current turn to finish first.
Reopen a chat
Codex's developer commands page, read the same night, gives these ways back in:
codex resumeopens the picker of saved interactive sessions.codex resume --lastskips the picker and reopens the most recent chat from the current folder. Add--allto pick the most recent one from any folder.codex resume <SESSION_ID>opens one session by its ID or its name./resume, typed inside a chat, opens the same saved-session picker.
Runs you started with codex exec are left out of the picker and out of
--last unless you add --include-non-interactive. They also have their own
codex exec resume.
A resumed chat reloads its transcript and the original history stays intact. If you are now in a
different folder from the one the session ran in, Codex asks which folder to use. Set
tui.resume_cwd to "current" or "session" in
config.toml to stop the question. An explicit --cd still wins over it.
Give the chats you will want a name
Type /rename and a short name, say /rename billing-retry. Only the saved
name changes; the transcript does not. That name works with codex resume,
codex archive and codex delete, so next week you type a word instead of
hunting for an ID.
Find a prompt you typed
Press Ctrl+R in the composer to search your prompt history. Enter uses
the match and Esc cancels. The up and down arrows bring back earlier drafts. This
searches what you typed, not what Codex answered. For an answer, resume the chat or export it.
Branch, hide or delete a session
codex forkopens the picker and copies the session you choose into a new chat with a fresh ID.codex fork --lasttakes the most recent one, and/forkcopies the chat you are in. The original transcript is left alone.codex archive <SESSION>, or/archiveinside the chat, hides a session from the active lists and keeps its transcript.codex unarchivebrings it back.codex delete <SESSION>, or/delete, removes the transcript for good./deletealso removes sessions that chat spawned.--forceskips the confirmation only when you give the session's UUID. A name always asks first.
How long Codex keeps it
The docs give no number of days. They give two keys in the [history] table of
config.toml. persistence takes save-all or
none, and this turns saving off:
[history]
persistence = "none"
max_bytes caps the size of the history file. Once the file passes the cap, Codex
drops the oldest entries and keeps the newest. The docs' own example is 100 MiB:
[history]
max_bytes = 104857600
Before you lower the cap or turn saving off, export the chats you still need.
Which of these is your situation
- Yesterday's chat, same repo.
codex resume --last. - The chat ran in another folder. Run
codex resumefrom that folder, orcodex resume --last --all. - You remember the prompt, not the chat.
Ctrl+R. - The picker is cluttered.
codex archivethe old ones. - You want a copy to read or share.
/export session.md. - You do not want transcripts kept.
persistence = "none".
What the transcript is not
A Codex transcript records the conversation. The code is somewhere else: the files Codex changed
are in your project folder, and git status and git diff show them whether
or not anything was committed. Reading a run in a useful order is in
how to review what Codex changed, and putting files
back is in how to undo Codex changes.
The transcript also stays inside Codex. Claude Code and Cursor cannot resume it. To move the task, carry the task itself: a short note with what you asked for, what is done and the next step, or Continue on the BuildGist card when you start a new chat in the same project. What moves and what stays is in can you resume a coding agent session in a different tool?
BuildGist explains each meaningful Claude Code, Cursor and Codex run in plain English and puts the explanation in your Inbox. It comes from the run's changes, not from the chat. It is written by AI, so check important behavior against the code and tests.
Sources
- Codex environment variables, checked October 19, 2026.
- Codex advanced configuration, checked October 19, 2026.
- Codex configuration reference, checked October 19, 2026.
- Codex developer commands, checked October 19, 2026.
What you need
- A Mac with Apple silicon and macOS 12 or later.
- Claude Code, Cursor or Codex.
- A Git project. No commit, push, remote or GitHub repository is needed.
- A GitHub account, to sign in. BuildGist does not access your GitHub repositories.
Codex needs you to approve BuildGist once, in Codex. BuildGist shows the steps. Setup is in Getting started.
To explain a run, your computer sends BuildGist what that run needs, and BuildGist passes it to Anthropic. BuildGist does not keep this material. It does not send your whole repository, files the run did not change, or files named like secrets, such as .env files and keys. It keeps the explanation and short cited excerpts of changed code, at most 12 lines each. Secret masking is best-effort. Privacy has the full list.
Every account gets 7 days of BuildGist Pro free, with no card. The 7 days start at your first explanation or Continue handoff. Nobody is charged when the trial ends. After that, BuildGist Pro is $12 per month, plus any applicable tax shown at checkout. See pricing.
Try BuildGist Download for Mac
Apple silicon, macOS 12 or later. United States, 18 or older.
Related
- What did Claude Code change?
- Switch from Claude Code to Codex
- Understand code an agent wrote
- Hand off Claude Code to Cursor
- Review what Codex changed
- You’ve hit your session limit in Claude Code
- You’ve hit your usage limit in Codex
- Keep context across agents
- Review AI code before merging
- BuildGist or the git diff
- Claude Code session history
- Undo Claude Code changes
- BuildGist vs CLAUDE.md, AGENTS.md and HANDOFF.md
- Keep context from Claude Code to Cursor
- Resume an agent session in another tool
- BuildGist vs Conductor
- Codex context window full
- Undo Codex changes
- Cursor usage limit reached
- Review Cursor agent changes
- Your conversation is too long in Cursor
- One default coding agent, or two?
- Tools that summarize agent sessions
- Switch from Codex to Claude Code
- Move from Cursor to Claude Code
- Switch from GitHub Copilot to Claude Code
- Move from Windsurf to Cursor
- Switch from Gemini CLI to Claude Code
- Coding agent crashed mid-task
- Claude Code lost context after compacting
- What commands did the agent run?
- Turn an agent session into a PR description
- Which coding agents read AGENTS.md?
Questions: kayvanandre@gmail.com.