How korelexai/ai-cyber-newspaper works
Purpose and entry points
This is a Python batch pipeline that produces a daily, static “newspaper” of the top AI-security stories from recent feeds, Hacker News, and arXiv. The primary executable is main.py; it orchestrates collection through HTML edition generation. Generated content is served as static files from output/, optionally through GitHub Pages.
Pipeline orchestration
main.py coordinates four stages: fetch raw articles, score/filter them, summarize the selected stories, and render an edition. It is the principal control-flow boundary and owns the handoff of normalized article records between stages.
• main.py
• fetch.py
• generate.py
Source definition and acquisition
Source scope is centralized in sources.py: RSS/Atom source definitions, Hacker News searches, AI-security keyword weights, lookback window, score threshold, and top-story count. fetch.py retrieves each configured source and normalizes heterogeneous upstream responses into a common article shape; external source failures should remain isolated here rather than affecting rendering.
• sources.py
• fetch.py
Relevance filtering and ranking
score.py applies the recency window and keyword-based AI-plus-cybersecurity relevance model, then ranks candidate articles and selects the configured top N. This is the editorial-policy boundary: changing scope, strictness, or incident emphasis should flow from sources.py into this stage rather than be embedded in fetch or template logic.
• score.py
• sources.py
Summarization boundary
Selected articles pass to summarize.py, which produces short “why this matters” blurbs. It conditionally calls Anthropic Claude when ANTHROPIC_API_KEY is available; otherwise it uses article-provided text as a fallback. This keeps the core edition pipeline functional without an AI-provider dependency.
• summarize.py
• main.py
Rendering and publication artifacts
generate.py renders ranked, summarized stories into the newspaper template and writes both the current edition and date-stamped archives. The static-output contract is output/latest.html, output/index.html, and edition HTML/JSON files under output/editions/; consumers need only serve this directory.
• generate.py
• templates/newspaper.html
• output/editions/2026-08-20.html
Scheduled runtime and infrastructure
The intended runtime is Python with dependencies declared in requirements.txt. GitHub Actions runs the job daily and commits regenerated output, making the repository itself the publication store. GitHub Pages can serve output/; Vercel-related files indicate an alternative static deployment path. A separate subscription/API and Supabase schema area exists, but it is not part of the documented core newspaper pipeline.
• .github/workflows/daily.yml
• requirements.txt
• api/subscribe.py
• supabase/schema.sql/schema.sql
Main entry points: fetch.py Acquisition & normalization · generate.py Edition renderer · main.py Pipeline orchestrator · score.py Relevance ranking
Components 18
Daily runtime
- Daily GitHub Action · Runs the pipeline daily and commits regenerated content.
.github/workflows/daily.yml - Python dependencies
requirements.txt - Pipeline orchestrator · Coordinates normalized article records across all editorial stages.
main.py
Editorial pipeline
- Source policy · Defines feeds, searches, scoring weights, windows, and limits.
sources.py - Acquisition & normalization · Isolates upstream failures while converting sources to common article records.
fetch.py - RSS / Atom feeds
- Hacker News search
- arXiv
- Relevance ranking · Filters by recency and AI-security relevance, then selects top stories.
score.py - Story summarization · Creates why-it-matters blurbs with a text fallback.
summarize.py - Anthropic Claude · Used only when ANTHROPIC_API_KEY is available.
Static publication
- Edition renderer · Writes current and archived HTML and JSON editions.
generate.py - Newspaper template
templates/newspaper.html - Edition archive · Contains dated edition HTML and JSON.
output/editions/2026-08-20.html - Static output · Includes latest.html and index.html for static hosting.
- GitHub Pages / static host
Separate subscription area
Not part of the core newspaper pipeline.
- Subscription API
api/subscribe.py - Supabase schema
supabase/schema.sql/schema.sql
Connections 17
- Daily GitHub Action → Pipeline orchestrator: runs daily
- Python dependencies → Pipeline orchestrator: provides runtime
- Pipeline orchestrator → Acquisition & normalization: collects articles
- Source policy → Acquisition & normalization: defines inputs
- RSS / Atom feeds → Acquisition & normalization: retrieves
- Hacker News search → Acquisition & normalization: searches
- arXiv → Acquisition & normalization: retrieves
- Acquisition & normalization → Relevance ranking: normalized candidates
- Source policy → Relevance ranking: editorial policy
- Relevance ranking → Story summarization: selected stories
- Anthropic Claude → Story summarization: optional blurb generation
- Story summarization → Edition renderer: ranked summaries
- Newspaper template → Edition renderer: renders with
- Edition renderer → Static output: writes current edition
- Edition renderer → Edition archive: writes dated editions
- Static output → GitHub Pages / static host: serves
- Subscription API → Supabase schema: uses