fix: Emphasize recency in Reddit search to find recent threads

The model was finding old threads (Nov-Dec 2025) that got filtered out,
leaving 0 results even for popular topics like "nano banana prompts".

Changes:
- Add explicit date filters: "after:{from_date}" and "2026"/"January 2026"
- Emphasize RECENT content is critical, old threads are filtered anyway
- Tell model to verify dates before including threads

Before: 0-2 Reddit threads for "nano banana prompting practices"
After: 16 Reddit threads from January 2026

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Matt Van Horn
2026-01-25 10:15:43 -08:00
parent b77d821f8d
commit acd7a533c0
+23 -23
View File
@@ -22,48 +22,48 @@ DEPTH_CONFIG = {
"deep": (50, 70), "deep": (50, 70),
} }
REDDIT_SEARCH_PROMPT = """Find Reddit discussion threads about: {topic} REDDIT_SEARCH_PROMPT = """Find RECENT Reddit discussion threads about: {topic}
STEP 1: EXTRACT CORE KEYWORDS STEP 1: EXTRACT THE CORE SUBJECT
Extract the main subject. Examples: Strip qualifiers and get the MAIN NOUN/PRODUCT/TOPIC:
- "killer features of clawdbot" → search for "clawdbot" - "best nano banana prompting practices""nano banana"
- "best React hooks practices" → search for "React hooks" - "killer features of clawdbot""clawdbot"
Search for the CORE KEYWORD, not the full phrase. - "top Claude Code skills""Claude Code skills"
DO NOT search for "best", "top", "tips", "practices" - just the core subject.
STEP 2: SEARCH STRATEGIES (try multiple) STEP 2: SEARCH FOR RECENT CONTENT (CRITICAL)
1. "reddit [keyword]" - general Reddit search You MUST search with date filters to find recent threads:
2. "reddit [keyword] discussion" - find discussions 1. "[core subject] site:reddit.com after:{from_date}"
3. "[keyword] site:reddit.com/r/" - subreddit posts 2. "reddit [core subject] 2026" or "reddit [core subject] January 2026"
4. "reddit.com/r/ [keyword] comments" - thread URLs 3. "[core subject] site:reddit.com/r/"
REQUIRED: URLs must contain BOTH "/r/" AND "/comments/" The goal is threads from {from_date} to {to_date}. Older threads are NOT useful.
Example valid URL: https://www.reddit.com/r/selfhosted/comments/abc123/title/
REJECT these URLs (not discussion threads): STEP 3: VALIDATE DATES
- developers.reddit.com (Reddit apps, not discussions) Before including a thread, verify its date is AFTER {from_date}.
- business.reddit.com If you cannot determine the date, set date to null.
- reddit.com/user/ (user profiles) EXCLUDE threads you know are older than {from_date}.
- Any URL missing "/comments/"
DATE RANGE: {from_date} to {to_date} (last 30 days). REQUIRED URL FORMAT: Must contain "/r/" AND "/comments/"
REJECT: developers.reddit.com, business.reddit.com, reddit.com/user/
Find {min_items}-{max_items} discussion threads. Find {min_items}-{max_items} RECENT discussion threads (from last 30 days).
Return JSON: Return JSON:
{{ {{
"items": [ "items": [
{{ {{
"title": "Thread title from Reddit", "title": "Thread title",
"url": "https://www.reddit.com/r/subreddit/comments/xyz/title/", "url": "https://www.reddit.com/r/subreddit/comments/xyz/title/",
"subreddit": "subreddit_name", "subreddit": "subreddit_name",
"date": "YYYY-MM-DD or null", "date": "YYYY-MM-DD or null",
"why_relevant": "Why this is relevant", "why_relevant": "How this relates to {topic}",
"relevance": 0.85 "relevance": 0.85
}} }}
] ]
}} }}
IMPORTANT: Only return items with URLs containing /r/*/comments/*. If you cannot find any valid discussion threads, return {{"items": []}}.""" IMPORTANT: Only return threads from the last 30 days. Old threads will be filtered out anyway."""
def search_reddit( def search_reddit(