CLI
Querio CLI commands, flags, authentication, output, and recovery rules.
For a first notebook, follow Get started with CLI.
For installation and downloads, see the Querio CLI repository.
Update the CLI
Run querio update --check to check for a newer release, then querio update to install it. Both support --json. The updater verifies the download's SHA256 and version before replacing the executable; your credentials and repository binding stay in place. The executable's directory must be writable.
Self-update supports release binaries on macOS and Linux, for AMD64 and ARM64. Use your package manager for package-managed installations. Development builds cannot self-update. If your binary has no update command, install a current release from the CLI repository.
Syntax and output
Prefix each listed command with querio. Replace uppercase names with your values; brackets mark optional arguments.
querio --help
querio notebook-session create --help
querio version --json--helpor-hshows command-specific help.querio help COMMANDalso works.--versionor-vprints the CLI version.- Add
--jsonto commands that support it for structured output. It is a command flag, not a global flag. Rows marked JSON already return JSON without it. - Progress, login/setup URLs, and recovery instructions go to stderr. Keep stderr separate when parsing stdout.
- Exit status 0 means the command succeeded. A submitted run, ready session, or accepted cancellation is not necessarily a completed run.
- API, transport, local-input errors and wait timeouts exit nonzero. A successful API request exits zero even when the returned execution or run failed. Inspect
success,status, and error fields. - Root
--workspace IDoverridesQUERIO_WORKSPACE_ID, then the binding in the nearest parentquerio.toml. Root--session IDoverridesQUERIO_SESSION_ID.
files get writes file bytes, notebook-session events streams server-sent events, git patch writes patch bytes unless given --json, and completion writes a shell script. These outputs are not JSON envelopes.
Login and workspace selection
| Command | Behavior and flags |
|---|---|
login | Browser login. --no-browser prints the URL without opening it. --api-url URL, --auth-url URL select services for this login. Supports --json. |
logout | Removes the stored login; repository bindings remain. Environment overrides remain in your shell. Supports --json. |
me | Shows the authenticated user; --json returns userId and email. Does not require workspace selection. |
workspace list | Lists accessible workspace IDs and names; supports --json. |
workspace create | Create a hosted workspace. --name NAME, optional --git, --file-mode MODE, --request-id ID, --json. Does not link it locally. |
workspace link WORKSPACE_ID | Verify workspace access, then write its ID into an existing querio.toml. Run init first. Supports --json. |
workspace show | Requests the selected workspace's ID and name. Supports --json. |
Login uses a loopback browser callback and waits up to five minutes. With --no-browser, keep the command running and open its URL in a browser that can reach the terminal's machine. This is not a remote device-code flow. Login does not change repository bindings.
Login service URLs require HTTPS, except HTTP on localhost or 127.0.0.1. Query strings, fragments, and embedded credentials are rejected.
Workspace and session IDs select where a command runs; they grant no access. Commands use the authenticated identity's permissions. See Roles.
Workspace setup and files
Initialize a workspace or context repository
init [DIRECTORY] copies the official workspace template into the directory, default .. It requires Git and network access for the official template. Use --template URL_OR_PATH for another Git repository. --json prints the destination and template.
Initialization refuses to overwrite existing files. It does not create a hosted workspace, initialize your repository, or link a workspace. Create with workspace create, then bind with workspace link. Workspace commands require the TOML binding unless --workspace or QUERIO_WORKSPACE_ID supplies an ID.
For failed workspace creation, retry with the same name and printed --request-id. The API owns provisioning policy and validation.
For the repository and publishing procedure, see Sync context with Git.
Workspace files
See Files and versions for canonical files, working copies, and path rules.
| Command | Behavior and flags |
|---|---|
files list [PATH] | One page of entries; default path .. --cursor CURSOR continues a page. --json includes entries and cursor; text mode prints the next cursor to stderr. |
files get PATH | Raw file contents on stdout. Redirect to a file when needed; no --json flag. |
files mkdir PATH | Create a directory. Supports --json. |
files put SOURCE PATH | Upload one local file; use - as SOURCE for stdin. --overwrite explicitly replaces an existing file. Supports --json; the result includes created and info. |
files upload DIRECTORY PATH | Upload selected directory contents recursively. Requires repeatable --include GLOB; optional repeatable --exclude GLOB, --dry-run, --overwrite, --json. |
For recursive uploads, globs are relative to the source directory. * matches within one path component; ** spans zero or more directories. Exclusions win. .gitignore rules under the source directory are respected. There are no hardcoded secret-name exclusions. Symlinks, special files, and API-reserved .git/.querio directories are skipped. Files and parent directories are checked again when opened to reject symlink substitution.
querio files upload ./docs memory/repo --include '**/*.md' --exclude 'drafts/**' --dry-run --json--dry-run shows an offline plan; it cannot check remote permissions or conflicts. Actual uploads require file read/write access, create missing parent directories, and stop at the first failure. An empty dry-run selection is valid; an actual upload with no matches fails.
Uploads are sequential and have no rollback, deletion, or automatic retry. JSON reports planned during dry-run, then uploaded, failed, or not_attempted during transfer. Earlier writes remain after failure. A connection failure can follow a completed write: inspect the remote file before retrying.
Notebooks and execution
Saved notebooks
| Command | Behavior and flags |
|---|---|
notebook create | Create an empty saved notebook. Optional --title TITLE and --file SERIALIZATION_JSON. Supports --json; text output is the notebook ID. |
notebook get NOTEBOOK_ID | JSON saved notebook, including title, cells and updatedAt. |
notebook update NOTEBOOK_ID | Supply --title and/or --file. Supports --json. |
--file forwards notebook serialization JSON to the API; use - for stdin. The API validates its shape and title. The CLI does not wrap Python into cells or fetch a concurrency timestamp.
Title-only updates can run while a session is open. Replacing saved cells requires the session to be closed; use Code Mode for live edits. Saved updates do not currently enforce a timestamp precondition.
Environments and notebook sessions
Use Execution reference for the full state and lifecycle model. An environment supplies compute; a session opens a saved notebook in it. For explicit CLI/API opens, each notebook and environment supports one active notebook session. Use separate environments for concurrent notebooks, and close only sessions you own.
environment is an alias for execution-environment.
| Command | Behavior and flags |
|---|---|
execution-environment create | Create an environment without opening a notebook. Optional --changeset CHANGESET_ID resumes a stored working copy; the workspace must be configured to use working copies. Supports --json; text output is the environment ID. |
execution-environment get ENVIRONMENT_ID | JSON environment metadata and state. |
execution-environment close ENVIRONMENT_ID | Close the environment after its sessions are closed. Supports --json. |
notebook-session create | Requires --notebook NOTEBOOK_ID and --environment ENVIRONMENT_ID. Optional --mode edit (default) or --mode run, --datasource SLUG, --variable KEY=VALUE, --wait, --timeout DURATION (default 5m), --json. |
notebook-session get SESSION_ID | JSON current session state. --timeout DURATION, default 5m. Inspection can restore its runtime. |
notebook-session wait SESSION_ID | Wait for readiness, then JSON session state. --timeout DURATION, default 5m. |
notebook-session events SESSION_ID | Raw server-sent event stream until closure or interruption; no --json flag. |
notebook-session executions SESSION_ID | JSON saved run page, oldest first. --limit NUMBER is 1-100, default 50. --after RUN_ID uses the previous page's nextCursor. |
notebook-session execute SESSION_ID | Submit a durable whole-notebook run in a ready session. --cache-mode default (default), no-cache, or no-store; --wait; --timeout DURATION (default 5m); --json. |
notebook-session close SESSION_ID | Close the session and its bound agents, leaving the environment open. Supports --json. |
Session creation does not execute cells. --wait on creation waits only for readiness and leaves resources open. A failed or timed-out wait also leaves cleanup to you; use the printed session ID to inspect it.
Datasources and query variables belong to session configuration. Repeat --datasource, or supply comma-separated slugs. Use --variable region=GB for query variables; these do not become Python globals. Deliberately close and reopen a session to change configuration.
Interactive execution and offline skills
| Command | Behavior and flags |
|---|---|
code exec [CODE] | Execute Python in QUERIO_SESSION_ID; reads stdin when CODE is omitted. --json returns success, stdout, stderr, output, and errors, without a durable run ID. |
code skill | Read the bundled workflow offline. --reference notebook-authoring reads the authoring reference. --output-dir DIRECTORY extracts the complete package into a new directory. --json returns path/content for reading, or path/files for extraction. |
Use code exec and Code Mode to author, inspect, edit, and run cells in a live session. Read the bundled authoring reference with querio code skill --reference notebook-authoring. Cell mutations use top-level async with code_mode.get_context(). Scratchpad assignments are transient; create cells for saved code. Keep the command attached while it runs; interruption does not roll back completed effects.
In an editable session, code exec waits for the notebook to save before reporting success. A save failure does not undo execution. Keep the session open, inspect its cells, and resolve the save error before closing. Do not replay authoring code or submit a durable run as a save step. Runtime values are separate from saved code; reopening can require re-execution.
The bundled workflow and reference need neither login nor network access. Skill extraction refuses existing destinations; --output-dir cannot be combined with --reference. If extraction is incomplete, inspect the destination before retrying.
Durable runs, waits, and cleanup
Use notebook-session execute for whole-notebook durable execution in an explicitly created session. It is not required after interactive Code Mode edits.
| Operation | Result and resource ownership |
|---|---|
notebook-session execute --json | Returns success, runId, and conversationId after submission. |
notebook-session execute --wait --json | Returns the terminal run. Leaves the session and environment open. |
Wait timeouts do not cancel durable runs. Keep the returned or printed IDs, inspect with runs get/runs wait, and close the session before its environment. If cancellation is needed, request it explicitly and wait for a terminal status. Saved notebooks remain after runtime closure. Resolve failed close operations before closing the environment.
Runs
| Command | Behavior and flags |
|---|---|
runs get RUN_ID | Read status and output. --timeout DURATION (default 5m), --json. |
runs wait RUN_ID | Poll until completed, failed, or cancelled. --timeout DURATION (default 5m), --json. |
runs cancel RUN_ID | Request cancellation; supports --json. Acceptance does not prove the run stopped. |
Datasource introspection is synchronous and returns its result directly.
Datasource setup
| Command | Behavior and flags |
|---|---|
datasource schema | JSON server-provided connection schema. |
datasource add SLUG | Choose --browser or --connection-file FILE. Supports --json; --timeout DURATION defaults to 10m. |
datasource get SLUG | JSON metadata and configured state; never connection credentials. |
datasource schemas SLUG | JSON live schemas and catalog inclusion information. |
datasource tables SLUG --schema SCHEMA | JSON live tables for the required schema. |
datasource introspect SLUG | Synchronously save catalog information. Repeatable --target SCHEMA or --target SCHEMA.TABLE, --refresh, --all, --timeout DURATION (default 5m), --json. |
Slugs contain 1-120 letters, digits, dots, underscores, or hyphens, starting with a letter or digit. The two creation modes have different rules:
- Manual:
--connection-file FILEreads connection JSON; use-for stdin. Optional--name NAMEand--test-connection. The API validates the connection. Local file permissions are your responsibility. - Browser:
--browserreturns the API's setup URL immediately. Open it and complete setup using your browser login. No browser launch or polling occurs. Verify later withdatasource get SLUG.
The link grants no access and contains no credentials. Browser and CLI each need workspace access. configured: true alone does not prove query permission; see Roles.
Without targets, introspection pulls all schemas. --refresh updates already-catalogued tables rather than discovering new ones. --all cannot be combined with --target or --refresh. The result includes the catalog path and counts, not a background job. Cancellation does not roll back catalog writes; inspect the result before retrying.
Git
These commands require the workspace file mode that keeps edits in separate working copies. CHANGESET_ID identifies a Querio working copy, not a Git branch. See Files and versions for state definitions and Sync context with Git for the reviewed publishing workflow.
| Command | Behavior and flags |
|---|---|
changes status | Working changes and canonical divergence for the session selected by QUERIO_SESSION_ID. Supports --json. |
changes diff | Changes against that working copy's base, with inline diffs where available. Supports --json. Binary or oversized files may have no inline diff. |
changes publish CHANGESET_ID | Requires --expected-canonical VERSION. Publishes the whole working copy to canonical without a Git connection, or opens a pull request proposing its complete file tree through the connected provider. Supports --json. |
changes discard CHANGESET_ID | Deletes a working copy after its sessions and environments are closed. Does not undo published files or notebook edits. Supports --json. |
git upload | JSON imported version from selected committed files. --repo DIRECTORY (default .), --ref REF (default HEAD), --config PATH (default querio.toml), --repository IDENTITY, --dry-run. |
git checkout VERSION | JSON new durable working copy based on an uploaded version. Does not switch your local Git branch. |
git status [CHANGESET_ID] | JSON working-copy list or one copy's changes and Git provenance, including canonical version. |
git patch CHANGESET_ID | Raw patch for required, repeatable exact --path PATH selections. --json returns encoding: "base64" and content. |
git promote VERSION | JSON explicit publication. Requires --expected-canonical VERSION from a prior status read. |
Upload reads the committed configuration and committed file bytes. Uncommitted changes are ignored. --config is repository-relative; the committed TOML must contain context includes and a stable repository identity, unless --repository supplies the identity. Exclusions win. context.root locates context; it does not restrict upload selection. Git upload excludes .querio paths; review the committed selection rather than assuming the recursive file-upload filters apply.
git upload --dry-run is offline. Actual upload creates an immutable source version and leaves canonical unchanged. Files and source metadata are sent as an uncompressed binary tar archive, not base64 JSON. The API limits the archive to 64 MiB. Use execution-environment create --changeset CHANGESET_ID to open the checked-out working copy.
Pause writers before exporting a patch. Check the command's exit status before applying its output, then reconcile against the source commit locally. CLI Git commands do not push to a forge, create or merge a PR, or verify approval.
Promotion replaces previously Git-managed files and removes managed files absent from the new selection, while preserving unrelated outputs. Existing working copies remain unchanged. Publication is not filesystem-atomic. A stale canonical version fails; inspect the changed state rather than blindly retrying.
Errors and environment variables
Errors and recovery
| Condition | Action |
|---|---|
| Missing/invalid arguments or nonpositive timeout | Read that command's --help. Durations use values such as 30s or 5m. |
| Login required or HTTP 401 | Log in again or renew the supplied automation token. Recheck identity and workspace selection. |
| HTTP 403 | Check selected workspace and effective permissions. Retrying unchanged does not fix access. |
| HTTP 404 | Check the resource ID/path and selected workspace. |
| HTTP 409 or stale update/promotion | Inspect current state, reconcile, and deliberately retry. Do not force an overwrite or assume no change occurred. |
Missing QUERIO_SESSION_ID | Select the returned ready-session ID for code exec or working-change inspection. |
| Execution/save failure, partial upload, or interrupted mutation | Inspect existing results before retrying. Completed effects can remain. Save failures require keeping the live session open until resolved. |
| Failed cleanup | Close your session successfully before its environment. Treat stderr cleanup warnings separately from the execution result. |
The CLI does not automatically retry mutations. Resolve permission, configuration, concurrency, or persistence errors before trying again.
Environment variables and precedence
| Variable | Effect |
|---|---|
QUERIO_ACCESS_TOKEN | With QUERIO_API_URL, supplies credentials for API operations instead of the stored login. The CLI does not refresh this supplied token. |
QUERIO_API_URL | API URL for the supplied token. Also supplies the default for login --api-url; otherwise login defaults to https://app.querio.ai. |
QUERIO_AUTH_URL | Default for login --auth-url; otherwise https://auth.querio.ai. |
QUERIO_CONFIG_DIR | Overrides the directory holding the stored login. Default is the OS user configuration directory's querio subdirectory. |
QUERIO_WORKSPACE_ID | Overrides the workspace binding in querio.toml; root --workspace takes precedence. |
QUERIO_SESSION_ID | Selects the live session for code exec, changes status, and changes diff. Explicit lifecycle commands take their session ID as an argument. |
QUERIO_TOOL_CALL_ID | Optional tool-call association passed with code exec. Ordinary CLI use does not require it. |
Both token and API URL must be set to use environment credentials. Otherwise API commands use the stored login, refreshing it when needed. An API URL set alone does not retarget existing stored credentials. Explicit login URL flags override their environment defaults; later commands use the URLs saved by that login.
workspace link works with either stored login or environment credentials. Unset stale automation overrides before returning to interactive use. Keep tokens out of command arguments, notebooks, logs, and source control.
Version and shell completion
| Command | Behavior |
|---|---|
version | Version text; --json returns version. Keep it with bug reports. |
completion SHELL | Write a completion script to stdout. Supported shells: bash, zsh, fish, powershell. No --json flag. |
For a first notebook and its expected output, follow Get started with CLI.
Last updated on November 18, 2026