Memory for production AI agents — built for predictable latency.
Hybrid search, knowledge graphs, and optional cloud sync — shipped as a single Rust binary.
|
A persistent memory layer designed for real deployments: fast, stable, and easy to ship. # Store a memory
curl -X POST localhost:8080/v1/memories \
-d '{"content": "User prefers dark mode"}'
# Hybrid search
curl localhost:8080/v1/search?q=user+preferencesWhat you get:
|
Capture project context and decision trails so your coding agents stop repeating the same questions. # Search decisions
engram-cli search "why did we choose postgres"What you get:
|
See Using Engram From Another Repository for a practical setup guide covering MCP config, repo-local databases, agent instructions, CLI usage, HTTP access, and local embeddings.
# Install from crates.io
cargo install engram-core
# Or from source
git clone https://github.com/aiconnai/engram.git
cd engram && cargo install --path .
# Run as MCP server (Claude Code, Cursor, VS Code MCP clients, etc.)
engram-server --mcp
# Or run as HTTP API
engram-server --http --port 8080Agents forget between sessions. Context windows overflow. Important knowledge gets buried in chat logs.
Engram turns that into a fast, queryable memory system with stable latency and zero runtime dependencies.
| Problem | Engram Solution |
|---|---|
| Vector search misses exact keywords | Hybrid search: BM25 + vectors + fuzzy, fused + ranked |
| Context disappears between sessions | Persistent memory on SQLite + WAL |
| Cloud-only products | Local-first, optional S3/R2 sync |
| Python/Docker required | Single Rust binary (no runtime stack) |
| No project awareness | Project Context Discovery (CLAUDE.md, AGENTS.md, .cursorrules, etc.) |
| Feature | Engram | Mem0 | Zep | Letta |
|---|---|---|---|---|
| Language | Rust | Python | Python | Python |
| MCP Native | Yes | Plugin | No | No |
| Single Binary | Yes | No | No | No |
| Local-first | Yes | Optional | Cloud-first | Optional |
| Hybrid Search | BM25+Vec+Fuzzy | Vec+KV | Vec+Graph | Vec |
| Project Context | Yes | No | No | No |
| Edge-Native Latency | Yes | No | No | No |
"Edge-native" here means runs beside the agent, with predictable p95 latency and no dependency chain.
# Handles typos, semantic matches, and exact keywords in one query
engram-cli search "asynch awiat rust"
# → Returns: "Use async/await for I/O-bound work in Rust"Isolate memories by project or context:
# Create memory in a specific workspace
engram-cli create "API keys stored in Vault" --workspace my-project
# List workspaces
engram-cli workspace listTwo tiers for different retention needs:
- Permanent: Important knowledge, decisions (never expires)
- Daily: Session context, scratch notes (auto-expire after 24h)
# Create a daily memory (expires in 24h)
engram-cli create "Current debugging task" --tier dailyStore and search conversation transcripts:
# Index a conversation session
engram-cli session index --session-id chat-123 --messages messages.json
# Search within transcripts
engram-cli session search "error handling"Link different mentions to canonical identities:
# Create identity with aliases
engram-cli identity create user:ronaldo --alias "Ronaldo" --alias "@ronaldo"# Export the graph
engram-cli graph --format json --output graph.jsonEntity extraction (memory_extract_entities) links memories through shared entities.
Multi-hop traversal and shortest-path are available via MCP tools:
memory_traversememory_find_path
- MCP: Native Model Context Protocol for Claude Code, Cursor, VS Code MCP clients
- REST: Standard HTTP API for any client
- WebSocket: Real-time updates
- CLI: Developer-friendly commands
Dynamic memory prioritization based on recency, frequency, importance, and feedback:
# Get top memories by salience
engram-cli salience top --limit 10
# Boost a memory's salience
engram-cli salience boost 42Salience decays over time, transitioning memories through lifecycle states: Active -> Stale -> Archived.
5-component quality assessment (clarity, completeness, freshness, consistency, source trust):
# Quality report for a workspace
engram-cli quality report --workspace my-project
# Find near-duplicate memories
engram-cli quality duplicatesIncludes conflict detection for contradictions between memories and resolution workflows.
Offload search to Meilisearch for larger-scale deployments (feature-gated):
# Build with Meilisearch support
cargo build --features meilisearch
# Run with Meilisearch indexer
engram-server --meilisearch-url http://localhost:7700 --meilisearch-indexerSQLite remains the source of truth. MeilisearchIndexer syncs changes in the background.
Engram exposes MCP Resources and Prompts for richer agent integration:
Resources — Query-only URI templates:
engram://memory/{id}— Get specific memoryengram://workspace/{name}— Get workspace statisticsengram://workspace/{name}/memories— List workspace memoriesengram://stats— Global statisticsengram://entities— Extracted entities
Prompts — Guided workflows for agents:
create-knowledge-base— Steps to build a new knowledge basedaily-review— Daily memory review and archival workflowsearch-and-organize— Search results with suggested tagsseed-entity— Initialize entity graph from project
Run Engram as HTTP server with JSON-RPC 2.0 support:
# HTTP-only server (port 8080)
engram-server --transport http --port 8080
# Both HTTP and stdio (default)
engram-server --transport both --port 8080
# Bearer token authentication
ENGRAM_BEARER_TOKEN=secret-token-here engram-server --transport httpClients connect via HTTP with JSON-RPC 2.0 at /v1/mcp endpoint.
Ingest and query instruction and policy files using MCP tools:
memory_scan_projectmemory_get_project_context
Supported patterns:
- CLAUDE.md
- AGENTS.md (agora com documentação útil para agentes)
- .cursorrules
- .github/copilot-instructions.md
- .aider.conf.yml (se existir)
- CONVENTIONS.md, CODING_GUIDELINES.md (se existirem)
Add to your MCP config (for example: ~/.claude/mcp.json, .cursor/mcp.json, or your VS Code MCP extension config):
{
"mcpServers": {
"engram": {
"command": "engram-server",
"args": [],
"env": {
"ENGRAM_DB_PATH": "~/.local/share/engram/memories.db"
}
}
}
}If you built from source instead of installing via Homebrew, use the full path to the binary (e.g. /path/to/engram/target/release/engram-server).
The MCP tool reference is generated from source of truth (src/mcp/tools.rs) and tracked in docs/MCP_TOOLS.md.
- Full reference: docs/MCP_TOOLS.md
- Generated count and schema are in that reference (single source of truth).
- Regenerate with:
./scripts/generate-mcp-reference.sh
| Variable | Description | Default |
|---|---|---|
ENGRAM_DB_PATH |
SQLite database path | ~/.local/share/engram/memories.db |
ENGRAM_STORAGE_URI |
S3/R2 URI for cloud sync | - |
ENGRAM_CLOUD_ENCRYPT |
AES-256-GCM encryption | false |
ENGRAM_EMBEDDING_MODEL |
Embedding model (tfidf, local, openai) |
tfidf |
ENGRAM_ONNX_MODEL_DIR |
Local embedding model directory (model.onnx + tokenizer.json) |
platform data dir |
ENGRAM_CLEANUP_INTERVAL |
Expired memory cleanup interval (seconds) | 3600 |
ENGRAM_WS_PORT |
WebSocket server port (0 = disabled) | 0 |
OPENAI_API_KEY |
OpenAI API key (for openai embeddings) |
- |
MEILISEARCH_URL |
Meilisearch URL (requires --features meilisearch) |
- |
MEILISEARCH_API_KEY |
Meilisearch API key | - |
MEILISEARCH_INDEXER |
Enable background sync to Meilisearch | false |
MEILISEARCH_SYNC_INTERVAL |
Sync interval in seconds | 60 |
Local sentence-transformer embeddings are opt-in and keep the default binary small:
cargo build --features local-embeddings
./target/debug/engram-cli model download minilm-l6-v2
ENGRAM_EMBEDDING_MODEL=local ./target/debug/engram-serverThis backend uses ONNX Runtime with all-MiniLM-L6-v2 (384 dimensions). The model is downloaded explicitly and is not bundled into the binary.
┌─────────────────────────────────────────────────────────────────┐
│ Engram Server │
├─────────────────────────────────────────────────────────────────┤
│ MCP (stdio) │ REST (HTTP) │ WebSocket │ CLI │
├─────────────────────────────────────────────────────────────────┤
│ Intelligence Layer │
│ • Salience scoring • Quality assessment • Entity extraction │
│ • Context compression • Lifecycle management │
├─────────────────────────────────────────────────────────────────┤
│ Search Layer │
│ • BM25 (FTS5) • Vectors (sqlite-vec) • Fuzzy • RRF fusion │
│ • Optional Meilisearch backend for scaled deployments │
├─────────────────────────────────────────────────────────────────┤
│ Storage Layer │
│ • SQLite + WAL • Turso/libSQL • Connection pooling │
│ • Optional S3/R2 sync with AES-256 encryption │
└─────────────────────────────────────────────────────────────────┘
Contributions welcome! See CONTRIBUTING.md for conventions.
cargo test # Run all tests
cargo clippy # Lint
cargo fmt # FormatMIT License — see LICENSE for details.