# pi-herdr-rename

Pi extension that keeps the current Herdr tab named after the coding agent's primary work scope.

The extension registers only inside an active Herdr environment: `HERDR_ENV=1`, `HERDR_SOCKET_PATH`, and `HERDR_PANE_ID` must all be present. It rechecks this environment and resolves the live pane before renaming.

## Contract

The extension registers one agent-callable tool:

```text
rename_herdr_tab({ name })
```

The agent calls `rename_herdr_tab` once before starting work when its primary task scope changes. It does not rename for follow-ups, subtasks, status updates, or continuations.

At session start, the extension checks the current tab label. A digits-only default label such as `1` or `2` adds a hidden reminder to the first agent turn, repeated until the tab is renamed successfully. Custom labels do not add a reminder.

Each call:

1. Reads `HERDR_PANE_ID`.
2. Resolves the pane's current tab with `herdr pane get`.
3. Renames that tab with `herdr tab rename` using argv-based execution.

Scope names must be a single printable line of at most 60 characters.

The intended Herdr layout is one coding agent per tab. Additional panes in that tab are for CLI commands and other processes. The extension intentionally provides no cross-agent collision handling.

## Install

```bash
pi install npm:pi-herdr-rename
```

For local development:

```bash
pi -ne -e ./src/index.ts
```

## Test

```bash
npm install
npm test
```
