diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..54896d1 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,86 @@ +# AGENTS.md — Autonomous Publisher Infrastructure + +## Quick Start +8 authority sites on Proxmox CTs 135-142. Flask :5000 + nginx :80. +Check Obsidian: Infrastructure/Auto Publisher.md + +## Critical Rules +1. NEVER Proxmox CTs for AI — user forbids it +2. MacBook: qwen3.5:4b-mlx (think:false) +3. GamingPC: ornith:latest (RTX 3070) +4. Deploy engine: tar+scp+pct push+pct exec restart +5. Check Obsidian before any infra change: ~/ai brain/ai brain/ + +## Dashboards +- NOC (fleet): http://localhost:5090 +- Admin (pipeline): http://localhost:5106 +- Kalshi (trading): http://localhost:5053/fleet + +## 8 Sites +| # | CT | IP | Vertical | Health | +|---|----|----|----------|--------| +| 1 | 135 | .240 | AI | /health | +| 2 | 136 | .241 | Tech | /health | +| 3 | 137 | .242 | Science | ARP issue | +| 4 | 138 | .243 | Crypto | ARP issue | +| 5 | 139 | .244 | Linux | /health | +| 6 | 140 | .246 | Gaming | /health | +| 7 | 141 | .247 | DIY | /health | +| 8 | 142 | .248 | Guides | /health | + +.242/.243 need periodic `sudo arp -d ` — another device responds to ARP first. + +## Quick Commands +Deploy engine update to all CTs: +``` +cd ~/auto-publisher/sites/_engine && tar czf /tmp/e.tar.gz app.py +scp /tmp/e.tar.gz root@10.30.20.85:/tmp/ +for vmid in 135 136 137 138 139 140 141 142; do + ssh root@10.30.20.85 "pct push $vmid /tmp/e.tar.gz /tmp/e.tar.gz && pct exec $vmid -- bash -c 'cd /opt/publisher && tar xzf /tmp/e.tar.gz && systemctl restart publisher'" +done +``` + +Pipeline: +``` +/usr/bin/python3 ~/auto-publisher/core/orchestrator.py discover +/usr/bin/python3 ~/auto-publisher/core/orchestrator.py run --max 3 +/usr/bin/python3 ~/auto-publisher/core/orchestrator.py status +``` + +Speed bot: +``` +cd ~/kalshi-bot && .venv/bin/python3 speed_bot.py --coin DOGE --dry +``` + +NOC restart: +``` +pkill -f noc.py; /usr/bin/python3 ~/auto-publisher/dashboard/noc.py --port 5090 +``` + +ARP fix: +``` +sudo -S -p '' arp -d 10.30.20.242; sudo -S -p '' arp -d 10.30.20.243 +``` + +## Key Files +- Engine: ~/auto-publisher/sites/_engine/app.py +- Orchestrator: ~/auto-publisher/core/orchestrator.py +- NOC: ~/auto-publisher/dashboard/noc.py +- Speed bot: ~/kalshi-bot/speed_bot.py +- Evolution log: ~/auto-publisher/core/evolution_log.json +- Gitea main: http://10.30.20.149:3000/drjones/auto-publisher +- Gitea per-site: http://10.30.20.149:3000/drjones/{name}-publisher + +## Credit Plugins +- Kalshi: Auth via RSA-PSS-SHA256, key ~/kalshi-bot/kalshi_private_key.pem +- Gitea: Basic auth drjones:czapiewski +- Proxmox: root/Czapiewski1! via SSH + +## Pitfalls +- Ollama saturated by Kalshi bots — throttle before pipeline +- MLX needs think:false or generates slow chain-of-thought +- System Python 3.9 lacks requests — install with --break-system-packages +- Python 3.9 doesn't support `str | None` syntax — use Optional[str] +- CT 137/138 ARP conflicts — flush before accessing +- Evolution cron b48fc30f84b7 paused — too complex for unattended +- WebSocket auth for Kalshi still WIP (401/403) diff --git a/core/orchestrator.log b/core/orchestrator.log index 6e3f0fe..d4b0f1a 100644 --- a/core/orchestrator.log +++ b/core/orchestrator.log @@ -3,3 +3,5 @@ 2026-08-03 21:38:19,445 [WARNING] orchestrator: Topic scoring failed: ollama_json() got an unexpected keyword argument 'temperature' 2026-08-03 21:38:19,449 [INFO] orchestrator: Discovered 0 topics, stored top 25 2026-08-03 21:38:30,350 [INFO] orchestrator: Starting trend discovery... +2026-08-04 00:55:28,996 [INFO] orchestrator: Starting trend discovery... +2026-08-04 00:56:33,717 [INFO] orchestrator: Starting trend discovery... diff --git a/core/orchestrator.py b/core/orchestrator.py index dc73006..16cfe0f 100644 --- a/core/orchestrator.py +++ b/core/orchestrator.py @@ -11,8 +11,7 @@ import logging from pathlib import Path from datetime import datetime, timedelta from dataclasses import dataclass, field, asdict -from typing import Optional - +from typing import Optional, Dict, List import requests # ─── Config ─────────────────────────────────────────────────────── @@ -795,7 +794,7 @@ def real_fact_check(article_text: str, topic_title: str) -> dict: # ─── Image Generator Hook ────────────────────────────────────────── -def generate_article_image(title: str, vertical: str) -> str | None: +def generate_article_image(title: str, vertical: str) -> Optional[str]: """Generate a hero image for an article via FAL.ai, verify with vision model. Returns URL or None.""" # Build a prompt that captures the article's essence prompt = f"""Dark atmospheric illustration for an article titled "{title}". @@ -841,7 +840,7 @@ Is the image relevant, coherent, and free of inappropriate content? Respond ONLY # ─── Writing Pipeline ────────────────────────────────────────────── def write_article(topic_id: int, topic_title: str, vertical: str, - knowledge_package: dict) -> dict | None: + knowledge_package: dict) -> Optional[dict]: """Multi-agent writing pipeline with format diversity, quality gate, and fact-check.""" log.info(f"Writing article for topic #{topic_id}: {topic_title}")