mBm TUI (mbm2)
Menu

Use The Terminal

Key In the terminal list While attached
n Create a terminal Sent to the shell
return Attach to the selected terminal Sent to the shell
up / down Move the selection Sent to the shell
r Refresh the list Sent to the shell
ctrl+] Back to the session Detach; the terminal keeps running
ctrl+\ — Close: the terminal is removed on the server
esc Back to the session Sent to the shell; once the shell has exited, back to the list

The terminal is a shell running on the runtime host as a server PTY. mbm2 shows its screen and sends your keys. In local mode that host is your machine; with --attach it is the remote server (Connect).

Open A Terminal

  1. Open a session (the command is offered on the session screen, not on home).

  2. Press ctrl+p, type term, and choose Open terminals.

  3. The list screen opens:

    Terminals  n new  enter attach  ctrl+] detach  ctrl+\ close  esc back
    
  4. Press n. A terminal starts in the session's directory with the first shell the runtime marks as acceptable, and is listed as title id status.

  5. Select it and press return. The screen shows Attached: <title> <status> and the shell below. Type as in any shell.

Open A Terminal Tab At Once

/terminal (or its short alias /cli) opens a terminal in its own tab straight away, from the main tab or any worker tab, and focuses it. It is also in the palette as Open a terminal tab.

You type Tab Runs
/terminal terminal Your shell ($SHELL on the runtime host) in the project directory
/terminal npm run dev terminal-2 (the next free name) npm with the arguments run dev, in the project directory
/cli go test './...' terminal-3 go test ./...; quotes group words and are removed
/terminal sh -c 'go test ./... | tee test.log' the next free name A pipe needs a shell: the line itself is not read by one

The tab works like any terminal worker's tab: switch with alt+n or <leader>tab, close it with <leader>shift+w (its terminal is removed on the runtime), and once its process exits esc closes it. It is not saved: it is not written to .mbm/workers.json and does not come back on the next start. For a shell tab you want every time, use /worker → Add shell.

Example: Run The Tests While You Keep Talking

  1. Attach a terminal as above and run go test ./... 2>&1 | tee test.log.
  2. Press ctrl+]. You are back in the conversation; the tests keep running.
  3. Ask the agent read test.log and fix the first failure.
  4. Later: ctrl+p → Open terminals, select the same terminal, return. Its earlier output is replayed from the start, so you see the whole run.
  5. Done with it: attach and press ctrl+\. The terminal is removed on the runtime.

A quicker way to put one command's output in front of the agent is shell mode: ! on an empty prompt (Prompts).

Leave, Return, Close

Goal Do
Go back to the conversation and keep the shell running ctrl+]
Come back to it ctrl+p → Open terminals, select it, return
End it Attach, then ctrl+\

Every key except ctrl+] and ctrl+\ goes to the shell while attached, including ctrl+c, esc and tab.

Terminal Or Terminal Worker?

Terminal (this page) Terminal worker (Workers)
Starts A shell, when you press n; or at once in its own tab with /terminal (not saved) A fixed command from .mbm/workers.json, e.g. claude, npm run dev
Lives in The session screen, behind Open terminals Its own tab with alt+n, the overview and the split
Leave it ctrl+] Switch tabs: <leader>tab, alt+1
Ends when You close it with ctrl+\ You close its tab (<leader>shift+w, or a click on its ×) or mbm2 exits
Renamed with — <leader>shift+r or /worker rename; the process keeps running
Receives hand-offs and team messages No Yes (Teamwork)

Use a worker for anything you run every time you open the project; /worker → Add shell gives you a shell tab in one step.

What To Expect

Behaviour Detail
Resize The terminal follows the mbm2 window size, sent to the runtime after a 100 ms pause
Reattach Attaching replays the runtime's buffer from the start, so earlier output reappears
Dropped connection The client reconnects and replays; the shell keeps running on the server
Large output The client keeps a bounded scrollback and drops the oldest lines first
Escape sequences Drawn as cells with their colours and effects; the program's escape sequences are not forwarded to your own terminal
The shell exits Its last screen stays, with [process exited with status <n> — press esc to close] under it, even though the runtime removes the terminal; esc goes back to the list
Copy text out of it Drag over its screen; releasing copies when copy_on_select is on. Unverified: whether ctrl+c over a selection copies or reaches the shell while attached; use the mouse copy
mbm2 itself stops The shell keeps running on the runtime; after the crash screen's Reset TUI (Troubleshooting) reattach from Open terminals

Colours And Your Prompt

A terminal, a shell tab and a claude tab look as they do in your own terminal: a coloured PS1, ls --color, git diff and the colours of claude itself are drawn with their bold, dim, italic, underline and reverse effects, in 16, 256 or 24-bit colour. Text the program leaves at the default colour takes the theme's background and your terminal's default foreground.

The program sees Value Change it
TERM xterm-256color "env": {"TERM": "..."} on the worker in .mbm/workers.json
COLORTERM truecolor "env": {"COLORTERM": "..."} on the worker
MBM_TERMINAL 1, so a script can tell it runs inside mbm2 —
NO_COLOR, LANG, LC_* As in the environment mbm2 started from Set them before starting mbm2, or in the worker's env
TERM_PROGRAM Not set (your own terminal's name is not passed on) The worker's env

Example: a worker that keeps a 16-colour program on a basic terminal type:

{ "workers": [ { "name": "logs", "kind": "terminal", "command": "tail", "args": ["-f", "app.log"],
  "env": { "TERM": "xterm", "COLORTERM": "" } } ] }

Your shell starts as a login shell (bash -l, zsh -l), as on macOS. zsh reads ~/.zshrc either way. bash reads ~/.bash_profile (or ~/.bash_login, or ~/.profile) and reads ~/.bashrc only when that file sources it. If your prompt is plain in a terminal tab but coloured in your own terminal, add this to ~/.bash_profile (or ~/.profile):

[ -f ~/.bashrc ] && . ~/.bashrc

Your colours are still lowered to what your own terminal shows: a 256-colour terminal shows a 24-bit prompt colour as its nearest 256-colour match.

The Cursor

The cursor of a terminal, a shell tab or a claude tab is your own terminal's cursor, placed where the program put it. A program that changes its shape (vim's bar in insert mode, a steady block) changes it in your terminal too:

The program writes You see
\e[0 q, \e[1 q blinking block
\e[2 q steady block
\e[3 q, \e[4 q blinking, steady underline
\e[5 q, \e[6 q blinking, steady bar
\e[?25l no cursor until it writes \e[?25h (full-screen programs hide it while they draw)

Example: printf '\e[6 q' in a shell tab turns its cursor into a steady bar; printf '\e[0 q' restores the default.

There is no cursor while a dialog, the palette or a toast covers its cell, after the program has exited, or in the pane of a split that is not focused.

If It Fails

Message Cause and fix
Terminal unavailable on this server The runtime refused the terminal (permission, plan-only server or credentials). Check with its operator
Terminal no longer exists It was closed elsewhere or its process exited; create a new one with n
Open terminals is not in the palette You are on home; open a session first
ctrl+c did not leave the terminal It went to the shell, by design; leave with ctrl+]
The prompt is one colour bash runs as a login shell and your ~/.bash_profile does not source ~/.bashrc; see Colours And Your Prompt. Check echo $TERM $COLORTERM prints xterm-256color truecolor and NO_COLOR is unset

Published from revision f88fc66f 2026-11-30