interplane.Get Omega
Read in your language

aien-protocols-mv

Canonical specifications, wire protocols, and schemas for the AIEN sovereign ecosystem

Brought by drakestapleton

branch main Branches Tags History

aien-protocols-mv / specs / execution-transcript / TRN1_TRANSCRIPT_SPEC.md

474 lines · 27438 bytes Raw Blame History Source

Execution Transcript: TRN1

Status: Draft v0 (hardening lane LB, 2026-10-01); 0.2.0 adds the causal and resource records (hardening cut S1, lane HD-08, 2026-10-01). Not yet produced by any runtime. Contract version: 0.2.0 (major zero: may change by minor bump, see VERSIONING.md) Wire schema versions: 1 (contract 0.1 record registry) and 3 (contract 0.2 record registry), in the schema field below; rule in section 10 0.2.0 sources: aien-architecture docs/hardening/causal-id-join-v0.md (merged fa46a26: sections 2.1, 3.1 to 3.3, 3.5, 4) and docs/hardening/resource-contract-v0.md (merged ddc17b7: section 4) License: Community Specification License 1.0 Reference verifier: tools/trn1_verify.c, C99, self-contained (own SHA-256, libc only) Planned implementations: omega tools/replay (C verifier and replayer, lane LD); sovereign-core crates/aien-replay (Rust reader, lane LE) Conformance corpus: vectors/ with vectors/expected.txt and vectors/compare.txt

1. Purpose

A run of an AIEN system makes choices that are not fixed by its inputs: which reaction the scheduler wakes next, which branch id it hands out, which random seed it draws, what an outside source sent, which capability generation was current. A TRN1 transcript writes those choices down, in order, so that:

  1. a verifier can tell, from the bytes alone, whether a transcript is complete and undamaged (nothing dropped, reordered, flipped or cut off);
  2. a replayer can run the same program again, feed it the recorded choices, write a second transcript, and compare the two record by record, reporting MATCH through N or the first divergence.

The transcript is the byte format and the outcomes, never a language type. No C struct, Rust enum or serialization crosses it.

What is deliberately not in the compared part of a transcript: wall-clock times, worker or core placement, and anything else that may differ between two correct runs of the same history. Those may be kept as annotations (section 4.3), which are integrity-protected but never compared.

2. Verifier and comparison interface

A verifier is a pure function of one read-only byte buffer. It returns exactly one of:

A comparison takes two buffers, expected (the recorded run) and actual (the replay), verifies both, and returns one line (section 8).

Neither performs I/O beyond reading its input, reads clocks, or uses randomness that can change the outcome.

3. File header (48 bytes)

All integers are unsigned little-endian unless marked signed (two's complement). Offsets are from the start of the buffer.

OffsetSizeFieldValid values
04magicASCII TRN1 (54 52 4E 31)
42schema1 or 3 (section 10); every other value is refused
62flags0 (no flags defined)
832run_idopaque; the root causal id of this run (plan item P5). Any value.
402producersubsystem id (section 5.2) of the writer; not 0
426reservedall zero

The header digest is SHA-256 over these 48 bytes. It is the prev value of record 1.

4. Records

4.1 Record layout

After the header come one or more records, back to back. The last record is always END (type 0xFFFF), and nothing follows it.

OffsetSizeFieldRule
02typea known record type (section 5.1)
22subsystema known subsystem id (section 5.2); 0 on END and only on END
44ident_lenidentity length, at most 65536, exact per type
84annot_lenannotation length, at most 65536; 0 on END
124reservedzero
168seqposition of this record, 1-based, dense: record k has seq k
2432prevrecord digest of record k-1, or the header digest for k = 1
56ident_lenidentitytype-specific, compared on replay (section 5.1)
56 + ident_lenannot_lenannotationopaque, chained, never compared

4.2 Two digests per record

4.3 Identity versus annotation

Everything that a correct replay must reproduce goes in the identity. Everything that may legitimately differ between two correct runs goes in the annotation. Writers must not put a wall-clock value in an identity unless the program's behaviour depended on it, and then it is a CLOCK_READ record.

5. Registries

5.1 Record types

ident lengths are exact unless stated. "digest" fields are 32 bytes. Fields named reserved must be zero (NONCANONICAL otherwise).

TypeNameident_lenIdentity fields in order
1SCHED_DECISION32decision u64 (logical step), chosen u64 (task or reaction id), wake_cause u64, coalesced u64
2BRANCH_CREATE24branch u64 (logical id), parent u64 (0 = root), generation u64
3BRANCH_DESTROY24branch u64, generation u64, reason i32, reserved u32
4RNG_SEED40stream u64, seed[32]
5RNG_DRAW24stream u64, index u64, value u64
6ARTIFACT_DIGEST48kind u32, reserved u32, artifact u64, digest
7CAP_TRANSITION32cap_id u32, op u8 (1 MINT, 2 ATTENUATE, 3 TRANSFER, 4 REVOKE, 5 RECLAIM, 6 EPOCH; else SHAPE), reserved[3], generation_before u64, generation_after u64, principal u32, issuer u32
8CORTEX_READ56object u32, object_generation u32, version u64, mask u64, value digest
9EFFECT_INTENT56effect u64, effect_class u32, cap_id u32, cap_generation u64, request digest
10EFFECT_COMMIT48effect u64, outcome i32, reserved u32, result digest
11EXTERNAL_INPUT48 to 4144source u32, reserved u32, input_seq u64, content digest, content (0 to 4096 bytes). When content is present its SHA-256 must equal the digest (DIGEST otherwise); when absent the content is stored elsewhere and only the digest is pinned.
12CLOCK_READ16clock u32, reserved u32, value u64. Only for reads the program's behaviour depended on.
13CRASH_BOUNDARY48epoch u64, last_durable_seq u64 (must be below this record's seq, SHAPE otherwise), recovered state digest
14CHECKPOINT40scope u32, reserved u32, subsystem state digest
15RX_CRUMB32 + ncrumb digest, then the canonical crumb bytes (section 5.3)
16ARGUS_EVENT200event[128], chained u8 (0 or 1, SHAPE otherwise), reserved[7], chain_before digest, chain_after digest (section 5.4)
17CAUSE80schema 3 only: cause[32], mode u32, local_kind u32, local u64, root digest (section 5.5)
18RECEIPT_BIND40schema 3 only: cause[32], format u32, reserved u32 (section 5.5)
19RUN_LINK48schema 3 only: relation u32, reserved u32, parent branch u64, parent create digest (section 5.5)
20TRAIN_DISPATCHnonenumber reserved; no layout in 0.2.0, so refused as UNKNOWN under every schema (section 5.5)
21RESOURCE96schema 3 only: op u8, reason u8, field u16, reserved u32, unit u64, cause[32], contract digest, declared u64, used u64 (section 5.5)
0xFFFFEND16record_count u64 (must equal this record's seq, GAP otherwise), reserved u64

Under schema 1 the registry is types 1 to 16 and END; types 17 to 21 are unknown there and refused with UNKNOWN (vectors m030, m070).

5.2 Subsystems

IdNameIdName
0transcript (END only)6aienos-store
1omega-world7sovcore-runtime
2omega-cortex8sovcore-scheduler
3omega-jspace9sovcore-kv
4aienos-kernel10external
5aienos-argus

The name column is the text printed in a DIVERGENCE line.

5.3 RX_CRUMB: carrying an Omega RxCrumb without loss

Source of truth: omega src/runtime/rx_world.h (RxCrumb) and src/runtime/rx_world.c (crumb_hash), checked at omega main 9ca297c. Omega computes a crumb's digest as SHA-256 over the ASCII tag AIEN_RX_CAUSAL_V1 (17 bytes) followed by these little-endian fields; the canonical crumb bytes in a TRN1 record are exactly those fields, without the tag:

FieldSize
idu64
kindu32 (RxCrumbKind; not range-checked here, so new kinds pass)
reactionu32 (UINT32_MAX for external or create)
facultyu32
wake_causeu64
coalesced_wakesu64
n_inputs, then n_inputs times (obj id u32, obj generation u32, version u64, mask u64)u32 + 24 each, n_inputs at most 8
n_caps, then n_caps times (cap_id u32, generation u64, issuer u32)u32 + 16 each, at most 8
n_outputs, then n_outputs times (obj id u32, obj generation u32, version u64, mask u64)u32 + 24 each, at most 8
reasoni32
n_parents, then n_parents times (parent u64, then the parent's 32-byte digest only if 1 <= parent < id)u32 + 8 or 40 each, at most 65

The bytes must parse to exactly their length (SHAPE otherwise), and the first 32 bytes of the identity must equal SHA-256(AIEN_RX_CAUSAL_V1 || canonical bytes) (DIGEST otherwise). Limits 8, 8, 8 and 65 are omega's RX_MAX_DEPS, RX_MAX_CAPS, RX_MAX_WRITES and RX_MAX_PARENTS (= 8 * 8 + 1).

The fields omega keeps but does not hash (worker, t_start_ns, t_end_ns, episode) are not identity. A writer that wants them kept puts them in the annotation as worker u32, t_start_ns u64, t_end_ns u64, episode u64 (28 bytes); the corpus does this. With that annotation every RxCrumb field is carried, and the omega digest is carried and rechecked unchanged: the conversion is lossless and needs no omega code. Omega's rule "a parent digest is hashed only when the parent precedes the child" is reproduced by the 1 <= parent < id rule above (vector p002 exercises parents 0 and parents at or above the crumb id).

5.4 ARGUS_EVENT: carrying the Aienux ARGUS chain without loss

Source of truth: aienos native/argus/argus_abi.h and argus_event.c (encode_raw, argus_chain_extend), and argus_core.c (chain starts from 32 zero bytes; malformed events are recorded but not chained), checked at aienos main 33927b1.

The ARGUS tick field is the authority's logical clock, not a wall clock, and stays in the identity.

5.5 Causal and resource records (contract 0.2.0, schema 3 only)

Source of truth: aien-architecture docs/hardening/causal-id-join-v0.md (merged fa46a26) sections 2.1, 3.1 to 3.3 and 3.5 (the joint number table), and docs/hardening/resource-contract-v0.md (merged ddc17b7) section 4, with the 32-byte cause required by causal-id-join section 3.5. All integers little-endian; "digest" is 32 bytes. These types exist only in a file whose header schema is 3; under schema 1 they are UNKNOWN.

Cause id. A 32-byte value, SHA-256("AIEN_CAUSE_V0" (13 ASCII bytes) || subsystem u16 || local_kind u32 || local u64 || root digest), where subsystem is the CAUSE record's own subsystem field, not the file header producer (aien-architecture#102 Q5), minted once where an outside input enters AIEN and copied, never re-minted, downstream (causal-id-join section 2.1 and 2.3). A TRN1 verifier carries it; it does not recompute it (see "Verifier rules versus join rules" below).

Type 17 CAUSE (80 bytes).

OffsetSizeFieldRule
032causethe cause id
324mode1 MINT, 2 ADOPT, 3 REF; else SHAPE
364local_kind1 omega episode, 2 aienos admission, 3 sovcore request, 4 train run (causal-id-join table 2.2 and section 3.4). MINT and ADOPT: 1 to 4, else SHAPE. REF: 0 exactly, else SHAPE (aien-architecture#102 Q3)
408localMINT and ADOPT: not 0, else SHAPE. REF: 0 exactly, else SHAPE (aien-architecture#102 Q3)
4832root digestMINT: the digest the cause was minted over. ADOPT and REF: all zero, else NONCANONICAL

Annotation (never compared, not checked by the verifier): an ADOPT carries origin run id (32) then origin seq (u64).

Type 18 RECEIPT_BIND (40 bytes).

OffsetSizeFieldRule
032causea cause opened earlier in this run (a join rule, below)
324format1 aienos cka_receipt, 2 omega evidence receipt, 3 sovereign-core aien-proof; else SHAPE
364reservedzero, else NONCANONICAL

Annotation: the receipt digest (32). It is chained but never compared, because receipt bytes may differ between correct runs (vector g008 MATCHes g006 with a different receipt digest).

Type 19 RUN_LINK (48 bytes). Allowed only as record 1 (SHAPE otherwise).

OffsetSizeFieldRule
04relation1 CHILD_OF; else SHAPE
44reservedzero, else NONCANONICAL
88parent branchthe branch of the parent's BRANCH_CREATE
1632parent create digestthe compared digest (section 4.2) of that BRANCH_CREATE record

Annotation: parent run id (32) then parent seq (u64).

Type 20 TRAIN_DISPATCH. The number is reserved by the joint table (causal-id-join section 3.5). Its identity layout is not fixed in 0.2.0, so every reader refuses type 20 as UNKNOWN (vector m071). A later minor version defines it.

Type 21 RESOURCE (96 bytes).

OffsetSizeFieldRule
01op1 CHARGE, 2 REFUND, 3 REFUSE, 4 CANCEL, 5 OVERRUN, 6 OVER_OBSERVED; else SHAPE
11reasonREFUSE: 1 BUSY, 2 OVER_BUDGET, 3 UNKNOWN, 4 QUOTA. CANCEL: 1 DEADLINE, 2 PARENT, 3 EXPLICIT. Every other op: 0. Else SHAPE
22fieldcontract field number 1 to 10 (resource-contract section 1.2), or 0 for a whole-need charge or refund; above 10 SHAPE
44reservedzero, else NONCANONICAL
88unitthe reaction or task id the outcome applies to
1632causethe cause id this outcome serves
4832contractdigest of the contract record in force
808declaredthe declared limit for field (0 when absent)
888usedthe deterministic amount used, 0 for a measured field

Measured amounts (CPU, wall, GPU, energy) go in the annotation, never the identity (resource-contract section 4). The 8-byte cause of the first arch#96 draft is refused by length (vector m073).

Verifier rules versus join rules. A TRN1 verifier checks the rules in the tables above, one file at a time, with the refusal codes of section 6. It does not check: that a minted cause recomputes, that a cause is minted once, CAUSE placement and adjacency, that a RESOURCE or RECEIPT_BIND names a cause opened earlier in the run, that an effect or branch is preceded by a CAUSE REF, ADOPT origins, RUN_LINK parents, or receipt contents. Those are steps 3 to 10 of the causal join (causal-id-join section 4), which has its own outcome line and codes (CAUSE_DIGEST, REF_UNKNOWN and the rest), and some of which need more than one file (a child run's causes are opened by its parent). A transcript that breaks only a join rule verifies; the corpus lists the join refusals it expects in vectors/join.txt (section 9).

6. Refusal codes

Zero means accept. A refusal is a negative integer from this table, and only from this table.

CodeNameMeaning
-1MAGICfirst four bytes are not TRN1
-2VERSIONschema is not 1 or 3 (unknown version, older or newer; section 10)
-3LENGTHbuffer ends inside the header or a record; a length above its limit; bytes after END
-4NONCANONICALa flag or reserved field is not zero
-5UNKNOWNunknown record type, unknown subsystem, or producer 0 or unknown
-6SHAPEidentity length wrong for its type; a field outside its valid set; END subsystem or annotation rule broken; malformed crumb bytes
-7GAPa record's seq is not its position (omission, reorder, duplicate) or END's record_count differs from its seq
-8CHAINa record's prev is not the digest of what precedes it (bit flip, splice)
-9DIGESTan embedded digest does not match: crumb digest, external input content, ARGUS chain link or continuity
-10TRUNCATEDthe buffer ends cleanly after a record that is not END

7. Check order (determines the code)

A verifier refuses with the code of the first failing check, in this order. "event" is the position k of the record being checked (0 = header).

Header:

  1. Fewer than 4 bytes: LENGTH. Magic not TRN1: MAGIC.
  2. Fewer than 6 bytes: LENGTH. schema not 1 and not 3: VERSION.
  3. Fewer than 48 bytes: LENGTH. flags not 0: NONCANONICAL.
  4. producer 0 or unknown: UNKNOWN.
  5. reserved not zero: NONCANONICAL.

Then for record k = 1, 2, ...:

  1. Buffer ends exactly here: TRUNCATED. Fewer than 56 bytes left, or k above 4096: LENGTH.
  2. type unknown for the file's schema (types 17 to 21 under schema 1, type 20 under every schema): UNKNOWN. subsystem unknown: UNKNOWN.
  3. reserved not zero: NONCANONICAL.
  4. ident_len or annot_len above 65536: LENGTH.
  5. seq not k: GAP.
  6. prev not the previous digest: CHAIN.
  7. identity plus annotation not fully present: LENGTH.
  8. Shape, in this order: ident_len rule for the type; END-and-only-END has subsystem 0; CAP_TRANSITION op; CRASH_BOUNDARY last_durable_seq < k; RX_CRUMB canonical bytes; ARGUS_EVENT chained flag; END annot_len 0; then (schema 3) CAUSE mode, CAUSE local_kind (MINT and ADOPT), REF local_kind zero, CAUSE local (MINT and ADOPT), REF local zero, RECEIPT_BIND format, RUN_LINK relation, RUN_LINK is record 1, RESOURCE op, RESOURCE reason, RESOURCE field. Any failure: SHAPE.
  9. Reserved fields inside the identity, then (schema 3) CAUSE root digest zero for ADOPT and REF, RECEIPT_BIND reserved, RUN_LINK reserved, RESOURCE reserved: NONCANONICAL.
  10. Embedded digests: RX_CRUMB digest, EXTERNAL_INPUT content, ARGUS continuity then ARGUS link. Any failure: DIGEST.
  11. If END: record_count not k: GAP. Bytes remain after END: LENGTH with event k + 1. Otherwise accept.

The 4096-record cap is a limit of this v0 reference verifier and corpus, not a property of the format; a later contract version may lift it.

8. Outcome lines and comparison

Every outcome is one canonical text line, which is also the corpus manifest format.

Verify:

ok records=N run=<run_id, 64 hex> final=<final digest, 64 hex>
refuse CODE event=K

Compare (expected first, actual second): both are verified first. If one is refused the line is refuse expected CODE event=K or refuse actual CODE event=K (expected checked first). Otherwise the compared digests (section 4.2) are compared position by position from 1:

MATCH through N
DIVERGENCE event=K expected=<compared digest, 64 hex> actual=<compared digest, 64 hex> subsystem=<name>

subsystem names the expected record's subsystem (section 5.2). Because every transcript ends with END, whose identity holds the record count, two transcripts of different length always diverge at or before the shorter one's END; MATCH through N therefore means both have exactly N records with equal identities.

What a chain does and does not prove: the chain catches accidental damage and naive tampering in one file. A writer that drops a record and then renumbers and rechains produces a transcript that verifies (corpus f001). That is caught only by comparison with a replay, or by checking the final digest against an independently stored copy. Consumers must not treat "verifies" as "is the history that happened".

9. Conformance corpus

vectors/expected.txt lists every transcript as <file> <verify line>; vectors/compare.txt lists pairs as <expected> <actual> <compare line>; vectors/join.txt lists <file> JOIN_REFUSED reason=<CODE> run=<64 hex> event=<k> for transcripts that verify but that the causal join (section 5.5) must refuse, the join set being that one file. The reference verifier does not read join.txt; it is input for a joiner, and NOT_RUN until one checks it. Lines starting with # are comments. Plain text, so C, shell, Rust and Omega harnesses can read them without a JSON parser.

GroupFilesWhat it shows
Goldeng001 .. g005g001 an Omega World run (two real RxCrumbs, effect intent and commit); g002 an ARGUS stream (two chained events, one unchained); g003 every other record type, including a crash boundary; g004 END only; g005 a replay of g001 with a different run id, workers and timings, which MATCHes g001
Edge positivesp001, p0024096-byte external input with a large annotation; a crumb at omega's 8/8/8 limits with digest-less parents
Forged replaysf001 .. f006valid chains with a different history: omission, reorder, changed seed, changed capability generation inside a crumb, extra record, early stop. Each verifies alone and DIVERGEs from g001 at the named record
Byte damagem001 .. m018g001 damaged after writing: omission, reorder, bit flips (identity, annotation, prev, seq, run id, magic, crumb bytes, END), truncation (header, mid record, inside END, at a record boundary), empty file, trailing byte, duplicate
Built refusalsm020 .. m065rechained so only the named check can fire: unknown versions (2 and 0), flags, producer, reserved fields, unknown type and subsystem, check order cases, oversize identity, every SHAPE rule, every DIGEST rule including an omitted ARGUS event the writer rechained
0.2 goldeng006 .. g008schema 3. g006 one sovcore request start to receipt: CAUSE MINT, RESOURCE charge, CAUSE REF before a branch and before an effect, refund, RECEIPT_BIND; g007 a child run (RUN_LINK as record 1 naming g006's BRANCH_CREATE, CAUSE ADOPT, RESOURCE cancel); g008 a replay of g006 with another run id and receipt digest, which MATCHes g006
0.2 edge positivep003top of each range: local_kind 4, REFUSE reason 4, CANCEL reason 3, OVERRUN, OVER_OBSERVED on field 10, receipt format 1
0.2 forgedf007 .. f009rechained: cause bit flip in a RESOURCE, RESOURCE before its MINT (reorder), MINT omitted before the RESOURCE. Each verifies and DIVERGEs from g006
Join onlyj001 .. j005verify under TRN1; join.txt names the join refusal: CAUSE_DIGEST, DOUBLE_MINT, REF_MISSING, COMMIT_ORPHAN, RECEIPT_CAUSE (f007 and f009 are listed there too, REF_UNKNOWN; f008 is CAUSE_PLACEMENT at its late MINT, aien-architecture#102 Q7)
0.2 refusalsm070 .. m094a valid 0.2 record under a schema 1 header (UNKNOWN); type 20 (UNKNOWN); wrong lengths (CAUSE 79 bytes, RESOURCE with the old 8-byte cause); every 0.2 SHAPE and NONCANONICAL rule; a check-order case; byte damage on g006 (cause bit flip, reorder); a CAUSE REF with nonzero local_kind (m093) and nonzero local (m094)

Regenerate with tools/make-corpus.sh vectors. The generator is shell plus coreutils (sha256sum, od, sed) and builds every byte from the tables above; it never calls the verifier. tools/check-corpus.sh regenerates the corpus into a temporary directory and requires it byte-identical to vectors/, then builds the reference verifier (warnings as errors, and an ASan/UBSan build when available) and checks every line. tools/mutate-verifier.sh builds one verifier per check with that check disabled and requires the corpus to catch each one (no survivors).

A conforming harness prints one summary line:

TRN1_CONFORMANCE impl=<c|rust|osc|...> pass=N fail=0

10. Versioning

11. Limits (stated, not hidden)