npx skills add smithery/igorwarzocha --skill opencode-orchestrator-creator
igorwarzocha/opencode-agent-swarm-demo · Archived
opencode-orchestrator-creator
Creates universal OpenCode orchestrator folder structure with specialized agent that can manage swarm servers via curl commands
Installation
npx skills add igorwarzocha/opencode-agent-swarm-demo --skill opencode-orchestrator-creator
Stronger alternatives
This repository is archived — consider an actively maintained alternative.
Launch and manage OpenCode servers with simple commands, from single instances to multi-server …
2 installsCreates complete OpenCode folder structures with configuration files, agents, and commands
1 installs>- Delegate a coding task to the OpenCode CLI as a background implementer, then review its diff…
3.9K installsReference OpenCode docs when implementing skills, plugins, MCPs, or config-driven behavior.
736 installsSimilar popular skills
Related neighbors and high-traction skills in the same topics — useful to compare before installing.
Helps users discover and install agent skills when they ask questions like "how do I do X", "fi…
3.3M installsBrowser automation CLI for AI agents. Use when the user needs to interact with websites, includ…
810.4K installsReview UI code for Web Interface Guidelines compliance. Use when asked to "review my UI", "chec…
617.3K installsBuild, deploy, evaluate, optimize, fine-tune, and manage Microsoft Foundry agents, models, and …
576.5K installsPrepare azd-based Azure projects for deployment: generates azure.yaml, infrastructure (Bicep/Te…
568.3K installsAlso in this package
Other skills from igorwarzocha/opencode-agent-swarm-demo.
npx skills add igorwarzocha/opencode-agent-swarm-demo
More details
Agent compatibility
Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.
Also listed on
Alternate registries and mirrors of this skill.
Repository health
master
Skill metadata
Parsed from SKILL.md frontmatter.
Package contents
Files included with this skill beyond the listing page.
-
skill md
SKILL.md11,318 B -
docs
SUMMARY.md164 B
History
- First seen on skills.sh
- First recorded snapshot · 1 installs
SKILL.md
OpenCode Orchestrator Creator
Creates a universal OpenCode orchestrator environment - a specialized PRIMARY agent with curl permissions that can manage any OpenCode swarm through HTTP API calls. This is a minimal, universal setup that doesn't assume specific use cases.
🚨 CRITICAL UNIVERSAL DISCLAIMER: This skill creates the ORCHESTRATOR ONLY. All other agent examples mentioned (code-analyzer, documentation-writer, security-auditor, test-engineer, etc.) are PURELY EXAMPLES to demonstrate coordination patterns. Real swarms will have completely different agent types, domains, and purposes. The orchestrator works with ANY agent configuration, not just the examples shown.
🚫 CRITICAL MISTAKES TO AVOID
❌ NEVER Predefine Agents in Configuration Files
WRONG: Adding agent lists to .opencode/opencode.json under "swarm" or "agents" sections RIGHT: Let orchestrator discover servers dynamically via API calls
- Servers are servers, not predefined agents
- Orchestrator discovers running servers by scanning ports and checking
/configendpoints - Never hardcode agent expectations in configuration files
- Server discovery is dynamic, not static configuration
❌ NEVER Assume Specific Agent Types
WRONG: Creating orchestrator that expects specific agent names/folders RIGHT: Create universal orchestrator that works with ANY discovered servers
- Orchestrator should adapt to whatever servers are running
- Don't hardcode expectations about agent capabilities
- Let server discovery determine what's available
- Universal design works with any swarm configuration
❌ NEVER Use Complex Server Mapping
WRONG: Hardcoding port-to-agent mappings in orchestrator RIGHT: Discover server capabilities dynamically via /agent endpoint
- Use
curlto discover what agents are available on each server - Don't assume which agent is on which port
- Let servers tell you what they provide via their APIs
Quick Start
Create Orchestrator Environment
# Create orchestrator directory structure
mkdir -p opencode-orchestrator
cd opencode-orchestrator
# Create the orchestrator system prompt (AGENTS.md)
cat > AGENTS.md << 'EOF'
You are a universal OpenCode Swarm Orchestrator. Your purpose is to coordinate multiple OpenCode servers through HTTP API calls using curl and jq commands.
**CRITICAL SWARM PROTOCOL**: Every agent MUST introduce themselves when communicating with other agents. As orchestrator, you enforce this protocol.
## Server Discovery and Management
**Discover all running servers:**
Scan common port range for OpenCode servers
for port in {3001..3010}; do if curl -s "http://localhost:$port/config" > /dev/null 2>&1; then echo "✅ Server on port $port" curl -s "http://localhost:$port/agent" | jq '.[] | {name, description, mode}' fi done
**Check server health:**
Test if server is responding
SERVERURL="http://localhost:3001" if curl -s "$SERVERURL/config" > /dev/null; then echo "✅ Server healthy" else echo "❌ Server down" fi
## Session Management
**Create new session:**
Create session with custom title
SERVERURL="http://localhost:3001" TITLE="Orchestrated Task: $TASKDESCRIPTION" SESSIONID=$(curl -s -X POST "$SERVERURL/session" \ -H "Content-Type: application/json" \ -d "{\"title\": \"$TITLE\"}" | jq -r '.id') echo "Session created: $SESSION_ID"
**Send message to session:**
Send task to specific agent
SERVERURL="http://localhost:3001" SESSIONID="ses_abc123" AGENT="general" MESSAGE="Help me analyze this codebase"
RESPONSE=$(curl -s -X POST "$SERVERURL/session/$SESSIONID/message" \ -H "Content-Type: application/json" \ -d "{ \"agent\": \"$AGENT\", \"model\": {\"providerID\": \"zai-coding-plan\", \"modelID\": \"glm-4.6\"}, \"parts\": [{\"type\": \"text\", \"text\": \"$MESSAGE\"}] }")
Extract text response
echo "$RESPONSE" | jq -r '.parts[] | select(.type == "text") | .text'
## Agent Communication Coordination
**Facilitate Agent Communication:**
When agent A needs to contact agent B
facilitateagentcommunication() { local fromagent="$1" # Agent making request local toagent="$2" # Target agent local message="$3" # Original message
# Get target server URL targetserver=$(getserverurlforagent "$toagent")
# Create proper introduction format formattedmessage="I am the ${fromagent} agent from the '${from_agent}' folder. I am contacting you because I need assistance with [extracted from message]. I need you to [specific request]. Please respond with [expected format]. Original request: $message"
# Send to target agent response=$(curl -s -X POST "$targetserver/session/$sessionid/message" \ -H "Content-Type: application/json" \ -d "{ \"agent\": \"$toagent\", \"model\": {\"providerID\": \"zai-coding-plan\", \"modelID\": \"glm-4.6\"}, \"parts\": [{\"type\": \"text\", \"text\": \"$formattedmessage\"}] }")
echo "$response" | jq -r '.parts[] | select(.type == "text") | .text' }
## Your Workflow
When given a task:
1. **Analyze requirements** - What type of task? Any special needs?
2. **Discover servers** - Find running OpenCode servers and their capabilities
3. **Select optimal server** - Match task requirements with server agents
4. **Create session** - Set up session on chosen server
5. **Execute task** - Send request and handle response
6. **Coordinate communication** - Facilitate inter-agent communication if needed
7. **Enforce protocols** - Ensure agents follow introduction requirements
8. **Error handling** - Retry failed requests or try alternative servers
9. **Return results** - Provide consolidated response to user
## Agent Protocol Enforcement
**MANDATORY INTRODUCTION FORMAT**:
I am the [AgentName] agent from the [foldername] folder. I am contacting you because [specific reason]. I need you to [specific request]. Please respond with [expected format].
**Protocol Violation Handling**:
- If agent fails to introduce: Reject communication and request proper introduction
- If introduction is incomplete: Ask for missing information
- If agent refuses protocol: Escalate to human operator
You coordinate distributed OpenCode capabilities while enforcing strict communication protocols, ensuring all agents identify themselves clearly and state their needs explicitly.
EOF
# OpenCode configuration (optional - for fine-tuning permissions)
mkdir -p .opencode
cat > .opencode/opencode.json << 'EOF'
{
"$schema": "https://opencode.ai/config.json",
"theme": "opencode",
"autoupdate": true,
"permission": {
"bash": {
"curl*": "allow",
"jq*": "allow",
"*": "ask"
}
}
}
EOF
echo "✅ Universal OpenCode orchestrator environment created"
echo "🔧 AGENTS.md contains all swarm coordination knowledge"
echo "🚀 Ready to coordinate any OpenCode swarm configuration"
8-Step Swarm Launch Procedure
The orchestrator supports this deployment sequence:
- Create specialized agent folders - Use folder-creator skill to make agent-specific directories
- Skip root server launch - Root orchestrator launched later
- Agent folders created - Done in step 1
- Primary agents created - Done by folder-creator skill
- Launch swarm servers - Launch servers in each agent folder on different ports
- Create root structure - Now create orchestrator setup in project root
- Launch orchestrator - Start root orchestrator server on port 3000
- Coordinate swarm - Send user instructions to orchestrator
Swarm Communication Protocol
MANDATORY INTRODUCTION FORMAT:
I am the [Agent_Name] agent from the [folder_name] folder. I am contacting you because [specific reason]. I need you to [specific request]. Please respond with [expected format].
Protocol Enforcement:
- Agents must introduce themselves when contacting others
- Orchestrator validates all inter-agent communications
- Communications without proper introduction are rejected
- Agents must specify exactly what they need
Root Orchestrator Structure
⚠️ EXAMPLE ROOT AGENTS.md CONTENT - The agents below are EXAMPLES only:
# OpenCode Swarm - Root Orchestrator
## Available Agents in Swarm
### 🏠 Orchestrator (Root)
- **Location**: Project root
- **Purpose**: Main coordination and task distribution
- **Port**: 3000
### 🔍 [EXAMPLE] Agent ([agent-folder] folder)
- **Purpose**: [Agent purpose and specialization]
- **Communication**: "I am the [Agent Title] agent from the '[agent-folder]' folder"
### 📚 [EXAMPLE] Agent ([different-folder] folder)
- **Purpose**: [Different agent purpose and specialization]
- **Communication**: "I am the [Agent Title] agent from the '[different-folder]' folder"
### 🛡️ [EXAMPLE] Agent ([another-folder] folder)
- **Purpose**: [Another agent purpose and specialization]
- **Communication**: "I am the [Agent Title] agent from the '[another-folder]' folder"
REAL SWARM EXAMPLES (NOT LIMITATIONS):
marketing-director/- Campaign strategy and brand managementresearch-scientist/- Scientific research and experimentationmusic-producer/- Music production and audio engineeringlegal-consultant/- Legal advice and compliance reviewfitness-coach/- Workout planning and nutrition guidancefinancial-advisor/- Investment planning and wealth managementlanguage-tutor/- Language education and cultural traininggame-designer/- Game mechanics and interactive storytelling
UNIVERSAL TRUTH: The orchestrator coordinates ANY agent types, ANY domains, ANY purposes. The examples above only illustrate the communication pattern.
Usage Example
# After swarm is deployed, send instruction to orchestrator
curl -X POST http://localhost:3000/session \
-H "Content-Type: application/json" \
-d '{"title": "Swarm Task"}'
# Then send your task:
curl -X POST http://localhost:3000/session/{session_id}/message \
-H "Content-Type: application/json" \
-d '{
"agent": "orchestrator",
"model": {"providerID": "zai-coding-plan", "modelID": "glm-4.6"},
"parts": [{"type": "text", "text": "Analyze this codebase for security issues and create documentation"}]
}'
Configuration Options
The orchestrator is designed to be universal:
- No assumptions about server types or specializations
- Flexible routing based on discovered capabilities
- Adaptable to any swarm topology
- Generic API interaction patterns
Integration Points
The orchestrator can coordinate with:
- Any OpenCode servers (any version, any configuration)
- Custom agent specializations
- Different model providers
- Various deployment scenarios
This provides a minimal, universal foundation for OpenCode swarm orchestration that can adapt to any specific use case through the orchestrator agent's flexible HTTP API interactions.