Autonomous Twitter/X engagement engine for open source growth
Twitter Sniper is a drip-mode engagement engine that autonomously promotes your open source repos on Twitter/X.
It uses AI to craft genuine, context-aware replies β not spam. One micro-action at a time, spread across the day like a real human.
Getting Started Β· How It Works Β· Configuration Β· Architecture
| Feature | Description |
|---|---|
| π€ AI-Powered Content | Gemini Flash generates context-aware tweets, replies, and quote tweets |
| π§ Drip Mode | One micro-action per run β no burst behavior, pure organic pacing |
| π΅ Verified-Only Follows | Only follows blue-check accounts for quality network growth |
| π Fresh Content Only | Engages only with tweets < 24 hours old β no necro-posting |
| π§ Topic Matching | Maps conversation topics to relevant repos automatically |
| π« Anti-Spam Guard | Banned phrases, anti-repetition, language enforcement |
| π‘ Trend Discovery | Uses Brave Search to find trending conversations in your niche |
| π΄ Organic Sleep | Random pauses, dead-hour detection, anti-burst throttling |
| π Daily Tracking | Tracks likes, replies, follows, tweets, and quote tweets per day |
- Node.js 18+
- Google Chrome with remote debugging enabled
- Twitter/X account logged in on Chrome
- Gemini API key (get one free)
- Brave Search API key (get one here)
# Clone the repo
git clone https://github.com/SovranAMR/twitter-sniper.git
cd twitter-sniper
# Install dependencies
npm install
# Configure your environment
cp .env.example .env
# Edit .env with your API keys and Twitter usernamegoogle-chrome --remote-debugging-port=18800Make sure you're logged into Twitter/X in that Chrome instance.
# Dry run (no real actions β safe testing)
npm run dry-run
# Test specific actions
npm run test:like
npm run test:reply
npm run test:tweet
npm run test:follow
npm run test:quote
# Live run (real engagement)
npm start
# Force a specific action
node src/sniper.mjs --action=tweet# Run every 8 minutes β the engine handles organic pacing internally
crontab -e
# Add this line:
*/8 * * * * cd /path/to/twitter-sniper && node src/sniper.mjs >> /tmp/sniper.log 2>&1Unlike traditional bots that spam 50 tweets in a minute, Sniper uses drip mode β one micro-action per execution, spread naturally across the day:
06:00 βββ π΄ sleep
06:08 βββ β€οΈ like (3 tweets)
06:16 βββ π΄ sleep (organic gap)
06:24 βββ π¬ reply (with repo link)
06:32 βββ π΄ sleep
06:40 βββ β€οΈ like (2 tweets)
06:48 βββ π tweet (mentions repo)
...
The engine picks actions based on time of day:
| Time | Behavior |
|---|---|
| 01:00β06:00 | 85% sleep, 15% light likes |
| 06:00β09:00 | More likes, fewer heavy interactions |
| 09:00β12:00 | Peak β more replies, quotes, tweets |
| 12:00β14:00 | Normal mix |
| 14:00β18:00 | Peak β aggressive engagement |
| 18:00β01:00 | Normal mix with organic gaps |
ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ
β Brave Search ββββββΆβ Trend Queries ββββββΆβ Twitter β
β (news/trends)β β (via Gemini) β β Search (live)β
ββββββββββββββββ ββββββββββββββββ ββββββββ¬ββββββββ
β
βββββββββΌββββββββ
β Tweet Filter β
β - Fresh (<24h)β
β - Not liked β
β - Min engage β
βββββββββ¬ββββββββ
β
βββββββββββββββββββββββββββββΌββββββββββββββββββββ
β Action Router β
ββββββββ¬βββββββ¬βββββββ¬βββββββ¬βββββββββββββββββββ€
β Like βReply βQuote βFollowβ Tweet β
β β(AI) β(AI) β(β) β (AI + repo link) β
ββββββββ΄βββββββ΄βββββββ΄βββββββ΄βββββββββββββββββββ
- Language Lock: English only β Turkish/Arabic auto-detected and blocked
- Banned Phrases: "check this out", "game-changer", "mind blown", etc.
- Anti-Repetition: Hash-based dedup prevents engaging same tweet twice
- Hashtag Limit: Max 1 hashtag per post (prefer zero)
- Verified-Only Follows: Won't follow non-blue-check accounts
- Organic Gaps: Random sleep cycles between actions
| Variable | Required | Description |
|---|---|---|
GEMINI_API_KEY |
β | Google Gemini API key for content generation |
BRAVE_API_KEY |
β | Brave Search API key for trend discovery |
CDP_URL |
β | Chrome DevTools Protocol URL (default: http://127.0.0.1:18800) |
TWITTER_USERNAME |
β | Your Twitter handle without @ (default: your_username) |
MAX_TWEET_AGE_HOURS |
β | Max tweet age to engage with (default: 24) |
Edit the REPOS object in src/sniper.mjs:
const REPOS = {
myproject: {
url: 'https://github.com/you/project',
short: 'github.com/you/project',
name: 'My Project',
desc: 'what it does in one line'
},
};Map conversation topics to your repos for intelligent matching:
const TOPIC_REPO_MAP = {
'AI agent': 'myproject',
'automation': 'myproject',
'neural network': 'myotherproject',
};Create a kb/ directory with text files for each repo. The engine uses these for context-aware content:
mkdir kb
echo "Technical details about your project..." > kb/myproject.txttwitter-sniper/
βββ src/
β βββ sniper.mjs # Main engine (930 LOC)
βββ data/ # Runtime state & logs (gitignored)
β βββ state.json # Daily counters & engagement history
β βββ tweets.log # Posted tweets
β βββ engagements.log # Likes, replies, quotes
β βββ follows.log # Followed accounts
β βββ drip.log # Action timeline
βββ kb/ # Knowledge base (gitignored)
βββ .env # API keys (gitignored)
βββ .env.example # Template for .env
βββ .gitignore
βββ package.json
βββ LICENSE
βββ README.md
| Module | Lines | Description |
|---|---|---|
| Language Enforcement | ~25 | Turkish char/word detection, English-only filter |
| Anti-Repetition | ~30 | Banned phrases, hash dedup, hashtag limiter |
| State Management | ~30 | Daily reset, JSON persistence, engagement tracking |
| Gemini AI | ~25 | Content generation with retry logic |
| Brave Search | ~12 | Trend discovery with freshness filter |
| Browser (Playwright) | ~120 | Twitter search, like, reply, follow, post, quote |
| Trend Discovery | ~50 | AI-powered query generation from news |
| Action Picker | ~35 | Time-of-day weighted random selection |
| Drip Actions | ~300 | Like, Reply, Quote, Follow, Tweet implementations |
With */8 * * * * cron schedule:
| Metric | ~Daily |
|---|---|
| β€οΈ Likes | 40-80 |
| π¬ Replies | 8-15 |
| π Quotes | 3-8 |
| π€ Follows | 3-8 (verified only) |
| π Tweets | 5-12 (each with repo link) |
| π΄ Sleep cycles | ~35% of runs |
This tool automates Twitter/X engagement. Use responsibly:
- Respect Twitter's Terms of Service
- Don't spam β the drip mode exists for a reason
- Monitor your account β adjust frequency if needed
- Be genuine β the AI generates real insights, not template spam
MIT β do whatever you want with it.
Built with π₯ by SovranAMR
"The best marketing is a great product. The second best is telling people about it β one conversation at a time."