AI-powered Gmail automation using Claude. Draft replies to repetitive emails, and get a weekly summary of your inbox.
- 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
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.
cp .env.example .env
# Add your key to .env:
# ANTHROPIC_API_KEY=sk-ant-...Get a key at console.anthropic.com.
- Go to console.cloud.google.com
- Select or create a project (e.g. under webeet.io)
- Enable the Gmail API: APIs & Services > Enable APIs > search "Gmail API"
- Create credentials: APIs & Services > Credentials > Create Credentials > OAuth 2.0 Client ID
- Application type: Desktop app
- Download the JSON and save it as
credentials.jsonin the project root
credentials.json and token.json are gitignored — never commit them.
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-repliesScans 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 50For 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
uv run gmail-ai summary
# Custom range (default: 7 days)
uv run gmail-ai summary --days 14Output is structured as:
- Executive Summary
- Action Required
- Notable Updates
- Low Priority / Noise
Once you've reviewed enough drafts and trust the output, switch to auto-send:
uv run gmail-ai draft-replies --auto-sendStill prompts you to confirm each reply before sending — it's not fully autonomous until you're ready.
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)
- 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)