KTXDocs
CLI Reference

ktx setup

Set up or resume a local KTX project.

Interactive wizard that walks you through configuring LLM credentials, embeddings, database connections, context sources, and agent integrations. When run without flags in a directory that has no ktx.yaml, it launches the full guided flow. When run in an existing project, it resumes from the first incomplete step.

Usage

ktx setup [options]

Subcommands

SubcommandDescription
setup demoRun the packaged KTX demo from setup
setup demo initInitialize the packaged demo project
setup demo resetReset the packaged demo project
setup demo replayReplay the packaged demo memory-flow
setup demo scanRun the packaged demo scan
setup demo inspectInspect packaged demo outputs
setup demo doctorCheck packaged demo readiness
setup demo ingestRun packaged demo ingest
setup context buildBuild agent-ready KTX context for setup
setup context watch [runId]Watch a setup-managed context build
setup context status [runId]Print setup-managed context build status
setup context stop [runId]Request a pause for a setup-managed context build
setup removeRemove setup-managed local integrations
setup statusShow setup readiness for the resolved KTX project

Options

General

FlagDescriptionDefault
--project-dir <path>KTX project directoryKTX_PROJECT_DIR, nearest ktx.yaml, or cwd
--newCreate a new KTX project before setupfalse
--existingUse an existing KTX projectfalse
--yesAccept safe defaults in non-interactive setupfalse
--no-inputDisable interactive terminal input

Agent Integration

FlagDescriptionDefault
--agentsInstall agent integration onlyfalse
--target <target>Agent target (claude-code, codex, cursor, opencode, universal)
--agent-scope <scope>Agent install scope (project or global)project
--agent-install-mode <mode>Agent install mode (cli, mcp, or both)cli
--projectInstall agent integration into the project scopefalse
--globalInstall agent integration into the global target scope (Claude Code and Codex only)false
--skip-agentsLeave agent integration incomplete for nowfalse

LLM Configuration

FlagDescriptionDefault
--anthropic-api-key-env <name>Environment variable containing the Anthropic API key
--anthropic-api-key-file <path>File containing the Anthropic API key
--anthropic-model <model>Anthropic model ID to validate and save
--skip-llmLeave LLM setup incomplete for nowfalse

Embedding Configuration

FlagDescriptionDefault
--embedding-backend <backend>Embedding backend (openai or sentence-transformers)
--embedding-api-key-env <name>Environment variable containing the embedding provider API key
--embedding-api-key-file <path>File containing the embedding provider API key
--skip-embeddingsLeave embedding setup incomplete for nowfalse

Database Configuration

FlagDescriptionDefault
--database <driver>Database driver to configure; repeatable (sqlite, postgres, mysql, clickhouse, sqlserver, bigquery, snowflake)
--database-connection-id <id>Existing or new connection id; repeatable
--new-database-connection-id <id>Connection id for one new database connection
--database-url <url>URL, env:NAME, or file:/path for one new URL-style database connection
--database-schema <schema>Database schema to include; repeatable
--skip-databasesLeave database setup incompletefalse

Historic SQL

FlagDescriptionDefault
--enable-historic-sqlEnable Historic SQL when the selected database supports itfalse
--disable-historic-sqlDisable Historic SQL for the selected databasefalse
--historic-sql-window-days <number>Historic SQL query-history window in days
--historic-sql-min-calls <number>Postgres pg_stat_statements minimum calls floor
--historic-sql-service-account-pattern <pattern>Historic SQL service-account regex; repeatable
--historic-sql-redaction-pattern <pattern>Historic SQL SQL-literal redaction regex; repeatable

Context Source Configuration

FlagDescriptionDefault
--source <type>Source connector type (dbt, metricflow, metabase, looker, lookml, notion)
--source-connection-id <id>Connection id for source setup
--source-path <path>Local source path for dbt, MetricFlow, or LookML
--source-git-url <url>Git URL for dbt, MetricFlow, or LookML
--source-branch <branch>Git branch for source setup
--source-subpath <path>Repo subpath for source setup
--source-auth-token-ref <ref>env: or file: credential ref for source repo auth
--source-url <url>Source service URL for Metabase or Looker
--source-api-key-ref <ref>env: or file: API key ref for Metabase or Notion
--source-client-id <id>Looker client id
--source-client-secret-ref <ref>env: or file: Looker client secret ref
--source-warehouse-connection-id <id>Mapped warehouse connection id
--source-project-name <name>dbt project name override
--source-profiles-path <path>dbt profiles path
--source-target <target>dbt target or source-specific mapping target
--metabase-database-id <id>Metabase database id to map
--notion-crawl-mode <mode>Notion crawl mode (all_accessible or selected_roots)
--notion-root-page-id <id>Notion root page id; repeatable
--skip-initial-source-ingestValidate source setup without building source context during setupfalse
--skip-sourcesMark optional source setup complete with no sourcesfalse

Subcommand Options

FlagSubcommandDescriptionDefault
--jsonstatus, context statusPrint JSON outputfalse
--no-inputcontext build, context watchDisable interactive terminal input
--forcecontext stopRequest the pause without interactive confirmationfalse
--agentsremoveRemove setup-managed agent integration filesfalse
--mode <mode>demoDemo mode: seeded, replay, or fullseeded
--plaindemoPrint plain text outputfalse

Examples

# Run the interactive setup wizard
ktx setup

# Create a new project and run setup
ktx setup --new

# Resume setup in an existing project
ktx setup --existing

# Non-interactive setup with Anthropic key from environment
ktx setup --yes --anthropic-api-key-env ANTHROPIC_API_KEY

# Set up a Postgres connection
ktx setup --database postgres --database-url "env:DATABASE_URL"

# Install agent integration for Claude Code only
ktx setup --agents --target claude-code

# Install agent integration globally for Codex
ktx setup --agents --target codex --global

# Add a dbt source from a local path
ktx setup --source dbt --source-path ./my-dbt-project

# Skip optional steps for a minimal setup
ktx setup --skip-sources --skip-agents

# Check setup readiness
ktx setup status

# Build context after setup
ktx setup context build

# Watch a running context build
ktx setup context watch

# Run the packaged demo
ktx setup demo