MemDrive
Shareable memory for AI coding agents. Enables agents to remember and recall durable memories across sessions and share them as importable packs.
README
MemDrive
Shareable memory for AI coding agents. Teach Claude Code (or Cursor) something once, then carry that knowledge across sessions — and hand it to a teammate as a single file they can import into their agent.
I taught Claude Code something on my laptop, exported a pack, my friend
imported it in Cursor, and their agent knew it.
MemDrive is a tiny MCP server + CLI. No
cloud, no account, no embeddings service — just a local SQLite database and
plain-text .jsonl packs you own.
Install
npx memdrive@latest install
This wires MemDrive into every agent it finds:
- Claude Code — adds the MCP server and (optionally) a Stop hook that auto-distills durable memories when a session ends.
- Cursor — adds the MCP server (you call
remember/recallyourself).
It backs up each config before touching it, never clobbers your other MCP servers, and prints exactly what changed. Then open your agent and ask: "what do you remember?"
Remove it any time:
npx memdrive@latest install --remove
The three tools
Your agent gets three tools it can call on its own:
| Tool | When it fires |
|---|---|
remember |
You decide something, state a rule/preference, or hit a gotcha and its fix. Stores a short, distilled memory — never a transcript. |
recall |
At the start of a task. Returns the most relevant memories, pinned first, inside labelled [MEMORY …] envelopes. |
forget |
A memory is wrong or outdated. Tombstones it by id. |
Memories have a type (decision, convention, gotcha, preference,
fact, snippet, todo_context), an optional project scope, and tags.
Sharing packs
Packs are the whole point. A pack is one .jsonl file — a header line plus one
memory per line.
# Export the acme project's memories (personal preferences are left out)
memdrive export acme.jsonl --project acme
# On another machine / in another agent
memdrive import acme.jsonl --name acme-team
- Idempotent. Every memory has a ULID, so re-importing an updated pack only adds the new entries. Share the file over GitHub or Drive and re-import whenever it changes — that's your sync story for v0.1.
- Secret-safe. Export scans for API keys, tokens, JWTs, connection strings,
and private keys, and refuses (naming each finding) unless you pass
--force. - Provenance kept. Imported memories are labelled
source=pack:<name>and are never auto-pinned into your context.
Other commands
memdrive list [--project x] [--all] # see what's stored
memdrive status # DB path + counts by type/source
memdrive serve # run the MCP server (your agent does this)
Everything lives in ~/.memdrive/local.db. Override with MEMDRIVE_DB for
scratch/testing.
Security note
Imported packs are untrusted text. A pack is just JSON someone else wrote —
read the .jsonl before importing it, exactly as you would a shell script from
the internet. MemDrive relabels provenance and refuses to pin imported memories,
but it cannot vouch for their content.
How it works
- Storage: SQLite with an FTS5 full-text index. Search is
bm25relevance, pinned-first, with a recency tiebreak; tombstoned and expired memories are never returned. - Server: stdio MCP.
recallrenders memories under a token budget so it never blows up your context. - Distill hook: on Claude Code session end, MemDrive tails the transcript
and asks a headless
claude -pto extract ≤5 durable memories as strict JSON, validates them, redacts secrets, and stores them withconfidence=0.6.
Roadmap
v0.1 is deliberately small. Next up, roughly in order:
- Embeddings (hybrid FTS + vector search) behind the same
recallcontract - Collections for grouping memories beyond
project/tags - Live mounts / sync and an HTTP transport
- Review queue for triaging imported packs
- More clients (Windsurf, Cline, VS Code)
The v0.1 interfaces — the store API, the recall contract, and the JSONL pack
format — were chosen to survive all of the above without a migration.
Develop
npm install
npm run build # tsup → dist/cli.js
npm test # vitest
npm run typecheck
MIT licensed.
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
Neon Database
MCP server for interacting with Neon Management API and databases
E2B
Using MCP to run code via e2b.
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.