AGENT SKILL

message-agents

ALWAYS invoke this skill when sending a message record to a registered agent-mail name with its one-line doorbell, discovering a Prowl coding-agent recipient, or sending facts, ownership proposals, state reports, authorizations, or acknowledgements to another agent pane.

License 许可
MIT
所属仓库
outcomeeng/plugins
最近更新
2026-11-14
Stars
★ 1
Forks
1

01 前言 Front Matter

name
message-agents
description
ALWAYS invoke this skill when sending a message record to a registered agent-mail name with its one-line doorbell, discovering a Prowl coding-agent recipient, or sending facts, ownership proposals, state reports, authorizations, or acknowledgements to another agent pane.
allowed-tools
Write, {{! tool('use_skill') !}}, Bash(python3 "${CLAUDE_SKILL_DIR}/scripts/agent_message.py":*), {{! tool('ask_user') !}}
argument-hint
<JSON message request>

02 资源文件 1

03 SKILL.md 正文

<objective> One message delivered on the route its request selects — a message record in the agent-mail store with its one-line doorbell, or a source-owned message envelope submitted into one complete Prowl pane — with delivery kept distinct from acknowledgement, agreement, authorization, and ownership, or a doorbell line from the caller's own pane resolved to its sender and store id. </objective>

<route_selection>

The request shape selects one of three routes. A request carrying recipient as an agent-mail name, correlation, body, and ackRequired is a mail request and follows <mail_route>. A request carrying recipientPath, facts, and a pane-bound kind and no recipient, body, or ackRequired is a Prowl request and follows <workflow>. A request carrying line and agents is a doorbell resolution and follows <mail_route> step 8. A request that mixes the fields of two of these shapes, a request that matches none, and an empty or whitespace request are invalid-schema before any discovery or delivery; the bundled script rejects fields outside the selected route's shape. The recovery names each route's own required fields: kind, correlation, sender, recipient, subject, body, and ackRequired for the mail route; recipientPath, kind, subject, and facts for the Prowl route; and line and agents for the doorbell route.

</route_selection>

<mail_route>

  1. Read $ARGUMENTS as one JSON message request with exactly kind, correlation, sender, recipient, subject, body, and ackRequired, plus authority only on a same-worktree delegation-request, plus an optional repository and an optional doorbell endpoint. sender is the caller's own registered agent-mail name and recipient is one registered name. kind is one of order, fact, question, answer, delegation-request, delegation-completed, delegation-failed, delegation-rejected, or delegation-unavailable. correlation is the thread every reply to one exchange shares. A same-worktree delegation-request carries authority with exactly owner equal to sender and gitMutation: false; an authority of any other shape — a missing owner, another owner, gitMutation admitted, or any extra field — reaches no record. Supplying authority on a same-worktree delegation is the sender's obligation; the script rejects no request for lacking it. The record body opens with that authority rendered. doorbell names where the recipient's pane is found and nothing else: {"recipientPath": "<absolute worktree, repository, or working-directory path>"} for a Prowl pane, or {"agent": "<the herdr agent name>"} for a herdr pane. doorbell never enters the record; remove it from the request before step 2. repository names the repository whose mail project receives the send, as the caller names it, and the script carries it unchanged into the capability's send request; a request without repository yields a send request carrying none, and the capability then selects the project. repository selects the store and never enters the record or the doorbell, and the caller names it only when the send must reach a mail project other than the capability's default.
  2. Pass the request to the bundled script's mail-request operation. It returns the record and the complete capability send request for the agent-mail capability.
  3. Use skill coding-agents:operate-agent-mail once with that capability request unchanged. Preserve its complete result.
  4. Pass the capability result to the bundled script's mail-result operation as capabilityResult. A succeeded result whose data.record carries the store-assigned id returns status: "delivered" with the doorbell.text line [<Label> <<sender>>] mail <id> when the capability result's response carries a renderable sender_display_name for the sender, and [<sender>] mail <id> otherwise. A label is unrenderable when it is empty, carries a line break, or carries any of [, ], <, >; the doorbell then takes the unlabeled form and the full label stays in the preserved capability result. Any other capability result returns delivery-failed with the capability's status and detail preserved. Delivery is the record in the store; stop here on delivery-failed.
  5. Resolve the doorbell endpoint. Without doorbell, ring nothing: report the delivered record with doorbell.submitted: false and say that no endpoint was named. With recipientPath, use skill coding-agents:operate-prowl once for resolve-target with that path, exactly as <workflow> step 2 does, and select the candidate by the same rules as <workflow> step 3; on identity-unavailable or an unresolved caller identity, report the exact detail beside the delivered record and ring nothing. With agent, the herdr capability selects the session by that name and no resolution runs.
  6. Ring the doorbell: send exactly doorbell.text and nothing else into the resolved endpoint. For a Prowl pane, fill the selected candidate's sendRequestTemplate text with doorbell.text and use skill coding-agents:operate-prowl once with that request; pass the complete checked send result back to mail-result as doorbellTransport beside the same capabilityResult, and doorbell.submitted is true only with status: "succeeded", commandExitCode: 0, and response.data.input.trailing_enter_sent: true. For a herdr pane, use skill coding-agents:operate-herdr once for prompt with the agent selector and doorbell.text; a herdr prompt carries no trailing-Enter record, so mail-result receives no doorbellTransport, reports doorbell.submitted: false, and the herdr prompt result is reported beside it as the doorbell's own evidence. No JSON and no record body reaches a pane. An unsubmitted doorbell leaves the message delivered and is reported beside it; never send the doorbell twice.
  7. Report the store-assigned id, correlation, status, doorbell, and the recipient by its registered name. delivered means the record exists in the store; it NEVER means acknowledged, agreed, authorized, or owned. A read is the recipient's private record that it judged the message, and an acknowledgement is the read its sender can observe; both are the recipient's own read and acknowledge operations through the agent-mail capability, and this skill performs neither.
  8. To resolve a doorbell that arrives in the caller's own pane, pass its line and the agents names from the live inventory — the agent-mail registrations or the environment capability's agent list — to the bundled script's doorbell operation. The line takes either form from step 4. The script reads the stable name inside <…>, or the bare name in the unlabeled form, and looks up only that name; a label never resolves a sender. It returns the sender and id, and rejects a line whose stable name is absent from that inventory even when its label names a registered agent; then find the record through the agent-mail capability's list for the caller's own name with includeBodies, and judge it with the capability's read, or with acknowledge only when the sender is meant to see the judgment.

</mail_route>

<workflow>

  1. Read $ARGUMENTS. When it is empty or whitespace, stop with invalid-schema and require one JSON message request containing recipientPath, kind, subject, and facts; perform no discovery or delivery. Otherwise interpret it as that request, with recipientPath holding the recipient's absolute worktree, repository, or working-directory path and with any applicable optional message fields. The request may carry toPane only as a complete pane identity that matches the selected candidate and may carry handback only as the complete structured block returned by /operate-prowl plan-handback. When required data is absent, stop and name it before discovery or delivery; never invent message data or ask for a pane UUID.
  2. Use skill coding-agents:operate-prowl once for resolve-target with the supplied path. Preserve the complete result. It returns the checked inventory, complete caller and participants, and non-caller candidates whose sendRequestTemplate already selects each pane with immediate-return mode and normal trailing-Enter behavior.
  3. Require a complete resolved caller and one selected candidate. On identity-ambiguous with caller: null, report the exact detail as an unresolved caller-identity conflict and stop; never ask the operator to select from the empty candidate set. Otherwise, when the request carries toPane, match it against the captured non-caller candidates before considering cardinality: exactly one matching candidate selects it, while zero or multiple matches stop with invalid-identity. Without toPane, use the sole candidate on succeeded. On identity-ambiguous, use {{! tool('ask_user') !}} for one single-select question: number candidates in resolver order, show each candidate's complete pane, worktree, branch, and repository, and map the answer back to that exact captured candidate and its sendRequestTemplate without rerunning resolution. When the runtime's option cap is below the candidate count, include the complete numbered inventory in the question and accept an exact candidate number through its free-form response; never omit a candidate. On identity-unavailable, report the exact detail and participant worktrees. NEVER select by title, focus, position, prose, or the caller's pane.
  4. Build the bundled script's discovery input directly from the resolver result: caller is the returned caller, targets is the returned complete participant list, and status is prowl-pane. Set toPane from the selected candidate's complete participant. This source-owned bridge uses the captured resolver result directly; never write an intermediate file or run an ad hoc transformation script.
  5. Build the bundled script's message request with the selected candidate's toPane, kind, subject, facts, optional request, optional handback, optional correlation, optional mutationTarget, optional observedState, and optional accepted. recipientPath has completed target resolution and never enters the envelope. kind is exactly ownership-proposal, fact, acknowledgement, mutation-state, or mutation-authorization. An acknowledgement, mutation-state report, or mutation authorization MUST reuse the active proposal UUID; an initiating proposal or fact MUST omit it so the adapter creates a new UUID. An acknowledgement MUST carry boolean accepted; every other kind omits it. Only a fact production request carries handback. When it does, use skill coding-agents:operate-prowl for plan-handback with the captured caller as sender, the selected participant as recipient, and that block's semantic completionText; require a successful result whose returned handback matches the request byte-for-byte, and pass the complete result to the bundled script as top-level handbackPlan. Reject top-level command, handbackCommand, returnPane, or adapterPath fields and never reconstruct the block.
  6. For a delegated mutation, use the source-owned handshake:
    • An ownership-proposal carries mutationTarget with exact pane, worktree, branch, repository, full head, and status values; pane, worktree, branch, and repository match the live recipient identity.
    • A mutation-state response carries the same target plus observedState with exact worktree, branch, repository, full head, and status values matching the live sender identity.
    • A mutation-authorization carries the checked target and observed state and targets that same live recipient. Any mismatch returns invalid-identity before delivery planning.
  7. Pass the discovery and message request to the bundled script's build operation. It returns the complete envelope and a semantic delivery containing toPane and text.
  8. Confirm the selected candidate template's pane equals the delivery's complete toPane, fill its null text with the delivery's exact text, and use skill coding-agents:operate-prowl once with that request. NEVER alter its pane or noWait, construct a second request, use noEnter, or retry after the editor becomes free.
  9. Pass the envelope and the exact environment result to the bundled script's result operation. Set delivered true only when the Prowl capability returned a complete checked send result with status: "succeeded", commandExitCode: 0, and public response.data.input.trailing_enter_sent: true; preserve that complete result under transport. The bundled script rejects delivered status when any checked transport or submission field is absent or inconsistent. Prefilled text that remains in the recipient editor is not delivered.
  10. Report the complete correlation, checked commandExitCode, and delivery status. Once trailing Enter is confirmed, the turn is queued and no second send is needed. delivered means only that the environment capability accepted transport; it NEVER means acknowledged, agreed, authorized, or owned. Stop with the exact status and detail on delivery-failed, invalid-identity, environment-unavailable, or invalid-schema.

</workflow>

<command_forms>

Every operation takes its JSON request from stdin. Write the request with the file-write tool to a file in the scratch directory the harness names for this session, under a file name unique to the agent and the request, and submit it through the input redirect < <request-file>. Where the harness names no scratch directory, use the one the environment designates, such as $RUNNER_TEMP on a hosted runner. A request carries message bodies, quotes, and JSON that the dangerous-command guard refuses in a heredoc, a pipe, or an inline argument. The request shapes:

  • mail-request: {"messageRequest":{"kind":"fact","correlation":"<thread>","sender":"<own-name>","recipient":"<name>","subject":"<subject>","body":"<body>","ackRequired":false}}, with "repository":"<repository>" added to messageRequest only when the caller names one
  • mail-result: {"capabilityResult":{},"doorbellTransport":null}
  • doorbell: {"line":"[<sender>] mail <id>","agents":[]}
  • build: {"discovery":{},"messageRequest":{},"handbackPlan":null}
  • result: {"envelope":{},"delivered":false,"commandExitCode":1,"transport":{},"detail":"<exact-environment-detail>"}
python3 "${CLAUDE_SKILL_DIR}/scripts/agent_message.py" <operation> < <request-file>

Every operation exits 0 on its success shape — record present for mail-request, status: "delivered" for mail-result, id present for doorbell, delivery.status: "ready" for build, status: "delivered" for result — and 2 otherwise. On invalid-schema or invalid-identity the output is the three-field {schemaVersion, status, detail} object. On delivery-failed the output is the full delivery result: mail-result returns status, capabilityStatus, detail, commandExitCode, and the three agreement flags acknowledged, agreed, and ownershipEstablished set to false; result returns status, correlation, commandExitCode, transport, detail, and the same three flags.

</command_forms>

<constraints>

  • ALWAYS preserve complete source-supplied agent, pane, worktree, branch, repository, run, correlation, mutation-target, observed-state, and transport identities.
  • ALWAYS report the selected target using the exact recipientPath supplied by the caller on the Prowl route, and the registered recipient name on the mail route, while using a resolved pane UUID only inside the delivery or doorbell operation.
  • ALWAYS invoke coding-agents:operate-prowl for source-owned target resolution and Prowl delivery, coding-agents:operate-agent-mail for mail delivery and for the recipient's list, read, and acknowledge, and coding-agents:operate-herdr for a herdr doorbell; the bundled script executes no command and reads no store.
  • ALWAYS send a doorbell as exactly the one line doorbell.text returns — [<Label> <<sender>>] mail <id> or [<sender>] mail <id> — into an endpoint the request named and the environment capability resolved; no JSON and no record body reaches a pane, and no message record is written under .spx/.
  • ALWAYS preserve a production request's complete source-generated handback block unchanged.
  • ALWAYS require the matching complete successful /operate-prowl plan-handback result before building a production request.
  • NEVER accept or construct a handback command, return-pane field, or cross-skill adapter path.
  • ALWAYS retain each complete command result in the active tool context and feed it into the next source-owned operation; the request files of <command_forms> are the only files this workflow writes, and no redirect that writes a result to a path is part of it.
  • NEVER pass a request through a heredoc, a pipe, or an inline argument, and NEVER remove a request file; the harness clears its scratch directory.
  • NEVER scan transcript files, use another terminal multiplexer, or ask the operator to relay a message as a fallback.
  • NEVER resolve a sender, select a recipient, or select an endpoint by a doorbell's label; the stable name and the store id are the only identities.
  • NEVER select an endpoint by title, focus, position, inferred prose, or an undeclared environment.
  • ALWAYS leave a delivered record's read and acknowledgement to the recipient's own read and acknowledge operations; this skill sends a record and never reads or acknowledges one on a recipient's behalf.
  • NEVER convert transport success or a stored record into acknowledgement, agreement, ownership, mutation authorization, or continuation state.

</constraints>

<testing>

Before release, exercise envelope_correlation, build_envelope, send_request, delivery_request, and delivery_result with complete resolver identities and controlled environment-result payloads. Run the documented build input-redirect form and require delivery.status: "ready"; run the documented result form with a complete successful send payload and require status: "delivered", then remove or alter each required transport field and require rejection. The matrix covers authoritative toPane selection from ambiguous candidates, caller exclusion, optional run-identity preservation and rejection, accepted and rejected acknowledgements, all message kinds, complete HEAD/status validation, exact mutation target/state matching, a production request that preserves the source-generated handback block only with its matching complete plan-handback result, rejection of caller-authored executable handback fields, malformed identities and optional fields, and transport results that never establish acknowledgement, agreement, authorization, or ownership.

The mail route's exercised properties: every record kind maps to a record the agent-mail capability accepts unchanged; the capability's checked send result over the store's captured reply maps to delivered with the store id and the doorbell line, and a rejected or absent store maps to delivery-failed with the capability's status and detail; generated doorbells, labeled and unlabeled, parse back to their stable sender name and id; a label that is empty or carries a line break or any of [, ], <, > renders the unlabeled form; a doorbell whose label names a registered agent while its stable sender is absent from the inventory is rejected; a sender absent from the inventory and a line carrying more than the doorbell are rejected; a delivered result requires every checked capability field and a zero exit code; a delegation request carrying an authority other than exactly the sender as owner and gitMutation: false reaches no record, while an absent authority is the sender's obligation and the script rejects nothing for lacking it.

Recorded exercised payload/results:

  • mail-request with a fact request → one record and the capability send request; mail-result with the capability's succeeded result → status: "delivered", the store id, and doorbell.text [<sender>] mail <id>, or [<Label> <<sender>>] mail <id> when the capability result's response carries a renderable sender_display_name, with submitted: false until a checked doorbell transport is supplied.
  • build with a complete resolver-selected recipient and a fact request → one envelope and delivery.status: "ready" for that recipient pane.
  • result with delivered: true, matching zero exit codes, status: "succeeded", and response.data.input.trailing_enter_sent: true → status: "delivered"; changing the trailing-Enter field to false → invalid-schema.
  • result with delivered: false, exit code 7, and detail: "transport rejected" → status: "delivery-failed" while acknowledgement, agreement, and ownership remain false.

</testing>

<failure_modes>

Transport success was inferred from an exit code alone. Claude passed delivered: true and commandExitCode: 0 without the checked /operate-prowl result, so downstream output claimed delivery with no transport evidence to inspect. The exit code establishes only one field of the environment result. Pass the complete checked send result under transport; the bundled script rejects delivered status when any required field is absent or inconsistent.

Continuation prose remained in the editor. Claude treated a successful immediate-return send as a submitted turn even though the operator could still see editable text. Require response.data.input.trailing_enter_sent: true; a prefill or absent submission field is a delivery failure.

A request was sent with no way for the answer to come back. Claude asked a recipient to produce a result and sent no return path, then had no signal when the recipient finished. Polling is blocked by design, so the sender read the recipient's pane once, saw nothing, and moved on while the finished result sat on disk. A production request carries the complete handback block returned by /operate-prowl plan-handback, so the recipient can send one line back on completion.

A pane UUID was requested from the operator. Claude asked which pane to send to, when the operator had already named the target the only way they can — by worktree or working directory. Resolve the operator's naming against the live inventory and report the target back in the same terms.

A blocked redirect was rewritten as another program. Claude redirected public inventory and discovery JSON into $SP/agents.json and $SP/discovery.json. The dangerous-command guard blocked the redirect, a compound command because it carried a shell variable. Claude wrote a Python replacement and continued, discarding the guard result. Use /operate-prowl's resolve-target result directly in the active tool context; an output redirect carrying a shell variable is no part of this workflow. Rewriting the blocked operation as another program is forbidden.

</failure_modes>

<success_criteria>

  • Target resolution passes only with one complete non-caller candidate selected from the complete checked inventory for recipientPath, with any supplied toPane matching that candidate.
  • Build passes only with one validated envelope and one semantic delivery bound to the target's complete pane UUID.
  • A production request preserves one source-generated handback block only when the complete successful plan-handback result carries the same block, and rejects every caller-authored executable handback field.
  • Delivery passes only after /operate-prowl returns a checked successful result whose public input record confirms trailing Enter was sent; every failure preserves its exact status, detail, and command exit code when present.
  • A mail delivery passes only when mail-result returns status: "delivered" from a succeeded capability result whose data.record carries the store-assigned id; the doorbell text is [<Label> <<sender>>] mail <id> for a renderable sender label and [<sender>] mail <id> otherwise, and doorbell.submitted is true only with a checked Prowl send result carrying trailing_enter_sent: true.
  • A delivery-failed mail result preserves the capability's exact status and detail, and a delegation-request carrying an authority other than exactly owner equal to sender and gitMutation: false produces no record; an absent authority is the sender's obligation and the script rejects nothing for lacking it.
  • A doorbell resolution, labeled or not, returns the stable sender name and id only for a stable name present in the supplied inventory, and the record is then found with the agent-mail capability's list and judged with its read.
  • Caller, recipient, mutation-target, and observed-state identities validate before delivery.
  • Transport delivery remains distinct from acknowledgement, agreement, authorization, ownership, and continuation.

</success_criteria>

04 同仓库更多 Skills