Local-first embedded agent memory using SQLite with hybrid dense+sparse search and add-only history.
Copy the AI prompt to install this server into Claude Code, Cursor, or another agent โ or use 1-click editor setup below.
We ran the install command below but it didn't respond within our test window โ this can mean a slow first-time install rather than a real problem.
uvx lean-memoryNo response to initialize.
This is an experimental automated check and can have false negatives โ missing environment variables, a slow cold install, etc. It doesnโt necessarily mean somethingโs wrong. Last checked 1mo ago.
๐ก Paste the JSON block into your client's configuration file under mcpServers, then restart the application.
Inspect callable tools, capabilities, and parameters exposed to AI agents by Lean Memory.
Embedded, local-first agent memory. No server, no daemon, no mandatory cloud key.
Status (2026-07): first public release line (0.2.1) is live on PyPI and the MCP Registry (MCP-first launch); the Claude Code plugin ships in this repo (marketplace listing pending). Roadmap and rationale:
docs/superpowers/specs/2026-07-08-strategic-direction-design.md. Public benchmark runs (LongMemEval/LoCoMo) are deliberately deferred until after launch; the harness is complete (bench/phase2_*.py) and the engine flaws it exposed are fixed โ seedocs/phase2-learnings.md.

Facts are extracted from natural language, stored in a per-namespace SQLite file, and retrieved with hybrid dense+sparse search. Old facts are never deleted โ they're superseded and queryable at any past point in time.
Runs fully offline out of the box. Optional extras unlock real model quality:
| Extra | What it adds |
|---|---|
lean-memory[models] | Real embedder + reranker (Qwen3-0.6B + Ettin-32M) |
lean-memory[extract] | GLiNER2 candidate generation for richer extraction |
lean-memory[llm] | Ollama-backed LLM typing pass |
lean-memory[mcp] | MCP server bridge for Claude Desktop / Claude Code |
lean-memory[examples] | Terminal demo agent (requires anthropic SDK) |
A terminal chatbot showing the full memory loop โ add, retrieve, supersede, restart. The demo script lives in the repo (it is not installed with the package):
No API key? The demo still runs โ it echoes the retrieved memory context instead of calling Claude, so you can watch the engine work offline.
Give any MCP agent persistent local memory: three tools (memory_add,
memory_search, memory_clear), one SQLite file per namespace, nothing
leaves your machine.
First run downloads three open models (~2.0 GB total: Qwen3-Embedding-0.6B
- Ettin-32M reranker for retrieval, plus GLiNER2-base (~0.8 GB) for real extraction โ all ungated). Pre-warm once so your MCP client never waits on a download:
Claude Code:
Claude Desktop โ add to mcpServers (or copy examples/mcp_config.json):
Data root: LM_DATA_ROOT (default ~/.lean_memory). Works offline-only too โ
the server opportunistically upgrades each backend that its extra is installed
for ([models] โ real embedder + reranker, [extract] โ GLiNER2 extraction)
and otherwise falls back to deterministic stub backends (fine for CI,
semantically meaningless for real use โ install [mcp,models,extract]).
What the optional
[llm]extra buys. The canonical[mcp,models,extract]install has no LLM typing pass, so the ~15% of candidates that escalate โ almost all of them inferential (derives) facts โ are typed by a deterministic stub instead of a model. Assertional facts are unaffected; inference-type facts are effectively second-class on the default path. Adding[llm](a local Ollama model) upgrades that escalated tier to real constrained typing. See ARCHITECTURE.md โ Known Limitations.
Memory accumulates cruft: the same fact restated a dozen ways, old records that never come up, clusters begging to be summarized. lean-memory cleans it up the way sleep consolidates memory โ an offline job you run off-hours that dedupes, summarizes, and demotes low-value records, then hands you the judgment calls to click through the next morning, in the web console or conversationally in Claude Code.
The CLI (lean-memory-maintain) is the primary trigger. It is dry-run by
default โ it reports what it would do and writes nothing:
--root defaults to $LM_DATA_ROOT; add --namespace NS to run a single
namespace instead of every *.db under the root. Overnight, on a schedule โ
one crontab line runs the safe band nightly at 3am and stages everything else
for you:
Next-morning review in Claude Code. Judgment calls (near-duplicate merges,
summaries, evictions) are staged as proposals โ nothing changes in stored
memory until you approve. Run the /review-memory plugin command (or invoke the
review-memory-maintenance MCP prompt on the console server) and Claude walks
you through the queue,
grouped by entity with before/after evidence, recording only the verdicts you
give. Four MCP tools back it โ memory_maintenance_run (dry-run by default,
like the CLI), memory_maintenance_status, memory_review_queue, and
memory_review_decide โ available on the core lean-memory-mcp server and both
console MCP surfaces. Set LM_MAINT_AUTO=1 to opt into a background auto-run
(safe band only) on the first tool call of a stale namespace; it is off by
default.
Or click through it in the console. The memory console ships a Review page: the same queue grouped by entity, before/after evidence per proposal (both texts + cosine for near-duplicates, sources + proposed text for summaries, score evidence for evictions), with Approve / Keep / Edit-then-approve / Promote verbs, batch-approve per entity, and a run-maintenance button (dry-run by default; apply sits behind a confirm). Both frontends drive the same proposal store with compare-and-set decisions, so deciding in one place shows up as "already decided" in the other instead of double-applying.
The safety story in one paragraph. Nothing is ever deleted โ maintenance
only appends, retires (the same superseded_by flip ordinary supersession
uses), or demotes to a cold tier, so your full history stays queryable as-of any
past point in time, bit-for-bit identical at the store predicate and pinned by
executable tests. Only two transforms auto-apply: exact-duplicate retirement and
a strict eviction band; everything judgmental is staged for a human, and an
unreviewed proposal expires after 30 days rather than auto-applying โ
silence is never consent. Cold-demoted facts stay reachable via as_of queries
and search(..., include_cold=True), and promotion back to the hot tier is
explicit-only, so a read never durably changes what your agent sees.
The default backends are offline stubs โ deterministic and dependency-free, but semantically meaningless. Swap in real models for production-quality retrieval:
With Qwen3-Embedding-0.6B + Ettin-32M reranker, retrieval jumps from 1/5 to 4/5 on the internal benchmark with zero code changes.
For benchmark results, architecture decisions, and implementation status see ARCHITECTURE.md.
Each mem.add() call runs a 4-pass hybrid extraction pipeline:
Factual signals from GitHub, npm, and our automated checks โ not a rating.
No reviews yet โ be the first to share how this listing worked for you.
Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.
[](https://allmcps.com/mcp/wuesteon-lean-memory)<a href="https://allmcps.com/mcp/wuesteon-lean-memory"><img src="https://allmcps.com/api/badge/wuesteon-lean-memory?style=directory" alt="Lean Memory on AllMCPs" /></a>