File size: 6,900 Bytes
abf6cdc 86b0251 abf6cdc | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 | ---
license: other
license_name: snapkitty-tri-license
license_link: https://huggingface.co/Snapkitty/sovereign-agi-kernel/blob/main/LICENSE
tags:
- snapkitty
- agents
- idris2
- lean4
---
> Source: [github.com/SNAPKITTYWEST/sovereign-agi-kernel](https://github.com/SNAPKITTYWEST/sovereign-agi-kernel)
# Sovereign AGI Kernel
**The first AGI kernel where correctness is enforced by the type system, not by monitoring.**
Built by Ahmad Ali Parr. Formalized in Idris 2 + Lean 4. Zero `sorry`. Zero runtime exceptions for the invariants that matter.
---
## What This Is
Most AI systems trust their own output. This one can't.
Every mathematical claim from any AGI component must pass through a formally verified kernel before it is accepted. The kernel is written in Idris 2 — a dependently-typed language where the **type checker IS the proof checker**. If it compiles, the invariants hold. Not because we tested them. Because violating them is not a valid program.
```
AGI Component
|
v
Reasoning_IDL.verifyClaim() <- only path to acceptance
|
v
SovereignKernel (Idris 2) <- entropy-bounded, WORM-audited
|
v
WORM Audit Chain <- append-only by construction
|
v
ACCEPTED or REJECTED
```
There is no other path.
---
## The Five Axioms
All five are **types**, not policies. They cannot be violated at runtime — they cannot be expressed in the type system at all.
| Axiom | What it means |
|-------|--------------|
| **1. Entropy bound** | `EntropyBound n = LTE n 20` — compile-time. Violating it is not a runtime error. It is a type error. |
| **2. Active ⇒ Trusted** | `Agent Active Untrusted` is an uninhabited type. No constructor exists. Cannot be instantiated. |
| **3. Artifact = Proof** | `%default total` on all Idris files. No `sorry`. No incomplete matches. Compiles = verified. |
| **4. WORM append-only** | `WORMChain` has no `Remove` constructor. Deletion is not prevented — it does not exist. |
| **5. Kernel is sole trust anchor** | No import path from untyped code to kernel internals. Structurally impossible to bypass. |
---
## Architecture
```
sovereign-agi-kernel/
|-- idris/
| |-- AgentModel.idr <- Active=>Trusted by construction
| |-- WORM_Audit.idr <- Append-only hash chain (no Remove)
| |-- Reasoning_IDL.idr <- Formal interface (only path to kernel)
| `-- SovereignKernel.idr <- Entropy-bounded reasoning oracle
|
|-- lean/
| `-- Erdos/ <- Lean 4 proofs (DSS greedy bound)
|
|-- runtime/
| |-- greedy.mjs <- DSS cardinality oracle
| |-- fault-isolation.mjs <- 98% search reduction via DSS
| |-- network-tomography.mjs <- Constant-size packet count
| |-- threshold-crypto.mjs <- Signer count without identity
| `-- financial-forensics.mjs <- Anti-structuring channel count
|
|-- scaffold/
| `-- agi_gate.py <- Python integration (kernel-gated reasoning)
|
|-- sovereign/scripts/
| |-- build_sovereign.sh <- Idris 2 + Lean 4 build
| |-- validate_entropy.sh <- Entropy bound verification
| `-- commit_to_worm.sh <- WORM seal
|
|-- FORBIDDEN/ <- Zones that invalidate ValidationProof
|-- ROOT_CLAIMS.md <- 5 non-negotiable axioms (all are types)
|-- CI_SOVEREIGN.yml <- 5-stage pipeline
|-- Dockerfile <- Air-gapped multi-stage build
`-- Makefile <- Local dev targets
```
---
## The DSS Oracle
The runtime implements a **Distinct Subset Sum (DSS) cardinality oracle** — a formally proved combinatorial engine that determines cardinality from aggregate sums without enumerating members.
Four production applications:
| Application | What it solves |
|-------------|---------------|
| **Fault Isolation** | Interaction order from test signal — 98% search reduction |
| **Network Tomography** | Packet count from aggregate ACK — constant-size |
| **Threshold Cryptography** | Signer count without identity — privacy + soundness |
| **Financial Forensics** | Channel count for anti-structuring detection |
All four are formally bounded by the Erdős-Straus greedy bound, proved in Lean 4.
---
## Run It
```bash
# Build the Idris 2 kernel
make idris
# Run entropy validation
make verify
# Run DSS oracle (all 4 applications)
cd runtime && node main.mjs
# Run Python AGI gate integration
python scaffold/agi_gate.py
# Seal to WORM
make seal
# Full pipeline
make gate
```
---
## CI Pipeline (5 stages)
```
Stage 1: FORBIDDEN zone check <- Fails if banned patterns detected
Stage 2: Idris 2 kernel build <- Fails if types don't hold
Stage 3: Entropy bound validation <- Fails if H > 0.20
Stage 4: Runtime oracle tests <- Fails if DSS oracle wrong
Stage 5: WORM commit <- Seals artifact hash on success
```
If Stage 2 fails, the kernel invariants are violated. The build does not proceed.
---
## Why Idris 2
Every other AGI safety approach uses one of:
- Runtime monitors (can be bypassed)
- Test suites (can miss edge cases)
- RLHF alignment (can drift)
- Constitutional AI (enforced by another model)
Idris 2 uses **dependent types** — the specification and the implementation are the same artifact. You don't write a spec and then test that the code matches it. The code that doesn't match the spec **does not compile**.
The kernel cannot hallucinate its own invariants. The type checker would reject it before you could run it.
---
## Mathematical Foundation
- **Erdős-Straus Conjecture** — DSS greedy bound (Lean 4 formalized)
- **Dependent Type Theory** (Martin-Löf) — Idris 2 type system
- **Entropy Bound** — fixed-point arithmetic, compile-time verified
- **WORM Chain** — append-only linked structure, deletion impossible by type
---
## Who Built This
**Ahmad Ali Parr** — Haskell, Idris 2, Lean 4, Agda, Prolog, APL, Coq. UCSD Liquid Haskell contributor. No PhD. Types compile. `refl` doesn't negotiate.
The kernel is not an experiment. It is not a demo. It is the trust anchor for sovereign AGI.
---
## License
**Tri-License** (BSL-1.1 / AGPL-3.0 / MPL-2.0) — See [LICENSE](LICENSE)
- SaaS/network deployment: AGPL-3.0 (mandatory, no opt-out)
- Enterprise/commercial: BSL-1.1 (converts to AGPL-3.0 after 2028-08-15)
- File-level modifications: MPL-2.0 (non-network only)
- Patent retaliation clause active
Copyright (C) 2026 Bel Esprit D'Accord Irrevocable Trust / SnapKitty Collective Limited
### 💼 Commercial License
Snapkitty code is free and open under **AGPL-3.0** for open-source use. Building a commercial product or service? A **proprietary commercial license** from Snapkitty Collective LLC lets you ship this code without the AGPL's source-sharing and network-use obligations.
**[→ Get a commercial license](mailto:A.parr@belespritdaccord.uk?subject=Commercial%20license:%20sovereign-agi-kernel)** · A.parr@belespritdaccord.uk
|