Support Email Intelligence · Documentation

Architecture

Support Email Intelligence's pipeline, its owned data, the events it emits/consumes, and what is out of scope.

Support Email Intelligence
cleanstrip quoteslang-detectscriptclassifymeteredenrichjoin coredraftmeteredQCtone · refmetered · LLMdeterministic · $0
Live diagram — clean, language-detect, enrich and QC are deterministic; classify and draft are the metered model stages (OSS-only at $0 in the prototype).
clean$0lang-detect$0$classifymeteredenrich$0$draftmeteredQC$0COST LEVER · classify routes the draft
Live diagram — spend accrues on classify and draft; everything else is deterministic at $0.
ASPECTCLOUD · capable readOSS · recordedCategory nuancefine-grainedcoarse bucketReply fluencyidiomaticterser, correctBooking-ref fillfilledfilledMixed-language emailclassifiednot captured - routed to a human
Live diagram — Cloud (claude-haiku-4-5) vs recorded OSS; the deterministic clean / detect / enrich / QC stages are identical in both modes.

The triage pipeline

One operator action drives a six-stage pipeline in the adapter's `triageEmail`: clean (strip signature + quoted history), language-detect (script + stopword signals across en/fr/de/es/ja), classify (multilingual keyword scoring → category, with priority + sentiment heuristics), enrich (join to booking/guest/property/loyalty from shared-core), draft (a per-category reply framed + signed in the detected language with the booking reference filled), and QC (flag a missing reference or apply an empathetic tone on negative sentiment).

Owned data + shared-core reads

The app reads shared-core `booking`, `guest`, `property`, and loyalty for enrichment, and reads/writes the C2-owned entities `support_email` (with its embedded triage), `conversation`, `message`, and `ticket`. The data invariant holds throughout: an owner's triage is canonical — it mutates the email record and mirrors durably — while a viewer's run is ephemeral, returned for display with a credential-tagged cost row that resets and never mutates the shared email.

Events emitted + consumed

Emits `email.triaged`, `email.replied`, and (on route) `ticket.created` / `ticket.routed` on the in-process event bus, persisted to the durable event log. It shares the ticket/conversation/message model with #16 and #38, so an escalation here is an inbox item there. The sent reply hands off to #35's notification path.

Metered AI + out of scope (simulated + labelled)

The one metered stage is `email-triage`, dual-mode by design: Cloud `claude-haiku-4-5` (cost-capped, fail-closed) or OSS recorded at $0 on local hardware. The prototype runs OSS-only with no API key and is honestly labelled simulated — deterministic classification and curated localized drafts behind the same adapter surface a real model run swaps into in Stage-2. Out of scope and clearly labelled: real email send (no SMTP — replies land in the in-app sent viewer), and any real PII or copyrighted content. Cost, mode, and trace are inspector-only.

Architecture · Support Email Intelligence · Abhishek Saxena