docs/cli/hooks.md
openclaw hooksManage agent hooks (event-driven automations for commands like /new, /reset, and gateway startup).
Running openclaw hooks with no subcommand is equivalent to openclaw hooks list.
Related:
openclaw hooks list
List all discovered hooks from workspace, managed, extra, and bundled directories. Gateway startup does not load internal hook handlers until at least one internal hook is configured.
Options:
--eligible: Show only eligible hooks (requirements met)--json: Output as JSON-v, --verbose: Show detailed information including missing requirementsExample output:
Hooks (4/4 ready)
Ready:
π boot-md β - Run BOOT.md on gateway startup
π bootstrap-extra-files β - Inject extra workspace bootstrap files during agent bootstrap
π command-logger β - Log all command events to a centralized audit file
πΎ session-memory β - Save session context to memory when /new or /reset command is issued
Example (verbose):
openclaw hooks list --verbose
Shows missing requirements for ineligible hooks.
Example (JSON):
openclaw hooks list --json
Returns structured JSON for programmatic use.
openclaw hooks info <name>
Show detailed information about a specific hook.
Arguments:
<name>: Hook name or hook key (e.g., session-memory)Options:
--json: Output as JSONExample:
openclaw hooks info session-memory
Output:
πΎ session-memory β Ready
Save session context to memory when /new or /reset 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/automation/hooks#session-memory
Events: command:new, command:reset
Requirements:
Config: β workspace.dir
openclaw hooks check
Show summary of hook eligibility status (how many are ready vs. not ready).
Options:
--json: Output as JSONExample output:
Hooks Status
Total hooks: 4
Ready: 4
Not ready: 0
openclaw hooks enable <name>
Enable a specific hook by adding it to your config (~/.openclaw/openclaw.json by default).
Note: Workspace hooks are disabled by default until enabled here or in config. Hooks managed by plugins show plugin:<id> in openclaw hooks list and canβt be enabled/disabled here. Enable/disable the plugin instead.
Arguments:
<name>: Hook name (e.g., session-memory)Example:
openclaw hooks enable session-memory
Output:
β Enabled hook: πΎ session-memory
What it does:
hooks.internal.entries.<name>.enabled = true in your configIf the hook came from <workspace>/hooks/, this opt-in step is required before
the Gateway will load it.
After enabling:
openclaw hooks disable <name>
Disable a specific hook by updating your config.
Arguments:
<name>: Hook name (e.g., command-logger)Example:
openclaw hooks disable command-logger
Output:
βΈ Disabled hook: π command-logger
After disabling:
openclaw hooks list --json, info --json, and check --json write structured JSON directly to stdout.openclaw plugins install <package> # npm by default
openclaw plugins install npm:<package> # npm only
openclaw plugins install <package> --pin # pin version
openclaw plugins install <path> # local path
Install hook packs through the unified plugins installer.
openclaw hooks install still works as a compatibility alias, but it prints a
deprecation warning and forwards to openclaw plugins install.
Npm specs are registry-only (package name + optional exact version or
dist-tag). Git/URL/file specs and semver ranges are rejected. Dependency
installs run project-local with --ignore-scripts for safety, even when your
shell has global npm install settings.
Bare specs and @latest stay on the stable track. If npm resolves either of
those to a prerelease, OpenClaw stops and asks you to opt in explicitly with a
prerelease tag such as @beta/@rc or an exact prerelease version.
What it does:
~/.openclaw/hooks/<id>hooks.internal.entries.*hooks.internal.installsOptions:
-l, --link: Link a local directory instead of copying (adds it to hooks.internal.load.extraDirs)--pin: Record npm installs as exact resolved name@version in hooks.internal.installsSupported archives: .zip, .tgz, .tar.gz, .tar
Examples:
# Local directory
openclaw plugins install ./my-hook-pack
# Local archive
openclaw plugins install ./my-hook-pack.zip
# NPM package
openclaw plugins install @openclaw/my-hook-pack
# Link a local directory without copying
openclaw plugins install -l ./my-hook-pack
Linked hook packs are treated as managed hooks from an operator-configured directory, not as workspace hooks.
openclaw plugins update <id>
openclaw plugins update --all
Update tracked npm-based hook packs through the unified plugins updater.
openclaw hooks update still works as a compatibility alias, but it prints a
deprecation warning and forwards to openclaw plugins update.
Options:
--all: Update all tracked hook packs--dry-run: Show what would change without writingWhen a stored integrity hash exists and the fetched artifact hash changes,
OpenClaw prints a warning and asks for confirmation before proceeding. Use
global --yes to bypass prompts in CI/non-interactive runs.
Saves session context to memory when you issue /new or /reset.
Enable:
openclaw hooks enable session-memory
Output: ~/.openclaw/workspace/memory/YYYY-MM-DD-HHMM.md by default. Set hooks.internal.entries.session-memory.llmSlug: true for model-generated filename slugs.
See: session-memory documentation
Injects additional bootstrap files (for example monorepo-local AGENTS.md / TOOLS.md) during agent:bootstrap.
Enable:
openclaw hooks enable bootstrap-extra-files
See: bootstrap-extra-files documentation
Logs all command events to a centralized audit file.
Enable:
openclaw hooks enable command-logger
Output: ~/.openclaw/logs/commands.log
View logs:
# Recent commands
tail -n 20 ~/.openclaw/logs/commands.log
# Pretty-print
cat ~/.openclaw/logs/commands.log | jq .
# Filter by action
grep '"action":"new"' ~/.openclaw/logs/commands.log | jq .
See: command-logger documentation
Runs BOOT.md when the gateway starts (after channels start).
Events: gateway:startup
Enable:
openclaw hooks enable boot-md