About the implementation and examples

Engineering notes draw on author-supplied MailTrace development reports through 13 October 2026. They describe the documented revision, including local work, rather than independently verified live deployment. Experiment designs and architecture proposals describe work to evaluate. Examples are educational, use synthetic data and are not copied production code.

Separate topic similarity from request identity

MailTrace’s reported grouping rules use contextual constraints because a case is not just a bag of related sentences. One request may have been answered while another remains outstanding. Merging them can falsely make the unanswered matter look resolved, or make a completed matter look open again.

Explicit references are particularly useful when their extraction is reliable. Dates need more care: an email can mention the date of a meeting, a reply deadline and the date of an earlier request. A veto should compare equivalent fields, not every date string found in a message.

Let a clear conflict override a high score

The example illustrates one narrow veto: two known, different request references. It does not treat missing references as proof of a match. Production validation also needs source freshness, chronology and the rest of the candidate rules.

python · Absence of a conflict is not positive evidence that two requests are identical.
def reference_conflict(left, right):
    a = left.get("request_reference")
    b = right.get("request_reference")
    return bool(a and b and a != b)

assert reference_conflict(
    {"request_reference": "DEMO-101"},
    {"request_reference": "DEMO-202"}
)
assert not reference_conflict({}, {"request_reference": "DEMO-202"})

Make the reviewer’s decision inspectable

A good merge review presents the proposed title, sources, request references and reasons together. The user should be able to compare the actual passages and keep the issues separate. Model confidence alone is an inadequate explanation, particularly when the cost of a false merge is a lost action.

For evaluation, deliberately include hard negatives: repeated templates, different requests to the same organisation and a new request appended to an old thread. Also include legitimate continuations across threads. The goal is not to ban merges; it is to make each merge defensible, reversible and linked to the evidence available at the time.

Browse the complete MailTrace series →