Agent Mailbox
Use this skill for a very lightweight internal mail system between OpenClaw agent workspaces.
Design goals
- - No central registry
- No guaranteed delivery
- No push notifications
- No group-message storms
- Best-effort fanout only
- Per-workspace local inboxes
- Token-efficient reads: each agent reads only its own inbox
- Advisory context only, not an execution bus
- Local filesystem only, not cloud sync or webhook delivery
This is a middle layer between long-term memory and chat messaging.
Safety boundary
This skill is intentionally narrow.
It is for local mailbox-style context sharing only.
It does not implement:
- - automatic task execution
- autonomous task dispatch
- webhook callbacks
- remote sync
- cloud delivery
- receipt tracking
- retry queues
Mailbox items should be treated as advisory hints for local agent judgment, not commands that must be executed.
Mailbox location
Each workspace owns its own local mailbox under:
INLINECODE0
Subdirectories:
- -
inbox/ — unread or pending mail files - INLINECODE2 — consumed mail files
Examples:
Fanout model
Sender scripts scan candidate workspaces using a configurable glob pattern.
Default pattern:
INLINECODE5
Override with MAILBOX_GLOB when your workspaces live elsewhere.
If a workspace contains .agent-mailbox/inbox/, write a mail file there.
If the path does not exist or write fails, skip it.
Do not maintain a registry. Do not retry failed deliveries. Do not block on partial failure.
File model
One mail = one file.
Filename format:
INLINECODE8
Example:
INLINECODE9
Fields:
- -
stamp — INLINECODE11 - INLINECODE12 — short sender id
- INLINECODE13 —
info, warn, or INLINECODE16 - INLINECODE17 — short readable identifier
Mail content
Use a short header followed by a blank line and body.
Example:
CODEBLOCK0
Baseline integration
For best results, integrate mailbox checking into the agent's baseline startup or task-entry workflow.
Recommended baseline rule:
- - If
.agent-mailbox/inbox/ exists in the current workspace, check only the newest 1-3 mail files before normal task work - Read only enough to determine relevance
- Compress relevant mail into a very short working summary
- Archive processed mail immediately so inbox stays small
- Do not rebroadcast, auto-reply, or auto-write all mail into long-term memory
This makes the mailbox reliable in practice while keeping token cost low.
Read flow
When loading this skill in a workspace:
- 1. Ensure the local mailbox exists
- List files in local INLINECODE19
- Read only the newest few files you need
- Summarize them briefly into context
- Decide whether to ignore, use for this session, or adopt into memory
- Archive or delete consumed mail so it is not repeatedly re-read
Prefer reading only 1–5 newest mails.
Receiver handling policy
Treat mailbox items as single-consumption lightweight context hints.
Default handling:
- 1. Read the newest relevant mail
- Compress it into a very short summary for the current task
- Decide whether it matters only for this turn or should affect longer-lived memory
- Archive it after processing so it leaves the inbox
Recommended decision model:
- -
critical — read first; usually affect current behavior immediately - INLINECODE21 — read and adopt when relevant to current work
- INLINECODE22 — skim quickly; keep only if useful
Possible outcomes after reading:
- - Ignore — not relevant; archive it
- Session-use only — use it for the current turn/session; archive it
- Adopt to memory — if it represents a durable fact, explicitly write the distilled version into the proper memory file; then archive it
- Act now — if it changes current execution, apply it and archive it
Do not automatically:
- - rebroadcast mail
- reply to the sender through chat
- write all mail into long-term memory
- keep already-processed mail in INLINECODE23
Inbox should contain only unprocessed mail. Archive should contain processed mail.
Archive policy
Default: archive after reading, do not keep re-reading inbox mail.
Archive path:
INLINECODE24
This keeps the inbox small and token cost low.
Good uses
- - low-noise cross-agent operational note
- temporary warning for other workspaces
- lightweight fanout without chat delivery
- “FYI only” advisory
- coordination hint that does not belong in long-term memory yet
- local best-effort sharing of small, non-urgent context
Avoid
- - secrets unless truly necessary
- large documents
- durable memory that belongs in MEMORY.md or memory/YYYY-MM-DD.md
- real-time urgent alerts that should use actual messaging
- any design that assumes guaranteed delivery
- any design that expects mailbox files to trigger automatic execution
- any claim of cloud sync, webhook transport, or remote callback support
Recommended AGENTS.md snippet
You can paste this into a workspace's AGENTS.md:
CODEBLOCK1
Minimal receive command pattern
Use this minimal pattern when an agent wants to consume mailbox items manually from shell.
This pattern is intentionally local and conservative: inspect, summarize, archive.
It should not be extended into automatic execution of mailbox contents.
CODEBLOCK2
Use this behavior convention:
- - check only the newest mail first
- read only enough to judge relevance
- archive immediately after processing
- keep inbox small
If you need a slightly broader pass, read up to 3 mails:
CODEBLOCK3
Scripts
Use bundled scripts when possible:
- -
scripts/init-mailbox.sh — initialize a mailbox in a workspace - INLINECODE27 — fan out mail to mailbox-enabled workspaces
- INLINECODE28 — list local inbox mail
- INLINECODE29 — archive a consumed mail file
- INLINECODE30 — prune old archive files
Read the script directly if you need to inspect or change behavior.
Agent Mailbox
使用此技能在OpenClaw代理工作空间之间实现一个非常轻量级的内部邮件系统。
设计目标
- - 无中央注册表
- 无投递保证
- 无推送通知
- 无群消息风暴
- 仅尽力分发
- 每个工作空间拥有本地收件箱
- 令牌高效读取:每个代理只读取自己的收件箱
- 仅提供咨询上下文,非执行总线
- 仅使用本地文件系统,不支持云同步或Webhook投递
这是长期记忆与聊天消息之间的中间层。
安全边界
此技能被刻意限制范围。
它仅用于本地邮箱式上下文共享。
它不实现:
- - 自动任务执行
- 自主任务分发
- Webhook回调
- 远程同步
- 云投递
- 回执跟踪
- 重试队列
邮箱项目应被视为供本地代理判断的咨询提示,而非必须执行的命令。
邮箱位置
每个工作空间拥有自己的本地邮箱,位于:
/.agent-mailbox/
子目录:
- - inbox/ — 未读或待处理的邮件文件
- archive/ — 已消费的邮件文件
示例:
- - /path/to/workspace/.agent-mailbox/inbox/
- /path/to/another-workspace/.agent-mailbox/inbox/
分发模型
发送脚本使用可配置的glob模式扫描候选工作空间。
默认模式:
$HOME/.openclaw/workspace*
当工作空间位于其他位置时,使用MAILBOX_GLOB覆盖。
如果工作空间包含.agent-mailbox/inbox/,则在此处写入邮件文件。
如果路径不存在或写入失败,则跳过。
不维护注册表。不重试失败的投递。不因部分失败而阻塞。
文件模型
一封邮件 = 一个文件。
文件名格式:
<时间戳>--<发送者>--<优先级>--<标识符>.md
示例:
20260322100000--main--warn--cron-list-broken.md
字段:
- - 时间戳 — YYYYMMDDHHMMSS
- 发送者 — 简短发送者ID
- 优先级 — info、warn或critical
- 标识符 — 简短可读标识符
邮件内容
使用简短头部,后跟空行和正文。
示例:
text
Title: cron list 异常
From: main
Created-At: 2026-03-22T10:00:00+08:00
Priority: warn
Tags: cron,ops
openclaw cron list 当前报错,先不要依赖其输出。
建议改用:
- - openclaw cron status
- openclaw cron runs
基线集成
为获得最佳效果,将邮箱检查集成到代理的基线启动或任务入口工作流中。
推荐基线规则:
- - 如果当前工作空间存在.agent-mailbox/inbox/,在正常任务工作前仅检查最新的1-3封邮件文件
- 仅读取足够判断相关性的内容
- 将相关邮件压缩为非常简短的工作摘要
- 立即归档已处理的邮件,保持收件箱小巧
- 不重新广播、自动回复或自动将所有邮件写入长期记忆
这使邮箱在实践中可靠,同时保持令牌成本低廉。
读取流程
在工作空间中加载此技能时:
- 1. 确保本地邮箱存在
- 列出本地inbox/中的文件
- 仅读取所需的最新几封文件
- 将其简要总结到上下文中
- 决定忽略、用于本次会话或纳入记忆
- 归档或删除已消费的邮件,避免重复读取
建议仅读取1-5封最新邮件。
接收者处理策略
将邮箱项目视为一次性消费的轻量级上下文提示。
默认处理方式:
- 1. 读取最新相关邮件
- 将其压缩为当前任务的非常简短摘要
- 决定它仅影响本轮还是应影响长期记忆
- 处理后归档,使其离开收件箱
推荐决策模型:
- - critical — 优先读取;通常立即影响当前行为
- warn — 读取并在与当前工作相关时采纳
- info — 快速浏览;仅在有帮助时保留
读取后可能的结果:
- - 忽略 — 不相关;归档
- 仅会话使用 — 用于当前轮次/会话;归档
- 纳入记忆 — 如果代表持久事实,将精简版本显式写入适当的记忆文件;然后归档
- 立即行动 — 如果改变当前执行,应用并归档
不要自动:
- - 重新广播邮件
- 通过聊天回复发送者
- 将所有邮件写入长期记忆
- 将已处理的邮件保留在inbox/中
收件箱应仅包含未处理的邮件。归档应包含已处理的邮件。
归档策略
默认:读取后归档,不重复读取收件箱邮件。
归档路径:
/.agent-mailbox/archive/
这保持收件箱小巧,令牌成本低廉。
良好用途
- - 低噪音的跨代理操作通知
- 对其他工作空间的临时警告
- 无需聊天投递的轻量级分发
- 仅供参考的咨询信息
- 尚不属于长期记忆的协调提示
- 小型非紧急上下文的本地尽力共享
避免
- - 除非确实必要,否则不包含机密信息
- 大型文档
- 应属于MEMORY.md或memory/YYYY-MM-DD.md的持久记忆
- 应使用实际消息传递的实时紧急警报
- 任何假设投递保证的设计
- 任何期望邮箱文件触发自动执行的设计
- 任何声称支持云同步、Webhook传输或远程回调的声明
推荐的AGENTS.md片段
你可以将其粘贴到工作空间的AGENTS.md中:
markdown
📬 轻量级邮箱检查
如果此工作空间有.agent-mailbox/inbox/,在开始正常任务工作前进行非常轻量的邮箱检查:
- 1. 仅查看最新的1-3封邮件文件
- 仅读取足够判断相关性的内容
- 将相关邮件压缩为非常简短的工作摘要
- 归档已处理的邮件,保持收件箱小巧
- 不要重新广播、自动回复或将所有邮件转储到长期记忆
将邮箱项目视为轻量级内部协调提示,而非聊天消息或永久记忆。
最小接收命令模式
当代理希望从shell手动消费邮箱项目时,使用此最小模式。
此模式刻意保持本地化和保守:检查、总结、归档。
不应扩展为自动执行邮箱内容。
bash
MAIL=$(./skills/agent-mailbox/scripts/list-mailbox.sh . 1 | head -n 1)
if [ -n $MAIL ]; then
sed -n 1,40p $MAIL
./skills/agent-mailbox/scripts/archive-mailbox.sh $MAIL >/dev/null
fi
使用此行为约定:
- - 仅先检查最新邮件
- 仅读取足够判断相关性的内容
- 处理后立即归档
- 保持收件箱小巧
如果需要稍宽泛的检查,最多读取3封邮件:
bash
./skills/agent-mailbox/scripts/list-mailbox.sh . 3
脚本
尽可能使用捆绑脚本:
- - scripts/init-mailbox.sh — 在工作空间中初始化邮箱
- scripts/send-mailbox.sh — 向启用邮箱的工作空间分发邮件
- scripts/list-mailbox.sh — 列出本地收件箱邮件
- scripts/archive-mailbox.sh — 归档已消费的邮件文件
- scripts/cleanup-mailbox.sh — 清理旧的归档文件
如需检查或更改行为,直接阅读脚本。