# Task 020 — Professional Inbox & Conversation Center

**Status:** Implemented

## Goal

Transform inbox from a basic email list into a Gmail + HubSpot-style conversation center.

## Delivered

- [x] `EmailThread` model + extended `EmailReply` fields
- [x] Thread matching service with priority rules
- [x] Thread list API with filters (unread, campaign, sequence, lead-worthy, etc.)
- [x] Thread detail with messages, tracking, CRM context
- [x] Reply / forward / archive / read / unread from UI
- [x] AI classify, create task, stop sequence, suppress actions
- [x] `email-body-cleaner.ts` + collapsed quoted history in bubbles
- [x] Professional `/inbox` three-column UI with 45s auto-refresh
- [x] `/inbox/[id]` → thread redirect
- [x] Sync wires new replies into threads + notifications
- [x] Backfill admin API for existing replies
- [x] Legacy `/api/inbox` APIs preserved

## Key files

- `src/server/models/email-thread.model.ts`
- `src/server/services/email-thread.service.ts`
- `src/lib/email-body-cleaner.ts`
- `src/components/inbox/inbox-conversation-center.tsx`
- `src/app/api/inbox/threads/**`
- `docs/25-professional-inbox.md`

## Post-deploy

Run once after deploy:

```http
POST /api/admin/maintenance/backfill-inbox-threads
{ "limit": 500 }
```

Repeat until `processed` < `limit`.
