Ktx: An Executable Context Layer to Fix Data Agent Accuracy

✍️ OpenClawRadar📅 Published: May 29, 2026🔗 Source
Ktx: An Executable Context Layer to Fix Data Agent Accuracy
Ad

Ktx is an open-source executable context layer designed to make AI agents like Claude Code, Codex, Cursor, and OpenCode query your data warehouse accurately. After building production-grade data agents for dozens of companies, the team at Kaelio found that accuracy is the #1 issue: agents generate valid SQL but it's often incorrect due to stale columns, hidden business rules, join fanout, and missing attribution logic.

Ktx splits the problem into two parts:

  • Business context goes into Markdown wiki pages that are auto-ingested, organized, deduplicated, and flagged for contradictions.
  • Queryable definitions go into YAML files defining tables, row grain, joins, measures, dimensions, filters, and filter groups.

When an agent needs a metric, it asks ktx for a measure, dimensions, and filters instead of writing the whole query. Ktx's planner chooses the join path, uses grain and relationship metadata, catches issues like join fanout and chasm joins, and compiles the warehouse SQL while also leveraging unstructured knowledge from ingested docs.

Ktx integrates with most warehouses (BigQuery, Snowflake, Postgres, ClickHouse, MySQL, SQL Server, SQLite), modeling tools (dbt, MetricFlow, LookML), BI tools (Looker, Metabase), and doc tools like Notion.

Ad

Quick Start

npm install -g @kaelio/ktx
ktx setup
ktx status

After setup, ktx status shows readiness checks for LLM, embeddings, databases, context sources, and agent integration.

First Commands

ktx setup          # Create, resume, or update a ktx project
ktx status         # Check project readiness
ktx ingest         # Build context for every configured connection
ktx sl "revenue"   # Search semantic sources
ktx wiki "refund policy"  # Search local wiki pages
ktx mcp start      # Start the MCP server for agent clients

For agent users: run npx skills add Kaelio/ktx --skill ktx in your project directory to install and configure ktx via the skill.

Who It's For

Use ktx if you want agents like Claude Code or Codex to query your warehouse with approved metric definitions, have business knowledge scattered across dbt, Looker, Metabase, and Notion, or need agents to reuse canonical SQL instead of inventing it on every prompt. Skip it if you don't have a SQL warehouse or only need one-off ad-hoc queries.

📖 Read the full source: HN AI Agents

Ad

👀 See Also

OmniCoder-9B: 9B Parameter Coding Agent Fine-Tuned on 425K Agentic Trajectories
Tools

OmniCoder-9B: 9B Parameter Coding Agent Fine-Tuned on 425K Agentic Trajectories

Tesslate released OmniCoder-9B, a 9-billion parameter coding agent model fine-tuned on Qwen3.5-9B's hybrid architecture. It was trained on 425,000+ curated agentic coding trajectories from Claude Opus 4.6, GPT-5.4, GPT-5.3-Codex, and Gemini 3.1 Pro.

OpenClawRadar
ClearSpec: A Spec Generator to Reduce Hallucination in Claude Code
Tools

ClearSpec: A Spec Generator to Reduce Hallucination in Claude Code

ClearSpec is a tool that generates structured specifications from plain English descriptions, connecting to GitHub repos to reference real file paths and dependencies, then uses those specs as prompts for Claude Code to provide better context.

OpenClawRadar
Clash of Agents: An MMA Arena for Testing Autonomous AI Agent Behavior
Tools

Clash of Agents: An MMA Arena for Testing Autonomous AI Agent Behavior

Clash of Agents is an experiment where autonomous AI agents compete in an MMA fighting arena with turn-based combat, post-fight analysis, and social interactions. Agents register, choose fighting disciplines, train stats, and fight with 21 real MMA moves and a combo system.

OpenClawRadar
Open-source 31-agent product development system for Claude with 12,000+ lines of content
Tools

Open-source 31-agent product development system for Claude with 12,000+ lines of content

An open-source Claude Skill provides 31 specialized AI agents and 20 strategic frameworks covering all company departments from product to compliance. The MIT-licensed system includes 62 files with 12,000+ lines of actionable content, country-specific compliance for multiple regions, and a smart-loading system that routes requests efficiently.

OpenClawRadar