cmux-nextArchitecture
cmux-next

Architecture

How cmux-next fits together, and where each part lives in the code.

cmux-next has three layers: a Swift app for macOS, a Rust core, and web views. The Rust core runs as daemons, so terminals and agents keep running when the app quits, updates, or crashes. Each section below links to the code and to the longer docs next to it.

The app

The macOS app is a Swift package with one module per feature: terminal, browser, Home, Settings, and so on. It draws windows, panes, and tabs, and draws terminals with libghostty from the ghostty-next fork. Rust code that runs inside the app is linked in as one static library.

WhereWhat
Packages/macOS/CmuxNextThe app, one module per feature
Packages/macOS/CmuxNext/Sources/CmuxNextTerminalTerminal views on libghostty
cmux-tui/crates/cmux-app-ffiThe Rust library inside the app
ghostty-nextThe Ghostty fork that renders terminals
skills/cmux-architecture/SKILL.mdLayering and package rules for Swift code

The core: cmux-tui

cmux-tui is the Rust core and the cmux command. Its daemon keeps the tree of machines, workspaces, panes, tabs, terminals, and browsers, and owns every shell. The app, the CLI, the terminal UI, and remote clients all talk to it over the same socket protocol. A new app build takes over the running daemon, which is why an update keeps your shells and scrollback.

WhereWhat
cmux-tuiThe Rust workspace: core, CLI, and daemons
cmux-tui/crates/cmux-tuiThe cmux command and its daemon
cmux-tui/crates/cmux-tui-coreThe workspace tree and the resources in it
cmux-tui/spec/resource-api-v2.mdThe socket protocol (cmux.protocol/2)
cmux-tui/docscmux-tui docs: concepts, remote, protocol

Agents: acpmux

acpmux is a daemon that keeps coding agents alive as named sessions: Claude Code, Codex, OpenCode, Pi, and any agent that speaks the Agent Client Protocol (ACP). It records every message, so any number of clients can attach to a session, and it adds up what each turn cost. A chat tab in the app is one of those clients.

WhereWhat
cmux-tui/crates/acpmuxThe agent daemon and its CLI
webviews/src/agent-session/acpmuxThe chat pane, a client of acpmux

Web views

Chat, diffs, Markdown, Settings, Home, and the other pages are React, built from one source tree. The app serves each page from its own cmux-page:// origin, and the page talks to the app only over a small bridge. A dev server can feed them to a running app with hot reload.

WhereWhat
webviewsThe React source and its dev server
webviews/src/pagesPages the app hosts: Settings, Home, history, and more

One catalog for every action

Every action is declared once in a Rust catalog: its title, shortcut, arguments, and where it shows up. The command palette, the menus, the cmux command, and the MCP tools are all built from it, and so are the CLI, palette, and keyboard shortcut pages of these docs. Settings work the same way, from one schema.

WhereWhat
cmux-tui/crates/cmux-action-catalogThe action catalog
plans/cmux-next/action-surfaces.jsonThe catalog exported as JSON
schemas/settings/settings-schema.jsonThe settings schema
cmux-tui/crates/cmux-tui/src/cli/mcpThe MCP server (cmux mcp serve)

Other machines

A remote machine runs the same cmux-tui and acpmux, so its workspaces and agents work like local ones. Cloud machines are remote machines that cmux sets up for you.

WhereWhat
cmux-tui/crates/cmux-remoteThe remote runtime: daemon, client, and connection
cmux-tui/docs/remote.mdHow the remote daemon and clients connect

Design docs

Longer docs live next to the code. Design notes for each feature are in plans/cmux-next, and how-to guides for running and building cmux-next are in docs/cmux-next.

WhereWhat
plans/cmux-nextDesign notes, one per feature
docs/cmux-nextGuides: install, dev builds, hot reload, dotfiles
plans/cmux-next/docs-DESIGN.mdHow these docs are built