Hooks
CLI reference for openclaw hooks (agent hooks).
Manage agent hooks (event-driven automation commands like ''/new'', ''/reset'', and gateway startup).
Related:
- Hooks: ''Hooks''
- Plugin hooks: ''Plugins''
List all hooks
openclaw hooks list
Lists all hooks discovered from workspace, hosted directories, and bundled directories.
Options:
- ''--eligible'': Show only eligible hooks (meet requirements)
- ''--json'': Output as JSON
- ''-v, --verbose'': Show details including missing requirements
Output example:
Example (verbose):
Hooks (4/4 ready) Ready: π boot-md β - Run BOOT.md on gateway startup π command-logger β - Log all command events to a centralized audit file πΎ session-memory β - Save session context to memory when /new command is issued π soul-evil β - Swap injected SOUL content during a purge window or by random chance
Shows missing requirements for ineligible hooks.
openclaw hooks list --verbose
Example (JSON):
Returns structured JSON for programmatic use.
openclaw hooks list --json
ReferenceCliHooksPage step 01: P11
Get hook info
openclaw hooks info <name>
Shows detailed information about a specific hook.
Arguments:
- ''<name>'': Hook name (e.g., ''session-memory'')
Options:
- ''--json'': Output as JSON
openclaw hooks info session-memory
Example:
πΎ session-memory β Ready Save session context to memory when /new command is issued Details: 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 Events: command:new Requirements: Config: β workspace.dir
Check hooks eligibility
openclaw hooks check
Shows a summary of hook eligibility status (ready vs not ready counts).
Options:
- ''--json'': Output as JSON
Hooks Status Total hooks: 4 Ready: 4 Not ready: 0
Enable hook
openclaw hooks enable <name>
Enables a specific hook by adding it to your configuration (''~/.openclaw/config.json'').
''Note:'' Hooks managed by plugins show ''plugin:<id>'' in ''openclaw hooks list'' and
cannot be enabled/disabled here. Instead, enable/disable the plugin.
Arguments:
- ''<name>'': Hook name (e.g., ''session-memory'')
openclaw hooks enable session-memory
Example:
β Enabled hook: πΎ session-memory
Output:
What it does:
- Checks that the hook exists and is eligible
- Updates ''hooks.internal.entries.<name>.enabled = true'' in your configuration
- Saves configuration to disk
After enabling:
Disable hook
openclaw hooks disable <name>
Disables a specific hook by updating your configuration.
Arguments:
- ''<name>'': Hook name (e.g., ''command-logger'')
openclaw hooks disable command-logger
Example:
βΈ Disabled hook: π command-logger
Output:
After disabling:
Install hook
openclaw hooks install <path-or-spec>
Installs a hook package from a local folder/archive or npm.
What it does:
- Copies hook package to ''~/.openclaw/hooks/<id>''
- Enables installed hooks in ''hooks.internal.entries.*''
- Records installation under ''hooks.internal.installs''
Options:
- ''-l, --link'': Link local directory instead of copying (adds to ''hooks.internal.load.extraDirs'')
''Supported archives:'' ''.zip'', ''.tgz'', ''.tar.gz'', ''.tar''
openclaw hooks install ./my-hook-pack openclaw hooks install ./my-hook-pack.zip openclaw hooks install @openclaw/my-hook-pack openclaw hooks install -l ./my-hook-pack
Update hook
openclaw hooks update <id> openclaw hooks update --all
Updates installed hook packages (npm installs only).
Options:
- ''--all'': Update all tracked hook packages
- ''--dry-run'': Show what would change without writing
Bundle hook
#
Session memory
Saves session context to memory when you issue ''/new''.
Enable:
openclaw hooks enable session-memory
Output: ~/.openclaw/workspace/memory/YYYY-MM-DD-slug.md
See: session memory docs
#
Command logger
Logs all command events to a centralized audit file.
Enable:
openclaw hooks enable command-logger
Output: ~/.openclaw/logs/commands.log
View logs:
tail -n 20 ~/.openclaw/logs/commands.log cat ~/.openclaw/logs/commands.log | jq . grep '"action":"new"' ~/.openclaw/logs/commands.log | jq .
See: command logger docs
### Soul evil
Swaps injected ''SOUL.md'' content with ''SOUL_EVIL.md'' during a purge window or by random chance.
openclaw hooks enable soul-evil
See: soul evil hook docs
#
Boot md
Runs ''BOOT.md'' on gateway startup (after channels start).
Event: gateway:startup
Enable:
openclaw hooks enable boot-md
See: boot-md docs