Your inbox, handled. AI-generated email drafts with human-in-the-loop approval.
CHIEF watches your Gmail inbox, scores every email by importance, drafts replies in your voice, and waits for you to swipe right (send) or left (archive). No email is ever sent without your explicit approval.
Gmail Inbox ──► Webhook ──► Gatekeeper ──► Oracle ──► Scribe ──► [You Swipe] ──► Operator ──► Gmail Sent
│ PII scan │ RAG │ Draft │ Approve │ Send
│ Score 1-10 │ Context │ Your voice │ or reject │ or archive
- Email arrives — Gmail Pub/Sub webhook fires, triggering an incremental sync
- Gatekeeper sanitizes PII + scores importance (1-10) using sender history from Pinecone
- Oracle retrieves context from past interactions via RAG + synthesizes a briefing
- Scribe drafts a reply in your voice using Claude Sonnet 4, then pauses for approval
- You swipe right to send, left to archive — no auto-send, ever
- Operator executes your decision via Gmail API
# 1. Clone
git clone https://github.com/your-org/chief.git && cd chief
# 2. Configure
cp .env.example .env
# Fill in: Supabase, Anthropic, Google, Pinecone keys
# 3. Run database migrations
# Apply 001-005 SQL files in backend/migrations/ via Supabase Dashboard → SQL Editor
# 4. Start
docker compose up
# 5. Open
open http://localhost:3000
# 6. Connect Gmail via OAuth, send yourself a test email, watch the pipeline process itSee docs/quickstart.md for the full 5-minute setup guide.
| Layer | Tech |
|---|---|
| Backend | Python 3.12 · FastAPI · LangGraph 0.4 |
| Frontend | Next.js 16 · React 19 · TypeScript · Tailwind · shadcn |
| LLM | Claude Sonnet 4 (drafts) · Gemini Flash (scoring) |
| Database | Supabase (Postgres + Vault + Realtime + RLS) |
| Vector DB | Pinecone (per-user namespaces) |
| Deploy | Docker · Railway |
┌─────────────┐ Pub/Sub ┌──────────────────────────────────────────────┐
│ Gmail API │ ──────────────► │ FastAPI Backend (single port) │
└─────────────┘ │ │
│ Webhook ──► LangGraph Pipeline │
┌─────────────┐ Realtime │ ├─ Gatekeeper (PII + score) │
│ Supabase │ ◄────────────── │ ├─ Oracle (RAG context) │
│ Postgres │ ──────────────► │ ├─ Scribe (draft + interrupt) │
│ + Vault │ Service Role │ └─ Operator (send/archive) │
│ + RLS │ │ │
└─────────────┘ │ PostgresSaver checkpointer (durable state) │
└──────────────────────────────────────────────┘
┌─────────────┐ │
│ Pinecone │ ◄───────────────────────┘ Embeddings (user_{uuid} namespace)
└─────────────┘
┌──────────────────────────────────────────────┐
│ Next.js Frontend │
│ ├─ Supabase Realtime (live email/draft feed)│
│ ├─ SSE streaming (pipeline progress) │
│ └─ Swipe UX (approve/reject drafts) │
└──────────────────────────────────────────────┘
- No auto-send — Every email requires explicit human approval via swipe
- PII sanitization — All email bodies are sanitized before any LLM call or database storage
- Two LLM tiers — Operational (Gemini Flash, fast/cheap for scoring) and Deliverable (Claude Sonnet 4, high-quality for drafts)
- Dynamic interrupts — Scribe self-interrupts via
interrupt(), not graph-levelinterrupt_after - Per-user isolation — Supabase RLS, Pinecone namespaces (
user_{uuid}), Vault-encrypted tokens - Supabase Realtime — Frontend subscribes to Postgres Changes, no polling
| Doc | Description |
|---|---|
| Architecture | System design, data flow, security model |
| Quickstart | 5-minute local setup guide |
| Pipeline Guide | The 4-node LangGraph pipeline explained |
| Human-in-the-Loop | Interrupt/resume + swipe UX |
| Realtime | Supabase Realtime + SSE streaming |
| Gmail Setup | OAuth + Pub/Sub configuration |
| Supabase Setup | Tables, RLS, Vault, Replication |
| Deployment | Railway / Docker production deploy |
| API Reference | All REST endpoints |
| Database Reference | Table schemas + RLS policies |
| Env Vars | Every environment variable |
| State Reference | EmailState fields |
| Contributing | Code style, PR process |
MIT