Come back to a session. Keep the thread.
claude --continue, claude --resume, named sessions and a three-line handoff: how to pick up yesterday’s Claude Code or Codex session where it left off.
You closed the terminal, the laptop slept, or it’s simply the next morning. The work is half done and the agent that knew all about it is gone. Or is it? Claude Code and Codex both save every session locally, so you can pick one up where it left off. The commands are simple. The habits around them are what keep the thread.
Resume in Claude Code
Claude Code stores each session with the project folder it ran in. From that folder:
claude --continue # reopen the most recent session in this folder
claude --resume # pick from a list of sessions
claude --resume auth-refactor # reopen a named session directly-c and -r are the short forms. Inside a running session, /resume opens the same picker. In the picker you can type to search, press Space to preview a session, Ctrl+R to rename it, Ctrl+W to include other worktrees of the repository and Ctrl+A to include every project on your Mac.
A resumed session brings back the full conversation history, including tool calls and results, and continues on the same model. A few launch flags, such as extra directories added with --add-dir or a custom --mcp-config, aren’t restored, so pass them again if the session depended on them.
Resume in Codex
codex resume # pick from a list of sessions
codex resume --last # continue the most recent oneYou can also pass a session id or name, as in codex resume <id>. Add --all to list sessions from every folder, not only the current one.
Habit 1: name sessions after the task
“Yesterday, 4:12 pm” tells you nothing a week later. Name each session for what it’s doing, either at the start with claude -n auth-refactor or mid-session with /rename auth-refactor. Then claude --resume auth-refactor takes you straight back, with no picker.
Treat names like branch names: one workstream, one session. When you run several agents at once, names are how you find the right one, and if you also name the git worktree or branch the same way, everything lines up.
Habit 2: leave a three-line handoff before you stop
The best resume starts before you close the session. Ask for three lines:
Done: what changed and what passes.
Next: the very next step.
Gotchas: what surprised us, and what not to touch.It costs a few seconds, and it protects you twice. The resumed session has a crisp summary at the end of its history. And if the full history is too big to resume as-is, the handoff is what you’ll want to keep.
Habit 3: ask for a recap before anything new
When you come back, don’t open with the next request. Open with “Recap where we are in one line, and what you’d do next.” It takes a moment, and it tells you whether the agent’s picture of the task matches yours before it edits anything. If it doesn’t, correct it now, while it’s cheap.
On Pro and Max plans, Claude Code may offer to resume from a summary when a large session (over about 100,000 tokens) has been idle for more than about an hour. Resuming from the summary makes later requests cheaper; resuming the full session keeps every detail. If you left a good handoff, the summary is usually enough.
Habit 4: branch instead of overwriting
Want to try a different approach without losing the current one? Run /branch try-streaming inside the session, or start a copy from the command line with claude --continue --fork-session. The original stays untouched in the picker. Don’t resume the same session in two terminals at once without forking: the messages from both interleave in one transcript.
Resuming in a worktree
If the session ran in a worktree started with claude --worktree, resuming it returns the session to that worktree. When you exit a worktree session that has changes, Claude Code asks whether to keep the worktree and prints the exact claude --worktree <name> --resume command to come back later. More on worktrees in how to run multiple Claude Code agents without conflicts.
What a resume can’t bring back
- A command that was still running when the process ended doesn’t finish or rerun. Claude sees it as cut off and checks whether it took effect before running it again.
- Background shell commands and monitors aren’t restarted.
- Sessions are kept locally for 30 days by default (the
cleanupPeriodDayssetting changes it). Anything you need longer belongs in the repo: the handoff, a plan file, the PR description.
In short
claude --continuefor the last session,claude --resumeto choose;codex resume --lastfor Codex.- Name sessions after their task, and resume by name.
- Leave a handoff before you stop: done, next, gotchas.
- Ask for a one-line recap before the next request.
- Branch to experiment instead of overwriting.
Where XAgents fits
In XAgents, every agent keeps its tab. Idle agents sleep to free memory, and pressing ⌘R resumes the same conversation with the same model, effort and account, never just “the latest”. Read how in Sleep and ⌘R, or take the product tour.
XAgents is a home for your agents. Join the waitlist and we’ll email you when your invite is ready.