Detect automated senders from headers first, AI only as a fallback
Why
Newsletters and no-reply senders identify themselves in the email headers. Reading them costs nothing and covers around 95% of cases, so the model is only called for the genuinely ambiguous ones. Those emails are still embedded into Pinecone as context, and only draft generation is skipped.
Trade-off
A hand-written heuristic to maintain as senders change how they label themselves.
Separate Pinecone namespaces per retrieval purpose
Why
Context and feedback answer different questions. Keeping them apart is the difference between a draft informed by how you write and a draft drifting towards what you already rejected.
Trade-off
More namespaces to manage, and every new signal type needs a deliberate decision about where it lives.
A rule builder and a chatbot, not one or the other
Why
People who know exactly what they want should not have to negotiate with a chat, and people who do not should not have to learn a form. Both surfaces produce the same rule, so the choice is about comfort rather than capability.
Trade-off
Two interfaces over one model: every change to what a rule can do has to land in both, and stateful multi-turn conversations are far harder to test than a form.
Parallelisation and caching over a heavier AI framework
Why
The response time users feel comes from how many model calls run at once and how many are avoided entirely. CompletableFuture parallelisation, batching and a lazy cache for importance evaluation moved the numbers; an extra abstraction layer would not have.
Trade-off
More concurrency to reason about, and caching means being explicit about when a stale verdict is acceptable.
EU-hosted analytics and infrastructure from the start
Why
Email content passes through the system and the customers are European. Choosing EU-hosted services while the codebase was small made data residency a setting rather than a migration.
Trade-off
A narrower set of providers to choose from, sometimes at a higher price.
~95%
of automated senders identified from email headers alone in testing, at zero token cost
Gmail · Outlook
Both providers supported through a per-account model, each with its own OAuth2 flow
Idempotent
A webhook pipeline keyed so that repeated deliveries cannot produce a second draft, label or vector
2 paths
A rule builder and a conversational assistant writing to one automation model