Skip to main content

Demo: Email Handling

What you'll see​

An email arrives in your inbox. AI Partner:

  1. Reads the email and classifies its intent (needs reply, FYI, action required, spam)
  2. Drafts a reply in your writing style (informed by USER.md and past email tone)
  3. Sends you the draft via Telegram with a preview and one-tap approval buttons
  4. Sends the approved reply — or edits it based on your correction
  5. Logs the entire interaction to the counterparty's record for future context

Prerequisites​

Required:

For best results:

  • USER.md filled in with your name and communication style
  • SOUL.md with your tone preferences

Setup​

1. Connect Gmail​

Go to Settings → Integrations → Gmail and enter your address plus a Gmail App Password — not your login password.

Gmail App Passwords are 16-character codes generated in your Google Account under Security → 2-Step Verification → App passwords. They're separate from your login password and can be revoked independently.

2. Connect Telegram​

Go to Settings → Messaging → Telegram:

  1. Create a bot via @BotFather — /newbot → get your bot token
  2. Get your chat ID: send /start to your bot, then check https://api.telegram.org/bot<token>/getUpdates
  3. Enter both in the Telegram settings

3. Set your authority policy​

In AUTHORITY.md, add rules for email:

## Draft + ask
- action: reply_email + counterparty: colleague
- action: reply_email + counterparty: client
- action: reply_email + counterparty: vendor

## Block
- action: reply_email + counterparty: unknown

The demo​

Trigger it manually​

If you want to test without waiting for a real email, ask AI Partner directly:

Check my Gmail inbox and reply to the most recent unread email that needs a response.
Draft a reply in my voice and send it to me via Telegram for approval before sending.

Or let it run automatically​

With the email trigger configured, AI Partner monitors your inbox automatically. When a new email arrives:

  1. EmailTriggerService detects the message via Gmail push notifications
  2. Classifies the intent: "client asking for project status update"
  3. Checks AUTHORITY.md: reply_email + counterparty: client → verdict: draft_and_ask
  4. Drafts a reply using your past emails as style reference
  5. Sends to Telegram

What you see in Telegram​

📧 New email — needs your review

From: sarah@acme.com (Sarah Johnson, Acme Inc. — Client)
Subject: Q2 Project Status Update Request
Received: 2026-05-13 09:47 AM

Their message:
> Hi Alex,
> Hope you're doing well. Could you give us a quick update on where
> things stand with the Q2 deliverables? We have a board meeting on
> Friday and I'd like to include something.
> Thanks, Sarah

My draft reply:
---
Hi Sarah,

Great to hear from you. Here's where we stand heading into the board meeting:

• Phase 1 (API integration) — ✅ Complete
• Phase 2 (Dashboard) — 🔄 85% complete, on track for May 20
• Phase 3 (Reporting) — Starts May 21, on track for June 15

We're on schedule for the full Q2 deliverable. Happy to jump on a call
if you'd like to walk through any of it before Friday.

Best,
Alex
---

[✅ Approve & Send] [✏️ Edit first] [⏭ Skip for now]

Approving​

Tap ✅ Approve & Send — the email sends immediately. You get a confirmation:

✅ Sent to sarah@acme.com — 09:52 AM

Editing​

Tap ✏️ Edit first — then reply to the Telegram message with your corrected text. AI Partner sends the corrected version:

You → Telegram: "Change 'Phase 3 (Reporting) — Starts May 21' to 'Phase 3 (Reporting) —
Already started, on track for June 15'"

AI Partner: ✅ Updated and sent.

Skipping​

Tap ⏭ Skip for now — the email stays in your inbox unread, marked as deferred. The agent moves on.


Reply style​

The reply draft is personalized using:

InputHow it's used
USER.mdYour name, role, company, communication style
SOUL.mdTone rules (formal vs. casual, frameworks preference)
Counterparty recordSarah's relationship class, tone notes, past interactions
Past emailsYour previous emails to this person, analyzed for style matching

The agent doesn't use a canned template. It reads your actual sent emails and matches your phrasing patterns.


What's logged​

Every email interaction is logged to:

  • email_threads and email_messages tables (full persistence)
  • counterparty record for Sarah: last contact date updated, reply sentiment noted
  • authority_decisions table: the verdict and your response (approved / edited / skipped)

This means the next time Sarah emails you, the agent knows the last conversation, your previous reply tone, and any open commitments from prior threads.


Variations to try​

Summarize inbox
Summarize my last 20 unread emails.
Group by: needs-reply, FYI, action-required.
Send the summary to my Telegram.
Send a new email
Send an email to mike@vendor.com following up on
the proposal they sent last week. Be polite but clear
that we need a decision by Friday.

(Gated by AUTHORITY.md — you'll see a Telegram approval request first)

Search and extract
Search my Gmail for emails from investors in the last 30 days.
Extract: sender, subject, key ask, and my reply status.
Create an Excel file with this data.
Draft only, don't send
Draft a reply to Sarah's last email about Q2 status.
Don't send it — just show me the draft.