Expand description
Canonical touch streams from agent transcripts.
Every harness (Claude Code, omp, later opencode) is reduced to the same
sequence of Events. Phase 0 mines these for headroom; later the same
parser drives offline counterfactual replay of borg’s recall policy.
Modules§
- claude
- Claude Code transcripts:
~/.claude/projects/<slug>/<session>.jsonl(sub-agents under<session>/subagents/). - dialogue
- The conversation between engineer and drone, as the live hooks see it: the engineer’s prompts,
the drone’s visible text, what its tool calls touched, and tool calls the engineer refused with
words. The touch streams (
claude::parse,omp::parse) drop all of this; replay evals of hook logic (the queen) need it. - fingerprint
- Deterministic fingerprints: the same error seen by two drones (or two sessions weeks apart) must hash the same, regardless of line numbers, temp paths, ids or durations.
- omp
- omp (oh-my-pi) sessions:
~/.omp/agent/sessions/<slug>/<ts>_<id>.jsonl. - scars
- Execution memory (layer 1): scars and protocols, learned deterministically from what a session did, at zero tokens.
Structs§
Enums§
Constants§
- CHARS_
PER_ TOKEN - Characters per token wherever borg estimates a token count: a transcript’s tool results here, a
lesson line’s cost (borg whole.rs), the cost lines of
borg status. Method: the usual rule of thumb for English text and code under today’s BPE tokenizers; an estimate, never a bound.
Functions§
- approx_
tokens - Approximate token count of a JSON tool result (
CHARS_PER_TOKEN, counted in bytes). - civil_
from_ days - The civil date
(year, month, day)of a day number since 1970-01-01, Howard Hinnant’scivil_from_days: the inverse ofdays_from_civil, with the same calendar numbers. - days_
from_ civil - Days since 1970-01-01 of the civil (proleptic Gregorian) date
y-m-d, Howard Hinnant’sdays_from_civil. The one calendar routine of borg’s crates, withcivil_from_days(borg’s clock.rs re-exports both). Its numbers are the calendar’s (method): 146 097 days in a 400-year era, 719 468 days from 0000-03-01 to 1970-01-01, the year counted from March. - jsonl_
files - All
*.jsonlfiles belowroot. - parse_
ts - Parse an RFC 3339 UTC timestamp (
2026-09-15T22:18:11.638Z) to epoch ms. - repo_
key - Resolve the repository a session worked in: nearest ancestor with
.git, with borg/claude worktree suffixes folded back onto their parent repo. Only a worktree itself folds: a repo of its own nested deeper inside a worktree (a test fixture, a sandbox HOME’s repos) keeps its own name. - result_
text - Flatten a tool result into text (for error fingerprinting).