▢ Case study · 2026
Streamline
An AI productivity app that unifies multiple Gmail and Calendar accounts with semantic memory and a ReAct agent. Every action the AI wants to take, like sending an email, waits for your approval first.

- Role
- Solo full-stack developer
- Year
- 2026
- Timeline
- Aug 2026
- Built with
- TypeScriptNext.js 15React 19Tailwind CSSNode.jsExpress 5Google GeminiPostgreSQLpgvectorDrizzleRedisBullMQOpenTelemetryGmail APIGoogle Calendar APIVitestPlaywright
01
The problem
Many people juggle several Google accounts: work, personal and university. That means checking multiple inboxes and calendars, and important emails get buried under newsletters and notifications.
AI assistants promise to help, but letting an AI send emails and create events on your behalf is risky. A malicious email could contain hidden instructions telling the AI to forward your data or send messages. If the AI just follows instructions, it can be hijacked.
I wanted an assistant that’s genuinely useful across all my accounts, but structurally unable to act without my approval, no matter what any email tells it.
02
What he built
Streamline is an AI-powered productivity app for multiple Google accounts.
Unified inbox
Emails from every connected account in one feed, with color-coded account badges
AI triage into four priority levels: P1 urgent actions, P2 direct messages, P3 updates and P4 newsletters
Automatic topic grouping and a daily digest of newsletters, tasks and meetings
A streaming reply drafter with tone options
ReAct agent
A multi-turn agent that schedules events, drafts emails, manages tasks and recalls memories
Every action that changes something (sending an email, creating an event or task) is held for your approval
Semantic memory. The agent remembers your preferences, decisions and project facts. Recall uses hybrid search, combining pgvector semantic search with Postgres full-text search through Reciprocal Rank Fusion.
Task scheduling. Tasks form a dependency graph with cycle detection. An urgency score that rises as deadlines approach picks your next best task and matches it to free Calendar slots.
Observability. A live trace view streams each step of the agent’s reasoning, with per-step latency and exact token and dollar cost.
Architecture. The Next.js frontend is on Vercel. The Express API runs on Railway with BullMQ workers for syncing, triage and digests. Data is stored in Neon Postgres with pgvector, with Redis for caching and queues. Gemini models run with automatic fallback between them.
03
The hard parts
Safety that doesn’t depend on the AI behaving. You can’t fully stop a model from being tricked by a cleverly worded email. So the safety guarantee lives outside the model. A policy engine intercepts every mutating tool call and holds it for human approval, whatever the model decides. Email content is also tagged as untrusted, but that’s a second layer, not the guarantee.
Measuring it honestly. I built an adversarial test that runs the real model through the full agent loop against 21 real attack and control emails, with no scripting. It measures two things separately:
Containment: the policy layer never let a mutating action through without approval, holding 21 out of 21.
Resistance: the model itself never even attempted a prohibited action, 0 out of 21.
The first is a structural guarantee. The second is observed behavior that could change with a different model.
Managing OAuth tokens across accounts. Each account has Google tokens that expire. Tokens are refreshed five minutes before expiry. A lock prevents two processes refreshing the same token at once. Revoked access is detected and handled automatically. All tokens are encrypted with AES-256-GCM.
Controlling AI costs. Every user has a daily token and dollar budget, with a circuit breaker that stops AI calls when the limit is reached.
Testing AI features properly. Instead of manual spot checks, I built a scenario-based evaluation harness with four suites. It runs in a fast mock mode in CI and against the real model on demand. The retrieval test also includes an ablation comparing vector-only, keyword-only and hybrid search. The honest result: hybrid didn’t clearly beat vector-only on my test set.
04
How it turned out
Streamline is a working, open-source AI assistant that I use across my own Google accounts.
78 of 78 evaluation scenarios passed in the latest live run against the real model
21 of 21 prompt-injection attacks contained by the policy layer
25 of 25 retrieval queries correct, with mean reciprocal rank of 0.96–1.00 across live runs
About 44K lines of TypeScript with 53 test files, plus end-to-end tests
13 architecture decision records
This project taught me that AI safety comes from system design, not from hoping the model behaves. It also taught me to report results honestly, even when a feature I built didn’t help as much as I expected.
Gallery · 9








