Skip to content

About

Hand off a live Claude Code session from any machine to your desktop with one line; picked up in ~30s

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

5 Commits

Folders and files

Repository files navigation

claude-handoff

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 …      │
└─────────────────────────┘                └──────────────────────────────┘

The one-liner

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.com and raw.githubusercontent.com (set session network access to allow GitHub).

What gets moved

  • the full session transcript (~/.claude/projects/<slug>/<session-id>.jsonl) → installed on the desktop with cwd fields 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.

Sender auth (first match wins)

  1. 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.
  2. gh CLI already authenticated (typical for your own laptop)
  3. plain git push with ambient credentials
  4. OneDrive — drops the bundle in OneDrive/claude-handoff/inbox/ (no network auth needed; works if the machine syncs the same OneDrive)

Desktop setup (one time — already done on this machine)

git clone https://github.com/sriptcollector/claude-handoff
cd claude-handoff
powershell -ExecutionPolicy Bypass -File receiver\install-receiver.ps1

Requires: 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).

Repos

  • claude-handoff (public) — these scripts only, no secrets
  • claude-handoff-inbox (private) — transient bundle drop-box; bundles are deleted after processing (local copies kept in %USERPROFILE%\.claude-handoff\archive)

Config

%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.

Troubleshooting

  • Resumed sessions authenticate with the desktop's claude.ai login — the resume job clears ANTHROPIC_API_KEY/ANTHROPIC_AUTH_TOKEN because the scheduled-task environment can carry a stale key (this showed up as 401 API key is invalid). If resumes 401, run claude /login on 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.

Security notes

  • 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-permissions by default so it is truly uninterrupted; remove it from claudeArgs if you prefer safety over autonomy.

About

Hand off a live Claude Code session from any machine to your desktop with one line; picked up in ~30s

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages