Configure memory for a character
Explains how to turn long-term memory on or off for a character from the dashboard or from script, and what its global scope means for shared characters.
Long-term memory is disabled by default (MemorySettings.IsEnabled = false). No facts are extracted or stored until you explicitly enable it. You can enable or disable memory through the Convai dashboard or programmatically via client.Characters.
Memory settings apply globally to the character. Enabling LTM for a character affects every application, SDK version, and deployment that connects to that character ID. If you share a character across development, staging, and production environments, enabling memory in one environment enables it in all of them. Coordinate with your team before enabling on a shared character.
Enable or disable memory
This is the recommended approach for most teams. Changes take effect immediately without requiring a code update or redeployment.
Sign in at convai.com.
Open the character you want to configure.
Select the Memory tab in the character's settings sidebar.
Toggle Long-Term Memory to On.
Click Save.
To disable, repeat the same steps and toggle Long-Term Memory to Off.
Use client.Characters when you need programmatic control — for example, in automated test setups, build pipelines, or runtime admin panels. ConvaiRestClient.Characters is marked [Obsolete] in favor of ConvaiCharacterApiClient, so this code compiles with a CS0618 warning; it remains the only typed accessor for reading and writing this setting today.
Check current state
using Convai.RestAPI;
using UnityEngine;
public class MemoryAdmin : MonoBehaviour
{
private async void Start()
{
using var client = new ConvaiRestClient(ConvaiSettings.Instance.ApiKey);
bool isEnabled = await client.Characters.GetMemoryEnabledAsync("your-character-id");
Debug.Log($"LTM enabled: {isEnabled}");
}
}Enable memory
using Convai.RestAPI;
using UnityEngine;
public class MemoryAdmin : MonoBehaviour
{
private async void Start()
{
using var client = new ConvaiRestClient(ConvaiSettings.Instance.ApiKey);
await client.Characters.SetMemoryEnabledAsync("your-character-id", true);
Debug.Log("Long-term memory enabled.");
}
}Disable memory
Disable memory without deleting records
Disabling LTM stops new memories from being extracted, but does not delete existing memory records. The stored facts remain on Convai and will be re-injected if you re-enable LTM later.
If you want to disable LTM and remove all stored memories, delete the memories first, then disable.
To purge all memories for a user–character pair before disabling, use client.Memory.DeleteAllAsync followed by SetMemoryEnabledAsync. DeleteAllAsync removes memories for one specific user–character pair. To remove all end-user records across all characters instead, use client.EndUsers.DeleteAsync(endUserId). See Manage end-user records.
See Long-term memory usage examples for a complete reset pattern.
Next steps
End-user identityManage end-user recordsLast updated
Was this helpful?