← 返回
沟通协作

email-triage

IMAP email scanning and triage with AI classification via a local Ollama LLM. Scans unread emails, categorizes them as urgent, needs-response, informational,...
利用本地Ollama大语言模型进行AI分类的IMAP邮件扫描与分级功能。扫描未读邮件,将其归类为紧急、需回复、参考信息等。
briancolinger
沟通协作 clawhub v1.0.1 1 版本 99669.4 Key: 无需
★ 2
Stars
📥 2,673
下载
💾 13
安装
1
版本
#latest

概述

Email Triage

Scan your IMAP inbox, classify emails into priority categories, and surface the ones that need attention. Uses a local LLM (Ollama) for intelligent classification with a rule-based heuristic fallback when Ollama is unavailable.

Prerequisites

  • Python 3.10+
  • IMAP-accessible email account (Gmail, Fastmail, self-hosted, etc.)
  • Ollama (optional) — for AI-powered classification. Without it, the script uses keyword-based heuristics that still work well for common patterns.

Categories

IconCategoryDescription
-----------------------------
🔴urgentOutages, security alerts, legal, payment failures, time-critical
🟡needs-responseBusiness inquiries, questions, action items requiring a reply
🔵informationalReceipts, confirmations, newsletters, automated notifications
spamMarketing, promotions, unsolicited junk

Configuration

All configuration is via environment variables:

VariableRequiredDefaultDescription
------------------------------------------
IMAP_HOSTIMAP server hostname
IMAP_PORT993IMAP port (SSL)
IMAP_USERIMAP username / email address
IMAP_PASSIMAP password or app-specific password
EMAIL_TRIAGE_STATE./data/email-triage.jsonPath to the JSON state file
OLLAMA_URLhttp://127.0.0.1:11434Ollama API endpoint
OLLAMA_MODELqwen2.5:7bOllama model for classification

Directories Written

  • EMAIL_TRIAGE_STATE (default: ./data/email-triage.json) — Persistent state file tracking classified emails and surfacing status

Commands

# Scan inbox and classify new unread emails
python3 scripts/email/email-triage.py scan

# Scan with verbose output (shows each classification)
python3 scripts/email/email-triage.py scan --verbose

# Dry run — scan and classify but don't save state
python3 scripts/email/email-triage.py scan --dry-run

# Show unsurfaced important emails (urgent + needs-response)
python3 scripts/email/email-triage.py report

# Same as report but JSON output (for programmatic use)
python3 scripts/email/email-triage.py report --json

# Mark reported emails as surfaced (so they don't appear again)
python3 scripts/email/email-triage.py mark-surfaced

# Show triage statistics
python3 scripts/email/email-triage.py stats

How It Works

  1. Connects to IMAP over SSL and fetches unread messages (up to 20 per scan).
  2. Deduplicates by Message-ID (or a hash of subject + sender as fallback) so emails are never classified twice.
  3. Classifies each email using Ollama if available, otherwise falls back to keyword heuristics.
  4. Stores state in a local JSON file — tracks category, reason, and whether the email has been surfaced.
  5. report surfaces only unsurfaced urgent and needs-response emails, sorted by priority.
  6. mark-surfaced flags reported emails so they won't appear in future reports.
  7. Auto-prunes state to the most recent 200 entries to prevent unbounded growth.

Integration Tips

  • Heartbeat / cron: Run scan periodically, then report --json to check for items needing attention.
  • Agent workflow: scanreport --json → act on results → mark-surfaced.
  • Without Ollama: The heuristic classifier handles common patterns (automated notifications, marketing, urgent keywords) well. Ollama adds nuance for ambiguous emails.
  • App passwords: If your provider uses 2FA, generate an app-specific password for IMAP access.

版本历史

共 1 个版本

  • v1.0.1 当前
    2026-03-28 14:34 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

communication-collaboration

Slack

steipete
当需要通过 slack 工具从 Clawdbot 控制 Slack 时使用,包括在频道或私信中回复消息或置顶/取消置顶项目。
★ 157 📥 47,674
communication-collaboration

imap-smtp-email

gzlicanyi
使用IMAP/SMTP读取和发送邮件;检查新/未读邮件、获取内容、搜索邮箱、标记已读/未读、发送带附件的邮件。支持...
★ 113 📥 52,397
communication-collaboration

Himalaya

lamelas
{"answer":"通过IMAP/SMTP管理邮件的CLI。可在终端使用 `himalaya` 收发、回复、转发、搜索及整理邮件。支持多账户与MML(MIME元语言)编写邮件。"}
★ 68 📥 45,581