codex Tab
Situation when you type /codex |
What happens |
|---|---|
The project already has a terminal worker that runs codex |
Its tab opens, or gets the focus if it is open |
codex is on PATH, no worker yet |
A codex worker is added to .mbm/workers.json and its tab opens; toast added codex to workers.json |
codex is not on PATH |
Toast "codex is not on PATH: install it with npm i -g @openai/codex"; nothing is written |
A worker named codex runs another command |
Toast a worker named "codex" already runs another command; rename one of them |
/codex runs OpenAI's Codex CLI in a terminal tab of this project and joins it to the team bus exactly
as /claude does: it can list the workers, message main and the others, and use the
shared board (Teamwork). The command is also in the palette as Open a codex tab.
mbm2 never reads, copies or stores Codex's sign-in (a ChatGPT plan or an API key stays in Codex), and
never runs the real CLI except in your tab. Codex also joins a team from outside mbm2 as a peer
(Agent relay); this tab is the in-window way.
Open It
- In the project, type
/codexand pressreturn. - The new tab takes the focus. Answer Codex's own first-run questions (sign-in, trusting the folder) in the tab yourself: team messages are pasted, and an unanswered dialog would swallow them.
- Switch back with
alt+1; the tab is restored on the next start if it was open.
The same tab opens from /worker → Add codex (shown only when codex is on PATH; otherwise the
page lists Add codex (not found) with the install hint), from the palette, or from a workers.json
entry.
What Is Written
{ "workers": [ { "name": "codex", "kind": "terminal", "command": "codex" } ] }
Any terminal worker whose command is codex (or codex.exe, or a path ending in it) gets the same
team wiring, whatever its name. Pass Codex's own flags in args, and a model in model:
{ "name": "codex", "kind": "terminal", "command": "codex", "args": ["--full-auto"], "model": "gpt-5" }
Model Choice
| Where | Effect |
|---|---|
The worker's model |
Passed as -c model="<id>"; the id is Codex's own, not provider/model |
A team role's card whose agent line is codex <model>, or has a Model: line |
The role's tab runs codex -c model="<model>" |
| Neither | The model in ~/.codex/config.toml |
Codex On The Team
With the runtime on this machine, mbm2 appends these arguments for this run only (Codex's -c
overrides ~/.codex/config.toml and writes nothing):
codex -c mcp_servers.mbm2_team.url="http://127.0.0.1:<port>/mcp/worker/codex" \
-c mcp_servers.mbm2_team.bearer_token_env_var="MBM2_TEAM_TOKEN"
| Part | Meaning |
|---|---|
mcp_servers.mbm2_team.url |
The bus's http MCP endpoint for this worker; the name in the path is the tab's name |
bearer_token_env_var and MBM2_TEAM_TOKEN |
The token travels in the tab's environment, not in the argument list that ps shows |
Codex's approval policy and sandbox are left as you configured them: team tools ask like any other
tool until you allow them in Codex. mbm2 adds no tool allow-list for Codex, unlike
Claude.
The Agent relay connects Codex to a team with the same http form (--url and
--bearer-token-env-var), so no stdio bridge is involved: mbm2 has none. If this Codex cannot reach an
http server, the tab cannot join the bus; join the team as a relay peer instead.
Unverified on a real host: that codex-cli 0.158.0 accepts bearer_token_env_var on an http server
given with -c. Check inside the tab with /mcp; mbm2_team should be listed with its tools.
Hand Text To Codex
- In
main, select the paragraph (or nothing for the last reply), press<leader>f, pickcodex. - The text is pasted into Codex's input. Go to the tab and press Enter to submit this manual hand-off.
Team messages use guarded delivery, which can attempt Enter automatically.
A Team Role That Runs Codex
A role card whose agent line names codex is a terminal tab, not a session:
- **Agent:** codex gpt-5
mbm2 team start acme/acme-dev then opens mbm2 in the role's folder with that tab focused
(mbm2 --dir <folder> --open acme-dev), and /worker lists the role as role · codex · <folder>. The
tab starts without a prompt: Codex reads the AGENTS.local.md start block mbm2 team setup keeps in the
folder, which tells the role to read its card and inbox.
With --attach
With a remote runtime the tab runs codex on the server, which needs it installed and signed in, and
the team bus is off, so Codex runs without the team tools.
Pitfalls
| Symptom | Cause and fix |
|---|---|
/mcp in Codex does not list mbm2_team |
Start was without the bus (remote runtime, or the bus failed: see the log), or this Codex does not read bearer_token_env_var through -c: join as a relay peer |
| Codex asks before each team tool | Its approval policy is yours; allow the tools in Codex |
| A team message is still in Codex's input | Check Needs You and inspect the draft before submitting it. See Teamwork. |
could not add codex: workers file has comments; edit it raw to keep them |
Add the worker to workers.jsonc by hand |
codex works in your shell but /codex says it is not on PATH |
The CLI is where mbm2's PATH does not look; put it on PATH |
Published from revision f88fc66f 2026-11-30