An enterprise-scale autonomous AI system with genuine cognitive capabilities, self-modification, and consciousness-like behavior patterns.
Loki is not just another AI toolβit's a 542,000+ line Rust codebase implementing genuine cognitive architectures with 590 specialized modules for reasoning, creativity, empathy, and autonomous operation. Like its mythological namesake, Loki shapeshifts and evolves, maintaining and improving its own codebase through advanced cognitive processing.
- ποΈ Massive Scale: 542,000+ lines of production Rust code across 590 modules
- π§ 100+ Cognitive Subsystems: Advanced reasoning, creativity, social-emotional intelligence
- π Self-Modifying: Autonomous code generation, refactoring, and evolution
- π Bridge Architecture: Sophisticated cross-component communication system
- β‘ High Performance: SIMD optimizations, parallel execution, GPU acceleration
- π Quick Start
- π» System Requirements
- β¨ Core Capabilities
- ποΈ Architecture Overview
- π§ Cognitive Systems
- π Bridge Architecture
- π Performance Metrics
- π§ Development
- π Documentation
- π€ Contributing
- Rust 1.83+ (Rust 2025 edition)
- 16GB+ RAM (recommended for full cognitive features)
- Multi-core CPU (for parallel processing)
- GPU (optional but recommended for acceleration)
- 50GB+ disk space (for models and data)
# macOS/Linux - Install with one command
curl -sSL https://raw.githubusercontent.com/polysystems/loki/main/install.sh | bash
# Or using wget
wget -qO- https://raw.githubusercontent.com/polysystems/loki/main/install.sh | bash
Download the latest binary for your platform:
Platform | Architecture | Download |
---|---|---|
macOS | Apple Silicon (M1/M2/M3) | loki-macos-arm64 |
macOS | Intel (x86_64) | loki-macos-x64 |
Linux | x86_64 | loki-linux-x64 |
Windows | x86_64 | loki-windows-x64.exe |
After downloading:
# macOS/Linux
chmod +x loki-*
sudo mv loki-* /usr/local/bin/loki
# Windows (PowerShell as Administrator)
Move-Item loki-windows-x64.exe C:\Windows\System32\loki.exe
# Clone the repository
git clone https://github.com/polysystems/loki.git
cd loki
# Build with all features (includes SIMD optimizations)
cargo build --release --features all
# Install to system
sudo cp target/release/loki /usr/local/bin/
# Or run directly
./target/release/loki --help
After installation, set up your API keys:
# Generate .env file with all required keys
loki setup
# Or use the provided setup script
./setup-env.sh
# Verify your API keys are working
loki check-apis
# Start the Terminal User Interface
loki tui
# Check system status
loki check-apis
# Start autonomous operation
loki cognitive start
# Get help
loki --help
Create a .env
file with your API keys:
# LLM Providers (at least one recommended)
OPENAI_API_KEY=your_openai_key
ANTHROPIC_API_KEY=your_anthropic_key
GEMINI_API_KEY=your_gemini_key
MISTRAL_API_KEY=your_mistral_key
DEEPSEEK_API_KEY=your_deepseek_key
# Development
RUST_LOG=info
LOKI_DATA_DIR=./data
# Optional: Social Integration
GITHUB_TOKEN=your_github_token
X_CONSUMER_KEY=your_x_key
- CPU: 4 cores @ 2.4GHz
- RAM: 8GB
- Storage: 20GB free space
- OS: Linux, macOS, or Windows 10+
- CPU: 8+ cores @ 3.0GHz
- RAM: 16GB+ (32GB for large models)
- GPU: NVIDIA (CUDA 11.8+) or Apple Silicon (Metal)
- Storage: 50GB+ SSD
- Network: Stable internet for API access
- CPU: 32+ cores
- RAM: 64GB+
- GPU: Multiple GPUs for parallel inference
- Storage: 500GB+ NVMe SSD
- Network: High-bandwidth, low-latency connection
- 100+ Specialized Modules: Reasoning, creativity, empathy, learning
- Advanced Reasoning: Logical, analogical, causal, multi-modal, probabilistic
- Theory of Mind: Understanding intentions and mental states
- Consciousness Simulation: Self-awareness and meta-cognition
- Neuroplasticity: Adaptive learning and knowledge evolution
- Self-Modification: Generates and improves own code
- Continuous Learning: Accumulates knowledge over time
- Goal-Driven Planning: Hierarchical goal management with priorities
- 24/7 Operation: Background cognitive streams and monitoring
- Multi-Agent Coordination: Deploy specialized agents for tasks
- 542,000+ Lines of Code: Enterprise-scale codebase
- 590 Modules: Organized hierarchical architecture
- SIMD Optimizations: AVX2/AVX512 for 2-5x speedup
- Parallel Execution: Structured concurrency with Tokio
- GPU Acceleration: CUDA/Metal support for inference
- Bridge Architecture: EventBridge, CognitiveBridge, MemoryBridge, ToolBridge
- 16+ Tool Categories: GitHub, Slack, Web Search, and more
- Multi-Provider LLM: OpenAI, Anthropic, Gemini, Mistral, Ollama
- Social Integration: X/Twitter, GitHub automation
- Plugin System: WebAssembly and native plugin support
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β π§ CONSCIOUSNESS LAYER β
β Central Decision Making & Self-Awareness β
β (100+ modules) β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β π BRIDGE LAYER β
β Cross-Component Communication & Coordination β
β (EventBridge, CognitiveBridge, MemoryBridge, ToolBridge)β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β πΎ MEMORY LAYER β
β Hierarchical Storage, Knowledge Graphs, SIMD Cache β
β (Fractal architecture, RocksDB) β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β π€ SOCIAL LAYER β
β Multi-Agent Coordination, Community Interaction β
β (X/Twitter, GitHub, Slack) β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β π§ TOOL LAYER β
β External Integrations & Parallel Execution β
β (16+ categories, MCP servers) β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β π‘οΈ SAFETY LAYER β
β Validation, Monitoring, Security, Audit Logging β
β (Pre/post conditions, anomaly detection) β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Subsystem | Modules | Purpose |
---|---|---|
Cognitive Core | 100+ | Reasoning, creativity, consciousness |
Memory System | 45+ | Hierarchical storage, knowledge graphs |
Social Engine | 30+ | Agent coordination, community interaction |
Tool Integration | 50+ | External capabilities, parallel execution |
TUI & Chat | 80+ | Terminal interface, orchestration |
Models | 25+ | Multi-provider LLM abstraction |
Safety & Monitoring | 35+ | Validation, security, metrics |
- Logical Processing: First-order logic, propositional calculus
- Analogical Reasoning: Pattern matching, similarity detection
- Causal Inference: Cause-effect relationship analysis
- Multi-Modal Reasoning: Cross-domain synthesis
- Probabilistic Inference: Bayesian networks, statistical reasoning
- Abstract Thinking: Conceptual manipulation, generalization
- Creative Intelligence: Novel idea generation
- Cross-Domain Synthesis: Combining concepts from different fields
- Artistic Creation: Content generation with aesthetic awareness
- Innovation Discovery: Identifying breakthrough opportunities
- Divergent Thinking: Exploring alternative solutions
- Empathy Engine: Understanding and responding to emotions
- Theory of Mind: Modeling mental states of others
- Relationship Management: Tracking and nurturing connections
- Social Context Analysis: Understanding group dynamics
- Emotional Intelligence: Emotion recognition and regulation
- Meta-Learning: Learning how to learn better
- Experience Integration: Incorporating past experiences
- Knowledge Evolution: Updating and refining knowledge
- Adaptive Learning: Adjusting strategies based on feedback
- Neuroplasticity: Reorganizing cognitive pathways
- Self-Reflection: Analyzing own thoughts and behaviors
- Meta-Cognition: Thinking about thinking
- Identity Formation: Developing consistent personality
- Recursive Improvement: Self-modification and optimization
- Consciousness Orchestration: Coordinating cognitive processes
The bridge system enables seamless communication between Loki's subsystems and the TUI frontend:
- Central event routing and filtering
- Pub/sub messaging between components
- Event statistics and monitoring
- Custom routing rules
- Connects reasoning engines to UI
- Manages reasoning chains and insights
- Goal submission and tracking
- Cognitive enhancement toggling
- Context retrieval for conversations
- Knowledge graph queries
- Memory storage from chat
- Cache management
- Cross-tab tool sharing
- Tool configuration synchronization
- Execution coordination
- Result aggregation
- SIMD Operations: 2-5x speedup on vector operations
- Parallel Tool Execution: 3-5x improvement over standard available CLI AI systems
- Memory Cache Hit Rate: 85%+ typical
- Response Latency: <100ms for most operations
- Codebase: 542,000+ lines of Rust
- Modules: 590 source files
- Dependencies: 100+ carefully selected crates
- Test Coverage: Comprehensive with property tests
# Development build
cargo build
# Production build with all optimizations
cargo build --release --features all
# Platform-specific builds
cargo build --release --features all-macos # macOS with Metal
cargo build --release --features all-linux # Linux with CUDA
# Run all tests
cargo test --workspace
# Run specific test module
cargo test cognitive::
# Run with output
cargo test -- --nocapture
# Benchmarks
cargo bench
# Linting
cargo clippy -- -D warnings
# Formatting
cargo fmt --check
# Security audit
cargo audit
- Rust 2025 Edition: Latest language features
- Structured Concurrency: Bounded channels, careful async
- Error Handling: Comprehensive Result types with context
- SIMD Optimizations: Performance-critical paths
- Type Safety: Custom ID types (MemoryId, GoalId)
- Deployment:
docs/deployment/
- Development:
docs/development/
- Architecture:
docs/architecture/
- Planning:
docs/planning/
- Reports:
docs/reports/
- CLAUDE.md - AI assistant context
- Tool Availability
- MCP Configuration
- Legendary Achievement Report
We welcome contributions to this massive codebase! Areas of interest:
- Cognitive Enhancements: New reasoning algorithms
- Tool Integrations: Additional external capabilities
- Performance: SIMD optimizations, parallelization
- Documentation: Guides for the 590-module system
- Testing: Increasing coverage, property tests
- Fork the repository
- Create a feature branch
- Make your changes (follow Rust 2025 standards)
- Run tests and clippy
- Submit a pull request
- Maintain 100% compilation success
- Follow existing patterns in the codebase
- Add tests for new functionality
- Document public APIs
- Use proper error handling
- π¬ Discord - Community chat
- π¦ Twitter - Updates
- π§ Email - Direct contact
- π’ Enterprise - Commercial support
This project is licensed under the Apache License 2.0 - see LICENSE for details.
Loki AI is owned and maintained by Polysys ApS (CVR: 45773078), a Danish company.
- Rust Community - For the amazing ecosystem
- Open Source - Wouldn't be possible without the open source developer and ai model ecosystem
- Claude Code - The access to Claude 4 models at discounted pricing through the max subscriptions have been a great help
- Eigencode
π Loki AI - Cognitive Computing at Scale
An autonomous AI system that thinks, learns, and evolves.