Sandbox
@xhluca/session-migrate

Session migration CLI for coding agents

session-migrate is a Python tool that moves a native agent session from one harness to another, then lets you resume it in the target client. It supports many sources and targets, including Claude Code, Codex, Pi, OpenCode, Copilot CLI, Cursor, Mistral Vibe, Muse Code, Qwen Code, Kimi Code, Grok, Kilo Code, OpenHands, Hermes, MastraCode, and Devin.

92 stars6 forksPythonUpdated 14d ago
Who it's for

Builders who want to continue the same coding session in a different agent harness.

What it delivers

You can carry an active agent conversation into another client and keep working from the same history.

What it does

Cross-harness session transfer

Converts a session from one supported harness into another supported native format.

Session catalog search

Finds older sessions by title, name, ID, format, lifecycle, and date before transferring them.

Inspect without printing conversation

Shows native session metadata and structure without dumping the full chat.

Validated native adapters

Uses per-format readers and writers backed by tests and native corpus validation.

Command-line resume flow

Produces a new target session ID so you can resume it in the destination client.

How to get it

  1. 1Run
    curl -LsSf https://session-migrate.github.io/install.sh | sh
  2. 2Or install with uv
    uv tool install session-migrate
  3. 3Inspect any native transcript without printing its conversation
    smigrate inspect ~/.claude/projects/-work/SESSION.jsonl
  4. 4Move a Claude session into Codex and resume it from the same project directory
    smigrate transfer SESSION_UUID --from claude --to codex --cwd "$PWD"
    codex resume NEW_SESSION_UUID
  5. 5Or find an older session by its native title/name first
    smigrate catalog refresh
    smigrate catalog search "oauth refresh" --format claude
    smigrate transfer --title "oauth refresh" --from claude --to pi

README

session-migrate

Migrate your sessions to any harness.

PyPI version Total PyPI downloads Python versions MIT license Project website

A Claude Code session migrated and continued inside the native Pi TUI

Move coding agent sessions among Claude Code, Codex, Pi, Oh My Pi, OpenCode, GitHub Copilot CLI, Antigravity CLI, Cursor Agent, Mistral Vibe, Muse Code, Qwen Code, and Kimi Code, Grok, Kilo Code, OpenHands, Hermes Agent, MastraCode, and Devin.

Install

curl -LsSf https://session-migrate.github.io/install.sh | sh

Or install with uv:

uv tool install session-migrate

pipx install session-migrate works too. Python 3.11+ and Linux are currently supported. The full command is session-migrate; smigrate is the shorthand. Already installed? Run uv tool upgrade session-migrate.

Quick start

Inspect any native transcript without printing its conversation:

smigrate inspect ~/.claude/projects/-work/SESSION.jsonl

Move a Claude session into Codex and resume it from the same project directory:

smigrate transfer SESSION_UUID --from claude --to codex --cwd "$PWD"
codex resume NEW_SESSION_UUID

Or find an older session by its native title/name first:

smigrate catalog refresh
smigrate catalog search "oauth refresh" --format claude
smigrate transfer --title "oauth refresh" --from claude --to pi

Search is case-insensitive and every word must match, in any order. It searches native titles, names, and IDs—not conversation bodies. A few useful patterns:

# “Fix flaky PostgreSQL timeout” also matches this reversed keyword order.
smigrate catalog search "timeout postgres"

# Find a release conversation among archived Codex sessions from this month.
smigrate catalog search "release notes" --format codex \
  --lifecycle archived --since 2026-08-01T00:00:00Z

# Opt in to matching a project directory when the title is vague.
smigrate catalog search "checkout api" --include-paths

catalog refresh is exhaustive inside the default, environment-selected, registered, and explicitly discovered roots. It does not crawl your whole disk.

Give it to your coding agent

Choose the route on the project website, or replace the three bracketed values yourself:

Follow https://session-migrate.github.io/llms.txt to migrate a session from [SOURCE] to [TARGET]. Session: [UUID OR TITLE]

The linked procedure is sandbox-tested with both Claude Code and Codex. See the agent workflow and verification.

Compatibility

Claude Code logo
Claude Code
Codex logo
Codex
Pi logo
Pi
Oh My Pi logo
Oh My Pi
OpenCode logo
OpenCode
Copilot logo
Copilot
Antigravity logo
Antigravity
Mistral Vibe logo
Mistral Vibe
Muse Code logo
Muse Code
Qwen Code logo
Qwen Code
Kimi Code logo
Kimi Code
Grok logo
Grok
Kilo Code logo
Kilo Code
OpenHands logo
OpenHands
Hermes Agent logo
Hermes Agent
MastraCode logo
MastraCode
Devin logo
Devin
Cursor logo
Cursor*

Every listed format can be a source or target: 324 ordered routes, including same-format portable rewrites. Cursor deliberately transfers only ordered user/assistant text and is pinned to one exact Linux build; it is not a vendor-supported import API. Same-format migration creates a new independent session—it is not a byte-for-byte clone or a live sync. The matrix is exercised from one exact native-produced source per harness.

What survives

Session dataResultNotes
User and assistant messagesPreserved in order on every route
Tool calls and results✓ / partialPreserved when both adapters support the native shape
Images✓ / partialSupported image blocks move; other media is format-dependent
Compaction summaries✓ / partialRecreated where the target has a portable equivalent
Readable reasoningVibe-only portable rewriteVibe keeps its explicit readable field when rewritten to Vibe; other/private/signed traces never move
Session name, ID, and picker entry✓ / partialThe target gets a new native identity; OpenHands derives its picker title from the first user turn
Branches, forks, and subagentsNot flattenedCataloged separately where detectable; migrate the parent session
Private or signed thinkingNoModel/provider-bound traces are deliberately omitted
Auth, hooks, policies, MCP, and runtime configNoThese remain with the source client

Every omission or transformation is counted in a content-free migration manifest. The source session is never modified. Cursor intentionally accepts text only. See Pi thinking traces.

How it works

native session → validated event timeline → native target → resume

Each reader projects a versioned native transcript into a small ordered model. Each writer then emits only structures verified against the target CLI. This is session migration, not text export: the target receives a discoverable, resumable native session.

More

The Antigravity and Cursor adapters are clean-room, unofficial, and version-pinned. Their independently observed formats are published separately: Antigravity research and Cursor research.

The demo above uses real native casts recorded with the same tmux + asciinema approach as agent-talk. Claude diagnoses a boundary bug in a small project; the migrated session is reopened in Pi, which applies the proposed patch and runs the regression test. It shows the source TUI, the migration command, the shared history, and the continued target session. The website plays those casts directly in JavaScript; the README animation is rendered from that same scene. The same source session is also continued in Claude → Codex. Watch the larger-text Pi video, watch the larger-text Codex video, or reproduce both. The recorder uses disposable credential copies only to drive the native clients; the published assets contain only the controlled demo project and omit account status.

Compare Claude Code → Pi inside the native clients
Before · Claude Code TUIAfter · Pi TUI
Claude Code native session before migrationMigrated session continued inside the native Pi TUI
Compare Claude Code → Codex inside the native clients
Before · Claude Code TUIAfter · Codex TUI
Claude Code native session before migrationMigrated session continued inside the native Codex TUI
session-migrate project website

Contributing

git clone https://github.com/xhluca/session-migrate.git
cd session-migrate
uv sync --dev
uv run pytest

See the development guide before changing a native adapter. New formats need sanitized fixtures and a real native-resume oracle.

License

MIT

Files in the repo

Repository payload17 top-level entries
  • .claude
  • .github
  • docs
  • scripts
  • src
  • tests
  • website
  • .gitignore
  • .python-version
  • CHANGELOG.md
  • install.sh
  • LICENSE
  • llms.txt
  • pyproject.toml
  • README.md
  • THIRD_PARTY_NOTICES.md
  • uv.lock

Discussion (0)

Ask about usage, or say what you built with it

Sign in to join the discussion.

No comments yet. Be the first to say what this is good for.

More tools

JuliusBrussee/
caveman

🪨 why use many token when few token do trick — Claude Code skill that cuts 65% of tokens by talking like caveman

105k
1 add
MemPalace/
mempalace

The best-benchmarked open-source AI memory system. And it's free.

59k
stablyai/
orca

Orca is the ADE for working with a fleet of parallel agents. Run any coding agent with your own subscription. Available on desktop, mobile and remote runtime.

66k

A cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Grok Build & Hermes Agent. Only official website: ccswitch.io

132k

Never stop coding. Free MIT AI gateway: one endpoint, 352 providers (150+ free), 1200+ models Kimi, Claude, GPT, Gemini, GLM, DeepSeek, MiniMax. Works with Claude Code, Codex, Cursor, OpenCode, Cline & Copilot. Quota-aware auto-fallback, RTK+Caveman compression saves 15-95% tokens, MCP/A2A, Desktop/PWA. Built by 550+ contributors

64k
headroomlabs-ai/
headroom

Compress tool outputs, logs, files, and RAG chunks before they reach the LLM. 20% fewer tokens for coding agents, 60-95% fewer tokens for JSON, same answers. Library, proxy, MCP server.

71k