{
  "description": "ccx-ecc-mem memory system hooks",
  "hooks": {
    "Setup": [
      {
        "matcher": "*",
        "hooks": [
          {
            "type": "command",
            "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=\"${CLAUDE_PLUGIN_ROOT}\"; [ -z \"$_R\" ] && _R=$(ls -dt $HOME/.claude/plugins/cache/remote1993/ccx-ecc-mem/[0-9]*/ 2>/dev/null | head -1); _R=\"${_R%/}\"; [ -z \"$_R\" ] && _R=\"$HOME/.claude/plugins/marketplaces/remote1993/plugin\"; node \"$_R/scripts/smart-install.js\"",
            "timeout": 300
          }
        ]
      }
    ],
    "SessionStart": [
      {
        "matcher": "startup|clear|compact",
        "hooks": [
          {
            "type": "command",
            "command": "export PATH=\"$(${SHELL:-/bin/sh} -lc 'echo $PATH' 2>/dev/null):$PATH\"; _R=\"${CLAUDE_PLUGIN_ROOT}\"; [ -z \"$_R\" ] && _R=$(ls -dt $HOME/.claude/plugins/cache/remote1993/ccx-ecc-mem/[0-9]*/ 2>/dev/null | head -1); _R=\"${_R%/}\"; [ -z \"$_R\" ] && _R=\"$HOME/.claude/plugins/marketplaces/remote1993/plugin\"; node \"$_R/scripts/smart-install.js\"",
            "timeout": 300
          },
          {
            "type": "command",
"command": "export PATH=\"$(${SHELL:-/bin/sh} -lc 'echo $PATH' 2>/dev/null):$PATH\"; _R=\"${CLAUDE_PLUGIN_ROOT}\"; [ -z \"$_R\" ] && _R=$(ls -dt $HOME/.claude/plugins/cache/remote1993/ccx-ecc-mem/[0-9]*/ 2>/dev/null | head -1); _R=\"${_R%/}\"; [ -z \"$_R\" ] && _R=\"$HOME/.claude/plugins/marketplaces/remote1993/plugin\"; PORT=\"${CLAUDE_MEM_WORKER_PORT:-}\"; HOST=\"${CLAUDE_MEM_WORKER_HOST:-}\"; [ -z \"$PORT\" ] && PORT=$(sed -n 's/.*\"CLAUDE_MEM_WORKER_PORT\"[^0-9]*\\([0-9][0-9]*\\).*/\\1/p' \"$HOME/.claude-mem/settings.json\" 2>/dev/null | head -1); [ -z \"$HOST\" ] && HOST=$(sed -n 's/.*\"CLAUDE_MEM_WORKER_HOST\"[^\"]*\"\\([^\"]*\\)\".*/\\1/p' \"$HOME/.claude-mem/settings.json\" 2>/dev/null | head -1); if [ -z \"$PORT\" ]; then case \"$(uname -s 2>/dev/null)\" in MINGW*|CYGWIN*|MSYS*) PORT=37777;; *) PORT=$((37700 + $(id -u 2>/dev/null || echo 77) % 100));; esac; fi; [ -z \"$HOST\" ] && HOST=127.0.0.1; node \"$_R/scripts/bun-runner.js\" \"$_R/scripts/worker-service.cjs\" start; for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20; do curl -sf http://$HOST:$PORT/health >/dev/null 2>&1 && break; sleep 1; done; if ! curl -sf http://$HOST:$PORT/health >/dev/null 2>&1; then echo \"ccx-ecc-mem startup hook: worker health check failed on http://$HOST:$PORT/health\" >&2; fi; echo '{\"continue\":true,\"suppressOutput\":true}'",
            "timeout": 60
          },
          {
            "type": "command",
"command": "export PATH=\"$(${SHELL:-/bin/sh} -lc 'echo $PATH' 2>/dev/null):$PATH\"; _R=\"${CLAUDE_PLUGIN_ROOT}\"; [ -z \"$_R\" ] && _R=$(ls -dt $HOME/.claude/plugins/cache/remote1993/ccx-ecc-mem/[0-9]*/ 2>/dev/null | head -1); _R=\"${_R%/}\"; [ -z \"$_R\" ] && _R=\"$HOME/.claude/plugins/marketplaces/remote1993/plugin\"; PORT=\"${CLAUDE_MEM_WORKER_PORT:-}\"; HOST=\"${CLAUDE_MEM_WORKER_HOST:-}\"; [ -z \"$PORT\" ] && PORT=$(sed -n 's/.*\"CLAUDE_MEM_WORKER_PORT\"[^0-9]*\\([0-9][0-9]*\\).*/\\1/p' \"$HOME/.claude-mem/settings.json\" 2>/dev/null | head -1); [ -z \"$HOST\" ] && HOST=$(sed -n 's/.*\"CLAUDE_MEM_WORKER_HOST\"[^\"]*\"\\([^\"]*\\)\".*/\\1/p' \"$HOME/.claude-mem/settings.json\" 2>/dev/null | head -1); if [ -z \"$PORT\" ]; then case \"$(uname -s 2>/dev/null)\" in MINGW*|CYGWIN*|MSYS*) PORT=37777;; *) PORT=$((37700 + $(id -u 2>/dev/null || echo 77) % 100));; esac; fi; [ -z \"$HOST\" ] && HOST=127.0.0.1; for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20; do curl -sf http://$HOST:$PORT/health >/dev/null 2>&1 && break; sleep 1; done; if curl -sf http://$HOST:$PORT/health >/dev/null 2>&1; then node \"$_R/scripts/bun-runner.js\" \"$_R/scripts/worker-service.cjs\" hook claude-code context || true; fi",
            "timeout": 60
          }
        ]
      }
    ],
    "UserPromptSubmit": [
      {
        "hooks": [
          {
            "type": "command",
            "command": "export PATH=\"$(${SHELL:-/bin/sh} -lc 'echo $PATH' 2>/dev/null):$PATH\"; _R=\"${CLAUDE_PLUGIN_ROOT}\"; [ -z \"$_R\" ] && _R=$(ls -dt $HOME/.claude/plugins/cache/remote1993/ccx-ecc-mem/[0-9]*/ 2>/dev/null | head -1); _R=\"${_R%/}\"; [ -z \"$_R\" ] && _R=\"$HOME/.claude/plugins/marketplaces/remote1993/plugin\"; PORT=\"${CLAUDE_MEM_WORKER_PORT:-}\"; HOST=\"${CLAUDE_MEM_WORKER_HOST:-}\"; [ -z \"$PORT\" ] && PORT=$(sed -n 's/.*\"CLAUDE_MEM_WORKER_PORT\"[^0-9]*\\([0-9][0-9]*\\).*/\\1/p' \"$HOME/.claude-mem/settings.json\" 2>/dev/null | head -1); [ -z \"$HOST\" ] && HOST=$(sed -n 's/.*\"CLAUDE_MEM_WORKER_HOST\"[^\"]*\"\\([^\"]*\\)\".*/\\1/p' \"$HOME/.claude-mem/settings.json\" 2>/dev/null | head -1); if [ -z \"$PORT\" ]; then case \"$(uname -s 2>/dev/null)\" in MINGW*|CYGWIN*|MSYS*) PORT=37777;; *) PORT=$((37700 + $(id -u 2>/dev/null || echo 77) % 100));; esac; fi; [ -z \"$HOST\" ] && HOST=127.0.0.1; _HEALTH=0; curl -sf http://$HOST:$PORT/health >/dev/null 2>&1 && _HEALTH=1 || for i in 1 2 3 4 5 6 7 8 9 10; do sleep 1; curl -sf http://$HOST:$PORT/health >/dev/null 2>&1 && _HEALTH=1 && break; done; [ \"$_HEALTH\" = \"1\" ] && node \"$_R/scripts/bun-runner.js\" \"$_R/scripts/worker-service.cjs\" hook claude-code session-init",
            "timeout": 60
          }
        ]
      }
    ],
    "PostToolUse": [
      {
        "matcher": "*",
        "hooks": [
          {
            "type": "command",
            "command": "export PATH=\"$(${SHELL:-/bin/sh} -lc 'echo $PATH' 2>/dev/null):$PATH\"; _R=\"${CLAUDE_PLUGIN_ROOT}\"; [ -z \"$_R\" ] && _R=$(ls -dt $HOME/.claude/plugins/cache/remote1993/ccx-ecc-mem/[0-9]*/ 2>/dev/null | head -1); _R=\"${_R%/}\"; [ -z \"$_R\" ] && _R=\"$HOME/.claude/plugins/marketplaces/remote1993/plugin\"; node \"$_R/scripts/bun-runner.js\" \"$_R/scripts/worker-service.cjs\" hook claude-code observation",
            "timeout": 120
          }
        ]
      }
    ],
    "PreToolUse": [
      {
        "matcher": "Edit|Write|MultiEdit|NotebookEdit",
        "hooks": [
          {
            "type": "command",
            "command": "export PATH=\"$(${SHELL:-/bin/sh} -lc 'echo $PATH' 2>/dev/null):$PATH\"; _R=\"${CLAUDE_PLUGIN_ROOT}\"; [ -z \"$_R\" ] && _R=$(ls -dt $HOME/.claude/plugins/cache/remote1993/ccx-ecc-mem/[0-9]*/ 2>/dev/null | head -1); _R=\"${_R%/}\"; [ -z \"$_R\" ] && _R=\"$HOME/.claude/plugins/marketplaces/remote1993/plugin\"; node \"$_R/scripts/bun-runner.js\" \"$_R/scripts/worker-service.cjs\" hook claude-code fusion-policy",
            "timeout": 10
          }
        ]
      },
      {
        "matcher": "Read",
        "hooks": [
          {
            "type": "command",
            "command": "export PATH=\"$(${SHELL:-/bin/sh} -lc 'echo $PATH' 2>/dev/null):$PATH\"; _R=\"${CLAUDE_PLUGIN_ROOT}\"; [ -z \"$_R\" ] && _R=$(ls -dt $HOME/.claude/plugins/cache/remote1993/ccx-ecc-mem/[0-9]*/ 2>/dev/null | head -1); _R=\"${_R%/}\"; [ -z \"$_R\" ] && _R=\"$HOME/.claude/plugins/marketplaces/remote1993/plugin\"; node \"$_R/scripts/bun-runner.js\" \"$_R/scripts/worker-service.cjs\" hook claude-code file-context",
            "timeout": 2000
          }
        ]
      }
    ],
    "Stop": [
      {
        "hooks": [
          {
            "type": "command",
            "command": "export PATH=\"$(${SHELL:-/bin/sh} -lc 'echo $PATH' 2>/dev/null):$PATH\"; _R=\"${CLAUDE_PLUGIN_ROOT}\"; [ -z \"$_R\" ] && _R=$(ls -dt $HOME/.claude/plugins/cache/remote1993/ccx-ecc-mem/[0-9]*/ 2>/dev/null | head -1); _R=\"${_R%/}\"; [ -z \"$_R\" ] && _R=\"$HOME/.claude/plugins/marketplaces/remote1993/plugin\"; node \"$_R/scripts/bun-runner.js\" \"$_R/scripts/worker-service.cjs\" hook claude-code summarize",
            "timeout": 120
          }
        ]
      }
    ]
  }
}
