# CLI and TUI

`openprogram` runs the same agent as the desktop app and Web UI. Other capabilities have subcommands named by one rule, so a new command can be guessed from known ones.

| One of each | How |
| --- | --- |
| Backend | A long-lived Python worker serves every front end on one port. The Ink terminal UI (`apps/cli/`), launched by `openprogram/interfaces/cli/ink.py`, finds it through `worker.pid` and `worker.port` and talks WebSocket, so a terminal chat is the session the Web UI shows. |
| Settings schema | Each setting is declared once; `openprogram config`, the TUI panel and the Web UI use it. Every `config.json` write goes through one atomic, locked entry point. |
| Slash-command registry | Built-ins, plugin commands, MCP prompts and skills merge into one format, so `/` lists the same in the TUI and Web composer. |

In the terminal, tool calls fold into one line, `ctrl+o` opens the transcript, edits render as diffs, and input during a run is queued.

| Document | Covers |
| --- | --- |
| [naming](https://fzkuji.github.io/OpenProgram/docs/reference/design/cli/naming.html) | The naming rule for subcommands |
| [redesign](https://fzkuji.github.io/OpenProgram/docs/reference/design/cli/redesign.html) | Command grammar, settings schema, TUI panel, transport |
| [config-write-safety](https://fzkuji.github.io/OpenProgram/docs/reference/design/cli/config-write-safety.html) | The atomic entry point for `config.json` |
| [headless-print](https://fzkuji.github.io/OpenProgram/docs/reference/design/cli/headless-print.html) | `--print` runs: the shared turn request, accounting by execution tree, how a run ended |
| [drop-run-command](https://fzkuji.github.io/OpenProgram/docs/reference/design/cli/drop-run-command.html) | One execution path for `Agent` methods, user- or model-run |
| [single-port](https://fzkuji.github.io/OpenProgram/docs/reference/design/cli/single-port.html) | One process, one port, the Python worker as only origin |
| [ports](https://fzkuji.github.io/OpenProgram/docs/reference/design/cli/ports.html) | Choosing, configuring and defending the Web UI port |
| [slash-commands](https://fzkuji.github.io/OpenProgram/docs/reference/design/cli/slash-commands.html) | The unified registry |
| [slash-commands-references](https://fzkuji.github.io/OpenProgram/docs/reference/design/cli/slash-commands-references.html) | How five other projects do it |
| [tui-upgrade](https://fzkuji.github.io/OpenProgram/docs/reference/design/cli/tui-upgrade.html) | Folding, `ctrl+o` transcript, diffs, queued input, keybindings |
