SabaKore

Home / Articles / AI guides

How to Store and Delete AI Chat Conversation History

This article covers why a service with AI features keeps conversation history, the responsibility that comes with keeping too much, and how to design for deletion as well.

Ren, a junior infrastructure engineer

Ren

I'm building an AI chat feature. How long should I keep the conversation history?
Procura, a cloud AI robot who explains

Procura

There are reasons to keep it and reasons not to keep too much. First work out what you need the history for, and then decide the period and scope.

Reasons to keep history

  • To keep the conversation natural by building on what came before
  • To investigate the cause when there is a bug or a wrong answer
  • To understand usage and help improve the feature
Ren, a junior infrastructure engineer

Ren

But conversations can contain quite personal things, can't they...
Procura, a cloud AI robot who explains

Procura

Exactly, and that's the weight of keeping history. In what users say casually, there can be personal information or worries they'd rather not share. Keeping it also means taking on the responsibility of holding it.

What to decide in the design

  • Decide the retention period in advance, and delete automatically after it passes
  • Give users a way to delete their own history
  • Limit the people who can view history (including operator staff) to the minimum
  • State in your privacy policy what you store

Design for deletion too

Many people think about designing to "keep" from the start, but designing to "delete" tends to be put off. If you try to add deletion later, you have to delete copies scattered everywhere, including backups and related logs, which takes more work than you'd expect. Think through the deletion procedure from the initial design stage.

  • Decide how to handle backups and logs, not only the main database
  • Document in advance what to do when a deletion request arrives
  • Check regularly that expired data has actually been deleted
Ren, a junior infrastructure engineer

Ren

What if a service that's already running has been keeping too much history?
Procura, a cloud AI robot who explains

Procura

Start by deciding a retention rule and applying it as soon as you notice. Cleaning up everything retroactively in one go is hard, so it's still meaningful to apply the rule to newly created data first and tidy the old data in stages.

Consider an export feature

Beyond deletion, offering an export feature that lets users take out their own conversation history also reassures them. It isn't required for every service, but for features that get used for personal matters, having a way to take your own data out yourself is a comforting point for users.

  • Consider whether to offer export, depending on the nature of your service
  • If you do, check carefully that other people's history doesn't get mixed into the output
  • Record who made each export request and when
Procura, a cloud AI robot who explains

Procura

History is a source of convenience, and also a responsibility you've taken on. Get into the habit of always thinking of how much you keep and the effort of protecting it as a pair.
Ren, a junior infrastructure engineer

Ren

So I design the reason to keep and the procedure to delete together.

This article is translated from the Japanese original. If the two differ, the Japanese version is the one we keep up to date.