2026-01-15 06:12:54 +00:00
|
|
|
|
---
|
2026-01-30 03:15:10 +01:00
|
|
|
|
summary: "CLI reference for `openclaw hooks` (agent hooks)"
|
2026-01-15 06:12:54 +00:00
|
|
|
|
read_when:
|
2026-01-17 07:32:50 +00:00
|
|
|
|
- You want to manage agent hooks
|
|
|
|
|
|
- You want to install or update hooks
|
2026-01-15 06:12:54 +00:00
|
|
|
|
---
|
|
|
|
|
|
|
2026-01-30 03:15:10 +01:00
|
|
|
|
# `openclaw hooks`
|
2026-01-15 06:12:54 +00:00
|
|
|
|
|
2026-01-18 10:10:05 +02:00
|
|
|
|
Manage agent hooks (event-driven automations for commands like `/new`, `/reset`, and gateway startup).
|
2026-01-15 06:12:54 +00:00
|
|
|
|
|
|
|
|
|
|
Related:
|
2026-01-17 07:32:50 +00:00
|
|
|
|
- Hooks: [Hooks](/hooks)
|
2026-01-18 05:56:59 +00:00
|
|
|
|
- Plugin hooks: [Plugins](/plugin#plugin-hooks)
|
2026-01-17 01:31:39 +00:00
|
|
|
|
|
2026-01-17 07:08:04 +00:00
|
|
|
|
## List All Hooks
|
2026-01-17 01:31:39 +00:00
|
|
|
|
|
|
|
|
|
|
```bash
|
2026-01-30 03:15:10 +01:00
|
|
|
|
openclaw hooks list
|
2026-01-17 01:31:39 +00:00
|
|
|
|
```
|
|
|
|
|
|
|
2026-01-17 07:32:50 +00:00
|
|
|
|
List all discovered hooks from workspace, managed, and bundled directories.
|
2026-01-17 01:31:39 +00:00
|
|
|
|
|
|
|
|
|
|
**Options:**
|
|
|
|
|
|
- `--eligible`: Show only eligible hooks (requirements met)
|
|
|
|
|
|
- `--json`: Output as JSON
|
|
|
|
|
|
- `-v, --verbose`: Show detailed information including missing requirements
|
|
|
|
|
|
|
|
|
|
|
|
**Example output:**
|
|
|
|
|
|
|
|
|
|
|
|
```
|
2026-01-18 10:10:05 +02:00
|
|
|
|
Hooks (4/4 ready)
|
2026-01-17 01:31:39 +00:00
|
|
|
|
|
|
|
|
|
|
Ready:
|
2026-01-18 10:10:05 +02:00
|
|
|
|
🚀 boot-md ✓ - Run BOOT.md on gateway startup
|
2026-01-17 01:31:39 +00:00
|
|
|
|
📝 command-logger ✓ - Log all command events to a centralized audit file
|
|
|
|
|
|
💾 session-memory ✓ - Save session context to memory when /new command is issued
|
2026-01-18 06:23:09 +00:00
|
|
|
|
😈 soul-evil ✓ - Swap injected SOUL content during a purge window or by random chance
|
2026-01-17 01:31:39 +00:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
**Example (verbose):**
|
|
|
|
|
|
|
|
|
|
|
|
```bash
|
2026-01-30 03:15:10 +01:00
|
|
|
|
openclaw hooks list --verbose
|
2026-01-17 01:31:39 +00:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
Shows missing requirements for ineligible hooks.
|
|
|
|
|
|
|
|
|
|
|
|
**Example (JSON):**
|
|
|
|
|
|
|
|
|
|
|
|
```bash
|
2026-01-30 03:15:10 +01:00
|
|
|
|
openclaw hooks list --json
|
2026-01-17 01:31:39 +00:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
Returns structured JSON for programmatic use.
|
|
|
|
|
|
|
2026-01-17 07:08:04 +00:00
|
|
|
|
## Get Hook Information
|
2026-01-17 01:31:39 +00:00
|
|
|
|
|
|
|
|
|
|
```bash
|
2026-01-30 03:15:10 +01:00
|
|
|
|
openclaw hooks info <name>
|
2026-01-17 01:31:39 +00:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
Show detailed information about a specific hook.
|
|
|
|
|
|
|
|
|
|
|
|
**Arguments:**
|
|
|
|
|
|
- `<name>`: Hook name (e.g., `session-memory`)
|
|
|
|
|
|
|
|
|
|
|
|
**Options:**
|
|
|
|
|
|
- `--json`: Output as JSON
|
|
|
|
|
|
|
|
|
|
|
|
**Example:**
|
|
|
|
|
|
|
|
|
|
|
|
```bash
|
2026-01-30 03:15:10 +01:00
|
|
|
|
openclaw hooks info session-memory
|
2026-01-17 01:31:39 +00:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
**Output:**
|
|
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
💾 session-memory ✓ Ready
|
|
|
|
|
|
|
|
|
|
|
|
Save session context to memory when /new command is issued
|
|
|
|
|
|
|
|
|
|
|
|
Details:
|
2026-01-30 03:15:10 +01:00
|
|
|
|
Source: openclaw-bundled
|
|
|
|
|
|
Path: /path/to/openclaw/hooks/bundled/session-memory/HOOK.md
|
|
|
|
|
|
Handler: /path/to/openclaw/hooks/bundled/session-memory/handler.ts
|
|
|
|
|
|
Homepage: https://docs.openclaw.ai/hooks#session-memory
|
2026-01-17 01:31:39 +00:00
|
|
|
|
Events: command:new
|
|
|
|
|
|
|
|
|
|
|
|
Requirements:
|
|
|
|
|
|
Config: ✓ workspace.dir
|
|
|
|
|
|
```
|
|
|
|
|
|
|
2026-01-17 07:08:04 +00:00
|
|
|
|
## Check Hooks Eligibility
|
2026-01-17 01:31:39 +00:00
|
|
|
|
|
|
|
|
|
|
```bash
|
2026-01-30 03:15:10 +01:00
|
|
|
|
openclaw hooks check
|
2026-01-17 01:31:39 +00:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
Show summary of hook eligibility status (how many are ready vs. not ready).
|
|
|
|
|
|
|
|
|
|
|
|
**Options:**
|
|
|
|
|
|
- `--json`: Output as JSON
|
|
|
|
|
|
|
|
|
|
|
|
**Example output:**
|
|
|
|
|
|
|
|
|
|
|
|
```
|
2026-01-17 07:32:50 +00:00
|
|
|
|
Hooks Status
|
2026-01-17 01:31:39 +00:00
|
|
|
|
|
2026-01-18 10:10:05 +02:00
|
|
|
|
Total hooks: 4
|
|
|
|
|
|
Ready: 4
|
2026-01-17 01:31:39 +00:00
|
|
|
|
Not ready: 0
|
|
|
|
|
|
```
|
|
|
|
|
|
|
2026-01-17 07:08:04 +00:00
|
|
|
|
## Enable a Hook
|
2026-01-17 01:31:39 +00:00
|
|
|
|
|
|
|
|
|
|
```bash
|
2026-01-30 03:15:10 +01:00
|
|
|
|
openclaw hooks enable <name>
|
2026-01-17 01:31:39 +00:00
|
|
|
|
```
|
|
|
|
|
|
|
2026-01-30 03:15:10 +01:00
|
|
|
|
Enable a specific hook by adding it to your config (`~/.openclaw/config.json`).
|
2026-01-17 01:31:39 +00:00
|
|
|
|
|
2026-01-30 03:15:10 +01:00
|
|
|
|
**Note:** Hooks managed by plugins show `plugin:<id>` in `openclaw hooks list` and
|
2026-01-18 05:56:59 +00:00
|
|
|
|
can’t be enabled/disabled here. Enable/disable the plugin instead.
|
|
|
|
|
|
|
2026-01-17 01:31:39 +00:00
|
|
|
|
**Arguments:**
|
|
|
|
|
|
- `<name>`: Hook name (e.g., `session-memory`)
|
|
|
|
|
|
|
|
|
|
|
|
**Example:**
|
|
|
|
|
|
|
|
|
|
|
|
```bash
|
2026-01-30 03:15:10 +01:00
|
|
|
|
openclaw hooks enable session-memory
|
2026-01-17 01:31:39 +00:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
**Output:**
|
|
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
✓ Enabled hook: 💾 session-memory
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
**What it does:**
|
|
|
|
|
|
- Checks if hook exists and is eligible
|
|
|
|
|
|
- Updates `hooks.internal.entries.<name>.enabled = true` in your config
|
|
|
|
|
|
- Saves config to disk
|
|
|
|
|
|
|
|
|
|
|
|
**After enabling:**
|
|
|
|
|
|
- Restart the gateway so hooks reload (menu bar app restart on macOS, or restart your gateway process in dev).
|
|
|
|
|
|
|
2026-01-17 07:08:04 +00:00
|
|
|
|
## Disable a Hook
|
2026-01-17 01:31:39 +00:00
|
|
|
|
|
|
|
|
|
|
```bash
|
2026-01-30 03:15:10 +01:00
|
|
|
|
openclaw hooks disable <name>
|
2026-01-17 01:31:39 +00:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
Disable a specific hook by updating your config.
|
|
|
|
|
|
|
|
|
|
|
|
**Arguments:**
|
|
|
|
|
|
- `<name>`: Hook name (e.g., `command-logger`)
|
|
|
|
|
|
|
|
|
|
|
|
**Example:**
|
|
|
|
|
|
|
|
|
|
|
|
```bash
|
2026-01-30 03:15:10 +01:00
|
|
|
|
openclaw hooks disable command-logger
|
2026-01-17 01:31:39 +00:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
**Output:**
|
|
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
⏸ Disabled hook: 📝 command-logger
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
**After disabling:**
|
|
|
|
|
|
- Restart the gateway so hooks reload
|
|
|
|
|
|
|
2026-01-17 07:08:04 +00:00
|
|
|
|
## Install Hooks
|
|
|
|
|
|
|
|
|
|
|
|
```bash
|
2026-01-30 03:15:10 +01:00
|
|
|
|
openclaw hooks install <path-or-spec>
|
2026-01-17 07:08:04 +00:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
Install a hook pack from a local folder/archive or npm.
|
|
|
|
|
|
|
|
|
|
|
|
**What it does:**
|
2026-01-30 03:15:10 +01:00
|
|
|
|
- Copies the hook pack into `~/.openclaw/hooks/<id>`
|
2026-01-17 07:08:04 +00:00
|
|
|
|
- Enables the installed hooks in `hooks.internal.entries.*`
|
|
|
|
|
|
- Records the install under `hooks.internal.installs`
|
|
|
|
|
|
|
|
|
|
|
|
**Options:**
|
|
|
|
|
|
- `-l, --link`: Link a local directory instead of copying (adds it to `hooks.internal.load.extraDirs`)
|
|
|
|
|
|
|
|
|
|
|
|
**Supported archives:** `.zip`, `.tgz`, `.tar.gz`, `.tar`
|
|
|
|
|
|
|
|
|
|
|
|
**Examples:**
|
|
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
|
# Local directory
|
2026-01-30 03:15:10 +01:00
|
|
|
|
openclaw hooks install ./my-hook-pack
|
2026-01-17 07:08:04 +00:00
|
|
|
|
|
|
|
|
|
|
# Local archive
|
2026-01-30 03:15:10 +01:00
|
|
|
|
openclaw hooks install ./my-hook-pack.zip
|
2026-01-17 07:08:04 +00:00
|
|
|
|
|
|
|
|
|
|
# NPM package
|
2026-01-30 03:15:10 +01:00
|
|
|
|
openclaw hooks install @openclaw/my-hook-pack
|
2026-01-17 07:08:04 +00:00
|
|
|
|
|
|
|
|
|
|
# Link a local directory without copying
|
2026-01-30 03:15:10 +01:00
|
|
|
|
openclaw hooks install -l ./my-hook-pack
|
2026-01-17 07:08:04 +00:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
## Update Hooks
|
|
|
|
|
|
|
|
|
|
|
|
```bash
|
2026-01-30 03:15:10 +01:00
|
|
|
|
openclaw hooks update <id>
|
|
|
|
|
|
openclaw hooks update --all
|
2026-01-17 07:08:04 +00:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
Update installed hook packs (npm installs only).
|
|
|
|
|
|
|
|
|
|
|
|
**Options:**
|
|
|
|
|
|
- `--all`: Update all tracked hook packs
|
|
|
|
|
|
- `--dry-run`: Show what would change without writing
|
|
|
|
|
|
|
2026-01-17 01:31:39 +00:00
|
|
|
|
## Bundled Hooks
|
|
|
|
|
|
|
|
|
|
|
|
### session-memory
|
|
|
|
|
|
|
|
|
|
|
|
Saves session context to memory when you issue `/new`.
|
|
|
|
|
|
|
|
|
|
|
|
**Enable:**
|
|
|
|
|
|
|
|
|
|
|
|
```bash
|
2026-01-30 03:15:10 +01:00
|
|
|
|
openclaw hooks enable session-memory
|
2026-01-17 01:31:39 +00:00
|
|
|
|
```
|
|
|
|
|
|
|
2026-01-30 03:15:10 +01:00
|
|
|
|
**Output:** `~/.openclaw/workspace/memory/YYYY-MM-DD-slug.md`
|
2026-01-17 01:31:39 +00:00
|
|
|
|
|
2026-01-17 07:32:50 +00:00
|
|
|
|
**See:** [session-memory documentation](/hooks#session-memory)
|
2026-01-17 01:31:39 +00:00
|
|
|
|
|
|
|
|
|
|
### command-logger
|
|
|
|
|
|
|
|
|
|
|
|
Logs all command events to a centralized audit file.
|
|
|
|
|
|
|
|
|
|
|
|
**Enable:**
|
|
|
|
|
|
|
|
|
|
|
|
```bash
|
2026-01-30 03:15:10 +01:00
|
|
|
|
openclaw hooks enable command-logger
|
2026-01-17 01:31:39 +00:00
|
|
|
|
```
|
|
|
|
|
|
|
2026-01-30 03:15:10 +01:00
|
|
|
|
**Output:** `~/.openclaw/logs/commands.log`
|
2026-01-17 01:31:39 +00:00
|
|
|
|
|
|
|
|
|
|
**View logs:**
|
|
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
|
# Recent commands
|
2026-01-30 03:15:10 +01:00
|
|
|
|
tail -n 20 ~/.openclaw/logs/commands.log
|
2026-01-17 01:31:39 +00:00
|
|
|
|
|
|
|
|
|
|
# Pretty-print
|
2026-01-30 03:15:10 +01:00
|
|
|
|
cat ~/.openclaw/logs/commands.log | jq .
|
2026-01-17 01:31:39 +00:00
|
|
|
|
|
|
|
|
|
|
# Filter by action
|
2026-01-30 03:15:10 +01:00
|
|
|
|
grep '"action":"new"' ~/.openclaw/logs/commands.log | jq .
|
2026-01-17 01:31:39 +00:00
|
|
|
|
```
|
|
|
|
|
|
|
2026-01-17 07:32:50 +00:00
|
|
|
|
**See:** [command-logger documentation](/hooks#command-logger)
|
2026-01-18 05:24:47 +00:00
|
|
|
|
|
|
|
|
|
|
### soul-evil
|
|
|
|
|
|
|
|
|
|
|
|
Swaps injected `SOUL.md` content with `SOUL_EVIL.md` during a purge window or by random chance.
|
|
|
|
|
|
|
|
|
|
|
|
**Enable:**
|
|
|
|
|
|
|
|
|
|
|
|
```bash
|
2026-01-30 03:15:10 +01:00
|
|
|
|
openclaw hooks enable soul-evil
|
2026-01-18 05:24:47 +00:00
|
|
|
|
```
|
|
|
|
|
|
|
2026-01-18 06:21:00 +00:00
|
|
|
|
**See:** [SOUL Evil Hook](/hooks/soul-evil)
|
2026-01-18 10:10:05 +02:00
|
|
|
|
|
|
|
|
|
|
### boot-md
|
|
|
|
|
|
|
|
|
|
|
|
Runs `BOOT.md` when the gateway starts (after channels start).
|
|
|
|
|
|
|
|
|
|
|
|
**Events**: `gateway:startup`
|
|
|
|
|
|
|
|
|
|
|
|
**Enable**:
|
|
|
|
|
|
|
|
|
|
|
|
```bash
|
2026-01-30 03:15:10 +01:00
|
|
|
|
openclaw hooks enable boot-md
|
2026-01-18 10:10:05 +02:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
**See:** [boot-md documentation](/hooks#boot-md)
|