hopsesh guide · Claude Code
How to bring a Claude Code session from a remote server to your laptop (and back)
tmux and Remote Control when the work belongs on the server; the manual copy when it should continue on your laptop; and moves in both directions with hopsesh.
Where the session is
When you ssh devbox and run claude there, Claude Code runs on the server, with the server’s files, and saves the session on the server:
devbox:~/.claude/projects/-home-alice-src-webapp/<session-id>.jsonl
Codex does the same in devbox:~/.codex/sessions/YYYY/MM/DD/. Your laptop’s claude --resume can’t see either.
Keep it on the server
If the work belongs on the server (it has the GPU, the data or the database), don’t move the session. Make it survive your connection instead:
tmuxorscreen. Start Claude Code insidetmux new -s webapp, detach withCtrl+B D, andtmux attach -t webappafter you reconnect. The session never stops.- Remote Control. Run
claude --remote-controlinsidetmuxon the server, and open the session from claude.ai/code or the Claude app on your laptop or phone. Claude Code’s documentation recommendstmuxorscreenfor exactly this, because Remote Control goes offline when theclaudeprocess stops. It needs a claude.ai subscription; API keys aren’t supported. - Resume after a dropped connection. Without
tmux, a dropped SSH connection ends the process, but the session is saved:ssh devbox,cd ~/src/webappandclaude --continue.
Bring it to your laptop by hand
When you want to continue on the laptop, with its checkout, editor and tools:
-
Move the code. On the server, commit and push. On the laptop, pull. If the server can’t push to your remote, fetch from it directly:
git fetch devbox:src/webapp <branch>. -
Quit the session on the server.
-
Copy the transcript into the laptop’s project folder for where the repository lives there:
mkdir -p ~/.claude/projects/-Users-alice-src-webapp scp devbox:.claude/projects/-home-alice-src-webapp/<id>.jsonl ~/.claude/projects/-Users-alice-src-webapp/ -
Fix the paths. Every tool call in the transcript names
/home/alice/src/webapp; on the laptop it’s/Users/alice/src/webapp. Replace the full prefix with the new one, and nothing shorter, or/home/alialso matches/home/alice2. -
Resume:
cd ~/src/webapp && claude --resume <id>.
If you skip step 4, Claude Code still opens the session, but Claude believes it’s in the server’s folder, and its first edits can aim at paths that don’t exist on the laptop. If claude --resume <id> says No conversation found with session ID, see “No conversation found” after copying.
And the other way: laptop to server
Same steps, reversed: push from the laptop, pull on the server, copy the transcript to devbox:~/.claude/projects/-home-alice-src-webapp/, rewrite /Users/alice to /home/alice, then on the server run claude --resume <id> inside tmux. Useful when a long task should keep going after you close the laptop.
Do it with hopsesh
hopsesh is a free, open-source command-line tool, terminal UI and app for macOS and Windows that moves Claude Code and Codex sessions between your computers over your own SSH. The server needs only an SSH server and its sessions; hopsesh uses your ~/.ssh/config, including aliases, ProxyJump and ProxyCommand.
Server to laptop
On the laptop:
hopsesh hosts allow devbox # an alias from ~/.ssh/config
hopsesh trust devbox # confirm its host key
hopsesh ls # sessions on the laptop and on devbox, by repository
hopsesh pull devbox:"fix flaky tests" # plan, confirm, move, print claude --resume
hopsesh finds the repository on the laptop by its git remote or clones it, brings the code to the session’s commit (fetching it straight from the server if it was never pushed), rewrites /home/alice/... to /Users/alice/... in one pass without touching ids or signed thinking blocks, and installs the transcript where Claude Code looks. The server’s copy refuses new prompts until you move the session back.
A server that logs in with a password works too: hopsesh hosts add devbox alice@10.0.0.5 --password, and hopsesh hosts setup-key devbox installs your key and forgets the password.
Laptop to server
The laptop usually can’t be reached from the server, so you send from the laptop. That needs hopsesh on the server, set up from the laptop:
hopsesh hosts setup devbox # copy this hopsesh there and start it at login
# then on devbox: hopsesh receive on (off by default)
hopsesh push <id> devbox # send the session from the laptop
The server plans with its own agents and settings against a read-only copy of that session’s files, and nothing changes until you confirm. hopsesh undo on the laptop reverses both sides.
Or continue it on the server from the laptop
With hopsesh set up on the server, hopsesh terminals run devbox --resume <id> continues the session where it is, in a terminal on the server that you use from the laptop. hopsesh also shows whether Remote Control reaches each running Claude Code session on the server, and can make every new session there start connected.
Uncommitted files stay where they are, and the plan says so. hopsesh has no server of its own, no relay and no telemetry. It is alpha software, and an independent project, not affiliated with Anthropic or OpenAI. More: hopsesh vs Remote Control.
Sessions on a remote server
Where is a Claude Code session I ran over SSH?
On the server, in ~/.claude/projects, under a folder named after the server’s path, such as -home-alice-src-webapp. Claude Code ran there and saved it there; your laptop can’t see it.
How do I keep a Claude Code session running after I disconnect from SSH?
Run Claude Code inside tmux or screen on the server. With Remote Control on, you can also drive it from claude.ai/code or the Claude app; Claude Code’s documentation recommends tmux or screen for that, because Remote Control goes offline when the claude process stops.
Does the server need hopsesh installed?
Not to bring a session to your laptop: hopsesh pull needs only SSH on the server. To send a session from your laptop to the server, hopsesh has to run there and receive sessions; hopsesh hosts setup puts it there from the laptop.
What about commits I never pushed from the server?
hopsesh fetches the commit the session last saw straight from the server and fast-forwards a clean checkout on the laptop. It never merges, rebases or stashes. Uncommitted files stay on the server, and the plan says so.
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 →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.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.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