Intermediate · 7 min read
Resume a Codex CLI session: picker, ID, --last and --all
Find the right saved Codex CLI conversation, recover it by ID or directory, and verify your current checkout before continuing work.
Interactive CLI recovery, checked in native Windows Codex CLI 0.163.0 on November 5, 2026, using a controlled conversation. Syntax and behavior can differ in another release. Desktop chat navigation is a separate interface.
Restore the intended conversation, then check your directory and Git state. Conversation history is not a file backup or an automatic branch checkout.
Choose a conversation instead of guessing a flag
Run codex resume from the intended project directory to open the picker. Select the matching conversation and press Enter. In our native Windows trial, the picker found the saved test conversation and selecting it loaded its earlier messages.
The commands below are alternatives. Replace SESSION_ID with the identifier printed when your own CLI exits. The current CLI also accepts a session name, but an exact ID avoids ambiguity between similar titles.
CLI 0.163.0 rejected codex --continue and codex --resume as unexpected arguments. Use the resume subcommand without a leading double dash. Check your installed version’s help when a searched command does not match it.
| Need | Command | Selection |
|---|---|---|
| Choose interactively | codex resume | Picker filtered to the current directory by default |
| Know the conversation | codex resume SESSION_ID | The specified saved conversation |
| Latest in this directory | codex resume --last | Latest eligible session in the current directory |
| Find one from another directory | codex resume --all | Picker without the directory filter |
| Global latest | codex resume --last --all | Latest eligible session across directories; confirm it is the intended one |
codex --version
codex resume --helpReference: OpenAI: Codex CLI commands · Codex Pets: native session recovery checks
Recover by ID and check the restored context
Use the continuation command printed when your session exits if you kept it. Read the restored conversation before requesting a change. Confirm the objective, last verified result and next action are the ones you expected.
Our ID recovery test correctly returned a marker from the earlier user message without including that marker in the recovery request. This verifies restored context in the tested client; it does not establish that the working files still match the conversation.
codex resume SESSION_IDReference: OpenAI: Codex CLI commands · Codex Pets: native session recovery checks
An empty picker can be a directory filter
The controlled conversation appeared in its original directory but not in a second empty directory with the default Cwd filter. With --all, it became findable across directories. An empty filtered list does not prove deletion.
Search for the known title and check the filter. Distinguish active from archived conversations if your picker exposes those controls. Different OS users, CODEX_HOME settings, native Windows and WSL can have separate histories. --all removes a directory filter; it does not merge every user or machine’s history.
For sessions created by non-interactive codex exec, this client’s help offers --include-non-interactive. The separate codex exec resume command continues non-interactive work. Those branches were not exercised in our interactive trial; consult their current help rather than assuming identical behavior.
codex resume --allReference: OpenAI: Codex CLI commands · Codex Pets: native session recovery checks
Reconcile the working directory and Git state
OpenAI documents a directory-choice prompt when the caller’s directory differs from the saved session. An explicit -C/--cd override takes precedence over tui.resume_cwd. Choose deliberately: a conversation title is not proof of the shell’s current directory.
Check the actual path, branch, changed files and last verified checkpoint before editing. Resume does not check out the original Git branch, revert intervening changes or restore deleted files. Reconcile changes made by another task first.
Use Get-Location in PowerShell or pwd in a Unix shell to inspect your directory. The commands below inspect Git. If the directory is not a Git repository, keep that result explicit; do not initialize or reset it as a recovery shortcut.
git status --short --branch
git diff --statReference: OpenAI: Codex CLI commands · Git: git status
Handle a missing ID or an active-session lock
Our nonexistent-ID trial stopped with No saved session found and directed us to the picker. Recheck the ID and the user/home/environment where the conversation was created. Do not delete your history, credentials or configuration to silence the error.
A resumed conversation may report that it is open in another app. We encountered that protection during native checks. Finish or close that same conversation in its other active client, then use the offered retry. We did not verify that every lock clears immediately when a client closes. Do not remove lock files or force a second writer into the conversation.
If recovery remains unavailable, use a separate conversation with a reviewed handoff and inspect the existing files. Keep history loss distinct from file loss. Sign-in and tool failures require their own diagnosis.
Reference: OpenAI: Codex CLI commands · Codex Pets: native session recovery checks
Try it in Codex
Check a restored session before editing
We are continuing a saved Codex session. Before editing, summarize the objective, last verified result and next unfinished action from the restored conversation. Inspect the actual working directory, Git branch, status and relevant existing handoff. Do not read credentials or unrelated private files. Explain mismatches between history and current files. Propose one safe next step with its verification. Do not reset, clean, switch branches, delete history, install, commit, push or deploy.Read the prompt before sending it. Copying does not run it.
Check your result
- The restored transcript is the intended conversation, not merely the newest one.
- The actual directory, branch and changed files have been checked.
- Current evidence supports the last completed claim, or its gap is stated.
- An active-session lock is respected; there is one writer.
- The next action is reconciled with the current files before editing.
Sources and scope
The references below distinguish documented behavior from our dated practical checks. Task prompts and completion checks are community guidance; each source states what it supports.
- OpenAI: Codex CLI commandsResume, directory filtering, latest-session selection and documented working-directory behavior; check options against your installed CLI.
- Codex Pets: native session recovery checksWindows CLI 0.163.0 picker, ID/context recovery, directory filters, missing-ID rejection and the observed active-session lock; not every release or non-interactive recovery.
- Git: git statusInspecting the current branch and working tree independently of restored conversation history.
Something changed in your version? Send a correction with the guide URL, platform, and version. Leave out credentials and private project content.