universal-ai-brain
Version:
π§ UNIVERSAL AI BRAIN 3.3 - The world's most advanced cognitive architecture with 24 specialized systems, MongoDB 8.1 $rankFusion hybrid search, latest Voyage 3.5 embeddings, and framework-agnostic design. Works with Mastra, Vercel AI, LangChain, OpenAI A
215 lines (168 loc) β’ 8.77 kB
Markdown
# π§ Universal AI Brain 3.3
**The world's most comprehensive cognitive architecture for AI agents with 24 cognitive systems, MongoDB 8.1 hybrid search, and latest Voyage 3.5 embeddings.**
Transform ANY AI framework into a truly intelligent system with semantic memory, emotional intelligence, goal hierarchy, and 21 other cognitive systems.
## π Quick Start (2 Minutes)
```bash
# Install Universal AI Brain
npm install universal-ai-brain
# Run interactive setup wizard
npx universal-ai-brain setup
```
**The setup wizard will:**
- β
Create a complete project structure
- β
Configure your API keys (Voyage AI or OpenAI)
- β
Set up MongoDB connection
- β
Generate working example code
- β
Create tests and documentation
### Manual Setup
### Simple Setup with Latest Voyage 3.5 (Recommended)
```typescript
import { UniversalAIBrain } from 'universal-ai-brain';
// π― Latest Voyage 3.5 model (strongest embeddings)
const brain = UniversalAIBrain.forVoyage({
mongoUri: process.env.MONGODB_URI,
apiKey: process.env.VOYAGE_API_KEY,
});
await brain.initialize();
console.log('π§ Universal AI Brain ready with 24 cognitive systems!');
```
### Framework Integration Examples
```typescript
// π― Mastra Framework
const brain = UniversalAIBrain.forMastra({
mongoUri: process.env.MONGODB_URI,
apiKey: process.env.VOYAGE_API_KEY
});
// β‘ Vercel AI SDK
const brain = UniversalAIBrain.forVercelAI({
mongoUri: process.env.MONGODB_URI,
apiKey: process.env.OPENAI_API_KEY
});
// π¦ LangChain.js
const brain = UniversalAIBrain.forLangChain({
mongoUri: process.env.MONGODB_URI,
apiKey: process.env.OPENAI_API_KEY
});
// π€ OpenAI Agents
const brain = UniversalAIBrain.forOpenAI({
mongoUri: process.env.MONGODB_URI,
apiKey: process.env.OPENAI_API_KEY
});
```
## π§ The 24 Cognitive Systems
### π§ **Core Memory** (4 Systems)
- **Semantic Memory** - Knowledge storage and retrieval
- **Working Memory** - Short-term context management
- **Episodic Memory** - Experience-based learning
- **Memory Decay** - Intelligent forgetting
### π― **Intelligence** (6 Systems)
- **Emotional Intelligence** - Emotion recognition and response
- **Cultural Knowledge** - Cultural awareness and adaptation
- **Confidence Tracking** - Uncertainty quantification
- **Self Improvement** - Continuous learning and optimization
- **Causal Reasoning** - Cause-and-effect understanding
- **Analogical Mapping** - Pattern recognition across domains
### β‘ **Management** (6 Systems)
- **Attention Management** - Focus and priority handling
- **Goal Hierarchy** - Multi-level objective management
- **Temporal Planning** - Time-aware decision making
- **Social Intelligence** - Social context understanding
- **Skill Capability** - Ability assessment and development
- **Change Stream** - Real-time data monitoring
### π§ **Advanced Tools** (8 Systems)
- **Advanced Tool Interface** - External tool integration
- **Workflow Orchestration** - Complex task coordination
- **Communication Protocol** - Multi-agent coordination
- **Multi-Modal Processing** - Multi-format data handling
- **Human Feedback Integration** - Learning from human input
- **Notification Manager** - Event-driven notifications
- **Vector Search** - Semantic similarity matching
- **Context Injection** - Relevant information retrieval
## π₯ **MongoDB 8.1 Hybrid Search - World's First $rankFusion**
β
**Latest MongoDB 8.1** - Cutting-edge database features
β
**$rankFusion Aggregation** - Combines vector + text search
β
**Atlas Vector Search** - Semantic similarity at scale
β
**Hybrid Search by Default** - Best of both worlds
β
**Production Tested** - Real MongoDB Atlas 8.1 cluster
β
**Performance Optimized** - Automatic query optimization
## π― **Framework Support**
β
**Mastra** - `UniversalAIBrain.forMastra()`
β
**Vercel AI SDK** - `UniversalAIBrain.forVercelAI()`
β
**LangChain.js** - `UniversalAIBrain.forLangChain()`
β
**OpenAI Agents** - `UniversalAIBrain.forOpenAI()`
β
**Framework Agnostic** - Works with ANY TypeScript AI framework
## β‘ **Latest Features in 3.3**
π **Voyage 3.5 Embeddings** - Latest and strongest embedding model
π **Smart Provider Selection** - Respects user choice (forOpenAI vs forVoyage)
π **5-Minute Integration Guide** - Complete setup documentation
π **Error Classification** - Clear distinction between critical vs non-critical errors
π **Enhanced Documentation** - Framework-specific examples and troubleshooting
## π **Documentation**
π **[Complete Integration Guide β](https://github.com/romiluz13/ai_brain_js/blob/main/INTEGRATION_GUIDE.md)**
π― **[Framework Examples β](https://github.com/romiluz13/ai_brain_js/tree/main/examples/)**
π **[Full Documentation β](https://github.com/romiluz13/ai_brain_js#readme)**
## ποΈ **Architecture**
```
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Your AI Framework β
β (Mastra, Vercel AI, LangChain, etc.) β
βββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββββββ
β
βββββββββββββββββββββββΌββββββββββββββββββββββββββββββββββββββββ
β Universal AI Brain 3.3 β
β βββββββββββββββ βββββββββββββββ βββββββββββββββββββββββββββ β
β β Memory β βIntelligence β β MongoDB 8.1 β β
β β Systems β β Systems β β Hybrid Search β β
β β (4) β β (14) β β $rankFusion β β
β βββββββββββββββ βββββββββββββββ βββββββββββββββββββββββββββ β
βββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββββββ
β
βββββββββββββββββββββββΌββββββββββββββββββββββββββββββββββββββββ
β MongoDB Atlas 8.1 β
β Vector Search + Text Search + $rankFusion β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
```
## π§ͺ **Testing All 24 Cognitive Systems**
```bash
# Test all cognitive systems with real MongoDB data
npm test
# Test specific cognitive systems
npm run test:cognitive:memory
npm run test:cognitive:benchmark
# Setup cognitive system tests
npm run setup:cognitive
```
## π¦ **Requirements**
- **Node.js 18+** - Modern JavaScript runtime
- **MongoDB Atlas** - For vector search and hybrid search
- **API Keys** - Voyage AI (recommended) or OpenAI
- **TypeScript** - For best development experience
## π¨ **Error Handling Guide**
### β
**Safe to Ignore (Non-Critical)**
```
β οΈ NON-CRITICAL: can't $divide by zero
β οΈ NON-CRITICAL: Atlas Vector Search failed
β οΈ NON-CRITICAL: Dashboard refresh failed
```
### β **Requires Attention (Critical)**
```
β CRITICAL: MongoDB connection failed
β CRITICAL: API key invalid
β CRITICAL: Brain initialization failed
```
## π **Environment Setup**
```bash
# Required Environment Variables
MONGODB_URI=mongodb+srv://your-connection-string
VOYAGE_API_KEY=pa-your-voyage-api-key
OPENAI_API_KEY=sk-your-openai-key # Optional fallback
```
## π **License**
MIT License - see [LICENSE](https://github.com/romiluz13/ai_brain_js/blob/main/LICENSE) file for details.
## π **Links**
- **[GitHub Repository](https://github.com/romiluz13/ai_brain_js)** - Source code and issues
- **[Integration Guide](https://github.com/romiluz13/ai_brain_js/blob/main/INTEGRATION_GUIDE.md)** - Complete setup guide
- **[Examples](https://github.com/romiluz13/ai_brain_js/tree/main/examples/)** - Framework examples
- **[npm Package](https://www.npmjs.com/package/universal-ai-brain)** - Install via npm
---
**π§ Universal AI Brain 3.3 - Making AI agents truly intelligent with 24 cognitive systems.** β‘