Hermes Agent hooks let you run your own code at key moments in every conversation: before a tool runs, before the model is called, when a session starts, when a reply is finished. On 1 November 2026 Nous Research merged a big one into hermes-agent: a pre_llm_call hook can now block a turn before any request reaches the model. It shipped in the stable v0.22.6 release on 2 November. That gives privacy and policy checks a proper, supported place to live. Below are the four hook systems, how to add a shell hook in a few lines, how blocking works, and the safety rules. My video is right under this intro.

Key takeaways

  • Hermes has 4 hook systems: gateway hooks, plugin hooks, shell hooks and outbound webhooks.
  • Shell hooks live in the hooks: block of config.yaml and can be any script.
  • pre_tool_call can block or rewrite a tool call; pre_llm_call can now block the whole turn.
  • Manage them with hermes hooks list, test, revoke and doctor.
  • Want guardrails like this on your business agents? Get your Backlink Gameplan, or try Polar Rank free for 3 days.

What are Hermes Agent hooks?

The Event Hooks docs describe four ways to plug your own code into Hermes:

System Set up with Runs in Good for
Gateway hooks HOOK.yaml + handler.py in ~/.hermes/hooks/ Gateway only Logging, alerts, webhooks
Plugin hooks ctx.register_hook() in a plugin CLI + gateway Tool interception, metrics, guardrails
Shell hooks hooks: block in config.yaml CLI, gateway, Desktop, TUI, dashboard Drop-in scripts: blocking, auto-formatting, context
Outbound webhooks hooks.outbound: list in config.yaml CLI + gateway Signed events to CI, dashboards, other agents

A broken hook is logged and skipped, so it never crashes the agent. But hooks aren’t all passive: some can stop a tool, replace text or end a turn.

The new pre_llm_call block

Before this change, pre_llm_call could only add extra context to your message (that’s how memory and RAG plugins work). The 1 November commit adds a second option: return a block and the turn ends before the model sees anything.

return {"action": "block", "message": "Blocked by policy: prompt contains a customer ID."}

What happens next, from the commit and the updated docs:

Nous calls this the supported place for data-loss-prevention, privacy and policy plugins, which until now had to patch Hermes itself.

Want guardrails and automations running on your AI agents? Inside the AI Profit Boardroom you get the Agent OS — Hermes, OpenClaw, OpenCode, Claude and Codex in one place — plus step-by-step Hermes training and four live coaching calls a week.

Want a plan for your business first? Get your Backlink Gameplan, or try Polar Rank free for 3 days.

Join the AI Profit Boardroom →Get Your Backlink Gameplan →Try Polar Rank Free for 3 Days →

How to add a shell hook

Shell hooks are the easiest way in: no Python plugin needed. Add a hooks: block to your profile’s config.yaml:

hooks:
  pre_tool_call:
    - matcher: "terminal"
      command: "~/.hermes/agent-hooks/check-command.sh"
      timeout: 60
      fail_closed: true

Hermes sends your script a JSON payload on stdin and reads JSON back from stdout. The rules from the docs:

Easier option: ask your agent, “Add a shell hook that blocks any terminal command containing rm -rf, then run hermes hooks test pre_tool_call to prove it works.”

What each hook can do

Most hooks just watch. A few can change what happens:

Gateway hooks are different: they fire on events such as gateway:startup, agent:start, agent:end and command:* in Telegram, Discord, Slack, WhatsApp and Teams, and can’t block anything.

The hermes hooks commands

Command What it does
hermes hooks list Shows configured hooks with matcher, timeout and consent status
hermes hooks test <event> Fires matching hooks against a sample payload and prints the response
hermes hooks revoke <command> Removes a hook’s approval; a running gateway stops it within about 30 seconds
hermes hooks doctor Checks the exec bit, approval, file changes, JSON output and run time for every hook

The first time Hermes sees a new shell hook in a foreground hermes chat, it asks you to approve it and saves your answer to ~/.hermes/shell-hooks-allowlist.json. The gateway, cron and CI never ask, so approve hooks there with --accept-hooks, HERMES_ACCEPT_HOOKS=1, or an allowlist entry.

Want this set up for you instead of doing it yourself? Get your Backlink Gameplan → or try Polar Rank free for 3 days →

Get Your Backlink Gameplan →Try Polar Rank Free for 3 Days →

Safety rules for hooks

Hooks run as you. The docs are direct about it:

My verdict

If you run Hermes for clients or a team, hooks are where your rules belong: block risky commands, keep customer data out of the model, log every session. Start with one shell hook, test it with hermes hooks test, and use the new pre_llm_call block for anything that must never reach a model. That’s the practical way to put Hermes Agent hooks to work.

About Julian Goldie

I’m Julian Goldie — founder of Goldie Agency and the AI Profit Boardroom. I test new AI agents almost every day for 432K+ YouTube subscribers and run Hermes, OpenClaw, OpenCode, Claude and Codex side by side in my own Agent OS. Get your Backlink Gameplan, try Polar Rank free for 3 days, or join the AI Profit Boardroom.

Want another angle? Read the AI Profit Boardroom guide to Hermes Agent Hooks.

FAQ: hermes agent hooks

What are Hermes Agent hooks?

Hooks are your own code or scripts that Hermes runs at set points, such as before a tool call, before the model is called, or when a session starts. There are gateway hooks, plugin hooks, shell hooks and outbound webhooks.

How do I add a shell hook in Hermes?

Add a hooks: block to your profile config.yaml with the event name, an optional matcher and the command to run. Hermes asks you to approve it the first time, then you can check it with hermes hooks test.

Can a Hermes hook block a tool call?

Yes. A pre_tool_call hook can return a block, or a shell hook can exit with code 2. With fail_closed: true, a crashed or timed-out pre_tool_call hook also blocks the tool.

What does the new pre_llm_call block do?

Merged on 1 November 2026, it lets a pre_llm_call hook end a turn before any model request. The block message becomes the reply and the prompt is stored only as a withheld placeholder.

Do gateway hooks work in the CLI?

No. Gateway hooks only fire in the messaging gateway, such as Telegram, Discord or Slack. Use plugin hooks or shell hooks for hooks that work in the CLI too.

Are Hermes hooks safe?

They run with your user permissions, so only use scripts you wrote or reviewed. Editing an approved script does not ask again, so run hermes hooks doctor after changes.

Ready to put Hermes to work in your business? Join the AI Profit Boardroom for the Agent OS, setup training and daily updates.

Or get your Backlink Gameplan and we’ll map out your setup, or try Polar Rank free for 3 days.

Starting from zero? Get the free AI course and community.

Join the AI Profit Boardroom →Get Your Backlink Gameplan →Try Polar Rank Free for 3 Days →Get the FREE AI Course + Community →

Related reading

Last updated November 2026. This page is a living guide to hermes agent hooks — the facts here move fast and it is updated as they do.

Leave a Reply

Your email address will not be published. Required fields are marked *