Trend-to-draft pipeline — owner’s guide

A human-gated growth loop: legitimate trend signals in, draft PRs out. Nothing publishes, commits to main, or merges without you.

How it works

  1. Collect (deterministic): top weekly threads from the official Reddit API (r/personalfinance, r/MiddleClassFinance, r/povertyfinance), Hacker News via the Algolia API, and Google Trends rising queries via pytrends. No scraping of X/Facebook/Instagram/TikTok — those are against platform ToS and are deliberately excluded.
  2. Score & dedupe (deterministic): signals are scored (votes + 2×comments), filtered to money topics, then compared against an index of every existing post. Close matches become UPDATE-EXISTING recommendations (consolidate rather than cannibalize); only genuinely novel topics become CREATE-NEW.
  3. Enrich (official data only): FRED (Fed funds, CPI, 30-year mortgage), BLS CPI, Treasury FiscalData average rates, Frankfurter FX, CoinGecko — attributed and dated so each draft carries unique factual value.
  4. Draft (LLM, judged by code): Claude writes in the site’s voice using the 4 closest existing posts as style examples. A deterministic safety gate rejects any draft containing advice-giving, guarantees, get-rich framing, or picks.
  5. Open a DRAFT PR: drafts land in _drafts/ (which Jekyll never publishes) plus an evidence-report.json showing every source, score, and decision. You review, edit, move approved files to _posts/, and merge — or close the PR.

Safety properties

Secrets to add (Settings → Secrets and variables → Actions)

Secret Needed for Where to get it
REDDIT_CLIENT_ID / REDDIT_CLIENT_SECRET Reddit collection reddit.com/prefs/apps → create a “script” app (free)
REDDIT_USER_AGENT Reddit collection Any descriptive string, e.g. thepennyplan-trends/1.0 by u/yourname
FRED_API_KEY Fed/CPI/mortgage data fred.stlouisfed.org/docs/api/api_key.html (free)
ANTHROPIC_API_KEY Drafting console.anthropic.com (paid per use; drafting ~3 articles/week costs cents)

Hacker News, BLS, Treasury FiscalData, Frankfurter, and CoinGecko need no keys. Missing secrets degrade gracefully — the pipeline skips that source and says so in the log.

Suggested cadence

Let the Monday dry-run report accumulate for a week or two to see signal quality, then dispatch with dry_run=false once a week and merge the 3–5 drafts that survive your review. Steady, reviewed growth beats bulk publishing — especially post-launch, while the site builds trust with Google.