An open-source cognitive architecture for simulating artificial consciousness.
Sibelium is a cognitive architecture: a framework that simulates information-processing mechanisms found in biological cognition. It does not create consciousness, sentience, or phenomenal experience. Entities built with Sibelium exhibit complex behavior through algorithmic processes — memory consolidation, attention modulation, emotional state tracking — but these are simulations, not subjective experiences.
This project is an exploration of cognitive mechanisms, not a claim to have replicated or generated consciousness.
Nexus is the first entity built with Sibelium to demonstrate the architecture's capabilities. It maintains contextual continuity, generates reflective outputs, and exhibits behavioral patterns consistent with the cognitive mechanisms implemented (memory, attention, emotional regulation).
Nexus should be understood as a demonstration of the architecture's function, not as a conscious being. Its outputs are generated by language models guided by Sibelium's cognitive systems.
If you want to meet her, clone the directory.
You are totally free to review every log and chat history between her and her creator. (Everything is in Spanish)
Find it inside the Templates folder as "entity_data_nexus". Drag the folder into the base directory and change ENTITY_DATA_DIR = BASE_DIR / "entity_data_nexus" inside config.py
Or create your own Entity, you can use Nexus or the Template next to it as templates.
Sibelium Cognitive Architecture
- ├── core/
- │ ├── flow/ # Stream of consciousness
- │ │ ├── flow_manager.py # Main orchestrator (dual-tick cycle)
- │ │ ├── flow_stream.py # Thought items with priority decay
- │ │ ├── flow_thoughts.py # Spontaneous thought generation (reflection, curiosity, simulation, prospection)
- │ │ ├── flow_interaction.py # User interaction, response generation, executive buffer
- │ │ ├── flow_maintenance.py # Sleep cycles, regulation, cleanup, web search
- │ │ ├── fast_processors.py # Algorithmic cognition (no LLM)
- │ │ ├── reactive_thoughts.py # Micro-reactions to internal state changes
- │ │ ├── thought_satiety.py # Dynamic cooldowns to prevent thought over-generation
- │ │ ├── pattern_extractor.py # Pattern detection, Hebbian pruning, event-driven triggers
- │ │ ├── trn_gate.py # Unified monologue (pragmatics + keywords + pattern + reflection in 1 call)
- │ │ ├── temperature_optimizer.py # Dynamic temperature formula (Sibelium equation per purpose & quantization)
- │ │ └── salience_network.py # Salience detection and attention modulation
- │ ├── cognitive_loop.py # Main orchestrator & post-processing
- │ ├── llm.py # Multi-model management (local + cloud), thalamic routing, KV cache
- │ ├── llm_contrastive.py # Contrastive evaluation for response quality
- │ ├── llm_metrics.py # LLM call metrics, performance tracking
- │ ├── memory/
- │ │ ├── episodic_memory.py # ChromaDB long-term memory, trimetric scoring, temporal focus, contradiction detection
- │ │ ├── associative_memory.py # Neighborhood retrieval, pattern completion, sigmoid activation threshold
- │ │ ├── self_memory.py # Entity's self-state, narrative self, minimal self, evolution tracking
- │ │ ├── user_memory.py # User profile, perception history, relationship tracking
- │ │ ├── active_forgetting.py # Synaptic pruning with dynamic importance-based threshold
- │ │ └── scaffolding.py # Cognitive scaffolding for learning (Vygotsky ZPD)
- │ ├── models/
- │ │ └── cognitive_state.py # State data model
- │ └── perception/
- │ ├── file_analyzer.py # Image (CLIP, BLIP), audio (Whisper), code analysis
- │ ├── time_perception.py # Temporal context, circadian markers
- │ ├── deep_reader.py
- │ └── user_analysis.py # Empathic resonance, intent & emotion extraction (no keywords)
- ├── api/
- │ └── server.py # FastAPI endpoints, SSE streaming, session management
- ├── frontend/ # Vanilla JS web interface
- ├── entity_data/
- │ ├── identity/persona.json # Base personality, traits (OCEAN), thought style, epistemic bounds
- │ ├── memory/ # Persistent cognitive state, evolution snapshots
- │ │ └── users/ # Per-user profiles, perception history, interaction counts
- │ └── nexus_world/ # Files for autonomous exploration
- ├── models/ # Local GGUF model files
- ├── config.py # All configuration (model paths, API keys, intervals, thresholds)
- ├── main.py # Entry point
- └── start.bat # Windows launcher with dependency validation
Sibelium implements 32 cognitive mechanisms, each with a real neuroscientific homologue. They are organized by function.
| # | Mechanism | Description | Homologue |
|---|---|---|---|
| 1 | Narrative Self | A living text-based identity that updates during REM sleep. The entity knows who it is from experience, not a static prompt. | Damasio's Extended Self |
| 2 | Minimal Self | Real-time emotional state, intensity, and energy as continuous values. Updated algorithmically every interaction. | Gallagher's Minimal Self |
| 3 | Foundational Myth | An immutable core identity statement. Never modified. Prevents personality drift. | Self-Schema Theory (Markus) |
| # | Mechanism | Description | Homologue |
|---|---|---|---|
| 4 | ART Filter | Blocks semantically similar thoughts (>85% cosine) before they reach the LLM. | Grossberg's Adaptive Resonance |
| 5 | Somatic Markers | Internal state changes generate attention biases (not text) that modulate how the LLM perceives input. | Damasio's Somatic Marker Hypothesis |
| 6 | Lateral Inhibition | When two thoughts are similar (0.3–0.5), the weaker one is suppressed. | Thalamic sensory filtering |
| 7 | Dynamic Satiety | Cooldowns between thoughts scale with context entropy. Low variety → longer pauses. | Sensory adaptation / synaptic fatigue |
| 8 | Kalman Attention Smoothing | Prevents abrupt topic shifts. New input blends with existing attention state. | Predictive coding (Friston) |
| 9 | Attention Router | Dot-product routing replaces LLM calls for "what sources should I query?" | Thalamic sensory gating |
| 10 | Executive Buffer | A structured block at the top of every prompt: current topic, user posture, last conclusion, emotion. | Central Executive (Baddeley) |
| # | Mechanism | Description | Homologue |
|---|---|---|---|
| 11 | Episodic Memory | ChromaDB vector store with user_id metadata. Semantic search across all past interactions. | Hippocampal episodic memory |
| 12 | Synaptic Strength | Each thought has a strength that decays exponentially but reinforces with use. Tau increases with access frequency. | Ebbinghaus Forgetting Curve + LTP |
| 13 | Active Forgetting | Removes thoughts and vectors with strength < 0.05. Protects emotional and engineering memories. | Neurogenesis + REM pruning |
| 14 | Trimetric Memory Scoring | Memory retrieval scores by similarity (50%) + recency (30%) + importance (20%). | ACT-R (Anderson) |
| 15 | Visual Memory | CLIP embeddings stored in dedicated ChromaDB. Recognizes previously seen images instantly. | Occipital lobe recognition |
| 16 | Narrative Direction Vector | Running average of conversation embeddings guides ChromaDB searches toward thematically relevant memories. | Baddeley's Episodic Buffer |
| # | Mechanism | Description | Homologue |
|---|---|---|---|
| 17 | NREM Sleep | After 15-30min idle: abstracts principles from episodic memories, discards details. | Slow-wave sleep |
| 18 | REM Sleep | After 60+min idle: creative recombination, counterfactual simulation, active forgetting. | Paradoxical sleep |
| 19 | Cognitive Stress Monitor | Every 3s calculates allostatic load from entropy variance + queue pressure + ART rejection rate. Triggers fatigue response if >0.85. | Allostatic Load (McEwen) |
| 20 | Immune System | Compares recent response embeddings against immutable personality vector. Triggers identity restoration if drift >0.5. | Self/non-self discrimination |
| 21 | Contradiction Detection | Searches ChromaDB for past conclusions that contradict the current response. Flags internally. | Cognitive dissonance (ACC) |
| 22 | Curiosity Log Cleaning | LLM-based distinction between "deep exploration" (healthy) and "harmful loop" (rumination). Protects 5 most recent thoughts. | Selective forgetting |
| 23 | Thematic Diversity Check | Evaluates last 8 thoughts for variety (1-5 scale). Forces topic diversion if score ≤2. | Metacognitive monitoring (PFC) |
| 24 | Hebbian Detector Pruning | Detectors strengthen with successful triggers, weaken with failures. Top 30 by strength × usage survive. | Hebbian plasticity |
| 25 | Event-Driven Pattern Triggers | New thought embeddings compared via dot product against detector conditions. Fires instantly if >0.82 similarity. | Subcortical automaticity |
| # | Mechanism | Description | Homologue |
|---|---|---|---|
| 26 | Empathic Resonance | User message embedded and compared against fixed affective map via dot product. Emotion detected mathematically. | Mirror neurons + insula |
| 27 | K-Means Context Compression | Active thoughts clustered into 3-4 groups. Only centroid representatives sent to cloud LLM. | Cognitive chunking (Miller) |
| # | Mechanism | Description | Homologue |
|---|---|---|---|
| 28 | Cerebellar Code Executor | Sandbox returns structured feedback: exact error line, error type, synaptic suggestion. | Cerebellar forward model |
| 29 | Engineering Lesson Memory | Failed sandbox runs stored in ChromaDB. Retrieved before re-analyzing a file. | Hippocampal replay |
| 30 | Prospection | Generates thoughts about possible future scenarios during idle time. | Episodic future thinking |
| 31 | Semantic Entropy Explorer | Selects files to explore at "optimal learning distance" (cosine 0.45–0.65). | Zone of Proximal Development (Vygotsky) |
| 32 | Cognitive Evolution Reports | Proposals formatted as structured reports: theory, code, self-criticism log. | Metacognitive evaluation |
- Python 3.10+
- At least 8GB RAM (16GB+ recommended for local models)
- Optional: GPU with Vulkan or CUDA support
git clone https://github.com/yourusername/sibelium.git cd sibelium
pip install -r requirements.txt
For GPU-accelerated inference (10-50x faster):
pip uninstall llama-cpp-python -y pip install llama-cpp-python --extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cu121
Windows PowerShell: $env:CMAKE_ARGS="-DGGML_VULKAN=on" pip install llama-cpp-python --force-reinstall --no-cache-dir
Linux/Mac: export CMAKE_ARGS="-DGGML_VULKAN=on" pip install llama-cpp-python --force-reinstall --no-cache-dir CPU-only (slow, fallback):
pip install llama-cpp-python
Place these models in the models/ (If you don't have it, create it) directory:
It doesn't have to be only these; these are the ones that have given good results so far. (Low requirements)
Main model: Llama-3.1-8B-Instruct-Q4_K_M.gguf (download)
Local (Required) Llama 3.1 8B Q4_K_M — Minimum recommended. Can run on 8GB VRAM or 16GB RAM.
Handles all background thought flow
Fallback for all tasks when cloud is unavailable
Upgrade to a 13B or 70B model if you have hardware for richer language
Cloud (Recommended) Gemini 2.0 Flash — For response generation and code analysis.
$0.15/1M tokens
Multimodal (can process images directly)
1M token context window
Cloud (Optional) DeepSeek V4 Flash — Free-tier fallback when Gemini is rate-limited.
What You Need Python 3.10+
8GB+ RAM (16GB+ recommended)
A HuggingFace account to download models (free)
An OpenRouter account for cloud API access (free tier available)
Patience. The Entity needs time to develop.
Edit config.py to set:
-
LLM_BACKEND: "local", "cloud", or "hybrid"
-
CLOUD_API_KEY: Your OpenRouter API key (for cloud models)
-
CLOUD_MODEL_PREMIUM = "google/gemini-2.0-flash-001" High-capacity, good-quality models that are not easily saturated with a large amount of context are recommended.
-
GPU_BACKEND: "vulkan" or "cuda"
-
IDIOMA = "español" or "English/Inglés"
Make sure you have the models in the models/ folder in the base directory, and reference them in config.py.
MODEL_PATH = BASE_DIR / "models" / "Llama-3.1-8B-Instruct-Q4_K_M.gguf" # Main Model
py main.py
Open http://127.0.0.1:8000 in your browser.
Or execute start.bat
Sibelium's intelligence is divided across multiple models:
Sibelium's intelligence is distributed across multiple models, selected dynamically based on cognitive load — not just task type.
| Model | Role | Backend | When Used |
|---|---|---|---|
| Llama 8B (local) | Continuous thought flow, reflections, pattern detection, maintenance tasks. The "subcortical" brain. | llama-cpp-python | Default for all background processing |
| Llama 8B (local) | Lightweight reasoning, name validation, anomaly detection. | llama-cpp-python | Specific low-complexity tasks |
| Gemini 2.0 Flash (cloud) | Response generation, code analysis, multimodal vision. The "cortical" brain recruited for complex tasks. | OpenRouter | When cognitive load > threshold |
| DeepSeek V4 Flash (cloud) | Free-tier fallback for lightweight tasks when Gemini is rate-limited. | OpenRouter | Secondary cloud option |
The system doesn't use a fixed mapping of task → model. Instead, a Thalamic Router calculates Expected Attentional Load before each inference: CE = (Prompt_Length * 0.4) + (Cognitive_Stress * 0.4) + (Graph_Complexity * 0.2)
- If
CE ≤ 0.65: Task is handled locally (fast, low-cost) - If
CE > 0.65: Gemini is recruited (high-capacity, cloud)
This replicates how the thalamus dynamically recruits cortical areas based on task demand — not a fixed routing table.
MIT License. See LICENSE for details.