# CAIN42 — Effect Contract Specification (Prompt 13)

An `EffectContract` binds **what may change**, not merely who may act. Canonical JSON (RFC 8785-style sorted keys),
domain `CAIN42/IRONCLAD-EFFECT-CONTRACT/v1`, Ed25519-signed over `sha256(canonical({"domain", **body}))`.

## Fields

| Field | Meaning |
|---|---|
| effect_id | unique durable-effect id |
| principal / agent / lineage / model / runtime | who and what acts |
| authority_digest / decision | authority state + authorization decision at grant time |
| intent / target / action / arguments_digest | the declared effect |
| policy_version / environment_digest / world_state_version | context versions |
| consequence_envelope / reversibility (R0–R7) / resource_budget / time_window | bounds |
| idempotency_key / nonce | duplication + replay defense |
| expected_pre_state / expected_post_state | the intended durable transition |
| required_evidence / evidence_quorum / allowed_variance | verification requirements |
| compensation / delegation_chain / expiration | recovery + scope |

`contract_hash = sha256(canonical(body))`.

## Effect Fingerprint

`EffectFingerprint.compute` hashes the dimensions (pre_state, change, target, parameters, context, authority,
expected_result). `compare` returns EXACT_MATCH, ACCEPTABLE_BOUNDED_VARIANCE, PARTIAL_MATCH, DIVERGENT_RESULT,
UNAUTHORIZED_RESULT or UNVERIFIABLE_RESULT. **Deterministic; no LLM judgment is the final authority.**

## Verification

`verify_effect_contract` checks digest, signature, pinned signer, known reversibility class, required fields and
delegation depth. `verify_effect_receipt_offline` independently recomputes the contract hash from the bound body,
checks the signature and that a FINALIZED receipt carries a passing verification verdict and evidence — it does not
trust CAIN's own flag.
