umi-memory
A production-ready memory library for AI agents with deterministic simulation testing.
Features
- 🧠 Smart Memory Management: Core, working, and archival memory tiers with automatic eviction
- 🔍 Dual Retrieval: Fast vector search + LLM-powered semantic query expansion
- 🔄 Evolution Tracking: Automatically detect updates, contradictions, and derived insights
- ✅ Graceful Degradation: System continues operating even when LLM/storage components fail
- 🎯 Deterministic Testing: Full DST (Deterministic Simulation Testing) for reproducible fault injection
- 🚀 Production Backends: LanceDB for embedded vectors, Postgres for persistence
Quick Start
[]
= "0.1"
Basic Usage
use ;
async
Production Setup
use ;
use AnthropicProvider;
use OpenAIEmbedding;
use LanceStorageBackend;
use Duration;
async
Feature Flags
lance- LanceDB storage backend (persistent, embedded vector database)postgres- PostgreSQL storage backend (persistent, external database)anthropic- Anthropic LLM provider (Claude)openai- OpenAI LLM provider (GPT, embeddings)llm-providers- All LLM providers (convenience flag)embedding-providers- All embedding providers (convenience flag)
[]
= { = "0.1", = ["lance", "anthropic", "openai"] }
Architecture
Umi follows TigerStyle principles:
- ✅ Simulation-first: Every component has deterministic simulation
- ✅ Graceful degradation: System continues operating despite component failures
- ✅ Assertions everywhere:
debug_assert!validates invariants - ✅ Same seed = same results: Reproducible testing and debugging
Core Components
- EntityExtractor - Extracts structured entities from text using LLM
- DualRetriever - Fast vector search + LLM query rewriting with RRF merging
- EvolutionTracker - Detects updates, contradictions, extensions, and derivations
- Memory Orchestrator - Coordinates all components with graceful degradation
Memory Tiers
- CoreMemory: Small (32 KB), persistent, always loaded
- WorkingMemory: Medium (1 MB), TTL-based eviction, in-memory cache
- ArchivalMemory: Large (unlimited), persistent storage + vector search
Examples
See the examples/ directory:
quick_start.rs- Basic remember/recall workflowproduction_setup.rs- Production configuration with real providersconfiguration.rs- Customize memory behaviortest_anthropic.rs- Test Anthropic integration (requires API key)test_openai.rs- Test OpenAI integration (requires API key)
Run examples:
Testing
Umi has comprehensive test coverage:
- 462 unit tests - All passing
- 44 DST tests - Fault injection with deterministic simulation
- Benchmarks - Criterion-based performance tracking
# Run all tests
# Run fault injection tests
# Run benchmarks
Documentation
- Architecture Decision Records - Design decisions and rationale
- API Documentation - Full API reference
- CLAUDE.md - Development guide for AI assistants
- Testing Guide - Testing philosophy and practices
Development Philosophy
Simulation-First
Every component MUST have a simulation implementation:
use ;
// Deterministic - same seed = same results
let config = with_seed;
let memory = sim;
Why? Same seed = same results = reproducible tests and bugs.
Graceful Degradation
Components handle failures gracefully:
- EntityExtractor: Creates fallback entities (type=Note, confidence=0.5)
- DualRetriever: Falls back to fast search when LLM fails
- EvolutionTracker: Skips detection (Ok(None)) when LLM fails
TigerStyle Assertions
Use debug_assert! for invariants:
Python Bindings
Python bindings are available but experimental. See PYTHON.md for details.
=
=
Status: Basic functionality works, but incomplete type system. Rust API is primary.
Contributing
Contributions welcome! Please:
- Read CLAUDE.md for development guidelines
- Ensure all tests pass:
cargo test --all-features - Add tests for new features
- Follow TigerStyle principles (simulation-first, graceful degradation)
License
MIT License - see LICENSE for details.
Origin
Umi was extracted from RikaiOS to be a standalone library. Inspired by:
- memU - Dual retrieval (fast + LLM semantic)
- Mem0 - Entity extraction and evolution tracking
- Supermemory - Temporal metadata
- TigerStyle - Assertion-based programming
Versioning
Umi follows semantic versioning (SemVer):
- 0.1.x - Beta release, core features stable
- 0.2.x - Python bindings complete
- 1.0.0 - Production-ready, API stable
Breaking changes are expected in 0.x versions.