claude-handoff
Health Gecti
- License — License: MIT
- Description — Repository has a description
- Active repo — Last push 0 days ago
- Community trust — 12 GitHub stars
Code Basarisiz
- rm -rf — Recursive force deletion command in scripts/roundtrip-test.sh
- execSync — Synchronous shell command execution in src/commands/export.ts
- os.homedir — User home directory access in src/commands/export.ts
- os.homedir — User home directory access in src/commands/import.ts
- os.homedir — User home directory access in src/commands/skill.ts
Permissions Gecti
- Permissions — No dangerous permissions requested
Bu listing icin henuz AI raporu yok.
Move or share Claude Code sessions with another machine or a teammate. Rewrites paths, redacts secrets, claude --resume picks it up.
claude-handoff
Move or share Claude Code sessions with another machine or a teammate,
through git or a single file. Local paths are rewritten, secrets are
redacted, and claude --resume picks the session up on the other side.
Claude Code keeps every conversation in ~/.claude/projects/ on your
local machine — full transcripts, decisions, tool calls, accumulated
memory. Nothing syncs to the repo. Nothing travels with git push.
When a teammate picks up the branch, they get the code but none of
the reasoning.
claude-handoff packages that context into ./.claude-shared/ on
export, scrubs local absolute paths and secrets, and reconstructs it
into the teammate's ~/.claude/projects/ on import. claude --resume
then shows the shared session with its original title and full
history intact.
Install
npm install -g @neoacar/claude-handoff
Then run claude-handoff from any project directory.
The flow
# Alice's machine, in the project
claude-handoff export # pick a session from the list
git add .claude-shared/ && git commit -m "handoff" && git push
# Neo's machine
git pull
claude-handoff import # reconstruct sessions under ~/.claude/projects/
claude --resume # pick Alice's session, keep going
There is no setup step. export shows your sessions by title, the wayclaude --resume does; arrow keys and Enter choose one. Alice's session
then shows up in Neo's /resume picker with its original title and
100% of the conversation history, tool calls, and subagent transcripts.
No shared repo? Send one file instead:
# sender
claude-handoff export -o # pick a session; writes <its-title>.handoff
# ...send the file any way you like...
# receiver, in their checkout of the project
claude-handoff import fix-login-bug.handoff
The file holds the same redacted bundle and is checksummed, so a
damaged or half-downloaded file is refused instead of half-imported.
Iteration. The same session can ping-pong through the repo
multiple times. After Neo resumes and keeps working, Neo runsexport again and Alice imports the follow-up. Each round's
author and timestamp is preserved in the manifest, so you can see
who added what. Concurrent editing (both sides resuming at once
and both appending) is not yet supported — use the tool for
sequential handoff.
What the receiver is told. A shared session only makes sense next
to the code it talks about. Export records the commit it was made from
and which files the session edited; if some of those edits were never
committed, it says so before you share. On import, Neo is warned when
his checkout lacks that commit or those edits. Each bundle also carries
a HANDOFF.md — edited files, commands run, the last request — written
by the tool from the transcript, not by the model.
What ships across machines
Every session is exported as a bundle directory:
.claude-shared/sessions/<sessionId>/
main.jsonl # the transcript (streamed, path-rewritten, redacted)
metadata.json # author, timestamps, title
HANDOFF.md # what the session did, and what may be uncommitted
subagents/*.jsonl # Explore / Plan / general-purpose agent transcripts
subagents/*.meta.json # subagent metadata (agent type, description)
session-memory/*.md # session-scoped memory, when present
tool-results/* # large tool outputs the transcript points at by path
Plus optional project-level auto-memory (--memory flag) under.claude-shared/memory/. And a .manifest.json tying it all together.
On import, the layout is reconstructed exactly as Claude Code expects
it, with every absolute path rewritten from the sender's filesystem
to the receiver's.
Commands
| Command | What it does |
|---|---|
claude-handoff export [session] |
Export sessions; with nothing chosen, pick from a list |
claude-handoff import [file] |
Import from .claude-shared/, or from a .handoff file |
claude-handoff status |
Local vs shared sessions and what is not exported yet (-v for more) |
claude-handoff doctor |
Check the setup: sessions, Claude Code version, bundles, redaction |
claude-handoff skill install |
Let Claude Code run handoffs when you ask it to |
Running claude-handoff alone shows status.
Choosing what to export
claude-handoff export pick from a list (arrow keys, Enter)
claude-handoff export "<title words>" sessions whose title contains these words
claude-handoff export -n 1 the most recent session (-n 3 for three)
claude-handoff export --all every session of this project
A session's title is the one claude --resume shows: the name you gave
it, else the one Claude Code generated, else the first thing you asked.
An ID prefix works in place of title words. When the output isn't a
terminal (a script, or Claude Code running the command), a bareexport prints the list and writes nothing.
Add -o to write one .handoff file instead of .claude-shared/ — it
is named after the session, or -o <name> names it yourself. Add--memory to include the project's auto-memory files (MEMORY.md
excluded; Claude Code regenerates it), and --dry-run to preview.
Import
claude-handoff import reads .claude-shared/; claude-handoff import <file> reads a .handoff file (the extension may be left off).--dry-run previews.
When the shared bundle is ahead of your local copy (teammate
shared newer work), import catches you up on its own. When your
local copy has unshared work (you resumed after the last import),import skips it and says so; --overwrite discards the local
changes and takes the bundle. Pass it only when you mean to.
Less common export options
--since <date> only sessions started on or after an ISO date
--author <name> name recorded in the bundle (default: git user.name)
--keep-signatures keep signed thinking blocks (default: strip them, to
avoid API 400s after resuming under another API key)
--force export even if the shared bundle looks newer than
your local copy
--no-env-scan do not scrub values found in .env files and
secret-named environment variables
--no-redact turn redaction off; needs --i-know-what-im-doing too
Custom redaction patterns
Create .claude-handoff-ignore at the project root with one regex
per line (# for comments). Each pattern is applied on top of the
built-in ones, with matches replaced by [REDACTED:custom-N]. Check
it in so the whole team shares the same scrub rules.
Letting Claude Code do it
claude-handoff skill install writes a skill to~/.claude/skills/claude-handoff/. After that you can say "hand this
session off to a teammate" in Claude Code and the agent previews,
exports and reports the redactions. It never commits, pushes, or turns
redaction off; those stay with you. claude-handoff skill print shows
the file without installing it.
How it handles the tricky parts
- Path rewriting. Absolute paths like
/home/alice/myapp/file.ts
become portable placeholders ({{PROJECT_ROOT}}/file.ts) on export,
translate back to the receiver's paths on import. Path-component
boundary-aware: a project namedauthnever accidentally rewrites
the wordauthinside source code. - Claude store keys. Memory files and in-transcript references to
~/.claude/projects/<key>/...go through a{{CLAUDE_STORE}}
placeholder so they land at the receiver's key, not the sender's. - Secret redaction. 15 built-in patterns (AWS, GitHub classic and
fine-grained, Anthropic, OpenAI includingsk-proj-, Google, Slack
tokens and webhooks, bearer tokens, password andapi_key/secret/tokenassignments, passwords inhttps://andpostgres://-style URLs, PEM blocks) replace matches with[REDACTED:type]. Overlapping matches are merged into one
redaction, so a key is never left half-removed. Export reports both
the count of unique secrets found and the total markers written; a
redaction log lives at.claude-handoff/redaction-log.json
(gitignored) for review. - Your project's own secrets. Patterns only know shapes; a
database password has none. Export reads the project's.envfiles
(not.env.exampleand friends) and secret-named environment
variables, and removes those exact values wherever they appear,
marked[REDACTED:env:DB_PASSWORD]. It knows the value as written,
JSON-escaped and URL-encoded; other encodings (base64, for one) are
not recognised. Values that are short, numeric,
or look like ordinary settings (development, a port, a path) are
left alone.--no-env-scanturns this off. - A secret named once is scrubbed everywhere. A value found next to
a label (password=,API_KEY=,Bearer) is also removed where it
later appears on its own, such as in acurlheader. - Account identity scrubbing. Recent Claude Code versions record
the signed-in account's email, account UUID and organization UUID
inside the transcript. Export learns both from the session and scrubs them
everywhere in the bundle ([REDACTED:account-email], a nil UUID),
reported asaccount-email/account-orgin the redaction log.
Bundles written by 0.2.0 or earlier still contain them; runningexportwith a current version rewrites those bundles automatically. Anything
already committed stays in git history. - Project store resolution. Not a naive slug match — canonicalizes
the project root (realpath+ Unicode NFC) and, if the computed key
misses, falls back to readingcwdfields from candidate session
files until it finds the right one. Survives symlinks, macOS vs
Linux Unicode differences, and Claude Code slug-rule changes. - Malformed JSONL recovery. Real sessions occasionally contain
concatenated records or truncated lines. The parser tries}{
split recovery, warns on failure, and keeps going instead of
crashing. thinking.signaturestripping. Thinking-block signatures are
API-key + model bound. Resume doesn't validate them but the next
API turn can 400 on mismatch. Export strips them by default; pass--keep-signatureswhen you know the receiver shares your key/model.
Safety
- Redact by default.
--no-redactrequires a second--i-know-what-im-doingflag. No way to turn off redaction by
accident. - No auto-commit. The tool writes files; you run
git addandgit commityourself. Always reviewgit diff .claude-shared/
before pushing. - Never changes your source. It reads
~/.claude/and, for
redaction, the project's.envfiles;.envvalues are used in
memory only and are never written anywhere. It writes to.claude-shared/,.claude-handoff/(local log), the receiver's~/.claude/, and an archive file only where you name one. - It cleans what you share, not what the model saw. Redaction runs
when a session is exported. It does not stop a secret from reaching
Claude during the session — acat .envor a strayenvin a shell
command puts the value in front of the model and into the local
transcript, and anything exposed that way may still need rotating.
Masking tool output before the model sees it is a separate job, for
Claude Code itself (see
anthropics/claude-code#80153)
or a hook-based tool. - Redaction is a safety rail, not a guarantee. Patterns can't catch
every secret shape, and the.envscan only knows the values on the
exporting machine. Use.claude-handoff-ignorefor project-specific
patterns. Always diff before committing, and send an archive only to
people you would show the conversation to.
Known limitations
MEMORY.mdis not bundled. Claude Code regenerates it from the
sibling memory files via/dreamconsolidation; shipping a stale
one would stamp over the receiver's. Individual memory files are
bundled with--memory.- Windows untested. Slug computation and path rewriting have
only been validated on Linux. macOS should work (same POSIX paths- realpath + NFC handling). Windows likely needs work.
- Large sessions. Some sessions are 2 MB+. Consider
.gitattributeswith git-lfs on projects with many sessions. - Session forking. If Alice exports, Neo imports, Neo continues,
Neo exports — the merge story is "skip or overwrite" right now.
Proper fork/merge is future work.
FAQ
How do I move my Claude Code sessions to a new computer?
If the project sits at exactly the same absolute path on the new
machine, copying ~/.claude/projects/<key>/ across is enough. If the
path differs (another user name, another folder, another OS), runclaude-handoff export on the old machine and claude-handoff import
on the new one. The sessions are stored under a key made from the
project path, and every path inside the transcripts points to the old
location; the import rewrites both.
Why is /resume empty after I copied ~/.claude to another machine?
Each project's sessions live in ~/.claude/projects/<key>/, where<key> is the project's absolute path with every character other than
letters, digits and - replaced by -. /resume reads only the folder
for the directory you start Claude Code in, and it also hides sessions
whose recorded working directory is somewhere else. Copied to a
different path, the sessions sit under a key nothing reads.claude-handoff import files them under the new key and rewrites the
recorded paths, so they show up.
How do I share a Claude Code conversation with a teammate?
claude-handoff export and pick the session, then commit.claude-shared/ and push. Your teammate pulls and runsclaude-handoff import, then claude --resume. To keep it out of git
history, use claude-handoff export -o and send the .handoff file
directly; they run claude-handoff import <file>.
Is it safe to commit a Claude Code session?
Safer than copying the raw files, but not guaranteed safe. The export
redacts common token formats, values from your .env files and
environment, your account email and IDs, and local paths, and writes a
local log of every redaction for you to review. A transcript can still
hold secrets in shapes no pattern recognises, and everything you
discussed with Claude travels with it. Read git diff .claude-shared/
before committing, and share only with people you would show the
conversation to.
Does the receiver get the code changes too?
No. Code travels through git as usual. The bundle's HANDOFF.md lists
the branch and commit the session was on, and the import warns when that
commit is missing or when the sender had uncommitted edits.
Does it work with Codex or other agents?
No, only Claude Code.
Development
git clone https://github.com/NeoAcar/claude-handoff
cd claude-handoff
npm install
npm run build
npm test # vitest, ~270 tests
npm run lint # prettier --check + tsc --noEmit
npm link # optional: make `claude-handoff` available globally
How this relates to Remote Control
Claude Code now ships Remote Control
(/remote-control), which the maintainers point to in the cross-device
threads below. It lets you watch and steer a session that is still
running in a terminal from the browser or phone. The session keeps
living on the original machine.
claude-handoff covers the other case: the transcript itself moves, so
a teammate (or you, on another machine) can /resume it there with the
original machine switched off. Last verified end-to-end (export →
import → claude --resume) against Claude Code 2.1.331.claude-handoff doctor tells you if your Claude Code is newer than that.
Related discussions
- anthropics/claude-code#11455 — Session Handoff / Continuity Support (open, most active)
- anthropics/claude-code#44063 — Resume Any Claude Session in the CLI (closed by its author)
- anthropics/claude-code#31992 — Cross-machine session resume for CLI-to-CLI handoff (open)
- anthropics/claude-code#47926 — Allow resuming Claude Code sessions across devices (closed, answered with Remote Control)
- anthropics/claude-code#10368 — Chat Package Export/Import: Git-compatible format for team collaboration (the original request, closed/locked)
License
MIT — see LICENSE.
Yorumlar (0)
Yorum birakmak icin giris yap.
Yorum birakSonuc bulunamadi