Skip to main content
The ancha CLI is published on npm as @ancha-labs/cli. This reference covers version 0.1.4. It needs Node.js 24 or later.
ancha without a command prints where to start and exits 2:
Output

Global options

These work with every command. Setting ANCHA_JSON=1 in the environment acts as --json on every command. ancha --help fits on one page. ancha advanced lists the commands it leaves out: agent, serve, ui, scene, env, sandbox, mcp, execution, playground, status, wait, logs, report, check, runs and attempt. ancha --help --json prints every command and flag as one JSON tree, and ancha <command> -h prints one command’s flags.

Which server a command uses

Commands that create worlds choose a server in this order:
  1. --server-url <url>
  2. server.url in ancha.yaml
  3. The ANCHA_SERVER_URL environment variable
--local skips all three. With none of these, ancha run, ancha doctor and ancha world up start a private server on this computer for the duration of the command, also when you are signed in. Other server commands, such as ancha env and ancha sandbox, use http://127.0.0.1:4400, where ancha serve listens by default. The workspace saved by ancha login does not move the worlds. It names the workspace that ancha run --upload sends results to, that ancha run --on cloud runs in, and that ancha secrets, ancha agent, ancha world create|list|show|update|archive, ancha test and ancha runs work on. ancha whoami shows the workspace, where that choice came from, and where ancha run puts its worlds. ancha logout forgets the saved workspace. The first line of ancha run, ancha doctor and ancha world up says where the worlds run:

Output

  • Human output goes to stdout. Errors go to stderr as error[CODE]: message with a hint: line that names the next command. Most commands end with a next: line.
  • With --json, results and errors both go to stdout. An error is {"error": {"code": "...", "message": "...", "hint": "..."}}.
  • Commands never prompt. Every input comes from flags, files or the environment.
  • ancha schema prints the JSON Schema of ancha.yaml, scene files and every JSON output.

Exit codes

See Errors for every error code.

Commands

Test loop

Tools and scenes

Automation

Worlds

Servers and sandboxes

Hosted workspace

Agents and playgrounds

Files

Commands keep their state in .ancha/ in the current directory: runs/ for ancha run results, baselines/ for baselines, playgrounds/ for agents, worlds, tests and playground runs, and the records of idempotency keys and live worlds. Run every command from the same directory to share them. ancha init adds .ancha/ to .gitignore.