The terminal closed, the laptop rebooted, or you hit Ctrl+D one time too many, and the conversation you were 40 minutes into is gone from the screen. It is not gone from disk. Every session is written continuously to a transcript file, and 2 flags bring it back.
This post covers --continue and --resume, the session picker and its keys, naming sessions so you can find them, branching one to try something else, and the difference between /clear and /compact. The flags and behaviour are from the current docs, linked at the end.
–continue and –resume
cd C:\path\to\your\project claude --continue # or claude -c: reopen the most recent session in this folder claude --resume # or claude -r: open the session picker claude --resume auth-fix # resume the session named auth-fix directly claude --resume <session-id> # resume by ID, from any folder on this machine
Sessions are tied to the folder you started them in, so run --continue from the same project directory. A resumed session restores the conversation, the model it was on, and the permission mode it ended in, with 2 exceptions: a session that ended in bypassPermissions comes back in the normal starting mode, and --fork-session drops a saved plan mode. What is not restored is anything you passed as a flag the first time, --mcp-config, --add-dir, --settings, so pass those again.
From inside a session, /resume does the same job without leaving: it opens the picker, or /resume <name> switches straight to that session and saves the one you were in.
The Session Picker
claude --resume with no argument, or /resume, lists the sessions for this project with the name or generated title, how long since the last activity, the git branch and the file size. The keys worth knowing:
Up/Downorj/kto move,Enterto resume,1to9to jump to that rowSpacepreviews the conversation without opening it- Type
/or any letter to search; pasting a GitHub pull request URL finds the session that made it Ctrl+Rrenames the highlighted sessionCtrl+Awidens the list to every project on the machine,Ctrl+Wto every worktree of this repo,Ctrl+Bfilters to the current branchEscleaves the picker or the search
Picking a session from another project does not open it in place; Claude Code copies a cd and resume command to your clipboard for you to run there. Sessions started with claude -p are left out of the picker and out of --continue; you resume those by ID, and claude -p --continue does see them.
Name Your Sessions
An unnamed session gets a title generated from your first prompt, which is fine for yesterday and useless for last month. Name the ones you will come back to:
claude -n api-refactor # name it at startup (--name) # inside a session /rename api-refactor # name or rename the current one # later, from the shell claude --resume api-refactor
The name shows on the prompt bar and in the picker, and --resume by name resolves across the repo and its worktrees. If 2 sessions share a name, claude --resume <name> opens the picker pre-filtered to them. Accepting a plan in plan mode also titles the session from the plan, unless you named it already.
Branch to Try Something Else
A branch is a copy of the conversation so far that you switch into, leaving the original untouched. Use it when you want to try a second approach without losing the first:
/branch try-the-other-approach # inside a session, name optional claude --continue --fork-session # from the shell: same thing for the last session
The original stays in the picker and you get back to it with /resume <name>. In-flight background commands keep running and report into the branch you moved to. The thing not to do is resume the same session in 2 terminals without forking: both write into one transcript and the messages interleave.
Branching is for a different direction. To undo edits inside one session, the rewind menu (Esc twice on an empty prompt, or /rewind) is the tool, and Rewind Claude Code Edits With Checkpoints covers it.
Clear Versus Compact
2 commands manage what is in the context window without leaving the session, and they are not the same:
/clearstarts a new, empty session. The old one is saved and sits in/resume. Pass a name,/clear release-prep, to name the session you are leaving./compactreplaces the history with a summary, in the same session, and takes optional instructions:/compact keep the list of files we changed./contextshows what is using the context right now, which tells you whether you need either.
Claude Code compacts on its own when the window fills. The project CLAUDE.md is re-read after a compaction, so put anything that must survive one in there rather than in the conversation; the CLAUDE.md post has the detail.
Where the Sessions Are
Transcripts are JSONL files under your profile, one per session, in a folder named after the project path with every non-alphanumeric character swapped for a hyphen:
Get-ChildItem "$env:USERPROFILE\.claude\projects" -Directory | Select-Object Name
# the sessions for one project, newest first
Get-ChildItem "$env:USERPROFILE\.claude\projects\C--Users-<you>-my-project" -Filter *.jsonl |
Sort-Object LastWriteTime -Descending | Select-Object Name, LastWriteTime, @{n='MB';e={[math]::Round($_.Length/1MB,1)}}
The 30 day retention applies to all of them: a session you have not touched for 30 days is deleted, and with it --resume for that session. Claude Code Only Keeps 30 Days of Transcripts covers the cleanupPeriodDays setting that changes it. /export saves a readable copy of the current conversation if that is all you need.
Other Considerations
The “Resume this conversation?” dialog appears on Pro, Max and Ultra when a long session has sat for a while. The estimate it shows is how much of your 5-hour usage window the saved conversation alone would take on your next message. Start a new conversation if the next task does not need the old one.
--continue skips sessions that started with /loop, and from version 2.1.257 it will open a finished background session but not one still running; for that it tells you the ID to claude attach.
Delete a project’s sessions sooner with claude purge, which removes its transcripts and its entry in ~\.claude.json from this machine only.
Frequently Asked Questions
I ran claude –continue and got a different session.
It reopens the most recent session in the current folder, so check the folder. From a subfolder of the repo it still counts as the same project, but a different project folder has its own list.
Can I resume a session on another machine?
Not from these files; they are local. Remote Control and the desktop app have their own session lists, and the desktop app can resume a CLI session, but a transcript on this laptop stays on this laptop unless you copy the file.
What is the difference between –resume and –continue?
--continue takes no argument and reopens the last session here. --resume opens the picker, or takes a name, an ID, or the absolute path of a transcript file.
Does resuming restore the permission mode?
From the terminal, yes: the session comes back in the mode it ended in, except bypassPermissions. Pass --permission-mode to override it.
How long are sessions kept?
30 days from last activity by default, set by cleanupPeriodDays in settings.json. The memory folder is excluded from that sweep; the transcripts are not.
Related
- Claude Code on Windows: The Complete Guide
- Install Claude Code on Windows, Native and in WSL
- Claude Code Only Keeps 30 Days of Transcripts
- Rewind Claude Code Edits With Checkpoints
- Plan Mode in Claude Code: Read First, Edit After
- CLAUDE.md: Project Memory for Claude Code
- Run Claude Code From a PowerShell Script With claude -p
- Claude Code docs: manage sessions (resume, name, branch, where transcripts are stored)
- Claude Code docs: CLI reference (–continue, –resume, –fork-session, –name)
- Claude Code docs: checkpointing and /rewind
If SQL Server is part of your day job, my current work lives over at sqldba.blog: production DBA scripts, an error library and the SSMS guide.
Leave a Reply