Claude Code guide: resuming a session

Claude Code resume: how to continue any session

To resume in Claude Code, run claude --continue for the last conversation in this folder, or claude --resume to pick any earlier one from a list. Inside a running session, /resume does the same. Every conversation is saved on disk as it happens, so resuming is the normal way back in after you close the terminal, not a recovery trick.

Anthropic

On Claude Code

Resume takes the session id

Continuing a conversation means starting Claude Code again with the id of the session you want. The id is the filename of the transcript, minus the .jsonl extension.

It happens once, at start

The resume is done when the process starts, not per turn. Everything after that is one continuous run, which is why resuming is cheap even on a long conversation.

Changes made elsewhere need a restart

Because resume happens once, a turn that a terminal appended to the transcript after your process started is not picked up until the next start. Codex re-reads before every turn, Claude does not.

The session id is stable

Continuing a session keeps its id, so the transcript keeps growing in the same file rather than forking into a new one.

Finding the id

List the project directory under ~/.claude/projects and sort by modified time. The most recently touched .jsonl file is the session you were last in.

The commands

Claude Code resume commands at a glance

There are four ways back into a conversation. All of them read the same saved transcript, so the conversation continues with its history and on the model it was using.

CommandWhat it does
claude --continue or claude -cReopens the most recent session in the current directory.
claude --resume or claude -rOpens the session picker.
claude --resume <id or name>Resumes that session directly. A name that matches more than one session opens the picker with the name as the search.
/resumeSwitches to another session from inside a running one. /continue is an alias.
bash
claude -c                       # last conversation in this folder
claude -r                       # pick from a list
claude -r auth-refactor         # by name
claude -r 3f2a9c1e-...          # by session id

A conversation you leave with /clear is not lost either. Claude Code starts a fresh session and keeps the old one on disk, so it shows up in /resume.

History

See your Claude Code conversation history

The picker is the history view. Run claude --resume with no argument, or /resume, and each row shows the session name if you set one, otherwise a generated title or the first prompt, plus time since last activity, git branch and file size.

  • Up and Down (or k and j) move between sessions. Enter resumes the highlighted one, and 1 to 9 resume by position.
  • Space previews the conversation without opening it.
  • / or any other printable key starts a search. Pasting a pull request URL finds the session that created it.
  • Ctrl+A shows sessions from every project on this machine. Ctrl+W shows all worktrees of the repository, and Ctrl+B filters to the current git branch.
  • Ctrl+R renames the highlighted session. Esc leaves search or the picker.

To keep a conversation as readable text rather than a transcript, open it and run /export, which copies it to the clipboard or writes it to a file you name. If you want the raw files and their layout, that is covered in where Claude Code stores sessions.

Names

Name a session so you can resume it by name

Generated titles work, but a name you chose is easier to find and type. Set one at launch with -n, rename later with /rename (alias /name), or press Ctrl+R in the picker.

bash
claude -n auth-refactor
# later, from the same repository
claude --resume auth-refactor

Name resolution covers the current repository and its worktrees. The short default label you see on a running session, such as my-app-3f, is not a resume handle.

Folders

Resume a session from another directory

Claude Code stores sessions per project directory, which is why claude --continue in the wrong folder finds nothing. There are two ways round it:

  • By id, from anywhere. claude --resume <session-id> looks in the current project and its worktrees first, then every other project on the machine. If no transcript matches, it prints No conversation found with session ID: <session-id>.
  • From the picker. Press Ctrl+A and pick the session. A session from another worktree of the same repository resumes in place. One from an unrelated project puts a cd plus resume command on your clipboard instead.

Sessions only exist on the machine that ran them. Moving one to a second computer is its own task, covered in continue a Claude Code session on another computer.

Forking

Fork instead of continuing

Resuming the same session in two terminals interleaves both into one transcript. When you want to try a different approach and keep the original intact, fork it: --fork-session gives the resumed copy a new session id.

bash
claude --continue --fork-session
claude --resume auth-refactor --fork-session

Inside a session, /branch does the same at the current point and switches you into the copy. The original stays in the picker under its old id.

Scripts

Resume from a script with claude -p

Non-interactive runs resume the same way. Pass a session id to send a follow-up and capture the answer:

bash
claude -p --resume <session-id> --output-format json "summarize what we changed" | jq -r '.result'
claude -p --continue "run the tests again"

Sessions created with claude -p or the Agent SDK are left out of the picker and out of a plain claude --continue. Resume them by id, or use claude -p --continue, which includes them. That gap is the usual reason a session seems to be missing; Claude Code session missing from the list walks through the other causes. To run without saving anything at all, add --no-session-persistence to a -p run.

Retention

How long Claude Code keeps history, and how to delete it

Claude Code deletes transcripts older than 30 days. If you rely on resuming old work, raise the limit with cleanupPeriodDays in ~/.claude/settings.json. The minimum is 1; there is no value that means forever, so use a large number.

json
{
  "cleanupPeriodDays": 365
}

To delete history now rather than wait, use claude purge. It removes a project's transcripts, tasks, file history and config entry.

bash
claude purge --dry-run     # list what would be deleted for this folder
claude purge               # delete it, after a confirmation
claude purge --all         # every project on this machine

-i asks before each item and -y skips the confirmation. Purge is not undoable, so run the dry run first.

Termdeck

Resume any session on any machine from a browser

The resume picker shows one machine and, by default, one folder. Termdeck reads the same transcript files through a small agent on each of your machines, so the Claude Code sessions in every project folder you add, on every machine, sit in one sidebar grouped by folder. Sessions you started in a terminal are listed too, unless you turn that off in Settings. Open one and type to continue it; Termdeck resumes the same session id, so claude --resume in the terminal later picks up where the browser left off.

If a terminal is still attached to the session, the chat opens view only rather than letting two writers fork the transcript. The details are in the sessions docs. Transcripts stay on your machine.

Compare

How each engine picks a conversation back up

FeatureClaude CodeCodex CLIGrok CLI
Resume mechanismA flag on the next runAn explicit resume callSession state re-read per turn
HappensOnce, at process startBefore every turnBefore every turn
Picks up terminal editsAt the next process startYes, every turnYes, every turn
Identified bySession idThread id plus working directorySession id
Cost of resumingCheapCan be slow on a long threadCheap

Termdeck drives all three from one console, so the differences above stop being three separate habits to remember.

FAQ

Claude Code resuming a session, answered

How do I resume my last Claude Code session?

Run claude --continue (or claude -c) in the same folder you worked in. It reopens the most recent conversation for that directory. If there is none, it prints No conversation found to continue and exits.

How can I list all sessions in Claude Code?

Run claude --resume with no argument, or /resume inside a session. The picker shows sessions from the current folder. Press Ctrl+A to widen it to every project on the machine, and Ctrl+W to show all worktrees of the current repository.

Can I see my Claude Code conversation history?

Yes. The resume picker lists past conversations with their name or title, age, git branch and size, and Space previews the one you have highlighted. To read a conversation as text, open it and run /export to save it to a file or copy it to the clipboard.

How to clean Claude Code history?

Claude Code deletes transcripts older than 30 days on its own. Change that with cleanupPeriodDays in settings.json (minimum 1). To delete a project now, run claude purge in that folder, or claude purge --all for every project. Add --dry-run first to see what would go.

How can I view my Claude Code usage history?

Run /usage inside a session (also available as /cost and /stats). It shows the session cost, your plan usage and activity stats. Usage is separate from conversation history, which lives in the transcript files.

Why is my old session not in the resume list?

The picker starts on the current folder only, and sessions created with claude -p or the Agent SDK are left out of it. Widen with Ctrl+A, or resume directly with claude --resume and the session id. Transcripts older than your cleanupPeriodDays setting are deleted.

Does resuming a Claude Code session cost tokens?

Your next message sends the saved conversation as context, so a long conversation costs more per turn than a fresh one. After a long break the prompt cache has expired and that first message is priced as uncached input. On Pro and Max, Claude Code may show a Resume this conversation dialog estimating the share of your 5-hour limit it will use.