HeadlinesBriefing favicon HeadlinesBriefing.com

Ktx Open-Sources Context Layer to Fix Unreliable Data Agent Queries

Hacker News •
×

Kaelio launched ktx, an open-source executable context layer designed to make AI agents produce accurate SQL queries on data warehouses. The tool emerged from building production data agents across dozens of companies, where agents consistently generated syntactically valid but incorrect queries due to missing business context and flawed assumptions.

Traditional approaches using skills or semantic layers proved inadequate. Skills provided context but agents still wrote buggy SQL. Semantic layers solved execution but required manual maintenance and ignored unstructured knowledge. Ktx addresses both by ingesting Markdown wiki pages and YAML definitions that specify tables, joins, measures, and filters.

Agents query ktx for metrics instead of writing raw SQL, letting the planner resolve join paths and catch fanout traps. The system flags contradictions between sources and combines dbt, Looker, Metabase, and Notion knowledge into one searchable surface. It supports BigQuery, Snowflake, Postgres, and integrates with Claude Code, Codex, Cursor, and OpenCode through CLI and MCP tools.

Ktx runs locally under an Apache 2.0 license with no hosted billing. The tool represents a practical response to accuracy problems that plague general-purpose agents working with analytical data, potentially reducing the gap between prototype and production deployments.