Skip to main content

Advanced Topics

Enabling the LLM Reasoning Engine

The reasoning module works out-of-the-box with rule-based heuristics. Adding an LLM unlocks deeper pattern analysis and autonomous pipeline generation.

Setup

cp .env.template .env

Edit .env with your provider:

# Option 1: Ollama (local, free, sovereign) — recommended
LLM_PROVIDER=ollama
OLLAMA_BASE_URL=http://localhost:11434
OLLAMA_MODEL=llama3

# Option 2: NVIDIA NIM (free tier cloud)
LLM_PROVIDER=nvidia
NVIDIA_API_KEY=your_key_here

# Option 3: OpenAI (paid cloud fallback)
LLM_PROVIDER=openai
OPENAI_API_KEY=your_key_here

Restart the runtime. The reasoning engine will automatically detect the LLM and switch from rule-based to hybrid mode.

What Changes with LLM

CapabilityRule-basedLLM-backed
Pipeline quarantine
Metric logging
Pattern analysis
Autonomous pipeline generation
Memory synthesis
Natural language reasoning

The Full Module Catalog (20+)

The starter kit has four modules. The full SovCore platform adds:

ModuleFileTick FrequencyRole
💭 Pattern Synthesisdreams.pyEvery 20th tickOffline pattern detection during idle
🧬 Versioningdna.pyOn bootPipeline version registry
🧪 Selectiongenetics.pyOn breed cyclePool management, tournament selection
🍳 Replicatorbreeder.pyEvery 50th tickEvolutionary reproduction of pipelines
🌐 Federationfederation.pyEvery 30th tickPeer discovery, cross-runtime sharing
👀 File Watcherperception.pyEvery 5th tickCodebase awareness, file change detection
🔍 Code Indexcode_index.pyOn bootAnti-hallucination — indexes real codebase symbols
🧠 Embedding Engineneural_cortex.pyEvery 100th tickEmbedding backfill for semantic search
📊 Working Bufferworking_memory.pyEvery tickShort-term salience-gated buffer (capacity 64)
🎯 Reinforcementreinforcement.pyOn pipeline execOutcome ledger, reward/penalty tracking
📈 Growth Trackergrowth.pyEvery 100th tickComposite growth score, trajectory tracking
🎓 Skill Extractorskills.pyEvery ~36 maintSkill crystallization from repeated success
🧩 Attention Filtercognitive_biases.pyEvery tickAttention gating, priority-aware filtering
🦴 Invariant Guardskeleton.pyEvery tickStructural invariant enforcement
🚔 Threat Scannerimmune_patrol.pyEvery tickActive threat hunting, anomaly sweeps
🔗 Knowledge Graphcortex_graph.pyEvery ~10 maintKnowledge graph edges, clustering
🌉 Artifact Bridgecortex_bridge.pyEvery 3rd tickScans agent artifacts, publishes to shared store
🛡️ Pipeline Filterbred_filters.pyOn pipeline execPre/post-compile whitelist for generated pipelines

Each module is a standalone Python file. Add them one at a time to your starter runtime.

Architecture

main.py              ← FastAPI entry point (boot/shutdown lifecycle)
runtime.py ← The persistent runtime (scheduler + tick loop)
memory.py ← Persistent memory engine
memory_api.py ← REST API for memory access
reasoning.py ← Hybrid decision engine (rules + optional LLM)
monitor.py ← Pipeline health monitoring
pipeline_engine.py ← Pipeline CRUD + sandboxed execution
sandbox.py ← Static analysis + runtime restriction
llm_client.py ← Optional LLM client (Ollama/NVIDIA/OpenAI)
sovereign_lang/ ← Sovereign Script compiler
lexer.py ← Tokenizer
parser.py ← Recursive descent parser → AST
codegen.py ← AST → Python code generator
pipelines/ ← Your .sov pipeline files
hello_world.sov ← Example pipeline

Security Warning

caution

The starter kit has no authentication. Do not expose it to the public internet without adding API key auth. The full engine ships with sovereign_auth.py — a production-grade bearer token system with trust tiers.

Running Tests

python -m pytest tests/ -v