Architecture
100 TypeScript files. 18,000+ lines. Zero dependencies on any AI provider.
File structure
tree
src/
├── commands/ # CLI commands (init, status, search, etc.)
├── memory/ # Knowledge Graph engine (SQLite, 15 tables)
├── extraction/ # Entity-relationship extraction + verification
├── signal/ # Thalamus, activation, spreading activation
├── senses/ # 6 senses (code, tone, emotion, health, stability, context)
├── learning/ # Hebbian, self-tuner, engrams, cold start
├── consolidation/ # NREM/REM sleep, reconsolidation, schemas
├── regulation/ # Echo system, metacognition, self-model, user-model
├── meta/ # AI profiles, development phases, idle brain
├── hooks/ # Provider integration (session-start, user-prompt, etc.)
├── watcher/ # Background daemon (HTTP port 7899)
├── mcp/ # MCP server (7 tools, stdio JSON-RPC)
├── tacit/ # Knowledge hunger, curiosity system
├── hygiene/ # Pruning, garbage collection, brain maintenance
├── providers/ # Multi-provider detection + configuration
├── llm/ # Cloud LLM client (OpenAI, Anthropic, etc.)
├── dashboard/ # 3D brain visualization
└── config.ts # Central configurationTech stack
- Runtime: Node.js + TypeScript
- Database: better-sqlite3 (Knowledge Graph)
- CLI: Commander.js + @clack/prompts
- LLM Analysis: OpenAI API (gpt-4o-mini) or any compatible endpoint
- Embeddings: text-embedding-3-small (hybrid search)
- Dashboard: Vanilla HTML + Three.js (3D visualization)
Database: 15 tables
| Table | Purpose |
|---|---|
nodes | Knowledge entities (facts, preferences, decisions...) |
edges | Weighted relationships between nodes |
chunks | Raw conversation chunks for processing |
patterns | Detected recurring patterns and schemas |
moods | Emotional state tracking |
outcomes | Somatic markers — what worked, what didn't |
raw_buffer | Incoming data before Thalamus filtering |
knowledge_gaps | Detected holes in knowledge (hunger system) |
sessions | Session metadata (provider, timestamps, messages) |
snapshots | Brain state at points in time (growth tracking) |
expertise | Skill levels and domain expertise |
hot_memory | Currently activated nodes (working memory) |
signal_counters | Thalamus signal tracking |
tacit_patterns | Implicit knowledge patterns |
system_state | Global brain state (phase, mood, thresholds) |