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.1.tar.gz (32.6 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.1-py3-none-any.whl (31.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: handoff_agent-0.1.1.tar.gz
  • Upload date:
  • Size: 32.6 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.1.tar.gz
Algorithm Hash digest
SHA256 f9a6322577db79567732de92c3be5ceb52c82ddd1792f2b64752f59b6ce35889
MD5 dc51dd9475b400c1026c938dd48fcf10
BLAKE2b-256 b8a0b2316bcebb4527ec61931cdafaa9532915700dea39f26735c9bf600678d2

See more details on using hashes here.

Provenance

The following attestation bundles were made for handoff_agent-0.1.1.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.1-py3-none-any.whl.

File metadata

  • Download URL: handoff_agent-0.1.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e46cbf168c43a7cbe9f50743312ae549b1e5471ba26488da611ae60573f20724
MD5 20816cb8b79335658cbed337ddbd5c29
BLAKE2b-256 b91553868ab10abe5aade91ad64947eb0d9a8324005c6ea358bf3542595616be

See more details on using hashes here.

Provenance

The following attestation bundles were made for handoff_agent-0.1.1-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