← All posts

Commitments You Can Verify

A decision you cannot verify is just a log line. How a MACP Commitment gets a canonical hash anyone can recompute, and how a decision receipt carries it to someone who was not there.

By Ajit Koti

Every MACP session that ends well ends in one message: a Commitment. Last time it was transfer.review, sent by the checkout orchestrator after three approvals and one objection. That message is the decision.

Here is the uncomfortable question. Six months later, someone hands you a JSON blob and says "this is what the agents decided." How do you know it is the same decision? How do you know nobody edited the reason, or flipped the outcome, or changed which policy version it claims?

If the only answer is "trust the database it came from," the decision is just a log line. This post is about how MACP makes it more than that.

What a Commitment says

A Commitment carries nine fields, and only nine:

  • commitment_id: an identifier for this commitment
  • action: what was decided, for example deployment.approved
  • authority_scope: the scope it was decided under
  • reason: why, in words
  • mode_version, policy_version, configuration_version: the rules that governed the session, bound when it started
  • outcome_positive: whether the outcome is a yes or a no
  • supersedes: optionally, a reference to an earlier commitment this one revises

Who may send it is fixed by the mode. In Decision Mode it is the session's initiator by default, unless policy names another authority. And because a resolved session accepts nothing else, there is exactly one.

supersedes is the only way to change your mind. A resolved session cannot be reopened, so a revision happens in a new session, whose commitment points back at the old one by session ID and hash. That raises the obvious question: which hash?

One hash, computed the same way everywhere

Before RFC-MACP-0013, the core spec left it as "an implementation-defined digest." That works until two implementations need to agree on a value, and supersession across sessions is exactly that case. RFC-MACP-0013 settles it with one algorithm, macp-commitment-hash/1:

  1. Project the nine fields into a JSON object, under fixed rules for how each field is written.
  2. Canonicalise it with JCS (RFC 8785), so key order and number formatting are fixed.
  3. Prefix the label macp-commitment-hash/1:, so this hash can never be confused with a hash of something else.
  4. Hash with SHA-256, and write it as sha256: plus 64 lowercase hex characters.

A four-stage pipeline: project the commitment payload to JSON, canonicalise it with JCS (RFC 8785), prefix the label macp-commitment-hash/1:, and take SHA-256 as lowercase hex. Below it, the published conformance vector cmt_hash_001 as input and the recomputed hash sha256:9f58e9d114d11860d48aa2bcb8cda458b9618b1cc8560595a802b68c4af85d41 as output, with the three verifier outcomes match, mismatch and cannot-verify, and notes that exactly nine fields are hashed and the label is not part of the output. RFC-MACP-0013 on one page, using a published test vector whose hash was recomputed independently.

It is a pure function. Anyone with the nine fields can recompute it, with no keys, no network and no access to the system that made the decision. The spec publishes test vectors, and the compute vectors reproduce byte for byte in the Rust runtime and in both SDKs. Here is the first vector, recomputed with the Python SDK:

from macp.v1.core_pb2 import CommitmentPayload
from macp_sdk import commitment_hash

payload = CommitmentPayload(
    commitment_id="c1", action="decision.approved", authority_scope="seam",
    reason="sealed by seam", mode_version="macp.mode.decision.v1",
    policy_version="1.0.0", configuration_version="1.0.0", outcome_positive=True,
)
print(commitment_hash(payload))
# sha256:9f58e9d114d11860d48aa2bcb8cda458b9618b1cc8560595a802b68c4af85d41

The TypeScript SDK exports the same function as commitmentHash.

Three answers, not two

Verifying a hash sounds like a yes-or-no question. MACP makes it a three-way one, and the third answer is the interesting one.

  • match: the payload's hash equals the claimed hash.
  • mismatch: it does not. A claim written in a non-canonical way, such as uppercase hex or a missing sha256: prefix, is also a mismatch. Claims are never quietly normalised.
  • cannot verify: the payload has a field outside the nine, or its bytes do not parse. The label does not cover this payload's shape, so no honest verifier can say "match."

Why not just ignore the extra field and hash the rest? Because then a payload with an extra field, perhaps one that changes the meaning, would verify as if it were the original. The spec has a vector built to catch exactly that shortcut: an implementation that drops unknown fields reports "match" on it, and fails.

This is also why verification takes the payload's wire bytes, not a decoded object. Once a Protobuf message is decoded into a typed object, unknown fields are easy to lose. The bytes keep them visible.

from macp_sdk import verify_commitment_hash

wire = payload.SerializeToString()
h = commitment_hash(payload)

verify_commitment_hash(wire, h)                  # "match"
verify_commitment_hash(wire, h.upper())          # "mismatch"
verify_commitment_hash(wire + b"\x98\x06\x01", h)  # "cannot_verify": field 99 appended

In TypeScript this is verifyCommitmentHash(wire, claimedHash), with the same three outcomes.

One more design choice: the label is not part of the output. A hash does not announce which algorithm made it, and verifiers must not guess. If a tenth field is ever hashed, it gets a new label, macp-commitment-hash/2, advertised as a capability. Adding a field silently under /1 is not allowed.

Decision receipts: carrying it to someone else

A hash proves that a payload has not changed. It does not prove who issued it. For that, the spec has an informative appendix that defines a decision receipt, macp-receipt/1: a portable JSON record of one commitment that a third party can check offline.

A receipt carries the session ID, the mode, the commitment itself, its canonical hash, who issued it and when, and one or more attestations. The verifier reports two things separately:

  • Integrity: does the recorded commitment have the recorded hash? This needs no keys.
  • Authenticity: is there a valid signature over the receipt from a key you trust? The SDKs implement Ed25519 JWS attestations.

Both SDKs ship it today, Python 0.19 and TypeScript 0.18. In Python, signing needs the receipts extra (pip install 'macp-sdk-python[receipts]'). Here is the spec's own signed example receipt, checked as published and then after someone edits the reason:

from macp_sdk import verify_receipt

# receipt and its trusted key come from the spec vector schemas/conformance/receipt/receipt_001_attested.json
verify_receipt(receipt, {"example-1": public_key_x})
# {'integrity': 'match', 'attestations': ['valid'], 'verdict': 'attested'}

receipt["commitment"]["reason"] = "edited later"
verify_receipt(receipt, {"example-1": public_key_x})
# {'integrity': 'mismatch', 'attestations': [], 'verdict': 'unverified'}

There are four verdicts: attested (integrity holds and a trusted signature is valid), integrity_only (the hash holds but no trusted signature is), unverified (integrity fails, so signatures are not even checked), and refused (an unknown receipt format). verify_receipt never raises on a malformed receipt; it returns a verdict. In TypeScript the same functions are buildReceipt and verifyReceipt, from the browser-safe macp-sdk-typescript/receipt subpath, so a receipt can be checked in a web page with no gRPC at all.

You do not need to write code to check one. The macp command line, from runtime 0.10.0, verifies a receipt file and says so in its exit code:

macp verify receipt.json --key example-1=TDVzkxaSf6_Oxu7mmn5TbCkF80s8Ulh33qKQsi0gnZM
# integrity     match
# attestation 0 jws    valid
# verdict       attested

It exits 0 for attested and 1 for anything weaker; --require integrity also accepts integrity_only. Run it on the edited receipt and it prints mismatch and unverified, and exits 1. That makes it easy to put in a script or a CI job.

Receipts are anchored on the commitment hash, not on any one key service. A runtime's own key, a key you bring, or an identity service can all issue receipts, and one verifier checks them all the same way.

What this does not do

A receipt proves that a commitment is intact and that a trusted key signed it. It does not prove that the decision was a good one, or that the agents had the right information. Receipts are informative in the spec: no implementation is required to issue them. And the RFCs are still drafts, so the details can change, although the label exists precisely so that any change to what is hashed is visible rather than silent.

What it does give you is a decision you can hand to someone who was not there, and that they can check without trusting you. That is the difference between a log line and evidence.

The normative text is RFC-MACP-0013, and the SDK details are in the Python and TypeScript docs.

Next: enough reading. Your first session, on your own machine or in your browser.