Skip to content

CLI

The zidane command, its subcommands, zidane run, the JSON result, exit codes, environment and upgrades.

The zidane command comes with the zidane-tui package (install). Bare zidane opens the terminal app. Its flags, such as --no-daemon and --no-remote, are on command-line switches.

Commands#

zidane subcommands
UsageDescription
zidaneOpen the TUI. --no-daemon runs it in this process, ignoring the daemon setting. --no-remote turns remote hosts off (sets ZIDANE_NO_REMOTE=1).
zidane run [flags]Open the TUI and run a prompt.
zidane -p <text> --json-schema '<JSON>'Print JSON that matches the schema. No TUI.
zidane daemon [flags]Run the shared chat host that syncs windows.
zidane attach [flags]Attach a terminal client to the daemon, or to a zidane server with --host <wss-url> --token-file <path>.
zidane server <cmd>Serve this computer's chat host to remote windows and manage its device tokens. --help lists the commands.
zidane machine shareShare folders and a shell on this computer with a host.
zidane machine setupMake this computer a machine of a main server, as a service (--host <wss-url> --token-file <path> --name <n> --root <dir>).
zidane --host <wss-url> --token-file <path|->Open the TUI on a remote zidane server (or set ZIDANE_HOST_URL and ZIDANE_HOST_TOKEN). --token <t|-> also works, but ps and shell history show argv. ZIDANE_NO_REMOTE=1 or --no-remote blocks it and ignores ZIDANE_HOST_URL with a warning. Headless runs (--json, --json-schema) stay local.
zidane extension <cmd>Create, test, pack and publish extensions (create | test | pack | publish). --help lists the flags.
zidane upgrade [flags]Update to the latest release. --help lists the flags.
CommandHome page
zidane daemon, zidane attachThe daemon
zidane serverInstall the server
zidane machine shareRemote hosts and machines
zidane --hostRemote hosts

zidane run#

zidane run runs one prompt. In a checkout, bun start takes the same flags.

Terminal
zidane run --prompt "Add a /health route that returns 200" --model claude-sonnet-4-5
Output flagDoes
NoneOpens the terminal app and sends the prompt there, in a new session or the one --session-id names
--jsonRuns without the app and prints one result object when the run ends
--stream-jsonRuns without the app, prints each finished turn as a JSON line, then prints the result object

With --json or --stream-json, nothing asks for approval. zidane refuses --host and ignores --preset. --codemode adds the codemode tool to these runs. CI recipes: headless and CI.

Flags#

zidane run flags
FlagDefaultDescription
-h, --helpNonePrint help and exit.
-p, --prompt <text>NonePrompt to run.
-m, --model <id>NoneModel id.
-t, --presetbasicPreset name.One of basic.
-s, --system <text>NoneSystem prompt override.
--thinking <level>offThinking (reasoning effort) level.One of off, minimal, low, medium, high, xhigh, max, adaptive.
--provider <name>anthropicModel provider.One of anthropic, openai, openrouter, cerebras, xai, google, google-vertex, arcee, baseten, neuralwatt, local, openai-compat.
--base-url <url>NoneBase URL for local/openai-compat.
--api-key-env <NAME>NoneEnv var with the local/openai-compat API key.
--headers-env <NAME>NoneEnv var with JSON headers for local/openai-compat.
--header 'Name: value'NoneExtra local/openai-compat header. Repeatable.
--visionNoneThe local/openai-compat model reads images.
--image-in-tool-resultNoneThe local/openai-compat model reads images in tool results.
--codemodeNoneAdd the codemode tool to a --json or --stream-json run.
--temperature <f>NoneSampling temperature for local/openai-compat.
--seed <n>NoneSampling seed for local/openai-compat.
-c, --contextprocessExecution context.One of process, docker, e2b, daytona.
--image <image>NoneDocker image for --context docker.
--cwd <path>NoneTool execution working directory.
--env KEY=VALUENoneSet an env var in the context (repeatable).
--pass-env VARNAMENoneForward a shell env var into the context (repeatable).
--pregame <file>Nonee2b/daytona: upload + run this setup script once the sandbox is ready, before prompting (shebang picks the interpreter; a non-zero exit aborts the run).
--sandbox <id>Nonee2b/daytona: connect to an existing sandbox by id instead of creating one (left running on exit).
--sandbox-on-destroykille2b/daytona: what to do with a created sandbox at the end of the run (pause preserves state for reconnect via --sandbox; leave relies on provider TTL).One of kill, pause, leave.
--mcp <json-or-path>NoneMCP config as JSON, or a path to a JSON file.
--session-db <path>NoneSQLite session DB path.
--session-id <id>NoneSession id to load or create.
--durabilityNoneWith --session-db: checkpoint runs; on resumes an interrupted run first (resume-ask never does here).One of on, resume-ask, off.
--json-schema <JSON>NoneSchema for result.output (implies --json).
--schema <file.json>NoneRead the output schema from a file.
--jsonNoneWait for the run, then print only the result JSON.
--stream-jsonNonePrint each turn as JSONL, then the result JSON.
--formatzidaneJSON shape. provider prints raw provider messages.One of zidane, provider.

--provider accepts the providers in the table above, which are fewer than the sign-in wizard offers (providers). The default is anthropic. zidane run rejects the --restate flags and exits with code 1. zidane run accepts --durability but ignores it. Use bun start or bun run headless with --session-db to checkpoint runs (crash recovery). In a checkout, bun start --restate runs through a local Restate endpoint.

Structured output#

--json-schema '<JSON>' (or --schema <file.json>) makes the agent return a matching object in output. It implies --json, and run is optional:

Terminal
zidane -p "List the package's runtime dependencies" \
  --json-schema '{"type":"object","properties":{"deps":{"type":"array","items":{"type":"string"}}},"required":["deps"]}'

The result object#

stdout carries only the result. Logs go to stderr.

JSON
{
  "status": "completed",
  "finalText": "Added GET /health in src/server.ts and a test.",
  "usage": { "input": 18230, "output": 912, "cacheRead": 12800, "cacheCreation": 0, "cost": 0.07 },
  "turns": 6,
  "durationMs": 41200,
  "numToolCalls": 5,
  "sessionId": "…",
  "transcript": []
}
FieldHolds
statuscompleted, aborted, error or timeout
finalTextThe agent's last answer
outputThe schema-checked object, with --json-schema
usageTokens in, out, cache reads and writes, and cost when known
turnsModel turns
numToolCallsTool calls
durationMsWall time
finishReasonWhy the last turn ended
errormessage and type, when the run failed
sessionIdResume it with --session-id
summaryThe run summary: errors, blocked calls, budget events, retries and sub-agent runs
transcriptThe turns of this run

--stream-json first prints one {"type":"turn","index":0,"turn":{…}} line for each finished turn. --format provider prints the turns as provider messages instead of the result object. The messages use the Anthropic format with --provider anthropic and the OpenAI format with any other provider.

Exit codes#

CodeWhen
0status is completed
1status is error, a flag was wrong, or zidane refused --host

zidane run --json has no timeout. Ctrl+C writes no result and your shell reports 130. For a time limit and the 124 and 130 codes, use bun run headless.

Environment#

Environment variables
VariableDescription
ZIDANE_STORAGE_DIRKeep all storage in one dir (legacy layout). If unset and ~/.zidane/ is missing, Linux uses XDG paths.
ZIDANE_PREFIXOverride the storage prefix (default: .zidane).
ZIDANE_CONFIG_DIROverride the XDG config dir (default: $XDG_CONFIG_HOME/zidane on Linux).
ZIDANE_DATA_DIROverride the XDG data dir (default: $XDG_DATA_HOME/zidane on Linux).
ZIDANE_STATE_DIROverride the XDG state dir (default: $XDG_STATE_HOME/zidane on Linux).
ZIDANE_CACHE_DIROverride the XDG cache dir (default: $XDG_CACHE_HOME/zidane on Linux).
ZIDANE_NO_UPDATE"1" turns off the background update check.
ZIDANE_NO_DAEMON"1" turns the daemon off (same as --no-daemon).
ZIDANE_NO_REMOTE"1" turns remote hosts off (same as --no-remote).
ZIDANE_NO_ONBOARDING"1" never opens the setup wizard on its own.
ZIDANE_HOST_URLRemote zidane server (wss://) for the TUI. Needs ZIDANE_HOST_TOKEN.
ANTHROPIC_API_KEYAnthropic API key (or sign in with OAuth in the TUI).
OPENAI_CODEX_API_KEYOpenAI Codex API key (or sign in with OAuth in the TUI).
OPENROUTER_API_KEYOpenRouter API key.
CEREBRAS_API_KEYCerebras API key.
XAI_API_KEYxAI Grok API key (or sign in with OAuth in the TUI).
GEMINI_API_KEYGoogle Gemini API key (Google AI Studio), or GOOGLE_API_KEY.
GOOGLE_CLOUD_PROJECTGoogle Cloud project for --provider google-vertex. Signs in with gcloud ADC or GOOGLE_APPLICATION_CREDENTIALS.
GOOGLE_CLOUD_LOCATIONVertex AI location for google-vertex (default: global).
GOOGLE_CLOUD_API_KEYVertex AI API key, in place of Google Cloud credentials.
LOCAL_LLM_BASE_URLBase URL for --provider local/openai-compat.
LOCAL_LLM_API_KEYBearer key for local/openai-compat (optional).
LOCAL_LLM_AUTHORIZATIONAuthorization header value for local/openai-compat, as is.
LOCAL_LLM_HEADERSJSON object of extra local/openai-compat headers.
LOCAL_LLM_DEFAULT_MODELDefault local/openai-compat model id.

ZIDANE_HOST_TOKEN goes with ZIDANE_HOST_URL. Provider key variables: providers. What the ZIDANE_*_DIR variables move: files and folders.

Updating#

Terminal
zidane upgrade                       # check, then run your package manager
zidane upgrade --in-place            # download the release and swap the binary (macOS and Linux)
zidane upgrade --channel next        # another npm dist-tag
zidane upgrade --force               # reinstall even if up to date

The install runs in a background process. Ctrl+C or closing the terminal stops the output, never the package manager (exit code 130). The log is update.log in the cache folder (files and folders). A package manager still running after 10 minutes is stopped.

FlagDoes
--checkPrint the latest version and exit
--dry-run (or --dryrun)Resolve everything without installing
--in-place (or --inplace)Skip the package manager. Refused under Volta and on Windows.
--tui-onlyLeave a global zidane-gui alone. By default it upgrades too.
--package-manager <pm> (or --pm)Force npm, pnpm, yarn, bun or volta
--registry <url>Another npm registry
--channel <tag>Another dist-tag (default latest)
--forceInstall even when up to date, or when the registry check failed
Exit codeMeans
0Upgraded, or --check finished (with or without an update)
1The upgrade failed. The package manager failed, the download failed, the registry check failed, or the release cannot be downloaded yet.
2Unknown flag, or a flag without its value

The update check in the app: install and first run.

Reference#