Move Claude Code sessions to a new computer

Published · Updated · Checked against Claude Code 2.1.319

Copy ~/.claude/projects/ to the same place on the new machine, and rename the project folders if your repos live at different paths there. Each folder is named after the working directory, so a session copied under the old path's name sits where Claude Code never looks for the new one. If renaming is a hassle, resume by session ID or by transcript path instead.

How the project folder is named

Per the docs, a transcript is at ~/.claude/projects/<project>/<session-id>.jsonl, where <project> is the working directory path with non-alphanumeric characters replaced by -. A converted name longer than 200 characters is truncated to 200 and gets a hash of the full path appended. The hash algorithm is not documented, so you cannot reliably compute the name of a very long path by hand.

The ordinary case reproduces with sed:

cd ~/work/my-repo
printf %s "$PWD" | sed 's/[^A-Za-z0-9]/-/g'
# -Users-me-work-my-repo

This was checked against two real folders on one machine. One path contained a space and an @; both became -, and the result matched the folder under ~/.claude/projects/ exactly. The encoding is lossy: /a/b-c and /a/b/c give the same name, so never try to decode a folder name back into a path.

What to copy

CopyWhy
~/.claude/projects/Transcripts, subagent logs, tool results, and auto memory (projects/<project>/memory/)
~/.claude/history.jsonlUp-arrow prompt recall. It records the project path per prompt, so old paths stay as they were
~/.claude/file-history/Only if you want checkpoint restore for old sessions
~/.claude/settings.json, CLAUDE.md, skills/, agents/Your configuration, not sessions

~/.claude.json holds account details and per-project state keyed by path, and the docs list it among the files you should not delete. Whether to move it between machines is a separate decision that is untested. Sign in on the new machine instead of copying credentials, and do not copy .credentials.json across machines without a reason.

If you set CLAUDE_CONFIG_DIR, all of the above lives under that directory instead (docs).

Same path on both machines

Then it is a plain copy:

rsync -a --ignore-existing old-mac:~/.claude/projects/ ~/.claude/projects/

--ignore-existing skips files already on the new machine, so a session created there is never overwritten. Then:

cd ~/work/my-repo
claude --resume

The sessions appear in the picker for that directory. The paths match only if the username and folder layout do: a different home directory (/Users/old against /Users/new) changes the folder name.

Different path: remap the folder

Compute the old and new names, then copy the contents:

old=/Users/old/work/my-repo
new=/home/new/work/my-repo
enc() { printf %s "$1" | sed 's/[^A-Za-z0-9]/-/g'; }

src=~/migrated/projects/$(enc "$old")
dst=~/.claude/projects/$(enc "$new")
mkdir -p "$dst"
cp -Rn "$src"/. "$dst"/
ls "$dst" | head

cp -Rn carries over subfolders (subagents, tool results, memory) without overwriting. Run on a scratch tree, this logic produced the expected files; do it per project. With many projects, loop over a table of old and new paths rather than guessing mappings from folder names.

A blog post by Vincent Schmalbach (10 Nov 2025) describes the same idea with cp -n per folder. It reports that after copying, sessions can show in history but fail with "No conversation found with session ID", and it recommends copying over symlinks because symlinks can cause problems when new sessions are created. The symlink claim is not verified.

Resume without remapping

Two documented forms skip the path problem:

claude --resume <session-id>          # from any directory
claude --resume /abs/path/to/<session-id>.jsonl

The docs say --resume <session-id> searches the current project and its worktrees, then every other project on the machine. The cross-project search resolves the ID only when exactly one other project holds a transcript with messages for it, so a hand-copied duplicate in two folders makes Claude Code report not-found instead of picking one. Copy each session to a single folder. The path form resumes whatever .jsonl sits at that absolute path.

What still breaks

The picker looks only in the folder for the current directory, so with a different absolute path it lists nothing until you remap or resume by ID. Trust prompts and per-project settings in ~/.claude.json are keyed by path, so expect to approve them again. Transcripts also record the old paths inside tool calls; resuming works, but Claude may refer to files that no longer exist at those paths.

The Desktop app is a separate story. In issue 81797 (opened 27 Jul 2026, closed as a duplicate of 69585), a user on a new Windows PC copied the whole ~/.claude. The CLI's claude --resume listed the old sessions, but the Desktop app did not show them. The duplicate issue was not opened and the Desktop app is untested.

On Windows, a path such as C:\Users\me\app should become C--Users-me-app by the stated rule. That follows from the rule and is untested on Windows, as is a real machine-to-machine move.

Check your count after copying, excluding subagent files:

find ~/.claude/projects -name '*.jsonl' -not -path '*/subagents/*' | wc -l

Sessions older than your retention setting are already gone, so look at what you have before the move (Claude Code silently deletes transcripts after 30 days). If resume fails afterwards, see claude --resume shows no history; the folder layout is in where Claude Code stores sessions. All guides: /guides/.

Restoring from Sealkeep archives

If the sessions were sealed in your own bucket, the new machine does not need the old one. sealkeep storage import rebuilds the backup list from the bucket using your recovery phrase, and sealkeep recover <id> <dest> restores original bytes to a path you choose. sealkeep recover <session-file> puts a missing session file back where resume expects it.

It does not rewrite project folder names for a changed path, so you still decide where the file goes, and it does not migrate settings, CLAUDE.md or login. It needs your recovery phrase. The full restore on a changed path is untested.

Based on the sessions docs as of 10 Nov 2026, with Claude Code 2.1.319 on macOS.

FAQ

Where do I copy Claude Code sessions on the new machine?

Into ~/.claude/projects/<project>/, where <project> is the repo path with every non-alphanumeric character replaced by -.

Why does resume say "No conversation found with session ID"?

The docs give that message when no stored session matches the ID. After a copy, the usual causes are a folder named for the old path, or a duplicate in two project folders.

Can I rename the project folder instead of copying?

Yes, if it is the only copy. Rename it to the encoded new path, and keep the originals until resume works.

Do I need the same username on both machines?

No, but the home directory is part of the path, so a different username changes the folder name unless the repo lives elsewhere.