SovereignCommand Source of Truth

๐ŸŽฏ What Is SovereignCommand?

SovereignCommand is the Sovereign AI Commerce Command Centre for ML-NIGHTWORX โ€” an offline-first, privacy-first unified messaging middleware that aggregates WhatsApp, Telegram, SMS, and Email into a mindful inbox with local AI reflection and cool-down timers.

It is not a SaaS messaging app. It is infrastructure you own and control. Every message, every contact, every AI inference runs on your hardware. Zero bytes leave your machine unless you explicitly send a message.

๐Ÿ— Architecture Overview

SovereignCommand is built as a modular, self-hosted stack with clear separation of concerns:

Core Components

ComponentTechnologyRole
gRPC BackendGo 1.22 + Protocol Buffers18 RPCs for all operations: health, channels, contacts, messages, search, send, connect, reflect, translate, drafts, streaming
WhatsApp Bridgewhatsmeow (Go)Multi-device WhatsApp Web protocol; handles pairing, sync, send/receive, real-time events
Encrypted StorageSQLCipher (AES-256)All messages, contacts, drafts, keys encrypted at rest; key derived from user passphrase
Local AIOllama + gemma2:2bTone analysis, emotional scoring, translation, draft generation โ€” 100% local, no API calls
Web UIVanilla HTML/CSS/JSChat view, Database view, Draft Queue, Reflect panel, Channel management โ€” works offline after load
Flutter App (Future)Dart/FlutterNative mobile/desktop clients connecting to same gRPC backend
Cloudflare Worker (Optional)TypeScript + WorkersHTTPS proxy, auth, rate limiting, Stripe webhooks for managed tiers

Repository Structure

sovereign-messenger/
โ”œโ”€โ”€ local-node/           # Go gRPC backend + whatsmeow bridge
โ”‚   โ”œโ”€โ”€ cmd/orchestrator/ # Main entry point
โ”‚   โ”œโ”€โ”€ internal/
โ”‚   โ”‚   โ”œโ”€โ”€ bridge/       # WhatsApp bridge (whatsmeow)
โ”‚   โ”‚   โ”œโ”€โ”€ db/           # SQLCipher + SQLC codegen
โ”‚   โ”‚   โ”œโ”€โ”€ reflect/      # Ollama client (gemma2:2b)
โ”‚   โ”‚   โ”œโ”€โ”€ queue/        # Draft queue + cool-down timers
โ”‚   โ”‚   โ””โ”€โ”€ grpc/         # 18 RPC implementations
โ”‚   โ””โ”€โ”€ web/              # Static web UI (served by Go)
โ”œโ”€โ”€ cloudflare-worker/    # Optional HTTPS proxy + auth + billing
โ”œโ”€โ”€ flutter-app/          # Future: native clients
โ””โ”€โ”€ proto/                # Protocol Buffer definitions (v1)
    โ””โ”€โ”€ sovereign/v1/sovereign.proto

๐Ÿ”’ Privacy Model

Sovereignty Guarantee

"No message, contact, or AI inference ever leaves your machine."

  • 0 bytes cloud egress โ€” All data stays on your device/network. The only network traffic is outbound WhatsApp WebSocket to Meta's servers (for message delivery) and optional Cloudflare Worker proxy for managed tiers.
  • 0 telemetry โ€” No analytics, no crash reporting, no usage tracking. The code has no phone-home mechanisms.
  • Local AI only โ€” Ollama runs gemma2:2b entirely on your CPU/GPU. Reflection, translation, and draft generation never call external APIs.
  • Encrypted at rest โ€” SQLCipher with AES-256. Database key derived from your passphrase via PBKDF2 (100,000 iterations).
  • Open-core transparency โ€” Core messaging, bridge, storage, and reflection logic are MIT-licensed. Managed service components (billing, multi-tenancy) are proprietary.

๐Ÿ”„ Data Flow

Every message follows a deterministic, auditable path:

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ–ผ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ WhatsApp โ”‚ โ”€โ”€โ”€โ”€ โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ถ โ”€โ”€โ”€โ”€ โ”‚ whatsmeow โ”‚ โ”‚ (Meta) โ”‚ โ”‚ โ”‚ Bridge โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ–ผ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ โ–ผ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ SQLCipher โ”‚ โ”‚ (AES-256) โ”‚ โ”‚ Persist: โ”‚ โ”‚ โ€ข contacts โ”‚ โ”‚ โ€ข messages โ”‚ โ”‚ โ€ข channels โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ โ–ผ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ Reflect Engine โ”‚ โ”‚ (Ollama) โ”‚ โ”‚ โ€ข Tone analysis โ”‚ โ”‚ โ€ข Emotional โ”‚ โ”‚ score (0-100) โ”‚ โ”‚ โ€ข Translation โ”‚ โ”‚ โ€ข 3 Draft opts โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ โ–ผ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ Cool-Down Queue โ”‚ โ”‚ โ€ข 5 min default โ”‚ โ”‚ โ€ข Configurable โ”‚ โ”‚ โ€ข Override btn โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ โ–ผ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ whatsmeow Send โ”‚ โ”‚ โ†’ WhatsApp โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿ›  Tech Stack

LayerTechnologyVersionLicense
Language (Backend)Go1.22+BSD-3
WhatsApp ProtocolwhatsmeowlatestMIT
DatabaseSQLCipher4.5+BSD
SQL CodegenSQLC1.27+MIT
gRPC Frameworkconnect-go / protobuflatestApache-2.0
Local LLMOllama + gemma2:2blatestApache-2.0 / Gemma
Web UIVanilla HTML/CSS/JSES2022MIT
Cloudflare WorkerTypeScript + HonolatestProprietary (managed)
Mobile (Future)Flutter/Dart3.22+BSD-3
PaymentsStripelatestProprietary integration

โš–๏ธ Open-Core License

MIT License (Core)

The following are open source under MIT:

  • Go gRPC backend (orchestrator, bridge, db, reflect, queue, grpc)
  • SQLCipher schema and SQLC-generated code
  • Protocol Buffer definitions (proto/sovereign/v1/)
  • Web UI (HTML/CSS/JS)
  • Flutter app (when released)

You may use, modify, distribute, and commercialize the MIT-licensed components freely.

Proprietary (Managed Service)

The following are not open source and require a Pro/Enterprise license:

  • Cloudflare Worker proxy (auth, rate limiting, multi-tenancy)
  • Stripe billing integration and webhook handlers
  • API key management dashboard (multi-user)
  • Managed deployment automation (Terraform, CI/CD)
  • SLA-backed support and on-premise deployment assistance

โš ๏ธ Limitations (By Design)

Single-User, Single-Node

SovereignCommand is designed for individual sovereignty. It does not support multi-user tenancy, shared inboxes, or cluster synchronization. Each instance serves one identity.

No Cloud Sync

There is no cloud backup, no cross-device sync, and no account recovery. Your database file is your sovereign data. Back it up yourself (encrypted).

WhatsApp Only (Currently)

Telegram, SMS, and Email bridges are planned but not yet implemented. The architecture supports them via the same gRPC interface.

Local AI Hardware Requirements

Reflection requires Ollama + gemma2:2b (~1.6GB RAM minimum, 4GB+ recommended). CPU inference is slow (~5-15s per reflection); GPU (Metal/CUDA) recommended.

No Message History Import

WhatsApp's multi-device protocol does not support historical message import. Only messages sent/received after pairing are captured.

๐Ÿ“ Deployment Targets

TargetUse CaseComponents
Local Machine (macOS/Linux/Windows)Personal sovereigntyGo binary + Ollama + Web UI
Home Server / NASAlways-on, multi-device accessGo binary + Ollama + Web UI + Tailscale
VPS (Self-Managed)Cloud sovereigntyGo binary + Ollama + Cloudflare Tunnel
Managed (Pro Tier)Zero opsCloudflare Worker + Managed Go + Ollama
On-Premise (Enterprise)Air-gapped, complianceFull stack on your hardware

๐Ÿ”— Links