Ctxdb

•

Stores and retrieves structured context for Large Language Models, optimizing for relevance and token budget.

Ctxdb is a specialized context database designed for Large Language Models (LLMs), enabling them to store information structurally and retrieve only the most relevant pieces for a given query. It goes beyond simple text dumps by segmenting context into semantic layers with distinct expiry rules and employing a hybrid retrieval approach that combines lexical (BM25) and semantic (vector KNN) search, fused with RRF for optimal ranking. Running on Python and SQLite, it seamlessly integrates with Claude as an MCP server, offering robust memory management, structured facts, and token-budgeted context packing to enhance LLM performance and reduce hallucination.

主な機能

01Token-budgeted context packing to return the most relevant material within limits
02Direct integration with Claude as an MCP server, exposing nine specialized tools
03Layered context storage (facts, chunks, notes) with distinct semantics and expiry rules
04SQLite-based local database with multi-agent support for concurrent use
05Hybrid retrieval combining BM25 and vector search, fused with RRF for optimal ranking
060 GitHub stars

ユースケース

01Ingest and query extensive documentation or specifications for AI assistants
02Manage evolving data like decisions or preferences for persistent LLM knowledge
03Enhance LLM long-term memory with structured facts and documents