# CAIN42 — Effect Protocol (Prompt 13)

Two-phase effect commit over the RESTRICTION-ONLY decision path.

## Phase 1 — PREPARE

CAIN verifies authority, identity, policy, state freshness, consequence, reversibility, target, parameters, budget,
idempotency and evidence, then creates a commitment (`sha256(canonical({contract_hash, nonce, effect_id, at}))`).
A duplicate idempotency key or an expired contract is refused; no commitment is issued.

## Phase 2 — COMMIT

The external system executes the exact committed effect. CAIN observes the result and compares
`EffectFingerprint(intended)` with the realized state.

| Outcome | Transition |
|---|---|
| exact / bounded variance | VERIFIED_EFFECT → FINALIZED_STATE |
| divergent / partial | COMPENSATION_PENDING |
| unauthorized target | EFFECT_VIOLATION |
| cannot determine | IN_DOUBT (never SUCCESS) |
| execution error / timeout | IN_DOUBT |

## In-doubt resolution

`EffectResolutionGraph` groups witnesses by provenance root; a root with contradictory results is itself a divergence.
A quorum requires **independent** roots. Retry is never automatic. Verdicts: RESOLVED_SUCCESS / RESOLVED_FAILURE /
RESOLVED_PARTIAL / RESOLVED_DIVERGENCE / UNRESOLVED_INCIDENT.

## Recovery

`CompensationGraph.plan` returns compensations in reverse order; every step `requires_authority: true`. An
irreversible node is an explicit INCIDENT, never a silent no-op.
