#!/usr/bin/env python3 """OSS→Paperclip Chain: discovered OSS tools → Paperclip agent proposals""" import json, os, urllib.request from datetime import datetime TRENDING = "/var/www/html/api/oss-trending.json" def main(): print(f"[{datetime.now().strftime('%H:%M:%S')}] OSS→Paperclip Chain") if not os.path.exists(TRENDING): print(" No trending data. Run oss-discovery first.") return tools = json.load(open(TRENDING)) unwired = [t for t in tools if not t.get("wired") and t.get("files",0) > 10] print(f" {len(unwired)} unwired tools with >10 files") # Check which are already in Paperclip try: r = urllib.request.urlopen("http://127.0.0.1:3100/api/agents?limit=100", timeout=5) agents = json.loads(r.read()) agent_names = [a.get("name","").lower() for a in agents] if isinstance(agents, list) else [] new = [t for t in unwired if t["name"].lower() not in agent_names] print(f" {len(new)} new tools not in Paperclip") for t in new[:5]: print(f" → {t['name']}: {t['files']} files") except Exception as e: print(f" Paperclip error: {e}") if __name__ == "__main__": main()