mBm TUI (mbm2)
Menu

Custom Agents

You want to Do
Have the model write an agent for you mbm2 agent create (Managing mbm2)
Write one by hand for this project Create .mbm/agents/<name>.md
Make a role and its worker in the interface /worker → Add a role…: a name and one line of duty write .mbm/agents/<name>.md and a worker tab on it (Workers)
Have one written for a team role mbm2 team setup <team>/<role> writes .mbm/agents/<role>.md from the role's card, never over an existing one (The team store); in a role folder /worker → Create 's agent from the card does the same
Write one for every project Create ~/.config/mbm/agents/<name>.md
Change a built-in agent Add an entry with its name (build, plan, …); your fields replace its own
Turn a built-in off disable: true in an entry with its name
See what the runtime loaded mbm2 agent list, or tab / <leader>a in the interface

The runtime reads the files at start and again when one changes (the next message uses the new version; no restart). GET /agent, the tab cycle, <leader>a and @ show exactly the agents the runtime can run.

The File

The file name (without .md) is the agent's name; a file under a sub-folder is named with it, so .mbm/agents/team/pm.md is team/pm. The front matter holds the settings, the body is the agent's system prompt. .mbm/agent/ works too.

---
description: Plans the work, splits it into tasks and checks the results
mode: primary
model: deepseek/deepseek-flash
permission:
  edit: deny
  bash:
    "*": ask
    "git status*": allow
    "./manage.sh test*": allow
---
You are the project manager. Read the task board, split the request into tasks small enough for
one person, hand coding to @coder and reviews to @reviewer, and never edit files yourself.

Fields

Field Values Effect
description text When to use the agent; task shows it to the model choosing a subagent
mode primary, subagent, all (default) primary: a session's agent (tab); subagent: only through task or @; all: both
model provider/model The agent's model when you have not picked one for the message
variant text The model variant (/variants names it, such as high) used when the agent runs on its own model and you chose none; it is sent as the provider's reasoning effort
temperature, top_p number Sent to the provider with each request (temperature only to a model that takes one)
options object, such as { "reasoningEffort": "high" } Sent with each request of the agent, over the model's own options and under the variant you pick; reasoningEffort is written reasoning_effort, other keys as you spell them. Any field this table does not list goes into options too, so reasoningEffort: high in the front matter works
steps whole number > 0 After this many model steps in one reply the agent is told to stop using tools and summarise (maxSteps is the old name)
permission as the top-level permission Merged over the defaults and your global rules, last, so the agent's own rule wins
tools { "<tool>": true/false } Old form of permission: false denies the tool, true allows it (write and patch mean edit)
hidden true / false Keeps the agent out of @ and the agent list; it still runs when named
disable true Removes the agent, a built-in one too
color #RRGGBB or primary, secondary, accent, success, warning, error, info The agent's colour in the interface
prompt text The system prompt, when you write the agent in mbm.json (a markdown body sets it)
auto_correct { "enabled": true, "max_iterations": 3, "confirm": "ask", "triggers": ["bash", "write", "edit", "apply_patch", "lint"] } The auto-correct loop: after each step, a finished call of a trigger tool whose output shows errors (a non-zero exit code, error:, FAIL, a stack trace, a compiler message, …) makes the next step's system prompt list those errors and ask the agent to fix them, up to max_iterations times per reply. With confirm ask (the default) the first attempt of a reply asks the auto_correct permission; rejecting it ends the reply. never and always do not ask (as in v1). verify_command is accepted and not run

Role fields

An agent that is a member of a team can say what it is, who it reports to, which model backs it up and what it may not do. Each field is optional and works in .mbm/agents/<name>.md, in a mbm.json agent and in a team role's .mbm2/team/roles/<role>.agent.md.

Field Values Effect
role_type pm, architect, frontend, backend, worker, reviewer, or any text What the member is. Shown beside the agent in /worker and by mbm2 team roles (role_type=reviewer), and told to the agent (Your role type: reviewer.). A reviewer is the role whose pass a review_gate waits for
model_primary provider/model Another name for model. Setting both to different models is an error: the agent is left out and mbm2 agent list or the startup notice names model_primary (in a team file: model and model_primary name different models; set one of them)
model_fallback provider/model Takes over when the agent's own model cannot answer: its provider is not connected, or the request is refused before any text arrives (a bad key, a model that does not exist, a quota or rate limit, or a server error once the retries are spent). The step is sent once to the fallback and a notice says model X failed (reason); using fallback Y. The next message tries the main model again; the fallback never replaces a model you chose with /model, and it is never used after text has started streaming. When the TUI already knows the main model is missing (its provider is not in the list), the prompt shows the fallback as the agent's model and the warning says using its fallback provider/model
handoff_to list of role names Who this member's reports go to; the agent is told hand reports to: a, b. It is stored and shown to the agent; mbm2 does not route anything by it yet
review_gate true / false The lead may not accept this member's work (merge_task, or update_task to done) until a reviewer has passed it (Agent teams)
read_only true / false The member cannot edit or write files, its shell runs only read-only commands (ls, cat, grep, git status, …), and it calls no MCP tool but the team bus. A project's bash: allow or edit: allow does not widen it
budget unlimited (the default), or {tokens_per_day: 400000, usd_per_day: 5} (either or both) The most this member may spend in a local day: tokens (input, output, reasoning and cache, with its titles, recaps and suggestions) and USD at the catalogue's prices. At the limit its next turn waits for the next day or a higher limit (Cost limits). mbm2 team budget writes it
---
description: Checks finished work against the PRD and the architecture
role_type: reviewer
model_primary: deepseek/deepseek-reasoner
model_fallback: openai/gpt-5-mini
handoff_to: [architect, backend]
read_only: true
---
You review. Read the task's report and branch, run the tests, and record your verdict with review_pass.

A builder that must be reviewed before the lead accepts it:

---
description: Builds the API
role_type: backend
model_fallback: deepseek/deepseek-flash
review_gate: true
---
You build the API. Report with report_back when the tests pass.

Rules are applied in this order, the last match winning: the runtime's defaults, the built-in agent's own rules (for build, safe, plan, …), your top-level permission and tools, then the agent's permission and tools. In the example edit: deny holds even when your top-level permission allows edit; git status --short runs without asking, rm -rf build asks.

Permissions Belong In The Project

Because the agent's own rules come last, an agent file's bash: ask (or "*": "ask") asks for every command whatever the project's mbm.json allows, and Allow always → This project cannot keep a command for it: the runtime refuses and names the agent's file (The agent's own rule asks). Keep the two apart:

Where Holds Example
The project's .mbm/mbm.json The bash policy every agent shares: what asks, what runs, what is refused "bash": {"*": "ask", "git status*": "allow", "npm test*": "allow"}
The agent's file Only the role's limits, written as narrowly as the role needs edit: deny for a planner or a reviewer; "git push*": "deny" for a coder
---
description: Reviews a branch and reports what is wrong
mode: subagent
permission:
  edit: deny
---
You review. You never change files.

With the bash policy in the project, This project (permanent) keeps a command for every agent at once. When an agent does hold its own bash rule, This agent (permanent) writes the allow into that agent's file instead.

The model a message runs on is the one you picked for it, else the agent's model, else the session's last model, else the configured model, else your recent pick.

The Same In mbm.json

{
  "agent": {
    "coder": {
      "description": "Writes and fixes code for one task at a time",
      "mode": "subagent",
      "model": "deepseek/deepseek-flash",
      "temperature": 0.2,
      "prompt": "You are a careful programmer. Make the smallest change that does the task, run the tests, report what changed.",
      "permission": { "bash": { "*": "ask", "go test*": "allow" } }
    },
    "reviewer": {
      "description": "Reviews a change for bugs and missing tests",
      "mode": "all",
      "steps": 20,
      "permission": { "edit": "deny" },
      "prompt": "You review diffs. List real problems with file:line, then say whether the change can be merged."
    },
    "docs": { "disable": true }
  }
}

With pm above as the session's agent, the model can hand work to coder and reviewer through task (both are listed to it with their descriptions); pm itself is never offered as a subagent. You can also start one yourself: @reviewer look at the last commit. In a team a lead's new:pm worker starts a session on pm.

When A File Is Wrong

A file the runtime cannot load is skipped; the others still load and the runtime starts. The runtime log names it (agent not loaded) at start and whenever the set of such files changes, and the TUI shows it as an error toast: a problem found at start when it connects, a change while you work as it happens.

What you see Cause and fix
Toast Failed to parse agent <file>: entry: parse_failed The front matter is not valid YAML; check quotes and indentation
Toast Failed to parse agent <file>: mode: schema_invalid A field has a value the schema refuses (here mode); see the table above
… agent <name>: invalid_model model is not provider/model
… agent <name>: invalid_permission permission could not be compiled (an action other than allow, ask, deny is already schema_invalid)
The agent you just broke still behaves as before A file that worked keeps its last good version until you fix it
Toast Failed to parse agent <mbm.json>: default agent "<name>" not found default_agent names no agent (or is a subagent, is hidden); sessions start on the first primary agent
Toast Agents not loaded, the previous agents are kept: <code> The agents could not be read at all (for example a reference path with *); the built-ins, or the agents loaded before, keep running
Agent not found: "<name>". Available agents: … No agent of that name is loaded (a typo, disable: true, or a file that failed)

Published from revision f88fc66f 2026-11-30