/comitatus:herdrfrom comitatus
Use when running inside herdr (HERDR_ENV=1) to manage its worktrees, workspaces, panes, coding agents, messages, or state, or to launch, brief, message, or coordinate a herd of agents.
Ships in comitatus. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Before using this skill, check that HERDR_ENV=1. If it is not, say you are not running inside a herdr-managed pane and stop. Do not inspect or control herdr from outside it.
herdr is a terminal multiplexer for coding agents. The herdr binary is on your PATH and talks to the running herdr over a local socket. This skill uses only native herdr and git commands. There is no helper script.
| Layer | Owns |
|---|---|
| herdr | Terminal input, agent identity, startup, readiness and state waits, prompt submission and its serialization |
| git | Branches, worktrees, fetches, merges |
| this skill | Native command usage, transport behavior, and the message protocol |
For flags, run herdr <family> --help (for example herdr agent prompt --help). The help text is authoritative and this skill does not repeat it.
Supported herdr: 0.9.5 or later. The skill relies on these native behaviors:
agent prompt rejects a blocked agent with agent_blocked before typing anything.agent prompt queues the text and Enter as one submission per terminal, so concurrent prompts do not interleave.agent prompt --wait reports agent_prompt_stalled when no activity follows.agent start waits for interactive readiness.tab create --env sets environment variables for the launched process.Check the version with herdr --version.
The message protocol, briefing template, membership and withdrawal rules are in reference/protocol.md. Read it before messaging another agent.
| Task | Command |
|---|---|
| Who is running, and where | herdr agent list (JSON: name, workspace_id, agent_status, pane_id, cwd) |
| One agent | herdr agent get <handle> |
| Why an agent reads as that state | herdr agent explain <handle> |
| Worktrees and the main-checkout workspace | herdr worktree list --json |
| Workspaces, tabs, panes | herdr workspace list, herdr tab list --workspace <ws>, herdr pane list --workspace <ws> |
| Send one message | herdr agent prompt <handle> "<one line>" |
| Wait for a state | herdr agent wait <handle> --until idle --until done --timeout <ms> |
| See what an agent shows | herdr agent read <handle> --source recent-unwrapped --lines 40 |
| Wait for output | herdr pane wait-output <pane> --match "<text>" --timeout <ms> |
| Rename an agent | herdr agent rename <handle> <new> |
| Close one agent, or a whole workspace | herdr tab close <tab>, herdr workspace close <ws> |
Take every id from a command's JSON response or a fresh list. Ids such as w8, w8:t1 and w8:p1 are not durable, so never reuse an old one.
herdr nests repo -> worktree -> workspace -> tab -> pane -> agent.
workspace create --cwd workspace has no repo association and floats ungrouped.herd command. A herd usually lives in one workspace, and the briefing names that workspace.agent start <handle>. herdr enforces global uniqueness and rejects a duplicate with agent_name_taken.agent_status is one of idle, working, blocked, done or unknown, detected by herdr.
idle; Codex can settle in done.done means finished, with output not yet viewed in the UI. A CLI agent read does not clear it.blocked means herdr detected a modal or permission prompt./tmp becomes /private/tmp. Compare resolved paths when filtering by cwd.worktree create targets the session's home repo and must run with the main-checkout workspace as its source.Handles are globally unique. A later agent rename does not update the tab
label; herdr tab rename is a separate operation. Naming style and roles belong
to the consuming project.
Each step's input comes from the previous step's output. Run them as separate commands.
Check the handle is free. Run herdr agent list and confirm no agent has that name.
Create its tab in the target workspace:
herdr tab create --workspace <ws> --cwd <path> --label "jay ◇" --no-focus
Take result.tab.tab_id and result.root_pane.pane_id from the response. Add --env KEY=VALUE per variable when the agent needs one, for example --env BEADS_ACTOR=jay or --env CODEX_HOME=<path>.
Start the agent in that root pane. Arguments after -- go to the agent CLI unchanged:
herdr agent start jay --kind codex --pane <root-pane> --timeout 45000 -- --no-daemon --model gpt-6.1-sol
Success means herdr detected the expected agent in that terminal and found it ready for input. herdr already retries the shell-initialization race on Unix.
Wait for a settled state when your next step depends on it:
herdr agent wait jay --until idle --until done --timeout 45000
agent start can accept an interactive Codex whose state is still unknown. This wait is the stricter check.
Read before the first message on an unattended Codex launch: herdr agent read jay --source visible. A Codex menu can read as idle while it owns the keyboard. Two have been seen:
herdr agent send-keys jay 2 skips the update.Escape to continue without trusting.Do not send keys to a menu you do not recognize; ask the human.
Brief the agent with the template in reference/protocol.md. The agent is not part of the herd until its reply arrives.
Nothing is enforced; append what you choose after --.
1.x defaults. The old up.js passed these automatically. Pass them yourself to keep that behavior:
| Kind | Arguments |
|---|---|
| claude | --model claude-opus-5-5 |
| codex | --no-daemon --model gpt-6.1-sol |
| opencode | none: -m <provider/model> was always required |
Opt-in examples. 1.x never passed these by default. Effort and permissions were inherited from each CLI's own config unless asked for:
| Kind | Examples | Notes |
|---|---|---|
| claude | --effort high, --permission-mode <mode>, --add-dir <second-checkout> | Effort levels: low, medium, high, xhigh, max. Org-managed settings can pin a model, which makes --model the only lever. |
| codex | -c model_reasoning_effort=high, -c sandbox_mode="<mode>", -c approval_policy="<policy>", --add-dir <second-checkout> | Codex has no effort flag; use -c. --no-daemon does not stop codex queue from reaching the session. |
| opencode | Run herdr integration install opencode once, or its status waits are unreliable. |
A permission mode, sandbox or approval setting changes what the agent may do unasked. Choose one per task; it is not a compatibility default.
The CLI validates its own arguments. Nothing checks for a setting you passed twice, so the agent CLI decides which one wins. tab create --env accepts later duplicates, which replace earlier ones.
Do not put secrets in --env or in launch arguments. They appear in your command line, in your transcript, and in any error herdr prints. Give the agent secrets through its own config or a local .env file it reads.
herdr agent list and confirm none of the planned handles is taken, before anything is created.git remote lists remotes. A base such as origin/main whose first segment is a remote needs git fetch origin main. A slash alone does not make a base remote: task/my-slug is a local branch, so it needs no fetch.herdr worktree list --cwd <your cwd> --json, then read result.source.source_workspace_id. This works from the main checkout or from inside a linked worktree.herdr worktree create --workspace <source-ws> --branch chore/my-slug --base origin/main --no-focus --json
Take result.worktree.path, result.worktree.open_workspace_id and result.tab.tab_id, the root shell tab.herdr tab close <root-tab>.This is not transactional. If a step fails:
herdr worktree list --json and herdr agent list.Never relaunch blind. A half-finished launch can hold a handle, a tab or a worktree.
For an existing branch, the commands differ:
herdr worktree open --branch <b> --no-focus --json.git worktree add <path> <b>, then herdr worktree open --path <path> --no-focus --json.A timeout or stall does not establish non-delivery; inspect the native result using the table in reference/protocol.md. Idle/done state does not establish that a particular request was processed. Native terminal prompts are not a durable message store; the mail skill supplies durable mailboxes. The project owns file ownership, integration, and completion.
herdr tab close <tab>
herdr workspace close <ws>
herdr worktree remove --workspace <ws> --json
git branch -d <branch>
herdr tab close <tab> closes one agent.herdr workspace close <ws> closes every agent in a workspace.herdr worktree remove removes the worktree, its directory, its workspace and all its tabs. It keeps the branch; git branch -d deletes it.--force off. git worktree remove refuses a dirty tree without it, and git branch -d refuses an unmerged branch.To reassign a herd to another worktree, relaunch it there, since cwd is fixed at launch. Close the old workspace first so the handles are free, then brief again. Relaunched agents are cold.
Removing the helper does not remove approvals. Every native command needs its own grant. Each harness grants commands differently:
/herd-setup. It adds one allow rule per safe native verb.
herdr agent start, herdr pane run and herdr pane send-keys prompting. Launch arguments after -- can carry permission-bypass flags, so each launch is a human approval.PermissionDenied / Operation not permitted. That is a sandbox failure, not an approval rejection, and it does not mean a rule is missing. Request the native command outside the sandbox: set sandbox_permissions to require_escalated with a one-line justification, in a form a prefix rule can match. Codex checks each command of a simple shell script against its rules, but treats a script with redirection, $(...) or variable assignments as one command. A matching allow rule then runs it without a prompt; otherwise Codex asks for approval through its own prompt, so do not ask in chat first.
forbidden rule blocks it, stop that action and tell the human the command and the reason. Do not wrap it in another script to get past the denial, and do not change sandbox or approval settings.$CODEX_HOME/rules/default.rules let these requests run without a prompt; only the human adds them. A member needs only the messaging and observation verbs:
prefix_rule(pattern=["herdr", "agent", "prompt"], decision="allow")
prefix_rule(pattern=["herdr", "agent", "list"], decision="allow")
prefix_rule(pattern=["herdr", "agent", "get"], decision="allow")
prefix_rule(pattern=["herdr", "agent", "read"], decision="allow")
prefix_rule(pattern=["herdr", "agent", "wait"], decision="allow")
A launcher may also need ["herdr", "tab"], ["herdr", "worktree"] and ["herdr", "workspace"].Weak local models also need an explicit instruction to run the commands as real shell commands and not print them.
worktree create does not fetch. --base origin/main resolves your local ref.agent prompt types and submits with the agent's own submit keys. It does not track turns. With --wait, an already-running turn can satisfy the wait.agent wait takes one --until per state. Without --until it matches idle, done or blocked, and without --timeout it waits forever.agent start needs a pane at a shell prompt. It takes the pane over and does not create one.blocked only covers modals herdr detects. An undetected menu reads as ready and swallows typed text. Read the pane when a send stalls.--source recent can come back empty while a pane is redrawing. Retry with --source visible, or use pane wait-output.worktree create and open from a linked worktree fail with linked_worktree_source unless you pass --workspace <main-checkout-ws>.cmd.exe.What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub flexion/claude-domestique --plugin comitatus4 skills in this plugin
/herd-setupUse when herdr or git commands trigger repeated permission prompts inside a herd, or when the user asks to allowlist, pre-approve, or stop being prompted for herdr verbs./mailUse when you need to find another Claude or Codex agent running on this machine, or send it a message, inside herdr or not./teamsUse when asked to send, post, read or reply in a Microsoft Teams chat or meeting chat, including agent-to-agent messages across machines, or when the Microsoft 365 connector's `teams_send_chat_message` fails for lack of the `ChatMessage.Send` scope. Sends go through `pwsh` with `Microsoft.Graph.Authentication`; reads can use the connector. The user supplies the chat and the tenant ID.