Expand description
A typed intermediate representation for AI coding-agent session transcripts.
Claude Code, Codex, OpenCode, and pi all record the same thing — a sequence
of user/assistant turns carrying text, reasoning, tool calls, tool results,
and images — in mutually incompatible on-disk formats. This crate models
that shared shape once, as Transcript<Common>, and gives each harness a
Codec to and from it. Converting a session from one harness to another
is then convert::<A, B>: A → Common → B.
§The two-layer fidelity contract
- Native ↔ disk is byte-lossless. Each harness keeps a faithful typed
representation of its records (
Harness::Body); aStoreround-trips it to disk without loss. This is what a same-harness resume uses. - Through
Commonis semantically lossless.Codec::to_commonmay canonicalize representation so a thread is functional in another harness, but it never discards detail: anything a same-harness round-trip needs is preserved inCommon’s typed fields. It is not byte-exact, by design — canonicalization and byte-faithfulness pull in opposite directions, and byte-faithfulness already lives at the native ↔ disk layer.
§Shape
Re-exports§
pub use common::Block;pub use common::EditOp;pub use common::ImageSource;pub use common::Message;pub use common::Meta;pub use common::Role;pub use common::StopReason;pub use common::Tool;pub use common::ToolOutput;pub use common::Usage;pub use error::Error;pub use error::Result;pub use harness::campfire::Campfire;pub use harness::campfire::CampfireStore;pub use harness::claude_code::ClaudeCode;pub use harness::claude_code::ClaudeStore;pub use harness::codex::Codex;pub use harness::codex::CodexStore;pub use harness::cursor::Cursor;pub use harness::cursor::CursorBlob;pub use harness::cursor::CursorDb;pub use harness::cursor::CursorMetaEntry;pub use harness::cursor::CursorStore;pub use harness::opencode::OpenCode;pub use harness::opencode::OpenCodeStore;pub use harness::pi::Pi;pub use harness::pi::PiStore;
Modules§
- common
- The canonical model — the hub every harness converts through.
- error
- The crate’s error type.
- harness
- Per-harness implementations.
Structs§
- Common
- The canonical hub representation. Every cross-harness conversion routes
through
Transcript<Common>. - Discovered
- A transcript found by
Store::discover: its metadata and how to load it. - Saved
- The outcome of
Store::save: the id the harness will resume by, and where it landed. - Transcript
- A transcript in some representation
H.
Enums§
- Harness
Id - Runtime tag for the harnesses this crate implements. Distinct from the
type-level
Harnessmarkers — this is for dispatch on a string the user typed (--with codex), not for selecting aBody.
Traits§
- Codec
- Maps a harness’s native representation to and from
Common. - Harness
- A transcript representation. Implemented by
Commonand by each harness marker. The marker is a zero-size type; the representation is itsBody. - Store
- Procuring and persisting native transcripts against a real backend (a
session directory, a SQLite database, an
importsubprocess). - Text
Codec - Parsing and rendering a harness’s native session text — free of any
filesystem or database. This is the format layer:
Storeis location built on top of it (read a file, thenfrom_text;to_text, then write a file), and the WASM bindings use it directly so the browser/Bun side owns the I/O.