# CAIN-42 Proof Standard v1

**Status:** public draft, 2026-11-13. Version `cain42.proof-standard.v1`.
**Purpose:** define what makes a CAIN-42 record *evidence* rather than a log line, and specify a verifier that a third party can run without importing CAIN code.

## 1. Scope

A **CAIN-42 Proof Record** is a canonical JSON document that binds:

- **who** acted (agent identity),
- **what authority** it held (scope, delegation, expiry),
- **what it intended** (action, target, parameters),
- **what was decided** (ALLOW / DENY / REQUIRE_APPROVAL / UNKNOWN / ERROR),
- **what actually executed** (effect, artifact digests),
- **the evidence** (hashes, signature, chain link, optional Merkle root).

A **Proof Bundle** is a directory containing the record(s), the artifacts they bind, a manifest, the issuer's public key, and a standalone verifier.

This standard does **not** assert that the world matches the record, that a test is good, or that a control is certified. It asserts **integrity, attribution, and binding to the supplied artifacts** — no more, no less.

## 2. Conformance levels

| Level | Name | Requirement |
|---|---|---|
| **L1** | Integrity | Canonical JSON, SHA-256 record hash, Ed25519 signature, verified against a **pinned** key |
| **L2** | Chain | `prev_hash` continuity, bundle head lists every record in order, no gaps |
| **L3** | Anchor | Merkle root over the records, optional quorum/transparency anchor (vendor-operated unless stated) |
| **L4** | Execution binding | Artifact digests in the record equal the supplied artifact bytes; independent recompute of the effect |

A verifier must report the highest level it actually checked. **L1 is not L4.** Do not market L1 as execution proof.

## 3. Canonicalization and hashing

1. Serialize with **RFC 8785 JSON Canonicalization Scheme** (sorted keys, no insignificant whitespace, number lexemes preserved).
2. Compute `record_hash = SHA-256(canonical_json_without("record_hash", "signature"))`.
3. Store `record_hash` as lowercase hex.
4. Any change to a bound field changes the hash. The verifier recomputes it; it never trusts the stored value.

## 4. Signature

- Algorithm: **Ed25519** (RFC 8032).
- Signed bytes: the `record_hash` (or the canonical record with signature fields removed — the bundle must state which).
- `key_id`: a stable identifier for the signing key.
- `signature_b64`: base64 of the 64-byte signature.
- The verifier **must require an out-of-band pinned key or fingerprint**. A key shipped inside the bundle is untrusted until matched to the pin.

Exit behavior: missing pin → refuse (do not print VERIFIED). Wrong pin → NOT VERIFIED. Invalid signature → NOT VERIFIED.

## 5. Chain and bundle head

- Each record carries `prev_hash` (null for the first).
- `head.json` is a signed statement listing the exact record files, in order, with their hashes.
- Removing, adding, reordering, or rewriting a record must fail verification.
- A chain proves **continuity**, not completeness of the external world.

## 6. Merkle anchor (L3)

- Leaves: `SHA-256(record_hash)` in bundle order.
- Tree: RFC 6962 binary Merkle tree.
- Root: `merkle_root` in the bundle head, signed.
- Optional external anchor: a transparency log or a Byzantine quorum certificate. State the operator: a vendor-operated quorum is **not** an independent witness network.

## 7. Verifier requirements

A conforming verifier:

1. imports **no CAIN code** and no claimant-controlled library;
2. pins the key out of band;
3. fails closed on any parse, hash, signature, or digest mismatch;
4. prints a typed verdict (`VERIFIED`, `NOT_VERIFIED`, `NOT_PINNED`, `UNSUPPORTED`);
5. exits non-zero unless every claimed level passes;
6. prints the key fingerprint it was asked to trust;
7. never writes to the bundle.

## 8. Test vectors

A conforming implementation must pass the vectors in `standard/test-vectors/` (or the bundle's own `verify_offline.py` conformance run):

| Vector | Expected |
|---|---|
| Valid bundle | `VERIFIED`, exit 0 |
| One byte changed in a signed record | `NOT_VERIFIED`, non-zero |
| One byte changed in a bound artifact | `NOT_VERIFIED`, non-zero |
| Record removed / reordered | `NOT_VERIFIED`, non-zero |
| Wrong pinned key | `NOT_VERIFIED`, non-zero |
| No pin supplied | `NOT_PINNED`, exit 3 |
| Missing verifier | `UNSUPPORTED`, non-zero |

## 9. What this standard does not prove

- That the record is complete (logs can be omitted before signing).
- That the executed action was wise, safe, or legal.
- That the tests behind a fix are good.
- That the operator is independent.
- That any certification, SOC 2, ISO 27001/42001, or EU AI Act conformity exists.

Those require separate evidence, a third-party audit, and a named accountable party.

## 10. Reference implementation

- Conformance runner: `standard/conformance.py`
- Family verifier: `keystone/family_verify.py` (no CAIN imports)
- Browser verifier: `/verify-record.html`
- Sample bundle: `/evidence/agentic-75-products-2026-11-12/deliveries/CAIN-A75-001/signed-sample/`
- Machine-readable summary: `/proof-standard.json`

## 11. The one question

> **Can a third party verify the record offline, without trusting the issuer?**

If the answer is no, it is a dashboard, not evidence.
