From 664b1cc52dfdb0f1ac05617cf62bce316c22db27 Mon Sep 17 00:00:00 2001 From: Matt Van Horn Date: Fri, 23 Jan 2026 16:02:05 -0800 Subject: [PATCH] Fix output order and Reddit extraction MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- SKILL.md | 14 ++++++++++++-- scripts/lib/openai_reddit.py | 25 +++++++++++++++++-------- 2 files changed, 29 insertions(+), 10 deletions(-) diff --git a/SKILL.md b/SKILL.md index 231f4f9..a60d87b 100644 --- a/SKILL.md +++ b/SKILL.md @@ -109,7 +109,7 @@ Identify from the ACTUAL RESEARCH OUTPUT: ## 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.] +--- +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 @@ -126,7 +136,7 @@ Analyzed {total_sources} sources from the last 30 days └─ 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. diff --git a/scripts/lib/openai_reddit.py b/scripts/lib/openai_reddit.py index f07b027..52ae76a 100644 --- a/scripts/lib/openai_reddit.py +++ b/scripts/lib/openai_reddit.py @@ -17,28 +17,37 @@ DEPTH_CONFIG = { 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": [ {{ - "title": "Thread title", - "url": "https://reddit.com/r/...", + "title": "Actual thread title from Reddit", + "url": "https://www.reddit.com/r/subreddit/comments/...", "subreddit": "subreddit_name", "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 }} ] }} 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) - date must be YYYY-MM-DD format or null -- Include diverse subreddits if applicable -- Prefer threads with substantive discussions -- Do NOT include engagement metrics (upvotes, comments) - those will be fetched separately""" +- Include threads from diverse subreddits +- Prefer threads with substantive discussions""" def search_reddit(