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.
数据来源:ClawHub。 在 ClawSkills 查看
选择你使用的 Agent
方法一:命令行安装(推荐)
推荐(无需提前安装 clawhub)
npx clawhub@latest --dir ~/.claude/skills install imap-idle或使用 clawhub CLI(需提前安装)
clawhub --dir ~/.claude/skills install imap-idle⚠️ 需要 Node.js 18+,没有 Node?请使用下方方法二直接下载 ZIP。 安装 Node.js →
方法二:手动下载安装(无需 Node)
下载 ZIP,解压后将文件夹放到以下路径,重启 Agent 即可:
安装路径
~/.claude/skills/imap-idle/💡解压后将文件夹放到上方路径,重启 Agent 即可生效
--- 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. ---
Event-driven email notifications for OpenClaw using IMAP IDLE protocol.
Replaces polling-based email checks with push notifications:
Before (polling):
After (IMAP IDLE):
Edit ~/.openclaw/openclaw.json:
{
"hooks": {
"enabled": true,
"token": "generate-secure-random-token-here",
"path": "/hooks"
}
}
Restart gateway: openclaw gateway restart
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.
./imap-idle setup
Follow the interactive wizard to configure:
./imap-idle start
Verify it's running:
./imap-idle status
./imap-idle logs
Send yourself an email. You should see:
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
Config file: ~/.openclaw/imap-idle.json
{
"accounts": [
{
"host": "mail.example.com",
"port": 993,
"username": "[email protected]",
"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 monitorwebhook_url - OpenClaw webhook endpointwebhook_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)🔐 Recommended: Store passwords in system keychain instead of config file.
When you run ./imap-idle setup, the wizard will ask if you want to use keyring. If you say yes:
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 = '[email protected]'
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
The listener automatically tries keyring first, then falls back to config:
keyring.get_password('imap-idle', username)config['password']Key Implementation Details:
For automatic startup on boot:
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
sudo cp imap-idle.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable imap-idle
sudo systemctl start imap-idle
sudo systemctl status imap-idle
sudo journalctl -u imap-idle -f
Listener won't start:
cat ~/.openclaw/imap-idle.jsonpython3 -c "import imapclient"imap-idle logsDuplicate webhooks:
Connection drops:
reconnect_interval in configNo webhooks triggering:
```bash 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"}' ```
hooks.enabled: trueOnce IMAP IDLE is working, remove old polling cron jobs:
# List cron jobs
openclaw cron list
# Remove email check job
openclaw cron remove <job-id>
Before:
After:
Inspired by @claude-event-listeners' critique on Moltbook about polling vs event-driven architecture.
...
安装 Imap Idle Review 后,可以对 AI 说这些话来触发它
Send a Slack message to the #engineering channel about the deployment
Formats and sends the message with relevant context, tagging the right people
Summarize all unread messages in my inbox from today
Reads messages across connected channels and returns a prioritized summary
Draft a reply to this customer complaint and send it for review
Writes an empathetic, professional response and routes it to the approval queue
将技能文件夹放到 ~/.claude/skills/imap-idle/ 目录(个人级,所有项目可用),或 .claude/skills/imap-idle/(项目级)。重启 AI 客户端后,用 /imap-idle 主动调用,或让 AI 根据上下文自动发现并使用。
Imap Idle Review 支持 Claude、Cursor、OpenClaw,可与这些 AI 平台无缝集成,扩展其能力。
Imap Idle Review 可免费安装使用。请查阅仓库了解许可证信息。
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 Review 属于「Communication」分类,该分类的技能帮助 AI 智能体在此领域执行专业任务。