메뉴
HN
Hacker News 2일 전

데이터 에이전트용 오픈소스 컨텍스트 레이어, Ktx

IMP
7/10
핵심 요약

Ktx는 데이터 에이전트가 데이터 웨어하우스를 정확하게 쿼리하도록 돕는 자가 개선형 컨텍스트 레이어입니다. 위키, dbt 등의 비즈니스 지식을 자동 수집하고 조인 가능한 컬럼을 매핑하여 에이전트가 승인된 지표 정의를 따르게 합니다. Claude Code, Cursor 등 주요 코딩 에이전트와 MCP 및 CLI로 연동됩니다.

번역된 본문

데이터 에이전트를 위한 컨텍스트 레이어

빠른 시작 · CLI 레퍼런스 · 에이전트 설정 · Slack

ktx는 승인된 지표 정의, 조인 가능한 컬럼, 그리고 당신을 위해 구축하고 유지보수하는 비즈니스 지식으로부터 에이전트가 데이터 웨어하우스를 정확하게 쿼리하는 방법을 학습시키는 자가 개선형 컨텍스트 레이어입니다.

참고 ktx를 실행하려면 자신의 LLM API 키 또는 Claude Pro/Max 구독이 필요합니다. ktx에서의 추가 사용 요금은 청구되지 않습니다.

왜 ktx인가 범용 에이전트는 데이터 작업에서 어려움을 겪습니다. 매 질문마다 웨어하우스를 재탐색하고, 자체적인 지표 로직을 발명하며, 승인된 정의와 일치하지 않는 숫자를 반환합니다.

전통적인 시맨틱 레이어(Semantic layer)는 이를 해결하지 못합니다. 지속적인 수동 유지보수가 필요하며 회사의 나머지 지식을 흡수하지 못합니다.

ktx는 두 가지 모두 자동으로 수행합니다:

회사 지식으로부터 학습합니다. 위키 콘텐츠를 수집하고, 정리하며, 중복을 제거하고, 모순을 표시하여 사람이 검토할 수 있게 합니다. 데이터 스택을 매핑합니다. 테이블을 샘플링하고, 메타데이터와 사용 패턴을 캡처하며, 조인 가능한 컬럼을 감지하고, 출처에 주석을 달아 에이전트가 더 나은 쿼리를 작성하도록 돕습니다. 시맨틱 레이어를 구축합니다. 원시 테이블과 고수준 지표를 자동으로 chasm trap과 fan trap을 해결하는 조인 그래프를 통해 결합하여, 에이전트가 매번 정규 SQL(Canonical SQL)을 재작성하는 대신 선언적으로 지표를 가져올 수 있게 합니다. 실행 시 에이전트에 제공합니다. 위키와 시맨틱 레이어 엔티티에 걸쳐 전체 텍스트 및 시맨틱 검색을 결합한 CLI 및 MCP 도구를 노출합니다.

ktx 비교

기능 | 범용 에이전트 | 전통적 시맨틱 레이어 | ktx 웨어하우스 컨텍스트 자동 구축 | — | — | ✓ 조인 가능한 컬럼 감지 + fan/chasm trap 해결 | — | 수동 | ✓ 승인되고 재사용 가능한 지표 정의 | — | ✓ | ✓ 위키/Notion/팀 지식 흡수 | — | — | ✓ 소스 간 모순 표시 | — | — | ✓ 에이전트 실행을 위한 CLI + MCP 제공 | 부분적 | — | ✓ 설계상 읽기 전용 | 해당 없음 | 해당 없음 | ✓

ktx는 누구를 위한 것인가 다음과 같은 경우 ktx를 사용하세요:

Claude Code, Codex, Cursor, 또는 OpenCode와 같은 에이전트가 승인된 지표 정의로 웨어하우스를 쿼리하게 하고 싶다면 비즈니스 지식이 dbt, Looker, Metabase, Notion, 팀 위키에 흩어져 있다면 에이전트가 매 프롬프트마다 지표를 새로 발명하는 대신 정규 SQL(Canonical SQL)을 재사용하길 원한다면

다음과 같은 경우 ktx를 건너뛰세요:

SQL 웨어하우스가 없는 경우 — ktx는 그 위에서 작동합니다 단일 임시 쿼리만 필요한 경우 — psql이나 노트북이면 충분합니다

PostgreSQL, Snowflake, BigQuery, ClickHouse, MySQL, SQL Server, SQLite와 함께 작동합니다. dbt, MetricFlow, LookML, Looker, Metabase, Notion과 연동됩니다.

빠른 시작

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

ktx setup은 로컬 ktx 프로젝트를 생성하거나 이어서 진행하고, 프로바이더와 연결을 구성하며, 컨텍스트를 구축하고, 에이전트 연동을 설치합니다.

설정 후 ktx status 예시:

ktx project: /home/user/analytics Project ready: yes LLM ready: yes (claude-sonnet-4-6) Embeddings ready: yes (text-embedding-3-small) Databases configured: yes (warehouse) Context sources configured: yes (dbt_main) ktx context built: yes Agent integration ready: yes (codex:project)

팁 이미 에이전트를 사용 중인가요? 프로젝트 디렉토리에서 Claude Code, Codex, Cursor, 또는 OpenCode에 다음을 요청하세요: npx skills add Kaelio/ktx --skill ktx를 실행하고 ktx 스킬을 사용하여 이 프로젝트에 ktx를 설치하고 구성하세요.

중요 ktx status가 ktx mcp start --project-dir ...를 출력하면, 에이전트 클라이언트를 열기 전에 실행하세요.

첫 번째 명령어

명령어 | 용도 ktx setup | ktx 프로젝트 생성, 재개 또는 업데이트 ktx status | 프로젝트 준비 상태 확인 ktx ingest | 구성된 모든 연결에 대한 컨텍스트 구축 ktx sl "revenue" | 시맨틱 소스 검색 ktx wiki "refund policy" | 로컬 위키 페이지 검색 ktx mcp start | 에이전트 클라이언트를 위한 MCP 서버 시작

모든 명령어, 플래그, 옵션은 CLI 레퍼런스를 참조하세요.

프로젝트 레이아웃

my-project/ ├── ktx.yaml # 프로젝트 구성 ├── semantic-layer// # YAML 시맨틱 소스 ├── wiki/global/ # 공유 비즈니스 컨텍스트 ├── wiki/user// # 사용자 범위 메모 ├── raw-sources// # 수집 아티팩트 및 보고서 └── .ktx/ # 로컬 상태 및 시크릿, git-ignored

ktx.yaml, semantic-layer/, wiki/를 커밋하세요. .ktx/는 로컬에 유지하세요.

원문 보기
원문 보기 (영어)
The context layer for data agents Quickstart · CLI Reference · Agent Setup · Slack ktx is a self-improving context layer that teaches agents how to query your warehouse accurately - from approved metric definitions, joinable columns, and business knowledge it builds and maintains for you. Note Run ktx with your own LLM API keys or a Claude Pro/Max subscription. No extra usage billing from ktx . Why ktx General-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. Traditional semantic layers don't fix this. They demand constant manual upkeep and don't absorb the rest of your company's knowledge. ktx does both, automatically: 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. How ktx compares General-purpose agent Traditional semantic layer ktx Builds warehouse context automatically — — ✓ Detects joinable columns + resolves fan/chasm traps — Manual ✓ Approved, reusable metric definitions — ✓ ✓ Absorbs wiki / Notion / team knowledge — — ✓ Flags contradictions across sources — — ✓ Ships CLI + MCP for agent execution Partial — ✓ Read-only by design n/a n/a ✓ Who is ktx for Use ktx if you: Want agents like Claude Code, Codex, Cursor, or OpenCode to query your warehouse with approved metric definitions Have business knowledge scattered across dbt, Looker, Metabase, Notion, and team wikis Need agents to reuse canonical SQL instead of inventing it on every prompt Skip ktx if you: You don't have a SQL warehouse - ktx sits on top of one You only need one ad-hoc query - psql or a notebook will do Works with PostgreSQL, Snowflake, BigQuery, ClickHouse, MySQL, SQL Server, and SQLite. Integrates with dbt, MetricFlow, LookML, Looker, Metabase, and Notion. Quick Start npm install -g @kaelio/ktx ktx setup ktx status ktx setup creates or resumes a local ktx project, configures providers and connections, builds context, and installs agent integration. Example ktx status after setup: ktx project: /home/user/analytics Project ready: yes LLM ready: yes (claude-sonnet-4-6) Embeddings ready: yes (text-embedding-3-small) Databases configured: yes (warehouse) Context sources configured: yes (dbt_main) ktx context built: yes Agent integration ready: yes (codex:project) Tip Already using an agent? Ask Claude Code, Codex, Cursor, or OpenCode from your project directory: Run npx skills add Kaelio/ktx --skill ktx and use the ktx skill to install and configure ktx in this project. Important If ktx status prints ktx mcp start --project-dir ... , run it before opening your agent client. First commands Command Purpose 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 See the CLI Reference for every command, flag, and option. Project Layout my-project/ ├── ktx.yaml # Project configuration ├── semantic-layer/<connection-id>/ # YAML semantic sources ├── wiki/global/ # Shared business context ├── wiki/user/<user-id>/ # User-scoped notes ├── raw-sources/<connection-id>/ # Ingest artifacts and reports └── .ktx/ # Local state and secrets, git-ignored Commit ktx.yaml , semantic-layer/ , and wiki/ . Keep .ktx/ local. Project resolution defaults to KTX_PROJECT_DIR , then the nearest ktx.yaml , then the current directory. Pass --project-dir <path> when scripting. FAQ 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 . 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 when an agent client needs it. Is my warehouse safe? Yes. Connections are read-only - ktx never writes to your database. Docs Quickstart The Context Layer Building Context CLI Reference Agent Quickstart Community & Support Community Slack — ask questions, share what you're building, and chat with maintainers. GitHub Issues — report bugs and request features. Contributing — set up the repo, run tests, and open a PR. Development git clone https://github.com/kaelio/ktx.git cd ktx pnpm install uv sync --all-groups pnpm run build pnpm run check ktx is a pnpm + uv workspace: Path Purpose packages/cli TypeScript CLI and published npm package source packages/cli/src/context Core context engine packages/cli/src/llm LLM and embedding providers packages/cli/src/connectors Database scan connectors python/ktx-sl Semantic-layer query planning python/ktx-daemon Portable compute service Local development CLI: pnpm run setup:dev pnpm run link:dev ktx-dev --help Useful checks: pnpm run type-check pnpm run test pnpm run dead-code uv run pytest -q Telemetry ktx collects anonymous usage telemetry from interactive CLI runs to improve setup, command reliability, and data-agent workflows. No file paths, hostnames, SQL, schema names, error messages, or argv are recorded. See Telemetry for the event catalog and opt-out options. License ktx is licensed under the Apache License, Version 2.0. See LICENSE . Star History