""" gap_tracker.py — Log capability gaps: things people ask for that Performance West doesn't yet offer. Monitors call log_gap() when they SKIP a post because we can't fulfill the request. The gaps log is reviewed for service expansion decisions. """ import json from pathlib import Path from datetime import datetime, timezone LOG_DIR = Path.home() / "logs" GAPS_FILE = LOG_DIR / "capability-gaps.log" def log_gap(platform: str, source_url: str, title: str, body: str, reason: str = ""): """ Log a capability gap. Args: platform: Monitor name (Reddit, Stack Exchange, dev.to) source_url: URL of the post/question we're skipping title: Title of the post body: First 300 chars of post body reason: Why we're skipping — what they need that we don't have """ LOG_DIR.mkdir(exist_ok=True) entry = { "ts": datetime.now(timezone.utc).isoformat(), "platform": platform, "url": source_url, "title": title, "body": body[:300], "reason": reason, } with open(GAPS_FILE, "a") as f: f.write(json.dumps(entry) + "\n")