Skip to main content

Cortex CLI reference

The upcoming CLI, SDK and provider are 0.39.0. Use Node 24.15.0+ and the declared npm 12.2.0 toolchain. The CLI selects the project's installed Convex executable. Until publication, select matching local archives explicitly.

Backend runtime setup​

cortex backend install ./host --plan
cortex backend install ./host --jwt-provider ./jwt-provider.json
cortex backend register ./host --target ./target.json
cortex backend provision ./host --target ./target.json --principal ./principal.json
cortex backend configure ./app --url https://your-deployment.convex.cloud --http-url https://your-deployment.convex.site --agent-id your-agent --agent-version 1 --space your-space
cortex backend guide

Installation composes the host functions directory/schema/components/auth/HTTP routes. Ambiguous merges are refused. --sdk-path selects an installed SDK distribution. Registration/provisioning are explicit development operator tasks with exact disposable metadata and management/target-bound credentials. Configure appends public metadata only. See backend setup for JSON shapes, qualifications and Agent publication.

Application catalog​

cortex templates list --format json
cortex templates init demo --template vercel-ai-quickstart --template-version 1.4.0 --catalog-version 1.3.0 --yes --graph none
cortex templates init chat --template chat-sdk --template-version 1.4.2 --catalog-version 1.3.0 --yes --graph none
cortex templates init basic-app --template basic --template-version 1.4.0 --catalog-version 1.3.0 --yes --graph none
cortex templates update ./demo --to 1.4.0 --catalog-version 1.3.0 --dry-run

Template IDs are basic, vercel-ai-quickstart and chat-sdk. Catalog and payload versions are independent of the SDK. CLI build does not assemble payloads. Basic/Vercel use npm; Chat follows its declared pnpm manager. Graph off needs no Docker. Application dev scripts start only the app; backend registration/deployment is explicit.

For local packages use --sdk-package, --provider-package and --templates-package. Missing versions, absent ownership and conflicting edited files fail before unsafe replacement. Dry-run plans without project/dependency/service writes; no-install stages without dependency/lock regeneration.

Interrupted external update work requires the original receipt. templates update ./demo --recover restores journaled files only; it reports reconciliation required until external effects are manually reconciled and acknowledged with --recover --yes. Recovery never repeats dependencies, backend or graph work. Do not combine recovery with version/dry-run/package override flags.

SDK/backend channel​

cortex init backend --template none --local --yes --graph none
cortex install ./existing-project --no-deploy --yes --graph none --dry-run
cortex update -d development --sdk-version 0.39.0 --convex-version 1.46.0 --sync --dry-run
cortex schema status ./host
cortex schema sync ./host --dry-run

Application and SDK update ownership stay separate. --sync explicitly synchronizes owned backend sources after a dependency update; dependency changes do not imply deployment. Preserve host schema/functions/config and repair conflicts explicitly. Existing-project install supports its declared standalone manager constraints; --no-install requires --no-deploy. Cloud staging is separate from native target setup.

The recognized old Next shim lacking MutationCtx needs its app update before SDK backend synchronization. Arbitrary/edited host schemas require explicit composition rather than guessed merging. No automatic legacy runtime data/embedding migration is included.

Target selection and native lifecycle​

cortex config add-deployment development --url https://your-deployment.convex.cloud --json-only
cortex config set-path development ./host
cortex config set-key development
cortex config show --format json
cortex use development
cortex status -d development --check
cortex doctor -d development --json
cortex dev -d development

Selection is explicit -d, project use, default, then sole deployment. Stale/ambiguous aliases fail. URL/key environment values do not override aliases. Config is private/atomic and diagnostics redact secrets. Native mutations require explicit target/path/key agreement; --local and --prod assert intent rather than silently switching targets.

dev runs one foreground Convex child and Ctrl-C stops it. Run app scripts separately. Status/doctor inspect without pruning or starting services; explicit checks are bounded. There is no detached supervisor or port-kill dashboard.

Optional graph service​

cortex graph setup ./host --graph neo4j --graph-mode local --yes --dry-run
cortex graph status ./host
cortex graph stop ./host
cortex graph start ./host

Memgraph/existing services are also supported. Credentials remain private; URIs are credential-free. Local operations validate project ownership and stop preserves volumes. Existing-service setup probes without data mutation; lifecycle is refused for resources not owned by the project. Runtime connector/service-grant/worker registration is a separate graph setup step.

Explicit domain administration​

Memory/facts/conversations/users/spaces commands operate under selected transport and data scope. Scope IDs/--scope-user/--tenant do not fabricate a JWT. Complete user export and supported-layer erasure require fixed deployment administration; omitted tenant means tenantless only. Inspect partial/unknown receipts before recovery.

Native db export uses deployment ZIPs; it is separate from domain export. Lifecycle-bearing archives/targets refuse unsupported import before mutation. Raw backup/restore/clear and protected restore sessions are not an alternative. schema references and explicit supported migration are distinct from status/install/help; no automatic runtime legacy migration follows.

Use leaf --help for exact formats/options. Completion is explicit script output (completion bash|zsh|fish) and does not edit shell RC files.

The templates catalog is independently versioned at 1.3.0. The current app payloads are Basic and Vercel AI quickstart 1.4.0, and Chat SDK 1.4.2. These are upcoming release selections; the registry publication step is separate. Existing immutable app payloads remain available for their pinned versions.