Skip to content

feat(herdr): report forge lifecycle state to herdr - #1

Open
bugakov wants to merge 2 commits into
mainfrom
feat/herdr-integration
Open

bugakov wants to merge 2 commits into
mainfrom
feat/herdr-integration

Conversation

@bugakov

@bugakov bugakov commented Oct 4, 2026

Copy link
Copy Markdown
Owner

Summary

Adds official Herdr agent support to forge via the documented
"Add Herdr support to your agent" integration path (herdr pane report-agent).

When forge runs inside a Herdr pane it inherits HERDR_ENV, HERDR_PANE_ID,
HERDR_BIN_PATH and HERDR_SOCKET_PATH; a lightweight hook reporter uses those to
push lifecycle state so Herdr can show forge in its sidebar, wait on state, notify
on completion and restore the same session after a server restart.

Outside a Herdr pane (HERDR_ENV unset) the reporter is a strict no-op, so plain
terminal usage is unaffected.

What it reports

Event State
Start working (+ resume argv: --conversation-id, --model)
Response idle
ToolcallStart working (tool name in message)
process exit (main → release_global()) release-agent

Sequence numbers are epoch-milliseconds (monotonic, per Herdr's requirements);
reports are fire-and-forget with a short timeout and errors ignored.

Scope

  • crates/forge_app/src/hooks/herdr.rs — the reporter (new)
  • crates/forge_app/src/app.rs — wired into the hook chain
  • crates/forge_main/src/main.rs — release_global() on exit
  • plumbing in hooks/mod.rs, lib.rs
  • .github/workflows/build.yml — CI binary artifact builder

Testing

Validated against a real herdr 0.9.3 server:

  • agent registered as forge / working in herdr agent list while a turn runs,
  • herdr agent wait <pane> --until idle resolves with agent_status: idle,
  • pane released (agent name cleared) after forge exits,
  • CLI (forge -p ...) and interactive TUI both covered.

Linked fork PR preparing the change for upstream submission.

Adds a HerdrReporter hook that pushes forge state into the herdr agent
pane via `herdr pane report-agent` whenever the process is running inside
a herdr environment ($HERDR_ENV=1):

- Start  -> working
- Response -> idle
- ToolcallStart -> working (with tool name)
- process exit -> release-agent

The reporter is a no-op outside herdr (no active runner, no herdr env),
so impact on plain terminal usage is zero. This is the official "add
Herdr support to your agent" integration path and requires no herdr
binary changes; on the herdr side it enables agent detection, sidebar
presence, `herdr agent wait`, notifications and session resume.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant