Home / Spec / Evidence model
Execution chain · Stage 6 of 6 — Evidence
Evidence model
Evidence is stage 6 of the execution chain: every governed action leaves a verifiable receipt. A receipt is a self-contained record — it carries enough information to re-derive the policy decision and to detect tampering without trusting the system that stored it.
On this page
What is recorded per action Stable
Every receipt records the following fields. Fields marked hash store a SHA-256 hex digest of the canonical JSON of the referenced object, not the object itself.
receipt_id- Stable receipt identifier, e.g.
rcpt_…. action_id- The action this receipt evidences.
tenant- Organization, workspace, environment — the scope the action ran in.
actor- Actor id and actor class (human / service / agent).
action_schema/schema_version- The contract the action was validated against.
inputs_hash(hash)- Digest of the action inputs as validated at stage 1.
policy_bundle/policy_version- The bundle and version the decision was evaluated under.
decisionallow,deny, orrequire-approval.evaluation_trace- Rules evaluated, in order, with match results and the deciding rule.
approval- Present when the decision was
require-approval: approver id, role, decision, timestamp, expiry. outputs_hash(hash)- Digest of the action outputs. Absent (null) when the decision was
deny. expectations/actuals- Expected vs actual value, cost, and risk. Declared in the proposal; measured at execution.
started_at/finished_at- RFC 3339 timestamps bounding execution.
prev_receipt_hash- Digest of the previous receipt in this tenant's chain (
nullfor the genesis receipt). receipt_hash- Digest of this receipt's canonical form (all fields except
receipt_hashitself).
Receipt format Stable
- Canonical JSON: UTF-8, object keys sorted lexicographically at every level, no insignificant whitespace, numbers as plain decimal.
- Hashing: SHA-256 over the canonical JSON bytes, rendered as lowercase hex.
- Chaining: each receipt embeds
prev_receipt_hash, forming one append-only chain per tenant. Tampering with any receipt invalidates every receipt after it. - Storage: receipts are stored append-only within the tenant boundary. The receipt format does not depend on any particular database.
Verification
To verify a receipt, recompute the canonical JSON of its fields (excluding receipt_hash), hash it, and compare with receipt_hash. To verify a chain, repeat for each receipt and check that each prev_receipt_hash equals the previous receipt's receipt_hash. Verification requires no trusted server — only the receipt data and this spec.
Example receipt
{
"receipt_id": "rcpt_01J9ZQK9P5T2R8W4N6P1",
"receipt_format": "ametios.receipt/v1",
"action_id": "act_01J9ZQK7M3T2R8W4N6P0",
"tenant": {
"organization": "org_9f2",
"workspace": "ws_billing",
"environment": "production"
},
"actor": { "actor_id": "svc_invoicer", "actor_class": "service" },
"action_schema": "billing.invoice.issue",
"schema_version": "1.2.0",
"inputs_hash": "9f2c41d8e5b60a7f3d1c9e8b4a6f5d2c1e8b7a6f4d3c2b1a09f8e7d6c5b4a39",
"policy_bundle": "billing-default",
"policy_version": "2.1.0",
"decision": "allow",
"evaluation_trace": {
"evaluated": [
{ "rule": "deny-refunds-in-production", "matched": false },
{ "rule": "allow-low-value-invoices", "matched": true }
],
"matched_rule": "allow-low-value-invoices"
},
"approval": null,
"outputs_hash": "1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c6d7e8f9a0b1c2d3e4f5a6b7c8d9e0f1a2b",
"expectations": {
"expected_value_cents": 290000,
"expected_cost_cents": 12,
"risk_tier": "low"
},
"actuals": {
"actual_value_cents": 290000,
"actual_cost_cents": 11,
"risk_tier": "low"
},
"started_at": "2026-10-03T14:02:11Z",
"finished_at": "2026-10-03T14:02:12Z",
"prev_receipt_hash": "c0ffee11c0ffee11c0ffee11c0ffee11c0ffee11c0ffee11c0ffee11c0ffee11",
"receipt_hash": "d34db33fd34db33fd34db33fd34db33fd34db33fd34db33fd34db33fd34db33f"
}
Example verifier
// Illustrative reference: receipt verification (Node.js).
const crypto = require("node:crypto");
function canonicalize(value) {
if (Array.isArray(value)) {
return "[" + value.map(canonicalize).join(",") + "]";
}
if (value !== null && typeof value === "object") {
const keys = Object.keys(value).sort();
return "{" + keys.map((k) => JSON.stringify(k) + ":" + canonicalize(value[k])).join(",") + "}";
}
return JSON.stringify(value);
}
function sha256Hex(text) {
return crypto.createHash("sha256").update(text, "utf8").digest("hex");
}
function receiptHash(receipt) {
const { receipt_hash, ...body } = receipt; // exclude the hash itself
return sha256Hex(canonicalize(body));
}
function verifyReceipt(receipt) {
return receiptHash(receipt) === receipt.receipt_hash;
}
function verifyChain(receipts) {
for (let i = 0; i < receipts.length; i++) {
if (!verifyReceipt(receipts[i])) return { ok: false, at: i, reason: "bad receipt hash" };
const expectedPrev = i === 0 ? null : receipts[i - 1].receipt_hash;
if (receipts[i].prev_receipt_hash !== expectedPrev) {
return { ok: false, at: i, reason: "chain link broken" };
}
}
return { ok: true };
}
module.exports = { canonicalize, receiptHash, verifyReceipt, verifyChain };
Related: execution chain (stage 6 context), policy model (the trace format), evidence-receipt reference (issuance + verification in code).