Use Cases/Claude Code
v0.1@db0-ai/claude-code

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

Option A: MCP Server (fastest)

Run in Claude Code:

claude mcp add --transport stdio db0 -- npx -y @db0-ai/claude-code

Or 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.

Option B: Full Plugin (tools + skills + hooks)
/plugin marketplace add db0-ai/db0
/plugin install db0@db0-ai-db0

Adds MCP tools plus skills (/db0:inspect, /db0:ingest) and hooks.

Verify it works: ask Claude "what db0 tools do you have?" — it should list 9 tools starting with db0_.

What you get

Out of the box, with no further configuration.

9 MCP tools
Full memory CRUD, semantic search, state checkpoints, and structured logging — all via standard MCP protocol.
Persistent storage
SQLite at ~/.claude/db0.sqlite. Survives restarts, survives sessions. Your agent accumulates knowledge over time.
Scoped memory
4 scopes (task/session/user/agent) with different lifetimes. User preferences persist forever; task scratch work stays temporary.
Memory superseding
When facts change, old memories are marked superseded, not deleted. Full audit trail preserved. Search returns only active memories.
Semantic search
Built-in hash embeddings, zero API calls, zero config. Similarity + scope filtering in a single search call.
L0 summaries
Auto-generated one-line summaries for token-efficient recall. More memories fit into the context window.
State checkpoints
Save and restore execution progress. Pick up where you left off across sessions.
Skills
/db0:inspect to browse memories, /db0:ingest to store facts. Natural language interface on top of MCP tools.

MCP Tools

All 9 tools are available to Claude Code immediately after installation.

ToolDescription
db0_memory_writeStore a fact with scope, tags, summary, and optional superseding
db0_memory_searchSemantic search across memories with scope/tag filtering
db0_memory_listList memories by scope
db0_memory_getGet a specific memory by ID
db0_memory_deleteDelete a memory
db0_memory_statsMemory statistics by scope and status
db0_state_checkpointCreate a state checkpoint
db0_state_restoreRestore the most recent checkpoint
db0_log_queryQuery structured log entries

Memory superseding in action

When facts change, old memories are preserved but excluded from search. Full audit trail.

Claude Code session
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.

ScopeLifetimeExample
userPermanent, cross-sessionPreferences, decisions, personal context
agentPermanent, all sessionsAgent-specific patterns, learned behaviors
sessionCurrent sessionIn-progress decisions, temporary context
taskCurrent taskScratch work, intermediate results

Cross-device memory with Postgres

For memory that syncs across machines, point to any hosted Postgres with pgvector.

.mcp.json
{
  "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.

VariableDefaultDescription
DB0_STORAGE~/.claude/db0.sqliteStorage path. Use a PostgreSQL connection string for cross-device sync.
DB0_AGENT_IDclaude-codeAgent 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.

db0total-recallNempMemoryGraphmem0CLAUDE.md
StorageSQLite / PostgresUnknown (tiered)JSON filesSQLite / Neo4jVector DB (cloud)Plain text
Semantic searchYes (built-in embeddings)UnknownTerm expansionFuzzy matchingYes (LLM-powered)grep only
Memory scopes4 (task/session/user/agent)TieredFlatFlat3 (user/session/agent)None
SupersedingYes (audit trail)Correction propagationNoNoNoOverwrites
State managementCheckpoints + branchingNoNoNoNoNo
Structured loggingYesNoNoNoNoNo
Requires LLMNoUnknownNoNoYesNo
Requires accountNoNoNoNoYesNo
Cross-device syncYes (Postgres)NoNoNoYes (cloud)git
L0 summariesYes (auto-generated)NoNoNoNoNo

Part of the db0 ecosystem

The same memory database is compatible with every db0 package.

@db0-ai/core
Core SDK — use db0 programmatically in any TypeScript project
@db0-ai/plugins-openclaw
OpenClaw ContextEngine plugin for full context lifecycle
@db0-ai/inspector
Web UI for browsing memory, state, and logs
@db0-ai/cli
CLI for memory operations (list, search, stats, export, import)
← All use cases