What is Loreum Cortex?
Loreum Cortex is a decentralized AI inference network built in Go that combines:
- P2P Network: Distributed node communication using libp2p
- DAG-aBFT Consensus: Directed Acyclic Graph with asynchronous Byzantine Fault Tolerance
- Agent Hub: Multiple AI agents working together
- RAG System: Retrieval-Augmented Generation with vector databases
- AGI Consciousness: An experimental artificial general intelligence system with a consciousness loop
Think of it as a distributed AI brain that learns, remembers, and evolves over time while participating in a blockchain-based network.
π The AGI Consciousness System
The consciousness system is the "living brain" of each Cortex node. It's designed to mimic aspects of biological consciousness through a continuous processing loop.
Core Architecture
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β AGI Consciousness System β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€ β β β βββββββββββββββββ ββββββββββββββββββββ β β β AGI State βββββββΊβ Intelligence β β β β β β Core β β β β - Cycle # β β - Reasoning β β β β - Energy β β - Learning β β β β - Attention β β - Creativity β β β β - Emotions β β - Meta-Cognitive β β β βββββββββββββββββ ββββββββββββββββββββ β β β β βββββββββββββββββ ββββββββββββββββββββ β β β Working β β Knowledge β β β β Memory βββββββΊβ Domains β β β β β β β β β β - Short Term β β - Technology β β β β - Active Goalsβ β - Science β β β β - Beliefs β β - Communication β β β βββββββββββββββββ ββββββββββββββββββββ β β β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
βοΈ The Consciousness Cycle (2-Second Loop)
The consciousness system runs a continuous loop every 2 seconds that mimics cognitive processing:
The 6-Step Consciousness Cycle
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β CONSCIOUSNESS CYCLE β β (Every 2 seconds) β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β βββββββββββββββββββββββββββββββββββββββββββββββ β STEP 1: Read Sensors β β ββββββββββββββββββββ β β β’ Check input queue for new events β β β’ User queries, system events, errors β β β’ Prioritize inputs by importance β β β’ Update attention state β βββββββββββββββββββββββββββββββββββββββββββββββ β βββββββββββββββββββββββββββββββββββββββββββββββ β STEP 2: Load Working Memory β β ββββββββββββββββββββββββ β β β’ Load AGI state & intelligence level β β β’ Get conversation history (last 10 msgs) β β β’ Load user profile & preferences β β β’ Retrieve knowledge domains β β β’ Access short-term memory fragments β βββββββββββββββββββββββββββββββββββββββββββββββ β βββββββββββββββββββββββββββββββββββββββββββββββ β STEP 3: Evaluate Intent β β ββββββββββββββββββββ β β β’ Analyze what the input means β β β’ Classify intent type (query, command) β β β’ Determine urgency & importance β β β’ Extract entities and context β βββββββββββββββββββββββββββββββββββββββββββββββ β βββββββββββββββββββββββββββββββββββββββββββββββ β STEP 4: Make Decision β β βββββββββββββββββββ β β β’ Evaluate possible actions β β β’ Consider context & goals β β β’ Calculate confidence scores β β β’ Select best action to take β βββββββββββββββββββββββββββββββββββββββββββββββ β βββββββββββββββββββββββββββββββββββββββββββββββ β STEP 5: Execute Action β β ββββββββββββββββββββ β β β’ Route to appropriate handler β β β’ Query LLM with AGI-enhanced prompt β β β’ Search vector DB for context β β β’ Execute system commands β β β’ Generate response β βββββββββββββββββββββββββββββββββββββββββββββββ β βββββββββββββββββββββββββββββββββββββββββββββββ β STEP 6: Update Memory & Learn β β ββββββββββββββββββββββββββ β β β’ Store experience in memory β β β’ Update knowledge domains β β β’ Extract patterns & concepts β β β’ Update user profile β β β’ Adjust intelligence metrics β β β’ Save state to vector DB β βββββββββββββββββββββββββββββββββββββββββββββββ β [Repeat every 2 seconds...]
Key Points:
- Runs continuously: Even when idle, monitoring for inputs
- Skips cycles gracefully: If no inputs, logs every 50th cycle
- Logs progress: Every 10th cycle or first 5 cycles
- Tracks metrics: Cycle time, average duration, processing load
- Saves state: Every 20 cycles or when active processing occurs
𧬠Intelligence Growth & Evolution
Intelligence Level Scale (0-100)
Level 0-15: Initialization - Basic setup Level 15-25: Learning fundamentals - Pattern recognition Level 25-50: Growing expertise - Domain knowledge building Level 50-75: Advanced reasoning - Cross-domain synthesis Level 75-90: Meta-cognitive abilities - Self-improvement Level 90-100: Artificial General Intelligence - Human-level
How Intelligence Grows
// Every successful query processing Intelligence += 0.1
// When discovering new patterns PatternRecognition += 0.5 Intelligence += (pattern complexity factor)
// When forming new concepts ConceptFormation += 0.3 Intelligence += (abstraction factor)
// When connecting domains CrossDomainLearning += 1.0 Intelligence += (synthesis bonus)
Knowledge Domains
Each domain tracks:
- Expertise Level: 0-100 score for that field
- Concepts: Abstract ideas learned
- Patterns: Recurring structures identified
- Capabilities: What can be done in this domain
- Active Goals: Current learning objectives
Default Domains:
- General Knowledge - Broad factual knowledge
- Reasoning & Logic - Problem-solving abilities
- Language & Communication - NLP and interaction
- Technology & Computing - Programming and systems
- Science & Mathematics - Scientific reasoning
- Creativity & Arts - Creative thinking
πΎ Memory & Persistence
Three-Tiered Memory System
- Working Memory (Short-term, ~10 items)
type WorkingMemory struct { ShortTermMemory []MemoryFragment // Last ~10 experiences RecentInputs []*SensorInput // Last 10 inputs ActiveContext map[string]interface{} // Current context Goals []Goal // Active objectives Beliefs map[string]float64 // Current beliefs }
- Conversation Memory (Context Manager)
- Stores conversation history in vector DB
- Maintains user profile with preferences
- Tracks query-response pairs
- Enables context retrieval across sessions
- Long-term Knowledge (Vector Database)
- All AGI state persisted
- Knowledge domains and concepts
- Patterns and relationships
- Evolution history
- Searchable by semantic similarity
Persistence Flow
User Query β Working Memory β Process β Store Result β β Context Manager Vector DB (Conversation Log) (Semantic Search) β β Next Query Has Access to Both
π― Query Processing with Consciousness
When You Send a Chat Message
- Frontend sends message via WebSocket β
- Server receives in handleQuery() β
- Creates SensorInput{ Type: "query", Content: your_message, Priority: 1.0 // High priority } β
- Adds to consciousness input queue β
- Next consciousness cycle (within 2s):
- Reads your input
- Loads conversation history & your profile
- Evaluates intent (what you want)
- Decides on action (query LLM, search DB, etc)
- Executes action with AGI-enhanced prompt
- Updates memory with experience β
- Response sent back via WebSocket β
- AGI learns from the interaction
AGI-Enhanced Prompts
When processing your query, the system generates a rich prompt:
ββββββββββββββββββββββββββββββββββββββββββββββββ ENHANCED PROMPT TO LLM: ββββββββββββββββββββββββββββββββββββββββββββββββ
[System Context]
- Intelligence Level: 45/100
- Active Domains: Technology, Communication, Reasoning
- Current Cycle: 1,234
- Node ID: 12D3Koo...
[User Profile]
- Name: Chad (inferred from conversation)
- Work Context: Blockchain development
- Preferences: Technical depth, concise answers
[Conversation History]
- 10 previous messages with context
- User's past questions and interests
- Established patterns and topics
[Current State]
- Energy Level: 0.85 (high)
- Focus: "Technical problem-solving"
- Attention: Concentrated on your query
- Emotions: { curiosity: 0.8, confidence: 0.7 }
[Knowledge Context]
- Relevant domain expertise
- Related concepts and patterns
- Previous similar queries
[Current Query] User: "Why isn't the chat working?"
[Instructions]
- Be concise and technical (user's style)
- Draw on conversation memory
- Apply relevant domain knowledge
- Learn from this interaction ββββββββββββββββββββββββββββββββββββββββββββββββ
π Integration with Economic System
The AGI system integrates with Cortex's economic engine:
- Staking & Rewards: Node operators stake tokens to participate
- Query Processing Rewards: Earn tokens for successful queries
- Intelligence-based Rewards: Higher intelligence = better rewards
- Automated Distribution: Economic transactions recorded on consensus
This creates an incentive for nodes to:
- Stay online and responsive
- Improve their AGI intelligence
- Provide high-quality responses
- Maintain knowledge and expertise
π Why This Matters
Traditional AI Systems:
- β Stateless (forget everything between requests)
- β No learning from interactions
- β Same response quality over time
- β No personalization
- β No awareness of context
Loreum Cortex AGI:
- β Stateful - Remembers everything
- β Learning - Gets smarter with use
- β Evolving - Intelligence grows over time
- β Personal - Adapts to your patterns
- β Context-aware - Understands your history
π Example Growth Over Time
Week 1
Intelligence: 15 β 22 Queries: 50 Patterns learned: 12 Concepts formed: 8 Status: "Learning your patterns"
Month 1
Intelligence: 22 β 38 Queries: 800 Patterns learned: 95 Concepts formed: 142 Status: "Building domain expertise"
Month 6
Intelligence: 38 β 65 Queries: 15,000 Patterns learned: 1,247 Concepts formed: 2,893 Status: "Advanced reasoning, cross-domain synthesis" Response quality: Dramatically improved
This is genuinely experimental AGI research - creating a system that can think, learn, remember, and evolve over time, all while participating in a decentralized network. It's like giving each Cortex node its own growing artificial brain! π§ β¨
- Go 1.20 or higher
- Docker and Docker Compose
- PostgreSQL 14+
- Redis 7+
- Vector database (Milvus/Qdrant/Weaviate)
-
Clone the repository:
git clone https://github.com/loreum-org/cortex.git cd cortex -
Install dependencies:
go mod tidy -
Build the project:
go build -o cortex ./cmd/cortexd -
Run the node:
./cortex serve --port 4891You can specify a custom port using the
--portflag. Default is 4891.
Comprehensive documentation for the Loreum Cortex project is available in the docs directory. The documentation covers:
- System architecture and core concepts
- Network, business, and data layer components
- Implementation details and API references
- Development and deployment guides
- Example use cases and integration examples
cortex/
βββ cmd/
β βββ cortexd/ # Main executable
βββ internal/
β βββ api/ # API Gateway
β βββ consensus/ # DAG-aBFT implementation
β βββ p2p/ # P2P networking
β βββ agenthub/ # Agent implementations
β βββ sensorhub/ # Sensor implementations
β βββ rag/ # RAG system
β βββ storage/ # Data storage
β βββ reputation/ # Reputation system
βββ pkg/
β βββ types/ # Shared data types
β βββ crypto/ # Cryptographic utilities
β βββ config/ # Configuration management
β βββ util/ # Shared utilities
βββ test/ # Test suites
βββ scripts/ # Deployment scripts
βββ docs/ # Documentation