Toronto, Canada  · 

Work / AI products

»

Streamed grant writer.

An LLM content generator that streams output over SSE as it writes, protected by a fail-closed prompt-injection guard and grounded against eligibility rules.

Stack
Gemini, Node.js, SSE
Scale
Production, multi-tenant
Role
Designed and built

Flow

  1. User brief
  2. Injection guard
  3. Constraint extraction
  4. Grounded prompt
  5. Gemini stream
  6. SSE to browser
  7. Draft

How it works

The user describes what they need in plain language. Before anything reaches a model, a guard classifies the input; if it looks like an injection attempt, the request fails closed rather than being sanitized and passed on.

A first pass extracts the hard constraints from the opportunity: word limits, required sections, eligibility language. Those become part of the grounded prompt so the draft cannot drift from the rules.

Generation streams token by token over Server-Sent Events, so the writer sees the draft appear as it is produced instead of waiting on a spinner. Length and structure are enforced as the stream arrives.

Hard parts

  • Streaming through a load balancer and a multi-tenant API without buffering or dropped connections.
  • Deciding what fail-closed means for a writing tool: refuse clearly, explain why, never half-answer.

Outcome

Became the most-used feature on the platform. Drafts arrive in seconds and stay inside the rules of the opportunity they are written for.