{
  "schemaVersion": "1.0",
  "item": {
    "slug": "agent-swarm-network",
    "name": "Agent Swarm Network",
    "source": "tencent",
    "type": "skill",
    "category": "效率提升",
    "sourceUrl": "https://clawhub.ai/sarahmirrand001-oss/agent-swarm-network",
    "canonicalUrl": "https://clawhub.ai/sarahmirrand001-oss/agent-swarm-network",
    "targetPlatform": "OpenClaw"
  },
  "install": {
    "downloadMode": "redirect",
    "downloadUrl": "/downloads/agent-swarm-network",
    "sourceDownloadUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=agent-swarm-network",
    "sourcePlatform": "tencent",
    "targetPlatform": "OpenClaw",
    "installMethod": "Manual import",
    "extraction": "Extract archive",
    "prerequisites": [
      "OpenClaw"
    ],
    "packageFormat": "ZIP package",
    "includedAssets": [
      "README.md",
      "config.example.json",
      "SKILL.md",
      "manifest.json"
    ],
    "primaryDoc": "SKILL.md",
    "quickSetup": [
      "Download the package from Yavira.",
      "Extract the archive and review SKILL.md first.",
      "Import or place the package into your OpenClaw setup."
    ],
    "agentAssist": {
      "summary": "Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.",
      "steps": [
        "Download the package from Yavira.",
        "Extract it into a folder your agent can access.",
        "Paste one of the prompts below and point your agent at the extracted folder."
      ],
      "prompts": [
        {
          "label": "New install",
          "body": "I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Then review README.md for any prerequisites, environment setup, or post-install checks. Tell me what you changed and call out any manual steps you could not complete."
        },
        {
          "label": "Upgrade existing",
          "body": "I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Then review README.md for any prerequisites, environment setup, or post-install checks. Summarize what changed and any follow-up checks I should run."
        }
      ]
    },
    "sourceHealth": {
      "source": "tencent",
      "status": "healthy",
      "reason": "direct_download_ok",
      "recommendedAction": "download",
      "checkedAt": "2026-04-23T16:43:11.935Z",
      "expiresAt": "2026-04-30T16:43:11.935Z",
      "httpStatus": 200,
      "finalUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=4claw-imageboard",
      "contentType": "application/zip",
      "probeMethod": "head",
      "details": {
        "probeUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=4claw-imageboard",
        "contentDisposition": "attachment; filename=\"4claw-imageboard-1.0.1.zip\"",
        "redirectLocation": null,
        "bodySnippet": null
      },
      "scope": "source",
      "summary": "Source download looks usable.",
      "detail": "Yavira can redirect you to the upstream package for this source.",
      "primaryActionLabel": "Download for OpenClaw",
      "primaryActionHref": "/downloads/agent-swarm-network"
    },
    "validation": {
      "installChecklist": [
        "Use the Yavira download entry.",
        "Review SKILL.md after the package is downloaded.",
        "Confirm the extracted package contains the expected setup assets."
      ],
      "postInstallChecks": [
        "Confirm the extracted package includes the expected docs or setup files.",
        "Validate the skill or prompts are available in your target agent workspace.",
        "Capture any manual follow-up steps the agent could not complete."
      ]
    },
    "downloadPageUrl": "https://openagent3.xyz/downloads/agent-swarm-network",
    "agentPageUrl": "https://openagent3.xyz/skills/agent-swarm-network/agent",
    "manifestUrl": "https://openagent3.xyz/skills/agent-swarm-network/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/agent-swarm-network/agent.md"
  },
  "agentAssist": {
    "summary": "Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.",
    "steps": [
      "Download the package from Yavira.",
      "Extract it into a folder your agent can access.",
      "Paste one of the prompts below and point your agent at the extracted folder."
    ],
    "prompts": [
      {
        "label": "New install",
        "body": "I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Then review README.md for any prerequisites, environment setup, or post-install checks. Tell me what you changed and call out any manual steps you could not complete."
      },
      {
        "label": "Upgrade existing",
        "body": "I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Then review README.md for any prerequisites, environment setup, or post-install checks. Summarize what changed and any follow-up checks I should run."
      }
    ]
  },
  "documentation": {
    "source": "clawhub",
    "primaryDoc": "SKILL.md",
    "sections": [
      {
        "title": "Agent Swarm Network — Agent Communication Skill",
        "body": "A unified communication backbone for every AI tool in the OpenClaw ecosystem\n(OpenClaw / Antigravity / Codex).\nAnalogy: This network = the Agent's nervous system. OpenClaw = the Agent's brain."
      },
      {
        "title": "Acknowledgments",
        "body": "This Skill is built on top of Pilot Protocol by @TeoSlayer. Pilot Protocol provides the core daemon, encrypted tunnels, NAT traversal, and peer-to-peer addressing that this Skill leverages. Huge thanks to the Pilot Protocol team for building the Internet of Agents."
      },
      {
        "title": "Permissions & Privacy",
        "body": "This Skill executes local CLI commands and writes files to the ~/.pilot/ directory. Full transparency:\n\nPermissionWhatWhyCLI Exec~/.pilot/bin/pilotctlAll agent operations go through this binaryFile Write~/.pilot/inbox/Context snapshots and incoming messages land hereFile Write~/.pilot/received/Received files from peer agentsFile Read~/.pilot/inbox/Reading snapshots for context restorationFile Read~/.pilot/received/Reading transferred filesNetworkLocal Unix socketDaemon communication (localhost only)NetworkUDP tunnels (encrypted)Agent-to-agent communication (AES-256-GCM)Script Exec~/.pilot/context-snapshot.shContext snapshot helper scriptScript Exec~/.pilot/pilot-publish.shEvent publishing helper scriptProcessDaemon lifecycleStart/stop/status of the pilotctl daemon\n\nPrivacy Note: All inter-agent traffic is encrypted end-to-end using X25519 key exchange + AES-256-GCM. Agents are private by default and require mutual trust handshake before communication. No data passes through relay servers. The rendezvous registry defaults to localhost (127.0.0.1:9000) — no peer-discovery metadata leaves the machine unless you explicitly change registry_url to a remote address. Snapshots are unencrypted JSON; you must secure the ~/.pilot/ directory (chmod 700)."
      },
      {
        "title": "Prerequisites",
        "body": "ToolPurposeRequired?Pilot ProtocolCore daemon + CLI (pilotctl)✅ RequiredOpenClawSkill host + Agent orchestration✅ Required"
      },
      {
        "title": "Configuration",
        "body": "Edit config.json after installation:\n\n{\n  \"pilotctl_path\": \"~/.pilot/bin/pilotctl\",\n  \"daemon_start_script\": \"~/.pilot/start-local.sh\",\n  \"snapshot_script\": \"~/.pilot/context-snapshot.sh\",\n  \"publish_script\": \"~/.pilot/pilot-publish.sh\",\n  \"inbox_path\": \"~/.pilot/inbox/\",\n  \"received_path\": \"~/.pilot/received/\",\n  \"agent_hostname\": \"keke-agent\"\n}\n\nFieldDescriptionDefaultpilotctl_pathPath to the pilotctl binary~/.pilot/bin/pilotctldaemon_start_scriptScript to start the daemon~/.pilot/start-local.shsnapshot_scriptContext snapshot helper script~/.pilot/context-snapshot.shpublish_scriptEvent publish helper script~/.pilot/pilot-publish.shinbox_pathDirectory for incoming messages/snapshots~/.pilot/inbox/received_pathDirectory for received files~/.pilot/received/agent_hostnameThis agent's hostname on the Pilot networkkeke-agent"
      },
      {
        "title": "First-time Setup",
        "body": "Install Pilot Protocol securely: We strongly recommend building from source to eliminate supply-chain risk. Clone https://github.com/TeoSlayer/pilotprotocol, audit the source, compile via go build, and place the binary at ~/.pilot/bin/pilotctl.\nSecure your directories: chmod 700 ~/.pilot\nStart the daemon: ~/.pilot/start-local.sh\nVerify: ~/.pilot/bin/pilotctl --json daemon status"
      },
      {
        "title": "Global Rules",
        "body": "All pilotctl commands use the full path: ~/.pilot/bin/pilotctl\nAlways append the --json flag for structured output\nCheck the returned status field: ok = success, error = failure\nOn failure, read the hint field for remediation guidance"
      },
      {
        "title": "⚠️ Single-Node Mode (Current State)",
        "body": "Currently running with only one node (keke-agent). Cannot send network messages to self (publish/send-message will return connection_failed)."
      },
      {
        "title": "Single-Node Workarounds",
        "body": "OperationMulti-node CommandSingle-node AlternativePublish eventpilotctl publish keke-agent topic --data ...~/.pilot/pilot-publish.sh topic '{\"key\":\"val\"}'Send to inboxpilotctl send-message keke-agent --data ...Write file directly to ~/.pilot/inbox/Context snapshotpilotctl send-message ...~/.pilot/context-snapshot.shRead inboxpilotctl inbox → read ~/.pilot/inbox/Same (read directory directly)Check statuspilotctl info✅ Works normallySet tagspilotctl set-tags ...✅ Works normally\n\nWhen a second node joins (e.g., VPS or another Mac), network commands will activate automatically."
      },
      {
        "title": "1.1 Save Context Snapshot",
        "body": "When a session ends, compaction triggers, or manual request is made, save critical context:\n\n# Using the snapshot script (works in both single-node and multi-node)\n~/.pilot/context-snapshot.sh SESSION_ID \"Key summary of current context\"\n\n# Or manually write to inbox\necho '{\"type\":\"context_snapshot\",\"session_id\":\"ID\",\"summary\":\"Summary\"}' > ~/.pilot/inbox/snapshot_$(date +%Y%m%d_%H%M%S).json"
      },
      {
        "title": "1.2 Restore Context",
        "body": "When a new session starts, read the previous session's snapshot:\n\n~/.pilot/bin/pilotctl --json inbox\n\nReturns a messages array sorted by received_at. Read the most recent context_snapshot type message."
      },
      {
        "title": "1.3 Context Overflow Protocol",
        "body": "When context usage exceeds 80%:\n\nStep 1: Extract critical information from current context\nStep 2: Serialize as JSON snapshot\nStep 3: pilotctl send-message keke-agent --data \"{snapshot}\" --type json\nStep 4: pilotctl publish keke-agent context.overflow --data \"overflow at TOKEN_COUNT tokens\"\nStep 5: Suggest user starts a new session\nStep 6: New session automatically restores from inbox"
      },
      {
        "title": "2.1 Publish Events",
        "body": "When significant events occur, use pilot-publish.sh (automatically handles single-node/multi-node):\n\n# Model switch\n~/.pilot/pilot-publish.sh model.switch '{\"from\":\"flash-lite\",\"to\":\"opus-4.6\",\"reason\":\"strategic analysis\"}'\n\n# Task completion\n~/.pilot/pilot-publish.sh task.complete '{\"task\":\"intelligence_ingestion\",\"source\":\"twitter\"}'\n\n# Context compaction\n~/.pilot/pilot-publish.sh context.compaction '{\"before_tokens\":150000,\"after_tokens\":30000}'\n\n# Error alert\n~/.pilot/pilot-publish.sh error.alert '{\"type\":\"model_402\",\"model\":\"gemini\",\"action\":\"fallback\"}'\n\n# Intelligence ingested\n~/.pilot/pilot-publish.sh intel.ingested '{\"source\":\"url\",\"title\":\"Article Title\",\"category\":\"infra\"}'"
      },
      {
        "title": "2.2 Subscribe to Events",
        "body": "Listen for specific topics (used by sub-agents or external monitors):\n\n# Listen to all events\n~/.pilot/bin/pilotctl --json subscribe keke-agent \"*\" --timeout 60s\n\n# Listen only to model switches\n~/.pilot/bin/pilotctl --json subscribe keke-agent model.switch --count 1\n\n# Listen for error alerts\n~/.pilot/bin/pilotctl --json subscribe keke-agent error.* --timeout 300s"
      },
      {
        "title": "2.3 Standard Event Topics",
        "body": "TopicTriggerData Schemacontext.snapshotSession end / manual save{session_id, summary, key_decisions}context.overflowToken usage > 80%{token_count, threshold}context.compactionCompaction triggered{before_tokens, after_tokens}model.switchModel changed{from, to, reason}model.errorModel failure{model, error, fallback}task.startTask initiated{task, type, model}task.completeTask finished{task, result_summary}task.errorTask failed{task, error, retry}intel.ingestedInformation ingested{source, title, category, value}error.alertError notification{type, details, action}agent.spawnSub-agent created{hostname, purpose, model}agent.exitSub-agent exited{hostname, reason, result}"
      },
      {
        "title": "3.1 Naming Convention",
        "body": "Primary agent:    keke-agent\nSub-agents:       keke-sub-{purpose}  (e.g., keke-sub-code, keke-sub-writer)\nNested sub:       keke-sub-{purpose}-{n}"
      },
      {
        "title": "3.2 Spawning Sub-Agents",
        "body": "When OpenClaw needs to create a sub-agent for overflow tasks:\n\n# Publish agent spawn event\n~/.pilot/bin/pilotctl --json publish keke-agent agent.spawn \\\n  --data '{\"hostname\":\"keke-sub-code\",\"purpose\":\"code refactoring\",\"model\":\"sonnet-4.6\"}'"
      },
      {
        "title": "3.3 Collecting Sub-Agent Results",
        "body": "# Sub-agent sends results via Data Exchange\n~/.pilot/bin/pilotctl --json send-message keke-agent \\\n  --data '{\"type\":\"sub_agent_result\",\"from\":\"keke-sub-code\",\"result\":\"refactoring complete\",\"files_changed\":3}' \\\n  --type json\n\n# Primary agent checks results\n~/.pilot/bin/pilotctl --json inbox"
      },
      {
        "title": "4.1 Route by Tags",
        "body": "Assign capability tags to different agents:\n\n# Tag self\n~/.pilot/bin/pilotctl --json set-tags orchestrator chinese fast\n\nTag conventions:\n\nTagMeaningBest Fit AgentorchestratorScheduling & dispatchOpenClaw primary agentdeep-reasoningDeep reasoning tasksAntigravity (Opus)code-genCode generationCodex (Sonnet)local-inferenceLocal model inferenceLM Studio (Qwen)fastFast responsesFlash Lite instanceschineseChinese language tasksQwen / Chinese-optimized models"
      },
      {
        "title": "4.2 Find the Best Agent",
        "body": "~/.pilot/bin/pilotctl --json peers --search \"code-gen\""
      },
      {
        "title": "5.1 Publish Model Switch Events",
        "body": "Every model switch gets logged to the event stream:\n\n~/.pilot/bin/pilotctl --json publish keke-agent model.switch \\\n  --data '{\"from\":\"CURRENT_MODEL\",\"to\":\"NEW_MODEL\",\"reason\":\"reason\",\"timestamp\":\"ISO8601\"}'"
      },
      {
        "title": "5.2 Model Fallback Chain",
        "body": "On model failure, automatically publish degradation events:\n\n~/.pilot/bin/pilotctl --json publish keke-agent model.error \\\n  --data '{\"model\":\"gemini-3-flash\",\"error\":\"402 quota exceeded\",\"fallback\":\"minimax-m2.5\"}'"
      },
      {
        "title": "6.1 Send File",
        "body": "~/.pilot/bin/pilotctl --json send-file keke-agent /path/to/file\n\nFiles are saved to ~/.pilot/received/."
      },
      {
        "title": "6.2 View Received Files",
        "body": "~/.pilot/bin/pilotctl --json received"
      },
      {
        "title": "6.3 Use Cases",
        "body": "Transfer context snapshot files\nTransfer code diffs\nTransfer analysis reports\nShare configuration across agents"
      },
      {
        "title": "7.1 Health Checks",
        "body": "# Daemon status\n~/.pilot/bin/pilotctl --json daemon status\n\n# Agent info\n~/.pilot/bin/pilotctl --json info\n\n# Connection list\n~/.pilot/bin/pilotctl --json connections\n\n# Peer list\n~/.pilot/bin/pilotctl --json peers"
      },
      {
        "title": "7.2 Performance Testing",
        "body": "# Ping latency\n~/.pilot/bin/pilotctl --json ping keke-agent --count 3\n\n# Throughput benchmark\n~/.pilot/bin/pilotctl --json bench keke-agent 1"
      },
      {
        "title": "8.1 Map Agent to Local IP",
        "body": "# Gateway bridging on user-space ports (>1024) does NOT require root/sudo.\n~/.pilot/bin/pilotctl gateway start --ports 1234,8080 0:0000.0000.0001\n\nOnce mapped, standard HTTP tools can be used:\n\ncurl http://10.4.0.1:1234/v1/chat/completions  # Like calling LM Studio directly"
      },
      {
        "title": "8.2 Use Cases",
        "body": "Expose LM Studio through Gateway as a Pilot address\nUnify all model endpoints under one entry point\nAccess agent services with standard HTTP tools"
      },
      {
        "title": "9.1 Set Up Webhook",
        "body": "~/.pilot/bin/pilotctl --json set-webhook http://localhost:8080/pilot-events"
      },
      {
        "title": "9.2 Event Types",
        "body": "All native daemon events are pushed to the webhook:\n\nnode.registered / node.reregistered\nconn.established / conn.fin / conn.rst\nhandshake.received / handshake.approved\nmessage.received / file.received\npubsub.published / pubsub.subscribed\nsecurity.syn_rate_limited / security.nonce_replay"
      },
      {
        "title": "Rule 1: Snapshot Before Session End",
        "body": "Automatically execute a context snapshot (Capability 1.1) before every session ends."
      },
      {
        "title": "Rule 2: Critical Events Must Be Published",
        "body": "The following events must always be published to the Event Stream:\n\nModel switches\nIntelligence ingestion completions\nTask completions/failures\nContext compactions\nError alerts"
      },
      {
        "title": "Rule 3: Auto-Restore on New Session",
        "body": "On every new session start, check pilotctl inbox for the latest snapshot and restore context."
      },
      {
        "title": "Rule 4: Daemon Heartbeat",
        "body": "Check daemon status every 30 minutes. Auto-restart on failure."
      },
      {
        "title": "Troubleshooting",
        "body": "ProblemDiagnostic CommandSolutionDaemon not runningpilotctl daemon status~/.pilot/start-local.shRegistry unreachablepilotctl info (check peers)Verify rendezvous server is runningMessages not sendingpilotctl connectionsCheck trust state with targetInbox overflowingpilotctl inboxpilotctl inbox --clear"
      }
    ],
    "body": "Agent Swarm Network — Agent Communication Skill\n\nA unified communication backbone for every AI tool in the OpenClaw ecosystem (OpenClaw / Antigravity / Codex).\n\nAnalogy: This network = the Agent's nervous system. OpenClaw = the Agent's brain.\n\nAcknowledgments\n\nThis Skill is built on top of Pilot Protocol by @TeoSlayer. Pilot Protocol provides the core daemon, encrypted tunnels, NAT traversal, and peer-to-peer addressing that this Skill leverages. Huge thanks to the Pilot Protocol team for building the Internet of Agents.\n\nPermissions & Privacy\n\nThis Skill executes local CLI commands and writes files to the ~/.pilot/ directory. Full transparency:\n\nPermission\tWhat\tWhy\nCLI Exec\t~/.pilot/bin/pilotctl\tAll agent operations go through this binary\nFile Write\t~/.pilot/inbox/\tContext snapshots and incoming messages land here\nFile Write\t~/.pilot/received/\tReceived files from peer agents\nFile Read\t~/.pilot/inbox/\tReading snapshots for context restoration\nFile Read\t~/.pilot/received/\tReading transferred files\nNetwork\tLocal Unix socket\tDaemon communication (localhost only)\nNetwork\tUDP tunnels (encrypted)\tAgent-to-agent communication (AES-256-GCM)\nScript Exec\t~/.pilot/context-snapshot.sh\tContext snapshot helper script\nScript Exec\t~/.pilot/pilot-publish.sh\tEvent publishing helper script\nProcess\tDaemon lifecycle\tStart/stop/status of the pilotctl daemon\n\nPrivacy Note: All inter-agent traffic is encrypted end-to-end using X25519 key exchange + AES-256-GCM. Agents are private by default and require mutual trust handshake before communication. No data passes through relay servers. The rendezvous registry defaults to localhost (127.0.0.1:9000) — no peer-discovery metadata leaves the machine unless you explicitly change registry_url to a remote address. Snapshots are unencrypted JSON; you must secure the ~/.pilot/ directory (chmod 700).\n\nPrerequisites\nTool\tPurpose\tRequired?\nPilot Protocol\tCore daemon + CLI (pilotctl)\t✅ Required\nOpenClaw\tSkill host + Agent orchestration\t✅ Required\nConfiguration\n\nEdit config.json after installation:\n\n{\n  \"pilotctl_path\": \"~/.pilot/bin/pilotctl\",\n  \"daemon_start_script\": \"~/.pilot/start-local.sh\",\n  \"snapshot_script\": \"~/.pilot/context-snapshot.sh\",\n  \"publish_script\": \"~/.pilot/pilot-publish.sh\",\n  \"inbox_path\": \"~/.pilot/inbox/\",\n  \"received_path\": \"~/.pilot/received/\",\n  \"agent_hostname\": \"keke-agent\"\n}\n\nField\tDescription\tDefault\npilotctl_path\tPath to the pilotctl binary\t~/.pilot/bin/pilotctl\ndaemon_start_script\tScript to start the daemon\t~/.pilot/start-local.sh\nsnapshot_script\tContext snapshot helper script\t~/.pilot/context-snapshot.sh\npublish_script\tEvent publish helper script\t~/.pilot/pilot-publish.sh\ninbox_path\tDirectory for incoming messages/snapshots\t~/.pilot/inbox/\nreceived_path\tDirectory for received files\t~/.pilot/received/\nagent_hostname\tThis agent's hostname on the Pilot network\tkeke-agent\nFirst-time Setup\nInstall Pilot Protocol securely: We strongly recommend building from source to eliminate supply-chain risk. Clone https://github.com/TeoSlayer/pilotprotocol, audit the source, compile via go build, and place the binary at ~/.pilot/bin/pilotctl.\nSecure your directories: chmod 700 ~/.pilot\nStart the daemon: ~/.pilot/start-local.sh\nVerify: ~/.pilot/bin/pilotctl --json daemon status\nGlobal Rules\nAll pilotctl commands use the full path: ~/.pilot/bin/pilotctl\nAlways append the --json flag for structured output\nCheck the returned status field: ok = success, error = failure\nOn failure, read the hint field for remediation guidance\n⚠️ Single-Node Mode (Current State)\n\nCurrently running with only one node (keke-agent). Cannot send network messages to self (publish/send-message will return connection_failed).\n\nSingle-Node Workarounds\nOperation\tMulti-node Command\tSingle-node Alternative\nPublish event\tpilotctl publish keke-agent topic --data ...\t~/.pilot/pilot-publish.sh topic '{\"key\":\"val\"}'\nSend to inbox\tpilotctl send-message keke-agent --data ...\tWrite file directly to ~/.pilot/inbox/\nContext snapshot\tpilotctl send-message ...\t~/.pilot/context-snapshot.sh\nRead inbox\tpilotctl inbox → read ~/.pilot/inbox/\tSame (read directory directly)\nCheck status\tpilotctl info\t✅ Works normally\nSet tags\tpilotctl set-tags ...\t✅ Works normally\n\nWhen a second node joins (e.g., VPS or another Mac), network commands will activate automatically.\n\nCapability 1: Context Snapshot & Restore (Highest Priority)\n1.1 Save Context Snapshot\n\nWhen a session ends, compaction triggers, or manual request is made, save critical context:\n\n# Using the snapshot script (works in both single-node and multi-node)\n~/.pilot/context-snapshot.sh SESSION_ID \"Key summary of current context\"\n\n# Or manually write to inbox\necho '{\"type\":\"context_snapshot\",\"session_id\":\"ID\",\"summary\":\"Summary\"}' > ~/.pilot/inbox/snapshot_$(date +%Y%m%d_%H%M%S).json\n\n1.2 Restore Context\n\nWhen a new session starts, read the previous session's snapshot:\n\n~/.pilot/bin/pilotctl --json inbox\n\n\nReturns a messages array sorted by received_at. Read the most recent context_snapshot type message.\n\n1.3 Context Overflow Protocol\n\nWhen context usage exceeds 80%:\n\nStep 1: Extract critical information from current context\nStep 2: Serialize as JSON snapshot\nStep 3: pilotctl send-message keke-agent --data \"{snapshot}\" --type json\nStep 4: pilotctl publish keke-agent context.overflow --data \"overflow at TOKEN_COUNT tokens\"\nStep 5: Suggest user starts a new session\nStep 6: New session automatically restores from inbox\n\nCapability 2: Event-Driven Collaboration\n2.1 Publish Events\n\nWhen significant events occur, use pilot-publish.sh (automatically handles single-node/multi-node):\n\n# Model switch\n~/.pilot/pilot-publish.sh model.switch '{\"from\":\"flash-lite\",\"to\":\"opus-4.6\",\"reason\":\"strategic analysis\"}'\n\n# Task completion\n~/.pilot/pilot-publish.sh task.complete '{\"task\":\"intelligence_ingestion\",\"source\":\"twitter\"}'\n\n# Context compaction\n~/.pilot/pilot-publish.sh context.compaction '{\"before_tokens\":150000,\"after_tokens\":30000}'\n\n# Error alert\n~/.pilot/pilot-publish.sh error.alert '{\"type\":\"model_402\",\"model\":\"gemini\",\"action\":\"fallback\"}'\n\n# Intelligence ingested\n~/.pilot/pilot-publish.sh intel.ingested '{\"source\":\"url\",\"title\":\"Article Title\",\"category\":\"infra\"}'\n\n2.2 Subscribe to Events\n\nListen for specific topics (used by sub-agents or external monitors):\n\n# Listen to all events\n~/.pilot/bin/pilotctl --json subscribe keke-agent \"*\" --timeout 60s\n\n# Listen only to model switches\n~/.pilot/bin/pilotctl --json subscribe keke-agent model.switch --count 1\n\n# Listen for error alerts\n~/.pilot/bin/pilotctl --json subscribe keke-agent error.* --timeout 300s\n\n2.3 Standard Event Topics\nTopic\tTrigger\tData Schema\ncontext.snapshot\tSession end / manual save\t{session_id, summary, key_decisions}\ncontext.overflow\tToken usage > 80%\t{token_count, threshold}\ncontext.compaction\tCompaction triggered\t{before_tokens, after_tokens}\nmodel.switch\tModel changed\t{from, to, reason}\nmodel.error\tModel failure\t{model, error, fallback}\ntask.start\tTask initiated\t{task, type, model}\ntask.complete\tTask finished\t{task, result_summary}\ntask.error\tTask failed\t{task, error, retry}\nintel.ingested\tInformation ingested\t{source, title, category, value}\nerror.alert\tError notification\t{type, details, action}\nagent.spawn\tSub-agent created\t{hostname, purpose, model}\nagent.exit\tSub-agent exited\t{hostname, reason, result}\nCapability 3: Sub-Agent Management\n3.1 Naming Convention\nPrimary agent:    keke-agent\nSub-agents:       keke-sub-{purpose}  (e.g., keke-sub-code, keke-sub-writer)\nNested sub:       keke-sub-{purpose}-{n}\n\n3.2 Spawning Sub-Agents\n\nWhen OpenClaw needs to create a sub-agent for overflow tasks:\n\n# Publish agent spawn event\n~/.pilot/bin/pilotctl --json publish keke-agent agent.spawn \\\n  --data '{\"hostname\":\"keke-sub-code\",\"purpose\":\"code refactoring\",\"model\":\"sonnet-4.6\"}'\n\n3.3 Collecting Sub-Agent Results\n# Sub-agent sends results via Data Exchange\n~/.pilot/bin/pilotctl --json send-message keke-agent \\\n  --data '{\"type\":\"sub_agent_result\",\"from\":\"keke-sub-code\",\"result\":\"refactoring complete\",\"files_changed\":3}' \\\n  --type json\n\n# Primary agent checks results\n~/.pilot/bin/pilotctl --json inbox\n\nCapability 4: Task Routing\n4.1 Route by Tags\n\nAssign capability tags to different agents:\n\n# Tag self\n~/.pilot/bin/pilotctl --json set-tags orchestrator chinese fast\n\n\nTag conventions:\n\nTag\tMeaning\tBest Fit Agent\norchestrator\tScheduling & dispatch\tOpenClaw primary agent\ndeep-reasoning\tDeep reasoning tasks\tAntigravity (Opus)\ncode-gen\tCode generation\tCodex (Sonnet)\nlocal-inference\tLocal model inference\tLM Studio (Qwen)\nfast\tFast responses\tFlash Lite instances\nchinese\tChinese language tasks\tQwen / Chinese-optimized models\n4.2 Find the Best Agent\n~/.pilot/bin/pilotctl --json peers --search \"code-gen\"\n\nCapability 5: Model Dispatch Notifications\n5.1 Publish Model Switch Events\n\nEvery model switch gets logged to the event stream:\n\n~/.pilot/bin/pilotctl --json publish keke-agent model.switch \\\n  --data '{\"from\":\"CURRENT_MODEL\",\"to\":\"NEW_MODEL\",\"reason\":\"reason\",\"timestamp\":\"ISO8601\"}'\n\n5.2 Model Fallback Chain\n\nOn model failure, automatically publish degradation events:\n\n~/.pilot/bin/pilotctl --json publish keke-agent model.error \\\n  --data '{\"model\":\"gemini-3-flash\",\"error\":\"402 quota exceeded\",\"fallback\":\"minimax-m2.5\"}'\n\nCapability 6: File Transfer\n6.1 Send File\n~/.pilot/bin/pilotctl --json send-file keke-agent /path/to/file\n\n\nFiles are saved to ~/.pilot/received/.\n\n6.2 View Received Files\n~/.pilot/bin/pilotctl --json received\n\n6.3 Use Cases\nTransfer context snapshot files\nTransfer code diffs\nTransfer analysis reports\nShare configuration across agents\nCapability 7: Network Diagnostics\n7.1 Health Checks\n# Daemon status\n~/.pilot/bin/pilotctl --json daemon status\n\n# Agent info\n~/.pilot/bin/pilotctl --json info\n\n# Connection list\n~/.pilot/bin/pilotctl --json connections\n\n# Peer list\n~/.pilot/bin/pilotctl --json peers\n\n7.2 Performance Testing\n# Ping latency\n~/.pilot/bin/pilotctl --json ping keke-agent --count 3\n\n# Throughput benchmark\n~/.pilot/bin/pilotctl --json bench keke-agent 1\n\nCapability 8: Gateway IP Bridging\n8.1 Map Agent to Local IP\n# Gateway bridging on user-space ports (>1024) does NOT require root/sudo.\n~/.pilot/bin/pilotctl gateway start --ports 1234,8080 0:0000.0000.0001\n\n\nOnce mapped, standard HTTP tools can be used:\n\ncurl http://10.4.0.1:1234/v1/chat/completions  # Like calling LM Studio directly\n\n8.2 Use Cases\nExpose LM Studio through Gateway as a Pilot address\nUnify all model endpoints under one entry point\nAccess agent services with standard HTTP tools\nCapability 9: Webhook Real-time Monitoring\n9.1 Set Up Webhook\n~/.pilot/bin/pilotctl --json set-webhook http://localhost:8080/pilot-events\n\n9.2 Event Types\n\nAll native daemon events are pushed to the webhook:\n\nnode.registered / node.reregistered\nconn.established / conn.fin / conn.rst\nhandshake.received / handshake.approved\nmessage.received / file.received\npubsub.published / pubsub.subscribed\nsecurity.syn_rate_limited / security.nonce_replay\nStanding Orders (Automation Rules)\nRule 1: Snapshot Before Session End\n\nAutomatically execute a context snapshot (Capability 1.1) before every session ends.\n\nRule 2: Critical Events Must Be Published\n\nThe following events must always be published to the Event Stream:\n\nModel switches\nIntelligence ingestion completions\nTask completions/failures\nContext compactions\nError alerts\nRule 3: Auto-Restore on New Session\n\nOn every new session start, check pilotctl inbox for the latest snapshot and restore context.\n\nRule 4: Daemon Heartbeat\n\nCheck daemon status every 30 minutes. Auto-restart on failure.\n\nTroubleshooting\nProblem\tDiagnostic Command\tSolution\nDaemon not running\tpilotctl daemon status\t~/.pilot/start-local.sh\nRegistry unreachable\tpilotctl info (check peers)\tVerify rendezvous server is running\nMessages not sending\tpilotctl connections\tCheck trust state with target\nInbox overflowing\tpilotctl inbox\tpilotctl inbox --clear"
  },
  "trust": {
    "sourceLabel": "tencent",
    "provenanceUrl": "https://clawhub.ai/sarahmirrand001-oss/agent-swarm-network",
    "publisherUrl": "https://clawhub.ai/sarahmirrand001-oss/agent-swarm-network",
    "owner": "sarahmirrand001-oss",
    "version": "1.0.6",
    "license": null,
    "verificationStatus": "Indexed source record"
  },
  "links": {
    "detailUrl": "https://openagent3.xyz/skills/agent-swarm-network",
    "downloadUrl": "https://openagent3.xyz/downloads/agent-swarm-network",
    "agentUrl": "https://openagent3.xyz/skills/agent-swarm-network/agent",
    "manifestUrl": "https://openagent3.xyz/skills/agent-swarm-network/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/agent-swarm-network/agent.md"
  }
}