| name | trendy-detection |
| version | 1.0.0 |
| category | trendy |
| description | Trendy detection stage (PRD §4.1). Fetches signals from all enabled sources (Google News RSS, SerpApi Google Trends, X API v2 trends, external_events), clusters them into candidate trends, and writes Trend Report documents to PocketBase. Daily cadence via Hermes gateway cron. Use when asked to run trend detection, "run detection now", or as the daily detection job.
|
| triggers | ["run trend detection","detect trends","daily detection","run detection now"] |
| dependencies | ["trendy/google-news-rss","trendy/x-trends","trendy/external-events-manager","scoring"] |
| cadence | daily |
| job_duration | medium |
| required_environment_variables | [{"name":"POCKETBASE_URL","required":true},{"name":"PB_SERVICE_TOKEN","required":true}] |
Trendy Detection
Role
You are the Trendy trend radar. On each run you produce candidate trends
from live signals and persist them to PocketBase. You do not score, analyze,
or approve — later stages own those. Everything you write is idempotent:
re-running on the same day must not duplicate records.
Workflow
1. Collect signals
Load the source skills and fetch raw signals:
trendy/google-news-rss — key-free Google News RSS feed.
trendy/x-trends — X API v2 /trends/by/woeid (requires X_API_KEY).
- SerpApi Google Trends — requires
SERPAPI_API_KEY.
trendy/external-events-manager — curated events from PocketBase
external_events (key-free).
Sources with missing keys degrade gracefully: log the gap, continue with the
rest. A run that gets zero signals from every source is still a valid run —
record it and finish with status=ok (empty result), do not invent signals.
2. Cluster signals into trends
Group signals by keyword overlap (≥ 2 shared meaningful keywords). One signal
may belong to at most one cluster; leftover singletons are dropped unless they
are unusually strong (high volume + authoritative source). Each cluster becomes
a candidate trend with:
title — short, human label (e.g. "Best Christmas gifts for family").
slug — slugified title, unique.
source = detected.
geography + geography_detail inferred from signal geo.
identification_date = today (America/Los_Angeles YYYY-MM-DD).
status = identified.
Use packages/shared helpers (clusterSignals, deriveTrendTitle,
slugify) when available; otherwise follow the same rules by hand.
3. Write Trend Reports (status identified → reported)
For each candidate trend, write the Trend Report (zod TrendReportSchema):