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.

Validate several different properties

First, the source must exist within the authorised scope. Second, the cited representation must match the expected source version. Third, the quoted passage must occur in that representation. Finally, the passage must actually support the associated claim. The first checks are largely deterministic; the final relationship needs separate evaluation and may need review.

The reported Q&A consolidation rejects changed, excluded and foreign sources. These controls support a defensible boundary, but exact quote matching alone does not prove entailment. “We have not approved the request” contains “approved the request”; a fragment without context can reverse the meaning.

Fail a quote check explicitly

This small example checks scope, hash and quotation presence against a synthetic prepared source. A complete implementation would also handle typed source keys, passage offsets, normalisation policy and authorisation before loading the source.

python · Structural citation checks; claim support remains a separate question.
def valid_quote(citation, source, allowed_ids):
    return (
        source["id"] in allowed_ids
        and citation["source_id"] == source["id"]
        and citation["source_hash"] == source["hash"]
        and bool(citation["quote"].strip())
        and citation["quote"] in source["text"]
    )

source = {"id": "demo", "hash": "revision-a",
          "text": "We have not approved the request."}
citation = {"source_id": "demo", "source_hash": "revision-a",
            "quote": "We have not approved the request."}
assert valid_quote(citation, source, {"demo"})
assert not valid_quote(citation, source, {"other"})

Make verification useful to the reader

The interface should open the cited passage with enough surrounding text to inspect the meaning. If a source becomes unavailable, retain the answer’s history but avoid presenting its citation as current verified support. A stale badge should explain the consequence in ordinary language.

Evaluate citation identity, quotation accuracy and claim support as separate measures. A model that produces perfect source IDs but unsupported conclusions is not an accurate evidence assistant. The product earns trust when a user can follow the path from a sentence back to the original material and understand the limits of the interpretation.

Browse the complete MailTrace series →