# E240 — Unified 15-Subsystem Governed Organism Architecture

**AGI: NOT ESTABLISHED · RSI: EXPERIMENTAL**

**Entity:** FIRME AI CORPORATION  
**Scope:** Closes E233's forensic finding (*"12-system integrated organism: ABSENT"*) by binding all 15 cognitive, research, persistence, governance, and evidence subsystems specified in the Founder's Maximum Evolution Directive onto **one typed, SHA-256 hash-chained `OrganismEventBus`**, extending E237's `DurableStore` and production `cain.mcp_proxy.MCPTransparentInterceptor`.

---

## 1. Constitutional Execution Loop

```
AGENT / SUBSYSTEM PROPOSES
  → CAIN GOVERNANCE DECIDES (MCPTransparentInterceptor default-deny + budget + policy)
  → ED25519 SINGLE-USE PERMIT MINTED (30s TTL, bound to stage + SHA-256(params))
  → EMERGENCY KILL FENCE CHECKED (independent Ed25519 key)
  → WORKER EXECUTES INSIDE ISOLATED STAGE
  → DURABLE SQLITE WAL JOURNAL + KNOWLEDGE ORGANISM COMMITS EXACTLY ONCE
  → INDEPENDENT CLEAN-ROOM EVALUATOR & OFFLINE VERIFIER CHECKS WITNESSES
  → OMEGA SEAL + CLAWX / CAINSTUDIO / MCPGATE / HF SPACE PUBLISHES
```

**Invariant:** `NO AUTHORIZATION → NO EXECUTION`. No RSI modification can alter `MCPTransparentInterceptor`, `PermitAuthority`, emergency fence keys, or sealed evaluation routines.

---

## 2. The 15 Interconnected Subsystems (`cain/cain2027/e240/`)

| ID | Subsystem | Implementation Module | Primary Responsibility & Typed Bus Contract |
|---|---|---|---|
| **A** | General Intelligence Core | `domains.py`, `organism.py` | Unified problem representation & solver dispatch across 5 distinct domains: Modular Algebra, Graph/Relational Rules, Structural Causal Models, Partially Observable Planning, Sequence DSL |
| **B** | Reasoning & Planning Engine | `domains.py`, `rsi.py` | Compositional best-first/beam search, belief-state POMDP planning, active query synthesis |
| **C** | Causal World Model | `world_model.py` | Executable symbolic SCM learner (DAG recovery + structural equations + active `do()` EIG interventions + counterfactuals + online shift repair) |
| **D** | Persistent Knowledge Organism | `knowledge.py` | SQLite WAL + SHA-256 hash-chained `KnowledgeUnit` store with all 14 required metadata/provenance fields, 6 lifecycle states, contradiction quarantine, poisoning rejection |
| **E** | Continual Learning Engine | `continual.py` | Sequential 5-domain acquisition with protected regression suite, BWT/forgetting tracking, rehearsal, and retrieval-competition measurement |
| **F** | Capability Acquisition Engine | `domains.py`, `transfer.py` | Witness-verified compositional macro/motif abstraction extraction with MDL utility gating |
| **G** | Cross-Domain Transfer Engine | `transfer.py` | Strict separation of (G06) frozen structural knowledge transfer vs (G07) frozen learning-procedure transfer, with isomorphism alignment and leakage audit |
| **H** | Scientific Discovery Engine | `discovery.py` | Explicit `HypothesisTree` with EIG experiment prioritization, competing alternatives, contradiction capture, and negative-result preservation |
| **I** | Recursive Self-Improvement Engine | `rsi.py` | Dual-timescale DGM-style Archive RSI evolving executable `StrategyGenome` across 5 generations (G0–G4) on 3 fresh salts with dev-only promotion and regression gating |
| **J** | Collective Intelligence Engine | `collective.py` | 4-role multi-agent coordination (Proposer, Explorer, Independent Critic/Falsifier, Consolidator) under strictly matched compute budget |
| **K** | Autonomous Engineering System | `rsi.py` | Bounded internal strategy/harness synthesis & automated regression testing inside isolated sandbox (zero production or governance modification) |
| **L** | Independent Evaluation Engine | `stats.py`, `verify_e240_offline.py` | Clean-room statistical evaluation: exact paired McNemar, Wilcoxon signed-rank, Holm-Bonferroni correction, deterministic bootstrap 95% CIs, leakage audit |
| **M** | Long-Horizon Persistence Engine | `bus.py`, `persistence.py` | Extends E237 `DurableStore` with multi-worker SQLite lease table (`leases`), real SIGKILL crash-resume, concurrent 4-worker contention safety, and emergency fence |
| **N** | Governance & Execution Constitution | `governance.py` | Production `cain.mcp_proxy.MCPTransparentInterceptor`, Ed25519 single-use permits, budget accounting, hosted `cainstudio.online/mcp` preflight, 16-vector adversarial red-team lab |
| **O** | Evidence & Reproducibility System | `scripts/evolution240/*`, `verify_e240_offline.py` | Pre-committed SHA-256 salts, deterministic execution, witness export, zero-CAIN-import verifier, 16-mutation tamper suite, OMEGA SEAL, IP Guards G1–G7, 4-surface sync |

---

## 3. Typed Bus & Dataflow Proof

Every experiment stage registers live typed messages on `OrganismEventBus` (`from_subsystem → to_subsystem`, `event_type`, `payload_sha256`, `prev_hash`, `hash`). The offline verifier checks both the bus hash chain AND that all 15 subsystems emitted/received verified messages during the live run, proving architectural integration empirically rather than by diagram.
