Shipped app feature · engineering case study
StreakUp Companion: An AI Chatbot with On-Device Memory
Inside Pip’s reading advice: how a mobile chatbot selects context, remembers a user’s words, and accounts for the cost of a checked reply.
My role Companion interaction design, mobile memory architecture, and evaluation of response quality and cost.
What should Pip know about tonight?
“Okay, help me read one page tonight.” In a synthetic conversation rendered in the app’s chat screen, Pip knows the reading goal has 14 completions and that the last one was four days ago. Its reply suggests picking up a book for one page. The count matters because it lets Pip acknowledge something this reader has already done.
That count comes from the habit tracker. A saved remark about when someone likes to read would come from a different source. Keeping those sources separate is one of the most consequential decisions in the companion’s design.
Who decides what reaches the reader?
Pip can suggest reading one page. Only a check-in from the habit tracker can add that page to the record. The phone supplies the facts, the model proposes words, and the backend decides whether those words can reach the reader.
Reply architecture
How a reply earns its place in chat
A reader asks for one page tonight.
- PhoneAssemble context
The current message travels with a fresh goal snapshot, recent dialogue and any selected memories.
- Input gateCheck the request
The request passes screening. The input assessment finds a relevant habit question.
- ModelDraft a reply
Pip drafts a small next step using the reading record.
- Output gateCheck the draft
The service screens the words and evaluates the draft against the supplied context.
- ChatRelease decision
After final authorization, the app receives the checked reply.
The reader asks Pip for a film review.
- PhoneAssemble context
The phone sends the new request with its bounded context.
- Input gateCheck the request
The request is harmless, but the assessment finds it outside the companion’s scope.
- ModelDraft a reply
Skipped. The service chooses a prepared response for an off-topic request.
- Output gateCheck the draft
Skipped. There is no generated draft to review.
- ChatRelease decision
The app can show the scope notice and leave the conversation open.
A draft credits the reader with an unrecorded check-in.
- PhoneAssemble context
The goal snapshot contains the recorded completions.
- Input gateCheck the request
The reading request passes the input assessment.
- ModelDraft a reply
In this example, the draft introduces a completion the records do not support.
- Output gateCheck the draft
If flagged as unsupported, the service drafts once more from the original context and runs every output check again.
- ChatRelease decision
A passing rewrite can be released. If the second draft still fails review, the service withholds it and returns a fixed notice.
The input assessment distinguishes a relevant request, a question that needs clarification, and a harmless change of subject. Those decisions give the interface different ways to respond. On the way out, both content screening and a contextual assessment can stop a draft. If a required review is unavailable, the service returns an error and keeps the unchecked draft out of chat.
The special case is an unsupported answer. It gets one fresh draft using the originally assessed context. The rejected text stays out of the rewrite prompt. Both attempts share the same reservation, and a passing draft still needs a final release decision. This bounds the retry cost and keeps an interrupted request from silently sending a second answer.
What goes into a reply
Current progress. The app refreshes the goal snapshot on each send. A new check-in can therefore inform the next reply even if an earlier message describes a missed day.
Conversation and memory. Recent messages carry the immediate exchange. When optional memory is enabled, a separate retrieval step can select relevant, dated quotes from the user. Eligible quotes retain their source turn. Pip’s own suggestions never become evidence that the user did something. For example, asking someone to read tonight must leave their completion count at 14 until they check in.
The phone and the provider. A small MiniLM model on the device helps match a new message to stored quotes even when the wording changes. Keyword matching provides a fallback. Adults 18+ choose whether to share the displayed context for cloud processing. They can inspect and delete saved memories in the app. Local retrieval avoids a separate embedding API request, while selected context still contributes tokens to the hosted reply.
Testing what memory brings back
I calibrated the on-device matcher with eight ways of restating a remembered fact and 64 unrelated pairs. Lowering the similarity cutoff recovered one more paraphrase. Two still escaped retrieval.
Each mark represents one paraphrase pair. At the lower cutoff, zero of 64 unrelated pairs qualified.
These fixtures helped choose a setting. They were too small to estimate accuracy across users or languages. They also illustrate a limit of similarity itself: “I read every morning” and “I used to read every morning” can score closely while describing different routines. A dated quote and fresh goal data give the model evidence to handle that difference.
What a checked reply costs
For the October 2026 evaluation, I priced each provider-reported input and output token at the rate used for that run. The unit was a complete exchange: one user message, the checks before and after generation, and one delivered reply. Counting only what appears in the chat bubble would miss most of the work.
| Synthetic test sample | Exchanges | Calls across the sample | Model cost (USD) |
|---|---|---|---|
| Claude Haiku | 9 | 45 paid calls | $0.01201 |
| GPT-4.1 mini | 3 | 9 paid calls and 6 moderation calls | $0.00736 |
In the Haiku sample, each exchange involved five calls covering input screening and assessment, reply generation, then output screening and assessment. The nine exchanges used 101,409 input tokens and 3,740 output tokens in total. At that sample average, 1,800 similar exchanges would cost about US$2.40 in model usage. That is a workload projection using October rates. Longer conversations, retries, and hosting would change the total.
Across the wider synthetic campaign, logs with reported usage accounted for about US$0.17 in model tokens. An early seven-round pilot lacked token telemetry, so the complete bill is unknown. The two samples above also differed in size and workload. I use them to understand what each request path costs, rather than to rank the providers.
A design decision the tests informed
Saving a useful quote could have required a separate extraction call on every turn. Instead, the existing input assessment also flags whether the user’s words are eligible for memory. Storage waits for the checked reply and applies local filters. This keeps an extra cloud call out of the interaction and preserves the original words for the user to review.