Skip to content

User Story: Collaborative Draft Editing

Overview

As a team member responding to complex inquiries, I want to collaborate with colleagues on draft replies in real-time so that we can craft better responses together.

User Personas

  • Support Agent: Drafts responses to customer inquiries
  • Subject Matter Expert: Reviews and enhances draft responses
  • Team Lead: Provides guidance on complex responses

User Stories

Create Shared Draft

As a support agent I want to start a draft reply to an email in a thread So that I can collaborate with my team on the response

Acceptance Criteria:

  • "Reply" button on email allows creating a draft
  • Draft is created with pre-filled recipient, subject, and quoted content
  • Draft appears as a new action in the thread timeline
  • Only one draft can be active per thread at a time
  • Draft creator becomes the owner

Edit Draft Collaboratively

As a team member I want to edit a draft that another team member started So that we can work together on the response

Acceptance Criteria:

  • Multiple users can edit the same draft simultaneously
  • Changes from all users are merged in real-time using CRDT
  • Each user's cursor position is visible to others (awareness)
  • Edits are synced via WebSocket connection
  • Draft content is persisted to backend
  • Offline edits are synced when connection is restored

Format Draft Content

As a support agent I want to format the draft email with rich text So that I can create professional-looking responses

Acceptance Criteria:

  • Rich text editor supports bold, italic, underline
  • Lists (ordered and unordered) are supported
  • Links can be inserted and edited
  • Images can be embedded
  • Blockquotes are available for quoting
  • Formatting toolbar is accessible and intuitive

Edit Draft Subject Line

As a support agent I want to modify the subject line of the draft So that I can clarify or update the conversation topic

Acceptance Criteria:

  • Subject line is editable in draft header
  • Subject changes sync across all collaborators
  • Subject persists in Yjs document metadata
  • Original subject is shown as default

See Who's Editing

As a team member I want to see who else is currently editing the draft So that I can coordinate with them

Acceptance Criteria:

  • Active collaborators are shown in the draft UI (via awareness)
  • User cursors/selections are visible with color coding
  • User names are displayed next to their cursors
  • User list updates in real-time as people join/leave

Send Collaborative Draft

As a support agent I want to send the completed draft So that the customer receives our response

Acceptance Criteria:

  • "Send" button is available to all collaborators
  • Clicking send converts draft to sent email
  • Sent email appears in thread timeline
  • Draft is removed after sending
  • All collaborators see the draft disappear
  • Sent email is delivered via mail system

Close Draft Without Sending

As a support agent I want to close/cancel a draft without sending So that I can discard work in progress

Acceptance Criteria:

  • "Close draft" button is available
  • Closing draft removes it from thread
  • Close action is recorded in timeline
  • Draft content is cleared from backend
  • All collaborators see the draft close

Persist Draft Locally

As a support agent I want to have my draft changes saved locally while offline So that I don't lose work if connection drops

Acceptance Criteria:

  • Draft content is persisted to IndexedDB
  • Offline changes sync when connection restored
  • Each thread can have only one draft in IndexedDB
  • Old drafts are automatically cleaned up

Value Proposition

Collaborative draft editing enables teams to leverage collective knowledge and produce higher-quality responses. Real-time collaboration reduces back-and-forth, speeds up complex responses, and ensures consistency in communication. The CRDT-based approach handles conflicts gracefully and works even with intermittent connectivity.

  • Thread Management
  • Real-time Collaboration
  • Email Integration
  • Assignment Workflow

Technical Notes

  • Collaborative editing powered by Yjs CRDT library
  • TipTap editor with Collaboration extension
  • WebSocket sync via custom Yjs provider (see ADR-0008)
  • Backend persistence in PostgreSQL, one snapshot per thread, and replica sync over Redis (see ADR-0028 and ADR-0029)
  • IndexedDB persistence via y-indexeddb
  • Draft API endpoints:
    • POST /threads/:inboxId/:threadId/draft - Create draft
    • DELETE /threads/:inboxId/:threadId/draft - Close draft
    • POST /threads/:inboxId/:threadId/draft/send - Send draft
  • Real-time notifications via WebSocket propagate draft actions