Skip to content

[Feature]: Add goal lifecycle plugin hooks (on_goal_set/pause/resume/complete) #27777

@zccyman

Description

@zccyman

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:

Proposed Hooks

Hook Trigger Payload
on_goal_set User sets a new goal goal_text, max_turns, session_id
on_goal_pause Goal auto-pauses (API error / parse failure / timeout) reason, state_snapshot
on_goal_resume Goal resumes execution reset_budget, state_snapshot
on_goal_complete Goal is achieved turns_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

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Low — cosmetic, nice to havecomp/agentCore agent loop, run_agent.py, prompt buildercomp/pluginsPlugin system and bundled pluginstype/featureNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions