A line is a commit
One line of record.jsonl is one commit: a non-empty list of records
appended together or not at all. A line is the log’s unit of atomicity: a
damaged line and everything after it are never read. A transition can put
several facts on one line;
readers receive its records only after the whole line is validated, while
folds still step them individually. This is the unit of a write-ahead log
(SQLite WAL,
PostgreSQL WAL) and
Datomic’s transaction log.
The line
The seal names the exact bytes of the commit value.
{"sum":"1315e869d182df50","commit":{"at_unix_ms":1761730000000,"records":[{"Display":{"answer":{"text":"One line.\n"}}},{"Forensic":"cancelled"}]}}RawValuepreserves that value byte-exact across serialization and verification; the timestamp belongs to the entire commit.Sumis the first 64 bits of blake3 as 16 lowercase hex digits. The accidental-match probability is 2⁻⁶⁴; 64 bits suffice for detecting damage and keep loci small. It is no defence against an editor who can replace both value and sum.- Hex survives JSON tools that cannot exactly represent integers above 2⁵³.
- Records are externally tagged at every level down to a value.
Transcript,Control,DisplayandForensiccarry notag = "kind": an internally tagged enum buffers through serde’sContentand replays it on the native stack, bypassing the stack-grown reader, so a deep reply value would make its session un-resumable. Types still internally tagged inside records (Settlement,DoneOutcome,Mark, diff rows) carry noFOValue, so their depth is bounded by their type. - Reader and writer are both unbounded in depth and stack-grown
(
serde_stacker);sealserializes through an adapter into aRawValueand never re-parses. A test round-trips a 5000-deepControl::Statuscarrying a reply on a 2 MiB thread. - Several records on one line are groundwork for the durable-agent plan
(L3 “one transition, one commit”);
Emitter::emitwrites single-record commits; control transactions use multi-record lines.
Torn, corrupt, foreign
Damage is not a foreign shape.
- The first unterminated, non-JSON or sum-failing line begins the torn tail: everything from it to EOF is never read, including any later whole commits. Resume quarantines that tail whole.
- The storage model is crash-only: a completed sync preserves its prefix; bytes beyond it have no promised write order. A damaged head cannot supply a session and is refused.
- A shape error is re-checked for well-formedness: a line that is not
well-formed JSON is damage, not foreign. A well-formed
{sum, commit}whose sum is not 16 lowercase hex digits is a failed seal, also damage. - A line and its body must be JSON objects; an array is foreign.
- Well-formed JSON of the wrong line shape, or a sealed commit whose records
cannot be parsed (including an empty list), is foreign and refused
before the first damage. Damage may coincidentally produce valid JSON of another
shape, such as a bit-flipped key (
"sun"); refusing it rather than quarantining it fails closed. - Resume folds context and all three control folds before quarantine, so a refused resume
leaves the file as found.
Log::complete_lensupplies the whole-commit extent to both reader and quarantine. Log::append_torefuses a log whose tail is not a whole sealed commit (Log::extent), naming the torn byte range, so an append cannot bury it mid-log; resume quarantines first.
Addressing
A record is addressed by (commit, index).
Seqorders the pair lexicographically; block ids, rewind points and the view fold’s high-water mark retain their ordering.Locusadds the line’s byte range and sum.log::Reader(Reader::record) refuses a range no longer sealed by that sum before parsing its records, and parses each addressed line once across consecutive loci on it (Commit::holds).Cursorcounts whole commits, so catch-up cannot resume midway through one.
Publication
One Signal::Commit carries the whole commit.
- The TUI drains bounded passes and draws between them; one signal prevents a pass boundary from splitting a commit on screen.
Sink::acceptcallsfactfor each record in order within one call. Folds step records, not commit boundaries; their intermediate states are not indivisible.
Stable storage
Append publication is provisional; Signal::Synced certifies a prefix.
Log::syncnotes the last commit under the journal lock, callsFile::sync_dataunder a separate sync mutex, then publishes its watermark under the journal lock. Appends and transients do not wait for disk IO.- Syncs serialize through failure latching and publication: a one-shot write-back error cannot be missed by another sync. The first failure ends the bound life; a failed sync certifies nothing new.
- Attach publishes the current watermark before any subsequent commit;
Reader::sincereturns it beside the cursor and bounded commits. A reopened writer starts at zero: surviving bytes alone are not a sync witness. - Every provider attempt, shell dispatch, enquiry answer and addressed post,
command, recall or Stop return follows the relevant prefix’s sync. A report
syncs the helper’s
Statusbefore posting its parent. Failed post confirmation is queued/possibly-readRefused::Unsynced, not nondelivery. - Before re-entering mailbox attendance, the owner certifies the preceding
commits; concurrent submitters retain their acknowledgement barriers. Terminal
completion certifies teardown and
SessionEndedbefore publishingDied/Gone. - Frontend outside actions require the relevant watermark: headless results, live model-selection persistence, Synod job certification/acknowledgement/release, and record-backed clipboard/export. Clipboard/export refuse an uncovered suffix until the owner certifies it. Drawing remains provisional. A frontend never promotes buffered success on death or writes/syncs a live log.
- Created directory entries are synced in their held parents, including the application’s held ancestor chain. Quarantine syncs its evidence and directory entry before trimming the live file.
Concessions
The seal is not a durability or presentation barrier everywhere.
- The seal alone proves no stable storage; only a successful sync supplies that witness.
- A hand-edited last line that breaks its sum is quarantined, not refused; damage leaving well-formed JSON of the wrong shape is refused, not quarantined.
- Synod narrates a commit as consecutive webview events, between which the webview may paint. A plan introducing a multi-record commit Synod narrates must first batch its events per commit.
- Logs using legacy
{at_unix_ms, record}envelopes are refused at their first line.
Amendment — 2026-10-30: four classes, one control door
agents names the classes Transcript,
Control, Display and Forensic. Emitter::begin appends the head and
returns its seeded folds. Every later control line uses commit_to: append
and publish, then step borrowed Mail, Schedules and Model, under the
cell lock (or before it exists at reopen). Failed append steps nothing;
ordinary commit rejects control records. Reports, fires, clear and reopen
now put related transitions on one line. Synod narrates no Control record,
so each such commit yields at most one narrated event; no webview batching
change is needed. A commit introducing two narrated events still requires it.
Where
exarch/src/record.rs:Seq,Sum,Locus,Commit,Cursor,Publish.exarch/src/record/non_empty.rs,record/log.rs(LocusReader::record, the sum-checked read-back),record/seam.rs,record/context/resume.rs.exarch/src/bus/signal.rs,exarch/src/tui/scrollback.rs.
See session-record and frontend.