Show HN: Ktx – Open-source executable context layer for data agents
TL;DR Highlight
ktx gives data agents approved metric definitions and warehouse context, so they query more accurately.
Who Should Read
A data or backend developer whose Claude Code or Codex agent returns warehouse numbers that don't match approved metric definitions.
Core Mechanics
- General-purpose agents struggle on data tasks
- They re-explore the warehouse from scratch on every question.
- They invent their own metric logic and return numbers that differ from approved definitions.
- ktx builds the context layer automatically
- It ingests wiki content, organizes it, and removes duplicates.
- It flags contradictions for human review.
- It maps the warehouse on its own
- It samples tables and captures metadata and usage patterns.
- It detects joinable columns and annotates sources.
- It builds a semantic layer (a layer of metric definitions) automatically
- Raw tables and high-level metrics are linked through a join graph.
- It resolves chasm and fan traps (joins that inflate numbers) automatically, per the README.
- Agents fetch metrics declaratively instead of rewriting SQL each time.
- It serves agents through CLI and MCP
- It combines full-text and semantic search across wiki and semantic-layer entities.
- Connections are read-only, and ktx never writes to your database.
- It runs locally with no hosted service
- Schema and query results only go to the LLM provider you configured.
- Supported LLMs are the Anthropic API, Vertex AI, AI Gateway, a local Claude Code session, and local Codex auth.
Community Reactions
- Commenters asked for validation and cost control
- One commenter asked about a sandbox such as DuckDB to validate queries before sending them to BigQuery.
- They also suggested tablesample to cut cost during query development.
- Many comments asked for comparisons
- Several commenters asked how ktx differs from nao, graphenedata, Wren 2.0, and OpenVikings.
- A user shared hands-on experience
- They tried it from Claude Code and found setup easy without OpenAI embeddings.
- Building context took about 19 minutes for a Postgres database with around 20 tables.
- They also noted that pg_desc descriptions did not make it into the wiki.
- Commenters raised accuracy and schema-change questions
- One asked how accuracy is measured and whether it is run against benchmarks.
- Another asked whether agents can self-correct when schema changes break old queries.
- A Copilot user asked whether ktx setup requires Claude specifically.
How to Apply
- Install ktx on a sample DB and check status
- Today, run npm install -g @kaelio/ktx, then ktx setup and ktx status.
- Connect one dev warehouse or dbt project and try ktx sl "revenue".
- Ask 3 key metrics with and without ktx
- Send the same questions to an agent with the ktx MCP and one without.
- Compare the numbers and SQL against your approved metric definitions.
- Consolidate scattered metric definitions into ktx
- Add the sources you use (dbt, Looker, Notion wiki) as context sources in ktx.yaml.
- Run ktx ingest, then have a human resolve the flagged contradictions.
- Commit ktx.yaml, semantic-layer/, and wiki/ to git
- Do not commit .ktx/, since it holds local state and secrets.
- This lets teammates share the same context.
Try It
# Paste into your terminal (requires Node.js; connect a dev warehouse)
npm install -g @kaelio/ktx
ktx setup
ktx status
ktx ingest
ktx sl "revenue"
ktx wiki "refund policy"
ktx mcp startTerminology
Related Papers
Frostbite: A new CPU architecture discovered, designed and verified by AI
AI agents designed a CPU from scratch, claiming 4.59x perf/W over a traditional core
Restricting AI agents in mobile operating systems platforms from capturing data
Signal now blocks OS-level AI agents from reading its screen on iOS 27 and Android
Actions Speak Louder than Words: Stateful Privacy Sniffing of LLM Agents via Behavioral Covert Channels in Web Interactions
Agents' link choices alone let attackers rebuild user queries at F1 0.89; SOR cuts it to 0.39.
Tracking and Limiting Unsupported Claim Propagation in Multi-Agent LLM Systems: A Provenance-Aware Framework
Passing claims with source, evidence and history kept equivalence at 5 agent stages at 96% versus 31%.
LLM assisted reverse engineering
Pointing an agent at binaries with skills and MD notes made years-long hacks feasible
Metrics-in-the-Loop: Complexity Feedback Reshapes Agent-Written Code
Injecting per-turn complexity reports into coding agents cut code erosion without changing correctness
Why is Gemini 4 Carbon taking so long?
Carbon took nearly an hour on bug fixes that Astra and Opus finished in minutes, mostly from extra unrequested work.
Weight-Space Programming builds neural networks like a 1990s researcher
LLM hand-wrote MNIST weights to 91.3%, using 1990s-style techniques