skip to content

An OpenClaw hook shows as ready in `openclaw hooks list`, yet its side effect never appears: how do you find out why?

level: seniorimportance: should knowfreq 5%

answer

  1. inventory is not registration
  2. which host's config did you change
  3. master switch and named entries
  4. files are not watched
  5. did the exact event fire

basics

~20 s

In OpenClaw, ready means requirements pass, policy allows the hook and it declares events, not that the Gateway loaded it. Check the master switch and named entries on the Gateway host, read the Gateway log, then trigger the exact event.

solid answer

~50 s

`ready`, `eligible` and `loadable` are inventory results: they do not apply `hooks.internal.enabled` or the named-entry selection, do not import the handler, and do not show that the event ran. First make sure you changed the right machine: `openclaw hooks enable` writes local config only, so on a remote Gateway you run it on that host, and `--agent` selects a workspace to inspect, not a scope for the entry. Then check selection: once named entries exist they form an allowlist, and with no master flag and no entries the Gateway skips directory hooks entirely. Restart after editing hook files, because they are not watched. Follow `openclaw logs --follow` for import errors, `Hook error [<type>:<action>]` and unknown-event warnings. Finally trigger the exact event: chat text never fires `command:new`, `boot-md` waits for the next Gateway start, and `session-memory` writes in the background.

code

bash · 5 lines
bash
# on the Gateway host, with the Gateway's own profile
openclaw hooks list --json      # check workspaceDir and managedHooksDir
openclaw hooks info reset-note  # hookKey, events, unknown events, blockedReason
openclaw hooks enable reset-note
openclaw logs --follow          # import errors, Hook error [command:new]

go deeper

for a junior

Recall that ready in the hook list is a report about requirements and policy, and that the real proof is the hook's own log line or file.

for a middle

Explain the master switch, how named entries become an allowlist, and why hook files need a Gateway restart while config changes reload.

for a senior

Walk the diagnosis in order: right host and workspace, selection, handler load errors in the log, the exact event, then the reply path. Name the traps at each step.

for a principal

Argue for a verification habit across a team's hooks, with markers that can be checked, eligibility gates that read JSON counts, and a rule that enables happen on the Gateway host.

## Three states that look like one OpenClaw's hook documentation separates three checks that a single word, "ready", tends to blur: | State | Means | Shown by | | --- | --- | --- | | **Requirements satisfied** | The hook's OS, binaries, environment and config requirements pass on the host doing the check | `requirementsSatisfied`, the Missing column in `hooks list --verbose` | | **Enabled by config** | Per-hook and source policy allow it; workspace hooks need explicit opt-in | `enabledByConfig`, `blockedReason` | | **Loaded** | The running Gateway selected the hook, imported its handler and registered its events | only Gateway logs and the side effect itself | `ready` (and its aliases `eligible` and `loadable`) means the first two plus at least one declared event. The report does **not** apply the master switch `hooks.internal.enabled`, does not apply the configured-name selection, does not import the handler and does not prove the event has fired. A bundled hook can appear ready while the internal hook system is off. ## Step 1: are you looking at the right Gateway? - **Reports** (`hooks`, `list`, `info`, `check`) ask the selected Gateway. A configured remote Gateway is authoritative; an implicit local one may fall back to local discovery. - **Mutations** (`enable`, `disable`) always edit **local** config. Running `openclaw hooks enable` on a laptop does not change a remote Gateway. Run it on the Gateway host with that host's profile. - **`--agent <id>`** selects which workspace to inspect. The saved entry is global, and the Gateway loads directory hooks only from its own selected workspace, not from every agent you inspect. - `openclaw hooks list --json` prints `workspaceDir` and `managedHooksDir`, which shows quickly whether you are looking where you think you are. ## Step 2: is the hook selected? The selection rules for directory hooks: 1. `hooks.internal.enabled: false` turns internal hooks off. 2. No master flag, no enabled entries, no extra directories and no tracked installs: the Gateway skips directory-hook loading. 3. Named entries, with the master flag omitted or true: the enabled names form an **allowlist**. 4. Master flag true with no named entries: open-ended discovery of eligible hooks. The trap is rule 3. Adding the first named entry can narrow a selection that used to be broad, so a hook that loaded yesterday stops loading after someone enables a different one. Also confirm the entry sits under the hook's `hookKey`, which `openclaw hooks info` prints. ## Step 3: did the handler load? - In the default `hybrid` reload mode, config changes reload the selection. If a selected handler fails to load, the **previous handlers stay active**, so a broken new hook looks like nothing happened. - **Hook files and metadata are not watched.** After editing `HOOK.md` or the handler, restart the Gateway. - Run `openclaw logs --follow` and look for import or export errors, boundary failures such as a symlink escaping the hook directory, unknown-event warnings, and `Hook error [<type>:<action>]` from a handler that threw. ## Step 4: did the event fire? Many "broken" hooks are listening for an event that did not happen: - Ordinary chat text never fires `command:new`; only an authorized `/new` does. - A misspelt key such as `command:nwe` registers with a warning but is never emitted. - `boot-md` listens to `gateway:startup`, and a config reload does not replay it, so it first runs on the next Gateway start. - `message:received` needs an accepted inbound dispatch with a session key; suppressed or duplicate dispatches can emit nothing. - `session-memory` writes after the reset returns; wait for `Session context saved to ...` in the log. ## Step 5: is the effect a chat reply? If the log marker appears but no chat message does, the hook ran and the reply path is the problem. Strings pushed to `event.messages` become a reply only when chat handling of `/new` or `/reset` produced the event. Control UI, webchat and a `sessions.reset` call run the handler but do not route those strings as chat replies, and `/stop` never delivers hook replies. ## A habit that prevents most of this Give every hook a marker you can check, such as a log line or a file it writes, and verify that marker after each change. `openclaw hooks check` is not proof: it exits `0` even when hooks are not ready, so an automated gate should read its JSON counts, and even then it does not test loading.

  • Why can `openclaw hooks check` pass in a CI script while hooks are not ready?
    A successful report exits with code `0` even when some hooks are not ready. An automated gate has to read the JSON output's `eligible` and `notEligible` counts. Even then it only checks eligibility; it does not prove the Gateway imported a handler or that its event fired.
  • The hook's log marker appears but no chat reply arrives: what next?
    The hook ran, so look at the reply path. `event.messages` becomes a chat reply only for `/new` and `/reset` handled from a chat channel. Control UI, webchat and a `sessions.reset` call do not route it, `/stop` never does, and a missing recipient or send policy can still block delivery.

  • Ready in openclaw hooks list proves the Gateway imported the handler.
  • Running hooks enable on a laptop enables the hook on the remote Gateway.
  • The --agent option scopes the enabled entry to that one agent.
  • A config reload replays gateway:startup, so boot-md runs right away.
  • Any chat message should trigger a command:new hook.
  • openclaw hooks check exiting 0 means every hook is ready.