← All use cases
The scenario
Once writes are scoped per user, the scope is worth more than isolation. It is a
profile — and two calls turn it into product features without you assembling
anything.
Step 1 — The profile, as data
Step 2 — The same profile, as a prompt block
Budgeted server-side, so a heavy user cannot quietly blow your prompt.
Step 3 — Ask a question about that person
The response names the model that answered — which is what the call’s credits
were billed at, so it is worth logging rather than discarding.
Evals
- Record three facts about one user, then read the profile. All three present.
- Request the block form with a small budget and confirm it truncates by
dropping whole memories, not mid-sentence.
- Ask about a user nobody has written about.
memory_count is 0 and that is
not an error — a user is a scope tag, not a resource you register.
Guardrails
memory_count is non-monotonic. Consolidation merges related memories, so
the number can fall while the system knows strictly more. Never show it to an
end user as “things we know about you”, and never alert on it dropping.
- A profile is personal data. Whatever goes in is retrievable, exportable
and — when someone asks — deletable.
- An unknown user returns an empty profile, not a 404. Handle the empty
case; do not treat it as a failure.
The script
Complete and runnable:
user_profiles.py.
Prerequisite: Support agent that knows each customer.