# CLI Reference: Octomind Commands, Flags, and Options Launch sessions, configure Octomind, and automate workflows from your shell. This reference covers every command, flag, and argument, hidden ones included. ## Synopsis ```bash octomind [COMMAND] octomind COMMAND --help ``` Most options belong after their subcommand. The global `-c/--config` option can appear before or after a subcommand; Boolean switches default to `false`, optional values to unset, and repeatable options to an empty list unless stated otherwise. The subcommand is optional. Bare `octomind` behaves as `octomind run` with the configured default tag. | Command | Purpose | |---------|---------| | `run` | Start an interactive or non-interactive AI session (the main command). | | `login` | Sign in to an Octomind account or a ChatGPT subscription. | | `configure` | Choose a provider, credentials, and the main and compression models interactively. | | `server` | Start a WebSocket server for remote sessions. See [WebSocket Server](../integration/01-websocket-server.md). | | `acp` | Run as an Agent Client Protocol agent over stdio for editor integration. See [ACP Protocol](../integration/02-acp-protocol.md). | | `config` | Create, validate, display, or upgrade configuration. See [Config Reference](03-config-reference.md). | | `tap` | Add a registry tap (agent source), list active taps, or scaffold a new tap with `tap init`. | | `untap` | Remove a previously added tap. | | `vars` | Show placeholder variables and their resolved values. | | `send` | Inject a message into a running named session. | | `workflow` | List tap workflows or run one by name/local TOML file. See [Workflows](../usage/09-workflows.md). | | `completion` | Generate shell completion scripts. | | `complete` | Hidden: print cached completion candidates. | | `help [COMMAND]...` | Clap-generated help, including nested commands such as `help tap init`. | ### Global config overrides Use `-c/--config KEY=VALUE` to override an existing config value for one invocation. `KEY` is a dotted path, and the option can be repeated. Values are parsed as TOML values when possible; otherwise they are treated as strings. Unknown keys and paths through arrays are errors. Array indexes are not supported. Overrides are not saved to the config file, and they cannot be combined with the `config` or `configure` subcommands. ```bash octomind -c max_identical_rounds=0 run octomind run -c max_identical_rounds=0 -c log_level=debug ``` The global config file lives at `~/.local/share/octomind/config/config.toml` on macOS and Linux (`%LOCALAPPDATA%\octomind\config\config.toml` on Windows). Override the load path with `OCTOMIND_CONFIG_PATH`, or relocate the data tree with `OCTOMIND_DATA_DIR`. See [Environment Variables](04-environment-variables.md) for load/save path differences. ### TAG resolution `run`, `server`, and `acp` take an optional `TAG`: - A **role name** — matched against `[[roles]]` in your config. A role with the same name as a tap agent takes priority over the tap agent. - A **tap agent name** (e.g. `developer`) — resolved through your installed [taps](../integration/04-tap-system.md); the base agent of a namespace `` is the file `agents//default.toml` of a tap. The same applies to `acp` and the `/role` command. The `role` parameter of the `tap` tool reaches only tap agents, so a config role never wins there. - A **variant** `:` (e.g. `acme:reviewer`) — the file `agents//.toml` of a private tap. `:default` is the base agent ``. A variant that no tap has is an error that lists the agents of its namespace. A variant is the exception; a specialty is a skill ([Skill or Variant](../integration/04-tap-system.md#skill-or-variant)). - Omitted — uses the `default` tag from config. Model resolution priority, highest first: explicit runtime override > role profile > tap name mapping > the required main `[model]`. Only `run` and `workflow` accept `--format`. Both accept only `plain` or `jsonl`; clap rejects any other value. ## `octomind configure` One screen lists the Octomind hub (recommended) first, then every supported provider, then "Skip for now". Type to filter, Enter to choose, Esc works like Skip. Hub setup reuses `octomind login` and sets all three models to `octohub:auto`. Providers whose key is already present are listed first. For a direct provider, setup prompts with hidden input for its key and any other required variable that is missing (empty input asks again), then offers a filterable model list with an "other" row for typing a model ID. OpenRouter's and Ollama Cloud's lists are fetched from their public model catalogs; if that fails, you type the ID. After the main model, setup asks `Use for compression too? It shortens long conversations; a cheaper model often fits. [Y/n]`; Enter keeps it for both, `n` opens a picker for the compression model. ```bash octomind configure ``` Only `[model].name` and `[compression.model].name` change in the selected config file; comments and other settings are preserved. New configs use the embedded template. Credentials go into the user-scope `/config/.env`, with owner-only permissions on Unix, and never into `config.toml`. Skip leaves an existing config unchanged; on first run it writes the default template. The final summary shows each model, provider, and whether its key is present. Use `octomind configure` again, `/model provider:model` for one session, or edit the displayed config path. The screen also runs before creating a missing config on the first interactive `octomind` or `octomind run` launch. Both stdin and stdout must be terminals, with neither `--format` nor `--daemon` set. Other commands and non-interactive runs keep the existing default-config behavior without prompting. Explicit `configure` requires both terminals; for automation, use `octomind config --model provider:model` and edit `config.toml`. ## `octomind login` Sign in through the browser-confirmed device flow and store the minted OctoHub key in Octomind's environment file. | Flag | Description | |------|-------------| | `--force` | Sign in again even when the current machine already has an account session. | | `--no-browser` | Print the confirmation URL instead of attempting to open it. | ```bash octomind login octomind login --force --no-browser ``` Use `octomind login chatgpt` to sign in with a ChatGPT account. Models with the `chatgpt:` prefix use the signed-in account's ChatGPT plan: ```bash octomind login chatgpt octomind run -m 'chatgpt:' ``` Add `--force` to sign in again or `--no-browser` to print the authorization URL instead of opening it. See the [provider reference](../usage/04-providers.md#provider-reference) for the `chatgpt:` prefix. ## `octomind config [OPTIONS]` Create, validate, display, or upgrade configuration. With no flags, see the example note below. Loading happens before command dispatch and may create or migrate config even with `--show` or `--validate`. **Mutating flags** (apply changes, then save to the loaded config path): | Flag | Description | |------|-------------| | `--model MODEL` | Set root-level model (`provider:model` format). | | `--log-level ` | Set the log level (case-insensitive); any other value errors. | | `--mcp-providers ` | **Replace** the MCP server list: clears all configured servers, then adds each named one as a `builtin` server (timeout 30s). | | `--mcp-server ` | Add or update one MCP server. See [the `--mcp-server` format details](01-cli-reference.md) below. | | `--system TEXT` | Write/reset the legacy root `system` field. Current session prompts come from `[[roles]].system`, so prefer editing the role instead. | | `--markdown-enable BOOL` | Enable or disable markdown rendering. | | `--markdown-theme THEME` | Set the markdown theme (must be one of the themes from `--list-themes`). | **Inspect / maintenance flags:** | Flag | Description | |------|-------------| | `--show` | Display a selected summary (model, logging, rendering, roles, credentials, and MCP), not a full TOML dump. | | `--validate` | Validate the configuration without making changes. | | `--list-themes` | List the available markdown themes. | | `--upgrade` | Upgrade and rewrite the standard config file when migration is needed. | **Note on `--api-key`:** the parser accepts an `--api-key provider:key` argument, but the mutation path rejects it at runtime — API keys can never be stored in the config file for security reasons. Set the provider's environment variable instead, using the credential example in [Environment Variables](04-environment-variables.md). See [Environment Variables](04-environment-variables.md) for credential variables. `--list-themes`, `--show`, `--validate` and `--upgrade` run alone: combining one with another of them or with a mutating flag (including `--api-key`) is rejected as a usage error. Value options take one value. `--markdown-enable` requires `true` or `false`; `--system default` clears the legacy prompt. ```bash octomind config --model octohub:auto --log-level debug octomind config --markdown-enable true --markdown-theme dark octomind config --system default octomind config --mcp-providers core,runtime,orchestration,agent octomind config --upgrade ``` `--api-key PROVIDER:KEY` has no short flag and takes one string; use environment credentials instead. ### `--mcp-server` format `--mcp-server name,key=value,...` — the first comma-separated token is the server name; the rest are `key=value` pairs: | Key | Meaning | |-----|---------| | `type` | `http`, `stdio`, or `builtin` (default `http`). | | `url` | Endpoint URL — **required** for `http`. | | `command` | Executable to launch — **required** for `stdio`. | | `args` | Space-separated arguments for a `stdio` command. | | `timeout` / `timeout_seconds` | Per-operation timeout in seconds (default `30`); tool-call progress resets the idle deadline, and it holds while the user answers an MCP elicitation. | The name must not be blank and every option must contain `=`. Only the first `=` splits key from value, so `url=http://localhost:9000/mcp?mode=read` and `args=--mode=read` keep their values intact. Malformed input is reported and nothing is saved. ```bash # HTTP server octomind config --mcp-server "search,url=http://localhost:9000,timeout=60" # stdio server octomind config --mcp-server "files,type=stdio,command=octofs" ``` **Examples:** ```bash # Create a default config (only if none exists; otherwise reports # the current state with no changes — it does NOT regenerate). octomind config # Show current settings octomind config --show # Validate config octomind config --validate # List themes octomind config --list-themes ``` ## `octomind run [TAG]` Start an interactive or non-interactive AI session. | Flag | Short | Description | |------|-------|-------------| | `TAG` | | Role name or tap agent tag (e.g. `developer`, or `acme:reviewer` for a variant in a private tap). Uses the config `default` (`assistant`) if omitted. | | `--name NAME` | `-n` | Create a named session, or resume it if it already exists. | | `--resume [SESSION]` | `-r` | Resume by name; in an interactive TTY, bare `--resume` opens the recent-session picker | | `--resume-recent` | | Resume the most recent session for the current directory | | `--format FORMAT` | | Output mode: `plain` or `jsonl` only; other values are rejected. Unset by default, resolving to `plain`. | | `--model MODEL` | `-m` | Override model (`provider:model` format) | | `--readonly` | | Start a read-only session: only tools whose MCP `readOnlyHint` annotation is true are offered and can run. A tool with no hint counts as mutable, and shell runners declare `readOnlyHint: false`, so there is no shell. The session cannot delegate, and `/run` and `/workflow` are refused. The mode lasts for the whole session and is restored when you resume it, with or without the flag; `--readonly` on resume of a writable session makes it read-only from then on. In code mode the tool catalog lists read-only tools only. This restricts the tools the model can call; scripts you configured yourself (skill `validate` scripts, guardrail scripts, hooks) still run. | | `--daemon` | | Keep the session alive for injected messages. Pair with `--format jsonl` for headless use; TTY use remains interactive-capable. | | `--sandbox` | | Restrict filesystem writes to the working directory. See [Sandbox](#sandbox). | | `--hook NAME` | | Activate webhook hook(s) by name (defined in `[[hooks]]` config). Repeatable. See [Daemon & Hooks](../integration/03-daemon-and-hooks.md). | | `--schema PATH` | | Path to a JSON Schema **object** file. Constrains the model's output to match it (structured output). The resolved model must support structured output, or the run fails fast. See note below. | **Interactivity and `--format`:** `--format` is unset by default. If it is omitted and stdin is a TTY, the session runs **interactively**. If `--format` is given (`plain` or `jsonl`) **or** stdin is piped, the session runs **non-interactively**, reading the input from stdin. Internally, an unset format resolves to `plain`. `run` has no message argument: its only positional argument is `TAG`. With `--format`, a non-daemon run requires nonempty piped stdin; a TTY produces an error. Resuming without an explicit tag restores the saved role. **Daemon mode:** `--daemon` keeps the session alive after a turn. Pair it with `--format jsonl` for a headless event stream. When attached to a TTY without `--format`, startup uses an empty initial input and the terminal stays interactive. Inject further messages with [`octomind send --name `](#octomind-send). **Structured output (`--schema`):** pass a path to a JSON Schema **object** file to constrain the model's output. The schema applies to every assistant reply for the session's lifetime — across multi-turn sessions, resumes, and daemon mode — while tool calls still flow normally underneath. If the resolved model reports no structured-output support, the run fails before the provider request. The schema is a runtime-only override and is not persisted, so pass it again when resuming. Most useful with `--format jsonl`. A ready-to-use example ships at [`config-templates/todos.schema.json`](../../config-templates/todos.schema.json). **Examples:** ```bash # Interactive session with the default tap agent octomind run # Tap agent octomind run developer # Read-only session octomind run developer --readonly # Non-interactive: pipe message via stdin echo "Explain the auth module" | octomind run --format plain # Named session octomind run --name feature-auth # Resume session octomind run --resume feature-auth octomind run --resume-recent # Daemon mode with webhook echo "Wait for build events" | octomind run --name ci-watcher --daemon --format jsonl --hook github-push # Main-purpose model override octomind run -m anthropic:claude-sonnet-4-6 # Structured output — constrain replies to a JSON Schema (structured-output models only) echo "List the top 3 TODOs" | octomind run developer --format jsonl --schema config-templates/todos.schema.json ``` ## `octomind server [TAG]` Start a WebSocket server for remote AI sessions. | Flag | Short | Description | |------|-------|-------------| | `TAG` | | Role name or tap agent name | | `--host HOST` | | Bind address (default: `127.0.0.1`) | | `--port PORT` | `-p` | Port (default: `8080`) | | `--sandbox` | | Restrict filesystem writes to the working directory. See [Sandbox](#sandbox). | | `--allow-origin ORIGIN` | | Permit a browser `Origin` header; repeatable. Unlisted origins are rejected, while native clients without `Origin` do not need an entry. | **Examples:** ```bash octomind server octomind server --host 0.0.0.0 --port 9090 octomind server developer --sandbox octomind server --allow-origin http://localhost:3000 ``` ## `octomind acp [TAG]` Run as Agent Client Protocol agent over stdio (for editor integration). | Flag | Short | Description | |------|-------|-------------| | `TAG` | | Role name or tap agent name | | `--readonly` | | Same as `octomind run --readonly`: only tools whose MCP `readOnlyHint` annotation is true are offered and can run, and the session cannot delegate. | | `--name NAME` | `-n` | Session name (used when client creates a session) | | `--resume SESSION` | `-r` | Resume a specific session by name | | `--resume-recent` | | Resume the most recent session | | `--model MODEL` | `-m` | Override model (`provider:model` format) | | `--sandbox` | | Restrict filesystem writes to the working directory. See [Sandbox](#sandbox). | **Examples:** ```bash octomind acp octomind acp developer --sandbox octomind acp -m openai:gpt-5.6-luna ``` ## `octomind tap [TAP] [PATH]` Add or list registry taps (Homebrew-style agent sources). Replace `myorg/my-tap` and the local path below with your own tap. `myorg/my-tap` resolves to the repository `myorg/octomind-my-tap`. | Argument | Description | |----------|-------------| | `TAP` | Tap identifier (`user/repo` format). Omit to list all taps. | | `PATH` | Optional local path. If provided, symlinks instead of cloning from GitHub. | **Examples:** ```bash # List all taps octomind tap # Add tap from GitHub octomind tap myorg/my-tap # Add local tap (symlink) octomind tap myorg/my-tap /path/to/local/tap ``` ## `octomind tap init ` Create a new tap repository from the default tap's scaffold (`scaffolds/tap/` in [muvon/octomind-tap](https://github.com/muvon/octomind-tap)). Renders the template, validates it, runs `git init`, and registers the directory as a local tap — the starter agent is runnable immediately. | Argument | Description | |----------|-------------| | `TAP` | New tap identifier (`user/repo` format). | | `--agent NAME` | Starter agent's name: lowercase letters, digits and hyphens, no `:`. Written to `agents//default.toml`. Defaults to the repo name. | | `--dir DIR` | Destination directory. Defaults to `./octomind-`. | **Examples:** ```bash # Scaffold ./octomind-team, validate, git init, register as local tap octomind tap init acme/team --agent team # Then run the starter agent (team) octomind run team # Custom starter agent and destination octomind tap init acme/team --agent legal --dir ~/work/acme-tap ``` The destination must be missing or an empty directory. Rendering fails if any scaffold token remains unresolved or the validation command declared by the installed scaffold fails. ## `octomind untap ` Remove a previously added tap. `TAP` is required; use an identifier listed by `octomind tap`. ```bash octomind untap myorg/my-tap ``` ## `octomind vars` Show all placeholder variables and their current values. | Flag | Short | Description | |------|-------|-------------| | `--preview` | `-p` | Show a short preview (up to 3 lines) of each placeholder value | | `--expand` | `-e` | Show full expanded values for placeholders | With no flag, `vars` runs in **list** mode (names + descriptions). If both flags are given, `--expand` takes precedence over `--preview`. ```bash octomind vars octomind vars --preview octomind vars --expand ``` Displays the placeholder set `octomind vars` reports: `{{DATE}}`, `{{SHELL}}`, `{{OS}}`, `{{BINARIES}}`, `{{CWD}}`, `{{HOME}}`, `{{SYSTEM}}` (complete system info), `{{CONTEXT}}` (README + git status + git tree), `{{GIT_STATUS}}`, `{{GIT_TREE}}`, and `{{README}}`. (`{{ROLE}}` is substituted in role prompts but is **not** among the values `vars` lists.) ## `octomind send` Inject a message into a running named session. Works against any running session that has started its inject listener (typically a session launched with `--daemon`, but not exclusively). The message reaches the session over a per-OS transport: - **Unix:** a Unix domain socket at `/.sock` (long names are shortened and suffixed with an eight-digit SHA-256 prefix) (run dir is `$XDG_RUNTIME_DIR/octomind/`, or `/octomind-/` when that variable is unset). - **Windows:** a named pipe `\\.\pipe\octomind-`. The session replies `ok` on successful delivery; any other reply is treated as an error and reported. | Flag | Short | Description | |------|-------|-------------| | `--name NAME` | `-n` | Name of the running session to send to (required) | | `MESSAGE` | | Message text. If omitted, reads from stdin. | ```bash echo "Check build status" | octomind send --name ci-watcher octomind send --name ci-watcher "Check build status" ``` ## `octomind workflow [NAME|FILE]` Run a multi-step workflow defined in a TOML file. | Flag | Short | Description | |------|-------|-------------| | `NAME|FILE` | | Tap workflow name or local TOML path. Omit to list available tap workflows. | | `--dry-run` | | Validate and print the execution plan without running any steps | | `--format ` | | `plain` or `jsonl` only; other values are rejected. `jsonl` streams one `assistant` event per step + a final aggregated `cost` event to stdout | Running a workflow reads input from stdin; listing workflows and `--dry-run` do not. Public tap workflows may reference only public tap roles; local files are not subject to that restriction. Per-step assistant responses, progress, cost, and token stats are written to **stderr**. When executing a target, **stdout** receives output only for `--dry-run` (the execution plan) or `jsonl`. Listing without a target also prints to stdout. With `--format jsonl`, stdout streams one `{"type":"assistant","content":...,"step":"","session_id":""}` line **as each step completes** (the final result is simply the last one) followed by one `{"type":"cost",...}` line with aggregated tokens/cost. These are the same event shapes `octomind run --format jsonl` emits, with an extra `step` field identifying the originating step (omitted in `run` output). Workflows have no single resumable session, so `session_id` is empty. See [Workflows](../usage/09-workflows.md). Create `myflow.toml` in your working directory with this runnable one-step definition: ```toml name = "refine" [[steps]] name = "refine" role = "task_refiner" prompt = "{{input}}" ``` ```bash octomind workflow echo "build a JSON-to-CSV CLI in Rust" | octomind workflow myflow.toml echo "build a JSON-to-CSV CLI in Rust" | octomind workflow myflow.toml --format jsonl octomind workflow myflow.toml --dry-run ``` ## `octomind completion ` Generate shell completion scripts. | Argument | Description | |----------|-------------| | `SHELL` | Target shell: `bash`, `zsh`, `fish`, `powershell`, `elvish` | | Shell | Command | |-------|---------| | Bash | `octomind completion bash > ~/.local/share/bash-completion/completions/octomind` | | Zsh | `octomind completion zsh > ~/.zfunc/_octomind` | | Fish | `octomind completion fish > ~/.config/fish/completions/octomind.fish` | | PowerShell | `octomind completion powershell > octomind.ps1` | | Elvish | `octomind completion elvish > octomind.elv` | Create the destination directory before redirecting output. For Zsh: ```bash mkdir -p ~/.zfunc octomind completion zsh > ~/.zfunc/_octomind ``` Add `~/.zfunc` to Zsh’s `fpath` before `compinit` in your shell configuration. Dynamic agent-tag completion for `octomind run ` and tap-workflow completion for `octomind workflow ` are injected only into the **bash**, **zsh**, and **fish** scripts through the hidden `complete` helper. PowerShell and Elvish remain static. ## Hidden internal commands These commands are omitted from normal help but remain callable. `complete` reads cached tap data; an unknown subcommand prints nothing. | Command / argument | Required / default | Meaning | |---|---|---| | `complete SUBCOMMAND` | Required | `run` lists agent tags and configured roles; `workflow` lists public workflows. | ```bash octomind complete run octomind complete workflow ``` ## Sandbox When enabled, the sandbox restricts writes with Landlock on Linux or Seatbelt on macOS while retaining the state/temp exceptions defined by each backend. It is active if **either** the config `sandbox` setting **or** the `--sandbox` flag is set, and it applies only to `run`, `server`, and `acp` — all other subcommands ignore both. Other platforms log that the sandbox is unsupported. ```bash octomind run developer --sandbox ``` ## Exit codes | Code | Meaning | |------|---------| | `0` | Success. | | `1` | The command failed; the error is printed to stderr. A non-daemon `run` also exits `1` when a provider call fails. | | `2` | Invalid command-line arguments (reported by the argument parser before anything runs). | | `75` | A non-interactive `run` stopped at a spending threshold (`max_request_spending_threshold` or `max_session_spending_threshold`). stderr ends with `Stopped: request spending threshold reached` or `Stopped: session spending threshold reached`. The session is saved, so the run can be resumed (`EX_TEMPFAIL`). | | `130` | A `run` session was force-stopped: a second Ctrl+C, or SIGTERM on Unix. The first Ctrl+C only cancels the current operation. | In an interactive TTY, a session spending threshold asks `Do you want to continue? (y/N)` instead of stopping the process with `75`. ## Common questions - **Why does `--format` reject startup?** Pipe a nonempty prompt; redirected empty stdin also fails in daemon mode. - **Why does bare `--resume` fail in a script?** Supply a session name; the picker requires an interactive TTY. - **Why does `send` fail?** The receiving session must still be running with its inject listener active. A saved session alone cannot receive messages. - **Why does a hook fail?** `--hook` names must exist in `[[hooks]]`; see [Daemon & Hooks](../integration/03-daemon-and-hooks.md) for a complete hook configuration. ## Help and version | Flag | Short | Description | |------|-------|-------------| | `--help` | `-h` | Root or subcommand help. | | `--version` | `-V` | Root version flag; not inherited by subcommands. | ```bash octomind --version octomind help tap init octomind run --help ``` ## Source map CLI registration: [main.rs](../../src/main.rs). Argument structs and behavior: [run.rs](../../src/commands/run.rs), [config.rs](../../src/commands/config.rs), [server.rs](../../src/commands/server.rs), [acp.rs](../../src/commands/acp.rs), [tap.rs](../../src/commands/tap.rs), [untap.rs](../../src/commands/untap.rs), [login.rs](../../src/commands/login.rs), [send.rs](../../src/commands/send.rs), [vars.rs](../../src/commands/vars.rs), [workflow.rs](../../src/commands/workflow.rs), [complete.rs](../../src/commands/complete.rs). Workflow file schema: [schema.rs](../../src/workflow/schema.rs). State paths: [directories.rs](../../src/directories.rs). ## See also - [Session Commands](02-session-commands.md) - [Config Reference](03-config-reference.md) - [Environment Variables](04-environment-variables.md) - [Workflows](../usage/09-workflows.md)