{
  "description": "Enforce token optimization by default: state the policy at session start, and challenge expensive built-in calls before they spend context.",
  "hooks": {
    "SessionStart": [
      {
        "matcher": "startup|resume|clear|compact",
        "hooks": [
          {
            "type": "command",
            "command": "node \"${PLUGIN_ROOT}/hooks/session-start.mjs\"",
            "commandWindows": "node \"$env:PLUGIN_ROOT\\hooks\\session-start.mjs\"",
            "timeout": 5,
            "statusMessage": "Loading token-optimizer policy"
          }
        ]
      }
    ],
    "PreToolUse": [
      {
        "matcher": "Read|read_file|view_file|Grep|grep|search_file_content|Glob|glob|find_files|Edit|edit_file|apply_patch|Write|write_file|Bash|shell|run_command|functions\\.exec|exec",
        "hooks": [
          {
            "type": "command",
            "command": "node \"${PLUGIN_ROOT}/hooks/pre-tool.mjs\"",
            "commandWindows": "node \"$env:PLUGIN_ROOT\\hooks\\pre-tool.mjs\"",
            "timeout": 5,
            "statusMessage": "Routing to optimized tooling"
          }
        ]
      }
    ],
    "PostToolUse": [
      {
        "matcher": "apply_patch|Edit|Write|edit_file|write_file|smart_edit|smart_write|functions\\.exec|exec",
        "hooks": [
          {
            "type": "command",
            "command": "node \"${PLUGIN_ROOT}/hooks/post-tool.mjs\"",
            "commandWindows": "node \"$env:PLUGIN_ROOT\\hooks\\post-tool.mjs\"",
            "timeout": 5,
            "statusMessage": "Tracking durable conclusions",
            "additionalContextLimit": 800
          }
        ]
      }
    ],
    "Stop": [
      {
        "hooks": [
          {
            "type": "command",
            "command": "node \"${PLUGIN_ROOT}/hooks/stop.mjs\"",
            "commandWindows": "node \"$env:PLUGIN_ROOT\\hooks\\stop.mjs\"",
            "timeout": 5,
            "statusMessage": "Checking for durable conclusions"
          }
        ]
      }
    ]
  }
}
