How-To Series · Episode 40 / 59 · Module 6: Working While You Sleep

Hermes · Event Hooks

When X happens, run Y. Log, block, format, alert.

After this videoYou can now inject custom behavior at Hermes lifecycle points.

Three hook systems run custom code at lifecycle points: gateway hooks (gateway-only, alerts/webhooks), plugin hooks (CLI + gateway, Python, guardrails), and shell hooks (CLI + gateway, any script). All are non-blocking, a broken hook never crashes the agent. Shell hooks are the easy path: add a hooks: block in config pointing at a script, which gets JSON on stdin and answers on stdout. Three powers: pre_tool_call blocks a tool, post_tool_call reacts after (e.g. auto-format on write), pre_llm_call injects context. They run with your full credentials, so the first time Hermes sees a new event-and-command pair it asks for approval.

About these resources. Every command in this video comes from the Event Hooks doc.

Sources · What this video distills

1 docs page · every command below traces to one of them
Primary · gateway/plugin/shell hook systems, JSON protocol, pre/post_tool_call + pre_llm_call, examples, consent model
Event Hooks
Read ↗

Commands shown · Copy and paste

each shows the source doc it came from
Auto-format on write (config.yaml)from source ↗
hooks.post_tool_call: [{matcher: "write_file|patch", command: "~/.hermes/agent-hooks/auto-format.sh"}]
Block rm -rffrom source ↗
hooks.pre_tool_call: [{matcher: "terminal", command: "~/.hermes/agent-hooks/block-rm-rf.sh"}]
hermes hooks list · hermes hooks doctor

Going deeper · Related Hermes docs

further reading · not sources of facts shown above

Next in the series · Episodes that build on this

E39
Kanban Board
E34
Webhooks
E36
Schedule With Cron