AI-powered inbox triage for Gmail β Gemini reads email content (not just sender) and applies labels + safe actions.
git clone https://github.com/kks0488/vibe-inbox.git
cd vibe-inbox
pip install -r requirements.txt
cp env_example.txt .env # set GEMINI_API_KEY
# Put your Gmail OAuth client file at ./credentials.json (see below)
python main.py auth
python main.py analyze -n 30 # dry-run
python main.py organize -n 50 -y # apply labels/actions- No delete actions (trash is disabled)
- Moves to spam only when confidence β₯
90% - Safe senders/domains are never auto-archived/spammed
- π€ Content-based AI Classification: Analyzes email body content, not just sender
- π·οΈ Auto Labeling: Automatically applies Gmail labels based on classification
- π¦ Smart Archiving: Archives marketing/promotional emails (even from trusted domains!)
- π‘οΈ Trusted Sender Management: Whitelist support for important senders
- π Statistics & Summary: Detailed classification statistics
- β° Auto Scheduler: Background execution via systemd service
| Category | Description | Examples | Action |
|---|---|---|---|
| π IMPORTANT | Directly relevant to me | Payment confirmations, password resets, shipping notifications, replies to my posts | Keep |
| π§ NORMAL | General service notifications | GitHub PRs, Slack alerts, monthly reports | Keep |
| π° INFO | Mass marketing/newsletters | Discount promos, follow suggestions, trend reports | Archive |
| π« SPAM | Malicious/scam emails only | Phishing, cold sales, unknown ads | Spam folder |
β Traditional: Email from Google β Always important
β
This tool: Google payment alert β Important / Google promo β Archive
| Email Example | Traditional | VibeInbox |
|---|---|---|
| LinkedIn comment notification | Important | β Important |
| LinkedIn "follow this person" | Important | π¦ Archive |
| Steam wishlist sale | Normal | π¦ Archive |
| Coupang payment complete | Normal | β Important |
- Python 3.9+
- Google Cloud Account
- Gemini API Key
cd vibe-inbox # (formerly: gmail-organizer)
pip install -r requirements.txtGmail API requires OAuth 2.0 authentication.
- Go to Google Cloud Console
- Create a new project or select existing one
- Navigate to "APIs & Services" β "Library"
- Search for "Gmail API"
- Click "Enable"
- Go to "APIs & Services" β "OAuth consent screen"
- Select "External" (for testing)
- Enter app name and email
- Add scopes:
https://www.googleapis.com/auth/gmail.readonlyhttps://www.googleapis.com/auth/gmail.modifyhttps://www.googleapis.com/auth/gmail.labels
- Add your email as a test user
- Go to "APIs & Services" β "Credentials"
- Click "Create Credentials" β "OAuth client ID"
- Application type: "Desktop app"
- Enter a name and click "Create"
- Click Download JSON
- Rename the downloaded file to
credentials.json - Place
credentials.jsonin the project folder
- Get an API key from Google AI Studio
- Create
.envfile:
cp env_example.txt .env- Edit
.envfile:
GEMINI_API_KEY=your_api_key_here
GMAIL_CREDENTIALS_PATH=credentials.json
python main.py# Check status
python main.py status
# Gmail authentication
python main.py auth
# Analyze emails (classify only, no changes)
python main.py analyze -n 50
# Organize emails (classify + apply labels)
python main.py organize -n 30
# Analyze with specific query
python main.py analyze -q "is:unread"
# Auto organize (no confirmation)
python main.py organize -n 50 -y
# Logout
python main.py logout# 1. Install dependencies
pip install -r requirements.txt
# 2. Run the program
python main.py
# 3. Select "4. Gmail Authentication" from menu
# 4. Login to your Google account in browser
# 5. Check connection with "1. Check Status"
# 6. Test with "2. Analyze Emails"
# 7. Start organizing with "3. Organize Emails"Customize settings in config.py:
# Change AI model
GEMINI_MODEL = "gemini-1.5-flash" # Fast model
# GEMINI_MODEL = "gemini-1.5-pro" # More accurate model
# Adjust batch size
DEFAULT_BATCH_SIZE = 50
# Max email content length
MAX_EMAIL_CONTENT_LENGTH = 2000
# Modify category actions
EMAIL_CATEGORIES = {
"SPAM": {
"action": "spam" # Options: "spam", "archive", "keep"
}
}- Never hardcode passwords in the code
- Add
credentials.jsonandtoken.jsonto.gitignore - Manage API keys via environment variables
- Gemini API has free quota limits (requests per minute)
- Processing many emails at once may hit API limits
- Adjust batch size to manage usage
- Only high-confidence spam emails are moved to spam folder
- Labels are created with "AI/" prefix
- Delete functionality is disabled for safety
vibe-inbox/
βββ main.py # Main executable
βββ config.py # Configuration
βββ auth.py # Gmail OAuth authentication
βββ gmail_client.py # Gmail API client
βββ ai_classifier.py # Gemini AI classifier
βββ scheduler.py # Auto scheduler
βββ requirements.txt # Dependencies
βββ README.md # This file
βββ README.ko.md # Korean documentation
βββ env_example.txt # Environment variable example
βββ credentials.json # OAuth credentials (add manually)
βββ token.json # Auth token (auto-generated)
# Transfer from local to Ubuntu server
scp -r /path/to/vibe-inbox username@your-server:/home/username/# SSH connection
ssh username@your-server
# Run install script
cd ~/vibe-inbox
chmod +x install_ubuntu.sh
./install_ubuntu.sh
# Note: installer copies the project to ~/gmail-organizer by defaultOption A: Authenticate locally, then copy token.json (Recommended)
# After completing authentication on local PC
scp token.json username@your-server:/home/username/gmail-organizer/
scp credentials.json username@your-server:/home/username/gmail-organizer/
scp .env username@your-server:/home/username/gmail-organizer/Option B: Use SSH port forwarding
# SSH with port forwarding from local
ssh -L 8080:localhost:8080 username@your-server
# Run authentication on server
cd ~/gmail-organizer
source venv/bin/activate
python main.py auth
# Access the displayed URL in browser# Start service
sudo systemctl start gmail-organizer
# Enable auto-start on boot
sudo systemctl enable gmail-organizer
# Check status
sudo systemctl status gmail-organizer# Real-time log monitoring
tail -f ~/gmail-organizer/logs/scheduler.log
# Service log
journalctl -u gmail-organizer -f# Direct execution (for testing)
cd ~/gmail-organizer
source venv/bin/activate
# Default (60 min interval, auto organize)
python scheduler.py
# Custom options
python scheduler.py --interval 60 --batch-size 100 # 1 hour interval, 100 emails
python scheduler.py --analyze-only # Analysis only (no organizing)# Build and run
docker-compose up -d
# View logs
docker-compose logs -f- Create an OAuth client ID in Google Cloud Console and download the JSON file
- Make sure the file is named exactly
credentials.json
- Check that
GEMINI_API_KEYis set in your.envfile - Verify the API key is valid
- Re-authenticate with
python main.py auth - Or delete
token.jsonand authenticate again
- Wait a moment and try again
- Reduce
DEFAULT_BATCH_SIZEinconfig.py
MIT License
Bug reports, feature suggestions, and PRs are welcome!