> ## Documentation Index
> Fetch the complete documentation index at: https://labs.laer.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Email threading

Epiq AI identifies matching emails and organizes them into threaded conversations. This topic outlines the metadata fields Epiq AI extracts and the rules it applies to determine whether messages belong to the same chain.

Epiq AI groups related emails into coherent threads based on their metadata and content. To do this, it extracts email header fields from the primary message and any embedded messages, then applies a combination of exact matching and similarity checks. These rules help ensure accurate reconstruction of message chains even when emails include inline replies, forwards, or minor formatting changes.

### **Email field extraction** <a href="#email-field-extraction" id="email-field-extraction" />

Epiq AI extracts metadata from:

* **Primary message header** (the topmost header in the email)
* **Embedded message headers** (headers from inline or quoted messages)

Extracted fields include, but are not limited to:The following metadata fields are extracted for the primary message (topmost email header) and the embedded messages (inline headers).

| Field Name | Description         |
| ---------- | ------------------- |
| FROM       | Sender of the email |
| TO         | Email To field      |
| CC         | Email CC field      |
| BCC        | Email BCC field     |
| DATE\_SENT | Email sent date     |
| SUBJECT    | Email subject       |
| BODY       | Email body          |
| SIGNATURE  | Email signature     |
| FOOTER     | Email footer        |

### **Exact matching criteria** <a href="#exact-matching-criteria" id="exact-matching-criteria" />

Epiq AI uses exact matching to compare key email attributes. Exact matching ignores whitespace and punctuation.

#### **Sender and recipient matching**

Epiq AI compares:

* `FROM`
* `TO`
* `CC`

The `BCC` field is not used for matching.&#x20;

#### **Sent date matching**

Time comparisons use normalized UTC values.

* With a known time zone: messages can differ by **up to 1 hour**
* With an unknown time zone: messages can differ by **up to 24 hours**

#### **Subject matching**

Subjects must match exactly after normalization. Normalization removes:

* Reply prefixes (for example, `RE:`)
* Forward prefixes (for example, `FW:`)
* Variants of reply/forward indicators

#### **Body content matching**

Epiq AI performs textual matching on:

* The main body content
* Inline quoted text (when applicable)

The following are ignored:

* Email signatures
* Common disclaimers
* Footers

### **Similarity matching (shingling method)**

When body text does not match exactly, Epiq AI applies a shingling method:

* Text is broken into overlapping sequences of words (unigrams and bigrams)
* A similarity score is calculated
* If the score meets or exceeds **`0.99`**, the messages are considered a match

### Threading logic

Epiq AI uses the extracted metadata and matching results to determine whether messages belong to the same conversation thread.Thread membership is based on:

* Matched subjects after normalization
* Consistent sender/recipient patterns
* Content similarity (exact or shingled match)
* Sequential sent dates, within allowed tolerances
* Relationships between primary and embedded message headers

The combination of these factors helps Epiq AI reconstruct email chains, even when emails contain nested replies or inline messages.
