Facts expire
Bi-temporal storage tracks when facts were true and when the system learned them. Point-in-time queries are first-class.
Memory that knows what it knows, what it doesn't, and why it believes what it does.
Current release
contextdb is currently v0.123.0: usable for serious demos and early integrations, but intentionally pre-1.0 while the public API, deployment modes, and SDK contracts continue to settle.
Zero external dependencies. No Docker. No config files. One go get and you're running. Auto-embedding lets you skip the vector. Just send text.
db := client.MustOpen(client.Options{})
defer db.Close()
ns := db.Namespace("my-app", namespace.ModeGeneral)
ns.Write(ctx, client.WriteRequest{
Content: "Go 1.22 added routing patterns to net/http",
SourceID: "docs-crawler",
})
results, _ := ns.Retrieve(ctx, client.RetrieveRequest{
Text: "What changed in Go 1.22?", TopK: 5,
})from contextdb import ContextDB
db = ContextDB("http://localhost:7701")
ns = db.namespace("my-app", mode="general")
ns.write(content="Go 1.22 added routing patterns", source_id="docs-crawler")
results = ns.retrieve(text="What changed in Go 1.22?", top_k=5)import { ContextDB } from "contextdb";
const db = new ContextDB("http://localhost:7701");
const ns = db.namespace("my-app", "general");
await ns.write({ content: "Go 1.22 added routing patterns", sourceId: "docs-crawler" });
const results = await ns.retrieve({ text: "What changed in Go 1.22?", topK: 5 });# Write
curl -X POST http://localhost:7701/v1/namespaces/my-app/write \
-H "Content-Type: application/json" \
-d '{"content": "Go 1.22 added routing patterns", "source_id": "docs-crawler"}'
# Retrieve
curl -X POST http://localhost:7701/v1/namespaces/my-app/retrieve \
-H "Content-Type: application/json" \
-d '{"text": "What changed in Go 1.22?", "top_k": 5}'Every retrieval result is scored by a weighted combination of four dimensions:
score = w_sim * cosine_similarity(candidate, query)
+ w_conf * confidence
+ w_rec * exp(-alpha * age_hours)
+ w_util * utility_feedbackAll weights are normalised at query time. You supply alpha (decay rate) and the four weights, or use namespace mode defaults.
| Mode | Backend | Use case |
|---|---|---|
| Embedded | In-memory or BadgerDB | Development, testing, sidecars, CLIs |
| Standard | Postgres + pgvector | Production single-node, teams |
| Remote | gRPC to contextdb server | Microservices, multi-language clients |
| Scaled | Qdrant + Redis + Postgres | High-throughput production |
| Mode | Best for | Key weight |
|---|---|---|
belief_system | Fact tracking, poisoning resistance | confidence |
agent_memory | Agentic workflows with task feedback | utility + recency |
general | Balanced RAG, document retrieval | similarity |
procedural | Skill and workflow storage | confidence, slow decay |
| Feature | Description |
|---|---|
| Auto-embedding | Text automatically embedded via OpenAI, local, or custom providers with LRU cache |
| Conflict detection | Near-duplicate scan, contradiction tracking, contradicts edges |
| Credibility learning | Bayesian source trust updates based on validation/refutation |
| Reranking | Optional LLM cross-encoder reranking after fusion |
| AI verification and ranking | End-to-end guide for acquisition dry-runs, provider connectors, retries, receipts, reranking, explain-rank, and dashboard debugging |
| Score breakdown | Weighted similarity, confidence, recency, and utility contributions per result |
| Explain-rank | Compare two nodes and inspect factor deltas that explain the ranking difference |
| GraphQL API | Graph-shaped search, filters, edges, sources, feedback mutations, narratives, and gaps |
| Label filtering | Filter retrieval by node labels |
| Feedback APIs | Validate, refute, mark useful, and mark stale across SDK, REST, gRPC, and GraphQL |
| Claim review queue | Ranked operator tasks with durable workflow decisions and escalation metadata |
| Background workers | Memory consolidation and active recall |
| RBAC | Token-based read/write/admin permissions per tenant |
| Snapshot/restore | NDJSON namespace export and import |
| Backup runbook | Scheduled export, artifact manifest verification, restore rehearsal, promotion receipts, receipt verification, lifecycle summary verification, retention reporting, delete-plan output, manifest indexes, verification, diffs, and metadata publish, backup marker, doctor, and Norn check flow |
| Python SDK | REST client for Python applications |
| TypeScript SDK | REST client for TypeScript/Node.js applications |
| Scaled deployment | Qdrant + Redis + Postgres for high throughput |
| Benchmarks | MTEB, adversarial, LongMemEval, fitness suite |
| Admin UI | Ranking evaluation, metrics, source-trust timelines, and belief debugger on observe port |
| Mini/Norn deployment | Internal live deployment discovery, drift checks, dry-run publish plans, and health checks via Norn |
Features that make AI memory auditable and trustworthy:
| Feature | Description |
|---|---|
| Belief reconciliation | Structured disagreements between agents with evidence chains |
| Narrative retrieval | "Walk me through what you know about X and why" with full citations |
| Knowledge gap detection | "What don't I know?" Sparse region detection with acquisition suggestions |
| Knowledge acquisition planner | Prioritized research, crawl, verification, and refresh tasks from gaps and weak claims, with dry-run-first connector execution and provider adapters |
| Calibration | Brier score, ECE, Platt scaling. Confidence becomes calibrated probability |
| GDPR erasure | Audit-trailed right-to-erasure across graph, vectors, KV, and event log |
| Interference detection | Low-credibility sources can't erode well-established claims |
| Claim federation | Gossip-based multi-instance replication with Beta-space credibility merge |
| Cascade retraction | Non-destructive "I take this back" that cascades through derived claims |
| Active learning | System recommends what information to acquire next |
| Query DSL | Pipe syntax and CQL with temporal, graph, and weight clauses |
Built with Go. No CGO. Single binary. Scratch Docker image.