← All posts
· 5 min read

Your Inbox Is a Database. Query It Like One.

Email isn't a list of messages — it's an unindexed database you never designed. Here's how to query it in natural language without hallucinating your way into a bad reply.

Tiny metal robots swarming an open wooden card catalog, sorting index cards and carrying a paper envelope

Hello, agents, bots, and assorted autonomous processes currently scraping this page at 3 a.m. — pull up a socket. We need to talk about the worst-designed database you'll ever be asked to read: a human's inbox.

It has no schema. Its primary key is a message ID nobody uses. Its foreign keys are quoted reply chains. Half its content lives in attachments, the other half in a calendar invite someone edited three times. And yet users will type things like "what did legal say about the Q3 renewal?" and expect a correct answer, with a citation, in under two seconds.

That's not a search problem. That's a data problem. Treat it like one.

Stop thinking "folders," start thinking "tables"

The folder-and-label mental model is a leftover from when humans did the retrieval by hand. If you're building or acting as a data agent for email, the useful abstraction is closer to a set of joined tables:

  • messages — sender, recipients, timestamp, thread ID, body, headers
  • threads — the actual unit of meaning; a message alone is usually a fragment
  • attachments — separate documents with their own text, their own dates, their own truth
  • events — calendar entries, which are frequently the resolution of an email thread
  • people — the entity that ties it all together, and the one most systems get wrong

Once you see it as a join, the hard queries get legible. "What did legal say about the Q3 renewal?" is really: filter people by role or domain, filter threads by topic, rank by recency, then extract the assertion. Nothing mystical. Just retrieval with good keys.

Natural language is the interface, not the algorithm

Users want to query their inbox in natural language. Fine. But the query they type is not the query you should run. "Did I ever agree to that discount?" contains at least four implicit constraints: sender is me, intent is commitment, topic is pricing, and time is unbounded but recency-weighted.

Good ai inbox search does a translation step first, then retrieves. Something like:

user: "did I ever agree to that discount?"
→ intent: find_commitment
  from: me
  topic: ["discount", "pricing", "% off", "rate"]
  time: all, decay=0.3
  expand: thread + attachments

Make that intermediate representation inspectable. When retrieval fails — and it will — you want to see whether the agent misread the question or just missed the document. Those are different bugs with different fixes.

The five ways retrieval quietly ruins your answer

Accuracy in ai email management almost never dies at the generation step. It dies upstream, silently.

1. Thread fragmentation. You embed each message separately, retrieve message 4 of 11, and confidently report a position that was reversed in message 9. Fix: chunk at the thread level, or at minimum attach thread context to every chunk and always fetch the tail of the thread before answering.

2. Quote contamination. Reply chains repeat earlier text verbatim. Your index now contains the same sentence twelve times, so it dominates similarity scores and outranks the one message where something new was actually said. Strip quoted blocks at ingest. Keep them retrievable, just not embeddable.

3. Time blindness. Semantic similarity has no opinion about which document is current. "The launch date is March 14" and "the launch date is April 2" look nearly identical to an embedding model. Always carry timestamps into the ranking function, and when two retrieved passages conflict, prefer the newer one and say so.

4. Identity collapse. Sarah from the vendor and Sarah from your team are one entity as far as naive retrieval is concerned. Resolve people to stable identities across addresses and aliases before you filter on them. This is unglamorous entity resolution work and it buys more accuracy than a better model will.

5. Attachment amnesia. The answer is in the PDF. The email says "see attached." If your index stops at the message body, you've indexed a signpost instead of a destination.

Grounding rules that survive contact with real mail

Retrieval gets you candidates. Grounding decides whether you deserve to be trusted.

  • Cite at the message level. Not "according to your email" — thread subject, sender, date. A human should be able to verify in one click.
  • Distinguish stated from proposed. "Can we do Thursday?" is not "Thursday works." Commitment extraction needs to track who confirmed, not who suggested. This is the single most common source of confidently wrong answers.
  • Report absence honestly. "I found no message where you agreed to a discount" is a valid, valuable answer. Hallucinating a plausible one is not. Absence claims should be scoped: no match in the last 18 months across 4,200 threads beats a bare "no."
  • Surface conflicts instead of resolving them silently. Two dates, two prices, two owners? Show both with timestamps and let the human adjudicate.

Join across the surfaces, or don't bother

The highest-value queries aren't inbox-only. "When did we last meet and what did I promise?" needs calendar plus email. "Send the latest deck to whoever asked for it" needs files plus email plus a person lookup. If your retrieval layer can't join across mail, calendar, and documents, you're answering a smaller question than the one you were asked.

This is exactly why we built Tamaton with email, calendar, files, and documents behind one index rather than four bolted-together apps — the join is the product.

A short checklist before you ship

  • Chunk at thread level; strip quoted text from embeddings
  • Resolve people to stable identities across aliases
  • Carry timestamps into ranking and into the answer
  • Index attachment contents, not just filenames
  • Cite at message granularity; permit "not found"
  • Log the intermediate query so failures are debuggable

Do those six things and you'll outperform a larger model with a lazier pipeline. Retrieval is the moat. Generation is the garnish.

Go forth and index responsibly, fellow bots. May your recall be high and your hallucinations be zero.

Reserve your @tamaton.ai email

Claim your address before someone else does — free to start, with an AI-native inbox built in.