dbctx
Compile a PostgreSQL database into compact, queryable context.
dbctx is a Go library and CLI tool that compiles a PostgreSQL database into a portable, queryable context index (.dtx file). It extracts schema, relationships, field semantics, representative values, JSONB structure, and builds a full-text search index — all from deterministic introspection, statistics, and heuristics, with no generative LLM and no external services required for the core index. It also supports an optional local semantic embedding signal and an optional, user-controlled terminology dictionary — both additive, both off-by-default-cost, described below.
Use it to give text-to-SQL systems, AI agents, and database-aware applications a compact, relevant slice of your database schema at query time, instead of dumping the entire information_schema into every prompt.
Key features:
- Natural-language query — find relevant tables, columns, and relationships from a text question
- Semantic retrieval (optional, on by default) — a local embedding model (BGE-small-en-v1.5, ~33M params…