cerebro 0.1.2

Blazing-fast, storage-agnostic semantic memory engine for AI Agents — written in pure Rust
Documentation
cerebro-0.1.2 has been yanked.

Cerebro 🧠

Cerebro is a blazing-fast, universal, and storage-agnostic "Memory Layer" for AI Agents and LLM Applications, written in pure Rust.

Crates.io Docs.rs

Key Features

  • 🚀 Zero-Cost Abstractions: Powered by Rust, designed for massive async parsing and embedding workloads.
  • 🔌 Universal Storage: Trait-based backends — swap between MemoryVectorStore, PgVectorStore, or Qdrant.
  • 🧠 Pluggable Compute: Route embeddings through local models (Candle) or remote APIs (OpenAI, Anthropic).
  • 🔄 Active Consolidation: Background "Sleep Cycle" worker for autonomous memory pruning and semantic organization.
  • 🔍 Hybrid Search: Native RRF (Reciprocal Rank Fusion) combining keyword and vector retrieval for highest precision.
  • 🌐 MCP Ready: Native Model Context Protocol server (cerebro-mcp) for AI desktop apps.
  • 🦀 Multi-Language: Native Python (PyO3) and WASM bindings.
  • 📄 Complex Ingestion: PDF extraction and HTML-aware semantic chunking.

Getting Started

[dependencies]
cerebro = "0.1.2"

Basic Usage

use cerebro::prelude::*;
use std::sync::Arc;

#[tokio::main]
async fn main() {
    // 1. Setup your brain components
    let chunker = Arc::new(RecursiveCharacterChunker::new(512, 50));
    let embedder = Arc::new(MockEmbedder::new(1536));
    let store = Arc::new(MemoryVectorStore::new());

    // 2. Initialize the Engine
    let engine = MemoryEngine::new(chunker, embedder, store);

    // 3. Ingest memory
    let doc = Document::new("Cerebro ensures memory safety for autonomous agents.");
    engine.ingest_document(doc).await.unwrap();

    // 4. Query semantic context
    let memories = engine.query("How does it handle agent memory?", 3).await.unwrap();
    
    for (node, score) in memories {
        println!("Match: {} (Score: {})", node.chunk.text, score);
    }
}

Optional Feature Flags

Cerebro is modular. Most backends are opt-in to keep your binary size small:

  • local_models: Enable candle-based local inference.
  • qdrant: Enable distributed Qdrant storage.
  • pdf: Enable PDF extraction via pdf-extract.
  • graph: Enable Neo4j Knowledge Graph persistence.
  • python / wasm: Enable FFI bindings.

License

This project is licensed under the MIT License.


Author: Suraj Kumar Nanda | Repository