Kipt

Your prompts and skills, one keystroke away.

Explore

Codex resume: continue, fork, archive and find Codex sessions

Codex resume explained from OpenAI's docs: codex resume --last, the session picker, forking, codex exec resume, archiving, and where Codex stores transcripts.

By the Kipt team · Updated 26 October 2026

How do you resume a session in Codex?

Run codex resume to pick a saved chat from a list, or codex resume --last to jump straight back into the most recent chat from the current folder. Inside a running session, /resume opens the same picker and reloads the chat's transcript so you can pick up where you left off.

Codex saves every interactive session on your machine, so closing the terminal does not lose your work. This guide covers the commands OpenAI documents for resuming, forking, renaming, archiving and deleting sessions in the Codex CLI, as of 26 October 2026. Everything comes from the Codex command line reference unless another link says otherwise. New to Codex? Start with Codex for beginners or the Codex CLI guide.

What does codex resume do?

codex resume continues an interactive session by ID or reopens the most recent chat. With no arguments it opens a picker of saved sessions.

# open the session picker
codex resume

# reopen the most recent chat from this folder
codex resume --last

# most recent chat from any folder
codex resume --last --all

# a specific session
codex resume <SESSION_ID>

The options, as the reference describes them:

Option What it does
--last Skip the picker and resume the most recent chat from the current working directory
--all Include sessions outside the current working directory
--include-non-interactive Include codex exec sessions in the picker and in --last
SESSION_ID Resume that specific session

Two details catch people out. First, --last is scoped to your current folder unless you add --all, so running it from your home directory will not find a chat you started inside a repo. Second, the reference says codex resume accepts model and sandbox overrides, but not --worktree.

# resume with a different model and a read-only sandbox
codex resume --last -m gpt-6.1-sol --sandbox read-only

If the folder you are in differs from the session's saved folder, Codex asks which one to use. Set tui.resume_cwd to "current" or "session" in config.toml to skip that question, and note that an explicit --cd (-C) flag wins over the setting. The Codex config guide covers where that file lives.

# ~/.codex/config.toml
[tui]
resume_cwd = "session"

How do you fork a Codex session?

Forking copies a chat into a new chat with a fresh ID and leaves the original transcript untouched. It is the safe way to try a second approach without overwriting the first.

There are three ways to fork:

  • From the shell: codex fork opens the session picker. Add --last to fork your most recent session, --all to see sessions from other folders, or pass a session ID.
  • Inside a session: /fork forks the current chat into a new chat. If Codex offers a checkout choice, you can pick the current directory or a new worktree.
  • From an earlier message: press Escape twice with an empty composer to edit your previous message and fork the chat from that point.
# fork the most recent session
codex fork --last

# fork a specific session into a managed Git worktree
codex fork <SESSION_ID> --worktree

The --worktree form needs an explicit session ID and local execution, and it does not work with --last or the picker. A worktree gives the fork its own checkout, so the two attempts do not edit the same files. When the current and saved folders differ, codex fork asks the same folder question as resume.

How do you resume codex exec runs?

Non-interactive runs are sessions too. The non-interactive mode docs show a two-stage pipeline:

codex exec "review the change for race conditions"
codex exec resume --last "fix the race conditions you found"

codex exec resume takes --last, --all or a session ID, plus an optional follow-up prompt that is sent right after resuming. To branch an exec session instead, codex exec fork <SESSION_ID> [PROMPT] copies it into a new session.

If you do not want a run saved at all, add --ephemeral, which runs "without persisting session rollout files to disk." That suits CI jobs on shared machines. The codex exec guide covers the rest of scripted use.

Remember that exec sessions are hidden from the interactive picker by default. Use codex resume --include-non-interactive when you want to open one in the terminal UI.

How do you rename, archive and delete sessions?

Long-running projects pile up sessions. Codex gives you commands to keep the picker tidy:

Command What it does
/rename Rename the current chat without changing its transcript
/archive Archive the current session; the transcript is kept
codex archive <SESSION> Archive a saved session by ID or name from the shell
codex unarchive <SESSION> Restore an archived session
/delete Permanently delete the current session
codex delete <SESSION> Permanently delete a saved session by ID or name
codex queue --thread <SESSION> --message "..." Queue a text message for an existing session by UUID or exact name

Archiving removes a session from active lists "without deleting the transcript." If a turn is running, confirming /archive stops that turn first.

Deleting is permanent. The reference says /delete "permanently deletes the transcript and spawned descendant sessions," and it is not available while a chat is running or inside a side chat. codex delete --force skips the prompt, but only when you pass a UUID; names still need interactive confirmation. When a session ID and a session name could both match, the ID wins.

Naming sessions with /rename pays off here, because archive, delete and queue all accept a name instead of a UUID.

Where does Codex store session history and transcripts?

Codex keeps its local state under CODEX_HOME, which defaults to ~/.codex. These are the default paths and where OpenAI documents each one:

Path Contents Source
~/.codex/sessions Session transcripts Troubleshooting
~/.codex/archived_sessions Archived sessions Troubleshooting
~/.codex/history.jsonl History file, if history persistence is enabled Advanced config

The advanced config page says "By default, Codex saves local session transcripts under CODEX_HOME." Two settings control the history file. history.persistence accepts save-all or none, and history.max_bytes caps the file size by dropping the oldest entries. OpenAI's docs show each one on its own; use one or the other:

# ~/.codex/config.toml, option 1: turn history persistence off
[history]
persistence = "none"

# option 2 (instead): keep history but cap the file, here at the docs' 100 MiB example
# [history]
# max_bytes = 104857600

If you set the CODEX_HOME environment variable to move all of this, the environment variables page notes that the directory must already exist.

Treat these files as sensitive. They hold your prompts, file contents and command output, and OpenAI's advice for logs applies here too: "If you share logs, review them first to confirm they don't contain sensitive information."

How do sessions fit with /new, /side and /compact?

Several commands change the chat without resuming or forking. Knowing which one you want avoids losing context by accident:

Command Effect on the session
/new Start a new chat inside the same CLI session
/clear Clear the terminal and start a fresh chat
/side or /btw Start an ephemeral side chat whose transcript is separate from the parent
/compact Summarize the visible chat to free tokens
/recap Generate a summary of the current conversation
/status Display session configuration and token usage
/import Import Claude Code or Cursor setup, projects and chats

A practical pattern: use /side for a quick question that should not clutter the main chat, /compact when a long session nears its context limit, and /new when you switch to unrelated work. The old chat stays in the picker, so you can /resume it later. Ctrl+R searches your prompt history if you only need an earlier prompt rather than the whole chat.

The full list is in the Codex slash commands guide.

Do sessions carry over to the Codex app and cloud?

The commands above are for the CLI. The ChatGPT desktop app has its own chat list; if chats seem to be missing there, the troubleshooting page says to select the filter icon next to Chats and choose Chronological, and archived chats are in Settings.

Codex cloud tasks are separate again. The Codex CLI page describes launching a cloud chat and returning to the terminal later, and codex cloud browses those tasks. See the Codex cloud guide for that workflow.

Tips for working with Codex sessions

  • Resume from the same folder. Most "missing session" problems come from running --last in a different directory. Add --all when in doubt.
  • Fork before risky changes. A fork into a worktree lets you compare two approaches without stashing.
  • Name important sessions. /rename makes codex archive, codex delete and codex queue easier, since they accept names.
  • Archive instead of delete. Archiving keeps the transcript and is reversible with codex unarchive.
  • Use --ephemeral in CI. It keeps rollout files off shared runners.
  • Make a Git checkpoint. Resuming reloads the conversation, and your files may have changed since. Commit or stash first so the next diff shows only what Codex changes.

Keep the useful parts of a session

A transcript records one conversation; the prompt that made it work is worth keeping separately. Kipt keeps prompts and Agent Skills as Markdown in a private GitHub repo you own, and installs your skills into Codex with one npx skills add command. If a prompt from an old session keeps paying off, the free SKILL.md generator turns it into a skill folder for .agents/skills.

Questions

How do I resume my last Codex session?

Run codex resume --last in the same folder you worked in. It skips the picker and reopens the most recent chat from the current working directory. Add --all if the session started in a different folder.

Where does Codex store session transcripts?

OpenAI's troubleshooting page lists session transcripts under $CODEX_HOME/sessions, which is ~/.codex/sessions by default, and archived sessions under $CODEX_HOME/archived_sessions. Review the files before you share them, because they can contain code and secrets from your work.

What is the difference between resume and fork in Codex?

Resume continues the same saved chat, so new turns are added to its transcript. Fork copies a chat into a new one with a fresh ID and leaves the original transcript untouched. Use fork when you want to try a different approach without losing the first one.

Why is my session missing from the codex resume picker?

The picker and --last are scoped to the current working directory, and non-interactive codex exec runs are left out. Add --all to include other folders, or --include-non-interactive to include exec runs. Archived sessions also leave the list until you run codex unarchive.

Can I resume a codex exec run in a script?

Yes. codex exec resume --last continues the most recent exec session from the current folder, and codex exec resume <SESSION_ID> targets a specific one. You can add a follow-up prompt after either form, such as a request to fix what the first run found.

How do I stop Codex from saving my sessions?

For a single scripted run, add --ephemeral to codex exec so it does not persist session rollout files to disk. For interactive history, set persistence = "none" in the [history] table of config.toml. history.max_bytes caps the history file size instead of turning it off.

More in Codex

All guides

Keep your prompts and skills in one place, in your own GitHub. Install every skill with one command.

Get started

Kipt is an independent product, not affiliated with or endorsed by Anthropic, OpenAI, Cursor or GitHub. Claude, ChatGPT, Codex, Cursor and GitHub are trademarks of their owners.