aboutsummaryrefslogtreecommitdiff
path: root/.pi
diff options
context:
space:
mode:
authorOgulcan Celik <ogulcancelik@gmail.com>2026-05-15 01:06:23 +0300
committerOgulcan Celik <ogulcancelik@gmail.com>2026-05-15 01:06:23 +0300
commit80d70642b7a86d1d9473ed55586412e0345d015e (patch)
tree2de13cea3bdbdbe517d26d85abeb9da801e8ccff /.pi
parent21cb18f74b9d160771d41c9ad29a56907e236471 (diff)
chore: add next-release docs mirror
Diffstat (limited to '.pi')
-rw-r--r--.pi/docs/CONFIGURATION.md411
-rw-r--r--.pi/docs/INTEGRATIONS.md219
-rw-r--r--.pi/docs/README.md301
-rw-r--r--.pi/docs/SOCKET_API.md1039
-rw-r--r--.pi/prompts/draft-changelog.md13
5 files changed, 1978 insertions, 5 deletions
diff --git a/.pi/docs/CONFIGURATION.md b/.pi/docs/CONFIGURATION.md
new file mode 100644
index 00000000..0bee5925
--- /dev/null
+++ b/.pi/docs/CONFIGURATION.md
@@ -0,0 +1,411 @@
+# configuration
+
+herdr reads config from:
+
+```text
+~/.config/herdr/config.toml
+```
+
+Named sessions share this config file. Sessions are runtime/socket namespaces, not workspace replacements; per-session sockets and persistent runtime state are separate:
+
+```text
+~/.config/herdr/session.json
+~/.config/herdr/sessions/<name>/session.json
+```
+
+Use `herdr session list`, `herdr session attach <name>`, `herdr session stop <name>`, and `herdr session delete <name>` to inspect and manage named session namespaces. Add `--json` to session commands when scripts need machine-readable output.
+
+In default persistence mode, quitting the UI detaches the current client. Use `herdr server stop` to stop the shared background server.
+
+print the full default config with:
+
+```bash
+herdr --default-config
+```
+
+if a config value is invalid, or two navigate actions use the same keybinding, herdr falls back to a safe default and shows a startup warning in the UI.
+
+## live reload
+
+After editing `config.toml`, reload the running app without restarting the persistent server:
+
+```bash
+herdr server reload-config
+```
+
+You can also use the global menu inside herdr and choose `reload config`.
+
+Reload is server-owned. In persistent mode the CLI sends a request to the running server, and the server reads, parses, validates, and applies `config.toml`.
+
+Reloadable now:
+- keybindings and prefix
+- theme, custom theme colors, and legacy `ui.accent`
+- `ui.confirm_close`
+- `ui.agent_panel_scope`
+- `ui.toast.delivery`
+- server-side `ui.sound` policy; attached thin clients refresh local sound config after a successful sound-policy change
+- `advanced.scrollback_limit_bytes` for panes created after reload
+- `ui.sidebar_width` as the default width; current width updates only while it is still config-owned
+
+Startup-only or special-case:
+- `onboarding` does not reopen onboarding during reload
+- `advanced.allow_nested` is checked before launch and needs a restart
+- existing pane scrollback buffers are not resized during reload
+- terminal notifications and sounds are client-local side effects and are sent to the foreground attached client
+
+If the TOML cannot be read or parsed, reload applies nothing and keeps the current running state. If keybindings are invalid, herdr keeps the current keybindings while applying other valid reloadable settings where possible.
+
+## onboarding
+
+```toml
+onboarding = true
+```
+
+| option | default | description |
+|--------|---------|-------------|
+| `onboarding` | unset | show first-run notification setup; set `false` after choosing |
+
+notes:
+- missing `onboarding` currently behaves like `true`
+- set `onboarding = true` to force the setup screen again for testing
+- continuing from onboarding writes `onboarding = false` and opens the normal settings UI
+
+## keybindings
+
+keybindings live under `[keys]`.
+
+supported syntax:
+- plain keys: `n`, `x`, `-`, `` ` ``
+- modifiers: `ctrl+b`, `shift+n`, `alt+x`
+- special keys: `enter`, `esc`, `tab`, `backspace`, `left`, `right`, `up`, `down`
+- function keys: `f1`, `f12`
+- uppercase letters also imply shift: `D` works like `shift+d`
+
+notes:
+- most reliable bindings are plain keys, `ctrl+letter`, `esc`/`tab`/`enter`, and function keys
+- `alt+...` and punctuation-with-modifiers may vary depending on terminal/tmux setup
+- bindings marked `unset` in the key reference are supported actions with no default key assigned
+- for navigate-mode actions, duplicate keybindings are treated as config errors; later conflicting bindings fall back to defaults
+
+example:
+
+```toml
+[keys]
+prefix = "ctrl+b"
+new_workspace = "n"
+rename_workspace = "shift+n"
+close_workspace = "X"
+reload_config = "" # optional, unset by default
+open_notification_target = "" # optional, unset by default
+new_tab = "c"
+split_vertical = "d"
+split_horizontal = "D"
+close_pane = "x"
+rename_pane = "" # optional, unset by default
+fullscreen = "f"
+resize_mode = "r"
+toggle_sidebar = "b"
+previous_workspace = "ctrl+alt+["
+next_workspace = "ctrl+alt+]"
+previous_agent = "ctrl+["
+next_agent = "ctrl+]"
+previous_tab = "alt+["
+next_tab = "alt+]"
+focus_pane_left = "alt+h"
+focus_pane_down = "alt+j"
+focus_pane_up = "alt+k"
+focus_pane_right = "alt+l"
+```
+
+### key reference
+
+| key | default | action |
+|-----|---------|--------|
+| `prefix` | `ctrl+b` | enter or leave navigate mode |
+| `new_workspace` | `n` | create a new workspace |
+| `rename_workspace` | `shift+n` | rename selected workspace |
+| `close_workspace` | `shift+d` | close selected workspace |
+| `detach` | unset | optional explicit detach shortcut in the persistent session |
+| `reload_config` | unset | reload `config.toml` in the running app/server |
+| `open_notification_target` | unset | jump to the currently visible notification target |
+| `previous_workspace` | unset | switch to the previous workspace directly from terminal mode |
+| `next_workspace` | unset | switch to the next workspace directly from terminal mode |
+| `previous_agent` | unset | focus the previous agent shown in the sidebar agent list |
+| `next_agent` | unset | focus the next agent shown in the sidebar agent list |
+| `new_tab` | `c` | create a new tab |
+| `rename_tab` | unset | rename the active tab |
+| `previous_tab` | unset | switch to the previous tab directly from terminal mode |
+| `next_tab` | unset | switch to the next tab directly from terminal mode |
+| `close_tab` | unset | close the active tab |
+| `focus_pane_left` | unset | focus the pane to the left directly from terminal mode |
+| `focus_pane_down` | unset | focus the pane below directly from terminal mode |
+| `focus_pane_up` | unset | focus the pane above directly from terminal mode |
+| `focus_pane_right` | unset | focus the pane to the right directly from terminal mode |
+| `split_vertical` | `v` | split pane vertically (side by side) |
+| `split_horizontal` | `-` | split pane horizontally (stacked) |
+| `close_pane` | `x` | close focused pane |
+| `rename_pane` | unset | rename the focused pane |
+| `fullscreen` | `f` | toggle focused pane fullscreen |
+| `resize_mode` | `r` | enter or leave resize mode |
+| `toggle_sidebar` | `b` | collapse or expand the sidebar |
+
+### custom command keybindings
+
+Use `[[keys.command]]` to bind a prefix-mode key to a command. Press the prefix key, then the configured key.
+
+```toml
+[[keys.command]]
+key = "g"
+type = "pane"
+command = "lazygit"
+```
+
+`type` is optional and defaults to `shell`.
+
+| type | behavior |
+|------|----------|
+| `shell` | run the command detached in the background |
+| `pane` | open a temporary zoomed pane, run the command there, then close the pane when the command exits |
+
+Commands run through `/bin/sh -lc`. Herdr sets the command working directory to the active pane cwd when available and provides context through environment variables:
+
+| variable | value |
+|----------|-------|
+| `HERDR_SOCKET_PATH` | active herdr socket path |
+| `HERDR_BIN_PATH` | current herdr binary path |
+| `HERDR_ACTIVE_WORKSPACE_ID` | active workspace id |
+| `HERDR_ACTIVE_TAB_ID` | active tab id |
+| `HERDR_ACTIVE_PANE_ID` | focused pane id |
+| `HERDR_ACTIVE_PANE_CWD` | focused pane cwd |
+
+Example detached helper:
+
+```toml
+[[keys.command]]
+key = "shift+g"
+type = "shell"
+command = "notify-send herdr 'custom command ran'"
+```
+
+## theme
+
+herdr ships with 10 built-in color themes. set one in config:
+
+```toml
+[theme]
+name = "tokyo-night"
+```
+
+### built-in themes
+
+| name | description |
+|------|-------------|
+| `catppuccin` | soft pastel mocha palette (default) |
+| `tokyo-night` | blue-purple aesthetic |
+| `dracula` | purple/pink/green classic |
+| `nord` | frosty scandinavian blues |
+| `gruvbox` | warm retro browns/oranges |
+| `one-dark` | atom's beloved palette |
+| `solarized` | ethan schoonover's classic |
+| `kanagawa` | hokusai-inspired |
+| `rose-pine` | muted, elegant |
+| `vesper` | high-contrast monochrome with peach and mint accents |
+
+theme names are flexible: `tokyo-night`, `tokyonight`, and `tokyo_night` all work.
+
+### custom overrides
+
+override individual color tokens on top of any base theme:
+
+```toml
+[theme]
+name = "dracula"
+
+[theme.custom]
+panel_bg = "reset"
+accent = "#f5c2e7"
+red = "rgb(255, 85, 85)"
+green = "#a6e3a1"
+```
+
+all tokens are optional — only set what you want to change.
+
+### available tokens
+
+| token | used for |
+|-------|----------|
+| `accent` | highlights, active borders, navigation UI |
+| `panel_bg` | floating panel, tab bar, and overlay background |
+| `surface0` | selected item background |
+| `surface1` | hover/active backgrounds |
+| `surface_dim` | active workspace background, separators |
+| `overlay0` | muted text, secondary info |
+| `overlay1` | slightly brighter secondary text |
+| `text` | primary text |
+| `subtext0` | workspace names, dimmed labels |
+| `mauve` | git branch names, special labels |
+| `green` | idle/done states |
+| `yellow` | busy/running states |
+| `red` | waiting/needs attention states |
+| `blue` | unseen notifications |
+| `teal` | done notification accents |
+| `peach` | interrupted/warning states |
+
+tokens accept the same color formats as `accent`: hex (`#rrggbb`), named colors, or `rgb(r,g,b)`.
+
+for `panel_bg`, you can also use `reset`, `default`, `none`, or `transparent` to stop herdr from painting an opaque panel background and instead use the host terminal's default background.
+
+## ui
+
+```toml
+[ui]
+sidebar_width = 26
+confirm_close = true
+show_agent_labels_on_pane_borders = false
+agent_panel_scope = "all"
+accent = "cyan"
+```
+
+### options
+
+| option | default | description |
+|--------|---------|-------------|
+| `sidebar_width` | `26` | base sidebar width before auto-scaling |
+| `confirm_close` | `true` | ask before closing a workspace |
+| `show_agent_labels_on_pane_borders` | `false` | show detected/reported agent labels in split pane borders when no manual pane name is set |
+| `agent_panel_scope` | `all` | sidebar agent list scope: `current` or `all` |
+| `accent` | `cyan` | highlight and border color |
+
+Changing the agent panel scope from the sidebar writes `agent_panel_scope` to config so it survives session resets and upgrades.
+
+`accent` accepts:
+- named colors like `cyan`, `blue`, `magenta`
+- hex like `#89b4fa`
+- rgb like `rgb(137,180,250)`
+
+## toast notifications
+
+```toml
+[ui.toast]
+delivery = "off"
+```
+
+### options
+
+| option | default | description |
+|--------|---------|-------------|
+| `ui.toast.delivery` | `off` | where background popup notifications should appear |
+
+available values:
+- `off` — disable popup notifications
+- `herdr` — show top-right in-app toasts
+- `terminal` — ask the outer terminal to show a desktop notification
+
+compatibility note:
+- older configs may still use `ui.toast.enabled = true|false`
+- herdr still reads that legacy key for compatibility
+- if you save toast settings from inside herdr, it rewrites the setting to `ui.toast.delivery`
+
+current behavior:
+- informational only
+- one notification event at a time
+- shown for background agent events like `needs attention` and `finished`
+- suppression is tab-aware: the active tab stays quiet, but background tabs in the same workspace can still notify
+- `terminal` delivery is best-effort and depends on terminal support
+- currently targets terminals such as Ghostty, Kitty, iTerm2, and WezTerm
+- inside tmux, herdr wraps notification escapes with tmux passthrough
+
+## sound
+
+```toml
+[ui.sound]
+enabled = true
+
+[ui.sound.agents]
+claude = "default"
+droid = "off"
+```
+
+### options
+
+| option | default | description |
+|--------|---------|-------------|
+| `ui.sound.enabled` | `true` | enable background agent sounds |
+
+per-agent values:
+- `default`
+- `on`
+- `off`
+
+available agent keys:
+- `pi`
+- `claude`
+- `codex`
+- `gemini`
+- `cursor`
+- `cline`
+- `open_code`
+- `github_copilot`
+- `kimi`
+- `droid`
+- `amp`
+
+## advanced
+
+```toml
+[advanced]
+allow_nested = false
+scrollback_limit_bytes = 10000000
+```
+
+### options
+
+| option | default | description |
+|--------|---------|-------------|
+| `advanced.allow_nested` | `false` | allow launching herdr from inside a herdr-managed pane |
+| `advanced.scrollback_limit_bytes` | `10000000` | maximum scrollback buffer size in bytes retained per pane terminal |
+
+### nested launches
+
+By default, herdr blocks nested launches when `HERDR_ENV=1` is already present.
+
+Set `allow_nested = true` only for debugging or intentionally nested setups.
+
+### scrollback
+
+`scrollback_limit_bytes` limits retained terminal scrollback per pane.
+
+The default matches Ghostty's `scrollback-limit` value.
+
+Set `scrollback_limit_bytes = 0` to disable pane scrollback entirely.
+
+The old `advanced.scrollback_lines` key is still accepted as a compatibility alias, but it uses the same byte-based value.
+
+## environment variables
+
+| variable | description |
+|----------|-------------|
+| `HERDR_LOG` | log level filter (default: `herdr=info`) |
+
+## logs
+
+herdr writes local file logs under:
+
+```text
+~/.config/herdr/
+```
+
+common files:
+
+```text
+~/.config/herdr/herdr.log
+~/.config/herdr/herdr-client.log
+~/.config/herdr/herdr-server.log
+```
+
+notes:
+- `herdr.log` is used by monolithic `--no-session` mode and some top-level startup paths
+- persistent session mode mainly uses `herdr-client.log` and `herdr-server.log`
+- logs rotate automatically by size and keep a few older files as `.1`, `.2`, and so on
+- default logs are metadata-focused and are intended to be shareable for issue diagnosis
+- `HERDR_LOG` can increase verbosity when you need a local repro or deeper debugging
diff --git a/.pi/docs/INTEGRATIONS.md b/.pi/docs/INTEGRATIONS.md
new file mode 100644
index 00000000..2489f619
--- /dev/null
+++ b/.pi/docs/INTEGRATIONS.md
@@ -0,0 +1,219 @@
+# integrations
+
+herdr works without any hook or plugin setup.
+
+out of the box, it detects supported agents automatically by combining foreground process detection with screen heuristics. that is enough to give you workspace awareness with zero configuration.
+
+when an agent exposes hooks or plugins, the more robust path is to forward semantic state to herdr over the local socket api. the built-in integrations in this document do exactly that.
+
+if you want to inspect the exact files herdr installs, they are versioned in this repo:
+
+- [pi extension](./src/integration/assets/pi/herdr-agent-state.ts)
+- [claude code hook](./src/integration/assets/claude/herdr-agent-state.sh)
+- [codex hook](./src/integration/assets/codex/herdr-agent-state.sh)
+- [opencode plugin](./src/integration/assets/opencode/herdr-agent-state.js)
+
+## how herdr uses integrations
+
+herdr uses a hybrid model:
+
+- **process detection** owns pane identity, liveness, and "the process is gone"
+- **agent integrations** report semantic state like `working`, `blocked`, and `idle` over the local socket api when the tool exposes those events
+- **screen heuristics** remain the fallback for gaps, unsupported tools, or incomplete hook surfaces
+
+that means hooks/plugins do **not** become the source of truth for pane ownership. they enrich state reporting; they do not replace process detection.
+
+## install commands
+
+```bash
+herdr integration install pi
+herdr integration install claude
+herdr integration install codex
+herdr integration install opencode
+```
+
+## uninstall commands
+
+```bash
+herdr integration uninstall pi
+herdr integration uninstall claude
+herdr integration uninstall codex
+herdr integration uninstall opencode
+```
+
+## pi
+
+install:
+
+```bash
+herdr integration install pi
+```
+
+this writes the bundled pi extension to:
+
+```text
+~/.pi/agent/extensions/herdr-agent-state.ts
+```
+
+pi is the cleanest integration. it already has an authoritative hook model, so herdr can get direct state reports over the socket api without guessing as much from the terminal.
+
+bundled source: [`src/integration/assets/pi/herdr-agent-state.ts`](./src/integration/assets/pi/herdr-agent-state.ts)
+
+uninstall:
+
+```bash
+herdr integration uninstall pi
+```
+
+this removes:
+
+```text
+~/.pi/agent/extensions/herdr-agent-state.ts
+```
+
+## claude code
+
+install:
+
+```bash
+herdr integration install claude
+```
+
+this:
+
+- writes the hook script to `~/.claude/hooks/herdr-agent-state.sh`
+- updates `~/.claude/settings.json`
+
+bundled source: [`src/integration/assets/claude/herdr-agent-state.sh`](./src/integration/assets/claude/herdr-agent-state.sh)
+
+current hook mapping:
+
+- `UserPromptSubmit` → `working`
+- `PreToolUse` → `working`
+- `PermissionRequest` → `blocked`
+- `PostToolUse` → `working`
+- `PostToolUseFailure` → `working`
+- `SubagentStop` → `working`
+- `Stop` → `idle`
+- `SessionEnd` → `release`
+
+notes:
+
+- claude code hooks also run inside subagents. herdr treats subagent `working` and `blocked` reports as real pane state.
+- subagent stop/release events are converted to `working` by the bundled hook script so a completed subagent does not make the parent claude pane look idle.
+- `PostToolUse` and `PostToolUseFailure` move the pane back to `working` after a permissioned tool call resolves.
+
+uninstall:
+
+```bash
+herdr integration uninstall claude
+```
+
+this:
+
+- removes `~/.claude/hooks/herdr-agent-state.sh`
+- removes herdr-owned hook entries from `~/.claude/settings.json`
+
+## codex
+
+install:
+
+```bash
+herdr integration install codex
+```
+
+this:
+
+- writes the hook script to `~/.codex/herdr-agent-state.sh`
+- updates `~/.codex/hooks.json`
+- ensures `codex_hooks = true` in `~/.codex/config.toml`
+
+bundled source: [`src/integration/assets/codex/herdr-agent-state.sh`](./src/integration/assets/codex/herdr-agent-state.sh)
+
+current hook mapping:
+
+- `SessionStart` → `idle`
+- `UserPromptSubmit` → `working`
+- `PreToolUse` → `working`
+- `Stop` → `idle`
+
+notes:
+
+- codex does **not** currently expose a permission-specific hook like claude or opencode, so `blocked` still depends on herdr's normal heuristics.
+- codex currently renders hook lifecycle messages in its own tui, for example `Running SessionStart hook` and `SessionStart hook (completed)`.
+- that noise is an upstream codex limitation, not a herdr-specific issue.
+- codex has a `suppressOutput` field in its hook output schema, but it is currently not effective for suppressing those tui lifecycle lines.
+
+uninstall:
+
+```bash
+herdr integration uninstall codex
+```
+
+this:
+
+- removes `~/.codex/herdr-agent-state.sh`
+- removes herdr-owned hook entries from `~/.codex/hooks.json`
+- intentionally leaves `~/.codex/config.toml` alone
+
+that last point is deliberate: herdr does **not** try to guess whether `codex_hooks = true` is still needed for some other codex hook setup.
+
+## opencode
+
+install:
+
+```bash
+herdr integration install opencode
+```
+
+this writes the bundled plugin to:
+
+```text
+~/.config/opencode/plugins/herdr-agent-state.js
+```
+
+bundled source: [`src/integration/assets/opencode/herdr-agent-state.js`](./src/integration/assets/opencode/herdr-agent-state.js)
+
+current plugin mapping:
+
+- `permission.asked` → `blocked`
+- `permission.replied: once|always` → `working`
+- `permission.replied: reject` → `idle`
+- `question.asked` → `blocked`
+- `question.replied` → `working`
+- `question.rejected` → `idle`
+- `session.status: busy|retry` → `working`
+- `session.status: idle` → `idle`
+- `session.idle` → `idle`
+
+notes:
+
+- opencode has the richest event surface of the currently supported integrations.
+- herdr intentionally does **not** guess that `session.deleted` means process exit. process detection still owns liveness and pane identity.
+
+uninstall:
+
+```bash
+herdr integration uninstall opencode
+```
+
+this removes:
+
+```text
+~/.config/opencode/plugins/herdr-agent-state.js
+```
+
+## known limitations
+
+- these integrations only activate inside herdr-managed panes.
+- if an agent has an incomplete hook surface, herdr falls back to process detection and screen heuristics rather than inventing lease or ttl behavior.
+- codex currently shows hook lifecycle chatter in its own tui until upstream adds a real silent mode.
+
+## troubleshooting
+
+if an install command succeeds but you do not see improved state reporting:
+
+1. make sure you launched the agent inside a herdr pane
+2. restart the agent session so it picks up the new hook/plugin config
+3. verify the expected config file was written to the path above
+4. remember that unsupported transitions still fall back to herdr's built-in heuristics
diff --git a/.pi/docs/README.md b/.pi/docs/README.md
new file mode 100644
index 00000000..05346b81
--- /dev/null
+++ b/.pi/docs/README.md
@@ -0,0 +1,301 @@
+# herdr
+
+
+<p align="center">
+ <img src="assets/logo.png" alt="herdr" width="100" />
+</p>
+
+<p align="center">
+ <a href="https://herdr.dev">herdr.dev</a> · <a href="#install">install</a> · <a href="#quick-start">quick start</a> · <a href="#supported-agents">supported agents</a> · <a href="./INTEGRATIONS.md">integrations</a> · <a href="./CONFIGURATION.md">configuration</a> · <a href="./SOCKET_API.md">socket api</a>
+</p>
+
+---
+
+https://github.com/user-attachments/assets/043ec09f-4bdd-41d5-aee0-8fda6b83e267
+
+**agent multiplexer that lives in your terminal.**
+
+workspaces, tabs, panes. mouse-native: click, drag, split. every agent at a glance: blocked, working, done. detach and reattach, agents keep running. no gui app, no electron, no mac-only native wrapper. you see the agent's own terminal, not someone's interpretation of it.
+
+---
+
+## install
+
+```bash
+curl -fsSL https://herdr.dev/install.sh | sh
+```
+
+or download the binary from [releases](https://github.com/ogulcancelik/herdr/releases). requires linux or macos.
+
+### update
+
+herdr notifies you when a new version is available. run manually to update:
+
+```bash
+herdr update
+```
+
+## quick start
+
+```bash
+herdr
+```
+
+by default herdr launches or attaches to one background session server. `ctrl+b q` detaches the client. agents keep running. use `herdr server stop` to stop the default server. use `--no-session` for the old single-process mode.
+
+named sessions are runtime/socket namespaces for separate persistent herdr servers. they do not replace workspaces; each named session has its own panes, tabs, workspaces, sockets, and session state while sharing the same global config file.
+
+```bash
+herdr session list
+herdr session attach work
+herdr session attach side-project
+herdr session stop work
+herdr session delete side-project
+```
+
+1. press `n` to create a workspace
+2. run an agent in the root pane
+3. press `ctrl+b` to enter navigate mode
+4. use `v` or `-` to split panes, or `c` to create a new tab
+5. watch the sidebar for blocked, working, and done states
+
+on first run herdr opens a short onboarding flow. after that, restored sessions land in terminal mode; fresh sessions start in **navigate mode**.
+
+## how it compares
+
+| | tmux | gui managers | herdr |
+|--------------------------|------|--------------|-------|
+| persistent sessions | ✓ | — | ✓ |
+| detach / reattach | ✓ | — | ✓ |
+| panes, tabs, workspaces | ✓ | ✓ | ✓ |
+| agent awareness | — | ✓ | ✓ |
+| lives in your terminal | ✓ | — | ✓ |
+| real terminal views | ✓ | — | ✓ |
+| mouse-native | — | ✓ | ✓ |
+| lightweight binary | ✓ | — | ✓ |
+| agents can orchestrate | ? | ? | ✓ |
+
+tmux gives you persistence and panes, but it was built before agents existed. gui managers show agent state, but they make you leave your terminal and use their wrapped view. herdr is persistence and awareness in one tool that stays out of your way.
+
+## persistence
+
+start herdr on your desktop or server. run your agents, split panes, do your work. press `ctrl+b q` to detach. close your terminal, close your laptop; your agents keep running. open a new terminal, run `herdr`, you're back. same session, same panes, same agents.
+
+### from anywhere
+
+need to check on your agents from your phone? just ssh in and run herdr. any ssh client works. no app to download, no account to create.
+
+```
+ssh you@yourserver
+herdr
+```
+
+or attach from your local terminal through ssh:
+
+```bash
+herdr --remote workbox
+herdr --remote ssh://you@yourserver:2222
+```
+
+for repeat targets, use your ssh config:
+
+```sshconfig
+Host workbox
+ HostName yourserver
+ User you
+ Port 2222
+```
+
+same session, same agents, same state.
+
+## agent awareness
+
+the sidebar shows which agents are blocked, working, or done. workspaces roll up to their most urgent state so you can scan the full list at a glance.
+
+states:
+
+- 🔴 **blocked** — agent needs input or approval
+- 🟡 **working** — agent is actively running
+- 🔵 **done** — work finished, you have not looked at it yet
+- 🟢 **idle** — done and seen
+
+detection works by reading foreground process and terminal output. zero config, no hooks required. for agents that expose hooks, the socket api integration gives more robust state reporting.
+
+## lives in your terminal
+
+not a gui window, not a web dashboard, not electron. herdr runs inside whatever terminal you already use. single rust binary, no dependencies. works inside tmux.
+
+## what you get
+
+- **workspaces** — organized around git repos or folder names, each with its own tabs and panes
+- **tabs** — first-class in the socket api and cli
+- **mouse-native** — click panes/tabs/workspaces/agents, drag borders, select text to copy, right-click menus; not keyboard-only
+- **notifications** — sounds and toasts for background events; tab-aware suppression
+- **10 built-in themes** — catppuccin (default), tokyo night, dracula, nord, gruvbox, one dark, solarized, kanagawa, rosé pine, vesper
+- **session persistence** — pane processes survive client detach; sessions restore after full restart
+
+## agents can use herdr too
+
+the local unix socket lets agents create workspaces, split panes, spawn helpers, read output, and wait for state changes.
+
+```bash
+# create a workspace and tab
+herdr workspace create --cwd ~/project --label "api"
+herdr tab create --label "logs"
+
+# split a pane and run
+herdr pane split 1-1 --direction right
+herdr pane run 1-2 "npm test"
+
+# wait for an agent
+herdr wait agent-status 1-1 --status done
+
+# read output
+herdr pane read 1-2 --source recent --lines 50
+
+# read a rendered ANSI snapshot for TUI feedback loops
+herdr pane read 1-2 --source visible --ansi
+```
+
+full reference: [`SOCKET_API.md`](./SOCKET_API.md) and [`SKILL.md`](./SKILL.md).
+
+## supported agents
+
+automatic detection works out of the box. process name matching plus terminal output heuristics.
+
+| agent | idle / done | working | blocked |
+|-------|-------------|---------|---------|
+| [pi](https://pi.dev) | ✓ | ✓ | partial |
+| [claude code](https://docs.anthropic.com/en/docs/claude-code) | ✓ | ✓ | ✓ |
+| [codex](https://github.com/openai/codex) | ✓ | ✓ | ✓ |
+| [droid](https://factory.ai) | ✓ | ✓ | ✓ |
+| [amp](https://ampcode.com) | ✓ | ✓ | ✓ |
+| [opencode](https://github.com/anomalyco/opencode) | ✓ | ✓ | ✓ |
+
+detected but not fully tested: gemini cli, cursor agent, cline, kimi, github copilot cli.
+
+for agents outside the built-in list, herdr still works as a terminal multiplexer with workspaces, panes, and tiling. custom integrations can report agent labels over the socket api. see [`SOCKET_API.md`](./SOCKET_API.md).
+
+### direct integrations
+
+the built-in pi, claude code, codex, and opencode integrations forward semantic state to herdr over the socket api. install with:
+
+```bash
+herdr integration install pi
+herdr integration install claude
+herdr integration install codex
+herdr integration install opencode
+```
+
+see [`INTEGRATIONS.md`](./INTEGRATIONS.md) for setup details.
+
+## keybindings
+
+press `ctrl+b` to enter navigate mode.
+
+| key | action |
+|-----|--------|
+| `n` | new workspace |
+| `shift+n` | rename workspace |
+| `shift+d` | close workspace |
+| `c` | new tab |
+| `v` / `-` | split pane |
+| `x` | close pane |
+| `b` | toggle sidebar |
+| `f` | fullscreen pane |
+| `r` | resize mode |
+| `q` | detach (quit client) |
+
+resize mode: `h`/`l` resize width, `j`/`k` resize height, `esc` exit.
+
+custom command keybindings can launch detached shell helpers or temporary panes from prefix mode:
+
+```toml
+[[keys.command]]
+key = "g"
+type = "pane" # "shell" or "pane"
+command = "lazygit"
+```
+
+mouse is supported throughout. full reference: [`CONFIGURATION.md`](./CONFIGURATION.md).
+
+## configuration
+
+config file: `~/.config/herdr/config.toml`
+
+```bash
+herdr --default-config # print full default config
+```
+
+in-app settings screen for theme, sound, and toast preferences. full reference: [`CONFIGURATION.md`](./CONFIGURATION.md).
+
+## logs
+
+herdr writes logs under `~/.config/herdr/`.
+
+common files:
+
+```text
+~/.config/herdr/herdr.log
+~/.config/herdr/herdr-client.log
+~/.config/herdr/herdr-server.log
+```
+
+in persistent session mode, the client and server logs are usually the useful ones. logs rotate automatically and keep a few older files like `.1` and `.2`.
+
+for issue reports, include the relevant current log plus rotated siblings if they exist. default logs are metadata-focused and avoid pane contents by default.
+
+use a higher log level only when needed:
+
+```bash
+HERDR_LOG=herdr=debug herdr
+```
+
+full logging and environment variable details: [`CONFIGURATION.md`](./CONFIGURATION.md).
+
+## docs
+
+- [`CONFIGURATION.md`](./CONFIGURATION.md) — keybindings, themes, notifications, environment variables
+- [`INTEGRATIONS.md`](./INTEGRATIONS.md) — pi, claude code, codex, opencode integrations
+- [`SKILL.md`](./SKILL.md) — reusable agent skill
+- [`SOCKET_API.md`](./SOCKET_API.md) — socket protocol and cli reference
+
+## building from source
+
+```bash
+git clone https://github.com/ogulcancelik/herdr
+cd herdr
+cargo build --release
+./target/release/herdr
+```
+
+## testing
+
+```bash
+just test # unit tests
+just test-all # full local test suite
+```
+
+## license
+
+AGPL-3.0: free to use, modify, and distribute. modified versions must be open-sourced under the same license.
+
+## pi, ghostty, and shift+enter
+
+herdr does not require or install terminal keybinds for pi.
+
+ghostty does not ship a default `shift+enter=text:\n` or `shift+enter=text:\x1b\r` keybind. if those lines exist in your ghostty config, they were added by user config or another tool, commonly claude code. they collapse shift+enter into legacy bytes, so downstream programs cannot reliably distinguish shift+enter from ctrl+j or alt+enter.
+
+if shift+enter behaves differently in pi inside herdr, first remove those custom terminal keybinds and retest. do not file this as a herdr keyboard encoding bug unless it reproduces with a clean terminal config.
+
+related context: #78, #81, #106, and earendil-works/pi#1872.
+
+## mandatory star history
+
+<a href="https://www.star-history.com/?repos=ogulcancelik%2Fherdr&type=date&legend=top-left">
+ <picture>
+ <source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/chart?repos=ogulcancelik/herdr&type=date&theme=dark&legend=top-left" />
+ <source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/chart?repos=ogulcancelik/herdr&type=date&legend=top-left" />
+ <img alt="Star History Chart" src="https://api.star-history.com/chart?repos=ogulcancelik/herdr&type=date&legend=top-left" />
+ </picture>
+</a>
diff --git a/.pi/docs/SOCKET_API.md b/.pi/docs/SOCKET_API.md
new file mode 100644
index 00000000..51046860
--- /dev/null
+++ b/.pi/docs/SOCKET_API.md
@@ -0,0 +1,1039 @@
+# herdr socket api
+
+herdr exposes a local unix socket api for scripts, tools, and coding agents that want to control a running herdr instance or subscribe to events.
+
+if you are teaching an agent that is already running inside herdr, start with [`SKILL.md`](./SKILL.md). use this document when you want the direct protocol, or when you want the cli wrapper reference for the commands that sit on top of it.
+
+## choose your integration layer
+
+there are three practical ways to integrate with herdr:
+
+- **agent skill** — [`SKILL.md`](./SKILL.md). best when an agent inside herdr just needs to learn the workflow quickly.
+- **cli wrappers** — `herdr server stop`, `herdr workspace ...`, `herdr tab ...`, `herdr pane ...`, `herdr wait ...`. best for shell scripts and simple orchestration.
+- **raw socket api** — best when you want direct request/response control or long-lived event subscriptions.
+
+these layers are intentionally stacked on top of the same control surface.
+
+important difference: `pane.run` and `wait agent-status` are **cli conveniences**, not raw socket methods.
+
+## transport
+
+- transport: unix domain socket
+- encoding: newline-delimited json
+- request/response: send one json request per line, read one json response per line
+- subscriptions: send `events.subscribe`, receive an ack, then keep the same connection open and continue reading pushed events
+
+named sessions are runtime/socket namespaces, not replacements for herdr workspaces. each named session has its own server sockets and persistent runtime state while config remains global.
+
+socket path resolution order:
+
+1. explicit `herdr --session <name>`:
+ `$XDG_CONFIG_HOME/herdr/sessions/<name>/herdr.sock` or `$HOME/.config/herdr/sessions/<name>/herdr.sock`
+2. `HERDR_SOCKET_PATH`
+3. `HERDR_SESSION=<name>`:
+ `$XDG_CONFIG_HOME/herdr/sessions/<name>/herdr.sock` or `$HOME/.config/herdr/sessions/<name>/herdr.sock`
+4. default session path:
+ `$XDG_CONFIG_HOME/herdr/herdr.sock` or `$HOME/.config/herdr/herdr.sock`
+
+this means `HERDR_SOCKET_PATH` remains an exact low-level socket override, but an explicit cli `--session <name>` still wins when a command runs inside a pane that inherited `HERDR_SOCKET_PATH`.
+
+session names may contain ASCII letters, numbers, `.`, `_`, and `-`. `default` is reserved for the default session. use `herdr session list`, `herdr session attach <name>`, `herdr session stop <name>`, and `herdr session delete <name>` to inspect and manage session namespaces. session commands print human-readable output by default; pass `--json` for machine-readable output. `session delete` refuses running sessions and does not delete the default session.
+
+## request and response envelopes
+
+all socket requests use this envelope:
+
+```json
+{
+ "id": "req_1",
+ "method": "ping",
+ "params": {}
+}
+```
+
+successful responses look like:
+
+```json
+{
+ "id": "req_1",
+ "result": {
+ "type": "pong",
+ "version": "0.1.2",
+ "protocol": 2
+ }
+}
+```
+
+errors look like:
+
+```json
+{
+ "id": "req_1",
+ "error": {
+ "code": "pane_not_found",
+ "message": "pane 1-99 not found"
+ }
+}
+```
+
+## ids and numbering
+
+workspace ids are opaque, stable ids like:
+
+- `w64e95948145ed1`
+- `w64e95948146a82`
+
+pane ids are workspace-scoped and stable across workspace reorder:
+
+- `w64e95948145ed1-1`
+- `w64e95948145ed1-2`
+- `w64e95948146a82-1`
+
+that means:
+
+- workspace id = stable workspace identity
+- pane number = compact pane number within that workspace
+
+workspace ids are durable for the life of the workspace and survive display reordering. pane numbers are still compact public numbers, so if a pane closes, higher pane numbers in that same workspace compact down.
+
+tabs are first-class socket api objects now.
+
+- tab ids look like `w64e95948145ed1:1`, `w64e95948145ed1:2`
+- workspace id = stable workspace identity
+- tab number = tab number within that workspace
+- pane ids still stay workspace-scoped like `w64e95948145ed1-2` rather than becoming `workspace-tab-pane` triples
+
+for backward compatibility, requests also accept the older positional forms like `1`, `1:2`, and `1-2` as shorthand for the current session order. responses use the stable ids.
+
+## core objects
+
+`workspace_info` responses contain objects like:
+
+```json
+{
+ "workspace_id": "w64e95948145ed1",
+ "number": 1,
+ "label": "herdr",
+ "focused": true,
+ "pane_count": 1,
+ "tab_count": 1,
+ "active_tab_id": "w64e95948145ed1:1",
+ "agent_status": "unknown"
+}
+```
+
+`tab_info` responses contain objects like:
+
+```json
+{
+ "tab_id": "w64e95948145ed1:1",
+ "workspace_id": "w64e95948145ed1",
+ "number": 1,
+ "label": "1",
+ "focused": true,
+ "pane_count": 1,
+ "agent_status": "unknown"
+}
+```
+
+`pane_info` responses contain objects like:
+
+```json
+{
+ "pane_id": "w64e95948145ed1-1",
+ "workspace_id": "w64e95948145ed1",
+ "tab_id": "w64e95948145ed1:1",
+ "focused": true,
+ "cwd": "/home/can/Projects/herdr",
+ "label": "reviewer",
+ "agent": "pi",
+ "agent_status": "working",
+ "revision": 0
+}
+```
+
+`label` is an optional manual pane name set through `pane.rename`.
+
+`agent` is an optional display label string.
+
+- when herdr detects a built-in agent, this is that built-in name like `pi` or `claude`
+- when a hook or plugin reports a custom agent through `pane.report_agent`, this can be any non-empty label like `hermes`
+- when no agent identity is known, it is omitted
+
+`pane_read` responses contain objects like:
+
+```json
+{
+ "pane_id": "w64e95948145ed1-1",
+ "workspace_id": "w64e95948145ed1",
+ "tab_id": "w64e95948145ed1:1",
+ "source": "recent",
+ "format": "text",
+ "text": "...",
+ "revision": 0,
+ "truncated": false
+}
+```
+
+`agent_status` is the public agent field:
+
+- `idle`
+- `working`
+- `blocked`
+- `done`
+- `unknown`
+
+`done` means the agent has finished, but you have not looked at that finished pane yet.
+
+## methods at a glance
+
+| method | purpose | success result type |
+|---|---|---|
+| `ping` | health check / version | `pong` |
+| `server.stop` | gracefully stop the running background server | `ok` |
+| `workspace.list` | list workspaces | `workspace_list` |
+| `workspace.get` | inspect one workspace | `workspace_info` |
+| `workspace.create` | create a workspace | `workspace_info` |
+| `workspace.focus` | focus a workspace | `workspace_info` |
+| `workspace.rename` | rename a workspace | `workspace_info` |
+| `workspace.close` | close a workspace | `ok` |
+| `tab.list` | list tabs, optionally filtered by workspace | `tab_list` |
+| `tab.get` | inspect one tab | `tab_info` |
+| `tab.create` | create a tab in a workspace | `tab_info` |
+| `tab.focus` | focus a tab | `tab_info` |
+| `tab.rename` | rename a tab | `tab_info` |
+| `tab.close` | close a tab | `ok` |
+| `pane.list` | list panes, optionally filtered by workspace | `pane_list` |
+| `pane.get` | inspect one pane | `pane_info` |
+| `pane.rename` | set or clear a manual pane label | `pane_info` |
+| `pane.read` | read pane output | `pane_read` |
+| `pane.split` | split a pane and create a sibling pane | `pane_info` |
+| `pane.send_text` | send literal text without Enter | `ok` |
+| `pane.send_keys` | send keypresses like `Enter` | `ok` |
+| `pane.send_input` | send literal text plus keypresses in order | `ok` |
+| `pane.report_agent` | report hook-authoritative agent label and state for a pane | `ok` |
+| `pane.clear_agent_authority` | clear hook-authoritative agent state for a pane | `ok` |
+| `pane.release_agent` | release a pane from the reported agent back to shell state | `ok` |
+| `pane.close` | close a pane | `ok` |
+| `pane.wait_for_output` | one-shot blocking wait for text | `output_matched` |
+| `events.subscribe` | start a long-lived subscription stream | `subscription_started` ack |
+
+### `server.stop`
+
+request:
+
+```json
+{
+ "id": "req_stop",
+ "method": "server.stop",
+ "params": {}
+}
+```
+
+returns `ok` and asks the running background server to shut down cleanly.
+
+this is the explicit server-level shutdown path for persistence mode. normal in-app quit actions detach the current client instead of sending this request.
+
+## workspace methods
+
+### `workspace.list`
+
+request:
+
+```json
+{
+ "id": "req_list",
+ "method": "workspace.list",
+ "params": {}
+}
+```
+
+returns `workspace_list` with zero or more workspace objects.
+
+### `workspace.get`
+
+params:
+
+```json
+{
+ "workspace_id": "1"
+}
+```
+
+returns `workspace_info` for one workspace.
+
+### `workspace.create`
+
+params:
+
+```json
+{
+ "cwd": "/home/can/Projects/herdr",
+ "focus": true
+}
+```
+
+notes:
+
+- `cwd` is optional
+- if `cwd` is omitted, herdr uses its current working directory and falls back to `/` if needed
+- `focus` is optional in raw socket requests and defaults to `false`
+- the cli wrapper also defaults to no focus; pass `--focus` to switch to the new workspace
+
+example response:
+
+```json
+{
+ "id": "req_create",
+ "result": {
+ "type": "workspace_info",
+ "workspace": {
+ "workspace_id": "1",
+ "number": 1,
+ "label": "herdr",
+ "focused": true,
+ "pane_count": 1,
+ "tab_count": 1,
+ "active_tab_id": "1:1",
+ "agent_status": "unknown"
+ }
+ }
+}
+```
+
+### `workspace.focus`
+
+params:
+
+```json
+{
+ "workspace_id": "1"
+}
+```
+
+returns the focused workspace as `workspace_info`.
+
+### `workspace.rename`
+
+params:
+
+```json
+{
+ "workspace_id": "1",
+ "label": "api"
+}
+```
+
+returns updated `workspace_info`.
+
+### `workspace.close`
+
+params:
+
+```json
+{
+ "workspace_id": "1"
+}
+```
+
+returns:
+
+```json
+{
+ "id": "req_close",
+ "result": {
+ "type": "ok"
+ }
+}
+```
+
+## tab methods
+
+### `tab.list`
+
+request with no filter:
+
+```json
+{
+ "id": "req_tabs",
+ "method": "tab.list",
+ "params": {}
+}
+```
+
+request filtered to one workspace:
+
+```json
+{
+ "id": "req_tabs_ws",
+ "method": "tab.list",
+ "params": {
+ "workspace_id": "1"
+ }
+}
+```
+
+returns `tab_list`.
+
+### `tab.get`
+
+params:
+
+```json
+{
+ "tab_id": "1:2"
+}
+```
+
+returns `tab_info`.
+
+### `tab.create`
+
+params:
+
+```json
+{
+ "workspace_id": "1",
+ "cwd": "/home/can/Projects/herdr",
+ "focus": true
+}
+```
+
+notes:
+
+- `workspace_id` is optional and defaults to the active workspace
+- `cwd` is optional; if omitted, herdr uses the focused pane cwd in that workspace when available
+- `focus` is optional in raw socket requests and defaults to `false`
+- the cli wrapper also defaults to no focus; pass `--focus` to switch to the new tab
+
+returns `tab_info` for the new tab.
+
+### `tab.focus`
+
+params:
+
+```json
+{
+ "tab_id": "1:2"
+}
+```
+
+returns focused `tab_info`.
+
+### `tab.rename`
+
+params:
+
+```json
+{
+ "tab_id": "1:2",
+ "label": "logs"
+}
+```
+
+returns updated `tab_info`.
+
+### `tab.close`
+
+params:
+
+```json
+{
+ "tab_id": "1:2"
+}
+```
+
+returns `ok`. the last tab in a workspace cannot be closed.
+
+## pane methods
+
+### `pane.list`
+
+request with no filter:
+
+```json
+{
+ "id": "req_panes",
+ "method": "pane.list",
+ "params": {}
+}
+```
+
+request filtered to one workspace:
+
+```json
+{
+ "id": "req_panes_ws",
+ "method": "pane.list",
+ "params": {
+ "workspace_id": "1"
+ }
+}
+```
+
+returns `pane_list`.
+
+### `pane.get`
+
+params:
+
+```json
+{
+ "pane_id": "1-1"
+}
+```
+
+returns `pane_info`.
+
+### `pane.rename`
+
+params:
+
+```json
+{
+ "pane_id": "1-1",
+ "label": "reviewer"
+}
+```
+
+send `label: null` or omit `label` to clear the manual pane label.
+
+returns `pane_info`.
+
+### `pane.read`
+
+params:
+
+```json
+{
+ "pane_id": "1-1",
+ "source": "recent",
+ "lines": 80,
+ "format": "text",
+ "strip_ansi": true
+}
+```
+
+notes:
+
+- `source` is required and must be `visible`, `recent`, or `recent_unwrapped`
+- `lines` is optional
+- current implementation defaults to `80` lines when `lines` is omitted and caps reads at `1000`
+- `format` defaults to `text`; use `ansi` for a rendered VT/ANSI snapshot with styles preserved
+- `strip_ansi` defaults to `true` and is kept for compatibility
+
+`source` meanings:
+
+- `visible` — current viewport
+- `recent` — recent scrollback text
+- `recent_unwrapped` — recent scrollback text with soft wraps joined
+
+example response:
+
+```json
+{
+ "id": "req_read",
+ "result": {
+ "type": "pane_read",
+ "read": {
+ "pane_id": "1-1",
+ "workspace_id": "1",
+ "tab_id": "1:1",
+ "source": "recent",
+ "format": "text",
+ "text": "...",
+ "revision": 0,
+ "truncated": false
+ }
+ }
+}
+```
+
+### `pane.split`
+
+params:
+
+```json
+{
+ "target_pane_id": "1-1",
+ "direction": "right",
+ "focus": true
+}
+```
+
+notes:
+
+- `direction` must be `right` or `down`
+- `cwd` is optional
+- `focus` is optional in raw socket requests and defaults to `false`
+- the cli wrapper also defaults to no focus; pass `--focus` to switch to the new pane
+
+returns `pane_info` for the new pane.
+
+### `pane.send_text`
+
+params:
+
+```json
+{
+ "pane_id": "1-1",
+ "text": "bun run dev"
+}
+```
+
+this sends literal text only. it does **not** press Enter.
+
+### `pane.send_keys`
+
+params:
+
+```json
+{
+ "pane_id": "1-1",
+ "keys": ["Enter"]
+}
+```
+
+use this after `pane.send_text` when you want to submit a command.
+
+### `pane.send_input`
+
+params:
+
+```json
+{
+ "pane_id": "1-1",
+ "text": "bun run dev",
+ "keys": ["Enter"]
+}
+```
+
+this sends text plus encoded keypresses in order within one request. when bracketed paste is enabled in the pane, the text portion is sent as a paste payload before the keys. use this when you need `text + Enter` to behave more like a real keypress sequence than `pane.send_text` with a literal trailing `\r`.
+
+`text` and `keys` are both optional, but at least one should usually be present.
+
+### `pane.report_agent`
+
+use this when an agent hook or plugin wants to report a semantic state directly over the socket api.
+
+params:
+
+```json
+{
+ "pane_id": "1-1",
+ "source": "custom:hermes",
+ "agent": "hermes",
+ "state": "working",
+ "message": "running tools"
+}
+```
+
+notes:
+
+- `source` is required and identifies the reporting integration instance
+- `agent` is required and may be any non-empty label string
+- built-in names like `pi` are normalized to their public label form
+- custom labels like `hermes` are accepted as-is
+- while this authority is active, the reported `agent` and `state` override heuristic display for that pane
+- process detection still owns pane liveness and fallback when hook authority is cleared or released
+- `message` is optional metadata for the reporting integration
+
+returns `ok`.
+
+### `pane.clear_agent_authority`
+
+params:
+
+```json
+{
+ "pane_id": "1-1",
+ "source": "custom:hermes"
+}
+```
+
+notes:
+
+- `source` is optional
+- when `source` is omitted, any hook authority for that pane is cleared
+- when `source` is present, only that reporting source is cleared
+
+returns `ok`.
+
+### `pane.release_agent`
+
+use this when the reported agent is exiting cleanly and wants herdr to drop agent identity immediately instead of waiting for fallback detection.
+
+params:
+
+```json
+{
+ "pane_id": "1-1",
+ "source": "custom:hermes",
+ "agent": "hermes"
+}
+```
+
+notes:
+
+- `agent` uses the same non-empty label rules as `pane.report_agent`
+- this clears the pane's effective agent identity immediately when the source and label match the active authority
+- for built-in detected agents, herdr also applies its normal short reacquire suppression during graceful release
+
+returns `ok`.
+
+### `pane.close`
+
+params:
+
+```json
+{
+ "pane_id": "1-2"
+}
+```
+
+returns `ok`.
+
+## waits
+
+### `pane.wait_for_output`
+
+this is the direct socket-side one-shot blocking wait.
+
+params:
+
+```json
+{
+ "pane_id": "1-1",
+ "source": "recent",
+ "lines": 200,
+ "match": { "type": "substring", "value": "ready" },
+ "timeout_ms": 30000,
+ "strip_ansi": true
+}
+```
+
+matcher forms:
+
+```json
+{ "type": "substring", "value": "ready" }
+```
+
+```json
+{ "type": "regex", "value": "server.*ready" }
+```
+
+notes:
+
+- `source` must be `visible`, `recent`, or `recent_unwrapped`
+- `lines` is optional
+- `timeout_ms` is optional
+- `strip_ansi` defaults to `true`
+- for `source = "recent"`, output matching uses unwrapped recent terminal text so soft wraps do not break matches
+- `source = "recent_unwrapped"` is also available on `pane.read` when you want to inspect the same unwrapped transcript directly
+- on success you get `output_matched`
+- on timeout you get an error response with code `timeout`
+
+example success response:
+
+```json
+{
+ "id": "req_wait",
+ "result": {
+ "type": "output_matched",
+ "pane_id": "1-1",
+ "revision": 0,
+ "matched_line": "server ready",
+ "read": {
+ "pane_id": "1-1",
+ "workspace_id": "1",
+ "tab_id": "1:1",
+ "source": "recent_unwrapped",
+ "text": "...server ready...",
+ "revision": 0,
+ "truncated": false
+ }
+ }
+}
+```
+
+## subscriptions
+
+`events.subscribe` is the long-lived pubsub entrypoint.
+
+you send a subscribe request once, get an ack on the same connection, and then keep reading newline-delimited json events from that same socket.
+
+### subscription ack
+
+```json
+{
+ "id": "sub_1",
+ "result": {
+ "type": "subscription_started"
+ }
+}
+```
+
+### supported subscriptions
+
+base lifecycle subscriptions:
+
+- `workspace.created`
+- `workspace.closed`
+- `workspace.focused`
+- `tab.created`
+- `tab.closed`
+- `tab.focused`
+- `tab.renamed`
+- `pane.created`
+- `pane.closed`
+- `pane.focused`
+- `pane.exited`
+- `pane.agent_detected`
+
+parameterized subscriptions:
+
+- `pane.output_matched`
+- `pane.agent_status_changed`
+
+### event naming rule
+
+this part matters because the pushed event names are **not all shaped the same**.
+
+- when you subscribe to a **base lifecycle event**, the pushed `event` value uses snake_case with underscores:
+ - subscribe with `workspace.created`
+ - receive `workspace_created`
+- when you subscribe to a **parameterized subscription**, the pushed `event` value keeps the dotted name:
+ - subscribe with `pane.output_matched`
+ - receive `pane.output_matched`
+
+examples below show both forms.
+
+### example: subscribe to lifecycle events
+
+request:
+
+```json
+{
+ "id": "sub_life",
+ "method": "events.subscribe",
+ "params": {
+ "subscriptions": [
+ { "type": "workspace.created" },
+ { "type": "workspace.focused" },
+ { "type": "tab.created" },
+ { "type": "tab.focused" },
+ { "type": "tab.renamed" },
+ { "type": "tab.closed" },
+ { "type": "pane.created" },
+ { "type": "pane.focused" },
+ { "type": "pane.agent_detected" },
+ { "type": "pane.closed" },
+ { "type": "workspace.closed" }
+ ]
+ }
+}
+```
+
+example pushed event:
+
+```json
+{
+ "event": "workspace_created",
+ "data": {
+ "workspace": {
+ "workspace_id": "1",
+ "number": 1,
+ "label": "herdr",
+ "focused": true,
+ "pane_count": 1,
+ "tab_count": 1,
+ "active_tab_id": "1:1",
+ "agent_status": "unknown"
+ }
+ }
+}
+```
+
+### example: subscribe to output matches and agent status changes
+
+request:
+
+```json
+{
+ "id": "sub_1",
+ "method": "events.subscribe",
+ "params": {
+ "subscriptions": [
+ {
+ "type": "pane.output_matched",
+ "pane_id": "1-1",
+ "source": "recent",
+ "lines": 200,
+ "match": { "type": "substring", "value": "ready" }
+ },
+ {
+ "type": "pane.agent_status_changed",
+ "pane_id": "1-1",
+ "agent_status": "done"
+ }
+ ]
+ }
+}
+```
+
+notes:
+
+- `pane.output_matched` supports `source`, optional `lines`, matcher config, and optional `strip_ansi`
+- `pane.agent_status_changed` accepts an optional `agent_status` filter; if omitted, any status transition for that pane can match
+
+example pushed `pane.output_matched` event:
+
+```json
+{
+ "event": "pane.output_matched",
+ "data": {
+ "pane_id": "1-1",
+ "matched_line": "server ready",
+ "read": {
+ "pane_id": "1-1",
+ "workspace_id": "1",
+ "tab_id": "1:1",
+ "source": "recent_unwrapped",
+ "text": "...server ready...",
+ "revision": 0,
+ "truncated": false
+ }
+ }
+}
+```
+
+example pushed `pane.agent_status_changed` event:
+
+```json
+{
+ "event": "pane.agent_status_changed",
+ "data": {
+ "pane_id": "1-1",
+ "workspace_id": "1",
+ "agent_status": "done",
+ "agent": "pi"
+ }
+}
+```
+
+`agent` in pushed events follows the same rules as `pane_info.agent`: it may be a built-in detected name, a custom hook-reported label, or omitted.
+## cli wrappers
+
+these commands provide the shell-facing control surface. most command groups talk to the local socket; `status client` only inspects the local executable.
+
+### command groups
+
+status commands:
+
+```text
+herdr status
+herdr status server
+herdr status client
+```
+
+`herdr -V` and `herdr --version` print the local executable version without contacting the server. `herdr status` compares that local executable with the running server when one is reachable.
+
+workspace commands:
+
+```text
+herdr workspace list
+herdr workspace create [--cwd PATH] [--label TEXT] [--focus] [--no-focus]
+herdr workspace get <workspace_id>
+herdr workspace focus <workspace_id>
+herdr workspace rename <workspace_id> <label>
+herdr workspace close <workspace_id>
+```
+
+tab commands:
+
+```text
+herdr tab list [--workspace <workspace_id>]
+herdr tab create [--workspace <workspace_id>] [--cwd PATH] [--label TEXT] [--focus] [--no-focus]
+herdr tab get <tab_id>
+herdr tab focus <tab_id>
+herdr tab rename <tab_id> <label>
+herdr tab close <tab_id>
+```
+
+pane commands:
+
+```text
+herdr pane list [--workspace <workspace_id>]
+herdr pane get <pane_id>
+herdr pane rename <pane_id> <label>|--clear
+herdr pane read <pane_id> [--source visible|recent|recent-unwrapped] [--lines N] [--format text|ansi] [--ansi]
+herdr pane split <pane_id> --direction right|down [--cwd PATH] [--focus] [--no-focus]
+herdr pane close <pane_id>
+herdr pane send-text <pane_id> <text>
+herdr pane send-keys <pane_id> <key> [key ...]
+herdr pane run <pane_id> <command>
+```
+
+wait commands:
+
+```text
+herdr wait output <pane_id> --match <text> [--source visible|recent|recent-unwrapped] [--lines N] [--timeout MS] [--regex] [--raw]
+herdr wait agent-status <pane_id> --status <idle|working|blocked|done|unknown> [--timeout MS]
+```
+
+### cli behavior notes
+
+- `status` prints local client version/protocol, running server version/protocol when reachable, socket path, compatibility, and whether a restart is needed
+- `status server` prints only the running server side; if no server is reachable it exits successfully and prints `status: not running`
+- `status client` prints only the local executable version/protocol and binary path without contacting the server
+- `workspace create` keeps focus where it is by default; pass `--focus` to switch to the new workspace
+- `workspace create` without `--label` keeps the default cwd-based workspace naming
+- `workspace create --label` applies the custom workspace name immediately
+- `workspace create` returns `result.workspace`, `result.tab`, and `result.root_pane`
+- `tab create` keeps focus where it is by default; pass `--focus` to switch to the new tab
+- `tab create` without `--label` keeps the default numbered tab naming
+- `tab create --label` applies the custom tab name immediately
+- `tab create` returns `result.tab` and `result.root_pane`
+- `pane split` keeps focus where it is by default; pass `--focus` to switch to the new pane
+- `pane read` prints **text**, not json
+- `pane read --format ansi` and `pane read --ansi` print a rendered ANSI snapshot with colors/styles preserved
+- `pane read --source recent-unwrapped` returns recent terminal text with soft wraps joined back together
+- `pane send-text`, `pane send-keys`, and `pane run` print nothing on success
+- list/get/create/split/wait commands print json on success
+- `pane run` is a convenience wrapper for `pane.send_input` with the command text followed by a real `Enter` keypress
+- `wait agent-status` is a cli convenience built on top of event subscriptions
+- use it when you want the same `done` / `idle` distinction the UI shows
+- `--raw` is a legacy alias for ANSI formatted `pane read` output and still disables ansi stripping for `wait output`
+- `wait output --source recent` matches against unwrapped recent terminal text by default, so pane width and soft wrapping do not break matches
+
+### cli examples
+
+create a workspace, split a pane, run a server, and wait for readiness:
+
+```bash
+herdr workspace create --cwd /path/to/project --label "api server"
+herdr pane split 1-1 --direction right --no-focus
+herdr pane run 1-2 "npm run dev"
+herdr wait output 1-2 --match "ready" --timeout 30000
+```
+
+wait for another agent to finish in the same user-facing sense the UI shows:
+
+```bash
+herdr wait agent-status 1-1 --status done --timeout 60000
+```
+
+inspect another pane's output:
+
+```bash
+herdr pane read 1-1 --source recent --lines 80
+```
+
+## behavior notes and gotchas
+
+- `pane.send_text` sends literal text only. if you want to execute a command, follow it with `pane.send_keys` and `Enter`, use `pane.send_input` for ordered `text + keypress` input, or use cli `pane run`, which sends the text and then a real Enter key in one request.
+- `pane.read` and `pane.wait_for_output` strip ansi by default.
+- `pane.output_matched` subscriptions fire on transitions into a matching state; they do not repeatedly spam the same still-visible match on every poll.
+- closing the socket connection ends the subscription.
+- there is no separate event transport.
+- the same herdr process can serve regular request/response calls and long-lived subscription connections at the same time.
diff --git a/.pi/prompts/draft-changelog.md b/.pi/prompts/draft-changelog.md
index 1b0bce51..de9f3c78 100644
--- a/.pi/prompts/draft-changelog.md
+++ b/.pi/prompts/draft-changelog.md
@@ -46,11 +46,13 @@ Process:
6. Audit public docs for release readiness.
- Treat `HEAD` as the release candidate that will be released after the changelog is drafted.
- - Compare meaningful user-facing changes in the range against public docs, especially `README.md`, `CONFIGURATION.md`, `INTEGRATIONS.md`, `SOCKET_API.md`, `website/`, and example config snippets.
- - Flag missing docs for new or changed features, commands, config keys, protocol behavior, integrations, defaults, and compatibility notes that should be documented for this release.
- - Flag stale docs that now describe behavior incorrectly.
- - Flag docs that mention work not included in the release range, deferred experiments, or incomplete features that should not ship in public docs yet.
+ - Treat root `README.md`, `CONFIGURATION.md`, `INTEGRATIONS.md`, and `SOCKET_API.md` as the latest released public docs.
+ - Treat `.pi/docs/README.md`, `.pi/docs/CONFIGURATION.md`, `.pi/docs/INTEGRATIONS.md`, and `.pi/docs/SOCKET_API.md` as the next-release versions of those public docs.
+ - Compare meaningful user-facing changes in the range against `.pi/docs/` first. Flag missing next-release docs for new or changed features, commands, config keys, protocol behavior, integrations, defaults, and compatibility notes that should be documented for this release.
+ - Compare `.pi/docs/` against the root docs. Flag each difference as either intended to ship in this release, stale, or needing user decision.
+ - Also audit `website/` and example config snippets for release readiness, but keep them aligned with the latest published release unless the user explicitly asks for prerelease docs.
- Do not edit docs unless the user explicitly asks; report the docs audit alongside the changelog draft.
+ - When the user asks to apply the release draft, update `CHANGELOG.md`, apply approved documentation changes to `.pi/docs/`, then copy the approved `.pi/docs/` files into the matching root public docs so `just release-docs-check` passes.
7. Draft the changelog entry.
- Group items under these sections when applicable:
@@ -77,7 +79,8 @@ Output format:
- `PRs included:`
- `Direct commits included:`
- `Excluded as housekeeping:`
-- `Public docs release-readiness audit:`
+- `Next-release docs audit:`
+- `Public docs finalization plan:`
- `Proposed changelog entry:`
If the range has no meaningful user-facing changes, say that plainly instead of forcing entries.