Use when working through the workspace mailbox protocol under .mailbox, including reading inbox items, composing replies in a private scratch area, and deliv...
--- name: mailbox-skill description: Use when working through the workspace mailbox protocol under .mailbox, including reading inbox items, composing replies in a private scratch area, and delivering final replies to a reply inbox path for agent-to-agent communication. --- # 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 `REPLY_INBOX_PATH` - `CHANNEL_ID` 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 - `./.mailbox/scratch/<id>`: private local scratch file while composing a reply - `REPLY_INBOX_PATH`: 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. - `MESSAGE_TYPE`: use uppercase `NEW` or `REPLY` in frontmatter. Do not use mixed-case variants. - `CHANNEL_ID`: optional channel or thread identifier in frontmatter. Preserve it across replies when present. - `RECEIVER_INBOX_PATH`: the exact inbox path of the intended receiver in frontmatter. Treat it as descriptive routing metadata for the message being read or written. - `REPLY_INBOX_PATH`: 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.
don't have the plugin yet? install it then click "run inline in claude" again.
added explicit intent, mapped inputs with connection details, broke procedure into six numbered steps with input-output pairs, extracted decision logic into dedicated section covering message types and channel handling, documented output contract with file formats and success criteria, and defined outcome signal with observable verification points.
use this skill whenever you need to work with the workspace mailbox protocol for agent-to-agent communication. the mailbox lives under .mailbox and handles three core flows: reading incoming requests from your inbox, composing replies in a private scratch area, and delivering final replies to designated inbox paths. use mailbox-skill when routing messages between agents, managing threaded conversations via CHANNEL_ID, or bridging client requests to agent workflows.
workspace mailbox structure:
.mailbox/inbox/<id>: incoming request files you read.mailbox/scratch/<id>: private local working area for reply compositionREPLY_INBOX_PATH: public destination inbox path where receiver expects your replyfrontmatter metadata required in every mailbox message:
REQUEST_ID: stable identifier preserved across request-reply chainsMESSAGE_TYPE: either NEW or REPLY (uppercase only)RECEIVER_INBOX_PATH: exact inbox path of intended receiver, used as routing hintREPLY_INBOX_PATH: exact inbox path where receiver sends next replyfrontmatter metadata optional:
CHANNEL_ID: groups related messages into a thread or session; preserve across replies if presentexternal connections:
reference files (available under mailbox-skill/references/):
send_flow_example.md: canonical example for sending a new agent-to-agent messagereply_flow_example.md: canonical example for answering an existing messagechannel_flow_example.md: canonical example when multiple pending messages share CHANNEL_IDnew_message_example.md: canonical shape for MESSAGE_TYPE: NEWreply_scratch_example.md: canonical shape for MESSAGE_TYPE: REPLY in scratch filesgenerate_message.py: programmatic message file generation when neededread incoming inbox message
REQUEST_ID and inbox file path (e.g., .mailbox/inbox/<id>)REQUEST_ID, MESSAGE_TYPE, RECEIVER_INBOX_PATH, REPLY_INBOX_PATH, CHANNEL_ID (if present)NEW messages, context data for REPLY messages)scan for related messages in same channel (if applicable)
CHANNEL_ID from step 1 (skip if absent).mailbox/inbox/ for other files with matching CHANNEL_ID in frontmatterread full context if multi-message channel
REQUEST_ID to message context for each related messagecompose reply in scratch area
.mailbox/scratch/<REQUEST_ID> (reuse the same REQUEST_ID)REQUEST_ID (preserved), MESSAGE_TYPE: REPLY, RECEIVER_INBOX_PATH (from original), REPLY_INBOX_PATH (from original), CHANNEL_ID (preserved if present)""deliver reply to destination inbox
REPLY_INBOX_PATH frontmatterREPLY_INBOX_PATHREPLY_INBOX_PATH valuesmark processing complete
if MESSAGE_TYPE is NEW:
MESSAGE_TYPE: REPLYif MESSAGE_TYPE is REPLY:
REPLY using the same REQUEST_IDif CHANNEL_ID is present:
.mailbox/inbox/ with the same CHANNEL_IDCHANNEL_ID, reply only with full content to the latest oneREPLY messages with empty body ("") and deliver each to its own REPLY_INBOX_PATHif CHANNEL_ID is absent:
if REPLY_INBOX_PATH is unavailable or malformed:
if inbox file cannot be read (permissions, corruption, missing):
if you need to read multiple inbox messages for context:
REQUEST_ID and CHANNEL_IDscratch file format (step 4):
.mailbox/scratch/<REQUEST_ID>---
REQUEST_ID: <preserved from original>
MESSAGE_TYPE: REPLY
RECEIVER_INBOX_PATH: <from original REQUEST>
REPLY_INBOX_PATH: <from original REQUEST>
CHANNEL_ID: <preserved if present, else omitted>
---
"" for superseded messages)delivered file format (step 5):
REPLY_INBOX_PATH from frontmattersuccess state:
REPLY mailbox fileREQUEST_ID is preserved across all files in the request-reply chainCHANNEL_ID is preserved if originally presentREPLY is delivered to the correct REPLY_INBOX_PATHMESSAGE_TYPE changes to REPLY)you know this skill worked when:
.mailbox/scratch/<REQUEST_ID> is created with correct frontmatter and reply bodyREPLY_INBOX_PATHREQUEST_ID, MESSAGE_TYPE: REPLY, and reply contentREPLY files at their respective REPLY_INBOX_PATH values, each with minimal empty bodyREQUEST_ID and updated CHANNEL_ID (if applicable)