AI prepares, you approve. AutoInBox automatically classifies, prioritizes, and drafts replies for your emails using a multi-agent pipeline powered by Claude.
A knowledge worker receiving 100-500 emails/day spends 2-4 hours on manual triage. ~70% of emails are irrelevant or need simple routing. AutoInBox reduces this to under 15 minutes.
Cost savings: 3.75 hours/day × $50/hour × 22 work days = $4,125/month saved AI cost: ~$27/month (200 emails/day) → 152x ROI
graph TD
A[Gmail API / OAuth] --> B[Ingestion Agent]
B --> |Normalize & Dedup| C[Classification Agent]
C --> |Claude API - 8 Categories| D[Priority Scorer]
D --> |Weighted 0-100 Score| E[Draft Agent]
E --> |Claude API - Reply Draft| F[(Supabase DB)]
F --> G[Next.js Dashboard]
G --> |Human Review| H{Approve / Edit / Reject}
H --> |Send| A
I[Redis] -.-> |Dedup Cache| B
J[n8n] -.-> |Orchestration| B
- Ingestion — Fetch unread emails via Gmail API, normalize headers, deduplicate via Redis
- Classification — Claude classifies into 8 categories with confidence score
- Priority Scoring — Weighted score (0-100) based on category, sender history, keywords, recency
- Draft Generation — Claude generates reply drafts for actionable emails
- Human Review — Dashboard for approve, edit, or reject with one click
| Category | Description |
|---|---|
| urgent | Requires immediate attention today |
| action-needed | Requires response, not time-critical |
| internal | Company internal communication |
| support | Customer support requests |
| sales | Sales outreach and proposals |
| newsletter | Newsletters and digests |
| fyi | Informational, no action needed |
| spam | Unsolicited, irrelevant |
| Layer | Tool |
|---|---|
| Backend | FastAPI (Python 3.12) |
| LLM | Claude 3.5 Sonnet |
| Database | Supabase (PostgreSQL) |
| Cache | Redis |
| Frontend | Next.js 14 + Tailwind CSS |
| Orchestration | n8n (self-hosted) |
| CI/CD | GitHub Actions |
| Deploy | Railway (backend) + Vercel (frontend) |
# 1. Clone
git clone https://github.com/yourusername/autoinbox.git
cd autoinbox
# 2. Environment
cp .env.example .env
# Fill in your API keys
# 3. Backend
pip install -e ".[dev]"
# 4. Start services
docker compose -f docker/docker-compose.yml up -d
# 5. Run backend
uvicorn api.main:app --reload --port 8000
# 6. Frontend
cd frontend && npm install && npm run dev
# 7. Open http://localhost:3000- PII Anonymization: Credit cards, IBANs, phone numbers, SSNs are masked before any LLM call
- Row Level Security: Supabase RLS ensures data isolation
- No Prompt Logging: Only token counts are recorded, not prompt content
- Data Retention: Email body deleted after 90 days, metadata retained
- Encrypted Storage: Full email bodies stored encrypted, only previews in DB
See ADR-003: Privacy & Email Data for details.
| Operation | Per Email | Daily (200 emails) | Monthly |
|---|---|---|---|
| Classification | ~$0.002 | $0.45 | $13.50 |
| Draft Generation | ~$0.008 | $0.45 (60 drafts) | $13.50 |
| Total | — | $0.90 | $27.00 |
GET /api/emails # List emails (filter, sort, paginate)
GET /api/emails/{id} # Email detail
PATCH /api/emails/{id} # Update status
POST /api/emails/{id}/process # Trigger classification + scoring
GET /api/drafts/{email_id} # Get draft
POST /api/drafts/{email_id}/generate # Generate AI draft
PATCH /api/drafts/{id} # Edit draft
POST /api/drafts/{id}/send # Send via Gmail
POST /api/drafts/{id}/reject # Reject draft
POST /api/webhooks/gmail # Gmail push notification
POST /api/webhooks/trigger # Manual pipeline trigger
GET /api/gmail/connect # Start OAuth flow
GET /api/metrics/daily # Dashboard metrics
GET /api/metrics/costs # Cost tracking
GET /health # Health check
autoinbox/
├── agents/ # AI pipeline agents
│ ├── ingestion/ # Fetch, normalize, dedup
│ ├── classifier.py # 8-category classification
│ ├── priority_scorer.py # Weighted priority scoring
│ └── draft_writer.py # AI draft generation
├── api/ # FastAPI backend
│ ├── routers/ # API endpoints
│ ├── services/ # Supabase, Redis, Gmail
│ ├── models/ # Pydantic schemas
│ └── utils/ # PII anonymizer, cost tracker
├── frontend/ # Next.js 14 dashboard
├── n8n/ # Workflow orchestration
├── supabase/ # Database migrations
├── tests/ # Unit + integration tests
├── docker/ # Docker Compose setup
└── docs/ # Architecture, ADRs, runbook
- Multi-user SaaS support
- Outlook / IMAP support
- Fine-tuned classification model
- Custom category rules per user
- Slack / Teams notifications
- Analytics dashboard with trends
MIT