hopsesh guide · Codex
How to resume a Codex session on another machine
A Codex session is a rollout in ~/.codex/sessions with its folder written inside. How to copy one, the pitfalls, the desktop app’s hand-off, and the move in one step.
Where Codex keeps a session
Codex keeps its local state under CODEX_HOME, which is ~/.codex unless you set it, and that includes your sessions. Each one is an append-only JSON Lines rollout, filed by the date it started:
~/.codex/sessions/2026/10/27/rollout-2026-10-27T09-14-03-<id>.jsonl
The id at the end is the session’s UUID, the one codex resume takes. The first record holds the session’s metadata, its working directory (cwd) among it. After that come the messages, the shell commands and patches Codex ran, and its reasoning, stored encrypted. Codex also keeps indexes of its own beside the rollouts, such as session_index.jsonl with thread names, and SQLite databases. Archived sessions move to ~/.codex/archived_sessions/.
Unlike Claude Code, Codex doesn’t file a session under a folder named after the project, so the file’s place doesn’t depend on where the repository is. Its recorded cwd does.
How codex resume finds a session
codex resumeopens a picker of sessions from the current working directory.--allshows sessions from every directory, with a column for each one’s directory.codex resume --lastskips the picker and resumes the newest session from the current directory (with--all, from anywhere).codex resume <id>resumes one by its UUID or name.- When the current directory differs from the session’s saved one, Codex asks which to use.
tui.resume_cwd = "current"or"session"inconfig.tomlremembers the answer, and-C <dir>overrides both. - Sessions from
codex execshow up only with--include-non-interactive.
Resume a Codex session on another machine: the manual way
-
Move the code first. Commit and push on the old computer, then pull or clone on the new one. The rollout is the conversation, not the work.
-
Stop the session on the old computer, or the two copies drift apart from the moment you copy.
-
Find the rollout. On the old computer,
codex resume --allshows the session; its id is in the file name:find ~/.codex/sessions -name '*<id>.jsonl' -
Copy it into the same date folder on the new computer:
mkdir -p ~/.codex/sessions/2026/10/27 scp studio:.codex/sessions/2026/10/27/rollout-2026-10-27T09-14-03-<id>.jsonl ~/.codex/sessions/2026/10/27/ -
Resume it from the repository:
cd ~/git/app && codex resume <id>. When Codex asks which directory to use, choose the current one.
The pitfalls of copying a rollout
codex resume doesn’t list it
The picker and --last are scoped to the current directory, and the session’s recorded cwd is the old computer’s path. If your username or repository location differs, it won’t appear. Use codex resume --all, or resume it by id.
The history names the old computer’s paths
Choosing the current directory sets where Codex works from now on. The commands, patches and outputs already in the history still name /Users/kim/git/app from the old computer, and a model reading them can reach for paths that don’t exist here. Rewriting them by hand means editing JSON-escaped strings without touching ids, and on Windows the separators differ too.
The name doesn’t come along
A name you gave the thread with /rename is kept in Codex’s own index beside the rollouts, so a copied rollout can arrive without it. Rename it again on the new computer.
Different account, different reasoning
Codex’s reasoning is stored encrypted for the account that made it. If the other computer is signed in to another account, that part of the history can’t be used there.
Don’t copy the rest of ~/.codex
auth.json holds your login when Codex uses file-based credentials: sign in on each computer instead. The SQLite databases and indexes describe that computer’s own sessions; copying them over another computer’s mixes the two up.
The desktop app’s hand-off to an SSH host
The ChatGPT desktop app has an official way, for chats in the app: Hand off a chat between hosts. Connect the other computer under Settings › Connections as an SSH host, save a project for the same Git repository on it (the same subdirectory, if your project is one), then pick the destination in the chat footer and choose Hand off. Codex creates or reuses a worktree there, transfers the chat and its Git state, and switches the chat to that host; a running response is interrupted first. This computer hands it back.
It needs the desktop app on your side, a saved project on both, and it moves Codex chats only. Handing off to a Codex cloud environment isn’t supported.
Move a Codex session over SSH or Tailscale with hopsesh
hopsesh is a free, open-source command-line tool, terminal UI and app for macOS and Windows that moves Codex and Claude Code sessions between your computers. It finds them in Tailscale and ~/.ssh/config, connects only to the ones you allow, with your own ssh, and needs nothing on the other computer beyond an SSH server.
hopsesh hosts allow studio # let hopsesh connect to it
hopsesh trust studio # confirm its SSH host key
hopsesh ls --agent codex # Codex sessions everywhere, by repository
hopsesh plan studio:codex/7f3c2a1e # the plan; changes nothing
hopsesh pull studio:codex/7f3c2a1e --clone # bring it here
A title works in place of the id (studio:"fix flaky tests"). In the app, pick the session and choose Bring to this Mac…. hopsesh then:
- finds the repository here by its git remote, or clones it, and recreates the worktree if the session used one;
- brings the code to the session’s commit, straight from the other computer if it was never pushed, by fast-forward only;
- rewrites the paths in the rollout for this computer,
cwdand history alike, without touching ids or encrypted content, and lists any it couldn’t map; - leaves out the encrypted reasoning when the two computers are signed in to different accounts, whole, never edited;
- installs the rollout where Codex looks, and prints the
codex resumecommand.
The copy on the other computer keeps its title and, by default, refuses new prompts until you move the session back; Codex asks you once to approve hopsesh’s hook for that (/hooks). If the session is open here, --stop-local quits it first, between turns only, since Codex can’t stop gracefully mid-turn. hopsesh pull <id> with no computer name brings back the newest copy later, and hopsesh undo reverses a move on every computer it touched.
When the other computer runs hopsesh too, you can send from there instead: hopsesh receive on on the receiver, then hopsesh push 7f3c2a1e laptop on the sender.
The same commands also continue a Codex session in Claude Code (--in claude), move Claude Code sessions to another computer, and move a session to another folder with hopsesh cd (after moving a project folder).
hopsesh is alpha software. It has no server and no telemetry, and it never calls the OpenAI or Anthropic API. It is an independent project, not affiliated with OpenAI or Anthropic.
Moving Codex sessions
Where does Codex store sessions?
Under CODEX_HOME, which is ~/.codex unless you set it. Each session is a JSON Lines rollout in ~/.codex/sessions/YYYY/MM/DD/, named rollout-<time>-<id>.jsonl, with the working directory recorded in its first record. Archived sessions move to ~/.codex/archived_sessions.
Why doesn’t codex resume show a session I copied?
codex resume and codex resume --last only look at sessions from the current working directory, and a copied session still records the old computer’s path. Run codex resume --all to see every directory, or resume it by its id.
How do I resume a Codex session in a different folder?
Run codex resume <id> from the new folder and choose the current directory when Codex asks, or pass -C <dir>. The tui.resume_cwd setting in config.toml, "current" or "session", answers that question for you.
Can the Codex desktop app move a chat to another computer?
Yes, for chats in the ChatGPT desktop app: connect the computer as an SSH host, save a project for the same repository there, and choose Hand off in the chat footer. Codex moves the chat and its Git state into a worktree there. It doesn’t hand off to Codex cloud.
Should I copy auth.json to the other computer?
No. auth.json holds your login when Codex uses file-based credentials. Sign in on each computer instead. hopsesh never reads or copies it: logins, keys and account data stay on the computer they belong to.
Use the method
Try it with hopsesh
Open-source CLI and desktop app: move a Claude Code or Codex session to another computer, into the other agent, or to the cloud, with undo built in.
See everything hopsesh does →curl -fsSL https://raw.githubusercontent.com/roeehrl/hopsesh/main/scripts/install.sh | sh Checks the download against the release’s checksums.txt and its signature. hopsesh update installs later releases with the same checks.irm https://raw.githubusercontent.com/roeehrl/hopsesh/main/scripts/install.ps1 | iex Same checks as the macOS and Linux script. The Windows app installs this command as well.More ways to install
- Installer for Arm64 Windows 10 or 11 on Arm
- Portable .zip x64 or Arm64, no install, on the release page
- Command line only in PowerShell, without the app
irm https://raw.githubusercontent.com/roeehrl/hopsesh/main/scripts/install.ps1 | iex