Cerebro π§
An AI memory layer and multi-agent swarm engine in async Rust: specialized agents share working, episodic and semantic memory.
Features
- π Async Rust: Built on Tokio, with trait-based storage, embedding and LLM components.
- π Universal Storage: Trait-based backends β swap between MemoryVectorStore, PgVectorStore, or Qdrant.
- π§ Pluggable Compute: Route embeddings through local models (Candle, CPU) or remote APIs (OpenAI, Voyage AI).
- π Consolidation Worker (experimental): Periodic background task that scans stored memories and can ask an LLM to summarise them into an "axiom" (printed, not stored yet). Pruning and merging are planned.
- π Hybrid Search (PgVectorStore): Reciprocal Rank Fusion (RRF) of pgvector similarity and Postgres full-text rank. The in-memory and Qdrant stores use vector search only.
- πΈοΈ Graphify: LLM-powered entity extraction into an in-memory (petgraph) or Neo4j knowledge graph. Querying triplets back from Neo4j is not implemented yet.
- π§ͺ Experimental: an append-only KV store you can read as of any past step; an immunology supervisor that suggests a rewritten prompt after a failed run (not applied automatically); nearest-neighbour lookup over caller-assigned 3D coordinates (
spatialfeature). - π SwarmForge: Multi-agent swarming engine with sequential, fan-out/fan-in, and hierarchical orchestration patterns.
- π€ Universal LLM: Supports Ollama, OpenAI, Gemini, Anthropic, and any OpenAI-compatible API.
- π MCP Ready: Native Model Context Protocol server (cerebro-mcp) for AI desktop apps.
- π¦ Bindings (scaffolding only): the
python(PyO3) andwasmfeatures expose placeholder classes;ingestandsearchare not wired to the engine yet. - π Complex Ingestion: PDF extraction and HTML-aware semantic chunking.
Getting Started
[]
= "1.1.10"
1. Working with the Memory Engine
Store and retrieve semantic memory. This example uses the in-memory store (vector search only); PgVectorStore adds hybrid search with Reciprocal Rank Fusion.
use *;
use Arc;
async
2. Building a Multi-Agent Swarm
Orchestrate a team of agents that share Cerebro's memory layer.
use *;
use *;
use Arc;
async
3. Model Context Protocol (MCP)
Cerebro acts as a native Model Context Protocol server for your local IDE (Cursor, Claude Desktop).
Compile the server:
Add the generated binary to your IDE's MCP config:
Supported LLM Providers
| Provider | Config Variant | Target Use Cases |
|---|---|---|
| Ollama | LlmProvider::Ollama |
Privacy-first local models (Llama 3, Mistral, Phi) |
| Anthropic | LlmProvider::Anthropic |
Deep reasoning and coding (Claude 3.5 Sonnet) |
| OpenAI | LlmProvider::OpenAI |
General agentic workflows (GPT-4o, o3) |
| Google Gemini | LlmProvider::Gemini |
Multimodal data ingestion (Gemini 1.5 Pro) |
| Universal API | LlmProvider::OpenAICompatible |
Fast inference engines (Groq, Together, vLLM) |