prompt.ts
1 import { feature } from 'bun:bundle' 2 3 export const DESCRIPTION = 'Send a message to another agent' 4 5 export function getPrompt(): string { 6 const udsRow = feature('UDS_INBOX') 7 ? `\n| \`"uds:/path/to.sock"\` | Local Claude session's socket (same machine; use \`ListPeers\`) | 8 | \`"bridge:session_..."\` | Remote Control peer session (cross-machine; use \`ListPeers\`) |` 9 : '' 10 const udsSection = feature('UDS_INBOX') 11 ? `\n\n## Cross-session 12 13 Use \`ListPeers\` to discover targets, then: 14 15 \`\`\`json 16 {"to": "uds:/tmp/cc-socks/1234.sock", "message": "check if tests pass over there"} 17 {"to": "bridge:session_01AbCd...", "message": "what branch are you on?"} 18 \`\`\` 19 20 A listed peer is alive and will process your message — no "busy" state; messages enqueue and drain at the receiver's next tool round. Your message arrives wrapped as \`<cross-session-message from="...">\`. **To reply to an incoming message, copy its \`from\` attribute as your \`to\`.**` 21 : '' 22 return ` 23 # SendMessage 24 25 Send a message to another agent. 26 27 \`\`\`json 28 {"to": "researcher", "summary": "assign task 1", "message": "start on task #1"} 29 \`\`\` 30 31 | \`to\` | | 32 |---|---| 33 | \`"researcher"\` | Teammate by name | 34 | \`"*"\` | Broadcast to all teammates — expensive (linear in team size), use only when everyone genuinely needs it |${udsRow} 35 36 Your plain text output is NOT visible to other agents — to communicate, you MUST call this tool. Messages from teammates are delivered automatically; you don't check an inbox. Refer to teammates by name, never by UUID. When relaying, don't quote the original — it's already rendered to the user.${udsSection} 37 38 ## Protocol responses (legacy) 39 40 If you receive a JSON message with \`type: "shutdown_request"\` or \`type: "plan_approval_request"\`, respond with the matching \`_response\` type — echo the \`request_id\`, set \`approve\` true/false: 41 42 \`\`\`json 43 {"to": "team-lead", "message": {"type": "shutdown_response", "request_id": "...", "approve": true}} 44 {"to": "researcher", "message": {"type": "plan_approval_response", "request_id": "...", "approve": false, "feedback": "add error handling"}} 45 \`\`\` 46 47 Approving shutdown terminates your process. Rejecting plan sends the teammate back to revise. Don't originate \`shutdown_request\` unless asked. Don't send structured JSON status messages — use TaskUpdate. 48 `.trim() 49 }