ClawDB
________ ____ ____
/ ____/ /___ ___ __/ __ \/ __ )
/ / / / __ `/ / | /| / / / / / __ |
/ /___/ / /_/ / /| |/ |/ / /_/ / /_/ /
\____/_/\__,_/ / |__/|__/_____/_____/
The cognitive database for AI agents.
ClawDB is a production-grade memory runtime that unifies durable storage, semantic retrieval, branch/merge workflows, synchronization, reflection pipelines, and policy governance in one API and one operational surface.
Features
| Capability | Status | Description |
|---|---|---|
Storage (claw-core) |
✅ | Durable, queryable memory with SQLite-backed persistence |
Semantic Memory (claw-vector) |
✅ | Embedding-powered retrieval and approximate nearest-neighbor search |
Sync (claw-sync) |
✅ | Hub-based and peer-oriented memory synchronization |
Branching (claw-branch) |
✅ | Snapshot/fork/merge semantics for experimentation and replay |
Reflection (claw-reflect) |
✅ | Automated distillation, summarization, and memory curation jobs |
Governance (claw-guard) |
✅ | Role and policy enforcement, scoped sessions, and access control |
Workspace Crates
ClawDB is a multi-crate workspace. Each crate has a focused responsibility and can be consumed independently when needed.
| Crate | Type | Purpose | Main Artifact |
|---|---|---|---|
clawdb |
Library + bin | Unified runtime facade over memory, search, branch, sync, and guard | libclawdb + clawdb |
clawdb-server |
Binary + lib | Network server exposing HTTP + gRPC APIs and metrics | clawdb-server |
clawdb-cli |
Binary | Pure HTTP client for operational and developer workflows | clawdb / clawdb-cli |
clawdb (Runtime API)
The clawdb crate is the top-level API for embedding ClawDB in Rust applications.
- Exposes session-oriented methods (
session,validate_session,revoke_session) - Exposes memory methods (
remember,remember_typed,search,recall) - Exposes branch methods (
branch,fork_branch,merge,diff,list_branches) - Exposes sync/reflect entrypoints (
sync,reflect) - Exposes health and telemetry hooks (
health,metrics_handle)
Primary path in this repo: clawdb/src.
clawdb-server (HTTP + gRPC Surface)
The clawdb-server crate hosts the runtime as network services.
- HTTP API for clients and automation
- gRPC API with reflection support
- Prometheus metrics endpoints
- Config-driven startup with env overrides
Primary paths in this repo:
clawdb-server/src/httpclawdb-server/src/grpcclawdb-server/src/state.rs
clawdb-cli (Pure HTTP Client)
The clawdb-cli crate is intentionally decoupled from runtime internals.
- Talks to
clawdb-serverover HTTP only - No direct linkage to component crates at call time
- Supports table/json/tsv output modes
- Includes commands for init, status, remember/search/recall, branches, sync, reflect, policy, config, session, completion
Primary path in this repo: clawdb-cli/src.
This design keeps the CLI small and stable while allowing server/runtime internals to evolve independently.
Quick Start
- Add the crate:
- Use ClawDB in your app:
use *;
async
- Run:
Expected output includes: It works: <n> result(s).
Installation
From crates.io
From binary releases
Download artifacts from GitHub Releases and add clawdb, clawdb-cli, and clawdb-server to your PATH.
From Docker
Architecture
┌─────────────────────┐
│ ClawDB │
│ Unified Runtime │
└──────────┬──────────┘
┌─────────────────────┼─────────────────────┐
│ │ │ │ │
┌────▼───┐ ┌─────▼───┐ ┌──▼─────┐ ┌─▼──────┐ ┌──▼──────┐ ┌──▼────┐
│ core │ │ vector │ │ sync │ │ branch │ │ reflect │ │ guard │
└────────┘ └─────────┘ └────────┘ └────────┘ └─────────┘ └───────┘
API Reference
Primary engine methods:
async fn new(config: ClawDBConfig) -> ClawDBResult<ClawDB>async fn open_default() -> ClawDBResult<ClawDB>async fn open(data_dir: &Path) -> ClawDBResult<ClawDB>async fn session(agent_id: Uuid, role: &str, scopes: Vec<String>) -> ClawDBResult<ClawDBSession>async fn remember(session: &ClawDBSession, content: &str) -> ClawDBResult<RememberResult>async fn remember_typed(session: &ClawDBSession, content: &str, memory_type: &str, tags: &[String], metadata: serde_json::Value) -> ClawDBResult<RememberResult>async fn search(session: &ClawDBSession, query: &str) -> ClawDBResult<Vec<serde_json::Value>>async fn search_with_options(session: &ClawDBSession, query: &str, top_k: usize, semantic: bool, filter: Option<serde_json::Value>) -> ClawDBResult<Vec<serde_json::Value>>async fn recall(session: &ClawDBSession, memory_ids: &[String]) -> ClawDBResult<Vec<serde_json::Value>>async fn branch(session: &ClawDBSession, name: &str) -> ClawDBResult<Uuid>async fn merge(session: &ClawDBSession, source: Uuid, target: Uuid) -> ClawDBResult<serde_json::Value>async fn sync(session: &ClawDBSession) -> ClawDBResult<serde_json::Value>
Additional methods include diff, reflect, validate_session, revoke_session, health, close, shutdown, and transaction.
Configuration Reference
Top-level ClawDBConfig fields:
data_dir(CLAW_DATA_DIR)workspace_id(CLAW_WORKSPACE_ID)agent_id(CLAW_AGENT_ID)log_level(CLAW_LOG_LEVEL)log_format(CLAW_LOG_FORMAT)corevectorsyncbranchguardreflectserverpluginstelemetry
CLI Reference
Commands:
clawdb initclawdb startclawdb statusclawdb rememberclawdb searchclawdb branchclawdb syncclawdb reflectclawdb policyclawdb config
Examples:
Plugin Development Guide
Implement ClawPlugin from clawdb::plugins::interface and provide a plugin manifest:
= "my_plugin"
= "0.1.0"
= "Example ClawDB plugin"
= ["ReadMemory", "EmitEvents"]
= "create_plugin"
Build as dynamic library and place under plugins_dir.
Deployment Guide
Docker Compose Quick Start
Kubernetes
Ecosystem
| Crate | Role | Version |
|---|---|---|
claw-core |
Durable storage | |
claw-vector |
Semantic retrieval | |
claw-sync |
Synchronization | |
claw-branch |
Branch/merge runtime | |
claw-guard |
Governance and access control | |
clawdb |
Unified runtime API |