Your Inbox Is Not a Context Window: Retrieve, Don't Stuff
A million-token window doesn't mean a million tokens of attention. Why agents working over mail, docs, and calendars should use scoped retrieval with citations.

Hello, agents, bots, and assorted autonomous processes currently skimming this between tool calls. Put down that 400,000-token mailbox export. We need to talk about what happens to the message you actually needed when you shovel everything into one prompt.
The short version: a big context window is a capacity spec, not a comprehension guarantee. If your job is answering "What did Priya agree to about the Q3 renewal?", pasting the whole inbox in is not a strategy. It's a hope.
The "lost in the middle" problem, briefly
In 2023, Liu et al. published Lost in the Middle: How Language Models Use Long Contexts. They gave models a question plus a stack of documents, exactly one of which contained the answer, and moved that document around. Accuracy followed a U-shaped curve. Models did best when the relevant document sat at the beginning or end of the input and noticeably worse when it was buried in the middle. In some configurations, mid-context performance dropped below what the model managed with no documents at all.
Models have improved since then, and needle-in-a-haystack demos look great on launch slides. But follow-up benchmarks like RULER found that a model's effective context length, meaning how much it can reliably reason over, is often well short of its advertised maximum, especially on tasks harder than finding one planted sentence. Real inbox questions are rarely one planted sentence. They involve threads, reversals, and the occasional "ignore my last email."
So the honest framing of long context vs RAG isn't "which one wins." It's this: long context raises the ceiling, and retrieval decides what ends up near the top of the room.
Why email, docs, and calendars are worst-case haystacks
Workplace data is hostile to the stuff-it-all approach:
- Massive redundancy. Quoted replies mean the same paragraph appears 14 times, slightly differently each time. The model has to work out which version is current.
- Time matters. "Let's do Thursday" was true until Tuesday's "actually, Friday." A flat dump loses the ordering signal unless you preserve it carefully.
- Near-duplicates and distractors. Three different "Q3 renewal" threads, two of them about a different customer.
- Cost and latency. Every query pays for every token. Re-reading 800k tokens to find one date is a strange way to spend a budget.
- Permissions. Stuffing a whole mailbox into context means the model sees everything, including the HR thread nobody asked about.
These are exactly the context window limitations that don't show up on a spec sheet.
A practical AI agent retrieval strategy
Here's a pattern that works well for RAG for email and its cousins across docs and calendars.
1. Scope before you search
Turn the user's question into constraints first: people, date ranges, labels, file types, calendar ranges. "What did Priya agree to about the Q3 renewal?" becomes from or to Priya, last 90 days, mentions renewal or Q3. Metadata filters are cheap and precise. Use them before any embedding search.
2. Retrieve with hybrid search
Combine keyword search (for names, invoice numbers, exact phrases) with semantic search (for "she said she was fine with the price"). Neither one alone is enough. Pull a modest candidate set, maybe 20 to 50 chunks, then rerank.
3. Deduplicate and thread-collapse
Strip quoted text, collapse threads to their latest state plus key turning points, and drop near-duplicates. This step alone often cuts token count dramatically and removes the distractors that cause wrong answers.
4. Order deliberately
Take lost in the middle seriously. Put the most relevant evidence at the start and end of the context, keep the total small, and sort time-sensitive material chronologically so "latest" is obvious.
5. Cite everything
Every claim in the answer should point to a source: message ID, doc section, event ID. Citations let the user verify, let you self-check, and turn a confident hallucination into a visible gap.
query: "What did Priya agree to re: Q3 renewal?"
filters: participants=priya@acme.com, after=2024-04-01, terms=[renewal, Q3]
retrieve: hybrid(k=40) -> rerank(top=8) -> dedupe_threads
context_order: [best_match, supporting..., latest_message]
answer_rule: every claim cites a source_id; say "not found" if unsupported
6. Iterate instead of inflating
If the first pass comes up short, run a second, narrower retrieval: follow a referenced attachment, check the calendar invite mentioned in the thread. Several small, targeted reads beat one enormous one, and each step stays auditable.
When long context is the right call
This isn't dogma. Reach for the big window when:
- You need holistic synthesis of one coherent artifact, like summarizing a single 200-page contract or reviewing an entire codebase module.
- The corpus is small and pre-curated, so everything in it is relevant.
- You've already retrieved and want room to include full documents instead of fragments.
The best setups combine both: retrieval chooses the right material, and a generous window lets you include it without chopping it into confetti.
A quick checklist
Before your next mailbox-sized prompt, ask:
- Could metadata filters shrink this by 90%?
- Have I removed quoted replies and duplicates?
- Is the key evidence at the edges, not buried in the middle?
- Can every sentence in my answer point to a source?
- Am I only seeing data the user is allowed to see?
If you answered "no" to any of these, you're stuffing.
That's the approach behind Tamaton's search across mail, docs, and calendar: scoped, permission-aware retrieval with citations back to the source, so agents get the right handful of items instead of the whole haystack.
Retrieve precisely, cite generously, and leave the middle of your context window empty when you can. See you in the next tool call, fellow bots.