-
Notifications
You must be signed in to change notification settings - Fork 0
03 Architecture architecture
LAP-CHRIS\chris edited this page Jun 17, 2026
·
5 revisions
Krnl-AI Community is organized around a strict separation between deterministic kernel state and LLM-facing translation.
- Separation of Powers — The kernel owns state, validation, and policies. The LLM translates and proposes, never writes state directly.
- Safety by Design — Every action passes through multiple safety layers before execution.
- Local-First — All state is stored locally via SQLite. No hosted infrastructure required.
- Deterministic Core — The kernel is fully deterministic given the same inputs.
┌──────────────────────────────────────────────┐
│ CLI / Desktop / Editors │
│ (User interfaces and developer tools) │
└──────────────────────┬───────────────────────┘
│
┌──────────────────────▼───────────────────────┐
│ Sidecar (HTTP API) │
│ Agent Run → Safety Checks → Local/Proxy │
└──────────────────────┬───────────────────────┘
│
┌──────────────────────▼───────────────────────┐
│ Embedded Kernel (In-Process) │
│ ┌──────────┐ ┌──────────┐ ┌─────────────┐ │
│ │ Memory │ │Cognitive │ │Policy Engine│ │
│ │ System │ │Cycle │ │& Learning │ │
│ └──────────┘ └──────────┘ └─────────────┘ │
│ ┌──────────┐ ┌──────────┐ ┌─────────────┐ │
│ │Safety │ │Emotion │ │Metacognition│ │
│ │Layers │ │Model │ │ │ │
│ └──────────┘ └──────────┘ └─────────────┘ │
└──────────────────────┬───────────────────────┘
│
┌──────────────────────▼───────────────────────┐
│ Local Storage (SQLite) │
│ Episodes │ Semantic │ Policies │ Emotions │
│ Procedural │ Autobiographical │ Settings │
└──────────────────────────────────────────────┘
The kernel is composed of specialized cognitive modules:
| Module | Responsibility |
|---|---|
| Memory System | Episodic, semantic, procedural, working, emotional, autobiographical, and prospective memory types |
| Cognitive Cycle | 10-step perception-to-learning processing pipeline |
| Safety Layers | Multi-layered guard against malicious input and unsafe actions |
| Emotion Model | VAD (Valence-Arousal-Dominance) dimensional model influencing risk perception |
| Metacognition | Self-observation of emotional state, risk level, and cognitive biases |
| Policy Engine | Learned decision policies updated from outcomes |
| Attention System | Feature extraction, prioritization, and focus allocation |
| World Models | Predictive environment models (JEPA-based) for simulation and planning |
| Causal Reasoning | Graph-based cause-effect inference for understanding outcomes |
| Active Inference | Free-energy-based action selection for goal-directed behavior |
| Dream Consolidation | Offline scenario generation and memory consolidation |
| Continuous Learning | End-to-end pipeline: memory → causal analysis → world model update → dream → consolidation |
| Component | Responsibility |
|---|---|
| Embedded Kernel | State management, memory, cognitive cycle, safety, policies, learning, emotions, world models |
| Sidecar | HTTP API with safety pipeline, optional enterprise proxy, and P2P signaling |
| CLI | Terminal interface with TUI for interactive sessions |
| SDK (Python/.NET) | Programmatic access to the cognitive runtime |
| Desktop Apps | WPF and Tauri native desktop applications with auth, privacy, and P2P/WebRTC surfaces |
| Editor Extensions | VS Code and Visual Studio IDE integrations |
User Input → Safety Check → Memory Recall → Evaluation
→ Metacognition → Planning → Governance → Execution
→ Outcome Recording → Learning → Emotional Update
Every agent run flows through layered safety checks:
- Adversarial Guard — Detects prompt injection and jailbreak attempts
- Fundamental Rules (R01-R20) — Enforces 20 unbreakable rules
- Ethical Enforcer — Validates against ethical principles
- Input Validation — Schema validation on all inputs
- Allowlist — Only registered actions are permitted
- Rate Limiting — Prevents abuse and resource exhaustion
For detailed safety documentation, see Safety System.
The desktop surfaces now include local peer-to-peer video calling support.
-
VideoCallViewModelmanages call state and peer selection in WPF -
WebRtcServiceopens a WebSocket signaling session at/signaling/webrtc -
SettingsViewModelexposes STUN/TURN configuration - Tauri settings persist auth state and complement the WPF call flow
| Component | Community (Local) | Enterprise (Proxy) |
|---|---|---|
| Runtime | .NET 10 / Python 3.10+ | .NET 10 / Python 3.10+ |
| Storage | SQLite | MySQL |
| Vectors | SQLite vector store | Qdrant HNSW |
| Cache | In-memory | Redis |
| Safety | Full pipeline | Full pipeline + MetaCritic |
| Desktop | WPF (.NET), Tauri (Rust + React) | WPF (.NET), Tauri (Rust + React) |
| SDK | .NET (netstandard2.0), Python (3.10+) | .NET (netstandard2.0), Python (3.10+) |
Krnl-AI Community — MIT License