Skip to content

traces-v1: session mirror + 4 harness adapters (0.2.0)#5

Merged
Arrmlet merged 5 commits into
mainfrom
traces-v1
May 29, 2026
Merged

traces-v1: session mirror + 4 harness adapters (0.2.0)#5
Arrmlet merged 5 commits into
mainfrom
traces-v1

Conversation

@Arrmlet

@Arrmlet Arrmlet commented May 29, 2026

Copy link
Copy Markdown
Owner

What

tracecraft session mirror copies a coding agent's session transcript into the
same bucket as coordination state (memory, messages, claims, artifacts). One
bucket holds every agent's reasoning and the messages between them.

Four harnesses behind one Harness protocol:

harness source storage
claude-code ~/.claude/projects/.../*.jsonl JSONL tail
codex ~/.codex/sessions/.../rollout-*.jsonl JSONL tail
openclaw <state>/agents/<id>/sessions/*.jsonl JSONL tail
hermes ~/.hermes/state.db SQLite (read-only WAL)

Plus tracecraft session list / show / stop, and redaction v0 (on by default,
counted in meta.json).

Design notes

  • Race-free cursor model. Harness.read_new(cursor) -> (bytes, new_cursor).
    Cursor is opaque: a byte offset for file harnesses, a messages.id rowid for
    Hermes. The loop advances to exactly what it consumed.
  • Hermes is read-only. Opened mode=ro (never immutable) so it is safe
    against a live WAL database; new rows read with WHERE id > :cursor.
  • REGISTRY-driven CLI. Adding an adapter auto-extends --harness.

Verification

  • 57 tests green (moto for S3, tmp_path for harness roots, sqlite for hermes).
  • Hermes proven read-only-safe against a live WAL DB: concurrent reader sees
    new rows immediately and mode=ro refuses writes.
  • OpenClaw + Hermes on-disk formats verified against upstream GitHub source.
  • Real end-to-end mirror run against a private HF bucket (claude-code).

Not in this PR

  • Claude Code / Codex plugins (hooks, slash commands) — follow-up.
  • Live smoke test of openclaw/hermes adapters against real installs (tested
    against synthetic data built to the verified schema).

🤖 Generated with Claude Code

Arrmlet and others added 4 commits May 29, 2026 03:22
Harness Protocol with read_new(cursor) -> (bytes, new_cursor) so the
mirror loop is race-free and works for both file-tail (claude-code,
codex, openclaw) and SQLite-poll (hermes, read-only WAL) backends.
Redaction v0 (regex denylist, counted in meta) included.

OpenClaw + Hermes formats verified against upstream GitHub source.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
mirror tails a harness session into <project>/sessions/<harness>/<id>/
as disjoint part-NNNNN-<uuid>.jsonl files plus a cumulative meta.json.
--harness choices are driven by the harness REGISTRY so new adapters
auto-extend the CLI. Redaction on by default; --no-redact for trusted
buckets. Cursor stored per-session; next part seq derived from bucket
LIST so losing local state is non-destructive.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
57 tests total (moto for S3, tmp_path for harness roots, sqlite for
hermes). docs/session-mirror.md covers all four harnesses, the cursor
model, the bucket layout, and redaction. README gains a session-mirror
section and CLI entries. plans/TRACES_V1_PLAN.md records the scope.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
/simplify cleanup pass (4 parallel review agents, converged findings):
- Extract FileTailHarness base for the identical read_new/size/
  active_session across claude-code, codex, openclaw (hermes stays
  standalone — SQLite cursor semantics differ). ~26 duplicated lines gone.
- Drop read_new_bytes from the Harness Protocol (vestigial; no production
  caller) — now an internal helper on the base.
- mirror: hoist doubled harness.size() call, drop speculative byte_offset
  back-compat fallback, remove the dead --once flag.
- list: remove dead `seen` dedup set (list_keys is already unique).

Net -38 lines. 57 tests green, ruff clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@Arrmlet Arrmlet added the enhancement New feature or request label May 29, 2026
@Arrmlet Arrmlet self-assigned this May 29, 2026
- Lead with a CLI-coordination-layer hook; differentiator in sentence one.
- Hero GIF: two agents race for the same task, second atomically rejected.
- Add "Agents talk to each other" section with a messaging GIF.
- Dedup the 3x command repetition into one collapsed CLI reference.
- Soften unprovable "nobody else does this"; sharpen the moat to
  cross-host / cross-cloud coordination (the durable differentiator vs
  single-machine in-process coordination tools).

GIFs are real commands against MinIO with real CLI output.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@Arrmlet Arrmlet merged commit 7d77daa into main May 29, 2026
4 checks passed
@Arrmlet Arrmlet deleted the traces-v1 branch May 29, 2026 12:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant