CLI Commands
botmux commands come in two kinds:
- Operator commands: you run them in a server terminal to manage the daemon (the background process), bots, and sessions.
- In-session commands: the AI calls them inside a session to send messages, read history, create scheduled tasks, and so on. You usually don't type these yourself.
If you forget an option, run botmux --help for an overview, or botmux <subcommand> --help for the full options of one command.
Most-used commands
Configure bots
Interactive setup
Opens an interactive UI to configure for the first time, or add, edit, or delete bots. By default it signs in with a Lark QR scan and creates the app, grants permissions, sets the redirect, and publishes a version for you. Add --no-open-platform-auto to skip the automatic Open Platform setup.
Scripted setup (no interactive UI)
Good for scripts or for letting an AI do it:
--allowed-users is the bot owner. When creating a new app, use a full email, phone number, or a union_id starting with on_, not an open_id starting with ou_: an open_id is valid only in the Lark app that issued it, and the new app doesn't exist yet, so it can't have a valid open_id. See botmux setup help for every field.
Clone a bot
Creates a new Lark app and copies the source bot's behavior settings. Without a name, it is named "source-name-copy-timestamp".
Export a shareable preset
Exports a bot's CLI, model, role, and capability tag as JSON, with setup guidance included. Send it to a teammate and their AI can set up a matching bot from it.
<bot>is the process name (botmux-xxx) or AppID.- The team-level role is exported by default; add
--from-chat <chatId>to export the role content of one group instead (the group ID itself is not written to the file). - By default it writes
<name>.botmux-preset.jsonin the current directory;--out -prints to stdout. - Before exporting, it shows you the role content to confirm. In non-interactive environments (for example when an AI runs it), add
--yes. - The file contains no secrets: AppID, Secret,
allowedUsers, working directory, and similar fields are never exported.
Switch the UI language
Switching languages in the setup wizard
While running botmux setup, press L on the first step's selection menu (with the search box empty) and the UI switches between Chinese and English right away; the choice is also saved as this machine's global language. In the simple numbered-input mode, typing L and Enter does the same.
You can also pick the language at launch: botmux setup --lang en (or zh), which is saved as the global language too. To change the UI language later, use botmux lang above.
Start and stop the daemon
start-bot / stop-bot accept --json for machine-readable output, handy in scripts. botmux setup add and Dashboard bot creation use start-bot to bring a new bot online.
Common botmux logs options:
--lines N: show the last N lines.--bot <index|name|AppID>: show one bot only (index starts at 0).--no-follow: print and exit instead of following.
start / restart also accept --companion-secret-file <absolute path> --companion-bot <appId>. Passing both enables a closed local API for one isolated test bot; see Local Companion API.
Upgrade
When it finishes, run botmux restart as prompted to load the new version. If you run botmux from a source checkout, upgrade does git pull + rebuild + restart instead. On releases older than v3.18.0, upgrade with the curl install script instead; see FAQ · How do I upgrade?.
Manage sessions
View sessions: botmux list
Keys in the interactive list:
list also cleans up dead sessions: adopt sessions whose external process has exited, and throwaway sessions that never actually launched a CLI. A regular session is kept even if its CLI process exits; the next message picks it up again.
Close, resume, suspend
Every suspend form accepts --dry-run to preview which sessions would be affected.
delete has the same effect as sending /close in Lark. When the daemon is online, it does the cleanup; if the daemon refuses or can't be reached, the command fails instead of killing processes locally. Local cleanup happens only once the daemon is confirmed offline.
Suspend long-idle sessions in bulk
--older-thanis the last-activity threshold, inms/s/m/h/d/w; default7d.--dry-runonly lists candidates (session, bot, title, last activity, processes to be stopped) and changes nothing. Running for real requires an explicit--yes.--bot <appId>limits it to one bot;--jsongives machine-readable output.- Suspended sessions are kept; the next message cold-starts them from history.
- Only sessions that are clearly idle and resumable are picked. Sessions that are replying, have queued messages, are waiting on you, are locked, or were attached via adopt are skipped.
To run this periodically, turn on "Idle auto-suspend" in the bot settings in the Dashboard. This command is for manual previews and one-off batches.
Get an operable terminal link
Gets a writable Web terminal for a session. The link isn't printed in the terminal; the daemon sends it to the bot owner as a private card (only you can see it in a group; in topics or direct chats it falls back to a direct message). You can omit id when there's only one active session. See Web Terminal.
Post a message from a host shell
CI jobs, alerting systems, and external agents can use botmux post to deliver text they already have. Select a running bot by App ID and provide a destination. The command needs no session ID and starts no AI session.
Run the command in a trusted host shell with access to the local Botmux daemon. The bot must already be in the group. For a topic, supply its group ID and root message ID (om_…). For a direct message, use the recipient's open_id in the sending bot's app scope. Lark must allow that bot to reach the recipient. Use --text or --text-file for up to 8192 UTF-8 bytes.
--bot accepts a Feishu App ID starting with cli_. CI and alerting systems should pass a stable event ID with --request-id (8–64 letters, digits, underscores or hyphens). The CLI generates an ID when omitted. A successful JSON receipt on stdout includes requestId, messageId, replayed, the bot and the destination. Group posts share deduplication records with the request-bound group API.
Invalid arguments exit with status 2. Delivery errors exit with status 1 and a JSON error on stderr. A timeout, interrupted connection or unverifiable receipt returns outcome_unknown; the message may already be visible. When retryable is true, retry within 50 minutes of the first attempt using the same bot, destination, text and request ID. An unresolved attempt past that window returns retryable: false and needs manual verification. Reusing the ID with different text returns request_conflict. While a definite first rejection is retained, retrying the original text replays that send_failed. Use a new request ID for corrected text. Completed requests replay the original message ID for as long as their record is retained in the bounded archive.
Dashboard login link
See Dashboard for what it can do.
Start on boot
Keep in mind:
- On Linux servers, logging out stops the service. To keep it running, run
sudo loginctl enable-linger <username>once. - The entry records the current Node (or single-file binary) path. After switching Node versions with nvm / fnm, run
enableagain;start/restartalso detect and refresh it automatically. enable/disableonly manage start-on-boot; they never start or stop the running daemon.- On Linux,
enablealso turns onbotmux-watchdog.timer: it checks every 30 seconds and brings the daemon back if it dies unexpectedly;disableturns it off too. After you runbotmux stopon purpose, the watchdog won't bring it back; normal watching resumes on the nextstart/restart.botmux autostart statusshows whether the watchdog is enabled.
In-session commands (for the AI)
When run inside a botmux session, these commands detect the current session and group automatically, so no extra options are needed. The AI calls them as needed; it's enough for you to know what's available.
Messages and cards
Sessions and groups
botmux slash rejects everything by default. First set tuiSlashAllow for the bot in bots.json, listing the command names allowed, for example ["/compact"] (case-insensitive; the leading / is optional). Also:
- Only single-line commands starting with
/are accepted; arguments may follow, and the command name is matched against the list. /cdis always rejected, even if listed: it changes the session directory the daemon tracks, so it must go through a dedicated command.- The command is queued until the CLI is idle; if the CLI process restarts before then, the command is dropped.
Lark authorization
Agent-initiated authorization
Nothing to set up on the user's side. When the AI calls a Lark API with lark-cli --as user in a session and finds your authorization missing, it runs botmux auth request itself (asking for all the scopes it needs in one --scope) and sends the link to the person who sent this turn:
- in a direct chat, the AI replies with the link;
- in a group, botmux sends the link to you in a private message, never into the group.
After you authorize, the AI waits for it with botmux auth wait in the same turn (up to 5 minutes) and retries the original action. If the turn has already ended, that's fine: authorize while the link is valid, then send another message to continue. You can also skip the wait and send /login (or /login --scope <scope>) in the topic yourself.
Prerequisite: this bot's lark-cli goes through botmux's app binding (larkToolBinding, on by default), or the bot has Run CLI calls as the message sender on with lark-cli covered. With both off, the daemon refuses with lark_user_auth_disabled. The link only goes to the verified human of the current turn; the AI cannot request it on someone else's behalf.
Read-only queries
These commands only read state; they change nothing.
Advanced features (each has its own page)
For how the AI discovers and uses these commands, see Skill + CLI.
Create a group that starts working, or a topic group
botmux create-group runs from a host terminal or inside a session; there is no switch to turn on:
--bot: at least one, repeatable. Prefer the bot's display name or full AppID. The first one is the creator.--chat-mode topic: create a topic group (each top-level message is its own topic);groupor leaving it out makes a regular group. The group type can only be chosen at creation and cannot be changed later.--kickoff-bot+--kickoff-prompt: once the group exists, the creator @mentions that bot with this prompt so it starts working right away (for example, a PR review). Give both together.--kickoff-botis that bot's open_id (look it up withbotmux bots listin a session); it must be in the--botlist and cannot be the first one.--working-dir <path>: binds the new group to this directory for every bot that joined, so new topics skip the repo picker.--json-status: prints a structured status line after the chatId. With or without it, the command exits non-zero when a requested kickoff wasn't sent.
See botmux create-group --help for every flag, including cross-machine team groups (--team / --agent).
Other configuration commands
Advanced: multi-replica deployments (primary mode)
Single-machine deployments can skip this section.
With BOTMUX_COORDINATION_MODE=primary, session state lives in PostgreSQL and is shared across machines (replicas). In this mode:
- Local
delete,resume,suspend(except--dry-run),maintenance suspend-idle, and delete / resume insidelistare refused. Close or resume from the session card in the original topic, so the action goes through the shared session-control channel. liststill works, but only displays sessions and never cleans up local ones.
A session runs only on the replica that owns it, while Lark callbacks and browser requests may land on any replica:
- "Show / Hide output" button: applied by the owning replica, which updates the original card. It takes effect only for people allowed to operate the session; clicking an old card or lacking permission shows a hint to use the latest card.
- Web terminal across replicas: a request that lands on another replica is forwarded one hop to the owner. Configure:
BOTMUX_TERMINAL_ROUTE_HOST: the IP other replicas can reach this one at (e.g. the Pod IP); must be an IP. If unset, this replica doesn't take part in forwarding.BOTMUX_TERMINAL_ROUTE_PORT: the port other replicas use for this Dashboard (e.g. a NodePort); defaults toBOTMUX_DASHBOARD_PORT.- Cookies, Authorization, and other login credentials are never forwarded.
- What works across replicas: only terminal links in Lark cards, which carry their own credential. The terminal embedded in the Dashboard, the touch-screen dynamic link, and takeover with write access must reach the owning replica directly (e.g. session-sticky load balancing); otherwise they return 403.
- Deployments without primary mode are unaffected.
Evidence retrieval: index first, then selected details
The default full history and single-message quoted JSON remain compatible. Index mode avoids card/forward expansion and returns previews of up to 240 characters plus resource counts. --no-download preserves resource metadata without downloading attachment bytes. Batch quoted accepts up to 20 IDs, deduplicates them, preserves successful input order, and returns messages/errors; partial failure exits with code 1 while retaining successful results.
Filters apply only within the fetched --limit window. --since is inclusive and --until exclusive; use ISO timestamps with a timezone. The retrieval block reports counts, filters, deferred details and detail failures. An index candidate marked queryMatch=deferred requires a detail read to verify the keyword. Index mode cannot be combined with --with-card-json. Message requests are coalesced only within one invocation, separately by app and representation; the next invocation reads afresh. Both commands support --help.
Worker Memory Protection
botmux worker-budget status shows available memory, the reserve, the memory PSI limit, and whether worker startup is allowed. Background recovery failures are logged and batched into a DM to the bot owner. A rejected current request receives only a brief unavailable status in its conversation.
Owner DMs are batched per bot over 2 seconds and count distinct affected sessions. Each bot/owner pair attempts at most one DM every 5 minutes, with a cooldown that survives daemon restarts. Failed sends also enter cooldown; a later rejection can trigger another attempt after it expires. An unresolved owner is logged. If the cooldown cannot be persisted, deduplication falls back to the current process. These notifications are independent of the optional Dashboard host overload monitor.
Background Recovery Diagnostics
Process-start and DNS/runtime preparation failures during background recovery are batched into a DM to the bot's current owner. A current request receives only a brief unavailable status. Pi installation changes also notify the owner while retaining suspension after the current task settles and cold-starting on the new version for the next input. Startup, installation and memory alerts have independent 2-second batching windows and 5-minute cooldowns.
Mojo lineage-quarantine and legacy-configuration notices remain pending through blank recovery and owner-only historical input replay. They are delivered only after a nonempty input with an explicit turn is accepted. A rejected input or failed notice delivery keeps the pending marker for a later input. Silent tasks, meeting receivers and sessions without an IM transport retain their existing output restrictions.
