hook-creator
Create, modify, and manage xbot hooks. Use when the user asks to set up a hook, configure lifecycle event handlers, or modify hooks.json.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Create, modify, and manage xbot hooks. Use when the user asks to set up a hook, configure lifecycle event handlers, or modify hooks.json.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
Manage SubAgent roles: create, view, modify, delete, or install agent definitions. MUST activate when user asks to create/edit/view/inspect any agent, install agents from external sources, or when you need to look at agent files under ~/.xbot/agents/. Agents are universal — install whatever the user needs.
Create, modify, and manage xbot plugins. Use when the user asks to create a plugin, set up script plugins, configure widgets, register custom tools via plugins, or create channel plugins.
Create, update, delete, or install skills. Use when the user asks to create a new skill, modify an existing skill, install/import a skill from external sources (GitHub, URLs), package scripts/assets into a skill, or discusses skill design and structure. Skills are universal agent capabilities — install whatever the user wants.
Guide for AI to configure xbot TUI, themes, subscriptions, and settings. Activate when the user asks to customize the TUI appearance, create themes, manage LLM subscriptions, or make bulk configuration changes.
Build implementation plans for complex tasks. Use when the user asks to plan, design an approach, or think through a task before coding. Also activate for large refactorings, multi-file changes, or when the user says 'plan first' or '/plan'.
Post-development cleanup: update AGENTS.md and docs/agent/ knowledge files to reflect code changes. MUST activate before git commit (or when user asks to commit/push). Also activate after any code modification that adds/removes files, changes architecture, or modifies core behavior.
| name | hook-creator |
| description | Create, modify, and manage xbot hooks. Use when the user asks to set up a hook, configure lifecycle event handlers, or modify hooks.json. |
Create and manage xbot hooks configuration.
~/.xbot/hooks.json — user-level (personal)<project>/.xbot/hooks.json — project-level (can commit to git)<project>/.xbot/hooks.local.json — local override (git-ignored){
"enable_command_hooks": true,
"hooks": {
"EventName": [
{
"matcher": "ToolName", // glob pattern, "" = match all
"hooks": [
{
"type": "command", // "command" | "http" | "mcp_tool"
"command": "script.sh",
"if": "Shell(*git*)", // optional fine-grained filter
"timeout": 30,
"async": false
}
]
}
]
}
}
| Event | When | Blocking |
|---|---|---|
SessionStart | Session created/resumed | No |
SessionEnd | Session ends | No |
UserPromptSubmit | Before LLM processing | Yes |
PreToolUse | Before tool execution | Yes |
PostToolUse | After tool success | No |
PostToolUseFailure | After tool failure | No |
PostToolBatch | After all tools in batch | Yes |
PermissionRequest | Permission check | Yes |
SubAgentStart | SubAgent created | No |
SubAgentStop | SubAgent completed | Yes |
AgentStop | Agent response complete | Yes |
AgentError | LLM API call failed | No |
PreCompact | Before context compression | Yes |
PostCompact | After compression | No |
CronFired | Cron job triggered | No |
WebhookReceived | Webhook received | No |
${variable} interpolation.Priority: deny > defer > ask > allow
| Variable | Value |
|---|---|
$XBOT_PROJECT_DIR | Current project root |
$XBOT_SESSION_ID | Current session ID |
$XBOT_HOME | ~/.xbot |
~/.xbot/hooks.json) or project-level (.xbot/hooks.json)tui_control with action reload_hooks to apply changes immediatelyenable_command_hooks defaults to false. MUST set to true for command-type hooks.if matches the entire tool input string as text, NOT key=value. Shell(*git commit*) works; Shell(command=*git*) does NOT."command": "PATH=\"$PATH:$(go env GOPATH)/bin\" make lint || exit 2"
{
"enable_command_hooks": true,
"hooks": {
"PreToolUse": [
{
"matcher": "Shell",
"hooks": [{
"type": "command",
"command": ".xbot/hooks/lint.sh",
"if": "Shell(*git commit*)",
"timeout": 120
}]
}
]
}
}
{
"enable_command_hooks": true,
"hooks": {
"AgentError": [{
"matcher": "",
"hooks": [{
"type": "command",
"command": "notify-send 'xbot error' 'LLM call failed'",
"async": true
}]
}]
}
}
IMPORTANT: Always reload hooks configuration so changes take effect immediately:
tui_control(action="reload_hooks")
Without reload, changes to hooks.json only apply after CLI restart.