# Verification receipts: identity before caching
Status: M2 design contract, not implemented receipt persistence. The portable digest module supplies byte identity only.
## Receipt core
A receipt binds a check definition/revision, canonical typed facts, exact scope, declared assumptions, policy/grant fingerprint, adapter revision and observed predicate result. Hashes are SHA-256 over a versioned domain-separated canonical byte encoding. Never concatenate unframed strings; use fixed tags and byte lengths for variable fields.
Canonicalization preserves exact Unicode bytes, missing versus present fields, and integer strings after their canonical numeric validation. Set order is sorted but duplicate sets are invalid before hashing. Object keys are sorted; arrays that express ordered logic remain ordered. Unknown keys are rejected, not dropped. Domain prefixes distinguish definition, facts, grant, observation and receipt hashes.
Semantic core excludes observation wall-clock timestamps, elapsed duration and cache-hit flags. Those belong to the envelope. Freshness claims use an explicit clock input and policy; a receipt's timestamp alone is not freshness proof.
## Trust
- SHA-256 validates byte identity, not author identity, authorization or truth.
- A caller-supplied receipt is untrusted until its supported revision is replayed or authenticated through an explicitly configured issuer boundary.
- User-reported success, adapter observation and independent replay remain separate provenance kinds.
- A PASS receipt never authorizes delete/send/publish or suppresses an unrelated tripwire.
- Private paths, policy identities and hashes of private content are private. Hashing does not anonymize low-entropy values.
## Persistence before cache
Use existing private journal/lock primitives in the versioned capability sidecar. Link to lesson identity and full definition digest, not only title-derived lesson ID. Prepare/commit records make interrupted attachment recoverable; no pretend atomic transaction across lesson and sidecar files.
Write only on an explicit attachment/receipt request. Pure `check run` and read-only `check observe` continue to create no files. The cache is a separate opt-in optimization after replay correctness passes.
A receipt replay revalidates schema, digest domain, scope, assumptions and definition revision. When world evidence cannot be reacquired within the owner grant, abstain; never widen access to restore a cache hit. Mutable filesystem observations are not reusable as current-world facts without a fresh supported snapshot check.
## Required independent tests
- SHA standard vectors and differential tests on padding boundaries.
- Same canonical semantic input => same digest across native/WASM; permutations of a set preserve identity.
- Different scope, unknown versus empty field, policy, content, adapter or checker revision => different identity.
- Reordered ordered logic stays different even if one example produces the same truth value.
- Changed observation invalidates dependent result; a forged PASS with recomputed public hash is still untrusted.
- Crash between prepare/commit recovers safely; duplicate delivery/retry is idempotent.
- Old binaries ignore the sidecar without rewriting it; copying a sidecar to an unrelated bank cannot attach its receipts.
- Export rejects private receipt hashes as well as literal private values.
No receipt, cache or signing claim is made by the current predicate kernel.