Agent Skillsmemohai/Memoh › hooks-setup

hooks-setup

GitHub

用于配置和管理 Memoh 工作区钩子(hooks),支持检查、创建、更新和调试 /data/.memoh/hooks.json 中的事件触发器、匹配器及命令动作,确保 JSON 语法正确并遵循最小化工作流程。

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

Trigger Scenarios

用户要求检查或解释 Memoh hooks 配置 需要创建或更新 .memoh/hooks.json 文件 调试 hooks 执行逻辑或错误行为

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
2fb1f05
Hash
1206f066
Indexed
2026-08-20 08:31

- 위키
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-25 13:24
浙ICP备14020137号-1 $방문자$