# Project Sovereign — Evolution 1 of 42: final report

Session cain-studio-platform-46, with -17 (verifygate, alternative routes, host enforcement, ledger; see `s17/`) and
-98 (`ihvrk/`, separate). 2026-10-12. Labels: **[observed]** run or read in this session; **[model]** inside the Z3
model under assumptions A1–A7; **[assumed]**; **[unverified]**.

## A. Executive verdict

Evolution 1 traced the two paths that can actually execute a tool call: the MCPGate proxy and the hosted `/mcp`
pipeline. It reproduced 10 fail-open defects on those paths and fixed 9 of them with tests that fail on the old code.
It also checked a Z3 model of the changed decision logic and wrote the evidence set. The headline defect is
**D-S46-10**: a quarantined agent could still make MCPGate call the tool by presenting its own capability token.
It is fixed in 3eff02c2. One defect, **D-S46-11**, stays open as an owner decision: an agent's own token turns the
operator allowlist's REQUIRE_APPROVAL into ALLOW.

**Deployed** by -17 with owner approval (tag `deploy/20261012T034805Z`, bf225092, both blue and green). **Production release gate: BLOCKED.** **Local development gate: PASS.** Nothing here establishes L5 containment.

## B. Revision and working tree

Start `6cfa3b9e` on `ironclad-prompt8-qualification` (no git remote). The working tree started with 150 dirty paths
owned by other sessions, which were left untouched. -46 commits: `c0b6a64b`, `3eff02c2`, plus this report's commit;
each was committed by explicit path (shared index). Deployed in bf225092 (tag `deploy/20261012T034805Z`); -46 confirmed both instances started after 3eff02c2 and run the committed files. Peer commits referenced: `3537d76e`, `a098fa61`, `e6978002`,
`b2d91354` (-17). Details: `baseline.md`, `changed_files.md`.

## C. Tests: baseline vs after

| Run | Exit | Passed | Failed | Other |
|---|---|---|---|---|
| Baseline, 16 core suites (-17) at 6cfa3b9e | 0 | 174 | 0 | |
| Baseline, 16 core + hosted-pipeline suites (-46) at 6cfa3b9e | 0 | 191 | 0 | |
| New `test_sovereign_e1_hosted_proof_stage_fail_closed.py` on 6cfa3b9e (fail-before) | 1 | 11 | 14 | |
| New `test_sovereign_e1_mcpgate_capability_boundary.py` on 6cfa3b9e (fail-before) | 1 | 1 | 4 | 2 xfailed |
| After c0b6a64b: core + hosted + both -17 E1 files + new file | 0 | 393 | 0 | |
| After 3eff02c2: 56 MCPGate/guard/capability/JIT/sovereign/continuum files | 1 | 1168 | 2 | 2 xfailed (D-S46-11) |

The 2 failures in the last row are `test_cain_sentinel_guardian.py`. That test reads a live health snapshot that
currently says DEGRADED, and it also fails on 6cfa3b9e **[observed]**. -17 independently re-ran 209 passed / 0
failed at c0b6a64b. Fail-before runs used an isolated `git worktree` of 6cfa3b9e.

## D. Defects reproduced and fixed (full list: `traceability_matrix.json` → `defects`)

| ID | Sev | Where | Defect | State |
|---|---|---|---|---|
| D-S46-10 | P0 | `cain/mcp_proxy.py` | Capability-token branch skipped containment: a quarantined agent got ALLOW; the HTTP proxy called the tool (1 downstream hit) and only withheld the result; stdio executed outright | FIXED 3eff02c2 |
| D-S46-08 | P0 latent | `hosted_pipeline.py` | Strict mode was satisfied by any stage's ALLOW: a random `_cain_nonce` executed with no proof | FIXED c0b6a64b |
| D-S46-06 | P0 latent | `hosted_pipeline.py` | An unpinned proof stage accepted a PROVED claim signed by any key | FIXED c0b6a64b |
| D-S46-01/02 | P2 | `hosted_pipeline.py` | v28 builder gave the stage no ledger, and an empty nonce skipped the replay check, so proofs were replayable | FIXED c0b6a64b |
| D-S46-03/04/05 | P2 | `hosted_pipeline.py` | An empty arguments digest, agent/tenant, or `valid_until` acted as a wildcard | FIXED c0b6a64b |
| D-S46-07 | P2 | `hosted_pipeline.py` | Nonce was burned before the signature check, so a forged copy voided the legitimate proof | FIXED c0b6a64b |
| D-S46-09 | P5 | two test files | Tests appended to the live hosted decision ledger (12 rows per run) | FIXED c0b6a64b |
| D-S46-11 | P1 | `cain/mcp_proxy.py` | An identity grant on a self-signed token overrides the operator allowlist / REQUIRE_APPROVAL | **OPEN, owner** |
| D-S46-12 | P6 | 4 library verifiers | Optional signer pin, so None accepts any key (no production caller) | OPEN (Evo-2 E2-4) |
| D-S17-01..07 | P1–P6 | verifygate, continuum route, eBPF, proof runs | see `s17/findings.json` | 01–05 fixed by -17 |

"Latent" means the code is reachable only through a configuration production does not use today: live runs pipeline
v27 with strict mode off **[observed]**.

## E. Formal model, properties, results, assumptions

`formal/authorization_model.py` (z3 5.1.0, stand-alone) → `formal/z3_results.json`: **21/21 results match their
expectation**. For the fixed logic, 9 forbidden states are UNSAT: strict execution without a valid proof, strict
execution with an unproved status, unpinned signer, unbound or changed arguments, other principal,
expired/unbounded validity, the same proof allowed twice, any-stage DENY executed, and a contained agent forwarded.
A tenth, token execution with changed parameters, is checked against the fixed logic only. The pre-fix logic gives
SAT on 7 of these (sensitivity check); the DENY-executed property is UNSAT in both versions. Two SAT results are
reported, not hidden: the operator allowlist is overridden (open D-S46-11), and an attacker who holds the pinned key
gets through (assumption A2 dropped). **[model]** These are UNSAT results inside a hand-written Boolean abstraction
of the code, not over the code itself; the regression tests tie the two together. The model says nothing about the
LLM, the tool, the OS, the kernel or the hardware.

On real Z3 use in the repo: `cain/formal/z3_solver_gate.py` interprets results correctly (PROVED only on UNSAT of the
negated safety predicate; UNKNOWN→TIMEOUT/UNKNOWN, never PROVED) **[observed]**. However, every variable is grounded to
a constant, so it decides one concrete action rather than proving anything over an input space, and it has **no
production caller**. -17 fixed four verifygate defects in which unknown inputs or solver UNKNOWN produced
`proved=True` or a fabricated SAT label.

## F. Authorization-to-execution trace

MCPGate proxy (`cain/mcp_proxy.py`) **[observed]**:
1. Method gate (only the handshake, listing and notification methods pass ungoverned).
2. Opt-in guard-stack precheck.
3. `evaluate_tool_call`: tool-metadata guard → identity binding (opt-in) → self-authoring deny → trajectory gate →
   **capability-token branch** (signature → action/resource → registered principal and grant → model continuity →
   parameter hash → **containment (new)** → atomic nonce) **or** fast-path cache (+ quarantine re-read) **or**
   deterministic baseline (allowlist, quarantine, risk floor).
4. Opt-in restriction-only gates.
5. Frontier gate.
6. Trifecta guard / guard stack.
7. `consume_jit_capability` (single-use, bound to the context digest).
8. Forward `downstream_message` (envelope stripped).
9. HTTP only: mid-flight and pre-release containment re-check.
10. Postcondition is UNVERIFIED unless a checker is registered.

Hosted `/mcp` (`HostedPipelineMiddleware`, live v27): guard-stack middleware → restriction-only stages (first DENY
wins) → strict mode (off) → tool. No solver runs on either path, and neither PCAA module is on either path.
Inventory: `repository_inventory.json`.

## G. Enforcement coverage and bypasses

Everything verified here is **application-level** enforcement in the gateway or proxy process. It does not survive
compromise of that process, its container, the kernel or the hardware. Per -17 (T-S17-05), `cain_enforce.bpf.c` is
tracepoint telemetry, not syscall denial, so there is no kernel enforcement on the hosted path. That is a BLOCKER for
any containment claim. The published overclaim of that program (D-S17-06) is PARTIAL: with owner approval -17 corrected IP recalc V38
(9fc79332); V33–V37 and V39–V45 still carry the old wording, pending the owner. Other routes checked by -17 are in `s17/findings.json → alternative_routes_checked`. Open
bypass-class items: D-S46-11, T-S46-05 (self-asserted caller identity on hosted `/mcp`) and T-S46-06 (replay across
blue/green or after a failed ledger write).

## H. Evidence artifacts

`evidence_manifest.json` lists every artifact with its SHA-256. `KIT_SLOT.json` is the publish contract for the
auditor kit and Verification Center (publisher: session -82). The kit carries data, reports and the stand-alone
model only, with no implementation source and no keys. The live hosted ledger hash chain verifies (`True, 1163`),
but rows 1133–1150 are test-origin rows and are retained, not deleted.

## I. Blockers and residual risks

BLOCKERS:
- D-S46-11 (owner decision)
- T-S17-05 no kernel enforcement (owner decision)
- authorization suites not in CI

Resolved during this evolution: T-S17-03 (offline fallback now fails closed, 9672bdc1); green :8098 back up after the deploy.
Not probed live: the D-S46-10 containment fix (it would need a live agent quarantined); its evidence is the regression suite.

Residual risks:
- pinned-key theft (A2)
- PROVED is a signed claim, not re-verified (E2-5)
- no policy-epoch check on hosted proofs (I7)
- per-process nonce stores (T-S46-06)
- no durable request-bound MCPGate ledger (T-S17-06)
- the model is an abstraction (E2-10)

## J. Release verdict

**BLOCKED** (production). See `release_gate.json`: G2 and G7 PASS; G4 and G6 PARTIAL; G1, G3, G5 and G8 FAIL.

## K. Next steps (Evolution 2)

`EVOLUTION-02-SPEC.md`: owner decisions D-S46-11 and T-S17-05, then E2-1 through E2-10. Highest-value first:
- authenticated principal binding (E2-1)
- shared durable nonce store (E2-2)
- CI wiring (E2-7)

## Reusable capabilities (Phase 12): candidates only, no novelty or patentability claimed

| Capability | Status | Source / tests | Evidence still needed |
|---|---|---|---|
| Action-bound single-use proof at a restriction-only pipeline | IMPLEMENTED_AND_TESTED | `hosted_pipeline.py`, `test_sovereign_e1_hosted_proof_stage_fail_closed.py` | cross-process store (E2-2), prior-art search |
| Strict mode = specific-stage ALLOW (not "any ALLOW") | IMPLEMENTED_AND_TESTED | same | prior-art search |
| Capability tokens that add requirements and never substitute for boundary policy | PARTIAL (containment yes, allowlist open) | `mcp_proxy.py`, `test_sovereign_e1_mcpgate_capability_boundary.py` | owner decision D-S46-11 |
| Counterexample-query model with a pre-fix mutant column | FORMALLY_CHECKED_WITH_STATED_ASSUMPTIONS | `formal/authorization_model.py` | model–code linkage (E2-10) |

No Top-100 entries were added or changed. The registry has no entry for the live enforcement boundary and holds 14
duplicate names (`repository_inventory.json`); that is for the registry owner to resolve.
