A complete local memory infrastructure for AI agents.
OpenMemory provides persistent memory, environment configuration, knowledge graphs, and automatic conversation recording - all local, all fast, all private.
# 1. Start infrastructure
docker compose up -d
# 2. Build MCP server
cargo build --release --bin openmemory-mcp
# 3. Add to ~/.claude/settings.json
{
"mcpServers": {
"openmemory": {
"command": "/absolute/path/to/openmemory/target/release/openmemory-mcp",
"env": {
"DATABASE_URL": "postgres://openmemory:openmemory@localhost:5432/openmemory",
"OPENSEARCH_URL": "http://localhost:9201",
"REDIS_URL": "redis://localhost:6399"
}
}
}
}See detailed setup instructions below for all integration modes.
Save and search important information across sessions. No embeddings, no API costs - just fast BM25 search (<10ms).
mem save "User prefers TypeScript" --importance 0.8 --tags preference
mem search "typescript" --limit 5Secure key-value store for configuration and secrets with agent access control. Store API keys, endpoints, and preferences that AI agents can reference safely.
mem env-set OPENAI_API_KEY "sk-..." --secret
mem env-set DEFAULT_MODEL "gpt-4o" --description "Preferred LLM model"Temporal knowledge graph (powered by FalkorDB) automatically builds entity relationships and tracks how facts evolve over time. Uses Graphiti-inspired Episode/Entity/Fact model.
# Entities and relationships are extracted automatically from saved memories
# Query via web UI or direct Cypher queriesPassive session watcher tails conversation logs from Claude Code, Gemini CLI, and Codex CLI - no agent involvement needed. All conversations are automatically stored and searchable.
mem sessions --limit 10 # List recent sessions
mem sessions messages <uuid> # View conversation historyMost AI tools either forget everything between sessions or require expensive RAG pipelines with embedding APIs. OpenMemory provides a better, integrated solution:
| Feature | Traditional RAG | OpenMemory |
|---|---|---|
| Speed | ~100ms+ per search | < 10ms with BM25 |
| Cost | Embedding API costs | Zero - fully local |
| Privacy | Cloud dependencies | 100% local storage |
| Setup | Complex pipelines | docker compose up |
| Integration | Custom per tool | Standard MCP protocol |
| Configuration | Manual env vars | Secure parameter store |
| Knowledge | Flat documents | Temporal graph |
| Sessions | Manual logging | Automatic recording |
- Persistent Context: AI remembers your preferences, project decisions, and past conversations
- Secure Configuration: Store API keys and secrets that agents can reference but not leak
- Knowledge Evolution: Track how facts and relationships change over time
- Automatic History: All conversations recorded passively - no manual saving needed
- Cross-Tool Memory: Share context between Claude Code, Cursor, and other MCP-compatible tools
- Smart Retrieval: Importance scoring + recency weighting + graph relationships surface the most relevant information
- Privacy First: All data stays on your machine - no external API calls
- Developer Friendly: Simple
memory_save/memory_search/env_set/sessionsAPIs
OpenMemory is a complete memory infrastructure in one package:
| Component | What It Does | Why It Matters |
|---|---|---|
| Memory Store | Save and search facts, preferences, and decisions | AI remembers context across sessions |
| Environment Params | Secure key-value store for config and secrets | No more hardcoded API keys or env files |
| Knowledge Graph | Temporal entity/fact relationships with FalkorDB | Track how knowledge evolves over time |
| Session Recorder | Automatic conversation logging from AI tools | Complete audit trail, searchable history |
| Web Dashboard | Visual interface for all features | Manage and explore your data easily |
| CLI Tools | Command-line access to all operations | Script and automate memory operations |
| MCP Integration | Standard protocol support | Works with Claude Code, Cursor, any MCP tool |
| Fast Search | BM25 full-text via OpenSearch (<10ms) | No embedding costs, instant results |
| Privacy First | 100% local, no external calls | Your data never leaves your machine |
- PostgreSQL: Metadata, indexes, env params, session tables
- OpenSearch: Full-text BM25 search on memory content
- Redis: 5-minute search result cache
- FalkorDB: Temporal knowledge graph with Cypher queries
Choose your integration mode based on your use case:
Best for: Claude Code, Cursor, and any MCP-compatible AI tool.
docker compose up -dThis starts:
- PostgreSQL (persistent storage)
- OpenSearch (fast BM25 search)
- Redis (caching)
cargo build --release --bin openmemory-mcpFirst build takes ~2-3 minutes. Subsequent builds are cached.
Add to your AI tool's MCP configuration. For Claude Code, edit ~/.claude/settings.json:
{
"mcpServers": {
"openmemory": {
"command": "/absolute/path/to/openmemory/target/release/openmemory-mcp",
"env": {
"DATABASE_URL": "postgres://openmemory:openmemory@localhost:5432/openmemory",
"OPENSEARCH_URL": "http://localhost:9201",
"REDIS_URL": "redis://localhost:6399"
}
}
}
}Note: Replace
/absolute/path/to/openmemorywith your actual project path. Usepwdto get it.
For Cursor or other tools, consult their MCP configuration documentation.
Your AI now has comprehensive memory capabilities:
πΎ Memory Operations
memory_save - Save important information
{
"content": "User prefers TypeScript over JavaScript",
"importance": 0.8,
"tags": ["preference", "typescript"]
}memory_search - Find relevant memories
{
"query": "typescript preferences",
"limit": 5
}π Environment Parameters
env_set - Store configuration and secrets
{
"key": "OPENAI_API_KEY",
"value": "sk-...",
"is_secret": true,
"description": "OpenAI API key for GPT-4"
}env_list - List available parameters (agents can call this to discover config)
{}env_get - Get normal parameter values (secrets blocked for agents)
{
"key": "DEFAULT_MODEL"
}πΈοΈ Knowledge Graph
Graph operations happen automatically as you save memories. Query via web UI or direct Cypher:
graph.add_entity - Create/update entities
{
"name": "TypeScript",
"entity_type": "Technology",
"group_id": "default",
"summary": "Typed superset of JavaScript"
}graph.add_fact - Create relationships between entities
{
"source_entity_id": "uuid-1",
"target_entity_id": "uuid-2",
"name": "replaces",
"fact": "TypeScript replaces JavaScript in modern projects",
"valid_at": "2025-01-01T00:00:00Z"
}π Session Recording
Sessions are recorded automatically. Query via CLI:
# List recent sessions
mem sessions --limit 10
# View session messages
mem sessions messages <session-uuid>π‘ Pro Tip: Before ending a conversation, ask: "Please save anything important from our discussion" to ensure key information is explicitly remembered with proper importance scoring.
Best for: Shell scripts, CI pipelines, custom integrations, and AI agents that prefer HTTP over MCP.
docker compose --profile api up -dFirst run compiles Rust inside Docker (~3 min). Subsequent starts use the build cache.
The API server runs at http://localhost:8080 with health check at /health.
Add the CLI to your PATH:
export PATH="$PWD/scripts:$PATH"Or use it directly:
# Save a memory
./scripts/mem save "User prefers dark mode" --importance 0.7 --tags preference,ui
# Search memories
./scripts/mem search "dark mode"
# List recent memories
./scripts/mem list --limit 10
# Get memory details
./scripts/mem get <memory-id>Install the OpenMemory skill so Claude Code automatically knows when and how to use memory:
# Global installation (available in all projects, invoke via /openmemory)
cp -r skills/openmemory ~/.claude/skills/openmemory
# Project-level only
mkdir -p .claude/skills && cp -r skills/openmemory .claude/skills/openmemoryBest for: Automatically recording AI conversations without requiring agent involvement.
The session watcher passively tails JSONL log files from supported AI tools and stores conversation history in PostgreSQL - no MCP integration or memory_save calls needed.
| Tool | Log Path | Auto-Detected |
|---|---|---|
| Claude Code | ~/.claude/projects/**/*.jsonl |
β Yes |
| Gemini CLI | ~/.gemini/**/*.jsonl |
β Yes |
| Codex CLI | ~/.codex/**/*.jsonl |
β Yes |
| GitHub Copilot | N/A (no local logs) | β No |
Tools not installed are automatically skipped - no configuration needed.
# Start infrastructure + watcher
docker compose --profile watcher up -d
# Or combine with API server
docker compose --profile api --profile watcher up -d# List recent sessions
mem sessions --limit 50
# Show session details
mem sessions <session-uuid>
# View messages in a session
mem sessions messages <session-uuid> --limit 200Open the dashboard at http://localhost:3000 and navigate to Agent Settings to:
- Enable/disable specific tools
- Add custom directory paths to monitor
- Adjust polling intervals
| Variable | Default | Description |
|---|---|---|
WATCHER_POLL_INTERVAL_SEC |
(unset) | Enable periodic re-scan fallback. Recommended for Docker Desktop / macOS / WSL where inotify may miss events. |
Permission Issues? Add
user: "${UID}:${GID}"to theopenmemory-watcherservice indocker-compose.yml.
Explore your memory index directly:
docker compose --profile dashboard up -d
# Dashboard available at http://localhost:5601After setup, verify everything is working:
# All containers should be running
docker compose ps
# Check health status
curl http://localhost:8080/health # Should return {"status":"ok"}
curl http://localhost:9201 # OpenSearch info
redis-cli -p 6399 PING # Should return "PONG"# Save a test memory
mem save "Test memory from setup" --importance 0.5 --tags test
# Search for it
mem search "test setup"
# List recent memories (should include your test)
mem list --limit 5# Set a test parameter
mem env-set TEST_KEY "test_value" --description "Test parameter"
# List parameters
mem env-list
# Get the value back
mem env-get TEST_KEY
# Clean up
mem env-delete TEST_KEY# Generate some conversation in Claude Code, then check:
mem sessions --limit 5
# If no sessions appear:
# - Check watcher logs: docker compose logs openmemory-watcher
# - Verify conversation logs exist: ls ~/.claude/projects/In Claude Code or your MCP-compatible tool, try:
- Ask the AI to search memory: "Search memory for 'test'"
- Ask it to save something: "Save this to memory: I prefer concise responses"
- Ask it to list env params: "What environment parameters are available?"
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β AI Tool (MCP) β
β (Claude Code, Cursor, etc.) β
ββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββββ
β stdio (MCP protocol) or HTTP
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β OpenMemory MCP/HTTP Server β
β (Rust binaries: openmemory-mcp/server) β
ββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββββ
β
βββββββββββββΌβββββββββββββ¬βββββββββββββββ
βΌ βΌ βΌ βΌ
PostgreSQL OpenSearch Redis FalkorDB
(Storage) (BM25 Search) (Cache) (Knowledge Graph)
β²
β inotify/poll
ββββββββ΄βββββββββββββββββββββββββββββββββββββββββββββββββ
β Session Watcher β
β Monitors: ~/.claude/**, ~/.gemini/**, ~/.codex/** β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
- Save: AI calls
memory_saveβ MCP/HTTP server β PostgreSQL (metadata) + OpenSearch (full-text index) + FalkorDB (graph node) - Search: AI calls
memory_searchβ Check Redis cache β OpenSearch BM25 query β Merge with PostgreSQL importance scores β Return ranked results - Score: Results ranked by:
importance * 0.6 + recency * 0.4
- Set:
env_setβ AES-GCM encrypt value β Store in PostgreSQLenv_paramstable - Get:
env_getβ Decrypt if normal param β Return value (secrets require API token) - List:
env_listβ Return all keys + types (no values for secrets)
- Entities: Extracted from saved memories β Deduplicated by (name, type, group_id) β Stored as FalkorDB nodes
- Facts: Entity relationships with temporal validity β
FACTedges withvalid_at/invalid_attimestamps - Episodes: Conversation chunks that mention entities β Provenance tracking via
MENTIONSedges - Query: Cypher queries at specific time points β Returns facts valid at that moment
- Watch: Watcher monitors
~/.claude/projects/**/*.jsonland similar paths (inotify + fallback polling) - Parse: Extracts user/assistant messages from JSONL events
- Store: Saves to
sessionsandsession_messagestables in PostgreSQL - Query: Via
mem sessionsCLI or web UI
See docs/design/architecture.md and docs/design/graph-schema.md for detailed architecture.
The mem CLI provides access to all OpenMemory features:
# Save a memory
mem save "User prefers dark mode" --importance 0.8 --tags preference,ui
# Search memories
mem search "dark mode" --limit 5
# List recent memories
mem list --limit 20
# Get specific memory details
mem get <memory-uuid>
# Delete a memory
mem delete <memory-uuid># List all parameters (shows keys + types, no secret values)
mem env-list
# Set normal parameter (agent can read)
mem env-set DEFAULT_MODEL "gpt-4o" --description "Preferred LLM model"
# Set secret parameter (agent cannot read)
mem env-set OPENAI_API_KEY "sk-..." --secret
# Get parameter value (only works for normal params)
mem env-get DEFAULT_MODEL
# Delete parameter
mem env-delete OLD_KEY# List recent sessions
mem sessions --limit 50
# Show session details
mem sessions <session-uuid>
# View messages in a session
mem sessions messages <session-uuid> --limit 200
# View messages after a specific message number
mem sessions messages <session-uuid> --after 10Graph queries are currently available via web UI or direct Cypher queries to FalkorDB. CLI support coming soon.
- Rust 1.75+ (for MCP server)
- Node.js 18+ (for web UI)
- pnpm 9+ (package manager)
- Docker & Docker Compose (for infrastructure)
# Install dependencies
pnpm install
# Start all services (web UI + API)
pnpm turbo run dev
# Or just the web UI
pnpm --filter web devopenmemory/
βββ apps/
β βββ server/ # Rust API server (Axum)
β βββ web/ # React web dashboard
βββ packages/ # Shared TypeScript packages
βββ scripts/
β βββ mem # CLI tool (Python)
βββ skills/
β βββ openmemory/ # Claude Code skill definition
βββ src/
β βββ mcp/ # MCP server implementation
β βββ watcher/ # Session watcher
β βββ lib.rs # Shared Rust library
βββ docker-compose.yml # Infrastructure services
βββ Cargo.toml # Rust workspace
cd scripts
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
python seed-data.py --count 1000cargo test
pnpm testMemory:
- Save architectural decisions, coding preferences, and project conventions
- Remember past bugs, their solutions, and related code patterns
- Track refactoring history - what was changed, why, and lessons learned
Configuration:
- Store API keys, database URLs, and service endpoints securely
- Share configuration across projects without hardcoding
- Different secrets for dev/staging/prod environments
Knowledge Graph:
- Track which libraries depend on which frameworks
- Map code ownership and component relationships
- Understand how system architecture evolved over time
Session History:
- Review past debugging sessions and solutions
- Search previous conversations for similar problems
- Track project timeline and decision history
Memory:
- Store key findings from papers and articles
- Log experiment results and hypotheses
- Maintain evolving research questions and answers
Configuration:
- Manage API keys for different research services
- Store model parameters and hyperparameters
- Track compute cluster endpoints and credentials
Knowledge Graph:
- Map paper citations and author relationships
- Track concept evolution across papers
- Connect experiments to theoretical foundations
Session History:
- Review data analysis conversations
- Track experimental methodology discussions
- Document hypothesis evolution
Memory:
- Remember character details, traits, backstories, and relationships
- Track plot points, story arcs, themes, and narrative decisions
- Store voice, tone, and formatting guidelines
Configuration:
- Store API keys for research services and tools
- Manage publication submission credentials
- Track submission guidelines for different venues
Knowledge Graph:
- Map character relationships and interactions
- Track plot thread dependencies
- Connect themes across chapters/stories
Session History:
- Review past writing sessions and decisions
- Search for previous character development discussions
- Track story evolution and alternative paths considered
- 100% Local: All data stays on your machine
- No Telemetry: Zero external network calls
- No Cloud Dependencies: Works completely offline
- Open Source: Full transparency - audit the code yourself
Contributions are welcome! Please:
- Fork the repo
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Write tests for new features
- Follow existing code style
- Update documentation as needed
- Keep commits atomic and well-described
MIT License - see LICENSE for details.
Built with:
- Model Context Protocol (MCP) - Standard AI tool integration
- OpenSearch - Fast BM25 full-text search
- PostgreSQL - Reliable relational storage
- FalkorDB - High-performance graph database for knowledge graphs
- Redis - In-memory caching
- Axum - Rust async web framework
- React - UI framework
- Graphiti - Temporal knowledge graph inspiration
Traditional RAG embeds documents and uses vector search. OpenMemory uses BM25 keyword search (no embeddings needed) + importance scoring + temporal knowledge graphs. It's faster, cheaper, and captures structured relationships.
Yes! Any tool that supports MCP (Model Context Protocol) can use the MCP server. For non-MCP tools, use the HTTP API via the CLI or direct HTTP calls.
Environment parameters marked as secret are encrypted at rest using AES-GCM. Regular memories and session data are stored in plaintext in PostgreSQL (since they're on your local machine). All services bind to localhost only.
All data is stored in Docker volumes. Back them up regularly:
docker volume ls # List volumes
docker run --rm -v openmemory_postgres_data:/data -v $(pwd):/backup alpine tar czf /backup/postgres-backup.tar.gz /dataOpenMemory is designed for local development. For production, you'd need to:
- Add authentication (currently localhost-only)
- Configure TLS for external access
- Set up proper backups
- Review security model for your use case
Depends on usage. Typical storage:
- Memory: ~1KB per memory
- Sessions: ~500 bytes per message
- Graph: ~2KB per entity, ~1KB per fact
- OpenSearch: ~3x memory content size (indexed)
- Memory search: <10ms (BM25 + cache)
- Memory save: ~50ms (Postgres + OpenSearch + graph)
- Env param operations: <5ms
- Session recording: No impact (async background watcher)
# Check Docker is running
docker ps
# Check logs
docker compose logs postgres
docker compose logs opensearch
# Restart all services
docker compose down && docker compose up -d- Verify the binary exists:
ls -la target/release/openmemory-mcp - Check the path in
~/.claude/settings.jsonis absolute - Restart Claude Code after config changes
- Check MCP server logs (Claude Code shows these in the UI)
# Check if API server is running
curl http://localhost:8080/health
# If it fails, check if containers are up
docker compose --profile api ps
# Restart API server
docker compose --profile api restart openmemory-server
# Check logs
docker compose logs openmemory-server- Verify watcher is running:
docker compose ps | grep watcher - Check paths are correct: Sessions only record from
~/.claude/projects/,~/.gemini/,~/.codex/ - Check logs:
docker compose logs openmemory-watcher - For Docker Desktop/macOS/WSL, set
WATCHER_POLL_INTERVAL_SEC=60in docker-compose.yml (inotify may not work across bind mounts)
Edit docker-compose.yml and increase heap size:
environment:
OPENSEARCH_JAVA_OPTS: "-Xms1g -Xmx1g" # Increase from 512mAdd user mapping to docker-compose.yml:
services:
openmemory-watcher:
user: "${UID}:${GID}"Then restart: docker compose --profile watcher restart openmemory-watcher
- Issues: GitHub Issues
- Discussions: GitHub Discussions
Made with β€οΈ for the AI agent community

