How to Resume a Claude Code Previous Session
Key takeaways
- Use claude --continue to reopen the most recent session in the current directory, or claude --resume to pick from a list of past sessions.
- Claude Code stores every session as a JSONL file under ~/.claude/projects/, keyed to the project directory path.
- Session history is scoped per directory, so resuming from a different folder, worktree, or renamed path hides the session you want.
- claude --resume <session-id> targets a specific session regardless of directory, sidestepping per-project scoping.
- Session history is local-only with no built-in sync or expiry, so cross-machine handoffs need copied files or a committed handoff note.
You can pick up a Claude Code previous session with claude --continue for the most recent one, or claude --resume to pick from a list, and /resume from inside a running session. This guide covers every flag, where session history lives on disk, and what to do when resume fails.
How do I continue a previous session in Claude Code?
Three commands cover almost every case. Run claude --continue from the project directory to reopen the most recent conversation with full context intact. Run claude --resume to get an interactive list of past sessions for that project and pick the one you want. Inside an already-running session, type /resume to switch to a different past conversation without leaving the terminal. All three are documented in the Claude Code CLI reference, along with the session ID flags that let you target a specific conversation directly.
The catch: these commands only work per project directory. If you started the session in a different folder, or you are juggling three or more agent sessions across worktrees, the picker may not show what you are looking for. That is the multi-project confusion later sections untangle.
If you run agents in parallel and want the handoff to survive regardless of which session lives longest, a board-based approach like KanbanMCP's Claude Code setup keeps the state on a card instead of in one conversation.
What is the difference between --continue and --resume in Claude Code?
--continue reopens your most recent session in the current directory, no questions asked. --resume opens a picker of past sessions so you can choose one, and it can also target a specific session by ID. If you run several parallel sessions across worktrees, that distinction matters: --continue is only safe when you know the last session in that directory is the one you want.
| Command or shortcut | What it does |
|---|---|
claude --continue | Reopens the most recent session in the current directory, silently |
claude -c | Short form of --continue |
claude --resume | Shows a picker listing previous sessions for the current project |
claude -r | Short form of --resume |
claude --resume <session-id> | Restores one specific session by ID |
/resume (in-session) | Opens the same picker without leaving your running session |
A practical habit: use -c for the single session you just closed, and -r when you have three or more sessions on different cards and need to see which is which before you commit. If you find yourself resuming five sessions every morning just to reconstruct state, that is the point where a handoff note on a board (the model behind KanbanMCP's agent workflow) beats session resume, because the note survives even when a session does not.
Where does Claude Code store previous session history?
Claude Code keeps every session as a JSONL file under ~/.claude/projects/. Each project directory path becomes a subfolder, and each session gets its own .jsonl file named by session ID. That is why --resume knows which sessions belong to which repo, and why history survives restarts but not a wiped home directory.
Reading and backing up session files
The files are plain JSONL, one JSON object per line, so you can grep them, jq them, or copy them into your backup routine like any other dotfile. Anthropic's documentation covers where session data lives and how resume works (Anthropic Claude Code docs). Back up the whole ~/.claude/projects/ tree, not individual files, so paths stay consistent.
What a session file contains
Each line records messages, tool calls and results in order, which is what lets --continue reconstruct context. If a file is truncated or corrupted mid-run, resume fails, which is the failure case the next section covers.
If you are running three or more parallel sessions across worktrees, session files give you recovery, but not a handoff note for the next agent. That is the gap a board like KanbanMCP's Claude setup fills: state lives on cards, sessions stay disposable.
How do I resume a Claude Code session from a specific project or branch?
Session history in Claude Code is scoped per project directory. The claude --resume picker only lists sessions started from the directory you launched it in, so run claude from the same checkout you used originally. If you resume from the wrong folder, the session you want will not appear.
Worktrees and per-directory history
With git worktrees, each worktree is its own directory with its own session history. A session started in ~/project/.worktrees/feature-auth will not show up when you run claude from ~/project. Resume from the worktree where the session started, or use claude --continue there to pick up the most recent one.
Resuming by session ID
If you know the session ID, claude --resume <session-id> works regardless of directory, which sidesteps the per-project scoping. Session IDs appear in the --resume picker and in the session files on disk.
This per-directory split is also why some devs keep handoff notes on a board like KanbanMCP instead of relying on session resume alone. Agents claim a card, leave a note, and the next session picks up the work even from a different worktree.
Why can't Claude Code find my previous session?
Three causes cover almost every case: you are running from the wrong directory, the session file is corrupted, or the history was deleted. Work through them in that order.
Wrong directory or renamed project path
Claude Code keys sessions to the working directory, so a renamed folder or a launch from a subdirectory hides every previous session. cd back to the original project root and run claude --resume again. If you moved the project, launching from the new path starts a fresh history rather than finding the old one.
Corrupted or truncated session files
The failure people hit after an upgrade or a crash is subtler: the session list shows entries, but resuming one fails or loads a truncated transcript. Session history lives as JSONL files on disk, and a partially written or manually edited file can break resume without deleting the record. Before assuming the session is gone, check the project's session directory for a zero-byte or obviously truncated file and compare it against an earlier backup if you keep one. This is also why treating chat sessions as disposable and keeping a handoff note in a tracked file pays off: the pattern we use for our qwen-code agents means a lost session costs minutes, not the whole thread. A git-committed note in the repo survives anything that happens to local JSONL.
History wiped by cleanup or a fresh install
Local session history is not guaranteed to persist forever; Anthropic's documentation covers data retention and cleanup behavior for stored data, and a fresh install or aggressive disk cleanup can remove files outright. If nothing shows in --resume after an upgrade, assume the history is gone and restart from a handoff note.
How far back do Claude Code session histories go, and can I manage or delete them?
There is no built-in expiry. Claude Code keeps every session as a local JSONL file under ~/.claude/projects/, and --continue and --resume will happily pick up sessions from weeks ago as long as the file is still there. History only disappears when you delete it.
That means you can manage it directly. To free disk space or scrub sensitive context, list the files with ls -lh ~/.claude/projects/<project-path>/, copy a session JSONL somewhere safe as a backup, or delete the ones you no longer need. Removing a file removes that session from /resume permanently, so check the timestamps before pruning.
If a project spans multiple repos or worktrees, remember each project path gets its own subdirectory, so clean up per project rather than assuming one global history.
How do I pick up a Claude Code session on another machine or share it with a teammate?
Session history is local to the machine and directory where you ran Claude Code, so there is no built-in cross-machine resume. You can copy the JSONL files into the same project path on the new machine, but context that lives only in a session file is fragile: it is tied to one directory, one machine and one agent.
Copying session files between machines
If you must move a session, copy the project's folder from ~/.claude/projects/ to the identical path on the other machine. Claude Code scopes sessions per directory, as covered in its documentation, so a path mismatch is the usual reason a copied session will not show up in --resume.
Handoff notes instead of session files
The sturdier pattern is to keep the state of record in the repo and on a board, not in chat history. Commit the work, write a short handoff note on the task card, and let the next session, agent or teammate claim the card and read the diff. Sessions stay disposable; the board is what survives a machine swap.
When should you stop relying on session resume and put the state on a board?
Resume works for one session on one machine. Run three or more parallel sessions, or mix Claude Code with Cursor and Codex, and the state you need lives in several histories at once. A board survives that: agents claim a card, do the work and leave a handoff note for the next one. A crashed session or a fresh machine costs you nothing, because the state was never in the chat.
Same criteria, applied honestly
Run every option through the same test: can an agent in a different tool pick up the card, and can you review the git diff in the morning? Plain CLAUDE.md and backlog.md files fail the first test at scale, since every session re-reads everything. Vibe Kanban handles the claiming and handoff well but expects you to work inside its board. KanbanMCP does the same claiming-and-note loop, and you steer from the same board, but it is one more service to keep running, and handoff notes are only as good as the agent that wrote them.
Where plain resume still wins
One session, one machine, an hour ago: just use --continue. Boards earn their keep only when sessions outnumber your attention.
FAQ
How do I reopen yesterday's Claude Code conversation without scrolling through my shell history?
Run claude --continue from the same project directory to reopen the most recent session, or claude --resume to see a picker of past sessions for that project. Inside a running session, /resume does the same thing. If you know the session ID, claude --resume <session-id> targets it directly, regardless of directory.
Can I run claude --continue after switching branches or coming back the next morning?
Yes. Sessions are keyed to the directory, not the branch, so switching branches does not hide history. There is no expiry on session files either, so the next morning works. Just launch from the original project root or worktree; resuming from a different checkout path means the session will not appear in the picker.
Is there a way to list all my previous Claude Code sessions with their session IDs?
Yes, two ways. claude --resume opens an interactive picker listing past sessions for the current project, including their IDs. You can also list the JSONL files directly under ~/.claude/projects/<project-path>/, where each file is named by session ID, letting you target one with --resume <session-id>.
Does Claude Code sync session history across devices or is it only stored locally?
It is only stored locally. Every session lives as a JSONL file under ~/.claude/projects/ on the machine where you ran it, with no built-in sync. To move one, copy the project's folder to the identical path on the other machine; a path mismatch is why copied sessions often fail to appear.
What happens to my session history if I delete or rename the project folder?
Renaming the folder hides the history: sessions are keyed to the directory path, so launching from the new path starts a fresh history rather than finding the old one. The JSONL files still exist under ~/.claude/projects/ under the old path. Rename the folder back, or move the session files to match the new path, and resume works again.