Find and resume the Claude Code session you actually want
A Claude Code session is a saved conversation tied to a project directory. Claude Code writes it to disk as you work, so the conversation survives an exit, a crash, and /clear. What does not survive is your memory of where you started it. Most "my session is gone" cases are one of a handful of things: you are looking from a different directory, the picker is filtering it out, the retention sweep deleted it, or it belongs to another surface.
Checked against Claude Code's documentation on 26–27 October 2026.
Status, 26 October 2026: three open naming and retention reports matter on this page. A renamed session can keep its name through the first resume and lose it after the second exit (#25090); the thread reports it again on v2.1.299 on 19 October 2026. The docs now describe a silent retention sweep; an open report documents losing sessions to it with no warning or recovery (#59248). /clear keeping a name is documented, but it can leave duplicate names in the picker (#61172, a user reports still hitting it on v2.1.302 on 19 October 2026). All three are covered below. If a fix has shipped in your version, the checks still apply.
The commands people mix up#
| You want | Command | What happens |
|---|---|---|
| Keep going in the last conversation here | claude --continue or claude -c | Loads the most recent session in the current directory. |
| Pick from a list | claude --resume or /resume | Opens the session picker. /continue inside a session is an alias for /resume. |
| Go straight to one you can name | claude --resume <name> | Resumes an exact name; an ambiguous name opens the picker pre-filled. |
| Go straight to one you have an ID for | claude --resume <session-id> | Works from any directory on this machine. |
| Open a transcript file | claude --resume <path>.jsonl | Resumes the session stored at that absolute path. |
| Start clean, keep the old one | /clear | Starts a new conversation with empty context; the old session stays resumable. |
| Try a different direction without losing this one | /branch or --fork-session | Copies the conversation to a new session ID; the original stays intact. |
--continue is not "the last session anywhere". It is the most recent session in the current directory. That one sentence explains a large share of missing sessions.
Where Claude Code stores sessions, and why old ones disappear#
In the CLI, a session is one transcript file. The transcript is a JSONL file: a text file with one JSON object per line, where each line is a message, a tool call or result, a record of a request Claude Code sent, or metadata. The default path is ~/.claude/projects/<project>/<session-id>.jsonl. <project> is the working directory path with non-alphanumeric characters replaced by -; on Windows the root is %USERPROFILE%\.claude. CLAUDE_CONFIG_DIR moves the whole tree, and CLAUDE_CODE_PROJECT_DIR_NAME can pin the project folder name when you also set CLAUDE_CONFIG_DIR.
The transcript format is internal and changes between versions. Read it with jq for a one-off, but expect a long-lived script to need maintenance.
The retention sweep is one reason an old session disappears. cleanupPeriodDays defaults to 30 days, with a minimum of 1; setting 0 fails validation. Claude Code runs the deletion in the background after a session starts, without showing a message. The sweep removes the transcript and the session's supporting data: subagent transcripts, large tool outputs, file-history snapshots, plans, debug logs, paste cache, uploads, and similar per-session files. Set it in any settings file, for example ~/.claude/settings.json:
{
"cleanupPeriodDays": 3650
}The sweep pauses when Claude Code cannot safely determine the retention period, such as an unreadable settings file; /status shows a warning until you fix it. Transcripts for sessions you started or most recently continued in Claude Desktop or Cowork are kept at any age by default; desktopSessionCleanupPeriodDays sets an additional limit, and a transcript is deleted only once it is older than both that limit and cleanupPeriodDays (with the CLI default of 30, a value of 7 still keeps them 30 days). That key is not the CLI's cleanupPeriodDays.
The sweep is not the only way a session leaves the picker:
- The project key changed. You are in another checkout, worktree, or subdirectory, or the directory was renamed.
Ctrl+Wwidens to worktrees andCtrl+Ato every project on the machine. - It is hidden, not deleted. Sessions created with
claude -por the Agent SDK, and sessions whose first prompt was/loop, stay on disk but are left out of the picker; resume one by ID. - It belongs to another surface. The desktop app, claude.ai/code, and the VS Code extension keep their own session lists.
- It is under another config directory.
CLAUDE_CONFIG_DIRmoves storage, andCLAUDE_CODE_PROJECT_DIR_NAMEcan create a second project folder name inside it. - Transcripts were never written.
--no-session-persistencesuppresses oneclaude -prun;CLAUDE_CODE_SKIP_PROMPT_HISTORYskips writing prompt history and session transcripts to disk. - You purged or deleted it.
claude purge <path> --dry-runshows what a purge would remove; a purge cannot be undone, and deleting files yourself has the same effect.
If the session is already gone, only a copy brings it back. Export a Claude Code conversation covers a readable copy and the full JSONL, back up coding-agent sessions covers a copy that survives the sweep, and delete session history covers removing sessions on purpose.
Start with the directory#
Claude Code stores sessions per project directory. The picker's default view is:
- sessions from the current worktree, including background sessions marked
bg(sessions that keep running outside the terminal) - sessions started elsewhere that added the current directory with
/add-dir
That is a narrow view. If you opened the terminal in a different checkout, a different worktree, or a subdirectory that Claude Code treats as its own project, the session you want is outside it.
Use Ctrl+W in the picker to widen to every worktree of the repository — a worktree being a second checkout of the same repository, usually on another branch. Use Ctrl+A to widen to every project on the machine. Press either again to go back. If you are looking for a session by its branch, Ctrl+B filters to the current git branch.
A subdirectory is not automatically the same project. The project key comes from the working directory path, with non-alphanumeric characters replaced by -. Starting in repo/ and starting in repo/packages/api/ normally produce two project directories. The session is under the one where it started.
Auto memory uses a different key: it is shared by a repository and its worktrees, while session transcripts follow the working directory. That is why a worktree can share memory with the main checkout and still appear as a separate group in the picker.
When it is not in the picker at all#
If the transcript was deleted rather than hidden, the section above covers the retention sweep and claude purge.
It was a non-interactive or SDK session#
Sessions created with claude -p or the Agent SDK, the library for embedding Claude Code in a script, are left out of the picker and out of claude --continue. So are sessions whose first prompt was /loop. You can still resume them by ID:
claude --resume <session-id>The ID is the .jsonl filename under ~/.claude/projects/<project>/. If the picker never showed the session, list that directory to find it.
claude -p --continue is the exception: it includes -p, SDK, and /loop sessions.
It belongs to another surface#
The desktop app, claude.ai/code, and the VS Code extension each keep their own session list. The desktop app can also resume a CLI session. If a conversation is missing in the terminal, check the surface where you started it. A session that exists in one list is not evidence that it exists in another.
It lives under another config directory#
CLAUDE_CONFIG_DIR moves storage off ~/.claude. If you start one session with a custom config directory and later start Claude Code without it, the default picker will not see those sessions. Ctrl+A lists every project under the config directory you are currently using, not every config directory on disk. Resume by ID or path if you know it, or launch with the same CLAUDE_CONFIG_DIR.
Transcripts were never written#
--no-session-persistence suppresses writes for one claude -p run; CLAUDE_CODE_SKIP_PROMPT_HISTORY skips writing prompt history and session transcripts to disk. If either is set in a wrapper or CI job, there is nothing to resume.
Resume by name, and why the name moves#
You can name a session at startup with claude -n auth-refactor, during a session with /rename auth-refactor, or from the picker with Ctrl+R. Accepting a plan gives an unnamed session a generated title based on the plan. A session you never name still gets a generated title, a short summary of your first prompt written by a small model. That generated title works as a resume handle. The default display name, such as my-app-3f, does not.
Names resolve across the current repository and its worktrees. An exact match resumes directly. An ambiguous name opens the picker with the name pre-filled; /resume <name> reports an error instead. Both forms are exact-match first, so a name that differs by one character is not "close enough".
Two naming problems are worth knowing:
- A rename can survive the first resume and revert after the second exit. The open report is #25090, with a reproduction on v2.1.299 on 19 October 2026. The report says the custom title survives in the transcript but the resumed process re-derives the session name. Workaround: resume by session ID, or rename again after the second exit and check
claude --resume <name>before you rely on it. /clearkeeps a name you set with--nameor/rename, but not a generated title. That is documented, not a bug. If you want a clean name after/clear, pass the name you are leaving:/clear <name>names the old session and starts the new one unnamed. The duplicate-name confusion in the picker is an open report (#61172, a user reports still hitting it on v2.1.302 on 19 October 2026).
Resume from a different folder#
You do not have to cd back to the original directory if you know the session ID. claude --resume <session-id> works from any directory. Claude Code looks in the current project and its worktrees first, then every other project on the machine. The cross-project lookup only resolves when exactly one other project holds a transcript with messages for that ID. If you copied the transcript by hand and there are two copies, it reports not-found rather than choosing one.
Three other routes:
Ctrl+Ain the picker lists every project on the machine. Selecting a session from an unrelated project copies acdand resume command to your clipboard instead of switching you into it. If that project's directory no longer exists, Claude Code resumes the session in your current directory.claude --resume <path>.jsonlresumes the session stored at that absolute path. This is the route for a transcript you copied or restored./cd <path>moves the current session to a new working directory and relocates it to that directory's project storage, so the picker finds it there afterward.
If you want to try a different approach without touching the original, use --fork-session with --continue or --resume, or /branch inside the session. Both create a new session ID; the original stays on disk and in the picker.
Another machine#
The docs describe no sync of the local session store between machines. The transcript is the JSONL file Claude Code writes as you work; it lives under ~/.claude/projects/<project>/<session-id>.jsonl. To move one, copy the .jsonl to the other machine and resume it by path, or place it in the matching project directory and resume by ID. The project directory name is derived from the path, so a different checkout path produces a different key.
Two limits matter:
/exportwrites a readable plain-text transcript. It is for reading and handing off, not for resuming. Export a Claude Code conversation covers what it includes and how to get the full JSONL.- Auto memory is machine-local. It is Claude Code's own notes store under
~/.claude/projects/<project>/memory/, written by Claude as it works and separate from the transcript. A resumed transcript carries the conversation, not that directory. If the next session needs a fact that lived there, put it in the handoff file (a short written baton for the next session).
For the file-copy and shared-store options, see sync agent memory and project progress across machines. For the baton itself, see hand off work between Claude Code and Codex.
What actually comes back#
A resumed session restores the messages, tool calls, and results; the model; the agent, if it was started with --agent; the permission mode, depending on how you resume; an active goal; and session-scoped scheduled tasks that have not expired.
It does not restore everything from the original launch. Pass --mcp-config, --settings, --plugin-dir, --fallback-model, and --add-dir again if the session depended on them. Settings files such as settings.json and settings.local.json are re-read at launch. Background Bash commands and monitor tasks are not restored; a background subagent or workflow that was running appears as a note that it did not finish.
An in-session /resume is the exception for instruction files: a report on v2.1.283 says it keeps the CLAUDE.md and auto-memory copy the process loaded earlier, even after those files changed on disk (#97722, open, updated 26 October 2026). Use claude --resume <id> from the shell, or /clear before resuming, if the change must be seen. See Claude Code auto memory.
If the session was compacted — older turns replaced by a model-written summary — it opens at a Conversation compacted row. Claude continues from the last summary, the messages that compaction left unsummarized, and everything since. The messages the last compaction summarized are not loaded again. That is why a resumed conversation can feel like it lost the middle: it did. See context compaction for what survives.
One warning: resuming the same session in two terminals without forking interleaves both sets of messages into one transcript. If you want two windows on the same work, fork one.
Check you resumed the right one#
The picker shows a name or generated title, time since last activity, git branch, and file size. That is enough to avoid the obvious mistake, not enough to prove the conversation still has the facts.
Ask for three things before you continue: the last decision you made together, the current branch and last commit, and the next action it was about to take. Compare the answers with git status and git log -1. If the session was compacted, ask it to quote the constraint or the failed attempt you care about. A summary can keep the shape of the work and drop the exact command. /recap gives you a one-line summary on demand, but the restatement is the check you can actually compare.
Where to go next#
- Export a Claude Code conversation — a readable copy, the full JSONL, and how to search old sessions.
- Back up coding-agent sessions — a copy that survives the sweep.
- Delete session history — remove sessions on purpose, including what the vendor keeps.
- Claude Code guides — the rest of the set.