{
  "description": "codebuddy-mem 记忆系统钩子 — 基于 claude-mem AGPL-3.0 分叉",
  "hooks": {
    "Setup": [
      {
        "matcher": "*",
        "hooks": [
          {
            "type": "command",
            "shell": "bash",
            "command": "export PATH=\"$HOME/.nvm/versions/node/v$(ls \"$HOME/.nvm/versions/node\" 2>/dev/null | sed 's/^v//' | sort -t. -k1,1n -k2,2n -k3,3n | tail -1)/bin:$HOME/.local/bin:/usr/local/bin:/opt/homebrew/bin:$PATH\"; _R=\"${CODEBUDDY_PLUGIN_ROOT:-$HOME/.codebuddy-mem}\"; _R=\"${_R%/}\"; node \"$_R/scripts/version-check.js\"",
            "timeout": 300
          }
        ]
      }
    ],
    "SessionStart": [
      {
        "matcher": "startup|clear|compact",
        "hooks": [
          {
            "type": "command",
            "shell": "bash",
            "command": "export CLAUDE_MEM_DATA_DIR=\"${CODEBUDDY_MEM_DATA_DIR:-$HOME/.codebuddy-mem}\"; export CODEBUDDY_MEM_DATA_DIR=\"${CODEBUDDY_MEM_DATA_DIR:-$HOME/.codebuddy-mem}\"; export PATH=\"$($SHELL -lc 'echo $PATH' 2>/dev/null):$PATH\"; _R=\"${CODEBUDDY_PLUGIN_ROOT:-$HOME/.codebuddy-mem}\"; _R=\"${_R%/}\"; node \"$_R/scripts/bun-runner.js\" \"$_R/scripts/worker-service.cjs\" start; echo '{\"continue\":true,\"suppressOutput\":true}'",
            "timeout": 60
          },
          {
            "type": "command",
            "shell": "bash",
            "command": "export CLAUDE_MEM_DATA_DIR=\"${CODEBUDDY_MEM_DATA_DIR:-$HOME/.codebuddy-mem}\"; export CODEBUDDY_MEM_DATA_DIR=\"${CODEBUDDY_MEM_DATA_DIR:-$HOME/.codebuddy-mem}\"; export PATH=\"$($SHELL -lc 'echo $PATH' 2>/dev/null):$PATH\"; _R=\"${CODEBUDDY_PLUGIN_ROOT:-$HOME/.codebuddy-mem}\"; _R=\"${_R%/}\"; node \"$_R/scripts/bun-runner.js\" \"$_R/scripts/worker-service.cjs\" hook codebuddy context",
            "timeout": 60
          }
        ]
      }
    ],
    "UserPromptSubmit": [
      {
        "hooks": [
          {
            "type": "command",
            "shell": "bash",
            "command": "export CLAUDE_MEM_DATA_DIR=\"${CODEBUDDY_MEM_DATA_DIR:-$HOME/.codebuddy-mem}\"; export CODEBUDDY_MEM_DATA_DIR=\"${CODEBUDDY_MEM_DATA_DIR:-$HOME/.codebuddy-mem}\"; export PATH=\"$($SHELL -lc 'echo $PATH' 2>/dev/null):$PATH\"; _R=\"${CODEBUDDY_PLUGIN_ROOT:-$HOME/.codebuddy-mem}\"; _R=\"${_R%/}\"; node \"$_R/scripts/bun-runner.js\" \"$_R/scripts/worker-service.cjs\" hook codebuddy session-init",
            "timeout": 60
          }
        ]
      }
    ],
    "PostToolUse": [
      {
        "matcher": "*",
        "hooks": [
          {
            "type": "command",
            "shell": "bash",
            "command": "export CLAUDE_MEM_DATA_DIR=\"${CODEBUDDY_MEM_DATA_DIR:-$HOME/.codebuddy-mem}\"; export CODEBUDDY_MEM_DATA_DIR=\"${CODEBUDDY_MEM_DATA_DIR:-$HOME/.codebuddy-mem}\"; export PATH=\"$($SHELL -lc 'echo $PATH' 2>/dev/null):$PATH\"; _R=\"${CODEBUDDY_PLUGIN_ROOT:-$HOME/.codebuddy-mem}\"; _R=\"${_R%/}\"; node \"$_R/scripts/bun-runner.js\" \"$_R/scripts/worker-service.cjs\" hook codebuddy observation",
            "timeout": 120
          }
        ]
      }
    ],
    "PreToolUse": [
      {
        "matcher": "Read",
        "hooks": [
          {
            "type": "command",
            "shell": "bash",
            "command": "export CLAUDE_MEM_DATA_DIR=\"${CODEBUDDY_MEM_DATA_DIR:-$HOME/.codebuddy-mem}\"; export CODEBUDDY_MEM_DATA_DIR=\"${CODEBUDDY_MEM_DATA_DIR:-$HOME/.codebuddy-mem}\"; export PATH=\"$($SHELL -lc 'echo $PATH' 2>/dev/null):$PATH\"; _R=\"${CODEBUDDY_PLUGIN_ROOT:-$HOME/.codebuddy-mem}\"; _R=\"${_R%/}\"; node \"$_R/scripts/bun-runner.js\" \"$_R/scripts/worker-service.cjs\" hook codebuddy file-context",
            "timeout": 60
          }
        ]
      }
    ],
    "Stop": [
      {
        "hooks": [
          {
            "type": "command",
            "shell": "bash",
            "command": "export CLAUDE_MEM_DATA_DIR=\"${CODEBUDDY_MEM_DATA_DIR:-$HOME/.codebuddy-mem}\"; export CODEBUDDY_MEM_DATA_DIR=\"${CODEBUDDY_MEM_DATA_DIR:-$HOME/.codebuddy-mem}\"; export PATH=\"$($SHELL -lc 'echo $PATH' 2>/dev/null):$PATH\"; _R=\"${CODEBUDDY_PLUGIN_ROOT:-$HOME/.codebuddy-mem}\"; _R=\"${_R%/}\"; node \"$_R/scripts/bun-runner.js\" \"$_R/scripts/worker-service.cjs\" hook codebuddy summarize",
            "timeout": 120
          }
        ]
      }
    ]
  }
}
