# CLI command reference

Full flags: `openprogram <command> -h`, `openprogram logs tail -h`, or one [generated page per command](https://fzkuji.github.io/OpenProgram/docs/reference/cli/README.html).

## Global

| Command | Does |
| --- | --- |
| `openprogram` | Opens the chat. A bare run first asks terminal UI or web UI, and launches a worker if none is running. |
| `--print PROMPT` | One-shot prompt; prints the reply and exits. Works in the current directory and runs until the model answers; a failure prints to stderr and exits non-zero. Run in its own process, it makes no model request beside the turn and leaves memory to the next worker: the conversation keeps the title cut from the prompt |
| `--print`, stopped | Ctrl-C or SIGTERM stops the run, waits up to 30 seconds for it to stop (2 seconds once a second signal comes), writes the usage and transcript files and exits 128 plus the first signal's number (130 for Ctrl-C, 143 for SIGTERM, 129 for SIGHUP), whatever signal follows; a turn still busy then has its commands stopped |
| `-p`, `--print -` | `-p` is `--print`. With no prompt or `-` the prompt comes from stdin; a prompt plus piped stdin adds the input as a `<stdin>` block. An empty prompt exits 2 |
| `--output-format FORMAT` | What `--print` writes on stdout: `text` (the reply), `json` (one record of how the run ended) or `stream-json` (one event per line, init first, result last); `--include-partial-messages` adds text and reasoning deltas to the stream |
| `--permission-mode MODE` | Permission mode for this `--print` turn only: `ask`, `acceptEdits`, `plan`, `auto`, `bypass`. A call that would ask is refused, since nobody can answer; it shows on stderr and the run still exits 0 |
| `--continue`, `--session-id ID`, `--at REF` | `--continue` (`-c`) runs on this folder's latest conversation; `--session-id` starts a new one with that id and fails if it exists; `--at` with `--resume` or `--continue` picks a branch or a message to run after |
| `--standalone`, `--no-project-binding`, `--no-web` | Run in this process instead of the App's Worker; keep a new conversation in the profile and write nothing in the folder; run the turn without web tools or the provider's own search |
| `--json-schema PATH` | Requires JSON Schema output for `--print`; `-` reads stdin |
| `--model PROVIDER/MODEL` | Model for a `--print` run in a new conversation; the provider needs a key from `providers login <provider> --api-key-stdin` |
| `--effort LEVEL` | Reasoning effort for one `--print` run: `off` (or `none`), `minimal`, `low`, `medium`, `high`, `xhigh`, `max`. Not saved; without it the Agent's effort applies |
| `--usage-file PATH` | After `--print`, writes tokens, cost, model, rounds and how the run ended to `PATH` as JSON |
| `--transcript-file PATH` | After `--print`, writes the turn to `PATH` as JSON lines: each model request with its tokens, the reply text, every tool call with its arguments and its result, in order, with times |
| `--resume SESSION_ID` | Resumes a session; ids from `openprogram sessions list` or the Web UI sidebar. With `--print`, an unknown id exits 1 |
| `--profile PROFILE` | State directory `~/.openprogram-<name>/`; same as `OPENPROGRAM_PROFILE` |
| `--no-alt-screen` | Inline TUI, keeps terminal scrollback |
| `--screen-reader` | Inline assistive-technology mode, no mouse tracking |
| `--version` | Prints the version |

## Chat and running

| Command | Does |
| --- | --- |
| `tui` (alias `chat`) | Launches the Ink terminal UI directly on Windows, macOS or Linux; terminals without raw input fall back to Rich. Takes `--print`, `--json-schema`, `--model`, `--effort`, `--usage-file`, `--transcript-file`, `--resume`, `--no-alt-screen`, `--screen-reader`. |
| `web` | Starts the service and opens `http://localhost:18100`. `--web-port` (this run; default stored preference, then 18100), `--no-browser`. `web auth-url` prints an authenticated link. |
| `acp` | Agent Client Protocol server. `--agent`, `--permission`. |

## Background service

| Command | Does |
| --- | --- |
| `status` | Running or not: PID, port, uptime |
| `stop` | Stops it |
| `restart` | After code or config changes |
| `upgrade` | Updates the code, restarts only if it works. `--check`, `--dry-run`, `--channel`, `--no-restart`, `--yes`, `--json`; `upgrade status`. |

| Verb | Does |
| --- | --- |
| `worker run` | Foreground, for debugging; Ctrl-C stops |
| `worker start` | Starts in the background and returns |
| `worker stop` | An installed service stays stopped until the next start or login |
| `worker restart` | Stops and starts a fresh one |
| `worker status` | Running or not, PID, port, uptime |
| `worker install` | Login service: launchd on macOS, systemd --user on Linux, Task Scheduler on Windows. Starts at login, restarts after a crash. |
| `worker uninstall` | Removes the service |

## Setup and configuration

| Command | Does |
| --- | --- |
| `setup` | First-run wizard. `menu` opens the picker; a section name jumps there: model, tools, agent, skills, ui, memory, profile, search, tts, channels, backend. |
| `config` | `list` (value, group, apply mode), `get <key>`, `set <key> <value>` |
| `ports` | Shows or persists the single Web UI port. `--port PORT`, default 18100. |
| `completion` | Prints a shell script: `bash`, `zsh`, `powershell`, `pwsh` |
| `recordings` | Records and replays provider calls: `status`, `record`, `replay`, `off`, `list`, `show`, `delete`, `prune` |
| `machines` | The machines OpenProgram reaches, where projects' folders are: `list`, `add`, `remove`, `enable`, `disable`, `test` |
| `permissions` | `check` explains one operation, `test` validates expected rule decisions |

### providers

Alias `secrets`. With no verb: the status table for all credentials.

| Verb | Does |
| --- | --- |
| `login <provider>` | `--api-key`, `--api-key-stdin` for non-interactive keys; `--account`; `--method` forces a login method |
| `logout` | Removes a provider's credentials |
| `list` | Credential pools by account |
| `available` (`search`, `catalog`) | Every configurable provider; optional QUERY |
| `status` | A provider's current credentials |
| `use` | Which account a provider uses |
| `discover`, `adopt` | Scan external credential sources, import them |
| `doctor` | Expiry, refresh, cooldown, conflicts |
| `setup` | Interactive first-time setup |
| `aliases` | Provider short names |
| `accounts` | `list`, `create`, `delete` |
| `migrate` | Stored credentials to the current format |

### mcp

| Verb | Does |
| --- | --- |
| `token create` | Creates and prints a token for the local stdio server |
| `serve` | Authenticated MCP over local stdio; needs an exact `OPENPROGRAM_MCP_TOKEN` |
| `list`, `show` | Servers and status; one server's tools and schemas |
| `add` | Stdio command server; writes `mcp_servers.json` and starts it |
| `rm` | Stops and deletes the config |
| `restart`, `enable`, `disable` | `disable` stops it and keeps the config |
| `edit` | Removed; reports to use `add`/`rm` or the MCP settings page |
| `test` | Starts a config temporarily to check its tool list; writes nothing |

```
openprogram mcp token create
export OPENPROGRAM_MCP_TOKEN="<paste the token printed above>"
openprogram mcp serve
```

`token create` prints the raw token once and does not set the variable. If one exists, reuse the saved token.

## Content

### agents

| Verb | Does |
| --- | --- |
| `list`, `show`, `add` | List, view, create |
| `rm` | Deletes the agent and all its sessions |
| `set-default` | Default agent |

### sessions

| Verb | Does |
| --- | --- |
| `list` | Every session across agents |
| `archive`, `unarchive` | Hide from or return to the default list; deletes nothing |
| `resume` | Answers a waiting session |
| `attach`, `detach` | Route a channel user into a session, remove it. `--channel`, `--peer` required; `--account`, `--peer-kind`. |
| `aliases` | All session-to-channel-user aliases |
| `export` | Markdown or HTML file: `--format`, `--output` |
| `import` | Claude Code and Codex conversations; rerunning adds only what is new |

### subagent

| Verb | Does |
| --- | --- |
| `spawn` | New branch in a session. `--session`, `--prompt` required; `--parent-msg`, `--label`, `--agent` (default `main`), `--context inherit\|clean` or `--clean`, `--no-json`. |
| `merge` | Merges into a target with a new turn. `--target`, repeatable `--branch SID` required; `--message`, `--agent`, `--base N`, `--no-json`. |
| `list`, `show` | Job resource views in a session |

### programs

| Verb | Does |
| --- | --- |
| `list` | Kind, owner, load state, directory, exposure tiers |
| `run <name> [operation]` | Entry in this process, or an application operation in the service. `--arg key=value`, `--input`, `--project`, `--request-key`, `--provider`, `--model`. |
| `status`, `cancel` | An application operation run |
| `check` | Validates; tests and commits a package so it can be called |
| `install`, `uninstall` | Directory, git URL or owner/repo. `--upgrade`, `--replace`, `--trust`. |
| `enable`, `disable` | An application's UI, resource, services and entries. Tools cannot be disabled. |

### skills

| Verb | Does |
| --- | --- |
| `list` | Discovered skills |
| `search`, `install` | From a discovery source, ClawHub by default |
| `update` | Re-pulls stale skills, comparing SKILL.md hashes |
| `remove` | Project, user or remote-cache skills only |
| `doctor` | Scans skill directories |

### plugins

| Verb | Does |
| --- | --- |
| `list`, `search` | Installed plugins; configured marketplaces |
| `install` | Declarative plugin from npm, git or a path; a manifest that names code is refused |
| `uninstall`, `update` | Remove; re-install from npm |
| `enable`, `disable`, `reload` | `reload` re-reads manifest and files |
| `inspect` | What a plugin may contain, what is refused, each entry's exposure tier |

### channels

| Verb | Does |
| --- | --- |
| `list` | Enable and configuration status per platform |
| `setup` | Wizard: pick a channel, log in (QR or token), bind an agent |
| `accounts` | Bot accounts: `list`, `add`, `rm`, `login`, `set`, `group-users` |
| `bindings` | Routes inbound messages to agents |
| `access` | `list`, `approve <code>`, `allow <user_id>`, `revoke <user_id>`. Unknown senders follow pairing; `allow` adds a known user directly. See [Chat Channels](https://fzkuji.github.io/OpenProgram/docs/integrations/channels.html#who-can-talk-to-your-bot). |

### memory

One workspace per instance, shared by every agent and conversation, including channels.

| Verb | Does |
| --- | --- |
| `status` | Contents, revision, writer health, pending turns |
| `recall QUERY...` | Prints matching paragraphs |
| `show PATH`, `edit PATH` | One file; `edit` uses `$EDITOR` and lands only if valid |
| `sleep` | Reorganises topic files now. `--model MODEL`. |
| `export` | tar+gzip the directory. `--out PATH`, default `./openprogram-memory-<date>.tar.gz`. |

### Recovery of content

| Command | Does |
| --- | --- |
| `trash` | `list`, `restore`: recoverable local deletions, no overwriting |
| `backup` | `create`, `list`, `restore`, `prune`: tar.gz snapshots in `<state>/backups/` |

## Execution

| Command | Does |
| --- | --- |
| `execution` | `pause`, `continue`, `step`, `steer`, `cancel`, `fork`, `retry`, `wait-answer`, `wait-decline` |
| `jobs` | `list`, `get`: job resource views |
| `transcript` | Rebuilds a `--print` run's transcript from its stored state, as `--transcript-file` writes it, for a run killed before it wrote one. `--state DIR`, `--session ID`, `--output PATH` |
| `scheduler-worker` (`cron-worker`) | Foreground loop for one-time, recurring and monitor tasks. A failed daemon tick logs a warning and traceback to stderr, then evaluation continues at the next minute without replaying a failed initial `@reboot` tick. `--once` runs one tick and propagates failures; `--list` shows match state. |

## Maintenance

| Command | Does |
| --- | --- |
| `doctor` | End-to-end health check. `--json`, `--repair`, `credentials`. |
| `rescue` | Diagnoses problems, prints fix commands |
| `diagnostics` | Redacted support zip. `--output PATH`, default `./openprogram-diagnostics-<date>.zip`. See [Diagnostics bundle](https://fzkuji.github.io/OpenProgram/docs/reference/diagnostics.html). |
| `logs` | `list`; `tail [name]` with `-n`, `-f`; `path [name]`. Names: worker (default), runtime, ink. |
| `self-update` | `status`, `repair`: inspects or recovers an in-chat App update. See [Upgrade](https://fzkuji.github.io/OpenProgram/docs/install/upgrade.html#conversational-self-update). |
| `dev` | `status`, `deploy`, `open`, `copy-models`, `auth-url`. See [Upgrade](https://fzkuji.github.io/OpenProgram/docs/install/upgrade.html#development-checkout). |
| `update` | Leftover that currently raises `ImportError`. Use `upgrade`. |
