Analyze your Twitter/X archive using AI to identify tweets for deletion.
- Parses Twitter archive JSON files
- Evaluates tweets using Google's Gemini AI (also, easy integration of other models)
- Checkpoint-based resumption (crash-safe)
- Configurable evaluation criteria
- Rate-limited API calls
- Generates CSV of tweets to delete
- Java 21+
- Maven
- Google Gemini API key
- Twitter/X archive download
- Get your Twitter archive: Settings ----> Download archive
- Get Gemini API key
: Google AI Studio
- Set environment variable:
For Linux/Mac:
export GEMINI_API_KEY=your_key_here
echo 'export GEMINI_API_KEY=your_key_here' >> ~/.bashrcFor Windows (Powershell):
$env:GEMINI_API_KEY="your_key_here"
[System.Environment]::SetEnvironmentVariable('GEMINI_API_KEY', 'your_key_here', 'User')For Windows (Command Prompt):
set GEMINI_API_KEY=your_key_here
setx GEMINI_API_KEY "your_key_here"- Verify it's set:
echo $GEMINI_API_KEY # linux/mac/git bash
echo %GEMINI_API_KEY% # windows cmd- Restart your terminal after setting variables.
exit # linux/mac/git bash mvn clean package
java -jar target/tweet-audit-1.0-SNAPSHOT.jar <archive_path> <output_csv> <config_path>Example:
java -jar target/tweet-audit-1.0-SNAPSHOT.jar data/tweets.js results.csv criteria.jsonCreate criteria.json (in the root folder):
{
"forbiddenWords": [
"crypto",
"NFT"
],
"professionalCheck": true,
"tone": "respectful",
"excludePolitics": false
}- results.csv: Tweets flagged for deletion with reasons
- results_checkpoint.txt: Progress tracker for resume capability
- Loads previously processed tweet IDs (resumes if interrupted)
- Parses Twitter archive
- Sends unprocessed tweets to Gemini for evaluation
- Saves flagged tweets to CSV
- Updates checkpoint after each tweet
Rate-limited to 15 requests/minute. Retries failed requests 3 times with exponential backoff.
src/main/java/
AI_Client/ # Gemini API integration
csv/ # State management
parser/ # Twitter archive parsing
orchestrator/ # Main workflow
Main.java # Entry point
criteria.json # Your tweet evaluation criteria
See TRADEOFFS.md for architecture decisions.