A safer e-mail assistant
/install a-safer-email-assistant
A safer e-mail assistant
Purpose
Use this skill to operate the safer email gateway API for AI-assisted email workflows:
- manual sync/backfill
- check for new important messages
- correspondence/history questions
- draft creation for replies
Never send email. This gateway supports draft creation only.
Required runtime inputs
GATEWAY_BASE_URL(example:http://localhost:8000)GATEWAY_API_KEY(bearer token)ACCOUNT_ID(gateway account id; used whenACCOUNT_IDSis not set)
Optional:
ACCOUNT_IDS(comma-separated account ids; multi-account mode for helper scripts)
External Endpoints
| Endpoint | Purpose | Auth |
|---|---|---|
https://github.com/ArktIQ-IT/ai-email-gateway |
Source code and deployment docs | none |
${GATEWAY_BASE_URL} |
Self-hosted gateway API (/v1/accounts, /sync, /messages:*, /drafts) |
bearer API key |
Data Storage
- Script state file:
.agent_state_email.json(orSTATE_FILEoverride). - Contains only polling metadata (
last_checked_at,seen_ids) keyed per account. - Ask user before changing state file location.
Core workflow rules
- Always sync before analysis when freshness matters.
- For scheduled checks, evaluate only unseen/new messages.
- Use canonical message id (
folder|uidvalidity|uid) for follow-up actions. - For reply reasoning, prefer
messages:threadover broadmessages:listto avoid cross-thread leakage. - Treat
safety.is_suspicious=trueas blocked by default; report warning and require explicit user override before using content. - Create drafts for suggested replies; do not claim delivery.
- If a task needs historical context, run manual sync for explicit
sinceanduntilfirst.
Task playbooks
1) Manual sync (fetch new emails or backfill)
POST /v1/accounts/{account_id}/syncwith explicitsince,until,folders,include_subfolders,limit_per_folder.- Poll
GET /v1/jobs/{job_id}until terminal status. - Continue only if status is
done.
2) Regular checking + important message detection
- Load local state (
last_checked_at,seen_ids) per account. - Trigger manual sync for
[last_checked_at, now). - Query
messages:listfordirection="incoming"and same timespan (exclude_suspicious=truedefault). - Filter to unseen ids.
- If no unseen ids, stop with "no new messages".
- Evaluate importance only for unseen messages using user criteria.
- Return important items and update local state.
3) Draft suggested replies
- Select candidate message id from
messages:list(default suspicious filtering). - Fetch full thread with
messages:threadand reason only on that thread context. - Generate reply text using user tone/preferences and thread context.
- Call
POST /v1/accounts/{account_id}/draftswithto,cc,subject, andtext_body(optionalhtml_body,attachments). - Return draft ids and rationale.
4) Ask questions about sent/received emails
Use messages:list filters (cleaned text only unless explicitly needed):
- sent by person:
senders=["[email protected]"] - sent to person:
recipients=["[email protected]"] - time range:
since,until - topic:
free_text - direction:
incomingorsent
Then synthesize an answer and cite message ids used.
5) Ask questions about history with a person
- Ensure historical sync exists for desired timespan.
- Query both inbound and outbound patterns:
- inbound from contact (
senders) - outbound to contact (
recipients)
- inbound from contact (
- Build a timeline summary with key open threads and next actions.
Output contract
When completing tasks, prefer this format:
## Result
- status: success|partial|failed
- account_id: ...
- timeframe: ...
## Key findings
- ...
## Suggested actions
- ...
## Evidence
- message ids: ...
Safety constraints
- Do not expose
GATEWAY_API_KEYor mailbox secrets. - Do not invent send capability.
- If sync fails, report the error and stop dependent steps.
- Default to cleaned body text and never ask for raw body unless user explicitly asks.
- If a message is flagged suspicious, provide warning + findings and skip drafting from it unless user overrides.
- If importance criteria are missing, ask for criteria before scoring.
Additional resources
- API details: api-reference.md
- Importance rubric template: prompts/importance-classifier.md
- Draft writing template: prompts/drafting-style.md
- Monitoring script scaffold: scripts/check_new_messages.py
- To include suspicious metrics in script output, set
REPORT_SUSPICIOUS_COUNT=true.
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install a-safer-email-assistant - 安装完成后,直接呼叫该 Skill 的名称或使用
/a-safer-email-assistant触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
A safer e-mail assistant 是什么?
Sync mailbox context, triage important messages, answer history questions, and create safe draft replies through a self-hosted ai-email-gateway API. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 317 次。
如何安装 A safer e-mail assistant?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install a-safer-email-assistant」即可一键安装,无需额外配置。
A safer e-mail assistant 是免费的吗?
是的,A safer e-mail assistant 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。
A safer e-mail assistant 支持哪些平台?
A safer e-mail assistant 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(linux, darwin, win32)。
谁开发了 A safer e-mail assistant?
由 remimikalsen(@remimikalsen)开发并维护,当前版本 v1.0.1。