memento-mcp
memento-mcp
Persistent memory for AI coding agents.
A local-first MCP server that gives Claude Code, Codex, Cursor, and any stdio-MCP client durable project memory: facts, decisions, patterns, architecture notes, pitfalls, session summaries, and team-shared knowledge — while cutting thousands of tokens of repeated context out of every single session.
AI coding agents are powerful, but they forget. They forget why a decision was made, which migration broke production, which convention your project follows, and which workaround saved you three hours last week.
memento-mcp fixes that — and stops your agent burning thousands of tokens re-reading the same context every session.
It stores structured memories locally in SQLite, retrieves the right context when your agent needs it, and can sync selected team memories through git. No hosted vector database. No mandatory cloud account. No mystery SaaS quietly eating your project history.
Quick start
npm install -g @luispmonteiro/memento-memory-mcp
memento-mcp install
memento-mcp import auto # detects CLAUDE.md, AGENTS.md, .cursor/rules, .github/copilot-instructions, …
memento-mcp uiRelated MCP server: Mono Memory MCP
Table of contents
Documentation
Getting started
Importing existing project memory — CLAUDE.md, AGENTS.md, Cursor, Copilot, Gemini, Windsurf, Cline, Roo
Features
Reference
Requirements
Node.js 20 or newer (20.x, 22.x, 24.x — Node 18 is EOL and no longer supported)
npm
An MCP-compatible client, such as Claude Code, Codex, Cursor, or another stdio-MCP client
Obsidian vault for curated Markdown knowledge
OpenAI key for semantic embeddings
Anthropic or OpenAI key for LLM-assisted session summaries
git repo for team memory sync
Package
Published on npm as:
@luispmonteiro/memento-memory-mcpInstall globally:
npm install -g @luispmonteiro/memento-memory-mcpWhat it does
memento-mcp gives your AI coding tools a memory layer that survives across sessions, machines, and teammates.
It can remember:
Architectural decisions | Project conventions |
Known pitfalls | Implementation patterns |
Debugging notes | User/team preferences |
Session summaries | Reusable context from |
Curated notes from an Obsidian vault |
Then it injects the relevant context back into your agent at the right time, without forcing you to paste the same project explanation into every new chat like a medieval scribe with npm installed.
Why use it
Save tokens. A lot of them.
Without persistent memory, every new session starts blind:
CLAUDE.md/AGENTS.md/.cursor/rules// Copilot instructions get re-pasted or stuffed into the system promptArchitectural decisions are re-explained mid-conversation
Last week's pitfall is re-discovered the hard way
"What were we doing yesterday?" eats hundreds of tokens before any actual work happens
memento-mcp imports that context once — from any of the major LLM instruction files — and serves back only the slice the current prompt needs, using progressive disclosure that prefers cheap index/summary layers over full bodies.
memento-mcp import auto # detects every known LLM memory file in the projectConservative per-session savings
Where the tokens go | Without memento | With memento | Saved |
| ~1,500 t | imported once → 0 t | ~1,500 t |
Architecture re-explained mid-chat | ~500 t | 1 retrieved decision (~80 t) | ~420 t |
Pitfall re-discovered | ~300 t | 1 retrieved pitfall (~80 t) | ~220 t |
"What were we doing?" recap | ~400 t | 1 session summary (~200 t) | ~200 t |
Total prelude per session | ~2,700 t | ~360 t | ~2,340 t |
Numbers are deliberately conservative. Real-worldCLAUDE.md / AGENTS.md / .cursor/rules/ trees routinely reach 3-5k tokens (often more once a team accumulates files across multiple tools), and longer-running projects accumulate dozens of decisions and pitfalls. Savings scale with project age.
Scaled out
Cadence | Sessions / month | Tokens saved (conservative) |
Solo dev, ~4 sessions/day | ~80 | ~190,000 |
5-person team, same cadence | ~400 | ~940,000 |
Three things you get back, for free:
Latency — the agent stops chewing through thousands of prelude tokens before responding.
Context budget — that ~2,300 tokens of saved prelude is ~2,300 tokens you can spend on actual code, longer files, or richer reasoning.
Cost — every saved token is one you don't pay for, on every session, on every machine, on every teammate.
Compounding effect: when embeddings are enabled,write-time dedup keeps the memory store lean, and adaptive ranking surfaces only high-utility memories — so the retrieved tokens are higher-signal too.
Keep decisions close to the code
Log decisions, pitfalls, patterns, and architecture notes as structured memories instead of burying them in old chats, random Markdown files, or the cursed archaeology layer known as “Slack search”.
Share memory with your team
Team-scoped memories are serialized into your repo under:
.memento/memories/Commit them, push them, and teammates can pull the same operational knowledge.
memento-mcp sync init
memento-mcp sync pullStay local by default
The default setup uses:
local SQLite
SQLite FTS5 search
local config
local web inspector
no required cloud account
no hosted database
Optional embeddings are available, but they areopt-in.
Keep private text private
<private>...</private> regions are excluded from search indexes, injection, embeddings, LLM calls, and sync paths. Secret scrubbing is applied at write time for common credentials such as env-var values, JWTs, GitHub tokens, URL credentials, and authorization headers.
See and control what the agent knows
Run the local inspector:
memento-mcp uiBrowse memories, sessions, projects, sync state, analytics, and drift without opening yet another SaaS dashboard pretending to be “simple”.
Installation
1. Install from npm:
npm install -g @luispmonteiro/memento-memory-mcp2. Wire it into your MCP client:
memento-mcp installThis configures supported local clients such as Claude Code, Codex, Cursor, or other stdio-MCP clients.
3. Verify the install:
memento-mcp --help4. Open the local web UI:
memento-mcp ui60-second tour
# 1. Install from npm
npm install -g @luispmonteiro/memento-memory-mcp
# 2. Wire your MCP client
memento-mcp install
# 3. Import existing project memory (CLAUDE.md, AGENTS.md, .cursor/rules, copilot-instructions, …)
memento-mcp import auto --dry-run
memento-mcp import auto --no-confirm
# 4. Open the local inspector
memento-mcp ui
# 5. Share team memory through git
memento-mcp sync init
memento-mcp sync pullCore features
Typed memories
Store different kinds of project knowledge with different ranking weights and retrieval behavior:
fact · decision · preference · pattern · architecture · pitfall
Dedicated tools such as decisions_log and pitfalls_log make high-signal memory capture easier.
Read more: MCP tools reference
Team memory via git
Team-scoped memories are written as JSON files under:
.memento/memories/<id>.jsonThat means your team can review, commit, diff, and sync shared agent memory like normal project files.
Read more: Team-scoped memories with git sync
Per-project policy
Use .memento/policy.toml to control project-specific behavior:
required tags
banned content patterns
retention rules
vault promotion rules
memory constraints
The policy lives in the repo, not hidden somewhere on one developer’s machine, because apparently “works on my machine” needed a memory layer too.
Read more: Per-project policy
Local-first search
By default, memento-mcp uses:
SQLite
FTS5
typed scoring
token-aware result ranking
adaptive utility feedback
No vector database is required.
Read more: Token-aware search
Optional semantic search
If you want semantic retrieval, enable embeddings. FTS5 and vector results are merged through an adaptive ranker.
Embeddings are opt-in and use your own provider key.
Read more: Optional embeddings
Smart write-time deduplication
When embeddings are enabled, near-duplicate memories can be detected at write time, before your memory store becomes a landfill of almost-identical “important notes”.
Read more: Smart write-time dedup
Session summaries
Capture useful session context at the end of a coding session.
Supported modes:
deterministic summaries by default
optional LLM-assisted summaries using Anthropic or OpenAI
Read more: End-of-session summaries
Obsidian vault integration
Index a curated Obsidian vault and route context through:
me.md · vault.md · maps · skills · playbooks · long-form project notes
The vault layer is indexed and searched, but not auto-written by the agent unless explicitly promoted.
Read more: Vault integration
Privacy controls
Privacy features include:
<private>...</private>redactionFTS exclusion for private regions
embedding exclusion for private regions
sync exclusion for private content
secret scrubbing at write time
title and body sanitization
Read more: Privacy
Mode profiles
Switch stop-words and trivial-prompt classifiers by profile:
English
Portuguese
Spanish
Use config or environment variables:
MEMENTO_PROFILE=portugueseRead more: Mode profiles
Automatic context injection and capture
Memory tools (memory_store, memory_search, decisions_log, …) work in any stdio-MCP client. Automatic injection and capture use whatever extension mechanism the client provides — most major clients now expose lifecycle hooks.
Client | MCP tools | Hooks | Hooks since |
Claude Code | yes | yes (native) | shipped with Claude Code |
Cursor | yes | yes (native) | 1.7 (Oct 2025) |
Codex | yes | yes (native, opt-in flag) | 0.114.0 (Mar 2026) |
Gemini CLI | yes | yes (native) | 0.26.0 (Jan 2026) |
Cline | yes | yes (native) | 3.36.0 (late 2025) |
Aider | yes | no — rule-file fallback only | — |
Other stdio-MCP | yes | depends on client | — |
Each client's hook event names and config format differ (e.g. Claude Code uses UserPromptSubmit, Cursor uses beforeSubmitPrompt, Cline filenames the events). The four memento-hook-* binaries were built for Claude Code's stdin payload shape; they work directly on Codex (very similar payload), and may need a light adapter on Cursor, Gemini CLI, and Cline. For clients without hooks, fall back to a rule file (AGENTS.md, .cursor/rules/*.mdc, system prompt) telling the agent to call the memory tools itself.
Read more: Installation & client setup
Web inspector
Launch a local browser UI:
memento-mcp uiInspect:
memories · sessions · projects · sync drift · analytics · memory health
Read more: Web inspector
Knowledge model
memento-mcp separates fast operational memory from curated long-form knowledge.
SQLite memory layer
Fast, typed, agent-written memory.
Use it for:
decisions
facts
patterns
bugs
pitfalls
preferences
session-derived notes
Vault knowledge layer
Curated Markdown knowledge from an Obsidian vault.
Use it for:
long-form docs
project maps
personal/team playbooks
technical notes
stable reference material
Search and hooks can combine both layers.
Example use cases
Remember project decisions
Decision: We use repository classes for complex SQL access instead of putting queries in controllers.
Reason: Keeps business logic separate from persistence and makes performance tuning easier.
Scope: project · Tags:
architecture,backend
Remember pitfalls
Pitfall: The quality scheduling query becomes expensive when paginating after loading all rows.
Fix: Use database-level pagination and a separate count query.
Scope: project · Tags:
performance,sql
Remember team conventions
Preference: In this project, bug fixes and improvements are tracked separately in release notes.
Scope: team · Tags:
process,release-notes
Testing
memento-mcp ships with 1,352 tests across 121 test files, covering 91% of lines and 85% of branches. The suite runs on Node 20, 22, and 24 in CI on every push and pull request.
Run the tests
npm install
npm test # full suite, ~40s
npm run test:watch # watch mode for development
npx vitest run --coverage # generate the v8 coverage reportWhat the suite covers
Layer | What's tested |
MCP server | Spawns the built server, performs an MCP handshake over stdio, asserts every registered tool is callable end-to-end ( |
Memory lifecycle | Chained |
Privacy | Pins the |
Vault | Promotion → file write → re-index → vault search → |
Tools | Per-tool unit tests for |
Hooks |
|
Database | Repos, migrations, FTS triggers, edges, sessions ( |
Engine | Classifier, compressor, adaptive ranker, embeddings, vault parser/router/index, similarity, token estimator ( |
Sync | Canonical JSON serializer round-trips, push/pull, schema migration, secret scrubbing on the wire ( |
Web inspector | Every API route, edit-mode auth, pagination, security headers ( |
CLI | Installer, uninstaller, all import formats ( |
Regression | v1-behavior compatibility for legacy users ( |
Coverage exclusions
Process entry points (src/index.ts, src/cli/main.ts, the hook bin scripts) are excluded from the coverage denominator: they are exercised by integration tests via spawnSync, but v8 cannot track child-process coverage. The handlers and helpers they invoke are fully covered. See vitest.config.ts for the full list.
License
Built with care for AI coding agents that deserve to remember.
Available Tools
19 toolsdecisions_logArchitectural decision logA
Multi-action ADR log. Pick one via action: • store — record a new decision (title + body required; supersedes_id optional). Writes a row. • list — list recent decisions (read-only). • search — FTS over decisions (query required, read-only). Decisions outrank free-form memories by default and survive pruning longer. Use pitfalls_log for recurring problems.
Inputs: action (required), project_path (required), title, body, +5 more. Returns: message
memory_analyticsMemory effectiveness analyticsARead-onlyIdempotent
Reports utility rates of injected memories, token costs per search layer, auto-capture stats, compression activity, and prune suggestions. Read-only. Use to tune importance thresholds, find dead memories worth pruning, and verify that auto-capture/compression are earning their keep. Returns a no-op message when analytics are disabled.
Inputs: period, section, project_path. Returns: message
memory_compressRun the compression pipeline nowA
Force one compression cycle now: cluster similar memories by embedding similarity, merge each cluster into a canonical memory, and mark originals as compressed. Use after a bulk import or to sanity-check compression. Compression normally runs on the maintenance schedule. Side effects: writes merged memories, updates originals' compressed_into pointer, may call embeddings + LLM providers. Requires compression.enabled=true; otherwise returns a no-op message.
Inputs: project_path. Returns: message
memory_dedup_checkCheck for near-duplicate memoriesARead-onlyIdempotent
Cheap pre-flight (~50 tok/match): "would storing this content duplicate something I already have?" Read-only. Use before memory_store when overlap is likely, or before bulk imports. Returns up to limit existing memories with cosine similarity above the threshold (highest first). Computing the candidate embedding may make an outbound call to the configured provider (OpenAI, Ollama, etc.). If embeddings are disabled, returns a clear no-op message rather than silently passing.
Inputs: content (required), title, project_path, threshold, +1 more. Returns: message
memory_deleteDelete a memory (soft)ADestructiveIdempotent
Soft-delete a memory by id — the row is hidden from search/list/get but retained for audit. Idempotent. Use for accidental or obsolete memories. To replace one with a corrected version, prefer memory_store(supersedes_id=...) so history is linked.
Inputs: memory_id (required). Returns: message
memory_exportExport memories as JSONARead-onlyIdempotent
Export memories, decisions, and pitfalls as a portable JSON document. Read-only. Use before destructive maintenance (bulk delete, schema migration) so you have a clean restore point, or to transfer state to another memento-mcp instance via memory_import. Includes scope, tags, importance, and supersession links so round-trip preserves structure.
Inputs: project_path. Returns: message
memory_getGet full memory by idARead-onlyIdempotent
Fetch the full body, tags, and metadata of one memory by id (~300-800 tokens). Read-only. Use after memory_search(detail="index") to expand a single hit. Substrings inside <private> tags are redacted unless reveal_private=true (which emits an audit event). Returns not found if the id does not exist or has been soft-deleted.
Inputs: memory_id (required), reveal_private. Returns: message
memory_graphExplore the knowledge graph around a memoryARead-onlyIdempotent
BFS walk from one memory id outward, returning neighbour nodes + typed edges. Read-only. Use after memory_search to map related concepts, supersession chains, or the cluster around a decision. direction controls edge polarity (out/in/both); depth is capped at 5.
Inputs: id (required), depth, edge_types, direction. Returns: found, root, edges
memory_importImport memories from JSONA
Import memories, decisions, and pitfalls from a JSON file produced by memory_export (server-local path, not a URL). Conflict handling via strategy: skip (default, safe to re-run) keeps existing rows on id collision; overwrite replaces them — use for authoritative restores. Side effects: inserts/updates rows in memories, decisions, pitfalls. Embeddings are queued asynchronously.
Inputs: path (required), strategy. Returns: message
memory_linkLink two memories with a typed edgeAIdempotent
Create a typed directed edge between two memories. Edge types: relates_to, supersedes, caused_by, mitigated_by, references, implements. Use after memory_search to map dependencies, cause/effect, supersession chains, or references. Re-linking the same (from_id, to_id, edge_type) triple updates the weight (idempotent).
Inputs: from_id (required), to_id (required), edge_type (required), weight. Returns: message
memory_listList memories (no query)ARead-onlyIdempotent
Browse stored memories with optional filters — ordered by recency/importance. Read-only. Use to enumerate by type/scope/project. Prefer memory_search whenever you have keywords (relevance ranking). Use the same detail levels to control token cost.
Inputs: project_path, memory_type, scope, pinned_only, +5 more. Returns: detail, count, memories, vault_results
memory_pathShortest path between two memoriesARead-onlyIdempotent
BFS shortest path between two memories — returns the chain of ids + edge types, or a no path message when unreachable within max_hops. Read-only. Use after memory_search (with both endpoints known) to trace cause-effect chains, supersession history, or dependency lineage.
Inputs: from_id (required), to_id (required), max_hops, edge_types. Returns: found, hops, path, message
memory_pinPin or unpin a memoryAIdempotent
Toggle the pinned flag — pinned memories survive pruning and rank higher in search. Idempotent. Use sparingly: reserve pins for canonical decisions, user preferences, and high-leverage facts. Pinning everything defeats the purpose.
Inputs: memory_id (required), pinned. Returns: message
memory_searchSearch memoriesARead-onlyIdempotent
Ranked full-text + decay-weighted search across SQLite, file-memory sources, and (when configured) the Obsidian vault. Read-only. Use the three-layer progressive-disclosure pattern: detail="index" (~30 tok/result, start here), "summary" (~80 tok), "full" (~150-300 tok, use sparingly). Follow-ups: memory_timeline(id) for chronological neighbours of one hit, memory_get(id) for one full body, memory_graph(id) to explore typed edges.
Inputs: query (required), project_path, memory_type, limit, +2 more. Returns: query, detail, count, results, +2 more
memory_storeStore a memoryA
Persist a fact, decision, lesson, or pattern so it can be recalled later by memory_search/memory_get or auto-injected into future sessions. Use for durable context (decisions, gotchas, preferences, recurring commands). For transient notes or duplicates, prefer memory_dedup_check first. Writes one SQLite row, queues an embedding (when enabled), and optionally creates/updates an Obsidian vault note. dedup="strict" refuses duplicates, "warn" stores with a warning, "off" bypasses.
Inputs: title (required), content (required), memory_type, scope, +11 more. Returns: message
memory_timelineList memories around an id (chronological)ARead-onlyIdempotent
Return the chronological neighbourhood of memories around an anchor id (~200 tok/neighbour). Read-only. Use after memory_search(detail="index") to recover work-session context for one hit. Cheaper than calling memory_get on each neighbour individually.
Inputs: id (required), window, detail, same_session_only. Returns: message
memory_unlinkRemove an edge between two memoriesADestructiveIdempotent
Remove a previously created edge — pass the exact (from_id, to_id, edge_type) triple used at creation time. No wildcards. Idempotent. Use to retract incorrect links. To retract a whole memory, prefer memory_delete (keeps audit trail).
Inputs: from_id (required), to_id (required), edge_type (required). Returns: message
memory_updateUpdate a memory in placeAIdempotent
Edit a memory in place — only the fields you pass are changed. Editable: title, content, tags, importance, memory_type, pinned. Use for typo fixes, retagging, importance tuning. For meaningful changes you'd want history for (e.g. a reversed decision), prefer memory_store(supersedes_id=...) instead. Side effect: when content changes, the embedding is re-queued and dedup may run. Returns not found for missing ids.
Inputs: memory_id (required), title, content, tags, +4 more. Returns: message
pitfalls_logRecurring pitfalls logA
Multi-action log of recurring problems and their resolutions. Pick one via action: • store — record a new pitfall (title + body required). Writes a row. • list — list open pitfalls (set include_resolved=true for all). Read-only. • resolve — mark a pitfall resolved (pitfall_id required). Use when something keeps biting and you want a queryable problem→resolution log. For one-off design choices, use decisions_log.
Inputs: action (required), project_path (required), title, body, +4 more. Returns: message
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 19 tools
Each tool has a clearly distinct purpose: decisions_log for ADR entry, pitfalls_log for problem tracking, and memory_* tools covering CRUD, search, graph, linking, analytics, etc. No two tools overlap in functionality.
Most tools use the 'memory_' prefix with a verb or noun (e.g., memory_store, memory_search), but decisions_log and pitfalls_log break the prefix pattern. The naming is mostly consistent and intuitive.
19 tools is well-scoped for a knowledge management server. The count covers all necessary operations without being excessive, and each tool contributes a unique, valuable function.
The tool surface is comprehensive: store, retrieve, update, delete, search, list, graph traversal, import/export, dedup, compression, pinning, linking/unlinking, timelines, decisions, pitfalls, and analytics. No obvious gaps.
Maintenance
Related MCP Connectors
MCP server that gives every AI tool the same memory. Save once in Claude, use it in ChatGPT, Cursor or any MCP client: your knowledge, preferences and decisions go with you, and it learns how you work.
Persistent memory for AI assistants. Save once; recall from Claude, ChatGPT, or any MCP client.
Persistent memory for AI agents across Claude, ChatGPT and any MCP client.
Give your AI agent persistent, governed memory for every project. At task start it recalls the approved decisions, conventions, risks and architecture (semantic search, ranked by importance); at close it proposes what was learned as typed memories that you review and approve — governance, not a notes dump. Agents propose, humans govern: edits go back to pending and deletion is human-only by design. Connect Claude Code, Cursor, Claude Desktop or any MCP client in two minutes with just your API key — hosted (nothing to install) or locally via `uvx solucortex-mcp`. Built by SoluAI and dogfooded daily: SoluCortex is developed using its own living memory.
Related MCP Servers
AlicenseNot gradedqualityDmaintenanceEnables Claude to add and search personal memories through the Nowledge Mem service. Allows users to store and retrieve contextual information across conversations.4MIT- AlicenseNot gradedqualityDmaintenanceA self-hosted MCP server that provides AI assistants with a shared, persistent SQLite-backed memory for storing and retrieving project context, decisions, and discoveries. It enables cross-session continuity and team-wide knowledge sharing to keep AI coding tools aligned and informed.3MIT
- AlicenseAqualityDmaintenanceSmart memory for AI agents. Solves the Karpathy problem: memories decay, topics are frequency-weighted, one-time questions don't become obsessions. 7 tools. Zero deps.42MIT
- AlicenseNot gradedqualityDmaintenancePersistent memory for AI coding agents. Enables agents to save and recall decisions, patterns, bugs, and context across sessions via an MCP server with local SQLite storage.9 npm2MIT