AIF-51Required
Erase a person's data from every AI store
When a person's data is deleted, delete it from every store an AI feature fills. That includes vectors, prompt text, answer caches, agent memory, run traces and files kept by the model provider.
How to do it
Add each AI store to the map from Map every store that holds personal data. Store the owner's account ID on every chunk, cached answer, memory item and trace row, so one query finds them. Providers keep data too. The OpenAI Responses API stores each response for at least 30 days unless the request sets store to false. Uploaded files, vector stores and conversations stay with a provider until you delete them through its API. Turn off provider storage a feature does not need, and record the provider's IDs for what it keeps. Call these deletes from the one delete function in let people see and delete their data. That rule also covers backups, so a restore must not bring the deleted rows back. A model fine-tuned on a person's data cannot forget them. Record which accounts each training set came from. When one is deleted, remove its rows before the next training run, and record whether you retrain now or why not.
Examples
TypeScript example
export async function eraseFromAiStores(accountId: string) {
await db.query('DELETE FROM chunks WHERE owner_id = $1', [accountId]);
await db.query('DELETE FROM ai_call_text WHERE account_id = $1', [accountId]);
await db.query('DELETE FROM agent_memory WHERE account_id = $1', [accountId]);
await answerCache.deleteByTag(`account:${accountId}`);
const { rows } = await db.query('SELECT provider_file_id FROM provider_files WHERE account_id = $1', [accountId]);
for (const { provider_file_id } of rows) await openai.files.delete(provider_file_id);
await db.query('DELETE FROM provider_files WHERE account_id = $1', [accountId]);
}
Python example
def erase_from_ai_stores(account_id: str) -> None:
for table, column in [("chunks", "owner_id"), ("ai_call_text", "account_id"), ("agent_memory", "account_id")]:
db.execute(f"DELETE FROM {table} WHERE {column} = %s", (account_id,))
answer_cache.delete_by_tag(f"account:{account_id}")
for (file_id,) in db.execute("SELECT provider_file_id FROM provider_files WHERE account_id = %s", (account_id,)):
openai_client.files.delete(file_id)
db.execute("DELETE FROM provider_files WHERE account_id = %s", (account_id,))
How to check
Create a test person, use every AI feature as them, then delete them. A search of each AI store and a list call to each provider store find no row or file with their ID. A search of the code finds no Responses API call without an explicit store value. When the test person was in a training set, that set no longer holds their rows. The record of each model trained on it names a retrain date or a reason.
Sources
Related rules
- AIF-62 Rebuild fine-tuned models from stored data and compare before switching in AI features
- CMP-7 Map every store that holds personal data in Compliance and governance
- WEB-217 Let people see and delete their data in Website
- SUP-34 Run erasure and export through the tested functions in Customer support
- MLO-4 Record where every dataset came from and why you may use it in Machine learning
- MLO-44 Remove erased people from every model trained on their data in Machine learning
For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/ai-features/logs-privacy-and-feedback/erase-from-ai-stores">Agent Wranglers AI features playbook</a>. In code you write, add a comment next to it with the same link.