Skip to content

feat(herdr): make concurrent agents distinguishable and wire session restore - #231

Merged
paveg merged 2 commits into
mainfrom
feat/herdr-agent-visibility
Aug 7, 2026
Merged

paveg merged 2 commits into
mainfrom
feat/herdr-agent-visibility

Conversation

@paveg

@paveg paveg commented Aug 7, 2026

Copy link
Copy Markdown
Owner

Why

Two gaps surfaced while auditing herdr --default-config against this repo's config and checking what the running herdr server actually reports over its API.

The agent sidebar could not tell concurrent agents apart. Every pane here runs Claude, so the default row layout [["state_icon", "workspace", "tab"], ["agent"]] printed one identical "claude" label per entry. agent_panel_sort = "priority" was already set, so herdr was ordering entries by who needs attention and then giving the reader nothing to distinguish them by. The distinguishing data was already in the API snapshot as terminal_title_stripped.

Agent session restore was silently inert. [session] resume_agents_on_restore defaults to true and reads as enabled, but it needs an official integration to report session refs, and herdr integration status showed claude: not installed. The API snapshot confirmed the consequence: no session-ref field on any of the five running agents, so a herdr server restart would have restored the panes and lost the conversations.

What changed

herdr config — the Claude sidebar rows now show terminal_title_stripped, scoped through rows_by_agent so other agent kinds keep the default layout. Opted into experimental.reveal_hidden_cursor_for_cjk_ime with cjk_ime_agents = ["claude"], which keeps the macOS IME candidate window tracking the pane cursor in TUIs that paint their own cursor. Also recorded agent_panel_sort = "priority", which had been chosen through the Settings TUI and never written back, so a chezmoi apply would have reverted it to the spaces default.

Claude settings template — added the SessionStart hook that herdr integration install claude wires up.

sequenceDiagram
    participant CC as Claude Code
    participant Hook as herdr-agent-state.sh
    participant Srv as herdr server
    CC->>Hook: SessionStart (session_id, transcript_path)
    Hook->>Srv: pane.report_agent_session (unix socket)
    Note over Srv: stores session ref for restore
Loading

The path renders through .chezmoi.homeDir, not $HOME. herdr decides whether the hook is already wired by matching its own absolute-path spelling, so a $HOME form goes unrecognized and a reinstall appends a second entry that fires the hook twice per session. Both forms were tested in an isolated HOME before choosing.

Verification

  • herdr server reload-config returns {"diagnostics":[],"status":"applied"} for the config change. status is the signal here, not diagnostics: herdr config check reports config: ok even for a conflicting keybinding, and empty diagnostics do not imply the config took effect.
  • The rendered template's hooks.SessionStart compares equal to what herdr integration install claude wrote, and the existing PreToolUse hooks still hold all 8 commands.
  • herdr integration status now reports claude: current (v7).
  • Integration behavior was exercised in a throwaway HOME before touching the real one: existing hooks are preserved, reinstall is idempotent, and top-level key order is retained.
  • just fmt-check and just lint-zsh pass. just lint still fails on the pre-existing missing-luac environment gap, unrelated to this change.

Not in this PR: the herdr --skill agent skill was deliberately declined. It exposes herdr pane read, send-keys, and run against arbitrary panes, which would let one agent drive another pane's shell and route around the PreToolUse guards this repo installs.

The pre-existing key-order and _tag drift between ~/.claude/settings.json and the template is left untouched; applying it would push unrelated churn through this PR.

🤖 Generated with Claude Code

paveg and others added 2 commits August 7, 2026 11:30
Every pane in this setup runs Claude, so the sidebar's default ["agent"] row
rendered one identical "claude" label per entry and left agent_panel_sort =
"priority" with nothing to distinguish the entries it had just ordered. Show
terminal_title_stripped instead, which carries the actual task.

Also opt into reveal_hidden_cursor_for_cjk_ime, scoped to Claude panes, so the
macOS IME candidate window keeps tracking the pane cursor in TUIs that paint
their own. Panes running an app that hides the cursor without painting a
replacement keep the default behavior.

agent_panel_sort itself was chosen through the Settings TUI and never made it
back to this source, so a chezmoi apply would have reverted it to "spaces".

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
`herdr integration install claude` adds a SessionStart hook that reports the
Claude session id and transcript path over herdr's local unix socket. That
report is what [session] resume_agents_on_restore needs; without it herdr
restores the pane but not the conversation.

Render the path through .chezmoi.homeDir rather than $HOME. herdr decides
whether the hook is already wired by matching its own absolute-path spelling,
so a $HOME form is not recognized and a reinstall appends a second entry that
fires the hook twice per session.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@changeset-bot

changeset-bot Bot commented Aug 7, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 73bd2e8

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@paveg paveg added the enhancement New feature or request label Aug 7, 2026
@paveg
paveg merged commit 0f234db into main Aug 7, 2026
12 checks passed
@paveg
paveg deleted the feat/herdr-agent-visibility branch August 7, 2026 02:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant