← Back to HomeSheaf / How Sheaf Works
Technical Overview · Developer Preview

How Sheaf Works: Verifiable Evidence for Autonomous Agents

Summary

AI agents now initiate payments, change records, and call tools across third-party systems at machine speed. The evidence available when those actions are disputed is usually an application log: mutable, debugging-oriented, and controlled by the party that owns the system. Sheaf closes that gap with an out-of-process recorder that captures MCP tool calls at the boundary, signs them with Ed25519 keys the agent never holds, links them into a hash chain, and anchors Merkle epoch roots on Base L2. A portable .sheaf bundle can then prove a specific action to an auditor, issuer, or counterparty through selective disclosure — without exposing the rest of the chain and without trusting Sheaf's servers. This document also states what Sheaf does not prove (section 07).

01The Trust Gap

Application logs are built to help engineers debug software. They are not built to survive an adversarial review. A log line can be edited at the source, rewritten in a database, dropped by a retention policy, or reconstructed from a different model version. Even an honest operator usually cannot prove that the log it presents is the same log its systems produced at execution time.

Observability platforms improve search and retention, but they preserve the same trust model: the operator owns the pipeline, the timestamps, and the storage. An auditor who receives a screenshot or a CSV export is still asked to trust the party whose conduct is in question. For high-value disputes, that is not evidence. It is a narrative with better formatting.

Regulation and payments are moving the same way. EU AI Act Article 12 requires high-risk AI systems to technically allow the automatic recording of events (logs) over their lifetime. In card payments, agent-initiated transactions are still disputed under the existing chargeback reason codes; the networks have not published a binding agent-specific dispute rule. That puts the burden on evidence: a merchant increasingly has to show what the customer authorised the agent to do, not merely that a checkout session completed. A mutable order log answers neither question.

The dispute is no longer “did the transaction complete?” It is “was this agent authorised to perform this action, for this principal, at this moment?” That question requires evidence that can be verified independently of the operator.

02Architecture

Sheaf records execution, not intention alone. The recorder sits outside the agent process and observes the same JSON-RPC messages the agent exchanges with an MCP server. Each event is signed, chained, batched, and anchored. The result is a receipt that another party can verify with a pinned public key and a Base RPC.

Interception

A transparent MCP proxy wraps the underlying server. When the agent sends tools/call, the proxy captures the tool name, arguments, and the result returned by the server. It also captures resources/read and sampling/createMessage where configured. Argument and result payloads are hashed; raw payloads are not sent to the recorder by default. The interception point is the boundary itself, not a vendor API and not the agent's own instrumentation.

For runtime enforcement, the same boundary evaluates a policy document before the call is forwarded. An ALLOW is recorded and forwarded. A BLOCK or REQUIRE_APPROVAL is recorded with result: "blocked" and returned to the agent as a structured JSON-RPC policy error; the underlying server never sees the call. The audit trail therefore contains both the actions that ran and the actions that were stopped. REQUIRE_APPROVAL currently blocks; a signed-approval flow is not built yet.

Release status: @sheafhq/mcp-recorder 0.4.0 on npm enforces sheaf.policy/1 (ALLOW, BLOCK, REQUIRE_APPROVAL with constraints) and writes a local signing ledger with wrap --local. The reference simulation still pins 0.3.0 and its earlier sheaf-policy/1 allow/deny format; it will move to sheaf.policy/1.

Signing

The recorder co-signs each event with Ed25519. The agent never holds the private key, and the wrapped MCP server does not need to be modified. The signed payload is the RFC 8785 (JCS) canonicalization of {v, event, chain}, which makes the signature deterministic across languages and platforms. The recorder's signature establishes that the event was observed and chained by the recorder whose key is pinned in the verifier. It says nothing about who the agent is: the envelope's signatures.actor field is not part of the signed payload or the chained hash, and verifiers ignore it.

Hash-Chaining & Merkle Batching

Every event carries a chain identifier and a sequence number. Its prev_hash is the hash of the previous envelope, excluding signatures. Changing an earlier event changes every later prev_hash, so an edit cannot be hidden by rewriting one record. The recorder periodically batches the events it has received into an epoch and computes a Merkle root over the event leaves. The root commits to the whole batch with a single 32-byte value; any individual event can later be proven against it with a logarithmic-size path.

Anchoring

The epoch root is written to Base L2 in the anchor transaction calldata. The transaction's block is the upper time bound: the root, and every event under it, existed by that block, and no one can change those events afterwards without the proof failing. Verification pins the expected anchorer address and network, reads the transaction from a Base RPC, and checks that the calldata root matches the Merkle root in the bundle. Sheaf's database is not part of the verification path.

What the chain proves

Ordering and integrity within a chain, and that the pinned recorder signed each event.

What the anchor proves

The epoch root, and so each event under it, existed on a public chain by a specific block, independent of Sheaf's servers.

03Selective Disclosure

A merchant should not have to hand over an entire agent history to prove one transaction. Sheaf uses Merkle-path disclosure: the bundle contains the selected event's signed envelope, its leaf hash, its Merkle inclusion path, and the epoch root. The verifier recomputes the root from the leaf and sibling hashes, then checks the root against the Base anchor. The rest of the epoch stays private.

For a contiguous range, the bundle also includes the events immediately before and after the window. These boundary references prove that the disclosed set is a contiguous slice of the chain and that no event was silently omitted from the middle. Payloads are separately hash-bound: the bundle can include the arguments or result needed to evaluate a claim, or only their hashes when the dispute does not require the raw content.

The result is a portable artifact that supports a narrow claim — “this agent called this tool with these arguments and received this result” — without exposing unrelated customers, tools, or sessions. The same primitive carries the Dispute Bundle's mandate, delegation, consent, execution, and policy evidence (sheaf.dispute-bundle/1, 14 checks).

04Verification

Verification is local and zero-dependency. The browser verifier at /verify is a single HTML file with the verification code inlined; it does not load a CDN, a framework, or a Sheaf API. The Node verifier, @sheafhq/verify, exposes the same checks as a library and CLI, and its output is byte-identical to the browser's. In offline mode it validates the hash chain, signatures, Merkle paths, bundle hash, payload hashes, and evidence documents without a network request. In online mode it additionally reads the anchor transaction from a Base RPC and confirms the root, anchorer, and block.

Trust is pinned, not discovered. The verifier ships with the recorder public keys and the authorised Base anchorers for its release. A bundle cannot introduce a new key by claiming a URL; the verifier never fetches public_key_url. Rotating a recorder key or anchorer therefore requires a new verifier release, and an old verifier fails closed on a bundle signed by a key it does not know. The --trust <path> option exists for tests and local ledgers, not as a production rotation mechanism.

Offline mode proves integrity, not anchor presence. The anchor_on_base check is reported as unconfirmed, and the CLI exits non-zero unless the caller explicitly accepts an unconfirmed anchor. Online mode is the stronger claim: the record was anchored on Base and has not been altered since.

The verifier does not take the bundle's word for anything

  • Claims are re-derived from signed data. A bundle states what is in dispute (amount, currency, merchant, tool) in subject.claims. Those are the author's statements. The verifier re-reads each value from the signed event or the payload it cites and fails with CLAIM_MISMATCH if they differ. The mandate's scope is checked only against those derived values; if the mandate caps an amount and the amount is not in the signed payload, the result is EVIDENCE_GAP.
  • Strict Ed25519. Every signature is checked against a strict profile before the platform's own Ed25519 runs: canonical encodings, no small-order keys or nonce points, and a reduced scalar. Native WebCrypto in current Node and Chromium accepts small-order public keys, for which a "signature" can be produced without any private key; the strict profile rejects them.
  • The format is closed. A sheaf.dispute-bundle/1 with any unknown top-level field fails, so content a verifier does not understand can never be silently ignored.
Pinned trust is a feature. It converts key rotation into an explicit software upgrade instead of a runtime trust decision made by the bundle being verified.

05Authorisation: who said yes?

Integrity and authorisation are different questions, and the verifier reports them separately. A bundle can be perfectly intact — every signature, path and anchor valid — while proving nothing about whether the principal agreed. The first line of the report is the integrity verdict; the second is the authorisation tier:

TierMeaning
verifiedThe mandate, delegation and consent are signed by keys the relying party has pinned to the named principal, for that role and time window.
unauthenticatedThe documents carry valid signatures, but by keys nobody has vouched for. Anyone can generate a key, so this proves consistency, not identity.
recorder_attestedA document is signed with a recorder key. The recorder observed it; that is never treated as the principal's authorisation.
absentAn authorising document is missing or unsigned.

The sample bundles on /verify report unauthenticated, and that is correct: their demo keys are not pinned to any real principal. Reaching verified requires the relying party to supply its own signer pins: the trusted_signers option of verifyDisputeBundle in @sheafhq/verify, or --signers pins.json on the repository's sheaf dispute verify CLI, where --require-verified-authorisation makes anything below verified a failure. Sheaf does not ship principal keys, and the browser verifier has no pin input yet.

Why this matters: an earlier version of the local export signed principal documents with the recorder's own key, and the verifier accepted that as complete authorisation. Both were fixed (2026-11-17); the bundle produced by the old code is kept as a regression fixture and is now reported as recorder-attested.

Binding keys to real organisations and agents — identities with key rotation and recovery, scoped and attenuated delegations, revocation, and supplier-side verification — is the subject of the Sheaf Authority Protocol, which is in design and early implementation and not part of this release.

06Run It Yourself: the Reference Simulation

The architecture is exercised end to end by a reference simulation that runs on a single machine with no cloud services. A buyer agent is told to purchase a €200 dataset and, if that fails, a €100 one. A policy firewall at the MCP boundary blocks the €200 call before it reaches the merchant and allows the €100 purchase. Both decisions, the denial as well as the sale, are signed by the recorder Worker running locally, hash-chained, and anchored on a local EVM chain (anvil) standing in for Base.

An independent notary then audits the exported evidence bundle offline. It has only the bundle, the pinned recorder key and anchorer, and an RPC for the anchor chain. It re-checks every signature, Merkle path and anchor, proves the session is complete rather than a selected subset, and re-evaluates the policy against the disclosed inputs to confirm each recorded decision. The same run feeds the notary six forged variants of the bundle (a hidden denial, a dropped close event, a rewritten decision, an altered amount, a substituted policy, an unset enforcement flag), and every one must be rejected.

git clone https://github.com/sheafhq/sheaf.git
cd sheaf
npm install && npm run sim

Requirements: Node.js 22.12+ and Foundry (anvil). The run prints a Notary Certificate and exits 0 only if the honest bundle is accepted and every forgery rejected. It has been tested from a fresh clone on Linux (including WSL); Windows and macOS launchers are included. Details: simulation/README.

The simulation tests the claims in this document rather than mocking them: the recorder and its anchoring code are the same Worker source that runs in production, the firewall is the published @sheafhq/mcp-recorder 0.3.0, and the notary builds on @sheafhq/verify.

07Limitations: what Sheaf does not prove

  • Which agent acted. event.actor is a label supplied by the client, not an authenticated identity. Sheaf proves what crossed the boundary it recorded, not who was on the other side.
  • Exact event time. event.ts is client-supplied. The trustworthy bound is the anchor block: the event existed no later than that.
  • Who authorised it, unless the relying party pins principal keys (section 05).
  • That nothing else happened. A bundle proves the disclosed range is contiguous, and the simulation's session open/close events prove a session is complete. Nothing proves the absence of actions that never passed through a recorder.
  • That the recorder showed everyone the same history. Each anchor commits to a set of events, not to one head per chain, so a dishonest recorder could anchor two conflicting branches in different epochs. This is detectable only by comparing evidence; witness co-signing and per-chain head commitments are planned.
  • That an action happened in the real world. A recorded MCP response proves what the server returned to the proxy, not that the order shipped or the payment settled.
  • Trust in delivery of the browser verifier. The page is only as trustworthy as its delivery from sheafhq.io. For independence, build dispute-verify.html from the source or use the CLI.

Sheaf is a Developer Preview. The recorder, verifier and simulation are open source and usable today; formats may still change, and versioned format changes are made so that old bundles keep verifying.

08Standards and Related Work

Sheaf is designed with the following in mind. None of this is a certification or a conformance claim; read it as design intent.

  • EU AI Act, Article 12 (record-keeping): high-risk AI systems must technically allow the automatic recording of events over their lifetime. Sheaf produces such records in a form a third party can verify.
  • RFC 8785 (JCS): deterministic JSON canonicalization for cross-platform signature verification. Used for every signed and hashed structure.
  • Internet-Drafts on agent audit trails (individual submissions, not IETF standards): VOLT (Verifiable Operations Ledger and Trace: hash-chained records packaged as portable evidence bundles) and WARD (content-free hash-chain witnessing). Sheaf solves overlapping problems; it does not claim conformance.
  • SOC 2 and ISO/IEC 42001: both ask for evidence of monitoring, integrity of processing and traceability of AI actions. Sheaf's records are cryptographic evidence an auditor can check rather than operator-curated exports.

This document describes protocol behaviour. It is not legal advice, and it does not replace a regulator's or card network's assessment of a specific dispute.

← Back to Home