You might want to copy a Codex session to another machine to continue a conversation started on one device, such as moving from a laptop to a desktop or server.
Each Codex chat is stored as a single .jsonl file under ~/.codex/sessions/.
1. Locate the session file
Sessions are organized by date:
~/.codex/sessions/YYYY/MM/DD/
Example:
rollout-2025-12-16T08-52-19-019b2813-b881-7813-afe8-bf072950e53b.jsonl
The long ID at the end uniquely identifies the chat.
2. Copy the session to the other machine
Copy only that file using scp. Make sure to create the destination directory on the remote machine first:
ssh sshhost "mkdir -p ~/.codex/sessions/2025/12/16"
scp ~/.codex/sessions/2025/12/16/rollout-2025-12-16T08-52-19-019b2813-b881-7813-afe8-bf072950e53b.jsonl \
sshhost:~/.codex/sessions/2025/12/16/3. Resume the Codex chat after transfer
Once Codex is running on the destination machine:
Open Codex CLI.
Run:
/resumeSelect the transferred session from the list.
Continue the conversation from the last message.
Codex restores the full conversation state directly from the .jsonl session file.
Notes
- Do not copy
history.jsonlor other files. - Keep the original filename and directory structure.
- One
.jsonlfile always corresponds to one chat.