Back to work
AI

Mail Copilot

An AI mail client where the assistant drives the UI: say it, watch the inbox do it.

Live demo
Role
Sole developer: design, architecture, implementation
Stack
Next.js · TypeScript · CopilotKit · Gmail API · OAuth · Vitest
Year
2026

Live demo available. Google OAuth is still in testing mode, so access has to be granted per account. Get in touch and I'll add you.

Demo

A silent screen recording of the deployed app, about three minutes long, for anyone without test access. The Google sign-in and a switch to Gmail to send a test reply have been cut out.

Context

Most AI email tools are a chatbot bolted to the side of your inbox. You ask it something, it answers in a panel, and you go back to doing the work yourself.

I wanted the opposite: an assistant that operates the interface. You say what you want and you watch the app do it, in the real UI, with the real data.

What I built

A working mail client where the assistant drives the interface rather than describing it.

  • "Send an email to john@ about tomorrow's meeting" opens the compose form and visibly fills it in: you see the fields populate, and you send it.
  • "Show unread from this week" filters the actual inbox, not a summary of it.
  • Real Gmail: read, search, send and reply through the Gmail API with Google sign-in, and replies thread correctly rather than starting a new conversation.
  • Context awareness: "reply to this" knows which email you have open, because the assistant reads the same state the UI renders from.
  • Incremental sync every 15 seconds, so the mailbox stays current without refetching everything.
  • Human in the loop: nothing is sent without an explicit confirmation step.
  • Dark mode.

Architecture

The design decision that makes the whole thing work is that the assistant and the interface share one state store. There is no separate copy of the world for the AI to reason about, so it cannot drift out of sync with what the user is looking at.

Stack
Next.js and TypeScript.
Assistant
CopilotKit v2, exposing nine frontend tools that act on the shared store the UI renders from.
Mail
Gmail API with Google OAuth sign-in: real read, search, send and reply, with correct threading.
Tests
Vitest unit tests over the fiddly parts: Gmail query construction, MIME assembly, and payload parsing. These are the places where a silent bug produces a plausible-looking wrong email.

How AI was used to build it

Built with the same agent-driven workflow as the internal tools: structured prompts, project memory in the repository, and phased plans, with me reviewing what lands.

The interesting constraint here was that the product itself is an AI agent operating a UI, so the failure modes had to be designed for rather than patched later. That is why sending requires confirmation, and why the parsing code has unit tests instead of a hope that the model formats things correctly.

Outcome and current status

Live and usable. The demo runs on Vercel, and because Google OAuth is still in testing mode, access is granted per account. Ask me and I'll add you.

Screenshots