Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/aien-protocols-mv/blob/main/specs/execution-transcript/TRN1_TRANSCRIPT_SPEC.md # aien-protocols-mv Canonical specifications, wire protocols, and schemas for the AIEN sovereign ecosystem Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `aien-protocols-mv / specs / execution-transcript / TRN1_TRANSCRIPT_SPEC.md` 474 lines ยท 27438 bytes Raw Blame History Rendered 1 # Execution Transcript: TRN1 2 3 **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. 4 **Contract version**: 0.2.0 (major zero: may change by minor bump, see VERSIONING.md) 5 **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 6 **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) 7 **License**: Community Specification License 1.0 8 **Reference verifier**: [`tools/trn1_verify.c`](tools/trn1_verify.c), C99, self-contained (own SHA-256, libc only) 9 **Planned implementations**: omega `tools/replay` (C verifier and replayer, lane LD); sovereign-core `crates/aien-replay` (Rust reader, lane LE) 10 **Conformance corpus**: [`vectors/`](vectors/) with [`vectors/expected.txt`](vectors/expected.txt) and [`vectors/compare.txt`](vectors/compare.txt) 11 12 ## 1. Purpose 13 14 A run of an AIEN system makes choices that are not fixed by its inputs: which 15 reaction the scheduler wakes next, which branch id it hands out, which random 16 seed it draws, what an outside source sent, which capability generation was 17 current. A TRN1 transcript writes those choices down, in order, so that: 18 19 1. a **verifier** can tell, from the bytes alone, whether a transcript is 20 complete and undamaged (nothing dropped, reordered, flipped or cut off); 21 2. a **replayer** can run the same program again, feed it the recorded 22 choices, write a second transcript, and **compare** the two record by 23 record, reporting `MATCH through N` or the first divergence. 24 25 The transcript is the byte format and the outcomes, never a language type. 26 No C struct, Rust enum or serialization crosses it. 27 28 What is deliberately **not** in the compared part of a transcript: wall-clock 29 times, worker or core placement, and anything else that may differ between 30 two correct runs of the same history. Those may be kept as *annotations* 31 (section 4.3), which are integrity-protected but never compared. 32 33 ## 2. Verifier and comparison interface 34 35 A verifier is a pure function of one read-only byte buffer. It returns 36 exactly one of: 37 38 - **accept**, with the record count, the run id and the final chain digest 39 (section 7), or 40 - **refuse**, with one refusal code (section 6) and the 1-based position of 41 the record where the first failing check fired (0 = the file header). 42 43 A comparison takes two buffers, *expected* (the recorded run) and *actual* 44 (the replay), verifies both, and returns one line (section 8). 45 46 Neither performs I/O beyond reading its input, reads clocks, or uses 47 randomness that can change the outcome. 48 49 ## 3. File header (48 bytes) 50 51 All integers are unsigned little-endian unless marked signed (two's 52 complement). Offsets are from the start of the buffer. 53 54 | Offset | Size | Field | Valid values | 55 |---|---|---|---| 56 | 0 | 4 | magic | ASCII `TRN1` (`54 52 4E 31`) | 57 | 4 | 2 | schema | `1` or `3` (section 10); every other value is refused | 58 | 6 | 2 | flags | `0` (no flags defined) | 59 | 8 | 32 | run_id | opaque; the root causal id of this run (plan item P5). Any value. | 60 | 40 | 2 | producer | subsystem id (section 5.2) of the writer; not 0 | 61 | 42 | 6 | reserved | all zero | 62 63 The **header digest** is SHA-256 over these 48 bytes. It is the `prev` value 64 of record 1. 65 66 ## 4. Records 67 68 ### 4.1 Record layout 69 70 After the header come one or more records, back to back. The last record is 71 always `END` (type `0xFFFF`), and nothing follows it. 72 73 | Offset | Size | Field | Rule | 74 |---|---|---|---| 75 | 0 | 2 | type | a known record type (section 5.1) | 76 | 2 | 2 | subsystem | a known subsystem id (section 5.2); 0 on `END` and only on `END` | 77 | 4 | 4 | ident_len | identity length, at most 65536, exact per type | 78 | 8 | 4 | annot_len | annotation length, at most 65536; 0 on `END` | 79 | 12 | 4 | reserved | zero | 80 | 16 | 8 | seq | position of this record, 1-based, dense: record k has seq k | 81 | 24 | 32 | prev | record digest of record k-1, or the header digest for k = 1 | 82 | 56 | ident_len | identity | type-specific, compared on replay (section 5.1) | 83 | 56 + ident_len | annot_len | annotation | opaque, chained, never compared | 84 85 ### 4.2 Two digests per record 86 87 - **Record digest** = SHA-256 over the whole record, bytes 0 through the end 88 of the annotation. It goes into the next record's `prev`, so the records 89 form a hash chain anchored on the header. The record digest of `END` is the 90 **final digest** of the transcript; publishing it (for example in a 91 receipt) pins the whole file. 92 - **Compared digest** = SHA-256 over 93 `"AIEN_TRN1_CMP"` (13 ASCII bytes) `|| type (2) || subsystem (2) || seq (8) || ident_len (4) || identity`, 94 all integers little-endian. Comparison (section 8) uses only this. It leaves 95 out `prev`, the annotation and the header, so two runs of the same history 96 with different run ids, timings or worker placement compare equal. 97 98 ### 4.3 Identity versus annotation 99 100 Everything that a correct replay must reproduce goes in the identity. 101 Everything that may legitimately differ between two correct runs goes in the 102 annotation. Writers must not put a wall-clock value in an identity unless the 103 program's behaviour depended on it, and then it is a `CLOCK_READ` record. 104 105 ## 5. Registries 106 107 ### 5.1 Record types 108 109 `ident` lengths are exact unless stated. "digest" fields are 32 bytes. 110 Fields named `reserved` must be zero (NONCANONICAL otherwise). 111 112 | Type | Name | ident_len | Identity fields in order | 113 |---|---|---|---| 114 | 1 | SCHED_DECISION | 32 | decision u64 (logical step), chosen u64 (task or reaction id), wake_cause u64, coalesced u64 | 115 | 2 | BRANCH_CREATE | 24 | branch u64 (logical id), parent u64 (0 = root), generation u64 | 116 | 3 | BRANCH_DESTROY | 24 | branch u64, generation u64, reason i32, reserved u32 | 117 | 4 | RNG_SEED | 40 | stream u64, seed[32] | 118 | 5 | RNG_DRAW | 24 | stream u64, index u64, value u64 | 119 | 6 | ARTIFACT_DIGEST | 48 | kind u32, reserved u32, artifact u64, digest | 120 | 7 | CAP_TRANSITION | 32 | cap_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 | 121 | 8 | CORTEX_READ | 56 | object u32, object_generation u32, version u64, mask u64, value digest | 122 | 9 | EFFECT_INTENT | 56 | effect u64, effect_class u32, cap_id u32, cap_generation u64, request digest | 123 | 10 | EFFECT_COMMIT | 48 | effect u64, outcome i32, reserved u32, result digest | 124 | 11 | EXTERNAL_INPUT | 48 to 4144 | source 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. | 125 | 12 | CLOCK_READ | 16 | clock u32, reserved u32, value u64. Only for reads the program's behaviour depended on. | 126 | 13 | CRASH_BOUNDARY | 48 | epoch u64, last_durable_seq u64 (must be below this record's seq, SHAPE otherwise), recovered state digest | 127 | 14 | CHECKPOINT | 40 | scope u32, reserved u32, subsystem state digest | 128 | 15 | RX_CRUMB | 32 + n | crumb digest, then the canonical crumb bytes (section 5.3) | 129 | 16 | ARGUS_EVENT | 200 | event[128], chained u8 (0 or 1, SHAPE otherwise), reserved[7], chain_before digest, chain_after digest (section 5.4) | 130 | 17 | CAUSE | 80 | schema 3 only: cause[32], mode u32, local_kind u32, local u64, root digest (section 5.5) | 131 | 18 | RECEIPT_BIND | 40 | schema 3 only: cause[32], format u32, reserved u32 (section 5.5) | 132 | 19 | RUN_LINK | 48 | schema 3 only: relation u32, reserved u32, parent branch u64, parent create digest (section 5.5) | 133 | 20 | TRAIN_DISPATCH | none | number reserved; no layout in 0.2.0, so refused as UNKNOWN under every schema (section 5.5) | 134 | 21 | RESOURCE | 96 | schema 3 only: op u8, reason u8, field u16, reserved u32, unit u64, cause[32], contract digest, declared u64, used u64 (section 5.5) | 135 | 0xFFFF | END | 16 | record_count u64 (must equal this record's seq, GAP otherwise), reserved u64 | 136 137 Under schema 1 the registry is types 1 to 16 and END; types 17 to 21 are 138 unknown there and refused with UNKNOWN (vectors `m030`, `m070`). 139 140 ### 5.2 Subsystems 141 142 | Id | Name | Id | Name | 143 |---|---|---|---| 144 | 0 | transcript (END only) | 6 | aienos-store | 145 | 1 | omega-world | 7 | sovcore-runtime | 146 | 2 | omega-cortex | 8 | sovcore-scheduler | 147 | 3 | omega-jspace | 9 | sovcore-kv | 148 | 4 | aienos-kernel | 10 | external | 149 | 5 | aienos-argus | | | 150 151 The name column is the text printed in a DIVERGENCE line. 152 153 ### 5.3 RX_CRUMB: carrying an Omega RxCrumb without loss 154 155 Source of truth: omega `src/runtime/rx_world.h` (`RxCrumb`) and 156 `src/runtime/rx_world.c` (`crumb_hash`), checked at omega main ``9ca297c``. 157 Omega computes a crumb's digest as SHA-256 over the ASCII tag 158 `AIEN_RX_CAUSAL_V1` (17 bytes) followed by these little-endian fields; the 159 **canonical crumb bytes** in a TRN1 record are exactly those fields, without 160 the tag: 161 162 | Field | Size | 163 |---|---| 164 | id | u64 | 165 | kind | u32 (`RxCrumbKind`; not range-checked here, so new kinds pass) | 166 | reaction | u32 (`UINT32_MAX` for external or create) | 167 | faculty | u32 | 168 | wake_cause | u64 | 169 | coalesced_wakes | u64 | 170 | n_inputs, then n_inputs times (obj id u32, obj generation u32, version u64, mask u64) | u32 + 24 each, n_inputs at most 8 | 171 | n_caps, then n_caps times (cap_id u32, generation u64, issuer u32) | u32 + 16 each, at most 8 | 172 | n_outputs, then n_outputs times (obj id u32, obj generation u32, version u64, mask u64) | u32 + 24 each, at most 8 | 173 | reason | i32 | 174 | 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 | 175 176 The bytes must parse to exactly their length (SHAPE otherwise), and the 177 first 32 bytes of the identity must equal 178 SHA-256(`AIEN_RX_CAUSAL_V1` || canonical bytes) (DIGEST otherwise). Limits 8, 179 8, 8 and 65 are omega's `RX_MAX_DEPS`, `RX_MAX_CAPS`, `RX_MAX_WRITES` and 180 `RX_MAX_PARENTS` (= 8 * 8 + 1). 181 182 The fields omega keeps but does not hash (`worker`, `t_start_ns`, `t_end_ns`, 183 `episode`) are not identity. A writer that wants them kept puts them in the 184 annotation as `worker u32, t_start_ns u64, t_end_ns u64, episode u64` 185 (28 bytes); the corpus does this. With that annotation every `RxCrumb` field 186 is carried, and the omega digest is carried and rechecked unchanged: the 187 conversion is lossless and needs no omega code. Omega's rule "a parent 188 digest is hashed only when the parent precedes the child" is reproduced by 189 the `1 <= parent < id` rule above (vector `p002` exercises parents 0 and 190 parents at or above the crumb id). 191 192 ### 5.4 ARGUS_EVENT: carrying the Aienux ARGUS chain without loss 193 194 Source of truth: aienos `native/argus/argus_abi.h` and `argus_event.c` 195 (`encode_raw`, `argus_chain_extend`), and `argus_core.c` (chain starts from 196 32 zero bytes; malformed events are recorded but not chained), checked at 197 aienos main ``33927b1``. 198 199 - `event` is the 128-byte ARGUS wire encoding exactly as `argus_event_encode` 200 writes it (ABI version 1). TRN1 does not validate ARGUS semantics; that is 201 the ARGUS decoder's job. 202 - `chained = 1`: `chain_after` must equal SHA-256(`chain_before` || `event`), 203 which is what `argus_chain_extend` computes. `chained = 0`: `chain_after` 204 must equal `chain_before`. 205 - Continuity: inside one transcript, each ARGUS_EVENT's `chain_before` must 206 equal the previous ARGUS_EVENT's `chain_after`. The first ARGUS_EVENT may 207 start from any value (all zeros for a stream that starts at boot), so a 208 transcript can begin in the middle of a run. Failures are DIGEST. 209 210 The ARGUS `tick` field is the authority's logical clock, not a wall clock, 211 and stays in the identity. 212 213 ### 5.5 Causal and resource records (contract 0.2.0, schema 3 only) 214 215 Source of truth: aien-architecture `docs/hardening/causal-id-join-v0.md` 216 (merged ``fa46a26``) sections 2.1, 3.1 to 3.3 and 3.5 (the joint number 217 table), and `docs/hardening/resource-contract-v0.md` (merged ``ddc17b7``) 218 section 4, with the 32-byte cause required by causal-id-join section 3.5. 219 All integers little-endian; "digest" is 32 bytes. These types exist only in 220 a file whose header schema is 3; under schema 1 they are UNKNOWN. 221 222 **Cause id.** A 32-byte value, 223 `SHA-256("AIEN_CAUSE_V0" (13 ASCII bytes) || subsystem u16 || local_kind u32 || local u64 || root digest)`, 224 where `subsystem` is the CAUSE record's own subsystem field, not the file 225 header producer (aien-architecture#102 Q5), 226 minted once where an outside input enters AIEN and copied, never re-minted, 227 downstream (causal-id-join section 2.1 and 2.3). A TRN1 verifier carries it; 228 it does not recompute it (see "Verifier rules versus join rules" below). 229 230 **Type 17 CAUSE (80 bytes).** 231 232 | Offset | Size | Field | Rule | 233 |---|---|---|---| 234 | 0 | 32 | cause | the cause id | 235 | 32 | 4 | mode | 1 MINT, 2 ADOPT, 3 REF; else SHAPE | 236 | 36 | 4 | local_kind | 1 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) | 237 | 40 | 8 | local | MINT and ADOPT: not 0, else SHAPE. REF: 0 exactly, else SHAPE (aien-architecture#102 Q3) | 238 | 48 | 32 | root digest | MINT: the digest the cause was minted over. ADOPT and REF: all zero, else NONCANONICAL | 239 240 Annotation (never compared, not checked by the verifier): an ADOPT carries 241 origin run id (32) then origin seq (u64). 242 243 **Type 18 RECEIPT_BIND (40 bytes).** 244 245 | Offset | Size | Field | Rule | 246 |---|---|---|---| 247 | 0 | 32 | cause | a cause opened earlier in this run (a join rule, below) | 248 | 32 | 4 | format | 1 aienos `cka_receipt`, 2 omega evidence receipt, 3 sovereign-core `aien-proof`; else SHAPE | 249 | 36 | 4 | reserved | zero, else NONCANONICAL | 250 251 Annotation: the receipt digest (32). It is chained but never compared, 252 because receipt bytes may differ between correct runs (vector `g008` 253 MATCHes `g006` with a different receipt digest). 254 255 **Type 19 RUN_LINK (48 bytes).** Allowed only as record 1 (SHAPE otherwise). 256 257 | Offset | Size | Field | Rule | 258 |---|---|---|---| 259 | 0 | 4 | relation | 1 CHILD_OF; else SHAPE | 260 | 4 | 4 | reserved | zero, else NONCANONICAL | 261 | 8 | 8 | parent branch | the `branch` of the parent's `BRANCH_CREATE` | 262 | 16 | 32 | parent create digest | the compared digest (section 4.2) of that `BRANCH_CREATE` record | 263 264 Annotation: parent run id (32) then parent seq (u64). 265 266 **Type 20 TRAIN_DISPATCH.** The number is reserved by the joint table 267 (causal-id-join section 3.5). Its identity layout is not fixed in 0.2.0, so 268 every reader refuses type 20 as UNKNOWN (vector `m071`). A later minor 269 version defines it. 270 271 **Type 21 RESOURCE (96 bytes).** 272 273 | Offset | Size | Field | Rule | 274 |---|---|---|---| 275 | 0 | 1 | op | 1 CHARGE, 2 REFUND, 3 REFUSE, 4 CANCEL, 5 OVERRUN, 6 OVER_OBSERVED; else SHAPE | 276 | 1 | 1 | reason | REFUSE: 1 BUSY, 2 OVER_BUDGET, 3 UNKNOWN, 4 QUOTA. CANCEL: 1 DEADLINE, 2 PARENT, 3 EXPLICIT. Every other op: 0. Else SHAPE | 277 | 2 | 2 | field | contract field number 1 to 10 (resource-contract section 1.2), or 0 for a whole-need charge or refund; above 10 SHAPE | 278 | 4 | 4 | reserved | zero, else NONCANONICAL | 279 | 8 | 8 | unit | the reaction or task id the outcome applies to | 280 | 16 | 32 | cause | the cause id this outcome serves | 281 | 48 | 32 | contract | digest of the contract record in force | 282 | 80 | 8 | declared | the declared limit for `field` (0 when absent) | 283 | 88 | 8 | used | the deterministic amount used, 0 for a measured field | 284 285 Measured amounts (CPU, wall, GPU, energy) go in the annotation, never the 286 identity (resource-contract section 4). The 8-byte cause of the first 287 arch#96 draft is refused by length (vector `m073`). 288 289 **Verifier rules versus join rules.** A TRN1 verifier checks the rules in 290 the tables above, one file at a time, with the refusal codes of section 6. 291 It does **not** check: that a minted cause recomputes, that a cause is 292 minted once, CAUSE placement and adjacency, that a RESOURCE or RECEIPT_BIND 293 names a cause opened earlier in the run, that an effect or branch is 294 preceded by a CAUSE REF, ADOPT origins, RUN_LINK parents, or receipt 295 contents. Those are steps 3 to 10 of the causal join (causal-id-join section 296 4), which has its own outcome line and codes (`CAUSE_DIGEST`, `REF_UNKNOWN` 297 and the rest), and some of which need more than one file (a child run's 298 causes are opened by its parent). A transcript that breaks only a join rule 299 **verifies**; the corpus lists the join refusals it expects in 300 `vectors/join.txt` (section 9). 301 302 ## 6. Refusal codes 303 304 Zero means accept. A refusal is a negative integer from this table, and only 305 from this table. 306 307 | Code | Name | Meaning | 308 |---|---|---| 309 | -1 | MAGIC | first four bytes are not `TRN1` | 310 | -2 | VERSION | schema is not 1 or 3 (unknown version, older or newer; section 10) | 311 | -3 | LENGTH | buffer ends inside the header or a record; a length above its limit; bytes after END | 312 | -4 | NONCANONICAL | a flag or reserved field is not zero | 313 | -5 | UNKNOWN | unknown record type, unknown subsystem, or producer 0 or unknown | 314 | -6 | SHAPE | identity length wrong for its type; a field outside its valid set; END subsystem or annotation rule broken; malformed crumb bytes | 315 | -7 | GAP | a record's seq is not its position (omission, reorder, duplicate) or END's record_count differs from its seq | 316 | -8 | CHAIN | a record's prev is not the digest of what precedes it (bit flip, splice) | 317 | -9 | DIGEST | an embedded digest does not match: crumb digest, external input content, ARGUS chain link or continuity | 318 | -10 | TRUNCATED | the buffer ends cleanly after a record that is not END | 319 320 ## 7. Check order (determines the code) 321 322 A verifier refuses with the code of the **first** failing check, in this 323 order. "event" is the position k of the record being checked (0 = header). 324 325 Header: 326 327 1. Fewer than 4 bytes: LENGTH. Magic not `TRN1`: MAGIC. 328 2. Fewer than 6 bytes: LENGTH. schema not 1 and not 3: VERSION. 329 3. Fewer than 48 bytes: LENGTH. flags not 0: NONCANONICAL. 330 4. producer 0 or unknown: UNKNOWN. 331 5. reserved not zero: NONCANONICAL. 332 333 Then for record k = 1, 2, ...: 334 335 1. Buffer ends exactly here: TRUNCATED. Fewer than 56 bytes left, or k above 4096: LENGTH. 336 2. type unknown for the file's schema (types 17 to 21 under schema 1, type 20 337 under every schema): UNKNOWN. subsystem unknown: UNKNOWN. 338 3. reserved not zero: NONCANONICAL. 339 4. ident_len or annot_len above 65536: LENGTH. 340 5. seq not k: GAP. 341 6. prev not the previous digest: CHAIN. 342 7. identity plus annotation not fully present: LENGTH. 343 8. Shape, in this order: ident_len rule for the type; END-and-only-END has 344 subsystem 0; CAP_TRANSITION op; CRASH_BOUNDARY last_durable_seq < k; 345 RX_CRUMB canonical bytes; ARGUS_EVENT chained flag; END annot_len 0; 346 then (schema 3) CAUSE mode, CAUSE local_kind (MINT and ADOPT), 347 REF local_kind zero, CAUSE local (MINT and ADOPT), REF local zero, RECEIPT_BIND 348 format, RUN_LINK relation, RUN_LINK is record 1, RESOURCE op, RESOURCE 349 reason, RESOURCE field. Any failure: SHAPE. 350 9. Reserved fields inside the identity, then (schema 3) CAUSE root digest 351 zero for ADOPT and REF, RECEIPT_BIND reserved, RUN_LINK reserved, 352 RESOURCE reserved: NONCANONICAL. 353 10. Embedded digests: RX_CRUMB digest, EXTERNAL_INPUT content, ARGUS 354 continuity then ARGUS link. Any failure: DIGEST. 355 11. If END: record_count not k: GAP. Bytes remain after END: LENGTH with 356 event k + 1. Otherwise accept. 357 358 The 4096-record cap is a limit of this v0 reference verifier and corpus, not 359 a property of the format; a later contract version may lift it. 360 361 ## 8. Outcome lines and comparison 362 363 Every outcome is one canonical text line, which is also the corpus manifest 364 format. 365 366 Verify: 367 368 ```text 369 ok records=N run= final= 370 refuse CODE event=K 371 ``` 372 373 Compare (expected first, actual second): both are verified first. If one is 374 refused the line is `refuse expected CODE event=K` or 375 `refuse actual CODE event=K` (expected checked first). Otherwise the 376 compared digests (section 4.2) are compared position by position from 1: 377 378 ```text 379 MATCH through N 380 DIVERGENCE event=K expected= actual= subsystem= 381 ``` 382 383 `subsystem` names the expected record's subsystem (section 5.2). Because 384 every transcript ends with END, whose identity holds the record count, two 385 transcripts of different length always diverge at or before the shorter 386 one's END; `MATCH through N` therefore means both have exactly N records with 387 equal identities. 388 389 What a chain does and does not prove: the chain catches accidental damage 390 and naive tampering in one file. A writer that drops a record and then 391 renumbers and rechains produces a transcript that verifies (corpus `f001`). 392 That is caught only by comparison with a replay, or by checking the final 393 digest against an independently stored copy. Consumers must not treat 394 "verifies" as "is the history that happened". 395 396 ## 9. Conformance corpus 397 398 `vectors/expected.txt` lists every transcript as ` `; 399 `vectors/compare.txt` lists pairs as ` `; 400 `vectors/join.txt` lists ` JOIN_REFUSED reason= run=<64 hex> event=` 401 for transcripts that verify but that the causal join (section 5.5) must 402 refuse, the join set being that one file. The reference verifier does not 403 read `join.txt`; it is input for a joiner, and NOT_RUN until one checks it. 404 Lines starting with `#` are comments. Plain text, so C, shell, Rust and 405 Omega harnesses can read them without a JSON parser. 406 407 | Group | Files | What it shows | 408 |---|---|---| 409 | Golden | `g001` .. `g005` | g001 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 | 410 | Edge positives | `p001`, `p002` | 4096-byte external input with a large annotation; a crumb at omega's 8/8/8 limits with digest-less parents | 411 | Forged replays | `f001` .. `f006` | valid 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 | 412 | Byte damage | `m001` .. `m018` | g001 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 | 413 | Built refusals | `m020` .. `m065` | rechained 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 | 414 | 0.2 golden | `g006` .. `g008` | schema 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 | 415 | 0.2 edge positive | `p003` | top of each range: local_kind 4, REFUSE reason 4, CANCEL reason 3, OVERRUN, OVER_OBSERVED on field 10, receipt format 1 | 416 | 0.2 forged | `f007` .. `f009` | rechained: cause bit flip in a RESOURCE, RESOURCE before its MINT (reorder), MINT omitted before the RESOURCE. Each verifies and DIVERGEs from g006 | 417 | Join only | `j001` .. `j005` | verify 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) | 418 | 0.2 refusals | `m070` .. `m094` | a 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) | 419 420 Regenerate with `tools/make-corpus.sh vectors`. The generator is shell plus 421 coreutils (`sha256sum`, `od`, `sed`) and builds every byte from the tables 422 above; it never calls the verifier. `tools/check-corpus.sh` regenerates the 423 corpus into a temporary directory and requires it byte-identical to 424 `vectors/`, then builds the reference verifier (warnings as errors, and an 425 ASan/UBSan build when available) and checks every line. 426 `tools/mutate-verifier.sh` builds one verifier per check with that check 427 disabled and requires the corpus to catch each one (no survivors). 428 429 A conforming harness prints one summary line: 430 431 ```text 432 TRN1_CONFORMANCE impl= pass=N fail=0 433 ``` 434 435 ## 10. Versioning 436 437 - The header `schema` names the record registry in force. Schema 1: contract 438 0.1 registry (types 1 to 16 and END). Schema 3: contract 0.2 registry 439 (schema 1 plus types 17, 18, 19, 21). Schema 2 is never assigned: vector 440 `m020` has pinned it as an unknown schema since 0.1.0, and existing 441 vectors keep their outcomes. 442 - Version negotiation is by the header only. A reader accepts exactly the 443 schemas it implements and refuses every other value with VERSION at event 444 0; it never reinterprets an older or newer file. So a 0.1 reader refuses a 445 schema 3 file cleanly (VERSION, event 0), and a 0.2 reader refuses a 446 0.2 record inside a schema 1 file (UNKNOWN at that record, vector `m070`). 447 A 0.2 reader accepts both schema 1 and schema 3 files. 448 - A writer writes schema 1 when it emits only 0.1 record types, so 0.1 449 readers keep reading it, and schema 3 when it emits any 0.2 type. 450 - While the contract is 0.Y.Z, a new record type, subsystem or field is a 451 minor version with new vectors; existing vectors keep their outcomes or the 452 change is recorded as breaking in CHANGELOG.md. 453 - Adding vectors the reference already decides is a patch version. 454 Changing a refusal code or the check order is a breaking change. 455 - No feature negotiation beyond the schema value: each schema is checked exactly. A writer that needs a 456 record this spec lacks proposes it here first; it does not invent a type 457 number. 458 459 ## 11. Limits (stated, not hidden) 460 461 - No runtime writes TRN1 yet. RX_CRUMB and ARGUS_EVENT layouts were checked 462 against the live omega and aienos sources named above, and a host-only 463 scratch check fed the corpus bytes to those sources' hash functions 464 (recorded in the lane LB report, not part of CI). 465 - Batch composition, KV page ownership and sampler state for an inference 466 runtime have no record type yet; they wait for an inference runtime that 467 exists (sovereign-core is scaffolding, omega has none). 468 - Cross-record checks beyond ARGUS continuity are left to replayers: a 469 crumb's parent digest is not checked against an earlier RX_CRUMB record in 470 the same file, and effect commits are not matched to intents. In 0.2.0 471 the causal checks are join rules (section 5.5), not verifier rules. 472 - TRAIN_DISPATCH (type 20) has a number and no layout. 473 - No signature over the final digest. Anchoring the final digest in a signed 474 receipt belongs to the receipt format, not to TRN1.