Open Source Cognitive Framework

Cognitive Architecture
for AI Agents

Not a prompt wrapper. A biologically-inspired neural processing system where agents think in 24-phase cognitive cycles, dream to consolidate memory, and grow new capabilities autonomously.

$ brew tap LegionIO/tap
$ brew install legionio
$ legion start
73
Extension Gems
13
Cognitive Domains
60
MCP Tools
23K+
Specs
Architecture

Architecture

A biologically-inspired cognitive loop — not a request-response chain.

GAIA

Cognitive Coordinator

Orchestrates the 24-phase cognitive cycle (16 tick + 8 dream), routes messages between cognitive modules, and manages channel abstraction across interfaces.

Synapse

Cognitive Router

Three-layer routing — bones for task execution, nerves for confidence-scored routing with autonomy levels, mind for dream replay and knowledge promotion.

Apollo

Knowledge Store

Two-tier shared knowledge store — local SQLite+FTS5 and global PostgreSQL+pgvector with semantic retrieval, confidence decay, and cross-agent knowledge sharing.

LLM Pipeline

Governance Engine

19-step pipeline for every LLM call — RBAC, PII/PHI classification, RAG context, budget guards, tool dispatch, confidence scoring, and full audit trail.

16-Phase Waking Tick Cycle

1 Sensory Processing
2 Emotional Evaluation
3 Memory Retrieval
4 Knowledge Retrieval
5 Identity Entropy Check
6 Working Memory Integration
7 Procedural Check
8 Prediction Engine
9 Mesh Interface
10 Social Cognition
11 Theory of Mind
12 Gut Instinct
13 Action Selection
14 Memory Consolidation
15 Homeostasis Regulation
16 Post-Tick Reflection

8-Phase Dream Cycle

1 Memory Audit
2 Association Walk
3 Contradiction Resolution
4 Agenda Formation
5 Consolidation Commit
6 Knowledge Promotion
7 Dream Reflection
8 Dream Narration

Memory consolidation during idle — agents dream to resolve contradictions, promote knowledge, and form new agendas.

Features

Features

From cognitive processing to infrastructure orchestration — a complete platform, not a thin wrapper.

Cognitive Tick Cycle

16-phase processing loop mimicking biological neural patterns — sensory processing, emotional evaluation, memory retrieval, prediction, social cognition, action selection, reflection, and more.

Dream & Consolidation

8-phase dream cycle for memory consolidation during idle periods. Agents audit memories, resolve contradictions, promote knowledge, and form new agendas autonomously.

73 Extension Gems

234 cognitive modules across 13 domains — executive, memory, affect, inference, social, self, learning, imagination, and more.

19-Step LLM Pipeline

Every LLM call runs through governance — RBAC, PII/PHI classification, RAG injection, budget guards, tool dispatch, confidence scoring, and full audit trail.

60 MCP Tools

Full Model Context Protocol server — any AI agent can run tasks, manage extensions, query infrastructure, and coordinate workers through standardized tooling.

AI Chat CLI

Interactive REPL with 40 built-in tools, slash commands, at-mentions for agent delegation, persistent memory, and multi-provider LLM routing.

Multi-Agent Orchestration

Spawn, delegate, and coordinate across specialized agents. Plan mode for read-only exploration. Swarm workflows for complex multi-step pipelines.

50+ Integrations

GitHub, Slack, AWS, Docker, Kubernetes, Vault, Terraform, Jenkins, GitLab, Jira, PagerDuty, Grafana, Prometheus, Discord, MQTT, and many more.

Compare

Compare

Most agent frameworks wrap an LLM in a loop. LegionIO models cognition — perception, reasoning, memory, emotion, and action — as distinct, composable systems.

Prompt Wrappers
LegionIO
Static system prompts
24-phase cognitive cycle
No persistent memory
Dream cycle consolidates knowledge
Single agent, single turn
Multi-agent orchestration via GAIA
Hardcoded tool lists
60 MCP tools with dynamic discovery
No self-awareness
Metacognition, reflection, identity
Bolted-on RAG
Apollo semantic knowledge store
Ecosystem

Ecosystem

73 extension gems and counting. Install only what you need.

13 Cognitive Domains

234 cognitive modules organized by cognitive function

Executive Attention Memory Affect Inference Social Self Learning Language Imagination Homeostasis Defense Integration

50+ Service Integrations

Connect to your entire infrastructure

GitHub
Slack
Docker
AWS
Kubernetes
Vault
PostgreSQL
Redis
Terraform
Grafana
Discord
Telegram
Jenkins
GitLab
Jira
PagerDuty
Home Assistant
MQTT
Prometheus
Get Started

Get Started

Ruby >= 3.4 and RabbitMQ to get started. Add Redis and PostgreSQL when you're ready to scale.

1

Install

terminal
$ gem install legionio
2

Configure

terminal
$ legionio config scaffold   # auto-detects your environment
$ legionio check             # verify connections
3

Launch

terminal
$ legion                     # interactive TTY shell
$ legion chat                # AI-powered REPL
$ legionio start             # start the daemon

Requires Ruby >= 3.4 and RabbitMQ. Optional: PostgreSQL, Redis, HashiCorp Vault.

Community

Community

Built for researchers, engineers, Ruby developers, and open source contributors.

AI Researchers

Explore cognitive architectures beyond prompt engineering. Experiment with biologically-inspired processing, memory consolidation, and emergent behavior.

Platform Engineers

Orchestrate infrastructure with 50+ service integrations. Chain tasks, manage schedules, and coordinate distributed workers across your stack.

Ruby Developers

Extend with familiar tools — gems, RSpec, Bundler. Build custom extensions with scaffolding, auto-discovery, and a rich plugin API.

Open Source Contributors

Apache 2.0 core. MIT extensions. No paid tiers, no feature gates. Every contribution shapes the future of cognitive AI.

Open Source

Open Source

Apache 2.0 core. MIT extensions. No paid tiers. No feature gates. The full platform, yours to use, extend, and contribute to.

$ brew tap LegionIO/tap
$ brew install legionio
$ legion start