ktx-ai-data-agents

Build a semantic context layer so AI agents query data warehouses accurately.

7|2|Updated May 16, 2026
One-click install
npx skills add https://github.com/reason-machines/mcp-skills --skill ktx-ai-data-agents-reason-machines
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: ktx-ai-data-agents
Source: https://github.com/reason-machines/mcp-skills/tree/main/skills/ktx-ai-data-agents
Command: npx skills add https://github.com/reason-machines/mcp-skills --skill ktx-ai-data-agents-reason-machines

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires @kaelio/ktx.

What problem does it solve? AI agents often invent incorrect SQL when querying data warehouses because they lack knowledge of approved metric definitions, joinable columns, and business context. ktx solves this by building a searchable context layer combining semantic metrics, wiki knowledge, and warehouse metadata that agents query through MCP tools. ## Core Features & Use Cases - Context Ingestion: Ingests dbt projects, Looker, Metabase, Notion, and wiki content, deduplicating knowledge and flagging contradictions across sources. - Semantic Layer & Search: Builds a join-graph semantic layer over PostgreSQL, Snowflake, BigQuery, ClickHouse, MySQL, SQL Server, and SQLite, with full-text and semantic search via CLI and MCP tools. - Agent Integration: Exposes MCP tools like ktx_search_semantic_layer and ktx_get_metric_sql so Claude Code, Codex, Cursor, and OpenCode fetch canonical SQL instead of guessing. - Use Case: A data team runs ktx setup against their Snowflake warehouse and dbt project, then asks Claude Code for monthly active users; the agent retrieves the approved metric definition and canonical SQL with fan traps resolved. ## Quick Start Ask your AI agent to install ktx globally with npm, run ktx setup to configure your warehouse and dbt sources, then start the MCP server so the agent can search the semantic layer for a revenue metric.

Frequently Asked Questions about ktx-ai-data-agents

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I set up ktx for AI data agent queries?▼

Install the CLI with npm install -g @kaelio/ktx, then run ktx setup. The interactive command configures your LLM and embedding providers, adds warehouse connections and context sources like dbt, builds initial context via ktx ingest, and installs MCP agent integration.

What databases does ktx support for semantic layer queries?▼

ktx supports PostgreSQL, Snowflake, BigQuery, ClickHouse, MySQL, SQL Server, and SQLite. Connections are defined in ktx.yaml with credentials stored in .ktx/secrets.env, and read-only SELECT access is sufficient for ingestion.

How do AI agents use ktx through MCP tools?▼

Run ktx mcp start to expose tools including ktx_search_semantic_layer, ktx_search_wiki, ktx_get_metric_sql, and ktx_validate_query. Claude Code, Codex, Cursor, and OpenCode connect via a mcpServers configuration pointing to the ktx project directory.

Can ktx ingest context from dbt and Notion?▼

Yes, ktx ingests dbt projects, Looker, Metabase, Notion, and wiki content as context sources defined in ktx.yaml. It organizes and deduplicates the knowledge, and flags contradictions when the same metric is defined differently across sources.

Why does ktx semantic search return no results?▼

Empty results usually mean stale or missing embeddings. Delete .ktx/embeddings.db and rerun ktx ingest, then verify an embedding provider such as OpenAI text-embedding-3-small or Voyage AI is configured with a valid API key in ktx.yaml.

How does ktx handle fan traps in generated SQL?▼

ktx resolves fan traps automatically during query planning. When a query joins one-to-many chains like customers to orders to line_items, it generates CTEs that pre-aggregate measures to prevent row multiplication and inflated totals.