r/ClaudeCode • • 3h ago

Built with Claude claude-sync: resume a Claude Code session on your other machine (rewrites the paths so --resume finds it)

I run Claude Code on a Mac and a Linux box and switch between them several times a day. claude --resume only lists sessions from the machine you're on, and copying ~/.claude/projects over doesn't work: each project's folder is named after its absolute path with every non-alphanumeric character turned into -, so /home/alice/work/shop is -home-alice-work-shop, and the paths repeat inside the session JSONL. On the Mac, Claude Code looks for -Users-alice-work-shop and finds nothing.

So I built claude-sync. It moves sessions over SSH and rsync and rewrites the paths in both the folder names and the file contents. Swapping the home covers everything under ~; projects outside it get a mapping:

[remotes.linux]
host = "linux-box"
home = "/home/alice"
>
[mappings]                # local path = path on the remote
"/Volumes/data/src" = "/data/src"

Then claude-sync push / claude-sync pull, with diff and --dry-run to see the plan first and . to sync just the project you're in. Pulls keep a mirror cache, so a pull with little to do takes about a second.

It also merges ~/.claude/history.jsonl (what ↑ and Ctrl-R recall) instead of copying it, under Claude Code's own lock.

Safety rules, since this is your session history:

  • It never deletes a session file; rsync -u, the newer file wins.
  • It won't run while Claude Code is running, since sessions are written mid-run.
  • The first pull into existing sessions offers a tarball backup.
  • It skips the temp-dir projects coding agents create (520 of my 739 project folders).
  • If a mapping is ambiguous, it stops instead of guessing.

The gap it can't close: if the same session gets new turns on both machines between syncs, the newer file wins. Sync before you switch, or resume with --fork-session.

It started as claude-hop, a Python tool by SeiduTakizawa on GitHub; I rebuilt it in TypeScript on Bun with a pull cache and stricter merge rules. MIT, macOS and Linux. If you already use claude-hop, claude-sync import takes its config.

Install: mise use -g github:feniix/claude-sync

Repo: https://github.com/feniix/claude-sync Write-up: https://feniix-hq.net/blog/claude-sync/?utm_source=reddit

1 Upvotes

2 comments sorted by

•

u/AutoModerator 3h ago

Hey! Thanks for posting to r/ClaudeCode

While participating in this thread, please follow our community rules. Keep discussions constructive. Attack the idea, not the person.

For help, project discussions, tips, and general chat, join the ClaudeCode Discord.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

2

u/nvrmtcup 2h ago

I just use a small powershell script