Hand off a live Claude Code session from any machine (laptop, or iPhone via a claude.ai cloud session) to your desktop with one line — the desktop picks it up within ~30 seconds and continues the work automatically, uninterrupted.
laptop / iPhone session desktop (this machine)
┌─────────────────────────┐ ┌──────────────────────────────┐
│ paste one-liner into │ private │ ClaudeHandoffReceiver task │
│ Claude Code │ GitHub repo │ polls inbox every 30s │
│ → bundles transcript │ ─────────────▶ │ → installs transcript │
│ + workspace │ (or OneDrive) │ → restores workspace │
│ → uploads bundle │ │ → claude -p --resume … │
└─────────────────────────┘ └──────────────────────────────┘
Paste this into the remote Claude Code session (it will run it and stop):
Mac / Linux / claude.ai cloud sessions (bash):
Run this command, then stop working and confirm the handoff:
curl -fsSL https://raw.githubusercontent.com/sriptcollector/claude-handoff/main/handoff.sh | bash
Windows laptop (PowerShell):
Run this command, then stop working and confirm the handoff:
iwr -useb https://raw.githubusercontent.com/sriptcollector/claude-handoff/main/handoff.ps1 | iex
iPhone (Claude Code on claude.ai, no gh auth in the sandbox): include a token:
Run this command, then stop working and confirm the handoff:
curl -fsSL https://raw.githubusercontent.com/sriptcollector/claude-handoff/main/handoff.sh | HANDOFF_TOKEN=github_pat_XXXX bash
On claude.ai cloud sessions the sandbox network must allow
api.github.comandraw.githubusercontent.com(set session network access to allow GitHub).
- the full session transcript (
~/.claude/projects/<slug>/<session-id>.jsonl) → installed on the desktop withcwdfields rewritten to the local workspace - per-session todo lists
- the workspace:
- git repo with a GitHub remote → branch + base commit + one patch of all committed-but-unpushed and uncommitted changes + untracked files (desktop re-clones and re-applies; no push to your real repo needed)
- anything else → tarball of the directory (minus
node_modules,.git, build dirs), capped at 80 MB
The desktop then runs, headless and hidden:
claude -p --resume <session-id> --dangerously-skip-permissions "<continue prompt>"
so the agent keeps working with full permissions until the task completes.
Resume output: %USERPROFILE%\.claude-handoff\logs\resume-*.log.
To take over interactively later: claude --resume <session-id> in the workspace dir.
HANDOFF_TOKEN— GitHub fine-grained PAT. Create at https://github.com/settings/personal-access-tokens/new: Only select repositories →claude-handoff-inbox→ Repository permissions → Contents: Read and write. This is the only setup needed for iPhone/cloud use.ghCLI already authenticated (typical for your own laptop)- plain
gitpush with ambient credentials - OneDrive — drops the bundle in
OneDrive/claude-handoff/inbox/(no network auth needed; works if the machine syncs the same OneDrive)
git clone https://github.com/sriptcollector/claude-handoff
cd claude-handoff
powershell -ExecutionPolicy Bypass -File receiver\install-receiver.ps1Requires: gh authenticated, claude on PATH, Windows 10+ (bundled tar).
Registers scheduled task ClaudeHandoffReceiver (runs at logon + 5-minute
keep-alive; a mutex prevents duplicate instances).
claude-handoff(public) — these scripts only, no secretsclaude-handoff-inbox(private) — transient bundle drop-box; bundles are deleted after processing (local copies kept in%USERPROFILE%\.claude-handoff\archive)
%USERPROFILE%\.claude-handoff\config.json: inboxRepo, pollSeconds,
workspaceRoot (where non-local workspaces are materialized), oneDriveInbox,
ghPath, claudePath, claudeArgs (drop --dangerously-skip-permissions here
if you want the resumed agent sandboxed — it will then pause on permission
prompts instead of running uninterrupted), continuePrompt.
- Resumed sessions authenticate with the desktop's claude.ai login — the
resume job clears
ANTHROPIC_API_KEY/ANTHROPIC_AUTH_TOKENbecause the scheduled-task environment can carry a stale key (this showed up as401 API key is invalid). If resumes 401, runclaude /loginon the desktop. - Receiver log:
%USERPROFILE%\.claude-handoff\logs\receiver.log - Run one poll in the foreground:
powershell -File receiver\receive.ps1 -Once - Task status:
Get-ScheduledTask ClaudeHandoffReceiver | Get-ScheduledTaskInfo - A processed bundle that failed stays in
.claude-handoff\archive— reprocess by copying it into the OneDrive inbox folder.
- Session transcripts can contain code and secrets — the inbox repo must stay private, and the PAT should be scoped to only that repo.
- The resumed session runs with
--dangerously-skip-permissionsby default so it is truly uninterrupted; remove it fromclaudeArgsif you prefer safety over autonomy.