Teaching a companion to remember, within budget
I built the long-term memory of our AI companion app, chose its model by comparing candidates on test scenarios for correctness, speed and cost, and kept its realtime sessions within their context and cost limits.
- Situation
Bumi, our AI companion app, talks to users in chat and in realtime voice and video calls. The companion forgot what was said in earlier conversations, and long realtime sessions were expensive.
- What I did
For memory, a model call with structured output folds new messages into the companion's memory and a shared user profile:
- a correction replaces the old fact, a resolved topic is closed, and what belongs to one companion stays out of the shared profile
- saves only go through if no other update changed the memory in the meantime, so parallel updates never lose or duplicate facts
- an evaluation harness runs the production call on test scenarios and compares models on passed checks, latency and cost
For the realtime sessions, language-aware token estimates keep memory, summary and recent messages within the instruction limit, and the conversation is truncated so the model stops re-reading whole calls while the prompt cache stays warm.
- Outcome
The companion keeps what users tell it across conversations, the model choice rests on measured quality, latency and cost, and long calls no longer grow the bill without limit.
Asana RebelMulti-App Strategy & AI-Native Engineering