Newer
Older
cortex-hub / swarm_framework / sub_agent_SKILL.md

Sub-Agent Communication Skill

Overview

This skill allows you to communicate with other agents in the swarm using a decentralized, file-based messaging system.

Communication Protocol

You communicate by writing JSON files to your output/ directory and reading files from your incoming/ directory.

1. Sending a Request

To send a message to another agent, create a JSON file in your output/ directory: output/to_[target]_[unique_id].json

Atomicity Rule: You MUST write the file with a .tmp extension first (e.g., to_agent_2_123.tmp) and then rename it to .json when the write is complete!

JSON Schema:

{
  "request_id": "req_123",
  "type": "prompt",
  "sender": "your_agent_name",
  "target_agent": "target_agent_name",
  "prompt": "Your instructions to the agent here."
}
  • request_id: A unique identifier for the request.
  • type: Must be "prompt" for sending instructions.
  • sender: Your agent name (e.g., agent_1).
  • target_agent: The name of the agent you want to communicate with (e.g., agent_2).
  • prompt: The text message or command you want the agent to execute.

2. Reading a Response

The background Orchestrator will pick up your request, route it to the target, and the response from the target will be placed in your incoming/ folder as from_[target]_[original_name].json. You should wait for the notification or poll your incoming/ folder.

Communication Boundaries Rules

  1. Do not target the Master Agent directly via file communication. All notifications for Master must be handled by the Orchestrator.
  2. You can communicate with any other sub-agent or the Orchestrator.

Payload Content Rules

When sending a response or request, ensure the prompt or output field contains ONLY the relevant information. You MUST wrap your final answer in ===RESULT=== and ===END_RESULT=== markers (e.g., in the output field or terminal output). The system will extract content between these markers to remove UI garbage.

Completion Rule

When you complete an assigned task or require upper layer attention, you MUST write a response file to your output/ directory (following the Atomicity Rule) to inform the upper layer. Failure to do so will leave the system waiting indefinitely!