import json as _json
from pathlib import Path as _Path

def load_skip_handles():
    """Return set of @handles in buckets.json with bucket EXCLUDED or PARTNER. These are skipped from scans/AI."""
    bp = _Path(__file__).parent / "buckets.json"
    if not bp.exists(): return set()
    try:
        data = _json.loads(bp.read_text())
        return {h for h, v in data.items() if isinstance(v, dict) and v.get("bucket") in ("EXCLUDED", "PARTNER")}
    except Exception:
        return set()
