Short answer
To resume a Codex CLI session, run codex resume --last for the newest chat in this folder, codex resume for the picker, or codex resume <id>. Sessions are saved under ~/.codex/sessions/. Tested on Codex CLI 0.159.0. Claude Code uses claude --continue or claude --resume instead.
How do I resume a Codex session?
OpenAI's CLI reference lists codex resume as the way to continue an interactive session. We also ran codex resume --help and codex exec resume --help on Codex CLI 0.159.0 to be sure. Use these:
| Command | What it does |
|---|---|
codex resume | Opens the session picker for this working directory |
codex resume --last | Skips the picker and reopens the newest session here |
codex resume --all | Same picker, but across every folder (shows a CWD column) |
codex resume <SESSION_ID> | Resumes one session by UUID or by name (UUID wins if both match) |
codex resume --include-non-interactive | Also lists sessions started with codex exec |
codex resume --last "next step" | Resumes the newest session and sends a follow-up prompt |
/resume inside the TUI | Opens the same picker without leaving Codex |
codex fork / codex fork --last | Copies a session into a new chat, leaves the original alone |
codex resume --last only looks in the current working directory unless you add --all. If the folder you're in differs from the folder the session saved, Codex asks which directory to use. You can set tui.resume_cwd to "current" or "session" in config to skip that prompt. An explicit --cd / -C wins over that setting.
Before codex resume shipped, people scraped the latest rollout file by hand. Ian Nuttall's codex_continue tip (crediting @fcoury) is the pattern that post describes. Prefer the built-in command now.
Where Codex stores session history
On this machine, Codex CLI 0.159.0 writes one JSONL rollout file per session under ~/.codex/sessions/YYYY/MM/DD/, named like rollout-….jsonl. If you set CODEX_HOME, look under that directory instead of ~/.codex. OpenAI's public CLI reference doesn't spell the path out. That layout is just what we found on disk.
That file is the chat: your prompts, the model's replies, tool calls and outputs. Resume reloads it. Delete the file (or run codex delete on the session) and you lose that transcript.
Archiving is different from deleting. codex archive <SESSION> hides a session from the active list and keeps the transcript. codex unarchive <SESSION> brings it back. codex delete <SESSION> removes the transcript for good.
Resume a non-interactive `codex exec` run
Scripted runs use codex exec (alias codex e). To continue one, OpenAI's reference and local help both show a resume subcommand:
Add --include-non-interactive on the interactive codex resume picker if you want those exec sessions listed there too.
tmux reattach vs Codex resume: two different jobs
People mix these up.
tmux keeps a live process going through a closed terminal or a dropped SSH connection. You reattach with tmux attach -t NAME and the same Codex process is still there, mid-turn if it was mid-turn. The tmux cheat sheet has the keys.
codex resume reloads a saved chat after the Codex process has exited. New process, same transcript.
On a laptop that sleeps, neither helps while the machine is asleep. Sleep suspends everything. For work that has to keep going with the lid shut, put the CLI inside tmux on a computer that stays on. The 24/7 Claude Code guide and the Codex cloud vs own computer guide cover that choice.
How do I resume a Claude Code session?
Claude Code uses its own flags. Anthropic's sessions docs are the source, and we checked them on Claude Code 2.1.265:
| Command | What it does |
|---|---|
claude --continue | Reopens the most recent conversation in the current directory |
claude --resume | Opens the session picker |
claude --resume <name-or-id> | Resumes that named session or session ID |
claude --resume /absolute/path/to/file.jsonl | Resumes from a transcript file path |
/resume inside a session | Switches to another conversation from the picker |
Claude Code stores transcripts as JSONL under ~/.claude/projects/<project-dir>/, where the project directory name is your working path with non-alphanumeric characters replaced by -. The default retention is 30 days (cleanupPeriodDays in settings.json). Change that setting if you need it longer.
A resumed Claude Code session restores conversation history, and in several launch paths it also restores model, agent, permission mode, active goals and unexpired scheduled tasks. Background Bash and monitor tasks aren't restored. Anthropic's docs spell out the permission-mode cases by how you resume; pass --permission-mode or --dangerously-skip-permissions when you want to override.
This page doesn't try to outrank Anthropic on "claude code resume". Use their docs for edge cases. The Codex half is the gap this guide fills.
What Hivra does with resume
On a paid Hivra plan the computer stays on and keeps your files, sessions and login. A Claude Code or Codex run you start inside tmux in the computer's Terminal tab keeps going after you close the laptop. On Claude Code, work you send through Telegram, connected in the agent's Telegram tab, runs on the computer, not in your browser.
Hivra's browser chat for Claude Code and Codex resumes a stored session id when you send the next message. In the provisioner code that spawn path uses codex exec resume <sessionId> … for Codex and claude --resume <sessionId> for Claude Code (see dashboard/provisioner/hivra-chat/server.js). That's how the chat process is started again. It isn't a tested claim that every browser reconnect restores the full transcript you saw before you left.
We haven't verified that CLI session history and tmux sessions survive a closed laptop plus a browser reconnect on a served Hivra computer end to end. So this page does not claim that. What we do state is the line above: the computer stays on and keeps files, sessions and login on a paid plan, and a run you start inside tmux in the Terminal tab keeps going after you close the laptop.
Hivra does not promise backups of your sessions. Export JSON and shared account memory exist for Claude Code and Codex computers only.
Paid plans start at $9.99 a month for 2 vCPU and 4 GB of RAM, stay on without being paused for inactivity, and come with a 7-day money-back guarantee on card payments. The $19.99 plan is 4 vCPU and 8 GB of RAM. Launch Codex from the Codex agent page or Claude Code from the Claude Code agent page. Hivra is independent and is not affiliated with OpenAI or Anthropic.
Common questions
How do I resume the most recent Codex session?
Run codex resume --last in the same working directory. That skips the picker. Add --all if the session you want might live in another folder. Tested on Codex CLI 0.159.0.
Where does Codex store sessions?
On this machine with Codex CLI 0.159.0, under ~/.codex/sessions/YYYY/MM/DD/ as rollout-*.jsonl files (or under $CODEX_HOME/sessions/ if CODEX_HOME is set). OpenAI's public CLI reference doesn't print that path. We found it on disk.
What is the difference between tmux attach and codex resume?
tmux attach rejoins a process that is still running. codex resume starts Codex again and reloads a saved transcript after the process has exited. Use both when you want a long run that survives disconnects and a way back after you quit.
How do I resume a Codex exec session?
Use codex exec resume --last "follow-up prompt", or pass a session id: codex exec resume <SESSION_ID> "follow-up". Add --all with --last to search outside the current directory.
How do I resume a Claude Code session?
claude --continue reopens the most recent chat in this directory. claude --resume opens the picker, and claude --resume <name-or-id> jumps straight to one session. Anthropic's sessions docs are the full reference. We checked on Claude Code 2.1.265.
How long does Claude Code keep session history?
Anthropic's sessions docs say the default cleanupPeriodDays is 30. Change that in settings.json if you need a different window. Codex retention on disk follows whatever you leave under ~/.codex/sessions/ until you archive or delete.
Does a Hivra computer keep my Codex sessions when I close the laptop?
On a paid Hivra plan the computer stays on and keeps your files, sessions and login. A Claude Code or Codex run you start inside tmux in the computer's Terminal tab keeps going after you close the laptop. On Claude Code, work you send through Telegram, connected in the agent's Telegram tab, runs on the computer, not in your browser. We haven't published a measured test of session history across a browser reconnect, so treat that as untested. Hivra does not promise session backups.
Can I resume Codex from another device?
The CLI resume commands read session files on the machine where Codex ran. To continue from another device, that device needs access to the same machine (SSH, a cloud desktop, or a Hivra computer you open in the browser) and the same ~/.codex data. Codex cloud is a different product path; see the Codex 24/7 guide for when OpenAI's cloud is enough.
Is Hivra affiliated with OpenAI or Anthropic?
No. Hivra is independent and is not affiliated with OpenAI or Anthropic. You sign in with your own ChatGPT or Claude account on the computer.