Add sovereign-router source: router-server.mjs, kernel-registry, agent-registry, omega-field, MAGMA verbs
931572e verified | # ⬑ 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* | |