Make analytics context usable by agents
ktx is an open-source context layer for data agents. It turns warehouse metadata, BI tool definitions, query history, docs, and approved metric definitions into reviewable files agents can search and execute.
Why ktx helps
ktx gives agents a shared context workspace before they write SQL, answer a question, or update analytics definitions.
- Context as code. ktx writes wiki pages and semantic-layer definitions as git-based files you can review, diff, and merge.
- Self-improving ingest. ktx reads warehouses, BI tools, modeling code, query history, and notes, then reconciles new evidence with accepted context.
- Executable semantics. Agents can use approved measures, joins, filters, dimensions, and segments instead of rebuilding canonical SQL from scratch.
- Agent-native access. CLI and MCP tools let agents search context, compile semantic queries, run read-only SQL, and propose updates.
ktx complements existing semantic layers by pairing metric definitions with the surrounding business knowledge, caveats, provenance, and review workflow agents need for data work.
How ktx works
ktx has two connected sides: it builds and maintains the context layer, then serves that context to agents at runtime.
| Side | What ktx does |
|---|---|
| Ingest and auto-maintain knowledge | Reads your data stack and company knowledge, reconciles new evidence with accepted context, and keeps changes to semantic-layer/ plus wiki/ as version-controlled diffs automatically. |
| Serve agents at runtime | Helps agents find the right wiki pages and semantic-layer entities, then compile or execute semantic queries through CLI and MCP tools. |
How ingestion works
ktx ingests source evidence, reconciles it with your existing project, and produces durable context that agents can search, review, and execute.
Ingestion flow
From scattered source systems to agent-ready context
The inputs can be structured systems or loose team knowledge. The outputs are the two files agents need: a readable wiki and an executable semantic layer.
Use it for
Use ktx when agents need more than raw database access. Agents can search wiki context, find semantic-layer entities, compile trusted semantic queries, run read-only SQL, and use the same tools through MCP.
- Generate SQL from approved metrics, joins, filters, and dimensions.
- Explain metric provenance with wiki content and source evidence.
- Repair context through reviewable YAML and Markdown diffs.
- Work alongside dbt, MetricFlow, LookML, Looker, Metabase, Notion, and supported databases.
Start here
Choose the route that matches what you want to do next. The quickstart is the best first step for users; contributor setup lives in the community docs.
Quickstart
Install ktx, run setup, build context, and connect an agent.
The Context Layer
Understand why agents need more than schema access and raw SQL.
Building Context
Refresh context from databases, BI tools, query history, and documents.
Writing Context
Edit semantic-layer YAML and wiki Markdown safely.
CLI Reference
Complete flag and subcommand reference for every ktx command.
Agent Quickstart
Machine-readable docs and agent-facing setup notes.
Community
Have questions, want to share what you're building, or chat with maintainers? Join the ktx Slack community. For bug reports and feature requests, open a GitHub issue. See Community & Support for the full guide on where to ask what.