pi-herdr-tab-name

Sync the pi coding agent session name to the herdr tab label

Packages

Package details

extension

Install pi-herdr-tab-name from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:pi-herdr-tab-name
Package
pi-herdr-tab-name
Version
0.1.0
Published
Sep 30, 2026
Downloads
184/mo · 6/wk
Author
simba123
License
MIT
Types
extension
Size
10.1 KB
Dependencies
0 dependencies · 0 peers
Pi manifest JSON
{
  "extensions": [
    "./index.ts"
  ]
}

Security note

Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.

README

pi-herdr-tab-name

pi extension that syncs the pi session display name (/name, pi -n, pi.setSessionName()) to the herdr tab label — in real time, both ways that matter:

You do Tab label does
/name refactor auth becomes refactor auth
pi -n my-session becomes my-session on startup
/resume into a named session follows the session's name
/name (clear) restores the label it saw before the first rename
session has no name stays untouched

Requirements

  • pi coding agent
  • herdr with the pi agent integration installed (herdr integration install pi). The integration injects the HERDR_* environment variables this extension needs.

Outside a herdr pane (plain terminal, headless run) the extension is inert: it registers no handlers and issues no I/O.

Install

pi install npm:pi-herdr-tab-name

Or from the GitHub repository:

pi install git:github.com/14sxlin/pi-herdr-tab-name

Try without installing:

pi -e npm:pi-herdr-tab-name

How it works

pi and herdr already talk: herdr's managed herdr-agent-state.ts extension reports agent state and session ids over herdr's socket API, but herdr has no notion of pi's session name. This companion extension listens to pi's session_start / session_info_changed events and, over the same socket (pane.get → tab.get → tab.rename), renames the tab hosting the pane.

  • One serialized queue per session; every rename path is idempotent and retried with bounded backoff (herdr's socket server intermittently ignores rapid successive connections).
  • Requests time out at 2 s and every failure is swallowed — the extension can never take pi down.
  • Labels are normalized: control characters collapsed, trimmed, capped at 80 chars.
  • TUI only: headless pi runs inside a herdr pane never touch the shared tab label.

Platform support

Platform Status
Windows + herdr 0.8.2 tested ✅
Linux / macOS expected to work (socket endpoint logic mirrors herdr's own integration), not yet verified — issues welcome

Limitations

  • The sync overwrites manual tab renames once the session is named — that is the point of the feature.
  • Multiple pi panes sharing one tab: last write wins.
  • herdr's tab.rename cannot clear a label, so "clear" restores the pre-rename label instead.

License

MIT