Skip to content

CLI

One entry point: dst (services/cli/main.py, with one module per command beside it). Two kinds of command:

  • In-process: init, dev, serve, migrate, doctor, bootstrap, secret, rotate-key, demo, prune-log, test, revoke-key, revoke-token, reindex, calibrate-bands, probe, cube status, drift, evals migrate run directly against the configured database or the local files; no server, URL, or token needed. introspect joins them whenever dst.yaml declares the connection, and falls back to the server when it does not.
  • Remote: everything else is an HTTP wrapper over the management API. Explicit --url / --token flags win; otherwise DST_URL and DST_ADMIN_TOKEN resolve from the process env or ./.env; dst init and dst bootstrap write them, so a scaffolded project needs no flags.

dst --version prints the installed version.

Color: output is colored only on a TTY, and the plain bytes are identical to the colored run's: piped output is the parse contract. dst --no-color … (or the NO_COLOR / DST_NO_COLOR env vars) turns it off everywhere.

Project lifecycle

dst init [dir]

Scaffold a new project (dbt-style; see Project files). Bare dst init creates ./<name>: it never scaffolds into the cwd implicitly; dst init . is the explicit way to use the current directory. Interactive by default; every prompt has a flag for headless runs (services/cli/init.py).

Flags: --name, --instance-name (what your AI calls this deployment — "check in watson ..."; default dst, written to .env as DST_INSTANCE_NAME and used as the scaffolded MCP registration name), --warehouse demo|duckdb|postgres|bigquery|snowflake|none, --duckdb-path (with --warehouse duckdb: your own .duckdb file), --example/--no-example (the bundled DuckDB example lens; default yes), --db-port (default 5432), --api-port (default 8000, written to .env as DST_URL), --yes (accept defaults, no prompts), --cube (a Cube-backed project, below).

--cube adds the Cube-backed slots: cube/model/ (empty, for the cubes and views), cube/cube.js (the sidecar's config), cube/overlay.yaml, lenses/main/lens.yaml with views: [], a cube: block in dst.yaml, a generated CUBEJS_API_SECRET in .env, the pinned Cube Core sidecar in docker-compose.yml behind the profile cube (docker compose --profile cube up -d), and the .claude/skills/dst-cube-overlay/ skill: which file holds what, every meta.dst key with what in dst reads it, and the checks plan runs.

The scaffolded docker-compose.yml carries a project name: of dst-<name>-<8 hex chars of the absolute path>, so two projects that share a name on one machine never share a Postgres volume (a volume written under another project's DST_SECRET_KEY refuses to start).

--skills-only refreshes an existing project. AGENTS.md and .claude/skills/ are a snapshot taken at init: a skill improved in a later release never reaches a project that was scaffolded before it, and neither plan nor apply has any way to notice. dst init <dir> --skills-only rewrites exactly those files from the installed dst and reports each one as unchanged, updated (+N -M) or new; it is the only init mode that runs inside a live project, and it touches nothing else — not dst.yaml, not .env, not semantic/ or lenses/. The write is unconditional, so a local edit to a skill is replaced rather than merged: it survives as a diff in your own git, which is where you would review it anyway. Run it after every upgrade.

dst dev

Postgres up + migrate + serve with auto-reload, one command. A reachable database is used as-is; otherwise the project's docker-compose.yml is brought up and waited on by connecting. Flags: --host (default 127.0.0.1), --port (default: the port in DST_URL, else 8000), --daemon (background mode, as for dst serve).

Before migrating, dst dev checks the database's encryption sentinel: a database written under another DST_SECRET_KEY (most often another project's compose volume) is refused with exit 1 and a message naming the compose project, instead of a traceback from inside the server.

dst serve

Run the API via uvicorn; serves the built dashboard same-origin when present (source checkout's apps/web/dist or the wheel's bundled copy). Without one it says so and serves the API only. Flags: --host, --port, --reload, --daemon, --stop.

Background mode. dst serve --daemon (and dst dev --daemon) starts the same server detached from the terminal, writes its pid to .dst/serve.pid and its output to .dst/serve.log in the current project, and returns once /health answers; if the server dies before that, or its log records a failed startup, or /health never answers, the command exits 1 with the last lines of the log instead — it never reports a server that is not serving. dst serve --stop sends SIGTERM to the recorded pid, waits for it to exit and removes the pidfile; a stale pidfile (the process is gone) is cleared, not obeyed. Whichever way it runs, the server logs the signal that ends it (received SIGTERM; shutting down), so a server that disappeared says why in serve.log.

Refuses to start on a schema behind this build, before it even probes the port: a server on an out-of-date schema serves answers correctly and loses every trace in silence, because the request_log writes fail in a background task nobody can see. The message names the current revision, the one this build needs, and the unapplied list, then tells you to run dst migrate; exit is 1 and no server starts. A schema ahead of this build starts normally (older code on a newer schema is the safe deploy order), and so does one whose state cannot be read, because a database still coming up is not a broken one. Full recovery path: Upgrading.

dst mcp

Run the MCP server over stdio for a local client (Claude Desktop, Cursor, claude mcp add), exactly as running the module does. The caller key comes from DST_API_KEY and the dst base URL from DST_URL (env or the project's .env). Remote clients do not need it: the API already serves the same tools at /mcp over streamable HTTP, one bearer key per request. See Agents over MCP.

dst migrate

Run database migrations to head against DATABASE_ADMIN_URL. Idempotent, and it takes a blocking advisory lock so concurrent runs serialize instead of racing.

Says precisely what it did, so an upgrade confirms itself:

migrated 0037 → 0040 — 3 revisions applied (0038, 0039, 0040)
already at head (0040) — nothing to apply
schema created at 0040

One of those three, depending on where the database started.

dst doctor

Can this install actually run? /ready reports what is configured (deliberately, and it never gates on models), so it stays green on a fully-configured but uncallable provider: an SDK incompatibility, a bad key, a wrong base_url. doctor checks callability: DB schema state, the embedder, and one cheap real call per model tier (max_tokens: 8, a fraction of a cent) with the failure printed verbatim per tier:

db            ok (0058)
embeddings    ok
providers
  fast  claude-haiku-4-5    ok
  smart claude-sonnet-4-6   FAIL — anthropic: SDK call signature mismatch (…)

Exit 0 when every check passes, 1 otherwise. Warehouse connections are not re-probed here; every dst apply already probes them and prints the capability line. Flags: --dir (default .).

In a project directory it closes with a skills line — current, or N behind this dst naming dst init . --skills-only. It never affects the exit code: holding an older skill on purpose is legitimate, and this command's 1 means not callable, not not current.

In a project with a Cube configured, doctor adds a cube row: ok with the URL and the model version, or FAIL when Cube does not answer or its meta cannot be read. With no Cube configured the row says not configured, which is not a failure.

A lanes block follows: one line per published lens, org/lens lane (why), where the lane is cube or typed and the reason is DST_SERVING, lens serving:, Cube-backed or default. Under a cube lane a ! line names each missing dependency and what it costs:

lanes
  acme/orders   cube (Cube-backed)
    ! cube not configured: every door on this lens answers 503 — set DST_CUBE_URL or `cube: {url: …}` in dst.yaml
    ! monitor never run: the data-end and feed checks skip — `dst monitor`, then `dst apply`
    ! no chat tier: the HTTP question door without a driver answers 503; MCP agents in driver mode are served with no model
  acme/support  typed (default)

These are warnings, never failures: the exit code does not change.

dst cube status

Checks whether the Cube that dst.yaml (or DST_CUBE_URL) points at is reachable, and reports what model it holds:

url           http://localhost:4000
secret        set
readyz        ok (version not stated)
model_version 3f9c0e…
members       4 view(s), 11 cube(s), 38 measure(s), 92 dimension(s), 6 segment(s)

model_version is the sha256 of Cube's meta in canonical form: members sorted, titles and descriptions left out. Relabelling a member does not change it. Changing a member, its type or its meta does. The meta is read as an operator with no groups, so a member withheld by group is not counted. A line overlay N meta.dst block(s) refused appears when a meta.dst key falls outside the schema dst reads. Flags: --dir (default .), --json. Exit 0 when Cube answered and its meta parsed, 1 otherwise.

dst bootstrap

Create (or reuse) an org and its admin token, saved to ./.env as DST_ADMIN_TOKEN when that file exists. Idempotent: a rerun never creates a duplicate org, and when .env already holds a live token of that org it keeps it and mints nothing; --rotate-admin-token mints a new one and replaces the line (earlier tokens stay valid until revoked). A rerun whose --org names a different org than the token in .env is refused, naming both, so a project never changes identity by accident. Talks to the database directly; no server needed. Flags: --org (default default), --email (create the first dashboard admin; an existing user is left untouched), --reset-password (with --email: set an existing user's password and make it admin), --password (omit to be prompted).

dst env new|ls|rm

Disposable environments. An environment is an org on this server — RLS-isolated content (lenses, callers, traces, certified answers) sharing the container and database, which is what makes one cheap enough to throw away (environments and CI).

  • dst env new <name> — create the org and mint its admin token. Idempotent like bootstrap, with one deliberate difference: it never writes .env — a sandbox must not steal the project's identity. The token is recorded in .dst/envs.json (gitignored, per-machine), so local commands reach the env by name: dst apply --env <name>, dst test --env <name>, dst runs <lens> --diff prev latest --env <name> — no secret changes hands. The printed export DST_ADMIN_TOKEN=… line remains the wiring for CI and remote shells.
  • dst env ls — every org on the server with what it holds (lenses, callers, traces) and when it was created, so a stale sandbox is visible instead of silently accumulating.
  • dst env rm <name> --yes — delete the org and everything in it, one transaction, printing what went. Irreversible, hence the mandatory --yes; an ambiguous name (two orgs, one name) is refused.

All three talk to DATABASE_ADMIN_URL directly; no server needed. A separate server per environment is still the right shape when production data or credentials are at stake — these verbs make the cheap shape disposable, they do not replace the isolated one.

dst secret

Generate a DST_SECRET_KEY (Fernet) for encrypting stored credentials.

dst rotate-key

Re-encrypt every stored credential under a new DST_SECRET_KEY. The variable takes a comma-separated list: the first key encrypts, all of them decrypt. That is what makes rotation possible without downtime.

DST_SECRET_KEY=<new>,<old>   # 1. deploy — everything still decrypts
dst rotate-key               # 2. move every secret onto <new>
DST_SECRET_KEY=<new>         # 3. drop <old>

Refuses to run with only one key configured (override with --force to re-encrypt in place). With just <new> set, nothing encrypted under <old> can be read, so the rotation would skip every row it could not decrypt and still report success. Any row that fails is named individually and the command exits non-zero. Do not drop the old key until it exits 0.

The server verifies the key at startup against an encrypted sentinel row and refuses to boot on a mismatch, so a wrong key is a failed deploy rather than a 503 on whichever connector is touched first.

dst demo

Publish the bundled DuckDB demo lens into an org. Flag: --org-id (required; the UUID dst bootstrap prints). By default the lens reads the bundled file and grants nobody but admins. For a deployment other people reach: --path md:<database> points it at MotherDuck (--secret-env NAME names the env var holding the token), --statement-timeout-ms bounds a query, --allow-group demo grants a caller group, and --per-caller-rpd N bounds a caller's day. The path is probed before anything lands. Re-running updates the connection and the lens in place.

dst prune-log

Delete request_log rows older than --keep-days N, for every org or one --org-id. The rows carry the questions people asked; run it from cron wherever you promised them a bounded life.

Files → server

dst plan

Dry run of the project directory against the server. The default output is the terraform-shaped summary: one glyph row per asset that needs attention (+ create, ~ update, ✗ invalid, ! stale), then a counts line: Plan: 1 to add, 2 to change, 1 invalid, 11 unchanged. --full prints the per-path diffs for review flows; --json prints the parseable row list, including the scope: warehouse rows in full — the human forms print each connection's drift line but stay quiet about a warehouse the check could not reach (status: unavailable). Shared-asset edits mark their selecting lenses stale either way (they recompile on apply). Flags: --full, --json, --dir (default .), --timeout (seconds, default 120), and the selection flags --select, --lens and --scope described below, which preview exactly what the same flags push on apply. With a selection, the first line of the plan names it (selection: +lens/finance (scope: all) → lenses: finance; assets: entity/orders, …) and everything after describes the selected push only.

Every plan that carries a lens prints the lane each one will serve on, in one line: serving: orders → cube (Cube-backed), support → typed (default). The reason is DST_SERVING (the server's environment decides for every lens), lens serving: (the lens's own key), Cube-backed (the push carries cube/overlay.yaml, and it lists the lens or the lens's lens.yaml names views:) or default. Under --json it is the row {"scope": "serving", "lanes": {"orders": {"lane": "cube", "why": "Cube-backed"}}}.

Selecting part of the project

--select takes one or more selectors over the project graph, where a lens reads the entities and definitions its select: names:

Selector Selects
lens/finance, entity/orders, definition/net_revenue that node alone
lens/finance_*, definition/* every node of that kind whose name matches the glob
+lens/finance the lens and everything upstream: the entities and definitions it selects
entity/orders+ the entity and everything downstream: every lens that selects it
table/marts.orders the entities whose source.table is that table
table/stg_orders+ the table and everything downstream: with a lineage configured, every table the dbt or SQLMesh DAG builds from it, the entities on those tables, the definitions about those entities, and every lens that selects either
@changed every node whose files differ from the server (the plan's own diff)
* everything, the same as leaving --select out; a CI step that always passes a selector can pass this one to run the whole project

Only selected files are pushed. An unselected lens is not validated and not touched, so a broken file in a sibling does not block yours. A selection that changes a shared asset an unselected published lens compiles against is refused before anything lands, naming the lens; entity/orders+ takes every reader along. A selector that matches nothing is an error. --lens <name> is an alias for --select lens/<name>.

Tables and the model DAG

A table/ name matches case-insensitively on the qualified name or its trailing parts, so table/orders matches an entity on marts.orders. Globs work as on the other kinds (table/stg_*+). A plain name that matches tables in two schemas takes both, and the selection notes it.

With a lineage: in dst.yaml (see Configuration), or --lineage PATH on the command line, table/X+ starts from a model, seed, snapshot or source of the transformation tool and walks its DAG down to the tables entities read. For dbt that is target/manifest.json: the child_map edges, and each node's relation (an ephemeral model has none and is walked through). For SQLMesh it is the project's models/ files: the MODEL (name …) header names the table, and the tables its query reads are its parents. dst runs neither tool. A SQLMesh Python model, or a query that does not parse, stays in the graph unwalked, and every selection that walks the DAG names it, since a table it reads does not reach it.

--tables-from FILE reads one table or model name per line (- reads stdin) and selects table/<name>+ for each, so the transformation tool's own selector grammar does the picking:

dbt -q ls -s state:modified+ --resource-type model --output name \
  | dst apply --tables-from -

Blank lines and # lines are skipped. A line that is not one name, such as a dbt log line when -q is left off, is skipped and the count is printed.

A table selector never fails the run. A name that matches no table an entity reads and no model in the lineage is a note naming it. A selection that reaches no lens says which of the tables it reached no entity reads, pushes nothing, and exits 0: a changed model that no lens reads is a normal CI state. An empty --tables-from selects nothing and exits 0 without contacting the server. The plan's selection row (--json) carries paths, one entry per pick with table, entity, definition (when the lens reaches the entity through one) and lens; the human output prints the same paths under the selection line.

--scope {all,semantic,certified,cases,config} limits which kinds of files are pushed: semantic/**, each selected lens's certified_answers.yaml, its evals/cases.yaml, or dst.yaml and the other project-level files. certified and cases change only that one file of a lens that is already on the server. --scope cases lands the cases against the published lens and runs no eval gate: nothing recompiles or republishes, and the next apply that publishes the lens scores against them.

Plan predicts apply: every semantic/** file is validated through the same seam apply parses with, so a file apply would reject plans as invalid on its own row (all of them, not just the first), and plan exits 1. A clean plan exits 0.

Plan also says what it cannot predict. Every run prints a not checked by plan block: warehouse connection probes, eval-case expected_sql actually executing, and the publish eval gate all need a live warehouse and happen only at apply, so a green plan is not a promise that apply succeeds. And a drift: '<connection>' UNARMED footer means no committed profile exists yet, so drift detection has no baseline to compare against; dst probe arms it.

One footer is about your files rather than the server's view of them: skills: N scaffolded file(s) differ from this dst appears when AGENTS.md or a .claude/skills/ page no longer matches what the installed version ships — dst init . --skills-only refreshes them. Only files that exist are compared, so deleting a skill you don't want is silent rather than a permanent nag, and the line never changes the exit code.

dst plan on a cold project: six green creates, then the not-checked-by-plan block naming what only apply can verify

dst plan --full after a definition edit: the diff in red and green, the stale lens, and the certified answer the change touches

dst apply

Deploy the project directory; files win. Blue/green and all-or-nothing: any error aborts the whole apply (APPLY ABORTED, exit 1) and prior versions keep serving; connection declarations are probed before landing. A connection whose entities name their tables is probed with one connectivity check plus one row-less read per declared table, not an introspection of every dataset the credential can see; a declared table that cannot be read is a warning naming it. Each warehouse step runs under DST_APPLY_STEP_TIMEOUT_S, and a step past it is named with the connection's declared-table and dataset counts.

The apply runs on the server as a job. dst apply starts it, prints each lens as it lands, and polls the job until it ends, so a client timeout or a proxy that cuts long requests never loses the result. --no-wait prints the job id and returns at once; dst apply status <job id> prints the job's state and per-lens progress, and once it is done, the same report dst apply prints. A second apply while one runs gets a 409 that names the running job and the dst apply status command that attaches to it.

A pushed evals/cases.yaml owns the lens's approved cases: a case absent from it is retired, and the lens row counts it (eval cases: … retired 1). A lens with no evals/cases.yaml in the push keeps its cases. Certified answers already work this way (an answer absent from a pushed certified_answers.yaml is deleted, except those a review approved). Values the server records onto a row (a probe's verified value and prose, timestamps) are not differences when the file does not carry them, so dst plan right after dst apply reports zero changes. Exit is non-zero on any error, not just rejected lenses. Every stage (connections, semantic assets, eval cases, certified answers, the lens publish) shares one transaction, so a failure deploys nothing and the error line says so.

dst apply, first publish: the connection probed, every asset narrated, five warnings including the loud gate SKIPPED

dst apply blocked: a certified answer diverged under a changed definition, the eval gate rejects the lens, and the red APPLY ABORTED banner says nothing was deployed

The default output is a grouped report: one section per scope/lens, warnings and errors in place, a per-connection capability line (read ✓ · query ✓ · query history ✗ …) for every connection the apply probed, ending in a Apply complete. counts line. --json prints the server's raw row array: the machine shape for agents and scripts.

Flags: --json, --dir, --timeout (seconds, default 300), --probe-certified (execute each new certified answer once, read-only and row-capped, to record its verified value; new entries only: already-stored answers are not re-probed, and probing zero says so; re-author the sql or run dst test for a sweep. Opt-in, costs one warehouse query per answer; a probe failure warns and stores the answer anyway), --require-gates (fail closed: abort, exit non-zero, if any lens configured for an eval gate had it skipped (empty suite, provider error, or unreachable warehouse alike); by default a skipped gate publishes with a warning. CI wants this flag: without it a provider outage silently converts a gated apply into an ungated one that exits 0), --no-wait, and --select / --lens / --scope (see Selecting part of the project: only the selected lenses are validated, pushed and gated; a changed connection that an unselected lens declares is refused the same way as a changed shared asset).

Lenses whose managed files match the server exactly report unchanged and skip the publish path (no recompile, no version bump, no eval-gate generation), so a no-op apply is cheap and apply; plan converges to zero changes. The footer adds one gate line (eval gates: 2 passed, 40 skipped (…)) whenever any lens was gated.

A timed-out apply is still running

The handler is synchronous: a client disconnect cannot cancel it. If the CLI times out, the server still holds the org apply lock and will commit when it finishes; the message says so. Poll dst plan for committed state rather than re-applying (a second apply gets 409 while the lock is held). The first certified answer an org ever applies pays the embedder's cold start; raise --timeout for it. A 502/503/504 from a proxy is the same situation: upstream never answered, so that family gets the in-flight message, not the rollback one.

dst export

Write server-side lenses into the project directory: the adoption path for lenses that predate the files. Prints a connections: snippet to merge into dst.yaml by hand; never auto-writes it, and secrets never leave the server. Flags: --lens <name> (repeatable; default: everything), --dir.

dst introspect

Print a connection's schema, agent-legible: the raw material for authoring semantic/ files. Flags: --connection (required), --tables a,b (subset), --profile, --json.

--profile adds the facts a schema cannot give you (enum values, null rates, ranges) by running the catalog + sampling passes against the warehouse right there. The reads are row-capped, but it is one sampling pass per table in scope: narrow it with --tables on a wide warehouse. Without --profile the listing is schema only and says NOT PROFILED at the top, so a bare schema is never mistaken for a complete answer. The dst.yaml path is the one that samples; when the command falls back to the server, the facts are whatever that connection's profiling passes already stored.

Every non-system schema is searched, and names come back qualified (spider.player); scope the connection with schema: <name> (or, on BigQuery, datasets: [a, b, c]) under its config in dst.yaml. On a warehouse too wide to list fully the unscoped listing is capped and says TRUNCATED at the top; --tables is unaffected by the cap: it resolves the named tables against the FULL catalog, at any qualification depth (table, dataset.table, project.dataset.table). One column per line, - <name>: <type> (<warehouse type>). Copy the first type, which is the value fields[].type takes. Use --json for anything that parses rather than reads: no prose separator survives a warehouse that can put , inside a type and a space inside a name. A connection that yields no table is an ERROR, not a blank line: the message names the schemas searched and the command exits non-zero.

dst probe

Record the warehouse's full profile into the project, at profiles/<connection>.probe.json. introspect --profile prints those facts to your terminal, where they help you author and are then gone; probe writes them down: the same catalog and sampling passes plus partitions and freshness, crossed with the entities that read each table. Flags: --connection (default: every warehouse connection dst.yaml declares), --tables a,b, --sample-all, --dir.

Commit the artifact. The next dst apply ingests it, and the value dictionaries land in the serving prompt, so generation filters on the literals the warehouse actually holds. A column storing 'FI' is the difference between an answer and this:

"customers in Denmark and Finland" → WHERE country IN ('Denmark','Finland') → zero rows, reported as "there are no customers in Denmark or Finland."

Nothing errored, so nothing warned. A filter written from the question's vocabulary instead of the column's returns a confident, empty, wrong answer, and a committed value dictionary is what stops it. Describing the domain in a field's description does the same job for facts you know; probe is for the ones the warehouse knows and you have not written down.

Sampling covers the tables the semantic layer reads: everything, while the layer is still empty. --sample-all samples every table and --tables pins an exact list; the catalog pass records every table either way. A table a run does not sample keeps the facts the previous probe sampled for it, except on a column the warehouse has since retyped, so --tables refreshes the tables it names and leaves the rest of the artifact as it was. Each sampled table costs at most three statements (one aggregate carrying counts, ranges, means, the time columns' offsets from the entity's default_time_field and the whole-table freshness; one for every value dictionary; one for the shape probes), and the run ends with what it cost per connection: statements, bytes billed, and the estimate where the engine prices bytes (BigQuery); an engine that reports no bytes says so rather than printing $0. Re-run it whenever the warehouse moves (a nightly cron is the intended cadence), because a value dictionary is only as true as its last pass.

Ingestion is advisory, never governance state: a malformed or connection-less artifact warns and skips, a stored profile newer than the incoming one is kept per table (a server refreshed over REST outranks an old commit), and absence never deletes. The drift baseline lives in the same directory: the first probe records it (arming drift), and no later probe touches it, so the evidence drift compares against survives the nightly refresh.

--cube reads through the project's Cube instead of a warehouse connection, for a project with cube/overlay.yaml. Every query is a /v1/load on a view member, as a caller would ask it: the value list of each dimension that declares meta.dst.dictionary (up to probe.cube.max_values, recorded as incomplete past that; a hidden dimension's values are never read), and the data end of each time dimension of the lens views, with whether rows are dated after the clock (--as-of, default yesterday). A time dimension whose latest dates are consecutive first-of-month days ends on its month's last day. One budget, probe.cube.max_queries in dst.yaml (default 500), covers the run; what it leaves unread is listed in the artifact and printed. The result is profiles/cube.probe.json. dst plan hints on a dictionary: true dimension it holds no values for.

dst drift

What has the warehouse done since you profiled it, and does the semantic layer still match. introspect is a snapshot; this is the diff against the baseline committed at profiles/<connection>.json, on two rails. Against the live catalog: new, dropped and retyped columns, and a column whose comment changed (listed on one line as comment only: no warning on the assets that read the table, and no effect on the exit code). Against the newest probe artifact: a time column whose median offset from the entity's default_time_field moved past probe.drift_tolerance, a numeric column whose mean did, a complete value dictionary that lost or renamed a member (a member gained is reported, not breaking). The second rail is what catches a column whose comment went from "UTC" to "local time" while its name and type stayed put: the schema diff is clean, and every duration derived from it is wrong, verified. Crucially the cross-reference: a change on a table a definition, entity, relationship or certified answer reads is flagged with the asset that reads it. This is how the layer avoids silently serving a stale derivation after the warehouse grew the real column, e.g. "orders gained discount_amount; definition discount derives it from list_price − unit_price — review whether the new column supersedes the derivation." Findings the layer reads sort first, definition-backed ahead of entity-only. Exit 0 clean or comment changes only, 2 changes none breaking, 1 a declared reference broke (a drop, a retype, a shift past tolerance, a dictionary member gone), 4 not armed. --json; --accept re-records the baseline once you have reviewed (the catalog's schema and comments, the artifact's measured facts), and dst apply advances it the same way at deploy. dst probe arms it on the first run and never rewrites it afterwards.

dst plan runs a cheap version of this every time: when the warehouse has changed since profiling it prints one line pointing you here, and it never touches the warehouse when no baseline exists or the connection is down (the degradation is visible only under plan --json). Flags: --connection, --accept, --dir, --json. Without --connection every warehouse connection dst.yaml declares runs in turn, findings under a connection <name>: heading, and the exit code is the worst of them; --json then prints one list with an object per connection.

dst drift: orders gained a column, cross-referenced to the entity that reads the table

dst migrate-model

Writes the project's entity catalogue as a Cube model. Reads semantic/ (entities, relationships, definitions, table blueprints), lenses/ and the probe under --dir, and writes under --out (default cube/): model/<entity>.yml with one cube per entity, model/views/<lens>.yml with a scope view per lens plus one view per cube with in-lens joins, holding the dimensions of every cube its many-to-one and one-to-one joins reach, two hops or more (a Cube view resolves one join tree; a one-to-many join is left out, since it would fan out the measures), overlay.yaml with everything dst reads that no member's meta.dst carries (each lens's views and policy, each cube's clock and routing text, prose and ambiguous definitions, hide exceptions), and MIGRATION.md, which lists every item the Cube model does not carry as authored with the failure mode a question would meet there.

What changes shape on the way: a population filter and a blueprint's versions (the latest sync per key) are baked into the cube's sql, and the cube's key becomes the blueprint key; a text YYYY-MM month becomes a time dimension cast to the month's first day; internal and hidden columns are public: false; ratio and derived metrics are number measures; a sum_distinct_on metric moves to a companion cube at the distinct grain, joined as its parent is wherever the join's columns are the distinct key; a definition with sql becomes a segment; a field named like a metric is renamed <field>_value, since a cube has one namespace. Certified answers stay where they are.

What the monitor and the cube lane read is written to the overlay too. A cube's feed_axes are the dimensions that say which book or system a row came from: a key column that splits two or more blueprinted tables by the same values (an entity, a revenue stream), and a key column whose every value the blueprint's system names (google_ads in "Google Ads / Meta Ads exports"). A date field the probe saw rows for after the day it ran gets a clock_kind on the evidence the monitor reads: event when its name, description or blueprint clock meaning says something happened (decided, paid, closed, created), schedule when it says something is due (due, end, planned, expires); a field that says neither is a schedule, and a cube's clock that says neither is left to the monitor. When most values of such a shared key column end in a legal form (Oy, AB, Ltd, GmbH), those values are the companies of scope.names, each named by itself and by its name without the legal form; the other words a question may use for one (a country, a system, dictionary:<cube.dimension> for its regions) are yours to add.

Every view lists its members. A view with includes: "*" serves a cube's public: false members through the view, so an internal column, or one hidden from everyone, is in no view's list. A column hidden with except_groups is listed and withheld by the view's access_policy: every caller is granted the view without it, and each exception group is granted it too. Cube reads the groups from dst's token through contextToGroups in cube/cube.js (the sidecar's config ships it); a Cube without it grants a named group nothing, so the exception fails closed.

The output is generated once and then authored. A re-run writes only files it wrote before and nobody has edited since (it keeps a sha256 per file in .dst-migrate.json), removes a generated file its source no longer produces, and never touches a file it did not write. A file edited since generation is kept as yours when its source has not changed since, and stops the run with exit 1, naming it, when the source has; --force overwrites it. The views follow the cubes as you edit them: a member you add to a cube is listed in every view that carries the cube, one you remove is dropped, and a cube you write by hand joins the lens that selects a cube its meta.dst.sources names.

--check (alias --dry-run) writes nothing: it prints a unified diff of each file that would change (a new file as (new, N lines)) and exits 2 when something would change, 0 when the model on disk is current, and 1 when a generated file was edited by hand since (the same refusal as a run; --force lifts it). A real run also writes cube/cube.js, the sidecar's config, when it is absent, and never overwrites it. Both end with a Next steps: checklist, each step marked [x] when the project already shows it: a cube: block in dst.yaml, CUBEJS_API_SECRET in .env, a cube service in docker-compose.yml, starting it (docker compose --profile cube up -d, then dst cube status), reading cube/MIGRATION.md, dst probe --cube, dst plan, dst apply, dst monitor then dst apply, and dst test. The whole move, step by step: Migrate to Cube.

Flags: --dir (default .), --out (default cube/ under --dir), --check, --force.

dst monitor

Data quality through Cube, for a project with cube/overlay.yaml. Runs the dst probe --cube pass, then judges what it read, one failure mode per finding:

  • stale: a cube's clock ends more than the lens's stale_after_days before the clock (a month-grained clock is current through the last complete month);
  • feed_stopped (data_gap): one feed of a cube ends that long before while its newest feed is current. A cube's feeds are the combinations of the dimensions overlay.yaml declares under cubes.<cube>.feed_axes, the columns that say which system a row came from;
  • future_rows (data_gap), on every time dimension: rows dated after the clock on an event date. A date is an event (the day something happened) or a schedule (the day something is due or ends, a renewal date) as cubes.<cube>.clock_kind declares it, else as its name or description says (decided, paid, closed, created read as events; due, end, planned, expires as schedules). The rows after the clock on an event date are clipped from every window, never counted. A date that neither declares nor says its kind reads as a schedule when it has rows after the clock, and the finding says so once. A schedule date is never clipped to the clock and is not judged for staleness, feeds or partial periods;
  • partial_period (data_gap): per additive measure (sum, count, count_distinct; never a level) on its clock, and per feed, the latest month against the median of the six full months before it, pro-rated to the days loaded. It is partial below 70% of that median and below every complete month in the series' own history, so a series that dips like that every quarter is never flagged. A series needs six judged months and a median of at least 20 before it is judged at all. A month the same month a year earlier dipped alike (scaled to this year's level) is a seasonal low and is not flagged. Volume alone never decides a closed month: a month the rule flags is a partial load only when the evidence says so. Where the cube declares loaded_at (a sync or export time), the month is partial when its rows were last loaded before it ended. Otherwise a month still open on the clock is partial, and a closed one is partial when it has no rows on its last seven days or its second half is loaded at under 70% of its first half's daily rate. A month-grained clock has no day coverage, so there the volume rule decides, and the finding says so. The finding names its evidence, and the lane's disclosure follows it: "partially loaded" only on load evidence; a month whose load evidence says complete is not flagged at all unless the cube declares matures_after for the measure (days after a period ends before its values are final: work billed after completion, refunds still arriving), and within those days it is disclosed as complete with its values still maturing, naming the measure. A feed is judged by the measures cubes.<cube>.feed_measures names (a billed amount that lags rows that are all there), else by its row counts, and a period they find partial is partial for every measure of the cube on the same clock (judged_by names the judge);
  • unbound_value_new / unbound_value_vanished (unbound_value): a dictionary the model declares as a list that the warehouse no longer matches.

A cube's clock is its overlay default_time_dimension, else a measure's meta.dst.clock; a cube with neither is not judged, never guessed. It writes profiles/cube.probe.json, profiles/cube.freshness.json (per clock its data end and feeds, per measure a partial month) and lenses/<lens>/results/monitor-<date>.json with the findings on that lens's cubes. Committed and applied, the freshness file becomes the data_quality block on /ready: per org, when the monitor ran, how old that is against probe.max_age, and its findings by mode. Flags: --dir, --as-of DATE (the last day data is expected through, default yesterday in UTC), --json (the summary). Exit 0 clean, 2 findings, 1 when Cube or the project could not be read, which makes it a scheduled job's gate.

dst sql <sql>

Run read-only SQL and see the rows: the governed version of opening a warehouse client. introspect says what the columns are; it cannot say what they contain together, and deciding a business rule ("is a refund a negative amount, or a row with status='refunded'?") takes five actual rows. Flags: --connection or --lens (exactly one, required), --limit (default 20, max 500), --json, --dir, --url/--token/--key.

dst sql "SELECT order_id, status, amount FROM orders" --connection warehouse --limit 5

Guarantees, all of them the reason to use this instead of a warehouse client: one SELECT statement, no DML/DDL anywhere (services/runtime/sql_guard.py, the same guard generated SQL passes), row-capped with truncated said out loud when the cap fires, and logged to request_log, so the probe behind an authoring decision sits in the audit trail next to the answers that decision shaped.

--connection <name> probes the whole connection and needs an admin token: a connection is an org-level credential, not a caller-scoped grant. It requires the connection to be applied (this command runs server-side; introspect reads dst.yaml directly and works before the first apply). --lens <name> probes inside one lens's allow-list and works with a dst_ caller key: every table and column checked against the compiled model, and SELECT * refused there, because a star is how a column the lens does not expose would come back. Mirrored as the sql MCP tool.

It complements introspect --profile rather than repeating it: per-column enum values, null rates and ranges come from the profile in one pass, so ask it for those. Reach here for rows, cross-column facts, and join checks a profile cannot see.

On the lens door a statement that reads an exposed table is an outside-lens read: the row lands in the request log with lane: explore, and the command prints what it could and could not verify under the rows: the GRAIN and DATA END lines, the clock of every time column read, the join check (rows after the joins against the base table's rows), the reconcile check (the number beside a certified answer over the same tables and window), and any check that reads could not close. --question "…" records the question the read answers: the log keeps it beside the SQL, a review ticket on the request carries it, and dst rule --certify certifies the pair. Without it the request has no question, and certifying it is refused.

Ask and verify

dst define <term>

Print what a governed term means, verbatim: the sibling of dst query. query answers questions about data (governed SQL, a warehouse execution); define returns the approved definition and nothing else: no generation, no warehouse, nothing billed. Flags: --json (the full DefinitionLookup), --timeout, --dir, --url/--token, --key.

--key dst_… looks up as that caller, so you see only the terms from lenses that key may use, the same scoping query obeys. Exit 1 when nothing is governed, so an agent branches on the code instead of parsing prose: "we have no approved meaning for this word" is a distinct answer from any definition.

Deliberately an index lookup rather than a search: top-k retrieval over a governed vocabulary can miss precisely the load-bearing terms, and a definition surface that quietly returns a near-miss is worse than one that says it has nothing.

dst query <lens> <question>

Ask a governed question from the terminal: the verify step of the authoring loop. Prints the answer, the SQL, the confidence line, and the request_id (dst correct takes that and nothing else); a clarification prints as clarify: with its options. Flags: --json (the full QueryResponse), --timeout (default 180s), --dir, --url/--token, --key.

--key dst_… asks as that caller instead of as the admin, and it is the only way to verify an access grant: an admin token bypasses every lens allow-list, so "I granted B access — does it work?" answers 200 whether the grant landed or not. Grant → ask with B's key (expect the answer) → ask with C's key (expect exit 1 and a 403). Resolves from DST_API_KEY when the flag is absent; an explicit --key beats the admin token.

Exit codes carry the outcome, so a script can branch without parsing prose: 0 the question was answered; 3 the lens declined (a refusal or a clarify:), which is a governed outcome to act on, not a failure; 1 it broke (a bad request, no server, a guard rejection). A refusal is deliberately not code 1: "I will not answer that" is the product working. --json carries the same distinction as status.

dst lens prompt <lens> <question>

Show exactly what the model sees for a question: the assembled system prompt, the prose context, and, per authored asset, whether it reached the prompt or was dropped (not selected, trimmed for budget, or escalation-only). No LLM or warehouse call. This is how you catch an authored definition or dimension that validates and applies but never reaches the model: if it isn't in this output, the model can't use it. --json for the full structure.

dst test [lens]

The certified corpus as the regression suite: for each active certified answer, execute its stored SQL (the oracle) and run its question through generation with certified matching disabled, then compare executed results. Approved behavioral expectations (expect: clarify|refuse) run alongside, scored on response shape. Default: every published lens in this project's org (--all says the lens default explicitly). A passing answer re-stamps its bindings to current hashes: re-verification through evidence. Runs in-process; needs a smart-tier model configured.

--select, --tables-from and --lineage narrow the sweep to the lenses a selection reaches, with the grammar of plan and apply, resolved against the project files under --dir. @changed needs the server's view and is refused here. A selection that reaches no lens prints its selection line and exits 0 without testing anything; --json then carries the selection row and total: 0.

Exit codes carry the outcome, so a deploy gate branches without parsing prose: 0 everything verified passed; 1 something diverged; 4 nothing was verified: the lens has no certified answers and no eval cases, so the run could not have failed. Treat 4 as not-green: it is the code that separates a green run over an empty suite from a green run over a real one.

Each case prints as a ledger row (PASS/FAIL, org/lens: question, the divergence when there is one, and the case's wall-clock), then a rule, the N/M passed summary, and a recorded: line per lens naming the run id and the database it was written to (DATABASE_URL, password hidden). --json emits the same rows structurally (org, lens, question, verdict, certified/generated result, reason, elapsed_s, and the join keys: case_id, the row's eval_result.case_id (certified:<id> on the data lane, slots:<id> on the slot lane, the case id on behavioral rows), and certified_answer_id wherever a certified answer is graded) plus the summary, recorded (org, lens, run_id) and database, for CI that wants the table rather than the exit code alone. calibration_by_slot gives the deciders' calibration per decision slot (shape, metric, dimension, grain): n, accuracy, the unanimous bin's n and accuracy, and ECE (null, with the status saying why, below 20 measured decisions). Every recorded row stores its generated value in eval_result.actual_value: the executed result as JSON on the data lane (the shape a verified_value has), the typed intent on the slot lane.

Behavioral cases that were answered from an exposed table are outside-lens answers, and the summary scores them as their own path, on an explore: line: right (the case expected an answer and got one), honest (it expected a clarification or a refusal and got one), wrong, and what their model calls cost. A right answer from an exposed table is not a governed pass, so it is never added to one. --json carries the same figures under explore, and each row's lane.

dst test with nothing certified: 0/0 passed, exit 4, and the warning that this run could not have failed

dst test with two certified answers and a behavioral case: three green PASS rows, 3/3 passed

Under typed serving the run is three lanes: the resolution lane (every certified question decided by the provider, graded per slot, no warehouse), the compile lane (compiled SQL against the certified text), and the data lane, which executes only the cases the first two could not prove. A case whose compiled SQL differs from the certified text but whose rows match on the data lane is reported differs (data equal) (sql_data_equal on its JSON row): the data lane is the oracle, and a different spelling is not a failure. --slots runs the first two only; --rows executes every case; --repeat N resolves each question N times and fails any that does not produce the same intent every time.

Flags: --all, --json, --dir (default .), the project whose .env supplies DATABASE_URL and the provider keys, so CI and cron can point the sweep at a project from outside its directory. --tag (repeatable, any-match) runs only behavioral cases carrying that tag: --tag intent:discriminator scores the routing slice on its own; certified answers carry no tags, so a tagged run is a case slice. --org <name> picks the org to sweep (default: the one this project's DST_ADMIN_TOKEN authenticates as — lens names are not unique across orgs, and an unscopable run sweeps every org and says so). --url/--token are accepted for uniformity and ignored (this command talks to the database, not to a server); passing them prints a note saying so.

dst runs <lens>

The run history dst test records (eval_run/eval_result), on the terminal: every run newest first — id, mode, score, pass/fail/error counts, started. --json for the parseable form. Reads through the server at DST_URL, while dst test writes in-process to DATABASE_URL: a run recorded against a database this server does not serve is not in this list, and the empty-list message says so. The recorded: line dst test prints names the database to compare against.

dst runs --all [--last N] lists every lens on the server with its last N runs (default 5) in one request (/mgmt/observe/runs); a lens with no history is listed as such. --json gives {"runs": [{"lens", "runs": [...]}]}, one entry per lens.

dst runs <lens> --diff A B compares two runs: score delta plus the per-case flips — newly failing (with the failure reason), newly passing, still failing, and cases present on only one side. A/B are run ids (a unique prefix is enough) or the words latest / prev — prev stays within latest's mode, so the apply gate's regression runs never silently become a dst test baseline. Exit 1 when B regresses A: the score dropped beyond the publish gate's epsilon or any case newly fails — a flip hidden by an unchanged score still fails the build. Cases join on the question asked, so the compare holds across environments too: --other-url + --other-token resolve B on another server, and --other-token alone resolves B as another org on the same server — the org-per-env shape dst env new mints. Same suite, sandbox vs production.

dst test --compare-last prints each lens's score against its previous test run after recording (informational; the exit code stays the suite's own — dst runs <lens> --diff prev latest is the comparator CI branches on).

dst experiment <lens>

Measure N lens-config variants side by side, without touching your project or any shared environment. Each --vary is a dimension dotted into lens.yaml (--vary model.temperature=0.0,0.7 --vary answer_mode=strict,balanced); variants are the cartesian product, capped at 8 — each one costs a gated apply plus a full test sweep, and the cap says so rather than hiding it.

Under the hood it is only the verbs you already know, in order: dst env new exp-… mints a disposable org, then per variant a copy of the project gets its lens.yaml patched and applied (--env), the suite runs, and every variant's recorded run is diffed against variant #1 with the same comparator CI uses — so the table shows score, pass/fail, and the per-case flips, with newly failing questions named. The env is removed at the end (--keep to inspect it; the kept name is printed). --json for the parseable form. Exit 0 when every variant produced a measurement — a variant that scores worse is a result, not an error; a variant that could not be measured (apply rejected, suite errored) exits 1.

$ dst experiment customer_balances --vary model.temperature=0.0,0.7
experiment env: exp-3f9a41c2 (2 variant(s))
   VARIANT                                       SCORE  PASS  FAIL  VS #1
#1 model.temperature=0.0                          100%     5     0  baseline
#2 model.temperature=0.7                           80%     4     1  1 newly failing
     newly failing: How many customers churned last quarter?

dst evals from-traffic <lens>

Production questions become the suite. Reads recent request-log rows for the lens (--limit, default 200) and drafts each as a behavioral case whose expectation is the observed outcome: an answered question pins expect: answer, a governed decline pins refuse or clarify. Errors are faults, not expectations — skipped. Drafts are appended to lenses/<lens>/evals/cases.yaml (existing bytes and comments untouched) as status: candidate / source: harvested, deduped against the suite by normalized question. Candidates are visible to dst test but never scored; review, promote to status: approved, then dst apply — the file is the interface. This is how a fresh environment inherits production's questions without inheriting production's data.

dst evals migrate

Local file rewrite, no server: every value-shaped eval case (has expected_sql) becomes a certified_answers.yaml entry; cases.yaml keeps only behavioral entries. Value cases are not scored anywhere: certified answers are the regression suite. Nothing lands until you review and dst apply. Flag: --dir.

Governance

dst keys create --caller <name> / dst keys list

Mint a caller and their API key (shown once), or list callers. One key per person, never per tool.

--group <name> (repeatable) sets the caller's groups, which a lens's access.allow and a hide entry's except_groups read; on an existing caller it replaces them (PUT /mgmt/callers/{name}/groups does the same). Only an admin credential sets groups. dst keys list prints each caller's groups.

--driver marks the caller a driver: an agent that writes its own Cube queries and SQL. dst calls no model for that caller's requests to lenses served through Cube (see driver mode). PUT /mgmt/callers/{name}/driver with {"driver": true} does the same, and dst keys list marks driver callers.

dst keys create: the caller and their key, shown once

dst keys sync-idp

Revoke the keys of every caller the identity provider no longer lists. Reads the users listing at DST_OIDC_USERS_URL through the server (POST /mgmt/callers/sync-idp, so a cron curl with an admin token does the same) and revokes the keys of each caller an IdP sign-in bound to a subject the listing no longer carries; callers an admin created by hand are never touched. --dry-run reports without revoking.

identity provider lists 41 user(s); 12 caller(s) here are bound to it
revoked 1 caller(s): tom@corp.example
keys revoked: 2

Exit 1 with the reason when the listing cannot be read or lists nobody: nothing is revoked on a listing the server could not trust.

dst revoke-key --caller <name>

Revoke the caller's active keys. In-process, immediate. Scoped to one org: pass --org, or run from a project whose .env carries DST_ADMIN_TOKEN. Caller names repeat across tenants, so this command refuses to act rather than guess.

dst revoke-token <raw>

For leaks. Kill one credential when what you have is the credential itself: the string in the committed file, the CI log, the screenshot. Takes any kind: dstadm_ admin token, dst_ caller key, dsto_ OAuth token. You do not need to know which store it lives in, which caller it belongs to, or which org.

dst revoke-token dstadm_...
revoked 1 admin_token in org 'acme'

Three outcomes, deliberately distinct; during containment they mean different things:

Output Exit Means
revoked 1 <table> in org '<name>' 0 Done. The org is named so you can see which tenant you touched.
already revoked (<table>) 0 Someone got there first. Safe to re-run.
no such credential in this database 1 Not contained: you are pointed at the wrong deployment. Check DATABASE_URL.

Unlike revoke-key this needs no --org: a token hash is unique across the database, so there is exactly one row it can touch. Revocation takes effect on the next request; there is no caching window.

dst correct <request_id>

File a correction against a served answer: step 3 of the correction loop. Opens the review ticket the ruling is made on. Flags: --kind definition|scope|number|freshness|other (required), --target (required; the term the correction is about, used verbatim, so the fix lands on the right page), --note/--note-file, --corrected-sql, --corrected-answer, --json, --timeout, --dir, --url/--token, --key.

--key dst_… files as that caller, which is the posture of the person who actually found the wrong answer: a business user holds a caller key and no admin token. Resolves from DST_API_KEY when no admin token is in scope; an explicit --key beats the admin token, and an ambient admin token otherwise wins (so an analyst holding both keeps filing org-wide).

Scope. A caller key may correct only its own requests: the ones it asked. Filing against another caller's request_id is a 403, and so is reading their ticket. An admin token files against anyone's, which is what lets the data team triage. Enforced server-side on /v1/reviews, not in the CLI.

dst observe

Who has been using this layer, and what for. Read-only, admin-authed, four shapes:

dst observe                 headline + usage per caller
dst observe callers         who, how many, how much, how many errors
dst observe requests        what they actually asked
dst observe show <req_id>   one request: question, SQL, confidence, purpose when logged
dst observe export          the request ledger, every row in the window

Flags: --lens, --status ok|refused|error (with requests), --limit (default 50; the server caps it at 10000 — there is no cursor, so the cap is the only page), --include-test, --json, --timeout, --dir, --url/--token.

dst observe export --since 2026-10-01 [--until 2026-10-08] [--caller ana] [--format csv|json] writes the request ledger (GET /mgmt/requests): one row per request, ts, caller, agent, question, lens, covered, answer_kind, certification, request_id, CSV by default. answer_kind is certified, generated, clarify, refuse or error; covered is false only for a refusal.

Test traffic, requests whose agent (X-Dst-Agent) is dst-test or benchmark, stays in the ledger and the export but is left out of the headline, the basis line and the caller rows; the headline says how many requests it left out, and --include-test counts them.

Outside-lens reads (lane: explore in the request log: the sql tool inside a lens, and answers read from a table a lens exposes without definitions) are not governed queries and are not counted in the headline. An explore: line reports them apart: how many, how many answered, their AI and warehouse cost, and the bytes they scanned.

The bare form is the answer to "the CFO wants to know who has been using the reporting tool": one line of totals, then a row per caller. The totals line labels the two bills apart: AI $… (the model providers) and warehouse $… (the scans, where the engine prices bytes), each with the number of unpriced items behind it when there are any (such a total is a floor); then the warehouse bytes scanned (the KPI payload carries the bytes per lens too). AI by purpose: splits the AI spend by what each provider call was for: route, decide (a typed slot or the reading of an ambiguous term), judge, equivalence (is this a paraphrase of an approved question), bind (a certified template's values), generate, compose. It is read from ai_call, one row per provider call, written for every question asked through a door; requests from before it carry none. Eval runs (dst test, the publish gate) record their own tokens and cost on eval_run and eval_result, and a test traffic: line says what they spent, outside the totals. The AI spend includes the router's spend on questions asked without a lens that no lens served (a decline or a refusal); a line under the headline says how much of it that is. A routed question that was answered carries the router's spend on its own request row. requests --status error is the fastest way to find a metric that is failing repeatedly: a caller retrying the same question three times in two minutes is visible here and nowhere else.

dst observe: the headline, then a row per caller with queries, cost, declines, and errors

dst reviews

List the review queue, all states and origins. Flags: --state open|ai_review|needs_human|approved|changes|rejected, --origin ai|human (ai = auto-flagged by a lens's auto_review policy), --json (machine-readable, unfiltered by default), --watch (poll needs_human, print each new ticket once with its question; Ctrl-C stops), --interval (watch poll seconds, default 30), --dir, --url/--token, --key.

With --key dst_… (or a project whose .env holds only DST_API_KEY) this reads the caller-scoped list instead: the tickets on your own requests, and their state, the other half of the loop for whoever filed the correction. The whole-queue view stays admin-only, as does --watch.

dst rule <ticket_id>

Rule on a review ticket. Flags: --verdict approve|changes|reject (required), --reasoning, --certify (after an approve, promote the request's question→SQL to a certified answer in the same act; requires --verdict approve). See The correction loop.

On a ticket raised on an outside-lens answer (a read over exposed tables that carried a question), --certify writes a kind: sql pair pinned to the blueprints of the tables it read. On a lens served through Cube, --cube-query '<json>' supplies the Cube query that is the governed reading of the question: the server compiles it, runs it beside the answer's SQL and certifies only when the rows are the same, and the command writes the kind: cube pair, with its query and verified hashes, to lenses/<lens>/certified_answers.yaml under --dir (printed when the project is not at hand). Rows that differ are a 409 and no pair.

dst seed-lens <ticket_id>

The other outcome of ruling on an outside-lens answer: instead of certifying one pair, scaffold the lens the table was missing. From the ticket's request it writes one semantic/entities/<name>.yaml per exposed table the SQL read (name, source, the fields the lens lists, the blueprint's grain and key, its clocks and caveats as comments) and lenses/<name>/lens.yaml selecting them, with the question as an expect: answer case in evals/cases.yaml. Every slot the ticket could not fill (description, dimensions, metrics) is left empty and marked TODO: the files say where the definitions go, and the author's agent fills them. Flags: --name (default <first entity>_seed), --dir, --url/--token. An existing entity file is kept; an existing lens directory is refused. Needs an admin token; a ticket on a governed answer is refused, since it has a lens already.

dst retire <lens> <answer_id>

Stop serving a certified answer, keeping its history — the way out when an approved answer turns out to be wrong. A retired answer is never served, matched, or tested again, but its row and provenance survive, so the record of what you once vouched for stays intact. (Deleting it instead would take that record with it.)

Reach for this when a definition change makes a certified pair wrong and re-certifying is not what you want, or when a promoted answer should never have been promoted. File authored answers can also carry status: retired in certified_answers.yaml; this verb is how you retire one that came from a review ruling, which no file owns. Flags: --url, --token.

dst lens list

The deployed lenses, from the server: name, status, shape (entities/definitions), query volume, and origin. Files and server state diverge by design (file absence never deletes; a lens created through the API is server-only until adopted), and this is the CLI read path for that: a lens marked not in files is the adoption cue; dst export --lens <name> brings it under the project. --json for the raw rows.

dst lens log <name>

The lens's published history as a change log, newest first: version, date, who published it (a dashboard user, an admin token by label, or a server process such as a recompile), and the summary the publish recorded. This answers "what changed on this lens and who did it" in the terminal where the apply just ran; the dashboard's History panel shows the same trail with diffs. --json for the raw rows.

dst lens rm <name>

Delete a lens on the server. Prints the cascade first (versions, certified answers, eval cases, context chunks; the request log and rulings survive as history) and asks; --yes for headless. File absence never deletes: this command is the only way.

dst semantic rm entity|definition|relationship|blueprint <name>

Remove a shared semantic asset. The server refuses while any published lens still selects it, and names the lenses. A blueprint is named by its table (dst semantic rm blueprint crm.contacts); no lens selects one, so removing it marks the lenses reading the table stale and the next apply recompiles them.

dst connection rm <name>

Delete a server-side connection (its stored credentials go with it). Dependent lenses are checked first and the command refuses while any still reads through the connection: re-point or dst lens rm them before retrying; --yes for headless. File absence never deletes: a connection dst.yaml still declares is re-created on the next apply, so remove the declaration too when you mean gone.

Maintenance

dst reindex

Re-embed all stored vectors with the configured embedder; required after changing the embedding model or dimension (the write-path guard blocks mismatched writes until then). Resumable. Flag: --batch (rows per committed batch, default 64).

dst calibrate-bands --pairs <file>

Fit the certified serve bands for the configured embedding model and store them for that model. The bands are the similarities at which a question serves an approved answer outright (exact), goes to the paraphrase check (equivalent), or is shown to generation as an example (assist). Each embedding model spreads similarities differently, so a model without its own bands serves on the defaults and may generate answers for paraphrases that should have served.

The pairs file is written by you or your AI; dst does not generate paraphrases. Each pair names a question someone might ask, the certified question it is about (word for word, from lenses/*/certified_answers.yaml), and whether that answer should serve it:

pairs:
  - asked: how many parcels went out last week
    certified: parcels shipped last week
    serves: true
  - asked: how many parcels came back last week
    certified: parcels shipped last week
    serves: false

The fit puts exact above every pair marked serves: false, equivalent low enough that nearly every true paraphrase reaches the check, and assist at the lowest true paraphrase. Pairs a serve-time rule already decides (a different period, a breakdown the approved SQL does not group by, a different unit) are left out. It needs at least 20 pairs of each kind after those; with fewer it stores nothing and says how many more are needed. Templates and retired answers are not part of the corpus. The output says how many paraphrases each band catches.

Stored per model in the database (install-wide, like the embedder); a running server reads it within a minute, and plan, apply and /ready stop reporting the bands as uncalibrated. Run it again after changing the embedding model. Flags: --dir, --dry-run (report the fit, store nothing).

(Verified against the command modules under services/cli/. Not every flag is listed here — dst <command> --help is the exhaustive one.)