Context commands
The five commands that work on the context files in a checkout. check is the gate, fmt keeps diffs minimal, pull and upload move the tree, and test probes real questions.
Install and sign-in are in Install and configure the CLI. Every command here takes the checkout as its first argument (. by default) and the shared options: --project, --api-key, --api-url, and --base-path. context fmt takes no --project. check, upload and test find the context directory from any directory inside the checkout; fmt and pull, which write files, use the directory they are run from.
context check
Validates the files with the same three stages as the cassis / ontology validation check Cassis posts on pull requests: every YAML file must parse, no file may lose data in a canonical round-trip, and the tree must pass the validation the post-merge import runs. A clean run means a green check and a clean import.
# From the root of a checkout containing the context directory
cassis context check
# Or point at the checkout explicitly
cassis context check /path/to/checkout
Arguments and options
| Name | Type | Default | Notes |
|---|---|---|---|
path | path | . | The checkout to validate |
--json | flag | Off | Prints the check result as JSON |
Output
- Validation
- Success prints the file count. Failures print one finding per line as
cassis/<path>: <message> (<stage>), every problem in one run rather than stopping at the first. Round-trip failures name the unknown fields that would be dropped. - Context quality warnings
- For any tree that parses: tables not assigned to a domain, joins or metrics pointing at unknown tables or columns, tables without a description, enum values a column’s type can’t store. The same findings
context testreports, without an agent run. A column without a description gets no warning: a self-explanatory column needs none. - Schema reference warnings
- In a checkout bound to a project, every table and column the tree references, including join equi-pairs, is checked against the project’s last-introspected source schema. An unbound checkout falls back to the tree-only checks and says so. The stage always says whether it ran.
- Eval case warnings
- In a checkout bound to a project, the project’s eval cases are resolved against the files being checked. A case whose gold SQL reads a table these files lack is listed, so a pull request that drops a table learns which cases it breaks before any run. A change no eval case guards is listed too.
✓ Eval cases resolve against this context.when it ran clean. In--jsonit is theevalsstage. It needs a data source, for the SQL dialect, and a tree that validates. - Order and summary
- After the passed checks, the eval warnings about your change print first (unguarded changes, unresolved cases), then the advisory schema reference and context quality warnings. The last line sums it up:
Valid, no warnings., orValid:orInvalid:followed by a count of each kind of warning. - Exit codes
- 0 when the files are valid, 1 when validation fails. Warnings never change the exit code: a referenced object may legitimately not be built or synced yet.
context fmt
Rewrites the files in canonical form, the way black or gofmt rewrites code, using the serializer the validation round-trip compares against. A formatted tree cannot fail that stage. It also writes the modeling guide to cassis/AGENTS.md.
# Rewrite the files in place
cassis context fmt
# CI mode: exit 1 if any file is not canonical, write nothing
cassis context fmt --check
Arguments and options
| Name | Type | Default | Notes |
|---|---|---|---|
path | path | . | The checkout to format |
--check | flag | Off | Writes nothing; exits 1 if any file would change |
Output
rewrote <file> for each file it changed, or ✓ N file(s) already canonical. With --check, would rewrite <file> instead, and nothing is written. Run it from the root of the checkout, or pass the root as path: unlike the commands that only read, it does not look for the context in enclosing directories. Exit 1 when the tree cannot be parsed, or with --check when a file would change. Formatting does not run import validation: check remains the gate for dangling references and incomplete metrics.
Review the diff before committing. Canonical form keeps exactly the fields Cassis understands, so unknown fields (typos) are dropped. The rewrite makes them visible in git diff instead of losing them silently at sync time. Files with duplicate YAML keys are rejected rather than rewritten, because the formatter cannot know which value you meant.
context pull
Downloads the project’s unpublished context into your checkout. Use it to add the context files to a repository, including one Cassis does not sync itself.
cassis context pull --project 019f0000-0000-7000-8000-000000000000
# Keep local files the project no longer has
cassis context pull --no-prune
Arguments and options
| Name | Type | Default | Notes |
|---|---|---|---|
path | path | . | The checkout to write into |
--prune, --no-prune | flag | --prune | Deletes local context files the project no longer has. Only files git can restore are deleted |
--json | flag | Off | Prints a summary of written, deleted, and kept files as JSON |
Output
- Full sync
- Files are overwritten, and local files the project no longer has are pruned, but only when git can restore them, meaning tracked and unmodified. Anything untracked or locally modified is kept and listed with the reason. Every path it deletes is printed first. Outside a git repository nothing is pruned.
--jsonreports what survived underkept. - Binding files
- Pull also writes
cassis/AGENTS.mdandcassis/project.yml, which binds the checkout to the project afterwards. - Next
- Review the result with
git diffbefore committing.
context upload
Replaces a project’s entire context with your local tree and, by default, publishes it immediately as a new version. It runs the same validation as check first, so a failing tree is rejected with the reason and the project is untouched.
It runs from a git checkout whose context files are committed, and the version it publishes records that commit. Commit your changes under cassis/ first.
# Replace and publish
cassis context upload --project 019f0000-0000-7000-8000-000000000000
# Replace the unpublished context only, to review in Cassis
cassis context upload --no-publish
# Label the published version
cassis context upload --label "release 1.2"
Arguments and options
| Name | Type | Default | Notes |
|---|---|---|---|
path | path | . | The checkout to upload |
--publish, --no-publish | flag | --publish | --no-publish replaces the unpublished context only. A never-published project publishes on its first upload anyway, as imports from the app do |
--label | text | The HEAD commit’s subject | Label for the published version |
--json | flag | Off | Prints the server’s response as JSON |
Output
- Success
✓ Context uploaded and published as vN, with the object counts. The version records the commit.cassis statusandget_project_statusthen show whether a checkout matches what is live.- No change
- Re-uploading content identical to the published version creates no new version, so re-running a CI job on unchanged files is a no-op. It prints
No change: vN stays published, and now records commit <sha>, andcassis statusshows that checkout in sync.--jsoncarries"unchanged": true. - Exit codes
- 1 when the tree fails validation or the publish fails on the server, with the server’s reason, so a CI job never shows green when nothing was published. 2 when a context file under the base path is modified, staged, deleted, or untracked, listed before anything is sent; also outside a git checkout with a commit, or without
git. Line endings do not count, so a file committed with CRLF uploads.
- Two places it fits
- Bootstrapping, while building a first context before any pull request or merge exists; a local repository with one commit is enough. And publishing from CI on any provider, GitHub included, when the GitHub App is not connected: this is how a merge goes live.
- Not against a GitHub-synced project
- When Cassis syncs the repository itself, it stays the source of truth and the next import replaces whatever you uploaded. Do not point both at one project.
context test
Runs individual questions through the text-to-SQL agent using your local context files, so you can confirm a change works: that a new column gets picked, that a metric routes correctly. Where eval run tells you nothing regressed, test tells you the thing you just built does what you meant.
cassis context test \
-q "How many customers are currently active?" \
-q "What was revenue in 2025?"
# Keep the probes that worked as eval cases guarding an issue's fix
cassis context test -q "How many customers are currently active?" --save-case --issue 019f0000-...
Arguments and options
| Name | Type | Default | Notes |
|---|---|---|---|
path | path | . | The checkout whose context files are tested |
-q, --question | text, repeatable | Required | A question to probe. Repeat for several |
--save-case | flag | Off | Adds each successful probe to the eval suite: its question and the SQL it produced, as eval cases add --pending-change would. A probe that failed, asked a clarification, or wrote no SQL is not saved |
--issue | issue id | None | With --save-case: the issue the saved cases guard. Their check waits for its resolution |
--json | flag | Off | Prints the outcomes as JSON |
Output
Per question: its status and duration, the generated SQL, the answer, the result rows, any clarification the agent asked on the way, and missing concepts. One line counts the tree’s advisory warnings; context check lists them. One full agent run per question, so expect roughly 30 to 90 seconds each. Nothing is persisted, except the cases --save-case adds. Probes are informational: the command exits 0 when every probe completed, whatever the outcome, and 1 when the tree is invalid or a probe failed to run. Do not gate CI on it.
Cassis runs up to twenty tests at once for a project. Past that, the command waits and retries on its own, with a notice on stderr, for up to 10 minutes in all, so CI jobs that test in parallel queue up.