CLI reference
Global options accepted before or after any command:
--workspace DIR: record argv, input hashes, output copies, and stdout underDIR/runs/and updateDIR/index.json(also read fromCONTEXTLIFT_WORKSPACE).--json: emit one JSON document on stdout.--trust-config: explicitly opt in to executingrunner.commandorclarifier_cmddeclared insidecontextlift.yaml.-V,--version,--help,--help-all: print version, list the 8 core verbs, or list all 61 verbs grouped by stage.
Core verbs (contextlift --help)
Eight verbs complete one end-to-end measurement:
| Verb | What it does |
|---|---|
demo | Run an offline 30-second end-to-end measurement on SQLite with canned predictions and zero API keys. |
doctor | Check installed extras (postgres, snowflake, databricks, bigquery, duckdb, yaml, lookml), credentials, and explain refusals (--explain). |
gate | Audit a gold answer key against 16 defect classes and 4 warnings; save golds_clean.csv (--clean-out). |
split | Create a deterministic hash-based curate.csv / holdout.csv split and ID lists. |
lint | Refuse written context defects, live enum mismatches (--db, --db-role), and cross-layer conflicts (--dbt, --snowflake-semantic, --ossie, --lookml) at $0. |
round | Run a paired control-vs-treatment evaluation with pre-flight power/leak/lint gates, sealed holdout tracking, merge policy enforcement, and signed attestation.json. |
bundle | Build a self-contained, zero-JavaScript verdict.html report for the pinned comparison. |
next | Inspect --workspace and print the single next command to run with resolved paths. |
Everyday workflow verbs
Diagnose and improve context
| Verb | Purpose |
|---|---|
classes | Price and measure each context class (rules, schema, terms, examples) separately. |
attribute | Rank which context rules or terms explain fixed and broken questions via SQL AST comparison. |
history | Track one question across every round to see when it broke or recovered. |
bisect | Binary-search a rule set to confirm which exact rule caused a regression. |
triage | Group failing questions by error shape (ROW_COUNT, COLUMN_COUNT, EMPTY_RESULT, REFUSED, DID_NOT_RUN, TIMEOUT, WRONG_VALUES, UNCLASSIFIED). |
worklist | Prioritize which failing context item to edit first. |
climb | Track accuracy across rounds against the same baseline, guarded by a noise floor. |
suggest | Propose lint- and leak-screened rule patches strictly from working-set (curate) failures. |
Build and curate gold sets
| Verb | Purpose |
|---|---|
init | Detect local SQLite/DuckDB/dbt assets, introspect starter spec/schema/*.json, and write contextlift.yaml. |
review | Prepare a review sheet, run optional cross-family --draft triage, render offline Steward HTML (--html), import SQL-hash-verified decisions.json, and compile golds.csv. |
ingest-failures | Convert production agent failure JSONL into a PII-redacted review.csv (merges without clobbering existing rows unless --force). |
draft-rules | Draft business rules from one triage failure bucket, citing its curate questions. |
rewrite-questions | Redraft natural-language question wording for existing golds without touching the warehouse. |
audit-golds | Inspect question clarity and answer-key alignment on an existing gold CSV. |
curate-examples | Build a leak- and template-twin-checked worked-example bank (--pool disjoint from --targets). |
build-examples | Build a spec/examples/bank.jsonl worked-example bank strictly from the working half of a gold set. |
context-write | Install a human-reviewed draft into context/rules.md with version history. |
estate-shape | Report table concentration, question redundancy, and split shared-ground stats (free). |
doc-coverage | Count what fraction of candidate or gold queries read documented datasets (free). |
resolvable-lift | Compute exact McNemar resolvable lift floors and sample-size requirements (free). |
Ask, score, compile, serve, and govern
| Verb | Purpose | |
|---|---|---|
generate | Generate SQL predictions for one arm (--reps 3, optional --retry --db, --context-per-question). | |
score | Grade a predictions CSV against gold SQL and save a reusable JSON report (--save-report). | |
ablate | Paired comparison of two scored arms (--without-report / --with-report), printing lift, Tango CI, McNemar p, and verdict. | |
arms | Inspect the compiled Arm 0d and Arm 1 hashes and payload sizes for a spec/. | |
leak | Verify that held-out questions and gold SQL do not appear inside a context file or bundle. | |
import | Register externally produced predictions as a tracked arm in --workspace. | |
semantic | Convert LookML, dbt, or Ossie models into starter rules and candidate questions. | |
compile | Compile a spec/ into snowflake-yaml, dbt-yaml, or ossie with honest certification headers (--sign-key, --require-signature). | |
serve-mcp | Serve a certified Arm and attestation status over zero-dependency JSON-RPC 2.0 stdio MCP (--require-signature, --require-certified). | |
schema | Export CREATE TABLE DDL text for prompt runners. | |
profile | Build a value dictionary of distinct categorical column values. | |
index | Rebuild index.json from recorded run folders under --workspace. | |
pin | Override the default baseline or candidate arm in --workspace (`pin baseline | candidate ID`). |
share | Export allowlisted, leak-scanned summary counts and metrics (no customer SQL or text). | |
scan | Scan staged diffs, history (--all), commit ranges (--since), or tracked files (--tree) for secrets using built-in + custom patterns. | |
pr-summary | Render one Markdown or JSON pull-request comment from saved round/ablate, lint, attribute, cost, and safety outputs. | |
verify-attestation | Verify content hash, HMAC-SHA256 signature (--require-signature), and hash chain (--prev) on attestation.json. | |
export-otel | Export an attestation.json, round.json, or ablate.json into OpenTelemetry OTLP JSON. |
Troubleshooting and refusal decoder
contextlift fails closed by design. Common refusals and their fixes:
| Symptom or exit message | Cause and fix |
|---|---|
untrusted command in contextlift.yaml | runner.command or clarifier_cmd came from a config file. Inspect the YAML first, then pass --trust-config (or pass --command on the CLI). |
INVALID on resolvable_lift | Holdout split is too small for --target-lift (6 unanimous flips is the floor for p < 0.05). Add questions or set --target-lift 50 for a pilot run. |
refused: ... --db-role is not supported | BigQuery and Databricks drivers cannot enforce SQL session role switching. Use a scoped IAM principal or PAT/SP instead of --db-role. |
attestation is unsigned / certified: false | Certification requires a verified HMAC-SHA256 signature (CONTEXTLIFT_SIGN_KEY / --sign-key), unmodified spec/, REAL GAIN, and passing policy:. |
sql_sha256 mismatch on --import-decisions | A candidate row's gold_sql changed after the steward approved it. Re-generate steward_review.html and obtain fresh sign-off. |
refusing private/metadata --base-url | SSRF guard blocked a metadata, link-local, RFC1918, or 3xx-redirecting host. Pass --allow-private-endpoint only for trusted internal VPC proxies. |
policy: exit code 2 before round starts | Unknown key or non-numeric threshold in contextlift.yaml policy:. Fix the YAML key name or type; run contextlift doctor --explain for live cloud refusals. |
Appendix: BigQuery query mining, Knowledge Catalog, and routing verbs (15 verbs)
| Verb | Purpose |
|---|---|
log | Pull BigQuery INFORMATION_SCHEMA.JOBS_BY_PROJECT demand tables (--demand) or filtered query logs. |
mine | Mine candidate gold questions round-robin across tables from query logs. |
draft-context | Draft starter per-table Markdown docs from warehouse metadata (no LLM, no row reads). |
mine-context | Extract candidate column descriptions and rules from query history. |
catalog-push | Push reviewed docs, rules, and examples into Google Cloud Knowledge Catalog with read-back verification (--dry-run first). |
catalog-pull | Pull served table documentation from Knowledge Catalog into local files. |
catalog-list | List tables in a Knowledge Catalog entry group (dataset.table per line). |
catalog-route | Route questions through Knowledge Catalog search and write per-question context JSON. |
catalog-rollback | Restore previous catalog descriptions captured by spec-push --previous-out. |
spec-push | Push a structured spec/ directory into Knowledge Catalog (--dry-run plans and checks drift). |
eval-room | Generate DDL for an undocumented BigQuery evaluation view room so Arm 0d is truly bare. |
sentinel | Plant a synthetic fact in a catalog and test whether the agent reads it. |
spec-schema | Generate spec/schema/*.yaml files from BigQuery INFORMATION_SCHEMA. |
routing-gate | Audit a routing answer key for concentration, missing catalog tables, or duplicate IDs. |
score-routing | Grade table-routing predictions against gold tables (with optional --catalog snap). |