Conversation
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.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Hi! While using forge inside Herdr, I noticed there's no
way for Herdr to know when forge is working, idle, or needs input. Herdr
documents a first-party integration path for exactly this — "Add Herdr support
to your agent" (
herdr pane report-agent) — so I implemented it for forge.The change is fully opt-in and a strict no-op outside Herdr; it cannot
affect normal terminal usage.
How it works
When forge runs inside a Herdr pane it inherits
HERDR_ENV,HERDR_PANE_ID,HERDR_BIN_PATHandHERDR_SOCKET_PATH. A small reporter hooked into forge'sexisting lifecycle events turns those into state reports:
Startworking(+ resume argv)ResponseidleToolcallStartworking(with tool name)release-agentReports are fire-and-forget (background spawn, short timeout, errors ignored),
so Herdr can never slow forge down.
seqis epoch-milliseconds as Herdrrecommends. On the Herdr side this enables: showing forge in the sidebar,
herdr agent wait, completion notifications, and restoring the same sessionafter a server restart.
Scope (5 files, +314/-5)
crates/forge_app/src/hooks/herdr.rs— new reporter using the existingEventHandlehook chain (Start/Response/ToolcallStart/End)crates/forge_app/src/app.rs— register the reporter inchat's hook chaincrates/forge_main/src/main.rs—release_global()on exithooks/mod.rs,lib.rsNo new dependencies. Uses
tokio::process(already a workspace feature).Testing
Verified against Herdr 0.9.3 (local server):
forge / workinginherdr agent listwhile a turn runsherdr agent wait <pane> --until idleresolves withagent_status: idleforge -p ...(CLI) and interactive TUI coveredHERDR_ENVunset) — zero impactHappy to adjust anything (naming, placement, or wiring) to fit your
conventions. Thanks for the great tool!