ktx auto-builds a context layer from your data stack and compiles accurate SQL. Your team reviews it. Agents query it. Interactions continuously improve it.
Trusted by data teams at scaling companies
Why data agents fail
ktx gives agents the business context, metric definitions, and approved logic they need to answer consistently.
agent receives question
warehouse returns rows
Result
Wrong answer.
Burns tokens.
agent receives question
warehouse returns rows
Result
Trusted answer.
Same logic every time.
Governed agent context
ktx gives data agents business context and approved metric definitions,plus the relationships they need to answer accurately.
Agents see definitions, caveats, policies, and team language before they answer.
Agents ask what to measure; ktx plans grain, joins, filters, and governed SQL.
Expose the same approved context to Claude Code, Codex, Cursor, and custom MCP agents.
How ktx works
ktx turns source evidence into reviewable context files, then serves them to agents through CLI and MCP.
Build loop
ktx reads your warehouse, BI layer, modeling code, query history, and docs, then turns new evidence into proposed context updates.
Runtime loop
Agents use the CLI or MCP server to search the wiki, find approved semantic entities, compile queries, and run read-only SQL.
Review loop
Every durable update is a YAML or Markdown diff. Your team can inspect it, adjust it, and merge it through git.
Databases
Schemas, columns, relationships, and query history.
BI tools
Dashboards, explores, usage, and trusted examples.
Modeling code
dbt, LookML, MetricFlow, joins, and existing metrics.
Docs and notes
Policies, caveats, analyst notes, and team definitions.
ktx
Context builder
wiki/*.md
Readable definitions, caveats, policies, provenance, and source notes that agents can search before answering.
semantic-layer/*.yaml
Measures, dimensions, joins, filters, and segments that ktx can validate and compile into SQL.
Agent runtime
agent request
The agent sends ktx the business question plus the metrics it needs.
context lookup
ktx reads the wiki and metric definitions, resolves grain, joins, filters, and entities.
validated SQL
ktx compiles a read-only query, executes it, and sends rows to the agent.
Built for data teams
Scale ktx into a governed company-wide context layerwithout running the infrastructure yourself.
Integrations
Connect your warehouse, semantic layer, BI, docs, and business tools,
with 900+ more connectors rolling out soon.
FAQ
ktx is an open-source context layer for data agents that makes them much more accurate at querying data warehouses. It gives agents the business context, approved metric definitions, joinable columns, warehouse metadata, and query history they do not get from direct warehouse access. It also includes a query engine, so agents can query through ktx instead of writing SQL from scratch.
Yes. ktx is open source under the Apache 2.0 license. There are no usage limits. You run it yourself with your own LLM API keys.
Run npm install -g @kaelio/ktx, then run ktx setup from your project directory. You can also ask Claude Code, Codex, Cursor, or another coding agent to install and configure ktx for you by giving it the prompt from the ktx quickstart. Setup creates a ktx project, connects your warehouse and context sources, builds context, and can install agent integrations. ktx requires Node.js 22 or newer.
A direct warehouse MCP connector usually gives an agent access to tables, columns, and SQL execution. ktx gives the agent a query engine plus reviewable metric definitions, a mapped join graph that resolves chasm and fan traps, a wiki of business context, and the source evidence behind every definition.
ktx gives agents approved context before they write or run SQL. Agents can search the wiki, find semantic-layer entities, compile governed metric queries, and run read-only SQL through configured connections. This reduces repeated schema exploration, incorrect joins, and invented metric logic.
ktx runs locally. Your warehouse data stays in your warehouse, and local state and secrets stay in the git-ignored .ktx directory. Your LLM provider sees whatever context or query content your agent sends to it, the same as any other agent connected to your data.
ktx stores shareable context in plain files: ktx.yaml, semantic-layer YAML, and Markdown wiki pages. Those files can be reviewed in git. Local runtime state, credentials, caches, and secrets live under .ktx and should stay out of git.
ktx includes its own semantic layer, but it is built to be flexible and agent-native: agents can search, read, patch, and validate context through files, CLI, and MCP. Compared with standalone semantic-layer tools, ktx adds business context, source evidence, warehouse metadata, query history, and a reviewable wiki around the semantic model.
No. ktx complements the tools you already use. It can ingest dbt, MetricFlow, LookML, Looker, Metabase, Notion, warehouse metadata, and query history, then expose that context to agents. Your existing transformations, dashboards, and BI workflows stay in place.
No. ktx consumes dbt instead of replacing it. If you use dbt, ktx can ingest your models, metric definitions, and documentation into its context layer so agents can use that governed logic directly. If you don't use dbt, ktx can still build context from your warehouse schemas, BI tools, documentation, and query history.
ktx is the open-source engine. You run it yourself, locally, with your own LLM keys. ktx Cloud is the hosted version. Same engine, plus hosted runtime, multi-user workspace, review and approval workflows, SSO, continuous ingest, observability, and included LLM credits.
ktx works with Claude Code, Claude Desktop, Codex, Cursor, OpenCode, generic .agents clients, and any custom MCP-compatible agent your team builds. ktx exposes an MCP server and a CLI, so any agent that speaks MCP can use it.
Warehouses: PostgreSQL, Snowflake, BigQuery, MySQL, SQL Server, SQLite, and many more. Modeling and BI: dbt, MetricFlow, LookML, Looker, Metabase, and many more. Documentation: Notion and many more.
Yes. ktx is built around reviewable context files. Agents can propose updates to semantic-layer YAML or wiki Markdown, but your team can inspect, validate, and approve those changes through normal code review before they become trusted context.
ktx is open source. Issues, pull requests, and discussions are welcome on the GitHub repository.
Get Started
Auto-built. Governed by your team. Ready for any agent.