File size: 14,966 Bytes
931572e | 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 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 | # ⬑ SNAPKITTY SOVEREIGN ROUTER
```
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β β
β ⬑ S N A P K I T T Y S O V E R E I G N R O U T E R β
β β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β Every task routes to the right engine. β β
β β The routing table is the IP. Not the models. β β
β β Evidence or Silence. Nothing in between. β β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β
β β¦Ξ©β§ Ahmad Ali Parr Β· SnapKitty Collective Β· Bel Esprit D'Accord Trust β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
```
[](SOVEREIGN_SOURCE_LICENSE_V3.md)
[](https://aws.amazon.com/bedrock/)
[](https://console.mistral.ai)
[](SNAPKITTY-PROOFS)
---
## What This Is
The Sovereign Router is a universal AI workflow engine.
One command. Every task routes to the right model automatically.
No thinking about which API to call. No switching between tools.
The SACM gate pattern-matches your input and decides.
```
You type: "prove by induction the sum of squares formula"
Router: β DeepSeek R1 (math/proof Β· us-west-2)
You type: "write a rust function for fibonacci"
Router: β Mistral Codestral (code Β· free tier)
You type: "explain why the WORM chain beats a database"
Router: β Claude Sonnet 4.6 (reasoning Β· Bedrock)
You type: "write a research paper about SACM architecture"
Router: β Nova Premier (long-form writing Β· DEVTRIAL)
```
---
## The Full Routing Table
```
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β S A C M G A T E β
β Pattern Match β Engine β ERE Verify β Output β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
INPUT
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββ
β DFA PATTERN MATCH (O(n), no backtracking) β
βββββββββββββββββββββββββββββββββββββββββββββββ
β
ββ PROVE / THEOREM / INDUCTION / AXIOM / LEMMA
β ββββββββββββββββββββββββββββββββββββββββββββΊ DEEPSEEK R1
β us-west-2 Β· reasoning model
β
ββ WRITE / CODE / GIT / SCAFFOLD / BUILD / NPM
β ββββββββββββββββββββββββββββββββββββββββββββΊ MISTRAL CODESTRAL
β free tier Β· code specialist
β
ββ PAPER / WHITEPAPER / RESEARCH PAPER / ACADEMIC
β ββββββββββββββββββββββββββββββββββββββββββββΊ NOVA PREMIER (DEVTRIAL)
β Bedrock Β· long-form writing
β
ββ MARKET / CRYPTO / NEWS / PRICE / FINANCE
β ββββββββββββββββββββββββββββββββββββββββββββΊ NOVA PRO
β Bedrock Β· fast synthesis
β
ββ LOCAL / NEMOTRON / OLLAMA / OUR MODEL
β ββββββββββββββββββββββββββββββββββββββββββββΊ OLLAMA :11434
β local Β· your trained weights
β
ββ COMPLEX / ELABORATE / FULL SYSTEM
β ββββββββββββββββββββββββββββββββββββββββββββΊ CLAUDE OPUS 4.6
β Bedrock Β· heavy reasoning
β
ββ LAW / TRUST / WORM / GOVERNANCE / WHY / EXPLAIN (default)
ββββββββββββββββββββββββββββββββββββββββββββΊ CLAUDE SONNET 4.6
Bedrock Β· reasoning + law
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββ
β ERE VERIFY (5-pass quality gate) β
β PASS β user QUARANTINE β flag REJECT β β β
βββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββ
β VAULT LEAK SCANNER (DFA key redaction) β
βββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
OUTPUT + WORM SEAL
```
---
## Engine Reference
| Engine | Model ID | Region | Best For | Cost |
|--------|----------|--------|----------|------|
| **Claude Sonnet 4.6** | `us.anthropic.claude-sonnet-4-6` | us-east-1 | Law Β· Trust Β· Reasoning | Bedrock |
| **Mistral Codestral** | `codestral-latest` | API | Code Β· Git Β· Terminal | **Free** |
| **Nova Pro** | `us.amazon.nova-pro-v1:0` | us-east-1 | Market Β· News Β· Research | Bedrock |
| **Nova Premier** | `us.amazon.nova-premier-v1:0` | us-east-1 | Long papers Β· DEVTRIAL | Bedrock |
| **DeepSeek R1** | `us.deepseek.r1-v1:0` | **us-west-2** | Math proofs Β· Induction | Bedrock |
| **Claude Opus 4.6** | `us.anthropic.claude-opus-4-6-v1` | us-east-1 | Complex architecture | Bedrock |
| **Local / Nemotron** | `nemotron` | localhost | Offline Β· your weights | **Free** |
> **DeepSeek R1 requires `us-west-2`** β the router handles this automatically.
---
## Quick Start
### Prerequisites
```bash
# 1. AWS CLI configured
aws configure
# Set region to us-east-1 (router uses us-west-2 for DeepSeek automatically)
# 2. Node.js 20+
node --version # v20+
# 3. Clone
git clone https://github.com/SNAPKITTYWEST/SNAPKITTYWEST.git
cd SNAPKITTYWEST
# 4. Install
npm install
```
### Configuration
```bash
# Copy the example env
cp .env.example .env
# Edit .env β set your master secret (derives all keys)
# This is the ONLY secret you need to remember
VAULT_MASTER_SECRET=your_secret_here
# Set your Mistral free key (get at console.mistral.ai)
MISTRAL_API_KEY=your_mistral_key
```
### Seal Your Keys
```bash
# Seals keys into vault.sealed.json (encrypted, safe to commit)
VAULT_MASTER_SECRET=your_secret npm run vault:seal \
"MISTRAL_API_KEY=your_mistral_key"
```
### Run
```bash
# Route any task
npm run router "write a rust fibonacci function"
npm run router "prove by induction the sum of squares formula"
npm run router "explain why WORM chain beats a database"
npm run router "what is the bitcoin market trend today"
# Open the visual Mission Control UI
open router-ui.html # macOS
start router-ui.html # Windows
```
---
## Architecture Deep Dive
```
sovereign-router.ts β Main router (TypeScript)
β
βββ SACM Gate β Pattern match, O(n), no backtracking
β βββ 15+ routing patterns
β βββ Agent type detection
β
βββ Vault (vault.ts) β Ed25519 + AES-256-GCM key management
β βββ PBKDF2-SHA512 key derivation
β βββ DFA leak scanner on all outputs
β βββ vault.sealed.json (encrypted, committable)
β
βββ Tools (tools.ts) β Mistral's tool belt
β βββ shell_exec β run commands
β βββ file_write β write files
β βββ file_read β read files
β βββ git_push β commit + push
β βββ kernel_invoke β sovereign-glue.rexx
β βββ web_verify β Tavily + DFA fact scan
β βββ ddg_search β DuckDuckGo
β βββ define β Merriam-Webster
β βββ thesaurus β M-W Thesaurus
β
βββ Web Verify (web-verify.mjs) β Tavily DFA pre-processor
β βββ Fetches web results
β βββ DFA scans for verified facts
β βββ Blocks injection attempts
β βββ Returns only clean token bundles
β
βββ Kernel Registry β 15 sovereign kernels
(kernel-registry.json)
βββ DFA Engine (JS)
βββ REXX Glue Kernel
βββ Route Dispatch (REXX)
βββ Carto Prolog
βββ Carto Gate (ASP)
βββ COBOL Law Kernel
βββ Corpus Store (OCaml)
βββ Math Dispatcher (Rust)
βββ Math Emitters (Rust)
βββ WORM Chain (Rust)
βββ SnapKitty Chain (JS)
βββ Sovereign Daemon (Go)
βββ Trust Deed Generator (JS)
βββ Sovereign Alien Trust (Prolog)
```
---
## The Kernel Chain
Every task fires a chain of sovereign kernels before the model sees it.
The kernels are deterministic. The model is the translation layer.
```
For a LAW query:
Input β DFA scan β REXX route-dispatch β CARTO Prolog
β BOB moral gate β Claude β ERE verify β WORM seal β Output
For a MATH query:
Input β DFA scan β DeepSeek R1 β ERE verify β WORM seal β Output
For a CODE task:
Input β DFA scan β REXX route-dispatch β SOVEREIGN-GLUE.REXX
β Mistral tools β git_push / file_write β WORM seal β Output
```
The kernels run in O(n). No backtracking. No regex recursion. ReDoS-immune.
---
## WORM Chain
Every router call is sealed to the append-only WORM chain.
Nothing leaves the system unsigned.
```json
{
"ts": "2026-07-11T...",
"input": "prove by induction...",
"agent": "deepseek",
"reason": "math/proof",
"model": "us.deepseek.r1-v1:0",
"tokens": 847,
"worm_seal": "sha256(payload)"
}
```
Sealed to: `.worm/router-chain.jsonl` (append-only, never deleted)
---
## Mission Control UI
Open `router-ui.html` in any browser. No server needed.
```
βββββββββββββββββββ¬βββββββββββββββββββββββ¬βββββββββββββββββ
β SACM GATE β OUTPUT STREAM β KERNEL CHAIN β
β β β β
β β INPUT β βΆ DEEPSEEK R1 β DFA ENGINE β β
β RECEIVED β math/proof β ROUTE-DISP β β
β β β ERE VERIFY βΆ β
β β ROUTED β β Proof by induction: β β
β DEEPSEEK β Base case: n=1... β WORM CHAIN β
β math/proof β β a3f7b2c1 seal β
β 10:32:44 β β WORM: a3f7b2c1... β b2d9e3f4 boot β
βββββββββββββββββββ΄βββββββββββββββββββββββ΄βββββββββββββββββ
[CLAUDE-reasoning][MISTRAL-code][NOVA-market][DEEPSEEK-math][LOCAL-nemotron]
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β > Route any task... ⬑ ROUTE β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
```
---
## Environment Variables
| Variable | Required | Description |
|---|---|---|
| `VAULT_MASTER_SECRET` | **YES** | Master secret β derives all keys |
| `MISTRAL_API_KEY` | Yes | Mistral free tier key |
| `AWS_REGION` | No | Default: `us-east-1` |
| `CLAUDE_MODEL` | No | Default: `us.anthropic.claude-sonnet-4-6` |
| `MISTRAL_MODEL` | No | Default: `codestral-latest` |
| `TAVILY_API_KEY` | No | Web search (optional) |
| `OLLAMA_URL` | No | Default: `http://localhost:11434` |
| `LOCAL_MODEL` | No | Default: `nemotron` |
---
## One-Command Boot (after config)
```bash
# Code task
npm run router "write a sovereign WORM chain in Rust"
# Math proof
npm run router "prove by induction sum 1..n = n(n+1)/2"
# Market research
npm run router "what is the current state of DeFi liquidity"
# Long paper
npm run router "write a technical paper on the SACM architecture"
# Use local model
npm run router "use our local model to summarize the sovereign router"
# Visual UI
start router-ui.html
```
---
## License
[Sovereign Source License v3.0](SOVEREIGN_SOURCE_LICENSE_V3.md)
**mathlib5** is the only repository that accepts pull requests (CLA required).
All other repositories are TIER 1 ARCHIVED β view only.
Commercial use requires written license: jessicalw34@gmail.com
---
*SnapKitty Collective LLC Β· EIN 41-5105572*
*Bel Esprit D'Accord Trust Β· EIN 41-6630640*
*Ξ© β Ahmad Ali Parr Β· the-49th-call Β· 2026*
|