Mirasim Documentation

Chapter 20

CLI, TUI and ui-cli

Run agents from the terminal, drive the app from scripts, and read or apply settings as one JSON tree.

The mirasim command

The mirasim command launches Claude Code and Codex, manages accounts and routing, runs the server, and runs diagnostics. It comes with the desktop app: once Mirasim has started on a computer, it is at ~/.mirasim/bin/mirasim. mirasim claude and mirasim codex open each agent's own terminal UI.

Everyday commands
~/.mirasim/bin/mirasim doctor                        # check the install and its environment
~/.mirasim/bin/mirasim claude                        # Claude Code
~/.mirasim/bin/mirasim codex                         # Codex
~/.mirasim/bin/mirasim agents                        # installed versions and updates
~/.mirasim/bin/mirasim ssh ubuntu@dev.example.com    # connect to a server over SSH
~/.mirasim/bin/mirasim ui-cli help                   # the whole control surface

The other commands are below. mirasim help prints the full list.

The full command surface
CommandWhat it does
login [github|email]Sign in — third-party OAuth or an email code. Stores a token.
logoutForget the stored login token.
agentsWhat 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 [mode|key]Show the current route and the platform's health. mode local|cloud switches between your own accounts and platform credits; key pastes a platform key by hand.
statusline [set]Show the running agent's live route; set adds your own text to that line.
doctorDiagnose the install, the configuration and recording.
serveRun the server: web workbench and pairing. Default port 4939; --host 127.0.0.1 binds loopback only.
ui-cli <cmd> [flags]Drive the UI over its server protocol, for agents and scripts. --port N attaches to a running serve, otherwise it spawns one.
chat <cmd>Read and post in this space's chat from the terminal, without the app running.
publish <verb>Publish this space's work to people outside it: init, check, preview, submit, status. Needs the app running.
ssh <user@host> [list|stop|uninstall]Connect to a Linux or macOS server over SSH, and manage the saved ones.
checks [session]Run deterministic checks over a recorded session.
evalBrowse local eval-skill simulation records: the run list, and per-case traces with screenshots. Default port 4960.
version · helpVersion, and the authoritative command list.

The current route shows in Claude's status line and in Codex's terminal title. Your own status line is kept, and you or other tools can add a segment to it.

Add your own status segment
mirasim statusline set deploy "staging ✓"

ui-cli: the app, scriptable

ui-cli drives a running Mirasim from the command line. What you can do in the app is available as a command, and the effect shows up live in the open window. Each call prints one JSON object, for use from scripts and agents.

Choosing an instance
FlagWhat it drives
--port 4970The installed desktop app's server — the usual choice.
(no --port)A private throwaway server, just for this command.
--shell desktop | mobileWhich app answers the shell operations — the desktop window, or the paired phone.
Read state, run real work, drive the window
# 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.png

Settings as one declarative tree

Every saved setting forms a single JSON tree: the default agent, per-agent model, effort and access mode, the routing mode (your own accounts or platform credits), browser and screen automation toggles, display sleep, agent auto-update, the working directory and registered workspaces. You can read the whole tree, set individual dot-paths, or apply a desired tree in one go.

Read, set, and apply
mirasim ui-cli --port 4970 config get

mirasim ui-cli --port 4970 config set \
  defaultAgent=codex relay.mode=cloud

# 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 changes only the fields that differ from the live values, takes effect immediately, and is safe to run again. The reply lists each changed field with its before and after. The platform key, account tokens and provider keys are not in the tree; set them with their own commands.

When a command does not exist yet

raw sends a protocol frame as-is and prints the responses. Use it for an operation that has no command of its own yet.

Send a raw frame
mirasim ui-cli --port 4970 raw '{"type":"…"}' --await someReplyType --seconds 5

Something wrong or missing on this page? Tell us