herdr
Control Herdr, a terminal multiplexer for coding agents. Use proactively for pane-based delegation, parallel work, and terminal control when running inside Herdr. Requires HERDR_ENV=1.
SKILL.mdskills/herdr/SKILL.md
GitHubHerdr
Herdr is a terminal multiplexer and runtime for coding agents. It organizes terminals into workspaces, tabs, and panes, detects agent identity and status, and exposes the running session through the herdr CLI.
Before issuing any control command, check that this agent is running inside a Herdr-managed pane:
test "${HERDR_ENV:-}" = 1
If the check fails, say that you are not running inside Herdr and stop. Do not inspect or control the focused Herdr session from outside Herdr.
When the check passes, the herdr binary in PATH talks to the running session. Use it to inspect neighboring work, create isolated terminal contexts, start agents and commands, read their output, and wait for state changes.
Tools-first execution
When the herdr_layout, herdr_pane, and herdr_agent tools are available in the toolset (the @ogulcancelik/pi-herdr extension), prefer them for the actions they cover: inspecting and creating layout, running commands in panes, waiting for output, and controlling recognized coding agents with lifecycle settlement. They wrap the same CLI with validated schemas, structured error codes, and bounded output.
Keep using the CLI via bash for what the tools do not expose: discovery (herdr --help, command groups), worktrees, notifications, sessions, integration, config, and raw terminal edge cases. The installed binary remains the authority for command syntax.
Coordination, not orchestration policy
Use the active harness’s configured delegation workflow to choose helpers and models. This skill controls Herdr layout and native agents; it does not mandate Shepherdr, pi-subagent, a model tier, or a new workspace. If an orchestrator owns a worker, communicate through that orchestrator rather than sending raw terminal input.
Parallel agents may intentionally share a worktree. Inspect neighboring task context and coordinate file ownership before overlapping edits; unrelated changes are not a reason to stop or revert work. Read session records only as needed for the current task, and do not treat old transcripts as current ownership or authorization.
Learn the current CLI
The installed binary is the authority for command syntax. Begin with:
herdr --help
Then print the relevant command group by running it without a subcommand:
herdr pane
herdr workspace
herdr worktree
herdr tab
herdr wait
herdr terminal
herdr notification
herdr integration
herdr session
Do not run bare herdr for discovery; it launches or attaches the TUI. Do not probe a mutating nested command by omitting arguments; some commands, including herdr workspace create, are valid with defaults and will execute. Use the command-group output above instead.
Most control commands print JSON. Read identifiers and state from those responses instead of predicting either one.
IDs and current context
Public IDs are short stable handles:
- workspace:
w1 - tab:
w1:t1 - pane:
w1:p1 - terminal:
term_...
The encoded suffix can contain letters and can grow beyond one character. Treat every ID as an opaque string.
Closed tab and pane IDs are not reused and do not retarget later resources. A pane moved into another workspace receives a new public pane ID. Re-read create, split, move, list, or get responses after mutations; never construct an ID from a workspace or display number.
Herdr injects the caller's stable context into every managed pane:
printf '%s\n' "$HERDR_WORKSPACE_ID" "$HERDR_TAB_ID" "$HERDR_PANE_ID"
Prefer --current when a pane command should target the calling pane. Omitting a target can use the UI-focused pane, which may belong to the user or another client.
Discover live state with:
herdr workspace list
herdr tab list --workspace "$HERDR_WORKSPACE_ID"
herdr pane current --current
herdr pane list --workspace "$HERDR_WORKSPACE_ID"
Control agents through panes
An agent runs inside a pane. Use the pane ID as the control target for agents, shells, servers, tests, and logs. This keeps spawning, input, reads, waits, and cleanup on one stable control surface.
Use workspace and tab commands for organization. Use worktree commands only when you intentionally want Herdr to create, open, or remove a Git checkout.
Pane records expose agent, agent_status, and native session metadata when available. Agent status is idle, working, blocked, done, or unknown.
idle and done are the same underlying semantic state with different attention state:
idle: the agent is waiting and its result is considered seen.done: the agent finished and its result has not been seen.
An agent that first opens at its prompt reports idle, including in a background pane. After a working or blocked agent completes, it reports done when its tab or workspace is in the background. It reports idle when it completes in the active tab while the foreground client is focused. If the foreground client is explicitly unfocused, completion can become done even in the active tab.
Focusing a pane, switching to its tab, or regaining outer terminal focus marks the visible tab as seen, so done becomes idle. Switching away does not turn an existing idle status into done; done is created by a later completion while the pane is unseen. With no foreground client, a new completion in the globally active tab is treated as seen while completions in background tabs still become done.
Start agents interactively
Default to a sibling pane in the current tab and current working directory. Do not create a workspace, tab, worktree, or different cwd unless the user explicitly requests that topology or location.
Honor a direction requested by the user. Otherwise inspect the caller pane's current rectangle:
herdr pane layout --pane "$HERDR_PANE_ID"
Split a wide pane to the right and a narrow or tall pane down. Avoid repeated same-direction splits that would create unusably narrow columns or short rows. Keep the user's focus in the calling pane:
herdr pane split --current --direction right --no-focus
Replace right with down when the layout calls for it.
Read the opaque pane ID from the split response. When tools are available, start the requested native agent with herdr_agent start, then use herdr_agent prompt, wait, and read for its conversation. Use herdr_pane only for ordinary commands, not agent prompts.
For CLI-only environments, discover the installed agent command group with herdr agent --help and use its start, prompt, wait, and read operations. Do not substitute pane run for agent lifecycle operations when those are available; never invent unsupported syntax.
Treat idle and done as ready states, blocked as requiring inspection or input, and unknown as uncertain. Settlement means a turn ended, not that the assignment succeeded. On timeout, inspect status and recent-unwrapped output before deciding whether to wait, follow up, or report a blocker. Preserve transcripts and only close task-owned workers once no work or question remains.
Run an ordinary command in another pane
Split the calling pane using the same geometry rule without moving the user's focus:
herdr pane split --current --direction right --no-focus
Read the new pane_id from the JSON response, then run and inspect the command:
herdr pane run <returned-pane-id> "just test"
herdr wait output <returned-pane-id> --match "test result" --timeout 120000
herdr pane read <returned-pane-id> --source recent-unwrapped --lines 120
Inspect existing output before waiting for future output. A wait timeout exits with status 1.
Use the read source that matches the task:
visible: the current rendered viewportrecent: recent scrollback as rendered, including soft wrapsrecent-unwrapped: recent scrollback with soft wraps joined; prefer it for logs and transcriptsdetection: the bottom-buffer snapshot used by agent detection
Use --format ansi when colors and terminal styling are evidence. Otherwise use text.
If the user explicitly asks for another tab, workspace, or worktree, discover that command group and use returned IDs. Do not infer a larger topology from a request to start an agent or command.
Safety and coordination rules
- Use
--no-focusfor background work unless the user asked to switch context. - Use
--currentor an explicit ID. Do not rely on another client's focused pane. - Parse IDs from JSON responses. Do not derive them from sidebar order or examples.
- Inspect before waiting. Read current output first, then wait for the next state or output you expect.
- Do not close workspaces, tabs, panes, or sessions you did not create unless the user explicitly asked.
- Never run
herdr server stopfrom an active session unless the user explicitly intends to stop the server and its pane processes. - Never kill the main Herdr process. Use named test sessions for experiments that need an isolated server.