Overview

Last updated: April 11, 2026

AIEmail Module Overview (aiemail)

The aiemail package serves as the primary ingress point for email-based automation and support ticketing.

Key Features

  • IMAP Ingestion: Connects to configured mailboxes to read incoming emails.
  • Support Agent Integration: Routes customer support emails to specialized agents (e.g., the "SupportAgent" persona).
  • NOC Alert Extraction: Acts as the feeder for noc_intelligence.go by identifying infrastructure alerts from monitoring systems.
  • Email Summarization: Triggers the aiemailsummary package to create daily digests of inbox activity.

Key Files

  • aiemail/aiemail.go: IMAP connection and initial parsing logic.
  • aiemailsummary/aiemailsummary.go: Logic for batch processing and summarizing emails.

Integration Flow

  1. Polling: The module periodically polls the IMAP server.
  2. Parsing: Extracts headers, sender, subject, and body (handling text/html and multipart).
  3. Routing:
    • If the sender matches a known monitoring tool, it calls assistant.RecordNOCAlert.
    • Otherwise, it may package the email and send it to the assistant module to draft a reply or summarize the content.

Guidance for AI Agents

  • NOC Alerts: You will rarely interact directly with this module. Instead, you will receive the processed output of this module via the noc_intelligence system.
  • Email Drafting: When asked to draft an email response, ensure the tone matches the corporate persona (e.g., Sysafe or Delicious) and do not include markdown formatting, as standard emails are plain text or HTML.

Cross-References