Claude Code Plugin
Agent-native memory, state, and logging for Claude Code — via 9 MCP tools. Persistent, scoped memory that survives across sessions. No signup, no API key.
Same db0 database accessible from CLI, web inspector, OpenClaw, or any TypeScript project. db0 and CLAUDE.md are complementary: CLAUDE.md for static project rules, db0 for dynamic knowledge that accumulates over time.
Quick start
Run in Claude Code:
claude mcp add --transport stdio db0 -- npx -y @db0-ai/claude-codeOr add to your project's .mcp.json:
{
"mcpServers": {
"db0": {
"command": "npx",
"args": ["-y", "@db0-ai/claude-code"]
}
}
}9 MCP tools immediately. No signup, no API key. Persistent SQLite at ~/.claude/db0.sqlite.
/plugin marketplace add db0-ai/db0 /plugin install db0@db0-ai-db0
Adds MCP tools plus skills (/db0:inspect, /db0:ingest) and hooks.
db0_.What you get
Out of the box, with no further configuration.
MCP Tools
All 9 tools are available to Claude Code immediately after installation.
| Tool | Description |
|---|---|
| db0_memory_write | Store a fact with scope, tags, summary, and optional superseding |
| db0_memory_search | Semantic search across memories with scope/tag filtering |
| db0_memory_list | List memories by scope |
| db0_memory_get | Get a specific memory by ID |
| db0_memory_delete | Delete a memory |
| db0_memory_stats | Memory statistics by scope and status |
| db0_state_checkpoint | Create a state checkpoint |
| db0_state_restore | Restore the most recent checkpoint |
| db0_log_query | Query structured log entries |
Memory superseding in action
When facts change, old memories are preserved but excluded from search. Full audit trail.
You: "remember I prefer dark mode" db0_memory_write({ content: "User prefers dark mode", scope: "user" }) You: "actually I switched to light mode" db0_memory_search("dark mode preference") // finds old memory db0_memory_write({ content: "User prefers light mode", scope: "user", supersedes: "<old-id>" })
Memory scopes
4 scopes with different lifetimes. The right scope means the right persistence.
| Scope | Lifetime | Example |
|---|---|---|
| user | Permanent, cross-session | Preferences, decisions, personal context |
| agent | Permanent, all sessions | Agent-specific patterns, learned behaviors |
| session | Current session | In-progress decisions, temporary context |
| task | Current task | Scratch work, intermediate results |
Cross-device memory with Postgres
For memory that syncs across machines, point to any hosted Postgres with pgvector.
{
"mcpServers": {
"db0": {
"command": "npx",
"args": ["-y", "@db0-ai/claude-code"],
"env": {
"DB0_STORAGE": "postgresql://user:pass@your-host/db0"
}
}
}
}Configuration
Environment variables for the MCP server.
| Variable | Default | Description |
|---|---|---|
| DB0_STORAGE | ~/.claude/db0.sqlite | Storage path. Use a PostgreSQL connection string for cross-device sync. |
| DB0_AGENT_ID | claude-code | Agent identifier for scoping memories. |
How it fits
The plugin is an MCP server that wraps the db0 harness. Same SDK, same database, different entry point.
Claude Code │ │ MCP protocol (stdio) │ ▼ db0 MCP Server (@db0-ai/claude-code) │ ├── memory tools → db0 harness → memory() ├── state tools → db0 harness → state() └── log tools → db0 harness → log() │ ▼ SQLite (local) or PostgreSQL + pgvector (cloud)
How it compares
db0 vs. other Claude Code memory solutions.
| db0 | total-recall | Nemp | MemoryGraph | mem0 | CLAUDE.md | |
|---|---|---|---|---|---|---|
| Storage | SQLite / Postgres | Unknown (tiered) | JSON files | SQLite / Neo4j | Vector DB (cloud) | Plain text |
| Semantic search | Yes (built-in embeddings) | Unknown | Term expansion | Fuzzy matching | Yes (LLM-powered) | grep only |
| Memory scopes | 4 (task/session/user/agent) | Tiered | Flat | Flat | 3 (user/session/agent) | None |
| Superseding | Yes (audit trail) | Correction propagation | No | No | No | Overwrites |
| State management | Checkpoints + branching | No | No | No | No | No |
| Structured logging | Yes | No | No | No | No | No |
| Requires LLM | No | Unknown | No | No | Yes | No |
| Requires account | No | No | No | No | Yes | No |
| Cross-device sync | Yes (Postgres) | No | No | No | Yes (cloud) | git |
| L0 summaries | Yes (auto-generated) | No | No | No | No | No |
Part of the db0 ecosystem
The same memory database is compatible with every db0 package.