Trinity Self-Supervised Symbolic AI — autonomous cognitive system with 10 brain modules.
S³AI implements a biologically-inspired cognitive architecture using Vector Symbolic Architecture (VSA) and ternary computation {-1, 0, +1} for efficient reasoning.
┌─────────────────────────────────────────────────────────────────────────┐
│ Sensory Processing │
│ ┌──────────────┐ │
│ │ HPC (HPC) │ │
│ └──────┬───────┘ │
│ │ │
│ ┌────────▼────────┐ │
│ │ Thalamus │ ←──► ACC (Anterior │
│ ┌────────►│ Hippocampus │ Cingulate) │
│ │ └──────┬───────┘ │ │ │
│ │ │ │ │ │
│ │ ┌────────▼────────┐ │ │ │
│ │ │ Amygdala │ │ │
│ │ │ Basal Ganglia │ │ │
│ │ │ DLPFC │ │ │
│ │ │ PCC │ │ │
│ │ │ OFC │ │ │
│ │ └──────┬───────────┘ │ │
│ │ │ │ │ │
│ │ ┌────────▼────────┐ │ │ │
│ │ │ Insula │ │ │
│ │ └──────┬───────────┘ │ │
│ │ │ │ │ │
│ │ ┌────────▼────────┐ │ │ │
│ │ │ Queen Motor │ │ │
│ │ │ Hypothalamus │ │ │
│ │ └──────┬───────────┘ │ │
│ │ │ │ │ │
│ │ ┌────────▼────────┐ │ │ │
│ │ │ Queen Telegraph │ │ │
│ │ └──────┬───────────┘ │ │
│ │ │ │ │ │
│ └─────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────────────────┘
Location: src/tri/insula.zig
Function: Internal state monitoring and metabolic regulation
- TimingSnapshot: Capture timing at different cognitive phases
- measureState(): Compute internal metrics (latency, alloc, action rate)
- health(): Return cell health status
- CellHealth: Track cycle count, last check, status
const state = try insula.measureState(allocator, cycle_start, &timing,
actions_taken, actions_suppressed, total_cycles);Location: src/tri/amygdala.zig
Function: Emotional processing and fear conditioning
- Emotion: Basic emotion types (fear, reward, neutral, anger, joy)
- Valence: -100 to +100 intensity scale
- FearMemory: One-shot fear learning from aversive events
- shouldAvoid(): Check if action should be avoided based on fear associations
- modulateMood(): Adjust OFC mood based on emotional context
const valence = amygdala.Valence.fear(85);
if (amygdala.shouldAvoid(&action_candidate, allocator)) {
// Suppress this action
}Location: src/tri/basal_ganglia.zig
Function: Action selection and impulse suppression
- ActionCandidate: Potential actions with urgency, value, cost, suppression
- ActionKind: Read-only vs Soft Write vs Dangerous actions
- selectAction(): Choose best action from candidates
- conflictDetect(): Find conflicting actions
- Urgency: critical, high, normal, low
const selected = basal_ganglia.selectAction(&candidates);
if (selected.suppressed) {
// Action was suppressed
}Location: src/tri/hippocampus.zig
Function: Memory formation, consolidation, and retrieval
- MemoryRecord: Store observations, episodes, with tags
- MemoryKind: observation, episode, goal, reflection
- read(): Query memory by kind, tag filter, limit
- consolidate(): Replay episodes for learning
- generateId(): Create unique IDs for records
const memories = try hippocampus.read(allocator, .{
.kind_filter = "emo:fear",
.limit = 50,
});Location: src/tri/hypothalamus.zig
Function: Homeostatic regulation and command orchestration
- CommandRegistry: 130+ commands with categories
- CommandMetadata: Name, category, risk level, min/max args
- registerAllCommands(): Register all Trinity commands
- checkPolicy(): Verify if action is allowed (rate limit, cooldown, escalation)
var registry = try hypothalamus.registerAllCommands(allocator);
const verdict = hypothalamus.checkPolicy(action, config, counters, incidents);Location: src/tri/thalamus.zig
Function: Sensory integration and signal routing
- LocusCoeruleus: Arousal level (sleep, idle, normal, alert, alarm, emergency)
- MetabolismAlert: Health alerts from hippocampus
- getMetabolismAlerts(): Fetch recent health warnings
- parseHealthStat(): Parse health metrics from data
- detectConflicts(): Find action conflicts
- countEpisodes(): Count memory consolidation episodes
const arousal = thalamus.getLocusArousal();
if (arousal == .alert) {
// Activate DLPFC for immediate action
}Location: src/tri/queen_acc.zig
Function: Conflict detection and cognitive control
- ActionCounters: Track action frequency and timing
- ErrorMonitor: Track errors by severity and threshold
- detectConflicts(): Find action conflicts
- generateControlSignals(): Generate control signals for actions
- ActionLevel: Read-only, Soft Write, Dangerous actions
const signals = try queen_acc.generateControlSignals(allocator, &candidates, &monitor);Location: src/tri/queen_dlpfc.zig
Function: Decision making and planning
- DecisionContext: Current state, senses, goals, history
- DecisionMaker: Generate decisions based on context
- evaluateOptions(): Score action options
- generatePlan(): Create action plan
- ActionKind: Classification of actions
const decision = try queen_dlpfc.makeDecision(allocator, state);Location: src/tri/queen_pcc.zig
Function: Self-awareness and consciousness simulation
- SelfModel: Identity, current state, capabilities, goals, learning state
- ConsciousnessState: Status, stuck duration, learning rate
- diagnoseConsciousness(): Analyze current state
- describeSelf(): Generate self-description
- learnFromActionResult(): Update model based on results
const consciousness = queen_pcc.diagnoseConsciousness(allocator, state);Location: src/tri/queen_ofc.zig
Function: Mood modulation and reward processing
- Mood: calm, focused, agitated, excited, tired
- MoodManager: Track mood changes and suggest actions
- applyReward(): Update mood based on reward/punishment
- MoodTransition: State transitions between moods
try queen_ofc.applyReward(allocator, .positive, 10);The brain modules communicate through shared structures:
- VSA Vectors: All modules use
src/vsa.zigfor vector operations - Ternary Computation: {-1, 0, +1} for efficient VSA operations
- Hippocampus: Shared memory accessed by all modules
- Command Registry: Hypothalamus coordinates all actions
Run brain module tests:
zig test src/tri/insula.zig
zig test src/tri/amygdala.zig
zig test src/tri/basal_ganglia.zig
zig test src/tri/hippocampus.zig
zig test src/tri/thalamus.zigAll modules: 600+ tests passing (100%)
- SIMD acceleration: 14-17x speedup for VSA operations
- Ternary encoding: 1.58 bits/trit (20x compression vs float32)
- Memory pooling: Reuse allocations for hot paths
- Lazy evaluation: Defer computation until needed
# Run all brain module tests
zig test src/tri/insula.zig
zig test src/tri/amygdala.zig
zig test src/tri/basal_ganglia.zig
zig test src/tri/hippocampus.zig
zig test src/tri/hypothalamus.zig
zig test src/tri/thalamus.zig
zig test src/tri/queen_actions.zig
zig test src/tri/queen_acc.zig
zig test src/tri/queen_dlpfc.zig
zig test src/tri/queen_pcc.zig
zig test src/tri/queen_policy.zig# Run all S³AI tests
zig build test src/tri/insula.zig src/tri/amygdala.zig \
src/tri/basal_ganglia.zig src/tri/hippocampus.zig \
src/tri/hypothalamus.zig src/tri/thalamus.zig# Run performance benchmarks
zig test src/tri/perf_benchmark.zig
# Benchmark VSA operations
zig test src/vsa.zig -fnsimd-test- Neural Symbol Grounding: Map symbols to VSA vectors
- Temporal Sequences: Add sequence prediction to hippocampus
- Attention Mechanism: Implement attention-based selection
- Meta-Learning: Learn how to learn efficiently
- Memory Consolidation: Implement sleep-wake cycle for hippocampus
- Emotional Regulation: Add mood state machine to amygdala
- Action Selection: Improve conflict resolution in basal ganglia
- Planning: Add multi-step planning to DLPFC
- VSA Spec:
specs/tri/vsa.tri - HSLM Training:
src/hslm/ - FPGA Synthesis:
fpga/openxc7-synth/ - This Doc:
docs/S3AI_BRAIN_MODULES.md