A production-ready memory system for intelligent agents and bots, featuring three-layer memory hierarchy, semantic search, and automated optimization with REST API, MCP protocol, and CLI support.
Cortex Memory is a production-ready memory system for intelligent agents and bots, developed in Rust (86.9%), offering a complete solution from memory extraction and semantic search to automated optimization.
Core Architecture#
- Three-layer memory hierarchy: L0 Abstract → L1 Overview → L2 Detail, progressive context disclosure optimizing LLM token usage
- Virtual filesystem:
cortex://URI scheme organizing data across session/user/agent/resources namespaces - Hybrid storage: Filesystem (Markdown persistence) + Qdrant vector database (semantic indexing)
Key Capabilities#
- LLM-driven intelligent memory extraction (auto-extracting facts, decisions, entities)
- High-performance vector semantic search via Qdrant with metadata filtering and weighted scoring
- Multi-tenant isolation support via tenant-aware collection naming
- Event-driven automation (file watcher, auto-indexer)
- Web dashboard (Svelte 5 SPA) for monitoring, tenant management, and semantic search visualization
Access Methods#
- REST API (Axum-based, /api/v2/* endpoints)
- CLI command-line tool
- MCP protocol server (exposing store_memory, query_memory, etc.)
- Native Rust library
Performance#
Based on LOCOMO dataset evaluation (50 conversations, 150 questions):
- Recall@1: 93.33% (+67.02pp vs LangMem)
- Recall@3: 94.00% (+44.00pp vs LangMem)
- MRR: 93.72% (+54.90pp vs LangMem)
- NDCG@5: 80.73% (+62.01pp vs LangMem)
Prerequisites#
- Rust 1.86+
- Qdrant 1.7+ (vector database)
- OpenAI-compatible LLM API endpoint
- OpenAI-compatible Embedding API endpoint
Installation#
cargo install --path cortex-mem-cli # CLI tool
cargo install --path cortex-mem-service # REST API service
cargo install --path cortex-mem-mcp # MCP server
Module Structure#
| Module | Responsibility |
|---|---|
| cortex-mem-core | Core: filesystem abstraction, LLM client, Qdrant integration, layer generation |
| cortex-mem-service | REST API server |
| cortex-mem-cli | Command-line tool |
| cortex-mem-insights | Svelte 5 SPA dashboard |
| cortex-mem-mcp | MCP protocol server |
| cortex-mem-rig | Rig framework integration layer |
Use Cases#
- Building LLM-powered chatbots and intelligent agents
- Creating personalized AI assistants that remember user preferences
- Open-source AI projects requiring a memory backbone
- Intelligent applications maintaining context across multiple conversations