🤖 AI Hot

Herdr: Terminal AI Agent Multiplexer Guide

A
Alex Chen

If you spend your day bouncing between Claude Code in one terminal tab, a GPT-5 shell session in another, and some homegrown agent in a third, you know the feeling: three windows, three contexts, zero coordination between them. Herdr is a terminal multiplexer built specifically for AI agents—it lets you run multiple agents side by side in one window, route output between them, and manage their lifecycle from a single interface.

I installed it three weeks ago out of curiosity. I kept it because it solved a problem I didn’t realize I had: my terminal had become a control panel for a small army of semi-autonomous programs, and I needed something better than tmux panes and mental notes to keep track of them.

What Herdr Actually Does

Herdr sits inside your terminal like tmux or screen, but instead of managing shell sessions for humans, it manages agent sessions. Each agent runs in its own named workspace. You can split the view horizontally or vertically, attach a Claude session to the left pane, a GPT session to the right, and a local script to a background pane that feeds results to both.

The key difference from tmux: Herdr understands agent output. It can detect when an agent has finished a task, parse structured responses, and route them to other agents based on rules you define. Think of it as tmux meets a lightweight agent orchestration layer, minus the cloud dependency.

# Install on macOS
brew install herdr

# Or build from source
git clone https://github.com/herdr-io/herdr
cd herdr && cargo build --release

Start a session with herdr new, then spawn agents with Ctrl-A c (create) and Ctrl-A n (name). The default keybindings mirror tmux, so if you already have muscle memory for Ctrl-A followed by directional splits, you’ll pick it up in five minutes.

The Architecture That Makes It Work

Under the hood, Herdr is a Rust binary that spawns PTY sessions for each agent and wraps them with a lightweight message bus. Each agent workspace gets a Unix socket that Herdr listens on. When an agent produces output, Herdr parses it through a configurable middleware pipeline—regex extraction, JSON schema validation, even a small embedded LLM for intent classification if you enable it.

The multiplexer itself is surprisingly lean. On my M3 MacBook, running four concurrent Claude Code sessions through Herdr adds about 40MB of RAM overhead total. Compare that to running four separate terminal windows with their own shell state, and the savings come from shared process management and deduplicated memory.

What sold me was the agent-to-agent routing. You can configure rules like:

routes:
  - from: "code-reviewer"
    to: "fixer-agent"
    condition: "output contains 'BUG_FOUND'"
    action: "forward"
  - from: "researcher"
    to: "writer-agent"
    condition: "task == 'complete'"
    action: "forward_and_notify"

This means you can chain agents: a research agent scrapes docs, a code-review agent checks the output, a fixer agent applies patches—all without you manually copying and pasting between windows. The routing config is YAML and hot-reloads, so you can tweak chains without restarting sessions.

Who Should Use Herdr

Herder is worth setting up if:

  • You run multiple AI coding agents simultaneously (Claude Code, Codex CLI, Aider, etc.)
  • You chain agent outputs regularly and are tired of copy-pasting between terminal tabs
  • You want to keep agent sessions persistent across SSH disconnects without cloud infrastructure
  • You’re building multi-agent workflows and want to observe them in one view before scaling to production orchestrators

The sweet spot is local development with 2-5 agents running in parallel. Beyond that, you’re probably better off with a dedicated orchestration framework like LangGraph or CrewAI.

How It Compares to Alternatives

People ask me whether Herdr replaces tmux, or LangGraph, or both. The honest answer: it occupies a narrow middle ground none of those tools target.

Herdr vs tmux. Tmux is a general-purpose terminal multiplexer. It doesn’t know what’s running inside each pane and doesn’t care. Herdr adds agent awareness—it can parse agent output, route messages between sessions, and track task completion state. But tmux is a battle-tested tool with decades of polish. If you just want split panes without agent routing, tmux is the better choice. Herdr’s value kicks in when you want those panes to talk to each other.

Herdr vs LangGraph/CrewAI. LangGraph and CrewAI are full orchestration frameworks built for production multi-agent systems. They handle state persistence, conditional branching, retry logic, and integration with vector stores and APIs. Herdr is none of that. It’s a local terminal tool with basic routing. Use LangGraph when you need to deploy agent workflows at scale. Use Herdr when you’re iterating on those workflows locally and want to see all agents in one view.

Herdr vs manual terminal tabs. This is where Herdr shines. The difference between three terminal tabs and three Herdr panes isn’t the visual layout—it’s the routing. When your research agent finishes in tab 1, you still have to read its output, mentally summarize it, and type it into tab 2. Herdr automates that handoff. For workflows where agents produce structured output that feeds into other agents, routing eliminates a surprising amount of friction.

Configuration System In Depth

Herdr’s config lives in ~/.config/herdr/herdr.yaml. Beyond basic keybindings and color schemes, the interesting parts are:

Session persistence. Herdr can save session state to disk, including each agent’s scrollback buffer and routing history. This means you can detach from a session, close your terminal, and reattach later with everything intact—even across reboots. The session file is a SQLite database stored at ~/.local/share/herdr/sessions/.

Agent profiles. You can define named agent profiles that pre-configure environment variables, startup commands, and routing rules:

agents:
  code-reviewer:
    command: "claude --model claude-sonnet-4-5 --system-prompt 'You are a code reviewer'"
    env:
      ANTHROPIC_API_KEY: "${ANTHROPIC_API_KEY}"
    auto_restart: true
    routing:
      on_complete: "notify"
      on_error: "forward:fixer-agent"

The ${ANTHROPIC_API_KEY} syntax reads from your shell environment or a .env file in the config directory. No hardcoded secrets in config files.

Middleware pipeline. The routing engine has a pluggable middleware system. Built-in middleware handles regex extraction, JSON parsing, and basic sentiment detection. You can write custom middleware in any language that speaks JSON over stdin/stdout—Herdr spawns it as a subprocess and pipes agent output through it. This is how people add custom routing logic without waiting for upstream DSL improvements:

middleware:
  - name: "security-scanner"
    command: "python3 ~/.config/herdr/middleware/scan_secrets.py"
    on_output: true

Session Recording and Agent Debugging

One feature I didn’t expect to rely on as much as I do: session recording. Herdr logs every agent interaction to the session database—prompts sent, responses received, routing decisions, timing data. You can replay entire sessions with herdr replay <session-id>, which steps through the timeline second by second.

This turns out to be useful for debugging multi-agent workflows. When agent A sends something to agent B and the result is wrong, you can replay the handoff and see exactly what was forwarded, what context was lost, and which middleware transformed the output. Without recording, you’d be reconstructing what happened from memory and partial logs.

The recording feature also makes Herdr useful as a lightweight evaluation tool. Run the same multi-agent workflow five times, record each session, then compare routing paths and final outputs. It’s not a formal eval harness, but for quick iteration on prompt chains, it’s faster than setting up LangSmith or Braintrust.

Agent Lifecycle Management

Each agent in a Herdr session has a defined lifecycle: spawn → initialize → running → paused → completed → terminated. You can control this lifecycle through keybindings or the command mode (Ctrl-A :):

  • Ctrl-A c spawns a new agent workspace
  • Ctrl-A p pauses an agent (freezes its process, preserves state)
  • Ctrl-A r resumes a paused agent
  • Ctrl-A k kills an agent (sends SIGTERM, then SIGKILL after 5 seconds)

Pause and resume is what makes Herdr practical for resource-constrained machines. If you’re running four Claude sessions and your Mac starts swapping, pausing two of them instantly frees up memory while preserving context. Resuming picks up exactly where they left off.

There’s also a watchdog feature: if an agent hasn’t produced output for N seconds (configurable), Herdr can optionally send a keepalive prompt, pause and notify you, or auto-terminate. I set mine to notify after 120 seconds of silence, which catches the cases where an agent has silently hit a token limit or network error.

Who Should Skip It

If you only run one AI agent at a time and don’t chain outputs, Herdr is overkill. A plain tmux session handles that fine.

If your agents are already running in production with full observability and orchestration (Kubernetes, LangSmith, etc.), Herdr won’t replace that. It’s a local tool, not a production orchestration layer.

If you’re on Windows—the current release is macOS and Linux only. WSL2 works, but native Windows support isn’t there yet.

Real-World Patterns I’ve Found Useful

After three weeks, a few patterns stuck:

The research → write pipeline. I keep a research agent in the left pane that scrapes docs and summarizes findings. The right pane runs a writing agent. When the researcher finishes, Herdr routes the summary to the writer automatically. I jump in at the end to edit, but the context-switching cost drops to nearly zero.

The code review daemon. I run a persistent code-review agent in a background Herdr pane. Every time I save a file in my editor, a watcher pipes the diff to a Herdr socket. The reviewer agent evaluates it and surfaces anything suspicious in a floating notification. It’s not as thorough as a CI pipeline, but the feedback loop is under 10 seconds.

Agent benchmarks. With three different coding agents running side by side on the same prompt, Herdr’s session recording lets you replay and compare outputs. I’ve used this to evaluate Claude Code vs Codex vs Aider on the same refactoring tasks. Not a rigorous benchmark, but useful for gut checks on which tool handles which type of task better.

Limitations Worth Knowing

Herdr’s error handling is still rough around the edges. If an agent crashes, the session sometimes hangs instead of cleanly detaching. I’ve hit this twice with long-running Claude Code sessions that ran into token limits.

The routing DSL is functional but not Turing-complete. You can’t write complex conditional logic—it’s basic matching against output strings and structured fields. For anything fancier, you’ll need to route to a script that parses output and dispatches accordingly.

There’s also no built-in credential management. Each agent workspace inherits your shell environment, which means API keys in env vars. Fine for local dev, but be careful about cross-contamination between different agent contexts running in the same Herdr session.

Should You Install It?

If the description “tmux for AI agents” makes immediate sense to you and you already run multiple coding assistants daily, install it. The learning curve is shallow if you know tmux, and the routing feature alone saves me about 20 minutes of context-switching per day.

If your agent workflow is single-threaded or you’re happy with your current terminal setup, skip it. The tool is early-stage and will feel rough compared to mature multiplexers.

I keep it running in a dedicated iTerm profile now. Three panes: research agent on the left, coding agent in the center, review agent on the right. It’s not the future of AI engineering or any grand claim like that—it’s just a practical tool that makes working with multiple agents feel less like juggling and more like conducting.


Herdr is open source (MIT license) and available at github.com/herdr-io/herdr. The project is under active development with weekly releases as of July 2026.

Disclosure: CarCare Guide is reader-supported. When you buy through links on our site, we may earn an affiliate commission at no extra cost to you. Learn more.
A
Alex Chen