Blog

Deleting a user from an AI memory

Users can ask for their data to be erased, and sooner or later one of your customers will pass such a request on to you. For an AI product with a memory, “delete this user” reaches further than the list of memories you see on screen. This article goes through what belongs to a user in an AI memory, the difference between archiving and deleting, and how permanent deletion works in CrystalBrain. It describes the product and is not legal advice.

Data that belongs to a user

The memories are the visible part. A memory layer that has run for a while holds more about each user, and a deletion that leaves any of it behind is incomplete.

  • Memories and their previous versions. Editing a memory keeps the text it replaced. A sentence the user asked you to correct last month is still there as an earlier version.
  • Files and their passages. A file attached to a user’s brain exists twice: as the file in storage, and as the passages it was cut into for search.
  • Embeddings. Every memory and every passage has a vector computed from its text. A vector left behind after its text was deleted is still derived from that text.
  • Search logs. The log of what the AI searched for contains the questions asked on the user’s behalf and the memories that were returned.
  • Everything else keyed on the user. In CrystalBrain that means the user’s brains, web pages and saved prompts, the tool calls and skill mentions apps reported for the user, the contradictions and check runs of its brains, and its group memberships.

If you build your own memory, the list is worth writing down while the schema is small. Each new table that carries a user ID adds a line to it.

Archive and permanent deletion

CrystalBrain has two actions on an end user, and they answer different requests. Archiving a user stops the AI from using it. The API and MCP refuse an archived user, and it leaves the user switcher. All its data is kept, and Restore brings the user back as it was. Archiving fits a customer who left and may return, or a user you want to pause.

Permanent deletion removes the user and everything listed above, and nothing can bring it back. It fits an erasure request. Archiving does not fit one, because the data still exists.

End userAcme · cus_123
ArchiveDelete permanently
AI accessRefusedRefused at once
DataKeptDeleted after 7 days
UndoRestore, any timeCancel within 7 days
WhoOwner or editorOwner, or an API key
The two actions on an end user compared on four points.

The two steps

The request

On the End users page, the workspace owner clicks Edit next to the user. The user’s page has a Delete permanently section, which only the owner sees. To confirm, the owner types the user’s name, then clicks “Delete permanently in 7 days”. The same request can be sent through the API with DELETE /api/v1/user?user=, which asks for no confirmation. It cannot be made through MCP, so an AI in a conversation cannot delete a user.

Access closes at that moment. The API and MCP refuse the user with the code USER_DELETION_PENDING. The user leaves the switcher, the Users table and the list of users the API returns, and appears in a separate list, Scheduled for deletion, with the date on or shortly after which its data will be deleted. If the user had opened brains to groups, the members of those groups stop reading them.

The purge

A job runs every night. At its first run once seven days have passed since the request, it deletes the user. It removes the user’s files from storage first, then deletes every row that belongs to the user in one database transaction, so the rows are deleted together or not at all. Previous versions go with their memories, passages go with their files, and embeddings go with the rows that hold them. If the job fails for a user, that user stays scheduled and the job tries again the next night.

Day 0Request
Access closed at once
Until the purgeScheduled for deletion
Cancel deletion is possible
After 7 days, at nightPurge
Files, then all rows. A log line is written.
The two steps of a permanent deletion and what is possible between them.

The 7-day delay

A deletion that cannot be undone needs protection against mistakes, and the mistakes are ordinary ones: the wrong row clicked in a table, a script that sends the wrong ID, a request that the customer withdraws the next day. Typing the user’s name guards against the first. The delay guards against the others.

The delay does not leave the data in use while it runs. From the request on, the AI cannot read or write for that user, so for the person concerned the product has stopped using their data on day 0. During the seven days the data is still stored, which is what makes it possible to cancel.

Cancelling

Until the purge, the owner or an editor can click Cancel deletion next to the user in the Scheduled for deletion list, or send POST /api/v1/user/restore with the user. Nothing was deleted, and the API and MCP accept the user again. A user that was archived before the request stays archived after the cancellation and has to be restored separately. Deleting an end user gives the steps for both directions.

Records kept after the purge

Two things remain after the purge, and neither contains what the user said.

  • A deletion log. One line with the user’s former internal ID, the date of the request, the date of the purge, whether the request came from the dashboard or the API, and how many items of each kind were deleted. It has no names and no content. You can use it to show that a deletion was carried out and when.
  • The monthly tracked-user counts. For each month in which the AI read or wrote for the user, the user stays counted in that month’s tracked users, as a bare ID. Deleting users therefore does not free quota for the current month. How tracked users are counted explains the quota.

If you set up a webhook, CrystalBrain sends a user.deleted event after the purge, with the same counts and the user’s ID. You can use it to delete the user from your own systems at the same moment. Like every webhook delivery, the record of this one is kept for 30 days.

Limits and what stays on your side

Your own account, the default user of the workspace, cannot be deleted this way, and neither can a group. A group has no memories of its own.

After the purge, the user’s ID is free again. If one of your apps later saves a memory under the same ID, CrystalBrain creates a new, empty user. Before you request a deletion, make sure your apps have stopped sending that user, or the memory will start to fill again after the purge.

The purge covers what CrystalBrain holds. It does not reach copies you made, such as a CSV export downloaded earlier or records in your own database. Those are part of the same erasure request and need their own step. We list the wider set of questions customers ask in what does your AI store about our users.

Free up to 25 tracked users, no card.

Start free