NeuralClaw is built around a five-cortex cognitive architecture connected by an asynchronous event bus. Every message flows through a biologically-inspired pipeline: Perceive β Remember β Reason β Act β Evolve.
ββββββββββββββββββββββββ
β Neural Bus β
β (async pub/sub) β
ββββββββββββ¬ββββββββββββ
β
βββββββββββββββ¬βββββββββββββββΌβββββββββββββββ¬ββββββββββββββ
βΌ βΌ βΌ βΌ βΌ
βββββββββββ ββββββββββββ ββββββββββββ ββββββββββββ ββββββββββββ
βPERCEPTIONβ β MEMORY β βREASONING β β ACTION β βEVOLUTION β
β β β β β β β β β β
β Intake β β Episodic β βFast Path β β Sandbox β βCalibratorβ
βClassify β β Semantic β βDeliberateβ βCapabilityβ βDistiller β
β Threat β βProceduralβ βReflectiveβ β Audit β βSynthesizeβ
β Screen β βMetabolismβ β β β β β β
βββββββββββ ββββββββββββ ββββββββββββ ββββββββββββ ββββββββββββ
Processes raw input before the LLM sees it.
| Module | File | Purpose |
|---|---|---|
| Intake | cortex/perception/intake.py |
Normalize input into a Signal object |
| Classifier | cortex/perception/classifier.py |
Zero-shot intent classification |
| Threat Screener | cortex/perception/threat_screen.py |
Detect prompt injection, social engineering |
Three memory stores with a biological metabolism cycle.
| Module | File | Purpose |
|---|---|---|
| Episodic | cortex/memory/episodic.py |
Conversation history (SQLite + FTS5) |
| Semantic | cortex/memory/semantic.py |
Entity-relationship knowledge graph |
| Procedural | cortex/memory/procedural.py |
Reusable workflows with trigger patterns |
| Retrieval | cortex/memory/retrieval.py |
Unified search across all stores |
| Metabolism | cortex/memory/metabolism.py |
Consolidation, strengthening, decay, pruning |
Multi-layer reasoning with automatic complexity routing.
| Module | File | Purpose |
|---|---|---|
| Fast Path | cortex/reasoning/fast_path.py |
Pattern-matched instant responses |
| Deliberative | cortex/reasoning/deliberate.py |
LLM-powered reasoning with context |
| Reflective | cortex/reasoning/reflective.py |
Multi-step planning with self-critique |
| Meta-Cognitive | cortex/reasoning/meta.py |
Performance analysis and capability gaps |
Executes skills and enforces security boundaries.
| Module | File | Purpose |
|---|---|---|
| Sandbox | cortex/action/sandbox.py |
Restricted subprocess for code execution |
| Capabilities | cortex/action/capabilities.py |
Permission-based skill verification |
| Audit | cortex/action/audit.py |
Full action logging for accountability |
Self-improvement from every interaction.
| Module | File | Purpose |
|---|---|---|
| Calibrator | cortex/evolution/calibrator.py |
Learn style preferences from corrections |
| Distiller | cortex/evolution/distiller.py |
Extract episodic patterns β semantic facts |
| Synthesizer | cortex/evolution/synthesizer.py |
Auto-generate skills from failure analysis |
The Neural Bus (bus/neural_bus.py) is the asynchronous backbone connecting
all cortices. It uses a pub/sub pattern with typed events:
from neuralclaw.bus.neural_bus import NeuralBus, EventType
bus = NeuralBus()
await bus.start()
# Subscribe to events
bus.subscribe(EventType.SIGNAL_RECEIVED, my_handler)
# Publish events
await bus.publish(EventType.RESPONSE_READY, {"content": "Hello"}, source="gateway")Event Types: SIGNAL_RECEIVED, THREAT_DETECTED, MEMORY_STORED,
REASONING_STARTED, ACTION_COMPLETE, RESPONSE_READY, ERROR, and more.
bus/telemetry.py subscribes to all bus events and logs reasoning traces.
Enable/disable with telemetry_stdout in your config.
Every message flows through this pipeline in gateway.py:
1. PERCEPTION: Intake
βββ Normalize raw text β Signal object
2. PERCEPTION: Threat Screening
βββ Check for prompt injection / social engineering
βββ If blocked β return safety message
3. PERCEPTION: Intent Classification
βββ Classify intent (question, command, greeting, etc.)
4. MEMORY: Retrieve Context
βββ Search episodic + semantic memory for relevant context
5. REASONING: Fast Path
βββ Try pattern-matched instant response
βββ If matched β return immediately
6. REASONING: Procedural Memory Check
βββ Look for matching workflow templates
7. REASONING: Deliberative or Reflective
βββ Simple queries β Deliberative (single LLM call)
βββ Complex queries β Reflective (plan β execute β critique β revise)
8. POST-PROCESS
βββ Store in memory
βββ Tick metabolism + distiller
βββ Calibrate behavior preferences
βββ Meta-cognitive analysis
The NeuralClawGateway class (gateway.py) is the brain β it wires together
all cortices, providers, and channels. Key entry points:
neuralclaw chat # Interactive terminal session
neuralclaw gateway # Full multi-channel deploymentThe web dashboard provides live monitoring:
neuralclaw dashboard # Default port 8080
neuralclaw dashboard --port 9090 # Custom portFeatures:
- Live reasoning traces via WebSocket
- Memory statistics
- Swarm agent status
- Event bus telemetry
- Neural bus event log
The dashboard also starts automatically when you run neuralclaw gateway.