Skip to content

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):

ProviderWhat it attachesSource
GeminiA 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 messagehttps://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)
AnthropicA 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 datahttps://platform.claude.com/docs/en/build-with-claude/thinking, Thinking encryption and Preserving thinking blocks
OpenAIReasoning 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-entryWhere today
A resume: a restart, another worker, a lease that ran outthe 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 callCtx reading journal_get (crates/adam-runtime/src/ctx.rs), JournalEntry (crates/adam-core/src/store/mod.rs)
A new task that continues a conversationinit_continuing (crates/adam-runtime/src/runtime.rs, new_run_within), Conversation::continued (crates/adam-llm-agent/src/conversation.rs)
A child session's roundRuntime::start_child_continuing (crates/adam-runtime/src/runtime.rs; ADR 0045)
The embedded engine reopening its fileSqliteStore::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 sendstext 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 ​

  1. 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.

  2. 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, on Message::Assistant (message level, beside #322's) and on Message::Tool (which gains the same carrier). If #322 names its Rust field differently, the JSON names here stand. Where it rides:

    WhereHow
    The storeinside the body row's message (BodyRow, crates/adam-core/src/store/mod.rs), as the state holds it; no column changes for rows
    The run's headthe envelope the runtime commits (crates/adam-runtime/src/envelope.rs) gains signature, the same form with typ adam-head/v1 (decision 4); the state is JSON, so no column changes
    The journalJournalEntry gains signature: Option<String>, the same form with typ adam-step/v1 over run, seq, name, ok and payload; each adapter stores it (Postgres and SQLite a column, MongoDB a field) and the testkit requires the round trip
    A model callnever sent: #322 sends a member back only to the model that made it, and adam is no model; the wire drops the adam namespace, and an adam member in a model's reply is dropped before the turn is recorded
    A2Aplanned (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 in metadata[<uri>] the rows the task committed, each with its signature, with run, cnv, the first row's idx and its prv (decision 3); a client may send such rows back to continue from them (a fork, decision 6). Without the extension nothing changes
  3. What 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}: run is the run that commits the turn, cnv the base64url SHA-256 of the run's conversation id (the run's own id when it has none), idx the turn's position in the transcript, prv the chain hash of every message before it, and msg the message as stored (after ADR 0051's replacement), without its extra_content.adam member. A provider's members are part of msg, 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's adam member. So a change to any earlier message, a reordering or a row spliced in from another run or position breaks every later signature.
  4. 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}, where len is the number of body rows, chain is h(len-1) and head is the envelope without its signature (for a run whose state is not split, the whole state, and chain is 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 past len are already not part of the state (ADR 0055), and a row appended with a new len breaks the signature. run is the id the run was loaded by and cnv the hash of the record's conversation_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/v1 message (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.

  5. 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 through signed-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.

  6. What is refused, and its class (Rule 6):

    WhereWhat happensClass
    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 signature error before any model call; no turn is addedCorrupt (alert)
    A signed-turns/v1 message that does not verify, or whose rows are not the caller's: their cnv must 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 writtenInvalid
    Plain A2A: a message whose text or data looks like a historytoday'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
  7. The key comes from the vault, through a port asked like the model's credentials. A port TurnKeys (planned, in adam-core beside SecretSource, crates/adam-core/src/secrets.rs) signs a payload (sign(payload) -> signature, with its kid) 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 of ModelCredentials (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. The kid is 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-system docs/decisions/0083-trusted-components-the-agent-names-and-the-client-draws.md at e95eafcd, Amended 2026-11-21, items 1 and 2). For a server (planned, slice T2):

    VariableWhatDefault
    TURN_SIGNING_KEY_FILEa PKCS#8 PEM Ed25519 private key, mounted from the Secret the reference resolves torequired
    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 kid its reference, with a revoked list 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_ID of vault:<name>#v<n> with n above 1 is exit 78 unless the verify set names every earlier version 1 to n-1, as a key or as revoked: a rotation that forgot the set would otherwise refuse every history signed before it.

  8. Rotation and revocation. A rotation makes version n+1 and keeps version n for 24 hours (the same ADR 0083 amendment). During that overlap a worker that has not restarted still signs with n, so the key set holds both public keys and a verifier accepts either. After it the private key n is 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 under revoked: 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.

  9. Fail closed, by deployment kind (Rule 4). No kind runs with the feature off, and there is no switch to turn it off.

    KindNo key
    A server: adam-coder, adam-agent, every role (DATABASE_URL always 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::start fails (Invalid); the host gives a TurnKeys backed by the platform keychain through the builder (planned EngineBuilder::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 itself
    The engine or a test on a MemoryStoreTurnKeys::ephemeral(), a key made at start that dies with the process, as the history does
  10. Ed25519, not an HMAC.

    HMAC-SHA256Ed25519
    Who can verifyonly a holder of the key, who can also forgeanyone with the public key, who cannot sign: the orchestrator, an auditor, a client of signed-turns/v1
    After a rotationthe 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 refusedthe public key stays; nothing is re-signed
    Revocationremoving the key also breaks honest turns, with no way to tell them apartthe same, and only for a key that leaked
    Cost per turnabout 1 µs, a 32-byte tagtens 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)
    Dependencyaws-lc-rs's hmacaws-lc-rs's ED25519, already used to sign the card

    The 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-rs is already in every build that has a model client: the workspace's rustls names its aws_lc_rs feature (Cargo.toml), and adam-a2a and adam-workspace depend on it (verified 2026-11-22: aws-lc-rs 1.18.1 in Cargo.lock, a dependency of rustls 0.23.46); RFC 8785 canonicalization is adam-a2a's canonicalize (behind its server feature, with ryu-js) and moves to adam-core so the engine has it. No package is added to Cargo.lock.

  11. 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 &ZeroWidthSpace;

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 &ZeroWidthSpace;

Sign at commit, verify on re-entry. TurnKeys and every call marked planned are not built.

A turn's life:

Alternatives &ZeroWidthSpace;

  • 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 &ZeroWidthSpace;

  • 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 when signed-turns/v1 is 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.
  • JournalEntry gains a field: no trait method changes, but an adapter outside this repository that builds a JournalEntry by its fields, or does not store the new one, breaks (Rule 2): the crate README and adam-upgrade say so.
  • Message::Tool gains the carrier; older binaries ignore the member (serde defaults), 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 &ZeroWidthSpace;

After ADR 0067's S8b and S8c.

SliceWhatTests
T1TurnKeys 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-corea 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
T2the 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 keysthe 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
T3sign 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 adoptioneach 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-1sign 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 shorteningthe 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-2sign 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 seala 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-3verify 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 thema 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
T4signed-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 rowsa 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
T5release N+1: no adoptionan unsigned assistant or tool row is refused Corrupt, with an error that names this ADR's migration

Not decided here &ZeroWidthSpace;

  • #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) &ZeroWidthSpace;

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:

  1. Ed25519 is ed25519-dalek 3.0.0, not aws-lc-rs (decision 10). The engine's tree may hold neither aws-lc-rs nor ring (tools/embedded-deps/check.sh, ADR 0047), and decision 9 has the engine sign (ephemeral) and verify, so the implementation in adam-core is pure Rust. Six packages are added to Cargo.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 in deny.toml's list. Verification is strict (RFC 8032, a non-canonical signature refused) and a weak public key is refused. A test in adam-a2a holds that it gives the bytes aws-lc-rs gives 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.
  2. 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 a CurrentKey: a KeyIdentity, Id(kid) or Certificate(chain) (leaf first, named by its leaf's x5t#S256 unless the adapter names it), and a KeyStatus, Active or Renewing (both closed); sign(kid, input) signs with the key that id names, or answers NotSigning (class Conflict: ask again); key_set(). A chain rides in the header as x5c (RFC 7515 §4.1.6, at most four certificates of 2 KiB), so the header of decision 3 is alg, kid, typ and, for a chain, x5c. T1 verifies by kid against the key set and carries the chain without trusting it: trusting a PKI is the certificate adapter's work.
  3. The chain's first link is h(-1) = SHA-256(JCS({typ: "adam-chain/v1", run, cnv})): decision 3 named the members, not the typ; a typ of its own keeps it apart from a turn's payload. run is the run's UUID as text, cnv and prv are base64url without padding, idx is the body row's u32.
  4. Where the member is. extra_content.adam is a member of the message object itself, not of #322's provider.members (a model switch drops those). msg is the message without extra_content.adam, and without extra_content when that was its only member, so adding the signature never changes what it signs.
  5. One encoding. verify_detached accepts only the header adam writes: its RFC 8785 bytes, those members, EdDSA, the expected typ, 64 bytes of signature, and at most MAX_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-character kid the member is 222 bytes ({"extra_content":{"adam":{"turn_signature":…}}}), as the Consequences estimated.
  6. TurnKeys::ephemeral() is <dyn TurnKeys>::ephemeral() (and Ed25519TurnKeys::ephemeral()), and returns a Result: a system with no random numbers is an error (Internal), not a panic.
  7. The store round trip (Consequences, unverified until now): a_message_canonicalizes_as_it_was_written and body_a_row_canonicalizes_as_it_was_written write floats, integers either side of 2^53, i64's extremes, -0 and names that sort differently by UTF-16 into a state, a commit, a journal payload and a body row. Verified 2026-11-25 on MemoryStore, SQLite and PostgreSQL 16.15; MongoDB is unverified (no server where this was built; CI runs it). A u64 above i64::MAX is not in it: MongoDB refuses it at the write, as before.

Amended 2026-11-25 (the request signature) &ZeroWidthSpace;

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).

  1. A new signature type. SignatureType::Request, typ adam-request/v1. The enum stays closed: every match on it names the new variant, and a history signature never verifies as a request one (the typ differs).

  2. The form is attached: BASE64URL(header).BASE64URL(payload).BASE64URL(signature) (sign_attached, verify_attached), because the verifier cannot rebuild iat and nonce from the request. The header is the one decision 3 and T1 write: the RFC 8785 form of {"alg":"EdDSA","kid":…,"typ":"adam-request/v1"}, plus x5c when TurnKeys::current names the key by a certificate chain. The signing input is the detached form's, byte for byte. The bound stays MAX_SIGNATURE_LEN (16 KiB).

  3. The payload is the RFC 8785 form of exactly eight members (request_payload):

    MemberValue
    typadam-request/v1
    runthe root run, the value of X-Run-Id beside it
    methodthe HTTP method, upper case
    paththe request target as sent: path and query (adam_model::request_target; adam-model-openai keeps 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's nonce (its protected header); null when 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 new iat and nonce.

  4. Where. adam_model::SignedRequests wraps any ModelCredentials (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's Prompt-Statement and Prompt-User-Signature when it has them, and Turn-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 test crates/adam-a2a-runtime/tests/prompt_statement.rs). CredentialRequest gained a public field, body; code that builds one with a struct literal adds it (no trait changed). A server reads TURN_SIGNING_KEY_FILE, TURN_SIGNING_KEY_ID and TURN_VERIFY_KEYS_FILE with the model's configuration (environment); an embedding host wraps the credentials of its own client with its keys, and gives the person's envelope with Say::with_prompt_statement.

  5. No prompt (the contract is silent). A run with neither a statement nor an envelope is still signed, with prompt_jti null: 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.

  6. 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 whose jti (an envelope whose nonce) cannot be read is InvalidRequest; keys that cannot be reached are a transient error, retried as a model outage is; keys that refuse are Auth. A key renewed between current and sign (NotSigning) is asked for once more. A key file that cannot be read, or is not an Ed25519 private key, is exit 78.

  7. The carrier. The key is named as the adapter names it: KeyIdentity::Id gives a header with kid only (the device, and today's file key), KeyIdentity::Certificate adds x5c (the leaf first). The contract wants x5c on 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 carries kid only, which the contract's verifier refuses (mismatch). The x5c path is built and tested with turn::testkit::Certified.

  8. Verified against the contract's vector V7 (copied, test material only, into crates/adam-core/tests/fixtures/request-signature/): adam's signer gives V7a (by x5c) and V7b (by kid) byte for byte, both verify with verify_request, and a changed body, method, path, prompt_jti or run, a changed byte of the signature, and an iat outside 300 s before or 60 s after the clock fail (crates/adam-core/tests/request_signature.rs). verify_request checks 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.

  9. Never logged. The headers are secret values (SecretString, a sensitive HeaderValue); the Debug of CredentialRequest and of ModelCall shows 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) &ZeroWidthSpace;

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) &ZeroWidthSpace;

An LlmAgent given LlmAgentBuilder::turn_keys signs what each step commits (crates/adam-llm-agent/src/signing.rs). What building it settled:

  1. One seam, not ten. The loop pushes messages at about ten sites. Agent::step is now a wrapper: the old body is step_unsigned, and sign_transition takes the state of whatever Transition it returns (Continue, Park, Done or Fail) and signs there, so a new push site is covered with no change.
  2. Which messages. Every assistant and tool message without a turn signature, in order, at its transcript index, with prv the 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.
  3. No keys, no change. Without turn_keys the transcript is byte for byte what it was. The host sets the keys (the engine's and the service's wiring of TURN_SIGNING_KEY_FILE to the agent is T2); no variable is read.
  4. A signing failure is the step's failure (a TurnKeyError keeps its class: the runtime retries or fails the run as for any step error): a turn is never committed unsigned by a configured agent.
  5. 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.
  6. 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's msg is 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 past u32::MAX, fails the step Internal; nothing is signed as null or clamped.

Amended 2026-11-26 (slice T3a-2: the head) &ZeroWidthSpace;

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:

  1. What head is. The stored state document without signature, seal and body.generation. The generation is the store's: the runtime leaves it null and 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 by len and chain). Everything else is signed: the inbox, rev, the artifacts, the error, the agent's head.
  2. Which documents. A v5 head (len and chain over 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; chain over the agent's own split rows, len their count, none when the agent does not split).
  3. 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.
  4. Where. Step commit: worker::seal_update, inside the CAS retry loop. Delivery and cancel: Inner::reseal. Read: join_head, join_stored and claimed (a claim, Runtime::state, a cancel's hook, a continued run's prior state). Runtime::view reads the head alone and checks nothing.
  5. 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.
  6. Failures. A refused head is RuntimeError::Corrupt; a claimed run is committed Failed by 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. RuntimeError gains TurnKeys (the enum is non_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.
  7. 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 Store method changed.

Amended 2026-11-26 (slice T3a-2, review of the pull request) &ZeroWidthSpace;

What the review of T3a-2 changed. The text above stands; where it says otherwise, this is what is built.

  1. A key set that cannot be read at a claim no longer fails the run (amends point 6). A TurnKeys error 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 committed Failed. A persistent misconfiguration (NotSigning, Refused) therefore retries until the keys are fixed, once per lease, and never fails the run.
  2. A process that hosts no agent no longer reads [] for the agent's transcript. Inner::transcript_of is None for an agent that is not registered, and a state that does not decode as the agent's is Corrupt. 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).
  3. 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.
  4. A parent no longer trusts a child's result unverified. Ctx::child_status (finished children) and Ctx::child_look verify the child's record first: a signed v5 head against its own seal (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 as Failed with 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, A2A GetTask and ListTasks read the head alone (a run refused as Corrupt has to stay viewable), ChildStatus::from_record in the session listings, and a child's rows (a parent reads the head, which holds the output and the error).
  5. 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's Corrupt. seal_update likewise refuses (Corrupt) a signed base head whose seal is missing or unparsable, as reseal's strict path does, instead of writing it unsigned.
  6. 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 (and seal) 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) &ZeroWidthSpace;

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:

  1. 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 call check_read; the embedded engine reopening its file is a Runtime over SqliteStore, so it is the same read. Not covered: a journal replay and the store service's own RPC (journal signatures are a later slice), and check_sealed, which checks a head by its own seal and reads no rows.
  2. What is checked. Only for a run whose head is signed: every row whose role is assistant or tool must carry a turn signature that verify_turn accepts at its index, with prv folded 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.
  3. A row is a turn by its role. The runtime holds rows as JSON, so it recognises the shape adam writes (adam_model::Message's role). A runtime with keys therefore needs an agent that signs its turns: the LlmAgent given 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.
  4. 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 LlmAgent signs every unsigned turn. A head with no signature over a row that carries one is Corrupt (unchanged from T3a-2). A run with any signature is checked in full. adam_turns_adopted_total is still not built.
  5. Failures. A refused turn is RuntimeError::Corrupt naming the row's position and role, with the TurnSignatureError as 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 is RuntimeError::TurnKeys: the lease is kept and the run is tried again, as for the head (T3a-2 review point 1). Only Corrupt fails a run.
  6. 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 by prior_state before 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.
  7. Not done. The journal's signature and its replay check; adam_turns_adopted_total; the A2A signed-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) &ZeroWidthSpace;

The text above stands; where it says otherwise, this does.

  1. 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, state or prior_state of that run was Corrupt for good. The commit now refuses first. Before the runtime signs a head it checks that every assistant and tool row 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 run Failed with 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 is Invalid, 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.
  2. 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 the prior_state of 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). A2A GetTask, ListTasks and SendMessage to an open task use Runtime::view, which reads the head record and checks nothing, so polling a task does not pay it. A long run read by Runtime::state in 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.
  3. 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: Corrupt at a claim, at Runtime::state and at any continuation (a new task or a session round on that conversation); GetTask still 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.
  4. 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 seal and 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 refused Corrupt). Until then, the downgrade is not resisted by design (decision 11).
  5. A key outage at prior_state. The key set that cannot be read at the read of the prior run is RuntimeError::TurnKeys (class Transient), not Corrupt: no run is made, the prior is not given up on (the A2A layer drops a prior only for NotFound or Corrupt), and A2A answers Unavailable. 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).
  6. More re-entry tests. An appended user row (the head names one more row) and a changed head field at a resume are each Corrupt with no model call.