Skip to content

[Feature]: expose discover_and_load(force=True) via hermes plugins install --reload flag #15626

@p-diogo

Description

@p-diogo

Problem or Use Case

PluginManager.discover_and_load(force=True) already exists at hermes_cli/plugins.py:523 and clears + rescans plugin state in-process. But no CLI command, no signal, and no IPC method exposes it to a running gateway. This means a user (or an agent) running inside the gateway has no way to install a plugin and have it bind without a full process restart.

After hermes plugins install <pkg> (hermes_cli/plugins_cmd.py:285-440), the CLI explicitly tells the user (line 437-438): "Restart the gateway for the plugin to take effect — hermes gateway restart".

This creates a real catch-22 for agentic flows where the agent itself is the entity invoking the install via its shell tool. The agent's shell runs inside the gateway it would need to restart, so it cannot complete the install end-to-end without breaking the conversation. SIGUSR1 graceful-drain still exits with code 75 and relies on a supervisor (systemd / launchd) to respawn — also problematic for non-systemd hosts.

This blocks autonomous agent installations of Hermes plugins (e.g. memory plugins, RAG integrations, etc.) where the human is not at the terminal. We see this routinely in our deployment — agents end up telling users to manually restart, breaking the flow.

Proposed Solution

Wire discover_and_load(force=True) to a CLI command. Two-flag surface:

  1. hermes plugins install <pkg> --reload — after install, call discover_and_load(force=True) against the running gateway via existing IPC (or via the SIGUSR2-style signal path, if needed).
  2. hermes plugins reload — standalone command for cases where the user wants to refresh after manual edits.

Behavior:

  • If gateway not running: --reload is a no-op + warning; the install still succeeds and next gateway start picks it up
  • If gateway running: triggers in-process refresh; existing in-flight requests complete; new ones see the new plugin
  • No process death, no PID file race, no supervisor dependency

Update the post-install message at hermes_cli/plugins_cmd.py:437-438 to:

"Plugin installed. Run hermes plugins reload to bind it without a gateway restart, or restart manually if reload mode is disabled."

Alternatives Considered

  1. Status quo (full restart) — works but breaks agentic flows. Catch-22 for agent-driven installs.
  2. SIGUSR1 graceful drain + supervisor respawn — current behavior; still exits code 75 + requires external supervisor. Doesn't solve agent-inside-gateway scenario.
  3. File-watcher (e.g. chokidar / watchdog watching the plugin config file) — works but requires a long-running daemon thread + adds moving parts. The CLI flag is the smallest delta — primitive already exists, just needs wiring.

Feature Type

CLI improvement

Scope

Small (single file, < 50 lines)

Contribution

  • I'd like to implement this myself and submit a PR

Debug Report (optional)

Not applicable — this is a feature request, not a bug.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Low — cosmetic, nice to havecomp/cliCLI entry point, hermes_cli/, setup wizardcomp/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