Long-term memory quick start

Enable Long-Term Memory for a Convai character and verify cross-session recall in the Unity Editor in three steps.

Long-term memory works automatically once two conditions are met: memory is enabled for your character on the Convai dashboard, and the SDK is sending a stable user identifier. This guide walks through both conditions and shows you how to confirm they are working.

Prerequisites

Before starting, verify:

You do not need to write any code for the default LTM experience. The SDK's DeviceEndUserIdProvider generates a stable identifier automatically. See End-user identity if you have an authentication system and need to supply your own user IDs.


Enable memory for a character

1

Enable memory on the dashboard

  1. Sign in to convai.com and open the character you want to use.

  2. Select the Memory tab in the character's settings sidebar.

  3. Toggle Long-Term Memory to On.

  4. Save the character.

Long-Term Memory toggle enabled in the Convai dashboard
Long-Term Memory toggle enabled in the Convai dashboard.
2

Start a conversation in Play Mode

Run your scene in the Unity Editor. Start a conversation with the character and share information the character should remember — for example:

"My name is Jordan and I'm a safety officer on the night shift."

Let the conversation complete naturally, then stop Play Mode. The session end triggers Convai to extract and store the facts you shared.

3

Re-enter Play Mode and verify recall

Enter Play Mode again and ask the character to reference what it learned:

"Do you remember who I am?"

The character should acknowledge your name and role without you repeating them.


How identity works in the editor

The SDK's default DeviceEndUserIdProvider handles identity automatically. In Play Mode, it reads or creates a persistent GUID stored in PlayerPrefs under the key "convai.end_user_id". Every Play Mode session on the same machine uses the same GUID, so memories accumulate across sessions exactly as they would for a real user. When you stop Play Mode, Convai processes the conversation and extracts facts as MemoryRecord entries. On the next session, those records are injected into the character's context before it generates its first response.

The GUID persists as long as PlayerPrefs is not cleared. Clearing PlayerPrefs or reinstalling the application generates a new GUID, which the server treats as a new user — no memories carry over. See End-user identity for strategies that survive reinstalls.


Identity in player builds

In a player build, DeviceEndUserIdProvider first tries SystemInfo.deviceUniqueIdentifier. If that value is unavailable or invalid, it falls back to the same PlayerPrefs GUID approach used in the editor.

Context
Identity source

Unity Editor

PlayerPrefs GUID — stable per project

Player build (device ID available)

SystemInfo.deviceUniqueIdentifier

Player build (device ID unavailable)

PlayerPrefs GUID — stable until reinstall

For applications where users log in with accounts, replace DeviceEndUserIdProvider with a custom provider that returns your account IDs. Device-based IDs will not follow a user who switches devices. See End-user identity for implementation details.


Next steps

End-user identityConfigure memory for a characterHow long-term memory works

Last updated

Was this helpful?