{"id":51078730,"url":"https://github.com/vola-trebla/toad-wire","last_synced_at":"2026-06-23T16:04:05.152Z","repository":{"id":339682642,"uuid":"1162968885","full_name":"vola-trebla/toad-wire","owner":"vola-trebla","description":"Autonomous AI-powered AI news engine","archived":false,"fork":false,"pushed_at":"2026-04-28T22:24:41.000Z","size":6403,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-29T00:24:48.355Z","etag":null,"topics":["ai-automation","content-generation","crypto-news","gemini","latam","pixel-art","rss","telegram-bot","typescript"],"latest_commit_sha":null,"homepage":"https://elsapocripto.com/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vola-trebla.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-02-20T23:06:10.000Z","updated_at":"2026-04-28T22:24:45.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/vola-trebla/toad-wire","commit_stats":null,"previous_names":["vola-trebla/el-sapo-cripto"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/vola-trebla/toad-wire","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vola-trebla%2Ftoad-wire","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vola-trebla%2Ftoad-wire/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vola-trebla%2Ftoad-wire/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vola-trebla%2Ftoad-wire/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vola-trebla","download_url":"https://codeload.github.com/vola-trebla/toad-wire/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vola-trebla%2Ftoad-wire/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34696912,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-23T02:00:07.161Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai-automation","content-generation","crypto-news","gemini","latam","pixel-art","rss","telegram-bot","typescript"],"created_at":"2026-06-23T16:04:05.039Z","updated_at":"2026-06-23T16:04:05.146Z","avatar_url":"https://github.com/vola-trebla.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 📡 Toad Wire\n\n**Autonomous AI-powered news engine for the artificial intelligence industry.**\n\nToad Wire monitors 15+ RSS sources across the AI landscape, scores and ranks articles using multi-factor analysis, generates English summaries and original pixel-art visuals via Google Gemini, and publishes optimized digests to Telegram and X — with zero manual intervention, 24/7.\n\nPart of the **Sapo Labs** ecosystem.\n\n---\n\n## System Overview\n\nToad Wire is a TypeScript monolith running on Railway (single node, Docker, SQLite with WAL mode). The system is decomposed into four major subsystems:\n\n| # | Subsystem | What it does |\n|---|-----------|-------------|\n| 1 | **News Intelligence Pipeline** | Ingestion, 4-level deduplication, multi-factor scoring, breaking detection |\n| 2 | **LLM Orchestration \u0026 Content Engine** | Task-based model routing (Gemini Flash/Lite/Pro), structured summarization, batch content generation |\n| 3 | **Generative Visual Pipeline** | 2-stage image generation: LLM descriptor → Gemini Image, 24 visual styles, sentiment-driven palettes |\n| 4 | **Autonomous Operations Framework** | Cron scheduling, circuit breakers, rate limiting, health monitoring, graceful recovery |\n\n---\n\n## Architecture\n\n```\nRSS Feeds (15+)\n    │\n    ▼\n┌─────────────────────────────────────────────┐\n│  INGESTION: Parse → Dedup (4 levels) → Save │\n└─────────────────┬───────────────────────────┘\n                  │\n                  ▼\n┌─────────────────────────────────────────────┐\n│  INTELLIGENCE: Score → Cluster → Rank       │\n│  (authority × freshness + keyword boosts    │\n│   − duplicate penalty − spam penalty)       │\n└─────────────────┬───────────────────────────┘\n                  │\n                  ▼\n┌─────────────────────────────────────────────┐\n│  CONTENT: Summarize (EN) → Format → Image   │\n│  Gemini Flash  │  Flash-Lite  │  Flash Image │\n└─────────────────┬───────────────────────────┘\n                  │\n                  ▼\n┌─────────────────────────────────────────────┐\n│  DELIVERY: Publisher → Telegram + X          │\n│  (circuit breakers, rate limiter, jitter)   │\n└─────────────────────────────────────────────┘\n```\n\n---\n\n## 1. News Intelligence Pipeline\n\nMulti-source ingestion with intelligent scoring and breaking news detection.\n\n**Ingestion:** 15+ RSS feeds organized into 3 tiers by authority (0.0-1.0). Sources include MIT Technology Review, The Verge AI, Ars Technica, VentureBeat, TechCrunch, OpenAI, Anthropic, DeepMind, Hugging Face, IEEE Spectrum, and more. Feeds are health-monitored with automatic degradation tracking (healthy → degraded → dead).\n\n**4-Level Deduplication:**\n- **Level 0 — URL:** Exact URL match (free, instant)\n- **Level 1 — Token overlap:** Jaccard similarity on tokenized titles\n- **Level 2 — Semantic:** Cosine similarity on embeddings (catches paraphrased duplicates)\n- **Level 3 — Story clustering:** Groups articles from different sources covering the same event\n\n**Impact Scoring:**\n```\nImpactScore = (authority × freshness) + keywordBoost + contextBoost\n              − duplicatePenalty − spamPenalty\n```\n\nKeyword boosts are tiered: security events (+0.25), policy/regulation (+0.20), major AI labs (+0.20), frontier models (+0.15), open source (+0.15), safety/alignment (+0.15), research breakthroughs (+0.15), agents/infrastructure (+0.10).\n\n**Breaking Detection:** When 3+ unique sources (or 2+ Tier-1 sources) cluster on the same story, the system triggers an immediate breaking news pipeline with a 2-hour cooldown between breaking posts.\n\n---\n\n## 2. LLM Orchestration \u0026 Content Engine\n\nCentralized AI layer with cost-optimized model routing.\n\n**Router Architecture:**\n\n| Task | Model | Rationale |\n|------|-------|-----------|\n| `news`, `ranking` | Gemini 2.5 Flash | Core work — quality matters |\n| `batch`, `goodnight` | Gemini 2.5 Flash-Lite | High volume, lower complexity |\n| `weekly` | Gemini 2.5 Pro | Deep analysis, 1 call/week |\n\nFlash-Lite handles ~60% of daily LLM calls at minimal cost. Pro is reserved for weekly deep analysis only.\n\n**Structured Summarization:** Single LLM call produces: English summary, X-ready tweet (≤280 chars), sentiment (optimistic/cautious/neutral), category (research/industry/product/policy/safety/open_source), and named entities — all validated through Zod schemas.\n\n**Batch Content Generation:** Personality-driven micro-post generation across content types: curated headline reactions, AI philosophy, and shitpost mode.\n\n---\n\n## 3. Generative Visual Pipeline\n\nTwo-stage AI image generation with 24 rotating visual styles.\n\n**Pipeline:**\n1. **Descriptor Stage:** Gemini Flash-Lite converts news summary into a visual scene descriptor (abstract, symbolic — not literal illustration)\n2. **Generation Stage:** Gemini 2.5 Flash Image renders pixel art using the descriptor + style + sentiment palette\n\n**Style System:**\n- 16 daytime styles (terminal, micro-matrix, circuit, market-topography, holo-chart, fracture, seismic-spike, oscilloscope, etc.)\n- 8 nighttime styles (moonlit-terminal, sleeping-circuit, signal-constellation, etc.)\n- Category-based overrides: security news → `fracture`/`seismic-spike`, open source → `vector-terrain`/`bio-circuit`, industry → `holo-chart`/`continent-grid`\n\n**Sentiment Palettes:**\n- Optimistic: neon green (#00ff41), upward energy\n- Cautious: deep red (#ff2200), downward pressure\n- Neutral: steel blue (#4a9eff), analytical calm\n\nBudget: 500 image generations/month (~16/day). Fallback: if generation fails, post publishes without image.\n\n---\n\n## 4. Autonomous Operations Framework\n\nSelf-healing infrastructure with zero manual intervention.\n\n**Cron Scheduler:** 15+ rules covering morning digests, midday news, prime time posts, breaking news scanning (every 10 min), weekly summaries, and maintenance jobs. All times in UTC-3 with quiet hours (23:00-07:00).\n\n**Circuit Breakers:** Three independent instances protecting Telegram, X API, and Gemini. Pattern: CLOSED → 5 consecutive failures → OPEN (all requests blocked) → 5 min cooldown → HALF-OPEN (single trial) → success → CLOSED.\n\n**X Rate Limiter:** Deterministic posting limits mimicking organic behavior — 45 tweets/day (API max: 50, 5 buffer), 8/hour, minimum 10 min between posts, randomized 10-25 min intervals.\n\n**Publisher Abstraction:** Pipelines prepare content, Publisher delivers. Channel-agnostic design — adding Discord or WhatsApp requires one new block with zero changes to any pipeline.\n\n**Graceful Shutdown:** SIGTERM handler performs WAL checkpoint before exit, ensuring zero data loss on Railway redeploys.\n\n---\n\n## Tech Stack\n\n| Layer | Technology |\n|-------|-----------|\n| Runtime | TypeScript, Node.js |\n| Framework | Hono (HTTP server) |\n| Database | SQLite (WAL mode) + Drizzle ORM |\n| AI / LLM | Google Gemini (Flash, Flash-Lite, Pro, Flash Image) via Vercel AI SDK |\n| Observability | toad-eye (OpenTelemetry), Pino, Sentry, Axiom |\n| Scheduling | node-cron (15+ rules, UTC-3) |\n| Delivery | twitter-api-v2 (OAuth 1.0a), Telegram Bot API (grammY) |\n| Infrastructure | Railway (Docker, single node) |\n| Validation | Zod (LLM output schemas, config validation) |\n\n---\n\n## Tech Decisions \u0026 Trade-offs\n\n**Why SQLite over PostgreSQL?** Single-process monolith, ~350 records/day. SQLite with WAL mode handles 10,000+ writes/sec. PostgreSQL would add operational complexity with zero benefit at this scale.\n\n**Why a Monolith?** Single Node.js process with cron-based scheduling. No message queues, no microservices, no Redis. The overhead of distributed infrastructure would provide negative ROI at current scale.\n\n**Why Task-Based LLM Routing?** Business logic declares intent (`'news'`, `'ranking'`, `'batch'`), router selects the model. Switching a task to a different model = one line change in the router, zero changes in 15+ pipeline files.\n\n**Why 4-Level Dedup?** Each level catches what the previous missed: URL → exact copies, token overlap → reformatted titles, cosine similarity → paraphrased content, story clustering → multi-source coverage.\n\n**Why Pixel Art?** Pixel art constraints (8-bit grid, no anti-aliasing, limited palette) force Gemini Image into a narrow output space, producing consistently recognizable brand aesthetic across 500+ monthly images.\n\n---\n\n## Author\n\nBuilt by **Sapo Labs** — AI systems \u0026 automation. Part of a solo engineering portfolio demonstrating end-to-end AI system design: from data ingestion and scoring algorithms through LLM orchestration and generative AI, to production infrastructure with self-healing capabilities.\n\n---\n\n*The toad doesn't sleep. The toad observes.* 🐸\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvola-trebla%2Ftoad-wire","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvola-trebla%2Ftoad-wire","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvola-trebla%2Ftoad-wire/lists"}