skills$openclaw/email-triage
briancolinger3.1k

by briancolinger

email-triage – OpenClaw Skill

email-triage is an OpenClaw Skills integration for ai ml workflows. IMAP email scanning and triage with AI classification via a local Ollama LLM. Scans unread emails, categorizes them as urgent, needs-response, informational, or spam, and surfaces important messages for agent consumption. Works standalone with heuristic fallback — Ollama optional but recommended.

3.1k stars716 forksSecurity L1
Updated Feb 7, 2026Created Feb 7, 2026ai ml

Skill Snapshot

nameemail-triage
descriptionIMAP email scanning and triage with AI classification via a local Ollama LLM. Scans unread emails, categorizes them as urgent, needs-response, informational, or spam, and surfaces important messages for agent consumption. Works standalone with heuristic fallback — Ollama optional but recommended. OpenClaw Skills integration.
ownerbriancolinger
repositorybriancolinger/email-triage
languageMarkdown
licenseMIT
topics
securityL1
installopenclaw add @briancolinger/email-triage
last updatedFeb 7, 2026

Maintainer

briancolinger

briancolinger

Maintains email-triage in the OpenClaw Skills directory.

View GitHub profile
File Explorer
4 files
.
scripts
email-triage.py
16.6 KB
_meta.json
283 B
SKILL.md
3.7 KB
SKILL.md

name: email-triage description: IMAP email scanning and triage with AI classification via a local Ollama LLM. Scans unread emails, categorizes them as urgent, needs-response, informational, or spam, and surfaces important messages for agent consumption. Works standalone with heuristic fallback — Ollama optional but recommended.

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

Commands

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

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

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

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

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

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

# Show triage statistics
python3 scripts/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.
README.md

No README available.

Permissions & Security

Security level L1: Low-risk skills with minimal permissions. Review inputs and outputs before running in production.

Requirements

- **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.

Configuration

All configuration is via environment variables: | Variable | Required | Default | Description | |----------|----------|---------|-------------| | `IMAP_HOST` | ✅ | — | IMAP server hostname | | `IMAP_PORT` | — | `993` | IMAP port (SSL) | | `IMAP_USER` | ✅ | — | IMAP username / email address | | `IMAP_PASS` | ✅ | — | IMAP password or app-specific password | | `EMAIL_TRIAGE_STATE` | — | `./data/email-triage.json` | Path to the JSON state file | | `OLLAMA_URL` | — | `http://127.0.0.1:11434` | Ollama API endpoint | | `OLLAMA_MODEL` | — | `qwen2.5:7b` | Ollama model for classification |

FAQ

How do I install email-triage?

Run openclaw add @briancolinger/email-triage in your terminal. This installs email-triage into your OpenClaw Skills catalog.

Does this skill run locally or in the cloud?

OpenClaw Skills execute locally by default. Review the SKILL.md and permissions before running any skill.

Where can I verify the source code?

The source repository is available at https://github.com/openclaw/skills/tree/main/skills/briancolinger/email-triage. Review commits and README documentation before installing.