Claude Code auto-resume: restore every session after a restart
Short answer: Claude Code resumes the latest conversation in a project folder with claude --continue, and Codex does the same with codex resume --last. To auto-resume every project at once after a restart, run magent --go: it reopens each project in its own terminal, resumes the Claude Code or Codex conversation in each, and tiles the windows across your monitors.
Friday, 18:42. You close the laptop mid-task — three Claude Code sessions deep in refactors, a Codex session halfway through a queue consumer, VS Code open on the docs. Monday, 09:01. All of that context is gone from your screen, and the first half hour of the week goes to reconstruction: reopening projects, hunting for windows, and trying to remember where each conversation left off.
The agents themselves solved half of this problem already. The other half — doing it across every project at once — is what this post is about.
Restore the last Claude Code session: claude --continue
Both major CLI agents can pick up their latest conversation in the current project directory:
cd ~/code/api && claude --continue # resumes the latest Claude Code conversation here
cd ~/code/worker && codex resume # same idea for CodexRun either and the agent is back mid-thought — the plan it was following, the files it had touched, the question it was about to ask. No re-prompting, no pasting context back in. For the exact flags, where transcripts live and what a crash does not restore, see how to resume a Claude Code session after a restart.
The half they didn’t
Resume commands are per-directory. With eight active projects, a restart means eight times: open a terminal, cd, type the right resume command for the right tool, drag the window somewhere sensible. It is exactly the kind of work that feels too small to automate and costs you every single day — and it is why re-entry, not agent speed, ends up being the tax on multi-project work.
Resuming the whole desk at once
mAgent (the magent CLI) treats resume as a property of the workspace, not of one session. Its config knows every project and which tool each one uses; magent --go replays all of it:
$ magent --go
✓ layout restored — 2 monitors · 2×2
✻ claude md:api resumed "refactor routes" (14h ago)
✻ claude md:web resumed "fix nav overflow" (14h ago)
▌ codex md:worker resumed "queue consumer" (15h ago)
▮ cursor md:ops launched — fresh session (no resume)
⧉ vscode md:docs reopened last workspaceThree layers come back together:
- Windows — each project in its own terminal, auto-tiled into the same grid across your monitors as last time.
- Agents — the right tool starts in each window: Claude Code here, Codex there, Cursor where that project uses it.
- Conversations —
claude --continueandcodex resumerun per window automatically; VS Code reopens its last workspace.
The stable grid matters more than it sounds: the same project lands in the same tile every time, so your eyes and hands stop searching. Re-entry becomes a glance, not an archaeology dig.
Restarts stop being expensive
Once resume is one command, a class of small decisions disappears. Reboot for the OS update now, not “after I finish these threads.” Shut down on Friday instead of leaving the machine hot all weekend. Undock the laptop without ceremony. The workspace is reproducible, so tearing it down costs nothing — the reasoning is the same as in one command to set up your entire dev workspace, and it pairs well with running multiple Claude Code sessions in parallel once everything is back up. For the day-to-day side of a restored fleet, see managing a fleet of AI coding agents across projects.
Set it up once
First run scans your Claude Code, Codex, and VS Code history and writes the config; every run after that is the two-second version of your Monday morning. The install guide takes about two minutes end to end.
Step by step
- Install mAgent. Run
pip install magent-multi-ai-agents-manager. It needs Python 3.10 or newer and works on Windows, macOS and Linux. - Generate your project config once. Run
magent. On first run it scans your Claude Code, Codex and VS Code history, finds your recent projects and writes the config. - Run magent --go after any restart. Run
magent --go. It reopens each project in its own terminal, resumes the Claude Code or Codex conversation in each, and tiles the windows across your monitors.
Frequently asked questions
How do I auto-resume Claude Code after a restart?
Claude Code resumes the latest conversation in a folder with claude --continue. To do it for every project at once, run magent --go: it reopens each project in its own terminal, runs claude --continue in each, and tiles the windows across your monitors.
How do I restore the last Claude Code session?
Run claude --continue (or claude -c) in the project folder: it reopens the most recent conversation in that directory without a picker. To choose an older conversation instead, run claude --resume. magent --go does the same for every project at once.
Can Codex sessions be resumed automatically too?
Yes. codex resume --last reopens the most recent Codex chat in the current directory, and magent --go resumes Codex and Claude Code sessions together, each in its own window.
What if a project has no previous conversation?
For a Claude Code project with no stored conversation, mAgent starts a fresh session instead of failing on --continue, so a brand-new project directory still opens with the agent running.