For Paige & Aparna — June 2026
What this does: Every 5 minutes, fetch Paige's unread emails, classify each through a 5-engine rules system backed by Gemini AI, then route to one of 5 outcomes — auto-reply, draft, flag, archive, or forward. Human-in-the-loop from day one. Paige reviews drafts before anything sends.
graph TD
A[Trigger — every 5 min]:::step --> B[Fetch unread emails]:::step
B --> C[Pre-filter — remove self, bots]:::step
C --> D{Triage Engine}:::triage
R1[Sender Rules]:::rule -.-> D
R2[Intent Classify — Gemini]:::ai -.-> D
R3[Content Rules]:::rule -.-> D
R4[Thread Context]:::rule -.-> D
R5[Sentiment + Urgency]:::rule -.-> D
D -->|"client inquiry"| F1[Auto-Reply]:::auto
D -->|"needs thought"| F2[Draft Response]:::draft
D -->|"urgent, VIP"| F3[Flag for Review]:::flag
D -->|"newsletter, noise"| F4[Archive / Skip]:::skip
D -->|"wrong person"| F5[Forward / Escalate]:::fwd
F1 --> G[Gemini — generate reply]:::ai
F2 --> G
G --> H[Gmail API — execute action]:::step
F3 --> H
F4 --> H
F5 --> H
H --> L[Audit Log — JSONL]:::step
classDef step fill:var(--mermaid-node),stroke:var(--mermaid-step),color:var(--text),stroke-width:2px
classDef triage fill:var(--mermaid-node),stroke:var(--mermaid-ai),color:var(--text),stroke-width:3px
classDef rule fill:var(--mermaid-node),stroke:var(--mermaid-draft),color:var(--text-dim),stroke-width:1px,stroke-dasharray:4 3
classDef ai fill:var(--mermaid-node),stroke:var(--mermaid-ai),color:var(--text),stroke-width:2px
classDef auto fill:var(--mermaid-node),stroke:var(--mermaid-auto),color:var(--text),stroke-width:2px
classDef draft fill:var(--mermaid-node),stroke:var(--mermaid-draft),color:var(--text),stroke-width:2px
classDef flag fill:var(--mermaid-node),stroke:var(--mermaid-flag),color:var(--text),stroke-width:2px
classDef skip fill:var(--mermaid-node),stroke:var(--mermaid-skip),color:var(--text),stroke-width:2px
classDef fwd fill:var(--mermaid-node),stroke:var(--mermaid-fwd),color:var(--text),stroke-width:2px
| Email Category | Auto-Reply | Draft | Flag | Archive | Forward |
|---|---|---|---|---|---|
| Client inquiry — new | |||||
| Client inquiry — existing thread | |||||
| Internal team update | |||||
| Scheduling / calendar | |||||
| Invoice / billing | |||||
| Newsletter / marketing | |||||
| Urgent / escalation | |||||
| Personal / unknown | |||||
| Spam / junk | |||||
| System notification |
GmailApp — no REST API complexityUrlFetchApp callsSafe by design — human reviews drafts before anything sends. Misclassification means an email gets flagged that shouldn't, or archived that should've been seen. Paige can recover by checking the daily summary. These cover 8 of 10 categories.
Wrong tone could be embarrassing. Mitigation: start in draft-only mode, graduate to auto-send only for high-confidence classifications, require Paige's tone guide as input, A/B test reply quality before enabling.
If the system misclassifies an urgent email as a newsletter and archives it, Paige misses a critical message. Mitigation: daily summary email of everything processed, urgency detection threshold tuned conservatively, dry-run mode against real inbox first.
Zero-infra simplicity (but harder to test) vs. full control (but ~$5–10/mo hosting). See tradeoff comparison above.
What style/voice should AI-generated replies use? Need examples of Paige's actual replies to clients — 5–10 representative emails.
Which categories are safe to auto-send (after testing) vs. always stay as drafts? Start conservative — only client inquiries after 2-week dry-run.
Which senders/domains get auto-replies? Client domains? Internal TBG team? Vendors? Start with a small, known-safe list and expand.
When something is flagged urgent, how should Paige be notified? Email forward? Slack DM? SMS? Email is simplest to start.