herdr
unix socket · 30+ methods · agents-can-scriptherdr is a Rust agent multiplexer — tmux's spiritual successor for AI coding agents. Persistent server + thin client, workspaces / tabs / panes (real PTYs), mouse-native, SSH-attachable, detects 11 agents via process name + screen-text heuristics, exposes a Unix socket API so agents-inside-herdr can spawn siblings and wait for output. 758 stars, AGPL-3.0, updated this week.
ainb is a Rust agent-session orchestrator + analytics TUI. Spawns Claude / Codex inside Docker containers, parses JSONL logs into a SQLite fingerprint cache, surfaces burndown / cost / token rollups across 30 days, manages git worktrees, recovers orphan containers. 89k LOC, 39 panels, 17 CLI subcommands.
ainb as the root process inside a herdr pane and get both. The interesting question is not "who wins" — it's which herdr ideas does ainb steal without losing its identity, and what does the AGPL license force us to clean-room?
This paper compares the two architectures, surfaces the 15 features herdr has that ainb doesn't, scores 4 candidate ports against the dimensions that actually matter (impact, effort, license safety, fit), and recommends a port order.
Architecture at a glance — two products, two layers, almost zero overlap on the data plane.
unix socket · 30+ methods · agents-can-scriptThe same axis projected onto each product. Where the two diverge is the answer to "what to port" and "what to leave behind".
| Axis | herdr | ainb |
|---|---|---|
| What is an "agent"? | Anything in a PTY — 11 detectors (claude · codex · pi · droid · amp · opencode · cursor · cline · kimi · copilot · gemini) | A Claude Code or Codex Docker session — 2 real providers + 2 stubs (copilot / gemini) |
| State source | Process detection + screen-text heuristic + optional hook push (real-time) | JSONL log polling + live-window file polling (~250 ms lag) |
| Isolation model | None — host shell process | Docker container per session |
| Persistence | Terminal scrollback + BSP layout snapshot (format v3) | JSONL append log + SQLite fingerprint cache |
| Concurrency model | Server + thin client · detach/reattach · SSH-able · named sessions | Single-process TUI · background containers |
| UI primitive | Tiled workspaces / tabs / panes · mouse-native | Session list + detail panels · 39 screens |
| API surface | Unix socket · 30+ methods · 3-layer (raw / CLI / agent SKILL) | clap CLI + JSON export only · no agent-callable API |
| Analytics | None (intentional — herdr is a window manager) | First-class burndown · cost · token · per-project rollup |
| Worktree | None — workspace = cwd | First-class git2 worktree manager · create / delete / branch |
| Self-update | website/latest.json + in-app update flow | brew tap (no in-app) |
| License | AGPL-3.0 — copyleft, source-copy taints | non-copyleft (port concepts, never paste) |
| Surface size | ~400k+ chars · large flat modules (cli.rs 47k, headless.rs 114k, detect.rs 49k) | ~89k LOC · 39 components · deep submoduling |
Six dimensions, weighted. Used to score the four candidate ports in §05. Weights skew toward impact and effort — license safety is low-weight only because every port is concept-port (never source copy), so safety is enforceable at PR review.
Four high-signal ports, distilled from the 15-row matrix in §06. Each one re-implements a herdr idea from concept (README / SOCKET_API / INTEGRATIONS) — no GPL source copy.
15 herdr features × ainb status × value × effort × license risk × recommendation. HAVE = ainb has equivalent. PARTIAL = weaker version. MISSING = nothing. Effort: TRIVIAL ≤ 1d · EASY 1–3d · MEDIUM 1–2w · HARD > 2w. Every entry assumes concept port, not source copy.
| # | herdr feature | ainb status | Value | Effort | License | Recommendation |
|---|---|---|---|---|---|---|
| 01 | Hook-based real-time state forwardingUserPromptSubmit→working · PermissionRequest→blocked · Stop→idle | PARTIAL | HIGH | EASY | SAFE | DO — Port A · next sprint |
| 02 | Unix socket API for agents controlling the toolworkspace.list · pane.read · wait agent-status | MISSING | HIGH | MEDIUM | SAFE | DO — Port C · read-only first |
| 03 | Process+screen heuristic detection for 11 agentspi · droid · amp · opencode · cursor · cline · kimi · gemini · copilot | MISSING | MEDIUM | MEDIUM | CARE | DO selectively — gemini + amp first |
| 04 | Notification sounds + toaststab-aware suppression · OSC delivery | MISSING | MEDIUM | EASY | SAFE | DO — Port B · pairs with hooks |
| 05 | Live config reloadherdr server reload-config · no restart | MISSING | LOW–MED | EASY | SAFE | MAYBE — only if config edits get common |
| 06 | Hook-installer command patternainb integration install claude/codex/... | MISSING | HIGH UX | TRIVIAL | SAFE | DO — ship with Port A |
| 07 | 10 built-in themes + theme configcatppuccin · tokyo-night · dracula · nord · gruvbox · vesper | PARTIAL | LOW | EASY | SAFE | MAYBE — bundle with UX pass |
| 08 | In-app self-update + manifestwebsite/latest.json + herdr update | MISSING | LOW–MED | EASY | SAFE | MAYBE — bundle with v1.1.x release |
| 09 | User-defined prefix-mode command keybindings[[keys.command]] · spawns shell helper or temp pane | MISSING | LOW–MED | MEDIUM | SAFE | DEFER — wait for user signal |
| 10 | Scrollback persistence + BSP layout snapshotformat v3 · restore terminal state | N/A | — | — | — | SKIP — wrong architectural fit |
| 11 | Tiled workspaces / tabs / panes UIBSP layout · mouse-native splits | N/A | — | — | — | SKIP — would require product pivot |
| 12 | Mouse-native click/drag/right-clickpanes · tabs · workspaces · agents · borders | PARTIAL | MEDIUM | MEDIUM | SAFE | MAYBE — incremental, not a focus |
| 13 | SSH thin-client attachherdr --remote workbox · phone-friendly | MISSING | LOW | HARD | SAFE | SKIP — ainb is single-process by design |
| 14 | Kitty graphics protocol in panesimage rendering · 27k LOC | MISSING | LOW | MEDIUM | SAFE | SKIP — rare use case |
| 15 | Long-lived event subscription streamevents.subscribe · pushed events | MISSING | MEDIUM | MEDIUM | SAFE | CONSIDER — fold into Port C if scope allows |
Same 6 criteria projected as a hexagon. Larger area = better overall fit. Spikes reveal where each port dominates or fails. Port A (hooks) and Port B (notifications) are the obvious quick wins; Port C is the strategic but expensive one.
Sequenced by weighted score, with one re-ordering: A and B ship together because the notification is meaningless without the real-time state push. C is the strategic bet — schedule after A+B prove the hook pattern.
Useful framing for "where does ainb sit if herdr starts eating our lunch?" These are things herdr does not do — and would have to rebuild from scratch.
Per project · session · day · week · 30-day. herdr does not parse JSONL at all.
moat · highblake3 + size + mtime keyed bincode blob. Sub-second relaunch on multi-GB log dirs.
moat · highIsolated per-session runs · log streaming · env injection. herdr just spawns shell PTYs.
moat · highCreate / delete / branch through git2 UI. herdr workspaces are cwd-driven only.
moat · midScan for stale containers + missing worktrees · offer fix. 2.1k LOC component.
moat · midIngest .claude-live-window.json for rate-limit + Tier1 state in real time.
Read-only Claude Code skill discovery (name · description · author).
moat · lowClaude API key / OAuth · keyring storage · per-provider setup UX.
moat · lowainb claudecode statusline plugs the rate-limit window into Claude's statusline.
Every port re-implements from herdr's README / SOCKET_API.md / INTEGRATIONS.md (documentation, not GPL-encumbered code). Need explicit policy: contributors should not read src/detect.rs line-by-line while writing ainb's equivalent.
For agents inside ainb-spawned containers to call ainb wait session-done, the Unix socket needs to be volume-mounted into the container. Worth a small spike before Port C lands.
herdr keeps screen heuristics when hooks aren't installed. Mirror this: JSONL polling stays as the fallback path when ainb integration install hasn't run for a session's provider.
Architecturally they compose: herdr workspace create --cwd ~/repo then run ainb in the root pane. herdr detects it as unknown but ainb's spawned sessions still work. Doc-only effort; potentially great marketing.