Identify the user: memory and conversations that continue
Tell the SDK who is signed in, let the agent remember them across chats, calls and devices, pick up the conversation where it left off, show and erase what is remembered, start a new conversation, and sign out — on every platform.
With one identifier — the trait your Who is the user? setting names — the agent knows the signed-in user on every surface: it remembers them across conversations and devices, the chat opens where they left it, and calls can be booked for them. Without one, every conversation is anonymous: nothing is kept, and nothing is shared between people.
What it needs in the dashboard
| Where | Setting | Value |
|---|---|---|
| Agent → Memory → Settings | Remembers users across chats and calls | On |
| Agent → Memory → Settings | Who is the user? | User ID (user_id, the default), Email, Phone number, or Custom field with your trait's name (for example customer_id). The same on every agent the user talks to |
| Agent → Memory → Settings | Devices per user | 1 to 5 (2 by default): how many installs can act as one user |
| Agent → Memory → Settings | Shared with, Keep memories for, What to remember | This agent or the whole workspace; how long (365 days by default); what to keep and what never to |
Memory → People is where your team later finds a user, sees what is remembered, forgets it and resets their devices.
What to do, in order
- After sign-in, call
identifywith the identifier under the field's name, plus any traits the prompt can use (name,plan). Pass the user's memory choice if your app asks for one. It applies to the next conversation. - Talk or chat. → The agent knows the user's name (a prompt variable) and, with memory on, what it learnt before.
- Come back later — the same day, on another of their devices. → The chat opens on the earlier messages (the last 50 with that agent, kept 7 days after the latest) and the agent carries on; a call starts with its greeting but knows what was said.
- Show what is remembered with
memories(); erase it withforgetMemory(), which also clears the chat on screen. - Start over with
newConversation()(or New conversation in the chat's header): a fresh thread; the memories stay. - On sign-out, call
identify(null). The device is released from the user and later conversations are anonymous.
The identifier is never a prompt variable. Graine stores the identifier your app sends so your team can see who each conversation was with — Call History shows User ID · u_8812 — and the memory service only ever receives a one-way key derived from it. Every other trait is masked on the device before it leaves it.
The code, platform by platform
1. After sign-in:
→ graine.memoryChoice is the user's stored choice (true unless they turned it
off). memory: nil keeps the stored one.
4. What is remembered, and erasing it:
5. A new conversation:
Turn memory off for this user (a privacy screen):
GraineInApp.shared.setMemory(false).
6. On sign-out:
What you'll see
| Moment | In your app | In the dashboard |
|---|---|---|
The first conversation after identify | The agent uses the name you sent | Call History shows User ID · u_8812 (or your field's name) |
| The user comes back within 7 days | The chat opens on the earlier messages, a date line where the day changes, an earlier call as one Voice call row; no second welcome | — |
forgetMemory() succeeds | The chat on screen empties | Memory → People shows nothing for the user |
| A device past Devices per user | It works, anonymously: no memory, no booking for the user | Memory → People → Reset devices frees the slots |
Troubleshooting
| What you see | Why | Fix |
|---|---|---|
| The agent does not remember | Memory is off on the agent, the user turned it off, or identify used another field | Turn it on; check memoryChoice / memoryEnabled; send the field Who is the user? names |
identity_required | No identifier — or a placeholder such as guest, 0, unknown | identify with a real identifier first |
device_limit | This install is not one of the user's allowed devices | Sign out on another device, raise Devices per user, or reset the user's devices |
| The website and the app are two people | A different field or value on each | The same Who is the user? field, and the same value, on both agents |
| The chat does not show earlier messages | Anonymous, memory off, more than 7 days, or the Garage hides Earlier messages | Identify the user; Chat window → Earlier messages on |
The rules in full: Identity and users · Memory · the variables the traits become: Variables.

