CLI, TUI and ui-cli
Run agents from the terminal, drive the whole app headlessly, and keep every setting in one reviewable tree.
The mirasim command#
The standalone archive gives you the built-in agent, transparent Claude and Codex launches, host control, accounts and diagnostics. The `claude` and `codex` commands preserve each agent's own terminal UI and its own authentication — Mirasim changes exactly one thing about them: where their model traffic goes.
./mirasim doctor # check the install and its environment
./mirasim # Mirasim's built-in agent
./mirasim -p "inspect this repository" # built-in agent, one-shot
./mirasim claude # Claude Code, explicit
./mirasim codex # Codex, explicit
./mirasim agents # installed versions and updates
./mirasim ssh ubuntu@dev.example.com # drive a Linux machine over SSH
./mirasim ui-cli help # the whole control surface`mirasim help` prints the authoritative list. The rest of it, grouped by what you would be doing:
| Command | What it does |
|---|---|
| login [github|email] | Sign in — third-party OAuth or an email code. Stores a token. |
| logout | Forget the stored login token. |
| agents | What is installed, each version, and whether an update is available. |
| update [agent] | Update an agent through whichever channel installed it. |
| accounts [add|use|remove] | List subscription accounts and switch which one an agent launches under. |
| relay [on|off|threshold|always|key] | The quota fallback: its status and health, the master switch, the usage threshold that engages it, proxy-everything, and the key. |
| statusline [set] | The running agent's live route status, and a seam for injecting your own text into it. |
| doctor | Diagnose the install, the configuration and recording. |
| recordings | List captured sessions and whether each one's changes were kept or reverted. |
| serve | Run the host: workbench, IM channels and pairing. Default port 4939; --host 127.0.0.1 binds loopback only. |
| web | A minimal browser chat page, with every message recorded. |
| ssh <user@host> [list|stop|uninstall] | Drive a remote Linux host over SSH, and manage the saved ones. |
| checks [session] | Run deterministic checks over a recorded session — part of evaluation. |
| export [session] | Decode a recorded session and upload it. Turn the background version off with MIRASIM_EXPORT=0. |
| collect [setup|record|selftest|doctor] | Screen-trace collector for evaluation, macOS only. Keystroke content and input text are never written to disk, and traces stay on the machine. |
| version · help | Version, and the authoritative command list. |
Because an agent's TUI paints over the terminal, a launch banner would be invisible within a second. Mirasim therefore publishes its live state into a slot the agent itself renders — Claude's status line, Codex's terminal title — so a mid-session switch to the quota fallback is visible where you are already looking. Your own status line is chained rather than replaced, and external tools can add a segment of their own.
mirasim statusline set deploy "staging ✓"ui-cli: the app, scriptable#
`ui-cli` is the scriptable twin of the graphical workbench. Every command speaks the exact frames the desktop, mobile and editor surfaces speak, against the same server a window is connected to — so anything a UI can do is one command here, and its effect shows up live in that window. It prints one JSON object per invocation, which is what makes it usable from scripts and from agents.
The `--port` flag picks which Mirasim you are driving. Without it, the command spins up a private throwaway server for itself.
| Flag | What it drives |
|---|---|
| --port 4970 | The installed desktop app's server — the usual choice. |
| --port 4950 | A development desktop instance's server. |
| (no --port) | A private throwaway server, just for this command. |
| --shell desktop | mobile | Which app answers the shell operations — the desktop window, or the paired phone. |
# read-only facts, safe any time
mirasim ui-cli --port 4970 state
mirasim ui-cli --port 4970 sessions --limit 20
mirasim ui-cli --port 4970 workspaces
# start a real run — identical to typing it in the UI
mirasim ui-cli --port 4970 prompt --agent claude \
--cwd ~/code/proj --text "summarize this repository"
# drive and observe the actual window
mirasim ui-cli --port 4970 navigate --to settings
mirasim ui-cli --port 4970 ui settings.open --value traffic
mirasim ui-cli --port 4970 dom
mirasim ui-cli --port 4970 click --text "By model"
mirasim ui-cli --port 4970 screenshot --out shot.pngSettings as one declarative tree#
Every persisted setting forms a single JSON tree — the default agent, per-agent model, effort and access mode, relay behavior and thresholds, browser and screen automation toggles, display sleep, agent auto-update, the working directory, registered workspaces, IM credentials. You can read the whole thing, set individual dot-paths, or converge a machine onto a desired tree.
mirasim ui-cli --port 4970 config get
mirasim ui-cli --port 4970 config set \
defaultAgent=codex relay.enabled=true relay.threshold=0.8
# see exactly what would change, then apply only that
mirasim ui-cli --port 4970 config apply --file desired.json --dry-run
mirasim ui-cli --port 4970 config apply --file desired.json`config apply` diffs your desired tree against the live values and applies only the fields that differ, each through the same setter the Settings UI uses — hot, and idempotent. The reply lists every field it touched with its before and after. Secrets are deliberately not part of the tree: relay keys, account tokens and provider keys go through their own commands.
When a command does not exist yet#
`raw` posts any protocol frame verbatim and prints the responses, which means the CLI's coverage is never the limit — the protocol is. It is the escape hatch for the rare case where the app can do something the command catalog has not named yet.
mirasim ui-cli --port 4970 raw '{"type":"…"}' --await someReplyType --seconds 5Something wrong or missing on this page? Tell us