SQLite memory brain for AI coding assistants. Per-user + shared team memory, hybrid search, zero config.
memrig gives AI coding assistants (Claude Code, Cursor, etc.) persistent memory that survives across sessions. Each team member gets their own private memory plus a shared team brain — all searchable via full-text + semantic search.
your-project/
├── .mcp.json ← committed to git
├── .memory/
│ ├── shared.db ← team knowledge (committed)
│ └── users/
│ ├── alice.db ← Alice's memories (gitignored)
│ └── bob.db ← Bob's memories (gitignored)
npm install memrig# In your project directory:
npx memrig init
# That's it. Restart Claude Code and memrig is connected.memrig init does the following:
- Creates
.memory/directory withshared.dbandusers/{you}.db - Adds
.memory/users/to.gitignore(personal memories stay private) - Creates
.mcp.jsonwith the memrig server config
If you prefer to configure manually, add this to your .mcp.json:
{
"mcpServers": {
"memrig": {
"command": "npx",
"args": ["-y", "memrig"],
"env": {
"MEMORY_DIR": ".memory",
"MEMRIG_USER": "${USER}"
}
}
}
}| Tool | What It Does |
|---|---|
remember |
Save a memory (personal by default, or shared) |
recall |
Search memories — hybrid FTS5 + vector search |
forget |
Delete a memory by ID |
share |
Promote a personal memory to shared team memory |
import_memory |
Copy a shared memory to your personal space |
list_memories |
Browse memories with filters |
decision— Architectural or product decisionspreference— Personal or team preferencescontext— Background context about the projectbug— Known bugs and workaroundspattern— Code patterns and conventionsarchitecture— System architecture notes
recall uses hybrid retrieval:
- FTS5 BM25 — keyword matching across content and tags
- sqlite-vec — semantic similarity (MiniLM-L6-v2 embeddings, runs locally)
- Reciprocal Rank Fusion — merges both ranked lists with
score = Σ 1/(k + rank) - Ebbinghaus decay — older, less-accessed memories rank lower (decay rate varies by type)
- Cross-DB merge — personal results weighted 1.1x higher than shared
Memories below 5% strength are auto-pruned during recall.
Environment variables (set in .mcp.json):
| Variable | Default | Description |
|---|---|---|
MEMORY_DIR |
.memory |
Path to memory directory |
MEMRIG_USER |
$USER |
Username for personal memory isolation |
- One person runs
npx memrig initand commits.mcp.json+.memory/shared.db - Everyone else pulls and runs
npx memrig init(idempotent — won't overwrite existing config) - Shared memories sync via git. Personal memories stay local.
- Use the
sharetool to promote personal memories to the team,import_memoryto pull shared memories into your personal space.
git clone https://github.com/RiggdAI/memrig.git
cd memrig
npm install
npm test # run tests (vitest)
npm run build # compile with tsupMIT