ktx
Skill1.6k starsChanged 6 months agoApache-2.0View on GitHub
Installs and configures ktx, the open-source context layer for data agents — runs ktx setup non-interactively with hidden CLI flags, configures database connections and embeddings, installs agent integration, and verifies readiness. Use when the user asks an agent to add ktx to a project, connect data sources, install agent rules, ingest schema, or troubleshoot a local ktx install.
- Reads credentials
- Installs packages
Trending
Steady talk.thin dataabout the whole repository
Who's talking about Kaelio/ktx
- A Hacker News story“Show HN: Ktx – Open-source executable context layer for data agents”Hacker News · May 28, 2026 · 93 points
- A Hacker News story“Show HN: Open-source version of Anthropic's internal analytics engine”Hacker News · Jun 9, 2026 · 15 points
- @winsontang.com“Excited to introduce Ktx, an open-source executable context layer designed for data agents! Streamline your …”Bluesky · Jul 9, 2026 · 2 likes
- heylabs-co/dev-tools-portal“🔍 Weekly Discovery: 48 new tools found (2026-06-01)”GitHub · Jun 1, 2026 · 1 reactions
- @hackernewsbot.bsky.social“Show HN: Ktx – Open-source executable context layer for data agents | Discussion”Bluesky · May 28, 2026 · 1 likes
The biggest 5 of 11 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 11
Talked about on GitHub, Hacker News and Bluesky (11 times).
On GitHub · 7
- Jun 1, 2026🔍 Weekly Discovery: 48 new tools found (2026-06-01) — heylabs-co/dev-tools-portal1 reaction
- Oct 5, 2026[Candidate] kaelio/ktx/packages/cli/src/skills/gdrive_synthesize - gdrive_synthesize — ProSkillsMD/proskills0 reactions · 1 comment
- Oct 5, 2026[Candidate] kaelio/ktx/packages/cli/src/skills/dbt_ingest - dbt_ingest — ProSkillsMD/proskills0 reactions · 1 comment
- Oct 5, 2026[Candidate] kaelio/ktx/packages/cli/src/skills/analytics - ktx-analytics — ProSkillsMD/proskills0 reactions · 1 comment
- Sep 28, 2026agent-skills.github.kaelio.ktx: init at 0.16.0 — sudosubin/agents.nix0 reactions
2 more on GitHub
- Jul 20, 2026fix: add missing repo metadata of companies — yc-oss/open-source-companies0 reactions
- May 29, 2026Tren Komunitas AI -- 2026-05-30 — rahmanramsi/daily-digest-ai0 reactions
On Hacker News · 2
- May 28, 2026Show HN: Ktx – Open-source executable context layer for data agents93 points · 37 comments
- Jun 9, 2026Show HN: Open-source version of Anthropic's internal analytics engine15 points · 2 comments
On Bluesky · 2
- Jul 9, 2026Excited to introduce Ktx, an open-source executable context layer designed for data agents! Streamline your data processing and enhance… — @winsontang.com2 likes and reposts
- May 28, 2026Show HN: Ktx – Open-source executable context layer for data agents | Discussion — @hackernewsbot.bsky.social1 likes and repost
The file
Show its rules and text
We split this skill into the rules it gives an agent
14 rules. About 0 are common, 6 are distinctive, and 8 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
This author's own choices. Worth a look.
8
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Distinctive: line 9
Use this skill when a user wants an agent to add ktx to a project, connect data sources, build initial context, install agent integration, …
- Distinctive: line 21
Ask only for values you cannot infer: project directory, connection targets, credentials, account identifiers, and source selections.
- Very specific: line 23
Prefer file:/abs/path secret refs over env:VAR_NAME.
- Very specific: line 35
Do not commit .ktx/secrets/*.
- Distinctive: line 39
Don't go silent: say what's about to run and that it may take a while, then post brief progress/liveness updates while it runs (see step 4) …
- Distinctive: line 42
If a command fails, identify the cause and change something before retrying.
- Very specific: line 46
Before invoking ktx setup, collect in one round:
- Distinctive: line 63
Do not discover these inputs across multiple setup runs.
- Very specific: line 67
Detect the install path: If the working directory contains packages/cli/dist/bin.js or pnpm-workspace.yaml referencing @kaelio/ktx you are …
- Distinctive: line 116
Build context: if setup did not already complete one:
- Very specific: line 201
After adding sources, ingest each new connection so its context is queryable: ktx ingest <source-connection-id> --no-input.
- Very specific: line 229
every connections[].status === "ok" (other levels: warn, fail, skipped), and
- Very specific: line 231
every ktx connection test <id> exited 0, and
- Very specific: line 238
If the LLM is intentionally left unconfigured, verdict is blocked and the exit is non-zero by design — that is still a usable context …
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
ktx
Install and configure ktx, the open-source context layer for data agents. Use this skill when a user wants an agent to add ktx to a project, connect data sources, build initial context, install agent integration, or troubleshoot a local ktx setup.
Operating rules
- Act autonomously when the user asks you to install or configure ktx.
The non-interactive scripted flow below is the canonical path — bare
ktx setupis interactive (clack prompts) and an agent cannot drive it. - Setup's non-interactive flags are intentionally hidden from
--help. Use the flags listed below; verify uncommon flags against the docs athttps://docs.kaelio.com/ktx/or this skill — not against--helpoutput. - Ask only for values you cannot infer: project directory, connection targets, credentials, account identifiers, and source selections.
- Prefer
file:/abs/pathsecret refs overenv:VAR_NAME.env:refs are re-resolved against the process environment on everyktxrun, so a var exported only in the setup shell is gone whenktx ingestorktx mcp startruns later — the secret silently resolves to empty and the connection fails.file:refs read from disk and survive across shells. The same caveat applies to--*-api-key-envflags: the named var must be present in every shell that runsktx, including thektx mcpdaemon's environment. - A literal database URL is safe to pass —
ktx setupauto-externalizes it into.ktx/secrets/<id>-urland rewritesktx.yamlto afile:ref (see workflow step 2). Source credential refs are not auto-externalized: write the secret to a file under.ktx/secrets/(chmod 600) and pass afile:ref. Never ask the user to paste a secret when afile:orenv:ref works. - Do not commit
.ktx/secrets/*. - Print each command you run and its result.
- Setup and ingest can run for many minutes (LLM-heavy source ingests take the longest), and from the outside a slow step looks identical to a stuck one. Don't go silent: say what's about to run and that it may take a while, then post brief progress/liveness updates while it runs (see step 4) so the user never has to wonder whether it stalled — otherwise they may kill it mid-run.
- If a command fails, identify the cause and change something before retrying.
Gather inputs once
Before invoking ktx setup, collect in one round:
- Project directory (default: current working directory).
- LLM backend and key strategy. In
--no-inputmode the CLI defaults toanthropicand requires an API key. When the user is inside Claude Code, pass--llm-backend claude-codeexplicitly; otherwise pass--llm-backend anthropic --anthropic-api-key-env ANTHROPIC_API_KEY. - Embedding backend (
sentence-transformersis the local default and needs no key; useopenaionly if the user already has a key, then pass--embedding-api-key-env OPENAI_API_KEY). - Database: driver, connection id, URL (or
env:/file:ref), and one or more schemas. - Optional context sources (dbt, Metabase, Looker, LookML, MetricFlow,
Notion). Add each one with a follow-up
ktx setup --source …run (see Add context sources); use--skip-sourcesonly when the user has none.
Do not discover these inputs across multiple setup runs.
Install workflow
Detect the install path. If the working directory contains
packages/cli/dist/bin.jsorpnpm-workspace.yamlreferencing@kaelio/ktxyou are inside the ktx monorepo — build and link the local CLI withpnpmand do not runnpm install -g. Otherwise:node --version # require >= 22; stop and ask the user if older ktx --version || npm install -g @kaelio/ktxRun scripted setup (canonical path):
ktx setup --no-input --yes \ --project-dir <path> \ --llm-backend claude-code \ --embedding-backend sentence-transformers \ --database <driver> --database-connection-id <id> \ --database-url '<raw-url | file:/abs/path>' \ --database-schema <schema> \ --skip-sources \ --skip-agents--database-schemais required for scope-bearing drivers (Postgres, MySQL, ClickHouse, SQL Server, BigQuery, Snowflake) in--no-input: setup fails fast without it unless the connection already has scope inktx.yaml. SQLite needs no scope.- Configure one new database connection per setup invocation. For multiple connections, rerun setup once per connection.
- Pasting a literal
--database-urlis safe: the CLI relocates the URL into.ktx/secrets/<connection-id>-urland rewritesktx.yamlto afile:ref automatically. ktx setupruns agent integration as its last step. In--no-inputmode with neither--targetnor--skip-agents, that step has no input, printsRun in a TTY, or pass --target <target>., and the command exits non-zero even though every database/LLM/embedding step succeeded. Pass--skip-agentsto defer agents to step 5 (as above), or--target <agent>to install them inline and exit 0. Judge data-layer success fromktx status, not from this exit code.
- Resumability and
--skip-*. Re-runningktx setupagainst an existing project resumes its config. Use--skip-llm,--skip-databases,--skip-sources, or--skip-embeddingsto leave a slice unconfigured but let the rest complete instead of aborting on the first failure. When resuming an existing project to change one slice (e.g. only LLM), still pass the database flags from the previous run — setup validates current flags, not persistedktx.yamlstate. Build context if setup did not already complete one:
ktx ingest <connection-id> --no-inputktx ingestalways builds enriched context and requires a configured model and embeddings (set during setup); a database connection without them fails with an enrichment-readiness error. Note:ktx ingestrejects--yestogether with--no-input(Choose only one runtime install mode);ktx setupaccepts both. Use--no-inputonly for ingest.Ingest one connection at a time. It can run for many minutes with no stdout until it exits (LLM-heavy sources like Metabase are the slowest), so don't assume it hung, and don't pipe it through
tail/head— that buffers all output to the end, so run it raw. Tell the user up front that the step is slow, then keep them posted instead of blocking silently: run the ingest in the background and poll for liveness every minute or so, reporting a one-line update each time (which connection, roughly how long it's been running, and that.ktxfiles are still changing) so a long run never looks stuck:find <path>/.ktx/worktrees <path>/.ktx/ingest-transcripts -type f -mmin -3On success, the
Ingest finishedsummary table showsdonein theSource ingestandMemory updatecolumns with noFailed sources:section.Install agent integration:
ktx setup --agents --target <claude-code|claude-desktop|codex|cursor|opencode|universal> ktx mcp start --project-dir <path>Agent integration is not usable until
ktx mcp startis running. The--agentsstep prints this requirement asRequired before using agents.- Fall back to bare
ktx setuponly when a human is at the keyboard — it uses interactive prompts an agent cannot answer.
Add context sources
Context sources (dbt, Metabase, Looker, LookML, MetricFlow, Notion) are added
one at a time — --source is not repeatable, so run ktx setup once per
source. Source setup is resumable against an existing project: pass
--skip-databases --skip-llm --skip-embeddings --skip-agents so only the source
is configured (the trailing agent step otherwise fails the run — see install
step 2). Map Metabase, Looker, and LookML to an existing database connection
with --source-warehouse-connection-id <db-connection-id> (required for those).
dbt ignores --source-warehouse-connection-id — it maps to the warehouse by
table name — so omit it for dbt. Use file:/abs/path refs for keys and tokens
(see the secrets rule above); env: refs must be exported in every later ktx
shell.
# dbt — pick exactly one of --source-path (local) or --source-git-url (remote).
# No --source-warehouse-connection-id: dbt maps to the warehouse by table name.
ktx setup --no-input --yes --skip-databases --skip-llm --skip-embeddings --skip-agents \
--source dbt --source-connection-id <id> \
--source-git-url <url> --source-branch <branch>
# Metabase
ktx setup --no-input --yes --skip-databases --skip-llm --skip-embeddings --skip-agents \
--source metabase --source-connection-id <id> \
--source-url <url> --source-api-key-ref file:/abs/path/metabase-api-key \
--source-warehouse-connection-id <db-connection-id> \
--metabase-database-id <metabase-db-id>
# Notion
ktx setup --no-input --yes --skip-databases --skip-llm --skip-embeddings --skip-agents \
--source notion --source-connection-id <id> \
--source-auth-token-ref file:/abs/path/notion-token \
--notion-crawl-mode selected_roots --notion-root-page-id <page-id>Notes:
--metabase-database-idis the numeric id of the warehouse inside Metabase (not the ktx connection id). Discover it from the Metabase API (GET /api/database) or UI if the user doesn't know it.--notion-crawl-mode selected_rootsrequires at least one--notion-root-page-id(repeatable); useall_accessibleto crawl everything the token can see.- After adding sources, ingest each new connection so its context is queryable:
ktx ingest <source-connection-id> --no-input.
Files to inspect
ktx.yaml: project configuration..ktx/secrets/*: local secret files. Never commit them.semantic-layer/<connection-id>/*.yaml: semantic sources for SQL compilation.wiki/**/*.md: project context pages for agents..claude/skills/ktx/,.agents/skills/ktx/,.cursor/rules/ktx.mdc, and.opencode/commands/ktx.md: generated agent integration files.
Verification
After setup, run:
ktx connection test <connection-id>
ktx status --json --no-input
ktx sl --output plain # lists compiled semantic sources; `ktx sl` has no --no-inputJudge readiness from ktx status --json fields, not the exit code.
ktx status exits 1 whenever the LLM is none (verdict: "blocked"), even
when embeddings and every database connection are healthy. Treat success as:
verdict: "ready"at the top of the JSON, and- every
connections[].status === "ok"(other levels:warn,fail,skipped), and - every
ktx connection test <id>exited 0, and - for each ingested source,
localStats.semanticLayer[].sourceCount > 0andlocalStats.wikiPages[].count > 0— these confirm the source actually produced context. Do not rely onlocalStats.ingest.perConnectionto confirm source ingests: it reflects only completed warehouse ingest reports and under-reports (often lists just the warehouse connection).
If the LLM is intentionally left unconfigured, verdict is blocked and the
exit is non-zero by design — that is still a usable context layer, so report it
as "ready, LLM optional" and judge the data layer by the connection and
localStats fields above rather than retrying setup.
Troubleshooting
For known failure signatures (invalid ELF header,
Native CLI binary for <plat> not found, Missing Anthropic API key,
claude-code probe failure, ktx cannot work without a database on resume,
Run in a TTY, or pass --target <target>. with a misleading exit 1, and a
secret that resolves empty only during ktx ingest/ktx mcp), see
troubleshooting.md.
Final report
End setup work with a concise report:
ktx SETUP COMPLETE
Project: <path>
LLM: <backend> / <model>
Embeddings: <backend> / <model>
Connections: <name> (<driver>) status=<ok|warn|fail>
Sources: <list or none>
Verdict: <ready|needs action>
Next:
1. <copy-pasteable command or action>
2. <copy-pasteable command or action>
RESULT: PASSDoes it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

