A Chrome extension that automatically deletes entire tweets from your timeline based on image content analysis using Python Flask service with moondream.ai AI-powered filtering and configurable analysis queries.
Never look at a screenshotted tweet that gets around your mute filter again.
- Smart Tweet Deletion: Uses Moondream AI to analyze tweet images and delete entire tweets containing inappropriate content
- 🆕 Configurable Queries: Choose from predefined analysis queries or create your own custom prompts
- 🆕 Query Dropdown Interface: Easy-to-use popup interface for selecting analysis types
- 🆕 Quote Tweet Processing: Also analyzes images in quote tweets (one layer deep)
- Timeline-Only Processing: Only runs on Twitter timelines, not individual tweet pages
- Real-time Processing: Processes images as they load on Twitter/X and removes problematic tweets instantly
- Selective Filtering: Only processes tweet media images, not profile pictures or UI elements
- Console Logging: Logs deleted tweet links to browser console for reference
- Smooth Animations: Tweets fade out smoothly when deleted
- Fallback System: Falls back to random decisions if API is unavailable
- Easy Toggle: Enable/disable via Chrome extension popup
- Tweet Restoration: Can restore deleted tweets when extension is disabled
The extension now supports multiple analysis types:
- Twitter Screenshot Detection: Identifies Twitter/X screenshots
- Inappropriate Content: Flags adult or inappropriate content
- Violence Detection: Detects violent or disturbing content
- Spam/Promotional: Identifies spam or promotional content
- Custom Query: Write your own analysis prompt for specific filtering needs
cluely-b-gone/
├── backend/
│ ├── image_processor_service.py # Flask service with configurable queries
│ ├── test_queries.py # Test script for query system
│ ├── test_logging.py # Test script for logging functionality
│ ├── config.py # Configuration file
│ └── requirements.txt # Python dependencies
├── chrome_extension/
│ ├── manifest.json # Chrome extension manifest
│ ├── content.js # Main content script (handles tweet deletion)
│ ├── popup.html # Extension popup interface (with query dropdown)
│ ├── popup.js # Popup functionality (query management)
│ ├── styles.css # Extension styling
│ ├── test.html # Test page for extension functionality
│ ├── icon.svg # Extension icon (SVG format)
│ ├── icon16.png # Extension icon (16x16)
│ ├── icon48.png # Extension icon (48x48)
│ └── icon128.png # Extension icon (128x128)
├── venv/ # Python virtual environment
├── .gitignore # Git ignore rules
└── README.md # This file
- Visit Moondream AI and sign up for an account
- Get your API key from the dashboard
- Keep this key secure - you'll need it for the setup
First, set up the Python environment and install dependencies:
# Create and activate virtual environment
python3 -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Navigate to backend directory and install dependencies
cd backend
pip install -r requirements.txt
# Set up environment variables
cp .env.example .env
# Edit .env and add your Moondream API key:
# MOONDREAM_API_KEY=your_actual_api_key_here
# Test the query system (optional)
python3 test_queries.py
# Run the service
python3 image_processor_service.pyThe service will start on http://localhost:5002
Important: Make sure to set your MOONDREAM_API_KEY environment variable. Without it, the service will fall back to random decisions.
- Open Chrome and navigate to
chrome://extensions/ - Enable "Developer mode" (toggle in top right)
- Click "Load unpacked"
- Select the
chrome_extensiondirectory - The extension should now appear in your extensions list
- Start the Flask service first (see step 2 above)
- Navigate to Twitter/X (twitter.com or x.com) timeline
- Click the extension icon in your toolbar
- Select your desired query type from the dropdown:
- Choose from predefined queries (Twitter Screenshots, Inappropriate Content, etc.)
- Or select "Custom Query" to write your own analysis prompt
- Toggle processing on/off using the switch
- Tweets with problematic images will be deleted automatically as they load
- Check the browser console (F12) for deleted tweet links and processing logs
- Click the extension icon
- Click the "Analysis Query" dropdown button
- Select from available options:
- Twitter Screenshot Detection
- Inappropriate Content
- Violence Detection
- Spam/Promotional
- Click the extension icon
- Select "Custom Query" from the dropdown
- Enter your custom analysis prompt in the text area
- Your custom query will be sent to the AI for analysis
"Does this image contain any text? Answer with just 'yes' or 'no'."
"Is this image a meme? Answer with just 'yes' or 'no'."
"Does this image show food? Answer with just 'yes' or 'no'."
"Is this image politically related? Answer with just 'yes' or 'no'."
The Flask service provides several endpoints with configurable query support:
POST /analyze- Analyze a single image with custom queryPOST /analyze-batch- Analyze multiple images with custom queriesGET /stats- Get processing statisticsGET /health- Health checkGET /config- Get current configuration
# Analyze an image with custom query
curl -X POST http://localhost:5002/analyze \
-H "Content-Type: application/json" \
-d '{
"image_url": "https://pbs.twimg.com/media/example.jpg",
"query": "Does this image contain inappropriate content? Answer with just yes or no.",
"query_type": "inappropriate_content"
}'
# Analyze with default query
curl -X POST http://localhost:5002/analyze \
-H "Content-Type: application/json" \
-d '{"image_url": "https://pbs.twimg.com/media/example.jpg"}'The extension identifies tweet media images (including in quote tweets) and sends them to a local Flask service with the selected analysis query. The service uses Moondream AI to analyze each image based on your chosen criteria. Entire tweets containing problematic images are deleted from the timeline.
- Image Detection: Extension finds images in tweets and quote tweets
- Query Selection: Uses the query type selected in the popup
- AI Analysis: Moondream AI analyzes the image with your custom prompt
- Decision Making: Based on AI response, tweet is kept or deleted
- Visual Feedback: Processing indicators show analysis status
The service now uses configurable Moondream AI queries:
- Image Download: Service downloads the image from Twitter's CDN
- Custom Query Analysis: AI model analyzes the image with your selected query
- Decision Making:
- If AI responds "yes" to blocking query → Entire tweet is deleted
- If AI responds "no" → Tweet remains visible
- If API fails → Falls back to random decision
- High Confidence: API-based decisions have 95% confidence vs 60-95% for random fallbacks
- Console Logging: Deleted tweet links and query types are logged to browser console
- 🔍 Analyzing [query_type]... - Image is being processed with selected query
- 🗑️ DELETED TWEET --> [tweet_link] - Tweet was deleted (logged to console)
- Blocked image was in: [main tweet/quote tweet] - Shows where the problematic image was found
- ✅ Allowed - Tweet was allowed to remain
- Smooth fade-out animation when tweets are deleted
Edit the queries object in chrome_extension/popup.js:
this.queries = {
'your_query_type': {
title: 'Your Query Name',
desc: 'Description of what this query does',
prompt: 'Your analysis question for the AI'
}
};Edit the analyze_with_moondream method in backend/image_processor_service.py:
async def analyze_with_moondream(self, image, custom_query=None):
# Use custom_query parameter for dynamic prompts
question = custom_query or "Default analysis question"
# ... rest of analysis logic- Popup Interface: Modify
chrome_extension/popup.htmlandpopup.js - Content Logic: Edit
chrome_extension/content.js - Service Logic: Modify
backend/image_processor_service.py - Styling: Edit
chrome_extension/styles.css - Testing: Use
chrome_extension/test.htmlfor extension testing
Use the included test scripts to verify functionality:
# Navigate to backend directory
cd backend
# Test all query types
python3 test_queries.py
# Test logging functionality
python3 test_logging.py
# Test specific functionality
curl -X POST http://localhost:5002/analyze \
-H "Content-Type: application/json" \
-d '{"image_url": "test_url", "query": "test query", "query_type": "test"}'For extension testing, open chrome_extension/test.html in your browser.
- Extension not working: Check that Flask service is running on port 5002
- Custom queries not working: Ensure the query is properly formatted for the AI
- CORS errors: Flask-CORS is included to handle cross-origin requests
- Tweets not being deleted: Check browser console for error messages and query responses
- Service errors: Check Flask service logs in terminal
- Query not updating: Make sure to select a new query type from the dropdown
- Browser Console: F12 → Console tab for extension logs, query types, and deleted tweet links
- Flask Logs: Check terminal running the Flask service for query processing
- Extension Popup: Click extension icon to see current query selection
The service tracks:
- Total images processed
- Tweets deleted
- Tweets allowed
- Query types used
- API errors
Access via the /stats endpoint or browser console logs.
- Service runs on localhost only (not exposed externally)
- No image data is stored permanently
- Custom queries are processed locally
- CORS enabled for browser extension access
- All processing happens locally
- Deleted tweets can be restored by disabling the extension
- ✅ Configurable analysis queries
- ✅ Quote tweet image processing
- ✅ Timeline-only processing
- Query templates and sharing
- Batch query processing
- Query performance analytics
- Whitelist/blacklist functionality
- Export deleted tweet logs with query information
- Advanced analytics dashboard with query breakdowns
This project is for educational/development purposes. Modify as needed for your use case.