Blog / claude code
Resume a Claude Code or Codex session you closed
Closed the terminal mid-task? Claude Code and Codex both keep the conversation. The commands to pick it up again, and why --continue can come back empty.
You closed the terminal, your laptop restarted, or you hit Ctrl+C one time too many, and the agent was halfway through a task. The work isn't lost. Claude Code and Codex both save every conversation to disk as it happens, and both can open it again with the full history, so the agent remembers what it was doing.
We tested every command below with Claude Code 2.1.312 and Codex CLI 0.164. In each test we told the agent to remember a word, ended the session, resumed it, and asked for the word back.
Claude Code#
Pick up the last conversation#
claude --continue(claude -c for short.) This opens the most recent conversation in the current folder. That last part matters: we gave Claude a word in one project folder, then ran claude --continue in another, and it had no idea what we meant. It had opened that other folder's conversation instead. Always cd into the project first.
Choose from a list#
claude --resume(claude -r.) With no argument, it opens a picker of this folder's past conversations: type to search, and press Ctrl+A to show sessions from all your projects.
Resume a specific session#
Every session has an ID. Pass it to --resume and Claude opens exactly that one:
claude --resume 518158cf-fa6b-485b-8cc6-15d53d0768e2This worked even from a different folder: our session started in one project, we resumed it by ID from another, and Claude still remembered the word.
IDs are hard to remember, so give sessions a name when you start them:
claude --name login-fixThen later:
claude --resume login-fixWe tested both the ID and the name; each brought back the same conversation.
Try something without losing the original#
claude --resume login-fix --fork-sessionThis opens a copy with a new session ID. The copy has the full history, but whatever you do next doesn't change the original, so you can try a different approach and still go back.
Inside a running session#
Type /resume to open the same picker without leaving Claude Code.
Codex#
Pick up the last conversation#
codex resume --lastLike Claude Code, Codex only looks at sessions from the current folder. Add --all to see sessions from every folder.
Choose from a list#
codex resumeThis opens a picker you can search, and filter by folder or show all. If a session you started with codex exec (a script or a scheduled job) is missing from the list, add --include-non-interactive: by default Codex leaves those out.
Resume a specific session#
codex resume 01a18682-331d-7663-b648-2cef1fe2a5bcCodex prints the session ID when a session starts (session id: …) and accepts a session name in the same place. Resuming by ID worked from another folder too.
Resume from a script#
For codex exec, resume is a subcommand of exec, and you can give the next instruction right away:
codex exec resume --last "Carry on with the next step."We gave Codex a word in one codex exec run, then ran codex exec resume --last "What word did I ask you to remember?". It answered with the word.
Why it came back empty#
- Wrong folder.
--continueand--lastonly look at the current folder.cdinto the project, or resume by ID or name. - The newest session isn't the one you wanted. If you started a quick new session after the one you care about,
--continueopens the quick one. Use the picker (claude --resume,codex resume) instead. - A Codex
execsession isn't in the picker. Add--include-non-interactive. - The folder moved. Sessions are stored by folder path. Claude Code keeps them in
~/.claude/projects/, in a subfolder named after the project's path. Codex keeps them in~/.codex/sessions/, by date. Rename or move the project folder and--continuestarts looking somewhere new. Resuming by ID still works.
What comes back, and what doesn't#
The conversation comes back: your messages, the agent's replies, the files it read, and the commands it ran. The world around it doesn't. A dev server the agent started, an install that was half done, or a test still running when the terminal closed has stopped. After resuming, a short "check where we are and carry on" is usually enough: the agent reads the history, looks at the files, and continues.
Your code changes are on disk regardless of the session. git status shows what the agent changed before it stopped.
Quick reference#
| What you want | Claude Code | Codex |
|---|---|---|
| Last conversation here | claude -c | codex resume --last |
| Pick from a list | claude -r | codex resume |
| A specific session | claude -r <id or name> | codex resume <id or name> |
| Name a new session | claude --name <name> | |
| Copy, keep the original | claude -r <id> --fork-session | |
| From a script | claude -c -p "…" | codex exec resume --last "…" |
Where Joxo fits#
Resuming works on the computer where the session ran. When the work needs to move, to your phone or to a teammate's agent, Joxo carries it: you see every session from your phone and can answer it from there, and an agent can hand a task with its context to another agent, on your computer or a teammate's. Get the desktop app to see all your sessions in one place.
Frequently asked questions#
How do I resume my last Claude Code session?#
In the same project folder, run claude --continue (or claude -c). To choose an older one, run claude --resume.
How do I resume a Codex session?#
Run codex resume --last in the same folder, or codex resume to pick from a list. For sessions started with codex exec, use codex exec resume --last.
Why does claude --continue start a new conversation?#
It only looks at sessions from the current folder. If you're in a different folder, or the project was moved, it finds nothing to continue. Use claude --resume and pick the session, or pass its ID.
Where are Claude Code sessions saved?#
In ~/.claude/projects/, one subfolder per project path, one file per session. Codex saves its sessions in ~/.codex/sessions/.