2026-05-14 12:53:55 -04:00
---
2026-05-18 09:49:43 -04:00
title: "ktx"
2026-05-20 17:33:38 +02:00
description: "Root command map, global options, and project resolution for the ktx CLI."
2026-05-14 12:53:55 -04:00
---
The `ktx` CLI sets up local projects, builds agent-ready context, checks
2026-05-20 17:33:38 +02:00
connections, queries semantic sources, searches wiki pages, runs the MCP
2026-05-15 13:25:44 -04:00
server, and manages the bundled Python runtime.
2026-05-14 12:53:55 -04:00
2026-05-18 09:49:43 -04:00
## Command signature
```bash
ktx [global-options] <command>
```
2026-05-20 17:33:38 +02:00
When you run bare `ktx` in an interactive terminal outside any **ktx** project, the
2026-05-18 09:49:43 -04:00
CLI starts the same guided setup flow as `ktx setup`. Inside an existing
project, use command-specific help:
```bash
ktx --help
ktx setup --help
ktx ingest --help
```
## Command map
2026-05-14 12:53:55 -04:00
```text
ktx
setup
connection
list
test [connectionId]
ingest [connectionId]
text [files...]
wiki
list
search <query>
sl
list
search <query>
validate <sourceName>
query
2026-05-17 10:29:07 +02:00
sql
2026-05-14 12:53:55 -04:00
status
2026-05-15 13:25:44 -04:00
mcp
start
stop
status
logs
2026-05-20 01:36:54 +02:00
admin
2026-05-14 12:53:55 -04:00
init [directory]
schema
runtime
install
start
stop
status
2026-05-20 01:36:54 +02:00
reindex
2026-05-14 12:53:55 -04:00
```
The public context-build entrypoint is `ktx ingest [connectionId]` or
2026-05-14 19:04:22 -04:00
`ktx ingest --all`.
2026-05-14 12:53:55 -04:00
2026-05-18 09:49:43 -04:00
## Global options
2026-05-14 12:53:55 -04:00
| Flag | Description |
|------|-------------|
2026-05-20 17:33:38 +02:00
| `--project-dir <path>` | **ktx** project directory. Defaults to `KTX_PROJECT_DIR`, then the nearest `ktx.yaml`, then the current working directory. |
2026-05-14 12:53:55 -04:00
| `--debug` | Print diagnostic dispatch and project-resolution details to stderr. |
| `-v`, `--version` | Show the CLI package name and version. |
| `-h`, `--help` | Show help for the current command. |
2026-05-18 09:49:43 -04:00
## Project resolution
2026-05-14 12:53:55 -04:00
Most commands are project-aware. Pass `--project-dir <path>` when scripting or
2026-05-20 17:33:38 +02:00
when you are outside the project directory. If you omit it, **ktx** checks
2026-05-14 12:53:55 -04:00
`KTX_PROJECT_DIR`, then walks upward for the nearest `ktx.yaml`, then falls back
to the current directory.
2026-05-18 09:49:43 -04:00
## Common workflows
2026-05-14 12:53:55 -04:00
```bash
# Start or resume setup
ktx setup
# Check readiness
ktx status
# Build one configured connection
ktx ingest warehouse
# Build every configured connection
2026-05-20 01:52:37 +02:00
ktx ingest
2026-05-14 12:53:55 -04:00
2026-05-20 17:33:38 +02:00
# Search semantic sources and wiki pages
2026-05-20 01:52:37 +02:00
ktx sl "revenue"
ktx wiki "revenue recognition"
2026-05-15 13:25:44 -04:00
2026-05-17 10:29:07 +02:00
# Execute read-only SQL
ktx sql --connection warehouse "select count(*) from public.orders"
2026-05-15 13:25:44 -04:00
# Start the local MCP server for agent clients
ktx mcp start
2026-05-14 12:53:55 -04:00
```