# Comparison Verdict

> The closing synthesis: tmux is strongest as a small, portable, protocol-deep multiplexer; cmux is strongest as a native agent-workflow shell that combines terminal, browser, notifications, remote access, and local automation. The most portable ideas are explicit socket contracts, source-backed command/config schemas, provider-neutral hooks, and focused regression boundaries.

- Repository: tmux/tmux-with-manaflow-ai-cmux
- GitHub: https://github.com/tmux/tmux
- Human wiki: https://grok-wiki.com/public/wiki/tmux-tmux-with-manaflow-ai-cmux-62db34dfaddc
- Complete Markdown: https://grok-wiki.com/public/wiki/tmux-tmux-with-manaflow-ai-cmux-62db34dfaddc/llms-full.txt

## Source Files

- `tmux-tmux:tmux.h`
- `tmux-tmux:server.c`
- `tmux-tmux:cmd-parse.y`
- `tmux-tmux:input.c`
- `manaflow-ai-cmux:Sources/TerminalController.swift`
- `manaflow-ai-cmux:Sources/Workspace.swift`
- `manaflow-ai-cmux:Sources/Panels/BrowserAutomation.swift`
- `manaflow-ai-cmux:CLI/CMUXCLI+AgentHookDefinitions.swift`

---

<details>
<summary>Relevant source files</summary>
The following files were used as context for generating this wiki page:
- [tmux-tmux:tmux.h](tmux-tmux/tmux.h)
- [tmux-tmux:tmux-protocol.h](tmux-tmux/tmux-protocol.h)
- [tmux-tmux:server.c](tmux-tmux/server.c)
- [tmux-tmux:cmd-parse.y](tmux-tmux/cmd-parse.y)
- [tmux-tmux:input.c](tmux-tmux/input.c)
- [tmux-tmux:regress/conf-syntax.sh](tmux-tmux/regress/conf-syntax.sh)
- [tmux-tmux:regress/control-client-sanity.sh](tmux-tmux/regress/control-client-sanity.sh)
- [manaflow-ai-cmux:Sources/TerminalController.swift](manaflow-ai-cmux/Sources/TerminalController.swift)
- [manaflow-ai-cmux:Sources/Workspace.swift](manaflow-ai-cmux/Sources/Workspace.swift)
- [manaflow-ai-cmux:Sources/Panels/BrowserAutomation.swift](manaflow-ai-cmux/Sources/Panels/BrowserAutomation.swift)
- [manaflow-ai-cmux:CLI/CMUXCLI+AgentHookDefinitions.swift](manaflow-ai-cmux/CLI/CMUXCLI+AgentHookDefinitions.swift)
- [manaflow-ai-cmux:cmuxTests/TerminalControllerSocketSecurityTests.swift](manaflow-ai-cmux/cmuxTests/TerminalControllerSocketSecurityTests.swift)
- [manaflow-ai-cmux:cmuxTests/CLIGenericHookPersistenceTests.swift](manaflow-ai-cmux/cmuxTests/CLIGenericHookPersistenceTests.swift)
- [manaflow-ai-cmux:tests_v2/test_browser_api_p0.py](manaflow-ai-cmux/tests_v2/test_browser_api_p0.py)
</details>

# Comparison Verdict

This page closes the comparison between `tmux-tmux` and `manaflow-ai-cmux`. The verdict is not that one replaces the other: tmux is strongest where a terminal multiplexer must stay compact, portable, and protocol-deep; cmux is strongest where the terminal is one surface inside a local agent-workflow shell.

The reusable lesson is architectural, not vendor-specific. The most portable ideas are explicit socket contracts, source-backed command/config schemas, provider-neutral hooks, and regression boundaries around protocols rather than only UI behavior. No `STRATEGY.md` or `docs/solutions/` source was present in the prepared repository scan, so this synthesis uses repository code and tests as the source of truth. The Compound Engineering profile was used only as bundled page-shape and QA guidance, not as executed project code.

## Verdict At A Glance

| Dimension | tmux is stronger when... | cmux is stronger when... | Portable idea |
|---|---|---|---|
| Runtime boundary | A long-lived server owns sessions over a Unix socket. | A native app exposes local automation over a Unix socket. | Make the socket contract explicit and testable. |
| Protocol depth | Terminal input, escape sequences, control clients, and tmux commands are the product. | Terminal, browser, notifications, remote PTY, and agent hooks all need one command surface. | Keep protocol verbs source-backed, not README-only. |
| Configuration | Users compose command language, formats, and conditionals. | Integrations install hooks into many agent-specific config locations. | Parse and validate config with owned schemas. |
| Portability | The core needs few assumptions beyond C/POSIX-style process, socket, and terminal primitives. | The app can depend on macOS-native surfaces and WebKit to deliver richer workflows. | Separate durable contracts from platform-specific UI. |
| Regression surface | Protocol, parser, control-client, and terminal behavior must not drift. | Socket security, browser automation, remote workflows, and hook persistence must not drift. | Regression tests should pin external contracts. |

Sources: [tmux-tmux:tmux.h:82-94](), [tmux-tmux:tmux-protocol.h:22-77](), [tmux-tmux:server.c:105-154](), [manaflow-ai-cmux:Sources/TerminalController.swift:1536-1815](), [manaflow-ai-cmux:Sources/TerminalController.swift:3335-3698](), [manaflow-ai-cmux:CLI/CMUXCLI+AgentHookDefinitions.swift:122-297]()

## What tmux Optimizes For

tmux’s center of gravity is a small server process with a stable Unix-socket boundary and a deep terminal protocol implementation. Its defaults define configuration paths, socket roots, socket permissions, and terminal identity in one shared header, while the server creates an `AF_UNIX` stream socket, binds it to `socket_path`, listens with backlog `128`, and switches the descriptor to nonblocking mode.

The protocol is intentionally narrow and explicit: `PROTOCOL_VERSION` and `enum msgtype` define client/server messages for identify, command, detach, resize, file read/write, and lifecycle events. That is the shape of a mature multiplexer: small surface, strong contract, careful compatibility pressure.

Sources: [tmux-tmux:tmux.h:82-94](), [tmux-tmux:tmux-protocol.h:22-77](), [tmux-tmux:server.c:105-154]()

### tmux Runtime Boundary

```text
tmux client
    |
    | Unix socket + typed protocol messages
    v
tmux server
    |
    +-- command queue
    +-- sessions/windows/panes
    +-- terminal input parser
```

The server loop drains command queues globally and per identified client, then runs the client loop and exits only after session/client/job conditions allow it. Socket execute permissions are updated based on whether sessions are attached, and accepted clients pass through ACL checks before they become active clients.

Sources: [tmux-tmux:server.c:264-305](), [tmux-tmux:server.c:331-401](), [tmux-tmux:server.c:407-427]()

### tmux Command And Terminal Depth

The command parser is not a thin string splitter. `cmd-parse.y` models command parse state, arguments, nested command lists, scope stacks, conditional forms, format expansion, environment assignment, and parse-only behavior. That explains why tmux configuration is powerful without needing a separate app-level automation framework.

The terminal side is similarly deep. `input.c` documents a DEC/ANSI-derived parser, adds UTF-8, OSC, APC, rename-sequence, and DCS handling, then carries parser context for panes, screen writing, palette, input buffers, parameters, UTF-8 state, outstanding requests, and control-client replay since ground state.

Sources: [tmux-tmux:cmd-parse.y:71-100](), [tmux-tmux:cmd-parse.y:197-243](), [tmux-tmux:cmd-parse.y:268-390](), [tmux-tmux:input.c:31-52](), [tmux-tmux:input.c:98-148]()

## What cmux Optimizes For

cmux’s center of gravity is a native agent-workflow shell. Its socket listener looks tmux-like at the boundary, but the commands behind it are broader: windows, workspaces, panes, surfaces, remote workspaces, notifications, feed events, files, browser automation, browser profiles, and VM-like methods all share the v2 JSON command plane.

This is why cmux is strongest when “terminal multiplexer” is not enough. A workflow can open a browser split, drive WebKit, persist browser profile state, surface notifications, track agent sessions, and reconnect remote PTYs through one local automation channel.

Sources: [manaflow-ai-cmux:Sources/TerminalController.swift:1536-1815](), [manaflow-ai-cmux:Sources/TerminalController.swift:2242-2278](), [manaflow-ai-cmux:Sources/TerminalController.swift:3335-3698]()

### cmux Runtime Boundary

```text
cmux CLI / agent hooks / local automation
    |
    | Unix socket + line JSON / v1 commands
    v
TerminalController
    |
    +-- windows / workspaces / panes / surfaces
    +-- terminal input and remote PTY methods
    +-- browser automation and profiles
    +-- notifications / feed / files
```

The socket listener has product-grade operational mechanics: it tracks listener identity, path locks, fallback socket paths, nonblocking setup, permission application, listener health, port scanner callbacks, and a dispatch source accept loop. Password mode supports both v1 text commands and v2 JSON `auth.login`, while worker-routed v2 methods keep selected operations off the main actor.

Sources: [manaflow-ai-cmux:Sources/TerminalController.swift:1536-1815](), [manaflow-ai-cmux:Sources/TerminalController.swift:2148-2235](), [manaflow-ai-cmux:Sources/TerminalController.swift:2242-2311](), [manaflow-ai-cmux:Sources/TerminalController.swift:2399-2491]()

### cmux Workspace And Browser Scope

`Workspace` snapshots include terminal scrollback, restorable agents, tmux start commands, browser URL/profile/history/zoom/devtools state, markdown panels, file previews, right-sidebar tools, notifications, git branch, listening ports, TTY names, and remote configuration. Restore logic distinguishes local startup, agent auto-resume, remote PTY replay, scrollback replay, and manual resume states.

Browser automation is first-class rather than incidental. cmux exposes profile list/create/rename/clear/delete operations, guards destructive profile operations when live browser panels use a profile, imports cookies from installed browsers, and tests browser v2 methods such as `browser.open_split`, `browser.navigate`, `browser.fill`, `browser.click`, `browser.snapshot`, and `browser.screenshot`.

Sources: [manaflow-ai-cmux:Sources/Workspace.swift:163-250](), [manaflow-ai-cmux:Sources/Workspace.swift:470-605](), [manaflow-ai-cmux:Sources/Workspace.swift:934-1045](), [manaflow-ai-cmux:Sources/Panels/BrowserAutomation.swift:183-364](), [manaflow-ai-cmux:Sources/Panels/BrowserAutomation.swift:366-468](), [manaflow-ai-cmux:tests_v2/test_browser_api_p0.py:22-113]()

## Provider-Neutral Agent Integration Is cmux's Most Portable Idea

cmux’s hook model is explicitly multi-agent. `AgentHookDef` abstracts CLI name, display name, status key, config directory/file, environment override, session store suffix, disable environment variable, hook marker, binary name, hook format, event mapping, aliases, feed-hook events, and post-install action. The concrete definitions cover Codex, Grok, OpenCode, Pi, Amp, Cursor, Gemini, Antigravity, Rovo Dev, Hermes Agent, Copilot, CodeBuddy, Factory, and Qoder without hard-coding the whole product to one model provider.

That matters for BYOC/BYOK architecture. The hook contract is a local file/config/socket integration pattern. Providers can vary, credentials can stay in each tool’s own environment, and cmux only needs stable event-to-command mappings plus sanitized persistence. The tests reinforce this: generic hook persistence expects launch commands to drop resume IDs and initial prompts while preserving non-secret config homes such as `GEMINI_CLI_HOME`, `GROK_HOME`, `COPILOT_HOME`, or `CODEBUDDY_CONFIG_DIR`.

Sources: [manaflow-ai-cmux:CLI/CMUXCLI+AgentHookDefinitions.swift:7-47](), [manaflow-ai-cmux:CLI/CMUXCLI+AgentHookDefinitions.swift:49-102](), [manaflow-ai-cmux:CLI/CMUXCLI+AgentHookDefinitions.swift:122-297](), [manaflow-ai-cmux:CLI/CMUXCLI+AgentHookDefinitions.swift:315-433](), [manaflow-ai-cmux:cmuxTests/CLIGenericHookPersistenceTests.swift:16-190]()

## Regression Boundaries

tmux’s regression boundaries match its product shape. `conf-syntax.sh` starts tmux with `/dev/null` config and runs `source -n` against repository config examples, pinning config syntax. `control-client-sanity.sh` drives `tmux -C` with pane/window/layout commands and compares exact pane layout output, pinning control-client behavior.

cmux’s boundaries are broader because its surface is broader. Socket security tests verify permission modes, password-mode rejection, focus-intent policy, remote status redaction, and worker routing for remote PTY resize. Browser v2 tests verify interactive browser control and ref-handle behavior. This is the right split: tmux protects protocol and terminal semantics; cmux protects local automation workflows crossing terminal, browser, notification, and remote surfaces.

Sources: [tmux-tmux:regress/conf-syntax.sh:1-14](), [tmux-tmux:regress/control-client-sanity.sh:13-40](), [manaflow-ai-cmux:cmuxTests/TerminalControllerSocketSecurityTests.swift:28-75](), [manaflow-ai-cmux:cmuxTests/TerminalControllerSocketSecurityTests.swift:77-141](), [manaflow-ai-cmux:cmuxTests/TerminalControllerSocketSecurityTests.swift:178-220](), [manaflow-ai-cmux:tests_v2/test_browser_api_p0.py:30-112]()

## Design Guidance For Future Grok-Wiki Integration

For a Grok-Wiki or Ask/Wiki workflow, borrow the parts that travel:

| Pattern | How to apply it | Provider-neutral constraint |
|---|---|---|
| Explicit socket contract | Treat local automation as a documented request/response protocol with health checks and auth modes. | Do not bind the protocol to one hosted model or connector. |
| Source-backed schemas | Generate command/config pages from code-owned definitions like tmux parser grammar or cmux hook definitions. | Skill packs can come from files, repositories, or catalogs; the schema should not require one vendor. |
| Hook adapters | Model agent integrations as event mappings plus environment/config resolution. | Keep credentials in BYOK tool environments; do not centralize provider secrets in the wiki layer. |
| Focused regression pages | Link wiki claims to tests that pin behavior: parser syntax, control client layout, socket security, browser API, hook persistence. | Tests should validate local contracts, not only provider-specific happy paths. |

Sources: [tmux-tmux:cmd-parse.y:103-134](), [tmux-tmux:cmd-parse.y:268-390](), [manaflow-ai-cmux:Sources/TerminalController.swift:2242-2278](), [manaflow-ai-cmux:Sources/TerminalController.swift:3335-3698](), [manaflow-ai-cmux:CLI/CMUXCLI+AgentHookDefinitions.swift:7-47](), [manaflow-ai-cmux:CLI/CMUXCLI+AgentHookDefinitions.swift:122-297]()

## Closing Summary

tmux wins on being a compact, portable, protocol-deep multiplexer: its source centers on a Unix socket, typed protocol messages, command parsing, and terminal input semantics. cmux wins on being a native agent-workflow shell: its source centers on a richer local socket API that joins terminal surfaces, browser control, notifications, remote PTYs, workspace persistence, and provider-neutral agent hooks. The shared lesson is to keep contracts explicit, source-backed, and regression-tested at the boundary where external tools depend on them.

Sources: [tmux-tmux:tmux-protocol.h:22-77](), [tmux-tmux:input.c:31-52](), [manaflow-ai-cmux:Sources/TerminalController.swift:3335-3698](), [manaflow-ai-cmux:Sources/Workspace.swift:231-250](), [manaflow-ai-cmux:CLI/CMUXCLI+AgentHookDefinitions.swift:122-297]()
