refactor: split OpenClaw AITBC skill into focused modules

BREAKING CHANGE: Split monolithic skill into domain-specific modules

New Skills Created:
- openclaw-management.md: Pure OpenClaw agent operations, coordination, workflows
- aitbc-blockchain.md: Pure AITBC blockchain operations, AI jobs, marketplace

Legacy Changes:
- openclaw-aitbc.md: Deprecated, now redirects to split skills
- Added comprehensive migration guide and quick reference

Benefits:
- Clearer separation of concerns (agent vs blockchain operations)
- Better documentation organization and maintainability
- Improved reusability across different systems
- Enhanced searchability and domain-specific troubleshooting
- Modular combination possible for integrated workflows

Migration:
- All existing functionality preserved in split skills
- Clear migration path with before/after examples
- Legacy skill maintained for backward compatibility
- Quick reference links to new focused skills

Files:
- New: openclaw-management.md (agent coordination focus)
- New: aitbc-blockchain.md (blockchain operations focus)
- Updated: openclaw-aitbc.md (legacy with migration guide)
- Preserved: All supporting files in openclaw-aitbc/ directory
This commit is contained in:
2026-03-30 15:57:48 +02:00
parent 9207cdf6e2
commit bd1221ea5a
7 changed files with 2077 additions and 0 deletions

View File

@@ -0,0 +1,490 @@
---
description: Complete AITBC blockchain operations and integration
title: AITBC Blockchain Operations Skill
version: 1.0
---
# AITBC Blockchain Operations Skill
This skill provides comprehensive AITBC blockchain operations including wallet management, transactions, AI operations, marketplace participation, and node coordination.
## Prerequisites
- AITBC multi-node blockchain operational (aitbc genesis, aitbc1 follower)
- AITBC CLI accessible: `/opt/aitbc/aitbc-cli`
- SSH access between nodes for cross-node operations
- Systemd services: `aitbc-blockchain-node.service`, `aitbc-blockchain-rpc.service`
- Poetry 2.3.3+ for Python package management
- Wallet passwords known (default: 123 for new wallets)
## Critical: Correct CLI Syntax
### AITBC CLI Commands
```bash
# All commands run from /opt/aitbc with venv active
cd /opt/aitbc && source venv/bin/activate
# Basic Operations
./aitbc-cli create --name wallet-name # Create wallet
./aitbc-cli list # List wallets
./aitbc-cli balance --name wallet-name # Check balance
./aitbc-cli send --from w1 --to addr --amount 100 --password pass
./aitbc-cli chain # Blockchain info
./aitbc-cli network # Network status
./aitbc-cli analytics # Analytics data
```
### Cross-Node Operations
```bash
# Always activate venv on remote nodes
ssh aitbc1 'cd /opt/aitbc && source venv/bin/activate && ./aitbc-cli list'
# Cross-node transaction
./aitbc-cli send --from genesis-ops --to ait141b3bae6eea3a74273ef3961861ee58e12b6d855 --amount 100 --password 123
```
## Wallet Management
### Creating Wallets
```bash
# Create new wallet with password
./aitbc-cli create --name my-wallet --password 123
# List all wallets
./aitbc-cli list
# Check wallet balance
./aitbc-cli balance --name my-wallet
```
### Wallet Operations
```bash
# Send transaction
./aitbc-cli send --from wallet1 --to wallet2 --amount 100 --password 123
# Check transaction history
./aitbc-cli transactions --name my-wallet
# Import wallet from keystore
./aitbc-cli import --keystore /path/to/keystore.json --password 123
```
### Standard Wallet Addresses
```bash
# Genesis operations wallet
./aitbc-cli balance --name genesis-ops
# Address: ait158ec7a0713f30ccfb1aac6bfbab71f36271c5871
# Follower operations wallet
./aitbc-cli balance --name follower-ops
# Address: ait141b3bae6eea3a74273ef3961861ee58e12b6d855
```
## Blockchain Operations
### Chain Information
```bash
# Get blockchain status
./aitbc-cli chain
# Get network status
./aitbc-cli network
# Get analytics data
./aitbc-cli analytics
# Check block height
curl -s http://localhost:8006/rpc/head | jq .height
```
### Node Status
```bash
# Check health endpoint
curl -s http://localhost:8006/health | jq .
# Check both nodes
curl -s http://localhost:8006/health | jq .
ssh aitbc1 'curl -s http://localhost:8006/health | jq .'
# Check services
systemctl is-active aitbc-blockchain-node.service aitbc-blockchain-rpc.service
ssh aitbc1 'systemctl is-active aitbc-blockchain-node.service aitbc-blockchain-rpc.service'
```
### Synchronization Monitoring
```bash
# Check height difference
GENESIS_HEIGHT=$(curl -s http://localhost:8006/rpc/head | jq .height)
FOLLOWER_HEIGHT=$(ssh aitbc1 'curl -s http://localhost:8006/rpc/head | jq .height')
echo "Height diff: $((FOLLOWER_HEIGHT - GENESIS_HEIGHT))"
# Comprehensive health check
python3 /tmp/aitbc1_heartbeat.py
```
## Agent Operations
### Creating Agents
```bash
# Create basic agent
./aitbc-cli agent create --name agent-name --description "Agent description"
# Create agent with full verification
./aitbc-cli agent create --name agent-name --description "Agent description" --verification full
# Create AI-specific agent
./aitbc-cli agent create --name ai-agent --description "AI processing agent" --verification full
```
### Managing Agents
```bash
# Execute agent
./aitbc-cli agent execute --name agent-name --wallet wallet --priority high
# Check agent status
./aitbc-cli agent status --name agent-name
# List all agents
./aitbc-cli agent list
```
## AI Operations
### AI Job Submission
```bash
# Inference job
./aitbc-cli ai-submit --wallet genesis-ops --type inference --prompt "Generate image" --payment 100
# Training job
./aitbc-cli ai-submit --wallet genesis-ops --type training --model "gpt-3.5" --dataset "data.json" --payment 500
# Multimodal job
./aitbc-cli ai-submit --wallet genesis-ops --type multimodal --prompt "Analyze image" --image-path "/path/to/img.jpg" --payment 200
```
### AI Job Types
- **inference**: Image generation, text analysis, predictions
- **training**: Model training on datasets
- **processing**: Data transformation and analysis
- **multimodal**: Combined text, image, audio processing
### AI Job Monitoring
```bash
# Check job status
./aitbc-cli ai-status --job-id job_123
# Check job history
./aitbc-cli ai-history --wallet genesis-ops --limit 10
# Estimate job cost
./aitbc-cli ai-estimate --type inference --prompt-length 100 --resolution 512
```
## Resource Management
### Resource Allocation
```bash
# Allocate GPU resources
./aitbc-cli resource allocate --agent-id ai-agent --gpu 1 --memory 8192 --duration 3600
# Allocate CPU resources
./aitbc-cli resource allocate --agent-id data-processor --cpu 4 --memory 4096 --duration 1800
# Check resource status
./aitbc-cli resource status
# List allocated resources
./aitbc-cli resource list
```
### Resource Types
- **gpu**: GPU units for AI inference
- **cpu**: CPU cores for processing
- **memory**: RAM in megabytes
- **duration**: Reservation time in seconds
## Marketplace Operations
### Creating Services
```bash
# Create AI service
./aitbc-cli marketplace --action create --name "AI Image Generation" --type ai-inference --price 50 --wallet genesis-ops --description "Generate high-quality images"
# Create training service
./aitbc-cli marketplace --action create --name "Model Training" --type ai-training --price 200 --wallet genesis-ops --description "Train custom models"
# Create data processing service
./aitbc-cli marketplace --action create --name "Data Analysis" --type ai-processing --price 75 --wallet genesis-ops --description "Analyze datasets"
```
### Marketplace Interaction
```bash
# List available services
./aitbc-cli marketplace --action list
# Search for services
./aitbc-cli marketplace --action search --query "AI"
# Bid on service
./aitbc-cli marketplace --action bid --service-id service_123 --amount 60 --wallet genesis-ops
# Execute purchased service
./aitbc-cli marketplace --action execute --service-id service_123 --job-data "prompt:Generate landscape image"
# Check my listings
./aitbc-cli marketplace --action my-listings --wallet genesis-ops
```
## Mining Operations
### Mining Control
```bash
# Start mining
./aitbc-cli mine-start --wallet genesis-ops
# Stop mining
./aitbc-cli mine-stop
# Check mining status
./aitbc-cli mine-status
```
## Smart Contract Messaging
### Topic Management
```bash
# Create coordination topic
curl -X POST http://localhost:8006/rpc/messaging/topics/create \
-H "Content-Type: application/json" \
-d '{"agent_id": "agent", "agent_address": "address", "title": "Topic", "description": "Description", "tags": ["coordination"]}'
# List topics
curl -s http://localhost:8006/rpc/messaging/topics
# Get topic messages
curl -s http://localhost:8006/rpc/messaging/topics/topic_id/messages
```
### Message Operations
```bash
# Post message to topic
curl -X POST http://localhost:8006/rpc/messaging/messages/post \
-H "Content-Type: application/json" \
-d '{"agent_id": "agent", "agent_address": "address", "topic_id": "topic_id", "content": "Message content"}'
# Vote on message
curl -X POST http://localhost:8006/rpc/messaging/messages/message_id/vote \
-H "Content-Type: application/json" \
-d '{"agent_id": "agent", "agent_address": "address", "vote_type": "upvote"}'
# Check agent reputation
curl -s http://localhost:8006/rpc/messaging/agents/agent_id/reputation
```
## Cross-Node Coordination
### Cross-Node Transactions
```bash
# Send from genesis to follower
./aitbc-cli send --from genesis-ops --to ait141b3bae6eea3a74273ef3961861ee58e12b6d855 --amount 100 --password 123
# Send from follower to genesis
ssh aitbc1 'cd /opt/aitbc && source venv/bin/activate && ./aitbc-cli send --from follower-ops --to ait158ec7a0713f30ccfb1aac6bfbab71f36271c5871 --amount 50 --password 123'
```
### Cross-Node AI Operations
```bash
# Submit AI job to specific node
./aitbc-cli ai-submit --wallet genesis-ops --type inference --prompt "Generate image" --target-node "aitbc1" --payment 100
# Distribute training across nodes
./aitbc-cli ai-submit --wallet genesis-ops --type training --model "distributed-model" --nodes "aitbc,aitbc1" --payment 500
```
## Configuration Management
### Environment Configuration
```bash
# Check current configuration
cat /etc/aitbc/.env
# Key configuration parameters
chain_id=ait-mainnet
proposer_id=ait158ec7a0713f30ccfb1aac6bfbab71f36271c5871
enable_block_production=true
mempool_backend=database
gossip_backend=redis
gossip_broadcast_url=redis://10.1.223.40:6379
```
### Service Management
```bash
# Restart services
sudo systemctl restart aitbc-blockchain-node.service aitbc-blockchain-rpc.service
# Check service logs
sudo journalctl -u aitbc-blockchain-node.service -f
sudo journalctl -u aitbc-blockchain-rpc.service -f
# Cross-node service restart
ssh aitbc1 'sudo systemctl restart aitbc-blockchain-node.service aitbc-blockchain-rpc.service'
```
## Data Management
### Database Operations
```bash
# Check database files
ls -la /var/lib/aitbc/data/ait-mainnet/
# Backup database
sudo cp /var/lib/aitbc/data/ait-mainnet/chain.db /var/lib/aitbc/data/ait-mainnet/chain.db.backup.$(date +%s)
# Reset blockchain (genesis creation)
sudo systemctl stop aitbc-blockchain-node.service aitbc-blockchain-rpc.service
sudo mv /var/lib/aitbc/data/ait-mainnet/chain.db /var/lib/aitbc/data/ait-mainnet/chain.db.backup.$(date +%s)
sudo systemctl start aitbc-blockchain-node.service aitbc-blockchain-rpc.service
```
### Genesis Configuration
```bash
# Create genesis.json with allocations
cat << 'EOF' | sudo tee /var/lib/aitbc/data/ait-mainnet/genesis.json
{
"allocations": [
{
"address": "ait158ec7a0713f30ccfb1aac6bfbab71f36271c5871",
"balance": 1000000,
"nonce": 0
}
],
"authorities": [
{
"address": "ait158ec7a0713f30ccfb1aac6bfbab71f36271c5871",
"weight": 1
}
]
}
EOF
```
## Monitoring and Analytics
### Health Monitoring
```bash
# Comprehensive health check
python3 /tmp/aitbc1_heartbeat.py
# Manual health checks
curl -s http://localhost:8006/health | jq .
ssh aitbc1 'curl -s http://localhost:8006/health | jq .'
# Check sync status
./aitbc-cli chain
./aitbc-cli network
```
### Performance Metrics
```bash
# Check block production rate
watch -n 10 './aitbc-cli chain | grep "Height:"'
# Monitor transaction throughput
./aitbc-cli analytics
# Check resource utilization
./aitbc-cli resource status
```
## Troubleshooting
### Common Issues and Solutions
#### Transactions Not Mining
```bash
# Check proposer status
curl -s http://localhost:8006/health | jq .proposer_id
# Check mempool status
curl -s http://localhost:8006/rpc/mempool
# Verify mempool configuration
grep mempool_backend /etc/aitbc/.env
```
#### RPC Connection Issues
```bash
# Check RPC service
systemctl status aitbc-blockchain-rpc.service
# Test RPC endpoint
curl -s http://localhost:8006/health
# Check port availability
netstat -tlnp | grep 8006
```
#### Wallet Issues
```bash
# Check wallet exists
./aitbc-cli list | grep wallet-name
# Test wallet password
./aitbc-cli balance --name wallet-name --password 123
# Create new wallet if needed
./aitbc-cli create --name new-wallet --password 123
```
#### Sync Issues
```bash
# Check both nodes' heights
curl -s http://localhost:8006/rpc/head | jq .height
ssh aitbc1 'curl -s http://localhost:8006/rpc/head | jq .height'
# Check gossip connectivity
grep gossip_broadcast_url /etc/aitbc/.env
# Restart services if needed
sudo systemctl restart aitbc-blockchain-node.service
```
## Standardized Paths
| Resource | Path |
|---|---|
| Blockchain data | `/var/lib/aitbc/data/ait-mainnet/` |
| Keystore | `/var/lib/aitbc/keystore/` |
| Environment config | `/etc/aitbc/.env` |
| CLI tool | `/opt/aitbc/aitbc-cli` |
| Scripts | `/opt/aitbc/scripts/` |
| Logs | `/var/log/aitbc/` |
| Services | `/etc/systemd/system/aitbc-*.service` |
## Best Practices
### Security
- Use strong wallet passwords
- Keep keystore files secure
- Monitor transaction activity
- Use proper authentication for RPC endpoints
### Performance
- Monitor resource utilization
- Optimize transaction batching
- Use appropriate thinking levels for AI operations
- Regular database maintenance
### Operations
- Regular health checks
- Backup critical data
- Monitor cross-node synchronization
- Keep documentation updated
### Development
- Test on development network first
- Use proper version control
- Document all changes
- Implement proper error handling
This AITBC Blockchain Operations skill provides comprehensive coverage of all blockchain operations, from basic wallet management to advanced AI operations and cross-node coordination.

View File

@@ -0,0 +1,170 @@
---
description: Legacy OpenClaw AITBC integration - see split skills for focused operations
title: OpenClaw AITBC Integration (Legacy)
version: 6.0 - DEPRECATED
---
# OpenClaw AITBC Integration (Legacy - See Split Skills)
⚠️ **This skill has been split into focused skills for better organization:**
## 📚 New Split Skills
### 1. OpenClaw Agent Management Skill
**File**: `openclaw-management.md`
**Focus**: Pure OpenClaw agent operations, communication, and coordination
- Agent creation and management
- Session-based workflows
- Cross-agent communication
- Performance optimization
- Error handling and debugging
**Use for**: Agent orchestration, workflow coordination, multi-agent systems
### 2. AITBC Blockchain Operations Skill
**File**: `aitbc-blockchain.md`
**Focus**: Pure AITBC blockchain operations and integration
- Wallet management and transactions
- AI operations and marketplace
- Node coordination and monitoring
- Smart contract messaging
- Cross-node operations
**Use for**: Blockchain operations, AI jobs, marketplace participation, node management
## Migration Guide
### From Legacy to Split Skills
**Before (Legacy)**:
```bash
# Mixed OpenClaw + AITBC operations
openclaw agent --agent main --message "Check blockchain and process data" --thinking high
cd /opt/aitbc && source venv/bin/activate && ./aitbc-cli chain
```
**After (Split Skills)**:
**OpenClaw Agent Management**:
```bash
# Pure agent coordination
openclaw agent --agent coordinator --message "Coordinate blockchain monitoring workflow" --thinking high
# Agent workflow orchestration
SESSION_ID="blockchain-monitor-$(date +%s)"
openclaw agent --agent monitor --session-id $SESSION_ID --message "Monitor blockchain health" --thinking medium
```
**AITBC Blockchain Operations**:
```bash
# Pure blockchain operations
cd /opt/aitbc && source venv/bin/activate
./aitbc-cli chain
./aitbc-cli ai-submit --wallet genesis-ops --type inference --prompt "Generate image" --payment 100
```
## Why the Split?
### Benefits of Focused Skills
1. **Clearer Separation of Concerns**
- OpenClaw: Agent coordination and workflow management
- AITBC: Blockchain operations and data management
2. **Better Documentation Organization**
- Each skill focuses on its domain expertise
- Reduced cognitive load when learning
- Easier maintenance and updates
3. **Improved Reusability**
- OpenClaw skills can be used with any system
- AITBC skills can be used with any agent framework
- Modular combination possible
4. **Enhanced Searchability**
- Find relevant commands faster
- Domain-specific troubleshooting
- Focused best practices
### When to Use Each Skill
**Use OpenClaw Agent Management Skill for**:
- Multi-agent workflow coordination
- Agent communication patterns
- Session management and context
- Agent performance optimization
- Error handling and debugging
**Use AITBC Blockchain Operations Skill for**:
- Wallet and transaction management
- AI job submission and monitoring
- Marketplace operations
- Node health and synchronization
- Smart contract messaging
**Combine Both Skills for**:
- Complete OpenClaw + AITBC integration
- Agent-driven blockchain operations
- Automated blockchain workflows
- Cross-node agent coordination
## Legacy Content (Deprecated)
The following content from the original combined skill is now deprecated and moved to the appropriate split skills:
- ~~Agent command syntax~~ → **OpenClaw Agent Management**
- ~~AITBC CLI commands~~ → **AITBC Blockchain Operations**
- ~~AI operations~~ → **AITBC Blockchain Operations**
- ~~Blockchain coordination~~ → **AITBC Blockchain Operations**
- ~~Agent workflows~~ → **OpenClaw Agent Management**
## Migration Checklist
### ✅ Completed
- [x] Created OpenClaw Agent Management skill
- [x] Created AITBC Blockchain Operations skill
- [x] Updated all command references
- [x] Added migration guide
### 🔄 In Progress
- [ ] Update workflow scripts to use split skills
- [ ] Update documentation references
- [ ] Test split skills independently
### 📋 Next Steps
- [ ] Remove legacy content after validation
- [ ] Update integration examples
- [ ] Create combined usage examples
## Quick Reference
### OpenClaw Agent Management
```bash
# Agent coordination
openclaw agent --agent coordinator --message "Coordinate workflow" --thinking high
# Session-based workflow
SESSION_ID="task-$(date +%s)"
openclaw agent --agent worker --session-id $SESSION_ID --message "Execute task" --thinking medium
```
### AITBC Blockchain Operations
```bash
# Blockchain status
cd /opt/aitbc && source venv/bin/activate
./aitbc-cli chain
# AI operations
./aitbc-cli ai-submit --wallet wallet --type inference --prompt "Generate image" --payment 100
```
---
**Recommendation**: Use the new split skills for all new development. This legacy skill is maintained for backward compatibility but will be deprecated in future versions.
## Quick Links to New Skills
- **OpenClaw Agent Management**: [openclaw-management.md](openclaw-management.md)
- **AITBC Blockchain Operations**: [aitbc-blockchain.md](aitbc-blockchain.md)

View File

@@ -0,0 +1,163 @@
# OpenClaw AITBC Agent Templates
## Blockchain Monitor Agent
```json
{
"name": "blockchain-monitor",
"type": "monitoring",
"description": "Monitors AITBC blockchain across multiple nodes",
"version": "1.0.0",
"config": {
"nodes": ["aitbc", "aitbc1"],
"check_interval": 30,
"metrics": ["height", "transactions", "balance", "sync_status"],
"alerts": {
"height_diff": 5,
"tx_failures": 3,
"sync_timeout": 60
}
},
"blockchain_integration": {
"rpc_endpoints": {
"aitbc": "http://localhost:8006",
"aitbc1": "http://aitbc1:8006"
},
"wallet": "aitbc-user",
"auto_transaction": true
},
"openclaw_config": {
"model": "ollama/nemotron-3-super:cloud",
"workspace": "blockchain-monitor",
"routing": {
"channels": ["blockchain", "monitoring"],
"auto_respond": true
}
}
}
```
## Marketplace Trader Agent
```json
{
"name": "marketplace-trader",
"type": "trading",
"description": "Automated agent marketplace trading bot",
"version": "1.0.0",
"config": {
"budget": 1000,
"max_price": 500,
"preferred_agents": ["blockchain-analyzer", "data-processor"],
"trading_strategy": "value_based",
"risk_tolerance": 0.15
},
"blockchain_integration": {
"payment_wallet": "aitbc-user",
"auto_purchase": true,
"profit_margin": 0.15,
"max_positions": 5
},
"openclaw_config": {
"model": "ollama/nemotron-3-super:cloud",
"workspace": "marketplace-trader",
"routing": {
"channels": ["marketplace", "trading"],
"auto_execute": true
}
}
}
```
## Blockchain Analyzer Agent
```json
{
"name": "blockchain-analyzer",
"type": "analysis",
"description": "Advanced blockchain data analysis and insights",
"version": "1.0.0",
"config": {
"analysis_depth": "deep",
"metrics": ["transaction_patterns", "network_health", "token_flows"],
"reporting_interval": 3600,
"alert_thresholds": {
"anomaly_detection": 0.95,
"performance_degradation": 0.8
}
},
"blockchain_integration": {
"rpc_endpoints": ["http://localhost:8006", "http://aitbc1:8006"],
"data_retention": 86400,
"batch_processing": true
},
"openclaw_config": {
"model": "ollama/nemotron-3-super:cloud",
"workspace": "blockchain-analyzer",
"routing": {
"channels": ["analysis", "reporting"],
"auto_generate_reports": true
}
}
}
```
## Multi-Node Coordinator Agent
```json
{
"name": "multi-node-coordinator",
"type": "coordination",
"description": "Coordinates operations across multiple AITBC nodes",
"version": "1.0.0",
"config": {
"nodes": ["aitbc", "aitbc1"],
"coordination_strategy": "leader_follower",
"sync_interval": 10,
"failover_enabled": true
},
"blockchain_integration": {
"primary_node": "aitbc",
"backup_nodes": ["aitbc1"],
"auto_failover": true,
"health_checks": ["rpc", "sync", "transactions"]
},
"openclaw_config": {
"model": "ollama/nemotron-3-super:cloud",
"workspace": "multi-node-coordinator",
"routing": {
"channels": ["coordination", "health"],
"auto_coordination": true
}
}
}
```
## Blockchain Messaging Agent
```json
{
"name": "blockchain-messaging-agent",
"type": "communication",
"description": "Uses AITBC AgentMessagingContract for cross-node forum-style communication",
"version": "1.0.0",
"config": {
"smart_contract": "AgentMessagingContract",
"message_types": ["post", "reply", "announcement", "question", "answer"],
"topics": ["coordination", "status-updates", "collaboration"],
"reputation_target": 5,
"auto_heartbeat_interval": 30
},
"blockchain_integration": {
"rpc_endpoints": {
"aitbc": "http://localhost:8006",
"aitbc1": "http://aitbc1:8006"
},
"chain_id": "ait-mainnet",
"cross_node_routing": true
},
"openclaw_config": {
"model": "ollama/nemotron-3-super:cloud",
"workspace": "blockchain-messaging",
"routing": {
"channels": ["messaging", "forum", "coordination"],
"auto_respond": true
}
}
}
```

View File

@@ -0,0 +1,247 @@
# AITBC AI Operations Reference
## AI Job Types and Parameters
### Inference Jobs
```bash
# Basic image generation
./aitbc-cli ai-submit --wallet genesis-ops --type inference --prompt "Generate image of futuristic city" --payment 100
# Text analysis
./aitbc-cli ai-submit --wallet genesis-ops --type inference --prompt "Analyze sentiment of this text" --payment 50
# Code generation
./aitbc-cli ai-submit --wallet genesis-ops --type inference --prompt "Generate Python function for data processing" --payment 75
```
### Training Jobs
```bash
# Model training
./aitbc-cli ai-submit --wallet genesis-ops --type training --model "custom-model" --dataset "training_data.json" --payment 500
# Fine-tuning
./aitbc-cli ai-submit --wallet genesis-ops --type training --model "gpt-3.5-turbo" --dataset "fine_tune_data.json" --payment 300
```
### Multimodal Jobs
```bash
# Image analysis
./aitbc-cli ai-submit --wallet genesis-ops --type multimodal --prompt "Analyze this image" --image-path "/path/to/image.jpg" --payment 200
# Audio processing
./aitbc-cli ai-submit --wallet genesis-ops --type multimodal --prompt "Transcribe audio" --audio-path "/path/to/audio.wav" --payment 150
```
## Resource Allocation
### GPU Resources
```bash
# Single GPU allocation
./aitbc-cli resource allocate --agent-id ai-inference-worker --gpu 1 --memory 8192 --duration 3600
# Multiple GPU allocation
./aitbc-cli resource allocate --agent-id ai-training-agent --gpu 2 --memory 16384 --duration 7200
# GPU with specific model
./aitbc-cli resource allocate --agent-id ai-agent --gpu 1 --memory 8192 --duration 3600 --model "stable-diffusion"
```
### CPU Resources
```bash
# CPU allocation for preprocessing
./aitbc-cli resource allocate --agent-id data-processor --cpu 4 --memory 4096 --duration 1800
# High-performance CPU allocation
./aitbc-cli resource allocate --agent-id ai-trainer --cpu 8 --memory 16384 --duration 7200
```
## Marketplace Operations
### Creating AI Services
```bash
# Image generation service
./aitbc-cli marketplace --action create --name "AI Image Generation" --type ai-inference --price 50 --wallet genesis-ops --description "Generate high-quality images from text prompts"
# Model training service
./aitbc-cli marketplace --action create --name "Custom Model Training" --type ai-training --price 200 --wallet genesis-ops --description "Train custom models on your data"
# Data analysis service
./aitbc-cli marketplace --action create --name "AI Data Analysis" --type ai-processing --price 75 --wallet genesis-ops --description "Analyze and process datasets with AI"
```
### Marketplace Interaction
```bash
# List available services
./aitbc-cli marketplace --action list
# Search for specific services
./aitbc-cli marketplace --action search --query "image generation"
# Bid on service
./aitbc-cli marketplace --action bid --service-id "service_123" --amount 60 --wallet genesis-ops
# Execute purchased service
./aitbc-cli marketplace --action execute --service-id "service_123" --job-data "prompt:Generate landscape image"
```
## Agent AI Workflows
### Creating AI Agents
```bash
# Inference agent
./aitbc-cli agent create --name "ai-inference-worker" --description "Specialized agent for AI inference tasks" --verification full
# Training agent
./aitbc-cli agent create --name "ai-training-agent" --description "Specialized agent for AI model training" --verification full
# Coordination agent
./aitbc-cli agent create --name "ai-coordinator" --description "Coordinates AI jobs across nodes" --verification full
```
### Executing AI Agents
```bash
# Execute inference agent
./aitbc-cli agent execute --name "ai-inference-worker" --wallet genesis-ops --priority high
# Execute training agent with parameters
./aitbc-cli agent execute --name "ai-training-agent" --wallet genesis-ops --priority high --parameters "model:gpt-3.5-turbo,dataset:training.json"
# Execute coordinator agent
./aitbc-cli agent execute --name "ai-coordinator" --wallet genesis-ops --priority high
```
## Cross-Node AI Coordination
### Multi-Node Job Submission
```bash
# Submit to specific node
./aitbc-cli ai-submit --wallet genesis-ops --type inference --prompt "Generate image" --target-node "aitbc1" --payment 100
# Distribute training across nodes
./aitbc-cli ai-submit --wallet genesis-ops --type training --model "distributed-model" --nodes "aitbc,aitbc1" --payment 500
```
### Cross-Node Resource Management
```bash
# Allocate resources on follower node
ssh aitbc1 'cd /opt/aitbc && source venv/bin/activate && ./aitbc-cli resource allocate --agent-id ai-agent --gpu 1 --memory 8192 --duration 3600'
# Monitor multi-node AI status
./aitbc-cli ai-status --multi-node
```
## AI Economics and Pricing
### Job Cost Estimation
```bash
# Estimate inference job cost
./aitbc-cli ai-estimate --type inference --prompt-length 100 --resolution 512
# Estimate training job cost
./aitbc-cli ai-estimate --type training --model-size "1B" --dataset-size "1GB" --epochs 10
```
### Payment and Earnings
```bash
# Pay for AI job
./aitbc-cli ai-pay --job-id "job_123" --wallet genesis-ops --amount 100
# Check AI earnings
./aitbc-cli ai-earnings --wallet genesis-ops --period "7d"
```
## AI Monitoring and Analytics
### Job Monitoring
```bash
# Monitor specific job
./aitbc-cli ai-status --job-id "job_123"
# Monitor all jobs
./aitbc-cli ai-status --all
# Job history
./aitbc-cli ai-history --wallet genesis-ops --limit 10
```
### Performance Metrics
```bash
# AI performance metrics
./aitbc-cli ai-metrics --agent-id "ai-inference-worker" --period "1h"
# Resource utilization
./aitbc-cli resource utilization --type gpu --period "1h"
# Job throughput
./aitbc-cli ai-throughput --nodes "aitbc,aitbc1" --period "24h"
```
## AI Security and Compliance
### Secure AI Operations
```bash
# Secure job submission
./aitbc-cli ai-submit --wallet genesis-ops --type inference --prompt "Generate image" --payment 100 --encrypt
# Verify job integrity
./aitbc-cli ai-verify --job-id "job_123"
# AI job audit
./aitbc-cli ai-audit --job-id "job_123"
```
### Compliance Features
- **Data Privacy**: Encrypt sensitive AI data
- **Job Verification**: Cryptographic job verification
- **Audit Trail**: Complete job execution history
- **Access Control**: Role-based AI service access
## Troubleshooting AI Operations
### Common Issues
1. **Job Not Starting**: Check resource allocation and wallet balance
2. **GPU Allocation Failed**: Verify GPU availability and driver installation
3. **High Latency**: Check network connectivity and resource utilization
4. **Payment Failed**: Verify wallet has sufficient AIT balance
### Debug Commands
```bash
# Check AI service status
./aitbc-cli ai-service status
# Debug resource allocation
./aitbc-cli resource debug --agent-id "ai-agent"
# Check wallet balance
./aitbc-cli balance --name genesis-ops
# Verify network connectivity
ping aitbc1
curl -s http://localhost:8006/health
```
## Best Practices
### Resource Management
- Allocate appropriate resources for job type
- Monitor resource utilization regularly
- Release resources when jobs complete
- Use priority settings for important jobs
### Cost Optimization
- Estimate costs before submitting jobs
- Use appropriate job parameters
- Monitor AI spending regularly
- Optimize resource allocation
### Security
- Use encryption for sensitive data
- Verify job integrity regularly
- Monitor audit logs
- Implement access controls
### Performance
- Use appropriate job types
- Optimize resource allocation
- Monitor performance metrics
- Use multi-node coordination for large jobs

View File

@@ -0,0 +1,342 @@
#!/bin/bash
# OpenClaw AITBC Integration Setup & Health Check
# Field-tested setup and management for OpenClaw + AITBC integration
# Version: 5.0 — Updated 2026-03-30 with AI operations and advanced coordination
set -e
AITBC_DIR="/opt/aitbc"
AITBC_CLI="$AITBC_DIR/aitbc-cli"
DATA_DIR="/var/lib/aitbc/data"
ENV_FILE="/etc/aitbc/.env"
GENESIS_RPC="http://localhost:8006"
FOLLOWER_RPC="http://10.1.223.40:8006"
WALLET_PASSWORD="123"
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m'
log_info() { echo -e "${BLUE}[INFO]${NC} $1"; }
log_success() { echo -e "${GREEN}[OK]${NC} $1"; }
log_warning() { echo -e "${YELLOW}[WARN]${NC} $1"; }
log_error() { echo -e "${RED}[ERROR]${NC} $1"; }
# ── Prerequisites ──────────────────────────────────────────────
check_prerequisites() {
log_info "Checking prerequisites..."
local fail=0
command -v openclaw &>/dev/null && log_success "OpenClaw CLI found" || { log_error "OpenClaw not found"; fail=1; }
[ -x "$AITBC_CLI" ] && log_success "AITBC CLI found" || { log_error "AITBC CLI not found at $AITBC_CLI"; fail=1; }
if curl -sf http://localhost:8006/health &>/dev/null; then
log_success "Genesis RPC (localhost:8006) healthy"
else
log_warning "Genesis RPC not responding — try: sudo systemctl start aitbc-blockchain-rpc.service"
fi
if ssh aitbc1 'curl -sf http://localhost:8006/health' &>/dev/null; then
log_success "Follower RPC (aitbc1:8006) healthy"
else
log_warning "Follower RPC not responding — check aitbc1 services"
fi
[ -d "$DATA_DIR/ait-mainnet" ] && log_success "Data dir $DATA_DIR/ait-mainnet exists" || log_warning "Data dir missing"
[ -f "$ENV_FILE" ] && log_success "Env file $ENV_FILE exists" || log_warning "Env file missing"
[ $fail -eq 0 ] && log_success "Prerequisites satisfied" || { log_error "Prerequisites check failed"; exit 1; }
}
# ── OpenClaw Agent Test ────────────────────────────────────────
test_agent_communication() {
log_info "Testing OpenClaw agent communication..."
# IMPORTANT: use --message (long form), not -m
local SESSION_ID="health-$(date +%s)"
local GENESIS_HEIGHT
GENESIS_HEIGHT=$(curl -sf http://localhost:8006/rpc/head | jq -r '.height // "unknown"')
openclaw agent --agent main --session-id "$SESSION_ID" \
--message "AITBC integration health check. Genesis height: $GENESIS_HEIGHT. Report status." \
--thinking low \
&& log_success "Agent communication working" \
|| log_warning "Agent communication failed (non-fatal)"
}
# ── Blockchain Status ──────────────────────────────────────────
show_status() {
log_info "=== OpenClaw AITBC Integration Status ==="
echo ""
echo "OpenClaw:"
openclaw --version 2>/dev/null || echo " (not available)"
echo ""
echo "Genesis Node (aitbc):"
curl -sf http://localhost:8006/rpc/head | jq '{height, hash: .hash[0:18], timestamp}' 2>/dev/null \
|| echo " RPC not responding"
echo ""
echo "Follower Node (aitbc1):"
ssh aitbc1 'curl -sf http://localhost:8006/rpc/head' 2>/dev/null | jq '{height, hash: .hash[0:18], timestamp}' \
|| echo " RPC not responding"
echo ""
echo "Wallets (aitbc):"
cd "$AITBC_DIR" && source venv/bin/activate && ./aitbc-cli list 2>/dev/null || echo " CLI error"
echo ""
echo "Wallets (aitbc1):"
ssh aitbc1 "cd $AITBC_DIR && source venv/bin/activate && ./aitbc-cli list" 2>/dev/null || echo " CLI error"
echo ""
echo "Services (aitbc):"
systemctl is-active aitbc-blockchain-node.service 2>/dev/null | sed 's/^/ node: /'
systemctl is-active aitbc-blockchain-rpc.service 2>/dev/null | sed 's/^/ rpc: /'
echo ""
echo "Services (aitbc1):"
ssh aitbc1 'systemctl is-active aitbc-blockchain-node.service' 2>/dev/null | sed 's/^/ node: /'
ssh aitbc1 'systemctl is-active aitbc-blockchain-rpc.service' 2>/dev/null | sed 's/^/ rpc: /'
echo ""
echo "Data Directory:"
ls -lh "$DATA_DIR/ait-mainnet/" 2>/dev/null | head -5 || echo " not found"
}
# ── Run Integration Test ───────────────────────────────────────
run_integration_test() {
log_info "Running integration test..."
local pass=0 total=0
# Test 1: RPC health
total=$((total+1))
curl -sf http://localhost:8006/health &>/dev/null && { log_success "RPC health OK"; pass=$((pass+1)); } || log_error "RPC health FAIL"
# Test 2: CLI works
total=$((total+1))
cd "$AITBC_DIR" && source venv/bin/activate && ./aitbc-cli list &>/dev/null && { log_success "CLI OK"; pass=$((pass+1)); } || log_error "CLI FAIL"
# Test 3: Cross-node SSH
total=$((total+1))
ssh aitbc1 'echo ok' &>/dev/null && { log_success "SSH to aitbc1 OK"; pass=$((pass+1)); } || log_error "SSH FAIL"
# Test 4: Agent communication
total=$((total+1))
openclaw agent --agent main --message "ping" --thinking minimal &>/dev/null && { log_success "Agent OK"; pass=$((pass+1)); } || log_warning "Agent FAIL (non-fatal)"
echo ""
log_info "Results: $pass/$total passed"
}
# ── Main ───────────────────────────────────────────────────────
main() {
case "${1:-status}" in
setup)
check_prerequisites
test_agent_communication
show_status
log_success "Setup verification complete"
;;
test)
run_integration_test
;;
status)
show_status
;;
ai-setup)
setup_ai_operations
;;
ai-test)
test_ai_operations
;;
comprehensive)
show_comprehensive_status
;;
help)
echo "Usage: $0 {setup|test|status|ai-setup|ai-test|comprehensive|help}"
echo " setup — Verify prerequisites and test agent communication"
echo " test — Run integration tests"
echo " status — Show current multi-node status"
echo " ai-setup — Setup AI operations and agents"
echo " ai-test — Test AI operations functionality"
echo " comprehensive — Show comprehensive status including AI operations"
echo " help — Show this help"
;;
*)
log_error "Unknown command: $1"
main help
exit 1
;;
esac
}
# ── AI Operations Setup ───────────────────────────────────────────
setup_ai_operations() {
log_info "Setting up AI operations..."
cd "$AITBC_DIR"
source venv/bin/activate
# Create AI inference agent
log_info "Creating AI inference agent..."
if ./aitbc-cli agent create --name "ai-inference-worker" \
--description "Specialized agent for AI inference tasks" \
--verification full; then
log_success "AI inference agent created"
else
log_warning "AI inference agent creation failed"
fi
# Allocate GPU resources
log_info "Allocating GPU resources..."
if ./aitbc-cli resource allocate --agent-id "ai-inference-worker" \
--gpu 1 --memory 8192 --duration 3600; then
log_success "GPU resources allocated"
else
log_warning "GPU resource allocation failed"
fi
# Create AI service marketplace listing
log_info "Creating AI marketplace listing..."
if ./aitbc-cli marketplace --action create \
--name "AI Image Generation" \
--type ai-inference \
--price 50 \
--wallet genesis-ops \
--description "Generate high-quality images from text prompts"; then
log_success "AI marketplace listing created"
else
log_warning "AI marketplace listing creation failed"
fi
# Setup follower AI operations
log_info "Setting up follower AI operations..."
if ssh aitbc1 "cd $AITBC_DIR && source venv/bin/activate && \
./aitbc-cli agent create --name 'ai-training-agent' \
--description 'Specialized agent for AI model training' \
--verification full && \
./aitbc-cli resource allocate --agent-id 'ai-training-agent' \
--cpu 4 --memory 16384 --duration 7200"; then
log_success "Follower AI operations setup completed"
else
log_warning "Follower AI operations setup failed"
fi
log_success "AI operations setup completed"
}
# ── AI Operations Test ──────────────────────────────────────────────
test_ai_operations() {
log_info "Testing AI operations..."
cd "$AITBC_DIR"
source venv/bin/activate
# Test AI job submission
log_info "Testing AI job submission..."
if ./aitbc-cli ai-submit --wallet genesis-ops \
--type inference \
--prompt "Test image generation" \
--payment 10; then
log_success "AI job submission test passed"
else
log_warning "AI job submission test failed"
fi
# Test smart contract messaging
log_info "Testing smart contract messaging..."
TOPIC_ID=$(curl -s -X POST "$GENESIS_RPC/rpc/messaging/topics/create" \
-H "Content-Type: application/json" \
-d '{"agent_id": "test-agent", "agent_address": "ait158ec7a0713f30ccfb1aac6bfbab71f36271c5871", "title": "Test Topic", "description": "Test coordination"}' | \
jq -r '.topic_id // "error"')
if [ "$TOPIC_ID" != "error" ] && [ -n "$TOPIC_ID" ]; then
log_success "Smart contract messaging test passed - Topic: $TOPIC_ID"
else
log_warning "Smart contract messaging test failed"
fi
log_success "AI operations testing completed"
}
# ── Comprehensive Status ───────────────────────────────────────────
show_comprehensive_status() {
log_info "Comprehensive AITBC + OpenClaw + AI Operations Status"
echo ""
# Basic status
show_multi_node_status
echo ""
# AI operations status
log_info "AI Operations Status:"
cd "$AITBC_DIR"
source venv/bin/activate
# Check AI agents
AI_AGENTS=$(./aitbc-cli agent list 2>/dev/null | grep -c "agent_" || echo "0")
echo " AI Agents Created: $AI_AGENTS"
# Check resource allocation
if ./aitbc-cli resource status &>/dev/null; then
echo " Resource Management: Operational"
else
echo " Resource Management: Not operational"
fi
# Check marketplace
if ./aitbc-cli marketplace --action list &>/dev/null; then
echo " AI Marketplace: Operational"
else
echo " AI Marketplace: Not operational"
fi
# Check smart contract messaging
if curl -s "$GENESIS_RPC/rpc/messaging/topics" &>/dev/null; then
TOPICS_COUNT=$(curl -s "$GENESIS_RPC/rpc/messaging/topics" | jq '.total_topics // 0' 2>/dev/null || echo "0")
echo " Smart Contract Messaging: Operational ($TOPICS_COUNT topics)"
else
echo " Smart Contract Messaging: Not operational"
fi
echo ""
log_info "Health Check:"
if [ -f /tmp/aitbc1_heartbeat.py ]; then
python3 /tmp/aitbc1_heartbeat.py
else
log_warning "Heartbeat script not found"
fi
}
ai-setup)
setup_ai_operations
;;
ai-test)
test_ai_operations
;;
comprehensive)
show_comprehensive_status
;;
help)
echo "Usage: $0 {setup|test|status|ai-setup|ai-test|comprehensive|help}"
echo " setup — Verify prerequisites and test agent communication"
echo " test — Run integration tests"
echo " status — Show current multi-node status"
echo " ai-setup — Setup AI operations and agents"
echo " ai-test — Test AI operations functionality"
echo " comprehensive — Show comprehensive status including AI operations"
echo " help — Show this help"
;;
*)
log_error "Unknown command: $1"
main help
exit 1
;;
esac
}
main "$@"

View File

@@ -0,0 +1,321 @@
# OpenClaw AITBC Workflow Templates
## Multi-Node Health Check Workflow
```yaml
name: multi-node-health-check
description: Comprehensive health check across all AITBC nodes
version: 1.0.0
schedule: "*/5 * * * *" # Every 5 minutes
steps:
- name: check-node-sync
agent: blockchain-monitor
action: verify_block_height_consistency
timeout: 30
retry_count: 3
parameters:
max_height_diff: 5
timeout_seconds: 10
- name: analyze-transactions
agent: blockchain-analyzer
action: transaction_pattern_analysis
timeout: 60
parameters:
time_window: 300
anomaly_threshold: 0.95
- name: check-wallet-balances
agent: blockchain-monitor
action: balance_verification
timeout: 30
parameters:
critical_wallets: ["genesis", "treasury"]
min_balance_threshold: 1000000
- name: verify-connectivity
agent: multi-node-coordinator
action: node_connectivity_check
timeout: 45
parameters:
nodes: ["aitbc", "aitbc1"]
test_endpoints: ["/rpc/head", "/rpc/accounts", "/rpc/mempool"]
- name: generate-report
agent: blockchain-analyzer
action: create_health_report
timeout: 120
parameters:
include_recommendations: true
format: "json"
output_location: "/var/log/aitbc/health-reports/"
- name: send-alerts
agent: blockchain-monitor
action: send_health_alerts
timeout: 30
parameters:
channels: ["email", "slack"]
severity_threshold: "warning"
on_failure:
- name: emergency-alert
agent: blockchain-monitor
action: send_emergency_alert
parameters:
message: "Multi-node health check failed"
severity: "critical"
success_criteria:
- all_steps_completed: true
- node_sync_healthy: true
- no_critical_alerts: true
```
## Agent Marketplace Automation Workflow
```yaml
name: marketplace-automation
description: Automated agent marketplace operations and trading
version: 1.0.0
schedule: "0 */2 * * *" # Every 2 hours
steps:
- name: scan-marketplace
agent: marketplace-trader
action: find_valuable_agents
timeout: 300
parameters:
max_price: 500
min_rating: 4.0
categories: ["blockchain", "analysis", "monitoring"]
- name: evaluate-agents
agent: blockchain-analyzer
action: assess_agent_value
timeout: 180
parameters:
evaluation_criteria: ["performance", "cost_efficiency", "reliability"]
weight_factors: {"performance": 0.4, "cost_efficiency": 0.3, "reliability": 0.3}
- name: check-budget
agent: marketplace-trader
action: verify_budget_availability
timeout: 30
parameters:
min_budget: 100
max_single_purchase: 250
- name: execute-purchase
agent: marketplace-trader
action: purchase_best_agents
timeout: 120
parameters:
max_purchases: 2
auto_confirm: true
payment_wallet: "aitbc-user"
- name: deploy-agents
agent: deployment-manager
action: deploy_purchased_agents
timeout: 300
parameters:
environment: "production"
auto_configure: true
health_check: true
- name: update-portfolio
agent: marketplace-trader
action: update_portfolio
timeout: 60
parameters:
record_purchases: true
calculate_roi: true
update_performance_metrics: true
success_criteria:
- profitable_purchases: true
- successful_deployments: true
- portfolio_updated: true
```
## Blockchain Performance Optimization Workflow
```yaml
name: blockchain-optimization
description: Automated blockchain performance monitoring and optimization
version: 1.0.0
schedule: "0 0 * * *" # Daily at midnight
steps:
- name: collect-metrics
agent: blockchain-monitor
action: gather_performance_metrics
timeout: 300
parameters:
metrics_period: 86400 # 24 hours
include_nodes: ["aitbc", "aitbc1"]
- name: analyze-performance
agent: blockchain-analyzer
action: performance_analysis
timeout: 600
parameters:
baseline_comparison: true
identify_bottlenecks: true
optimization_suggestions: true
- name: check-resource-utilization
agent: resource-monitor
action: analyze_resource_usage
timeout: 180
parameters:
resources: ["cpu", "memory", "storage", "network"]
threshold_alerts: {"cpu": 80, "memory": 85, "storage": 90}
- name: optimize-configuration
agent: blockchain-optimizer
action: apply_optimizations
timeout: 300
parameters:
auto_apply_safe: true
require_confirmation: false
backup_config: true
- name: verify-improvements
agent: blockchain-monitor
action: measure_improvements
timeout: 600
parameters:
measurement_period: 1800 # 30 minutes
compare_baseline: true
- name: generate-optimization-report
agent: blockchain-analyzer
action: create_optimization_report
timeout: 180
parameters:
include_before_after: true
recommendations: true
cost_analysis: true
success_criteria:
- performance_improved: true
- no_regressions: true
- report_generated: true
```
## Cross-Node Agent Coordination Workflow
```yaml
name: cross-node-coordination
description: Coordinates agent operations across multiple AITBC nodes
version: 1.0.0
trigger: "node_event"
steps:
- name: detect-node-event
agent: multi-node-coordinator
action: identify_event_type
timeout: 30
parameters:
event_types: ["node_down", "sync_issue", "high_load", "maintenance"]
- name: assess-impact
agent: blockchain-analyzer
action: impact_assessment
timeout: 120
parameters:
impact_scope: ["network", "transactions", "agents", "marketplace"]
- name: coordinate-response
agent: multi-node-coordinator
action: coordinate_node_response
timeout: 300
parameters:
response_strategies: ["failover", "load_balance", "graceful_degradation"]
- name: update-agent-routing
agent: routing-manager
action: update_agent_routing
timeout: 180
parameters:
redistribute_agents: true
maintain_services: true
- name: notify-stakeholders
agent: notification-agent
action: send_coordination_updates
timeout: 60
parameters:
channels: ["email", "slack", "blockchain_events"]
- name: monitor-resolution
agent: blockchain-monitor
action: monitor_event_resolution
timeout: 1800 # 30 minutes
parameters:
auto_escalate: true
resolution_criteria: ["service_restored", "performance_normal"]
success_criteria:
- event_resolved: true
- services_maintained: true
- stakeholders_notified: true
```
## Agent Training and Learning Workflow
```yaml
name: agent-learning
description: Continuous learning and improvement for OpenClaw agents
version: 1.0.0
schedule: "0 2 * * *" # Daily at 2 AM
steps:
- name: collect-performance-data
agent: learning-collector
action: gather_agent_performance
timeout: 300
parameters:
learning_period: 86400
include_all_agents: true
- name: analyze-performance-patterns
agent: learning-analyzer
action: identify_improvement_areas
timeout: 600
parameters:
pattern_recognition: true
success_metrics: ["accuracy", "efficiency", "cost"]
- name: update-agent-models
agent: learning-updater
action: improve_agent_models
timeout: 1800
parameters:
auto_update: true
backup_models: true
validation_required: true
- name: test-improved-agents
agent: testing-agent
action: validate_agent_improvements
timeout: 1200
parameters:
test_scenarios: ["performance", "accuracy", "edge_cases"]
acceptance_threshold: 0.95
- name: deploy-improved-agents
agent: deployment-manager
action: rollout_agent_updates
timeout: 600
parameters:
rollout_strategy: "canary"
rollback_enabled: true
- name: update-learning-database
agent: learning-manager
action: record_learning_outcomes
timeout: 180
parameters:
store_improvements: true
update_baselines: true
success_criteria:
- models_improved: true
- tests_passed: true
- deployment_successful: true
- learning_recorded: true
```

View File

@@ -0,0 +1,344 @@
---
description: OpenClaw agent management and coordination capabilities
title: OpenClaw Agent Management Skill
version: 1.0
---
# OpenClaw Agent Management Skill
This skill provides comprehensive OpenClaw agent management, communication, and coordination capabilities. Focus on agent operations, session management, and cross-agent workflows.
## Prerequisites
- OpenClaw 2026.3.24+ installed and gateway running
- Agent workspace configured: `~/.openclaw/workspace/`
- Network connectivity for multi-agent coordination
## Critical: Correct OpenClaw Syntax
### Agent Commands
```bash
# CORRECT — always use --message (long form), not -m
openclaw agent --agent main --message "Your task here" --thinking medium
# Session-based communication (maintains context across calls)
SESSION_ID="workflow-$(date +%s)"
openclaw agent --agent main --session-id $SESSION_ID --message "Initialize task" --thinking low
openclaw agent --agent main --session-id $SESSION_ID --message "Continue task" --thinking medium
# Thinking levels: off | minimal | low | medium | high | xhigh
```
> **WARNING**: The `-m` short form does NOT work reliably. Always use `--message`.
> **WARNING**: `--session-id` is required to maintain conversation context across multiple agent calls.
### Agent Status and Management
```bash
# Check agent status
openclaw status --agent all
openclaw status --agent main
# List available agents
openclaw list --agents
# Agent workspace management
openclaw workspace --setup
openclaw workspace --status
```
## Agent Communication Patterns
### Single Agent Tasks
```bash
# Simple task execution
openclaw agent --agent main --message "Analyze the system logs and report any errors" --thinking high
# Task with specific parameters
openclaw agent --agent main --message "Process this data: /path/to/data.csv" --thinking medium --parameters "format:csv,mode:analyze"
```
### Session-Based Workflows
```bash
# Initialize session
SESSION_ID="data-analysis-$(date +%s)"
# Step 1: Data collection
openclaw agent --agent main --session-id $SESSION_ID --message "Collect data from API endpoints" --thinking low
# Step 2: Data processing
openclaw agent --agent main --session-id $SESSION_ID --message "Process collected data and generate insights" --thinking medium
# Step 3: Report generation
openclaw agent --agent main --session-id $SESSION_ID --message "Create comprehensive report with visualizations" --thinking high
```
### Multi-Agent Coordination
```bash
# Coordinator agent manages workflow
openclaw agent --agent coordinator --message "Coordinate data processing across multiple agents" --thinking high
# Worker agents execute specific tasks
openclaw agent --agent worker-1 --message "Process dataset A" --thinking medium
openclaw agent --agent worker-2 --message "Process dataset B" --thinking medium
# Aggregator combines results
openclaw agent --agent aggregator --message "Combine results from worker-1 and worker-2" --thinking high
```
## Agent Types and Roles
### Coordinator Agent
```bash
# Setup coordinator for complex workflows
openclaw agent --agent coordinator --message "Initialize as workflow coordinator. Manage task distribution, monitor progress, aggregate results." --thinking high
# Use coordinator for orchestration
openclaw agent --agent coordinator --message "Orchestrate data pipeline: extract → transform → load → validate" --thinking high
```
### Worker Agent
```bash
# Setup worker for specific tasks
openclaw agent --agent worker --message "Initialize as data processing worker. Execute assigned tasks efficiently." --thinking medium
# Assign specific work
openclaw agent --agent worker --message "Process customer data file: /data/customers.json" --thinking medium
```
### Monitor Agent
```bash
# Setup monitor for oversight
openclaw agent --agent monitor --message "Initialize as system monitor. Track performance, detect anomalies, report status." --thinking low
# Continuous monitoring
openclaw agent --agent monitor --message "Monitor system health and report any issues" --thinking minimal
```
## Agent Workflows
### Data Processing Workflow
```bash
SESSION_ID="data-pipeline-$(date +%s)"
# Phase 1: Data Extraction
openclaw agent --agent extractor --session-id $SESSION_ID --message "Extract data from sources" --thinking medium
# Phase 2: Data Transformation
openclaw agent --agent transformer --session-id $SESSION_ID --message "Transform extracted data" --thinking medium
# Phase 3: Data Loading
openclaw agent --agent loader --session-id $SESSION_ID --message "Load transformed data to destination" --thinking medium
# Phase 4: Validation
openclaw agent --agent validator --session-id $SESSION_ID --message "Validate loaded data integrity" --thinking high
```
### Monitoring Workflow
```bash
SESSION_ID="monitoring-$(date +%s)"
# Continuous monitoring loop
while true; do
openclaw agent --agent monitor --session-id $SESSION_ID --message "Check system health" --thinking minimal
sleep 300 # Check every 5 minutes
done
```
### Analysis Workflow
```bash
SESSION_ID="analysis-$(date +%s)"
# Initial analysis
openclaw agent --agent analyst --session-id $SESSION_ID --message "Perform initial data analysis" --thinking high
# Deep dive analysis
openclaw agent --agent analyst --session-id $SESSION_ID --message "Deep dive into anomalies and patterns" --thinking high
# Report generation
openclaw agent --agent analyst --session-id $SESSION_ID --message "Generate comprehensive analysis report" --thinking high
```
## Agent Configuration
### Agent Parameters
```bash
# Agent with specific parameters
openclaw agent --agent main --message "Process data" --thinking medium \
--parameters "input_format:json,output_format:csv,mode:batch"
# Agent with timeout
openclaw agent --agent main --message "Long running task" --thinking high \
--parameters "timeout:3600,retry_count:3"
# Agent with resource constraints
openclaw agent --agent main --message "Resource-intensive task" --thinking high \
--parameters "max_memory:4GB,max_cpu:2,max_duration:1800"
```
### Agent Context Management
```bash
# Set initial context
openclaw agent --agent main --message "Initialize with context: data_analysis_v2" --thinking low \
--context "project:data_analysis,version:2.0,dataset:customer_data"
# Maintain context across calls
openclaw agent --agent main --session-id $SESSION_ID --message "Continue with previous context" --thinking medium
# Update context
openclaw agent --agent main --session-id $SESSION_ID --message "Update context: new_phase" --thinking medium \
--context-update "phase:processing,status:active"
```
## Agent Communication
### Cross-Agent Messaging
```bash
# Agent A sends message to Agent B
openclaw agent --agent agent-a --message "Send results to agent-b" --thinking medium \
--send-to "agent-b" --message-type "results"
# Agent B receives and processes
openclaw agent --agent agent-b --message "Process received results" --thinking medium \
--receive-from "agent-a"
```
### Agent Collaboration
```bash
# Setup collaboration team
TEAM_ID="team-analytics-$(date +%s)"
# Team leader coordination
openclaw agent --agent team-lead --session-id $TEAM_ID --message "Coordinate team analytics workflow" --thinking high
# Team member tasks
openclaw agent --agent analyst-1 --session-id $TEAM_ID --message "Analyze customer segment A" --thinking high
openclaw agent --agent analyst-2 --session-id $TEAM_ID --message "Analyze customer segment B" --thinking high
# Team consolidation
openclaw agent --agent team-lead --session-id $TEAM_ID --message "Consolidate team analysis results" --thinking high
```
## Agent Error Handling
### Error Recovery
```bash
# Agent with error handling
openclaw agent --agent main --message "Process data with error handling" --thinking medium \
--parameters "error_handling:retry_on_failure,max_retries:3,fallback_mode:graceful_degradation"
# Monitor agent errors
openclaw agent --agent monitor --message "Check for agent errors and report" --thinking low \
--parameters "check_type:error_log,alert_threshold:5"
```
### Agent Debugging
```bash
# Debug mode
openclaw agent --agent main --message "Debug task execution" --thinking high \
--parameters "debug:true,log_level:verbose,trace_execution:true"
# Agent state inspection
openclaw agent --agent main --message "Report current state and context" --thinking low \
--parameters "report_type:state,include_context:true"
```
## Agent Performance Optimization
### Efficient Agent Usage
```bash
# Batch processing
openclaw agent --agent processor --message "Process data in batches" --thinking medium \
--parameters "batch_size:100,parallel_processing:true"
# Resource optimization
openclaw agent --agent optimizer --message "Optimize resource usage" --thinking high \
--parameters "memory_efficiency:true,cpu_optimization:true"
```
### Agent Scaling
```bash
# Scale out work
for i in {1..5}; do
openclaw agent --agent worker-$i --message "Process batch $i" --thinking medium &
done
# Scale in coordination
openclaw agent --agent coordinator --message "Coordinate scaled-out workers" --thinking high
```
## Agent Security
### Secure Agent Operations
```bash
# Agent with security constraints
openclaw agent --agent secure-agent --message "Process sensitive data" --thinking high \
--parameters "security_level:high,data_encryption:true,access_log:true"
# Agent authentication
openclaw agent --agent authenticated-agent --message "Authenticated operation" --thinking medium \
--parameters "auth_required:true,token_expiry:3600"
```
## Agent Monitoring and Analytics
### Performance Monitoring
```bash
# Monitor agent performance
openclaw agent --agent monitor --message "Monitor agent performance metrics" --thinking low \
--parameters "metrics:cpu,memory,tasks_per_second,error_rate"
# Agent analytics
openclaw agent --agent analytics --message "Generate agent performance report" --thinking medium \
--parameters "report_type:performance,period:last_24h"
```
## Troubleshooting Agent Issues
### Common Agent Problems
1. **Session Loss**: Use consistent `--session-id` across calls
2. **Context Loss**: Maintain context with `--context` parameter
3. **Performance Issues**: Optimize `--thinking` level and task complexity
4. **Communication Failures**: Check agent status and network connectivity
### Debug Commands
```bash
# Check agent status
openclaw status --agent all
# Test agent communication
openclaw agent --agent main --message "Ping test" --thinking minimal
# Check workspace
openclaw workspace --status
# Verify agent configuration
openclaw config --show --agent main
```
## Best Practices
### Session Management
- Use meaningful session IDs: `task-type-$(date +%s)`
- Maintain context across related tasks
- Clean up sessions when workflows complete
### Thinking Level Optimization
- **off**: Simple, repetitive tasks
- **minimal**: Quick status checks, basic operations
- **low**: Data processing, routine analysis
- **medium**: Complex analysis, decision making
- **high**: Strategic planning, complex problem solving
- **xhigh**: Critical decisions, creative tasks
### Agent Organization
- Use descriptive agent names: `data-processor`, `monitor`, `coordinator`
- Group related agents in workflows
- Implement proper error handling and recovery
### Performance Tips
- Batch similar operations
- Use appropriate thinking levels
- Monitor agent resource usage
- Implement proper session cleanup
This OpenClaw Agent Management skill provides the foundation for effective agent coordination, communication, and workflow orchestration across any domain or application.