Sandbox
@mguozhen/social-bot

Claude Code skill for Reddit and X reply automation

This repo ties Claude reply generation to browser automation for Reddit and X. It looks for relevant posts, filters out weak matches, generates a contextual reply, posts it, and stores the result for deduping and reporting. The dashboard and daily runner make it a repeatable outbound workflow rather than a one-off script.

111 stars33 forksPythonUpdated 5mo ago
Who it's for

Builders who want Claude Code or a Python script to monitor Reddit and X for relevant conversations and reply automatically.

What it delivers

You can find likely customers, answer them in context, and keep the same post from getting replied to twice.

What it does

Dual platform search

Searches Reddit subreddits and X keyword queries from the same config.

Two-layer relevance check

Uses keyword matching first, then Claude to decide whether a reply is actually worth posting.

Browser-based posting

Posts replies through a real browser session, so no Reddit or X API key is required.

Reddit warmup mode

Runs short, low-risk Reddit comments to build karma before posting in stricter communities.

SQLite deduplication and tracking

Stores replied URLs, history, and lead scores so the bot does not repeat itself.

Flask dashboard

Shows daily progress and reply history in a web UI.

Daily scheduling

Includes a macOS LaunchAgent plist for automatic daily runs.

Claude Code skill commands

Provides ready-made skill commands like `social reply bot warmup` and `social reply bot stats`.

How to get it

  1. 1Run
    curl -fsSL https://raw.githubusercontent.com/mguozhen/social-bot/main/install.sh | bash
  2. 2Run
    git clone https://github.com/mguozhen/social-bot.git ~/social-bot
    cd ~/social-bot
    pip3 install -r requirements.txt
    cp .env.template .env
    # Edit .env with your ANTHROPIC_API_KEY

README

Social Bot

Social Reply Bot

AI-powered Reddit & X auto-reply bot that finds your customers and joins the conversation.

5min Setup Agent Skills MIT License Python 3.9+ Reddit + X

Quick StartHow It WorksFeaturesScreenshotsConfigurationArchitecture


What is this?

Social Reply Bot searches Reddit and X/Twitter for posts relevant to your product, then uses Claude AI to generate genuine, helpful replies that naturally mention your brand. No API keys for Reddit or X required — it uses browser automation to act like a real user.

Not spam. The AI evaluates every post for relevance first. If a post isn't a good fit, it skips it. When it does reply, it sounds like an experienced practitioner sharing real insight — because that's what the prompt engineers it to be.

Currently configured for two products:

  • Solvea — AI customer service agent for Amazon/Shopify sellers
  • VOC.ai — Amazon review intelligence and sentiment analysis

But it's fully configurable for any product/niche via config.json.

Features

FeatureDescription
Dual PlatformReddit (subreddit search) + X/Twitter (keyword search)
AI-Generated RepliesClaude crafts genuine, on-topic responses — not templates
Smart FilteringTwo-layer filter: keyword match first, then AI relevance check
Browser AutomationNo platform API keys needed — uses real browser sessions
Reddit WarmupKarma-building mode for new accounts (safe subreddits, no product mentions)
Lead TrackingEvery replied post scored 1-10 for customer potential
Web DashboardReal-time Flask dashboard showing daily progress
DeduplicationSQLite-backed — never replies to the same post twice
Rate LimitingConfigurable delays (Reddit: 10min, X: 5min between replies)
Daily SchedulingmacOS LaunchAgent runs at 10:05 AM automatically

How It Works

Keyword Search (Reddit subreddits + X queries)
       ↓
Two-Layer Relevance Filter
  ├─ Layer 1: Keyword match (zero API cost)
  └─ Layer 2: Claude AI judges if post is worth replying to
       ↓
Claude generates reply as "experienced seller sharing real insight"
       ↓
Browser automation posts the reply
       ↓
SQLite logs it → Dashboard displays it → Lead scored

The core principle: Every reply must provide genuine value. The AI is prompted as a "seller with 5 years of experience" who naturally mentions tools they use — not as a marketer pushing a product. Posts that don't fit get skipped, not force-fitted.

Screenshots

Dashboard — Real-time Daily Progress

Dashboard showing daily reply targets and progress

The web dashboard tracks daily X posts, Reddit comments, product mentions, and historical totals.

X/Twitter — Targeted Competitive Replies

AI-generated reply on X to a competitor's post

The bot found a competitor's tweet about customer support automation and replied with a genuine insight that naturally positioned Solvea as an alternative. No "Great product!" fluff — real technical substance.

Reddit — High-Quality Community Comments

AI-generated Reddit comment about WooCommerce chatbot issues

On r/ecommerce, a user discussed WooCommerce chatbot inventory sync issues. The bot shared specific technical experience (event-triggered vs. scheduled sync), earning genuine upvotes and discussion.

Quick Start

Option 1: One-Line Install

curl -fsSL https://raw.githubusercontent.com/mguozhen/social-bot/main/install.sh | bash

This will:

  1. Clone the repo to ~/social-bot
  2. Install Python dependencies (anthropic, flask)
  3. Check for browse CLI
  4. Guide you through .env setup
  5. Initialize SQLite database
  6. Register macOS LaunchAgent (daily 10:05 AM)

Option 2: Manual Setup

git clone https://github.com/mguozhen/social-bot.git ~/social-bot
cd ~/social-bot
pip3 install -r requirements.txt
cp .env.template .env
# Edit .env with your ANTHROPIC_API_KEY

Prerequisites

RequirementHow to Get It
Python 3.9+Pre-installed on macOS
browse CLInpm install -g @anthropic-ai/browse-cli
Anthropic API Keyconsole.anthropic.com
Reddit accountLog in once in the browse-controlled Chrome
X/Twitter accountLog in once in the browse-controlled Chrome

No Reddit API key or Twitter API key required. The bot uses browser sessions, not platform APIs.

Commands

As Claude Code Skill

Once installed as a skill, just tell Claude:

social reply bot                  # run both platforms
social reply bot x only           # X/Twitter only
social reply bot reddit only      # Reddit only
social reply bot warmup           # build Reddit karma (8 comments)
social reply bot warmup 15        # warmup with custom target
social reply bot leads            # show potential customers found
social reply bot stats            # today's stats
social reply bot dashboard        # open web dashboard

As Standalone Script

python3 run_daily.py              # run both platforms
python3 run_daily.py --x-only     # X only
python3 run_daily.py --reddit-only # Reddit only
python3 warmup_reddit.py          # karma building mode

Configuration

Edit config.json to customize for your product:

{
  "x": {
    "username": "@YourAccount",
    "daily_target": 20,
    "min_delay_seconds": 300,
    "search_queries": [
      "your product keyword 1",
      "your product keyword 2"
    ]
  },
  "reddit": {
    "username": "your_reddit_user",
    "daily_target": 10,
    "min_delay_seconds": 600,
    "subreddits": ["YourTargetSubreddit", "AnotherOne"]
  },
  "products": {
    "YourProduct": {
      "description": "What your product does (AI uses this to craft mentions)",
      "trigger_keywords": ["keyword1", "keyword2"]
    }
  },
  "reply_style": {
    "tone": "knowledgeable practitioner sharing experience",
    "max_length_x": 260,
    "max_length_reddit": 400,
    "rules": [
      "Lead with genuine insight about the post",
      "Mention product as 'what we use/built' — not as an ad",
      "Skip if not relevant — never force a mention"
    ]
  }
}

Environment Variables

VariableRequiredDescription
ANTHROPIC_API_KEYYesClaude API key for reply generation
BROWSERBASE_API_KEYNoOptional: persistent browser sessions across reboots
BROWSERBASE_PROJECT_IDNoOptional: pairs with Browserbase key

Architecture

social-bot/
├── bot/
│   ├── ai_engine.py        # Claude AI: relevance filter + reply generation
│   ├── browser.py           # Browser automation via browse CLI
│   ├── db.py                # SQLite: dedup, history, lead scoring
│   ├── reddit_bot.py        # Reddit: search subreddits, post comments
│   └── x_bot.py             # X/Twitter: search queries, post replies
├── dashboard/
│   ├── app.py               # Flask web dashboard
│   └── templates/           # Dashboard HTML
├── docs/
│   ├── screenshot_dashboard.png
│   ├── screenshot_reddit_reply.png
│   └── screenshot_x_reply.png
├── launchd/                 # macOS LaunchAgent plist
├── config.json              # Platform targets, keywords, products
├── run_daily.py             # Main entry point (scheduled daily)
├── warmup_reddit.py         # Reddit karma builder
├── install.sh               # One-line installer
├── setup.sh                 # Manual setup helper
├── SKILL.md                 # Claude Code / Agent Skills definition
└── .env.template            # Credential template

Two-Layer Filtering

# Layer 1: Fast keyword match (zero API cost)
def detect_product(text: str) -> Optional[str]:
    # Returns matching product name or None

# Layer 2: Claude AI relevance check
# If Layer 1 matches, Claude decides:
#   - Is this post genuinely relevant?
#   - Can we add real value with a reply?
#   - SKIP if forcing a mention would feel unnatural

Rate Limiting & Safety

PlatformDelay Between RepliesDaily CapDeduplication
Reddit10 minutes10 postsSQLite (URL-based)
X/Twitter5 minutes20 postsSQLite (URL-based)

Reddit Warmup

New Reddit accounts need karma before posting in restricted subreddits. The warmup mode:

  • Visits safe, low-moderation subreddits (r/karma, r/CasualConversation, r/self)
  • Claude Haiku generates authentic short comments (no product mentions)
  • 90-180 second natural delays between posts
  • Default: 8 comments per session, configurable
python3 warmup_reddit.py          # default 8 comments
python3 warmup_reddit.py --target 15  # custom target

Expected Results

With default settings (X: 20/day, Reddit: 10/day):

MetricMonthly
Posts covered600+ targeted posts
Users reached600+ people actively discussing your niche
Click-through~10-15% visit your profile/link
Cost~$0.30/day (Claude API at ~$0.01/reply)

This isn't viral growth — it's consistent, targeted brand presence in conversations where your product is genuinely relevant.

Known Limitations

IssueCauseWorkaround
Reddit comments auto-removedAccount karma < 10 or age < 10 daysRun warmup mode for 1-2 weeks first
Some X replies failPage structure changes or rate limitsAuto-retry with backoff, skips on persistent failure
Low match rate on some daysToday's posts don't match your keywordsAdd more subreddits and search queries

FAQ

Is this against Reddit/X terms of service?

This tool uses browser automation (not API abuse) and generates unique, contextually relevant responses (not spam). However, automated posting always carries platform risk. Use responsibly, keep daily volumes reasonable, and ensure your replies genuinely add value to conversations.

How do I add my own product?

Edit the products section in config.json. Add your product name, description (used by Claude to craft natural mentions), and trigger keywords. Then update search_queries and subreddits to target where your audience hangs out.

Can I use this without Claude Code?

Yes. run_daily.py is a standalone script. You just need Python 3.9+, the browse CLI, and an Anthropic API key. The Claude Code skill integration is optional.

How much does it cost to run?

About $0.01 per reply (Claude API). At 30 replies/day, that's roughly $9/month. Browser automation is free — no Reddit or X API fees.

Contributing

PRs welcome. Please test your changes with both platforms before submitting.

License

MIT


Built with Claude AI • Browser automation via browse CLI

Files in the repo

Repository payload16 top-level entries
  • bot
  • dashboard
  • docs
  • launchd
  • .env.template
  • .gitignore
  • article_social_bot.md
  • config.json
  • install.sh
  • README.md
  • requirements.txt
  • run_daily.py
  • setup.sh
  • SKILL.md
  • skill.sh
  • warmup_reddit.py

Discussion (0)

Ask about usage, or say what you built with it

Sign in to join the discussion.

No comments yet. Be the first to say what this is good for.

More tools

MemPalace/
mempalace

The best-benchmarked open-source AI memory system. And it's free.

59k

A cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Grok Build & Hermes Agent. Only official website: ccswitch.io

132k

Never stop coding. Free MIT AI gateway: one endpoint, 352 providers (150+ free), 1200+ models Kimi, Claude, GPT, Gemini, GLM, DeepSeek, MiniMax. Works with Claude Code, Codex, Cursor, OpenCode, Cline & Copilot. Quota-aware auto-fallback, RTK+Caveman compression saves 15-95% tokens, MCP/A2A, Desktop/PWA. Built by 550+ contributors

64k
headroomlabs-ai/
headroom

Compress tool outputs, logs, files, and RAG chunks before they reach the LLM. 20% fewer tokens for coding agents, 60-95% fewer tokens for JSON, same answers. Library, proxy, MCP server.

71k
virgiliojr94/
book-to-skill

Turn any technical book PDF into a Claude Code skill — ready to study, reference, and use while you work.

30k
herdrdev/
herdr

the runtime your coding agents live on

37k