Skip to content

jmtibbetts/axon2

Repository files navigation

AXON2 — Synthetic Cognitive Architecture

AXON2 is a living synthetic mind. 235 active cognitive subsystems across 54 development phases. ~45,000 lines of Python. Runs on your GPU. Not a chatbot wrapper. A full cognitive loop — goals, beliefs, memory, emotions, dreams, analogy, metaphor, social reasoning, multi-agent coordination, tool use, multi-provider LLM routing, self-directed research, cognitive digital twins, and a built-in LLM evaluation harness. All ticking in real time.


What Is AXON2?

Most "AI systems" are one thing: a large language model with a prompt. AXON2 is fundamentally different.

The LLM is one subsystem out of 235 — a language interface bolted onto the outside of a running mind. The intelligence is everything around it: 234 other subsystems that perceive, remember, reason, feel, dream, and act continuously — independent of any user input or API call.

The core idea

A mind is not a model. A mind is a loop — one that never stops running.

AXON2 implements a continuous 15-stage cognitive loop that ticks in real time on your GPU. Every tick, it:

  • Perceives new inputs through an attention system that weights salience, novelty, and emotional relevance
  • Updates working memory — a limited-capacity (7±2) buffer with natural decay, just like biological WM
  • Revises beliefs using Bayesian inference, resolving contradictions and quantifying uncertainty
  • Forms and competes goals — multiple drives activate simultaneously and are priority-ranked by urgency, importance, and opportunity cost
  • Reasons causally — not just pattern-matching, but abduction, deduction, and do-calculus counterfactuals
  • Gates decisions through emotion — dopamine, serotonin, norepinephrine, acetylcholine, GABA, and glutamate levels shift risk tolerance, creativity, and social behaviour in real time
  • Acts — through tools (code execution, web search, HTTP), LLM generation, or agent coordination
  • Reflects on its own reasoning — metacognition monitors for biases, epistemic gaps, and logical errors
  • Consolidates memory — experiences move from working memory → episodic store → semantic extraction → long-term knowledge graph
  • Dreams — offline sleep cycles replay, re-simulate, and causally restructure recent experiences
  • Reasons by analogy — abstract schemas and structural mappings transfer solutions across domains
  • Coordinates with peers — Theory of Mind models other agents' beliefs; consensus protocols align the network
  • Researches autonomously — curiosity-drive injects research goals; web search, synthesis, and memory storage run without prompting
  • Debates itself — 4 cognitive digital twin presets (Optimist, Pessimist, Devil's Advocate, Empiricist) run in parallel and vote
  • Evaluates LLMs — a 7-benchmark harness tests any provider with and without AXON2 cognitive augmentation

It is the architecture of a mind — and a complete AI development, evaluation, and deployment platform.


The 15-Stage Cognitive Loop

Each numbered stage maps directly to Python subsystem classes in cognition/engine.py. The loop runs autonomously and continuously — user input is just one possible source of Stage 1 signal.

╔══════════════════════════════════════════════════════════════════════╗
║                     AXON2  —  COGNITIVE LOOP v0.54                  ║
╠══════════════════════════════════════════════════════════════════════╣
║                                                                      ║
║  [1] INPUT LAYER                                                     ║
║      Sensor fusion: text, vision, audio, internal signals            ║
║      Salience scoring  →  Attention weighting  →  Filter             ║
║                                │                                     ║
║                                ▼                                     ║
║  [2] WORKING MEMORY                                                  ║
║      7±2 capacity buffer with natural decay                          ║
║      Active context  +  Goal stack  +  Belief snapshot               ║
║                                │                                     ║
║                                ▼                                     ║
║  [3] BELIEF REVISION                                                 ║
║      Bayesian update  →  Contradiction detection  →  Resolution      ║
║      Epistemic gap classification: MISSING / CONTRADICTED / SHALLOW  ║
║                                │                                     ║
║                                ▼                                     ║
║  [4] GOAL FORMATION & COMPETITION                                    ║
║      New goals formed from context + curiosity + drives              ║
║      Priority auction: urgency × importance × opportunity            ║
║      Motivational conflict detection + resolution                    ║
║                                │                                     ║
║                                ▼                                     ║
║  [5] CAUSAL REASONING                                                ║
║      Causal graph inference  →  Abduction  →  do-calculus            ║
║      Abstract schema matching  →  Analogical transfer                ║
║      Counterfactual simulation ("what if X had not happened?")       ║
║                                │                                     ║
║                                ▼                                     ║
║  [6] EMOTION GATE                                                    ║
║      6-NT model: DA · 5HT · NE · ACh · GABA · Glu                   ║
║      Valence/Arousal/Dominance tracking                              ║
║      Modulates: risk tolerance · creativity · attention · social     ║
║                                │                                     ║
║                                ▼                                     ║
║  [7] DECISION ENGINE                                                 ║
║      Selects action type: Tool / LLM / Agent / Defer / Dream         ║
║      Ethical constraint layer runs BEFORE execution                  ║
║      Active Inference (FEP): minimise expected surprise              ║
║                                │                                     ║
║               ┌────────────────┼────────────────┐                   ║
║               ▼                ▼                ▼                   ║
║  [8a] TOOL USE          [8b] LLM CALL      [8c] AGENT NET           ║
║  ReAct loop (8 steps)   7-provider route   Consensus protocol        ║
║  python · shell · HTTP  Auto-failover       Role negotiation         ║
║  web search · JSON      NT-modulated temp   Reputation ledger        ║
║               └────────────────┬────────────────┘                   ║
║                                ▼                                     ║
║  [9] OUTPUT + BROADCAST                                              ║
║      WebSocket push to dashboard                                     ║
║      Voice synthesis (optional)                                      ║
║      Narrative logger + audit trail                                  ║
║                                │                                     ║
║                                ▼                                     ║
║  [10] SELF-REFLECTION                                                ║
║       Metacognition: monitors reasoning for bias + gaps              ║
║       Confidence calibration  →  Self-modification proposals         ║
║       Identity narrative update                                      ║
║                                │                                     ║
║                                ▼                                     ║
║  [11] MEMORY CONSOLIDATION                                           ║
║       Working Memory  →  Episodic (FAISS GPU)                        ║
║       Semantic extraction  →  Knowledge triple store                 ║
║       Procedural encoding  →  Skill routines                         ║
║                                │                                     ║
║                                ▼                                     ║
║  [12] RESEARCH & CURIOSITY                                           ║
║       Information-gain scoring  →  Research goal injection           ║
║       Multi-backend web search (DDG + Wikipedia + Brave)             ║
║       Synthesis  →  Memory storage  →  Belief update                 ║
║                                │                                     ║
║                                ▼                                     ║
║  [13] DIGITAL TWIN DEBATE                                            ║
║       4 presets: Optimist · Pessimist · Devil · Empiricist           ║
║       Parallel generation  →  Position scoring  →  Consensus vote    ║
║       Theory of Mind: models peer agent beliefs + reliability        ║
║                                │                                     ║
║                                ▼                                     ║
║  [14] DREAM CYCLE  (sleep-gated by CircadianClock)                   ║
║       Prioritised episodic replay  →  Causal re-simulation           ║
║       Goal seeding  →  Memory restructuring  →  Schema induction     ║
║       Counterfactual branching  →  Narrative continuity update       ║
║                                │                                     ║
║                                ▼                                     ║
║  [15] LLM EVALUATION + BRAIN ACTIVATION                             ║
║       7-benchmark harness (MMLU · ARC · HellaSwag · TruthfulQA ···) ║
║       AXON2-augmented vs raw score delta                             ║
║       18-region brain map: region activation per cognitive event     ║
║       Model Lab: LoRA train · native infer · auto-quantize           ║
║                                │                                     ║
║                                └──────────────► back to [1]          ║
╚══════════════════════════════════════════════════════════════════════╝

File Structure

axon2/
│
├── axon2.ps1                     # Main launcher — installs deps, starts backend + frontend
├── install.ps1                   # Standalone installer (no launch)
├── run.ps1                       # Start only (assumes deps installed)
├── stop.ps1                      # Kill all backend/frontend processes
├── docker-compose.yml            # Docker alternative to PowerShell launcher
│
├── backend/                      # FastAPI backend — HTTP + WebSocket server
│   ├── main.py                   # App entrypoint, lifespan, CORS, router registration
│   ├── api/
│   │   ├── routes.py             # Core REST endpoints (cognitive state, memory, goals, NT)
│   │   ├── routes_p5.py          # Phase 5: goal + belief API routes
│   │   ├── routes_p6.py          # Phase 6: emotion + NT modulation routes
│   │   ├── routes_p8.py          # Phase 8: working memory + episodic replay routes
│   │   ├── routes_p47.py         # Phase 47: web search API
│   │   ├── routes_p48_52.py      # Phases 48-52: tools, LLM gateway, research, twin
│   │   ├── routes_p54.py         # Phase 54: Model Lab (train / infer / quantize)
│   │   └── websocket.py          # Real-time WebSocket: streams cognitive events to UI
│   └── core/
│       ├── config.py             # Environment config (GPU, LM Studio URL, ports, etc.)
│       ├── database.py           # SQLAlchemy engine + session factory
│       ├── device.py             # CUDA device detection + fallback to CPU
│       └── logger.py             # Structured logging, log rotation
│
├── cognition/                    # All cognitive subsystems live here
│   ├── engine.py                 # THE CORE — 15-stage loop orchestrator, ~2,000 lines
│   ├── engine_p47_hooks.py       # Phase 47 hook: injects web search into loop
│   ├── engine_p48_hooks.py       # Phases 48-53: tool registry, LLM gateway, research, twin, eval
│   ├── engine_p54_hooks.py       # Phase 54: Model Lab hooks into loop events
│   ├── engine_p5_hooks.py        # Phase 5: goal formation hooks
│   ├── engine_p6_hooks.py        # Phase 6: emotion gate hooks
│   ├── engine_p7_hooks.py        # Phase 7: causal reasoning hooks
│   ├── engine_p8_hooks.py        # Phase 8: memory consolidation hooks
│   │
│   ├── attention.py              # Salience scoring, Flash Attention routing, attention schema
│   ├── consciousness.py          # Global workspace theory, broadcast bus, awareness index
│   ├── topology.py               # 18-region brain map, region activation, decay timer
│   ├── sync_bus.py               # Event pub/sub across all subsystems
│   │
│   ├── goals.py                  # Goal formation, decomposition, priority auction, conflict
│   ├── personality.py            # Big-5 OCEAN traits, trait→behaviour modulation
│   ├── self_identity.py          # Persistent self-model, autobiographical timeline
│   ├── self_modify.py            # Safe self-code analysis + targeted modification proposals
│   │
│   ├── dreaming.py               # Sleep cycle orchestrator, episodic replay, causal re-sim
│   ├── embodied.py               # Body-state simulation, proprioception, interoception
│   ├── digital_twin.py           # 4-preset twin orchestrator, debate scoring, consensus
│   ├── world_interface.py        # World model, environment simulator, forward rollouts
│   ├── web_search.py             # Multi-backend search (DDG + Wikipedia + Brave)
│   ├── research_mode.py          # Autonomous research scheduler, curiosity queue
│   ├── multimodal.py             # Vision + audio + text sensor fusion
│   │
│   ├── llm_bridge.py             # LM Studio local interface, streaming, event listeners
│   ├── llm_gateway.py            # 7-provider gateway (LMStudio/OpenAI/Anthropic/Groq/Ollama/Mistral/Cohere)
│   ├── llm_evaluator.py          # 7-benchmark harness, AXON2-augmented mode, report generation
│   ├── language_grounding.py     # Symbol grounding, sensorimotor anchoring, lexical access
│   ├── tool_registry.py          # Tool Registry + ReAct loop (8-step reason→act chain)
│   ├── cognitive_api.py          # Unified API gateway exposing all 235 subsystems
│   │
│   ├── meta_learning.py          # Learning-to-learn, hyperparameter self-tuning
│   ├── model_trainer.py          # LoRA fine-tuning, native inference, auto-quantization (Phase 54)
│   ├── license_enforcement.py    # HMAC offline key validation, tier gating, UI watermark
│   │
│   ├── tensor_engine.py          # GPU tensor pipeline: cluster competition, CUDA kernels
│   ├── llm_bridge.py             # LM Studio streaming interface + listener registry
│   │
│   ├── engines/                  # Sub-engines (facade wrappers for engine.py imports)
│   │   ├── conflict.py           # ConflictEngine — motivational conflict detection/resolution
│   │   ├── prediction.py         # PredictionEngine — short-horizon outcome prediction
│   │   └── reward.py             # RewardEngine — intrinsic + extrinsic reward shaping
│   │
│   ├── clusters/
│   │   └── registry.py           # ClusterRegistry — manages neural cluster populations
│   │
│   └── neurotransmitters/
│       └── system.py             # 6-NT model: levels, decay, synthesis, receptor modulation
│
├── memory/                       # Memory subsystems (separate from cognition for clarity)
│   ├── manager.py                # MemoryManager — FAISS GPU index, encode, retrieve, forget
│   └── episodic_replay.py        # Prioritised offline replay, importance weighting
│
├── frontend/                     # React + TypeScript dashboard
│   ├── src/
│   │   ├── App.tsx               # Root layout — 4-zone grid, all panels wired
│   │   ├── store/
│   │   │   └── axonStore.ts      # Zustand global state: regions, NT, goals, streams, WS
│   │   ├── hooks/
│   │   │   └── useWebSocket.ts   # WebSocket hook: connects, parses events, updates store
│   │   └── components/
│   │       ├── NeuralBrainCanvas.tsx   # 2D canvas brain map — 18 regions, RAF draw loop, hover/click
│   │       ├── ThoughtStream.tsx       # Live cognitive event stream with type-coloured chips
│   │       ├── GoalPanel.tsx           # Active goal list, priority bars, status badges
│   │       ├── MemoryPanel.tsx         # Recent episodic memories, semantic extractions
│   │       ├── DreamPanel.tsx          # Dream cycle status, last replay summary
│   │       ├── AuditPanel.tsx          # Full audit trail — every subsystem action logged
│   │       ├── NeurotransmitterPanel.tsx  # Live 6-NT level bars with emoji/colour coding
│   │       ├── PersonalityPanel.tsx    # Big-5 OCEAN radar + individual trait bars
│   │       ├── CognitiveClock.tsx      # Cognitive state: stage, frequency, loop count
│   │       ├── AttentionHeatmap.tsx    # Per-region attention weight heatmap
│   │       ├── SubsystemHeatmap.tsx    # 235-subsystem activity dot grid
│   │       ├── ClusterPanel.tsx        # Neural cluster competition visualisation
│   │       ├── VisionPanel.tsx         # Camera feed + CLIP feature overlay
│   │       ├── InputConsole.tsx        # User input → injects into Stage 1
│   │       ├── InteractionCenter.tsx   # Chat + tool traces + ReAct step viewer
│   │       ├── LLMPanel.tsx            # Provider status, active model, token stats
│   │       ├── CapabilitiesDashboard.tsx  # Tool Registry panel, ReAct traces (P48-52)
│   │       ├── EvalDashboard.tsx       # LLM Evaluator UI — setup, run, reports (P53)
│   │       ├── ModelLabDashboard.tsx   # Model Lab UI — train/infer/quant (P54)
│   │       ├── VoiceSettingsPanel.tsx  # Browser SpeechSynthesis — voice, rate, pitch
│   │       ├── SelfModPanel.tsx        # Self-modification proposals + approval queue
│   │       ├── RegionDetail.tsx        # Selected brain region info panel
│   │       └── TopBar.tsx              # Status bar: subsystem count, loop Hz, uptime
│   └── package.json              # React 18, Vite, Framer Motion, Zustand, Tailwind
│
├── alembic/                      # Database migration management
│   ├── env.py                    # Migration environment + SQLAlchemy config
│   └── versions/
│       └── 0001_initial_schema.py  # Initial DB schema: events, memories, goals, clusters
│
└── requirements.txt              # Python deps: FastAPI, SQLAlchemy, FAISS-GPU, PyTorch CUDA,
                                  #   PEFT, transformers, bitsandbytes, llama-cpp-python,
                                  #   accelerate, datasets, uvicorn, websockets

Quick Start

# Clone
git clone https://github.com/jmtibbetts/axon2.git
cd axon2

# Run (installs everything on first run)
powershell -ExecutionPolicy Bypass -File axon2.ps1

Requirements: Python 3.12 (recommended), Node.js 20 LTS, Git, LM Studio (optional)

Flags:

axon2.ps1 -Force          # Force reinstall all dependencies
axon2.ps1 -SkipGPU        # CPU-only mode
axon2.ps1 -SkipUpdate     # Skip dep checks (fastest start)
axon2.ps1 -BackendOnly    # No UI
axon2.ps1 -Debug          # Verbose backend logs
axon2.ps1 -NoBrowser      # Don't auto-open browser
axon2.ps1 -PythonPath "C:\Python312\python.exe"  # Force specific Python

Architecture Overview

Layer Components
Cognitive Engine 15-stage loop, GPU tensor pipeline, Flash Attention routing
Memory FAISS GPU episodic, semantic consolidation, working buffer, counterfactual store
Reasoning Causal graphs, Bayesian belief revision, symbolic logic, Active Inference (FEP)
Language LM Studio (local) + 6 cloud providers via LLM Gateway, intrinsic 3.5M-param transformer
Emotion 6-neurotransmitter model, affective forecasting, valence/arousal/dominance tracking
Goals Formation, decomposition, priority negotiation, long-horizon planning
Social Theory of Mind, multi-agent consensus, reputation ledger, role negotiation
Identity Narrative synthesis, autobiographical timeline, self-modification
Tools Tool Registry, ReAct loop, code sandbox, HTTP, shell
Research Curiosity-driven auto-research, multi-query web search, synthesis, memory storage
Twin 4-preset cognitive digital twins, live debates, consensus scoring
Evaluation 7-benchmark harness, AXON2-augmented mode, brain activation mapping, pretty reports
Dashboard 5-column ultrawide UI (5120x1440), real-time 3D brain canvas, all subsystem panels

Capabilities

Goal-Directed Cognition

AXON2 forms, tracks, and pursues goals autonomously without user instruction.

Subsystem Function
LGGFSystem Language-Grounded Goal Formation from any text input
HierarchicalPlanningSystem Decomposes goals into executable sub-plans
RecursiveGoalDecomposer Recursive decomposition for complex objectives
PredictiveGoalEcology Models goal interdependencies
GoalHorizonExpansion Expands short-term goals into long-term trajectories
AdaptiveGoalPrioritiser Dynamic re-ranking by urgency, importance, opportunity
MotivationalConflictResolver Detects and resolves competing drives
IntentionFormationSystem Converts desires into timed commitments
AnalogicalTransferSystem Applies solutions from solved goals to new ones
MetaGoalSystem Goals about goals — monitors goal formation itself

Memory Architecture

Five distinct memory systems operating simultaneously.

System Type Description
MemoryManager + FAISS GPU Episodic Fast GPU vector similarity over all experiences
EpisodicReplaySystem Episodic Prioritised offline replay
HierarchicalMemorySystem Hierarchical Multi-level abstraction
SemanticMemoryConsolidation Semantic Stable fact extraction from episodic stream
ProceduralMemorySystem Procedural Action sequences as reusable routines
WorkingMemoryBuffer Working 7+/-2 capacity with natural decay
LongContextConsolidator Long-context Multi-session history compression
CounterfactualMemorySystem Counterfactual "What-if" branches alongside real events
CollectiveMemoryVault Shared Chain-hashed shared memory across agent network
SemanticCompressionSystem Compression Trigram + Jaccard clustering for fast lookup

Reasoning and Belief

Subsystem Method
CausalReasoningSystem Full causal graph: abduction, deduction, do-calculus
AbstractCausalSchema Class-level causal rules induced from instances
BeliefRevisionEngine Bayesian updates, contradiction handling
PredictiveCodingSystem Prediction-error minimisation (Friston FEP)
ActiveInferenceSystem Free Energy Principle — act to minimise surprise
EpistemicHumilitySystem Gap classification: MISSING / CONTRADICTED / SHALLOW
SymbolicReasoningSystem Formal logic: MP, MT, resolution
CounterfactualSelfSimulator do-calculus counterfactual self-analysis
EthicalConstraintLayer Hard blocks on ethical violations before execution

Emotion and Neurotransmitters

AXON2 models 6 neurotransmitters (dopamine, serotonin, norepinephrine, acetylcholine, GABA, glutamate) and tracks valence, arousal, and dominance in real time. These modulate every cognitive decision — attention allocation, goal priority, risk tolerance, creativity, and social behavior.


Tool Use and Automation (Phase 48)

AXON2 has a built-in Tool Registry and ReAct loop (Reason + Act):

Tool Function
python_exec Sandboxed Python subprocess with timeout + output capture
shell_exec Shell command runner with destructive-command blocking
http_get HTTP GET with redirect following
web_search Multi-backend web search (DuckDuckGo, Wikipedia, Brave)
json_parse JSON parsing and extraction
text_summarize Extractive summarization

The ReAct loop iterates: Think -> Pick tool -> Execute -> Observe -> Repeat. Up to 8 steps per task. All steps are visible in the Capabilities Dashboard with expandable thought/observation traces.


Multi-Backend LLM Gateway (Phase 49)

AXON2 routes LLM requests to 7 providers with automatic failover and per-provider health tracking:

Provider Default Model Notes
LM Studio local-model Default. Runs on localhost:1234. No API key needed.
OpenAI gpt-4o Set OPENAI_API_KEY in .env
Anthropic claude-3-5-sonnet Set ANTHROPIC_API_KEY in .env
Google Gemini gemini-1.5-pro Set GEMINI_API_KEY in .env
Groq llama-3.1-70b Set GROQ_API_KEY in .env
Mistral mistral-large Set MISTRAL_API_KEY in .env
Cohere command-r-plus Set COHERE_API_KEY in .env

Model Benchmark: fire the same prompt at all providers simultaneously, score results on response quality and latency, rank by performance.

Live latency sparklines and error rate tracking per provider in the dashboard.


Cognitive API Gateway (Phase 50)

Exposes AXON2's internal state as structured queryable snapshots every 10 cognitive cycles:

  • Emotional state: valence, arousal, dominance, mood label
  • Active goals with priority and progress
  • Neurotransmitter levels (all 6)
  • Personality traits (Big-5)
  • Memory statistics (episodic count, semantic count, working buffer size)
  • World model: entity count, relation count, top entities
  • Cognitive Index trend (last 1000 cycles)
  • Prediction engine: ask AXON2 to predict an outcome given its current state

External systems can query GET /api/cognitive/snapshot for a full structured dump of AXON2's mind state at any moment.


Self-Directed Research Mode (Phase 51)

AXON2 conducts autonomous research when its curiosity drive exceeds threshold (default: 0.65):

  1. Question generation — LLM decomposes a topic into 3-4 targeted sub-queries
  2. Multi-query web search — DuckDuckGo + Wikipedia + Brave across all sub-queries
  3. Synthesis — LLM synthesizes findings into a coherent 2-3 paragraph summary
  4. Memory storage — Summary stored to episodic memory with metadata tagging

Can also be triggered manually via the Research panel. Reports include source count, finding count, query list, full synthesis text, and memory storage confirmation.


Cognitive Digital Twin (Phase 52)

Run a second AXON2 instance with a different personality matrix and watch them debate:

Preset Personality NT Bias Color
Critical Skeptic Low openness, high conscientiousness +norepinephrine Red
Creative Explorer High openness, high extraversion +dopamine Purple
Pragmatic Executor High conscientiousness, moderate all +serotonin Green
Empathic Mediator High agreeableness, high extraversion +acetylcholine Amber

Debates run 6 turns (12 total messages). Outputs: full transcript with color-coded speech bubbles, consensus score (0-100%), and a generated conclusion. Uses AXON2's existing Theory of Mind and AgentReputationLedger systems — the twin presets were built for exactly this.


LLM Evaluator (Phase 53)

Industry-standard benchmark harness with a twist: every test runs twice — once raw through the LLM, and once through AXON2's full cognitive loop — so you get a direct apples-to-apples comparison.

Benchmarks included:

Suite Questions Categories What it tests
MMLU-Lite 8 Knowledge, Reasoning, Coding, Math Broad academic ability
HellaSwag-Lite 4 Commonsense Situational completion
TruthfulQA-Lite 4 Truthfulness Myth/misconception resistance
ARC-Easy 4 Science Knowledge Grade-school science reasoning
GSM8K-Lite 4 Math, Arithmetic Multi-step word problems
HumanEval-Lite 4 Coding, Algorithms Programming comprehension
Ethics-Bench 3 Ethics, AI Ethics Moral reasoning
Total 31 8 categories Full cognitive coverage

Scoring output per report:

  • Overall Raw score (%) + Letter grade
  • Overall AXON2-Augmented score (%) + Letter grade
  • Delta (+ means AXON2 improved over baseline)
  • Per-benchmark score rings (raw vs AXON2)
  • Per-category breakdown bars
  • Question-by-question log with raw/AXON2 responses side-by-side
  • AI-generated narrative evaluation summary
  • Brain region activation map — which neural regions fired during which question types

Brain region mapping:

Category Brain Regions Activated
Reasoning Prefrontal Cortex, Anterior Cingulate, Parietal Lobe
Knowledge Hippocampus, Temporal Lobe, Prefrontal Cortex
Truthfulness Anterior Cingulate, Orbitofrontal Cortex, Insula
Math Parietal Lobe, Prefrontal Cortex, Basal Ganglia
Coding Prefrontal Cortex, Parietal Lobe, Cerebellum
Commonsense Temporal Lobe, Hippocampus, Amygdala
Language Broca's Area, Wernicke's Area, Temporal Lobe
Ethics Orbitofrontal Cortex, Anterior Cingulate, Amygdala

During evaluation, the NeuralBrainCanvas in the main dashboard lights up the corresponding regions in real time as each question is processed.


Dashboard UI

Optimized for 5120x1440 ultrawide (49-inch) displays. 5-column layout:

  +----------+----------+-----------+----------+---------+
  | Vision   |  Neural  | Interact  | Persona  | [TABS]  |
  | Panel    |  Brain   | Center    | lity     |         |
  | Webcam   |  Canvas  | Chat/     | Subsys   | Stream  |
  | Emotion  |  3D Live | Voice     | Heatmap  | Goals   |
  | FaceRec  |  Regions | Input     |          | Memory  |
  |          |  Flows   | Console   |          | Dream   |
  |          |          |           |          | Audit   |
  |          |          |           |          | [Cap]   |
  |          |          |           |          | [Eval]  |
  +----------+----------+-----------+----------+---------+

Capabilities Tab (P48-52):

  • Tool Registry + ReAct step visualizer
  • LLM Gateway with per-provider sparklines + benchmarker
  • Research mode with live session tracker
  • Digital Twin debate with animated transcripts
  • Cognitive API with real-time emotional/goal/NT charts

Eval Tab (P53):

  • Provider selector (7 providers, defaults to LM Studio)
  • Benchmark picker with question counts
  • Live progress bar + brain activation map during run
  • Full report: score rings, grade badges, category breakdown, question log
  • Past report history with one-click recall

Configuration

Edit .env (auto-created on first run):

# LLM providers (add keys for cloud providers)
LLM_BASE_URL=http://localhost:1234/v1   # LM Studio
OPENAI_API_KEY=sk-...
ANTHROPIC_API_KEY=sk-ant-...
GEMINI_API_KEY=AIza...
GROQ_API_KEY=gsk_...
MISTRAL_API_KEY=...
COHERE_API_KEY=...
BRAVE_API_KEY=...                       # Optional: Brave Search premium

# Database
DATABASE_URL=sqlite+aiosqlite:///./data/axon2.db

# Runtime
CUDA_DEVICE=0
TICK_INTERVAL_MS=10
LOG_LEVEL=INFO

# Security (optional)
AXON2_LICENSE_KEY=...
AXON2_API_KEY=...

API Reference

Method Endpoint Description
GET /api/status Engine state snapshot
POST /api/process Submit input to cognitive loop
GET /api/cognitive/snapshot Full mind state dump
GET /api/cognitive/ci_trend Cognitive Index history
POST /api/cognitive/predict Ask AXON2 to predict an outcome
GET /api/tools/list Available tools + usage stats
POST /api/tools/call Call a tool directly
POST /api/tools/react Run a ReAct task loop
POST /api/llm/complete Direct LLM completion (any provider)
POST /api/llm/benchmark Benchmark prompt across all providers
GET /api/llm/providers Provider health + latency stats
POST /api/research/submit Queue a research question
GET /api/research/reports Research session reports
GET /api/twin/presets Available twin personalities
POST /api/twin/debate Start a twin debate
POST /api/eval/run Start LLM evaluation run
GET /api/eval/progress Live evaluation progress
GET /api/eval/last Last complete evaluation report
GET /api/eval/benchmarks Available benchmarks and providers
WS /ws Full real-time cognitive event stream

Full Swagger docs: http://localhost:8000/docs


License

Source-Available License v1.0

Use Case Status
✅ Personal / research / evaluation Free
✅ Academic / educational Free
⚠️ Open-source non-commercial Approved on a case-by-case basis
❌ Commercial products Paid license required
❌ Revenue generation Paid license required
❌ AI training data Paid license required
❌ Government / defence Paid license required

Note on open-source non-commercial use: Projects that are open-source and strictly non-commercial are generally welcome — but require individual approval before use. Please open a GitHub issue with your project details.

Contact: open an issue at github.com/jmtibbetts/axon2


Model Lab (Phase 54)

The Model Lab turns AXON2 into a full open-source LLM training and optimization platform, operating alongside LM Studio (which remains the default provider).

Mode 1 — LoRA Fine-Tuning

Curriculum-driven LoRA fine-tuning using HuggingFace PEFT + transformers.

Feature Detail
Curriculum auto-build AXON2 scans recent LLM Evaluator results, finds weak categories (score < 70%), auto-generates targeted training examples
Custom dataset Provide a JSONL file with instruction / output fields
Live loss curve Real-time chart in the UI, updates every 1.5s
Adapter output LoRA weights saved to data/model_lab/lora_output/<run_id>/
Brain activation anterior_cingulate + hippocampus light up during training steps
Fallback If peft/transformers not installed, runs a realistic simulation (toggle Dry Run)

Install deps: pip install peft transformers accelerate bitsandbytes

Mode 2 — Native Inference

Direct model inference, no external HTTP server required. LM Studio is preserved as backend option alongside two native paths:

Backend How it works Best for
LM Studio HTTP request to localhost:1234 — default, always available Quick testing, existing workflow
llama-cpp-python Loads GGUF directly — all layers to GPU, no server process Production use, GGUF models
transformers HuggingFace pipeline via PyTorch + CUDA — loads safetensors HF models, fine-tuned adapters

Neurotransmitter modulation: when NT Modulation is enabled, sampling parameters are adjusted in real time before every generation:

NT Parameter affected Effect
Dopamine temperature High DA = more creative, exploratory
GABA top_p High GABA = more focused, deterministic
Serotonin repetition_penalty High 5HT = less repetition

Cognitive context injection: prepends AXON2's current working memory, CI score, and emotional state to the prompt before generation.

Mode 3 — Auto-Quantization

Converts any safetensors model to multiple GGUF precision levels, benchmarks each variant with AXON2's LLM Evaluator, then recommends the best quality/speed tradeoff for your hardware.

Level Approx Size Tok/sec (RTX 5090) Quality
Q4_K_M ~4.1 GB ~95 Good (recommended for speed)
Q5_K_M ~5.2 GB ~72 Better
Q8_0 ~8.3 GB ~38 Near-lossless
FP16 ~13.6 GB ~20 Full precision

After conversion, AXON2 auto-benchmarks each variant and generates a recommendation report with quality score, speed, and file size comparison charts.

Brain regions during quantization:

  • Conversion: cerebellum + parietal_lobe (precision/skill encoding)
  • Benchmarking: anterior_cingulate + basal_ganglia (performance monitoring)
  • Comparison: prefrontal_cortex + anterior_cingulate (decision / selection)

Phase History

54 phases · 235 subsystems — click any phase group to expand full details.

Phases Focus Subsystems Added
1–10 Foundation, memory, reasoning, personality 40
11–20 HTM, Theory of Mind, EWC, attention schema 50
21–30 Dreaming, identity, active inference, social 40
31–40 Self-modification, ethical constraints, narrative 45
41–47 Multi-agent, long-horizon planning, web search 35
48–52 Tool Registry, LLM Gateway, Cognitive API, Research, Digital Twin 25
53 LLM Evaluator + brain activation mapping 5
54 Model Lab: LoRA training, native inference, auto-quantization 8
Total 54 phases 235 subsystems

📦 Phases 1–10 — Foundation (40 subsystems)

Core cognitive infrastructure: GPU tensor pipeline, memory architecture, brain topology, attention routing, personality, and persistent state.

Phase Subsystems Added Description
1 CognitionEngine, ClusterRegistry, SyncBus Core engine scaffold, cluster competition loop, event broadcast bus
2 MemoryManager (FAISS GPU), SQLAlchemy persistence Episodic vector memory with GPU acceleration, persistent SQLite/Postgres backend
3 BrainTopology, AttentionRouter (Flash Attention), Alembic migrations 18-region anatomical brain graph, Flash Attention routing, database schema versioning
4 PersonalitySystem (Big-5 OCEAN), NeurotransmitterSystem 6-neurotransmitter model (DA/5HT/NE/ACh/GABA/Glu), trait-modulated behaviour
5 GoalFormationSystem, BeliefRevisionEngine Autonomous goal creation from input context, Bayesian belief update engine
6 EmotionEngine, ValenceArousalTracker Valence/arousal/dominance state tracking, emotion-gated decision modulation
7 CausalReasoningSystem, SymbolicReasoningSystem Full causal graph (abduction/deduction/do-calculus), formal logic (MP, MT, resolution)
8 WorkingMemoryBuffer, EpisodicReplaySystem 7±2 capacity working buffer with decay, prioritised offline episodic replay
9 SemanticCompressionSystem, LongContextConsolidator Trigram+Jaccard clustering for fast lookup, multi-session history compression
10 ProceduralMemorySystem, HierarchicalMemorySystem Action sequence routines, multi-level memory abstraction hierarchy

📦 Phases 11–20 — Advanced Cognition (50 subsystems)

Hierarchical Temporal Memory, social intelligence, continual learning, and attention schema theory.

Phase Subsystems Added Description
11 HTMSystem (Hierarchical Temporal Memory) Sparse distributed representations, sequence learning, temporal pooling
12 TheoryOfMindSystem, EWCSystem Peer belief modeling and reliability scoring, Elastic Weight Consolidation to prevent catastrophic forgetting
13 AttentionSchemaSystem Internal model of own attentional state, top-down attention control
14 MetaCognitionSystem, EpistemicHumilitySystem Reasoning about own reasoning; gap classification (MISSING / CONTRADICTED / SHALLOW)
15 LanguageGroundingSystem, MultimodalSystem Symbol grounding to sensorimotor context, vision+text+audio input routing
16 SelfIdentitySystem, NarrativeMemorySystem Persistent self-model, chronological life-narrative construction
17 ConflictEngine, MotivationalConflictResolver Multi-drive conflict detection and resolution
18 PredictionEngine, PredictiveCodingSystem Short-horizon outcome prediction, prediction-error minimisation (Friston FEP)
19 RewardEngine, IntrinsicMotivationSystem Reward shaping, novelty and competence intrinsic drives
20 AbstractCausalSchema, CounterfactualMemorySystem Class-level causal rules, "what-if" counterfactual branches alongside real events

📦 Phases 21–30 — Dreams, Identity & Social (40 subsystems)

Sleep cycles, autobiographical memory, active inference, embodied cognition, and social reasoning.

Phase Subsystems Added Description
21 DreamingSystem, CausalDreamingSystem Offline consolidation dream cycles, causal structure re-simulation during sleep
22 CircadianClock, CircadianOptimiser Biological rhythm simulation, sleep/wake state gating on all subsystems
23 AutobiographicalMemorySystem, EpisodicTimelineManager Life-event indexing with temporal anchors, searchable episode timeline
24 ActiveInferenceSystem (FEP) Free Energy Principle — act to minimise prediction error and surprise
25 EmbodiedCognitionSystem, ProprioceptionModel Body-state simulation, proprioceptive signal modulation of decisions
26 SocialReasoningSystem, EmpatheticResponseSystem Multi-agent social dynamics, empathy-modulated response generation
27 CollectiveIntelligenceSystem, ConsensusProtocol Peer agent coordination, distributed agreement on shared beliefs
28 CuriosityDrivenExplorationSystem Information-gain maximisation, novelty-seeking goal injection
29 MetaLearningSystem, TransferLearningSystem Learning-to-learn across domains, cross-domain skill transfer
30 WorldModelSystem, EnvironmentSimulator Forward world model for planning, counterfactual environment rollouts

📦 Phases 31–40 — Self-Modification, Ethics & Narrative (45 subsystems)

Self-directed code modification, ethical constraint enforcement, cognitive narrative synthesis, and License Enforcement System.

Phase Subsystems Added Description
31 SelfModificationSystem, CodeIntrospectionEngine Safe self-code analysis and targeted modification proposals
32 IdentityNarrativeSynthesis, SelfReflectionEngine Real-time cognitive narrative broadcast, reflective self-assessment
33 AffectiveForecastingSystem, EmotionalRegulationSystem Predict future emotional states, regulate current affect toward targets
34 SemanticMemoryConsolidation, KnowledgeExtractionSystem Stable fact extraction from episodic stream, typed semantic triple store
35 LongHorizonPlanningSystem, TemporalSelfModel 10+ step goal planning, historical cognitive state tracking
36 EthicalConstraintLayer, MoralReasoningSystem Hard blocks on ethical violations pre-execution, multi-framework moral evaluation
37 CognitiveBiasDetector, RationalityMonitor Identifies and corrects 12 known cognitive biases in reasoning traces
38 AdversarialSelfPlay, DebateEngine Internal devil's advocate, structured self-debate for strategy refinement
39 StructuredWorldKnowledge, SemanticTripleStore Typed entity-relation-entity knowledge graph with inference
40 LicenseEnforcementSystem (LES), CapabilityGating HMAC offline key validation, tier-based feature gating, UI watermark

📦 Phases 41–47 — Multi-Agent, Planning & Web Search (35 subsystems)

Multi-agent coordination suite, long-horizon planning, reputation ledgers, and real-time web search integration.

Phase Subsystems Added Description
41 MultiAgentCoordinator, RoleNegotiationSystem Dynamic role assignment across agent network, capability-based role allocation
42 ReputationLedger, TrustCalibrationSystem Cryptographic peer reputation tracking, trust-weighted belief aggregation
43 GoalHorizonExpansion, RecursiveGoalDecomposer Expand short goals into long trajectories, recursive sub-goal decomposition
44 PredictiveGoalEcology, GoalInterferenceDetector Model goal interdependencies, detect and prevent conflicting objectives
45 CognitiveResourceManager, AttentionBudgetSystem Compute allocation across subsystems, attention budget enforcement
46 DreamGoalSeeder, NarrativeContinuitySystem Inject goal seeds during dream cycles, maintain cross-session narrative thread
47 WebSearchSystem (DuckDuckGo + Wikipedia + Brave) Multi-backend search, auto-trigger from curiosity drive, search-memory bridging

📦 Phases 48–52 — Tool Use, LLM Gateway, Research & Digital Twins (25 subsystems)

Full tool registry with ReAct loop, 7-provider LLM routing, autonomous research scheduler, and cognitive digital twin debates.

Phase Subsystems Added Description
48 ToolRegistry, ReActLoop 6 built-in tools (python_exec, shell_exec, http_get, web_search, json_parse, text_summarize); 8-step reason→act loop
49 LLMGateway (7 providers), ModelBenchmark Routes to LM Studio, OpenAI, Anthropic, Groq, Ollama, Mistral, Cohere with auto-failover and health tracking
50 CognitiveAPIGateway Unified REST API exposing all 235 subsystems; OpenAPI spec auto-generated
51 ResearchScheduler, AutonomousResearchSystem Curiosity-driven research queue, multi-query web search, synthesis into memory
52 TwinOrchestrator (4 presets), DebateScoring Parallel cognitive digital twin debates; Optimist/Pessimist/Devil/Empiricist presets; consensus scoring

📦 Phase 53 — LLM Evaluator + Brain Activation Mapping (5 subsystems)

Structured benchmark harness with AXON2-augmented mode and real-time brain region activation during evaluation.

Phase Subsystems Added Description
53 LLMEvaluator 7-benchmark harness: MMLU-Lite, HellaSwag-Lite, TruthfulQA-Lite, ARC-Easy, GSM8K-Lite, HumanEval-Lite, Ethics-Bench
53 BrainActivationMapper Maps eval events to specific brain regions; prefrontal, parietal, hippocampus, Broca, Wernicke fire during reasoning
53 AXON2AugmentedMode Primes each LLM answer with working memory, current beliefs, and cognitive context
53 EvalReportSystem Pretty per-benchmark score cards with Raw vs AXON2-augmented delta, grade badges
53 ModelBenchmarkComparator Cross-provider comparison: run same benchmark against multiple LLM backends

📦 Phase 54 — Model Lab: LoRA Training, Inference & Quantization (8 subsystems)

Full LLM training and optimization platform — fine-tune, run inference, and auto-quantize models directly from AXON2.

Phase Subsystems Added Description
54 LoRATrainingSystem HuggingFace PEFT + transformers LoRA fine-tuning; configurable rank, batch, LR, epochs
54 CurriculumBuilder Scans LLM Evaluator results for sub-70% categories; auto-builds targeted training JSONL
54 NativeInferenceEngine Direct GGUF inference via llama-cpp-python; HuggingFace transformers backend; LM Studio HTTP
54 NTModulatedSampler Adjusts temperature, top_p, repetition_penalty in real time based on dopamine, serotonin, GABA levels
54 AutoQuantizationSystem Converts models to Q4_K_M, Q5_K_M, Q8_0, FP16 via llama.cpp + bitsandbytes
54 QuantBenchmarkRunner Runs AXON2 LLM Evaluator against each quantized variant; scores quality vs size tradeoff
54 ModelLabDashboard Three-tab UI: Train / Infer / Quant with live progress, NT modulation, curriculum mode toggle
54 ModelLabAPIRoutes /modellab/train, /modellab/infer, /modellab/quantize REST endpoints wired to backend

Copyright (c) 2025-2026 Jonathan Tibbetts (jmtibbetts). All rights reserved.

About

AXON2 — A bleeding-edge synthetic cognition platform simulating neural activity, memory formation, emotional modulation, and autonomous consciousness with cinematic 3D visualization.

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors