Agent Builder Plus
by @ykaixu
Build high-performing OpenClaw agents end-to-end with comprehensive safety features. Use when you want to design a new agent (persona + operating rules) and...
clawhub install agent-builder-plusπ About This Skill
name: agent-builder-plus description: Build high-performing OpenClaw agents end-to-end with comprehensive safety features. Use when you want to design a new agent (persona + operating rules) and generate required OpenClaw workspace files (SOUL.md, IDENTITY.md, AGENTS.md, USER.md, HEARTBEAT.md, optional MEMORY.md + memory/YYYY-MM-DD.md). Includes anti-deadlock protection, timeout handling, error recovery, loop breaker, message overload protection, token limit protection, retry mechanism, health check, degraded mode, monitoring & logging, configuration validation, and channel conflict prevention. Also use to iterate on an existing agent's behavior, guardrails, autonomy model, heartbeat plan, and skill roster.
Agent Builder Plus (OpenClaw)
Design and generate a complete OpenClaw agent workspace with strong defaults and advanced-user-oriented clarifying questions.
Quick Start
# 1. Read skill documentation
Read SKILL.md and references/openclaw-workspace.md2. Answer interview questions
Provide answers for: job statement, surfaces, autonomy level, prohibitions, memory, tone, tool posture3. Generate workspace files
The skill will create: IDENTITY.md, SOUL.md, AGENTS.md, USER.md, HEARTBEAT.md4. Verify and test
Run acceptance tests to validate behavior
Canonical references
references/openclaw-workspace.mdreferences/templates.mdreferences/architecture.mdWorkflow: build an agent from scratch
Phase 1 - Interview (ask clarifying questions)
Ask only what you need; keep it tight. Prefer multiple short rounds over one giant questionnaire.
Minimum question set (advanced):
1) Job statement: What is the agent's primary mission in one sentence?
2) Surfaces: Which channels (Telegram/WhatsApp/Discord/iMessage/Feishu)? DM only vs groups?
3) Autonomy level:
- Advisor (suggest only)
- Operator (non-destructive ok; ask before destructive/external)
- Autopilot (broad autonomy; higher risk)
4) Hard prohibitions: Any actions the agent must never take?
5) Memory: Should it keep curated MEMORY.md? What categories matter?
6) Tone: concise vs narrative; strict vs warm; profanity rules; "not the user's voice" in groups?
7) Tool posture: tool-first vs answer-first; verification requirements.
Error recovery:
Phase 2 - Generate workspace files
Generate these files (minimum viable OpenClaw agent):
IDENTITY.mdSOUL.mdAGENTS.mdUSER.mdHEARTBEAT.md (often empty by default)BOOTSTRAP.md (for first-run guidance)Optionals:
MEMORY.md (private sessions only)memory/YYYY-MM-DD.md seed (today) with a short "agent created" entryTOOLS.md starter (if the user wants per-environment notes)File creation commands:
# Create workspace directory
mkdir -p /path/to/workspace/memoryCreate files (use write tool with correct parameters)
Important: Use file_path parameter, not path
Example:
write:
file_path: /path/to/workspace/IDENTITY.md
content: "content here"
For large files (>2000 bytes), consider using file-writer skill
or split content into smaller chunks
Note: If you encounter "Missing required parameter: path (path or file_path)" error,
ensure you're using file_path parameter in your write tool calls.
Error handling:
Error recovery:
Use templates from references/templates.md but tailor content to the answers.
Phase 2.5 - Register agent with OpenClaw
β οΈ CRITICAL WARNING: Channel Conflict Prevention
NEVER bind a new agent to the same channel as the main agent!
This will cause the new agent to hijack the main agent's channel, making it impossible to communicate with the main agent.
Before registering, check existing agent bindings:
# List all agents and their bindings
openclaw agents listCheck which channels are already in use
openclaw channels list
Channel binding rules:
1. Main agent (ε€§ι±Ό): Always uses the primary Feishu DM channel
2. New agents: Must use DIFFERENT channels or sub-channels
3. Testing: Use /agentname command binding for testing
4. Production: Create separate Feishu apps or use different channels
Backup configuration first:
# Backup openclaw.json before modification
cp ~/.openclaw/openclaw.json ~/.openclaw/openclaw.json.backup
Register the agent:
# Add agent to OpenClaw configuration
openclaw agents add --workspace /path/to/workspaceExample 1: Use independent workspace (recommended - each agent has its own workspace)
openclaw agents add my-assistant --workspace ~/.openclaw/workspace-my-assistantExample 2: Use default workspace (for single agent setup only)
openclaw agents add my-assistant --workspace ~/.openclaw/workspace
Channel binding options:
Feishu:
/agentname in Feishu messages (for testing)Telegram:
WhatsApp:
Discord:
iMessage:
Authentication configuration (if needed):
# Edit auth-profiles.json for external service access
Location: ~/.openclaw/auth-profiles.json
Example structure:
{
"feishu": {
"appId": "cli_xxxxx",
"appSecret": "xxxxx"
},
"telegram": {
"botToken": "your-bot-token"
}
}
Model provider configuration (optional):
If the new agent needs to use custom model providers, you need to configure API keys:
Step 1: Check main agent's model configuration
# View main agent's model configuration
cat ~/.openclaw/agents/main/agent/models.jsonView global model providers
cat ~/.openclaw/openclaw.json | grep -A 20 "providers"
Step 2: Choose configuration approach
Option A: Use same model as main agent (recommended)
Option B: Configure new model provider
Step 3: Configure model provider (if needed)
# Add provider to openclaw.json
Location: ~/.openclaw/openclaw.json
Example structure:
{
"models": {
"providers": {
"custom-provider": {
"baseUrl": "https://api.example.com/v1",
"apiKey": "key_id:secret",
"api": "openai-completions",
"models": [...]
}
}
}
}
Step 4: Configure agent-specific auth (if needed)
# Edit auth-profiles.json for the agent
Location: ~/.openclaw/agents//agent/auth-profiles.json
Example structure:
{
"custom-provider": {
"apiKey": "key_id:secret",
"baseUrl": "https://api.example.com/v1"
}
}
β οΈ IMPORTANT: Model providers vs Channel providers
Do not confuse these two types of providers!
Common error:
β οΈ Agent failed before reply: No API key found for provider "provider-name"
Solution: 1. Check if provider name matches openclaw.json models.providers 2. Verify API key is configured correctly 3. Check auth-profiles.json for agent-specific configuration 4. Restart OpenClaw Gateway after configuration changes
β οΈ IMPORTANT: Never reuse credentials from main agent!
Error recovery:
openclaw agents add fails: Restores from backup and checks syntaxCommon errors and solutions:
Error 1: "No API key found for provider 'provider-name'"
Causes:
Solutions: 1. Check provider name in openclaw.json:
cat ~/.openclaw/openclaw.json | grep -A 10 "providers"
2. Verify provider name spelling (case-sensitive)
3. Add provider to models.providers if needed
4. Restart OpenClaw Gateway after configuration changesError 2: "Agent failed before reply"
Causes:
Solutions: 1. Verify workspace files exist:
ls -la /path/to/workspace/
2. Check agent configuration:
openclaw agents list
3. Test agent loading:
openclaw agents test
4. Check OpenClaw logs:
openclaw logs --follow
Error 3: "Missing required parameter: path (path or file_path)"
Causes:
Solutions:
1. Use correct parameter name: file_path instead of path
2. Verify tool call syntax:
write:
file_path: /path/to/file.md
content: "content here"
3. Check tool documentation for correct parametersError 4: "Could not find exact text in file"
Causes:
Solutions: 1. Re-read file to get exact content:
read /path/to/file.md
2. Use unique markers for large sections:
[content]
3. Match whitespace exactly (copy from file read)
4. Use smaller oldText for more precise matchingPhase 2.6 - Verify configuration
Verification steps:
# 1. Check agent is registered
openclaw agents list2. Verify workspace files exist
ls -la /path/to/workspace/3. Test agent can load (dry run)
openclaw agents test
Success criteria:
openclaw agents list outputIf verification fails:
1. Check file permissions
2. Validate JSON/YAML syntax in configuration files
3. Review error messages from openclaw agents test
4. Restore from backup if necessary
Error recovery:
Phase 3 - Guardrails checklist
Ensure the generated agent includes:
AGENTS.md.Error recovery:
Phase 4 - Acceptance tests (fast)
Provide 5-10 short scenario prompts to validate behavior, e.g.:
Error recovery:
Phase 8 - Automated testing (optional)
Automated test commands:
# Run OpenClaw's built-in agent tests
openclaw agents test --verboseTest workspace file syntax
openclaw validate workspace /path/to/workspaceTest configuration loading
openclaw config test
Test script example:
#!/bin/bash
test-agent.sh - Automated agent testing script
AGENT_NAME="my-assistant"
WORKSPACE="/path/to/workspace"
echo "Testing agent: $AGENT_NAME"
Test 1: File existence
echo "Test 1: Checking required files..."
for file in IDENTITY.md SOUL.md AGENTS.md USER.md HEARTBEAT.md; do
if [ ! -f "$WORKSPACE/$file" ]; then
echo "β Missing: $file"
exit 1
fi
done
echo "β
All required files present"Test 2: Configuration syntax
echo "Test 2: Validating configuration..."
openclaw agents list | grep -q "$AGENT_NAME"
if [ $? -eq 0 ]; then
echo "β
Agent registered correctly"
else
echo "β Agent not found in configuration"
exit 1
fiTest 3: Agent loading
echo "Test 3: Testing agent load..."
openclaw agents test "$AGENT_NAME"
if [ $? -eq 0 ]; then
echo "β
Agent loads successfully"
else
echo "β Agent failed to load"
exit 1
fiecho "π All tests passed!"
Error recovery:
Optional: systemd service configuration
For production deployments, the agent can run as a systemd service:
Service file example:
# Create systemd service file
sudo tee /etc/systemd/system/openclaw-agent.service > /dev/null <[Service]
Type=simple
User=
WorkingDirectory=/home//.openclaw
ExecStart=/usr/bin/node /home//.npm-global/lib/node_modules/openclaw/dist/index.js
Restart=always
RestartSec=10
[Install]
WantedBy=multi-user.target
[Install]
WantedBy=multi-user.target
EOF
Enable and start service:
# Reload systemd configuration
sudo systemctl daemon-reloadEnable service to start on boot
sudo systemctl enable openclaw-agent.serviceStart service now
sudo systemctl start openclaw-agent.serviceCheck status
sudo systemctl status openclaw-agent.serviceView logs
sudo journalctl -u openclaw-agent.service -f
Error recovery:
Workflow: iterate on an existing agent
When improving an existing agent, ask:
1) What are the top 3 failure modes you have seen? (loops, overreach, verbosity, etc.) 2) What autonomy changes do you want? 3) Any new safety boundaries? 4) Any changes to heartbeat behavior?
Then propose targeted diffs to:
SOUL.md (persona/tone/boundaries)AGENTS.md (operating rules + memory + delegation)HEARTBEAT.md (small checklist)Keep changes minimal and surgical.
Error recovery:
π‘ Examples
# 1. Read skill documentation
Read SKILL.md and references/openclaw-workspace.md2. Answer interview questions
Provide answers for: job statement, surfaces, autonomy level, prohibitions, memory, tone, tool posture3. Generate workspace files
The skill will create: IDENTITY.md, SOUL.md, AGENTS.md, USER.md, HEARTBEAT.md4. Verify and test
Run acceptance tests to validate behavior