Feature: Categories and Status Tracking
Overview
Categories and Status Tracking provides categorization and workflow management for threads. Categories are sourced from App Suite mail categories (predefined with colors and icons), while status tracking provides a standard workflow framework (New → To Do → In Progress → Done).
Feature Purpose
Different teams have different needs for organizing work. Categories provide consistent, organization-wide categorization using App Suite's predefined mail categories, while status provides a common framework for workflow stages. Together, they enable teams to organize, prioritize, and track progress on threads.
User Value Proposition
For Support Teams:
- Categorize threads using organization-wide mail categories
- Track work progress from new to done
- Filter and prioritize work visually
- Standardize workflows across team members
For Team Leads:
- Monitor workload by status
- Identify bottlenecks (too many "In Progress")
- Track team velocity (time from new to done)
- Filter views by category to focus on specific areas
For Organizations:
- Consistent categorization using App Suite mail categories
- Standardized workflow visibility
- Data for performance analytics
- Adaptable to different team needs
Key Capabilities
Categories
1. Add Categories to Thread
Description: Apply one or more categories to a thread for categorization.
User Experience:
- Category control in thread detail top bar ("Manage Categories" button)
- Click to open category editor
- Select from available App Suite mail categories
- Multiple categories per thread
- Categories update immediately
- All users see updated categories in real-time
Acceptance Criteria:
- Categories saved to backend
- Categories sourced from App Suite mail categories (predefined, not free-form)
- Duplicate categories prevented
- Categories sync to all users within 1 second
- Category change recorded in timeline
2. Display Categories
Description: Show categories visually on threads.
User Experience:
- Categories appear as colored badges with icons
- Shown in thread list and detail view
- Each category uses its App Suite-defined color and icon
- Categories wrap to multiple lines if needed
Acceptance Criteria:
- Categories visible in list view
- Categories visible in detail view header
- Styling matches App Suite mail category appearance
- Colors and icons sourced from App Suite category definitions
3. Remove Categories
Description: Remove categories from a thread.
User Experience:
- X button on each category badge
- Click X removes category immediately
- Removal synced to all users
Acceptance Criteria:
- Category removal via same API as add
- Removal recorded in timeline
- All users see removal in real-time
- Removed categories don't reappear
4. Edit Categories in Bulk
Description: Modify entire category set at once.
Acceptance Criteria:
- All category changes saved in one API call
- Single timeline action for bulk update
- Atomic operation (all or nothing)
- Optimistic UI update with rollback on error
Status Tracking
5. Set Thread Status
Description: Change the work status of a thread.
User Experience:
- Status dropdown in thread detail top bar
- Options: New, To Do, In Progress, Done
- Click to select new status
- Status updates immediately
- Icon changes to match status
- All users see updated status
Acceptance Criteria:
- Status saved to backend
- Status sync to all users within 1 second
- Status action recorded in timeline
- Previous status preserved in history (future)
6. Status Display
Description: Show current status visually.
User Experience:
- Status shown with icon and label
- Icons: New (⭐), To Do (○), In Progress (↻), Done (✓)
- Status visible in list and detail views
- Color-coded for quick scanning
Acceptance Criteria:
- Status always visible on thread
- Icons consistent across application
- Accessible labels for screen readers
- Status updates reflected immediately
7. Default Status
Description: New threads start with appropriate status.
Acceptance Criteria:
- Database stores null for new threads
- UI interprets null as "New" status
- New threads highlighted in list (future)
- Status can be changed from New to any other
8. Auto-status on Assignment
Description: Assigning thread automatically sets status to "To Do".
Acceptance Criteria:
- Only triggers for null/New status threads
- Already-assigned threads keep current status
- Both actions recorded separately
- Works for self-assignment and assigning others
9. Status Change Tracking
Description: View history of status changes.
Acceptance Criteria:
- Status action includes user and timestamp
- Action data includes new status value
- Timeline displays status icon and label
- Status changes from all users visible
10. Auto-Reopen on New Activity
Description: Automatically reopen done threads when new external emails arrive.
Problem Statement: When a thread is marked as "done" and the customer replies, the thread must automatically reopen to appear in the active view. Without this, active customer conversations remain hidden in the archive, causing missed responses.
User Experience:
- User marks thread as "done" → thread moves to archive
- Customer replies to the conversation (external email)
- Thread status automatically changes to "new" (null)
- Thread immediately appears at top of active view for all users (sorted by last activity)
- Timeline shows status change with system indicator
- Assignment and categories are preserved
Acceptance Criteria:
- Email ingestion detects when new email belongs to existing thread
- If existing thread has
status === "done"AND email is external, status automatically set to null - Internal emails (sent items, system messages) do NOT trigger auto-reopen per ADR-0009
- Status change recorded in timeline as system action (not user action)
- WebSocket event broadcasts status change to all connected clients
- Thread moves from
archivedThreadstoactiveThreadscollection - All users see reopened thread within 1 second
- Thread appears at top of active list (sorted by
last_message_received_at) - Thread GUID matching ensures correct thread identification
- Assignment preserved during auto-reopen
Technical Implementation:
- Auto-reopen logic implemented in email ingestion flow
- Check thread status BEFORE inserting new email action
- Filter to external emails only (ignore sent items per ADR-0009)
- If
thread.status === "done"AND email is external, execute status update alongside email insertion - Use database transaction to ensure atomicity
- Create system-generated status action in timeline
- WebSocket broadcast triggers frontend collection movement
See: Technical Patterns for transaction pattern details.
11. Archive View (Status-based Filtering)
Description: Automatically filter "Done" threads from default views, with dedicated Archive view for accessing completed work.
Problem Statement: Thread lists become cluttered with completed work, making it difficult to focus on active threads requiring attention. Teams need a way to maintain a clean working view while preserving access to completed threads.
User Experience:
Default Behavior:
- "Done" threads automatically hidden from all thread list views
- Thread counts show only threads matching current filter context
- Only "relevant" (non-Done) threads shown by default
Archive View:
- Dedicated "Archive" filter available in all thread list views
- Shows only "Done" threads when selected
- Same list/detail interface as regular views
- Clear visual indication user is in Archive mode
- Archive count badge showing number of completed threads
Real-time Behavior:
- When thread marked as "Done":
- Thread removed from all active list views
- Thread appears in Archive view immediately
- When "Done" thread changed to different status:
- Thread removed from Archive view
- Thread appears in regular list views immediately
- When new email arrives for "Done" thread (auto-reopen):
- Thread status automatically changes to "new" (null)
- Thread immediately moves from Archive to active view
- All users see updates within 1 second (real-time sync)
Acceptance Criteria:
Filtering Logic:
- Default views exclude threads where
status === "done" - Archive view shows only threads where
status === "done" - Filtering applied consistently across all views
Backend API Requirements:
- Backend API filters threads by status before returning results
- API endpoint accepts
?filter=status:active(default) or?filter=status:donequery parameter - Active filter returns only threads with
status IS NULL OR status IN ('to-do', 'in-progress') - Done filter returns only threads with
status = 'done' - SQL query includes appropriate WHERE clause for filtering
- Default behavior (no query param) returns active threads (
filter=status:activeimplicit) - Database indexes optimize status filtering queries (add
(inbox_id, status)index via migration)
UI/UX:
- Archive filter accessible via filter dropdown in all thread list views
- Clear visual indicator when viewing Archive
- Thread count badges show counts for current filter context
- Counts are contextually relevant, not global totals
Real-time Sync:
- Status change to "Done" removes thread from active views immediately
- Status change from "Done" restores thread to active views immediately
- WebSocket events trigger view updates for all users
- Thread moves between
activeThreads↔archivedThreadscollections on status change
Performance Requirements:
- Active view loads in <500ms even with 100k+ total threads in database
- API response size for active view <100KB regardless of total thread count
- Performance does NOT degrade as done thread count increases
- Filter state transition < 100ms
Technical Implementation:
Server-side filtering is mandatory for performance. See Technical Patterns for filtering conventions.
API Changes:
GET /api/threads/:inboxId?filter=status:active- Returns New/To Do/In Progress (default)GET /api/threads/:inboxId?filter=status:done- Returns only Done threadsGET /api/threads/:inboxId/count?filter=status:active- Count active threadsGET /api/threads/:inboxId/count?filter=status:done- Count done threads
Backend SQL Filtering:
-- Active view (default)
WHERE status IS NULL OR status IN ('to-do', 'in-progress')
-- Archive view
WHERE status = 'done'Frontend State Management:
- New store property:
filterMode("active" | "done") - Router query parameter:
?filter=status:donefor archive view - Separate API calls for each filter
- Store maintains two separate collections:
activeThreadsandarchivedThreads - Switching views triggers new API call with appropriate query parameter
Database Migration:
- Database schema changes applied via
drizzle-kit pushduring development - Final migration created with
drizzle-kit generatebefore production deployment - Migration adds composite index:
CREATE INDEX idx_threads_inbox_status ON threads(inbox_id, status)
Future Extensibility:
The filter parameter design enables natural expansion to multi-criteria filtering:
?filter=status:active&filter=category:$ct_predefined_0001
?filter=status:in-progress&filter=assignee:john@example.comSee: Technical Patterns for filter design patterns.
12. Category Filtering
Description: Filter the thread list by one or more mail categories, composable with the existing status filter.
Problem Statement: Users working across multiple mail categories need to scope the thread list without navigating away or losing their current status filter context.
User Experience:
- Filter dropdown in thread list header includes a "Categories" section below status options
- Each category shown with its colored badge and icon (sourced from App Suite mail categories)
- Clicking a category toggles it on/off; a checkmark indicates active selection
- Multiple categories can be selected simultaneously
- Category and status filters are independent — both can be active at the same time
- Active filters reflected in URL query parameters for bookmarkable/shareable views
- Deselecting all categories returns to the unfiltered view
- When no categories are configured, a "No categories available" message is shown
Acceptance Criteria:
- All available mail categories appear in the dropdown
- Selection state visually indicated with a checkmark
- Thread list shows intersection of all active filters
- Thread count badges update to reflect active filters
- Works on individual inbox views and "My threads" view
- Exiting archive mode preserves active category filters in URL
- Empty state message shown when no categories exist
UI/UX Design
Categories UI
Thread Detail - Top Bar
┌──────────────────────────────────────────────┐
│ Subject: Customer inquiry about billing │
│ Categories: [🔴 Billing] [🟡 Urgent] [+] │
│ │
│ Assigned: John Status: In Progress │
└──────────────────────────────────────────────┘
Category Editor:
┌──────────────────────────┐
│ [🔴 Billing] [x] │
│ [🟡 Urgent] [x] │
│ [🔵 Support] │
│ │
│ Add a category... [____] │
└──────────────────────────┘Status UI
Status Dropdown:
┌──────────────────┐
│ ⭐ New │
│ ○ To Do │
│ ✓ In Progress │ ← selected
│ ✓ Done │
└──────────────────┘
Timeline Action:
┌──────────────────────────────┐
│ ↻ Status changed to │
│ In Progress │
│ by Jane Smith │
│ 1 hour ago │
└──────────────────────────────┘Archive View UI
Thread List Header with Filter Dropdown:
┌──────────────────────────────────────┐
│ Support [🔽] │ ← Filter icon
│ 12 threads │
└──────────────────────────────────────┘
Filter Dropdown Menu:
┌────────────────┐
│ ✓ Active │ ← Currently selected
│ Archive │
│────────────────│
│ [Billing] ✓ │ ← Category filters
│ [Support] │
└────────────────┘Visual Design
Categories:
- Colored badges with border, matching App Suite mail category styling
- Icon from App Suite category definition (Iconify format)
- Small X button on hover for removal
- Consistent height (24px)
- 4px gap between categories
- Color, icon, and name sourced from App Suite category API
Status:
- Icon + label format
- Icons use theme colors
- Dropdown uses standard menu styling
- Status badge in list view (compact)
- Full label in detail view
Technical Implementation
Architecture
- Frontend: Vue 3 components for categories and status
- Backend: Fastify endpoints for updates
- Database: PostgreSQL stores category IDs in
threads.tagsJSONB column - Real-time: WebSocket propagates changes
- Categories Source: App Suite
categoriesCollectionAPI (predefined categories with colors and icons)
See: Technical Patterns for Yjs, WebSocket, API, and state management patterns.
API Endpoints
| Endpoint | Method | Purpose |
|---|---|---|
GET /api/threads/:inboxId?filter=status:active | GET | Fetch active threads (default) |
GET /api/threads/:inboxId?filter=status:done | GET | Fetch archived threads |
GET /api/threads/:inboxId?filter=category:$id | GET | Fetch threads with category |
GET /api/threads/:inboxId/count?filter=status:active | GET | Count active threads |
GET /api/threads/:inboxId/count?filter=status:done | GET | Count done threads |
POST /threads/:inboxId/:threadId/categories | POST | Update thread categories |
POST /threads/:inboxId/:threadId/status | POST | Update thread status |
Request/Response
Categories Update:
{
"categories": ["$ct_predefined_0001", "$ct_predefined_0002"]
}Status Update:
{
"status": "in-progress"
}Data Model
Thread Fields:
{
tags: string[], // Array of App Suite category IDs (DB column)
categories: string[], // Same data, mapped in API response
status: string | null // "to-do" | "in-progress" | "done" | null
}Category Change Action:
{
type: "tag",
created_at: Date,
data: {
from: {id, context} // User who made change
}
}Status Action:
{
type: "status",
created_at: Date,
data: {
from: {id, context},
status: string // New status value
}
}State Management
Threads Store:
updateThreadCategories(categories, thread): Update thread categoriesupdateThreadStatus(status, thread): Update thread status- Both update local state immediately (optimistic)
- Both call API and handle errors with rollback
Categories Composable (use-categories.ts):
- Sources categories from App Suite
categoriesCollectionbackbone API - Bridges backbone model to Vue reactive state
- Provides
allCategories(ref) andcategoryLookup(computed, ID-keyed) - Re-syncs on dark mode change (category colors adapt)
See: Technical Patterns for optimistic update pattern.
Business Logic
Categories:
- Predefined by App Suite (not free-form)
- Category IDs are App Suite identifiers (e.g.,
$ct_predefined_0001) - Empty categories filtered out
- Duplicates removed
- Categories stored as JSONB array in
threads.tagscolumn - Filtering uses PostgreSQL
?|operator for OR matching
Status:
- Valid values: null, "to-do", "in-progress", "done"
- Invalid values rejected by API
- Null displayed as "New" in UI
- Auto-set to "to-do" when assigning null-status thread
Real-time Synchronization
Category Update Flow:
- User modifies categories in UI
- Frontend updates local state (optimistic)
- POST to categories endpoint
- Backend updates database + creates action
- WebSocket broadcasts
teams:updateevent - Other clients fetch updated thread
Status Update Flow:
- User selects new status
- Frontend updates local state (optimistic)
- POST to status endpoint
- Backend updates database + creates action
- WebSocket broadcasts
teams:actions:newevent - Other clients fetch updated thread
See: Technical Patterns for notification patterns.
Performance
- Optimistic updates for instant feedback
- Category changes committed immediately
- Status changes committed immediately
- Real-time updates throttled (100ms)
Dependencies
- Thread Management (categories/status belong to threads, filtering operates on thread lists)
- App Suite Categories API (predefined categories sourced from core App Suite)
- Real-time Collaboration (WebSocket propagation, filter updates sync across users)
- Assignment Workflow (status auto-set integration, auto-reopen preserves assignments)
- Email Synchronization (auto-reopen depends on email ingestion detecting new emails for existing threads)
- Database Transactions (atomic updates for auto-reopen + email insertion)
- Router (view mode and filter state in URL)
Known Limitations
- Archive view shows only "Done" threads (other status filters planned)
- Category filtering limited to App Suite predefined mail categories (no custom categories in Teams)
- No saved/preset filter combinations
- Status history not preserved (only latest)
- Binary view selection only (active vs archive) - no multi-status filtering yet
- Auto-reopen applies to ALL external emails (no rules/conditions to control when it happens)
- No user notification when thread auto-reopens (thread reappears in active view, sorted to top by last activity)
- Auto-reopen preserves assignment even if original assignee is no longer available/active (future: integrate with automatic assignment)
Future Enhancements
Categories
- Category Analytics: Most-used categories, category trends
- Bulk Categorization: Add categories to multiple threads
Status
- Custom Statuses: Define team-specific statuses
- Advanced Filtering: Multi-status filters (New, To Do, In Progress combinations)
- Filter Persistence: Remember filter preferences per user/inbox
- Status Automation: Auto-transition based on rules
- Status Analytics: Time in each status, bottleneck detection
- Status History: View all status changes for thread
- Status Permissions: Restrict status changes
- Status Workflows: Define allowed transitions
- Kanban View: Drag threads between status columns
Auto-Reopen
- Configurable Auto-Reopen: Rules to control when threads reopen
- Auto-Reopen Notifications: Notify original assignee when thread reopens
- Smart Reassignment: Offer to reassign if original assignee unavailable
- Auto-Reopen History: Track how many times thread has been reopened
- Conditional Reopen: Only reopen for certain senders or based on email content
Filtering System (Built on Archive View)
- Multi-criteria Filters: Combine status, categories, assignee, date range
- Quick Filter Toggles: Fast switching between common filter combinations
- Saved Filter Presets: User-defined and team-wide filter templates
- Filter Search: Full-text search integrated with filters
- Cross-inbox Filters: Apply filters across multiple inboxes
- Smart Filters: Dynamic filters based on user behavior/patterns
Related Features
- Thread Management
- Assignment Workflow
- Real-time Collaboration
- Filtering (future)
Related ADRs
- ADR-0006: Database layer for storing categories/status
- ADR-0007: Real-time state sharing (WebSocket)
- ADR-0009: Ignore sent items when fetching threads (critical for auto-reopen external-only filter)
Success Metrics
Categories
- Category update latency < 500ms (p95)
- Category changes visible to all users within 1 second
Status
- 90% of threads reach "Done" status
- Average time per status stage tracked
- Status update latency < 300ms (p95)
- Auto-status on assignment used in 70% of cases
- Zero status conflicts (concurrent updates)
Archive View & Auto-Reopen
User Experience:
- 90% reduction in visible "Done" threads in default views
- Archive view accessed by 60%+ of users monthly
- Zero user confusion about "missing" threads
- Thread removal on "Done" status change < 1 second (p95)
- Filter view switching < 200ms (p95)
Auto-Reopen Behavior:
- 100% of new emails on done threads trigger auto-reopen
- Thread reopens and appears in active view < 2 seconds from email arrival
- Zero customer replies remain hidden in archive
- Auto-reopen status action recorded in timeline for all reopened threads
- No false positives (internal comments don't trigger reopen)
Performance & Scalability:
- Active view load time <500ms at p95, regardless of total thread count
- API response size for active view <100KB at p95, even with 100k+ total threads
- Zero performance degradation as archive grows (validated with 100k+ done threads)
- Archive view load time <1s at p95
- Memory usage bounded by visible threads only
- Linear scaling with active thread count (not total thread count)

