A cross-AI-coding-agent session sync tool. AgentSync migrates conversation history across OpenCode, Claude Code, and Codex while preserving the full conversation context.
- Cross-agent sync - Migrate sessions among OpenCode, Claude Code, and Codex.
- Full context preservation - Keep messages, tool calls, timestamps, and other conversation context intact.
- Search and filter - Search session titles by keyword.
- Batch export - Export sessions to JSON files.
- Dry-run preview - Preview sync results before making changes.
- Interactive interface - Friendly TUI with multi-select workflows.
- Skill support - Includes
SKILL.mdso compatible agents can invoke AgentSync directly.
On macOS / Linux, install with:
curl -fsSL https://raw.githubusercontent.com/Edmund-a7/agentsync/main/scripts/install.sh | bashThe installer will:
- Detect macOS / Linux and
arm64/x64automatically. - Download the latest GitHub Release binary to
~/.local/bin/agentsync. - Ask whether
~/.local/binshould be added to your PATH.
Optional arguments:
# Install a specific version
curl -fsSL https://raw.githubusercontent.com/Edmund-a7/agentsync/main/scripts/install.sh | bash -s -- --version v0.1.0
# Use a custom install directory
curl -fsSL https://raw.githubusercontent.com/Edmund-a7/agentsync/main/scripts/install.sh | bash -s -- --install-dir /usr/local/binOn Windows, run:
irm https://raw.githubusercontent.com/Edmund-a7/agentsync/main/scripts/install.ps1 | iexYou can also download the binary for your platform from Releases, rename it to agentsync (agentsync.exe on Windows), and place it in a directory on your PATH.
# Clone the repository
git clone https://github.com/Edmund-a7/agentsync.git
cd agentsync
# Install dependencies
bun install
# Build
bun run build
# The compiled binary is generated in dist/Run agentsync to open the interactive interface:
agentsyncWorkflow:
- Choose the source agent.
- Choose one or more target agents with Space, or press
ato select all. - Choose the sessions to sync.
- Review the result after sync completes.
# List all sessions
agentsync list claude-code
# Output JSON
agentsync list opencode --jsonagentsync view claude-code <session-id>
# JSON output
agentsync view codex <session-id> --json# Search by keyword
agentsync search claude-code "html"
# Limit result count
agentsync search opencode "project" --limit 5agentsync export claude-code <session-id> -o /path/to/output.json# Sync one session
agentsync sync -s claude-code -t opencode -i <session-id>
# Sync to multiple targets
agentsync sync -s claude-code -t "opencode,codex" -i <session-id>
# Sync multiple sessions, up to 10
agentsync sync -s claude-code -t opencode -i "id1,id2,id3"
# Dry-run preview
agentsync sync -s claude-code -t opencode -i <session-id> --dry-run
# JSON result
agentsync sync -s claude-code -t opencode -i <session-id> --json# Update to the latest version
agentsync update
# Preview the release asset that would be downloaded
agentsync update --dry-run
# Install a specific version
agentsync update --version v0.1.0
# Uninstall
agentsync uninstall
# Non-interactive uninstall
agentsync uninstall --yes# 1. List Claude Code sessions
agentsync list claude-code
# 2. Find the session ID and sync it
agentsync sync -s claude-code -t opencode -i abc-123-def
# Or preview first with dry-run
agentsync sync -s claude-code -t opencode -i abc-123-def --dry-run# Get all session IDs
agentsync list claude-code --json | jq -r '.[].id'
# Sync the first 5 sessions
agentsync sync -s claude-code -t opencode -i "id1,id2,id3,id4,id5"# Export one session
agentsync export claude-code <session-id> -o backup.json
# Batch export with a shell script
for id in $(agentsync list claude-code --json | jq -r '.[].id'); do
agentsync export claude-code $id -o "backups/$id.json"
doneAgentSync reads each agent's local database or files, converts sessions into a unified internal format, and writes them into the target agent.
| Agent | Read Source | Write Target |
|---|---|---|
| OpenCode | SQLite database (~/.local/share/opencode/opencode.db) |
opencode import command |
| Claude Code | JSONL files (~/.claude/projects/) |
JSONL files |
| Codex | SQLite + JSONL (~/.codex/) |
JSONL + database |
AgentSync automatically filters system-injected messages during sync:
<environment_context># AGENTS.md instructions<skill>,<subagent_notification>
This ensures the target agent shows real user messages instead of system metadata.
- AgentSync normalizes session content before checking whether it has already been imported. Re-syncing the same session will not silently create duplicate copies.
- If you migrated from an earlier version and already have broken imported data with malformed titles, system-message pollution, or unstable restore behavior, delete the bad data and sync again.
- Pre-release verification is based on clean fixtures and local smoke tests. It does not guarantee that historically corrupted data can be repaired in place.
This project includes SKILL.md, which can be invoked directly by agents that support MCP (Model Context Protocol).
Trigger examples:
- "Migrate Claude Code sessions to OpenCode"
- "Export the current session to another agent"
- "Sync conversation history"
- "Back up sessions"
Place SKILL.md in the agent's skills directory to use it.
| Command | Description | Example |
|---|---|---|
agentsync |
Start the interactive interface | agentsync |
agentsync list <agent> |
List sessions | agentsync list claude-code |
agentsync view <agent> <id> |
View session details | agentsync view opencode abc-123 |
agentsync search <agent> <keyword> |
Search sessions | agentsync search codex "project" |
agentsync export <agent> <id> |
Export a session | agentsync export claude-code abc-123 -o out.json |
agentsync sync |
Sync sessions | agentsync sync -s claude-code -t opencode -i abc-123 |
agentsync update |
Update an installed binary | agentsync update |
agentsync uninstall |
Uninstall an installed binary | agentsync uninstall --yes |
--json- Output JSON.-h, --help- Show help.
-s, --source <agent>- Source agent.-t, --target <agents>- Target agents, separated by commas.-i, --ids <ids>- Session IDs, separated by commas. Supports up to 10 sessions.--dry-run- Preview mode.
agentsync updateonly supports installed standalone binaries. It does not supportbun run src/index.ts.agentsync uninstallasks for confirmation by default. Use--yesin CI or scripts.- The default Unix install directory is
~/.local/bin. You can override it withAGENTSYNC_INSTALL_DIRor an installer argument.
- TypeScript - Type safety.
- Bun - Runtime and build tooling.
- Commander - CLI framework.
- Clack - Interactive prompts.
- bun:sqlite - SQLite database access.
# Install dependencies
bun install
# Development mode
bun run dev
# Build a binary
bun run build
# Typecheck
bun run typecheck
# Test
bun test
# Pre-release check: typecheck + test + build
bun run release-checkbun run build also generates dist/SHA256SUMS, which helps verify release artifacts.
Q: Why does the target agent show garbled session titles after sync? A: The source agent session may contain system-injected messages. Use the latest version, which filters these messages automatically.
Q: Can I sync an active session? A: Yes, but it is better to finish the current conversation first so all context is captured.
Q: Does sync delete sessions from the source agent? A: No. Sync is read-only for source data.
Q: Can AgentSync sync to other tools? A: AgentSync currently supports OpenCode, Claude Code, and Codex. PRs for additional agents are welcome.
Issues and PRs are welcome.
MIT License. See LICENSE for details.
Thanks to these open source projects:
- Clack - Interactive CLI components.
- Commander.js - CLI framework.
- Bun - JavaScript runtime.