Skip to content

Detect & Remove Quoted Reply Chains from Email Threads #37

Description

@krishnasahoo11156

When users view an email in a thread, they see the entire quoted history (“On Monday, John wrote…”). This wastes AI tokens and creates a poor reading experience. We need to extract only the fresh content written by the latest sender.

Acceptance Criteria
• Create backend/src/services/parser/quoted-reply-detector.service.ts
• Detect patterns: >, |, From:, On [date] [name] wrote:, -----Original Message-----
• Handle nested quotes (multiple >>>>> levels)
• Use string diffing to detect repeated content blocks across thread emails
• Return only the newest content
• Store full thread context separately for AI processing
• Add threadContext field to Thread model

Technical Notes
• Must handle Gmail, Outlook, Apple Mail, Thunderbird quoting styles
• Must NOT remove inline quotes where sender references previous text
• Pure function, no DB calls

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions