forked from Selig/openclaw-skill
Initial commit: OpenClaw Skill Collection
6 custom skills (assign-task, dispatch-webhook, daily-briefing, task-capture, qmd-brain, tts-voice) with technical documentation. Compatible with Claude Code, OpenClaw, Codex CLI, and OpenCode.
This commit is contained in:
41
openclaw-knowhow-skill/docs/infrastructure/hooks/index.md
Normal file
41
openclaw-knowhow-skill/docs/infrastructure/hooks/index.md
Normal file
@@ -0,0 +1,41 @@
|
||||
# Hooks Documentation Summary
|
||||
|
||||
## Core Concept
|
||||
OpenClaw's hooks system provides an event-driven mechanism for automating actions in response to agent commands and lifecycle events. Hooks are small scripts that run when something happens.
|
||||
|
||||
## Key Components
|
||||
|
||||
**Two Hook Categories:**
|
||||
- **Hooks**: Run inside the Gateway when agent events fire (like `/new`, `/reset`, `/stop`)
|
||||
- **Webhooks**: External HTTP endpoints for triggering work in OpenClaw
|
||||
|
||||
**Discovery Locations (by precedence):**
|
||||
1. Workspace hooks (`<workspace>/hooks/`)
|
||||
2. Managed hooks (`~/.openclaw/hooks/`)
|
||||
3. Bundled hooks (shipped with OpenClaw)
|
||||
|
||||
## Structure Requirements
|
||||
|
||||
Each hook requires:
|
||||
- **HOOK.md**: Metadata in YAML frontmatter plus documentation
|
||||
- **handler.ts**: TypeScript implementation exporting a `HookHandler` function
|
||||
|
||||
The metadata object supports fields like `emoji`, `events`, `requires` (for binaries/environment variables), and `homepage`.
|
||||
|
||||
## Event Types
|
||||
|
||||
**Command events**: `command:new`, `command:reset`, `command:stop`
|
||||
**Agent events**: `agent:bootstrap`
|
||||
**Gateway events**: `gateway:startup`
|
||||
|
||||
## Bundled Hooks
|
||||
|
||||
Four hooks ship with OpenClaw:
|
||||
- **session-memory**: Saves context when `/new` is issued
|
||||
- **command-logger**: Audit trail to `~/.openclaw/logs/commands.log`
|
||||
- **boot-md**: Executes `BOOT.md` on gateway startup
|
||||
- **soul-evil**: Swaps SOUL content during specified windows
|
||||
|
||||
## Management
|
||||
|
||||
CLI commands include `openclaw hooks list`, `enable`, `disable`, `info`, and `check` for discovery and eligibility verification.
|
||||
Reference in New Issue
Block a user