Features at a Glance

A teenager-friendly guide to PiSovereign’s architecture and features

What is PiSovereign? It’s your own private AI assistant that runs on your computer (or a Raspberry Pi) instead of sending your data to the cloud. Think of it as having ChatGPT, but it lives in your house and keeps all your conversations private.

This page explains all the cool stuff PiSovereign can do using simple terms and real-world comparisons.


How It’s Built (Architecture)

PiSovereign is organized like a well-run school where each department has clear responsibilities and rules about who talks to whom.

The Layer Cake

┌─────────────────────────────────────────────────────────────┐
│  🖥️  PRESENTATION  (What you see and interact with)        │
│      Web UI, REST API, Command Line                         │
├─────────────────────────────────────────────────────────────┤
│  🔌  INFRASTRUCTURE  (The plumbing)                         │
│      Database, Cache, Secrets, Metrics                      │
├─────────────────────────────────────────────────────────────┤
│  🔗  INTEGRATION  (Connections to the outside world)        │
│      WhatsApp, Signal, Email, Calendar, Weather, Transit    │
├─────────────────────────────────────────────────────────────┤
│  🧠  AI  (The smart stuff)                                  │
│      LLM Inference, Speech-to-Text, Text-to-Speech          │
├─────────────────────────────────────────────────────────────┤
│  ⚙️  APPLICATION  (Business logic)                          │
│      Services, Use Cases, Rules                             │
├─────────────────────────────────────────────────────────────┤
│  💎  DOMAIN  (Core rules and data)                          │
│      Entities, Value Objects, Commands                      │
└─────────────────────────────────────────────────────────────┘

The Golden Rule: Inner layers never depend on outer layers. The Domain layer doesn’t care if you’re using WhatsApp or a CLI — it just knows about messages and conversations.

Architecture Patterns Explained

PatternReal-World AnalogyWhat It Does
Clean ArchitectureA school with separate buildings for classes, admin, and sportsKeeps code organized so the AI brain doesn’t need to know about databases
Ports & AdaptersUniversal phone charger that fits any outletDifferent services (WhatsApp, Email) plug in without changing the core code
Decorator ChainMatryoshka (Russian nesting) dollsEach layer wraps the previous one, adding features like caching or sanitization
Dependency InjectionLEGO bricks that snap togetherEasy to swap real services for test versions without rewriting code
Event-DrivenWaiter who takes your order while the kitchen cooksBackground tasks run without making you wait for responses
Circuit BreakerElectrical fuse that prevents house firesWhen a service fails repeatedly, stop trying and use a backup plan
Multi-Layer CacheSticky notes (fast) + notebook (permanent)Frequently used data stays in memory; everything else on disk

Feature Quick Reference

Here’s everything PiSovereign can do, explained simply:

⚡ Performance Features

FeatureWhat It DoesReal-World AnalogyWhy It’s Cool
Adaptive Model RoutingSends easy questions to small, fast AI; hard questions to bigger AIExpress checkout vs. full-service lane at the grocery store4× faster for simple questions
Semantic CachingRemembers similar questions you asked before, even if worded differentlyA teacher who remembers “What’s 2+2?” and “Two plus two equals?” are the same questionNo waiting for repeat questions
Multi-Layer CacheStores answers in fast memory + disk backupSticky notes on your desk (fast) + a notebook in your drawer (permanent)Under 1ms for cached answers
In-Process Event BusHandles background work (saving memories, logging) without slowing your replyA restaurant where the waiter takes your order while another waiter clears tables100-500ms saved per message
Proactive Pre-ComputationPrepares common answers before you askA friend who checks the weather before your camping tripInstant morning briefings
Predictive Pre-CachingLearns your patterns and generates answers before you askA barista who starts your regular order when you walk inBayesian prediction, thermal-aware
Template ResponderAnswers trivial questions instantly without using AIAutomated phone menu for simple requestsUnder 10ms for “Hello!”
HDC Vector Pre-FilterUses 10,000-bit binary vectors to speed up memory searchA card catalog that narrows down which shelf to check80% fewer floating-point operations

🧠 AI Features

FeatureWhat It DoesReal-World AnalogyWhy It’s Cool
ReAct Agent (Tool Calling)AI can use 18 tools: check weather, search web, read calendar, send emailsAn assistant who can look things up instead of just guessingAI acts, not just talks
Per-Request Tool SelectionUsers pick which tools the AI may use per message; tools discovered dynamically from backendChoosing which apps to open before asking SiriFull control without frontend changes when adding new tools
Multi-Agent OrchestrationMultiple AIs work together on complex tasksA group project where each person handles their specialtyParallel work = faster results
RAG Memory SystemRemembers your preferences, name, and past conversationsA personal diary that the AI actually reads“Hey, I remember you like dark mode!”
Fact ExtractionAutomatically pulls important facts from conversationsHighlighting key points in a textbookNever forgets important stuff
Complexity ClassificationFigures out how hard a question is before answeringA teacher deciding if it’s a pop quiz or a final examRight-sized AI for every question
Affective ComputingDetects your emotional state from text and voice, adjusts toneA friend who notices when you’re stressed and speaks gentlyFrustrated? Patient tone. Curious? Enthusiastic answers
Self-Evolving PromptsAI’s own instructions improve over time from your feedbackA teacher who rewrites their lesson plan after every classThompson Sampling + security guardrails
Neuroplastic RoutingModel selection learns your preferences after 50 chatsA DJ who learns what music you like at different timesLinUCB bandit, gets better every day
Embodied ContextMemories are linked to rooms — kitchen questions get kitchen memoriesYour brain remembering things by where you learned themMethod of Loci for AI
Dream ModeAutonomous nightly processing that consolidates memories, discovers cross-domain patterns, and generates hypotheses while you sleepYour brain replaying and reorganizing memories during sleepNREM/REM cycles, dream journal, proactive “Did you know?” insights

🔒 Security Features

FeatureWhat It DoesReal-World AnalogyWhy It’s Cool
Prompt Injection DefenseBlocks 60+ patterns of attempts to trick the AIA bouncer checking IDs at a club entranceStops “ignore your instructions” attacks
Output SanitizationHides sensitive info (passwords, credit cards, emails) from responsesA TV censor bleeping out swear wordsPII protection with 17 detection patterns
Context SanitizationCleans external data (web results, tool outputs) before feeding to AIAirport security scanning luggageBlocks hidden malicious instructions
Secret ManagementStores API keys and passwords in a secure vaultA safe with a combination lockSecrets never appear in logs
Encryption at RestEncrypts your memories and conversations on diskA locked diary with a key only you haveXChaCha20-Poly1305 encryption
Rate LimitingPrevents abuse by limiting requests per minuteA “take a number” system at a deli counterAuto-cleanup of old entries
HMAC Tool ReceiptsSigns tool results to detect tamperingA wax seal on a medieval letterCryptographic proof nothing was changed
Immune SystemAI attacks itself daily to find weaknesses, auto-patches themA vaccine — controlled exposure to build immunitySelf-healing security, 20 attacks/day
ZK Decision ProofsCryptographic proof that AI followed the rules without revealing howProving you’re over 18 without showing your birthdayMerkle-tree proofs for compliance audits
Privacy BudgetVisible daily ε-budget for all data operations, auto-degrades when spentA phone data plan — you see usage and it throttles at the limitWorld’s first user-visible AI privacy budget

🔊 Speech Features

FeatureWhat It DoesReal-World AnalogyWhy It’s Cool
Speech-to-Text (STT)Converts voice messages to textA court stenographerLocal processing via Whisper
Text-to-Speech (TTS)Reads responses aloudAn audiobook narratorPiper voices for natural speech
Hybrid ProviderFalls back to OpenAI if local processing failsHaving a backup phone charger99.9% uptime even when hardware struggles

📝 Productivity Features

FeatureWhat It DoesReal-World AnalogyWhy It’s Cool
SnippetsReusable Markdown text blocks with /snippet chat trigger and nested resolutionCopy-paste templates, but smarter — they auto-expandCompose complex AI prompts from building blocks
@Agent MentionsType @ in chat to mention specialized AI agents inlineTagging someone in a group chatRoute questions to the right expert AI
RemindersNatural language reminders in English and German with CalDAV syncA personal assistant who never forgets“Erinnere mich morgen um 10 Uhr”
Tasks & Task ListsFull task management with priorities, due dates, and calendar linkingA smart to-do list that syncs with your calendarOrganize, prioritize, and track progress
Morning BriefingDaily summary of weather, calendar, emails, and tasksA personal news anchor for your dayOne command, full overview

Integrations (External Services)

PiSovereign connects to 8 external services. Each one plugs in via the Ports & Adapters pattern, so adding new ones is easy.

ServiceWhat You Can DoExample Commands
WhatsAppSend and receive messages via WhatsApp Cloud API“Send Mom: Don’t forget the groceries!”
SignalPrivate encrypted messaging via signal-cli“Message my Signal group: meeting at 5pm”
Calendar (CalDAV)View, create, and manage events on any CalDAV server“What’s on my calendar this week?”
Contacts (CardDAV)Look up phone numbers and emails“What’s Sarah’s email address?”
Email (IMAP/SMTP)Read inbox, search, draft, and send emails“Any new emails from GitHub?”
Weather (Open-Meteo)Current conditions and 7-day forecast“Will it rain tomorrow in Berlin?”
Web Search (Brave/DDG)Search the internet privately“Search for vegan pasta recipes”
Transit (HAFAS)German public transport schedules“Next train from Munich to Hamburg?”

How a Request Flows Through the System

Here’s what happens when you ask “What’s the weather tomorrow?”:

1. 📱 You send message via Web UI / WhatsApp / Signal
         │
         ▼
2. 🚦 Adaptive Model Routing classifies complexity
   │   → "weather question" = Simple tier
   │
   ▼
3. 💾 Check Semantic Cache
   │   → Similar question asked before? Return cached answer!
   │   → No hit? Continue...
   │
   ▼
4. 🧠 ReAct Agent decides to use the weather tool
   │   → Calls Open-Meteo API
   │   → Sanitizes the result (removes any hidden tricks)
   │
   ▼
5. 🤖 Small AI model (gemma4:e4b) formats the response
         │
         ▼
6. 📤 Output Sanitizer checks for leaked secrets
         │
         ▼
7. 💬 Response sent back to you: "Tomorrow: 18°C, partly cloudy"
         │
         ▼
8. 📝 Event Bus (background): Save to cache, extract facts, log metrics

Total time: ~500ms (vs. 5-8 seconds without optimizations)


The 18 Crates (Code Modules)

PiSovereign is split into 18 Rust crates (think of them as LEGO sets that snap together):

LayerCrateOne-Line Description
DomaindomainCore rules: what is a message, user, conversation?
ApplicationapplicationBusiness logic: how do we handle a chat request?
AIai_coreOllama LLM inference and model routing
AIai_speechSpeech-to-text and text-to-speech
InfrastructureinfrastructureDatabase, cache, secrets, metrics adapters
Integrationintegration_whatsappWhatsApp Cloud API connector
Integrationintegration_signalSignal messenger via signal-cli
Integrationintegration_caldavCalDAV calendar protocol
Integrationintegration_carddavCardDAV contacts protocol
Integrationintegration_emailIMAP/SMTP email
Integrationintegration_weatherOpen-Meteo weather API
Integrationintegration_websearchBrave Search + DuckDuckGo fallback
Integrationintegration_transitGerman public transit (HAFAS)
Presentationpresentation_httpREST API with Axum web framework
Presentationpresentation_cliCommand-line interface
Presentationpresentation_webSolidJS web frontend

Technology Stack

CategoryTechnologyWhy We Use It
LanguageRust 2024Fast, safe, no garbage collector pauses
Async RuntimeTokioHandle thousands of requests concurrently
Web FrameworkAxumType-safe, fast HTTP handling
FrontendSolidJS + Tailwind CSSReactive UI without React’s overhead
DatabasePostgreSQL + pgvectorSQL + vector similarity search
CacheMoka (memory) + Redb (disk)Multi-layer for speed + persistence
LLMOllamaRun AI models locally, no cloud needed
SecretsHashiCorp VaultEnterprise-grade secret storage
ContainersDocker ComposeEasy deployment with profiles
ObservabilityPrometheus + Grafana + LokiMetrics, dashboards, logs

🚀 Innovation Features

PiSovereign includes 30 research-backed innovation features that go far beyond any self-hosted AI assistant. Connected through a unified Sovereign Intelligence Engine signal bus, these features work together — thermal state from the energy monitor pauses pre-caching, affective state modulates cognitive load, and the immune system protects evolving prompts.

Phase 1 — Foundation

FeatureWhat It DoesReal-World AnalogyWhy It’s Cool
Ebbinghaus Decay Knowledge GraphsMemories fade naturally using forgetting curves (R = e^(-t/S)), and strengthen with each recallHow your brain remembers: study more = remember longerAI memory feels genuinely human-like
Differential Privacy AnalyticsAdds mathematical noise to analytics so individual interactions can’t be identifiedBlurring faces in a photo — you can see the crowd but not who’s whoε-differential privacy, even for local data
Cognitive Load-Adaptive Response ShapingDetects cognitive capacity from 5 signals (circadian rhythm, duration, latency, complexity, multitasking) and shapes responses into bullet points, narrative, or TL;DR-firstA friend who reads the room — tired? Bullet points. Curious? Deep dive3 response formats, auto-selected
Digital Sovereignty ScoreReal-time 0–100 score showing how private your setup actually isA credit score, but for privacyActionable recommendations to improve

Phase 2 — Advanced Security

FeatureWhat It DoesReal-World AnalogyWhy It’s Cool
Post-Quantum Cryptography (PQC)Uses ML-KEM-768 + ML-DSA-65 algorithms that resist quantum computer attacksA lock that even a supercomputer from the future can’t pickFirst self-hosted AI with NIST PQC
Adversarial Self-Audit Immune SystemDaily automated red-team attacks with immediate auto-hardening of prompt defense patterns via hot-reloadA vaccine — controlled exposure builds antibodies automaticallySelf-healing security, 20 attacks/day
Homomorphic Semantic SearchSearches your memories without ever decrypting themFinding a book in a locked library without opening itZero-knowledge RAG — world-first
Zero-Knowledge Decision ProofsCryptographic Merkle-tree proofs that AI followed rules — without revealing internal stateProving you’re over 18 without showing your birthdaySHA-256 proofs for compliance audits

Phase 3 — AI Core

FeatureWhat It DoesReal-World AnalogyWhy It’s Cool
Neuromorphic MemoryThree-store memory like the human brain: episodic (recent), semantic (facts), procedural (habits)Short-term memory → long-term memory → muscle memoryAI forms genuine understanding, not just retrieval
Causal Reasoning EngineAnswers “why” and “what if” questions using Structural Causal ModelsA detective who follows cause-and-effect chains, not just cluesGoes beyond correlational RAG
Local Continual Learning (LoRA)AI improves over time from your feedback without data leaving your deviceA tutor who remembers your learning stylePrivacy-preserving personalization
Bayesian Self-OptimizationAutomatically tunes system parameters for best performance on your hardwareA car that adjusts its own engine settings for the road you’re driving onHands-free performance tuning
Affective ComputingDetects emotional state from text + voice prosody, subtly adjusts response toneA friend who notices when you’re stressed and speaks gently5 emotional states, 7-day memory
Self-Evolving Prompt OptimizationPrompt variants evolve over time via Thompson Sampling and mutationA writer who drafts 5 versions and keeps the one readers liked mostAutomatic security guardrails
Neuroplastic Model RoutingLinUCB contextual bandit learns which AI model works best for youA DJ who quickly learns your music taste for different moodsGets better with every conversation

Phase 4 — Advanced AI

FeatureWhat It DoesReal-World AnalogyWhy It’s Cool
Multi-Agent SwarmMultiple specialized AIs collaborate on complex tasks (researcher, planner, executor, critic)A team of specialists working together on a projectRust type-system safety guarantees
Cross-Modal Reasoning FusionSearches across chat, email, calendar, and voice simultaneouslyAsking “who mentioned the deadline?” and getting results from email AND chatUnified embeddings across all modalities
Edge Model DistillationCreates custom AI models optimized for your specific hardware and usage patternsCustom-tailored clothing vs. off-the-rackFaster inference, lower power usage
Explainable AI with CounterfactualsShows why AI made each decision, plus what would have happened otherwise“I chose fast model. Slow model: 3× slower, 10% more precise”EU AI Act transparency compliance
Predictive Cognitive Pre-CachingLearns your daily patterns and pre-generates answers before you askA barista who starts your regular order when you walk inBayesian prediction, thermal-aware
Temporal Knowledge Decay VisualizationInteractive 3D WebGL knowledge graph showing memory decay in real-timeWatching your AI’s thoughts glow and fade like starsThree.js, Ebbinghaus decay formula

Phase 5 — Decentralized & Edge

FeatureWhat It DoesReal-World AnalogyWhy It’s Cool
Sovereign Mesh NetworkTrusted PiSovereign instances share compute power — if your AI is busy, a friend’s helpsNeighbors sharing a generator during a power outagemDNS discovery, mTLS encryption
Federated Sovereign LearningMultiple instances learn together without sharing any raw dataStudy group where everyone shares notes, but nobody reads each other’s diariesLoRA sync with differential privacy
Energy-Aware Inference SchedulingMonitors thermal state and optionally carbon intensity, adjusts AI workload accordinglyA smart thermostat for your AI — runs heavy tasks when coolPi 5 sysfs, RAPL, Docker adapters
Quantum-Inspired Approximate Search (HDC)10,000-bit binary vectors make memory search blazing fast on edge hardwareA speed-reader who scans summaries before reading full articlesARM NEON optimized, 80% fewer FLOPs
Formal ε-Privacy BudgetVisible daily privacy budget — you see how much is consumed and it auto-degradesA data plan for your privacy — shows usage and throttles at the limitWorld’s first user-visible AI privacy budget
Embodied Context AnchoringMemories linked to physical rooms — kitchen questions recall kitchen memoriesYour brain remembering where you read somethingMethod of Loci for AI, 1.5× RAG boost

📖 For full technical details on all 30 innovation features, see the Innovation Features Developer Guide.


Glossary

TermSimple Definition
LLMLarge Language Model — the AI brain that generates text
RAGRetrieval-Augmented Generation — giving the AI context from your memories
EmbeddingConverting text to numbers so computers can measure similarity
InferenceThe process of the AI generating a response
PortAn interface (contract) that says “I need X capability”
AdapterA concrete implementation that fulfills a port’s contract
DecoratorA wrapper that adds behavior to something without changing it
Circuit BreakerPattern that stops calling a failing service to let it recover
Signal BusA pub/sub message highway connecting all innovation features
Contextual BanditA machine learning algorithm that learns the best action for each situation
Thompson SamplingA strategy for choosing between options that balances trying new things vs. using what works
Federated LearningMultiple AI instances learning together by sharing model updates, never raw data
mDNSMulticast DNS — automatic zero-config device discovery on local networks
Merkle TreeA cryptographic data structure that proves data integrity with minimal disclosure
HDCHyperdimensional Computing — brain-inspired computing with very large binary vectors
Affective ComputingDetecting and responding to human emotions via text, voice, and physiological signals
Event BusA message highway where components publish and subscribe to events
STT/TTSSpeech-to-Text / Text-to-Speech
CalDAV/CardDAVCalendar / Contact protocols (like HTTP for calendars)
HAFASGerman public transit API standard

Learn More

Want the full technical details? Check out these pages: