System architecture overview
Cat health monitoring with structured daily records and natural-language conversations as entry points. The system turns expressions such as “he’s been squinting since the weekend, and he threw up twice yesterday” into a structured longitudinal health record; tracks symptom courses across days; identifies urgent situations; reorganizes those courses daily using the latest observations; and produces a report for veterinarians.
Status. TestFlight within a small group.
Stack. React Native / Expo (TypeScript) client; PostgreSQL (Supabase) with row-level
security; LLM access through a server-side gateway; nightly reasoning driven by pg_cron.
Benchmark. Recorded tests of what the system records, organizes and reasons over across days. See the results.
rec_NNNNNN) is what
retrieval hands to the model, what the model cites back, and what cross-module references use — identity
stays stable across turns, across days, and across the client/server boundary.
The core entity holds both a single-day observation and a multi-day episode, distinguished by lifecycle state — a course is what a day becomes, not a different kind of object.
active → passive → closed, plus
dormant) use model-proposed horizons clamped by floors the model cannot
override: a minimum observation window, and a rule that a chronic course may go passive but
never auto-closes.
One message can need an answer now and a reliable record for later. Tamo first retrieves from the Digital Twin; reply and recording then proceed concurrently along separate paths.
When a message needs recording, background extraction in the App can run alongside the reply. The reply can use the owner's words from this turn and existing records, but neither waits for nor reads the structured results extracted in this turn.
The diagram's “Write” includes validation and deterministic routing after extraction; the model does not write directly to the Digital Twin. When time is unknown, the system preserves that uncertainty rather than guessing a date.
Occurrence and onset are separate questions: “is it happening today?” and “since when?” A current observation can have an earlier onset. The nightly server-side round is a later, distinct loop that organizes committed observations into courses.
| loop | period | job |
|---|---|---|
| turn | seconds | extract, route to ledger, retrieve, respond |
| round (review) server-side, per pet-local day | nightly | organize the latest observations into courses; emit a diagnosis frame (current + append-only log);
adjudicate leftover ambiguous entries; run lifecycle transitions; seed tomorrow’s follow-up
agenda (idempotent, catches up missed dates; concurrency guarded, failures retried without being marked complete) |
| longitudinal | weeks–months | periodic recalibration of each animal’s normal daily habits, version-to-version drift, assessment staleness (§5) |
Each animal has a versioned normal-activity profile — its own steady state (stool frequency and form, intake, activity) — archived exactly once per re-measurement session, so two versions can be compared.
It is deliberately not a per-day comparator. Daily judgment runs on discrete rules with no “normal range” and no weighted deviation score; an earlier design that scored each day against a fitted normal was abandoned. Two scoped exceptions survive:
The profile’s real job is longitudinal: version-to-version drift — continuous fields at ≥30%, food ≥25%; ordinal fields by rank distance.
Drift feeds the persisted health assessment, which is keyed by a hash over its own inputs — and those inputs are restricted to the persistent portrait: banded age rather than exact, chronic background rather than active courses, long-term medication, the profile and its drift. Nothing transient enters, so the hash does not churn daily. There is no “refresh the assessment” code path at all:
re-measuring archives a version → drift becomes computable → the hash changes → the assessment reads as stale and offers regeneration, user-triggered rather than silently spending a model call.
Staleness is a derived property, not an event someone has to remember to fire.
Each reply dynamically assembles context for that turn: recent dialogue rolls forward, and records relevant to the current conversation are retrieved from the Digital Twin as needed. Dynamic working memory stores questions awaiting answers or clarification. The Digital Twin also selectively supplies long-term, stable health background.
New observations enter the longitudinal record only after the recording path has processed them; this turn’s reply uses previously committed records.
pet_id to
pets.id and requires pets.user_id to equal the signed-in account.