# Recently Deleted

CRM records (contacts, companies, deals, tasks) are soft-deleted — they're flagged with `deletedAt` instead of being physically removed. Recently Deleted is the one-click restore surface for those records.

Navigate to **CRM > Recently Deleted** to open it.

## What You See

The page lists soft-deleted records across the four CRM entities in a single feed, ordered by deletion time (most recent first). Each row shows:

- Entity type chip (Contact / Company / Deal / Task) with a color-coded icon.
- The record's label (full name, company name, deal name, task title).
- "Deleted N days ago" timestamp.
- The user who deleted it, when known.
- An **Open** link to view the record (if it has a detail page).
- A **Restore** button.

## Filters

The toggle chips at the top of the page filter the feed by entity type. Click any chip to add or remove that entity from the visible set. Clicking until everything is off resets back to showing all four.

## Restoring a Record

Click the **Restore** button on any row. The record's `deletedAt` is cleared on the server and the row disappears from the Recently Deleted feed. The record reappears in its entity's normal list view and detail pages.

Restoration is non-destructive for both the record and its associations — notes, activities, tasks, and list memberships are all preserved during the soft-delete window. (Hard deletion happens out-of-band on a configurable schedule and is unaffected by Recently Deleted.)

## Why Soft Delete

Every CRM entity carries a `deletedAt` field and a query middleware that auto-excludes deleted records from default reads. This means:

- Mistakes are recoverable in one click during the retention window.
- The audit trail keeps a complete history — deletions are an audit event, not a gap.
- AI agents and background workers that read the same models see the same filtered view, so a soft-deleted record can't leak back through a side channel.

To list records including soft-deleted ones from the API, pass `?includeDeleted=true` on the relevant endpoint.

<!-- SCREENSHOT: recently-deleted.png — Recently deleted page with filter chips -->
