Sochdb
SochDB is a high-performance embedded, ACID-compliant vector database purpose-built for AI agents and memory
Install / Use
/learn @sochdb/SochdbREADME
What is SochDB?
SochDB is a single database that replaces your vector DB + relational DB + prompt packer stack. Store structured data, embeddings, and conversation history together—then ask SochDB to assemble token-optimized context for your LLM.
Comparison
Database + retrieval layer
| Feature | SochDB | SQLite + vec | Postgres + pgvector | Chroma | LanceDB | |---------|--------|--------|----------------------|--------|---------| | Embedded | ✅ | ✅ | ❌ | ✅ | ✅ | | Vector search | ✅ HNSW | ⚠️ (via extension) | ✅ (HNSW / IVFFlat) | ✅ | ✅ | | Full SQL (user-facing) | ✅ SQL-92 | ✅ | ✅ | ❌ | ✅ | | Hybrid search (vector + keyword) | ✅ | ⚠️ (DIY) | ⚠️ (DIY) | ⚠️ (limited) | ✅ | | Context builder | ✅ | ❌ | ❌ | ❌ | ❌ | | Token budgeting | ✅ | ❌ | ❌ | ❌ | ❌ | | Graph overlay | ✅ | ❌ | ❌ | ❌ | ❌ | | ACID transactions | ✅ | ✅ | ✅ | ⚠️ (limited) | ❌ | | Columnar storage | ✅ | ❌ | ❌ | ❌ | ✅ |
Memory / agent-memory layer
| Feature | SochDB | Mem0 | Letta | Graphiti | |--------|--------|------|-------|----------| | Primary focus | DB + retrieval + context | Memory layer | Agent framework + memory | Temporal knowledge-graph memory | | Long-term memory primitives | ✅ | ✅ | ✅ | ✅ | | Token-aware context budgeting | ✅ | ❌ | ❌ | ❌ | | Graph-based memory | ✅ | ❌ | ❌ | ✅ | | Built-in vector store | ✅ | ❌ (BYO) | ❌ (BYO) | ❌ (BYO) | | Built-in agent runtime | ❌ | ❌ | ✅ | ❌ | | Drop-in “memory add-on” to existing apps | ✅ | ✅ | ⚠️ | ✅ |
Quick links: 📚 Documentation • Quick Start • Architecture • TOON Format • Benchmarks • RFD
Why SochDB?
❌ The Typical AI Agent Stack
┌─────────────────────────────────────────────────────────────────────────────────┐
│ YOUR APPLICATION │
└───────┬─────────────────┬─────────────────┬─────────────────┬───────────────────┘
│ │ │ │
▼ ▼ ▼ ▼
┌───────────────┐ ┌───────────────┐ ┌───────────────┐ ┌───────────────────────────┐
│ Postgres │ │ Pinecone │ │ Redis │ │ Custom Code │
│ (metadata) │ │ (vectors) │ │ (sessions) │ │ (context assembly) │
│ │ │ │ │ │ │ │
│ • User data │ │ • Embeddings │ │ • Chat state │ │ • Token counting │
│ • Settings │ │ • Similarity │ │ • Cache │ │ • Truncation logic │
│ • History │ │ search │ │ • Temp data │ │ • Prompt packing │
│ │ │ │ │ │ │ • Multi-source fusion │
└───────────────┘ └───────────────┘ └───────────────┘ └───────────────────────────┘
│ │ │ │
└─────────────────┴─────────────────┴─────────────────┘
│
┌───────────────┴───────────────┐
│ 😰 You manage all of this: │
│ • 4 different query languages │
│ • 4 sets of credentials │
│ • 4 failure modes │
│ • No cross-system transactions│
│ • Weeks of glue code │
└───────────────────────────────┘
✅ With SochDB
┌─────────────────────────────────────────────────────────────────────────────────┐
│ YOUR APPLICATION │
└─────────────────────────────────────┬───────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────┐
│ SochDB │
│ │
│ SQL + Vectors + Context Builder │
│ │
│ • One query language │
│ • One connection │
│ • ACID transactions │
│ • Token budgeting built-in │
│ │
└─────────────────────────────────────┘
│
┌─────────────────┴─────────────────┐
│ 😎 What you actually ship: │
│ • Single ~700KB embedded DB │
│ • Zero external dependencies │
│ • Works offline │
│ • Deploys anywhere │
└───────────────────────────────────┘
The Problem → Solution
| Challenge | Traditional Stack | SochDB | |-----------|------------------|--------| | Token waste | JSON/SQL bloat in prompts | TOON format for dense output | | RAG plumbing | Separate vector DB + glue code | Built-in HNSW with hybrid search | | Context assembly | Custom packer per use case | One query with token budget | | I/O overhead | Multiple DB round-trips | Single columnar read | | Consistency | Distributed transaction headaches | Local ACID guarantees | | Deployment | Manage 4 services | Single binary, embed anywhere |
Key Features
🧠 Context Query Builder — Assemble system + user + history + retrieval under a token budget
🔍 Hybrid Search — HNSW vectors + BM25 keywords with reciprocal rank fusion
🕸️ Graph Overlay — Lightweight relationship tracking for agent memory
⚡ Embedded-First — ~700KB binary, no runtime dependencies, SQLite-style simplicity
🔒 Full ACID — MVCC + WAL + Serializable Snapshot Isolation
📊 Columnar Storage — Read only the columns you need
Why SochDB exists
Most "agent stacks" still glue together:
- a KV store (sessions / state)
- a vector DB (retrieval)
- a prompt packer (context budgeting, truncation)
- a relational DB (metadata)
…and then spend weeks maintaining brittle context assembly and token budgeting.
SochDB collapses that stack into one LLM‑native substrate: you store structured data + embeddings + history and ask the DB to produce a token‑efficient context payload.
What you can rely on today
✅ LLM + agent primitives
- TOON: compact, model-friendly output for context windows
- Graph Overlay: lightweight agent-memory graph with BFS/DFS traversal and relationship tracking
- ContextQuery builder: token budgets, deduplication, and multi-source fusion
- Policy hooks: safety controls with pre-built policy templates and audit trails
- Tool routing: multi-agent coordination with dynamic discovery and load balancing
- Hybrid retrieval: vector + BM25 keyword with Reciprocal Rank Fusion (RRF)
- Multi-vector documents: chunk-level aggregation (max / mean / first)
- Vector search (HNSW): integrated into retrieval workflows
✅ Database fundamentals
- SQL (SQL-92): SELECT / INSERT / UPDATE / DELETE / JOINs
- AST-based query executor: unified SQL processing with dialect normalization
- Multi-dialect compatibility: MySQL, PostgreSQL, SQLite
- Idempotent DDL:
CREATE TABLE IF NOT EXISTS,DROP TABLE IF EXISTS
- ACID transactions with MVCC
- WAL durability + group commit
- Serializable Snapshot Isolation (SSI)
- Columnar storage with projection pushdown (read only the columns you need)
- Sync-first architecture: async runtime (tokio) is optional
- ~500KB smaller binaries for embedded use cases
- Follows SQLite-style design for maximum compatibility
✅ Developer experience
- Rust client:
sochdb - Python & Nodejs & Golang SDK with:
- Embedded mode (FFI) for lowest latency
- IPC mode (Unix sockets) for multi-process / service deployments
- Namespace isolation for multi-tenant apps
- Typed error taxonomy with remediation hints
- Bulk vector operations for high-throughput ingestion
- BatchAccumulator: deferred graph construction — 4–5× faster inserts via zero-FFI numpy accumulation + single bulk Rayon-parallel HNSW build
Known limits
- Single-node only (no replication / clustering yet)
SochDB in one picture
| Problem | Typical approach | SochDB approach | | ----------------- | ------------------------------ | ----------------------------------- | | Token waste | JSON/SQL payload bloat | TOON: dense, table-like output | | RAG plumbing | External vector DB + glue | Built-in HNSW + quantization | | Context assembly | multiple reads + custom packer | One context query with a budget | | I/O amplification | row store reads all columns | columnar + projection pushdown |
📦 Quick Start
Installation
Choose your preferred SDK:
# Rust - add to Cargo.toml
sochdb = "0.2"
SDK Repositories
Language SDKs are maintained in separate packages and repos with their own release cycles:
| Language | Repository | Installation |
|----------|------------|-------------|
| Python | sochdb-python/ | pip install sochdb |
🐳 Docker Deployment
SochDB includes a production-ready Docker setup with gRPC server:
# Pull and run from Docker Hub
docker pull sushanth53/sochdb:latest
docker run -d -p 50051:50051 sushanth53/sochdb:latest
# Or use docker-compose
cd docker
docker compose up -d
Docker Hub: [sushanth53/sochdb](https://hub
