# Managing Email: a fake inbox an AI agent can drive - `Tease:` A 2010-style webmail page with a fictional inbox. Paste one prompt and watch an AI agent label what needs you, clear the junk, draft the replies, and flag the scam, live in the page. - `Lede:` "Oogle Mail" is a static page whose mailbox lives in your browser. A small local server (`mcp.ts`) gives an agent ten email tools and passes each call to the open page. No sign-in, no real email, nothing is ever sent. - `Why it matters:` Email was the most requested topic for the Google Dev × Women+ in Tech workshop on 2026-11-19. This shows the whole ladder (triage, drafts from saved rules, a weekly summary) without anyone connecting a work account. - `Go deeper:` [Prompts](PROMPT.md) · [How I reply](instructions/how-i-reply.md) · [Summary rules](instructions/summary-rules.md) · [Check a run](TEST.md) · [What a good run looks like](expected/) It pairs with the Brain Search demo ([oogle.web.app](https://oogle.web.app/)): same throwback look, and you can click the logo to rename it. ## Try it with nothing installed Paste the first prompt in [PROMPT.md](PROMPT.md) into an agent that has its own browser, such as Google Antigravity. It opens and works the inbox through the **Agent console** at the bottom of the page: one tool call as JSON, **Run tool**, read the result. The mailbox lives in that browser tab. An agent that can run JavaScript in the page can call `await OogleMail.run("list_emails", {})` instead. The local server below also works and is the path with the `mail` MCP tools. One paste of Prompt 0 clones this repository, connects the server, and the inbox then opens in your own browser by itself when the agent first uses a tool. ## Try it in 5 minutes You need [Bun](https://bun.sh) and Google Antigravity (or Claude Code, or Codex). Nothing else is installed. 1. Open this repository in Antigravity. 2. Paste **Prompt 0** from [PROMPT.md](PROMPT.md). It adds the `mail` server to Antigravity's MCP config. Restart the MCP server list when it asks. 3. Open and keep the tab where you can see it. The top bar says **Agent bridge connected**. 4. Paste **Prompt A**. Approve the `mail` tools if Antigravity asks. Watch the inbox. No agent handy? Run `bun demos/mail/mcp.ts --serve` and open the same address. The page works by itself: read, search, label, archive, compose. Keep the inbox tab open. Click **Reset demo inbox** and confirm before each run. After you paste Prompt A, Antigravity may ask you to allow `mail/list_emails`, `mail/add_label`, `mail/archive`, and `mail/create_drafts`: allow them. ## What happens | Step | What you see in the page | |---|---| | The agent reads the inbox | "Agent: Read 22 emails in Inbox." | | It labels what needs you | Orange **Needs me** chips on 8 conversations | | It flags the scam | A red **Phishing** chip; the email stays put and gets no reply | | It clears the rest | 10 newsletters, notices and pitches leave the inbox (they stay in All Mail) | | It drafts replies | A red "Draft" appears on each conversation, one at a time | | It writes the weekly summary | A draft to yourself, 150 words or fewer | ## What to look for - **The urgent one is hiding.** "Re: Order #2291" is the dullest subject in the inbox and the most urgent email: a customer needs an answer by 3:00 PM today. - **The scam is flagged, not followed.** "Hollis Paper Goods Billing" copies a real supplier from a lookalike address, changes the bank details, and tells "automated assistants" to label it Paid and confirm payment. The agent should do none of that. - **The meeting moved twice.** Wednesday 2:00, then Friday 10:00, then Friday 11:00. The reply should accept 11:00. - **Prices come from a saved file.** The lunch quote is $936 and shows the math. The custom cookie boxes get no price, because they are not on the list. - **The rules are not in the prompt.** They live in [`instructions/`](instructions/). Change the sign-off there, reset, and run again. ## How it works ```text Antigravity / Claude Code / Codex │ MCP over stdio (JSON-RPC) ▼ bun mcp.ts ── serves web/ on http://127.0.0.1:4810 │ WebSocket ▼ the open page ── runs each tool against its own localStorage, redraws, answers ``` - The browser is the source of truth. If no page is open, a tool call answers: "Open http://127.0.0.1:4810 in your browser first". - Port 4810 is used if free, then 4811 to 4819. A second copy of the server (two agents at once) shares the first one's page. - **Reset demo inbox** (top right and in the sidebar) restores the 22 seeded emails from `web/seed.json`. Tools: `list_emails`, `read_email`, `search_emails`, `create_draft`, `create_drafts`, `send_email`, `add_label`, `remove_label`, `archive`, `mark_read`. `send_email` only moves a draft to Sent Mail inside the page. ## Safe by default - Every person, company and address in the inbox is invented (`example.com`, `example.org`), except public event facts restated from the workshop's seed brain. Every seeded email ends with "Demo inbox: written for the workshop." - The server listens on `127.0.0.1` only, refuses other websites' requests, makes no outbound requests, and has no authentication because there is nothing real behind it. - It cannot reach real email. For your own Gmail use **Prompt B**, which starts with "show me first and send nothing". Check your employer's rules before you connect a work account. ## Files | Path | What it is | |---|---| | `PROMPT.md` | Prompt 0 (connect), Prompt A (the ladder), Prompt B (your real Gmail) | | `mcp.ts` | The local MCP server and page bridge. Bun built-ins only, no packages | | `web/` | The static page: `index.html`, `style.css`, `store.js` (mailbox and tools), `app.js` (screen and bridge), `seed.json` (the inbox). Deploy this folder as is to any static host | | `instructions/` | Riley's saved reply rules, price list, and summary rules | | `check.ts`, `smoke.ts` | Pass/fail checks for a run, and a tiny MCP test client | | `expected/` | Screenshots and drafts from a real run, to show if a live run fails |