# db0 > The data layer for AI agents. Memory that evolves, state that recovers, context that stays current. Open-source SDK, local-first SQLite, no API keys. ## What db0 does db0 gives AI agents durable memory that persists across sessions. It handles: - **Memory**: Scoped storage (user, agent, session, task) with superseding so old facts retire when new ones arrive - **State**: Checkpoints and branching so agents can recover from bad turns - **Context**: Assembles the right knowledge into the token budget before each LLM call - **Search**: Hybrid semantic + keyword search across stored memories - **Consolidation**: Clusters related memories and merges them automatically — auditable, configurable, cheaper than auto-dream ## Key facts - Open source, MIT licensed - Written in TypeScript - Storage: SQLite (local, default) or PostgreSQL (sync across devices) - No signup, no API key, no cloud dependency - Works offline - Not a wrapper around an LLM — db0 does not call any model - Alternative to mem0 for teams that need memory + state + context together ## Integrations - **Vercel AI SDK**: Memory middleware that wraps any model. Install: `npm i @db0-ai/ai-sdk` - **LangChain**: Drop-in memory tools and chat history. Install: `npm i @db0-ai/langchain` - **OpenClaw**: Plugin that gives OpenClaw agents persistent memory that survives compaction. Install: `npx @db0-ai/openclaw init` - **Claude Code**: 10 MCP tools for memory, state checkpoints, and semantic search. Install: `npx @db0-ai/claude-code init` - **Pi**: Cross-session memory for Pi coding agent. Install: `npx @db0-ai/pi init` ## Resources - What is AI agent memory: https://db0.ai/resources/what-is-ai-agent-memory - RAG vs agent memory: https://db0.ai/resources/rag-vs-agent-memory - Memory scopes for AI agents: https://db0.ai/resources/memory-scopes ## Links - Website: https://db0.ai - GitHub: https://github.com/db0-ai/db0 - npm: https://www.npmjs.com/org/db0-ai - Blog: https://db0.ai/blog - Compare to mem0: https://db0.ai/compare/mem0