harness
Skill149 starsChanged 3 months agoApache-2.0View on GitHub
Integrate a new AI coding-agent harness into txcript — native Body types, Codec, TextCodec, Store, wiring, and tests. Use when asked to add or integrate a new harness or transcript format. Takes the harness name, its format docs (URL or path), and one real local session id to anchor implementation and verification on.
21 other projects use a version of this.
Adopted by
Most recently taken up by
- Boxline-dev/examplestheir own version, first seen Oct 5, 2026
- hanzhangzzz/agent-skills-zhtheir own version, first seen Oct 4, 2026
- virgoC0der/awesome-claude-codetheir own version, first seen Sep 11, 2026
- bam-bam-2/solo-skillstheir own version, first seen Sep 3, 2026
- gutomec/nirvana-os-enginetheir own version, first seen Aug 12, 2026
- SensorsIot/Embedded-AI-Harnesstheir own version, first seen Aug 10, 2026
Other versions21 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 21
- revfactory/harness★ 9.1ksame name
- stellarlinkco/myclaude★ 2.8ksame name
- BankrBot/skills★ 1.2ksame name
- bam-bam-2/solo-skills★ 366same name
- serejaris/personal-corp-os★ 228same name
- SensorsIot/Embedded-AI-Harness★ 185same name
- gutomec/nirvana-os-engine★ 79same name
- stellarlinkco/skills★ 27same name
- d-oit/rust-2026-template★ 11same name
- gd452/skills★ 7same name
11 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository2 other files it gives its agents.
- corpus-checkSkill
- releaseSkill
The file
We split this skill into the rules it gives an agent
9 rules. 0 are common, 4 are distinctive, and 5 are very specific to this project.
0
Common
Most of the 15 edited versions we read keep these.
4
Distinctive
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 44
Before writing any Rust:
- Very specific: line 46
Read the docs at <docs>.
- Distinctive: line 54
Check how the native app resumes a session (CLI flag, id format, sidecar files it validates).
- Very specific: line 102
Every typed record struct: #[serde(flatten)] extra: Map<String, Value> for unknown keys, and #[serde(default, skip_serializing_if = …
- Very specific: line 111
Do NOT put deny_unknown_fields on harness record types.
- Very specific: line 119
Claude Code is the canonical convention: Write a normalize_tool(name, input) that maps native tool names and argument keys onto it …
- Very specific: line 124
Write denormalize_tool at the same time.
- Distinctive: line 203
Every item, in order; the exhaustive matches make most omissions compile errors:
- Distinctive: line 256
All must pass before you call it done:
“Common” is measured: kept by at least 6 in 10 of the 15 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Integrate a new harness
You are adding a harness to txcript, the transcript converter in this repo. The
work is one flat file src/harness/<name>.rs plus wiring and tests, but the
quality bar is set by two fidelity contracts (below) and by the fact that the
output must actually resume in the native app — a session that loads but
shows an empty conversation is a failed integration.
Inputs
$ARGUMENTS: <name> <docs> <sample-session-id>
name— the harness (e.g.gemini,amp). Derive the snake_case id from it.docs— URL or file path describing the native transcript format.sample-session-id— a real session of that harness on this machine. This is your ground truth. If any input is missing, ask before starting.
The two fidelity contracts (non-negotiable, from src/lib.rs)
- Native ↔ disk is record-lossless. The
Bodyholds a faithful typed representation;Store/TextCodecround-trip it without loss. This is value-level, not byte-level:serde_jsonis built withoutpreserve_order, so key order canonicalizes — tests assert record equality, never string equality of the file. - Through
Commonis semantically lossless.to_commonmay canonicalize representation (so the thread works in another harness) but must never discard what a same-harness round trip needs. The testable form is the fixpoint:to_common(from_common(c)) == cfor anycin the harness-representable subset ofCommon.
Corollary: from_common must be pure and deterministic — synthetic ids are
UUIDv5 over a fixed namespace and stable keys like "{session_id}:{i}:{j}",
never Uuid::new_v4() (sole exception: generating a session id when meta.id
is empty), never clock reads.
Phase 0 — Recon: the bytes are the spec
Before writing any Rust:
- Read the docs at
<docs>. - Find the sample session on disk. Probe the harness's storage root
(
~/.<name>/…, XDG data dirs, an SQLite DB, app-support dirs) until you locate the file/rows for<sample-session-id>. - Dump the raw session into the scratchpad. Catalog every record/blob kind you observe: which carry conversation (user/assistant/tool records), which are bookkeeping (headers, token counts, snapshots, titles, model changes), which are opaque (binary, protobuf).
- Check how the native app resumes a session (CLI flag, id format, sidecar files it validates). The consumer defines correctness, not the schema.
- Interrogate the consumer by bisection. Find the harness's cheapest
read-only replay of a session (
<name> export,sessions list, a--printresume) and use it as a load oracle: copy the sample under a fresh id, then delete files/records until it stops loading. What survives deletion is bookkeeping; what breaks the load is the regeneration contract forfrom_common— learned before writing any code, at zero model cost. - Mint the bytes the sample lacks. One session won't cover every record
kind you must emit (file edits, images, errored calls, aborts). Don't
guess from docs — run the harness itself headlessly in a scratch dir with
prompts engineered to exercise each gap, and probe its input flags (a
--prompt-json-style flag reveals content-block encodings). The same trick answers optionality questions: to learn whether the native parser treats a field as optional, load a session without it. - For multi-file/dual-log formats, write down the exclusive carrier of
each semantic field: timestamps, images, or stop reasons may exist only
in the display log while reasoning tokens exist only in the model log.
to_commonis then a join across carriers andfrom_commona fan-out — knowing the carrier map is most of the codec design.
Where docs and bytes disagree, model the bytes. Keep the dump — it becomes your
test fixture material and the final verification anchor. Copy the sample
session out of the live root NOW: save() derives its path from Meta, so
converting a session back into its source harness reuses the original id and
silently overwrites your ground truth.
Phase 1 — Choose the Body shape
Pick the closest existing codec as your reference and re-read it before implementing (don't work from memory of it):
| Native format | Reference | Body pattern |
| JSONL, one envelope kind | codex.rs | Single Line { timestamp, type, payload: Value, #[serde(flatten)] extra } |
| JSONL, a few typed kinds | claude_code.rs, pi.rs | Enum with manual serde via From<Value> dispatch on the type tag; parse failure → Other(Value); tagged() helper re-inserts the tag on render |
| One JSON export document | opencode.rs | Body = the harness's own export/import shape; typed two-level envelope, everything inside stays Value, navigated with .get() |
| SQLite with opaque blobs | cursor.rs | Body = raw rows (Vec<u8> blob bytes with hex serde + meta rows); losslessness at the blob level; only parse what you understand |
| Session directory, multiple logs | grok.rs | Body = struct of per-file fields (typed model log, raw Vec<Value> display/telemetry logs, Option<Value> sidecars); "text" is a JSON bundle of the directory |
| Sibling of an existing harness | campfire.rs | Thin delegate: reuse the donor's pub(crate) helpers, change only identity and storage root |
Details and per-harness idioms: read references/patterns.md in this skill
directory now.
Phase 2 — Native record rules
- Type only what the codec must interpret; keep messy payload unions as raw
Valueinside a typed envelope. - Every typed record struct:
#[serde(flatten)] extra: Map<String, Value>for unknown keys, and#[serde(default, skip_serializing_if = "Option::is_none")]on every optional field — absent must not round-trip asnull. - The type tag lives outside the struct (stripped on parse, re-inserted on
render), or it duplicates into
extra. - Any classification/parse failure demotes to a raw-
Valuevariant (Record::Other(v)) — never an error, never a dropped line. One corrupt line must not sink the session (jsonl::parsealready skips unparseable lines for the line-based path). - Do NOT put
deny_unknown_fieldson harness record types. It exists only on the canonical tool-arg structs incommon.rs, where it forces the losslessTool::Rawfallback.
Phase 3 — Codec
to_common
- Claude Code is the canonical convention. Write a
normalize_tool(name, input)that maps native tool names and argument keys onto it (bash→Bash,path→file_path, …), then callTool::from_canonical. Itsdeny_unknown_fields→Rawfallback is the safety net — never bypass it, never pre-drop keys.mcp__*passes through. Writedenormalize_toolat the same time; they must be a real inverse pair, including shape changes (e.g. pi's multi-hunkedit→Edit/MultiEditby hunk count). - Tool results ride on
Role::Usermessages (Anthropic convention). Errored calls →is_error: true; in-flight calls →ToolUsewith no result. - Skip bookkeeping records and harness-injected scaffolding (environment
preambles,
<user_query>-style wrappers — strip on read, re-wrap on write). Skip empty/whitespace-only blocks and messages that end up empty. Unknown block types drop from Common — they still live in the native body. - Turn-level attribution (model, usage, stop reason) often lives in bookkeeping records far from the message: do a stateful pass with per-turn maps and backfill onto the right assistant message (typically the last text message of the turn).
- Dual-log formats (protocol log + display log): pick the canonical record per kind, mark fallback mirrors, dedup by call id in a post-pass so file order doesn't matter.
- Pairing without ids: key on serialized semantic content, tolerate both arrival orders, use a deterministic synthetic id as last resort.
- Timestamps: parse per-record with fallback to
meta.timestamp; never error.
from_common
- Regenerate every field the native app validates on resume — even as
explicit
null(codex refuses sessions missingmodel_provider/base_instructionskeys). Regenerate both logs of a dual-log format, and any internal structures the app needs (Cursor's protobuf turn graph, sidecarmeta.json). The failure mode here is silent: the app starts a fresh or empty session. Only end-to-end resume testing catches it. - Write only field shapes you have observed the native app write. This is
the loud failure mode, dual to the silent one: native parsers are strict,
and one field of an unobserved type fails the WHOLE session load ("invalid
type: sequence, expected a string"). Structural pass-through is the
lossless instinct for reading and exactly wrong for writing — where Common
is richer than the observed slot (structured
ToolOutput::Jsoninto a string field, an image block into a text-only log), flatten to the observed shape (block arrays → joined text, other JSON → compact string, image → its display-log carrier plus a placeholder) and document the loss. - Carry a
tool_use_id → native tool namemap while emitting tool calls so redundant result fields can be reconstructed; give orphans a fallback. - Fabricate required-but-derivable fields plausibly (provider from a model-id
prefix, zero cost objects,
totalTokens) and comment that they are best-effort historical reconstruction. - Option-vs-zero trap: never serialize a default that parses back as
Some(default)(e.g. omit an all-zero cache object entirely). - Some Common detail may have no native slot (thinking signatures,
replace_all,StopReason::Other). Accept the loss, document it in the module doc, and keep the fixpoint fixture inside the representable subset.
Meta
meta_from_records: per-field fallback chains with explicit keep-first or
last-wins semantics (e.g. latest model_change wins; custom-title beats
summary). Filter placeholder titles. Leave id empty when the text has none —
the Store fills it from the filename/row. Timestamp fallback: Utc::now().
Phase 4 — TextCodec + Store
TextCodecis pure text↔records, zero I/O — it is the WASM boundary. For a DB-backed harness, "text" is a JSON dump of the Body (binary as hex), not anything the native tool emits; it must round-trip to an identical Body.Store:default_root()returnsOption<Self>honoring env overrides then$HOMEpaths (match the pattern inpi::resolve_sessions_dir).discover()is tolerant: missing root →Ok(vec![]), unreadable files silently skipped, and sniff the format (e.g. first record must be the session header) — extension alone doesn't identify a harness.load()backfills an emptymeta.idfrom the file stem (jsonl::file_id).save()derives a deterministic path fromMeta— copy the native app's directory encoding exactly (Claude maps both/and.to-; pi wraps--{cwd}--; Cursor usesmd5(cwd)).fingerprints()is cheap:"{mtime_nanos}:{len}"or aMAX(time)query; failures → empty string, never an error.- New native dependency (SQLite etc.): make it a cargo feature (
dep:only), keep the codec and Body compiling featureless, and stub the Store without the feature (empty discover,Unconvertibleload/save). Open another tool's DBREAD_ONLY; prefer delegating writes to the harness's own CLI importer if one exists (opencode importpattern) over reverse-engineering schema defaults.
Phase 5 — Wiring checklist
Every item, in order; the exhaustive matches make most omissions compile errors:
src/harness/<name>.rs— the whole harness, one flat file, module doc explaining format + known losses.src/harness/mod.rs—pub mod <name>;src/transcript.rs—HarnessIdvariant,ALLarray (bump its length),as_str,FromStrwith friendly aliases.src/bin/cli.rs—resume_commanddefault, adiscover_allblock, aload_commonarm, asave_targetarm.src/wasm.rs— both dispatch matches (parse_to_common,render_from_common) and the doc-comment harness list.Cargo.toml— feature entry if a new dep; keep it out of thewasmbuild.README.md— supported-harness list, string id, WASM text-format note.tests/integration/<name>.rs(declared intests/integration/main.rs), a new hop intests/integration/cross_harness.rs, and a newassert_fixpointline intests/integration/properties.rs— seetests/README.mdfor the taxonomy.
Repo style: hierarchical imports — import modules and qualify (common::Tool,
jsonl::parse), never flatten items to the crate root. Clippy pedantic is on
and unwrap/expect/panic are denied in src/ (allowed in tests via the
file-top #![allow]).
Phase 6 — Tests
Standard invariants, one test each, named as behavior sentences. Fixtures are
inline json! + tempfile — no checked-in fixture files. Build the native
fixture from the real sample session's shapes (anonymized), covering every
record kind you cataloged in Phase 0, including one unmodeled record that must
survive.
store_round_trip_is_lossless_on_disk— load→save→load, record equality including unknown records; assert the save path shape.discover_extracts_metadata— every populatedMetafield.to_common_…— faithful extraction: typed tools with renamed keys, bookkeeping skipped, result pairing, usage/stop backfill, message count asserted exactly.codec_fixpoint_through_common_loses_nothing—to_common(from_common(c)) == c. Shape the Common fixture at the harness's native granularity (message grouping, which fields are mandatory, result timestamps) — this is the direction that holds;from_common ∘ to_commonneed not be byte-identical.from_common_is_deterministic— two runs serialize identically.
Plus one test per quirk you handled (error results, pending calls, legacy
shapes, format sniffing), and extend the cross_harness.rs chain with the new
harness so the block signature survives the extra hop. Store tests that need
the native dep go #[cfg(feature = …)] inside the gated module against a real
temp DB — never mocks.
Phase 7 — Verification gates
All must pass before you call it done:
cargo testandcargo test --no-default-features.cargo clippy --all-targets— pedantic-clean, nounwrap/expectinsrc/.- Real-session anchor: load
<sample-session-id>through the new Store,to_common, and inspect the conversation end to end — no dropped turns, no scaffolding leaking in as user text, tools typed where expected. Then run the fixpoint on this real transcript, and convert it toclaude_codeand back, checking the cross-harness block signature. - Resume in the native app (the only gate that catches
missing-required-header and missing-display-log bugs): write the converted
session with
txcript continue <id> --with <name> --no-resume(or--outplus a copy into the live root), then resume it with the harness's own CLI and confirm the conversation renders and the session continues. Also do the reverse direction: sample →claude_code, resume withclaude --resume. Two rules learned the hard way:- The sample round trip is the weakest resume test — it only exercises the subset of Common the sample happens to use, and it passes trivially. Also convert a kitchen-sink source: a real session from the richest other harness (or a synthetic Common) carrying structured JSON tool results, images, thinking, errored calls, and an aborted turn. Write-side shape bugs (the "loud" from_common failure) only surface here.
- Verification writes get a fresh session id (set
meta.idbeforefrom_common) so they can't collide with — and overwrite — real sessions; clean them out of the live roots afterward. Order the resume work by cost: the read-only export/list oracle first (validates the display log), then one headless-p-style resume turn (validates the model log actually carries the context), then the TUI.
- README and module docs updated; known representational losses documented in the module doc.
Report the result with: record kinds handled vs passed-through, tool mappings, known losses, and the resume verification outcome for both directions.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

