Skip to content

11. The Trace and conformance

Draws on: ADR 0006, ADR 0008, ADR 0009, ADR 0010, ADR 0011, ADR 0014, ADR 0015, ADR 0016, ADR 0017, ADR 0018, ADR 0020, ADR 0022, ADR 0023, ADR 0025, ADR 0026, ADR 0029, ADR 0030, ADR 0031, ADR 0034, #71, #79, ADR 0060, ADR 0073.

Both Cores answer to the Spec and the Conformance Corpus, bit for bit (ADR 0009). This chapter gives the display form every value is written in, the ids the Core assigns, the Trace a Group writes, and the case kinds of the Corpus and how they are run. The formats are Data Files: the records and the case.toml keys are in corpus.toml, and the line grammars in trace.ebnf.

Every value has one display form: a single line of text that names its kind as well as its value, so "5" and 5 differ. It is what a Trace, a Session’s echo, a Host’s String() and toString(), an error’s message template and a disassembly’s constants write (chapter 3). It round-trips: reading a value’s display form gives an equal value with the same display form, and both Cores ship its reader (ADR 0018).

  • Nothing and booleans: nothing, true and false.
  • A number is its canonical text, such as 7.50, -2.5 or 0.00.
  • A Quantity is its number, one space and its Unit in normal form: 2.50 GBP, 1 day, 3 days, 0.5 1/s.
  • Text is quoted, as below.
  • Bytes are <<, each byte as 0x and two uppercase hexadecimal digits, separated by , , then >>: <<0x0D, 0x0A>>, and <<>> when empty.
  • A list is [, its items separated by , , then ]: [1, "a", [nothing]].
  • A map is {, its entries in order, separated by , , then }, as below.
  • A range is its two ends joined by ..: 3..7, -2..-1 or 3 m/s..7 m/s.
  • A Path is its Path Literal form (chapter 3): /reviews/2/"first name", or / when empty.
  • A Civil Date or an Instant is its ISO 8601 form: 2026-09-27, 2026-09-27T14:30:00.5 or 2026-09-27T13:30:00Z.
  • A Text Pattern is its canonical source, such as <"ID-", 4 digits>.
  • A Function Value is <function …>, as below.
  • A Host Object is <object, its kind, its id as text, then >: <object item "object-slot-183">. Whether it has been disposed isn’t shown.

Rationale. The display form needs to read back only through a Core’s reader, not as source, where 2026-09-27 would be a subtraction (ADR 0023). One form for values also leaves the Corpus one decoder, rather than a tagged-JSON one beside a printer (ADR 0030).

Text literals have no escapes (ADR 0029), so text is written as source joins it: pieces separated by &.

  • Plain runs of code points are written between double quotes.
  • A " is quote, an LF is newline, and a tab is tab.
  • Hidden code points are fromCodePoint(n), with n in decimal: U+0000 to U+001F other than LF and tab, U+007F to U+009F, U+061C, U+200E, U+200F, U+2028 to U+202E, U+2066 to U+2069 and U+FEFF. So a Trace line never breaks, and no bidirectional control reorders it.
  • Empty text is "".
  • Pieces are split at code points, not Characters, and reading joins them the same way. Joining pieces of an NFC text gives that text back, so reading changes nothing.
  • Reading gives code points, as written. A runner builds the value through the Host’s constructors, which normalise text to NFC, as they do a Host’s (ADR 0030). So a Trace Case writes its Host texts in NFC, since the Core writes each Host Input back in the display form of the value it built, and a Value Encoding case is where a text that isn’t NFC is shown being normalised.

Example. "say " & quote & "hi" & quote, "a" & newline & "b", "C:\new" and fromCodePoint(13) & newline.

  • An entry is its key, : and its value.
  • A key that is a Word (chapter 1) other than offer, other Reserved Words included, is written bare, as in {sku: "A1", if: true}. The key offer is written as text, as in {"offer": 1, if: true}, so it is also valid as a source map key (chapter 2). Any other key is written as text, as in {"unit price": 2.50 GBP}, and one whose text would start with quote, newline, tab or fromCodePoint starts with "" & instead, so it never reads as a Word: {"" & quote: 1}.
  • An empty map is {}.

A Function Value is <function, a space, its Home Script and where its code is, then its captures, then > (ADR 0025):

  • A Lambda is placed by the code unit it is in and the line and column of its given: <function weather:12:3> in the Home Script’s own source, <function session+3:1:9> in its third extension, and <function orders:list:14:7> in the Library list.
  • A named function of the Script is placed by its Home Script and declaration name, <function weather:tax>, whether the initial source or an Extend unit defines it. An extension’s unit name is omitted: a Session Entry defining double displays as <function session:double>. An imported function is placed by its Home Script, defining Library and declaration name there, <function weather:text:pad>, even if the Import renames it or is added by Extend.
  • Captures follow as a map, in the order of their capture slots (chapter 8): <function weather:12:3 {n: 3}>. With no captures, the map is left out.
  • Staleness isn’t shown, since it isn’t part of the value (chapter 3).
  • Code identity still includes the defining code unit (chapter 10). Different Function Values can share a display form; matching displays do not imply equality or make a stale value call new code.

A Text Pattern’s canonical source is its source written on one line, with its splices resolved. Two Text Patterns are equal when their canonical sources are (chapter 3).

  • Its shape: <, its elements separated by , , then >, and <> with none. Alternatives are separated by or, and every other word by one space.
  • A leading group: when the first element is a nested <…>, one space follows the opening <, as in < <4 digits>, "x">. So no canonical source starts with <<, which starts Bytes, here and in source (chapter 1).
  • Kept as written: the elements, their grouping into nested <…>, singular and plural keywords, and counts. So <digit, digit> and <2 digits> are unequal, though they match the same text.
  • A text literal is written between quotes, in NFC, when its display form is a single quoted piece. Otherwise it is written as its display form in parentheses, which splices the same text: (quote & "x").
  • Keywords, classes, anchors and a number are their words: uppercase letters, text start, a number.
  • Repetitions are one or more of e, zero or more of e, optional e, and n e with n in canonical text, so 0x04 digits is 4 digits.
  • A Capture is name: e.
  • Suffixes: each suffix an element has, once, in the order as number, ignoring case, lazily.
  • Splices: a spliced Text Pattern is its canonical source, as a nested <…>. Spliced text is a text literal, as above.
  • Empty groups: a nested <> is left out, since it matches only where the rest would.
  • Not part of it: a use-site ignoring case, which belongs to the operation, not the pattern (chapter 4).

Example. < "ID" ,(sep), (tail) >, with sep holding the text "-" and tail the pattern <0x04 digits>, has the canonical source <"ID", "-", <4 digits>>. <last: word, ", ", first: word> is already canonical. <(tail), "x"> has the canonical source < <4 digits>, "x">, and <(tail)> has < <4 digits>>.

  • The grammar below decides where each value ends, so a Trace needs no quoting around values, and 2.50 GBP is one value.
  • A Unit follows a number after one space, and is never followed by =, so value=2.50 GBP fuel=9 reads a Quantity, then the key fuel.
  • A Text Pattern is read with the Text Pattern grammar of chapter 2, and a parenthesised piece in it as display-form text.
  • A Function Value or Host Object is read against the Host that holds it. A Host can’t build either, so each one a Trace’s Host Input names is one that crossed to the Host earlier: the runner uses the latest value with that display form that it received, and a Host Object that case.toml declares.
  • A malformed value in a case makes the case malformed. That is an error in the case, not a divergence between Cores.
Value ::= 'nothing' | 'true' | 'false' | Number | Quantity | TextValue
| BytesValue | ListValue | MapValue | RangeValue | PathValue | CivilDate
| Instant | PatternValue | FunctionValue | ObjectValue
Number ::= '-'? Digits ( '.' Digits )?
/* canonical text: no leading zeros, and no `-` on a zero */
Digits ::= [0-9]+
Quantity ::= Number ' ' UnitText
UnitText ::= [A-Za-z0-9*/^]+
/* a Unit in normal form; never followed by `=` */
TextValue ::= TextPiece ( ' & ' TextPiece )*
TextPiece ::= '"' Plain* '"' | 'quote' | 'newline' | 'tab'
| 'fromCodePoint(' Digits ')'
Plain ::= [^"#x0-#x1F#x7F-#x9F#x61C#x200E#x200F#x2028-#x202E#x2066-#x2069#xFEFF]
BytesValue ::= '<<' ( Byte ( ', ' Byte )* )? '>>'
Byte ::= '0x' [0-9A-F] [0-9A-F]
ListValue ::= '[' ( Value ( ', ' Value )* )? ']'
MapValue ::= '{' ( MapEntry ( ', ' MapEntry )* )? '}'
MapEntry ::= MapKey ': ' Value
MapKey ::= Word | TextValue
/* a Word exactly when the key is one other than offer; a TextValue key
starts with a quoted piece, `"" & ` if need be */
Word ::= [A-Za-z_] [A-Za-z0-9_]*
RangeValue ::= RangeEnd '..' RangeEnd
RangeEnd ::= Number | Quantity
PathValue ::= '/' ( PathStep ( '/' PathStep )* )?
PathStep ::= Word | '-'? [0-9]+ | '"' Plain* '"' | '${' TextValue '}'
/* a key is a Word when it is one, Reserved Words included; otherwise quoted,
or a hole holding its TextValue when it holds a character Plain excludes */
CivilDate ::= Date ( 'T' Time )?
Instant ::= Date 'T' Time 'Z'
Date ::= [0-9] [0-9] [0-9] [0-9] '-' [0-9] [0-9] '-' [0-9] [0-9]
Time ::= [0-9] [0-9] ':' [0-9] [0-9] ':' [0-9] [0-9] ( '.' [0-9]+ )?
/* one to six fraction digits, the last not 0 */
PatternValue ::= '<' [^#xA]* '>'
/* a Text Pattern's canonical source, read with chapter 2's
TextPattern production; `<<` starts Bytes, never this,
since a leading nested group is written `< <` */
FunctionValue ::= '<function ' Word ( '+' Digits )? ':' ( Word ':' )?
( Digits ':' Digits | Word ) ( ' ' MapValue )? '>'
ObjectValue ::= '<object ' Word ' ' TextValue '>'

The constants of a canonical disassembly are written in the display form. The constants that aren’t Script values are written like this:

  • A Built-in Constant by name is its name, such as pi or newline.
  • A list of map keys is a list of text, ["sku", "qty"].
  • A Text Pattern template is its canonical source, with (1), (2), … where its splices stand.
  • A list of bit-field widths is a list of numbers, [4, 4].

The Core assigns every id a Trace or a report names, the same way on both Cores. The counters behind them are part of the Group’s state, so they carry across Reload, extend Script and save, and a restored Group goes on from its save’s counters (chapter 10).

  • Delivery ids are d1, d2, … in the order the Group gives them. A Delivery the Host makes (Deliver, Request, Call or Decide) gets one when the call is made, or over the message layer when the Core reads it (chapter 9), and one refused at the call gets none. Each recipient of a Broadcast gets one when the Broadcast is drained.
  • Broadcast ids are b1, b2, … in the order the Group gives them, one for each Broadcast and Broadcast Decision.
  • Run ids are the Script’s name, /r and a number counting that Script’s Runs from 1 in the order they start, such as orders/r2. A Run starts when its message leaves the mailbox, so a Delivery cancelled in the mailbox has no Run.
  • Call ids are the Run’s id, .c and a number counting that Run’s calls from 1 in the order they start, such as orders/r2.c1. A call starts when it reaches its Host function or its receiver’s mailbox, so one refused before that gets no id. The calls are every Capability call, every send that waits for a reply (send … and wait, a Command Call sent up the Message Path with and wait, and a call to a Function Value in another Script), and every Join Member. Automatic scope abandonment also takes a call id from that Run’s sequence; Segment hooks use Segment ids and consume no call ids.
  • Segment ids are the Run id followed by .s1, .s2, …, counting actual Segments, including cancellation cleanup, but not preemptions. They identify lifecycle hooks.
  • Save ids are s1, s2, … in the order the Group’s save attempts are made; a refused attempt has an id but no restorable snapshot.
  • Code units are named by their Script or Library, and a Script’s extensions by <script>+<n>, counting the extensions since its last Load or Reload from 1, such as session+3.
  • Code positions are a code unit’s name, : and an instruction index in canonical text, such as orders:17.

A Trace is the record of a Group’s life: every Host Input it received, in the order it acted on them, and what it observably did in response (ADR 0018). Because it holds its inputs, a Trace replays on any Core, given the sources and setup it names. A Host asks for one with the Trace sink of GroupOptions and RestoreOptions, or trace: true on the message layer’s new-group and restore (chapter 9). A Group with no sink writes nothing, and behaves the same.

TraceFile ::= ( TraceLine #xA )*
TraceLine ::= ( '> ' )? Record | '#' [^#xA]* | ''
Record ::= RecordName ( ' ' Id )* ( ' ' Field )*
/* offer-chosen and offer-entered use the ordinary record grammar;
their ordered attempt/name/at/target/args keys are in corpus.toml. */
/* deliver and request carry an optional caller key, a Remote Send's Caller
Identity (ADR 0154), as a Value; its place among the keys is in corpus.toml. */
RecordName ::= [a-z] [a-z-]*
Id ::= [A-Za-z0-9_] [A-Za-z0-9_./:+-]*
Field ::= Key '=' FieldValue
Key ::= [A-Za-z_] [A-Za-z0-9_-]*
FieldValue ::= Value | Id | IdList
/* as the key's type in corpus.toml says */
IdList ::= '[' ( Id ( ', ' Id )* )? ']'
  • One record per line, in UTF-8, each ended by an LF, with no trailing spaces. A value’s display form never breaks a line.
  • A Host Input is written after > , and the Core’s output has no prefix.
  • A record is its name, then its ids in order, each after one space, then its keys in the order corpus.toml lists them, each as key=value after one space. A key that isn’t optional is always written. An optional one is written only when it applies, a list-valued one only when its list isn’t empty, and a value-typed one only when its value isn’t Nothing, so a Run that completes with Nothing has no value, and neither has a bare veto. A map’s entries are always written, so a vetoes entry keeps reason: nothing.
  • Values are written as their key’s type says (below): a value in the display form, an id, or a list of ids.
  • Comments and blank lines: a line that starts with #, and an empty line, are an author’s. The Core writes neither, and comparing ignores them.
  • Only outcomes are recorded, never single instructions.

Metered Operations specify charge-request, charge-result, synchronous charge-refused, and the metering Operation setup key. The catalogue tables below carry them, and SQLite [standard] setup takes perStep. Synchronous replay must preserve accepted prefix charges before refusal. A refusal made while a queued charge-request waits to be written is held and written among the queued inputs in call order, so an overlap refusal follows the request it overlaps. Asynchronous replay processes each request in input order, including inactive outcomes and charge-only Pumps. No synthetic Segment is emitted for admission-time refusal.

A record is written when what it records happens, so a Trace is in the order the Core acted:

  • Lifecycle records follow the scope and participant ordering. A Host-successful opening/closing call is followed immediately by its scope acknowledgement, before result conversion or interruption; a malformed result still gives a scope acknowledgement. Automatic abandonment writes call with automatic=yes, then scope with abandoned or failed; failure writes effect-failure next. Hooks write effect, followed by effect-failure on failure. These precede the affected seg, run, decided or stopped records. Host detail strings are outside parity. On a fault, the existing fault record precedes the resulting cleanup records.
  • Worker calls (load, reload, extend, add-library, replace-library, save, restore and vars) are written when they are made, followed by what they cause, such as diag, stopped or vars records.
  • Queued calls are written when the Pump that drains them has read its Clock, in the order they were made, and just before that Pump’s pump line. So a Delivery an author writes just before a > pump is where the Core writes it too, and a worker call or a refused input written between them moves before it.
  • A queued call never drained, because a worker call discarded it first, as a variables-only restore drops the saved input queue, is written just before that worker call’s line, in the order the calls were made.
  • A Host Input refused at the call, with a Host error or MailboxFull, is written at the call, with none of the ids the Core would assign, and a refused record follows it. It changes nothing. The ids the Host supplies, such as a settle’s call id, are kept.
  • A queued parent change refused at drain keeps its ordinary queued-input placement before > pump. Its refused record appears after > pump, in drain-output order, before any Stretch. The parent remains unchanged; later inputs still drain.
  • Calls made inside a Pump, from a Host function, land when that function returns: a queued call is drained by the next Pump, and a refused one, a Stop, a CancelRun or a RewindRun is written right after the record of that crossing (below).
  • Inside a Pump, the records follow in the order they happened, and the Pump ends with pumped. A Stretch of a Run is written as seg or preempt when it ends, so the call, send, raise, guard-skip and note records it made come before it, and a Run’s run record comes after its last Stretch. A Run’s first Stretch carries the start keys (delivery, broadcast, from, handler, fallback, clause and fn), whether it is a seg or a preempt.
  • A Verdict is written as decided right after the record of what settled it. A seal comes at the end of a Segment, so an allowed or vetoed Decision’s decided follows the sealing seg, and comes before the Run’s run. An undecided Verdict is settled by the Run’s end, so its decided follows the run record, or the stopped record for a Run stopped before its seal. A Decision cancelled in the mailbox is settled as it is drained, after its run record with no id, and a Broadcast Decision with no recipients as it is drained. An allow at successful dispatch to a clause without , deciding, or by a matching wait for, is written at that dispatch, before the Handler body’s records and Stretch. A Broadcast Decision with recipients is settled by its last recipient to settle. An open Decision a variables-only restore discarded or dropped is settled in the first Pump, before any Stretch, in delivery id order.
  • A reissued call, settled with how=reissue, crosses to the Host again as the first Pump drains the settle: a call record under its saved call id, before any Stretch. It has charged only if the Host function draws with Charge, since the declared cost isn’t charged again.
  • Guard regions: an error raised in a guard region, which skips its clause or branch, is written as guard-skip with its code, and not as raise. A Guard that gives something other than a boolean is a guard-skip with that value.
  • An unhandled Delivery is written as its Run’s seg, with end=unhandled, then its run, then the unhandled record.
  • Clause mismatches: a Run that no named clause matched, which ended unhandled or was started by the Fallback Handler, carries mismatches on its run record when it tried at least one named clause (below).
  • Every Host crossing is recorded: each Capability call as call, with an immediate call’s result or error and the Fuel it charged, and each property or collection call as prop. So a Trace carries every answer a Host gave, and replays without that Host (chapter 7).
  • Errors: a Core-raised error map is written without its message, wherever the map appears, whose wording is outside parity. Every other key is kept, in the order chapter 6 gives, and so is the message of an error a Script or a Host made (chapter 6). Text a Script builds from a Core-raised message is outside parity too, and no case may depend on it.

mismatches says why dispatch skipped each named clause of the Run’s Selector, so a reader of the Trace can see why a message wasn’t handled without running anything (ADR 0172). It is a list with one map per named clause dispatch tried, in clause order, each with clause, its 1-based number among the Selector’s clauses, and reason, the first test that failed (chapter 5):

  • "arity": the message has a different number of arguments.
  • "pattern": an argument failed its parameter’s Destructuring pattern.
  • "shape": an argument didn’t fit its Clause Shape. The map adds argument, the 1-based position of the first argument whose Clause Shape failed, left to right, and mismatches, what explain gives for that argument and Shape (chapter 7).
  • "guard": the Guard gave false, or was skipped with a guard-skip. Why is never recorded.

Each reason is what dispatch already found, so nothing runs again to find it. A Core builds the explain report only while it writes a Trace, and charges nothing for it: Fuel, allocation and every outcome are the same with or without a Trace. The Fallback Handler’s own clauses are not listed. A Run whose Selector has no named clause, or a Delivery the Fallback took because it was a message map with no named Handler, has no mismatches.

* marks a key an author may leave out, which bless fills in (below), and ? an optional one. An author may also leave out the ids the Core assigns, such as a Delivery’s.

Record Ids Keys Says
load script identity* loads the Script that case.toml names, with its source, Grants, owner, well-known objects and limits
reload script carry, mailbox?, source, identity* reloads the Script from the source given
extend script source, identity* extends the Script with an Entry
add-library library identity* adds the Library that case.toml names
replace-library library carry, mailbox?, source, identity* replaces the Library with the source given
pump clock, fuel-slice?, fuel-cap? a Pump, with its one Clock reading
deliver delivery to, message, args?, limits?, caller? a Delivery
request delivery to, message, args?, limits?, caller? a Request: a Delivery whose result the Host waits for
broadcast broadcast message, args?, limits?, recipients* a Broadcast
call-value delivery fn, args?, limits? a Host call of a Function Value
decide delivery to, message, args?, limits? a Decision
decide-broadcast broadcast message, args?, limits?, recipients* a Broadcast Decision
cancel-delivery delivery cancels a Request, Decision or Host call, by its delivery id or broadcast id
answer call value, fuel? answers a suspending call
fail call error fails a suspending call
settle call how, value?, error? settles a pending call after a restore
stub operation value?, error?, charge?, charge-refused? queues what the Host function returns at the next call of an Operation, named <capability>.<operation>: an immediate call’s result or error, a suspending call’s error, which fails it as it starts, and any call’s charge; the runner writes it, and the Core never sees it
charge-request call, request (optional) fuel a Metered Operation’s queued charge request; a synchronous refusal has no request id and is followed by refused
cancel-run run pc? cancels a Run
rewind-run run pc? rewinds a Run still in its first Segment: its message goes back to the head of its Script’s mailbox
stop script reason, pc? stops a Script
revoke script grant revokes one of the Script’s Grants
set-parent object, parent sets a Host Object’s parent
dispose object disposes a Host Object
save save saves the Group
restore from*, mismatch?, mailbox?, unbound?, withheld?, fingerprint*, mode*, reloaded?*, pending?*, disposed?, discarded?*, dropped?*, abandoned?* restores a Group from a save
counters script reads the Script’s Counters without draining Host Inputs; writes one counters record
vars inspects the Group, which writes a vars record for each Script in it
stub-effect grant phase, status queues a synchronous lifecycle hook result for the participant whose first enrolled Grant is