Persistent memory for AI agents β 98%+ retrieval recall, 99% token savings, 44 tools
Copy the AI prompt to install this server into Claude Code, Cursor, or another agent β or use 1-click editor setup below.
We haven't yet run this listing's install command through our automated sandbox check. This isn't a red flag β we're steadily working through the catalog.
π‘ 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 Context Mem.
observeStore observation with auto-summarization, importance scoring, entity extraction, topic detection
recallRetrieve verbatim content by filter (importance, type, flag, time)
searchHybrid search (BM25 + vector + optional LLM judge)
askNatural language Q&A over the full memory store
timelineReverse-chronological observations with importance badges and flags
statsToken economics for current session (raw vs. compressed)
Memory + context infrastructure for AI agents. Remembers everything. Compresses everything. Fully local.
Two problems with today's AI tooling that no one has solved together in a single package.
Your AI forgets. Every new session starts from zero. The architecture decisions you settled on last Thursday, the bug you spent four hours tracing to a misconfigured environment variable, the preferences you stated three times β none of it carries forward. You spend the first ten minutes of every session re-explaining context that already existed. Multiply this by every developer on your team, every project, every day.
Your context explodes. Long coding sessions blow past the context window. A typical session with 50 tool outputs accumulates 365 KB of raw text β stack traces, test output, file reads, shell commands. Every token costs money or slows the model. Naive truncation drops the exact evidence the model needs. Keeping everything makes responses slower and inference cost climb fast.
These two problems compound each other. The solution to forgetting (keep everything) is the opposite of the solution to context explosion (discard everything). The result is a false tradeoff most tools force on you: either your AI forgets everything, or your costs balloon. context-mem solves both simultaneously by building an indexed, compressed, retrievable memory store rather than dumping raw history into the context window.
Every tool call is automatically ingested, summarized, and written into a navigable markdown vault β a living wiki your AI maintains about your project. Entities get their own pages with backlinks. Topics get synthesis pages. Sessions become browseable source documents. Decisions accumulate into a reconstructible trail.
The vault lives at .context-mem/vault/ and syncs continuously from the underlying SQLite store. Read it in Obsidian, grep it from the terminal, or query it through 45+ MCP tools using hybrid BM25 + vector + optional LLM judge search. The raw SQLite store is the authoritative record; the markdown vault is the derived, human-readable layer.
This is a reference implementation of Andrej Karpathy's LLM Wiki pattern β three layers (raw sources / wiki / schema), with automatic ingest from tool calls that no other system provides.
Every observation passes through a content-aware summarizer before storage. A stack trace is not treated the same way as a JSON config file. Shell output from a build is compressed differently from TypeScript compiler errors. The system applies the right compression for the content type.
The result: a full coding session with 50 tool outputs goes from 365 KB to 3.2 KB β 99.1% token savings, verified. Compression is adaptive: recent high-importance observations stay verbatim; older low-importance ones compress progressively. Pinned entries never compress regardless of age.
init auto-detects your editor and writes the right config files:
| Editor | Config written |
|---|---|
| Claude Code | .mcp.json + 8 hooks + CLAUDE.md |
| Cursor | .cursor/mcp.json + .cursor/rules/context-mem.mdc |
| Windsurf | .windsurf/mcp.json + .windsurf/rules/context-mem.md |
| VS Code / Copilot | .vscode/mcp.json + .github/copilot-instructions.md |
| Cline | .cline/mcp_settings.json + .clinerules/context-mem.md |
| Roo Code | .roo-code/mcp_settings.json + .roo/rules/context-mem.md |
| Aider | .aider.conf.yml (MCP block) |
| Continue | .continue/config.json (MCP block) |
| JetBrains AI | .idea/mcp.json |
No API keys. No cloud account. No data leaves your machine.
[ placeholder: GIF or video β Claude Code session with split view showing Obsidian graph updating in real time alongside the context-mem dashboard token savings chart ]
Three layers (per Karpathy):
.context-mem/vault/). Auto-synced from SQLite. Human-readable, Obsidian-compatible, grep-friendly. Entity pages, topic pages, session pages, knowledge pages, index, event log.docs/llm-wiki-schema.md governs page structure, linking conventions, agent workflow recipes, and interop contract. Public spec β other tools can emit conforming wikis.The distinction from most memory systems: context-mem is not replacing SQLite with markdown. SQLite is authoritative β it is where observations are stored, searched, and indexed. The vault is the browseable, linkable, diffable surface on top of it β the layer a human or LLM can navigate without a database client. If you delete the vault directory, you lose nothing that matters. If you edit a vault page manually, those edits are preserved and not overwritten on the next sync.
This is the Karpathy three-layer model applied to a running AI development environment: immutable inputs, a maintained synthesis layer, and a public schema that governs the synthesis. The vault can be used independently of the MCP tools β it is just a directory of markdown files. Open it in any editor. Put it in git. Diff it across commits. Use it as long-form context by copy-pasting pages into a new conversation. The MCP tools are the automated path; the markdown vault is the portable, durable, human-readable path.
All scores are session-level retrieval recall: did any correct evidence session appear in the top-k results? This is different from end-to-end QA accuracy (retrieve + generate + judge), which is harder and lower for every system. Both measurements are published here.
| Benchmark | Retrieval Recall | E2E QA Accuracy | Questions | Sessions |
|---|---|---|---|---|
| LongMemEval | 97.8% R@5 | published post-v3.4 | 500 | ~53/conv |
| LoCoMo | 98.1% R@10 | published post-v3.4 | 1,977 | 19-35/conv |
| MemBench | 98.0% R@5 | β | 500 | β |
| ConvoMem | 97.7% R@10 | β | 250 | β |
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/context-mem)<a href="https://allmcps.com/mcp/context-mem"><img src="https://allmcps.com/api/badge/context-mem?style=directory" alt="Context Mem on AllMCPs" /></a>