Expand description
A stored record’s amx is believed only if srv signed it
(docs/specs/SPEC_MESSAGE_ORIGIN_AND_ONE_CONTAINER_2026_10_25.md §6.1).
“Only srv writes amx” holds for the protocol. The record also has to hold
up when it is read back from storage, where anything able to append a line
could write "amx":{"origin":{"kind":"user"}}. So:
- srv signs the record it writes (
sign_line): an HMAC-SHA256 over the record’s owner, itsts_ms, the message content, and the wholeamxobject, with a key an agent can’t read ([key]). - everything srv hands to a viewer first goes through
vet_line, which removes the record’s wholeamxobject and puts back only what the MAC covers, markedverified. A missing, wrong or copied-onto-other-content MAC leaves the record with noamxat all: untyped, so a viewer shows it in the container and never as the human.
The MAC binds the record’s owner, not the zone it sits in: the agent
(agent:<id>:current, …:archive:<ms>) or, for a record with no agent,
the block. Archive, restore and clear keep a line’s bytes and still verify;
a copy to another owner (a fork) does not, so a fork shows its parent’s
lines untyped.
Structs§
- Fork
Cover - What a fork’s mark says about the history copied into the fork: it came from
parent, an agent that ran inruntime, and the firstuptobytes of the fork’s transcript are that copy.
Enums§
- Writer
Runtime - Which runtime wrote the lines of an agent’s output.
Constants§
- SIG_LEN
- The length of a signature as written: SHA-256 as hex.
Functions§
- echoed_
prompt - The text of the user line
lineof a provider’s own output, when it is the provider echoing the prompt (see [content_of]);Nonefor anything else, a user record srv wrote included. - fork_
cover - What the mark
mark(fork.json) of the forkforksays about its copied history, when its signature holds;Nonefor a mark that has none, or whose facts were changed or are another fork’s. - owner_
for_ block - The owner of the records
block_idwrites: its agent, when it has one, else the block itself. The same rule the writer uses (persist_user_line_asis given the agent zoneresolve_global_output_zonefinds from the block). - owner_
for_ read - The owner of the records read from
read_zoneforblock_id: a global or archive zone names its agent; the block’s own copy is the block’s. - owner_
of_ zone - The owner a record is signed for, from the zone it is written to: the agent
id of an
agent:<id>:…zone, else the zone itself (a block id). - resign_
line - A line signed for
from_owner, to be signed forto_ownerinstead (a fork’s copy of its parent’s transcript): where its signature is, and the one for the new owner, bothSIG_LENbytes of hex, so the line keeps its length and everything after it keeps its offset.Nonefor a line that does not verify forfrom_owner, or has no signature to swap: a record nobody signed is never signed here, so a forged line cannot be made good by a fork. - sign_
fork_ mark - The signature over a fork mark’s facts, for the fork
fork(agent ids): which parent, which runtime, how many bytes. - sign_
line linewithts_msandsigadded to itsamx, forowner. A line with noamxobject (or that isn’t a JSON object) is returned as it is.- stamp_
writer line, an output line an agent’s process wrote, as srv stores it: the agent’s own bytes, withamx.writersaying which runtime wrote it, and which agent, signed forowner, added as the last member. The agent’s bytes and key order are kept (readers look for"type":"stream_event"and"subtype":"init"near the start of a line). Whateveramxthe line already carries is the agent’s own words and is dropped first, never kept or merged; such a line (rare) is written again from its parsed record, so its key order and number spelling are not kept.Nonefor a line that isn’t a JSON object, and for a streaming delta (never a message, and kept compact), which are stored as they are.- vet_
line - What a viewer may be shown for stored
lineofowner: the line with itsamxreplaced by the verified parts of it (origin,notes,via,device,message_id,v, plusverified: true), or with noamxat all when it doesn’t verify. A line that can’t carry one is returned as it is. A line that may carry one but can’t be read here (a viewer’s parser takes input serde_json refuses: nesting past its limit, a lone surrogate escape) is blanked, never passed on with itsamx. - vet_
lines vet_lineover a list of lines, each changed in place only when it carries anamx.