CLI Command Reference¶
This section provides usage details for all CLI commands. See XTrace CLI Quick Start for installation and first-time setup.
Commands are grouped by submodule and invoked as:
xtrace <group> <command> [ARGS] # subgroup command
xtrace <command> [ARGS] # top-level command
Inside the interactive shell (xtrace shell), omit the xtrace prefix:
> xvec load /path/to/data/ KB_ID
> kb create-kb my-kb
Knowledge base admin — xtrace kb¶
KB commands require ADMIN_KEY input, entered once per session. To avoid repeated prompts, run init -e remote --admin to save the key to your .env.
create-kb¶
xtrace kb create-kb {NAME} [-d "{description}"] [-p {permission}] [--json] [-a {API_KEY}] [--help]
Creates a knowledge base named NAME. Use -d for an optional description (wrap in quotes). Control access with -p {permission}: read, write, delete, or none (default: write). The permission applies to the API key in your .env unless overridden with -a {API_KEY}. --json returns the raw API response.
delete-kb¶
xtrace kb delete-kb {KB_ID...} [--json] [--help]
Permanently deletes one or more space-separated knowledge bases. Prompts for confirmation. --json outputs raw JSON results.
list-kbs¶
xtrace kb list-kbs [--all] [--json] [-a {api_key}] [--help]
Lists all knowledge bases accessible to your current API key. By default, only KBs with explicit permissions are shown. --all also shows KBs with no permissions (displayed as NONE). --json returns raw JSON including numeric permissionLabel values. Override the API key with -a {api_key}.
describe-kb¶
xtrace kb describe-kb {KB_ID ...} [--json] [-a {api_key}] [--help]
Prints details for one or more knowledge bases. --json returns raw JSON (list when multiple IDs are given). Override the API key with -a {api_key}.
x-vec commands — xtrace xvec¶
load¶
xtrace xvec load {/path/to/dir/} {KB_ID} [-f {file-types,...}] [--help]
Loads data from a directory into a knowledge base with id KB_ID, processing files of type .txt, .md, .json, and .csv. To filter by file type, use -f with a comma-separated list (e.g. txt,json).
retrieve¶
xtrace xvec retrieve {KB_ID} {"query"} [-k {integer}] [--mode {mode}] [--inference {provider} --model {"model"}] [--json] [--bench] [--help]
Returns the k most similar vectors to the query (default k=3). --mode selects simple or parallel retrieval. --inference {provider} --model {"model"} runs an LLM over the retrieved context (requires an inference key from init --inference). --json returns raw chunk data. --bench prints timing for each retrieval step.
query¶
xtrace xvec query {KB_ID} "{query}" [-k {integer}] [--mode {mode}] [--inference {provider} --model {"model"}] [--json] [--bench] [--help]
Alias of retrieve. Same signature and behavior.
head¶
xtrace xvec head {KB_ID} [--all] [--fullChunks] [--json] [-a {api_key}] [--help]
Previews vectors in a knowledge base. Shows up to 25 vectors with truncated content by default. --all shows every vector. --fullChunks disables content truncation. --json returns a raw JSON array. Override the API key with -a {api_key}.
fetch¶
xtrace xvec fetch {KB_ID} {VECTOR_ID...} [--fullChunks] [--json] [-a {api_key}] [--help]
Fetches one or more vectors by ID. --fullChunks disables content truncation. --json returns a raw JSON list of {id, content} objects. Override the API key with -a {api_key}.
upsert¶
xtrace xvec upsert {KB_ID} "{text}" [--help]
Inserts a single text chunk into a knowledge base. Wrap text in quotes if it contains spaces.
upsert-file¶
xtrace xvec upsert-file {/path/to/file} {KB_ID} [--help]
Inserts and chunks the contents of a single file into a knowledge base. Supported types: .txt, .md, .json, .csv. For multiple files, use load.
x-mem commands — xtrace xmem¶
x-mem commands are coming soon.