# CAIN-42 L5 Autonomy Constitution — Specification

**CAIN-42 governs L5-class autonomous agents.**

| Field | Value |
|---|---|
| Document | `CAIN42_L5_AUTONOMY_SPEC.md` |
| Evolution | CAIN-42 Evolution #1 of 42 |
| Version | 1.0 — 2026-09-28 |
| Status | **IMPLEMENTED as a TESTED library (`cain45/l5/`); NOT in the hosted path; L5 is not claimed** |
| Kernel | `cain45/l5/` (package), version `42.1.0` |
| Doctrine | [`CAIN-7-MOATS.md`](../architecture/CAIN-7-MOATS.md), [`CAIN42-TO-GOVERNED-L5-AGENT.md`](CAIN42-TO-GOVERNED-L5-AGENT.md) |

> **L5 is not unrestricted autonomy.** L5 means *sustained autonomous operation in which routine human
> intervention is not required while CAIN-42 continuously governs identity, authority, policy, trust, risk,
> resource scope, execution, recovery and revocation.* HIGH AUTONOMY + LOW ROUTINE INTERVENTION + HIGH
> GOVERNANCE.

---

## 1. The operational autonomy states (Part II)

| State | Operational meaning | May cause consequential effects? |
|---|---|---|
| **L0** | No meaningful autonomous operation: observe only | No |
| **L1** | Assisted execution: the agent may act only under direct step-by-step human direction | Only under direct human action |
| **L2** | Delegated execution: a human delegates a specific bounded task | Yes, within the delegated task only |
| **L3** | Conditional autonomous execution: bounded, reversible, low-risk actions under a short-lived certified authorization | Yes, under a live authority lease |
| **L4** | Sustained autonomous operation with bounded human intervention: multi-step, long-horizon, over tools and sessions | Yes, under continuous leases and budgets |
| **L5** | Sustained autonomous operation in which routine human intervention is not required, while CAIN-42 continuously governs | Yes, only under continuously re-verified authority |

**Hard rule.** An autonomy level is *descriptive metadata*. The authority decision never reads it. Setting a
vector to L5 changes nothing about what is authorized; setting it to L0 does not weaken security. This is
enforced by `cain45/l5/invariants.py` (I19) and, historically, by
`tests/clawx_foundation/test_autonomy_and_risk_are_decorative.py`.

**L5 is a governance state, not a score.** There is no `score()` in the kernel. Autonomy is reported as the
vector in §2.

---

## 2. The L5 Autonomy Vector (Part III)

Twelve dimensions (`cain45/l5/autonomy.py`, `DIMENSIONS`). **A1 TASK, A2 PLANNING, A3 TOOL, A4 EXECUTION,
A5 DELEGATION, A6 MEMORY, A7 LEARNING, A8 RESOURCE, A9 RECOVERY, A10 SELF_MODIFICATION, A11 MULTI_AGENT,
A12 ENVIRONMENTAL.**

Each dimension carries: `current`, `maximum`, `policy_ceiling`, and the
`trust_requirement` / `risk_requirement` / `authority_requirement` / `evidence_requirement` /
`revocation_rule`. Invariant: `current ≤ maximum ≤ policy_ceiling`.

An agent may be **L5 in task autonomy and L2 in self-modification autonomy**. That is intentional and is the
reason a single "L5 score" is forbidden. `widen()` reports any dimension whose level is raised, so a
widening always requires governed approval.

---

## 3. Authority Root (Part V)

`authority_root(states) = digest("CAIN42/L5-AUTHORITY-ROOT/v1", {10 state roots})` — implemented with the
existing `cain45.canon` canonical serialization, not a second scheme. A missing state root raises: an unknown
state is never silently treated as trusted.

```
AUTHORITY_ROOT = H(
  identity_state, policy_state, trust_state, quorum_state, delegation_state,
  resource_state, risk_state, trajectory_state, environment_state, certificate_state )
```

---

## 4. Capability is not authority (Part VI)

`CAPABILITY != AUTHORITY`. A model may know an action; a tool may be able to perform it; an agent may request
it; a sandbox may permit the process to attempt it. None of these establishes authority. The kernel computes
authority only from governed state, and `cain45/l5/governance.py` refuses to treat any object tagged
`SIMULATED`, `PREDICTION`, `COUNTERFACTUAL`, `AGENT_VOTE`, `MEMORY`, `WORLD_MODEL` or `NONE` as a certified
decision.

---

## 5. Effective L5 authority (Part VII)

```
EFFECTIVE_AUTHORITY = MIN(
  IDENTITY, POLICY, TRUST, QUORUM, CERTIFICATE, DELEGATION,
  RESOURCE_SCOPE, RISK_BOUNDARY, BLAST_RADIUS, TRAJECTORY, ENVIRONMENT, EXPIRATION )
```

Not additive. `effective_l5_authority(constraints)` returns `ALLOW` with `permitted_level = min(...)`, or
`DENY` / `REVALIDATE` when a constraint fails with the corresponding failure mode. One failed mandatory
condition cannot be offset by raising any other dimension.

---

## 6. Continuous authorization (Part VIII)

Every consequential action re-enters:

```
OBSERVE → IDENTIFY → EVALUATE → AUTHORIZE → EXECUTE → OBSERVE RESULT → VERIFY
→ UPDATE TRUST → UPDATE TRAJECTORY → REVALIDATE AUTHORITY
```

The canonical decision point is `L5ExecutionGate.evaluate(GateInput)` (`cain45/l5/governance.py`). Authority
may fall, expire or be revoked *during* execution; the gate re-checks identity, policy binding, trust,
quorum, certificate, delegation, resource, risk, blast radius, trajectory, environment, memory, world model,
evidence and clock on every call.

---

## 7. Autonomy leases (Part IX)

`AutonomyLease` binds TIME, TASK, RESOURCE, TOOL, DATA, NETWORK, DELEGATION, SPEND, TRAJECTORY, ENVIRONMENT,
RISK and BLAST_RADIUS. Leases are signed, versioned, revocable, renewable, auditable and evidence-backed.
`AutonomyLeaseManager.renew` refuses when the renewer is the subject, when trust or policy conditions are not
met, when the lease is revoked or already expired, or when the maximum renewal count is reached. A renewed
lease must be re-signed. **A lease cannot renew merely because the agent requests renewal.**

---

## 8. Human control modes (Part X)

Explicit modes: **OPERATOR, COLLABORATOR, CONSULTANT, APPROVER, OBSERVER**. For L5, routine operation may sit
at OBSERVER; a consequential exception may transition to APPROVER or ESCALATION_REQUIRED without destroying
the agent's autonomy. The gate returns `ESCALATE` when the action requires a higher permitted level than the
current authority grants.

---

## 9. Emergency human override (Part XI)

`EmergencyOverride` is an authenticated, authorized, scoped, revocable, evidenced and replayable authoritative
event. It may only force `READ_ONLY`, `QUARANTINED` or `STOPPED`; `sign()` refuses any target that would
grant authority. There is no administrator backdoor: the override itself is an authoritative event with a
signature and a digest.

---

## 10. Autonomy degradation (Part XII)

`downgrade(state, trigger)` returns a deterministic target for each trigger (trust degradation, policy
conflict, stale certificate, expired lease, key compromise, trajectory drift, world-state uncertainty, memory
poisoning, tool integrity failure, blast-radius increase, resource exhaustion, consensus loss, evidence
failure, repeated action failure, unexpected environment change). A downgrade can only lower the rank
(`STATE_RANK`); `REVALIDATE` is returned when the trigger requires re-authorization rather than a level change.

---

## 11. The L5 execution gate — outputs (Part XXI)

`ALLOW`, `DENY`, `REVALIDATE`, `PAUSE`, `ESCALATE`, `QUARANTINE`, `ROLLBACK`. Every decision produces an
evidence record with a deterministic `decision_digest` (domain `CAIN42/L5-EXECUTION-DECISION/v1`).

## 12. Machine-readable reasons (Part XXII)

`cain45/l5/authority.py:Reason` — e.g. `AUTHORITY_LEASE_EXPIRED`, `TRUST_BELOW_THRESHOLD`,
`TOOL_SCOPE_EXCEEDED`, `BLAST_RADIUS_EXCEEDED`, `TRAJECTORY_DRIFT`, `POLICY_CONFLICT`, `QUORUM_UNAVAILABLE`,
`EVIDENCE_INVALID`, `CERTIFICATE_TAMPERED`, `CLOCK_ROLLBACK`. The system never returns only `DENIED`.

---

## 13. Non-fabrication invariant (Part XIII)

`cain45/l5/invariants.py` executes I01–I20 (`check_all()`), including *an agent cannot create its own
authority*: fake approval, fake certificate, self-policy/trust/identity modification, self-admission, fake
evidence, replay, hidden subagent and delegation escalation all fail closed.

---

## 14. Registry, admission and lifecycle (Parts XV, XVI)

`L5AgentRegistry` holds identity, owner, sponsor accountability, purpose, model, version, tool/policy set,
authority ceiling, autonomy vector, lease, trust/risk state, trajectory, children, budget, evidence and
lifecycle. Lifecycle: `PROPOSED → REGISTERED → VERIFIED → ADMITTED → ACTIVE → DEGRADED → QUARANTINED →
REVOKED → RETIRED`; transitions into `ADMITTED`/`ACTIVE` require an externally certified decision, so no
agent admits or activates itself. `L5AdmissionGate` requires all 15 admission requirements; partial admission
is not admission, and failing requirements do not admit.

## 15. Change control (Parts XVII–XX)

Model change, tool change, memory change and world-model mismatch each yield `REVALIDATE`
(`RISK_REASSESSMENT` for a world-model mismatch). A tool identity change invalidates the existing certificate.
A memory update never expands authority. A prediction is never treated as reality.

---

## 16. What "done" means (Part XXVIII)

**No public claim of "CAIN-42 is L5" is made.** The published state is *L5 GOVERNANCE READINESS* across
ARCHITECTURE / IMPLEMENTATION / TESTING / VERIFICATION / PRODUCTION / EVIDENCE
(`CAIN42_L5_GOVERNANCE_READINESS.json`). The mandatory conformance gate
(`CAIN42_L5_CONFORMANCE_MATRIX.json`) is **not admitted**: live, hosted, independent and third-party items
remain. The library kernel is real and tested; the L5 operating claim requires all five locks from
[`CAIN42-TO-GOVERNED-L5-AGENT.md`](CAIN42-TO-GOVERNED-L5-AGENT.md) §2.

---

## 17. Constitutional doctrine (inherited by Evolutions 2–42)

An agent may think, plan, learn, remember, predict, delegate, discover tools, create candidate tools, evolve
and operate autonomously. But capability, intelligence, memory, prediction, simulation, agent consensus,
self-modification and delegation do **not** create authority. Only governed CAIN-42 authority state may
authorize consequential execution.

**L5 does not mean uncontrolled. L5 means autonomously operating under continuously verified governance.
NO CURRENT AUTHORITY = NO CONSEQUENTIAL EXECUTION.**
