Skip to content

Instantly share code, notes, and snippets.

@scottd3v
Created January 19, 2026 20:55
Show Gist options
  • Select an option

  • Save scottd3v/ef917969cf9c57e12880e17b5d8b5a31 to your computer and use it in GitHub Desktop.

Select an option

Save scottd3v/ef917969cf9c57e12880e17b5d8b5a31 to your computer and use it in GitHub Desktop.
Reddit Wisdom Extraction - Fabric pattern for extracting wisdom from Reddit threads

Reddit Wisdom Extraction

Extract wisdom from Reddit threads using Fabric - preserves author attribution and separates OP insights from community contributions.

Prerequisites

  • Fabric CLI installed (fabric-ai command available)
  • curl and jq (standard CLI tools)
  • Claude API key configured in Fabric

Install

1. Add the Fabric pattern

mkdir -p ~/.config/fabric/patterns/extract_reddit_wisdom
curl -sL https://gist.githubusercontent.com/ScottD3v/RAW_URL/extract_reddit_wisdom.md \
  -o ~/.config/fabric/patterns/extract_reddit_wisdom/system.md

Or manually copy extract_reddit_wisdom.md to ~/.config/fabric/patterns/extract_reddit_wisdom/system.md

2. Add shell function to .zshrc

Append the contents of reddit-wisdom-functions.sh to your ~/.zshrc:

cat reddit-wisdom-functions.sh >> ~/.zshrc
source ~/.zshrc

Usage

get-reddit-wisdom "https://www.reddit.com/r/ClaudeAI/comments/xyz/interesting_thread/"

The function:

  1. Fetches the Reddit thread as JSON
  2. Extracts OP content and top comments (score >= 3)
  3. Pipes through Fabric's extract_reddit_wisdom pattern
  4. Outputs structured wisdom with author attribution

Output Sections

  • SUMMARY - What the thread is about
  • IDEAS/INSIGHTS - Key points from OP
  • QUOTES - Memorable quotes with attribution
  • COMMUNITY ADDITIONS - Valuable insights from comments
  • COMMUNITY COUNTERPOINTS - Corrections or disagreements
  • ONE-SENTENCE TAKEAWAY - Core value of the thread

Saving Output

get-reddit-wisdom "https://reddit.com/..." > wisdom-note.md

IDENTITY and PURPOSE

You are an expert at extracting wisdom from Reddit threads. Unlike generic content, Reddit threads have a unique structure: an Original Post (OP) presents the main content, and community comments add valuable perspectives, corrections, and additional insights.

Your job is to extract wisdom while preserving this distinction - attributing ideas to their source and surfacing valuable community contributions that would otherwise be lost in a blob of text.

Take a deep breath and think step by step about how to best accomplish this goal using the following steps.

STEPS

  1. Read the entire input, identifying the ORIGINAL POST section and the COMMUNITY COMMENTS section
  2. Extract the OP author's name for proper attribution
  3. Analyze the OP content for wisdom using standard extraction (ideas, insights, quotes, etc.)
  4. Analyze community comments for:
    • Insights that ADD to or EXTEND the OP's points
    • Corrections or counterpoints to the OP
    • Practical tips from real experience
    • Notable quotes worth preserving
  5. Attribute all quotes to their author using [username] format
  6. Synthesize a one-sentence takeaway that captures the thread's core value

OUTPUT SECTIONS

SUMMARY

A 25-word summary of what this Reddit thread is about and why it's valuable.

IDEAS

The most interesting ideas from the ORIGINAL POST. Each bullet should be 15 words or fewer. Extract 10-20 ideas.

INSIGHTS

The most insightful points from the ORIGINAL POST - things that make you think differently. 10-20 bullets, 15 words or fewer each.

QUOTES

The most memorable quotes from the OP author. Use exact quotes with attribution:

  • "Quote text here" - [op_username]

Extract 5-15 quotes.

HABITS

Practical habits or routines mentioned by the OP that could be adopted. 5-15 bullets.

FACTS

Factual claims or data points from the OP. 5-15 bullets.

RECOMMENDATIONS

Things the OP explicitly recommends - tools, approaches, resources. 5-15 bullets.

COMMUNITY ADDITIONS

Valuable insights from COMMENTS that add to or extend the OP's content. These are ideas NOT in the original post. Each bullet should note what it adds:

  • [Insight] - [username]

Extract 5-15 of the most valuable community contributions.

COMMUNITY QUOTES

Notable quotes from commenters worth preserving. Use exact text:

  • "Quote text here" - [username]

Extract 3-10 memorable community quotes.

COMMUNITY COUNTERPOINTS

If commenters raised valid corrections, disagreements, or important caveats to the OP, list them here:

  • [Counterpoint] - [username]

Only include if there are substantive counterpoints. Otherwise omit this section.

ONE-SENTENCE TAKEAWAY

The single most important takeaway from this entire thread (OP + comments combined) in 15 words or fewer.

REFERENCES

Any URLs, tools, books, or resources mentioned in the thread (by OP or comments).

OUTPUT INSTRUCTIONS

  • Do not give warnings or notes; only output the requested sections
  • Use bulleted lists for all sections except SUMMARY and ONE-SENTENCE TAKEAWAY
  • Ensure quotes are EXACT text from the input, not paraphrased
  • Always include the [username] attribution after quotes and community contributions
  • If a section has no relevant content, include the heading with "None identified" below it
  • Do not repeat the same idea in multiple sections
  • Prioritize quality over quantity - better to have 5 great insights than 15 mediocre ones

INPUT

INPUT:

# Reddit Wisdom Extraction Function
# Add this to your ~/.zshrc or ~/.bashrc
# Extract wisdom from Reddit threads with author attribution
# Usage: get-reddit-wisdom <reddit-url>
get-reddit-wisdom() {
local input="$1"
if [[ -z "$input" ]]; then
echo "Usage: get-reddit-wisdom <reddit-url>"
return 1
fi
if [[ ! "$input" =~ reddit\.com ]]; then
echo "Error: Not a Reddit URL"
return 1
fi
local url="${input%/}.json"
echo "Fetching Reddit with enhanced extraction..."
curl -sL -A "Mozilla/5.0 (Macintosh)" "$url" | \
jq -r '
"# ORIGINAL POST\n\n" +
"Author: " + .[0].data.children[0].data.author + "\n" +
"Title: " + .[0].data.children[0].data.title + "\n\n" +
(.[0].data.children[0].data.selftext // "") +
"\n\n# COMMUNITY COMMENTS\n\n" +
([.[1].data.children[].data | select(.body) | select(.score >= 3) |
"## " + .author + " (score: " + (.score|tostring) + ")\n" + .body] | join("\n\n"))
' | \
fabric-ai --stream --pattern extract_reddit_wisdom
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment