{"slug": "running-coding-agents-in-cmux", "title": "Running coding agents in cmux", "summary": "A hands-on guide details how to run multiple coding agents in cmux 0.65.2, a Ghostty-based Mac terminal from manaflow-ai that places each task in a sidebar workspace alongside shells and browser panes. The author launches agents such as Codex, Claude and opencode via `cmux new-workspace --name ... --cwd ... --command`, splits panes with `cmux new-split right` to inspect `git diff` and rerun tests, and routes alerts with `cmux notify` or `cmux hooks setup --agent codex`. The guide warns that plain `ssh` sessions in a cmux pane lose their shell and foreground jobs if the connection drops unless run inside tmux or Herdr.", "body_md": "When an agent finishes a change, I want to find its terminal, see the diff and run the tests. With several tasks in flight, I also want to know which one is waiting for me. [cmux](https://cmux.com/) is a Ghostty-based Mac terminal that puts those tasks in a sidebar and lets me keep a shell, an agent and a browser together.\n\nThis is a companion to the [Herdr post](https://ngrislain.github.io/blog/2026-11-26-herdr-a-place-for-coding-agents-to-keep-working/). The examples use the macOS app and CLI, checked against cmux 0.65.2.\n\n## Give each task a workspace\n\nI use a workspace for one change. Inside it, I split the terminal when the new pane should share the same checkout. For a parser fix, that might mean Codex on the left and a shell for tests on the right. A browser split is useful when the change has a page to inspect. The review in the figure has its own workspace, so I can switch to it without rearranging the parser layout.\n\nYou can install cmux with Homebrew or get the installer from the [download page](https://cmux.com/).\n\n```\nbrew tap manaflow-ai/cmux\nbrew install --cask cmux\n```\n\nOpen the app. Create a workspace from the command palette, change to the repository and run `codex`, `claude` or `opencode` as you would in any terminal. Install and sign in to the agent on the machine where it will run. The cmux CLI is available inside its terminals. To use it from another terminal, run **Shell Command: Install 'cmux' in PATH** from the cmux command palette. [Getting started](https://cmux.com/docs/getting-started)\n\n## Launch agents from the command line\n\nOnce I know the layout I want, I can launch the workspaces from an existing cmux terminal. The two directories in this example are separate checkouts of the project.\n\n```\ncmux new-workspace --name \"Parser fix\" --cwd \"$HOME/code/parser-fix\" \\\n  --command \"codex\"\ncmux new-workspace --name \"Review change\" --cwd \"$HOME/code/parser-review\" \\\n  --command \"claude\"\ncmux list-workspaces\n```\n\nSwitch between tasks by clicking the sidebar. A script can take a workspace reference from `cmux list-workspaces` and pass it to `cmux select-workspace --workspace`. Run this from a terminal in the parser workspace to open a shell beside the agent. You can also target the workspace explicitly with `--workspace`.\n\n```\ncmux new-split right --command 'cd \"$HOME/code/parser-fix\"'\n```\n\nThat shell is where I inspect `git diff` and rerun tests. If the app serves a page on port 3000, `cmux browser open http://localhost:3000` opens it in a browser pane. I give parallel edits separate Git worktrees because splits and workspaces can point at the same directory. For a review, I give the reviewer the commit or diff I want it to inspect. [CLI reference](https://cmux.com/docs/api)\n\n## Follow the notifications\n\nAn unread badge gives me a place to start when I return. Press `⌘⇧I` for the notification list, or `⌘⇧U` to jump to the latest unread notification. The pane will tell you why it rang. An agent may be asking a question, waiting for a decision or reporting a finished turn.\n\nTo try the routing, run this from a cmux pane and switch to another workspace during the five-second delay.\n\n```\nsleep 5\ncmux notify --title \"Parser fix\" --body \"Ready for review\"\n```\n\nFor automatic alerts, cmux uses agent integrations and terminal notification sequences. If the test notification works but Codex stays silent, check `cmux hooks --help`. In the version used here, `cmux hooks setup --agent codex` installs the Codex integration. Desktop banners may be suppressed while you are looking at cmux, so check the sidebar and notification panel too. [Notification guide](https://cmux.com/docs/notifications)\n\n## What happens when cmux opens an SSH workspace\n\nThere are two ways to SSH from a cmux terminal. Typing `ssh workbox` starts ordinary OpenSSH in the current pane. The remote SSH server starts a shell. If that connection dies, expect the shell and its foreground jobs to end unless you put them in a separate session with something like tmux or Herdr.\n\nTyping `cmux ssh workbox` creates a managed SSH workspace in the Mac app and uses the same SSH host alias. On a supported host, cmux copies over a versioned helper called `cmuxd-remote` if it is missing. An SSH channel talks to a bridge on the host, which connects to a background daemon for that workspace. The daemon holds the remote pseudoterminals (PTYs), so a shell and the agent it starts can stay alive when the bridge disconnects. The Mac draws the terminal and sends your input. The agent runs as your remote user, with the remote checkout, dependencies and model login. [Remote daemon and PTY lifecycle for cmux 0.65.2](https://github.com/manaflow-ai/cmux/blob/12023d89f/daemon/remote/README.md#persistent-ssh-pty-daemon)\n\nThe relay also carries browser traffic and notifications. The browser pane appears on the Mac, but `http://localhost:3000` in that pane reaches a development server on the remote host. A remote `cmux notify` can send a message back to the Mac sidebar. [cmux SSH guide](https://cmux.com/docs/ssh)\n\n## What survives a disconnect\n\n- **Wi-Fi drops or the Mac goes to sleep.** The SSH connection can drop while the daemon and the remote shell keep running. cmux retries with backoff and can reattach to the same PTY when the network returns, provided the session still exists.\n- **You close one terminal view.** A persistent PTY can stay alive if its owning workspace is still open. Detached PTYs are subject to the daemon's idle timeout. Use`cmux ssh-session-list` in that workspace and`cmux ssh-session-attach --session-id SESSION_ID` to return to a session listed there.\n- **You type `exit` in the remote shell.** That shell ends. A separately running tmux or Herdr server can still hold its own terminals.\n- **You explicitly close the owning cmux workspace.** cmux asks the remote daemon for that workspace to shut down. Treat this as the end of its managed shells. An independent tmux or Herdr session can continue.\n- **The remote host reboots.** The original processes end. An agent may be able to resume its conversation from disk. An interrupted test command needs to be started again.\n\nQuitting and reopening the app can restore a saved SSH session when cmux has retained the session ID and the remote daemon still has its PTY. For a run I want to retrieve by name from another client, I use a separate remote session. [cmux reconnect behavior](https://cmux.com/docs/ssh#reconnect) · [Remote daemon lifecycle](https://github.com/manaflow-ai/cmux/blob/12023d89f/daemon/remote/README.md#persistent-ssh-pty-daemon)\n\n## Leave an agent running in a named session\n\nFrom the Mac, open the connection with `cmux ssh`.\n\n```\ncmux ssh workbox --name \"Remote parser\"\n```\n\nFrom the remote shell, enter the checkout and start or reattach the named session.\n\n```\ncd ~/code/parser-fix\ntmux new-session -A -s parser\n```\n\nRun the agent inside tmux. With default tmux keys, `Ctrl+B`, then `D` detaches. Later, run `tmux attach -t parser` from any SSH client on the same host. For an existing Herdr session, run `herdr` in the remote terminal to return to its panes. [tmux getting started](https://github.com/tmux/tmux/wiki/Getting-Started) · [Herdr remote sessions](https://herdr.dev/tui/docs/persistence-remote/)\n\nIf you want each remote tmux session to appear as its own cmux sidebar entry, cmux also has a **Remote tmux** beta. With the setting enabled and tmux 3.2 or later on the host, `cmux ssh-tmux workbox` mirrors sessions, windows and panes. In that view, closing a mirrored pane closes it on the remote tmux server too. [Remote tmux guide](https://cmux.com/docs/remote-tmux)\n\nI would start with two workspaces and one test notification. Give each workspace a name you will recognize an hour later. Once you can get back to the right pane and see what it was doing, add a remote session for the task you want to leave running.", "url": "https://wpnews.pro/news/running-coding-agents-in-cmux", "canonical_source": "https://ngrislain.github.io/blog/2026-11-26-running-coding-agents-in-cmux/", "published_at": "2026-11-26 00:00:00+00:00", "updated_at": "2026-11-26 19:14:51.045013+00:00", "lang": "en", "topics": ["ai-agents", "developer-tools", "ai-tools"], "entities": ["cmux", "manaflow-ai", "Ghostty", "Codex", "Claude", "opencode", "Herdr", "Homebrew"], "also_reported_by": [], "takeaway": "Give each coding-agent task its own cmux workspace with a separate Git worktree, launch it via `cmux new-workspace --name ... --cwd ... --command`, and split a shell beside the agent to run `git diff` and tests.", "recommendation": {"advice": "Run each parallel coding-agent task in its own cmux workspace and Git worktree, split a shell beside the agent to review diffs and rerun tests, and install `cmux hooks setup --agent codex` so finished turns raise notifications.", "playbook": "coding-agents", "playbook_url": "https://wpnews.pro/playbooks/coding-agents"}, "alternates": {"html": "https://wpnews.pro/news/running-coding-agents-in-cmux", "markdown": "https://wpnews.pro/news/running-coding-agents-in-cmux.md", "text": "https://wpnews.pro/news/running-coding-agents-in-cmux.txt", "jsonld": "https://wpnews.pro/news/running-coding-agents-in-cmux.jsonld"}}