{
  "$schema": "hook-registry-schema",
  "version": 1,
  "description": "훅 우선순위 레지스트리 — 오케스트레이터가 이 파일을 읽어 순차 실행한다. priority 낮을수록 먼저 실행.",
  "defaults": {
    "triflux_priority": 0,
    "omc_priority": 50,
    "external_priority": 100
  },
  "events": {
    "CwdChanged": [
      {
        "id": "tfx-claude-cwd-projection-refresh",
        "source": "triflux",
        "matcher": "*",
        "command": "node \"${PLUGIN_ROOT}/hooks/claude-cwd-projection-refresh.mjs\"",
        "priority": 0,
        "enabled": true,
        "timeout": 2,
        "blocking": false,
        "description": "Claude /cd CwdChanged 이벤트를 Triflux native-bridge projection cwd에 반영"
      }
    ],
    "PermissionRequest": [
      {
        "id": "tfx-permission-safe-allow",
        "source": "triflux",
        "matcher": "Bash",
        "command": "node \"${PLUGIN_ROOT}/hooks/permission-safe-allow.mjs\"",
        "priority": 0,
        "enabled": true,
        "timeout": 2,
        "blocking": false,
        "description": "안전한 repo-local Bash PermissionRequest 자동 허용 (#245)"
      }
    ],
    "PreToolUse": [
      {
        "id": "tfx-safety-guard",
        "source": "triflux",
        "matcher": "Bash",
        "command": "node \"${PLUGIN_ROOT}/hooks/safety-guard.mjs\"",
        "priority": 0,
        "enabled": true,
        "timeout": 3,
        "blocking": true,
        "description": "위험 Bash 명령 사전 차단 (rm -rf, force push 등)"
      },
      {
        "id": "tfx-agent-route-guard",
        "source": "triflux",
        "matcher": "Agent",
        "command": "node \"${PLUGIN_ROOT}/hooks/agent-route-guard.mjs\"",
        "priority": 0,
        "enabled": true,
        "timeout": 3,
        "blocking": false,
        "description": "서브에이전트 스폰 시 triflux 컨텍스트 주입"
      },
      {
        "id": "tfx-cross-review-gate",
        "source": "triflux",
        "matcher": "Bash",
        "command": "node \"${PLUGIN_ROOT}/scripts/cross-review-gate.mjs\"",
        "priority": 1,
        "enabled": true,
        "timeout": 3,
        "blocking": true,
        "description": "git commit 전 교차 리뷰 미검증 파일 차단/경고"
      },
      {
        "id": "omc-headless-guard",
        "source": "omc",
        "matcher": "Bash|Agent",
        "command": "bash \"${HOME}/.claude/scripts/headless-guard-fast.sh\"",
        "priority": 50,
        "enabled": true,
        "timeout": 3,
        "blocking": false,
        "description": "primary multiplexer headless 가드"
      },
      {
        "id": "omc-tfx-gate-activate",
        "source": "omc",
        "matcher": "Skill",
        "command": "node \"${HOME}/.claude/scripts/tfx-gate-activate.mjs\"",
        "priority": 50,
        "enabled": true,
        "timeout": 2,
        "blocking": false,
        "description": "tfx-multi 상태 추적 게이트"
      },
      {
        "id": "tfx-write-edit-passthrough",
        "source": "triflux",
        "matcher": "Edit|Write",
        "command": "exit 0",
        "priority": 999,
        "enabled": true,
        "blocking": false,
        "description": "Edit/Write passthrough"
      }
    ],
    "PostToolUse": [
      {
        "id": "tfx-cross-review-tracker",
        "source": "triflux",
        "matcher": "Edit|Write",
        "command": "node \"${PLUGIN_ROOT}/hooks/cross-review-tracker.mjs\"",
        "priority": 0,
        "enabled": true,
        "timeout": 3,
        "blocking": false,
        "description": "파일 수정 추적 → 교차 리뷰 nudge"
      },
      {
        "id": "tfx-mcp-config-watcher",
        "source": "triflux",
        "matcher": "Edit|Write",
        "command": "node \"${PLUGIN_ROOT}/hooks/mcp-config-watcher.mjs\"",
        "priority": 1,
        "enabled": true,
        "timeout": 3,
        "blocking": false,
        "description": "감시 대상 MCP 설정 변경 감지 → stdio MCP 자동 치환"
      },
      {
        "id": "tfx-post-tool-tips",
        "source": "triflux",
        "matcher": "Bash|Edit|Write",
        "command": "node \"${PLUGIN_ROOT}/hooks/post-tool-tips.mjs\"",
        "priority": 2,
        "enabled": true,
        "timeout": 2,
        "blocking": false,
        "description": "중요 경로 변경 시 opt-in rules reminder 주입 (#245)"
      }
    ],
    "PostToolUseFailure": [
      {
        "id": "tfx-error-context",
        "source": "triflux",
        "matcher": "*",
        "command": "node \"${PLUGIN_ROOT}/hooks/error-context.mjs\"",
        "priority": 0,
        "enabled": true,
        "timeout": 3,
        "blocking": false,
        "description": "도구 실패 시 에러 힌트 자동 주입"
      },
      {
        "id": "tfx-adaptive-collector",
        "source": "triflux",
        "matcher": "*",
        "command": "node \"${PLUGIN_ROOT}/hooks/hook-adaptive-collector.mjs\"",
        "priority": 1,
        "enabled": true,
        "timeout": 3,
        "blocking": false,
        "description": "에러 패턴 수집 → Neural Memory adaptive engine 학습"
      }
    ],
    "UserPromptSubmit": [
      {
        "id": "tfx-keyword-detector",
        "source": "triflux",
        "matcher": "*",
        "command": "node \"${PLUGIN_ROOT}/scripts/run.cjs\" \"${PLUGIN_ROOT}/scripts/keyword-detector.mjs\"",
        "priority": 0,
        "enabled": true,
        "timeout": 5,
        "blocking": false,
        "description": "키워드 매칭 → 스킬 자동 라우팅"
      },
      {
        "id": "tfx-cto-north-star-brief",
        "source": "triflux",
        "matcher": "*",
        "command": "node \"${PLUGIN_ROOT}/hooks/cto-north-star-brief.mjs\"",
        "priority": 2,
        "enabled": true,
        "timeout": 2,
        "blocking": false,
        "description": "CTO north-star brief를 UserPromptSubmit additionalContext로 변경 시 주입"
      }
    ],
    "SessionStart": [
      {
        "id": "tfx-setup",
        "source": "triflux",
        "matcher": "*",
        "command": "node \"${PLUGIN_ROOT}/scripts/setup.mjs\"",
        "priority": 0,
        "enabled": true,
        "timeout": 10,
        "blocking": false,
        "description": "triflux 환경 초기화"
      },
      {
        "id": "tfx-mcp-safety-guard",
        "source": "triflux",
        "matcher": "*",
        "command": "node \"${PLUGIN_ROOT}/scripts/mcp-safety-guard.mjs\"",
        "priority": 1,
        "enabled": true,
        "timeout": 3,
        "blocking": false,
        "description": "Gemini stdio MCP 자동 감지 + 제거 (spawn EPERM 방지)"
      },
      {
        "id": "tfx-hub-ensure",
        "source": "triflux",
        "matcher": "*",
        "command": "node \"${PLUGIN_ROOT}/scripts/hub-ensure.mjs\"",
        "priority": 2,
        "enabled": true,
        "timeout": 8,
        "blocking": true,
        "description": "tfx-hub 서비스 헬스체크 및 시작 (BLOCKING — 세션 시작 전 Hub 준비 보장)"
      },
      {
        "id": "tfx-preflight-cache",
        "source": "triflux",
        "matcher": "*",
        "command": "node \"${PLUGIN_ROOT}/scripts/preflight-cache.mjs\"",
        "priority": 3,
        "enabled": true,
        "timeout": 5,
        "blocking": false,
        "description": "CLI/Hub 가용성 캐시 (hub-ensure 완료 후 실행)"
      },
      {
        "id": "tfx-mcp-gateway-ensure",
        "source": "triflux",
        "matcher": "*",
        "command": "node \"${PLUGIN_ROOT}/scripts/mcp-gateway-ensure.mjs\"",
        "priority": 4,
        "enabled": true,
        "timeout": 8,
        "blocking": false,
        "description": "supergateway MCP 서비스 헬스체크 및 자동 기동"
      },
      {
        "id": "tfx-session-stale-cleanup",
        "source": "triflux",
        "matcher": "*",
        "command": "node \"${PLUGIN_ROOT}/scripts/session-stale-cleanup.mjs\"",
        "priority": 5,
        "enabled": true,
        "timeout": 3,
        "blocking": false,
        "description": "이전 세션의 stale tfx-multi 상태 파일 정리 (#62)"
      },
      {
        "id": "tfx-session-lake",
        "source": "triflux",
        "matcher": "*",
        "command": "node \"${PLUGIN_ROOT}/hooks/session-start-lake.mjs\"",
        "priority": 6,
        "enabled": true,
        "timeout": 3,
        "blocking": false,
        "description": "CTO north-star brief를 SessionStart additionalContext로 주입"
      },
      {
        "id": "ext-session-vault-start",
        "source": "session-vault",
        "requires": "$HOME/Desktop/Projects/tools/session-vault",
        "matcher": "*",
        "command": "bash \"${HOME}/Desktop/Projects/tools/session-vault/scripts/start_hook.sh\"",
        "priority": 100,
        "enabled": false,
        "timeout": 10,
        "blocking": false,
        "description": "세션 볼트 로깅 시작"
      }
    ],
    "Stop": [
      {
        "id": "tfx-pipeline-stop",
        "source": "triflux",
        "matcher": "*",
        "command": "node \"${PLUGIN_ROOT}/hooks/pipeline-stop.mjs\"",
        "priority": 0,
        "enabled": true,
        "timeout": 5,
        "blocking": true,
        "description": "컨텍스트 guard/retry cap + 활성 파이프라인 감지 → Stop 차단"
      },
      {
        "id": "ext-session-vault-export",
        "source": "session-vault",
        "requires": "$HOME/Desktop/Projects/tools/session-vault",
        "matcher": "*",
        "command": "bash \"${HOME}/Desktop/Projects/tools/session-vault/scripts/export_hook.sh\"",
        "priority": 100,
        "enabled": false,
        "timeout": 30,
        "blocking": false,
        "description": "세션 트랜스크립트 내보내기"
      },
      {
        "id": "ext-mcp-cleanup",
        "source": "system",
        "matcher": "*",
        "command": "powershell -NoProfile -WindowStyle Hidden -ExecutionPolicy Bypass -File \"${HOME}/.claude/scripts/mcp-cleanup.ps1\"",
        "priority": 100,
        "enabled": false,
        "timeout": 8,
        "blocking": false,
        "description": "MCP 고아 프로세스 정리"
      }
    ],
    "SessionEnd": [
      {
        "id": "tfx-session-end-cleanup",
        "source": "triflux",
        "matcher": "*",
        "command": "node \"${PLUGIN_ROOT}/hooks/session-end-cleanup.mjs\"",
        "priority": 0,
        "enabled": true,
        "timeout": 3,
        "blocking": false,
        "description": "세션 종료 시 lifecycle 상태 보고 및 opt-in 정리 (#245)"
      }
    ],
    "SubagentStart": [
      {
        "id": "tfx-subagent-tracker",
        "source": "triflux",
        "matcher": "*",
        "command": "node \"${PLUGIN_ROOT}/hooks/subagent-tracker.mjs\"",
        "priority": 0,
        "enabled": true,
        "timeout": 2,
        "blocking": false,
        "description": "서브에이전트 lifecycle 시작/종료 상태 추적 (#245)"
      }
    ],
    "SubagentStop": [
      {
        "id": "tfx-subagent-tracker",
        "source": "triflux",
        "matcher": "*",
        "command": "node \"${PLUGIN_ROOT}/hooks/subagent-tracker.mjs\"",
        "priority": 0,
        "enabled": true,
        "timeout": 2,
        "blocking": false,
        "description": "서브에이전트 lifecycle 시작/종료 상태 추적 (#245)"
      },
      {
        "id": "tfx-subagent-verifier",
        "source": "triflux",
        "matcher": "*",
        "command": "node \"${PLUGIN_ROOT}/hooks/subagent-verifier.mjs\"",
        "priority": 1,
        "enabled": true,
        "timeout": 3,
        "blocking": false,
        "description": "서브에이전트 결과 품질 체크"
      }
    ],
    "PreCompact": [
      {
        "id": "tfx-pre-compact-snapshot",
        "source": "triflux",
        "matcher": "*",
        "command": "node \"${PLUGIN_ROOT}/hooks/pre-compact-snapshot.mjs\"",
        "priority": 0,
        "enabled": true,
        "timeout": 3,
        "blocking": false,
        "description": "compact 직전 repo-local 진행 상태 스냅샷 주입 (#245)"
      }
    ]
  }
}
