Appearance
0068. adam signs its own history ​
Status: Accepted (2026-11-22). The owner decided on 2026-11-22 that adam uses, by default and for security, the same kind of signature the model providers use for their reasoning continuity. Slice T1 (the port, its Ed25519 implementation and the form) is built: see Amended 2026-11-25 (slice T1). Nothing signs or verifies a run yet; the other slices are at the end. Every model request is signed when the deployment gives a turn key: see Amended 2026-11-25 (the request signature).
Amended 2026-11-26: slice T3a-1 signs each assistant and tool turn at commit (see Amended 2026-11-26 (slice T3a-1) below), and slice T3a-2 signs the run's head at commit and checks it on decode (see Amended 2026-11-26 (slice T3a-2)); slice T3a-3 verifies each turn on re-entry and signs a carried history again (see Amended 2026-11-27 (slice T3a-3) at the end); the journal's signature is not built.
It has two parts. Part 1 is not decided here: adam carries every opaque member a provider attaches (Gemini 3's thought_signature in a tool call's extra_content) byte for byte, sends it back only to the model that made it, and drops it when a run changes model; that is adam-rs#322, built separately. Part 2 is this ADR: adam signs the turns it produces and verifies every history that comes back. It builds on #322's carrier.
Context ​
What the providers do (each verified 2026-11-22 on the page named):
| Provider | What it attaches | Source |
|---|---|---|
| Gemini | A thought signature, "an encrypted representation of the model's internal reasoning state"; in generateContent it "can be attached to any part, such as living inside functionCall parts", and a stateless caller "MUST always resend all thought blocks exactly as they were received". On the OpenAI-compatible API it is tool_calls[i].extra_content.google.thought_signature, sent back on the assistant message | https://aistudio.google.com/docs/thinking; the JSON examples of https://docs.cloud.google.com/vertex-ai/generative-ai/docs/migrate/openai/examples (the Gemini API's own https://aistudio.google.com/docs/openai says only that Gemini 3 supports thought signatures there) |
| Anthropic | A signature on every thinking block: "Full thinking content is encrypted and returned in the signature field … The API uses the signature to verify that thinking blocks were generated by Claude when you pass them back"; it is opaque; with tools the blocks go back "complete and unmodified", and a modified block is a 400; a redacted_thinking block carries an opaque, encrypted data | https://platform.claude.com/docs/en/build-with-claude/thinking, Thinking encryption and Preserving thinking blocks |
| OpenAI | Reasoning items carry encrypted_content (by default, per the page; include: ["reasoning.encrypted_content"] is still accepted); the stateless mode is store: false or Zero Data Retention; with function calls the caller passes back "the reasoning items returned with the function calls along with the tool outputs" | https://developers.openai.com/api/docs/guides/reasoning |
Unverified against those pages: the 400 Gemini 3 answers when the signature is missing. adam's bench saw it on every second call (#322); the docs pages read do not state it. Also unverified: how each provider makes its value (a MAC, an encryption, both). The pages say only that it is opaque.
The shape is the same everywhere: an opaque string in a member that names its maker, next to the content it belongs to, sent back unchanged, and checked only by whoever made it. It stops a caller from making the model believe it reasoned what it did not.
adam has no such check on its own history. A run's history leaves process memory and comes back at these points, and each time adam takes it as its own:
| Re-entry | Where today |
|---|---|
| A resume: a restart, another worker, a lease that ran out | the head and its body rows joined (crates/adam-runtime/src/runtime.rs, join_stored, join_head; ADR 0055); a state written whole (crates/adam-runtime/src/envelope.rs, Envelope::decode) |
| A journal replay: a step's recorded result instead of a second call | Ctx reading journal_get (crates/adam-runtime/src/ctx.rs), JournalEntry (crates/adam-core/src/store/mod.rs) |
| A new task that continues a conversation | init_continuing (crates/adam-runtime/src/runtime.rs, new_run_within), Conversation::continued (crates/adam-llm-agent/src/conversation.rs) |
| A child session's round | Runtime::start_child_continuing (crates/adam-runtime/src/runtime.rs; ADR 0045) |
| The embedded engine reopening its file | SqliteStore::open (crates/adam-store-sqlite/src/lib.rs), Engine::start (crates/adam-engine/src/engine.rs) |
| The store service (ADR 0053) | the same rows, over RPC |
| A fork, or a history a client sends | text only: an A2A message becomes one user message (crates/adam-a2a-runtime/src/convert.rs, default_inbound; crates/adam-a2a-runtime/src/vymalo.rs); another-agentic-system's fork puts the earlier conversation in front of the text (its orchestrator/crates/agent-a2a/src/client.rs:755 at e95eafcd, read 2026-11-22) |
So whoever can write a row (a compromised store, a person with the SQLite file of an engine, a broken migration) can put words in the agent's mouth: an earlier assistant turn that "agreed" to something, or a tool result that "showed" it. The next model call takes that history as true.
Decision ​
adam signs every turn it produces and commits: each assistant message, and each tool result it records. A person's message is not signed (it is not adam's), but the chain (decision 3) covers it.
The signature rides in #322's carrier, in the providers' shape. #322 keeps a provider's members as the JSON object the provider sent,
extra_content, namespaced by its maker ({"google": {"thought_signature": "…"}}). This ADR adds one maker and one member:extra_content.adam.turn_signature, an opaque string, onMessage::Assistant(message level, beside #322's) and onMessage::Tool(which gains the same carrier). If #322 names its Rust field differently, the JSON names here stand. Where it rides:Where How The store inside the body row's message(BodyRow,crates/adam-core/src/store/mod.rs), as the state holds it; no column changes for rowsThe run's head the envelope the runtime commits ( crates/adam-runtime/src/envelope.rs) gainssignature, the same form withtypadam-head/v1(decision 4); the state is JSON, so no column changesThe journal JournalEntrygainssignature: Option<String>, the same form withtypadam-step/v1overrun,seq,name,okandpayload; each adapter stores it (Postgres and SQLite a column, MongoDB a field) and the testkit requires the round tripA model call never sent: #322 sends a member back only to the model that made it, and adam is no model; the wire drops the adamnamespace, and anadammember in a model's reply is dropped before the turn is recordedA2A planned (slice T4): https://agents.vymalo.com/a2a/extensions/signed-turns/v1, listed on the card only when the deployment turns it on (it hands tool results to the client, which a task's message does not carry today). When a client activates it, the task's agent message carries inmetadata[<uri>]the rows the task committed, each with its signature, withrun,cnv, the first row'sidxand itsprv(decision 3); a client may send such rows back to continue from them (a fork, decision 6). Without the extension nothing changesWhat is signed, and to what it is bound. The value is a JWS (RFC 7515) in compact form with a detached payload (RFC 7515 appendix F):
BASE64URL(header)..BASE64URL(signature), the construction adam already uses for its card (ADR 0030,crates/adam-a2a/src/signing.rs).- The header is
{"alg":"EdDSA","kid":"<key id>","typ":"adam-turn/v1"}. - The payload, never sent, is the RFC 8785 canonical JSON of
{typ, run, cnv, idx, prv, msg}:runis the run that commits the turn,cnvthe base64url SHA-256 of the run's conversation id (the run's own id when it has none),idxthe turn's position in the transcript,prvthe chain hash of every message before it, andmsgthe message as stored (after ADR 0051's replacement), without itsextra_content.adammember. A provider's members are part ofmsg, so they are protected too. - The chain:
h(-1) = SHA-256(JCS({typ, run, cnv})),h(i) = SHA-256(h(i-1) ‖ SHA-256(JCS(message i)))(two 32-byte values, so no separator is needed), over every message, a person's included, with each one'sadammember. So a change to any earlier message, a reordering or a row spliced in from another run or position breaks every later signature.
- The header is
When adam verifies: whenever history comes from outside its own process memory, at each re-entry of the table above, once per decode and before the first model call in that process; a state that stays in memory between steps is not checked again. The decoded state carries no mark of having been checked (a field the decoder never fills).
- The head. At every commit the runtime (
crates/adam-runtime/src/worker.rs) also signs the head: the payload is the canonical JSON of{typ: "adam-head/v1", run, cnv, len, chain, head}, wherelenis the number of body rows,chainish(len-1)andheadis the envelope without its signature (for a run whose state is not split, the whole state, andchainis over its messages). On a decode the runtime (join_stored,Envelope::decode) recomputes the chain over the rows and checks this one signature. It covers every field of the state, not only the messages (the loaded tool groups, the owed calls, the summary, the session), and the transcript's length: rows pastlenare already not part of the state (ADR 0055), and a row appended with a newlenbreaks the signature.runis the id the run was loaded by andcnvthe hash of the record'sconversation_id, so a run moved to another conversation in the store is refused too. - The turns. Every assistant and tool row must also carry a turn signature whose header parses and names a key in the key set, so a revoked key is refused wherever it signed. A carried history (decision 5) and a
signed-turns/v1message (decision 6) are checked by the agent loop: the chain, and the newest turn's signature against the payload rebuilt at its position. adam signs a turn only over a prefix it holds verified in memory, so that one signature vouches for every byte before it; rows after it must be a person's messages. - The journal. Entries are not chained: each entry the runtime replays (
crates/adam-runtime/src/ctx.rs) is checked on its own.
So a load costs one signature check, plus one per replayed journal entry, and a SHA-256 pass over the transcript.
- The head. At every commit the runtime (
adam re-signs only its own acts. A message adam changes is a message it produces: a compaction (a new body generation), a shortening of an old output, a carried history,
answer_owed_calls. The changed message and every assistant and tool message after it are signed again. A history carried into a new run (a new task of the conversation, a session's round, a fork throughsigned-turns/v1) is verified under the run it came from, then signed under the new run, so every signature of a run names that run.What is refused, and its class (Rule 6):
Where What happens Class A stored row, a journal entry or a carried history that is unsigned where it must be signed, forged, out of place, or signed by a key not in the set (revoked, or a set that lost it) the run fails with a turn signatureerror before any model call; no turn is addedCorrupt(alert)A signed-turns/v1message that does not verify, or whose rows are not the caller's: theircnvmust be the hash of the conversation of the caller's subject and the source context the message names (encode_conversation,crates/adam-a2a-runtime/src/convert.rs), so rows of another person's conversation are refused even when adam signed themrefused with -32602(InvalidParams), nothing writtenInvalidPlain A2A: a message whose text or data looks like a history today's rule: it is the text of one new user turn, never an assistant turn ( default_inbound,vymalo_inbound)none: accepted as a person's words The key comes from the vault, through a port asked like the model's credentials. A port
TurnKeys(planned, inadam-corebesideSecretSource,crates/adam-core/src/secrets.rs) signs a payload (sign(payload) -> signature, with itskid) and gives the key set of public keys; it never hands out the private key, so a host may sign in a keychain, a KMS or an HSM. It follows the pattern ofModelCredentials(ADR 0058,crates/adam-model/src/credentials.rs): the host provides, adam asks, and no value is ever logged, journaled or put in an error. Thekidis the key's vault reference in the form another repository's ADR 0083 fixed in its amendment of 2026-11-21,vault:<name>#v<n>, which that decision says is not a secret (verified 2026-11-22: another-agentic-systemdocs/decisions/0083-trusted-components-the-agent-names-and-the-client-draws.mdate95eafcd, Amended 2026-11-21, items 1 and 2). For a server (planned, slice T2):Variable What Default TURN_SIGNING_KEY_FILEa PKCS#8 PEM Ed25519 private key, mounted from the Secret the reference resolves to required TURN_SIGNING_KEY_IDthe kid: the reference,vault:<name>#v<n>the key's RFC 7638 thumbprint TURN_VERIFY_KEYS_FILEa JWKS of the public keys of earlier versions (not secret: a ConfigMap), each kidits reference, with arevokedlist of the references no longer acceptedthe signing key's own public key only The turn key is not the card's key: another purpose, another rotation. A
TURN_SIGNING_KEY_IDofvault:<name>#v<n>withnabove 1 is exit 78 unless the verify set names every earlier version1ton-1, as a key or as revoked: a rotation that forgot the set would otherwise refuse every history signed before it.Rotation and revocation. A rotation makes version
n+1and keeps versionnfor 24 hours (the same ADR 0083 amendment). During that overlap a worker that has not restarted still signs withn, so the key set holds both public keys and a verifier accepts either. After it the private keynis gone and its public key stays in the set: the turns it signed stay valid, and nobody can sign a new one with it. Revoking a key that leaked is removing its public key from the set and naming it underrevoked: every turn it signed is then refused, which is the point. Keys and the set are read at start, so a revocation is a rollout of every role, with a new signing key: a worker that has not restarted would go on signing with the revoked key, and the others would refuse its turns.Fail closed, by deployment kind (Rule 4). No kind runs with the feature off, and there is no switch to turn it off.
Kind No key A server: adam-coder,adam-agent, every role (DATABASE_URLalways names a store that outlives the process)exit 78, naming the variable The engine on a store that outlives the process (a SQLite file) Engine::startfails (Invalid); the host gives aTurnKeysbacked by the platform keychain through the builder (plannedEngineBuilder::turn_keys): it signs there, and keeps the key set there too, because a person who can write the file can write a key set beside it; adam never reads the keychain itselfThe engine or a test on a MemoryStoreTurnKeys::ephemeral(), a key made at start that dies with the process, as the history doesEd25519, not an HMAC.
HMAC-SHA256 Ed25519 Who can verify only a holder of the key, who can also forge anyone with the public key, who cannot sign: the orchestrator, an auditor, a client of signed-turns/v1After a rotation the old key goes after 24 h, so every turn it signed becomes unverifiable: every idle conversation would have to be re-signed within the day, or be refused the public key stays; nothing is re-signed Revocation removing the key also breaks honest turns, with no way to tell them apart the same, and only for a key that leaked Cost per turn about 1 µs, a 32-byte tag tens of µs, a 64-byte signature (OpenSSL on the machine this was written on: 39 µs to sign, 113 µs to verify; aws-lc-rs unverified, slice T1 measures it) Dependency aws-lc-rs'shmacaws-lc-rs'sED25519, already used to sign the cardThe rotation row decides: with a key the vault keeps 24 hours, only a public key can keep a history older than a day verifiable. Verifying outside adam comes with it. The cost does not matter at this grain: two signatures per commit (the turn and the head), one check per load plus one per replayed journal entry (decision 4), beside a model call of seconds.
aws-lc-rsis already in every build that has a model client: the workspace'srustlsnames itsaws_lc_rsfeature (Cargo.toml), andadam-a2aandadam-workspacedepend on it (verified 2026-11-22:aws-lc-rs1.18.1 inCargo.lock, a dependency ofrustls0.23.46); RFC 8785 canonicalization isadam-a2a'scanonicalize(behind itsserverfeature, withryu-js) and moves toadam-coreso the engine has it. No package is added toCargo.lock.Turns from before the feature: adopt for one release, then refuse. As ADR 0055 did, in two releases. In release N (slice T3) a run with no signature at all is adopted: verified as far as it can be (nothing), signed as it stands at its next commit, and counted (
adam_turns_adopted_total, planned); a run with any signature, on its head or a turn, is checked in full. A journal entry with no signature is replayed in N and refused in N+1, as a row is. In release N+1 (slice T5) an unsigned assistant or tool row is refused like a forged one. During N a store attacker can still downgrade a run by stripping all its signatures: that is today's exposure, and N+1 ends it. Nothing in the store can mark the cutoff, because the store is what is not trusted; the release does.
What it protects, and what it does not ​
It protects against an earlier agent turn or tool result that adam did not produce: inserted by a client, written by a compromised store or by whoever holds an engine's file, or replayed from another run, conversation or position. So the agent cannot be made to believe it already agreed to something, ran something or saw something.
It does not protect:
- The content of a tool's output. adam signs what the tool returned, faithfully. A web page that tells the model to do something is still a prompt injection, and needs its own defences.
- Secrets. A signature hides nothing: the turns are as readable as before, and a secret in a turn is still there.
- A rollback of a run to an earlier state that adam really signed, head and rows together: the store is adam's only memory of how far a run got, so a store restored from an older backup is accepted. (A user turn appended in the store is refused: it changes the signed
len.) - A person's own words. A user turn is chained, not signed: a client that sends a new message can say anything, as today; it cannot change what came before adam's last turn.
- A stolen key. It forges until it is revoked (decision 8).
Diagrams ​
Sign at commit, verify on re-entry. TurnKeys and every call marked planned are not built.
A turn's life:
Alternatives ​
- An HMAC. Decision 10: cheaper, but a verifier can forge, and a 24-hour key cannot keep older history verifiable.
- Sign in the runtime, not in the agent loop. The runtime knows the run and each body row's position, and is the same for every agent; but the signature must live in the message (decision 2), which the runtime does not know, and the agent's re-signing acts (compaction, carrying) are the agent's. So the runtime signs what is its own, the head and the journal entries, and the agent signs the turns.
- A signature per message, each verified. Simpler to explain, but a load of a long run would make one Ed25519 check per turn (a thousand turns, about 0.1 s), and splicing would still need a chain. The chain needs one.
- Encrypt the history, as OpenAI and Anthropic do with their reasoning. Confidentiality is not what is asked, and a person, the orchestrator and the web read these turns.
- Trust the store. Today's rule. It makes the store's integrity the agent's, on a phone too.
- A switch to turn it off. The owner asked for it by default; a switch would be on every dev stack and copied into deployments. Tests use
TurnKeys::ephemeral().
Consequences ​
- Every deployment needs a key before it upgrades to slice T2, or it exits 78. The chart gains the key from its ExternalSecret and the verify set as a ConfigMap; the platform's operator must mount both (a parity row says so).
- About 220 bytes per signed message in the store (the member with a 19-character
kid), about as much per journal entry and per head, and the same on A2A whensigned-turns/v1is active. A load hashes the transcript (SHA-256, about 1.5 GB/s with OpenSSL here) and makes one signature check, plus one per replayed journal entry. - Plain A2A is unchanged: a client that sends history without signatures sends a person's words.
JournalEntrygains a field: no trait method changes, but an adapter outside this repository that builds aJournalEntryby its fields, or does not store the new one, breaks (Rule 2): the crate README andadam-upgradesay so.Message::Toolgains the carrier; older binaries ignore the member (serdedefaults), so a rollback within release N keeps working, and the rolled-back binary does not verify.- Unverified: that every store returns a message whose RFC 8785 form is the one adam signed (MongoDB's numbers in particular). Slice T1's testkit case writes and reads back floats, large integers and non-ASCII keys in each adapter.
Slices ​
After ADR 0067's S8b and S8c.
| Slice | What | Tests |
|---|---|---|
| T1 | TurnKeys and its testkit in adam-core, TurnKeys::ephemeral; the Ed25519 implementation and the key set from a JWKS; the turn_signature form, its payload and the chain; canonicalize moved to adam-core | a golden vector (Ed25519 is deterministic: a fixed key and message give a fixed string); each payload field changed fails; a kid outside the set fails; both versions of an overlap pass; a public-only key verifies and cannot sign; a revoked key fails; no Debug or error holds a key; the size bound; the round trip of numbers and keys in each store adapter; a measurement of sign and verify |
| T2 | the server variables and exit 78, every role; the chart's key from the ExternalSecret and the verify set; EngineBuilder::turn_keys, and Engine::start refusing a file store without keys | the configuration table; exit 78 for a missing, unreadable or non-Ed25519 key; the chart's goldens; the engine's refusal and ephemeral on a MemoryStore |
| T3 | sign turns at commit in the agent loop and the head in the worker; verify on re-entry; the journal's signature in each adapter; re-signing after a compaction, a shortening and a carry; release N's adoption | each re-entry of the Context table (a resume after a kill, a new task, a session round, the engine reopening its file, a journal replay, the store service) with a forged assistant row, a forged tool row, a changed user row, an appended user row, a row spliced from another run, a reordering, a changed head field and a run moved to another conversation: the run fails Corrupt and the mock model got no call; a forged journal entry is refused on replay; a compaction re-signs; a legacy run is adopted once; #322's members inside the signed bytes; the testkit's journal round trip |
| T3a-1 | sign each assistant and tool turn at commit in LlmAgent (built, 2026-11-26): the row as stored, the chain, signatures cleared after a compaction or a shortening | the golden vector (tests/vectors/turn_chain_vector.py); a NUL verifies after the store; a compaction re-signs; failing keys commit no unsigned turn |
| T3a-2 | sign the run's head at every commit and check it on every decode in adam-runtime (built, 2026-11-26): RuntimeBuilder::turn_keys, head_payload, Head.signature and seal | a changed head field, a row appended past len and a run moved to another run and conversation are each Corrupt before any step; a v4 state is covered the same way; a store that keeps bodies and one that does not both round-trip; no keys changes nothing; adoption and its refusal over a signed turn |
| T3a-3 | verify the turns on re-entry and sign a carried history again (built, 2026-11-27): Sealer::check_turns in the one function every row read calls; the carry strips the old signatures so the new run signs them | a forged assistant row, a forged tool row, a changed user row and a row spliced from another run each refused Corrupt with no model call at a resume, a new task and a session round; the unit cases where the head verifies and the turn does not; a carry verifies under the new run; a legacy run adopted once; a revoked key |
| T4 | signed-turns/v1, behind a deployment setting: the card lists it and its JWKS the turn keys; the rows on the task's message; a message that continues from signed rows | a client that kept the earlier rows verifies a task's rows with the card's key set, and one that did not checks them against the given prv; a fork from them is verified and re-signed under the new run; a forged or reordered row, and rows of another subject's conversation, are -32602 with nothing written; off by default, the card does not list it; plain A2A, a data part shaped like signed rows without the extension, is one user turn |
| T5 | release N+1: no adoption | an unsigned assistant or tool row is refused Corrupt, with an error that names this ADR's migration |
Not decided here ​
- #322 (part 1): how a provider's members are kept and to which model they go back.
- What the orchestrator does with
signed-turns/v1: storing the rows in its log, sending them back on a fork, and checking them. That is another-agentic-system's decision. - Signing a person's messages on their way in (by the orchestrator, for the person): another key and another trust.
Amended 2026-11-25 (slice T1) ​
Slice T1 is built in adam-core: crates/adam-core/src/turn/ (the port TurnKeys, Ed25519TurnKeys, KeySet, the form, the payload and the chain, turn::testkit), crates/adam-core/src/jcs.rs (canonicalize, moved from adam-a2a, which re-exports it), and two cases of adam-store-testkit. Nothing signs or verifies a run, and no variable is read (T2, T3). What building it changed or settled:
- Ed25519 is
ed25519-dalek3.0.0, notaws-lc-rs(decision 10). The engine's tree may hold neitheraws-lc-rsnorring(tools/embedded-deps/check.sh, ADR 0047), and decision 9 has the engine sign (ephemeral) and verify, so the implementation inadam-coreis pure Rust. Six packages are added toCargo.lock(ed25519-dalek,ed25519,signature,curve25519-dalek,curve25519-dalek-derive,fiat-crypto), against "no package is added": BSD-3-Clause, Apache-2.0 OR MIT and MIT OR Apache-2.0 OR BSD-1-Clause, all indeny.toml's list. Verification is strict (RFC 8032, a non-canonical signature refused) and a weak public key is refused. A test inadam-a2aholds that it gives the bytesaws-lc-rsgives for the same key. Measured (crates/adam-core/examples/turn_signature_timing.rs, release build, one core of a 2.1 GHz Xeon, 2026-11-25): a signature 20 µs and a verification 49 µs over 64 bytes; a 2 KB turn signed with its RFC 8785 form 45 µs, verified 67 µs; the chain over 1,000 such turns 7.3 ms. - The port answers a key id or a certificate chain, and whether it is renewing (the owner, 2026-11-25: the cloud's turn key will come from a PKI certificate).
current()gives aCurrentKey: aKeyIdentity,Id(kid)orCertificate(chain)(leaf first, named by its leaf'sx5t#S256unless the adapter names it), and aKeyStatus,ActiveorRenewing(both closed);sign(kid, input)signs with the key that id names, or answersNotSigning(classConflict: ask again);key_set(). A chain rides in the header asx5c(RFC 7515 §4.1.6, at most four certificates of 2 KiB), so the header of decision 3 isalg,kid,typand, for a chain,x5c. T1 verifies bykidagainst the key set and carries the chain without trusting it: trusting a PKI is the certificate adapter's work. - The chain's first link is
h(-1) = SHA-256(JCS({typ: "adam-chain/v1", run, cnv})): decision 3 named the members, not thetyp; atypof its own keeps it apart from a turn's payload.runis the run's UUID as text,cnvandprvare base64url without padding,idxis the body row'su32. - Where the member is.
extra_content.adamis a member of the message object itself, not of #322'sprovider.members(a model switch drops those).msgis the message withoutextra_content.adam, and withoutextra_contentwhen that was its only member, so adding the signature never changes what it signs. - One encoding.
verify_detachedaccepts only the header adam writes: its RFC 8785 bytes, those members,EdDSA, the expectedtyp, 64 bytes of signature, and at mostMAX_SIGNATURE_LEN(16 KiB) in all, refused before it is decoded. A key id is 1 to 256 bytes of printable ASCII. With a 19-characterkidthe member is 222 bytes ({"extra_content":{"adam":{"turn_signature":…}}}), as the Consequences estimated. TurnKeys::ephemeral()is<dyn TurnKeys>::ephemeral()(andEd25519TurnKeys::ephemeral()), and returns aResult: a system with no random numbers is an error (Internal), not a panic.- The store round trip (Consequences, unverified until now):
a_message_canonicalizes_as_it_was_writtenandbody_a_row_canonicalizes_as_it_was_writtenwrite floats, integers either side of 2^53,i64's extremes,-0and names that sort differently by UTF-16 into a state, a commit, a journal payload and a body row. Verified 2026-11-25 onMemoryStore, SQLite and PostgreSQL 16.15; MongoDB is unverified (no server where this was built; CI runs it). Au64abovei64::MAXis not in it: MongoDB refuses it at the write, as before.
Amended 2026-11-25 (the request signature) ​
The shared prompt-signature contract (its decisions 9 to 11, and its vector V7) asks adam for a second use of the turn key: a signature of each model request adam sends, so a verifier in front of the model can bind the request's run, body and prompt to adam. Decision 2 still holds for the history: a model call never carries a turn's signature. The request signature is another type, built with the same port and header writer. Built in adam-core (crates/adam-core/src/turn/request.rs, form.rs) and adam-model (crates/adam-model/src/signed.rs).
A new signature type.
SignatureType::Request,typadam-request/v1. The enum stays closed: everymatchon it names the new variant, and a history signature never verifies as a request one (thetypdiffers).The form is attached:
BASE64URL(header).BASE64URL(payload).BASE64URL(signature)(sign_attached,verify_attached), because the verifier cannot rebuildiatandnoncefrom the request. The header is the one decision 3 and T1 write: the RFC 8785 form of{"alg":"EdDSA","kid":…,"typ":"adam-request/v1"}, plusx5cwhenTurnKeys::currentnames the key by a certificate chain. The signing input is the detached form's, byte for byte. The bound staysMAX_SIGNATURE_LEN(16 KiB).The payload is the RFC 8785 form of exactly eight members (
request_payload):Member Value typadam-request/v1runthe root run, the value of X-Run-Idbeside itmethodthe HTTP method, upper case paththe request target as sent: path and query ( adam_model::request_target;adam-model-openaikeeps its URL in the form its parser writes, so the target signed is the target sent)body_sha256base64url SHA-256 of the body's exact bytes ( CredentialRequest::body)prompt_jtithe prompt statement's jti(a member of its attached payload), or, with no statement, the person's envelope'snonce(its protected header);nullwhen the run has neither (item 5)iatseconds since the epoch, when adam signs nonce16 random bytes, base64url Each call and each attempt is signed anew: the retry after a
401, and every retry of the loop, get a newiatandnonce.Where.
adam_model::SignedRequestswraps anyModelCredentials(the injector on the cloud, the host's credentials on a device) and adds, on every call:X-Run-Id(on the device path too, as the contract asks), the run'sPrompt-StatementandPrompt-User-Signaturewhen it has them, andTurn-Signature. The client asks it for every call, so the root's calls, a local subagent's and a session round's are all signed (the testcrates/adam-a2a-runtime/tests/prompt_statement.rs).CredentialRequestgained a public field,body; code that builds one with a struct literal adds it (no trait changed). A server readsTURN_SIGNING_KEY_FILE,TURN_SIGNING_KEY_IDandTURN_VERIFY_KEYS_FILEwith the model's configuration (environment); an embedding host wraps the credentials of its own client with its keys, and gives the person's envelope withSay::with_prompt_statement.No prompt (the contract is silent). A run with neither a statement nor an envelope is still signed, with
prompt_jtinull: every call carries a signature, and it still binds the run, the method, the path and the body. The contract's verifier refuses such a call before it reads the turn signature (no prompt header:missing), so nothing is weakened; a deployment that checks only the request signature can use it.No key, and a key that cannot sign (fail closed). With no
TURN_SIGNING_KEY_FILE, no call is signed, as before (slice T2 makes the key required, with exit 78); a contract verifier then refuses each call (missing). Once a key is given, a call adam cannot sign is never sent unsigned: no run, a URL with no target, or a statement whosejti(an envelope whosenonce) cannot be read isInvalidRequest; keys that cannot be reached are a transient error, retried as a model outage is; keys that refuse areAuth. A key renewed betweencurrentandsign(NotSigning) is asked for once more. A key file that cannot be read, or is not an Ed25519 private key, is exit 78.The carrier. The key is named as the adapter names it:
KeyIdentity::Idgives a header withkidonly (the device, and today's file key),KeyIdentity::Certificateaddsx5c(the leaf first). The contract wantsx5con every cloud call; the certificate adapter of the cloud's PKI is a later change, so until then a cloud call signed with the file key carrieskidonly, which the contract's verifier refuses (mismatch). Thex5cpath is built and tested withturn::testkit::Certified.Verified against the contract's vector V7 (copied, test material only, into
crates/adam-core/tests/fixtures/request-signature/): adam's signer gives V7a (byx5c) and V7b (bykid) byte for byte, both verify withverify_request, and a changed body, method, path,prompt_jtior run, a changed byte of the signature, and aniatoutside 300 s before or 60 s after the clock fail (crates/adam-core/tests/request_signature.rs).verify_requestchecks in the contract's order (the form, the key and signature, then each member, then the window); a replay store and trusting a chain are the verifier's, not adam's.Never logged. The headers are secret values (
SecretString, a sensitiveHeaderValue); theDebugofCredentialRequestand ofModelCallshows the body's length, never the body;SignedRequests' shows the keys' kind. The end-to-end test reads every log line of a run and finds no signature.
Amended 2026-11-26 (the carrier) ​
Message::Assistant and Message::Tool carry extra_content: Option<BTreeMap<String, Value>>, a member of the message object itself, one entry per maker (crates/adam-model/src/types.rs). Nothing writes extra_content.adam yet. The OpenAI wire never sends Message::extra_content at all (crates/adam-model-openai/src/wire.rs): the carrier is adam's namespace only. Another maker's member (google, ...) belongs to the bound provider.members of #322, which goes back only to the model that produced it, and nowhere else; a maker set in the carrier would have crossed a model switch, the leak #324 closed. A model's reply drops the adam maker from the provider's members, streamed or not, and leaves everything else as sent (an empty extra_content object stays one).
Amended 2026-11-26 (slice T3a-1: signing at commit) ​
An LlmAgent given LlmAgentBuilder::turn_keys signs what each step commits (crates/adam-llm-agent/src/signing.rs). What building it settled:
- One seam, not ten. The loop pushes messages at about ten sites.
Agent::stepis now a wrapper: the old body isstep_unsigned, andsign_transitiontakes the state of whateverTransitionit returns (Continue,Park,DoneorFail) and signs there, so a new push site is covered with no change. - Which messages. Every assistant and tool message without a turn signature, in order, at its transcript index, with
prvthe chain over the messages before it as stored. The chain is folded once per commit, a person's message included and unsigned, each link taken over the message with its signature. Messages after the last unsigned one are not read, and a commit with no new turn does no work. A message that already has a signature is left as it is. - No keys, no change. Without
turn_keysthe transcript is byte for byte what it was. The host sets the keys (the engine's and the service's wiring ofTURN_SIGNING_KEY_FILEto the agent is T2); no variable is read. - A signing failure is the step's failure (a
TurnKeyErrorkeeps its class: the runtime retries or fails the run as for any step error): a turn is never committed unsigned by a configured agent. - Still not done: verifying on re-entry (T3a-3), the head's signature and the journal's, and re-signing after a carry (the rows a continued run copies keep their old signatures; a compaction and a shortening are decided in 6). A run that predates the keys is signed from its first unsigned turn at its next commit, which is the adoption of decision 11 in effect; its count (
adam_turns_adopted_total) is not built. - Amended after review (2026-11-26). The row is signed as stored: a NUL is replaced (ADR 0051, by the store's own
storable) before the row is hashed, so decision 3'smsgis what a read returns. A compaction and a shortening clear the turn signature of every row from the first one whose position or preceding bytes changed (unsign_from), and the next commit signs them again. A row that cannot be written, or sits pastu32::MAX, fails the stepInternal; nothing is signed asnullor clamped.
Amended 2026-11-26 (slice T3a-2: the head) ​
RuntimeBuilder::turn_keys makes adam-runtime sign the head at every commit and check it on every decode (crates/adam-runtime/src/seal.rs; adam_core::turn::head_payload). What building it settled:
- What
headis. The stored state document withoutsignature,sealandbody.generation. The generation is the store's: the runtime leaves itnulland the store patches it after the runtime has signed, and it names where the rows are, not what the state is (the rows are covered bylenandchain). Everything else is signed: the inbox,rev, the artifacts, the error, the agent's head. - Which documents. A v5 head (
lenandchainover the body rows it names) and the v4 state of a run that is not split or whose store keeps no bodies (the whole state signed;chainover the agent's ownsplitrows,lentheir count, none when the agent does not split). - A new head member,
seal{len, chain}. Writers that leave the transcript alone (a delivery, a cancel, a step that does not split) must sign again, and reading every row to do it would make a message cost the whole transcript. The seal carries the pair. A reader never uses it: it recomputes both from the rows, so a wrong seal only makes the next check fail. A delivery first verifies the head it read against its seal, so it never signs over a document that did not verify; a cancel, which has to end a corrupt run as well, writes such a head unsigned. - Where. Step commit:
worker::seal_update, inside the CAS retry loop. Delivery and cancel:Inner::reseal. Read:join_head,join_storedandclaimed(a claim,Runtime::state, a cancel's hook, a continued run's prior state).Runtime::viewreads the head alone and checks nothing. - Adoption (decision 11, release N). With keys, a document with no signature is accepted when no row carries a turn signature, and is signed at its next commit that writes rows (a delivery or a step that does not split does not sign what it found unsigned). A head with no signature over a signed turn is
Corrupt. Without keys a state's signature is not read, and a write drops it. - Failures. A refused head is
RuntimeError::Corrupt; a claimed run is committedFailedby the unreadable-state path, before its agent is stepped. A key that cannot sign fails the commit with the keys' class, and the run keeps its lease.RuntimeErrorgainsTurnKeys(the enum isnon_exhaustive). A key set that cannot be read at a claim also fails that run: a remote key set that is down is not told apart from a forged one yet. - Not done. No host sets the keys (the engine's and the service's wiring, T2); the turns are not verified on re-entry (T3a-3); the journal is not signed. A commit's CAS retry does not verify the head it reloads (only the inbox and artifacts are taken from it, and a reader recomputes). The store testkit is unchanged: the signature rides in the state JSON, so no
Storemethod changed.
Amended 2026-11-26 (slice T3a-2, review of the pull request) ​
What the review of T3a-2 changed. The text above stands; where it says otherwise, this is what is built.
- A key set that cannot be read at a claim no longer fails the run (amends point 6). A
TurnKeyserror at a claim (Unavailable,NotSigning,Refused) leaves the run as it is: the lease is kept and the run is found again when it expires. Only a head that does not verify (Corrupt) is committedFailed. A persistent misconfiguration (NotSigning,Refused) therefore retries until the keys are fixed, once per lease, and never fails the run. - A process that hosts no agent no longer reads
[]for the agent's transcript.Inner::transcript_ofisNonefor an agent that is not registered, and a state that does not decode as the agent's isCorrupt. A v4 state whose agent is not registered here is not chain-checked on a read (Runtime::state), and a delivery to it is written unsigned: this is a gap, chosen so that these front-end calls keep working as before. A worker that hosts the agent adopts it again (decision 11), unless a row carries a turn signature, in which case that run is refused as an unsigned head over signed turns: a front end that hosts no agent should register the agent as a starter (a start-only registration chains). - A cancel swallows only
Corrupt(amends point 3). A key outage during a cancel is the cancel's error and writes nothing; a corrupt head is still cancelled and written unsigned. - A parent no longer trusts a child's result unverified.
Ctx::child_status(finished children) andCtx::child_lookverify the child's record first: a signed v5 head against its ownseal(no row read), an unsigned head by its rows (stripping the signature must not pass), a v4 state as in point 2. A child that does not verify is reported asFailedwith an error that says the record is refused, never as its output; a key set that cannot be read is the call's own transient error. Still unverified, by design of point 4:Runtime::view,view_from_record, A2AGetTaskandListTasksread the head alone (a run refused asCorrupthas to stay viewable),ChildStatus::from_recordin the session listings, and a child's rows (a parent reads the head, which holds the output and the error). - The CAS retry checks what it reloads. The commit that lost its CAS to a delivery and reloads the record now verifies it (a signed head against its
seal, a signed v4 state against the agent's rows) before signing over its inbox and artifacts; failure is the commit'sCorrupt.seal_updatelikewise refuses (Corrupt) a signed base head whosesealis missing or unparsable, asreseal's strict path does, instead of writing it unsigned. - Known gaps.
- In a mixed fleet, or after a rollback, a worker without keys drops head signatures when it writes; a later signed turn then makes that head refused (an unsigned head over a signed turn). Roll keys out to every process that writes.
- Release N gives an agent that does not sign its turns no downgrade resistance: stripping
signature(andseal) passes adoption, because there is no signed turn to contradict it. - A v4 state is not verified in a process without its agent (point 2).
Amended 2026-11-27 (slice T3a-3: the turns on re-entry) ​
Sealer::check_read (crates/adam-runtime/src/seal.rs), which every read of a run's rows goes through, now follows the head check with Sealer::check_turns. What building it settled:
- Where the re-entries are. There is one place, not one per row of the Context table. A resume (a claim), a new task that continues a conversation and a session round (both read the prior run through
prior_state),Runtime::state, a child's unsigned head and the CAS retry's reload all callcheck_read; the embedded engine reopening its file is aRuntimeoverSqliteStore, so it is the same read. Not covered: a journal replay and the store service's own RPC (journal signatures are a later slice), andcheck_sealed, which checks a head by its ownsealand reads no rows. - What is checked. Only for a run whose head is signed: every row whose
roleisassistantortoolmust carry a turn signature thatverify_turnaccepts at its index, withprvfolded over the rows as stored. That covers, in one rule, the key being in the set and not revoked, the chain, and the position. A person's row is chained, never checked. This amends decision 4, which said the header of each turn and the newest turn's signature were enough: every turn is verified, because a rotation can revoke a key that signed an early turn while the head is signed by a later one, and the cost (one Ed25519 verification per turn per decode) is small against a model call. - A row is a turn by its
role. The runtime holds rows as JSON, so it recognises the shape adam writes (adam_model::Message'srole). A runtime with keys therefore needs an agent that signs its turns: theLlmAgentgiven the same keys. An agent whose assistant rows are unsigned under a signed head is refused on the next decode. No host sets the keys yet (T2), so nothing deployed meets this. - Adoption mirrors the head's (decision 11, release N). A head with no signature over rows with no turn signature is accepted and nothing is checked; the next commit signs the head, and the
LlmAgentsigns every unsigned turn. A head with no signature over a row that carries one isCorrupt(unchanged from T3a-2). A run with any signature is checked in full.adam_turns_adopted_totalis still not built. - Failures. A refused turn is
RuntimeError::Corruptnaming the row's position and role, with theTurnSignatureErroras its source (no row content): a claimed run fails before it steps, and a new task or round is refused before its run is made. A key set that cannot be read isRuntimeError::TurnKeys: the lease is kept and the run is tried again, as for the head (T3a-2 review point 1). OnlyCorruptfails a run. - Re-signing. A compaction and a shortening clear the signatures from the first changed row (T3a-1) and the step's own commit signs them again; both now have a test that the result verifies. A history carried into a new run (
continue_conversation: a new task, a session round, a close round) has every signature cleared,answer_owed_calls' synthetic tool results included, and the new run's first commit signs all of it under its own id and its own chain. The prior was verified under its own run byprior_statebefore the agent saw it. The strip does not depend on keys (a starter has none): a process without keys carries the rows unsigned, as a legacy run. - Not done. The journal's signature and its replay check;
adam_turns_adopted_total; the A2Asigned-turns/v1(T4); the engine's and the service's wiring of the keys to the runtime and the agent (T2); verifying a v4 state in a process that hosts no agent (T3a-2's gap stays).
What the review of T3a-3 changed (2026-11-27) ​
The text above stands; where it says otherwise, this does.
- A keyed runtime over an agent that does not sign. Building a runtime with keys did not check the agent, so its first commit signed a head over assistant rows with no turn signature, and the next claim,
stateorprior_stateof that run wasCorruptfor good. The commit now refuses first. Before the runtime signs a head it checks that everyassistantandtoolrow it signs carries a turn signature (presence, not verification: the agent just wrote them, and every decode verifies them in full). A step whose rows fail the check ends the runFailedwith its state untouched and an error that names the row, its role and the fix ("the runtime has turn keys but the agent did not sign its turns; give the agent the same keys, e.g.LlmAgent::turn_keys"). The class isInvalid, a configuration error and permanent (RuntimeError::UnsignedTurns): retrying would call the model again for the same refusal. The commit's own signing path (seal_update) holds the same guard, so no path signs a head over unsigned turns; an adopted run that ends is the one exception, written unsigned as it was read. Nothing signed over unsigned turns is stored. - The cost, said plainly. Decision 4's argument that one check per turn is small against a model call holds for a claim, which is followed by a step. It does not hold for the reads with no model call behind them:
Runtime::state(the embedded engine calls it when it reopens a run) and theprior_stateof a new task or a session round. Each decode is O(rows): one SHA-256 pass, one Ed25519 verification and one canonical-JSON form per turn, and one key-set read (the head and the turns share it; before this review a decode read it twice). A2AGetTask,ListTasksandSendMessageto an open task useRuntime::view, which reads the head record and checks nothing, so polling a task does not pay it. A long run read byRuntime::statein a loop pays in full each time. No cache is built here. If it shows, the follow-up is a verified-prefix cache keyed by run, version and key-set generation. - Revoking a key (decision stated 2026-11-27). Revoking a key makes every past run that key signed, its head or any of its turns, permanently unreadable:
Corruptat a claim, atRuntime::stateand at any continuation (a new task or a session round on that conversation);GetTaskstill reports the status. That is the point of a revocation for a compromised key, and a trap for a routine one. Rotating is the non-destructive path: add the new key, keep the old one in the set and not revoked, sign new commits with the new one, and revoke the old key only when it is compromised, or when its history may be lost. - Adoption and a carry, in release N (stated 2026-11-27). Release N adopts a run whose head has no signature and whose rows have no turn signature (decision 11). A store attacker who strips the head signature, the
sealand every turn signature of a history therefore gets it adopted, and a carry (a new task, a session round) then signs that history as a validly signed new run: the carry clears the old signatures and signs every row under the new run's id. What the signature proves in release N is that adam signed what it signed from now on, not that a run it adopted was ever adam's. This closes with the release that does not adopt (T5, release N+1: an unsigned assistant or tool row is refusedCorrupt). Until then, the downgrade is not resisted by design (decision 11). - A key outage at
prior_state. The key set that cannot be read at the read of the prior run isRuntimeError::TurnKeys(classTransient), notCorrupt: no run is made, the prior is not given up on (the A2A layer drops a prior only forNotFoundorCorrupt), and A2A answersUnavailable. The same request succeeds once the keys are back. Tests:crates/adam-llm-agent/tests/turn_reentry.rs,crates/adam-a2a-runtime/src/backend.rs(runtime_errors_map_by_class). - More re-entry tests. An appended user row (the head names one more row) and a changed head field at a resume are each
Corruptwith no model call.