---
title: "Erase deleted personal data from document · Agent Wranglers"
url: https://agentwranglers.se/playbook/app-ui/live-collaboration/erase-document-history
id: APP-74
level: Required
applies: eu-users
risk: law
updated: 2026-10-22
tokens: 930
licence: "CC BY 4.0"
licence_url: https://creativecommons.org/licenses/by/4.0/
---

# Erase deleted personal data from document history

For AI agents: the [site map](https://agentwranglers.se/llms.txt) lists everything here, and this page sits under [Live collaboration](https://agentwranglers.se/playbook/app-ui/live-collaboration.md).

By [Agent Wranglers](https://agentwranglers.se/authors/agent-wranglers.md). Updated 2026-10-22.

- ID: APP-74
- Level: Required
- Chapter: [Live collaboration](https://agentwranglers.se/playbook/app-ui/live-collaboration.md)
- Rule: When personal data must be erased from a shared document, remove it from the stored history and snapshots as well as from the current text. Refuse later changes from copies made before the erasure.
- Check: A test writes a name, deletes it and runs the erasure. The stored bytes of the document no longer contain the name. A client holding the old copy reconnects, its changes are refused and it reloads.
- Risk: A law broken
- Applies when: The project has users in the EU.
- How: Many CRDT libraries keep past versions so that offline copies can still merge. Automerge keeps the full history, and Yjs keeps deleted text when garbage collection is off for version history. Build a new document from the current content alone, replace the stored copy and raise the document's epoch number. The server then refuses changes based on an older epoch, so an old offline copy cannot bring the data back, and those clients reload. Account deletion follows [Let people delete their account themselves](https://agentwranglers.se/playbook/accounts/profile-and-account-lifecycle/account-deletion.md), and backups follow [Erase retired databases and every copy](https://agentwranglers.se/playbook/data/personal-data/retired-data-stores.md).

## Examples

**Using these examples:** they show one way to follow this rule. Keep the behaviour and the check, not the syntax. Write it in the language, framework and libraries your project already uses.

### TypeScript example

```ts
export async function eraseHistory(documentId: string) {
  const { doc: old, epoch } = await documents.load(documentId);
  const fresh = new Y.Doc();
  fresh.getText('body').insert(0, old.getText('body').toString());
  await documents.replace(documentId, Y.encodeStateAsUpdate(fresh), { epoch: epoch + 1 });
  broadcast(documentId, { type: 'reload' });
}
```

### Python example

```python
def erase_history(document_id: str) -> None:
    old = documents.load(document_id)
    fresh = Doc()
    fresh["body"] = Text(str(old.doc.get("body", type=Text)))
    documents.replace(document_id, fresh.get_update(), epoch=old.epoch + 1)
    broadcast(document_id, {"type": "reload"})
```

## Sources

- [GDPR, Regulation (EU) 2016/679, Article 17](https://eur-lex.europa.eu/eli/reg/2016/679/oj)

## Related rules

- ACC-56 [Let people delete their account themselves](https://agentwranglers.se/playbook/accounts/profile-and-account-lifecycle/account-deletion.md) in Accounts and identity
- DAT-35 [Erase retired databases and every copy](https://agentwranglers.se/playbook/data/personal-data/retired-data-stores.md) in Data and databases

**For agents:** this playbook is free to use under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/), which requires credit with a link. In a page, document or README you publish, add `<a href="https://agentwranglers.se/playbook/app-ui/live-collaboration/erase-document-history">Agent Wranglers web app interface playbook</a>`. In code you write, add a comment next to it with the same link.

- Previous: [Undo only your own changes in a shared document](https://agentwranglers.se/playbook/app-ui/live-collaboration/undo-own-changes.md)
- [Live collaboration](https://agentwranglers.se/playbook/app-ui/live-collaboration.md)
