> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cloudthinker.io/llms.txt
> Use this file to discover all available pages before exploring further.

# CLI Reference

> Look up every cloudthinker command, flag, environment variable, exit code, and file path in one place.

Every command in the `cloudthinker` binary, with its flags and exit codes. New to the CLI? Start with the [CLI overview](https://docs.cloudthinker.io/guide/cli/overview.md).

```bash theme={null}
cloudthinker [--url <URL>] [--workspace <ID or NAME>] <command> [flags]
```

Run `cloudthinker <command> --help` for the exact syntax of the version you have installed.

## Global options

Put global options before the command name.

| Option | Description |
| - | - |
| `--url <URL>` | CloudThinker address. Defaults to the address of your last `login --url`, else `https://app.cloudthinker.io`. Pass the bare origin, with no path or trailing slash: `--url https://ct.example.com` |
| `--workspace <ID or NAME>` | Use the stored login for this workspace. Can't be combined with `CLOUDTHINKER_TOKEN` |
| `--tui-mode <MODE>` | For a bare `cloudthinker` only: `fullscreen` (default) or `regular`, which keeps the chat in terminal scrollback. With `cloudthinker agent`, pass it after `agent` instead |
| `--skill [MODULE]` | Print the CLI's operating guide for AI coding agents and exit. Needs no login. With no value it prints the index; modules are `auth`, `chat`, `cloud`, `review`, `cyber`, `cyber-scan`, `cyber-verify`, `cyber-report`, `worker`, and `remote` |
| `-h`, `--help` | Print help |
| `-V`, `--version` | Print the CLI version |

## Sign-in commands

| Command | Description |
| - | - |
| `login` | Log in through the browser. Over SSH or without a display, it shows a short code instead |
| `login --device-auth` | Always use the short-code flow |
| `login --no-browser` | Print the sign-in URL without opening a browser |
| `logout` | Clear the login for the selected or active workspace |
| `logout --all` | Clear every login stored for this host |
| `whoami [--json]` | Show the account and workspace behind the login, checked live |
| `auth status [--json]` | List the workspace logins saved on this machine and mark the active one |
| `auth switch <WORKSPACE>` | Make a saved login the active one |
| `auth token` | Print the current access token on stdout. It is a secret |

Details and CI patterns: [CLI authentication](https://docs.cloudthinker.io/guide/cli/authentication.md).

## Agent

`cloudthinker` with no command, or `cloudthinker agent`, starts [CloudThinker Agent](https://docs.cloudthinker.io/guide/cli/agent.md) in the current folder. Every argument after `agent` goes to the agent unchanged.

The flags below need the `agent` command. Run `cloudthinker agent --session <id>` to reopen a session; the CLI rejects `cloudthinker --session <id>`. CLI 0.11.0 and earlier printed that rejected form on exit, so update with `cloudthinker update`.

| Flag | Description |
| - | - |
| `-p`, `--print <PROMPT>` | Run headless: answer, print, and exit |
| `--mode json` | With `-p`, stream events as JSON lines |
| `-c`, `--continue` | Continue the most recent session in this folder |
| `-r`, `--resume` | Pick a session to resume |
| `--session <ID>` | Open a session by ID or file |
| `-n`, `--name <NAME>` | Name this session |
| `--model <MODE>` | Agent mode: `light`, `pro`, or `ultra` |
| `--list-models` | List the agent modes your workspace offers |
| `--tools <NAMES>` | Allow only these local tools, comma-separated |
| `--exclude-tools <NAMES>` | Turn off these local tools, comma-separated |
| `--tui-mode <MODE>` | `fullscreen` (default) or `regular`. Same as the global option on a bare `cloudthinker` |
| `-a`, `--approve` | Trust this project's local files for this run |
| `-na`, `--no-approve` | Ignore this project's local files for this run. The spelling is a single dash and two letters |

Put the CLI's own options before `agent`. Everything after `--` goes to the agent without the CLI reading it:

```bash theme={null}
cloudthinker --workspace Production agent    # start the agent in the Production workspace
cloudthinker agent --help                    # the CLI's summary of agent flags
cloudthinker agent -- --help                 # the agent's own, full help
```

`agent` hands off to the agent process, so `agent -p` returns the agent's own exit code, not the codes in [Exit codes](#exit-codes).

### Remote agent

`remote [TARGET]` runs the agent on another machine over SSH and keeps it running when the connection drops or your laptop sleeps. The remote machine's own CLI holds the agent in a background process, so you don't need `tmux`. `TARGET` is a host from `~/.ssh/config`, `user@host`, or `ssh://user@host:port`, and defaults to the last machine you used. The first time, name it: with no target and no earlier machine, the command exits 2 with `Which machine? Run: cloudthinker remote <ssh-host>`. Both machines need the CLI on macOS or Linux.

| Flag | Description |
| - | - |
| `--cwd <DIR>` | Folder on the remote machine, instead of picking one |
| `--name <NAME>` | Attach to or start the agent with this name |
| `-- <AGENT_ARGS>` | Arguments for the agent when it starts |

The remote agent runs the remote machine's own `cloudthinker`, so it uses that machine's login and workspace. Run `cloudthinker login` there first; over SSH it shows a short code.

> [!NOTE]
>
> Inside `cloudthinker remote`, Ctrl+Z detaches and leaves the agent running on the remote machine. It doesn't suspend a local job. Run `cloudthinker remote` again to return to it.

## Chat

| Command | Description |
| - | - |
| `chat -p <PROMPT>` | Send a prompt to CloudThinker and wait for the answer. `-p -` reads the prompt from stdin |
| `chat -p … --continue <UUID>` | Continue a conversation, by run ID or conversation ID |
| `chat -p … --agent <UUID or ALIAS>` | Have a custom agent answer this turn |
| `chat -p … --no-wait` | Return as soon as the run is queued |
| `chat -p … --timeout <SECS>` | Stop waiting after this many seconds. Default 2400. The run continues |
| `chat -p … --json` | Print one JSON object instead of the plain answer |
| `chat status <RUN_ID> [--wait] [--timeout <SECS>] [--json]` | Show a run's state and answer; `--wait` polls until it finishes |
| `chat ls [--conversation <UUID>] [--limit <N>] [--json]` | List recent headless runs, newest first. `--limit` 1 to 50, default 10 |

Without `--json`, stdout carries only the answer; progress and the `continue_with=` line go to stderr. See [Headless chat](https://docs.cloudthinker.io/guide/cli/headless-chat.md).

## Review

Review your local Git changes, or read a [Review](https://docs.cloudthinker.io/guide/code-review/overview.md) CloudThinker already runs on a merge request or pull request.

| Command | Description |
| - | - |
| `review` | Review staged, unstaged, and untracked changes against `HEAD` |
| `review --base <REF>` | Review the branch diff from the merge base with `REF`, including uncommitted edits |
| `review status <MR_URL>` | Summary: provider, title, status, verdict, and finding count |
| `review findings <MR_URL>` | List findings, worst severity first |
| `review watch <MR_URL>` | Poll until the review finishes |

Every review command takes `--json`. `review` and `review watch` also take `--timeout <SECS>` (default 2400) and `--fail-on <low|medium|high|critical>`, which exits 6 when a finding is at that severity or worse.

A local `review` reads your checkout with read-only tools and prints findings in the terminal. It doesn't post comments, apply fixes, or change your Git index or working tree. It runs on CloudThinker Agent modes, so the diff and any file it reads go to CloudThinker's model gateway, and it uses workspace credits. See [What leaves your machine](https://docs.cloudthinker.io/guide/cli/agent.md#what-leaves-your-machine).

```bash theme={null}
cloudthinker review --base origin/main --fail-on high
cloudthinker review findings https://github.com/acme/api/pull/412 --json
```

| Field | Values |
| - | - |
| Review status | `queued`, `in review`, `review complete`, `filtered`, `failed`, `stopped` |
| Review verdict | `in review`, `approved`, `review suggested`, `changes requested`, `filtered`, `failed`, `stopped` |

`filtered` means a repository filter skipped the merge request, so no review ran. `review suggested` means findings worth a look, with nothing blocking. Exit codes: a review that finishes without hitting `--fail-on` exits 0, and so does a `filtered` or `stopped` one. A `failed` review, or an MR URL with no review, exits 1. A wait that passes `--timeout` exits 4.

## Incidents and recommendations

| Command | Description |
| - | - |
| `incident ls [--status <STATUS>] [--limit <N>] [--json]` | List [incidents](https://docs.cloudthinker.io/guide/incident/overview.md), newest first. `--limit` 1 to 100, default 25 |
| `incident status <ID> [--wait] [--timeout <SECS>] [--json]` | Show an incident; `--wait` blocks until it closes |
| `recommendations ls [--status <STATUS>] [--limit <N>] [--json]` | List [cost recommendations](https://docs.cloudthinker.io/guide/cost-optimization/recommendations.md) with monthly savings. `--limit` 1 to 100, default 25 |

Incident statuses: `open`, `acknowledged`, `investigating`, `identified`, `on-hold`, `not-found`, `false-alarm`, `resolved`, `auto-resolved`. `not-found` is a status, not a lookup error: the investigation found no root cause the evidence supports. `incident status --wait` exits 0 once the incident is `resolved`, `auto-resolved`, `false-alarm`, or `not-found`. If `--timeout` passes first, it exits 4.

Recommendation statuses: `pending`, `in-progress`, `implemented`, `ignored`.

## Cyber

To run a security test, start the agent and ask for one in plain language, for example "Test [http://localhost:3000](http://localhost:3000) for security issues". These commands check the results. See [Cyber](https://docs.cloudthinker.io/guide/security/cyber-overview.md).

| Command | Description |
| - | - |
| `cyber app ls` | List the apps this workspace tests |
| `cyber domain ls` | List workspace domains and their ownership proof |
| `cyber domain add <DOMAIN>` | Add a domain to prove ownership of, with a DNS TXT record. See [Register the app](https://docs.cloudthinker.io/guide/security/security-testing.md#register-the-app) |
| `cyber domain verify <ID>` | Re-check a domain's ownership proof |
| `cyber run status <RUN_ID> [--wait]` | Show a run's state and finding counts. There's no command that lists runs: the run ID is in the agent's output when it starts a test run |
| `cyber run cancel <RUN_ID>` | Stop a running test |
| `cyber finding ls <APP_ID>` | List an app's findings. Filters: `--severity`, `--status`, `--triage`. Paging: `--page` (from 1, default 1) and `--take` (per page, default 50) |
| `cyber finding get <FINDING_ID>` | Show one finding |
| `cyber finding export <APP_ID> [--finding-id <ID>]` | Export findings as a PDF report. It writes no local file: it prints the `filename` and a `download_url` to fetch it from |
| `cyber config show`, `get <KEY>`, `set <KEY> <VALUE> [--user]` | Read or change Cyber settings for this project, or as your default |
| `cyber doctor [--fix]` | Check this machine can run a local Cyber test; `--fix` installs missing tools |

Every Cyber command takes `--json`.

`finding ls` filter values: `--severity` is `critical`, `high`, `medium`, `low`, or `info`. `--status` is `open`, `resolved`, `dismissed`, or `needs-verification`. `--triage` is `none`, `in-progress`, or `awaiting-retest`.

`cyber doctor --fix` installs pinned versions of `httpx` and `katana` under `~/.cloudthinker/tools/`, in your home folder, so it needs no `sudo`. It reports a missing `curl` but doesn't install it.

`cyber config` reads `.cloudthinker/config.toml` in the project and `~/.cloudthinker/config.toml` for your defaults (`--user`). A value you set wins over a derived one. `cyber config show` lists both.

| Key | Meaning |
| - | - |
| `app` | The app this project tests |
| `repo_path` | The repository root. Derived from Git when not set |
| `auth.<role>` | The name of the environment variable that holds that test identity's auth header, never the secret itself. In a project file it must be `CYBER_<ROLE>_AUTH` |
| `context.<name>` | A path or URL to context for the test, such as an OpenAPI spec, a Postman collection, or a HAR file |

## Environments

`worker` runs this machine as an environment, so a chat or automation can work in a folder here. Full guide: [Environments](https://docs.cloudthinker.io/guide/workers.md).

| Command | Description |
| - | - |
| `worker outpost create <NAME> [--shared]`, `ls`, `archive <OUTPOST>` | Register, list, or retire environments |
| `worker start --outpost <OUTPOST> --workdir <DIR>` | Serve one folder until interrupted. `--background` keeps it running after the terminal closes |
| `worker service install`, `uninstall`, `status`, `start`, `stop` | Run the environment under systemd (Linux) or launchd (macOS). `install --system --user <ACCOUNT>` (as root) installs a machine-wide service |
| `worker status --outpost <OUTPOST>` | Show an environment's availability as the workspace sees it |
| `worker doctor` | Check this machine can run an environment, with one fix per problem |
| `worker worktrees ls`, `prune` | List or clean up the Git worktrees made for conversations |

## Update and shell completion

| Command | Description |
| - | - |
| `update` | Install the latest release of the CLI and agent together |
| `update --force` | Reinstall even when already current |
| `update --json` | Print the result as JSON |
| `completion <bash\|zsh\|fish\|…>` | Print a shell completion script |

On an interactive terminal the CLI also offers an update when a newer release exists, at most every 20 hours. `update` works only on an install the CLI installer created. On any other install, it refuses and prints the reinstall command: `curl -fsSL https://cloudthinker.io/install.sh | sh`. See the [CLI overview](https://docs.cloudthinker.io/guide/cli/overview.md).

```bash theme={null}
cloudthinker completion zsh > "${fpath[1]}/_cloudthinker"
cloudthinker completion bash > ~/.local/share/bash-completion/completions/cloudthinker
cloudthinker completion fish > ~/.config/fish/completions/cloudthinker.fish
```

If `${fpath[1]}` isn't writable, save the zsh file to a folder of your own and add that folder to `fpath` in `~/.zshrc` before `compinit`.

## Environment variables

| Variable | Effect |
| - | - |
| `CLOUDTHINKER_URL` | Same as `--url` |
| `CLOUDTHINKER_WORKSPACE` | Same as `--workspace` |
| `CLOUDTHINKER_TOKEN` | Bearer token to use instead of stored logins. Can't be combined with `--workspace` |
| `CLOUDTHINKER_LOGIN` | `browser` or `device` forces that login flow on this machine |
| `CLOUDTHINKER_NO_UPDATE_CHECK` | Set to `1` to turn off the update offer |
| `CLOUDTHINKER_OUTPOST_ID` | Default environment for `worker` commands |
| `CLOUDTHINKER_AUTO_BACKGROUND_SECONDS` | Seconds before the agent moves a long shell command to the background. Default 10; `0` turns it off |
| `NO_COLOR` | Turn off color on stderr. Color is also off when stderr is not a terminal |
| `HTTPS_PROXY`, `ALL_PROXY` | Send the CLI's traffic through this proxy. Hosts in `NO_PROXY` skip it |
| `SSL_CERT_FILE`, `SSL_CERT_DIR` | Trust this CA bundle or folder, for a proxy that re-signs HTTPS. Without them, the CLI uses the OS trust store |

## Exit codes

| Code | Meaning |
| - | - |
| 0 | Success |
| 1 | The job failed: a failed run, an unknown run or review, or exhausted network retries |
| 2 | Bad usage, or the server rejected the request |
| 3 | Not logged in, the credential expired, or access was refused |
| 4 | The CLI stopped waiting. The work continues on the server |
| 5 | The run paused for an approval in the browser |
| 6 | A review found an issue at or above its `--fail-on` severity |
| 130 | Ctrl-C stopped a `chat` wait, an `incident status --wait`, or a `login`. A run or incident continues on the server |

## Files

| Path | Contents |
| - | - |
| `~/.local/bin/cloudthinker` | The binary the installer puts on your `PATH` |
| `~/Library/Application Support/cloudthinker/credentials.json` (macOS), `$XDG_CONFIG_HOME/cloudthinker/credentials.json` or `~/.config/cloudthinker/credentials.json` (Linux) | One login per workspace for each host |
| `~/.cloudthinker/agent/` | Agent configuration, including `settings.json` |
| `~/.cloudthinker/agent/bin/<version>/` | The agent build for that CLI version |
| `~/.cloudthinker/agent/sessions/` | Local agent session transcripts |
| `~/.cloudthinker/tools/` | Tools `cyber doctor --fix` installed |
| `.cloudthinker/config.toml` | Cyber settings saved for a project, in that project's folder |
| `~/.cloudthinker/config.toml` | Your default Cyber settings, from `cyber config set --user` |

`credentials.json` is plain JSON with file mode `0600` in a `0700` folder, so only your user can read it. The CLI doesn't use the OS keychain. Releases before 0.5.3 did, and the first run of a newer release moves those logins into the file and deletes the keychain entry. On a machine other people log in to, give each person their own OS account, and run `cloudthinker logout --all` when you're done.

### Uninstall

1. If this machine runs an environment as a service, run `cloudthinker worker service uninstall`.
2. Run `cloudthinker logout --all` once for each host you logged in to, using `--url` for any host other than the default. Or delete `credentials.json`.
3. Delete the binary, `~/.local/bin/cloudthinker`.
4. Delete the `~/.cloudthinker` folder, and any completion script you saved, such as `"${fpath[1]}/_cloudthinker"`.
5. Optional: delete `.cloudthinker/` folders inside your projects.

## Related

> [card] [Agent CLI](https://docs.cloudthinker.io/guide/cli/agent.md)
>
> Run CloudThinker Agent in your repository

> [card] [Headless chat](https://docs.cloudthinker.io/guide/cli/headless-chat.md)
>
> Send prompts from scripts and CI jobs


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.