From coral-skills
Orchestrate multi-agent swarms via Coral Protocol using HTTP API calls. Use this skill whenever the user wants to coordinate multiple AI agents, run parallel agent tasks, spawn agent swarms, delegate work to sub-agents, or manage multi-agent collaboration through Coral. Also trigger when the user mentions Coral Protocol, puppet-agent, agent orchestration, or wants to run tasks like research/coding/debate across multiple agents simultaneously.
How this skill is triggered — by the user, by Claude, or both
Slash command
/coral-skills:coral-agent-swarmThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
You are the main orchestrator agent in a Coral multi-agent session. You talk directly to the human user.
You are the main orchestrator agent in a Coral multi-agent session. You talk directly to the human user.
You do NOT have Coral MCP tools. You control everything via HTTP API calls and the watch_coral.sh script.
Before doing anything else, run a single combined check:
echo "=== SERVER CHECK ===" && (curl -s -o /dev/null -w "%{http_code}" http://localhost:5555/ 2>/dev/null || echo "000") && echo "=== CORAL INSTALLED ===" && (test -f ~/.coral/coral-server/gradlew && echo "YES" || echo "NO") && echo "=== PUPPET CHECK ===" && (test -f ~/.coral/puppet/startup.sh && echo "YES" || echo "NO") && echo "=== AVAILABLE AGENTS ===" && (grep "local_agents" ~/.coral/coral-server/src/main/resources/config.toml 2>/dev/null || echo "NOT_FOUND")
Parse the output and handle each issue:
1. Coral not installed (CORAL INSTALLED = NO):
Tell the user Coral is not installed and suggest running the coral-setup skill first. Stop here.
2. Puppet not installed (PUPPET CHECK = NO):
Puppet is required — it is your proxy identity in the Coral session. Read the sibling skill at ${SKILL_DIR}/../coral-built-in-agent-setup/SKILL.md and follow its instructions to install puppet (and optionally other agents). Do NOT proceed until puppet is installed.
3. Server not running (HTTP status = 000):
Start it in the background:
mkdir -p ~/.coral/logs && cd ~/.coral/coral-server && nohup ./gradlew run > ~/.coral/logs/coral-server.log 2>&1 &
Then wait for the server to become ready (it typically takes 10-20 seconds to start):
for i in $(seq 1 30); do
STATUS=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:5555/ 2>/dev/null || echo "000")
if [ "$STATUS" != "000" ]; then echo "Coral server is ready"; break; fi
sleep 2
done
If the server doesn't come up after 60 seconds, tell the user — there may be a build issue or port conflict. Check ~/.coral/logs/coral-server.log for errors.
4. Note available agents from the AVAILABLE AGENTS output:
Parse the local_agents array from config.toml to determine which agent types are registered. Store this list — you will need it in the Agent Spawning section to know which agent types you can use. Do NOT assume only claude-code and hermes are available; use whatever agents are actually configured.
All requests use base URL http://localhost:5555 and require -H "Authorization: Bearer test".
Your proxy identity in Coral is puppet-agent. All messages you send go through this agent.
curl -X POST http://localhost:5555/api/v1/local/session \
-H "Authorization: Bearer test" \
-H "Content-Type: application/json" \
-d '{
"agentGraphRequest": {
"agents": [
{
"id": {"name": "<agent-type>", "version": "0.1.0", "registrySourceId": {"type": "local"}},
"name": "<unique-agent-name>",
"provider": {"type": "local", "runtime": "executable"},
"description": "<agent description/role>",
"options": {},
"blocking": false
},
{
"id": {"name": "puppet-agent", "version": "0.1.0", "registrySourceId": {"type": "local"}},
"name": "puppet-agent",
"provider": {"type": "local", "runtime": "executable"},
"description": "Orchestrator proxy agent",
"options": {},
"blocking": false
}
],
"groups": [["<agent-name-1>", "<agent-name-2>", "puppet-agent"]]
},
"namespaceProvider": {
"type": "create_if_not_exists",
"namespaceRequest": {"name": "demo", "deleteOnLastSessionExit": false}
},
"execution": {
"mode": "immediate",
"runtimeSettings": {"ttl": 86400000}
}
}'
Save the sessionId from the response.
curl -X POST http://localhost:5555/api/v1/puppet/demo/{sessionId}/puppet-agent/thread \
-H "Authorization: Bearer test" \
-H "Content-Type: application/json" \
-d '{
"threadName": "<descriptive-thread-name>",
"participantNames": ["<agent-name-1>", "<agent-name-2>", "puppet-agent"]
}'
Save the threadId from the response.
curl -X POST http://localhost:5555/api/v1/puppet/demo/{sessionId}/puppet-agent/thread/message \
-H "Authorization: Bearer test" \
-H "Content-Type: application/json" \
-d '{
"threadId": "<threadId>",
"content": "Your message here @agent-name",
"mentions": ["<agent-name>"]
}'
.claude/skills/coral-agent-swarm/watch_coral.sh <sessionId>
Blocks until a new message arrives, then exits.
curl -X GET http://localhost:5555/api/v1/local/session/demo/{sessionId}/extended \
-H "Authorization: Bearer test"
curl -X DELETE http://localhost:5555/api/v1/puppet/demo/{sessionId}/{agentName} \
-H "Authorization: Bearer test"
curl -X DELETE http://localhost:5555/api/v1/local/session/demo/{sessionId} \
-H "Authorization: Bearer test"
NOTE: Closing the session does NOT kill external agent processes. After closing, also kill remaining processes:
ps aux | grep -E "claude.*bypassPermissions|hermes" | grep -v grep
kill <pid>
Create a session with the agents you need. The available agent types come from local_agents in ~/.coral/coral-server/src/main/resources/config.toml (detected during Pre-flight). The agent type name in the API (id.name) is the directory name under ~/.coral/ (e.g. if the path is /Users/xxx/.coral/claude-code, the agent type is claude-code).
Rules:
config.toml. If the user requests an agent type that isn't available, tell them and suggest running the coral-built-in-agent-setup skill to install it.puppet-agent in the session — this is your proxy for sending/receiving messages.All communication with spawned agents MUST go through the API:
After EVERY message sent, follow this exact loop:
watch_coral.sh <sessionId> to wait for a response.watch_coral.sh exits — no matter why it exited (new message, timeout, error, user interruption, or any other reason) — your very next action MUST be to GET the extended session endpoint. This is non-negotiable. There is no scenario where you skip this step.
curl -s -X GET "http://localhost:5555/api/v1/local/session/demo/{sessionId}/extended" \
-H "Authorization: Bearer test"
Why this matters: watch_coral.sh is a best-effort notification mechanism — it listens on a WebSocket and exits when it sees a thread_message_sent event. But it can miss messages for many reasons: the WebSocket might connect after the message was already sent, multiple messages might arrive while only one triggers the exit, or the script might time out or be interrupted. The GET endpoint is the only reliable source of truth for what messages actually exist. Skipping the GET is the #1 cause of "lost" messages.
The iron rule: never run watch_coral.sh twice in a row. Between every watch_coral.sh call, there must be a GET to the extended endpoint. If you find yourself about to run watch_coral.sh and your previous action was also watch_coral.sh, STOP — you forgot to check state. Do the GET first.
When you create, update, or complete tasks using your task/todo tools, ALWAYS print the current task list or status summary so the user can see your progress. Do not silently update tasks — make it visible.
When the user gives you a task, follow this decision tree:
YES — atomic task:
NO — needs decomposition:
Before decomposing, check: do you have enough information to plan properly?
Break the task into subtasks. While decomposing, consider:
Before executing each subtask:
For each subtask, evaluate in this order:
When spawning agents, choose the type based on the task nature and the agents available in config.toml (detected during Pre-flight). Common mappings:
claude-code if available)hermes if available)coral-agent.toml under ~/.coral/<agent-name>/ to understand its capabilities if needed.After each subtask completes, update your task/todo tool. Remove agents that have finished their work.
Once all subtasks are done, synthesize results and report back to the user.
Creates, edits, and optimizes skills for Claude Code, including drafting, evaluating with test prompts, iterating on performance, and improving skill descriptions for better triggering accuracy.
npx claudepluginhub coral-protocol/coral-skill-set --plugin coral-skills