# IP Evolution 10: Final Report

**Date:** 2026-10-04
**Status:** TESTED + DEPLOYED (blue + green, 3 domains). The default mode is MONITORING; PROTECTED and HIGH_ASSURANCE are opt-in per tenant and product.
**Commits:** `2c2b451` (E10 library), `7a75b62` (store integrity + live enforcement), `3289089` (named draft refusal).
**Evidence bundle:** `evolution-10-governance-attestation-2026-10-04`, on clawx.click `/evidence/` and on cainstudio.online / mcpgate.online `/proof/bundle/`.

Numbers in this report come from the bundle files named in brackets. Where a number is not in the bundle, the report says so.

## 1. Executive summary

E10 started as a library that could detect governance change. It is now in the live contract path. Building it exposed a CRITICAL defect in existing code:

- **Before (E10F-01):** the live decision trusted authority state just because it was in the database. Setting a revoked contract back to ACTIVE in SQLite produced ALLOW. So did restoring an exhausted contract's uses, or widening or un-revoking a RIG agent.
- **After:** every such row is checked against logs the database alone cannot forge, and the decision is a receipted DENY.

E10 itself:

- fingerprints each agent's governance state in 11 dimensions;
- classifies changes, including implicit authority expansion;
- signs envelopes and attestations;
- verifies offline with a script that imports no CAIN code;
- in PROTECTED mode, refuses execution when the verified state has drifted, including drift that lands between the decision and the E8 commit.

**It never grants authority.**

## 2. Starting state (forensic)

| Item | Measured at start |
|---|---|
| E10 | Library only (`2c2b451`), no route; `EnvelopeGuard` opt-in, wired nowhere |
| decide() per-invoke checks | identity key, RIG chain, amplification, declared model digest, environment, policy digest, epoch, validity |
| Database rows | **trusted as stored** (E10F-01, E10F-02) |
| RIG REGISTER audit | did not record the public key (E10F-03) |
| E7 proof coverage | 2 of the 7 decision/execution components (E10F-04) |
| Key separation | all keys on the gateway host (see KEY_SEPARATION.md) |

Parallel sessions owned E7/E8/E9 (session -2b) and E12/E11 (session -78). Their files were not edited. The shared files changed here (the contract fabric, RIG, the contracts router, and `main.py`'s operator list) carry only E10 hunks, committed by explicit path.

## 3. What was implemented

| Component | File | Notes |
|---|---|---|
| Snapshot / BOM / fingerprint / change detector / impact / migration plan / change policy / envelope / rollback check / attestation log | `cain_governance_attestation.py` | E10 library, extended: store-integrity status and key attestation in the agent BOM |
| Store integrity | `cain_store_integrity.py` | new |
| Live runtime: modes, envelopes, gate, adapter | `cain_attestation_runtime.py` | new |
| API | `routers/governance_attestation.py`, `/fabric/contracts/attestation/{trust,status,envelope,mode,assess,log,export/{agent},rollback-check}` | new |
| Clean-room verifier | `scripts/attestation_verify_offline.py` | zero CAIN imports, tested by AST |
| Bundle builder | `scripts/build_evolution10_bundle.py` | new |

## 4. What runs in live execution

- **Every contract invoke, authorize, activate and E8 commit on blue and green:** the store-integrity check (contract rows and the RIG chain).
- **Every product policy-digest read:** the E10 adapter, installed under the E9 package adapter as `PackageEnforcingAdapter(AttestationEnforcingAdapter(raw))`.

| Mode | Behaviour |
|---|---|
| OBSERVATION | not assessed |
| MONITORING (default) | assessed (rate-limited to once per 60 s per agent) and attested; never blocks |
| PROTECTED | must be CONTINUE, with an attested RIG key; otherwise the policy digest becomes `UNAVAILABLE`, so DENY and no E8 token |
| HIGH_ASSURANCE | PROTECTED, plus the assessment must be L3 (E7 proofs VALID) |

A CONTINUE returns the inner digest unchanged, so switching modes never re-binds contracts. Establishing an envelope and changing a mode need the operator credential and refuse agent keys.

**Live check** [LIVE_DEPLOYMENT.json]: all 5 targets passed (blue 8088, green 8098, cainstudio.online, mcpgate.online, clawx.click). On each one:

- a contract invoke through the integrity path (ALLOW, E8 COMMITTED);
- envelope without the operator credential: 403;
- assess: CONTINUE;
- offline verification of the live envelope and attestations: OK;
- cross-tenant export: 404; cross-tenant assess: UNKNOWN / NO_ENVELOPE;
- a PROTECTED round trip on test tenant a02: refused with no envelope, ALLOW with one, mode restored.

**Observed live:** envelopes were L2 on blue/green and L3 on the domains in the same run. My commit had changed `cain_governance_contract.py`, so E7's proofs were STALE. The E7 owner re-ran its gate at 12:53Z (`2069cb5`) and later envelopes were L3. That is the designed behaviour: stale proofs lower the assurance level, and they never raise it.

## 5. Security changes

- **E10F-01 (CRITICAL, existing code, fixed):** contract state, uses and body edits were obeyed.
- **E10F-02 (HIGH, existing code, fixed):** RIG row edits were obeyed (scopes, actions, parent, runtime digest, revocation).
- **E10F-03 (MEDIUM, fixed going forward):** the RIG key is now logged. 76 live agents predate this and are labelled KEY_UNATTESTED.
- **E10F-04 (MEDIUM, mitigated):** E10 hashes all 13 decision, execution, verification and compiler components. E7 coverage of the product engines is the E7 owner's change.
- **Draft refusal:** an enforcing-boundary refusal at draft is now `POLICY_UNAVAILABLE` (it was a misleading 422 about the body).

## 6. Database authority-integrity analysis

| Row | Source of truth checked | Result on a mismatch |
|---|---|---|
| `contracts.state` | HMAC transition chain: the last transition for the contract must end in this state, from the state before it | DENY `STATE_INTEGRITY_TAMPERED` |
| `contracts.uses` | count of Ed25519-signed ALLOW decision receipts in the chained receipt log | DENY |
| `contracts.body` / `fingerprint` | `fingerprint(body)`; the fingerprint is bound into each transition hash; issuer signature over (fingerprint, authority digest) | DENY |
| forged row (no log) | must have a transition | DENY |
| `rig_agents.*` | RIG HMAC audit chain: REGISTER (actions, scopes, parent, runtime digest, key) and REVOKE_AGENT (monotonic) | snapshot UNAVAILABLE, so DENY `AUTHORITY_UNAVAILABLE`; authorize refuses |

How the check works:

- Logs are replayed incrementally. Each entry is verified once, and the state it implies is held in memory.
- Rewriting the last verified entry marks the whole log TAMPERED (sticky).
- A fresh process replays from genesis.

**Dry run on copies of the live stores, with production keys and before deployment:** 30/30 contracts OK, the RIG audit chain intact, 76 agents KEY_UNATTESTED.

**Remaining gaps (UNKNOWN / documented):**
- Truncating log entries that no process has read yet is not detectable from the database alone. It needs an external anchor.
- Nonce rows are not derived; the replay window is the 60 s invocation skew, bounded by the remaining uses, which are checked.
- An attacker holding the HMAC or signing keys can forge everything above.

## 7. Revocation and rollback

Tested against real stores [INVARIANTS.json INV-E10-03]:

- a revoked agent un-revoked in the store;
- a revoked parent un-revoked in the store (the child stays denied);
- a revoked contract resurrected;
- an exhausted contract re-opened;
- an epoch rolled back;
- `rollback_check` refusing to restore revoked agents or contracts, a lower epoch, retired notary keys, dropped evidence, or known-bad code (also over the API).

Revocation in the RIG audit log is monotonic: no event removes it.

**Not tested:** revocation propagation across replicas. There are none for these stores; see §8.

## 8. Distributed consistency

**Honest scope.** E10 state (envelopes, modes, the attestation log) and the contract stores are SQLite per tenant, shared by the blue and green processes on one host. Each process verifies the logs itself.

| Situation | Status |
|---|---|
| concurrent invokes (4 threads × 5) never trip the check; uses equal signed ALLOWs | tested |
| tamper between decision and E8 commit (E8 REFUSED) | tested |
| a fresh process (restart, the other instance) rebuilds from the logs | tested |
| multi-host replication, partitions, stale replicas, split brain | **UNKNOWN / NOT TESTED**. There is no multi-host deployment of these stores. E9's package registry has an in-process quorum (E9's own claim). |
| required guarantee for PROTECTED | a read of committed rows on the local host, with each process verifying the logs independently. **No stronger guarantee is claimed.** |

## 9. Clean-room verification

`attestation_verify_offline.py` imports only the standard library and `cryptography`; this is checked by AST in tests. It independently recomputes:

- the 11 dimension digests from the envelope BOM;
- the composite digest;
- the envelope digest and signature;
- the attestation chain and signatures;
- the L4 continuity rule.

It agrees with the runtime on dimensions and levels, and rejects every tamper vector [CLEANROOM_VECTORS.json]:

- level raised;
- authority claimed;
- model swapped;
- verdict flipped;
- an entry dropped;
- entries reordered;
- the wrong key.

**Boundary:** the verifier checks integrity and consistency of the signed statements. It does **not** establish that the observed state is true, and the signing key is the operator's own (NOT INDEPENDENTLY VERIFIED).

## 10. Auditor pack

The SCITT auditor pack (`POST /fabric/scitt/auditor-pack`, owned by the four-product session) was not modified. E10 evidence is exported separately (`/fabric/contracts/attestation/export/{agent}`) and verified by its own clean-room script. Merging the two exports into one pack is **NOT DONE** in this evolution.

## 11. Performance (single host, 4 vCPU)

- **Unchanged from the E10 library run** [RESULT_BENCH.json]: agent check against real stores at 1,000 agents, p50 13 ms; in-memory fingerprint about 0.28 ms; 1,000-agent sweep 37 s → 16 s after the profiled SQL fix.
- **New:** `invoke()` latency per mode, end to end [PROTECTED_ROUTE_LATENCY.json].
- **Not measured:** 10,000 or 100,000 agents against real stores; multi-host.

## 12. Test results

- E10 suites plus the contract / E9 / E4 / E5 / SDK / RIG / SCITT / MemVault / OpenShell / auditor-pack / tenant-isolation regression [TEST_RESULTS.json].
- Full repository suite, run in chunks [FULL_SUITE.json]. A single-process run was OOM-killed at 6% on this shared 7.4 GB host; that is recorded, not hidden.

## 13. Bugs discovered

E10F-01 to E10F-04 (above). Defects in the new E10 code that its own tests caught:
- BOM aliasing;
- FastAPI model resolution through another module's globals (422 on every POST);
- a docstring over-claim about in-process edit detection;
- the misleading draft error.

## 14. Bugs fixed

All of the above, except: E10F-03 for agents that already exist (labelled), and E10F-04 (E7's own change).

## 15. Known limitations

- Not built: behavioural drift (§21 of the E10 prompt), the patch compiler, the incident engine, canary and blue/green governance, and Studio UI.
- The model digest is DECLARED, not observed.
- The scope is the contract fabric only; other Frontier-20 products are UNSUPPORTED.
- Every key is on the gateway host.
- Monitoring attestations are rate-limited to once per 60 s per agent.

## 16. UNKNOWN states

- multi-host consistency of E10 and contract stores;
- truncation before first read;
- whether any live customer will run PROTECTED (none do today);
- HMAC key rotation (NOT IMPLEMENTED: rotating today would deny every contract).

## 17. Public claim matrix

| Claim | Label |
|---|---|
| Database edits to contract or RIG authority are refused at the live decision | VERIFIED (tests + live dry run + deployed) |
| E10 attestation enforces in PROTECTED mode on the live contract path | VERIFIED (tests + live round trip on a test tenant) |
| Attestations verify offline without CAIN code | VERIFIED; NOT INDEPENDENTLY VERIFIED (operator key) |
| Continuous L4 assurance for any customer | NOT CLAIMED (no customer runs PROTECTED; monitoring only) |
| Multi-host consistency | UNKNOWN |
| Certification or audit | NOT CLAIMED |

## 18. Commercialization readiness

For the $2,500 pilot:

| Step | Status |
|---|---|
| governed setup | yes |
| protected execution | yes, opt-in |
| governance attestation | yes |
| change detection | yes |
| affected-contract analysis | yes: the impact list in each assessment |
| revocation handling | yes |
| offline verification | yes: the E10 script and the SCITT auditor kit |
| a single weekly auditor pack including E10 | **not yet** (two exports) |

## 19. Reproduction cost (this evolution only, code rather than business value)

About 2–3 senior engineer-weeks on top of E1–E9. That covers the store-integrity design against existing log formats, enforcement through the policy digest without changing decide(), the clean-room verifier, and the tests against real stores. Most of the difficulty is in knowing which existing invariants to rely on (the HMAC transition chain, the receipt signatures, the RIG audit), which comes from E1–E9. Business value is not estimated here.

## 20. IP value analysis (candidates for counsel; patentability is not claimed)

1. Event-sourced verification of authority rows against domain-separated MAC'd or signed logs inside the live decision, keeping a pure decision function.
2. Enforcement of a continuous-attestation verdict through the product policy digest, so a verdict change between decision and commit refuses the commit without a new authorization path.
3. Explicit versus implicit authority-expansion classification over delegation chains (from the E10 library).

## 21. Evidence manifest

See `MANIFEST.json` in the bundle. It lists file sha256 values, `git_head` and source sha256 commitments; source is not published.

## 22. Identifiers

| Kind | Value |
|---|---|
| Code commits | `2c2b451`, `7a75b62`, `3289089` |
| Bundle | `evolution-10-governance-attestation-2026-10-04` |
| E10 attestation key id (live) | `c3e7b2064f5148c6` |

## 23. Recommended E11 architecture

E11 is owned by session -78. Recommended scope:

- Anchor the transition, receipt and RIG-audit heads, plus E10 attestation heads, in SCITT checkpoints countersigned by a key held off this host.
- Distribute the publisher, contract-root and E10 keys out of band.
- Merge E10 exports into the auditor pack.

Those three steps would turn several items in this report from NOT INDEPENDENTLY VERIFIED and UNKNOWN into verifiable claims.
