Metadata-Version: 2.4
Name: morning-email-brief
Version: 1.0.2
Summary: AI-powered CLI tool that reads your Gmail, summarizes every email with AI, and tells you what to reply to first
Author-email: Rakhee Singh <rakhisingh2811@gmail.com>
License: MIT
Project-URL: Homepage, https://github.com/rakheesingh/morning-email-brief
Project-URL: Repository, https://github.com/rakheesingh/morning-email-brief
Project-URL: Bug Tracker, https://github.com/rakheesingh/morning-email-brief/issues
Keywords: email,gmail,ai,llm,groq,llama,email-summary,email-automation,productivity,cli,inbox-zero,email-triage,developer-tools,email-ai
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: End Users/Desktop
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Communications :: Email
Classifier: Topic :: Office/Business
Classifier: Topic :: Utilities
Requires-Python: >=3.9
Description-Content-Type: text/markdown
Requires-Dist: google-api-python-client>=2.100.0
Requires-Dist: google-auth-oauthlib>=1.2.0
Requires-Dist: google-auth-httplib2>=0.2.0
Requires-Dist: groq>=0.4.0
Requires-Dist: google-generativeai>=0.8.0
Requires-Dist: schedule>=1.2.0
Requires-Dist: python-dotenv>=1.0.0
Requires-Dist: requests>=2.28.0

# 📬 Morning Email Brief

**AI-powered CLI tool that reads your Gmail inbox, summarizes every email in one sentence, and tells you what to reply to first.**

Built for developers and busy professionals who get 50-100+ emails a day and miss the important ones.

[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
[![Python 3.9+](https://img.shields.io/badge/python-3.9+-blue.svg)](https://www.python.org/downloads/)
[![AI: Groq](https://img.shields.io/badge/AI-Groq%20(free)-orange.svg)](https://console.groq.com)

---

## What It Does

```
$ morning-email-brief

  📬 Morning Email Briefing
  Wednesday, April 8, 2026 at 10:00 AM
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

  50 emails  │  1 urgent  │  5 important  │  3 need reply

  🔴 REPLY NOW (1)
  ─────────────────────────────────────────────────────
  1. Production DB migration failing — need your help
     Alex Chen [↩ REPLY] [Work]
     → Migration script throws FK constraint error on users table.
       Alex is blocked and needs your fix before 2 PM deploy.

  🟠 IMPORTANT (5)
  ─────────────────────────────────────────────────────
  2. Offer Letter — Senior Engineer at Acme Corp
     Sarah from HR [↩ REPLY] [HR]
     → Offer letter attached. Needs your signature by Friday.

  3. Sprint retro moved to 4 PM
     David Park [Meeting]
     → Calendar updated. New agenda includes Q2 planning.

  🔵 FYI (15)
  ─────────────────────────────────────────────────────
  4. UPI transaction alert — Rs.2,500 debited
     HDFC Bank [Finance]

  ⚪ LOW PRIORITY (29)
  ─────────────────────────────────────────────────────
  5. Your weekly newsletter from dev.to
     DEV Community [Newsletter]
  ...
```

### Key Features

- **Smart triage** — AI classifies each email as Urgent, Important, FYI, or Low Priority
- **AI summaries only where it matters** — urgent and important emails get detailed summaries, the rest just show subject lines (saves tokens)
- **Detects what needs a reply** — highlights emails where a real person is waiting for your response
- **Filters out noise** — charity spam, newsletters, promotions, automated alerts correctly classified as low priority
- **Works with any Gmail account** — uses Google OAuth2 (read-only access)
- **100% free** — uses Groq free tier (14,400 requests/day) + Gmail API (free)
- **Privacy-first** — emails are processed locally, never stored on any server
- **Briefing history** — past briefings saved locally in SQLite

---

## Quick Start

### Install

```bash
pip install morning-email-brief
```

### Setup (2 minutes, one time)

```bash
# 1. Choose AI provider (Groq or Gemini) & enter API key
morning-email-brief setup

# 2. Sign in with Google (opens browser)
morning-email-brief login
```

### Use

```bash
morning-email-brief              # Generate today's briefing
morning-email-brief last         # Re-print the last briefing
morning-email-brief history      # List past briefing dates
morning-email-brief date 2026-04-08  # View a specific day's briefing
```

---

## How It Works

```
┌──────────────┐     ┌──────────────┐     ┌──────────────┐
│  Gmail API   │────▶│  Groq AI     │────▶│  Terminal     │
│  (read-only) │     │  (Llama 3.3) │     │  Output       │
│              │     │              │     │              │
│ Fetch 50     │     │ Step 1:      │     │ Sorted by    │
│ unread       │     │ Triage ALL   │     │ priority     │
│ emails       │     │ (cheap)      │     │              │
│              │     │              │     │ AI summaries │
│              │     │ Step 2:      │     │ only for     │
│              │     │ Summarize    │     │ urgent +     │
│              │     │ important    │     │ important    │
│              │     │ only (smart) │     │              │
└──────────────┘     └──────────────┘     └──────────────┘
```

### 2-Step AI Processing (saves 70% tokens)

1. **Triage** — classifies all 50 emails using only subject + snippet (cheap, fast)
2. **Summarize** — writes detailed summaries only for urgent + important emails (5-10 emails, not 50)

FYI and Low Priority emails just show the original snippet — no AI call needed.

---

## Getting API Keys (free)

### Groq API Key (required)

1. Go to [console.groq.com](https://console.groq.com)
2. Sign up (Google or GitHub)
3. API Keys → Create API Key → copy it
4. Free tier: 14,400 requests/day — more than enough

### Gmail Access

Run `morning-email-brief login` — opens your browser for Google sign-in. Read-only access, we never send or modify emails.

---

## Configuration

All config is stored in `~/.email-brief/.env`:

```bash
GROQ_API_KEY=gsk_xxxxx        # Required: free from console.groq.com
GMAIL_CLIENT_ID=xxxxx          # Set by auth server
GMAIL_CLIENT_SECRET=xxxxx      # Set by auth server
AUTH_SERVER_URL=https://...    # Auth server for Google sign-in
BRIEFING_TIME=10:00            # Daily schedule (for watch mode)
EMAIL_COUNT=50                 # Number of emails to fetch
```

---

## Project Structure

```
morning-email-brief/
├── cli/                       # Python CLI tool (pip installable)
│   ├── email_brief/
│   │   ├── main.py            # CLI entry point
│   │   ├── gmail_client.py    # Gmail API + OAuth
│   │   ├── summarizer.py      # Groq/Gemini AI engine
│   │   ├── prompts.py         # AI prompt templates
│   │   ├── prioritizer.py     # Priority sorting
│   │   ├── renderer.py        # Terminal output (colors, formatting)
│   │   ├── storage.py         # SQLite briefing history
│   │   ├── config.py          # Environment config
│   │   └── types.py           # Data models
│   └── pyproject.toml
│
└── auth-server/               # Next.js server for Google OAuth
    ├── src/app/
    │   ├── page.tsx            # Landing page
    │   ├── privacy/page.tsx    # Privacy policy
    │   ├── terms/page.tsx      # Terms of service
    │   └── api/auth/           # OAuth routes
    └── package.json
```

---

## Privacy & Security

- **Read-only access** — we only use the `gmail.readonly` scope. We cannot send, delete, or modify your emails.
- **Local processing** — your emails are processed on your machine. Email content is sent to Groq/Gemini API for summarization but never stored on any server.
- **Local storage** — OAuth tokens and briefing history are stored locally in `~/.email-brief/`. Nothing is uploaded.
- **Open source** — review every line of code to verify exactly how your data is handled.

---

## Supported AI Providers

| Provider | Model | Cost | Setup |
|---|---|---|---|
| **Groq** (default) | Llama 3.3 70B | Free (14,400 req/day) | [console.groq.com](https://console.groq.com) |
| Google Gemini | Gemini 2.0 Flash | Free (1,500 req/day) | [aistudio.google.com](https://aistudio.google.com) |

Set `GROQ_API_KEY` or `GEMINI_API_KEY` in your config. Groq is recommended (faster, higher limits).

---

## Tech Stack

- **Python 3.9+**
- **Groq** — Llama 3.3 70B for email triage and summarization
- **Gmail API** — OAuth2 read-only access
- **SQLite** — local briefing history
- **Next.js** — auth server for Google sign-in (hosted on Vercel)

---

## Roadmap

- [x] CLI tool with `pip install morning-email-brief`
- [x] Gmail integration (OAuth2)
- [x] AI-powered triage + summarization
- [x] Smart priority scoring (Urgent → Important → FYI → Low)
- [x] 2-step AI processing (70% token savings)
- [x] Briefing history (SQLite)
- [ ] Outlook / Microsoft 365 support
- [ ] Daily email digest (get briefing in your inbox)
- [ ] Chrome extension
- [ ] Web dashboard
- [ ] Slack/Discord notifications
- [ ] Custom priority rules per user

---

## Contributing

Contributions are welcome! See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.

```bash
# Clone and setup for development
git clone https://github.com/rakheesingh/morning-email-brief.git
cd morning-email-brief/cli
pip install -e .
```

---

## License

MIT — see [LICENSE](LICENSE) for details.

---

**If this tool saves you time, give it a star!** ⭐
