Skip to main content

Herdr

@magistr/herdrv2026.08.19.1· 3d agoMODELS
01README

Drive a herdr terminal-agent runtime from swamp.

herdr (https://herdr.dev) is a terminal multiplexer built for AI coding agents: a background server owns persistent workspaces → tabs → panes, recognises the agent running inside each pane, and exposes the whole tree over a local Unix socket. This model turns that fleet into swamp data and swamp methods.

Model:

  • @magistr/herdr — one instance per herdr server: the local one (default session, a named session, or an explicit socket path), or a server on another host reached over ssh by setting sshHost. The transport is the only difference — every method below works identically against either.

    Observe:

    • status — client/server versions, protocol compatibility, socket in use and the named-session inventory. A stopped server is reported, not thrown.
    • snapshot — the whole session in ONE socket round-trip: a fleet roll-up (workspaces, tabs, pane count, per-state agent histogram) plus one agent resource per agent. Filter by workspace id/label and by agent state.
    • read — capture a pane's or agent's output (visible screen, scrollback tail, or the agent classifier's own detection buffer), bounded by maxOutputBytes and tagged with its pane/tab/workspace.

    Drive:

    • prompt — submit a prompt to many agents in one run, optionally waiting for each to settle.
    • wait-agent — block until agents reach a state (idle/blocked/done).
    • start-agent — launch an agent of a given kind in a pane.
    • send-keys / send-text / run-command — key presses, literal text, and submitted shell commands, fanned out across panes.
    • wait-output — block until a pane's output matches a string or regex.

    Shape:

    • create-workspace, create-tab, split-pane, create-worktree, close, notify.

    Server and sessions:

    • server-stop, server-reload-config (validates config.toml first), server-live-handoff, session-stop, session-delete.
    • agent-manifests, update-agent-manifests (reports exactly which agents moved), reload-agent-manifests.

Idempotent by construction: every mutating method reads herdr's state first. close on a missing id is a recorded no-op; create-workspace, create-tab and create-worktree reuse an existing container with the same label/branch; start-agent leaves a pane that already hosts an agent running. Re-running any method is safe.

Safe to run from inside the fleet it manages: swamp normally executes in a herdr pane, so the model reads herdr's own HERDR_PANE_ID / HERDR_TAB_ID / HERDR_WORKSPACE_ID to refuse to close the terminal issuing the command and to skip the caller when a prompt fans out (an agent prompting itself would wait on its own turn forever).

Transport is the herdr CLI over Deno.Command — never a shell — so every label, prompt and command travels as one literal argv element. Ids and key names that would be read as flags are refused before anything is sent. Over ssh a remote shell is unavoidable, so every argument is POSIX-quoted and the quoting is proved against a real /bin/sh in the property suite.

02Models1
@magistr/herdrv2026.08.19.1extensions/models/herdr.ts

Resources

status(infinite)— herdr client/server health: versions, protocol compatibility, socket path and named sessions
fleet(infinite)— Whole-session roll-up: workspaces, tabs, pane count and every agent with its state
agent(infinite)— One agent in one pane: kind, state, cwd, terminal title and the agent's own session id
output(infinite)— Terminal text captured from a pane or agent
action(infinite)— Outcome of a control method, one row per target, with what changed and what was skipped
container(infinite)— A workspace, tab, pane or worktree that a method created or reused
manifests(infinite)— Agent-detection manifests in force on the server: per-agent version, source and staleness
03Previous Versions1
2026.08.08.1

2026.08.08.1

Server lifecycle, and an ssh transport so all of it works against a herdr on another host.

Added

  • SSH transport. Setting sshHost points the whole model at a remote herdr server; every existing method works unchanged against it. New global arguments: sshHost, sshUser, sshPort, sshIdentityFile, sshExtraArgs, remoteBinary. ssh is invoked with BatchMode=yes and ConnectTimeout=10 so an unattended run never blocks on a prompt; caller options are placed first, which is what makes them win.
  • Eight server/session methods: server-stop, server-reload-config, server-live-handoff, agent-manifests, update-agent-manifests, reload-agent-manifests, session-stop, session-delete.
  • New manifests resource — per-agent detection-manifest version, source (bundled vs remote), and any manifest herdr rejected with a warning.
  • status now also reports target / remote (which server it talked to) and configOk / configDetail from herdr's own config check.

Changed

  • update-agent-manifests reads the current versions before updating, so its changedAgents names exactly which agents moved. herdr's own output reports only the post-update state, which cannot answer "did anything change?".
  • server-reload-config refuses to reload a config.toml that fails validation, rather than pushing a broken config into a live fleet.

Security

  • Over ssh a remote shell is unavoidable, so every argument is POSIX single-quoted with no "looks safe, skip it" fast path. The quoting is proved by round-tripping through a real /bin/sh in the property suite — a hand-written decoder could share a blind spot with the encoder.
  • The self guard does not fire against a remote fleet. HERDR_PANE_ID names a pane on the LOCAL server, and herdr numbers panes per session, so a local w1:p4 and a remote w1:p4 are unrelated panes that share a string. Matching there would refuse legitimate remote closes and silently skip legitimate remote prompts.
  • server-stop refuses to stop a LOCAL server that hosts the pane running the method; session-stop / session-delete refuse the session in use. session-delete also refuses a still-running session unless forced.
04Stats
A
100 / 100
Downloads
3
Archive size
54.0 KB
  • Has README or module doc2/2earned
  • README has a code example1/1earned
  • README is substantive1/1earned
  • Most symbols documented1/1earned
  • No slow types (deprecated)1/1earned
  • Dependencies pass trust audit2/2earned
  • Has description1/1earned
  • Platform support declared (or universal)2/2earned
  • License declared1/1earned
  • Verified public repository2/2earned
05Platforms
06Labels