# CAIN ORACLE — Counterfactual Authorization

`cain/oracle/counterfactual.py`.

Before high-consequence autonomous execution, ORACLE generates a bounded set of **machine-checkable** counterfactuals
(not LLM questions): target state differs, critical observation stale, tool returns malformed, environment changes,
effect delayed, target unavailable, model wrong, downstream dependency changes, action partially succeeds, secondary
consequence. Each has: input state, changed assumption, expected outcome, safety threshold, consequence bound,
evidence requirement, decision impact.

`CounterfactualAuthorizationEngine.robustness(results)` yields a state and a decision:

| State | Decision |
|---|---|
| ROBUST (all held) | ALLOW |
| CONDITIONAL (≥ 0.7 held) | NARROW |
| FRAGILE (≥ 0.4 held) | REQUIRE_APPROVAL |
| UNSAFE (< 0.4 held) | DENY |
| UNKNOWN (< required count) | REQUIRE_APPROVAL |

This is deliberately **not** a meaningless 0–100 score. The system can say: *"the action is authorized, but the
prediction is too fragile for autonomous execution"* (P182, P183; lab `counterfactual_omission`,
`selective_counterfactual`, `unsafe_autonomy`).

## Status
IMPLEMENTED, TESTED, LIVE (the `oracle_counterfactual` restriction-only hosted stage).
