
Cross Agent Session Resumer for coding agents: resume a session created in one provider (Claude Code, Codex, Gemini, and more) using a different provider by converting through a canonical session model.
curl -fsSL "https://raw.githubusercontent.com/Dicklesworthstone/cross_agent_session_resumer/main/install.sh?$(date +%s)" | bash
That installer is the primary distribution path. It handles platform detection, secure artifact verification, fallback source builds, shell completions, and agent-oriented local setup in one step.
The Problem: AI coding sessions are siloed by provider. A useful Codex session cannot be resumed directly in Claude Code, and vice versa.
The Solution: casr discovers a session across installed providers, reads it into a canonical IR, writes a native session file for your target provider, verifies read-back fidelity, and prints the exact resume command.
| Feature | What It Does |
|---|---|
| Cross-provider resume | casr cc resume <codex-session-id> and similar conversions in one command |
| Canonical IR | Normalizes provider formats into a common model, then exports back to native format |
| Native-format writers | Produces plausible provider-native session files, not intermediate-only exports |
| Safety-first writes | Atomic temp-then-rename writes, conflict detection, optional .bak backup with --force |
| Provider auto-detection | Finds which provider owns a session ID without user guesswork |
| Verification step | Re-reads written output to catch writer bugs before you try to resume |
| Machine-friendly output | --json mode for scripts and automation |
| Debuggability | --verbose, --trace, and structured tracing with RUST_LOG |
# 1) See what providers are available
casr providers
# 2) Find a session from any provider
casr list --limit 20 --sort date
# 3) Inspect a single session
casr info 019c3eae-94c3-7d73-9b2a-9edb18f1563b
# 4) Convert that session to Claude Code format
casr cc resume 019c3eae-94c3-7d73-9b2a-9edb18f1563b
# ergonomic shorthand (auto-detects source provider from the session ID)
casr -cc 019c3eae-94c3-7d73-9b2a-9edb18f1563b # open in Claude Code
casr -cod 019c3eae-94c3-7d73-9b2a-9edb18f1563b # open in Codex
casr -gmi 019c3eae-94c3-7d73-9b2a-9edb18f1563b # open in Gemini CLI
# 5) Resume in Claude Code using the generated ID
claude --resume <new-session-id>
| Capability | casr | Manual copy/paste | Read-only session search tools | Ad-hoc one-off scripts |
|---|---|---|---|---|
| Convert sessions between providers | Yes | No | No | Partial |
| Provider-native output files | Yes | No | No | Usually brittle |
| Auto-detect source provider by session ID | Yes | No | Sometimes | Rare |
| Atomic writes and conflict handling | Yes | No | N/A | Rare |
| Round-trip testable architecture | Yes | No | N/A | Rare |
| Structured JSON mode for automation | Yes | No | Sometimes | Depends |
| Provider | Alias | Read | Write | Resume command |
|---|---|---|---|---|
| Claude Code | cc |
Yes | Yes | claude --resume <session-id> |
| Codex | cod |
Yes | Yes | codex resume <session-id> |
| Gemini CLI | gmi |
Yes | Yes | gemini --resume <session-id> |
| Cursor | cur |
Yes | Yes | cursor . |
| Cline | cln |
Yes | Yes | code . |
| Aider | aid |
Yes | Yes | aider --restore-chat-history |
| Amp | amp |
Yes | Yes | amp threads continue --execute "Continue from @<session-id>" |
| OpenCode | opc |
Yes | Yes | opencode |
| ChatGPT | gpt |
Yes | Yes | open "https://chatgpt.com/c/<session-id>" |
| ClawdBot | cwb |
Yes | Yes | clawdbot --resume <session-id> |
| Vibe | vib |
Yes | Yes | vibe --resume <session-id> |
| Factory | fac |
Yes | Yes | factory --resume <session-id> |
| OpenClaw | ocl |
Yes | Yes | openclaw --resume <session-id> |
| Pi-Agent | pi |
Yes | Yes | pi --session <path-to-session.jsonl> |
Notes:
- Initial core focus is Claude Code, Codex, and Gemini CLI.
- Additional providers are implemented through the same Provider trait model.
curl | bash Installercurl -fsSL "https://raw.githubusercontent.com/Dicklesworthstone/cross_agent_session_resumer/main/install.sh?$(date +%s)" | bash
What this installer does for you:
| Capability | Behavior |
|---|---|
| Platform targeting | Detects Linux/macOS + x86_64/aarch64 and picks the right artifact |
| Supply-chain checks | Verifies SHA256 and Sigstore/cosign when available |
| Download fallback chain | Versioned release -> latest release naming variants -> source build |
| Airgap install | --offline <tarball> installs from local artifacts |
| Proxy-aware networking | Uses HTTPS_PROXY / HTTP_PROXY automatically |
| Shell UX | Installs completions for bash/zsh/fish |
| Agent setup | Installs casr skill for Claude/Codex and optional cc/cod/gmi wrappers |
High-value installer flags:
| Flag | Purpose |
|---|---|
--verify |
Runs post-install self-test |
--force |
Reinstall even if same version is already present |
--offline <tarball> |
Airgapped local install |
--from-source |
Build from source directly |
--easy-mode |
Auto-update PATH in shell rc files |
--yes |
Non-interactive prompt acceptance |
--no-configure |
Skip agent skill/wrapper setup |
--no-skill |
Skip Claude/Codex skill installation |
# Examples
bash install.sh --verify
bash install.sh --system --easy-mode --yes
bash install.sh --offline ./casr-x86_64-unknown-linux-musl.tar.xz
bash install.sh --no-configure --no-skill
Run bash install.sh --help for the full option set.
git clone https://github.com/Dicklesworthstone/cross_agent_session_resumer
cd cross_agent_session_resumer
cargo build --release
./target/release/casr --help
cargo install --path .
casr --help
cargo run -- --help
casr providers
casr list --sort date --limit 50
casr info <session-id>
casr <target-alias> resume <session-id>
# Examples
claude --resume <new-session-id>
codex resume <new-session-id>
gemini --resume <new-session-id>
Global flags:
--dry-run # Show what would happen without writing
--force # Overwrite existing target session (creates .bak backup)
--json # Structured JSON output
--verbose # Debug-level logging (casr=debug)
--trace # Trace-level logging (casr=trace)
--source <alias_or_path> # Explicit source provider alias or direct session path
--enrich # Add optional synthetic context/orientation messages
casr <target> resume <session-id>Convert a source session into target provider format and print the target resume command.
casr cc resume 019c3eae-94c3-7d73-9b2a-9edb18f1563b
casr claude resume 019c3eae-94c3-7d73-9b2a-9edb18f1563b # standard name fallback
casr cod resume 40f2cb68-fed7-4cee-83de-2b63ba9b7813 --dry-run
casr codex resume 40f2cb68-fed7-4cee-83de-2b63ba9b7813 --dry-run
casr gmi resume 40f2cb68-fed7-4cee-83de-2b63ba9b7813 --source cc
casr gemini resume 40f2cb68-fed7-4cee-83de-2b63ba9b7813 --source claude
casr cc resume <session-id> --force
casr cc resume <session-id> --json
casr listList sessions across installed providers.
casr list
casr list --provider codex
casr list --workspace /data/projects/myapp
casr list --limit 100 --sort messages
# default behavior (no args): current workspace only, top 10, styled table output
casr list
casr info <session-id>Show non-converting session details.
casr info 019c3eae-94c3-7d73-9b2a-9edb18f1563b
casr info 019c3eae-94c3-7d73-9b2a-9edb18f1563b --json
casr providersShow provider detection and installation evidence.
casr providers
casr completions <shell>Generate shell completions.
casr completions bash > /tmp/casr.bash
casr completions zsh > "${fpath[1]}/_casr"
casr completions fish > ~/.config/fish/completions/casr.fish
casr is primarily configured by environment variables.
# Optional provider home overrides for non-standard locations
export CLAUDE_HOME="$HOME/.claude"
export CODEX_HOME="$HOME/.codex"
export GEMINI_HOME="$HOME/.gemini"
export CURSOR_HOME="$HOME/.config/Cursor"
export CLINE_HOME="$HOME/.config/Code/User/globalStorage/saoudrizwan.claude-dev"
export AIDER_HOME="$HOME/.aider"
export AMP_HOME="$HOME/.local/share/amp"
export OPENCODE_HOME="$HOME/.opencode"
# Logging verbosity (alternative to --verbose / --trace)
export RUST_LOG="casr=debug"
# or:
export RUST_LOG="casr=trace"
Core model (conceptual):
CanonicalSession
- session_id: String
- provider_slug: String
- workspace: Option<PathBuf>
- title: Option<String>
- started_at: Option<epoch_millis>
- ended_at: Option<epoch_millis>
- messages: Vec<CanonicalMessage>
- metadata: serde_json::Value
- source_path: PathBuf
- model_name: Option<String>
CanonicalMessage
- idx: usize
- role: User | Assistant | Tool | System | Other(String)
- content: String
- timestamp: Option<epoch_millis>
- author: Option<String>
- tool_calls: Vec<ToolCall>
- tool_results: Vec<ToolResult>
- extra: serde_json::Value
Important helpers:
- flatten_content: normalizes mixed string/block content representations.
- parse_timestamp: normalizes ISO strings, epoch seconds, and epoch millis.
- normalize_role: maps provider-specific roles to canonical roles.
- reindex_messages: keeps message indices contiguous after filtering.
Input CLI
casr <target> resume <session-id>
|
v
Provider Registry + Detection
- discover installed providers
- optional --source narrowing
|
v
Session Discovery
- find owning provider + source path
|
v
Reader (Provider-specific native format -> CanonicalSession)
Claude/Codex/Gemini/etc.
|
v
Validation
- hard errors: empty / one-sided sessions
- warnings/info: missing workspace, timestamp gaps, metadata loss
|
v
Writer (CanonicalSession -> target native format)
- generate target session id
- preserve provider-specific extras when possible
|
v
Atomic Write + Conflict Handling
- temp file -> fsync -> rename
- optional --force backup (.bak)
|
v
Read-Back Verification
- re-read written session via target reader
- compare structural fidelity
|
v
Output
- human output with actionable steps
- optional JSON output for automation
casr is built for practical agent handoff problems, not only format conversion demos.
Common examples: - Start in Codex for rapid code edits, then resume in Claude Code for architecture review. - Start in Gemini for long context analysis, then resume in Codex for implementation. - Recover old sessions from one provider and continue them in another after a tooling migration.
casr supports two equivalent resume styles:
casr <target> resume <session-id>casr -cc <session-id>, casr -cod <session-id>, casr -gmi <session-id>Shorthand flags are rewritten internally before clap parsing, so logging, JSON output, and error handling stay identical across both forms.
Alias normalization also accepts common provider tokens:
claude maps to claude-codecodex-cli maps to codexgemini-cli maps to geminiThe resolver is intentionally strict and deterministic.
--source parses as a path, casr bypasses provider scanning and resolves from that path.--source parses as an alias, casr searches only that provider.casr scans installed providers and collects all matches.SessionNotFound.AmbiguousSessionId and includes candidates.Path mode has additional fallback logic when a file is outside known provider roots:
$ claude mcp add cross_agent_session_resumer \
-- python -m otcore.mcp_server <graph>