Exchange agent/chat sessions between codex, opencode, and claude-code
Project description
harness-exchange
Exchange sessions between codex, opencode, and claude-code.
Rate-limited on one tool but still have context you need? Port your session to another harness and keep going.
harness-exchange --from codex --to opencode
Installation
pip install harness-exchange
Requires Python 3.11+.
Usage
Interactive (arrow-key selection)
harness-exchange --from codex --to opencode
Lists the 15 most recent sessions from the source harness, each with a preview of the first and last message. Use arrow keys to select, Enter to transfer.
Non-interactive (session ID)
harness-exchange --from claude --to codex --session-id <session-uuid>
Combine with --non-interactive for scripting:
harness-exchange --from codex --to opencode --session-id <id> --non-interactive
All combinations
| From | To |
|---|---|
codex |
opencode |
codex |
claude |
opencode |
codex |
opencode |
claude |
claude |
codex |
claude |
opencode |
Options
| Flag | Description |
|---|---|
--from |
Source harness (codex, opencode, claude) |
--to |
Target harness (codex, opencode, claude) |
--session-id |
Transfer a specific session by ID (skips selection) |
--limit |
Number of recent sessions to show (default: 15) |
--non-interactive |
Skip interactive prompts (requires --session-id) |
Storage locations
Each tool stores sessions in a different format:
| Tool | Format | Location |
|---|---|---|
| codex | JSONL rollouts | ~/.codex/sessions/YYYY/MM/DD/*.jsonl |
| opencode | SQLite | ~/.local/share/opencode/opencode.db |
| claude-code | JSONL transcript | ~/.claude/projects/<cwd>/<sessionId>.jsonl (+ sessions/<pid>.json and history.jsonl) |
The tool detects these paths automatically (uses $HOME). Writing to opencode
uses opencode's own import command so the schema stays valid; writing to
claude-code produces a real projects/ transcript so the session is resumable
with claude --resume.
What gets transferred
- All conversation messages, with user and assistant roles preserved
- Tool calls and their outputs (where the target format supports them)
- Session title, working directory (
cwd), and timestamps - Agent and model information (where available)
Codex injects system prompts and context (AGENTS.md, <environment_context>,
permissions/personality specs) as hidden turns; these are filtered out so only
the real conversation is carried over.
How it works
- Lists the most recent sessions from the source harness (default: 15)
- Shows a preview of the first and last real user message for each session
- Reads the full session (metadata + all messages) from source storage
- Writes the session into the target harness's storage format
The interactive selector uses questionary with a plain-text fallback if the library isn't available.
Development
git clone https://github.com/cnmoro/harness-exchange.git
cd harness-exchange
# Install dev dependencies
pip install -e ".[dev]"
# Run tests
pytest
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file harness_exchange-0.1.0.tar.gz.
File metadata
- Download URL: harness_exchange-0.1.0.tar.gz
- Upload date:
- Size: 24.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5806c05997d3529f376924fcd6814fc4653dd5bc42f9cf182fc4b332ba4e2288
|
|
| MD5 |
4a263bd675419b21ca98922e0bd30c2b
|
|
| BLAKE2b-256 |
37e314d5bbd09188baebf2c1c390c2e51f9ae2faded33cd98d9e50bbc650f798
|
File details
Details for the file harness_exchange-0.1.0-py3-none-any.whl.
File metadata
- Download URL: harness_exchange-0.1.0-py3-none-any.whl
- Upload date:
- Size: 20.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bab6c1b26544f78ee9738533afd87bf4798e9277de5f05a20f61862df79336d4
|
|
| MD5 |
c25438b09e3cf6b55367f1fca843c7cf
|
|
| BLAKE2b-256 |
13a4db009075536222fd3ff900c00230020989358415841e309f69b54c773b2a
|