Skip to main content

Relocate a coding-agent session across harnesses (Codex <-> Claude Code) and resume it natively.

Project description

harness-convert (hc)

Relocate a coding-agent session across harnesses and resume it natively.

The escape hatch: you're 80% through a fix, your harness hits a rate limit / outage mid-task, and you can't even ask it for a handoff. hc reads the session transcript off disk (the dead harness doesn't need to be running or your quota intact), rewrites it into the target harness's format, and you keep going there.

hc --from claude --to codex                 # move the latest Claude session here -> Codex
hc --from codex  --to claude <session-id>   # a specific session
hc --from claude --to codex --dest-cwd DIR  # land it in a different folder
hc list --from codex                        # what's the latest convertible session here

By default it's a dry run; pass --write to create the file, then it prints the exact codex resume / claude --resume command.

How it works

A session is (a) a model-context stream, (b) a UI-render stream, and (c) identity metadata. Conversion maps all three.

  • Common interface (hconv/common.py): every harness maps to four records — UserMessage, AssistantMessage, ToolCall, ToolResult. This universal floor guarantees any pair converts and resumes. Private reasoning is dropped (each harness encrypts/owns its own; unrecoverable).
  • N² enrichment (hconv/enrich.py): surplus the floor can't hold (session titles, ...) rides a sparse (source, dest) map, layered on top. A pair with no entry is simply common-only. The map never re-encodes the common records.
  • Adapters (hconv/adapters/): one per harness, locate / read / dest_path / write. Codex's writer emits BOTH streams (response_item for the model, event_msg for scrollback incl. exec_command_end / patch_apply_end tool cards); Claude's single row set serves both.
  • Ragged-tail close (synthesize_missing_results): the source usually died mid-tool-call, so every orphan ToolCall gets a synthetic result — else the resumed API call rejects the history.

Install

pipx install .     # or: pip install -e .

Stdlib only, no dependencies. python3 hc.py ... also works without installing.

Supported

Codex (~/.codex) ↔ Claude Code (~/.claude), both directions. Within a harness, sessions are also freely relocatable across working directories (pure metadata rewrite, lossless).

Test

python3 tests/test_hconv.py

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

harness_convert-0.1.0.tar.gz (17.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

harness_convert-0.1.0-py3-none-any.whl (15.0 kB view details)

Uploaded Python 3

File details

Details for the file harness_convert-0.1.0.tar.gz.

File metadata

  • Download URL: harness_convert-0.1.0.tar.gz
  • Upload date:
  • Size: 17.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for harness_convert-0.1.0.tar.gz
Algorithm Hash digest
SHA256 07b7b790a3287437f89b3be57e25cd51e99e952daab0168fbd2a4239ab6de5ad
MD5 9a99d4e03a6ee299fedd1efdf094bf16
BLAKE2b-256 0b8beb0d7cbf1f49abb84d5a670f41742421d36e1dae0d25afdeff3c0c5c8d0d

See more details on using hashes here.

File details

Details for the file harness_convert-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for harness_convert-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d73ab1025cea561eebe10ed77087b9d2d257a5f2b8eb126c4cf4a84fb4302464
MD5 6959e8872e1521224ff44e33f31a227d
BLAKE2b-256 50e9e5c8b90ad9a7f4dd43919772f1d7894a8293153bdacbfca913f398ae8929

See more details on using hashes here.

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