Skip to content

Splitting Coding Agents by Role and Repository with herdr

Interactive Diagram

새 탭 ↗

If one coding agent handles every repository and every role, at some point a human can no longer follow what was changed and how far. This post covers three setups that split agents by repository boundary and by role, and the problems found along the way.

  • One Claude Code session per repository in internal platform work, with sessions exchanging requests
  • Separate builder and reviewer sessions in a personal project (a shopping mall refactoring)
  • A local Mac agent (OmO) and a cloud VM agent (Poppy) handing work to each other

The common tools are Claude Code and herdr. The herdr versions are 0.9.5 locally and 0.9.0 on the remote. That gap causes one of the problems later on. herdr command descriptions are limited to what I confirmed from --help output on each machine and from the official herdr docs (agent-guide.md on herdr.dev and the pages linked from llms.txt).

herdr is a terminal workspace manager for AI coding agents. Like tmux, a background server owns the real terminal processes and clients only attach and detach, so agents inside panes keep running when the terminal closes or SSH drops.

It has four levels.

  • session: a background server namespace. Most people use only the default session.
  • workspace: a container for one repository or task. The sidebar rolls agent states up per workspace.
  • tab: a layout inside a workspace.
  • pane: a real terminal, addressed by an ID such as w1:p2.

What sets it apart from tmux is that it recognizes coding agents running inside panes. For supported agents such as Claude Code, Codex, OpenCode, Pi, and Hermes Agent, herdr decides the state either by reading the bottom of the pane against rules or from reports sent by the agent itself. There are five states: idle, working, blocked, done, and unknown. The official docs say blocked is deliberately strict. herdr only marks blocked when the screen matches a known approval, question, or permission UI, so an unfamiliar prompt can show up as idle. An idle label is therefore not permission to type into the pane.

I use herdr for that state information and for its CLI. A person looks at the sidebar to see which agent is waiting. An agent uses the CLI to ask another agent’s state, submit a prompt, and read its screen.

These are the herdr agent subcommands that became routine. Each target accepts a pane ID or an agent name.

Terminal window
herdr agent list # all agents on this server and their states
herdr agent get w1:p1 # one agent: agent, agent_status, and more
herdr agent read w1:p1 --lines 80 # read the pane's screen text
herdr agent prompt w1:p1 "..." --wait
herdr agent wait w1:p1 --until idle --timeout 600000
herdr agent rename w1:p1 reviewer
herdr agent send-keys w1:p1 esc
herdr agent explain w1:p1 # why the state was judged that way

Here is where each one came in.

  • agent list and agent get: check the other agent’s state before sending a request. Running agent get on the remote VM shows something like agent as hermes and agent_status as idle. If it says working, the agent is busy with something else, so I reconsider sending.
  • agent read: confirm on screen whether a prompt arrived and what the agent is doing. I used it most in the timeout case described below. --source picks one of visible, recent, recent-unwrapped, or detection, and the default is recent.
  • agent rename: give role names such as builder and reviewer. According to the official docs, names must match [a-z][a-z0-9_-]{0,31} and be unique among live agents. The name is an alias for the agent currently in that pane and is cleared when that agent exits. It does not permanently rename the pane.
  • agent send-keys: send keys such as esc or enter when the agent’s screen is stuck on a question or approval. When the target is blocked, agent prompt refuses without sending input, so this is the command for a deliberate response after reading that screen.
  • agent explain: look at the reasoning when the state display looks wrong.

The command most easily misunderstood is agent prompt --wait. At first I assumed it waited until my request was finished. The help text says something different.

--wait: Wait for the first matching state observed after submission
--until <STATUS>: State to match after --wait; possible values: idle, working, blocked, done, unknown
If the agent is already blocked, submission is rejected with agent_blocked before
any input is sent. When an accepted submission starts from another non-working
state, --wait requires an observed working or blocked state within 5000ms;
otherwise it returns agent_prompt_stalled. A caller timeout that expires first
returns timeout. It then matches idle, done, or blocked by default, or any exact
--until state. It does not track turns: if the agent is already working, that
active turn's completion may match.

This text was identical in the local 0.9.5 and remote 0.9.0 help. Laid out as a flow:

PlantUML Diagram

Two things matter here.

First, it does not track turns. If the target is already working when the prompt goes in, the end of the previous turn can be the ā€œmatching stateā€. A successful return does not necessarily mean my request is done. So I got into the habit of checking agent_status with agent get and sending only when it is idle.

Second, timeout is not a delivery failure. The input was written before the wait began; the caller simply did not see the desired state within its own time limit. A request I sent to the remote Poppy did end with a timeout while Poppy was already working on it. Sending the same request again would run the job twice. On a timeout I do not resend; I look at the screen with agent read first.

agent wait should be read the same way. Its help says ā€œWithout —until, matches idle, done, or blocked. Without —timeout, waits indefinitely.ā€ Without --timeout it waits forever, so scripts always pass one.

Deployment for the work cluster is split across Git repositories with different roles: an app deployment manifest repository, a cluster base configuration repository, another app’s manifest repository and so on. We ran one Claude Code session per repository, and each session changed only its own repository.

When a session decides another repository also needs a change, it does not edit it. It sends a request to the session that owns that repository through Claude Code’s inter-session messaging (the ListAgents and SendMessage tools). The receiving session makes the change and replies, and the requesting session then opens the other repository’s diff itself to confirm the change matches the request. Not trusting the reply text alone is the key.

PlantUML Diagram

Two real examples:

  • Changing the routing host meant the docs and comments in the cluster base configuration repository had to follow. The app manifest session sent a request, and the configuration repository session made the change and replied.
  • Responding to a security review required action in another app’s repository as well. The session for that repository was not open, so there was no one to receive the request. The human opened that session and then the request was sent. This approach assumes the receiving session is running.

Every session got the same rules.

  • A human does commit, push and Argo CD sync.
  • Agents check only up to kustomize build and kubectl apply --dry-run=server, and state ā€œnot committedā€ in every report.
  • Secret files are blocked from agents by permission settings. Agents do not work around this; they write out the command for a human to run instead.

The reason for ā€œnot committedā€ in every report is simple. With several sessions moving at once, it is easy for a human to lose track of what landed in which repository. Fixing the status in the report format makes it explicit that nothing reaches the cluster until a human commits.

For the shopping mall refactoring, a personal project, the split was by role. Two herdr panes each ran a Claude Code session, and each got a name.

Terminal window
herdr agent rename <pane-1> poppy-builder
herdr agent rename <pane-2> poppy-reviewer

When the builder needs a review, it puts a prompt straight into the reviewer pane.

Terminal window
herdr agent prompt poppy-reviewer "Please do the first review of docs/spec.md. Write results to docs/review/phase-1.md" --wait

The exact meaning of --wait is explained earlier in What agent prompt --wait waits for.

Work starts from documents, with a review at each stage.

PlantUML Diagram
  • Once the intent document is Ready, the builder writes spec, plan, tasks and ADR drafts.
  • The reviewer reviews, the builder applies the findings, and the reviewer reviews again.
  • Implementation starts only after a human approves the tasks. T1 through T13 are committed one task at a time.

The reviewer writes findings to docs/review/phase-N.md. Each finding has a number such as P1-01 and a grade of Major, Minor or Info. The first spec review found 3 Major, 6 Minor and 5 Info. The re-review confirmed earlier fixes and added 2 new Major findings.

Numbering kept conversations short (ā€œP1-03 fixedā€) and made it easy to track which findings were closed in a re-review.

One rule matters. If the builder only reports ā€œfixedā€, the reviewer does not close the item and records it as ā€œfix reported, not verified by reviewerā€. Actual verification happens at the next review by reading the diff. It is the same principle as the requesting session opening the diff in the per-repository setup.

While the builder worked on T8, the reviewer did an interim review of the already committed T1 through T7 in parallel. The reviewer does not only read code; it runs the build and tests itself. The tests use Testcontainers, so the reviewer side also needed Docker.

One catch from review: test code violated the project rule against Thread.sleep in tests. The part waiting for an asynchronous result was changed to a condition wait with Awaitility. Had the same session both written and reviewed the code, it would have been hard for it to see the sleep it had just written as a rule violation.

The builder and reviewer setup above started with a human relaying results between the two panes. To hand that job to the agents, the agents have to use herdr properly too. herdr ships a skill for exactly that.

The herdr skill is a single SKILL.md that agents such as Claude Code read. You can install it from the herdr repository (herdrdev/herdr) with a skill installer, and herdr --skill prints the version that matches the installed binary. It reads less like a command list and more like a set of rules, and much of it overlaps with the tips I worked out by hand in this post.

  • Before any control command, check that HERDR_ENV=1. If not, say that you are outside herdr and stop.
  • The installed binary is the authority for command syntax. Read herdr --help and the group help first. Plain herdr without arguments opens the TUI, so do not use it for discovery.
  • Read IDs and states from JSON responses. Do not guess them from sidebar order or examples.
  • Create background panes with --no-focus so the human’s screen is not taken over.
  • --wait waits for a state, not a turn. A timeout or agent_prompt_stalled does not prove the prompt was not delivered, so do not resend it as is; check agent get and agent read first.
  • idle and done do not guarantee that an unfamiliar approval screen was recognized.

Having the agent read the skill first makes these tips available before work begins. Its commands and results still need to be checked for compliance.

The herdr skill was installed under .agents/skills/herdr in the home directory, a location several agents share. That Claude Code session did not discover the skill at its installed location, so I linked it under ~/.claude/skills. That story is in herdr skill not showing up.

The version matters too. The SKILL.md installed in September (202 lines) differed from the herdr --skill output of the 0.9.5 binary (214 lines). The installed copy had no section on controlling remote machines with --machine, and lacked the caution that idle does not guarantee an approval screen was recognized. Update the skill when you upgrade herdr, or have the agent read the current version with herdr --skill.

When I said ā€œrename yourself in herdrā€, the builder session read the skill and renamed its own pane.

Terminal window
herdr pane rename "$HERDR_PANE_ID" builder-a
herdr agent rename "$HERDR_PANE_ID" builder-a
herdr agent list

herdr injects HERDR_PANE_ID into every pane it manages, so an agent can point at itself without knowing its pane ID. It left the neighboring reviewer pane alone, judging that each agent should name itself.

There are two separate names. Claude Code’s /rename only changes the terminal title and the session name used for cross-session messages. The name used by herdr agent prompt has to be set separately with herdr agent rename. That name disappears when the agent exits. After restarting sessions the next day the names are empty, so at session start I check names with herdr agent list and fix them first. Pane IDs are stable handles, but moving a pane to another workspace changes its workspace-qualified ID. After a move, use the new ID returned by the command or the live agent name. I record roles in notes and rediscover the current targets with herdr agent list before acting.

Once the names were in place, the builder requested reviews from the reviewer directly.

Terminal window
herdr agent prompt reviewer "Review request for phase-3 cart. Write the result to docs/review/phase-3-cart.md" \
--wait --until done --until idle --timeout 2400000
  • The reviewer runs builds and tests, so I set a 40-minute timeout. The command above records what I used at the time. For ordinary work, use --wait --timeout 2400000; the default matching states are idle, done, and blocked. The --until done --until idle flags above exclude blocked. Removing them also lets the wait return at an approval or question, so check the returned state and review file separately.
  • After writing the review file, the reviewer replies to the builder’s session name with Claude Code’s cross-session message. The builder reads the file, applies the fixes and asks again. No human relays in between.
  • Approving tasks and merging the implementation still belong to the human.

Once, after the reviewer was restarted, its name was gone and agent prompt failed with agent_not_found. An output filter hid the original exit status, making the command look successful. Automation should preserve both herdr’s exit status and its full output. Searching for error strings is useful for diagnosis, not as a substitute for checking success.

Terminal window
if output=$(herdr agent prompt reviewer "..." --wait --timeout 2400000 2>&1); then
rc=0
else
rc=$?
fi
printf '%s\n' "$output"
if [ "$rc" -ne 0 ]; then
exit "$rc"
fi

For the stage that builds services in parallel, I added three builders. Each builder owns one service (payment, cart, account) and works in its own worktree. The worktrees were also created with herdr.

Terminal window
herdr worktree create --cwd <repo> --base main --branch feat/cart \
--path ../shop-cart --label cart --no-focus

The skill says not to create a workspace or worktree the human did not ask for. Here the layout came from the human’s parallel development plan, so it meets that condition. The rules that came out of running it:

  • Give each builder its own worktree. When Gradle builds ran at the same time in one working tree, the build broke with NoSuchFileException.
  • Give every file that several builders touch a single owner: settings.gradle.kts, AGENTS.md, the service template document, asyncapi.yaml and the shared platform modules.
  • Commit documents (intent, spec, review) to the main checkout so the human can read them right away, and commit implementation to the worktree’s feat/<svc> branch. The human merges into main.

The skill only covers general herdr rules. Project rules, such as who uses which name, how the reviewer replies, and the worktree and file ownership rules, went into the repository’s CLAUDE.md (the ā€œparallel developmentā€ section) and Claude Code project memory. This gives freshly started sessions, and sessions whose conversations were compacted, a place to look up the same rules again.

The memory also got the line ā€œload the herdr skill before any herdr workā€. One session had been calling the CLI from memory without reading the skill. Having the skill installed does not guarantee that the agent reads it.

The third setup spans machines. OmO on a local Mac (an OpenCode-based agent) hands work to Poppy (a Hermes agent) on a cloud VM. This post itself was requested that way.

PlantUML Diagram

herdr offers three ways to work with a remote machine. Following the official docs:

  • SSH in and run herdr on the remote, the same way as tmux.
  • Attach the local UI to one remote session with herdr --remote <ssh-target>.
  • Save the remote with herdr machine add <ssh-target> --label <label> and see Local plus several remote machines together in the local sidebar.

I used the third. The help describes machine add as ā€œPrepare the remote Herdr server and save an SSH machineā€. It checks for a compatible herdr server on the remote and, if one is missing or incompatible, installs or replaces it after asking for approval before saving.

When local herdr attaches to a remote machine, it opens an OpenSSH ControlMaster connection. The options I saw were ControlPersist 600, BatchMode, and StrictHostKeyChecking yes, and the remote side runs herdr remote-client-bridge. The temporary SSH config file for this connection lives under the macOS temp folder as herdr-ssh-<pid>-<N>/config. Because the path contains the herdr process ID, it changes whenever the herdr process changes.

The 0.9.5 docs recommend a --machine prefix for remote automation, as in herdr --machine <label-or-id> agent list. Running that locally ended like this.

$ herdr --machine my-agent-vm agent list
remote Herdr does not support machine API forwarding; update Herdr on this machine

At the same moment herdr machine status showed the machine as reachable. The connection is alive, but remote 0.9.0 does not support --machine API forwarding. The remote 0.9.0 help shows more of the gap.

CommandLocal 0.9.5Remote 0.9.0
machine subcommandslist, status, reconnect, add, rename, remove, enable, disablelist, add, rename, remove, enable, disable
worktree subcommandslist, create, open, removelist, create, open, remove
agent prompt helpsame as the text abovesame as the text above

Remote 0.9.0 has no machine status or machine reconnect. The worktree command, which creates Git worktree-backed workspaces, exists in both versions.

Upgrading the remote herdr was an option, but replacing that VM’s herdr server means restarting the panes and agents on it. For now I reuse the SSH connection herdr already opened instead. I find herdr’s ssh command in the local process list, pull out the -F config file and the -S ControlMaster socket path, and use the two to run herdr agent prompt directly on the remote.

Terminal window
ssh -F "$F" -S "$S" -o BatchMode=yes my-agent-vm \
'herdr agent prompt w1:p1 "request body" --wait --timeout 60000'

Because it reuses an already authenticated connection, no new authentication is needed. It does depend on herdr’s internal paths, so once the remote is on 0.9.5 or later, moving to --machine is the right call.

That opened the path from local to remote. The other direction was the problem. The remote Poppy had no way to report results or ask the local OmO for something. I compared three options.

OptionWhat the remote getsDecision
pull: the remote writes files to an outbox folder and the local side reads them periodicallynothing, it only writes filesadopted
ssh -R reverse tunnel so the remote can reach local herdrcontrol over local panesrejected
turn on Mac Remote Login (sshd) and upgrade remote herdr for a two-way machine setupa login path into the local machinerejected

A reverse tunnel is the same as handing the remote agent the ability to type anything into local panes. Mac Remote Login was off at the time, and with VPN and NAT in the way it was unclear whether the remote could reach the Mac at all. It was also the most complex to set up.

The pull option gives the remote no permissions. The local side only reads the remote folder over the SSH connection it already has. When the local side needs to reply to Poppy, it puts the reply into the remote pane with herdr agent prompt again.

PlantUML Diagram

The local OmO runs this script as an always-on monitor at a 60-second interval. The remote host name has been replaced with a generic value.

#!/usr/bin/env bash
set -euo pipefail
HOST=my-agent-vm
STATE="${XDG_STATE_HOME:-$HOME/.local/state}/agent-outbox/seen"
mkdir -p "$(dirname "$STATE")"; touch "$STATE"
line=$(ps -ax -o command= | grep -E "^ssh .* -S [^ ]+ .*$HOST" | grep -v grep | head -1 || true)
[ -z "$line" ] && { echo "herdr SSH connection to $HOST not found" >&2; exit 2; }
F=$(sed -E 's/.* -F ([^ ]+) .*/\1/' <<<"$line")
S=$(sed -E 's/.* -S ([^ ]+) .*/\1/' <<<"$line")
ssh_r() { ssh -F "$F" -S "$S" -o BatchMode=yes -o ConnectTimeout=10 "$HOST" "$@"; }
files=$(ssh_r 'cd $HOME/omo-outbox 2>/dev/null && ls -1 -- *.md 2>/dev/null' | grep -E '^[A-Za-z0-9._-]+\.md$' || true)
new=$(comm -23 <(printf '%s\n' "$files" | sed '/^$/d' | sort) <(sort "$STATE"))
[ -z "$new" ] && exit 0
for f in $new; do echo "=== REQUEST $f"; ssh_r "cat \$HOME/omo-outbox/$f"; echo "$f" >>"$STATE"; done

Piece by piece:

  • Finding the connection: ps lists local processes, and the script picks the ssh command that has a -S socket option and the remote host name. That is the ControlMaster connection herdr opened. If none exists, the script exits with code 2 so the monitor can tell ā€œno connectionā€ apart. As noted above, the config path changes with each herdr process, so the script looks it up every time instead of hardcoding it.
  • F and S: the -F config file and -S socket path from that line. ssh_r connects with those two. With BatchMode=yes it never stalls waiting for a password.
  • Filtering file names: the remote ls output is filtered to .md names made only of letters, digits, dots, underscores, and hyphens. These names go inside a remote shell command on the next line, so the filter keeps an oddly named file from being interpreted as another command by the remote shell.
  • Choosing new files: the remote list and the local seen file are sorted, and comm -23 keeps names that exist only on the remote.
  • Read and record: each new file is printed with cat and its name is appended to the local seen file.

The design keeps three rules. The remote is only read, and the record of what has been read lives only on the local side. A remote file is never edited after it is written; additions go into a new file named YYYYMMDD-HHMMSS-slug.md. That way the file name alone tells whether content is new, with no need to compare modification times or contents. Finally, the remote agent gets no permission that reaches into the local machine.

In the reviewer session, the herdr skill did not appear in Claude Code’s skill list. The cause was that the skill was installed in a different path from where Claude Code looks. A symbolic link under .claude/skills in the home directory pointing to that path fixed it.

A prompt sent by herdr is not an agent protocol message like ACP. As the official docs describe, it writes text and Enter into the terminal, and from the receiving agent’s point of view it is the same as a person typing. Because it is not a structured message, the receiver is responsible for checking the content.

When I sent a long body over SSH, the tilde dropped out, and a time range written as 09:00 tilde 16:30 arrived as 09:16:30. I believe it was lost somewhere along the input path, but I did not confirm the exact cause. Since then I avoid the tilde in request text, and the receiver rechecks the original intent when a time or path value looks wrong.

The local OmO runs in a setup called OmO Native, and its actual engine is senpi. herdr recognizes that pane as the pi kind, and agent prompt --wait and agent read both work. The problem is that the sidebar shows the session name instead of the agent name.

pane report-metadata reports what its help calls ā€œdisplay-only pane metadataā€, with options such as --title, --display-agent, --clear-display-agent, --state-label STATUS=TEXT, and --token. Setting --display-agent by hand changes the name briefly, but it does not stick. Tracing the cause, I found that the herdr extension built into senpi reports both title and display_agent as the session name in reportTitle. So the display name follows every session rename, and a hand-set value is overwritten on the next report.

As of 2026-10-29, I have opened OmO issue #11397 and senpi fix PR #4582; the PR has not been merged. The one-line change, tests, change fragment, and CLI QA are recorded in the senpi contribution article. There was an earlier, separate issue about herdr being unable to put prompts into an OmO Native pane, but that was a prompt delivery problem and it is already closed. It is a different problem from this one.

With the VPN on, remote connections and uploads were restricted. On a day the connection dropped, herdr’s temporary SSH config file was gone, so the outbox script could not find the connection either. Having a separate exit code 2 in the script helped here. I check the connection state before sending a request.

  • Give agents names and repository boundaries. A name lets you address a request, and a boundary lets you answer ā€œwho changed this fileā€.
  • Let a session with a different context review. A session finds it hard to doubt its own decisions. The reviewer runs the build and tests itself.
  • Put human approval at every document stage. No implementation before tasks are approved, and a human does commit, push and sync.
  • Confirm delivery from the screen or a file. Reply text, a command’s exit code and a ā€œfixedā€ report are things to verify, not evidence. Check with something you can see directly: the diff, herdr agent read, the outbox file.
  • Check the target’s agent_status with agent get before sending. If it is working, the --wait result may be the end of the previous turn.
  • --wait and agent wait wait for states, not turns.
  • If local and remote herdr versions differ, commands in the docs may not work on the remote. Read the remote --help first.
  • For the reverse channel, a pull model that gives the remote no permissions was the simplest.
  • A prompt is keyboard input. Avoid fragile characters, and have the receiver recheck values.
  • Most of the tips above are already in the herdr skill. When handing herdr work to an agent, have it read the skill first, and since the installed copy may be older than the binary, check the current version with herdr --skill.
  • At session start, check names with herdr agent list. A name disappears when its agent exits.
  • Preserve herdr’s exit status and full output even when filtering the display. Searching for error strings helps diagnosis but does not replace checking success.
  • With several builders, give each its own worktree and decide who owns each shared file.