{"slug": "show-hn-ktx-open-source-executable-context-layer-for-data-agents", "title": "Show HN: Ktx – Open-source executable context layer for data agents", "summary": "Kaelio released Ktx, an open-source context layer that automatically builds and maintains warehouse knowledge for AI data agents. The tool ingests company wikis, maps data stacks, and creates a semantic layer with approved metric definitions, enabling agents like Claude Code and Cursor to query databases accurately without re-exploring schemas or inventing metric logic on each request. Ktx supports PostgreSQL, Snowflake, BigQuery, and other warehouses, and integrates with dbt, Looker, and Notion to resolve join conflicts and flag contradictions across sources.", "body_md": "[ Quickstart](https://docs.kaelio.com/ktx/docs/getting-started/quickstart) ·\n\n[·](https://docs.kaelio.com/ktx/docs/cli-reference/ktx)\n\n**CLI Reference**[·](https://docs.kaelio.com/ktx/docs/ai-resources/agent-quickstart)\n\n**Agent Setup**\n\n**Slack****ktx** is a self-improving context layer that teaches agents how to query your\nwarehouse accurately - from approved metric definitions, joinable columns, and\nbusiness knowledge it builds and maintains for you.\n\nNote\n\nRun **ktx** with your own LLM API keys or a **Claude Pro/Max** subscription.\nNo extra usage billing from **ktx**.\n\nGeneral-purpose agents struggle on data tasks. They re-explore your warehouse on every question, invent their own metric logic, and return numbers that don't match approved definitions.\n\nTraditional semantic layers don't fix this. They demand constant manual upkeep and don't absorb the rest of your company's knowledge.\n\n**ktx** does both, automatically:\n\n**Learns from company knowledge.** Ingests wiki content, organizes it, removes duplicates, and flags contradictions for human review.**Maps the data stack.** Samples tables, captures metadata and usage patterns, detects joinable columns, and annotates sources so agents write better queries.**Builds a semantic layer.** Combines raw tables and high-level metrics through a join graph that automatically resolves chasm and fan traps, so agents fetch metrics declaratively instead of rewriting canonical SQL each time.**Serves agents at execution.** Exposes CLI and MCP tools with combined full-text and semantic search across wiki and semantic-layer entities.\n\n| General-purpose agent | Traditional semantic layer | ktx |\n|\n|---|---|---|---|\n| Builds warehouse context automatically | — | — | ✓ |\n| Detects joinable columns + resolves fan/chasm traps | — | Manual | ✓ |\n| Approved, reusable metric definitions | — | ✓ | ✓ |\n| Absorbs wiki / Notion / team knowledge | — | — | ✓ |\n| Flags contradictions across sources | — | — | ✓ |\n| Ships CLI + MCP for agent execution | Partial | — | ✓ |\n| Read-only by design | n/a | n/a | ✓ |\n\n**Use ktx if you:**\n\n- Want agents like Claude Code, Codex, Cursor, or OpenCode to query your warehouse with approved metric definitions\n- Have business knowledge scattered across dbt, Looker, Metabase, Notion, and team wikis\n- Need agents to reuse canonical SQL instead of inventing it on every prompt\n\n**Skip ktx if you:**\n\n- You don't have a SQL warehouse -\n**ktx** sits on top of one - You only need one ad-hoc query -\n`psql`\n\nor a notebook will do\n\nWorks with PostgreSQL, Snowflake, BigQuery, ClickHouse, MySQL, SQL Server, and SQLite. Integrates with dbt, MetricFlow, LookML, Looker, Metabase, and Notion.\n\n```\nnpm install -g @kaelio/ktx\nktx setup\nktx status\n```\n\n`ktx setup`\n\ncreates or resumes a local **ktx** project, configures providers\nand connections, builds context, and installs agent integration.\n\nExample `ktx status`\n\nafter setup:\n\n```\nktx project: /home/user/analytics\nProject ready: yes\nLLM ready: yes (claude-sonnet-4-6)\nEmbeddings ready: yes (text-embedding-3-small)\nDatabases configured: yes (warehouse)\nContext sources configured: yes (dbt_main)\nktx context built: yes\nAgent integration ready: yes (codex:project)\n```\n\nTip\n\nAlready using an agent? Ask Claude Code, Codex, Cursor, or OpenCode from your project directory:\n\n```\nRun npx skills add Kaelio/ktx --skill ktx and use the ktx skill to install\nand configure ktx in this project.\n```\n\nImportant\n\nIf `ktx status`\n\nprints `ktx mcp start --project-dir ...`\n\n, run it before\nopening your agent client.\n\n| Command | Purpose |\n|---|---|\n`ktx setup` |\nCreate, resume, or update a ktx project |\n`ktx status` |\nCheck project readiness |\n`ktx ingest` |\nBuild context for every configured connection |\n`ktx sl \"revenue\"` |\nSearch semantic sources |\n`ktx wiki \"refund policy\"` |\nSearch local wiki pages |\n`ktx mcp start` |\nStart the MCP server for agent clients |\n\nSee the [CLI Reference](https://docs.kaelio.com/ktx/docs/cli-reference/ktx)\nfor every command, flag, and option.\n\n```\nmy-project/\n├── ktx.yaml                         # Project configuration\n├── semantic-layer/<connection-id>/  # YAML semantic sources\n├── wiki/global/                     # Shared business context\n├── wiki/user/<user-id>/             # User-scoped notes\n├── raw-sources/<connection-id>/     # Ingest artifacts and reports\n└── .ktx/                            # Local state and secrets, git-ignored\n```\n\nCommit `ktx.yaml`\n\n, `semantic-layer/`\n\n, and `wiki/`\n\n. Keep `.ktx/`\n\nlocal.\n\nProject resolution defaults to `KTX_PROJECT_DIR`\n\n, then the nearest `ktx.yaml`\n\n,\nthen the current directory. Pass `--project-dir <path>`\n\nwhen scripting.\n\n**Does ktx send my schema or query results to a hosted service?** No.**ktx** runs locally. The only data leaving your machine is what you send to the LLM provider you configured.**Which LLM backends are supported?** Anthropic API, Google Vertex AI, AI Gateway, and the local Claude Code session through the Claude Agent SDK. See[LLM configuration](https://docs.kaelio.com/ktx/docs/guides/llm-configuration).**How is ktx different from a dbt or MetricFlow semantic layer?****ktx*** ingests*those layers and combines them with raw-table introspection and wiki content. Agents get one searchable surface instead of three disconnected ones - and**ktx** flags contradictions across sources.**Does ktx need a running server?** There is no hosted service. The local MCP daemon runs on demand via`ktx mcp start`\n\nwhen an agent client needs it.**Is my warehouse safe?** Yes. Connections are read-only -**ktx** never writes to your database.\n\n— ask questions, share what you're building, and chat with maintainers.[Slack](https://join.slack.com/t/ktxcommunity/shared_invite/zt-3y9b44m1x-LVyNNJD5nwaZHq4XS29LMQ)— report bugs and request features.[GitHub Issues](https://github.com/Kaelio/ktx/issues)— set up the repo, run tests, and open a PR.[Contributing](https://docs.kaelio.com/ktx/docs/community/contributing)\n\n```\ngit clone https://github.com/kaelio/ktx.git\ncd ktx\npnpm install\nuv sync --all-groups\npnpm run build\npnpm run check\n```\n\n**ktx** is a pnpm + uv workspace:\n\n| Path | Purpose |\n|---|---|\n`packages/cli` |\nTypeScript CLI and published npm package source |\n`packages/cli/src/context` |\nCore context engine |\n`packages/cli/src/llm` |\nLLM and embedding providers |\n`packages/cli/src/connectors` |\nDatabase scan connectors |\n`python/ktx-sl` |\nSemantic-layer query planning |\n`python/ktx-daemon` |\nPortable compute service |\n\nLocal development CLI:\n\n```\npnpm run setup:dev\npnpm run link:dev\nktx-dev --help\n```\n\nUseful checks:\n\n```\npnpm run type-check\npnpm run test\npnpm run dead-code\nuv run pytest -q\n```\n\n**ktx** collects anonymous usage telemetry from interactive CLI runs to\nimprove setup, command reliability, and data-agent workflows. No file paths,\nhostnames, SQL, schema names, error messages, or argv are recorded. See\n[Telemetry](https://docs.kaelio.com/ktx/docs/community/telemetry) for the\nevent catalog and opt-out options.\n\n**ktx** is licensed under the Apache License, Version 2.0. See `LICENSE`\n\n.", "url": "https://wpnews.pro/news/show-hn-ktx-open-source-executable-context-layer-for-data-agents", "canonical_source": "https://github.com/Kaelio/ktx", "published_at": "2026-05-28 15:05:06+00:00", "updated_at": "2026-05-28 23:42:42.807560+00:00", "lang": "en", "topics": ["ai-agents", "ai-tools", "ai-infrastructure", "ai-products", "large-language-models"], "entities": ["Ktx", "Kaelio", "Slack", "Claude"], "alternates": {"html": "https://wpnews.pro/news/show-hn-ktx-open-source-executable-context-layer-for-data-agents", "markdown": "https://wpnews.pro/news/show-hn-ktx-open-source-executable-context-layer-for-data-agents.md", "text": "https://wpnews.pro/news/show-hn-ktx-open-source-executable-context-layer-for-data-agents.txt", "jsonld": "https://wpnews.pro/news/show-hn-ktx-open-source-executable-context-layer-for-data-agents.jsonld"}}