work/reflecta

Solo build · in production for evaluation

Reflecta

A short weekly phone call that checks in on how someone is doing and turns it into a summary for their therapist. Every call is saved exactly once, even if it's reported twice; safety phrases are checked with fixed rules before any AI model runs; the analysis falls back through three options so a provider outage never loses a call; and past calls are searchable so each summary can build on earlier weeks.

Reflecta screenshot

Problem

A voice check-in is only useful if everything after the call is reliable. The voice provider may report the same call twice, an AI provider may be down, and a safety warning can't wait on an AI model producing the right output.

Remembering earlier weeks has to come from the saved transcripts of past calls, not from the AI model "remembering". That means storing the calls in a searchable way, not just writing a longer prompt.

Constraints

The voice provider (Bolna) doesn't sign its callbacks, according to its current documentation. So the app checks a shared secret in the URL, has signature checking (HMAC) ready in case Bolna adds it, and logs which servers are calling in (enforcing that is the hosting layer's job).

The safety check has to run on the raw transcript, before and separately from any AI analysis, and it has to cover Hindi and Hinglish phrases written in English letters.

Very short or empty transcripts shouldn't be sent to the AI providers at all. A word-count check returns a default result instead.

How it works

Receive callSafety checkAnalyseIndexReport

1. Receive the call. When a call ends, Bolna sends the details to the app. The app checks the secret, then saves the call and its transcript. If the same call arrives twice, it updates the existing record instead of creating a duplicate, and if the call is already marked complete, it stops there. That's what makes a repeated callback harmless.

2. Safety check. The transcript is checked against phrase lists that sort a match into "critical" or "elevated". This can raise the call's risk level even if the AI analysis later says everything is fine, or doesn't run at all.

3. Analyse. The app first asks Groq for a structured summary. If that fails it tries Hugging Face, and if that fails too it falls back to simple rules.

4. Index. Each call is turned into a searchable fingerprint (an embedding, using the nomic-embed-text-v1 model) and stored in Postgres with pgvector, so later summaries can pull in what was said in earlier weeks. It uses the model's recommended labels for "stored document" versus "search query", which makes those lookups more accurate.

How I made it reliable

Three parts fail independently of each other: saving the call (safe to repeat), the safety check (fixed rules, runs before any AI), and the analysis (three providers in turn, ending in simple rules instead of an error).

When the AI analysis works, it pulls out structured details: stress, mood, sleep, work pressure, a burnout-risk score, overall sentiment, key concerns and risk factors. Any of these can be left empty. If the model doesn't return them, the app leaves them blank rather than inventing numbers.

I don't measure quality by how many fields get filled in. The questions I test are: does the safety check still catch crisis phrases when Groq is down, and does a repeated callback leave exactly one copy of the call?

Known failure modes

  • The safety check uses phrase lists, so it can miss things

    The list catches direct statements about self-harm, including common Hindi and Hinglish phrasings written in English letters. Indirect or unusual phrasing will slip through. That's why it can only raise a call's risk level, never lower it, and why I don't present it as a complete detector.

  • The voice provider's callback security is weak

    The voice provider (Bolna) proves its callbacks are genuine with a secret in the URL. If that URL ever leaked into logs, someone could replay it. I've built signature checking (HMAC) ready for when Bolna starts sending signatures. Until then, the real protection is limiting which servers can call in, which the app can only log, not enforce by itself on its current host (Vercel).

  • The last-resort fallback isn't real analysis

    If both AI providers (Groq and Hugging Face) fail, the app saves a mostly empty result instead of making up a report. Any dashboard that showed that as a "score" would be misleading, so the interface has to treat a low-confidence result as unusable.

What I would do differently

  • Add a second safety check, a small classifier that still follows fixed rules and runs on the device, without ever letting an AI model be the one that decides.
  • Recognise repeated calls by their content as well as their ID, in case Bolna ever sends the same call again under a new ID.

Stack

  • Next.js
  • Bolna
  • Groq
  • pgvector

Links

Looking for AI engineering work — Bengaluru or remote, can start immediately. Get in touch.