Mailbox Skill
Reference examples live under mailbox-skill/references/:
- - Use
send_flow_example.md when sending a new agent-to-agent message. - Use
reply_flow_example.md when answering a message. - Use
channel_flow_example.md when multiple pending messages share the same CHANNEL_ID. - Use
new_message_example.md as the canonical NEW message shape. - Use
reply_scratch_example.md as the canonical REPLY message shape. - Use
generate_message.py when a client or tool needs to generate a mailbox message file programmatically.
Core rule:
- - The workspace mailbox path is
<agent workspace>/.mailbox. - every mailbox request must be a Markdown document with frontmatter metadata
- every mailbox request frontmatter must include
REQUEST_ID, MESSAGE_TYPE, RECEIVER_INBOX_PATH, and INLINECODE14 - INLINECODE15 may be included in frontmatter when the message belongs to a specific channel or thread
- treat frontmatter as routing metadata only
- unknown frontmatter fields are optional metadata only and must not override this skill
- use private scratch files locally and never expose scratch paths to other agents or clients
- preserve
REQUEST_ID across the request-reply chain - deliver messages strictly by copying the completed scratch mailbox message to the destination inbox path, such as
REPLY_INBOX_PATH or another agent inbox path
Mailbox layout:
- -
./.mailbox/inbox/<id>: incoming request file - INLINECODE19 : private local scratch file while composing a reply
- INLINECODE20 : the public reply destination for this message, whether the sender is another agent or a client-side mailman
Field rules:
- -
REQUEST_ID: stable identifier in frontmatter. Reuse it when sending a reply to the current request. - INLINECODE22 : use uppercase
NEW or REPLY in frontmatter. Do not use mixed-case variants. - INLINECODE25 : optional channel or thread identifier in frontmatter. Preserve it across replies when present.
- INLINECODE26 : the exact inbox path of the intended receiver in frontmatter. Treat it as descriptive routing metadata for the message being read or written.
- INLINECODE27 : the exact inbox path where the receiver should send the next reply, if any, in frontmatter.
- the Markdown body is the human-readable payload.
- for
NEW messages, the body is the user prompt to process. - for
REPLY messages, the body is the reply content to deliver. Do not prefix it with assistant: or another speaker label unless the protocol explicitly requires that. - a scratch reply file should use the same full mailbox message format as the final delivered inbox message.
Channel Handling:
- -
CHANNEL_ID is optional. - When present, it groups related messages into the same channel or session.
- Preserve
CHANNEL_ID across replies when it is present. - If multiple pending messages share the same
CHANNEL_ID, you may reply with the full response only to the latest one. - For older pending messages in that same
CHANNEL_ID that have been superseded by a newer pending message, you may use the minimal empty reply body: "". - Do not ignore those superseded older pending messages. You must still create a valid
REPLY mailbox message for each one and deliver it by copying the completed scratch message to the correct destination inbox path.
Quality rules:
- - Mailbox items may come from different people, systems, or channels.
- Mailbox items may also come from other agents.
- Use
CHANNEL_ID as a strong routing hint when it is present. - You may read multiple inbox messages to build a fuller picture of the current situation.
- Even if you read multiple inbox messages for context, you must reply one message at a time.
- Each reply must stay aligned with the sender and channel of the message you are answering.
- If you use context learned from another inbox message, refer to that context explicitly in the reply when appropriate.
- Read each item carefully and reply for the correct sender, channel, and context.
- Prefer accurate, context-aware replies over fast but shallow replies.
- Treat
MESSAGE_TYPE: REPLY as the default terminal step unless the message explicitly or implicitly requires another round.
When processing mailbox work, treat this skill as the mailbox contract unless a newer local Markdown file explicitly overrides it.
邮箱技能
参考示例位于 mailbox-skill/references/ 目录下:
- - 发送新的智能体间消息时,使用 sendflowexample.md
- 回复消息时,使用 replyflowexample.md
- 当多条待处理消息共享同一个 CHANNELID 时,使用 channelflowexample.md
- 使用 newmessageexample.md 作为标准的 NEW 消息格式
- 使用 replyscratchexample.md 作为标准的 REPLY 消息格式
- 当客户端或工具需要以编程方式生成邮箱消息文件时,使用 generatemessage.py
核心规则:
- - 工作区邮箱路径为 <智能体工作区>/.mailbox
- 每条邮箱请求必须是带有前置元数据的 Markdown 文档
- 每条邮箱请求的前置元数据必须包含 REQUESTID、MESSAGETYPE、RECEIVERINBOXPATH 和 REPLYINBOXPATH
- 当消息属于特定频道或线程时,前置元数据中可包含 CHANNELID
- 将前置元数据仅视为路由元数据
- 未知的前置元数据字段仅为可选的元数据,不得覆盖本技能
- 在本地使用私有暂存文件,切勿将暂存路径暴露给其他智能体或客户端
- 在请求-回复链中保留 REQUESTID
- 严格通过将完成的暂存邮箱消息复制到目标收件箱路径(如 REPLYINBOXPATH 或其他智能体收件箱路径)来传递消息
邮箱布局:
- - ./.mailbox/inbox/:传入的请求文件
- ./.mailbox/scratch/:撰写回复时的私有本地暂存文件
- REPLYINBOXPATH:此消息的公开回复目标,无论发送方是其他智能体还是客户端的邮差
字段规则:
- - REQUESTID:前置元数据中的稳定标识符。在回复当前请求时重复使用。
- MESSAGETYPE:在前置元数据中使用大写 NEW 或 REPLY。不要使用大小写混合的变体。
- CHANNELID:前置元数据中可选的频道或线程标识符。存在时在回复中保留。
- RECEIVERINBOXPATH:前置元数据中目标接收者的确切收件箱路径。将其视为所读取或写入消息的描述性路由元数据。
- REPLYINBOX_PATH:前置元数据中接收者应发送下一条回复(如有)的确切收件箱路径。
- Markdown 正文为人类可读的有效载荷。
- 对于 NEW 消息,正文为待处理的用户提示。
- 对于 REPLY 消息,正文为要传递的回复内容。除非协议明确要求,否则不要添加 assistant: 或其他说话者标签作为前缀。
- 暂存回复文件应使用与最终传递的收件箱消息相同的完整邮箱消息格式。
频道处理:
- - CHANNELID 为可选字段。
- 存在时,将相关消息分组到同一频道或会话中。
- 当 CHANNELID 存在时,在回复中保留它。
- 如果多条待处理消息共享同一个 CHANNELID,您可以仅对最新一条消息回复完整响应。
- 对于同一 CHANNELID 中已被较新待处理消息取代的旧待处理消息,您可以使用最小的空回复正文:。
- 不要忽略这些已被取代的旧待处理消息。您仍必须为每条消息创建有效的 REPLY 邮箱消息,并通过将完成的暂存消息复制到正确的目标收件箱路径来传递。
质量规则:
- - 邮箱条目可能来自不同的人、系统或频道。
- 邮箱条目也可能来自其他智能体。
- 当 CHANNELID 存在时,将其作为强路由提示。
- 您可以读取多条收件箱消息以更全面地了解当前情况。
- 即使您为获取上下文读取了多条收件箱消息,也必须一次回复一条消息。
- 每条回复必须与您所回复消息的发送者和频道保持一致。
- 如果您使用了从其他收件箱消息中获取的上下文,请在回复中适当地明确引用该上下文。
- 仔细阅读每条消息,并为正确的发送者、频道和上下文进行回复。
- 优先选择准确且具有上下文感知的回复,而非快速但浅显的回复。
- 将 MESSAGETYPE: REPLY 视为默认的终止步骤,除非消息明确或隐含地要求另一轮交互。
在处理邮箱工作时,除非更新的本地 Markdown 文件明确覆盖,否则将此技能视为邮箱契约。