Guide
How to set a retention rule for an AI app's memory
An AI app's memory keeps growing. This guide shows how to set a retention rule in your own code, using labels, timestamps and the delete routes Harny provides.
The problem
Every fact your app's AI stores stays until something removes it. Old notes, old transcripts and old values can all sit in a person's memory.
Retention is a decision you make. You decide what to keep and what to remove, so the rule lives in your code and in a job you schedule.
How it works in Harny
When you send data, you can set an id, a label and a timestamp. The timestamp says when the thing happened. Recall can filter by date with occurredFrom and occurredTo.
You can delete one data point by its sourceId, delete up to 1,000 ids in one bulk call, or erase a whole user. Deletes are free.
Decide what to keep. Facts such as a stated budget are often worth keeping. Raw transcripts are often not.
Step by step
- Label and timestamp the data when you send it. Use the timestamp for when the event happened:
POST /v1/memory/ingest (content, label, timestamp). - Decide which kinds of data you keep past a set age, such as facts, and which you remove, such as raw transcripts.
- Keep the ids of what you send in your own records, together with the date it happened. You can also filter recall by date:
POST /v1/memory/recall (occurredTo, limit). - Delete the old data points by sourceId, in bulk up to 1,000 ids:
DELETE /v1/memory/data-points/{sourceId}. - When a person asks to be erased, or leaves your app, delete their whole memory:
DELETE /v1/users/{user_id}/data. - Schedule your own job to run the rule on a regular cycle, and check the month's count:
GET /v1/memory/usage.
What can go wrong
- A rule with no label means you cannot tell facts from transcripts later. Label your data when you send it.
- Deleting a data point also removes the memories built on it. Check what you delete before you run a bulk job.
- A job that runs with no limit can delete more than you intended. Test the rule on one user first.
Example: the Acme pilot
Picture a rule for the Acme pilot, where Nadia at Acme owns the app. The app keeps the stated budget, first 32k and then 40k as of March 14, as facts. A scheduled job removes raw chat transcripts past the age you choose.
For demo-user, the job deletes the old transcripts by sourceId and leaves the budget facts, which stay answerable by date.
Frequently asked questions
Does Harny delete my data after a set number of days?
This guide does not describe an age-based setting. You set the rule in your app and run it with the delete routes.
What should I keep: facts or raw transcripts?
That is your decision. Facts are often worth keeping. Raw transcripts are often not. Label your data so you can apply different rules.
What does a bulk delete cost?
Deletes are free. Monthly-active end users above 500 cost $0.30 each per month, flat.
Go on. Get Harny.
The first 500 monthly-active end users are free for good. Create an app key and make your first call in minutes.