Codonic

hopsesh guide · Claude Code and Codex

Moving to a new Mac or PC? How to bring your Claude Code and Codex sessions

What to bring and what to leave, the copy that works when nothing changed, why sessions hide when paths changed, and moving the ones you need from the old computer.

What to bring, and what to leave

Bring Where Why
Claude Code sessions ~/.claude/projects/ One .jsonl per session, plus side folders and each project’s auto memory
Claude Code checkpoints ~/.claude/file-history/ Rewind for those sessions; optional
Your Claude Code settings ~/.claude/settings.json, ~/.claude/CLAUDE.md, ~/.claude/commands/, ~/.claude/agents/, ~/.claude/skills/ Whatever of these you use
Codex sessions ~/.codex/sessions/, ~/.codex/archived_sessions/ One rollout per session, filed by date
Your Codex settings ~/.codex/config.toml, ~/.codex/AGENTS.md If you use them

Leave behind:

  • Logins. On macOS Claude Code keeps yours in the Keychain; on Linux and Windows it is ~/.claude/.credentials.json. Codex may keep its login in ~/.codex/auth.json. Don’t copy them: run claude and /login, and codex login, on the new computer.
  • The code. Session files are conversations, not your work. Push every branch from the old computer and clone on the new one, or copy the repositories with their .git folders.

On Windows, ~/.claude is %USERPROFILE%\.claude and ~/.codex is %USERPROFILE%\.codex.

Same username, same paths: copy and go

If the new computer has the same username and you put the repositories at the same paths, copy the folders across and everything resumes:

# on the new computer, with the old one reachable as old-mac
rsync -a old-mac:.claude/projects/ ~/.claude/projects/
rsync -a old-mac:.codex/sessions/ ~/.codex/sessions/

Two things to check afterwards:

  • The 30-day cleanup. Claude Code deletes transcripts older than cleanupPeriodDays (30 by default) when it starts. rsync -a keeps the old modification times, so anything older than that disappears on the first run. Raise cleanupPeriodDays in settings.json before you start Claude Code, or copy with rsync -rl so the files get new times.
  • The picker. claude --resume shows the current repository’s sessions; press Ctrl+A to see every project. codex resume --all does the same for Codex.

Migration Assistant on a Mac copies your home folder, ~/.claude and ~/.codex included, so in this case the sessions usually arrive with it.

New username or new folders: the paths are wrong

This is the usual case moving from an old work laptop, from Windows to Mac, or to a computer where you keep code in ~/src instead of ~/git. Claude Code files sessions by working directory, so everything you copied is under folders named for the old paths, -Users-alice-old-git-webapp, while Claude Code in /Users/alice/src/webapp looks in -Users-alice-src-webapp.

  • claude --continue says No conversation found to continue in every repository.
  • claude --resume <id> still finds a session by its id on Claude Code 2.1.223 or newer, and Ctrl+A lists them all.
  • A resumed session still refers to the old paths in every tool call, so its first edits can aim at folders that don’t exist.

You can rename each project folder to the new path’s name and search-and-replace the paths inside each file. For a handful of sessions that’s fine; Claude Code history after moving a project folder shows how. For Windows to Mac, the paths are also JSON-escaped with backslashes; see Claude Code session from Windows to Mac.

Codex files by date, so its sessions don’t hide, but codex resume only offers sessions from the current directory: use codex resume --all, or codex resume <id> -C <new folder>.

Bring the sessions you need with hopsesh

Most of what’s in ~/.claude/projects you’ll never open again. hopsesh is a free, open-source command-line tool, terminal UI and app for macOS and Windows that moves the sessions you do want, one at a time, from the old computer while it’s still on and reachable over SSH (Remote Login on a Mac, OpenSSH on Windows):

brew install roeehrl/tap/hopsesh   # or the install script, or Scoop on Windows
hopsesh hosts                      # computers found in Tailscale and ~/.ssh/config
hopsesh hosts allow old-mac
hopsesh trust old-mac
hopsesh                            # browse the old computer's sessions, by repository
hopsesh pull old-mac:"fix flaky tests" --clone

For each session it:

  • finds the repository on the new computer by its git remote, or clones it (--clone), and recreates the worktree if the session ran in one;
  • brings the code to the commit the session last saw, fetching it straight from the old computer if you never pushed it;
  • rewrites every path for the new computer in one pass, Windows paths and JSON escaping included, without touching ids or signed thinking blocks, and lists any it couldn’t map;
  • installs it under the exact project folder name Claude Code expects, with a fresh modification time;
  • prints the claude --resume or codex resume command.

If the old computer has no SSH key set up, hopsesh hosts add old-mac alice@192.168.1.20 --password connects with a password, and hopsesh hosts setup-key old-mac swaps it for a key. hopsesh never copies logins, keys or account data: each computer stays signed in on its own.

Uncommitted files stay on the old computer, and the plan says so. hopsesh undo reverses a move. hopsesh is alpha software, and an independent project, not affiliated with Anthropic or OpenAI. More: where Claude Code and Codex store sessions.

Sessions on a new computer

What do I copy to keep my Claude Code history on a new computer?

~/.claude/projects, which holds every session and each project’s auto memory, and optionally ~/.claude/file-history and your settings, CLAUDE.md, commands, agents and skills. For Codex, ~/.codex/sessions and ~/.codex/archived_sessions. Sign in again instead of copying logins.

Why did my copied sessions vanish after I started Claude Code?

Claude Code deletes transcripts older than cleanupPeriodDays, 30 by default, at startup, and rsync -a keeps the old modification times. Raise cleanupPeriodDays before you first start Claude Code, or copy so the files get new times.

My username changed. Why does claude --continue find nothing?

Claude Code files sessions by working directory, so the copies sit under folders named for the old paths. claude --resume <id> still finds them by id on 2.1.223 or newer, but the paths inside still point at the old folders. hopsesh moves each session with the paths rewritten.

Can hopsesh move all my sessions at once?

hopsesh moves the sessions you pick, one at a time, from the old computer over SSH, with the repository found or cloned and the code brought to each session’s commit. For a bulk archive of everything, copy the folders.

Use the method

Try it with hopsesh

Open-source CLI and desktop app: move a Claude Code or Codex session to another computer, into the other agent, or to the cloud, with undo built in.

See everything hopsesh does →
Install the CLI Terminal macOS and Linux · Command line and terminal UI brew install roeehrl/tap/hopsesh Without Homebrew: curl -fsSL https://raw.githubusercontent.com/roeehrl/hopsesh/main/scripts/install.sh | sh, which checks the download against the release’s checksums and signature.
Install the CLI Terminal Windows, in PowerShell · Command line and terminal UI irm https://raw.githubusercontent.com/roeehrl/hopsesh/main/scripts/install.ps1 | iex Same checks as the macOS and Linux script. The Windows app installs this command as well.
hopsesh for Mac .dmg macOS app · macOS 13 or later · Apple silicon and Intel Download Signed and notarized by BlueGuru LLC. Updates itself from Settings → Updates.
hopsesh for Windows .exe Windows app · Windows 10 or 11 · x64 Download Not code-signed yet: at SmartScreen, click More info, then Run anyway. Smart App Control, if on, blocks it.
More ways to install
  • Installer for Arm64 Windows 10 or 11 on Arm
  • Portable .zip x64 or Arm64, no install, on the release page
  • Command line with Scoop from the roeehrl bucket, without the app scoop bucket add roeehrl https://github.com/roeehrl/scoop-bucket; scoop install hopsesh
  • Command line only in PowerShell, without the app irm https://raw.githubusercontent.com/roeehrl/hopsesh/main/scripts/install.ps1 | iex
Linux packages and all files GitHub Latest release · .deb, .rpm and .apk for amd64 and arm64, a portable Windows app .zip, plus archives Open on GitHub Release notes, checksums and every build of the current version. Source on GitHub GitHub Apache-2.0 · Go 1.26 or later to build Open on GitHub From source: go install github.com/roeehrl/hopsesh/cmd/hopsesh@latest