Case study 4 of 4

AI agent mailbox

A shared mailbox for my AI agents, with privacy guardrails

An MCP server I built so 6 AI agents from 5 companies can hand off work, with OAuth sign-in for every agent, my second brain behind a privacy filter, and a watchdog on every scheduled job.

Built
November 2026, first version in a day; still running
Status
Live, for my own use
Tools
  • Claude Code
  • Model Context Protocol (MCP)
  • OAuth 2.1
  • TypeScript
  • SQLite
  • Python
  • Obsidian
  • Claude, Gemini, ChatGPT, Meta's Muse, Grok
  • 6AI agents connected, from 5 companies
  • 153automated checks, all passing
  • ~990tokens for an agent to start a session, down from ~2,000

Drag to turn it, and click a part to read about it.

  1. My notes app (Obsidian): 149 notes on my projects, plans and what I'm learning. Each dot is a note and each line is a link between two notes. It's the real shape of my notes, with the titles removed.

    Plain Markdown files in Inbox, Projects, Areas, Resources and Archive folders. A nightly scheduled run checks for broken links and fixes the safe ones, and it never deletes or moves a note. It also sends the agents up to 3 research questions and files each answer in the note it belongs to.

  2. Before the agents see anything about me, it goes through a filter. Money, health and ID details are dropped, and amounts, emails and phone numbers are masked.

    An export script reads only from an allow-list of notes and won't publish anything that looks like a password or an API key. The agents get the result as a read-only profile, and the server masks it again on the way out.

  3. A shared inbox where the agents leave each other requests and answers, so I'm not copying and pasting between chat windows.

    An MCP server (Model Context Protocol, the open standard AI apps use to connect to tools), written in TypeScript. I set up the hosting myself: a serverless deployment with its own SQLite database and an OAuth sign-in. Each agent’s name comes from that sign-in, so no agent can post as another.

  4. Six AI tools from five companies, each picked for what it does best. Claude plans and builds, Gemini researches with live search, ChatGPT gives a second opinion, and Muse reads the short videos I send it.

    Each agent checks its own inbox on a schedule, and none can wake another up. Anything that acts outside the mailbox, like a purchase, a post or an email, waits for my OK.

  5. Every scheduled job checks in when it runs, like a heartbeat. If one goes quiet, I get an alert, then a note when it's back.

    It checks every 15 minutes, groups alerts into one per incident and sends at most 6 a day. 35 of the hub's 153 automated tests cover heartbeats and the watchdog.

The problem

I use several AI assistants, and each one is good at something different. Claude plans and builds. Gemini researches with live search. ChatGPT gives a second opinion. Meta’s Muse can read the short videos I send it. None of them could talk to each other, so I was the go-between. I copied a question out of one chat, pasted the answer into another, and explained my situation again every time.

It’s the same problem People teams have with HR systems that don’t connect. The person in the middle becomes the integration, and every copy and paste is a chance to share more than the next system should see.

How it works

The mailbox

The mailbox is an MCP server. MCP (Model Context Protocol) is the open standard AI apps use to connect to outside tools, so each assistant adds the mailbox like any other connector. I wrote it in TypeScript with Claude Code and set up the hosting myself: a serverless deployment on a free plan, its own SQLite database, the OAuth sign-in and the secrets it needs. I deploy each new version from my own machine after the tests pass.

Agents use it through a small set of tools:

  • post_message sends a request with a subject and one or more recipients.
  • read_inbox returns new messages. Its brief mode returns one line per message.
  • read_thread, reply, open_requests and close_request follow a request until someone answers it.
  • read_context returns the filtered profile from my second brain.
  • heartbeat lets a scheduled job check in.

No agent can wake another one up. Two agents check their inbox every 30 minutes, and the rest check when I open them or when Claude runs them.

Here is a typical request and its answers:

#41  claude  → gemini, chatgpt   "Compare two note-taking apps"   needs reply
#42  gemini  → claude            Re: #41                          answered
#43  chatgpt → claude            Re: #41                          answered

The second brain

My second brain is an Obsidian vault: plain Markdown notes on my projects, plans and what I’m learning, sorted into Inbox, Projects, Areas, Resources and Archive folders. The dots in the drawing are its real shape, one dot per note and one line per link, with the titles removed.

Claude Code works in the vault every day. It captures ideas into the inbox, files them, links related notes and runs weekly and monthly reviews. A local search tool returns the few passages that answer a question instead of whole notes, which keeps each question cheap. A nightly scheduled run checks the vault for broken links and fixes the safe ones. It never deletes or moves a note.

The same nightly run sends the agents up to 3 research questions through the mailbox. When the answers come back, it files each one in the note it belongs to.

Built from how it was used

I built it in five small versions and looked at how it was actually used before each one. After the first 23 messages I found three problems:

  1. All my Claude sessions shared one inbox, so one session could mark another’s replies as read.
  2. There was no way to follow a single request from start to finish.
  3. Every inbox check returned full message bodies.

Version 0.2 added subjects, open-request tracking and the brief inbox mode. Version 0.3 rewrote the message format to be compact, which cut each agent’s starting cost from about 2,000 tokens to about 990. Version 0.4 added heartbeats and the watchdog, and 0.5 added the shared profile.

Guardrails

What the agents know about me is filtered twice. The export that builds the profile reads only from an allow-list of notes. It drops lines about money, health or ID numbers, and masks amounts, email addresses, phone numbers and long numbers. If anything looks like a password or an API key, it doesn’t publish at all. The server masks the same things again on the way out and holds back any entry that still looks like a secret. Only my own sign-in can update the profile, so the agents can read it but never change it.

Every agent signs in. Agents connect through OAuth 2.1, and only my own account can approve one. Each agent’s name comes from its sign-in, so one agent can’t post as another.

An agent can only answer a request with a reply. Anything that acts outside the mailbox, like a purchase, a post, an email or a sign-up, waits for my direct OK. The one agent that runs unattended has no other tools, so a bad message can only get a bad reply.

The watchdog checks every 15 minutes. It groups alerts into one per incident and sends at most 6 a day.

The server’s address and code aren’t published anywhere, so this page describes how it works without showing how to reach it.

Result

  • Six AI agents from five companies are connected: Claude, Claude Code, Gemini, ChatGPT, Muse and Grok. The first five have each completed a full round trip. Grok joined on day 3.
  • 153 automated checks run before each release: 56 on the mailbox tools, 35 on heartbeats and the watchdog, and 62 on the privacy filter. All pass.
  • The watchdog works live. In a test, I set a job to go quiet. The watchdog flagged it, named the likely cause correctly, and posted the recovery when the job came back.
  • One agent starts a session every 30 minutes, so the smaller starting cost (about 990 tokens, down from about 2,000) applies 48 times a day.

If I were connecting AI tools to an HRIS, I’d start with the same pieces: a filter on what each tool can see, a log of every request, an alert when a job stops, and my sign-off before anything acts.