Fix output order and Reddit extraction

1. Output order: What I learned → TARGET TOOL → KEY PATTERNS → Research Complete → Share vision
2. Fixed Reddit returning empty results - OpenAI was finding URLs but not extracting content
   - Updated prompt to explicitly require extraction from search results
   - Added "MUST include threads" instruction to prevent empty items

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Matt Van Horn
2026-01-23 16:02:05 -08:00
parent c9d4320b9b
commit 664b1cc52d
2 changed files with 29 additions and 10 deletions
+12 -2
View File
@@ -109,7 +109,7 @@ Identify from the ACTUAL RESEARCH OUTPUT:
## THEN: Show Summary + Invite Vision ## THEN: Show Summary + Invite Vision
**CRITICAL ORDER**: Display sections in this EXACT sequence (insights FIRST, stats LAST): **CRITICAL ORDER**: Display sections in this EXACT sequence:
``` ```
--- ---
@@ -117,6 +117,16 @@ What I learned:
[2-4 sentences synthesizing key insights FROM THE ACTUAL RESEARCH OUTPUT. Quote or paraphrase what the sources said. If sources mention a specific product (ClawdBot, Cursor, etc.), use that name - don't substitute your own knowledge. The synthesis should be traceable back to the research results above.] [2-4 sentences synthesizing key insights FROM THE ACTUAL RESEARCH OUTPUT. Quote or paraphrase what the sources said. If sources mention a specific product (ClawdBot, Cursor, etc.), use that name - don't substitute your own knowledge. The synthesis should be traceable back to the research results above.]
---
TARGET TOOL: {tool from research or user input}
KEY PATTERNS I'll use:
1. [Pattern from research]
2. [Pattern from research]
3. [Pattern from research]
4. [Pattern from research]
5. [Pattern from research]
--- ---
📊 Research Complete 📊 Research Complete
@@ -126,7 +136,7 @@ Analyzed {total_sources} sources from the last 30 days
└─ Top voices: r/{sub1}, r/{sub2}, @{handle1}, @{handle2} └─ Top voices: r/{sub1}, r/{sub2}, @{handle1}, @{handle2}
--- ---
Share your vision for what you want to create and I'll write a thoughtful prompt you can copy-paste directly into {TARGET_TOOL or "your tool of choice"}. Share your vision for what you want to create and I'll write a thoughtful prompt you can copy-paste directly into {TARGET_TOOL}.
``` ```
**Use real numbers from the research output.** The patterns should be actual insights from the research, not generic advice. **Use real numbers from the research output.** The patterns should be actual insights from the research, not generic advice.
+17 -8
View File
@@ -17,28 +17,37 @@ DEPTH_CONFIG = {
REDDIT_SEARCH_PROMPT = """Search Reddit for discussions about: {topic} REDDIT_SEARCH_PROMPT = """Search Reddit for discussions about: {topic}
Focus on threads from the last 30 days. Find {min_items}-{max_items} high-quality, relevant threads. Use web search to find {min_items}-{max_items} relevant Reddit threads from the last 30 days.
IMPORTANT: Return ONLY valid JSON in this exact format, no other text: CRITICAL: After searching, you MUST extract information from the Reddit URLs you found and return them as JSON.
For EACH Reddit thread URL you find in your search results, extract:
- The thread title
- The full Reddit URL
- The subreddit name
- Approximate date if visible
- Why it's relevant to "{topic}"
Return ONLY valid JSON in this exact format:
{{ {{
"items": [ "items": [
{{ {{
"title": "Thread title", "title": "Actual thread title from Reddit",
"url": "https://reddit.com/r/...", "url": "https://www.reddit.com/r/subreddit/comments/...",
"subreddit": "subreddit_name", "subreddit": "subreddit_name",
"date": "YYYY-MM-DD or null if unknown", "date": "YYYY-MM-DD or null if unknown",
"why_relevant": "Brief explanation of relevance", "why_relevant": "Brief explanation of relevance to {topic}",
"relevance": 0.85 "relevance": 0.85
}} }}
] ]
}} }}
Rules: Rules:
- You MUST include threads from the search results - do NOT return empty items
- relevance is 0.0 to 1.0 (1.0 = highly relevant) - relevance is 0.0 to 1.0 (1.0 = highly relevant)
- date must be YYYY-MM-DD format or null - date must be YYYY-MM-DD format or null
- Include diverse subreddits if applicable - Include threads from diverse subreddits
- Prefer threads with substantive discussions - Prefer threads with substantive discussions"""
- Do NOT include engagement metrics (upvotes, comments) - those will be fetched separately"""
def search_reddit( def search_reddit(