// guides

How to resume a Claude Code session after a restart

· 8 min read

Short answer: open a terminal in the project folder and run claude --continue (or claude -c). It reopens the most recent conversation in that directory. To pick an older one, run claude --resume for a session picker, or claude --resume <name> to jump straight to it. Conversations are saved to disk as you work, so they survive a reboot or a crashed terminal. To resume every project at once, magent --go reopens each project’s terminal and runs claude --continue in it.

Resume one Claude Code session

Claude Code has two resume flags, and a slash command for switching from inside a session:

cd ~/code/api
claude --continue              # most recent conversation in this directory (-c)
claude --resume                # choose one from the session picker (-r)
claude --resume auth-refactor  # jump to a named session; a session ID works too

/resume                        # inside a running session: switch conversation

--continue is the one you want after a restart: no picker, no ID, just the last conversation you had in that folder. It skips sessions created with claude -p or the Agent SDK; resume those with claude --resume <session-id>. Naming a session with claude -n or /rename gives you a handle that is easier to type than an ID. Anthropic’s session documentation has the full picker reference.

What survives a reboot or a terminal crash

The conversation survives, the process does not. Claude Code writes each conversation to a JSONL transcript as it goes, at ~/.claude/projects/<project>/<session-id>.jsonl, where <project> is the working directory with every non-alphanumeric character replaced by -. That is why --continue is per-directory: the folder you start from decides which transcripts it looks at.

A resumed session brings back:

  • The full history, including tool calls and their results.
  • The model the session was using, unless a --model flag or environment variable picks another at launch.
  • The permission mode, when you resume from a terminal with --continue or --resume <id-or-name>. A session you pick from the picker starts in the mode a new session would.

A few things do not come back:

  • A tool call cut off by the crash is not re-run. Claude sees it marked as interrupted and is told to check whether it took effect before trying again.
  • Background Bash tasks are not restored.
  • Launch-only flags such as --mcp-config, --settings and --add-dir have to be passed again. Settings in settings.json are re-read, so they need nothing.
  • Old transcripts. They are cleaned up after 30 days by default; cleanupPeriodDays in settings.json changes that.

Step by step

  1. Open a terminal in the project folder. claude --continue is scoped to the current directory, so start from the folder the conversation happened in.
  2. Run claude --continue. Run claude --continue (short form claude -c). It reopens the most recent conversation in that directory, with its full history.
  3. Pick an older conversation if you need one. Run claude --resume to open the session picker, or claude --resume <name> to jump straight to a named session. A session ID works too.
  4. Pass launch-only flags again. Flags such as --mcp-config, --settings and --add-dir are not restored on resume. Add them to the resume command if the session needed them.
  5. Resume every project at once. With many projects, run magent --go. It reopens each project in its own terminal, runs claude --continue in each, and tiles the windows across your monitors.

If your conversation seems lost after a restart

It almost never is. The transcript is on disk; --continue is just looking in a different place than you expect. Check these in order:

  • You are in a different folder. --continue only sees conversations from the current directory. Run claude --resume and search the picker, or pass the session ID: claude --resume <session-id> searches the current project first, then every other project on the machine. You can also pass the absolute path to a .jsonl transcript.
  • The session was a script run. Conversations started with claude -p or the Agent SDK are left out of --continue and the picker. Resume them by ID.
  • It is still running in the background. If your latest conversation was sent to the background and has not finished, --continue exits with Your most recent conversation is running in the background and its ID. Attach to it from claude agents.
  • It lives in another config directory. With CLAUDE_CONFIG_DIR set, transcripts are stored under that directory instead of ~/.claude. Resume with the same value set.
  • It is older than the retention period. Transcripts are deleted after 30 days by default. Raise cleanupPeriodDays if you come back to work later than that.

Resume every project at once

--continue works one directory at a time. With eight active projects, a restart means eight terminals, eight cds and eight resume commands, before any window is where you want it.

mAgent (the magent CLI) does that part. Its config lists every project and the agent it uses, and the default command for Claude Code is claude --continue. So one command reopens each project in its own terminal, resumes its conversation, and tiles the windows across your monitors:

pip install magent-multi-ai-agents-manager
magent         # first run: scans your Claude, Codex and VS Code history, writes a config
magent --go    # reopen every project's terminal, resume its agent, tile the grid

On a terminal, magent --go first shows a checklist of projects with everything already checked, so Enter launches them all; --all skips the checklist. Windows that are still open are left alone, so after a single crashed terminal only the missing window comes back.

A project can also open in several windows. Each one without its own command resumes a different conversation, the Nth most recent in that folder, by ID (claude --resume <id>), so two windows never land in the same one.

On Windows with psmux enabled, each project runs in a persistent psmux session. Closing or crashing the terminal window does not stop the agent, and magent --go reopens a window attached to the session that is still running. There is nothing to resume, because the agent never stopped. After a reboot the sessions are created again and claude --continue picks each conversation back up. magent up also relaunches the agent in any session whose pane fell back to a bare shell, after a Ctrl-C for example.

New projects do not open a dead pane

claude --continue in a folder that has never hosted a conversation has nothing to reopen, so Claude Code prints No conversation found to continue, exits and leaves you at a bare shell. Add a new project to a resume-everything setup and that is what you get: one dead window.

mAgent checks each project’s session store when it builds the launch command. If the folder has no stored conversation, it drops the implicit --continue and starts plain claude. Only a confirmed “no conversation here” changes anything. An explicit --resume <id>, a per-window custom command, a remote project and a store that cannot be read all run exactly as configured, so a real resume failure stays visible in the pane.

It also never uses a shell fallback like claude --continue || claude. That would start a fresh chat after any failure, including an auth error you need to see.

The Codex equivalent

OpenAI’s Codex CLI resumes through a subcommand rather than a flag, with the same per-directory default:

codex resume --last          # most recent chat in this directory
codex resume <SESSION_ID>    # a specific chat, by ID or name
codex resume --last --all    # most recent chat from any directory

If the chat was started in another directory, Codex asks which one to use. In mAgent the default Codex command is plain codex, which starts a new chat; multi-window projects still resume each Codex window by ID. To resume single-window Codex projects too, set the Codex command to codex resume --last. mAgent drops back to plain codex in a folder with no Codex chat yet, the same fallback as for Claude:

"settings": {
  "tools": {
    "claude": "claude --continue",
    "codex": "codex resume --last"
  }
}

For the workflow side of this (why re-entry costs more than it looks, and what a restart feels like once it is one command), see auto-resume Claude Code and Codex sessions after a restart. To run the resumed fleet side by side, see how to run multiple Claude Code sessions in parallel.

Frequently asked questions

How do I resume a Claude Code session after a restart?

Open a terminal in the project folder and run claude --continue (or claude -c). Claude Code saves every conversation to disk as you work, so a reboot or a closed terminal does not lose it. Run claude --resume instead to pick an older conversation from a list.

What is the difference between claude --continue and claude --resume?

claude --continue reopens the most recent conversation in the current directory, without asking. claude --resume opens a session picker, and claude --resume <name> or claude --resume <session-id> jumps straight to a specific session.

Where does Claude Code store sessions?

As JSONL transcripts in ~/.claude/projects/<project>/<session-id>.jsonl, where <project> is the working directory path with every non-alphanumeric character replaced by -. Transcripts are cleaned up after 30 days by default; cleanupPeriodDays in settings.json changes that.

Why does claude --continue not work in a new project?

Because there is nothing to continue: --continue looks for a conversation in the current directory, and a folder that never hosted one has none, so Claude Code prints No conversation found to continue and exits. Run plain claude there. mAgent does this for you: it drops the --continue for any project with no stored conversation.

Why can I not find my Claude Code session after a restart?

Usually because you are in a different folder: --continue only looks at the current directory. Run claude --resume and search the picker, or pass the session ID to claude --resume <session-id>, which searches every project on the machine. Sessions started with claude -p are skipped by --continue, and transcripts older than 30 days are deleted by default.

How do I resume a Codex CLI session?

Run codex resume --last for the most recent chat in the current directory, or codex resume <SESSION_ID> for a specific one. Add --all to --last to include chats from other directories.

How do I resume all my Claude Code sessions at once?

Install mAgent (pip install magent-multi-ai-agents-manager), run magent once to generate a config from your Claude, Codex and VS Code history, then run magent --go. Every project reopens in its own terminal with claude --continue already running, tiled across your monitors.

The install guide takes about two minutes end to end.

get mAgent — 2 min install ← all postsread as markdown