Building Custom AI Skills with InstructLab Taxonomy
Create domain-specific AI capabilities using InstructLab's taxonomy system—from writing skill definitions to generating synthetic training data and validating fine-tuned models.
OpenClaw’s hooks system lets the gateway execute automated actions when specific events occur. The most important built-in hook is session-memory, which triggers on conversation lifecycle events to manage the agent’s durable memory.
In the gateway logs, you’ll see it registered on every startup:
[hooks:loader] Registered hook: session-memory
-> command:new, command:resetThis means the session-memory hook fires whenever:
command:new)command:reset)Without hooks, memory management would be entirely manual — you’d need to tell the agent to save important information before ending each conversation. Session hooks automate this by:
New session starts (command:new)
→ session-memory hook fires
→ Hook searches memory for relevant context
→ Matching notes injected into agent context
→ Conversation proceeds with memory-augmented context
Session resets (command:reset)
→ session-memory hook fires
→ Hook evaluates what to preserve
→ Important context written to memory notes
→ Session cleared with knowledge safely storedThe session-memory hook works in concert with the memory flush system:
| System | When It Fires | What It Does |
|---|---|---|
| Memory flush | Before compaction (token threshold) | Saves notes mid-conversation |
| Session-memory hook | On new/reset events | Loads/saves notes at session boundaries |
Together, they create a complete memory lifecycle:
Session start → Load relevant notes (hook)
→ Long conversation → Flush notes (compaction)
→ Continue → Flush again if needed
→ Session end/reset → Save final notes (hook)
→ Next session → Load again (hook)After starting or restarting the gateway, check that the hook is registered:
docker logs openclaw-openclaw-gateway-1 | grep "hooks:loader"Expected output:
[hooks:loader] Registered hook: session-memory
-> command:new, command:resetIf you don’t see this line, the hook system may not be properly initialized. Check:
The session-memory hook requires these features to be configured:
docker compose run --rm openclaw-cli config set \
agents.defaults.compaction.memoryFlush.enabled true
docker compose run --rm openclaw-cli config set \
agents.defaults.compaction.memoryFlush.softThresholdTokens 4000docker compose run --rm openclaw-cli config set \
agents.defaults.memorySearch.provider local
docker compose run --rm openclaw-cli config set \
agents.defaults.memorySearch.model all-MiniLM-L6-v2mkdir -p ~/.openclaw/memory/notes
sudo chown -R 1000:1000 ~/.openclaw/memoryThe OpenClaw CLI provides a dedicated hooks command:
# List all registered hooks
docker compose run --rm openclaw-cli hooks list
# Inspect a specific hook
docker compose run --rm openclaw-cli hooks inspect session-memory
# List available hook events
docker compose run --rm openclaw-cli hooks eventsThe hooks system supports various events beyond session management:
| Event | Triggered When |
|---|---|
command:new | New conversation session created |
command:reset | Session reset (history cleared) |
message:incoming | New message received from user |
message:outgoing | Agent sends response |
compaction:before | Before context compaction |
compaction:after | After context compaction |
gateway:start | Gateway process starts |
gateway:stop | Gateway process stops |
The session-memory hook specifically listens to command:new and command:reset.
Beyond the built-in session-memory hook, you can create custom hooks for additional automation:
A hook that generates a daily summary when the first session of the day starts:
{
"hooks": {
"daily-summary": {
"events": ["command:new"],
"condition": "firstSessionOfDay",
"action": {
"type": "agentTurn",
"prompt": "Review memory/notes from yesterday. Write a summary to memory/daily/YYYY-MM-DD-summary.md"
}
}
}
}A hook that triggers a memory backup on session reset:
{
"hooks": {
"memory-backup": {
"events": ["command:reset"],
"action": {
"type": "exec",
"command": "tar czf /backup/memory-$(date +%s).tar.gz /home/node/.openclaw/memory/"
}
}
}
}Enable trace-level logging to see hooks fire in real-time:
docker compose run --rm openclaw-cli config set \
gateway.logLevel trace
docker logs -f openclaw-openclaw-gateway-1 | grep -i "hook"You’ll see detailed execution traces:
[hooks:exec] session-memory: triggered by command:new
[hooks:exec] session-memory: searching memory (query: session context)
[hooks:exec] session-memory: found 3 relevant notes
[hooks:exec] session-memory: injected 847 tokens from memoryRemember to reset the log level after debugging:
docker compose run --rm openclaw-cli config set \
gateway.logLevel infocommand:new (New Session)command:reset (Session Reset)memory/notes/ as a Markdown fileHook not registered:
# Check if memory features are configured
docker compose run --rm openclaw-cli config get agents.defaults.compaction.memoryFlush.enabled
docker compose run --rm openclaw-cli config get agents.defaults.memorySearch.providerHook fires but no notes saved:
docker logs openclaw-openclaw-gateway-1 | grep -i "error\|hook"Duplicate hook registrations:
Hook not loading memory into session:
memory reindex to rebuild the search indexAI & Cloud Advisor with 18+ years experience. Author of 8 technical books, creator of Ansible Pilot. Speaker at KubeCon EU & Red Hat Summit 2026.
Create domain-specific AI capabilities using InstructLab's taxonomy system—from writing skill definitions to generating synthetic training data and validating fine-tuned models.
How to access the OpenClaw Control UI dashboard from an Azure VM — via SSH tunnel (secure) or public IP. Covers device pairing, dashboard authentication, and the browser-based management interface.
End-to-end guide to building a complete persistent memory system for your OpenClaw AI agent. Combine memory flush, hybrid search, file-backed notes, SQLite indexing, and session hooks into a cohesive knowledge architecture.