claude-db231
Menu

Databases

SQLite by default, with no setup and no network. The connection string picks the backend, so moving to Postgres or Mongo is one command.

SQLite

Stored at ~/.claude-memory/memory.db. It comes from Node's builtin node:sqlite, so there is nothing to install and nothing compiles. Memory is filed by project, so one database serves every repo you work in.

Switch database

Terminal
claude-db use "postgres://user:pass@host:5432/memory"
claude-db use "mongodb+srv://user:pass@cluster.mongodb.net/memory"

use switches the backend and verifies it can be reached before saving. Install the driver you need first, either npm install -g pg or npm install -g mongodb, since neither ships by default and claude-db looks for them next to itself. CLAUDE_DB_URL overrides the config file when you need a one-off.

Recall does not change with the backend

Search is hybrid, keyword plus vector, on all three. Ranking, fusion and token budgeting live above the adapters, so results behave identically no matter which database is plugged in. Only retrieval cost changes.

Sync two databases

Terminal
claude-db sync "postgres://user:pass@host:5432/memory"

A two-way merge, so a laptop and a desktop can each keep working offline and reconcile later. export and import cover the same ground as files when you would rather move a dump by hand.

Teams and several machines

Point everyone at one Postgres or MongoDB database and they share memory.

  • Projects are matched by git remote. A repository with an origin remote is one project wherever it is cloned, so a laptop and a desktop share memory. The ssh and https addresses of one repository match, and no token in the address is ever stored. A folder with no remote is matched by its path. A fork has its own remote, so it is its own project. Set project.remote to use a remote other than origin.
  • Update every machine to 0.11.0 or newer. An older version does not see notes shared by git remote.
  • Personal rules stay personal. A rule about how you like to work is filed under your git email and never reaches a teammate. Set git config user.email so it is filed under the right name.
  • Use a restricted account. The account should reach only its own database.

Memory saved before 0.11.0 under a folder path is still found and is not moved.

MongoDB Atlas vector index

Atlas can index vector search instead of scanning brute-force, but Atlas indexes are not created by this tool. Add one by hand on the observations collection:

JSON
{
  "name": "memory_vector",
  "type": "vectorSearch",
  "fields": [
    { "type": "vector", "path": "embedding", "numDimensions": 256, "similarity": "cosine" },
    { "type": "filter", "path": "project" },
    { "type": "filter", "path": "kind" },
    { "type": "filter", "path": "tags" },
    { "type": "filter", "path": "createdAt" }
  ]
}

numDimensions is 256 for the builtin embedder and 384 once @xenova/transformers is installed. Without this index Mongo still works: vector search falls back to scoring candidates in process.

Edit this page on GitHub