AddThisFeature

Data Retention Controls

Delete data you no longer need, on a schedule, instead of keeping everything forever.

involved Privacy & Compliance

What it adds

Configurable retention windows per data type, with a scheduled job that deletes expired records and everything derived from them.

What your agent is told to do

6
  1. 1

    Build a data map first: every table, file store, log stream, search index, cache, and third-party processor that holds customer data, and how old the oldest row is.

  2. 2

    Define a retention window per data type, not one window for the whole app. Activity logs, uploaded files, and billing records have different obligations.

  3. 3

    Run deletion as a scheduled, idempotent, batched job that can be stopped and resumed, and that records what it deleted in an audit trail.

  4. 4

    Support legal holds: a flag that exempts a record, workspace, or user from deletion until it is cleared, and that survives the job being re-run.

  5. 5

    Delete derived copies at the same time — search index documents, thumbnails, exports, cached aggregates, and data pushed to analytics or support tools.

  6. 6

    Do NOT delete without a dry-run mode and a grace period. A retention job with an off-by-one window can destroy years of data in one run, and there is no undo.

Edge cases it handles

7
  • Backups are not covered by live deletion. State the backup retention period explicitly and accept that deleted data persists there until backups roll off.
  • Deleting a parent row can orphan or cascade into children — decide per relationship, and count rows in the dry run.
  • Records under legal hold must be skipped without failing the batch or silently resetting their expiry.
  • Retention windows differ by plan and region; a per-workspace override must not be overwritten by the global default.
  • Data already sent to third parties needs a deletion call to those APIs, and some will not have one — document that gap.
  • A job that times out mid-batch must not delete a record's rows in one table and leave the rest behind.
  • Changing a window from 24 months to 6 months queues a very large first deletion — throttle it rather than running it in one pass.

Definition of done

9
  • Every store of customer data appears in the data map with a stated retention window.
  • Windows are configurable per data type and overridable per workspace.
  • The deletion job is idempotent, batched, resumable, and auditable.
  • Legal holds prevent deletion and survive repeated runs.
  • Derived data, files, search indexes, and third-party copies are removed alongside the primary record.
  • A dry-run reports exactly what would be deleted before anything is.
  • Backup retention is documented and distinguished from live deletion.
  • The feature matches the existing design system.
  • No existing functionality is broken.

Related features

How it works

  1. 1

    Copy the link

    Grab the Markdown instruction URL for this feature.

  2. 2

    Give it to your AI

    Paste it into Claude Code, Cursor, v0, Lovable — whatever you build with.

  3. 3

    It inspects, then implements

    Your agent reads your existing app first, then adds the feature to fit it.

Works with your stack

These instructions are written to adapt. They tell the agent to detect your framework, match your existing design system, and reuse what you already have — rather than assuming a particular stack.

Need it tighter than that? Customize the feature and tell it exactly what you're running.