Internet-Draft Bridge Contract November 2026
Strebulaev Expires 29 May 2027 [Page]
Workgroup:
Network Working Group
Internet-Draft:
draft-strebulaev-bridge-contract-00
Published:
Intended Status:
Informational
Expires:
Author:
S. A. Strebulaev
Independent Researcher

Bridge Contract for Agent Session Governance

Abstract

Existing agent protocols define identity headers, audit records and session resumption, but none defines what an intermediate bridge MUST do when the client is detached and the agent keeps executing, or when the human in the loop is unavailable. This document defines the Bridge Contract: a Session Identity Descriptor, Mandatory Governance Events, a Resume Record that the bridge keeps for itself, and Conformance Criteria. Re-attach is a challenge-response in which the client proves possession of a registered key over a single-use nonce and the last event it saw. The event log is hash-chained. The contract complements, and does not replace, the protocols it composes with. The evidence for the specification is in a companion preprint; it comes from one author's implementations and is not independent confirmation.

Status of This Memo

This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79.

Internet-Drafts are working documents of the Internet Engineering Task Force (IETF). Note that other groups may also distribute working documents as Internet-Drafts. The list of current Internet-Drafts is at https://datatracker.ietf.org/drafts/current/.

Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress."

This Internet-Draft will expire on 29 May 2027.

▲

Table of Contents

1. Introduction

AI agents increasingly run as long-lived processes that outlive the interactive client that started them. A mobile user asks a research agent to summarise a dataset; the agent enqueues tool calls and pauses for a human confirmation; the user's transport drops and the user does not return for forty minutes. During that interval the bridge, the component that mediates between the client and the agent runtime, has to do something.

Existing work answers neighbouring questions. The Agent Transfer Protocol ([AGTP]) and its session companion ([AGTP-SESSION]) define identity and authority headers on the wire but not the execution semantics of the bridge that holds them. The Governance Audit Record ([GAR]) defines a tamper-evident audit record, but presupposes a Governing Enforcement Component (GEC) and does not say who emits audit events when none is present. PACE ([PACE]) defines re-attach for suspended sessions over a relay substrate but does not define what the bridge does while the client is detached. In the versions read, none of the three assigns these obligations to the bridge. The argument that this is a matter of scope rather than oversight rests on a reading of dated texts and weakens if one of them is extended to own these duties.

This document specifies the obligations. Its parts are:

A companion preprint [BC-PAPER] carries the evidence: a TLA+ model checked on bounded configurations, a conformance suite with mutation checks, language-neutral test vectors, the comparison with [AGTP], [GAR] and [PACE], and the limitations register. This document does not repeat it. Section 8 states what that evidence is and is not.

1.1. Requirements Language

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in BCP 14 [RFC2119] [RFC8174] when, and only when, they appear in all capitals, as shown here.

1.2. Terminology

Bridge:

A component that mediates between a client transport and an agent runtime, such that messages between them pass only through it. It is the locus of identity binding, of audit emission and of session-state continuity.

Bridge Contract (BC):

The specification in this document. "Bridge" names the component that implements it.

Resume Record:

The bridge's own durable record of where a detachment can be resumed. It is not handed to the client (Section 3.3).

GEC-less deployment:

A deployment without a Governing Enforcement Component ([GAR]). The bridge is then the source of audit events.

Cell:

A combination of the attachment, human and lifecycle dimensions of the state machine (Section 4).

Operator:

The party that runs the bridge and holds the key that signs grants, revocations and terminations of the deployment.

2. Problem Statement

2.1. Bridge Responsibility Gap

The Bridge Responsibility Gap is the set of obligations that fall between [AGTP], [GAR] and [PACE] when they are composed. A related finding, that no protocol assigns enforcement for cross-protocol behaviour, is reported for other agent protocols in [AGENTTHREAD]; it motivates this work and is not a result about the three protocols named here. The gap has these classes:

G1, client detaches and the agent continues:

The client transport disconnects while the agent is mid-execution. The bridge records a resume point, stops forwarding new tool calls that arrive while no client is attached (refusing them, holding them for an answer after re-attach, or forwarding only those the operator allowlisted), and leaves work already in flight undisturbed.

G2, human escalation pending:

The agent escalates a decision to a human who is unavailable. The bridge sets the human dimension to pending, queues every later tool call rather than executing it, and emits HUMAN_PENDING.

G3, resume after detach:

The client re-attaches. The bridge authenticates the client by a challenge answered under a registered key, verifies that the presented history is a prefix of its chain, re-verifies the hash chain, and returns to attached only if verification succeeds.

G4, bridge restart with live sessions:

The bridge process restarts while sessions are live. Every client transport is lost, the agent and the human dimension are not. The bridge rebuilds each session from its durable event log, treats it as detached and records a resume point, without losing or duplicating events or queued tool calls.

2.2. Scope and Failure Model

In scope: client transport disconnect with the agent continuing; human escalation with the human unavailable; re-attach with verification of the presented history and the hash chain; restart of a single bridge with a durable log; authentication of the re-attaching client, including replay of captured requests and attempts to terminate a session with forged ones; several clients of one principal, attached at once or in turn (the session is detached only when none is connected); clean termination from any state; and authority extension attempts in any cell. A Byzantine client, one that replays captured requests, forges signatures, claims a history that is not a prefix of the chain, or tries to terminate a session with forged attempts, is in scope provided no registered private key is compromised.

Out of scope: bridge replication, failover and storage faults beyond the durable-log assumption; sharing of one session between principals; network partition and partial detach; true concurrency on one session (events are assumed serialised per session); compromise of client or bridge keys; a Byzantine bridge that suppresses or forges events (mitigation needs an external transparency log and is a deployment matter); composition of two bridges in sequence; multi-agent composition above the session layer; and QUIC 0-RTT replay protection of the underlying transport, which the transport specifications own and I8 only adds the bridge-layer consequence of (Section 5.8).

2.3. What the Bridge Can See

The obligations attach to what crosses the bridge.

  • The queueing and approval obligations (I2, I13) apply to tool calls the runtime submits to the bridge for approval or forwarding. Where the bridge sees only a permission request and not the execution that follows, execution is outside the contract: the bridge cannot queue, suspend or audit what it does not see.

  • A scope or mode change requested through the bridge is enforced: widening is refused (I3). A change the runtime announces itself is observed: the bridge cannot prevent it, records AUTHORITY_EXTENSION_REJECTED with source observed, and SHOULD instruct the runtime to revert. A bridge claims enforced authority only where the runtime routes all authority changes through it; the deployment documents which case holds.

2.4. Applicability

The contract adds value when at least one gap class can fire: a long-lived agent with a client that can detach, a human who may be unavailable, a principal with several devices, a regulated deployment that needs an audit trail without a GEC, or a bridge that may restart with live sessions. It is overhead when none can. A deployment MAY skip Resume Record production when no detach is possible, but MUST still emit the lifecycle events ATTACHED and TERMINATION.

3. The Bridge Contract

A Bridge Contract is a tuple BC = (S, E, R, C):

3.1. Session Identity Descriptor

A Session Identity Descriptor is the tuple (sid, pid, scope, lineage). sid is the session identifier (matching the AGTP Session-ID header), pid the principal identifier (matching Owner-ID), scope the authority scope (matching Authority-Scope) and lineage the task lineage, a sequence of task identifiers rooted in the originating task. At attach the client also registers a public key, recorded with its scheme tag in the genesis ATTACHED event and bound to pid (I11). The principal may register further keys (CLIENT_ADDED); a session thus has a set of registered keys and a set of connected clients (I15).

Key identifiers are scoped to a session: the registry maps a session identifier and a key identifier to a key, a key identifier already registered in a session is never registered again in it, and a second session that uses the same identifier for another key neither replaces nor can use the first session's key.

The descriptor also exposes an authority hash: the SHA-256 of the canonical JSON [RFC8785] of the object with members principal, scope and lineage, as lowercase hexadecimal truncated to its first 16 characters. It is an identifier carried in events so that a reader can tell which authority a record refers to. No invariant depends on it and it is not a commitment against a determined adversary.

3.1.1. Authorisation Boundary

The contract guarantees key possession at attach (I11), not authorisation: the initial scope MUST be granted by a trusted authority outside the contract, and the bridge MUST NOT commit ATTACHED unless the deployment's grant verifier accepts. The grant, the proof of possession at attach, the refusal reasons grant_invalid and possession_invalid, and the documentation of how the principal identity is established are specified in Section 5.17. The human-approval channel is a further deployment concern (Section 4.4).

3.1.2. Scope Semantics

Scope is a set of opaque permission identifiers. The subset relation, the canonical form and the treatment of structured scopes are specified in Section 5.17.

3.2. Mandatory Governance Events

The bridge MUST emit the events in Table 1 under the stated conditions. Each event is a JSON object, GAR-shaped in that it uses the same canonicalisation [RFC8785], hash-chaining and causal ordering; a field-level mapping to [GAR] record types is future work. The payload of each kind is specified by a JSON Schema distributed with [BC-PAPER].

Table 1: Mandatory Governance Events
Event Trigger
ATTACHED Session attach (genesis event); carries the registered public key and scheme tag.
DETACHMENT Transport disconnect of the last connected client in the attached cell; of the re-attaching client in the re-attaching cell; and bridge restart (reason bridge_restart).
CLIENT_JOINED Authentic join from a registered key while attached (I15); carries the acknowledged (seq, hash).
CLIENT_LEFT Disconnect of one client while others remain; does not change the cell.
CLIENT_ADDED Registration of a further client key, authorised by a signature of a connected, unrevoked client over the new key and a single-use nonce (I15).
RESUME_PREPARED Immediately after DETACHMENT and before any state mutation; once per detachment. The bridge's own resume record.
RESUME_STARTED Authentic re-attach (I11) with a live unused nonce (I9) naming a prefix of the chain (I4); enters the re-attaching cell.
RESUME_REJECTED Re-attach fails authentication, presents a consumed, expired or unknown nonce, names a non-prefix history (I4), or is reported as a 0-RTT replay (I8). Informational; carries a reason.
RESUME_VERIFIED Hash chain verified during re-attach; returns to attached.
RESUME_FAILED Hash chain verification failed during re-attach; the session is quarantined (rule Q).
HUMAN_PENDING Agent escalates to a human; human dimension becomes pending.
HUMAN_RESOLVED Human resolves; carries the approval validity (I13). The queue drains once attached (rule D).
HUMAN_TIMEOUT Human timeout expires; session terminates with reason human_timeout.
DETACH_TIMEOUT T_detach or the cumulative cap T_total expires while detached; reason detach_timeout or detach_total_timeout.
AUTHORITY_EXTENSION_REJECTED Any attempt to widen Authority-Scope in any cell (I3), requested or observed; payload carries source.
AUTHORITY_NARROWED Successful runtime-initiated narrowing; ordered and versioned under I10.
AUTHORITY_NARROWING_REJECTED Out-of-order, duplicate or non-narrowing scope change (I10).
TERMINATION Session termination; irreversible.
TOOL_CALL_QUEUED Tool call arrives while the human dimension is pending; carries its idempotency key and the hash of the call shown to the human (I14).
TOOL_CALL_ANSWERED Human decision on a queued call; carries the key, the decision and the hash of the content the human's client displayed (I14).
TOOL_CALL_DRAINED Queue drain (rule D); one event per drained call.
TOOL_CALL_DELIVERED Runtime acknowledges receipt of a drained call.
TOOL_CALL_COMPLETED Runtime reports a delivered call finished.
TOOL_CALL_REJECTED Call refused at a full queue, refused as a direct call outside the current scope (direct set; I3), or dropped at drain (scope no longer permits it, unanswered, denied, or answered with a different hash).
TOOL_CALL_EXPIRED Queued call outlived T_call, or its approval outlived T_approve (I13).
BRIDGE_RECOVERED Recovery of a session after restart (Section 4.6).
RECOVERY_FAILED Failed recovery; the session is quarantined, and only an operator TERMINATION may follow.
CHECKPOINT Periodically (SHOULD, I-CHECKPOINT); carries the tree size and the signed Merkle tree hash (RFC 9162, Section 2.1.1) over the preceding events.
KEY_REVOKED Operator-signed revocation of a registered client key (I11-REVOKE).
KEY_REVOCATION_REQUESTED Client requests revocation; informational, the operator approves.
OPERATOR_ADD_KEY Operator adds a key to a key_exhausted session.
OPERATOR_TERMINATION Operator terminates a key_exhausted session.

Each event carries kind, session_id, sequence (monotonic per session), prev_hash (SHA-256 of the canonical JSON of the previous event, empty for the genesis event), payload and timestamp. The event's own hash, SHA-256 over its canonical JSON, is a derived value computed by the consumer; it is not a field of the event. It is referenced in I5 and in the (seq, hash) pair of a re-attach request (I4).

The timestamp field is informational, for audit displays and approximate ordering in logs. The bridge MUST NOT use wall-clock timestamps for ordering decisions. Ordering is determined solely by sequence and the prev_hash chain (I5).

Events are immutable once emitted and their hash is stable and externally referenceable. External annotations MAY reference an event hash as a cross-reference anchor. The annotation and delivery protocols are out of scope. An annotation layer that mutates an event hash or modifies the log after the fact is non-conformant with this specification.

Implementations MAY emit further events as extensions. Added events MUST NOT weaken any MUST invariant. The names AUDITOR_MARK, ROUTING_HINT and BROADCAST_SUBSCRIPTION are reserved as extension points for separate specifications.

3.3. Resume Record and Re-attach

The Resume Record R is the bridge's own durable record of the resume point of a detachment, written by RESUME_PREPARED on entry to a detached cell. It is the tuple (sid, seq, hash, scope, sv, Q, r): the session identifier; the sequence number and hash of the RESUME_PREPARED event; the authority scope and its version at detach (I10); the pending tool calls with their idempotency keys; and the reason (for example client_disconnect or bridge_restart).

R is a record, not a credential. Resuming does not require the client to present it, and the bridge's acceptance never depends on it. The event log alone determines the state (I12). A design that hands the client a MAC-protected token at detach and requires it back at re-attach fails for the client that most needs it: one that vanished abruptly holds at best an outdated token, because the token is superseded while the client is gone. Where a peer specification expects a resume token ([PACE]), a bridge MAY export R as a non-authoritative snapshot. Such an export plays no part in authentication.

The client keeps the pair (seq, hash) of the last event it observed on the event stream. To reconnect:

  1. The client requests a challenge, naming the key identifier it will sign with; the bridge returns a fresh nonce valid for T_nonce, bound to that identifier (I9, I11). The answer has the same form and lifetime for every identifier, registered or not.

  2. The client sends (nonce, seq, hash) and a signature over (sid, nonce, seq, hash) under a registered client key (I11).

  3. The bridge accepts iff the signature verifies, the nonce is live, unused and bound to the signing key (which was a registered, unrevoked key of the session when the nonce was issued), and hash is the hash of the event at seq in its chain (I4). It then emits RESUME_STARTED, verifies the chain (I5), emits RESUME_VERIFIED, and replays every event after seq to the client.

Any failure in step 3 yields RESUME_REJECTED with the reason and leaves the cell unchanged. The signed bytes are domain-separated and defined once in Section 6.4; a re-attach and a join sign different bytes. The reference signature scheme is Ed25519, and a deployment MAY use another unforgeable scheme through its verifier. The registry of client keys holds verification material only, so proof of possession is checked without a signing key at the bridge.

3.4. Conformance

A bridge conforms iff it satisfies every MUST invariant of Section 5: I1 to I15, I11-REVOKE, I-GRANT, I-OPERATOR and I-SIGN-JWKS. I-SIGN-EVENT and I-CHECKPOINT are SHOULD. Custom event payload schemas and additional cells beyond the product state machine are MAY, provided they are documented and weaken no MUST invariant.

The unit of conformance is the committed event log and the final session state. Two implementations that produce the same committed event kinds and the same final cell on the same input trace conform at the semantic level, whether or not they share a transport binding. The wire format (Section 6) is normative for the signed bytes and the reason names; agreement on those does not by itself make two implementations byte-compatible at the message level.

The conformance suite, the test vectors and the schemas that make the invariants executable are distributed with [BC-PAPER].

4. State Machine

This section defines the state of a session, the transitions between states, the timers that bound them, and the recovery rules after a bridge restart. The invariants that every transition has to satisfy are in Section 5; the events named here are defined in Section 3.2; the messages by which a client causes the inputs below are in Section 6.

4.1. Cells

The state of a session is a point in the product of orthogonal dimensions:

  • attachment a, one of Att, Det or Res: at least one client is attached, no client is attached, or no client is attached and a re-attaching client is being verified. The attachment is derived from the client set defined below;

  • human h, one of None or Pend: no escalation is outstanding, or the agent is waiting on a human;

  • lifecycle, one of Active or Terminated.

Every combination of a and h is reachable while the lifecycle is Active. Every terminated session is in the single terminated cell (written as the bottom element in the formal model), regardless of a and h. A new session starts in the cell (Att, None). This product machine is the normative state model. Where this document uses a named state (ATTACHED, DETACHED, PENDING_HUMAN, RESUMING, TERMINATED), it is a fold of cells for exposition: ATTACHED is (Att, None); DETACHED is (Det, None); PENDING_HUMAN is (Att, Pend) or (Det, Pend); RESUMING is (Res, None) or (Res, Pend); TERMINATED is the terminated cell. The fold is lossy, because it hides whether a client is attached while a human is pending, and that determines whether queued tool calls may drain and whether the detach timer runs. Where a named state and a cell disagree, the cell is authoritative. The named state ATTACHED is distinct from the genesis event ATTACHED.

4.1.1. Client set

A session has a set K of registered client keys, all bound to the session's principal (Owner-ID): the key registered at attach, and any key added later by CLIENT_ADDED. Its client set C is the subset of K whose keys currently have a connected transport; a client is identified by its key. The attachment is a function of C:

  • a = Att if and only if C is not empty;

  • a = Det if and only if C is empty and no re-attach is being verified;

  • a = Res if and only if C is empty and a re-attach request has been accepted and is being verified.

A principal typically has several devices, often attached at once; a further device is a join of the same session, not a resume. Changes of authority (narrowing, I3, I10) apply to the session as a whole, never to one client. Sharing a session between different principals is out of scope.

4.1.2. Side predicates

Two predicates are defined over the committed log, alongside the product machine. Neither is a cell. Both survive a restart, because both are derived from the log (I12).

quarantined:

True when the log contains a RESUME_FAILED or RECOVERY_FAILED event for the session and no later TERMINATION. The session is frozen (rule Q, Section 4.2). Only an operator-issued termination, ending in TERMINATION, is permitted.

key_exhausted:

True when every key in K has a KEY_REVOKED event in the log and no later OPERATOR_ADD_KEY. No client operation is accepted. Only OPERATOR_ADD_KEY, which clears the predicate, and OPERATOR_TERMINATION, the signed operator form of TERMINATION, which follows it, are permitted. The timers keep running (see Section 4.5). This predicate is not rule Q: rule Q is for a log that cannot be vouched for, key_exhausted is for deliberate revocation and has a recovery path (I11-REVOKE).

4.1.3. Transitions

The inputs to the bridge are: transport connects and disconnects, re-attach, join and key-addition requests, the agent's escalation, the human's resolution, the outcome of hash-chain verification and of recovery, expiry of T_detach, T_total and T_human, a clean end or abort, and bridge restart. The Mandatory Governance Events are the bridge's outputs, not inputs.

Table 2 lists the allowed transitions. In it, a and h stand for any value of that dimension unless a value is given. "Events" lists the events the bridge MUST emit, in this order, and make durable (I12) before the cell changes (I7). The table lists the transitions that change a cell, together with the join and re-attach transitions that leave it as it is. Events that leave every cell unchanged (tool-call events, KEY_REVOKED, OPERATOR_ADD_KEY, narrowing, AUTHORITY_EXTENSION_REJECTED) are defined by the invariants (I2, I3, I10, I11-REVOKE, I13, I14), not by a row of the table. A transition not listed is not allowed.

Table 2: Allowed transitions over the product machine
Transition Precondition Events
(Att,h) to (Det,h) Transport disconnect of the last connected client. DETACHMENT, RESUME_PREPARED
(Att,h) to (Att,h) Transport disconnect of one client while others remain. CLIENT_LEFT
(Det,h) to (Det,h) Idempotent disconnect, also of a client that is not in C. none
(Att,h) to (Att,h) Join: an authentic request (I11) from a registered key, with a live unused nonce and a prefix of the chain (I4, I9). The key is added to C. CLIENT_JOINED; the events after the acknowledged prefix are replayed to the joiner
(Att,h) to (Att,h) A registered client adds a further key for the principal. CLIENT_ADDED
(a,None) to (a,Pend) The agent escalates to a human. HUMAN_PENDING; the tool queue is initialised
(a,Pend) to (a,Pend) A second escalation while one is pending: escalations coalesce. HUMAN_PENDING, recorded for audit; the human dimension and T_human, measured from the first escalation, are unchanged
(a,Pend) to (a,None) The human resolves. HUMAN_RESOLVED, which ends every coalesced escalation at once; the queue drains only once a is Att (rule D)
(Det,h) to (Res,h) A re-attach request that is signed under a registered client key, uses a live unused nonce and names a prefix of the chain (I4, I9, I11). RESUME_STARTED
(a,h) to (a,h), a is not Res A re-attach or join request with a bad signature or unknown key, a consumed, expired or unknown nonce, a prefix the chain does not contain, or a reported 0-RTT replay (I4, I8, I9, I11). RESUME_REJECTED; no state change
(Att,h) to (Att,h) A re-attach request that is authentic (I11) but is made while the session is attached: join is the only way into an attached session. RESUME_REJECTED with reason already_attached; no state change; the nonce is spent
(Res,h) to (Res,h) Any further request while one is being verified. RESUME_REJECTED with reason resume_in_progress; no state change
(Res,h) to (Att,h) Hash-chain verification succeeds. RESUME_VERIFIED; then the queue drains (rule D)
(Res,h) to (Det,h) The re-attaching client disconnects during verification. DETACHMENT, RESUME_PREPARED
(Res,h) to (Res,h), quarantined Hash-chain verification fails (I5). RESUME_FAILED; no cell change; the session is quarantined (rule Q)
(Det,h) to the terminated cell T_detach is exceeded, or the time spent detached over all episodes has reached T_total. DETACH_TIMEOUT, TERMINATION
(a,Pend) to the terminated cell T_human is exceeded. HUMAN_TIMEOUT, TERMINATION
(a,h) to the terminated cell Clean session end or abort. TERMINATION
(a,h) to (Det,h) Bridge restart and recovery succeeds (Section 4.6). BRIDGE_RECOVERED, DETACHMENT, RESUME_PREPARED
(a,h) to (a,h), quarantined Bridge restart and recovery fails (Section 4.6). RECOVERY_FAILED; no cell change; the session is quarantined (rule Q)

4.2. Rules

4.2.1. Rule D: queue drain

Queued tool calls MUST drain, in arrival order, whenever the session is in (Att, None) with a non-empty queue: on HUMAN_RESOLVED while attached, or on RESUME_VERIFIED when no escalation is outstanding. A human who resolves while the client is detached or re-attaching leaves the queue in place; it drains when the client is back. This is the conservative reading: the bridge cannot know that a queued call is independent of the client. Each call MUST be re-validated at drain against the current scope, its own lifetime and approval (I13) and its answer (I14). A call that fails re-validation MUST NOT be forwarded.

4.2.2. Forwarding acknowledgement

A drained call passes through stages that the log records separately:

  • committed: TOOL_CALL_DRAINED is durable (I12);

  • delivered: the runtime acknowledges receipt (TOOL_CALL_DELIVERED);

  • completed: the runtime reports the result (TOOL_CALL_COMPLETED).

The bridge MUST forward a call only after its drain is committed, so a crash can leave a call committed but not delivered. Such a call is unacknowledged. Whenever the session is in (Att, None) and the current bridge instance has not yet forwarded an unacknowledged call, the bridge MUST forward it again with the same idempotency key (I13), without a second drain event. A call that is delivered MUST NOT be forwarded again. Delivery is therefore at-least-once with deduplication by the runtime; exactly-once execution is the runtime's responsibility.

4.2.3. Calls outside an escalation: conformance profiles

Rule D and I2 govern calls that arrive while h is Pend. A call that arrives with h equal to None while a is not Att has no escalation to wait for. The deployment chooses one conformance profile, by configuration, the same for every session of the deployment. The deployment MUST document which profile it uses and, for the forward profile, which operator role may configure the forward allowlist.

refuse:

The bridge refuses the call: it is not queued, not forwarded and not recorded as a queued call, and the error reaches the runtime. Every conformant bridge MUST implement this profile, and it is the default if the deployment does not name one. Every other statement in this section assumes this profile unless it says otherwise.

queue:

Optional. The bridge queues the call (TOOL_CALL_QUEUED with held set). It is held until a human answers it (I14) and the session is in (Att, None), and is then forwarded under rule D. A held call that is still unanswered at drain is not rejected as unanswered; it waits and expires after T_call (I13). Held calls do not depend on an escalation, so T_approve does not apply to them.

forward:

Optional. The operator lists permissions that may run without the client. A call whose permission is on that list and in the current scope is recorded as queued, answered (with source operator_policy) and drained in one committed batch, and forwarded after the batch is durable (I12). Any other call is refused as under refuse.

No profile changes I2: while h is Pend, every call is queued or rejected under rule D, whatever the profile. The forward profile is the operator-defined exception to rule D that a deployment opts into; the bridge cannot tell on its own which calls are client-independent.

4.2.4. Rule Q: quarantine

A session whose log cannot be vouched for is quarantined, not terminated. This applies when the hash chain fails to verify after a re-attach was accepted (RESUME_FAILED), and when recovery after a restart finds the chain broken (RECOVERY_FAILED). The cause is the storage or an attacker on it, not the client, so ending the session would punish the wrong party and destroy the evidence.

The bridge MUST record the failure if it can still append. It MUST NOT emit TERMINATION. It MUST then refuse every client operation on the session (attach, join, challenge, escalation, tool call, authority change), run no timer on it and emit no further event for it, except an operator's explicit termination (TERMINATION). The event log MUST be preserved read-only for forensic review: the bridge MUST NOT append, truncate or rewrite any record of a quarantined session, except the failure event that this rule itself permits and any later TERMINATION the operator issues.

The session keeps the cell it had; quarantine is not a cell. A restart does not lift it: the failure event is in the log, and if it could not be appended, recovery finds the broken chain again. Release from quarantine is an operator action outside this document; the only action this document permits on a quarantined session is operator TERMINATION. Chain verification follows authentication (I11), so a presenter without a registered key cannot cause a quarantine. Quarantine is defence in depth for a violated assumption A1 (see Section 4.3); the guarantees of this document rest on A1 and do not include quarantine. An operator key addition is refused on a quarantined session (quarantined), and no CHECKPOINT is appended to one.

4.3. Assumptions

The guarantees of this document hold under the following assumptions. An implementation operating in violation of one of them is outside this specification.

A1, reliable storage:

A record that has been committed under I12 is not lost, reordered or mutated by the storage medium or by the bridge itself. Mid-log tampering is detected by I5; truncation or rewriting of the last events is not, without a head held outside the log.

A2, monotonic sequence by construction:

The bridge's sequence-number generator returns a strictly increasing value on each call, including across restarts (it is recovered from the log). Acceptance of client-claimed sequence numbers is governed by I4.

A3, cryptographic primitives:

SHA-256 is collision resistant under the assumed adversary; prev_hash chaining and the prefix check of I4 rely on this. The signature scheme of I11 is existentially unforgeable. Nonces are drawn from a cryptographically secure source.

A4, trusted bridge:

The bridge is not Byzantine: it does not deliberately suppress governance events, forge events or lie about its state. Mitigations for a Byzantine bridge are deployment-level (for example external transparency logs).

A5, serialised emission per session:

Concurrent event emission for one session is serialised by the bridge. Concurrent sessions are independent.

A6, clocks:

While the bridge runs, timeouts use a monotonic clock; wall-clock skew does not affect them. Across a restart, elapsed time is taken from the timestamps of committed events, so a timeout may fire late by at most the wall-clock error of the host. A host clock that reads earlier than the last committed timestamp is treated as reading that timestamp: no time is counted until the clock passes it, and committed timestamps never decrease. Downtime counts toward T_human, which is measured from the original HUMAN_PENDING, and toward T_total, but not toward T_detach, which restarts at the recovered detachment. The timeout check is eventually invoked (fair scheduling).

A7, key custody:

The private keys of registered clients are not disclosed to the adversary, and the registry of client public keys survives restarts (it is rebuilt from the log, I12). Compromise of a client key is handled by operator-signed revocation (I11-REVOKE): after revocation the key is no longer accepted for re-attach or join. Soft revocation (reason rotation) keeps active connections; hard revocation (reason compromise) removes the key from the client set and detaches the session if it was the last connected client. When all keys are revoked the session enters key_exhausted, not rule Q; the operator can add a new key or terminate, and otherwise a detached session ends at the detachment bound. Until revocation, a lost device stays authorised until the session ends, which with long timers can be days.

4.4. Deployment requirements

The assumptions state what this document takes from the bridge and the storage. A conformant deployment MUST additionally provide the following.

Append-only storage:

A storage medium that, once a record is committed under I12, does not lose, reorder or mutate it (A1). Truncation of the tail is detected only against a head held outside the log and, where required, by I-SIGN-EVENT and I-CHECKPOINT.

Trusted bridge:

A non-Byzantine bridge (A4).

Client-key custody:

The principal holds the private keys of every registered client key (A7), and the operator can revoke a lost or compromised key (I11-REVOKE).

Human-resolution and answer channel:

An authenticated channel for HUMAN_RESOLVED, TOOL_CALL_ANSWERED and a clean end of session. The deployment MUST document who may emit them and under which key. The channel itself is not specified here; the bridge trusts whatever the deployment feeds it.

Runtime idempotency contract:

The runtime deduplicates forwarded calls by idempotency key, with the session as the key scope. The deployment MUST state a retention bound for spent keys. A second submission of the same key with different content MUST be rejected while the first call is queued (I13, reason duplicate_key). For a key already spent, the same rejection SHOULD hold within the retention bound; beyond that bound this document states no requirement. TOOL_CALL_DELIVERED means receipt, not execution; exactly-once external effects are not guaranteed.

Runtime routes execution and authority through the bridge:

Where the deployment wants the bridge to enforce authority rather than observe it, the runtime MUST route every authority change and every tool-call submission through the bridge. Execution the bridge does not mediate is outside this document.

Log access authorisation and retention:

The deployment MUST document who may read the event log and the replay, and the bridge MUST enforce a retention bound after which the log is archived or destroyed.

Principal identity:

The deployment MUST document how the principal identity is established and by which authority.

4.5. Timers

4.5.1. The timers

The state machine depends on the following timers. Each is a duration configured by the deployment.

T_detach:

Starts at the DETACHMENT that begins a detachment; later events while detached do not restart it. It is stopped while a is Res; a return from Res to Det is a new DETACHMENT and starts a fresh interval. A bridge restart while detached also starts a fresh interval (recovery rule 2, Section 4.6). On expiry the bridge emits DETACH_TIMEOUT and TERMINATION.

T_total:

A cumulative cap on the time the session spends in cells with a equal to Det, summed over every detachment. It is computed from committed event timestamps and MUST NOT exist only as an in-memory timer. It is never reset. Time with a equal to Res or Att is not counted; bridge downtime while detached is counted. On expiry the bridge emits DETACH_TIMEOUT and TERMINATION, with reason detach_total_timeout.

T_human:

Starts at the first HUMAN_PENDING of the current escalation; a second escalation while one is pending does not restart it. It runs while h is Pend and stops when h is None. Bridge downtime while h is Pend counts toward it, and an elapsed timeout is applied after recovery. On expiry the bridge emits HUMAN_TIMEOUT and then TERMINATION.

T_call:

Starts at the TOOL_CALL_QUEUED event of the call. It is not paused, and expires even if the queue is held under the queue profile. The call is removed on expiry, the bridge emits TOOL_CALL_EXPIRED, and the call MUST NOT be forwarded. A call whose T_call elapsed during downtime is expired at recovery.

T_approve:

Starts at the HUMAN_RESOLVED event of the escalation. It is not paused and runs while the client is away. An approval that lapses is void at the next drain, and the bridge emits TOOL_CALL_EXPIRED for every call of the lapsed escalation. The expiry is recorded per call when the approval is given, so a later approval does not revive a lapsed one. T_approve is a freshness bound on an approval, not a liveness bound on the session, and is deliberately independent of the other timers. A deployment that wants approvals to outlive a detachment raises T_approve and accepts the weaker freshness.

T_nonce:

Starts when the bridge issues a challenge and returns a nonce. It uses the bridge's own monotonic clock and is not paused. The nonce is volatile and is void after a restart; the client requests a fresh challenge. A nonce used after expiry is rejected with RESUME_REJECTED and reason nonce_expired.

Applicability of T_detach and T_human to each cell:

Table 3: Timer applicability by cell
Cell T_detach T_human
(Att,None) not running not running
(Att,Pend) not running running
(Det,None) running not running
(Det,Pend) running running
(Res,None) stopped not running
(Res,Pend) stopped running

4.5.2. Constraints and profiles

The timers MUST satisfy:

T_call <= T_human        and        T_detach <= T_total

T_human defaults to T_detach, T_call defaults to T_human, and T_total defaults to four times T_detach. T_approve and T_nonce have independent defaults. The condition T_call <= T_human is a configuration simplification: a call may not outlive the longest wait the session tolerates (under the queue profile a held call has no escalation, but is bounded the same way). A cap below a single detachment would be useless. T_human <= T_detach is a recommendation that the profiles follow, not a bound: it constrains a session only where the client is away, and there the detach timer enforces it without help. With the client attached, an escalation MAY wait longer than T_detach if the deployment sets T_human so. When the client then detaches, the wait is bounded by the time that remains of T_human and by T_detach from the detachment, whichever ends first.

Operators MAY set the timers to any non-negative values that satisfy the bounds. The default values below are informative. The value 0 is degenerate: a nonce expires on issue and a detachment ends at once.

Table 4: Timer profiles
Profile T_detach T_human T_call T_total T_approve T_nonce
interactive-short (default) 30 min 30 min 30 min 2 h 15 min 60 s
persistent 7 days 7 days 7 days 28 days 15 min 60 s

In the persistent profile, an approval given while the client is away still expires after T_approve and the call is rejected at drain, so the agent must ask again.

With T_detach equal to 0, on entry to a cell with a equal to Det the bridge MUST still emit DETACHMENT and RESUME_PREPARED (I1) before it transitions to the terminated cell with DETACH_TIMEOUT and TERMINATION.

In (Det, Pend) both T_detach and T_human run, and whichever fires first terminates the session; T_total runs in the same cells and ends the session if it is reached first. A deployment that must wait on a human for longer while the client is away MUST raise T_detach and T_total accordingly.

4.5.3. Simultaneous expiry

If T_human and T_detach expire in the same tick in (Det, Pend), the bridge MUST:

  1. emit HUMAN_TIMEOUT;

  2. emit DETACH_TIMEOUT, to keep the audit record complete;

  3. emit TERMINATION with the reason human_timeout+detach_timeout (simultaneous);

  4. transition to the terminated cell.

The order of steps 1 and 2 is not significant; both MUST be emitted before step 3. Naming human_timeout first in the reason is a default priority rule: the human escalation is the more salient event for audit consumers. The bridge SHOULD apply this default consistently across simultaneous timeouts. Operators MAY override the priority by configuration (for example to prefer detach_timeout); an override is a deployment configuration, not a violation.

4.5.4. Timer and request in the same tick

If a timer expires in the same tick as an incoming request that would move the session out of the timed cell (for example T_detach expiring in the same tick as a re-attach request that names a valid prefix), the bridge MUST process the request first. If the request succeeds (for example RESUME_STARTED), the timer no longer applies to the new cell and is not fired. If the request fails (for example RESUME_REJECTED), the timer fires in the same tick and the session transitions accordingly. A timer that expires in the tick of a re-attach or a join waits for the request; one that expired in an earlier tick has ended the session, and the request is refused uniformly.

4.5.5. Duplicate idempotency key

A second tool call submitted with an idempotency key that is already queued MUST NOT be queued, whether its content matches the first submission or differs from it. The caller is answered with the reason duplicate_key. The queued record is returned, the first submission's content and hash are retained, and the second is discarded and commits no event.

4.6. Bridge Restart and Recovery

When the bridge process restarts with live sessions, it MUST recover each session from its durable event log (I12) before accepting any client message for it. The rules are:

  1. Replay. Read the committed log from genesis, or from the latest verified checkpoint (I-CHECKPOINT), verify the hash chain (I5), and rebuild the cell, the scope and scope_version, the registry of client keys, the tool queue, the idempotency keys and the timer anchors. A trailing record that is not fully durable is discarded; by I12 it has no externally visible effect.

  2. Transports are gone. Every client transport was lost with the process, so every recovered active session has an empty client set and a equal to Det. The registered keys K are rebuilt from the log, with the scheme tag and public key each event records, and the key registry in storage is repaired from them. The log is the source of truth: a key missing from the registry is written back, an entry the log does not record (a crash between the registry write and the event commit can leave one) is dropped, and an entry whose scheme or public key differs from the log is replaced. BRIDGE_RECOVERED names the key ids that were repaired. The bridge MUST emit BRIDGE_RECOVERED, then DETACHMENT with reason bridge_restart, then RESUME_PREPARED (the resume record of the new detachment), before the cell changes. T_detach restarts at the new DETACHMENT; T_total does not, so a restart while detached continues the away interval, downtime included. Challenge nonces are volatile and are void after a restart; a client that holds one requests another (I11).

  3. Elapsed timeouts. T_human is measured from the original HUMAN_PENDING (A6). If it has already elapsed, the bridge MUST terminate the session after recovery with HUMAN_TIMEOUT and TERMINATION. Likewise, if T_total has already been reached, downtime included, the bridge MUST terminate the session after recovery with DETACH_TIMEOUT and TERMINATION. T_detach itself has just restarted and cannot have elapsed.

  4. Recovery failure. If the chain does not verify, the bridge MUST NOT resume the session and MUST leave the key registry as it is. The bridge quarantines the session (rule Q): it emits RECOVERY_FAILED if it can still append, emits no TERMINATION, and leaves the session to an operator. A log that cannot be replayed at all (no ATTACHED event first, or one without the fields the session is built from) quarantines its own session in memory, appends nothing to it, and MUST NOT stop the recovery of the other sessions. A chain failure found during a re-attach is handled the same way, because the cause is the same and is not attributable to the client.

  5. In-flight tool calls. A call whose drain was committed but whose delivery the runtime did not acknowledge before the crash (TOOL_CALL_DELIVERED) MUST be forwarded again, with the same idempotency key (I13), when the session is back in (Att, None) (rule D); it MUST NOT be drained twice. A call that was queued but not drained is subject to the usual drain checks. The runtime deduplicates by key. Delivery is therefore at-least-once with deduplication, and a call that was committed as drained is never dropped silently.

Bridge availability (replication, failover to another host) is a deployment concern beyond these rules. The rules hold for any bridge instance that has the durable log and the registered client keys.

4.7. Liveness

Without timers this document gives safety but not liveness: a session could remain in a cell with a equal to Det or h equal to Pend indefinitely. The following properties hold conditionally on fair scheduling of the timer mechanism (A6). A scheduler that postponed the timeout check indefinitely would violate liveness without violating any safety invariant.

L1, bounded detachment:

For every session that enters a cell with a equal to Det, either the client re-attaches successfully (through Res to Att), or the session reaches the terminated cell within T_detach of that detachment, or it is quarantined. A key_exhausted session is no exception: its timers keep running, so unless the operator adds a key it reaches the terminated cell within T_detach as well. Over the whole session, the time spent in cells with a equal to Det, summed over all detachments and including time when the bridge was down, never exceeds T_total: once the session has used up T_total, a session with a equal to Det reaches the terminated cell even if no single detachment lasted T_detach. A re-attach does not depend on any artefact issued at detach (I4, I11), so no secondary expiry can end the session earlier.

L2, bounded human wait:

For every session that enters a cell with h equal to Pend, either the human resolves (the session moves to h equal to None), or the session reaches the terminated cell within T_human of the first escalation, or earlier if the detach timer fires first, or the session is quarantined. The human timer of a key_exhausted session keeps running. While a is Det the detach timer runs (it is stopped in Res), so a human wait never outlasts the detachment the deployment tolerates; while the client is attached the wait may be longer than T_detach if T_human is.

L1 and L2 together mean that, under fair scheduling, no active session that is not quarantined remains in a transient cell indefinitely, with the following reservations.

  • (Att, None) has no timer and is stable by design.

  • A quarantined session is frozen by rule Q until an operator acts.

  • A key_exhausted session with a client still connected on a softly revoked key has a equal to Att and no detach timer, until the transport is lost or the operator acts. Rotating the only key by soft revocation therefore leaves the session without a detach bound.

  • A re-attach cannot hold the session in Res without bound, because a client disconnect during verification returns it to Det and verification itself is a finite computation over the log. A re-attach that is started and abandoned repeatedly is a limit of this bound: time in Res and Att is not counted by T_total, so T_total does not bound such a cycle.

  • A revocation of the only key while it is being verified, soft or hard, abandons the verification and returns the session to Det, where the detach timer runs.

The terminated cell is the only cell in which a session may persist without bound, apart from the stable and frozen cases above.

5. Conformance Invariants

This section defines the set C of Conformance Criteria. An implementation conforms to this specification when it satisfies every invariant below whose requirement level is MUST. The invariants are stated over the product state machine of Section 4: a cell is a pair of an attachment value (Att, Det, Res) and a human value (None, Pend), the terminated cell is the terminal cell, and the side predicates quarantined and key_exhausted are defined over the committed log. Event names are those of the Mandatory Governance Events. Reason strings are those of the wire format (Section 6).

An event is committed when it is durable on the storage medium the deployment relies on (for example after an fsync or an equivalent barrier; see Section 5.13). "Canonical JSON" means JSON canonicalised as specified in [RFC8785]. A hash of an object is the SHA-256 of its canonical JSON.

The core invariants are I1 to I7. The extended invariants are I8 to I15, the key lifecycle extension I11-REVOKE, the authorisation invariant I-GRANT, the operator invariant I-OPERATOR and the signing invariant I-SIGN-JWKS. I-SIGN-EVENT and I-CHECKPOINT are SHOULD-level.

5.1. I1: Resume Preparedness

For every transition into a cell with attachment Det that is caused by a disconnect (of the last connected client from a cell with attachment Att, or of the re-attaching client from a cell with attachment Res), the bridge MUST emit DETACHMENT followed by RESUME_PREPARED before the cell changes.

5.2. I2: Tool Call Suspension

While the human dimension is Pend, every tool call that the runtime submits to the bridge for approval or forwarding MUST be either queued (with TOOL_CALL_QUEUED emitted) or rejected. The bridge MUST NOT forward any tool call to the agent runtime for execution while the human dimension is Pend.

Tool calls that the runtime initiated before HUMAN_PENDING are not retracted; their completion is audited as TOOL_CALL_COMPLETED. This invariant covers what the runtime submits to the bridge. Execution that the bridge does not mediate is outside the contract.

5.3. I3: Authority Lock

In every cell, any attempt to widen the authority scope (any proposed scope that contains a permission the current scope lacks) MUST be rejected and MUST emit AUTHORITY_EXTENSION_REJECTED. The scope the bridge holds MUST remain unchanged. The scope of a session can only narrow (Section 5.10). Widening requires a new attach with a freshly granted scope, which is a new session. A tool call submitted while the session is in (Att, None) with no human decision pending, whose permission is not in the current scope, MUST be refused with the reason scope and recorded as TOOL_CALL_REJECTED with direct set; a call inside the scope is forwarded.

The invariant has an enforced part and an observed part:

Enforced:

A change requested through the bridge MUST be refused before it takes effect.

Observed:

A change that the runtime announces itself (for example an agent that switches its own mode) has already happened when the bridge learns of it. The bridge MUST emit AUTHORITY_EXTENSION_REJECTED with source observed and MUST keep its record of the scope unchanged. The bridge SHOULD instruct the runtime to revert to the recorded scope. The invariant does not claim that the bridge prevents a runtime-initiated widening, only that the bridge never records one as granted and always reports it.

5.4. I4: Prefix Consistency

A re-attach or join request carries the pair (seq, hash) of the last event the client acknowledged, taken from the event stream the client observed and not from any artefact issued at detach. The bridge MUST accept the request only if seq does not exceed the sequence number of the last committed event and hash equals the hash of the event with sequence number seq in the bridge's chain. In other words, the client's history MUST be a prefix of the bridge's chain.

Any other pair (a different hash at that sequence, or a sequence the chain has not reached) MUST be rejected with RESUME_REJECTED (reason prefix_mismatch). Rejection MUST leave the session in its current cell and MUST NOT terminate the session.

On acceptance the bridge MUST deliver every committed event after seq to the re-attaching or joining client, including events that changed the authority scope or the human dimension while the client was away. The client reconciles its view from this replay.

5.5. I5: Hash Chain Integrity

Every Governance Event MUST carry a prev_hash field equal to the SHA-256 of the canonical JSON of the immediately preceding event in the same session. The prev_hash of the genesis event MUST be the empty string.

The chain detects an insertion, deletion, rewrite or reordering of events in the middle of the log. It does not detect the removal or rewrite of the last events: a log cut back to an earlier event, or whose final event is replaced, is again a valid chain. Detecting that requires the head (sequence and hash) to be committed outside the log, as a checkpoint anchor does (Section 5.21).

5.6. I6: Terminality

The terminated cell is terminal. Any operation that would mutate state after TERMINATION MUST raise an error. This covers every operation, including attach, disconnect, join, adding a client key, escalation, re-attach, tool call submission, an attempt to extend authority, narrowing, human resolution, a tool-call answer and the operator's key operations.

On TERMINATION the following effects are normative:

  • The tool-call queue MUST be discarded; queued calls MUST NOT be forwarded. The runtime MUST be notified that the session is terminated and SHOULD clean up in-flight work.

  • In-flight tool calls (calls forwarded before termination whose TOOL_CALL_COMPLETED was not emitted) are not tracked further; their disposition is the runtime's responsibility.

  • No timer runs on a terminated session, no further event is emitted for it and no client operation is accepted.

  • The event log MUST be retained for audit. The deployment SHOULD apply its retention policy.

5.7. I7: Event-before-Mutation

For every transition, the corresponding governance events MUST be emitted and appended to the event log before the cell is changed. The audit trail therefore records the intent to transition before the transition takes effect. Together with Section 5.13 this ordering survives a bridge crash.

5.8. I8: QUIC 0-RTT Replay Rejection

The bridge MUST NOT accept a client re-attach whose underlying transport is a replayed QUIC 0-RTT session. Replay identification is the transport layer's job: [AGTP-SESSION] forbids establishing a session in 0-RTT data, and [AGTP-BINDINGS] restricts early data to safe idempotent methods. The bridge MUST honour the transport's replay verdict: if the transport reports a replay, the bridge MUST reject the re-attach with RESUME_REJECTED.

This invariant is conditioned on the transport. In a deployment that does not use QUIC 0-RTT it is vacuous.

5.9. I9: Challenge Nonce Lifetime

A challenge nonce (Section 5.11) is valid for T_nonce after the bridge issued it, measured on the bridge's monotonic clock. A re-attach that presents a nonce older than T_nonce MUST be rejected with RESUME_REJECTED (reason nonce_expired). The rejection MUST NOT change the cell and MUST NOT terminate the session: only a timeout (T_detach, T_total or, while an escalation is pending, T_human) ends a detached session.

The default of T_nonce is 60 seconds. It is configurable per deployment.

The challenge is minted when the client asks for it, not at detach, so its lifetime can be short without ever stranding a client that vanished abruptly. T_nonce bounds the window in which a captured nonce and signature could be replayed, and nothing else.

5.10. I10: Authority Scope Versioning

The session's authority scope carries a monotonically increasing scope_version counter, in every cell. The counter starts at 0 at attach and is incremented on each successful narrowing, that is, each AUTHORITY_NARROWED event.

Each AUTHORITY_NARROWED event MUST include new_version equal to the previous version plus 1, and a scope that is a strict subset of the current scope. A duplicate or out-of-order narrowing, or one whose proposed scope equals the current scope, MUST be rejected with AUTHORITY_NARROWING_REJECTED.

A proposal that is not a strict subset of the current scope is rejected. If it contains any permission the current scope lacks, including a partial overlap that also drops permissions, it is an extension and is governed by Section 5.3: it MUST be rejected with AUTHORITY_EXTENSION_REJECTED.

A scope change that happened while a client was away is not a reason to refuse that client's re-attach. It is part of the replay that Section 5.4 requires, and the client reconciles to the new scope.

Together with Section 5.3 this makes the authority of a session non-increasing for its entire life, and gives auditors a monotonic history of scope changes.

5.11. I11: Authenticated Single-Use Challenge

Re-attach and join are authenticated by a challenge-response over a registered client key. The following requirements apply.

(a) Key binding:

The client registers a public key at attach. The key is recorded, with its scheme tag, in the genesis ATTACHED event and is bound to the principal identifier (Owner-ID).

(b) Challenge:

To re-attach, the client first requests a challenge. The bridge MUST return a fresh nonce of at least 128 bits from a cryptographically secure source, bound to the session and to the key identifier the client names, valid for T_nonce (Section 5.9) and usable once. The record of the nonce MUST hold the key identifier and whether the key was a registered, unrevoked key of the session when the nonce was issued. The answer to a challenge MUST be the same for every key identifier, registered or not: a nonce of the same form and lifetime, counted against the same limit (f). No answer to a challenge may depend on the registry. A nonce issued for a key that was not registered at issue MUST NOT verify, however the registry changes later, and a nonce presented with another key identifier than the one it was issued for MUST NOT verify either; both are answered as a request whose signature does not verify (bad_signature), recorded as nonce_binding, and the nonce is not spent. Issuing a challenge is not a governance event and MUST NOT change state. The bridge SHOULD return a uniform rejection to unauthenticated callers (for example for an unknown session identifier), so that the challenge operation does not confirm the existence or lifecycle state of a session. Nonces are not durable across a restart.

(c) Proof of possession:

The re-attach request carries (nonce, seq, hash) and a signature, under a registered client key, over the domain-separated tuple defined in the signature-scope section of Section 6. The tuple binds the operation (re-attach or join), the session, the key identifier, the nonce and the prefix. The request is authentic if and only if the signature verifies for the operation received. A request that names a key identifier the session does not register MUST be answered as a request whose signature does not verify (reason bad_signature), so that the answer does not list the registered key identifiers; the log records unknown_key.

(d) Single use:

A nonce MUST be consumed by the first authentic request that presents it, whether that request is then accepted or rejected for a later reason. A consumed nonce MUST NOT be accepted again. A request that is not authentic MUST NOT consume the nonce. A request refused with resume_in_progress or already_attached (a re-attach on an attached session) or not_attached (a join on a detached one) is authentic and therefore spends its nonce; a second device that meets a re-attach in progress asks for a new challenge. These reasons MUST be given only after the key, the signature, the revocation, the binding of the nonce and the nonce have passed, so that none of them tells an unauthenticated caller anything about the attachment. A request that was presented and refused MUST NOT be accepted later, whoever presents it again and whatever the registry has become in between.

(e) No state-changing rejection:

A request that fails (c), (d), Section 5.9, Section 5.8, I11-REVOKE (Section 5.12) or Section 5.4 MUST be answered with RESUME_REJECTED and MUST NOT change the cell. Through the re-attach path, only a failure of hash-chain verification after acceptance (RESUME_FAILED), which quarantines the session, or a timeout, which terminates it, changes the standing of the session.

(f) Bounded issue, no eviction:

The bridge MUST keep at most a fixed limit of live nonces per session, where live means unspent and unexpired (the reference bridges use 16). Issuing a challenge MUST NOT invalidate a live nonce: when the limit is reached the bridge MUST discard spent and expired records to make room and, if none exists, MUST refuse the challenge. A nonce a genuine client already holds therefore stays valid whatever other callers request. The refusal reveals only that the session cannot issue a nonce now; the rejection of a re-attach request is unchanged (the uniform rejection of (b)).

(g) Bounded logging of unauthenticated failures:

A failure before authentication (transport_replay, unknown_key, nonce_binding, bad_signature) MUST be recorded as RESUME_REJECTED only until the session has recorded a fixed limit of such failures since its last authentic request (the reference bridges use 16). Further ones MUST be refused in the same way and not recorded. A request whose signature verifies restores the allowance, and every failure of such a request MUST be recorded. The limit is held in memory, so a restart restores it.

The verifier MUST check in this order: key and signature; then revocation (Section 5.12); then the binding of the nonce to the key and to the registry at issue; then the nonce (unknown, consumed, expired); then the prefix (Section 5.4); and only then what depends on the state of the session (an attachment in progress, an attached or a detached session). An unauthenticated party then learns nothing about the state of nonces, of the chain or of the attachment beyond a rejection.

Knowing the session identifier is not enough to re-attach, and a captured request cannot be replayed: one that was accepted has spent its nonce, an unspent nonce expires after T_nonce, and a request refused before its key was registered cannot become acceptable by a later registration, because a nonce issued for a key that was not registered never verifies. A rejected request does not change the cell, so a party without a key cannot terminate a session by presenting bad requests.

Relayed requests:

The signed message of a re-attach covers the operation, the session, the key, the nonce and the prefix, and no identifier of the transport channel. A party that relays a genuine client's signature, obtained for a nonce the bridge issued, is therefore not distinguishable from the client at the contract level. Protection rests on the client signing only nonces it requested from the bridge it means to reach, and on the transport authenticating the bridge to the client. A deployment that needs more can bind the signature to a channel identifier (for example a TLS exporter value); this document does not specify that binding.

Theft of a client key is out of scope.

5.12. I11-REVOKE: Key Lifecycle

This extension to Section 5.11 is normative.

5.12.1. Revoked keys are refused

A key that has been revoked (recorded in the log by KEY_REVOKED) MUST NOT be accepted for re-attach or join, even if its signature verifies. The rejection MUST be RESUME_REJECTED (reason revoked_key). The cell MUST NOT change and the nonce MUST be spent (rule (d) of Section 5.11). The verifier MUST check revocation after key and signature verification and before the nonce check. Spending the nonce is deliberate: leaving it live on a revoked-key attempt would tell the holder of a revoked key that the nonce is still outstanding.

5.12.2. Operator-signed key operations

Revocation is operator-signed. The KEY_REVOKED event carries a signature under the operator key, and the bridge MUST verify it before committing the event; if it does not verify the bridge MUST refuse with reason operator_signature_invalid and commit nothing. A client MAY request revocation (KEY_REVOCATION_REQUESTED, informational), but only a revocation with a verifying operator signature is executed. See Section 5.18 for the signed messages and for the same rule on OPERATOR_ADD_KEY and OPERATOR_TERMINATION.

5.12.3. Soft and hard revocation

The reason field of KEY_REVOKED distinguishes the two forms:

rotation (soft):

The key is revoked for new re-attach and join. Connections already attached with this key MUST NOT be disconnected, and the key stays in the client set until its transport leaves (Section 5.16). This form is used for rotation: CLIENT_ADDED, an overlap, then KEY_REVOKED.

compromise (hard):

The key is revoked for all purposes. A connection using this key MUST leave the client set at once. If it was the only connected client, or the key whose re-attach was being verified, the session MUST be forcibly detached (DETACHMENT followed by RESUME_PREPARED).

Revoked keys remain in the key registry of the session with revoked_at and reason markers and MUST NOT be deleted. A key never returns from the revoked state to the active state.

5.12.4. Key exhaustion

When the last active (unrevoked) key in the session's key registry is revoked, the session is key_exhausted. This is a side predicate on the session, not a cell of the product machine, and it is not quarantine. The session keeps its current cell. While key_exhausted holds:

  • the bridge MUST accept no client operation;

  • the timers T_detach, T_human and T_total MUST keep running, as in any other session; a restart treats the session as any other (it is recovered as detached and T_detach restarts), and the loss of a client's transport detaches it;

  • only these operations are permitted: OPERATOR_ADD_KEY, which adds a new key and clears key_exhausted, and OPERATOR_TERMINATION, which transitions to the terminated cell;

  • a termination without the operator's signature (the unsigned terminate operation of the transport binding) MUST be refused and commit nothing. A quarantined session is still ended by it.

Unless the operator adds a key, an exhausted session that is detached terminates after the detachment bound (T_detach of the detachment, or T_total). Once the session has terminated, adding a key or terminating it changes nothing.

Key exhaustion differs from quarantine. Quarantine is for storage corruption; key exhaustion is a deliberate action by an authorised party and has a recovery path.

5.12.5. Deployment hazard: rotating the only key

A soft revocation of the only registered key reaches key_exhausted just as a hard one does, but leaves the revoked key connected: the session stays in attachment Att, accepts no client operation and runs no detach timer. It ends only when that client's transport is lost (the session is then detached and T_detach applies) or the operator acts, so the runtime behind it may keep executing meanwhile.

The operator SHOULD rotate by adding the new key first (CLIENT_ADDED, then KEY_REVOKED of the old key), so that the registry never holds zero active keys. A hard revocation of the only key detaches the client, so the exhausted session is detached and ends by timeout unless a key is added in time.

5.12.6. Per-session key registry

Key identifiers are scoped to a session. The registry maps a session identifier and a key identifier to a key. A key identifier already registered in a session MUST NOT be registered again in it, and a second session that uses the same identifier for another key MUST NOT replace, and MUST NOT be able to use, the first session's key. The registry holds verification material (public keys) only. It is recorded in the log, and recovery MUST rebuild it from the log (Section 4).

5.13. I12: Durable Append

An event is committed when it is durable on the medium the deployment relies on. The bridge MUST NOT change the cell, forward a message to the agent runtime, or acknowledge any client request that depends on an event until that event is committed.

This invariant gives Section 5.7 its meaning in a process that can crash. The recovery rules of Section 4 depend on it.

5.14. I13: Queue Integrity and Approval Freshness

Every queued tool call carries an idempotency key, unique within the session, which MUST be forwarded to the runtime with the call. The key is supplied by the runtime when it can and is generated by the bridge otherwise. A call that is forwarded again after a restart MUST reuse the key it was queued with.

The queue has a maximum size Q_max (default 64) and each queued call has a lifetime T_call (default T_human). T_call MUST NOT exceed T_human. Then:

  • A call arriving at a full queue MUST be rejected with TOOL_CALL_REJECTED.

  • A call whose key is already queued MUST NOT be queued twice.

  • An expired call MUST be removed with TOOL_CALL_EXPIRED.

  • A human approval (HUMAN_RESOLVED) is valid for T_approve (default 15 minutes) from its emission, strictly before it has elapsed. The expiry is recorded for each call queued under the escalation when the approval is given, and a later approval does not extend it. A call held under the detached-call policy (the queue profile) has no escalation approval and relies on its own answer (Section 5.15) and T_call.

  • When the queue drains, every call MUST be re-validated against the current authority scope, its approval and its answer (Section 5.15). A call that requires a permission the scope no longer contains MUST NOT be forwarded and is audited with TOOL_CALL_REJECTED. A call whose approval has expired MUST NOT be forwarded and is audited with TOOL_CALL_EXPIRED.

A call rejected at drain is not retried; the agent has to re-escalate. This prevents a long detach from replaying stale or over-privileged side effects.

5.15. I14: Answer Binding

Let h(x) be the SHA-256 of the canonical JSON of x. Every queued tool call MUST record h_q = h({tool, permission, content}) in TOOL_CALL_QUEUED, where content is what the human is shown to decide on that call (arguments and any explanation), taken as null when the runtime supplies none. The tool name and the permission MUST be hashed in every case, so that the hash does not depend on what the runtime chose to put in content. The event MUST retain the tool, the permission and the content as hashed.

A human decision on a call MUST be recorded as TOOL_CALL_ANSWERED, carrying the call's key, the decision (approve or deny) and h_a, the hash of the call (tool, permission and content) that the human's client displayed when the human decided. The first answer to a call is final; a second answer MUST be refused.

When the queue drains, a call MUST be forwarded only if it has an approving answer with h_a equal to h_q. The request the bridge forwards MUST be the tool, permission and content hashed at queue time, taken from the retained record: the bridge MUST NOT synthesise, substitute or alter the call between queue and forward. Otherwise the call MUST NOT be forwarded and MUST be audited with TOOL_CALL_REJECTED and the reason unanswered, denied or answer_mismatch. The TOOL_CALL_DRAINED event MUST repeat h_q together with the retained tool, permission and content, so that a forward repeated after a restart sends the same request.

The approval of Section 5.14 says that an escalation is over and how long answers stay fresh; this invariant says what each answer was an answer to. A drain needs both: a call is forwarded only if its own answer matches and the approval of its escalation has not lapsed. An approval given while a client is away is void T_approve after the human gave it, so a client that returns later finds the call expired (approval_ttl) and the agent has to re-escalate.

This invariant protects against content drift by an honest client whose rendering differs from what the bridge recorded. It does not protect against a malicious client that reports whatever hash it was given, and it does not say that the content faithfully describes the action the runtime will perform.

5.16. I15: Client Set Coherence

The session has a set of registered client keys and a client set: the registered keys that currently have a connected transport. A client is identified by its key.

(a) Derivation:

The client set is a subset of the registered keys. The attachment is a function of the client set: Att if and only if at least one client is connected (outside a verification in progress).

(b) Departure:

The transport disconnect of a client while two or more clients are connected MUST emit CLIENT_LEFT, and MUST NOT change the cell, MUST NOT emit DETACHMENT and MUST NOT start T_detach. Only the departure of the last connected client detaches the session (Section 5.1).

(c) Joining:

After attach (whose key is the first member of the client set), a key enters the client set only through an authentic request that passes Section 5.9, Section 5.11 and Section 5.4: a join while the attachment is Att, or a re-attach while it is Det. A re-attach request while the attachment is Att MUST be refused with already_attached, so that a proof made for a re-attach never causes a join. A key that is not registered MUST NOT be accepted.

(d) Registration:

A key enters the registry only at attach, through CLIENT_ADDED, or through the operator-signed OPERATOR_ADD_KEY (on a key_exhausted session, in any cell). CLIENT_ADDED MUST be authorised by a client in the client set, by a signature under its own registered key over the new key, the session and a bridge-issued single-use nonce, under its own domain tag (Section 6). A request without such a signature, with one made for another operation, key or session, or with a spent, unknown or expired nonce MUST be refused with a named reason and commit nothing. Knowing the key identifier of a connected client is not authority. CLIENT_ADDED MUST NOT be accepted while the attachment is not Att. The new key is bound to the same Owner-ID.

(e) Revocation:

Revoked keys remain in the registry (Section 5.12). A key revoked for compromise leaves the client set at once. A key revoked for rotation stays in the client set for as long as its transport is connected and leaves it when the transport does; it cannot join or re-attach. A key enters the revoked state through KEY_REVOKED only.

The session is detached only when no key in the client set has a connected transport. A scope narrowed from one client reaches every other client through the replay of its next join or re-attach (Section 5.4).

5.17. I-GRANT: Attach Authorisation

Possession of a key is not authorisation. The initial scope at attach MUST be granted by a trusted authority outside the contract (for example an operator-signed scope grant, or an identity document that the bridge verifies). The attach request carries the grant. The grant is opaque to the contract.

The bridge MUST present the session identity, the client key and the grant to the deployment's grant verifier. The bridge MUST NOT commit ATTACHED unless the verifier accepts. A bridge with no verifier configured MUST refuse every attach with reason grant_invalid; nothing is committed and no key is registered.

The grant MUST bind, under its own domain tag, the identity of the bridge it is presented to, the session identifier, the principal, the scope, the lineage and the client key (its identifier, scheme tag and public key). A grant bound in this way cannot be replayed for another session, scope, key or bridge, and a party that sees a grant cannot attach the same session with another public key under the granted key identifier.

At attach the client also proves possession of the private key corresponding to the key it registers, by a signature with that key over the attach tuple (Section 6). A missing or invalid proof MUST be refused with reason possession_invalid; nothing is committed and no key is registered.

A client-asserted scope without a verifying grant is not a valid initial scope. Section 5.3 and Section 5.10 lock relative to the granted scope. The deployment MUST document how the principal identity is established and by which authority.

Scope is a set of opaque permission identifiers (for example read:docs, exec:shell). The subset relation used by Section 5.3 and Section 5.10 is the set-theoretic one: S' is a subset of S if and only if every permission in S' is in S. No hierarchical or semantic relationship between permissions is assumed. The canonical form of a scope is the lexicographic sort of its permission strings. A deployment whose scope has structure MUST map it to opaque identifiers so that its own order is the subset relation; a structure that cannot be mapped that way is outside this document.

5.18. I-OPERATOR: Operator Signatures

These operations change the standing of a session on the authority of the operator and not of a client: revocation of a client key (KEY_REVOKED), addition of a key to a key_exhausted session (OPERATOR_ADD_KEY) and operator termination of a key_exhausted session (OPERATOR_TERMINATION). Each MUST carry a signature under the operator key, and the bridge MUST verify it before committing the event. A missing or invalid signature, or one that covers another operation, bridge or log position, MUST be refused with reason operator_signature_invalid; nothing is committed.

The signed messages, under their domain tags, are:

["bc/v1/revoke",    bridge_id, sid, key_id, reason, seq, head]
["bc/v1/add-key",   bridge_id, sid, key_id, scheme,
                    public_key, seq, head]
["bc/v1/terminate", bridge_id, sid, reason, seq, head]

serialised as canonical JSON ([RFC8785]). bridge_id is the identity of the bridge. seq and head are the sequence number and the hash of the last committed event of the session when the operator signs. The bridge MUST verify the signature against the current last event, so that a signature verifies only while nothing has been committed after the position it names. A captured operator action therefore cannot be replayed at another bridge or later in the session's life; if the log has moved, the operator signs again.

The bridge MUST check these signatures against the operator key that verifies scope grants (Section 5.17). Which key that is, and how it is protected, is the deployment's.

5.19. I-SIGN-JWKS: JWKS Source Restriction

The bridge MUST NOT accept a JWKS endpoint learned from session-supplied metadata. The JWKS endpoint used by the bridge for event signing, or for forwarding events to an external signer, MUST be configured through an out-of-band channel bound to the operator's deployment identity. A JWKS endpoint learned from the client or from session-supplied metadata is not a trust anchor.

This requirement is a MUST because accepting a session-supplied endpoint would let a client, or an adversary, substitute a different signing key and break the trust model. It applies whatever the size of the deployment.

5.20. I-SIGN-EVENT: Event Signing

In a deployment with no external signer for governance events, the bridge SHOULD sign each emitted event with an operator key whose JWKS endpoint is published through an out-of-band channel bound to the operator's deployment identity, following the signing model of [GAR]. In a deployment where events are forwarded to an external signer, the bridge forwards unsigned events for signing and this requirement is vacuous.

This requirement is a SHOULD because event signing needs operator key management that may not be available in testing or small deployments. An operator who omits signing accepts that downstream consumers cannot verify event provenance without an out-of-band trust channel.

5.21. I-CHECKPOINT: Checkpoint Anchoring

The bridge SHOULD emit a CHECKPOINT event at least every N events (default 1000) or every T_cp (default 5 minutes), whichever comes first. The event carries the Merkle tree hash over the hashes of all preceding events of the session, the tree size, and a signature under the operator key. The bridge SHOULD submit the checkpoint to an external append-only transparency log (for example a SCITT service) and record the receipt in the event payload.

The Merkle tree hash is the one of RFC 9162, Section 2.1.1:

  • The input of leaf i is the event hash (SHA-256 of the canonical JSON of event i) as a raw 32-byte digest. The hash of a leaf is the SHA-256 of the byte 0x00 followed by that digest.

  • The hash of an interior node is the SHA-256 of the byte 0x01 followed by the hashes of its left and right children.

  • A tree of more than one leaf is split at the largest power of two smaller than the number of leaves; no last node is duplicated.

  • The root of an empty log is the SHA-256 of the empty string.

Checkpoints let an auditor detect a bridge that rewrites history after the fact, which the hash chain alone cannot, provided the receipt is anchored in an external log. Without that anchor the operator key can sign a rewritten log afresh. Checkpoints also let recovery and re-attach verify only the chain suffix after the latest verified checkpoint, so that verification cost is proportional to the length of the suffix and not of the whole log. Full-chain verification remains the fallback.

6. Client-Bridge Wire Format

This section is normative for the reference transport. A bridge that claims to speak it and emits or accepts messages in a different shape is non-conformant at the wire level, even if its committed event log and final session state agree with the contract. A binding to another transport keeps only the parts named in Section 6.1. The conformance unit remains the committed event log and the final session state (Section 4, Section 5); the wire format is what makes byte-level interoperability between bridges achievable.

The wire format is JSON [RFC8259], encoded canonically per [RFC8785] for the value types the contract uses:

A value outside that set (NaN, an infinity, an integer beyond 2^53) has no canonical form, and a bridge MUST refuse to hash or sign it. A binary encoding (for example CBOR) MAY be defined as an alternative binding, provided it preserves a canonical byte representation for signatures.

Known-answer files that fix the canonical bytes, the event and content hashes, and the signed bytes and signatures for a fixed key are published with the companion record of this document [BC-PAPER]: bytes_kat.json for the canonical forms, hashes and Ed25519 proofs, and p256_kat.json for the ECDSA P-256 bytes. An independent implementation confirms byte-level conformance by reproducing them.

6.1. What a Transport Binding Must Keep

A deployment may carry the contract in its own messages, for example inside the frames of an existing agent protocol, instead of in the envelope of Section 6.2. Such a binding is conformant at the wire level when it keeps the following parts and may change the rest.

Signature scope:

The arrays listed in the "Signature over" column of Table 5 and in Section 6.4, with their domain-separation tags and the order of their elements, are normative. A client and a bridge that sign and verify other bytes do not interoperate with a bridge that follows the known-answer files.

Reason names:

The reasons in Table 6 are the rejection vocabulary of the contract. A binding MAY wrap a reason in its own error structure, but it MUST preserve the reason name, so that a client can tell prefix_mismatch from nonce_used.

Canonical encoding of signed bytes:

What is signed is the [RFC8785] canonical JSON of the listed array, whatever encoding carries the message. A binding that does not use JSON on the wire MUST still reconstruct these bytes before it signs or verifies.

The envelope with its op, status and reason fields, the framing of one request and one response, and the op-type names belong to the reference transport only. A binding MAY map each op-type onto its own message type; the published test vectors then act as the acceptance interface at the level of events and final state, not of message shape. The requirements on unsigned ops (Section 6.4.1) apply to every binding.

6.2. Envelope

Every client-to-bridge request is a JSON object with an op field naming the op-type and a session_id field, except restart, which is bridge-level. Every bridge-to-client response is a JSON object with a status field and a session_id field. Errors use status: "rejected" and a short snake_case reason.

// client -> bridge
{"op": "<op-type>", "session_id": "<sid>", ...op-specific fields...}

// bridge -> client (success)
{"status": "<status>", "session_id": "<sid>", ...response fields...}

// bridge -> client (error)
{"status": "rejected", "session_id": "<sid>", "reason": "<reason>"}

6.3. Op-Types

Table 5 lists the op-types. The signature field, where present, is a hex-encoded signature (Ed25519 [RFC8032] or ECDSA P-256 in the reference implementations) over the canonical JSON of the array listed in the "Signature over" column. The bridge verifies signatures against the registry of client public keys (I11). A question mark after a field name marks an optional field.

Table 5: Client-bridge op-types
Op Request fields Response Signature over
attach session_id, principal, scope[], lineage[], key_id, scheme, public_key, grant, signature status: "attached", seq: 0, hash; or status: "rejected", reason ["bc/v1/attach", bridge_id, sid, principal, scope, lineage, key_id, scheme, public_key]
add_client session_id, via_key_id, new_key_id, scheme, new_public_key, nonce, signature status: "added"; or status: "rejected", reason ["bc/v1/add-client", sid, via_key_id, new_key_id, scheme, new_public_key, nonce]
challenge session_id, key_id status: "nonce", nonce, ttl_seconds none
reattach session_id, key_id, nonce, seq, hash, signature status: "verified", events[]; or status: "rejected", reason ["bc/v1/reattach", sid, key_id, nonce, seq, hash]
join as reattach; the session is attached status: "joined", events[] ["bc/v1/join", sid, key_id, nonce, seq, hash]
disconnect session_id, key_id? (absent: all), reason status: "disconnected" none
escalate session_id, trigger? status: "escalated" none
resolve session_id status: "resolved" none
submit_tool_call session_id, tool, key?, permission?, content status: "queued", or "forwarded" under the forward profile; a duplicate key or a full queue is refused through the error envelope (duplicate_key, queue_full) none
answer_tool_call session_id, key, shown_hash, decision status: "answered" none
delivered session_id, key status: "delivered" none
completed session_id, key, result_hash? status: "completed" none
narrow session_id, new_scope[] status: "narrowed" or "rejected", new_version?, reason? none
extend session_id, new_scope[], source see below none
terminate session_id, reason status: "terminated" none; refused as key_exhausted on a session without active keys
revoke session_id, key_id, reason, signature?, requested_by? status: "revoked" or "requested" operator signature (Section 6.4.3)
add_key session_id, key_id, scheme, public_key, signature status: "key_added" operator signature (Section 6.4.3)
operator_terminate session_id, reason, signature status: "terminated" operator signature (Section 6.4.3)

The response to extend depends on the request. A widening that the client asks for is answered status: "rejected", reason: "extension_rejected" (I3). A widening that the runtime announced (source: "observed") is answered status: "revert_requested"; it is recorded and is to be reverted. A subset is answered status: "unchanged". All three responses carry current_scope[], the scope in force.

The op-types tick (timer evaluation) and restart (bridge recovery) are test-harness and operator actions respectively, not client-bridge wire ops. They are carried by the operator channel, not by the wire format defined here.

6.4. Signature Scope

In every array below, sid is the session identifier, and bridge_id is the identity of the bridge that verifies the request. The bridge identity is deployment configuration known to both sides; it is not a field of the request.

These op-types carry a signature field.

attach:

The client proves that it holds the private key of the public_key it is registering. The signature is made with that key over the canonical JSON of ["bc/v1/attach", bridge_id, sid, principal, scope, lineage, key_id, scheme, public_key], where scheme is the scheme tag and public_key the hex string registered. The array has the fields of the grant (Section 6.4.2) under a different tag, so the proof and the grant cannot stand for one another. A missing proof, or one that does not verify under the presented key, MUST be answered with the reason possession_invalid; nothing is committed and no key is registered.

add_client:

The connected client, identified by via_key_id, authorises the new key. The signature is over ["bc/v1/add-client", sid, via_key_id, new_key_id, scheme, new_public_key, nonce], where nonce was issued by a challenge naming via_key_id and is spent by the first authentic presentation, so the authorisation cannot be replayed, and new_public_key is the hex string registered. The bridge verifies under the registered key of via_key_id, which MUST be connected and not revoked. The refusals are via_not_connected, bad_signature (missing, forged, or made for another operation, session or key), revoked_key, nonce_unknown, nonce_used, nonce_expired and key_already_registered. None of them commits an event, so a caller that holds no registered key writes nothing to the log.

reattach and join:

The client proves possession of a registered key and binds the request to the challenge nonce and the last event it saw. The signature is over ["bc/v1/reattach", sid, key_id, nonce, seq, hash] for reattach, or ["bc/v1/join", sid, key_id, nonce, seq, hash] for join. This is the one definition, and the other sections refer to it. The domain-separation tag ensures that a reattach and a join that sign the same underlying values produce different signatures, which prevents cross-operation replay, and the key identifier ties the proof to the identity that signs it. The bridge MUST verify against the operation it received, not one the request names, so that a proof made for the other operation is refused as bad_signature. A reattach for a session that is attached MUST be refused as already_attached, and a join for a session that is not attached MUST be refused.

The reference signature scheme is Ed25519 [RFC8032], hex-encoded. A deployment MAY use another scheme that is existentially unforgeable (A3), for example ECDSA P-256 where a client platform lacks Ed25519. The deployment's verifier then fixes the encoding of signature and public key, and the signed bytes are unchanged. The reference implementations also implement ECDSA P-256 with SHA-256 ([FIPS186]), with the public key as the 65-byte SEC1 uncompressed point ([SEC1]) and the signature in the 64-byte r || s form that WebCrypto produces. The registry records a scheme tag with each key. The registry holds verification material only, so proof of possession is checked without a signing key at the bridge.

6.4.1. Authentication of Unsigned Ops

The op-types resolve, answer_tool_call, escalate, delivered, completed, narrow, extend, disconnect, submit_tool_call and terminate do not carry a client signature in the wire format. They MUST be authenticated by the transport binding (for example TLS client certificates, mutual TLS, or a session token issued at attach). The bridge MUST verify the caller identity and MUST reject unsigned ops from unauthenticated transports.

Unauthenticated answers are a deployment risk: anyone who can speak the wire can inject a resolve or an answer_tool_call. The deployment MUST document which transport-level authentication is used and under which identity these ops are accepted.

The transport binding also carries freshness for these ops. They have no nonce or seq of their own, so the contract does not make them replay-safe on a transport that does not. Signing them is not required and is not specified: an approval is bound to the request it answers by a hash (I14), not to a signing identity, so who approved is exactly what the transport authenticated, no more.

The unsigned terminate is the exception that the bridge itself narrows. On a session without active keys it is refused (key_exhausted), and only the operator's signed termination ends the session.

6.4.2. Grant

The grant field of attach carries the scope grant that the bridge presents to the deployment's grant verifier before it commits ATTACHED (Section 3.1.1). It is an opaque string to the contract and is not covered by the client signature. It authenticates itself: it binds the bridge identity, the session identifier, the principal, the scope, the lineage and the client key (identifier, scheme tag and public key) under the domain tag "bc/v1/grant".

Binding the public key stops a party that sees a grant in transit from attaching the session under the granted key identifier with a public key of its own. Binding the bridge identity stops a grant from being replayed at another bridge.

The reference verifier takes a hex Ed25519 signature by the operator over the canonical JSON of ["bc/v1/grant", bridge_id, sid, principal, scope, lineage, key_id, scheme, public_key]. A deployment MAY use another format, such as an AGTP identity document or a mission contract. A missing grant, a grant that does not verify, or a bridge with no verifier MUST be answered with the reason grant_invalid.

6.4.3. Operator Signatures

A revocation, a key addition and a termination each carry a hex Ed25519 signature by the operator key, the key that signs scope grants. The signed bytes are the canonical JSON of the following arrays:

["bc/v1/revoke", bridge_id, sid, key_id, reason, seq, head]
["bc/v1/add-key", bridge_id, sid, key_id, scheme,
 public_key, seq, head]
["bc/v1/terminate", bridge_id, sid, reason, seq, head]

Here bridge_id is the identity of the bridge that verifies (the one the grant binds), public_key is the hex string registered, scheme is its scheme tag, and seq and head are the sequence number and the event hash of the last committed event of the session at the moment of signing.

The bridge MUST verify against its current last event, so a signature holds only while nothing has been committed after that position and only at the bridge it names. The domain tags keep these signatures, and the grant, from standing for one another. A missing signature, one that does not verify, one by another key, or one over another operation, session, bridge or log position MUST be answered with the reason operator_signature_invalid, and nothing is committed. A revocation request without a signature (KEY_REVOCATION_REQUESTED) is recorded as a request and revokes nothing.

6.5. Error Reasons

All rejections use status: "rejected" with a short snake_case reason. Table 6 lists the defined reasons.

Table 6: Error reasons
Reason Meaning
unknown_session The session_id does not name a known session.
unknown_key The key_id is not in the session's registry K(s). A re-attach or join naming such a key is recorded with this reason but answered bad_signature, so a caller learns nothing about which key identifiers a session registers (I11); revoke names it.
nonce_used The nonce has already been spent (I11d).
nonce_expired The nonce is older than T_nonce (I9).
nonce_unknown The nonce was never issued by the bridge for this session (I11b).
nonce_binding The nonce was issued for another key identifier, or for this one before it was registered or while it was revoked (I11b). Recorded only; the request is answered bad_signature and the nonce is not spent.
prefix_mismatch The (seq, hash) pair is not a prefix of the bridge's chain (I4).
resume_in_progress A re-attach is already being verified (I11d).
already_attached An authentic reattach reached a session that is attached; join is the only way into an attached session. Given only after the signature, the revocation, the binding and the nonce have been checked; the nonce is spent.
not_attached An authentic join reached a session that is not attached. Given only after the same checks; the nonce is spent.
transport_replay The transport reported a 0-RTT replay (I8).
queue_full The tool-call queue is at its limit (I13).
unanswered The call has no answer at drain (I14).
denied The call was answered with deny (I14).
answer_mismatch The hash of the answered content differs from the hash of the queued call at drain (I14).
scope The call's permission is not in the current scope, at drain (I13) or, for a call submitted with a client attached and no escalation pending, at submission (I3).
call_ttl The queued call outlived T_call (I13).
approval_ttl The approval outlived T_approve (I13).
terminated The session is terminated (I6).
quarantined The session is quarantined (rule Q).
not_a_strict_narrowing The proposed scope equals or widens the current scope (I10).
refused The uniform refusal that names no cause: an unknown, terminated or quarantined session at re-attach or join (I11a), and the answer to a request that finds its session ended by a timer that expired in an earlier tick.
unsupported_op The reference wire server does not serve the op-type named.
bad_signature The signature does not verify, is malformed, or (re-attach and join) names a key identifier the session does not register.
via_not_connected add_client names an authorising key that is not connected (I15).
key_already_registered add_client names a key identifier already in K(s).
bad_canonical The signed bytes are not canonical JSON per [RFC8785].
revoked_key The key has been revoked (I11-REVOKE); re-attach is rejected.
key_exhausted The session has no active keys (I11-REVOKE); all client operations are rejected, as is an unsigned terminate.
not_key_exhausted add_key or operator_terminate reached a session that has active keys.
extension_rejected extend asked for a scope wider than the current one (I3); the response carries current_scope.
duplicate_key A tool call with this idempotency key is already queued (I13).
grant_invalid The scope grant is missing or does not verify for this bridge, session, scope and client key.
unauthenticated The transport binding did not authenticate the caller of an unsigned op (Section 6.4.1); nothing is committed.
possession_invalid The attach carries no proof of possession of the registered key, or the proof does not verify under it; nothing is committed and no key is registered.
operator_signature_invalid The operator signature on a revocation, key addition or termination is missing, does not verify under the operator key, or covers another operation, bridge or log position (I-OPERATOR); nothing is committed.

6.6. Worked Example

A challenge and re-attach sequence follows. Values that are cut short with "..." are elided.

-> {"op": "challenge", "session_id": "sess-001",
    "key_id": "ck-7f3a"}
<- {"status": "nonce", "session_id": "sess-001",
    "nonce": "9c1f5e0a77d24b3e8a6f21d0c4b7e913",
    "ttl_seconds": 60}

-> {"op": "reattach", "session_id": "sess-001",
    "key_id": "ck-7f3a",
    "nonce": "9c1f5e0a77d24b3e8a6f21d0c4b7e913",
    "seq": 6,
    "hash": "a7ffc6f8bf1ed76651c14756a061d662f3f7...",
    "signature": "q3Zk0f..."}
<- {"status": "verified", "session_id": "sess-001",
    "events": [{"sequence": 7, ...}, {"sequence": 8, ...}]}

A rejection:

-> {"op": "reattach", "session_id": "sess-001",
    "key_id": "ck-7f3a",
    "nonce": "9c1f5e0a77d24b3e8a6f21d0c4b7e913",
    "seq": 6,
    "hash": "deadbeef...",
    "signature": "q3Zk0f..."}
<- {"status": "rejected", "session_id": "sess-001",
    "reason": "prefix_mismatch"}

6.7. What Is Not in the Wire Format

Transport layer:

HTTP, WebSocket and QUIC are out of scope. The wire format is the JSON message content, and the transport carries it. A binding MAY recommend a media type such as application/bridge-contract+json, but this is not normative and no media type is registered by this document.

Bridge-to-client authentication:

The bridge is trusted (A4). The client authenticates the bridge via the transport binding (for example TLS), which is out of scope here; the wire format assumes an authenticated channel in the bridge-to-client direction.

Streaming and batching:

Each message is one request and one response. A batch envelope MAY be defined later.

Operator actions:

OPERATOR_ADD_KEY, OPERATOR_TERMINATION and KEY_REVOKED are not client-initiated. Operator actions travel on a separate operator channel. The operator key is bound out of band, and the bridge verifies the operator signature on each action before it commits (Section 6.4.3). The reference front-ends give these actions a request form in the same envelope (revoke, add_key, operator_terminate), so that the signature check is exercised from a message; a deployment MAY carry them otherwise.

Key exchange:

Keys are registered at attach and add_client. There is no key-agreement message.

7. Relationship to Other Specifications

The Bridge Contract is execution semantics for the identity headers of [AGTP] and [AGTP-SESSION], a GAR-shaped event source for deployments without a Governing Enforcement Component ([GAR]), and the source of the resume point that a [PACE] re-attach needs. It does not replace any of them. The comparison obligation by obligation, with the version and section read for each cell, is in [BC-PAPER].

Where a GEC is present it remains the authoritative event source, and the bridge forwards events to it for signing. Where it is absent, I-SIGN-EVENT and I-SIGN-JWKS apply (Section 5).

8. Implementation Status

[RFC Editor: please remove this section before publication, as described in RFC 7942.]

Two implementations of the contract exist, a Python bridge and a Rust crate. Both have the same author as this document. No third-party implementation exists. The evidence in [BC-PAPER] therefore shows the consistency of one reading of the text, not independent confirmation, and the requirements here have not been exercised by anyone who did not write them. The conformance suite, the language-neutral test vectors and the event schemas distributed with [BC-PAPER] are the acceptance interface for an independent implementation.

The model of the product state machine is checked with TLC on bounded configurations, and an inductive check of a single-session model covers the state invariants. The model is not linked to the code by a refinement proof. Several invariants are abstracted in the model or covered by tests only; the register in [BC-PAPER] says which. The Rust crate does not emit CHECKPOINT, so I-CHECKPOINT is exercised on the Python bridge only.

8.1. Checking Status of the Model

Two properties of the model are not meaningfully checked. The state invariant for I6 is a tautology, and the no-eviction property of the live-nonce bound in I11 reads over an empty set in every configuration. These rest on tests and mutation checks. The remaining limits of the reference bridges are in the limitations register of [BC-PAPER].

9. Security Considerations

This document specifies the behaviour of a security-relevant component. The threat model is the Byzantine client of Section 2.2: one that replays captured requests, forges signatures, claims a history that is not a prefix of the chain, or tries to terminate a session with forged attempts, and that holds no registered private key. Compromise of client or bridge keys, a Byzantine bridge, and storage faults beyond a durable log are out of scope.

Replay and forgery. A re-attach and a join prove possession of a registered key over a single-use nonce, the session, the key identifier and the acknowledged prefix, under a domain tag (Section 6.4). The nonce lives for T_nonce and is spent on use (I9, I11). The unforgeability of the signature scheme is assumed. A signature carries no channel identifier, so a relayed genuine signature is indistinguishable from the client at the contract level; the client signs only nonces it requested from the intended bridge, and the transport authenticates the bridge. A request that was refused before its key was registered cannot be accepted later: the nonce it carries was issued for a key that was not registered, and never verifies.

Denial of service. A caller without a key that holds the bound on live nonces refuses a detached client every challenge; kept up until T_detach elapses, the session ends with DETACH_TIMEOUT. The timers bound detachment; they do not give availability. Replays of a captured authentic request grow the log, because each is recorded. The contract bounds what unauthenticated requests write to the log (I11), not their volume. Deployments SHOULD rate-limit or authenticate the transport in front of challenge, reattach and join.

Disclosure. A re-attach request lets an unauthenticated caller tell a live session from a dead one: unknown, terminated and quarantined sessions get one refusal, but a live session answers with other reasons. A caller that guesses session identifiers can list the live ones, though it learns nothing about their keys. Deployments SHOULD use unguessable session identifiers and rate-limit unauthenticated resume requests per source. The log retains the content of queued tool calls (I14), so access to it SHOULD be restricted as the content is.

Log integrity. The hash chain detects edits and reordering inside the log. It does not detect truncation or replacement of the last events: a log cut back to an earlier event is a valid chain, recovery accepts it, and a terminated session can become active again or a revoked key can be accepted again. The bridge operator SHOULD hold the head (sequence and hash) outside the log, for example as an I-CHECKPOINT anchor in an external transparency log. The reference bridges keep no external head.

Checkpoint construction. The root of I-CHECKPOINT is the Merkle tree hash of RFC 9162, Section 2.1.1, with separate prefixes for leaves and interior nodes and no duplicated last node, so a leaf cannot stand for an interior node. The event carries the tree size with the root.

Authorisation. Key possession is not authorisation (Section 3.1.1). The grant that authorises the initial scope is bound to a bridge identity the deployment configures; two bridges with the same identity accept each other's grants, so each bridge needs a distinct one. The attach proof carries no nonce, so freshness of the attach itself is not claimed.

Human approval. I14 binds an approval to the hash of the call content the human's client displayed. It detects honest rendering drift only: a malicious client that reports whatever hash it was given is not detected. Approvals, resolutions, escalations, disconnects and unsigned terminations are not signed in this document and stay transport-authenticated; anyone who can speak the transport can inject them. The deployment MUST document how they are authenticated and which identity is accepted.

Authority. The bridge enforces scope only for changes requested through it and for calls that cross it. A change the runtime announces itself is observed, reported and reverted by instruction, not prevented (Section 2.3).

Cryptographic agility. The contract fixes what a key must prove, not which signature scheme proves it. Ed25519 is the reference scheme and a second scheme is exercised by the implementations. Neither is post-quantum secure. A re-attach signature matters only while its nonce is live, so a later break does not reopen past re-attaches. The signatures that need to stay unforgeable for years are those on archived audit evidence, the operator signatures on events and checkpoints; a deployment that keeps such evidence long SHOULD move those to a post-quantum or hybrid scheme first.

10. IANA Considerations

This document has no IANA actions.

11. References

11.1. Normative References

[RFC2119]
Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, DOI 10.17487/RFC2119, , <https://www.rfc-editor.org/info/rfc2119>.
[RFC8032]
Josefsson, S. and I. Liusvaara, "Edwards-Curve Digital Signature Algorithm (EdDSA)", RFC 8032, DOI 10.17487/RFC8032, , <https://www.rfc-editor.org/info/rfc8032>.
[RFC8174]
Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, , <https://www.rfc-editor.org/info/rfc8174>.
[RFC8259]
Bray, T., "The JavaScript Object Notation (JSON) Data Interchange Format", STD 90, RFC 8259, DOI 10.17487/RFC8259, , <https://www.rfc-editor.org/info/rfc8259>.
[RFC8785]
Rundgren, A., Jordan, B., and S. Erdtman, "JSON Canonicalization Scheme (JCS)", RFC 8785, DOI 10.17487/RFC8785, , <https://www.rfc-editor.org/info/rfc8785>.

11.2. Informative References

[AGENTTHREAD]
Zheng, S., "Formal Security Analysis of Agent Protocol Composition", arXiv 2606.28690, , <https://arxiv.org/abs/2606.28690>.
[AGTP]
Hood, C., "Agent Transfer Protocol (AGTP)", Work in Progress, Internet-Draft, draft-hood-independent-agtp-09, , <https://www.ietf.org/archive/id/draft-hood-independent-agtp-09.txt>.
[AGTP-BINDINGS]
Hood, C., "AGTP Transport Bindings: TCP/TLS and QUIC", Work in Progress, Internet-Draft, draft-hood-agtp-bindings-00, n.d., <https://www.ietf.org/archive/id/draft-hood-agtp-bindings-00.txt>.
[AGTP-SESSION]
Hood, C., "AGTP Session Protocol", Work in Progress, Internet-Draft, draft-hood-agtp-session-00, , <https://www.ietf.org/archive/id/draft-hood-agtp-session-00.txt>.
[BC-PAPER]
Strebulaev, S. A., "Bridge Contract for Agent Session Governance", DOI 10.5281/zenodo.24409592, , <https://doi.org/10.5281/zenodo.24409592>.
[FIPS186]
National Institute of Standards and Technology, "Digital Signature Standard (DSS)", FIPS 186-5, DOI 10.6028/NIST.FIPS.186-5, , <https://doi.org/10.6028/NIST.FIPS.186-5>.
[GAR]
Sato, T., "The Governance Audit Record (GAR) for Agentic AI Systems", Work in Progress, Internet-Draft, draft-sato-soos-gar-08, , <https://www.ietf.org/archive/id/draft-sato-soos-gar-08.txt>.
[PACE]
Nandakumar, S. and C. Jennings, "Protocol for Agent Communication Exchange (PACE) over MOQT", Work in Progress, Internet-Draft, draft-nandakumar-agentproto-moq-pace-00, , <https://www.ietf.org/archive/id/draft-nandakumar-agentproto-moq-pace-00.txt>.
[SEC1]
Standards for Efficient Cryptography Group, "SEC 1: Elliptic Curve Cryptography, Version 2.0", , <https://www.secg.org/sec1-v2.pdf>.

Author's Address

Sergei A. Strebulaev
Independent Researcher