Skip to main content
Beato
  1. All Articles/

Build an AI Coding Workflow with Zellij, Herdr, and cmux

·9 mins

When a modern terminal multiplexer meets an AI agent multiplexer, the visualization capabilities of macOS native terminals are superimposed.

Introduction: Terminal Dilemma in the AI Coding Era #

If you deal with AI coding agents such as Claude Code, Codex, and OpenCode every day, you must have experienced this scene: there are a row of tabs in the terminal, each running different tasks, some are waiting for authorization, some are compiling, and some are stuck - but you can’t tell which one is which. Switching back and forth, the context is lost and the rhythm is broken.

Although traditional tmux can solve the multi-pane problem, it knows nothing about the status of the AI ​​agent. A bunch of AI dialog boxes opening in the browser? That is even more of a betrayal to the end user.

So, I found a combination solution:Zellij + Herdr + cmux. The three tools each perform their own duties, and together they form the smoothest AI coding workflow I have ever experienced.

Layer 1: Zellij — a modern terminal multiplexer #

What is it? #

Zellij is a modern terminal multiplexer written in Rust. You can think of it as a “modern version” of tmux. It allows you to manage multiple sessions, tabs, and panes in a single terminal window without requiring complex configuration like tmux.

Why choose it instead of tmux? #

Ready to use out of the box, zero configuration: Zellij’s design philosophy is “You shouldn’t sacrifice simplicity for the sake of power.” You can use it as soon as you open it. The status bar directly displays all available shortcut keys. No need to memorize the manual.

**Unique UI innovation **: Zellij introduces the concepts of ** floating panes (floating panes) and ** stacking panes(stacked panes). Floating panes can float above the interface like floating windows in an IDE, while stacked panes allow multiple terminals to be stacked in the same position and accessed by switching - which is extremely useful when debugging multitasking.

Layout automation: Zellij’s layout system allows you to use KDL files to describe a complete development environment - several panes, what commands to run respectively, and how to arrange them. Configure once and launch the entire workspace with one click.

Session persistence: Close the terminal window? no problem. Zellij’s session management is built-in, and the previous session will be automatically restored every time you open it.

Plug-in system: Supports writing plug-ins in any language compiled to WebAssembly. The community already has many useful plug-ins, such as zellij-workspace, which can apply layouts in existing sessions.

My usage #

Zellij is my entire workflowfoundation. Opening the terminal, Zellij started automatically, restoring all my previous sessions. There is one session for each project, and each session is divided into tabs according to functions - one tab for code editing, one tab for log monitoring, and one tab for AI agents.

Second level: Herdr — the “shepherd” of AI agents #

What is it? #

If Zellij is a universal terminal multiplexer, then Herdr is , a terminal multiplexer specially designed for AI coding agents. You can think of it as “tmux, but each pane knows the AI ​​agent you are running.”

Core Advantages #

Each agent has a real terminal: Each pane of Herdr is a real PTY (pseudo terminal), not a simulation of a terminal by a GUI application. This means that full-screen TUI applications can also render normally without compatibility issues.

Agent status at a glance: Herdr can automatically detect the status of the AI ​​agent running in each window - working (working), blocked (waiting for input), done (completed) or idle (idle). Just glance at it and you’ll know which agent is waiting for your response.

continues to run after detachment: You can detach at any time, turn off the terminal, and all agents in the Herdr background will continue to work. attach back from any terminal (even via SSH) and the scene is intact.

Native mouse support: Herdr is not a “keyboard first, mouse OK” tool - it treats the mouse as a first-class citizen. Click to switch panes, drag the border to resize, and right-click the menu to split panes. Even novices can get started immediately.

Scriptable: Herdr provides a local Socket API and CLI that the agents themselves can call - an agent can read the output of another pane, wait for state changes, and even create new panes.

My usage #

In a tab in Zellij, I launch Herdr. Then in this Herdr session, I simultaneously ran:

  • A Claude Code is refactoring the backend module
  • A Codex writing front-end components
  • An OpenCode running test case

Each has its own terminal and context. Which ones are stuck and which ones require my authorization, Herdr’s status bar makes it clear. Need to add an agent temporarily? prefix+v Split a new pane and start working directly.

The third layer: cmux — macOS native AI terminal #

What is it? #

cmux is amacOS native terminal application built on Ghostty, designed specifically for AI coding agents. It is not an Electron shell, but a native application written in Swift and AppKit, with fast startup and low memory.

Why add cmux on top of Zellij + Herdr? #

Because of some things, no matter how good the terminal TUI is, it is not as smooth as the native GUI. cmux fills this gap.

Notification Rings: This is the core killer feature of cmux. When the agent requires your attention (such as waiting for authorization, encountering an error), a blue halo will appear in the pane and the tab will light up. All pending notifications are concentrated in one panel, and you can jump to the corresponding location with one click. No more rummaging through dozens of windows.

Vertical tab page + sidebar: The sidebar displays the Git branch, PR status, working directory, listening port and latest notification text of each workspace. The information density is extremely high and clear at a glance.

Built-in browser pane: cmux has a built-in browser that can be opened next to the terminal. What’s even more powerful is that it can import cookies and sessions from 20+ browsers such as Chrome, Firefox, Arc, etc., and the browser pane will open in an authenticated state. Debug OAuth callbacks and view API documentation without having to switch out of your terminal.

SSH remote sessions: cmux ssh user@remote creates a workspace directly for the remote machine, and the browser pane is also routed through the remote network, localhost works out of the box.

Programmable CLI + Socket API: Like Herdr, cmux also provides CLI and Socket API, which can programmatically create workspaces, split panes, send keystrokes, and automate browsers.

My usage #

cmux is my “command center”. I open a terminal pane in cmux, run Zellij in it (yes, Zellij can run in the terminal pane of cmux), and then run Herdr in Zellij. Three levels of nesting, each performing its own duties:

  • cmux layer: responsible for global notifications, multi-project overview, built-in browser
  • Zellij layer: Responsible for the pane layout and session management of each project
  • Herdr layer: Responsible for the state awareness and parallel scheduling of AI agents

Three Powerful Alliance: Practical Workflow #

The following is my real daily workflow:

Morning start #

  1. Open cmux (macOS native application, open in seconds)
  2. The sidebar of cmux automatically displays the Git status and PR information of all my projects
  3. In the cmux terminal pane, Zellij starts automatically and restores all yesterday’s sessions
  4. Switch to Zellij’s “AI” tab, Herdr is already running in the background, and all agents are restored to their previous state.

in the encoding process #

  1. Main coding: Write code in a pane of Zellij
  2. Parallel AI task: Run 2-3 AI agents at the same time in Herdr - one for reconstruction, one for writing tests, and one for checking documents
  3. Status Monitoring: Take a glance at Herdr’s status bar to know who is busy and who is waiting.
  4. Notification reminder: Which agent needs my authorization, the cmux notification ring lights up, click to jump directly
  5. Quick verification: Need to see API documentation? cmux’s built-in browser opens next to it without having to cut out the terminal

Call it a day after get off work #

  1. Turn off cmux directly (or detach)
  2. Zellij session is saved persistently, and all agents in Herdr continue to run in the background.
  3. opened it the next day and everything was restored to the same state as before.

remote office #

  • Connect to your home machine via SSH on your company computer
  • runs herdr attach, all agents are restored on site
  • cmux’s SSH session also supports the full functionality of remote terminals

Summary: Why these three? #

ToolsPositioningirreplaceable value
Zellijmodern terminal multiplexerout-of-the-box, floating/stacked panes, layout automation, session persistence
HerdrAI agent multiplexerAgent state awareness, real terminal, scriptable, mouse native
cmuxmacOS native AI terminalnotification ring, vertical tabs, built-in browser, native performance

Either one is very strong when used alone, but the combination is the real “1+1+1>3”:

  • Zellij provides flexible terminal layout and session management
  • Herdr makes AI agents observable and schedulable
  • cmux uses the native GUI to supplement the notifications and visualizations that the terminal TUI cannot do.

These three are not in a competitive relationship, but a collaborative relationship in which is vertically layered and each performs its own duties. cmux provides a native macOS experience at the outermost layer, Zellij manages terminal sessions at the middle layer, and Herdr schedules AI agents at the core layer.

If you are also a developer who deals with multiple AI coding agents every day, you might as well try this combination. The installation command is placed here, you can take it away without thanks:

# Zellij
brew install zellij

# Herdr
brew install herdr
# 或 curl -fsSL https://herdr.dev/install.sh | sh

# cmux
brew tap manaflow-ai/cmux
brew install --cask cmux

Then open cmux, run Zellij in it, and run Herdr in Zellij - start to experience what “the final workflow of AI coding” is.


Written by Jermine. View original text.