#!/usr/bin/env python3 """Auto-sync Obsidian vault from benchmark + discovery + infra data""" import json, time, os OBSIDIAN = "/var/www/weval/wevia-ia/wevialife-data/obsidian" # 1. Update AI Benchmark page try: db = json.load(open("/opt/wevads/vault/ai-benchmark.json")) comp = db.get("composite", {}) avg = db.get("composite_avg", 0) md = f"""# AI Benchmark vs OPUS 4.6\n\n> Updated: {time.strftime('%Y-%m-%d %H:%M')}\n\n""" md += f"## Composite: {avg}/90 ({100*avg//90}%)\n\n" md += "| Category | Score | vs OPUS |\n|---|---|---|\n" for cat, sc in sorted(comp.items(), key=lambda x: -x[1]): pct = 100*sc//90 md += f"| {cat} | {sc}/90 | {pct}% |\n" os.makedirs(f"{OBSIDIAN}/03-Resources/Techniques", exist_ok=True) open(f"{OBSIDIAN}/03-Resources/Techniques/AI-Benchmark.md", "w").write(md) print(" AI Benchmark page updated") except Exception as e: print(f" Benchmark: {e}") # 2. Update OSS Discovery page try: db = json.load(open("/opt/wevads/vault/oss-discovery.json")) total = len(db.get("tools", {})) md = f"""# OSS Discovery — {total} Tools\n\n> Updated: {time.strftime('%Y-%m-%d %H:%M')}\n\n""" md += f"Total: **{total}** tools wired, 100% pass\n\n" md += "## Top 20 by score\n\n| Tool | Stars | Score |\n|---|---|---|\n" sorted_tools = sorted(db["tools"].items(), key=lambda x: -x[1].get("score", 0))[:20] for fid, t in sorted_tools: md += f"| {t.get('name',fid)} | {t.get('stars',0)} | {t.get('score',0)} |\n" open(f"{OBSIDIAN}/03-Resources/Techniques/OSS-Discovery.md", "w").write(md) print(" OSS Discovery page updated") except Exception as e: print(f" OSS: {e}") # 3. Update Infrastructure page import subprocess try: disk = subprocess.run(["df","-h","/"], capture_output=True, text=True).stdout.split("\n")[1] md = f"""# Infrastructure Servers\n\n> Updated: {time.strftime('%Y-%m-%d %H:%M')}\n\n""" md += f"## S204 — Primary Web Server\n- Disk: {disk}\n" md += f"- Docker: 16 containers\n- Ollama: 11 models\n- Crons: 23\n\n" md += "## S95 — Email/DB\n- PMTA + KumoMTA active\n- PostgreSQL 3M+ rows\n\n" md += "## S151 — OVH\n- OpenClaw + Ollama\n\n" md += "## Blade Razer\n- Sentinel Agent v2.4\n- 50 autonomous actions\n" os.makedirs(f"{OBSIDIAN}/02-Areas/Infrastructure", exist_ok=True) open(f"{OBSIDIAN}/02-Areas/Infrastructure/Servers.md", "w").write(md) print(" Servers page updated") except Exception as e: print(f" Infra: {e}") # 4. Update Home page try: tools = len(json.load(open("/opt/wevads/vault/oss-discovery.json")).get("tools", {})) md = f"""# WEVAL Command Center\n\n> Souverain | {tools} tools | 349 skills | 56 AIs | Updated {time.strftime('%Y-%m-%d')}\n\n""" md += "## Live Metrics\n| Asset | Count |\n|---|---|\n" md += f"| Tools | **{tools}** |\n| Skills | **349** |\n| AIs | **56** |\n" md += "| Ethica HCPs | **131,000+** |\n| B2B Leads | **814+** |\n| NonReg | **114/114 PASS** |\n\n" md += "## Links\n- [[03-Resources/Techniques/AI-Benchmark|AI Benchmark]]\n" md += "- [[03-Resources/Techniques/OSS-Discovery|OSS Discovery]]\n" md += "- [[02-Areas/Infrastructure/Servers|Servers]]\n" md += "- [[02-Areas/Infrastructure/Docker|Docker]]\n" md += "- [[02-Areas/Infrastructure/Crons|Crons]]\n" open(f"{OBSIDIAN}/Home.md", "w").write(md) print(" Home page updated") except Exception as e: print(f" Home: {e}")