CLI and operations
The Helix command-line application is the main operator interface for creating a Helix project, linking local or Helix Cloud instances, running queries, and managing local runtime resources. It turns project configuration into repeatable development and Cloud workflows while keeping credentials and runtime state separate from source code.
Operating model
The CLI works from a Helix project. A project is the directory that contains helix.toml; the CLI searches upward from the current directory to find it. The file names local and Cloud instances so that commands can use a stable name instead of a host, port, or remote database ID. crates/…/project.rs• L6-45
Project context
The project context combines the project root, validated configuration, and the project-local .helix state directory. This context gives setup commands a place to write configuration and gives runtime commands an isolated workspace for each instance. crates/…/project.rs• L6-59
The first project can be created with helix init. An existing project can gain more targets with helix add. Local targets and Cloud targets use the same named-instance model, but only local targets are started by the CLI. crates/…/init.rs• L14-114, crates/…/add.rs• L11-68
References: crates/…/project.rs• L6-59 crates/…/init.rs• L14-114 crates/…/add.rs• L11-68
Instance targets
An instance target is either a local Helix process managed through Docker or Podman or a Helix Cloud database reached through the Cloud query broker. The name selects the target for commands such as query, shell, status, and logs. When a command has no explicit name, the CLI prefers dev and otherwise uses a single unambiguous instance. crates/…/config.rs• L417-517, crates/…/query.rs• L28-49
This model lets one project describe development and remote environments together. It also prevents a command from silently choosing the wrong target when several instances exist. crates/…/query.rs• L28-49, crates/…/status.rs• L10-45
References: crates/…/config.rs• L417-517 crates/…/query.rs• L28-49 crates/…/status.rs• L10-45
Command surface
The top-level command surface is grouped around project setup, local development, Helix Cloud access, and CLI maintenance. Global --json, --quiet, and --verbose flags control machine output, progress detail, and timing detail. Top-level help gives a grouped overview, while command-level help supplies the exact arguments for each workflow. crates/…/main.rs• L43-61, crates/…/main.rs• L487-575, crates/…/e2e_cli.rs• L20-42
Project setup commands
init creates a new project with a starter target. add extends an existing project with another local or Cloud target. chef provides a higher-level bootstrap path for an application and is also available as cook. These commands establish the configuration that later commands consume. crates/…/main.rs• L64-93, crates/…/main.rs• L619-635
References: crates/…/main.rs• L64-93 crates/…/main.rs• L619-635
Local development commands
start, stop, and restart control local instances. status reports project and instance state. doctor checks the setup without changing it. logs exposes local runtime logs or recent Cloud query errors. query sends a request, shell accepts one JSON request per line, cypher supports local Cypher work, and explorer opens a local graph view. prune removes Helix-owned local runtime resources, while delete removes an instance from the project configuration. crates/…/main.rs• L94-245, crates/…/main.rs• L636-680
Local lifecycle commands separate applying new settings from reusing a running instance. start resolves all required images before it replaces the local resources and can persist command-line overrides. It runs the resolved immutable image IDs. restart reuses the existing container and its published port, so use start when image or configuration changes must take effect. crates/…/README.md• L19-49, crates/…/README.md• L62-67, crates/…/local_runtime.rs• L341-365, crates/…/local_runtime.rs• L504-540
References: crates/…/main.rs• L94-245 crates/…/main.rs• L636-680 crates/…/README.md• L19-49 crates/…/local_runtime.rs• L341-365 crates/…/local_runtime.rs• L504-540
Cloud resource commands
auth manages the Cloud login session. workspace, project, and cluster discover and select the Cloud resources that own a database. database manages tenant databases and application keys. service-credential manages workspace-owned credentials for headless automation. api provides a narrow authenticated escape hatch for supported Cloud API paths. crates/…/main.rs• L246-286, crates/…/mod.rs• L1-21
References: crates/…/main.rs• L246-286 crates/…/mod.rs• L1-21
CLI maintenance commands
skills installs or refreshes Helix agent skills and the docs MCP. metrics changes telemetry collection. update upgrades the CLI, and feedback sends a message to the Helix team. The CLI can show update notices for the binary and installed skills during normal interactive use. Removed v2 commands are recognized only to return a migration hint: query validation happens at the running instance and Cloud database lifecycle belongs to the control plane. crates/…/main.rs• L309-359, crates/…/main.rs• L693-700, crates/…/update.rs• L144-187, crates/…/update.rs• L312-367
References: crates/…/main.rs• L309-359 crates/…/main.rs• L693-700 crates/…/update.rs• L144-187 crates/…/update.rs• L312-367
Project and Cloud workflows
The CLI uses the same project file to connect local development with Cloud resources. Setup writes names and ownership links into helix.toml; operational commands resolve those links before they contact a runtime or the Cloud service.
Project lifecycle
The normal project path starts with a scaffold, adds or selects a target, and then uses the target name for daily work. The flow preserves a clear boundary between source-controlled project intent and disposable local runtime state.
This diagram shows how project setup leads to named-instance operations and local cleanup.
flowchart LR
A[helix init] --> B[helix.toml]
B --> C[helix add]
C --> D[Named local or Cloud instance]
D --> E[query, shell, status, logs]
E --> F[stop or restart]
F --> G[prune or delete]
init also creates a starter request for local projects and adds runtime and secret paths to .gitignore. Optional agent tooling is a convenience and does not block project creation when it cannot be installed. crates/…/init.rs• L63-114, crates/…/init.rs• L146-176, crates/…/init.rs• L198-235, crates/…/init.rs• L307-330
References: crates/…/init.rs• L14-114 crates/…/init.rs• L146-176 crates/…/init.rs• L198-235 crates/…/e2e_cli.rs• L72-135
Cloud resource lifecycle
Cloud operations start with a browser-based WorkOS login. The CLI stores the resulting rotating session, uses it for authenticated requests, and refreshes it when it is near expiry. It does not use API-key login or store application keys as its own Cloud session. crates/…/auth.rs• L40-119, crates/…/cloud.rs• L136-187, crates/…/cloud.rs• L215-286
Project links supply default workspace and project ownership for Cloud commands. A database target is written as cluster:<id> or tenant:<id>; if a project maps to more than one possible database, the operator must choose one explicitly. This makes Cloud actions explicit when the project cannot provide a unique target. crates/…/config.rs• L417-498, crates/…/config.rs• L246-356
Database and service-credential creation display secrets once. The CLI does not put those tokens into helix.toml or its session file, so the operator must capture them in a suitable secret system at creation time. crates/…/cloud_resources.rs• L71-109, crates/…/cloud_resources.rs• L193-224
References: crates/…/auth.rs• L40-119 crates/…/cloud.rs• L136-187 crates/…/cloud.rs• L215-286 crates/…/config.rs• L417-498 crates/…/config.rs• L246-356 crates/…/cloud_resources.rs• L71-109 crates/…/cloud_resources.rs• L193-224
Command workflow guide
The detailed command paths and prompt behavior are documented in CLI command workflows. Use that page when you need the user-facing sequence for setup, authentication, resource management, queries, status, logs, or shell access.
References: crates/…/main.rs• L64-359 crates/…/mod.rs• L1-21
Configuration and state
Configuration has two scopes. helix.toml describes a project and its named instances, while the user Helix directory stores CLI-wide state such as the Cloud session and disposable caches. Keeping these scopes separate allows the project file to be shared without sharing personal credentials.
Project configuration
The [project] section gives the project a name, query directory, and container runtime. The [local.<name>] sections define local ports, images, image pull policy, and storage mode. The [enterprise.<name>] sections point to Cloud databases and can retain workspace and project ownership IDs. Unknown fields are rejected so an old or misspelled setting cannot silently change behavior. Instance names are limited to 32 characters and use only ASCII letters, digits, -, or _ before they define runtime or state paths. crates/…/config.rs• L68-137, crates/…/config.rs• L417-498, crates/…/config.rs• L519-645
Local image settings support a tested default tag, an explicit tag, or a digest. latest is opt-in. Pull policy controls whether a cached image is accepted. Before replacing a local instance, start resolves all required images and then runs the resolved image IDs. With --persist, successful command-line overrides update helix.toml; failed image resolution leaves the project configuration and existing runtime in place. crates/…/README.md• L19-49, crates/…/local_runtime.rs• L341-388, crates/…/runtime_commands.rs• L700-817, crates/…/runtime_commands.rs• L939-1014
Local storage has three product-level choices:
- Memory is the default and is useful for short-lived development. Stopping or restarting loses its data.
- Disk uses a local SeaweedFS-backed store managed with the local runtime. Stopping preserves data; pruning removes the local store.
- S3 uses a configured bucket and prefix. The runtime keeps a local cache volume, stopping preserves that cache, and pruning removes it. Cleanup does not delete the remote data.
The CLI validates the storage mode and its required S3 settings before an instance can run. crates/…/config.rs• L124-186, crates/…/config.rs• L557-645, crates/…/e2e_cli.rs• L222-340
References: crates/…/config.rs• L20-66 crates/…/config.rs• L68-186 crates/…/config.rs• L417-498 crates/…/config.rs• L519-645 crates/…/local_runtime.rs• L341-388 crates/…/runtime_commands.rs• L700-817
User state locations
Persistent CLI state uses HELIX_HOME when set and otherwise the platform home directory plus .helix. Disposable cache data can use a separate HELIX_CACHE_DIR; without that override it falls back to the Helix home. The Cloud session, update notices, and skills notices use the Helix home, while the cached TypeScript query runtime uses the cache directory. Project runtime state remains under the project’s .helix directory. crates/…/paths.rs• L1-14, crates/…/paths.rs• L27-50, crates/…/paths.rs• L72-80, crates/…/update.rs• L50-56, crates/…/update.rs• L244-247, crates/…/ts_query.rs• L73-79
The CLI also loads a project .env before local start and restart operations. This lets local runtime settings such as object-store credentials come from the project environment without placing them in helix.toml. crates/…/start.rs• L16-18, crates/…/restart.rs• L8-12, crates/…/local_runtime.rs• L916-947
References: crates/…/paths.rs• L1-14 crates/…/paths.rs• L27-50 crates/…/paths.rs• L72-80 crates/…/update.rs• L50-56 crates/…/update.rs• L244-247 crates/…/ts_query.rs• L73-79 crates/…/start.rs• L16-18 crates/…/restart.rs• L8-12 crates/…/local_runtime.rs• L916-947
Local runtime guide
The lifecycle rules for Docker and Podman, image selection, ports, storage backends, runtime resources, readiness checks, Explorer support, and cleanup are documented in CLI local runtime and configuration. Use that page when a local instance does not start or when its data and containers need careful handling.
References: crates/…/local_runtime.rs• L188-221 crates/…/local_runtime.rs• L341-438 crates/…/local_runtime.rs• L504-627 crates/…/local_runtime.rs• L631-725 crates/…/README.md• L19-67
Query and operational feedback
The CLI presents one query command across local and Cloud targets. It accepts a JSON request file, inline JSON, or a TypeScript DSL expression or file. The request must declare a lowercase read or write type and include a query body. crates/…/query.rs• L191-250
TypeScript input is a convenience layer that turns a single SDK builder expression into the same JSON request used by the normal query path. It needs Node.js 20 or newer and installs the pinned TypeScript SDK into the Helix cache on first use; it does not need a running instance while building the request. crates/…/ts_query.rs• L1-9, crates/…/ts_query.rs• L35-79
Local queries go to the selected instance endpoint and may override the host or port. Cloud queries use the selected database reference and the authenticated broker; local-only warm-cache behavior and host or port overrides are rejected for Cloud targets. crates/…/query.rs• L52-124, crates/…/query.rs• L127-162
Status and logs expose different views of operation. Status combines project configuration with local container state or Cloud resource state. Local logs can stream from the runtime, while Cloud logs are represented by a bounded time range of recent query errors. crates/…/status.rs• L10-103, crates/…/mod.rs• L10-71
Setup diagnosis
doctor is a read-only setup check for a named local instance, a typed Cloud database, or a server URL. For local targets it checks the runtime, container, image, server health, and server diagnostics. For a direct URL it checks server health and diagnostics; for Cloud it records that infrastructure is managed by Helix Cloud. crates/…/doctor.rs• L1-12, crates/…/doctor.rs• L118-169
The report groups checks as pass, warning, failure, or skip and includes details and suggested fixes when available. A failure makes the command exit non-zero after it prints the report. Warnings alone do not fail the command, and --json returns the full report without interactive output. crates/…/doctor.rs• L31-61, crates/…/doctor.rs• L171-201, crates/…/doctor.rs• L562-646
The diagnosis follows the port published by a running local container. A stopped local instance skips server checks instead of contacting its configured endpoint. This keeps the result tied to the runtime that is actually serving the instance. crates/…/doctor.rs• L286-325, crates/…/doctor.rs• L455-559
References: crates/…/doctor.rs• L1-12 crates/…/doctor.rs• L118-201 crates/…/doctor.rs• L286-325 crates/…/doctor.rs• L455-559 crates/…/doctor.rs• L562-646
The output layer keeps automation and human use compatible. Normal mode shows milestones, quiet mode keeps errors and final results, verbose mode adds sub-steps and timing, and JSON mode keeps machine-readable results on stdout without prompts or chrome. Structured CLI errors include a cause and an actionable hint when the command knows how to recover. crates/…/main.rs• L47-58, crates/…/main.rs• L595-608, crates/…/output.rs• L1-9, crates/…/output.rs• L36-93, crates/…/errors.rs• L31-142
References: crates/…/query.rs• L52-250 crates/…/status.rs• L10-103 crates/…/mod.rs• L10-71 crates/…/doctor.rs• L562-646 crates/…/main.rs• L47-58 crates/…/main.rs• L595-608 crates/…/output.rs• L36-93 crates/…/errors.rs• L31-142
Change checklist
When these files or sections are changed, remember to consider these:
- Keep the top-level command enum, its dispatch match, and the grouped help view aligned. A command can work while remaining absent from the operator-facing overview.
- Keep local and Cloud target resolution aligned with the helix.toml schema. Changes to database reference forms affect query routing, project linking, status, logs, and resource commands.
- Preserve the image resolution contract across configuration, pull policy, persistence, and runtime replacement. A failed image lookup must not replace a working container or write partial overrides.
- Preserve the storage contract across configuration validation and runtime setup. A change to memory, disk, or S3 behavior must also update stop, restart, prune, and the data-loss guidance.
- Preserve the Cloud secret boundary. New authentication or resource flows must not turn application keys or service-credential tokens into persistent CLI credentials.
- Keep
HELIX_HOME,HELIX_CACHE_DIR, project.helix, and .env roles distinct. Moving one state path can affect credentials, update checks, metrics, TypeScript SDK setup, runtime state, and reproducible test environments. - Keep the TypeScript SDK version used by the CLI aligned with the SDK package that builds query requests. A mismatch can make cached and fresh TypeScript query runtimes behave differently.
- Keep
doctorcheck IDs, status values, server diagnostics, and exit behavior compatible with both human output and the JSON report. A stopped local container must remain distinct from an unreachable running server. - Keep local readiness and error hints consistent with the endpoint used by
query. A port or health-check change can make a successful container appear unusable. - Keep runtime resource ownership checks aligned with start, stop, and prune. A project must not adopt or remove containers, networks, or volumes owned by another project.
- Keep update and skills notice opt-outs and cache intervals aligned with normal command startup. Restricted-network environments must be able to disable the network checks without blocking commands.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| The command runs outside a directory tree with helix.toml | Project and instance commands stop before they can resolve a target | Run from the project tree or pass the supported project path during setup and add flows. |
| helix.toml has an unknown field, no project name, no instance, or an unsafe instance name | The configuration is rejected instead of partially applied | Keep the schema valid and use instance names made from ASCII letters, digits, -, or _, with no more than 32 characters. |
| A local instance uses memory storage and is stopped or restarted | Local graph data is lost | Use disk or S3 storage when data must survive a runtime stop. |
| An S3 storage configuration lacks its required object-store settings | Start fails before the local server runs | Provide a bucket, prefix, region, and valid endpoint settings when the instance uses S3 storage. |
| The local disk storage sidecar does not become ready | Start stops before the Helix server runs | Check the sidecar logs and its local storage setup before retrying. |
| Docker or Podman is missing or its daemon cannot start | start cannot create or inspect the local instance; doctor reports a runtime failure | Install or start the selected runtime, or set the project runtime to the installed option. |
| Image resolution or a required disk-mode image pull fails | start does not replace the current container or persist partial overrides | Select a reachable image and pull policy; use --persist only after a successful start. |
restart is used when image or configuration changes must apply | The existing container keeps its prior image and settings | Use start to apply new image or configuration settings. |
| Several instances or Cloud databases match and no target is supplied | The CLI refuses to guess and the operation does not run | Pass the instance name or an explicit cluster:<id> or tenant:<id>. |
| A Cloud command has no valid WorkOS session | Resource and broker requests fail before the Cloud operation | Run helix auth login; do not place an API key in the session file. |
| A one-time database or service-credential token is not captured | The resource exists but its application secret cannot be recovered from the CLI | Store the displayed token in the approved secret system when it is created. |
| TypeScript input runs without Node.js 20+ or npm access | The CLI cannot turn the DSL expression into a query request | Install the required Node.js toolchain or use JSON input with --file or --body. |
| A running container publishes a port different from the configured port | Health and diagnosis checks can contact the wrong endpoint if they trust only helix.toml | Let the CLI inspect the published port or persist the override when the port must remain stable. |
A server does not expose GET /v2/diagnostics | doctor can report health but skips server setup checks | Upgrade the server image when storage, cache, memory, or index checks are needed. |
| A legacy MinIO disk volume remains after the storage transition | SeaweedFS cannot read the old data, while prune can remove both old and new data | Migrate the old data first; remove only the old volume when it is no longer needed. |
| Runtime resources have another Helix identity | Start or cleanup must not take control of those resources | Keep ownership labels intact and use the CLI-created project and instance identity. |
Key files
| File | Why to read it |
|---|---|
| crates/…/README.md | Summarizes the v3 command purpose and the local image, pull-policy, disk-storage, S3-storage, and restart rules. |
| crates/…/main.rs | Defines the public command surface, global flags, help groups, dispatch, and process-level error handling. |
| crates/…/lib.rs | Defines shared command argument types for local targets, Cloud targets, database references, skills, metrics, and resource actions. |
| crates/…/config.rs | Defines the project file’s meaning, instance types, image and storage choices, Cloud database references, and validation rules. |
| crates/…/project.rs | Shows how the CLI finds a project root and separates project configuration from project-local runtime state. |
| crates/…/init.rs | Shows the project creation contract and the files and next steps produced by setup. |
| crates/…/config.rs | Shows how linked projects, workspaces, clusters, and Cloud database targets are resolved. |
| crates/…/cloud.rs | Shows the WorkOS session boundary and the authenticated Cloud request model. |
| crates/…/cloud_resources.rs | Shows Cloud database, application-key, service-credential, and generic API operations. |
| crates/…/query.rs | Shows how one query interface selects local HTTP or the Cloud broker. |
| crates/…/ts_query.rs | Shows how TypeScript DSL input becomes the common JSON query request and how its cached runtime is managed. |
| crates/…/doctor.rs | Shows the read-only setup diagnosis and the boundary between CLI checks, server checks, and Cloud-managed state. |
| crates/…/local_runtime.rs | Shows the local container lifecycle, image resolution, readiness model, storage support, ownership checks, Explorer support, and cleanup scope. |
| crates/…/paths.rs | Shows the cross-platform locations for persistent state and disposable cache data. |
| crates/…/update.rs | Shows release and skills update notices, their cache behavior, and network opt-outs. |
| crates/…/output.rs and crates/…/errors.rs | Show the operator-facing progress, verbosity, machine output, and recovery-message contract. |
| crates/…/e2e_cli.rs and crates/…/e2e_runtime.rs | Show the end-to-end contracts for project setup, query use, lifecycle commands, storage persistence, and runtime isolation. |
| crates/…/runtime_commands.rs | Shows the runtime contracts for image selection, resource ownership, pull failures, restart behavior, storage dependencies, and cleanup. |