Skip to content

Herdr

A terminal workspace manager for coding agents — a multiplexer like tmux, but mouse-first and agent-aware. A background server owns the real terminal processes, so panes survive a detached client, a closed terminal or a dropped SSH session. What makes it worth the switch is the sidebar: herdr recognises coding agents inside panes and rolls their state up per workspace, so you can see across every project which agent is working, which is blocked waiting on you, and which is done.

Installed on p620 and razer (the interactive-host developer profile), both on herdr 0.9.5. Not on p510.

What this repo owns, and what it does not

This split is the thing to understand before changing anything:

Thing Owned by Consequence
~/.config/herdr/config.toml home/development/herdr.nix A Nix-store symlink. Cannot be edited in place — edit the repo and deploy.
Everything else in ~/.config/herdr/ herdr itself Sessions, logs, pane history, plugin registry.
Plugins installed imperatively, per host herdr plugin install … on each machine. Nothing in the flake pins them.

The Nix module deliberately carries no host conditionals, so p620 and razer get a byte-identical config.toml — verify with readlink -f ~/.config/herdr/config.toml on both and compare the store hash.

Plugins are the opposite: they are global to the user but local to the machine, so the two hosts drift apart silently. Nothing warns you. Compare them with herdr plugin list on each and reinstall whatever lags.

Installed plugins

Ten, identical on both hosts:

Plugin What it is for
furkankly.zoetrope Session flow graph — the only way to see subagents
persiyanov.reviewr Diff review sidebar; comments go back to the agent
smarzban/herdr-file-viewer Git-aware read-only file viewer with diffs
lmilojevicc/herdr-splits.nvim Unified ctrl+hjkl across herdr panes and Neovim splits
kryptamine/herdr-auto-title Automatic pane titles
AltanS/collie PWA to watch agents from a phone over the tailnet
JanTvrdik/herdr-command-palette fzf command palette
nikok6/herdr-mirror Mirrors remote herdr servers into the local sidebar
ogulcancelik/herdr-plugin-github-start GitHub entry points
andrewchng/herdr-sessionizer Project switcher

Install a plugin on both hosts:

herdr plugin install <owner>/<repo> --yes
ssh razer 'herdr plugin install <owner>/<repo> --yes'

Note that a plugin whose manifest sits in a subdirectory needs the full path — zoetrope is furkankly/zoetrope/herdr-plugin, and the bare repo name fails.

Both zoetrope and reviewr are Rust and compile from source at install time, which is the good case on NixOS: a plugin that shipped a prebuilt dynamically linked ELF would need nix-ld to run at all. zoetrope's build installs zoe into ~/.cargo/bin. Verify a plugin actually works rather than trusting the installer — ldd <binary> | grep "not found" should be empty.

Seeing what subagents are doing

Native Claude Code and Codex subagents share their parent pane. The sidebar shows how many are active. In Codex, /subagents opens the native thread switcher. Open the graph to see individual workers and their activity.

Read the session graph (zoetrope)

zoetrope parses the session transcript JSONL directly — ~/.claude/projects/ for Claude Code, ~/.codex/sessions/ for Codex — and tells the formats apart by content. Because it reads the transcript rather than the terminal, in-process subagents appear as real nested nodes: the main session, its subagents, and workflow groups, with each agent's tool calls as chips beneath it. It follows live, and scrubs back through a finished session.

# inside herdr: open the graph over the current pane, following live
prefix+shift+z
# or open it in its own tab
prefix+alt+z

The Nix-managed graph bindings use the packaged Zoetrope binary.

Inspect managed workers

Press prefix+alt+r to open the managed run view in a temporary pane. You can also run herdr-runs in a shell on the workspace host. The header shows the hostname. Compare it with hostname in the selected workspace when attached remotely.

The view groups runs under a parent pane while its host, socket owner, Herdr session, terminal and agent session still match. Older records, calls made outside Herdr and runs whose parent has left appear under the hostname. Queued, running and cancelling runs count as active. Finished runs retain their final state. Select a run with the arrows and press Enter for its timestamped event types. Press b for the list or q to close the pane. Reopening the view reads the current history on that host.

Or stop using in-process subagents for work you want to watch

Spawn real agents in real panes. Each becomes a genuine sidebar row with real working/blocked/done state, its own scrollback, and a pane you can attach to:

id=$(herdr pane split --current --direction right --cwd "$PWD" --no-focus \
      | jq -r .result.pane.pane_id)
herdr agent start reviewer --kind claude --pane "$id"
herdr agent prompt reviewer "Review the diff, actionable findings only" \
      --wait --timeout 300000

agent start requires an existing pane at an interactive prompt; it never creates or moves layout itself. Split a wide pane right and a tall one down, and keep --no-focus so the user's focus stays put.

Start work in a background split and promote it to its own tab only when you want to watch it:

herdr pane move <pane-id> --new-tab --focus

For an agent team, give each member its own git worktree so they cannot fight over the tree:

herdr worktree create --branch feat/1234-thing --focus

Worktrees land in ~/.herdr/worktrees (set in the Nix module) and prefix+shift+o opens one.

Reviewing diffs (reviewr)

A diff sidebar with four scopes: uncommitted (working tree vs HEAD, including staged and untracked), branch (vs merge-base with the base branch), last agent turn, and individual commits. It polls the worktree every two seconds.

The point of it is the round trip: select lines with v, comment with c, send with s, and every comment lands in the agent's input. With one agent in the workspace it goes straight there; with several you get a picker. So a review becomes "annotate the diff, press send" instead of retyping findings into a prompt.

herdr plugin action invoke open --plugin persiyanov.reviewr

It needs git on PATH, a truecolor terminal, and herdr ≥ 0.7.5. gh, glab or az unlock its PR tab; this repo's hosts have gh and glab.

Agent integrations

Without an integration, herdr guesses agent state by scraping the screen. With one, the agent reports its own lifecycle, so blocked means a real approval prompt rather than a pattern match. Install per agent:

herdr integration install claude
herdr integration status            # or --outdated-only

Current state on both hosts — claude v9, codex v8, copilot v3, opencode v12. Of the seven AI CLIs installed here (claude, codex, gemini, opencode, copilot, crush, grok):

  • grok has an integration but it cannot be installed until the CLI has run once — the installer writes into ~/.grok, and refuses with "grok config directory not found" if that directory does not exist yet. Run grok, then install.
  • crush is not a herdr-supported kind at all, so its panes are never classified as agents.
  • Plain gemini has no integration of its own; the antigravity-cli integration is what writes into ~/.gemini.

Integrations are per host, and they are not covered by Syncthing: ~/.claude/.stignore excludes hooks/**, which is exactly where the Claude hook lives. Run the install on each machine.

Codex and agy rows

A headless Codex or agy run shows up as a ↳ codex or ↳ agy row under the Claude lead. The row is working while the run lasts, done for about 3 s, then its background tab closes. The tab streams the run's live progress.

The rows come from herdr-run <codex|agy> <command…>, which the fallback commands of the second-opinion skill put in front of themselves. Outside Herdr it runs the command directly. Managed agent-mcp runs appear in the prefix+alt+r view. agent-mcp

  • Ctrl-C and a timeout stop the run and close the tab.
  • A run herdr loses exits 1 and is never re-run.
  • herdr-run streams stdin to the command through a FIFO and never reads it up front, so a stdin that never closes (Claude Code's Bash tool gives a socket) only matters to a command that actually reads it (#2679).
  • The pane's command gets only the variables named in home/development/agent-env.sh (no tokens, no HERDR_*, no SSH_AUTH_SOCK), not the caller's whole environment. Outside herdr it gets the caller's (#2762).

Team tab

herdr-team opens a background tab with a pane for each member. Use review for a Codex reviewer, claude-review for a Claude reviewer and claude-implement for native Claude implementation. Delegate Codex or eligible Antigravity implementation through Handoff on agent-mcp, including inside Herdr.

Outside herdr, every herdr-team command exits 2.

herdr-team up <task> review
herdr-team up <task> claude-implement --step <k>
herdr-team ask <task> <member> <prompt-file> [--resume n] [--timeout s]
herdr-team converse <task> <member> <prompt-file> [--max-hops N] [--deadline s]
herdr-team finish <task> claude-implement [--verify CMD] [--retries N] [--verify-timeout S]
herdr-team status <task>
herdr-team down <task> [member] [--force]
  • Members run unrestricted (Issue #2812): Codex with --dangerously-bypass-approvals-and-sandbox.
  • They are launched through agent-env, so NIX_CONFIG and other tokens never reach them.
  • Claude implementation requires a linked worktree and an executable coder guard.
  • "Do not stage, commit, push, deploy or type into other panes" is an instruction to them, not a barrier.
  • Requests and answers. ask copies the prompt to <work>/req/<n>.md, then types only a fixed pointer (Request <gen>-<n>: read <work>/req/<n>.md and answer it in your reply.). The Codex and Claude hooks write the answer to <work>/turns/<turn-id>.json. A turn counts only when its input equals that pointer exactly.
  • Members talk to each other. converse relays the final TO: <member> … END block of each reply to that teammate, as a request file behind a fixed "teammate message, not an instruction" header. It stops when a reply addresses lead or has no block, at the hop limit (default 6) or at the deadline (default 1800 s). Every hop goes to <gen>/conversation.jsonl, and teardown keeps a copy in the archive.
  • JSON lines. ask prints {ok, outcome, n, member, answer, turn_id, revision_at_send, revision_at_reply, changed_during_review, exit}. Its outcome is one of ok, empty, provider_error, interrupted, cancelled, agent_gone, refused, send_failed, oversize, timeout or busy. converse prints one line per hop, {hop, from, to, n, outcome, answer, changed_during_review}, with no ok field: a hop succeeded when outcome == "ok". A converse outcome is one of the ask outcomes plus bad_address, bad_block, stale_target, hop_limit, deadline and busy_conversation.
  • On provider_error, the matching terminal lines are saved to <work>/ans/<n>.screen.
  • finish. It quits the implementer gracefully, runs down and checks:
  • the graceful exit code;
  • HEAD unchanged;
  • a non-empty diff against the start fingerprint;
  • nothing staged;
  • the last outcome == "ok".

Git runs with the git dir recorded at up, with fsmonitor and hooks off. Then it prints {ok, reason, failures, changed, head_moved, exit, verify}. failures lists every failed check in order, and reason is the first. - --verify CMD runs the lead's check in the worktree before the quit, with the API key variables unset and a --verify-timeout (default 900 s). If it fails, finish sends the last 4 KB of output to the live implementer and runs the check again, up to --retries times (default 1, at most 3). The check's own file changes are excluded from the empty-diff check, but still show in changed and verify.dirtied. Run finish --verify with the Bash tool's run_in_background: a check plus a retry can outlast a foreground Bash call. - verify is null without --verify, otherwise {cmd, ok, exit, attempts, dirtied, retry_outcome, tail}. failures can add verify_failed, verify_unsafe and verify_retry_<outcome>. - verify_unsafe means the check did not run: the worktree is ~/.config/nixos, on main, or detached at origin/main. - While a finish holds the task, ask, converse and down (without --force) refuse with busy. Its own retry is exempt. - Archive. Teardown copies each member's answers to $XDG_RUNTIME_DIR/herdr-team/archive/<gen>/<member>/ and the log to archive/<gen>/conversation.jsonl. They stay until logout. - Containment (Issue #2835). up picks one of two modes and records it as containment in its reply and in the task's state file: - scope when the systemd user manager answers: the member runs in its own transient unit, herdr-team-<task>-<gen>-<member>.scope. Stopping the member stops the unit, which ends every process in it, including children that left the process group, dropped the marker or ignore TERM (killed after TimeoutStopSec, 5 s at the default time scale). The member keeps its PID, process group and tty. - group otherwise (or with HERDR_TEAM_NO_SCOPE=1): while the member's own process (the group leader, carrying its HERDR_TEAM_MEMBER marker) is alive, its whole process group is signalled. Once the leader is gone, only processes in that group that still carry the marker are signalled. A process that drops the marker or leaves the group is not stopped. - A scope that will not stop. Unless systemd confirms the unit is inactive after its stop, down and finish keep the member's record and list it under scope_stop_failed, and down exits 1. Run down again to retry; every up also retries it once the task has no live member. To see what is left:

systemctl --user status 'herdr-team-*'
  • Watchdog. A per-member watchdog ends the member (its scope first, then the process group) if the lead dies, or when the role's maximum is reached (8 h review, 3 h implement).

Claude agent teams

Inside herdr, claude is a bash/zsh function (set in home/development/herdr.nix) that runs herdr-claude-teams. It puts a tmux shim on PATH that turns Claude Code's tmux calls into herdr socket calls.

  • Each teammate opens in its own tab, right after the lead's tab, labelled ↳ <name>. The tab never takes focus, and the lead's tab layout is left alone: the shim resizes and renames only tabs and panes it created.
  • When the lead stops a teammate, that teammate's tab closes.
  • claude-swarm-reaper, a user timer that runs every 2 minutes, closes teammates that have been idle for 10 minutes.
  • Only panes and tabs the shim created are ever closed. They are tracked in $XDG_RUNTIME_DIR/herdr-claude-teams/*.owned.
# which teammate panes the shim owns for this session
cat "$XDG_RUNTIME_DIR"/herdr-claude-teams/*.owned

Configuration worth knowing

All of this lives in home/development/herdr.nix:

  • agent_panel_sort = "priority" turns the sidebar into an attention queue, so a blocked agent rises above idle ones instead of sorting by workspace.
  • [ui.toast] delivery = "system" hands notifications to the desktop service. The default, "herdr", only draws a toast while herdr is on screen — which means an agent blocked on a question goes unnoticed.
  • Sidebar rows are configurable per agent kind. Claude rows carry terminal_title_stripped, which is where Claude Code reports what it is currently doing, plus a $agents pane-metadata token fed by the managed PreToolUse/PostToolUse hooks in modules/programs/claude-code-managed.nix — the live subagent count, since the subagents themselves can never be rows.
  • scrollback_limit_bytes = 50000000, because Claude Code outruns the 10 MB default.
  • [experimental] pane_history = true keeps pane screens across server restarts.
  • [update] version_check = false. The binary is read-only in the Nix store and tracked by a flake input; left enabled, herdr would poll for updates and offer to install a binary the next deploy silently reverts. manifest_check stays on, since that only refreshes agent-detection data. Bump with nix flake update herdr.

Apply a config change with herdr server reload-config after the deploy, and validate with herdr config check — note that it does not validate theme.name, which accepts arbitrary strings, so a typo there passes silently.

Gotchas

  • herdr --help and each bare command group (herdr agent, herdr pane) are the authority on syntax, not the docs — the installed binary here is two minor versions ahead of the checked-out repo's documentation.
  • Do not run bare herdr from inside a pane: it launches or attaches the TUI, and nested launches are blocked by design. Check with test "$HERDR_ENV" = 1.
  • Prefer --current or an explicit pane ID. Omitting a target may act on the UI-focused pane, which can belong to another client.
  • An agent running on the terminal's alternate screen loses rows to nowhere — they never reach herdr's host scrollback, so raising --lines cannot recover them. Ask the agent to write its output to a file instead.
  • Never herdr server stop from an active session unless you mean to kill every pane process with it.

Herdr app (herdr-app + hc)

On p620 and razer the desktop app runs next to the TUI (issue 2978). The TUI is unchanged and stays the fallback. The app has its own extension model (gpui-kit mods), so the TUI plugins are replaced by app mods and app settings.

What is managed

home/development/herdr-app.nix declares everything; herdr-app-sync copies it into ~/.config/herdr-app on every switch and every window launch. The app owns that folder (it rewrites its shipped mods and writes its JSON), so nothing there is a store symlink.

Item Source Replaces in the TUI
layout freund clone of main 0.1.16 the TUI layout
layout tui, mod tui, and theme gruber-darker-renaissance kryptamine/herdr-tui-mode, pinned as a bundle the TUI sidebar, tabs, and prefix modes
freund-agents clone of agents + a controls popup (⋯ or right-click) herdr-radar's agent view
freund-tabs clone of tabs + a GitLab button + the window title —
inbox ours: GitHub + gitlab.com issues and PRs/MRs, assigned, authored or review-requested GitHub Start
issues jankeesvw/herdr-issues, pinned GitHub Start, per repo
gitlab rem-aster/herdr-gitlab, pinned —
notify ours: alerts go to notify-send; Open runs the alert's action [ui.toast] delivery = "system"
splits ours: ctrl/alt+hjkl through Neovim herdr-splits
reviewer herdr-reviewer + reviewr's turns, read-only git; diff line comments pasted to an agent reviewr
settings theme = "omarchy" (Omarchy keeps themes/omarchy.json current), sounds on [theme] name = "terminal"
hc config history_mb = 48, restore_screen = true, per-shell systemd scope scrollback, pane history, #2959

The window title is <machine or host>: <space>, set by freund-tabs. For a remote space it shows the machine name, not the remote's hostname. In other layouts it stays "Herdr".

New setups start with freund. Select tui in Herdr App 0.1.18 with herdr-app do layout.switch --name tui. The TUI sidebar takes its topic from tab titles formatted as 1 · <icon> repo › topic. Set those titles yourself to show the topic. Upstream title format

argv launches (menu agents, tab.new --argv, terminal.open, splits) skip hcShell and would share one hc-hold-* unit, so a bashrc guard (home/development/hc-argv-guard.bash) re-execs them into their own herdr-pane scope (#2959, #2987).

Keys

Key Action
ctrl+h/j/k/l move between panes and Neovim splits
alt+h/j/k/l resize (Neovim splits inside Neovim); replaces the app's alt = focus
ctrl+shift+g lazygit in a new tab (closes when lazygit exits)
ctrl+shift+y / ctrl+alt+shift+y zoetrope (zoe) right / in a tab
ctrl+shift+u open a worktree
ctrl+shift+i issues inbox
ctrl+shift+d diff review: comment on lines, paste them to an agent in the tab
ctrl+b (layout tui only) open the prefix hint for TUI commands, including resize and copy mode
ctrl+shift+p / ctrl+? command palette / key help (app defaults)
ctrl+shift+l cycle layouts

Diff comments

Issue #2981. ctrl+shift+d opens the reviewer mod beside changes. Select a diff line or range, write a comment, repeat, then send all comments in one paste into an agent in the same tab.

  • Scopes: Uncommitted, Branch, Last agent turn and one picked Commit. Each scope keeps its own drafts.
  • Paste only: the text is pasted into the agent's input and never submitted; press Enter there yourself.
  • A send is refused when the tab has no agent or the agent is not idle (working and blocked are refused with the status shown). With several agents in the tab, pick one in the dialog.
  • Drafts live in the app's shared state, per repo and scope, and survive closing the panel and restarting the app. Comments whose lines changed since they were written are labelled and sent with a note.
  • Confirmation is a screen heuristic: the mod compares the agent's screen before and after. If it cannot confirm the paste, the comments are kept and the review stays on the clipboard.
  • The clipboard is restored after a confirmed paste, as text only; an image or other clipboard content is lost.

Sync, backups and rollback

herdr-app-sync keeps a manifest in ~/.local/state/herdr-app-sync/ and installs a mod only after herdr-app check passes (layouts and themes are checked with jq). Anything it replaces, including a hand-edited managed mod and the previous settings.json / keys.json, goes to ~/.local/state/herdr-app-sync/backups/<time>/. Declared keys and settings win; everything else in those files stays yours. Logs: journalctl --user -t herdr-app-sync.

To leave tui immediately, run herdr-app do layout.switch --name freund. For a configuration rollback, revert the TUI declaration and reactivate the previous generation. Remove mods/tui, layouts/tui.json, themes/gruber-darker-renaissance.json, and the ctrl-b entry under layout:tui in keys.json. Remove the corresponding entries from the sync manifest and restore matching backups if present. When restoring a backed-up keys.json, restore only the previous value of that binding.

To undo it on a host: remove ~/.config/herdr-app-sync/source and close the app, delete the managed items that have no backup, copy the backups back (oldest first), delete manifest.json, and start the app. ctrl+alt+shift+esc always returns the app to its default layout and keys.

Omarchy bar widget

The nixarchy.herdr bar widget (nixarchy-herdr 1.1.0, pinned through nixarchy) shows herdr-app agents next to classic Herdr sessions:

  • An app agent is a live hc terminal that reports a status. Each herdr-app space is one row; agents on other machines show in the menu only, never in the bar counts.
  • On an app row, Enter focuses the agent (opening the window if needed), a sends it a prompt, i interrupts it and K ends it after a confirmation that names every sub-agent ending with it.
  • "Done" follows herdr-app's own seen-turn label, so a finished turn you have not looked at stays visible with the window closed. An error while the window is closed counts as blocked.
  • When herdr-core cannot be reached the rows read "not live" and the badge carries a ! mark, while classic session counts stay visible. A failed list is retried a few times, then waits for the next event.

New bar code loads after omarchy-restart-shell (a plugin reload keeps the old QML types) or a logout and login.

Known gaps

Gap Issue
hintr's run-a-listed-key: use the palette (ctrl-shift-p), which lists and runs commands with their keys; mod commands (lazygit, zoetrope) are not in it #2982 (won't fix)
Collie is not wired to hc #2985
lazygit opens as a tab, not a float #2986
herdr-team's provider-error scan can match its own source on screen #2988
an hc command before login can still start a core with a dirty environment (see below) #2989

hc keeps the environment of whoever started it first

The core saves the environment of the process that first started it and reuses it across hc server restart and updates. If that was a herdr TUI pane or a Claude session, every app terminal inherits HERDR_ENV=1 and that session's variables, and claude() / herdr-team then act as if they were in the TUI. Plain app shells drop those variables (hcShell in home/development/herdr.nix), and argv launches drop them too, through the guard in interactive bash with a user bus. That cleans identities in shells, not credentials or the core's own saved environment.

hc-core-ensure (package pkgs/hc-core-ensure) keeps the core's environment clean. It re-runs itself through systemd-run --user, so the work happens in the user manager's environment, and it never fails the caller:

  • login (the hc-core-ensure user unit, once per graphical session): restarts a running core with hc server restart --fresh, or starts one.
  • launch (every herdr-app window launch, before the sync): starts the core only if it is not running.

The unit refuses manual starts and is not restarted by a Home Manager switch. Its journal lines are in journalctl --user -t hc-core-ensure. To repair a polluted core by hand, from any shell:

hc-core-ensure login

Limit: an hc command run before login, or after the core exits and before the next app launch, can start a core from a dirty environment. It stays that way until the next login.

Bumping herdr-app or herdr-core

  1. Version and sha256 from https://releases.herdr.dev/{app,core}/latest.json.
  2. No herdr-app.svg beside the binary (that keeps the self-updater off).
  3. Diff the new default keys.json (herdrdev/herdr-app, defaults/keys.json at the tag) against ours.
  4. Re-clone tabs → freund-tabs and agents → freund-agents and re-apply the changes listed in each mod's NIXOS.md.
  5. Check the inbox, the GitHub and GitLab panels, notifications, ctrl/alt+hjkl and the agent controls.