Skip to main content

Seamlessly switch between AI coding agents without losing context.

Project description

handoff

Seamlessly switch between AI coding agents without losing context.

$ handoff codex claude
✓ Found Codex session 019cdd7f (42 messages, 1h 23m) Extracted context
✓ Created Claude session: 4c9b7967-90d7-4fab-8e1d-6a95f1b3c8e2
  ~/.claude/projects/-Users-me-app/4c9b7967-....jsonl
Ready to continue!

What it does

When you switch between AI coding agents mid-project — rate limits, a second opinion, tool preference — you normally lose conversation history. handoff reads the transcript from one agent's home directory and injects it into another, so you can pick up exactly where you left off.

Install

The CLI is named handoff; the PyPI distribution is handoff-agent (the short name was already taken):

# uv (recommended)
uv tool install handoff-agent

# pip
pip install handoff-agent

Usage

# Transfer the most recent Codex session for this project into Claude Code
handoff codex claude

# Reverse it
handoff claude codex

# Three-way — OpenCode is also supported
handoff codex opencode
handoff opencode claude

# See what would happen, don't touch anything
handoff codex claude --dry-run --format markdown

# Extract only, print to stdout (great for piping into LLM review)
handoff codex claude --no-inject > /tmp/session.md

# Pick a specific source session
handoff codex claude --session-id 019cdd7f

Other commands

handoff list                 # sessions available for the current project
handoff list --agent codex   # filtered by agent
handoff list --all           # sessions across all projects

handoff status               # project + latest session per agent
handoff agents               # show registered adapters (built-in + plugins)

handoff config               # view configuration
handoff config --edit        # edit configuration

handoff completion zsh       # emit a zsh completion script
handoff completion zsh --install   # show install one-liner

Supported agents

Agent Storage Extract Inject
Claude Code ~/.claude/projects/<encoded-cwd>/<uuid>.jsonl
OpenAI Codex ~/.codex/sessions/YYYY/MM/DD/rollout-*.jsonl
OpenCode ~/.local/share/opencode/storage/

Cursor and GitHub Copilot Chat are on the roadmap — they live inside VS Code's SQLite state, which needs a different adapter approach.

Configuration

~/.handoff/config.toml is created with defaults on first run:

[agents]
claude_home = "~/.claude"
codex_home = "~/.codex"
# opencode follows XDG_DATA_HOME; override below if yours lives somewhere else.
# opencode_home = "~/.local/share/opencode"

[defaults]
redact_secrets = true
auto_inject = true
format = "native"

[redaction]
enabled = true
patterns = [
    "OPENAI_API_KEY=.*",
    "ANTHROPIC_API_KEY=.*",
    "Bearer [a-zA-Z0-9_\\-\\.]{20,}",
    "sk-[a-zA-Z0-9]{20,}",
]

Redaction is best-effort — the default patterns cover the common API-key shapes (OpenAI, Anthropic, GitHub, AWS, Bearer, PEM) but you should still review transcripts before sharing them externally.

Plugins

Add support for a new agent by publishing a package that registers an extractor/injector under the handoff.agents entry-point group:

# your_package/pyproject.toml
[project.entry-points."handoff.agents"]
aider = "your_package.aider:register"
# your_package/aider.py
from handoff.agents.base import register_extractor, register_injector

def register() -> None:
    register_extractor("aider", lambda home: AiderExtractor(home))
    register_injector("aider", lambda home: AiderInjector(home))

Install the plugin alongside handoff and handoff aider claude will just work.

See src/handoff/agents/opencode.py for a complete, real-world implementation.

Safety

  • Non-destructive. Source sessions are never modified.
  • Injected files are created with mode 0600.
  • Session IDs are generated with uuid4 / secrets — no collisions with source agents.
  • Path-traversal guards on the Claude project-dir encoder.
  • Redaction runs by default. Turn it off with --no-redact-secrets or [defaults] redact_secrets = false.

Development

uv sync
uv run pytest
uv run ruff check .
uv run ruff format .
uv build                    # produces dist/*.whl + *.tar.gz

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

handoff_agent-0.1.2.tar.gz (32.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

handoff_agent-0.1.2-py3-none-any.whl (31.2 kB view details)

Uploaded Python 3

File details

Details for the file handoff_agent-0.1.2.tar.gz.

File metadata

  • Download URL: handoff_agent-0.1.2.tar.gz
  • Upload date:
  • Size: 32.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for handoff_agent-0.1.2.tar.gz
Algorithm Hash digest
SHA256 773fa1b6e30d5efd6b084af08c80c1cd5627dc5d008c2962ea30a8e2f722043c
MD5 424b9b32ca5ffb1d2dc5ecc6a85c3168
BLAKE2b-256 7e4a7acff5029f192f83fabc948d1535160631565d28236427c05d9630feb1b1

See more details on using hashes here.

Provenance

The following attestation bundles were made for handoff_agent-0.1.2.tar.gz:

Publisher: release.yml on HacksonClark/handoff

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file handoff_agent-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: handoff_agent-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 31.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for handoff_agent-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f443fcf70984db803c02c87923f93db1b7f0a8fb5487dbc77c410bc7cf674a4e
MD5 c5b986f8ae3b4c778b51671a0d016352
BLAKE2b-256 4c77ecd284a561f6296e409c04424b73f3c55bfbc063796eb78416e7730d2015

See more details on using hashes here.

Provenance

The following attestation bundles were made for handoff_agent-0.1.2-py3-none-any.whl:

Publisher: release.yml on HacksonClark/handoff

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page