agentleFS
Hashi-Ai-DevHashi-Ai-Dev/HermitDoc/skills/hermes-hooks/SKILL.md

hermes-hooks

Skill4 starsChanged 7 months agoMITView on GitHub

Use when managing shell hooks in Hermes. Covers: hermes hooks CLI (list, test, revoke, doctor), hook configuration in config.yaml, shell-hooks-allowlist.json, first-use consent, hook events (pre/post), hook patterns, hook security. Triggers on: hooks, shell hooks, pre-hook, post-hook, automation, trigger.

The file

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Not in allowlist — hermes hooks list to check

    line 102

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Hermes Hooks Reference

Shell script hooks — run custom scripts at specific points in Hermes execution.

Hooks CLI

hermes hooks list               # List configured hooks (matcher, timeout, consent status)
hermes hooks test EVENT         # Fire every hook matching EVENT against a synthetic payload
hermes hooks revoke COMMAND     # Remove a command's allowlist entries
hermes hooks doctor             # Diagnose each hook: exec bit, allowlist, mtime drift, JSON validity, timing

Hook Configuration

# ~/.hermes/config.yaml
hooks:
  - name: "pre-terminal"
    event: "pre_tool_call"
    matcher: "terminal"
    command: "/path/to/hook.sh"
    timeout_seconds: 5
    allowlist: true  # pre-approved (no prompt needed)
  - name: "post-terminal"
    event: "post_tool_call"
    matcher: "terminal"
    command: "/path/to/hook2.sh"
    timeout_seconds: 5

Hook Events

EventWhen it fires
pre_tool_callBefore a tool is called
post_tool_callAfter a tool completes
pre_agent_loopBefore agent loop iteration
post_agent_loopAfter agent loop iteration

Hook Environment Variables

VariableContents
HERMES_TOOLTool being called (e.g. terminal)
HERMES_TOOL_ARGSTool arguments (JSON)
HERMES_EXITExit status
HERMES_SESSION_IDCurrent session ID

First-Use Consent

First time a hook fires, Hermes prompts for consent. Decisions are stored in:

~/.hermes/shell-hooks-allowlist.json

Manage the allowlist:

# Test hooks (fires against synthetic payload)
hermes hooks test pre_tool_call

# Revoke allowlist entries for a command
hermes hooks revoke "/path/to/hook.sh"

Hook Security

  1. Allowlist — hooks don't fire until approved
  2. Timeout — prevents hanging hooks
  3. Event filtering — use matcher to target specific tools

Hook Doctor

hermes hooks doctor
# Checks each hook:
# - Exec bit set
# - Allowlist status
# - File modification time drift
# - JSON validity of config
# - Synthetic run timing

Common Issues

Hook not firing:

  • Not in allowlist — hermes hooks list to check
  • Wrong event type — verify event in config
  • File not executable — chmod +x

Hook blocking execution:

  • Exit 1 blocks the tool call
  • Fix the hook or hermes hooks revoke

References

  • hermes-security/ — allowlist management
  • hermes-cli/ — hooks CLI commands
  • hermes-logging/ — audit logging

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.