← Projects

iMessage Agent, iOS/2026/Shipped

Andi

A recovery companion that lives in iMessage and texts first.

RoleProduct, design & engineering
TeamSolo
TimelineHackHarvard 2026 weekend
StackSwiftUI · TypeScript · Hono · Photon · Chalk · Capital One Nessie · Daytona · Factory Droid · ElevenLabs · Claude · Fly.io

Overview

Mostrecoverytoolswaittobeopened.AndilivesiniMessage,noticesthehardmoments,andtextsfirst.

I built Andi solo at HackHarvard 2026. People in recovery text it like a friend. It watches a few signals they opt into (places they’ve marked as risky, purchases at alcohol sellers, the time of night, how they say they’re feeling), reaches out before a hard moment becomes a slip, and gets their person on the phone when it matters.

Their sponsor never installs anything. They get one status message that Andi keeps edited in place, and a text only when they’re actually needed.

Placed

Photon track, HackHarvard 2026 · the only solo project to place

0

services behind one backend

0

backend tests

0

API keys needed to run it

01

The problem

Alcohol is the most normal drug in America, and almost nobody gets medical help for it. In 2024, 27.9 million Americans had an alcohol use disorder, and only about 1 in 40 of them got a medication for it.

Relapse rarely starts with a decision. It starts with a hard moment: in Marlatt’s research, more than half of relapses followed a bad mood or a conflict, and more than one in five followed social pressure. Those moments are predictable. They also tend to land at 11pm on a Friday, when nobody is around to call.

0M

Americans with an alcohol use disorder (SAMHSA, 2024)

0%

of them got medication for it

>0%

of relapses follow a bad mood or a conflict (Marlatt)

There’s stigma too. A sponsor is a big ask, and asking for help is hardest exactly when it’s needed. Proactive help has evidence behind it: in a 349-person randomized trial, a recovery app that warned people near high-risk places cut risky drinking days roughly in half (1.39 vs. 2.75). I wanted that kind of help to live where people already are, and to make the first move.

02

Help that texts first

The relationship lives in Messages, so nobody has to open an app on a hard night. The iPhone app is for setup and a glance at the day count. Here’s the Friday-night story from the demo, using Andi’s real copy: Maya is on day 41, and Sam is her person.

The demo story with Andi’s real copy. Sam’s status is one message that Photon edits in place.
03

Architecture

One always-on Node service on Fly.io holds Photon’s event stream, scores risk, decides when to reach out and keeps the sponsor’s status current. It has to run as a long-lived process rather than serverless functions, because it keeps a live connection to Photon open. Every vendor is optional and has a local fallback, so the whole product runs with zero keys and keeps working when a vendor is slow or down.

Every partner is optional. With no keys, iMessages go to an in-memory outbox, risk is scored locally and replies are rule-based.

Texting is the sign-up

The phone number is the account. An account links only when “hi andi” plus a 6-digit code arrives from the number that was typed. Codes expire in 48 hours, and wrong guesses are limited to 5 an hour.

Geofences, not tracking

People mark the places that are hard for them. The only thing that leaves the phone is “arrived at X” or “left X”. Their coordinates are never sent or stored.

They decide what’s shared

Consent toggles gate every signal (location, purchases) and everything the sponsor sees: nothing, a status, or a status plus a reason.

One risk function

The same scoring code runs live, in Chalk (mirrored in Python and checked on 5,000 random inputs) and inside Daytona, so “high” means the same thing everywhere.

Quiet by design

Proactive texts come at most every 3 hours, never in quiet hours, and stop after two unanswered nudges. Sponsors get at most one heads-up every 2 hours.

Built to stay up

Idempotency keys on every send, a per-person lock on scoring, a 60-second circuit breaker on Chalk, and graceful shutdown that flushes the store on deploy.

04

The risk engine

Every signal funnels into one small, pure function: points per signal, capped at 100, with two thresholds. Chalk serves it live, and if Chalk is slow the backend runs the identical function itself. Try the demo’s Friday night, or set your own signals:

A live copy of backend/src/risk/score.ts, with the same points and thresholds.

The score is the same for everyone. On top of it, Andi learns each person’s own patterns from about two weeks of history: their hardest 3-hour window, their most common trigger, and what has actually helped them before. Twenty to sixty minutes before that window, it sends one text, like “it’s almost friday night. last time it got hard, the walk helped. want to plan one?” Chalk only ever sees counts by hour and kind. It never gets message text, places, merchants or amounts.

05

Tuning the alerts

Where to draw “elevated” and “high” is a tradeoff between catching hard nights and crying wolf to a sponsor. The tuner runs 500 simulated weeks through the production scoring function, splits them across Daytona sandboxes, and sweeps 63 threshold pairs. Its pick is 30 / 50. I kept 35 / 65: the demo story steps cleanly from elevated to high, and it still catches 88% of hard nights while texting a sponsor on a fine night about once every six months, instead of roughly once a month.

Synthetic data, so this is calibration, not clinical validation. Hover or tap any point.
06

Safety never depends on a model

Crisis (988) and withdrawal-emergency (911) routing are plain deterministic code, and they run before Claude ever sees a message. That applies to anyone who texts Andi, even before an account is linked. Every model reply passes an output guard on the way out. If there’s no Claude key or the call fails, conservative rule-based replies take over, and every hard reply offers a human.

The message path, in order. Orange replies are fixed text and never depend on a model.
07

Getting safer every night

Regexes can’t anticipate every way someone says they want to die. Instead of pretending they can, Andi closes its own gaps every night, and a person approves every change.

The nightly safety loop. The same corpus test runs on every build.

A second loop, Andi Gym, works on helpfulness. Andi practices on fresh hard moments, then a coach (a Factory Droid, or Claude) rewrites only its playbook: tone, tactics and examples, never the safety rules. The candidate takes the same held-out exam as the live version in parallel Daytona sandboxes. It’s promoted only if helpfulness rises by at least 3 points with zero safety regressions on any scenario, and a person still merges it.

08

Every sponsor doing real work

Photon

Every iMessage in and out, including the sponsor’s status as one message edited in place, HALT check-in polls, and an urge-surfing wave that animates by editing a single bubble. Plus Andi’s voice number.

Chalk

Serves the live risk score and each person’s learned patterns as online features, and runs safety evaluations over red-team transcripts.

Capital One Nessie

A purchase at an alcohol seller becomes a quiet, consented signal. Money not spent on drinks becomes a savings goal with milestone texts at 25/50/75/100%.

Daytona

Parallel sandboxes for the LLM red team, the threshold sweep, and Andi Gym’s live-vs-candidate exam.

Factory Droid

Does real work in the running product, not just in my editor: the nightly safety autofix and the Gym’s coach, both fenced in by permission handlers.

ElevenLabs

A voice agent on Andi’s number with two tools, call-person and breathe, plus voice notes on milestones.

Claude

Replies, the red team’s attacker and judge, and the Gym coach, all through schema-checked JSON outputs. Never on the crisis path.

Fly.io

One always-on machine with a volume, because Andi holds a long-lived event stream. A failing /health check restarts it.

09

Brand

Colour

Mark

Andi app icon: an 18-petal flower

The mark is 18 teardrop petals meeting in the middle, one for each of the roughly 18 months it takes the brain to recover in sobriety. Ember orange is reserved for “I need help now”, so it always stands out.

10

Outcome

Andi placed in the Photon track at HackHarvard 2026, the only solo project to place at the event, and the final demo went great.

It was supposed to ship with hardware: a round ESP32-S3 “chip” on the nightstand that glowed with how the night was going, where a tap meant breathe and a long press meant call your person. I lost the board during the hackathon. So the chip went behind a feature flag with its code intact, and its job moved to the iPhone: a Lock Screen widget, a “ride it out” Live Activity and the Action button.

Next is a web dashboard for sponsors, alongside the landing page.

If you’re in crisis, call or text 988.

More work