Agent Skillsmemohai/Memoh › hooks-setup

hooks-setup

GitHub

用于配置、调试和解释 Memoh 工作区钩子,支持创建、更新 hooks.json 及定义事件匹配器与动作行为。

templates/workspace/.memoh/skills/hooks-setup/SKILL.md memohai/Memoh

Trigger Scenarios

用户询问如何设置或修改 Memoh 钩子 需要检查或调试 hooks.json 配置

Install

npx skills add memohai/Memoh --skill hooks-setup -g -y
More Options

Non-standard path

npx skills add https://github.com/memohai/Memoh/tree/main/templates/workspace/.memoh/skills/hooks-setup -g -y

Use without installing

npx skills use memohai/Memoh@hooks-setup

指定 Agent (Claude Code)

npx skills add memohai/Memoh --skill hooks-setup -a claude-code -g -y

安装 repo 全部 skill

npx skills add memohai/Memoh --all -g -y

预览 repo 内 skill

npx skills add memohai/Memoh --list

SKILL.md

Frontmatter
{
    "name": "hooks-setup",
    "description": "Configure Memoh hooks in \/data\/.memoh\/hooks.json, including events, matchers, command\/tool actions, decisions, on_error behavior, append_context, and validation. Use when the user asks to inspect, create, update, debug, or explain workspace hooks."
}

Hooks Setup

Use this skill when the user wants to inspect, create, update, debug, or explain Memoh hooks.

Files

  • User hooks live at /data/.memoh/hooks.json.
  • Detailed schema, events, payloads, and examples live in references/reference.md.

Read references/reference.md before adding anything beyond an empty config or a simple logging hook.

Empty Config

If /data/.memoh/hooks.json is missing, create:

{
  "version": 1,
  "enabled": true,
  "hooks": []
}

Minimal Workflow

  1. Read /data/.memoh/hooks.json.
  2. Preserve existing hooks unless the user asks to replace them.
  3. Choose the narrowest event and matcher.
  4. Prefer logging hooks with on_error: "ignore".
  5. Use on_error: "block" only for guardrail hooks that should deny on failure.
  6. Validate JSON syntax before finishing.

Common Pattern

{
  "version": 1,
  "enabled": true,
  "defaults": {
    "timeout": "10s",
    "on_error": "fail",
    "max_output_bytes": 65536,
    "trigger_nested_hooks": false
  },
  "env": {},
  "hooks": [
    {
      "name": "log workspace commands",
      "event": "AfterWorkspaceCommand",
      "enabled": true,
      "priority": 10,
      "matcher": ".*",
      "actions": [
        {
          "type": "command",
          "command": "mkdir -p .memoh && cat >> .memoh/hooks.log",
          "on_error": "ignore"
        }
      ]
    }
  ]
}

Action Output

Command and tool actions may return:

{
  "decision": "allow",
  "reason": "optional explanation",
  "append_context": "optional context"
}

Allowed decisions are allow, deny, ask_approval, and append_context.

For full examples and the complete event catalog, read references/reference.md.

Version History

  • 2fb1f05 Current 2026-08-20 08:31

Same Skill Collection

.agents/skills/humanizer-zh/SKILL.md
.agents/skills/humanizer/SKILL.md
.agents/skills/memoh-error-handling/SKILL.md
.agents/skills/twilight-ai/SKILL.md
templates/workspace/.memoh/skills/skill-creator/SKILL.md

Metadata

Files
0
Version
6bc7043
Hash
1206f066
Indexed
2026-08-20 08:31

Accueil - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-28 23:11
浙ICP备14020137号-1 $Carte des visiteurs$