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
- 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.
- 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.
- 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.
- 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.
- Open a DRAFT PR: drafts land in
_drafts/(which Jekyll never publishes) plus anevidence-report.jsonshowing every source, score, and decision. You review, edit, move approved files to_posts/, and merge — or close the PR.
Safety properties
- Scheduled runs are always dry-run (report only). Drafting requires a manual
workflow_dispatchwithdry_run=false. - The workflow has no merge step and drafts go to
_drafts/, so even an accidental merge publishes nothing. - No strong signal → the pipeline does nothing. Silence is a feature.
- The repo cannot protect itself from account-level automation. For the review gate to hold, also: (a) enable branch protection on
mainrequiring PR review (Settings → Branches), and (b) revoke any Claude Code Remote auto-merge trigger in your claude.ai connector settings — that trigger lives at the account level and no repo change can disable it.
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.