Memento is a local-first, open-source MCP middleware that gives your AI agents (Cursor, Claude Desktop, Trae, etc.) persistent memory, proactive goal enforcement, and autonomous intelligence — all running on a zero-cost SQLite temporal graph with Reciprocal Rank Fusion (RRF) retrieval.
No cloud databases. No API calls for storage. Everything stays on your machine.
Architecture
Temporal Graph Memory (RRF)
Built on SQLite FTS5 (full-text search) and cosine similarity (vector embeddings). Fuses keyword matches and semantic meaning via Reciprocal Rank Fusion. WAL-mode enabled for concurrency.
Tri-State Goal Enforcer
Keep your AI aligned with project objectives at three escalation levels:
- Level 1 — Context Injection: Automatically injects active goals into every search result. Active by default.
- Level 2 — Strict Mentor: Forces the AI to submit code/plans for goal alignment evaluation via LLM.
- Level 3 — Daemon Push: File-watcher monitors your workspace and proactively flags goal drift.
Active Coercion (Code Immune System)
Deterministic regex/tree-sitter rules that block anti-patterns at commit time and in the IDE. 100% deterministic — zero LLM hallucination risk during enforcement.
Autonomous Agent
Background cognitive loop with four levels:
- off: No background behavior (default).
- passive: Observe health and patterns every 5 min. No modifications.
- active: Consolidate memories, extract KG, warm caches, detect anomalies every 2 min.
- autonomous: All of the above plus dream synthesis, goal drift detection, task generation, health reports every 1 min.
Workspace Isolation
Each project gets its own .memento/ directory with an isolated SQLite database. No context bleeding between projects. Configure via MEMENTO_DIR or per-project .cursor/mcp.json.
Session Continuity
- Auto-checkpoints every 25 tool calls with full L1 working memory snapshot.
- Auto-resume restores goals and context from the previous session.
- LLM-agnostic handoff prompts for session transfer between agents.
Project Memory Graph
Semantic entity-relationship graph on top of the Knowledge Graph. Track files, components, decisions, and their dependencies. Impact analysis shows what breaks when you change something.
Unified Tool API (v0.3.x)
Memento exposes 16 action-based tools via MCP. Each tool uses an action parameter instead of separate tools per operation:
| Tool | Actions | Purpose |
|---|
memento | (main router) | Primary proactive memory interface |
memento_project | set_state, get_state, delete_state, set_goals, list_goals, summary | Vision, milestones, blockers, goals |
memento_session | begin, resume, handoff, status, list | Session lifecycle and handoff |
memento_graph | add_entity, add_relation, query, impact, summary | Project Memory Graph |
memento_search | basic, advanced, explain | FTS, vNext pipeline, routing trace |
memento_remember | add, consolidate, share, evaluate, hit | Memory write operations |
memento_compact | (standalone) | Token-friendly text compaction |
memento_configure | enforcement, coercion, daemon, autonomy, consolidation_scheduler, kg_scheduler, dependency_tracker, superpowers, access | All configuration |
memento_cognitive | dream, align, warnings, tasks | Cognitive engine operations |
memento_health | status, health, memory, kg, quality, relevance, cache, explain | Diagnostics |
memento_coercion | list_presets, apply_preset, list_rules, add_rule, remove_rule, install_hooks | Active Coercion management |
memento_kg | extract, health, cross_workspace_stats | Knowledge Graph operations |
memento_code | graph, links, stats | Code symbol graph and memory grounding |
memento_notifications | configure, list, dismiss | Proactive notifications |
memento_audit_dependencies | (standalone) | Dependency audit |
memento_migrate_workspace_memories | (standalone) | Workspace memory migration |
Quick Start
Install
pip install memento-mcp
Or run without installing:
uvx memento-mcp
Configure (Cursor / Claude Desktop / Trae)