# Hermes Agent adapter

Shows the sessions of Hermes Agent, the program `hermes` of Nous Research, in the notch: working, done when a turn ends, failed when it ends on an error, needing you while Hermes waits for your approval, an answer to its question or a password, what the tool in use does, its first message as its name, its tool calls as steps and how many subagents it runs.
Hermes reports through shell hooks: each hook posts the payload Hermes gives it with `curl` to a Unix socket in your own folder, `~/Library/Application Support/Blossom/hermes/socket`, where this adapter listens. Blossom launches the adapter.
**Permissions and questions are answered in Hermes.** Blossom shows that the session needs you, and you answer where Hermes asks: the events that say Hermes waits for you only observe, and `pre_tool_call`, the one hook that steers a call, can block it or send it to your approval, never approve it.
The hooks are entries under `hooks:` of your configuration file, `~/.hermes/config.yaml`, added after yours.

**This adapter was written from the documentation and the source of Hermes Agent and was never run against a real one.** What they say and what is only supposed is in [../../documentation/roadmap/hermes.md](../../documentation/roadmap/hermes.md); the checks at the end say what to look at.

You need:

- Blossom. It includes this adapter and the Bun that runs it; from a clone, `bun run build` makes one.
- Hermes Agent, `hermes`, set up with a model. The hooks follow the page [Event Hooks](https://hermes-agent.nousresearch.com/docs/user-guide/features/hooks), and the source of [NousResearch/hermes-agent](https://github.com/NousResearch/hermes-agent) at commit `1c4915270ca55f88af9e5777d30112b3e41afa7d` of 2 December 2026: `website/docs/user-guide/features/hooks.md`, which that page is built from, `agent/shell_hooks.py`, which runs the hooks, `hermes_cli/plugins.py`, which names their events, and `approval/human_input_hooks.py`.
- `curl`, which every hook runs by its full path, `/usr/bin/curl`, from `/bin/sh`.

## Connect from Blossom

Blossom finds `hermes` on your Mac, in your `PATH` or in the usual folders, `~/.local/bin` among them, where its install script puts it, and connecting it is one click: "Continue" on the second step of the introduction, with Hermes Agent checked, or its switch in Settings > Agents. Blossom then adds this adapter to its configuration, starts it, and adds the entries of `adapters/hermes/hooks.yaml` to `~/.hermes/config.yaml`: under `hooks:`, each event gets Blossom's entry after yours, and an event or `hooks:` the file lacks is added after the last line of what holds it.

The file is yours, so Blossom edits it by lines and never writes it again from what it read: your comments, your order, your quotes and your own hooks stay as they are, byte for byte, and so do `hooks_auto_accept`, `hooks.outbound` and every other key. When the file is missing, Blossom creates it with its entries alone, readable by you alone. Before each write it keeps a copy of the file in `~/Library/Application Support/Blossom/backups/hermes/`, named after the moment in UTC, and it puts the new content in place in one rename. A file that is not valid YAML, or whose `hooks:` or one of its events is written in flow style, `{ }` or `[ ]`, is left alone, and the row says why. "Repair" in the row puts the entries back when they are missing or not the ones this Blossom installs. "Disconnect", shown while the agent is off, takes the adapter out of Blossom and its entries out of the file, which then holds what it held before connecting. Blossom does not follow `HERMES_HOME` or the profiles of Hermes, whose configuration is `~/.hermes/profiles/<name>/config.yaml`: only the default profile reports. What Blossom writes and why is in [the decision](../../documentation/decisions/connecting.md).

### Hermes asks before it runs each hook

Hermes runs a hook only once you allowed it: it asks once for each pair of an event and the exact text of its command, and keeps your answer in `~/.hermes/shell-hooks-allowlist.json`, a file Blossom never reads or writes. Blossom installs nine hooks, so **the first `hermes chat` after connecting asks nine times**, once per event; answer yes to each. Only a `hermes chat`, or `hermes` alone, run in the foreground of a terminal asks: the gateway, cron, ACP and the other surfaces never do, and skip a hook nobody allowed. Every hook of Blossom's runs the same command, which names no version, so an update of Blossom keeps it as it is and Hermes does not ask again; a change of that text would make it ask again for every event. `hermes hooks list` shows which are allowed, and `hermes hooks revoke` takes an approval back.

Blossom never sets `hooks_auto_accept`, `--accept-hooks` or `HERMES_ACCEPT_HOOKS`, which would allow every hook of the file without asking.

## Run Blossom with the adapter

From the root of the clone:

```sh
bun install && bun run bootstrap && bun run build
BLOSSOM_CONFIGURATION=adapters/hermes/configuration.json apps/macos/build/Build/Products/Debug/Blossom.app/Contents/MacOS/Blossom
```

`bootstrap` installs the toolchain the build needs; see [../../documentation/contributing.md](../../documentation/contributing.md).

The notch shows nothing until a session of Hermes reports. Run one Blossom at a time: the adapter holds the socket, and the adapter of a second Blossom logs `cannot listen for the hooks of hermes` and exits.

### From Finder

An app opened from Finder reads `~/Library/Application Support/Blossom/configuration.json`. Name the adapter by its package, which Blossom includes:

```json
{ "adapters": [{ "package": "hermes" }] }
```

If the file already exists, add the adapter to its `adapters` list instead.

## Install by hand

For a clone without the app. Keep a copy of your file. When it has no `hooks:` key, append the template:

```sh
cp ~/.hermes/config.yaml ~/.hermes/config.yaml.before-blossom
{ printf '\n'; cat adapters/hermes/hooks.yaml; } >> ~/.hermes/config.yaml
```

When it has one, copy each event of the template, with its entry, under your `hooks:`, or the entry alone after yours when you already have that event. Then start `hermes chat` and allow the nine hooks.

## Remove by hand

After an install by hand; after connecting from Blossom, Disconnect does it, and removing Blossom takes out the hooks of every tool, see [Removing it](../../documentation/privacy.md#removing-it). Open `~/.hermes/config.yaml` and delete each entry whose `command` names `Blossom/hermes/socket`, and an event left with no entry. Then check that none is left:

```sh
grep -c 'Blossom/hermes/socket' ~/.hermes/config.yaml
```

The approvals stay in the allowlist of Hermes until you take them back: `hermes hooks revoke` with the text of the command, as `hermes hooks list` shows it.

## What to know

- **Hermes runs the command without a shell.** It splits the text of `command` the way `shlex.split` of Python does and runs the parts with `shell=False`, so `||`, `{ }` and redirections mean nothing there. Every hook of Blossom's is `/bin/sh -c '<script>'`, the script inside single quotes and holding none, so the split gives exactly three arguments, `/bin/sh`, `-c` and the script whole; a test runs `shlex.split` of the Python of the system on each command of the template and checks it.
- **Which events.** `pre_llm_call`, `pre_tool_call`, `post_tool_call`, `on_human_input_request`, `on_human_input_resolved`, `subagent_start`, `subagent_stop`, `on_session_end` and `on_session_finalize`. `pre_approval_request` and `post_approval_response` are not installed: they name the session by a key of the gateway and give the hook no identifier of it, so they could not be tied to a session.
- **Permissions, questions and passwords are shown, not answered.** `on_human_input_request` comes right before Hermes waits for a person, with the kind `approval`, `clarify` or `sudo`: the session needs you until `on_human_input_resolved`. Hermes leaves its `session_id` empty when it does not know the session, and then Blossom cannot tell which one needs you. A kind Hermes adds later changes nothing.
- **A session shows up with its first turn.** `pre_llm_call`, once a turn, starts it, and the first line of the first message Blossom sees is its title, cut to 60 characters; a message that starts with `/` or `!` titles nothing. A message of several parts, with an image for example, is read for its text alone.
- **A session has no project or branch.** Every turn of `hermes` and `hermes chat` runs in the gateway of Hermes, a process of its own, and the `cwd` of a payload is the folder of that process, not the one the session works in. Blossom does not name a session after it.
- **Where a session runs is not known.** The hooks run in the gateway, which no terminal holds, so no hook can tell the terminal of a session, and none looks for it.
- **Steps are tool calls.** Each call is a step from its `pre_tool_call` to its `post_tool_call`, paired by the `tool_call_id` of `extra`, failed when its `status` is `error`. A step still running when the turn ends is shown failed. A step is the verb and the name of the file of `read_file`, `write_file` and `patch`, read from `path`, never its folder or its content; `read_file` may name a folder too, which shows its name. Any other tool shows a label: `terminal` carries no description of its command, so it shows "Running a command".
- **How a turn ends.** `on_session_end` comes at the end of every turn, whatever its outcome, not at the end of the session: `failed` true is failed, anything else, an interrupt included, is done.
- **How a session ends.** `on_session_finalize`, which comes when Hermes tears a session down, `/new` or quitting among them, closes it. So does the end of the process the hooks name, the gateway, which ends every session of it.
- **Subagents.** `subagent_start` adds one and `subagent_stop`, which comes once a child of `delegate_task` finished, takes one away; the end of the turn sets the count to zero. A child runs a session of its own, named in `subagent_start`, whose events are not shown as a session of their own.
- **The hooks send the whole payload, and the adapter keeps a few fields.** Each hook posts what Hermes gives it on standard input, as it came, with your message and, for `pre_llm_call`, the whole conversation of the session, and the input and output of tools. The adapter keeps the identifier of the session, of the call and of a child, the title, the name of the tool and the words of its step, whether it failed, the kind of a wait and whether a turn failed, and drops the rest at once; nothing else is kept, logged or sent to Blossom. The event is the `hook_event_name` Hermes writes, and no text of the payload can pass for it.
- **The hooks print nothing and always succeed.** What `pre_tool_call` prints can block the call or send it to your approval, an exit status of 2 blocks it, and what `pre_llm_call` prints is added to your message. Every command sends everything it runs to `/dev/null` and ends with `|| /usr/bin/true`, so neither a configuration file of `curl` nor whatever answers on the socket can make a hook decide anything, and with Blossom closed every tool still runs. Blossom sets no `fail_closed`.
- **The hooks name `$HOME` and nothing else without a default.** `${PPID-}` is the only other variable, so a shell that refuses unset variables still runs them.
- **The hooks ignore your curl configuration.** `-q` keeps `curl` from reading `~/.curlrc` and its siblings.
- **Without Blossom, Hermes works as before.** With Blossom closed nothing listens on the socket: each hook gives up at once, prints nothing and ends without an error. When the adapter is alive but does not answer, every event waits one second, well inside the sixty seconds Hermes gives a hook by default.
- **Hermes writes the file too.** Commands such as `hermes config set` write `~/.hermes/config.yaml` again. Blossom recognizes its entries by the socket their `command` names, whatever the formatting Hermes gives them.
- **The socket is yours alone.** It lives in a folder only your user can open. A process that runs as you can still post events to it, or listen on it while Blossom is closed and read the payloads, your conversations included. See [../../documentation/decisions/socket.md](../../documentation/decisions/socket.md).
- **Sixty-four sessions at most.** When a sixty-fifth starts, the adapter closes the one it heard from least recently.
- **The hooks find the socket through `$HOME`.** A gateway started with another `HOME` does not report.

### Not confirmed

Read in the documentation and the source, never seen in a run:

1. That the shell hooks of `on_human_input_request` and `on_human_input_resolved` run, from the gateway, for the prompts of a `hermes chat`, and with the `session_id` of its session: `approval/human_input_hooks.py` fires them through the dispatcher of every hook, and takes the identifier from the context of the approval.
2. That the gateway runs the hooks of every turn of `hermes chat`, as `_chat_runs_at_gateway` of `hermes_cli/main.py` says, so that `$PPID` is the gateway for every event.
3. That `on_session_finalize` comes when a `hermes chat` quits, from `_finalize_session` of the gateway.
4. That a child of `delegate_task` runs its own `pre_llm_call` and `pre_tool_call` under the `child_session_id` that `subagent_start` names.
5. That the input of `read_file`, `write_file` and `patch` reaches a hook with the field `path`.

## Checks by hand

The adapter was tested with its hook command split by the `shlex` of the Python of the system and run by `sh`, `bash` and `zsh` against the socket, with payloads written from the documentation and the source, never captured from a run. Each check below needs `hermes` set up with a model. Write down what the line in italics asks.

Prepare once. To see the raw payloads first, add a logger under `hooks:` of `~/.hermes/config.yaml` for the nine events, `command: "/bin/sh -c 'cat >> /tmp/hermes-events.log; echo >> /tmp/hermes-events.log'"`, start `hermes chat` and allow it for each event; take it out afterwards and revoke it with `hermes hooks revoke`.

1. **The payloads.** Ask `hi`, then `read the README and run ls`, allow it, and quit. *Does every line carry `hook_event_name` and the same `session_id`, and the tool events `extra.tool_call_id`?*
2. **The process.** In a second terminal, `ps -ax -o pid,ppid,command | grep '[h]ermes'`. *Is the parent of the hooks the gateway of Hermes, and the same for every event?*
3. **A permission.** Ask `run the shell command rm -rf ./probe` and wait. *Is there an `on_human_input_request` with `"kind":"approval"` and the `session_id` of the session, and an `on_human_input_resolved` once you answered?*
4. **A question.** Ask `ask me to choose between two options before you answer`. *Is there an `on_human_input_request` with `"kind":"clarify"`?*
5. **A subagent.** Ask for a task that Hermes delegates. *Does `subagent_start` name a `child_session_id`, and do the events of the child carry it?*
6. **The end.** Quit with `/exit`. *Does `on_session_finalize` come with the `session_id`?*

Then run Blossom with the adapter and connect Hermes Agent, which adds the hooks to `~/.hermes/config.yaml`.

7. **The approvals.** Start `hermes chat`. *Does Hermes ask nine times, once per event? Does `hermes hooks list` show them allowed afterwards?*
8. **A turn.** Ask `hi`. *Does the tile appear titled `hi`, with no badge, and turn green when the answer ends?*
9. **A tool.** Ask `read the README`. *Does live show `Read README.md`, and detail list it as a step?*
10. **A permission.** Ask `run the shell command rm -rf ./probe` and do not answer yet. *Does the tile turn amber, with no request panel?* Answer. *Does it go back to working, and turn green at the end?*
11. **The end.** Quit `hermes`. *Does the tile leave?*
12. **Disconnect.** Disconnect Hermes Agent in Settings > Agents. *Is `~/.hermes/config.yaml` as it was before connecting, and does a new session no longer show?*
