hermes - 💡(How to fix) Fix [Feature]: Add goal lifecycle plugin hooks (on_goal_set/pause/resume/complete)

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

The /goal system has a complete state machine (set → evaluate → pause → resume → complete), but this lifecycle is completely invisible to the plugin system. While Hermes exposes hook points for sessions (on_session_start/end), LLM calls (pre/post_llm_call), and API requests (pre/post_api_request), there is no way for a plugin to observe or react to goal lifecycle events.

This makes it impossible for plugins to:

  • Monitor goal progress or completion status
  • Log goal auto-pauses (e.g. due to API errors, as fixed by #27585)
  • Send notifications when a goal pauses or completes
  • Build custom integrations based on goal state changes

Error Message

| on_goal_pause | Goal auto-pauses (API error / parse failure / timeout) | reason, state_snapshot |

  • #27585 — Recent fix for goal API error auto-pause (would benefit from on_goal_pause hook for notification)

Root Cause

The /goal system has a complete state machine (set → evaluate → pause → resume → complete), but this lifecycle is completely invisible to the plugin system. While Hermes exposes hook points for sessions (on_session_start/end), LLM calls (pre/post_llm_call), and API requests (pre/post_api_request), there is no way for a plugin to observe or react to goal lifecycle events.

This makes it impossible for plugins to:

  • Monitor goal progress or completion status
  • Log goal auto-pauses (e.g. due to API errors, as fixed by #27585)
  • Send notifications when a goal pauses or completes
  • Build custom integrations based on goal state changes

Fix Action

Fix / Workaround

This makes it impossible for plugins to:

  • Monitor goal progress or completion status
  • Log goal auto-pauses (e.g. due to API errors, as fixed by #27585)
  • Send notifications when a goal pauses or completes
  • Build custom integrations based on goal state changes
RAW_BUFFERClick to expand / collapse

Summary

The /goal system has a complete state machine (set → evaluate → pause → resume → complete), but this lifecycle is completely invisible to the plugin system. While Hermes exposes hook points for sessions (on_session_start/end), LLM calls (pre/post_llm_call), and API requests (pre/post_api_request), there is no way for a plugin to observe or react to goal lifecycle events.

This makes it impossible for plugins to:

  • Monitor goal progress or completion status
  • Log goal auto-pauses (e.g. due to API errors, as fixed by #27585)
  • Send notifications when a goal pauses or completes
  • Build custom integrations based on goal state changes

Proposed Hooks

HookTriggerPayload
on_goal_setUser sets a new goalgoal_text, max_turns, session_id
on_goal_pauseGoal auto-pauses (API error / parse failure / timeout)reason, state_snapshot
on_goal_resumeGoal resumes executionreset_budget, state_snapshot
on_goal_completeGoal is achievedturns_used, summary

Benefits

  • Observability: Plugins can track goal progress in external systems (Langfuse, PostHog, etc.)
  • Notifications: Goal auto-pauses can trigger user notifications beyond terminal output
  • Extensibility: Third-party plugins can implement custom goal judges, completion alerts, or analytics

Implementation Notes

  • All new hooks should be fire-and-forget (no return value modification), consistent with the existing hook contract
  • Hook invocation points in hermes_cli/goals.py: set(), pause(), resume(), judge_goal()
  • No breaking changes — existing behavior is preserved
  • The internal goal continuation hook in cli.py/gateway/run.py is an internal implementation detail; this proposal adds the plugin-visible hook layer

Related

  • #27585 — Recent fix for goal API error auto-pause (would benefit from on_goal_pause hook for notification)
  • agent/conversation_loop.py — Contains all existing _invoke_hook() calls for reference pattern

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING