Skip to content

David-L-R/automate-emails

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

automate-emails

AI-powered Gmail automation using Claude. Draft replies to repetitive emails, and get a weekly summary of your inbox.

Features

  • Draft replies — scans unread emails, uses Claude to decide which need a response, and drafts them for your review
  • Weekly summary — generates a structured digest: action items, notable updates, and noise to ignore
  • Auto-send mode — flip a flag to send replies automatically once you trust it

Setup

1. Clone and install

git clone git@github.com:David-L-R/automate-emails.git
cd automate-emails
uv pip install -e .

Requires uv. Install with curl -Ls https://astral.sh/uv/install.sh | sh.

2. Anthropic API key

cp .env.example .env
# Add your key to .env:
# ANTHROPIC_API_KEY=sk-ant-...

Get a key at console.anthropic.com.

3. Google Cloud OAuth credentials

  1. Go to console.cloud.google.com
  2. Select or create a project (e.g. under webeet.io)
  3. Enable the Gmail API: APIs & Services > Enable APIs > search "Gmail API"
  4. Create credentials: APIs & Services > Credentials > Create Credentials > OAuth 2.0 Client ID
    • Application type: Desktop app
  5. Download the JSON and save it as credentials.json in the project root

credentials.json and token.json are gitignored — never commit them.

4. First run

The first run opens a browser window for Google OAuth consent. After that, a token.json is cached locally and you won't be prompted again.

uv run gmail-ai draft-replies

Usage

Draft replies

Scans unread emails and creates Gmail drafts for emails that need a response:

# Default: last 3 days, up to 20 emails
uv run gmail-ai draft-replies

# Custom range
uv run gmail-ai draft-replies --days 7 --max 50

For each email that needs a reply, you'll see:

  • Who sent it and why Claude thinks it needs a response
  • The drafted reply
  • A prompt to save it as a draft or skip

Weekly summary

uv run gmail-ai summary

# Custom range (default: 7 days)
uv run gmail-ai summary --days 14

Output is structured as:

  • Executive Summary
  • Action Required
  • Notable Updates
  • Low Priority / Noise

Auto-send mode

Once you've reviewed enough drafts and trust the output, switch to auto-send:

uv run gmail-ai draft-replies --auto-send

Still prompts you to confirm each reply before sending — it's not fully autonomous until you're ready.


Project structure

src/gmail_ai/
├── auth.py     # Gmail OAuth2 flow and token caching
├── gmail.py    # Gmail API: read emails, create drafts, send
├── ai.py       # Claude: analyze emails, draft replies, summarize
└── cli.py      # CLI entry point (click)

Roadmap

  • Cron/scheduler support for fully automated runs
  • Label or archive handled emails automatically
  • Per-sender or per-topic reply templates
  • Full auto-send mode (no confirmation prompt)

About

AI-powered Gmail automation using Claude. Draft replies to repetitive emails, and get a weekly summary of your inbox.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages