by Avijit07x
Persistent memory for Claude Code. Bring your own database.
# Add to your Claude Code skills
git clone https://github.com/Avijit07x/claude-dbGuides for using data processing skills like claude-db.
claude-db is an open-source data processing skill for AI coding assistants such as Claude Code, Codex CLI, and ChatGPT, built by Avijit07x. Persistent memory for Claude Code. Bring your own database. It has 58 GitHub stars.
claude-db's catalog security scan is still queued. You can run an instant dependency and prompt-injection check now with the "Scan for vulnerabilities" button above.
Clone the repository with "git clone https://github.com/Avijit07x/claude-db" and add it to your Claude Code skills directory (see the Installation section above).
claude-db is primarily written in TypeScript. It is open-source under Avijit07x on GitHub, so you can review or fork the full source.
Yes. SkillsLLM lists many other Data Processing skills you can browse and compare side by side. Open the Data Processing category from the badge at the top of this page, or use the Related Skills and comparison links further down to weigh claude-db against similar tools.
No comments yet. Be the first to share your thoughts!
Top skills in this category by stars
Unlocks once the catalog security scan passes (runs nightly).
The deep catalog scan for this skill is still queued. Run an instant dependency check now instead.
Persistent memory for Claude Code. Bring your own database.
Claude Code forgets everything when a session ends. Next time you open it, you re-explain the architecture, why you chose X over Y, and what already failed.
claude-db records those decisions as you work and gives them back automatically. Local by default, no account, no subscription.
npm install -g claude-db
cd your-project
claude-db install --project
Restart Claude Code. That's it.
Claude Code already writes every session to disk as JSONL — your prompts, its replies, every tool call. claude-db reads that file, so it captures why you did something, not just which files changed.
you send a prompt
│
├─ 1. save the previous turn
│ read new lines from the session transcript
│ keep turns that changed something
│ store title + reasoning + files, with an embedding
│
└─ 2. search memory using your prompt
inject the best match above your message
Both steps are hooks, so they always run. Nothing depends on Claude deciding to look something up.
Install also writes a short standing instruction into CLAUDE.local.md (or
~/.claude/CLAUDE.md for a machine-wide install), telling Claude to search
memory before asking you to re-explain something. Hook output is context the
agent may or may not act on; a memory file is a rule for the whole session,
which is what makes recall the default rather than something you have to ask
for. claude-db uninstall takes the block back out.
What gets saved. One observation per turn, and only if that turn edited a
file or ran a real command. Questions, grep, and "ok" are skipped. A busy day
produces 10 to 20 rows, not hundreds.
What gets injected. Recent session summaries at startup, plus the single best match in full on each prompt. Roughly 350 tokens when something relevant exists, zero when it doesn't.
What search returns. An id, kind, date, title and one line of the matching
body — enough to tell two similarly-titled rows apart without expanding either.
Full bodies come only from get_observations, for ids you picked.
An example of one stored memory:
[decision] Chose WebSocket over polling for live order updates
Asked: the order feed keeps dropping
Polling at 3s hammered the API and still lagged behind. Switched to a
WebSocket subscription with exponential backoff and a replay flag, so no
order is missed during a drop.
Files: src/ws/client.ts, src/ws/reconnect.ts
Ran: Test run: pnpm test
cdb is a shorter alias for all of them.
| Command | What it does |
|---|---|
claude-db install [--project] |
Register hooks and the MCP server |
claude-db uninstall [--project] |
Remove them, keeping your memory |
claude-db status |
Is it wired up, and when did it last record anything |
claude-db doctor [--deep] |
Resolved config; --deep proves a full round trip |
claude-db search [--all] [--tag <name>] <query> |
Search this project's memory, or every project |
claude-db remember [--key <name>] <text> |
Record a rule outright, e.g. "always use pnpm here" |
claude-db forget <id> |
Delete specific observations by id |
claude-db seed --from-git |
Fill a cold memory from this repo's history |
claude-db usages [--regex] <symbol> |
Find real usages via git grep, live — not a stored index |
claude-db stats |
What this project's memory is made of |
claude-db projects |
Every project with memory stored |
claude-db merge [<path>] |
Move memory from an old project path onto this one |
claude-db use <url> |
Switch database and verify it |
claude-db sync <url> |
Two-way merge with another database |
claude-db flush |
Re-ingest every transcript for this project |
claude-db export [--all] |
Dump memory as JSONL, for backup or migration |
claude-db import <file> |
Load a dump back in; safe to repeat |
claude-db reembed |
Re-embed everything with the current model |
claude-db prune --older-than <days> |
Delete old memory (dry run without --yes) |
claude-db reset [--project] --yes |
Delete memory (dry run without --yes) |
Install also adds a /cdb-scan skill: run it once on an existing project and
Claude surveys the codebase into memory — stack, layout, conventions,
workflows — so search has something to find before you have any history. Those
notes are tagged inferred, because they are a reading of the code rather than
a record of what happened.
--project scopes to one repo instead of every project on the machine. It
writes .claude/settings.local.json and .mcp.json — add .mcp.json to your
.gitignore, since it holds a machine-specific path.
SQLite by default, at ~/.claude-memory/memory.db. No setup, no network.
Only needed if you want memory shared across machines:
claude-db use "mongodb+srv://user:pass@cluster.mongodb.net/memory"
claude-db use "postgres://user:pass@host:5432/memory"
The connection string picks the backend. Install the driver you need
(npm install mongodb or pg); neither ships by default. CLAUDE_DB_URL
overrides the config file if you prefer an env var.
Search is hybrid — keyword plus vector — on all three. Memory is partitioned by project path, so one database serves every repo you work in.
Node 22.5 or newer. That's the only hard requirement: SQLite comes from Node's
builtin node:sqlite, so nothing compiles at install time.
Embeddings run locally with a zero-dependency embedder. For real semantic
search, npm install @xenova/transformers and it upgrades itself.
Nothing leaves your machine unless you point it at a remote database.
.env, secrets/, node_modules and .git/ are never stored, text wrapped
in <private>...</private> is stripped, and API keys and tokens are redacted
before anything is written.
npm install
npm run build
npm test # 87 checks
npm run try # simulate a session, touches nothing
Releases publish from CI on a version tag:
npm version patch
git push --follow-tags
Apache-2.0