ClawKit Logo
ClawKitReliability Toolkit
Back to Registry
Official Verified developer tools Safety 2/5

Openclaw Hook

Skill by cbd2020

skill-install — Terminal

Install via CLI (Recommended)

clawhub install openclaw/skills/skills/cbd2020/openclaw-hook
Or

What This Skill Does

OpenClaw Hook is an essential development tool for the OpenClaw Gateway, designed to empower developers to create, maintain, and debug internal hooks. Internal hooks act as middleware processors that intercept specific agent lifecycle events, such as system bootstrap. This skill provides a structured framework for injecting virtual context files, managing session-specific data, and executing custom JavaScript/TypeScript code when an agent initializes or performs defined actions.

Installation

To integrate this skill, use the following command in your terminal: clawhub install openclaw/skills/skills/cbd2020/openclaw-hook Once installed, you must configure your ~/.openclaw/openclaw.json file to enable the hooks module and point to your custom hook directory. After updating the configuration, run openclaw gateway restart to apply the changes and load your logic into the runtime environment.

Use Cases

  • Dynamic Context Injection: Automatically inject 'MEMORY.md' or 'PROJECT.md' files into the agent workspace upon startup to ensure the agent has the latest project context.
  • Custom Notifications: Integrate external alerting systems like Telegram or custom Webhooks to receive notifications when specific events, such as task completion or system errors, occur.
  • Debugging Lifecycle Issues: Troubleshoot deployment bottlenecks, such as Content-Length errors or missing context data, by logging the raw event payload during the bootstrap phase.
  • Task Automation: Trigger secondary processes or cleanup tasks automatically when a session is initialized or terminated.

Example Prompts

  1. "I need to debug why my Telegram notifications aren't triggering when a bootstrap event happens; can you help me check my handler.js?"
  2. "Create a new internal hook for me that injects a 'RULES.md' file into the agent context whenever a new session starts."
  3. "My openclaw hook isn't working as expected; please review my ~/.openclaw/openclaw.json configuration and the handler logic."

Tips & Limitations

  • Safety First: Always validate the event.type and event.action to avoid unnecessary overhead and prevent your hook from running on unauthorized sub-agents.
  • Performance: Keep your handler logic lightweight. Since hooks execute during the bootstrap process, heavy operations can delay the agent's availability.
  • Error Handling: Implement comprehensive try-catch blocks within your handler to prevent the entire Gateway process from crashing due to an unhandled exception in your code.
  • Isolation: Use the sessionKey filtering method to ensure your custom hooks only run on intended agent instances.

Metadata

Author@cbd2020
Stars4044
Views1
Updated2026-04-12
View Author Profile
AI Skill Finder

Not sure this is the right skill?

Describe what you want to build — we'll match you to the best skill from 16,000+ options.

Find the right skill
Add to Configuration

Paste this into your clawhub.json to enable this plugin.

{
  "plugins": {
    "official-cbd2020-openclaw-hook": {
      "enabled": true,
      "auto_update": true
    }
  }
}

Tags(AI)

#hooks#gateway#automation#developer#javascript
Safety Score: 2/5

Flags: file-write, file-read, code-execution