# Yokai commands

Every yokai subcommand and flag, the environment variables it reads, and how each supported agent signs in.

## Synopsis

```bash
yokai [OPTIONS]                       # prepare if needed, then run phases
yokai setup [OPTIONS]                 # open the preparation wizard
yokai doctor [--probe]                # read-only checks
yokai migrate [--prefer legacy|new]   # convert Koi CLI settings
yokai guidance sensors|assess|sandbox # print the bundled helper rules
```

There are no `configure`, `sensors` or `assess` subcommands. Preparation happens in the [wizard](/en/docs/yokai/preparation) or through the `/yokai` helper skill.

`setup` needs an interactive terminal on the host and a Git repository. `doctor` checks tools, the run files, the gate review, whether the Junji skill is installed (`koi doctor` lists every agent and skill version) and which Linux `yokai` a sandbox launch will use; `--probe` also contacts the configured agents to confirm they are signed in. `guidance` needs no project.

## Options

All options work with bare `yokai` and with `setup`.

| Flag | Overrides | Default and notes |
| --- | --- | --- |
| `--working-folder <path>` | none | `.koi/run` |
| `--repo <path>` | none | `.` |
| `--agent <name>` | tier lists | Pins this launch: `claude`, `cursor`, `opencode` or `codex` |
| `--model <id>` | tier lists | Pins this launch; opaque ID |
| `--effort <level>` | tier lists | Pins this launch; opaque level |
| `--permission <mode>` | `permission` | `approve-all`; also `approve-reads`, `deny-all` |
| `--max-iters <n>` | `build.max_iters` | Unlimited when unset everywhere |
| `--token-savings` | `token_savings` | Two sessions per phase, review required |
| `--no-token-savings` | `token_savings` | Turn off a saved `true` |
| `--allow-gated` | none | Authorize gated phases for this launch; standing overrides still apply |
| `--guarded` | none | Halt at each gated phase. This is already the default; the flag remains for old scripts |
| `--once` | none | Run one phase, then exit |
| `--headless` | none | Plain text. Also on when stdout is not a terminal |
| `--max-cost <usd>` | none | Stop before a turn once the run has spent this much |
| `--max-tokens <n>` | none | Same, in tokens, for agents that report no cost |
| `--theme <name>` | `YOKAI_THEME` | `terminal`, `yoru`, `hiru` (`yoi`, `asa` alias `yoru`) |
| `--host` | `sandbox.enabled` | Run on the host for this launch |
| `--detail` | none | Kept for compatibility; setup always ends with a review |

Exit codes: `0` when the run advanced or completed, `2` on a halt in headless mode, non-zero on a preflight error.

When `sandbox.enabled` is true and `--host` is not given, this process becomes the launcher and starts an inner `yokai` in the VM with `YOKAI_SANDBOX_INNER=1`.

## Environment variables

| Variable | Purpose |
| --- | --- |
| `YOKAI_THEME` | Starting cockpit theme |
| `YOKAI_REDUCED_MOTION` | `1` keeps the setup animation still |
| `YOKAI_SANDBOX_INNER` | Set on the supervisor inside a sandbox; stops it from launching another sandbox or opening setup |
| `KOI_DATA_DIR` | Where the sandbox launcher caches Linux binaries; default `~/.local/share/koi` |
| `YOKAI_LINUX_BINARY` | Path to a Linux `yokai` for the sandbox; wins over the cached and downloaded copies |
| `ANTHROPIC_API_KEY` | Optional key for Claude Code; `doctor` warns when unset, but `claude auth login` works too |
| `CODEX_API_KEY`, `OPENAI_API_KEY` | Keys for Codex; `CODEX_API_KEY` wins |
| `NO_BROWSER` | `1` hides Codex's browser login, useful in a sandbox |

## Agent login

Yokai has no login of its own. Credentials live in each agent, and Yokai reaches the agent through its ACP adapter.

| Agent | How it connects | Sign in |
| --- | --- | --- |
| `claude` (default) | `claude-agent-acp` if it is on `PATH`, else `npx -y @agentclientprotocol/claude-agent-acp`; needs Node.js | `claude auth login`, `claude setup-token`, or `ANTHROPIC_API_KEY` |
| `codex` | `codex-acp` if it is on `PATH`, else `npx -y @agentclientprotocol/codex-acp`; needs Node.js. Inside a sandbox the image must install `codex-acp` | ChatGPT login, or `CODEX_API_KEY` / `OPENAI_API_KEY`. In a sandbox, prefer a key and `NO_BROWSER=1` |
| `cursor` | `cursor-agent acp` | Cursor CLI credentials |
| `opencode` | `opencode acp` | Run `opencode`, then `/connect` to a provider |

Sign in before an unattended run. A run without credentials fails fast instead of hanging. Gemini and policy files are not supported.

## Run from a koi clone

For development on Yokai itself:

```bash
cargo run -p yokai -- doctor --probe
cargo run -p yokai --
```
