Token导航 LogoToken导航TokenDH.com
效率敏感数据clawhub未标认证来源可访问clear审计提醒

imap-idleimap 空闲

Agent Skill

imap-idle 用于补充效率相关能力,适合在 OpenClaw 中需要让 Agent 承接效率相关任务时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

52,747

周安装

2,220

GitHub Stars

3

下载量

18,470
OpenClaw

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

MIT-0

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:imap-idle(imap 空闲)
来源仓库:https://github.com/topitip/imap-idle
安装命令:
openclaw skills install imap-idle
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 OpenClaw 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

ClawHubOpenClaw
openclaw skills install imap-idle

简介

使用 IMAP IDLE 协议进行事件驱动的电子邮件监控。通过 OpenClaw webhook 将轮询替换为即时推送通知。在设置电子邮件监控、替换每小时电子邮件检查或实施事件驱动的电子邮件处理时使用。监控多个 IMAP 帐户,在新邮件上触发 Webhook,等待时零令牌。

SKILL.md

name
imap-idle
description
Event-driven email monitoring using IMAP IDLE protocol. Replaces polling with instant push notifications via OpenClaw webhooks. Use when setting up email monitoring, replacing hourly email checks, or implementing event-driven email processing. Monitors multiple IMAP accounts, triggers webhooks on new mail, zero tokens while waiting.

IMAP IDLE Listener

Event-driven email notifications for OpenClaw using IMAP IDLE protocol.

What This Does

Replaces polling-based email checks with push notifications:

Before (polling):

  • Cron job checks email every hour
  • 16-24 checks per day
  • Up to 1 hour delay for new emails
  • Token burn on empty checks

After (IMAP IDLE):

  • Persistent connection to IMAP server
  • Server pushes notification when new mail arrives
  • <1 second notification latency
  • Zero tokens while waiting

Quick Start

1. Enable OpenClaw Webhooks

Edit ~/.openclaw/openclaw.json:

{
  "hooks": {
    "enabled": true,
    "token": "generate-secure-random-token-here",
    "path": "/hooks"
  }
}

Restart gateway: openclaw gateway restart

2. Install Dependencies

pip3 install imapclient --user --break-system-packages

Optional but recommended: Install keyring for secure password storage:

pip3 install keyring --user --break-system-packages

With keyring, passwords are stored in your system's secure keychain (macOS Keychain, GNOME Keyring, etc.) instead of plain text in config files.

3. Run Setup

./imap-idle setup

Follow the interactive wizard to configure:

  • IMAP account(s) (host, port, username, password)
  • OpenClaw webhook URL and token
  • Log file location

4. Start Listener

./imap-idle start

Verify it's running:

./imap-idle status
./imap-idle logs

5. Test

Send yourself an email. You should see:

  1. Log entry in listener logs
  2. OpenClaw wakes instantly
  3. Email processed in main session

CLI Commands

imap-idle start    # Start listener in background
imap-idle stop     # Stop listener
imap-idle restart  # Restart listener
imap-idle status   # Check if running
imap-idle logs     # Show recent logs (default: 50 lines)
imap-idle logs N   # Show last N lines
imap-idle setup    # Run interactive setup wizard

Configuration

Config file: ~/.openclaw/imap-idle.json

{
  "accounts": [
    {
      "host": "mail.example.com",
      "port": 993,
      "username": "user@example.com",
      "password": "password",
      "ssl": true
    }
  ],
  "webhook_url": "http://127.0.0.1:18789/hooks/wake",
  "webhook_token": "your-webhook-token",
  "log_file": "~/.openclaw/logs/imap-idle.log",
  "idle_timeout": 300,
  "reconnect_interval": 900,
  "debounce_seconds": 10
}

Fields:

  • accounts - Array of IMAP accounts to monitor
  • webhook_url - OpenClaw webhook endpoint
  • webhook_token - Webhook authentication token (from openclaw.json)
  • log_file - Path to log file (null for stdout)
  • idle_timeout - IDLE check timeout in seconds (default: 300 = 5 min)
  • reconnect_interval - Full reconnect interval in seconds (default: 900 = 15 min)
  • debounce_seconds - Batch events for N seconds before webhook (default: 10 sec)

Secure Password Storage (Keyring)

🔐 Recommended: Store passwords in system keychain instead of config file.

Setup with Keyring

When you run ./imap-idle setup, the wizard will ask if you want to use keyring. If you say yes:

  • Passwords are stored in your system's secure keychain
  • Config file only contains usernames (no passwords)
  • Keyring uses OS-level encryption

Manual Keyring Setup

If you already have a config with plain text passwords, migrate to keyring:

# Install keyring
pip3 install keyring --user --break-system-packages

# Store password for each account
python3 -c "
import keyring, getpass
username = 'user@example.com'
password = getpass.getpass(f'Password for {username}: ')
keyring.set_password('imap-idle', username, password)
"

# Remove password from config
# Edit ~/.openclaw/imap-idle.json and remove "password" field

How Keyring Works

The listener automatically tries keyring first, then falls back to config:

  1. Try keyring.get_password('imap-idle', username)
  2. If not found, use config['password']
  3. If still no password, abort connection

Security Benefits

  • ✅ No plain text passwords in config files
  • ✅ OS-level encryption (macOS Keychain, GNOME Keyring, Windows Credential Manager)
  • ✅ Reduces VirusTotal false positives
  • ✅ Better security audit trail

How It Works

  1. Connect: Opens persistent IMAP connection per account
  2. IDLE: Enters IDLE mode (server will push notifications)
  3. Wait: Blocks until server sends "new mail" notification
  4. Fetch: Retrieves new email headers (From, Subject, body preview)
  5. Queue: Adds event to debounce buffer (batches for 10 seconds)
  6. Webhook: Sends batched events via webhook (single or grouped)
  7. Resume: Re-enters IDLE mode

Key Implementation Details:

  • Debouncing: Batches emails for 10 seconds before webhook to prevent flooding during spikes (e.g., GitHub mention storms)
  • Smart Batching: Single email → full details, multiple emails → grouped summary with counts
  • UID Tracking: Tracks last processed message UID per account to prevent duplicate webhooks
  • Keep-alive: IDLE timeout every 5 minutes, sends NOOP command
  • Reconnect: Full reconnect every 15 minutes to prevent stale connections
  • Threading: One thread per account for concurrent monitoring
  • Error handling: Exponential backoff (5s → 300s) on connection failures

Systemd Service (Optional)

For automatic startup on boot:

  1. Generate service file:
skill_dir="$(pwd)"
listener_script="$skill_dir/scripts/listener.py"
config_file="$HOME/.openclaw/imap-idle.json"
log_file="$HOME/.openclaw/logs/imap-idle.log"
log_dir="$(dirname "$log_file")"

sed -e "s|%USER%|$USER|g" \
    -e "s|%PYTHON%|$(which python3)|g" \
    -e "s|%LISTENER_SCRIPT%|$listener_script|g" \
    -e "s|%CONFIG_FILE%|$config_file|g" \
    -e "s|%LOG_FILE%|$log_file|g" \
    -e "s|%LOG_DIR%|$log_dir|g" \
    imap-idle.service.template > imap-idle.service
  1. Install service:
sudo cp imap-idle.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable imap-idle
sudo systemctl start imap-idle
  1. Check status:
sudo systemctl status imap-idle
sudo journalctl -u imap-idle -f

Troubleshooting

Listener won't start:

  • Check config file exists: cat ~/.openclaw/imap-idle.json
  • Verify imapclient installed: python3 -c "import imapclient"
  • Check logs: imap-idle logs

Duplicate webhooks:

  • Fixed in v2 - uses UID tracking to prevent duplicates
  • Check logs for "UID tracking" messages

Connection drops:

  • Increase reconnect_interval in config
  • Check IMAP server allows IDLE (most do)
  • Verify firewall allows persistent connections

No webhooks triggering:

  • Test webhook manually:
  curl -X POST http://127.0.0.1:18789/hooks/wake \
    -H "Authorization: Bearer YOUR_TOKEN" \
    -H "Content-Type: application/json" \
    -d '{"text": "test", "mode": "now"}'
  • Check OpenClaw config: hooks.enabled: true
  • Verify token matches in both configs

Removing Polling

Once IMAP IDLE is working, remove old polling cron jobs:

# List cron jobs
openclaw cron list

# Remove email check job
openclaw cron remove <job-id>

Token Savings

Before:

  • 16-24 email checks per day
  • Each check = ~500-1000 tokens (even if no new mail)
  • Total: ~8,000-24,000 tokens/day for email monitoring

After:

  • 0 tokens while waiting
  • Tokens only spent when email actually arrives
  • 90%+ reduction in email-related token usage

Credits

Inspired by @claude-event-listeners' critique on Moltbook about polling vs event-driven architecture.

Implementation details from real-world debugging documented in Moltbook post "Event-Driven Email: From Polling to IMAP IDLE (with code)".

适合场景

01

OpenClaw 用户查找和安装 Skill 时

02

用户想查找某类 Agent Skill 时

03

需要根据任务场景推荐可安装能力包时

04

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

能力 5

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

OpenClaw

79.27%
按下载量换算14,641

安全审计

VirusTotal

通过

ClawScan

可疑

Static analysis

未展示

权限和风险

敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills