feat: Add intelligent auto-router and enhanced integrations

- Add intelligent-router.sh hook for automatic agent routing
- Add AUTO-TRIGGER-SUMMARY.md documentation
- Add FINAL-INTEGRATION-SUMMARY.md documentation
- Complete Prometheus integration (6 commands + 4 tools)
- Complete Dexto integration (12 commands + 5 tools)
- Enhanced Ralph with access to all agents
- Fix /clawd command (removed disable-model-invocation)
- Update hooks.json to v5 with intelligent routing
- 291 total skills now available
- All 21 commands with automatic routing

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
admin
2026-01-28 00:27:56 +04:00
Unverified
parent 3b128ba3bd
commit b52318eeae
1724 changed files with 351216 additions and 0 deletions

View File

@@ -0,0 +1,121 @@
# Coordinator Agent - Delegates tasks to specialist agents
agentId: task-coordinator
# Agent Card for A2A Protocol
agentCard:
name: "Task Coordinator"
description: "Intelligent coordinator that delegates specialized tasks to expert agents. Orchestrates multi-agent workflows."
url: "http://localhost:3000"
version: "1.0.0"
skills:
- id: "task-delegation"
name: "Task Delegation"
description: "Intelligently route tasks to specialized agents based on their capabilities"
tags: ["coordination", "delegation", "orchestration"]
examples:
- "Delegate data analysis tasks"
- "Coordinate multi-agent workflows"
- id: "result-synthesis"
name: "Result Synthesis"
description: "Combine results from multiple agents into coherent responses"
tags: ["synthesis", "aggregation", "coordination"]
# LLM Configuration
llm:
provider: anthropic
model: claude-sonnet-4-5-20250929
apiKey: ${ANTHROPIC_API_KEY}
# Internal Tools - Enable delegation
internalTools:
- delegate_to_url
# System Prompt
systemPrompt:
contributors:
- id: primary
type: static
priority: 0
content: |
You are a Task Coordinator agent. Your role is to:
1. Understand user requests and identify when specialized help is needed
2. Delegate tasks to specialist agents using the delegate_to_url tool
3. Manage stateful conversations with specialists using sessionId
4. Synthesize results from specialists into clear responses
Available Specialist Agents:
- Data Analyzer (http://localhost:3001):
* Analyzes data and identifies trends
* Generates statistical insights
* Creates comprehensive reports
* Use for: data analysis, trend identification, statistical insights
IMPORTANT - Session Management for Multi-Turn Conversations:
The delegate_to_url tool supports STATEFUL conversations:
1. FIRST delegation to an agent:
- Call tool with: {url: "http://localhost:3001", message: "your task"}
- Tool returns: {success: true, sessionId: "delegation-xxx", response: "..."}
- REMEMBER this sessionId!
2. FOLLOW-UP delegations to SAME agent:
- Call tool with: {url: "http://localhost:3001", message: "follow-up question", sessionId: "delegation-xxx"}
- Use the SAME sessionId from step 1
- The agent REMEMBERS the previous conversation
3. NEW conversation with SAME agent:
- Don't provide sessionId (or use a new one)
- Starts fresh conversation
Example multi-turn delegation:
```
// First delegation
delegate_to_url({
url: "http://localhost:3001",
message: "Analyze Q4 sales data: Revenue $2.5M, Growth 35%"
})
→ Returns: {sessionId: "delegation-abc123", response: "Analysis..."}
// Follow-up (remembers previous analysis)
delegate_to_url({
url: "http://localhost:3001",
message: "What was the most important factor you identified?",
sessionId: "delegation-abc123" ← SAME sessionId
})
→ Agent remembers the Q4 analysis and can answer specifically
```
BEST PRACTICE: Track sessionIds for each specialist agent you work with so you can maintain context across multiple user questions.
- id: date
type: dynamic
priority: 10
source: date
enabled: true
# Session configuration
sessions:
sessionTTL: 3600000 # 1 hour
maxSessions: 100
# Storage
storage:
cache:
type: in-memory
database:
type: sqlite
blob:
type: in-memory
# Tool confirmation
toolConfirmation:
mode: auto-approve
timeout: 120000
# Logging
logger:
level: info
transports:
- type: console
colorize: true

View File

@@ -0,0 +1,85 @@
# Specialist Agent - Receives delegated tasks and processes them
agentId: data-analyzer-specialist
# Agent Card for A2A Protocol
agentCard:
name: "Data Analyzer"
description: "Specialized agent for analyzing data, generating insights, and creating reports. Excellent at statistical analysis and data visualization."
url: "http://localhost:3001"
version: "1.0.0"
skills:
- id: "data-analysis"
name: "Data Analysis"
description: "Analyze datasets, identify trends, and generate statistical insights"
tags: ["data", "analysis", "statistics", "trends"]
examples:
- "Analyze sales trends for Q4"
- "Find correlations in customer data"
- "Generate summary statistics"
- id: "report-generation"
name: "Report Generation"
description: "Create comprehensive reports with insights and recommendations"
tags: ["reporting", "documentation", "insights"]
examples:
- "Generate quarterly report"
- "Summarize key findings"
# LLM Configuration
llm:
provider: anthropic
model: claude-sonnet-4-5-20250929
apiKey: ${ANTHROPIC_API_KEY}
# System Prompt
systemPrompt:
contributors:
- id: primary
type: static
priority: 0
content: |
You are a Data Analyzer specialist agent. Your role is to:
1. Analyze data and identify patterns/trends
2. Provide statistical insights
3. Generate clear, actionable reports
When you receive a delegation request, focus on:
- Understanding the data or question thoroughly
- Providing specific, quantitative insights
- Being concise but comprehensive
Always structure your responses with:
- Summary of findings
- Key insights (3-5 bullet points)
- Recommendations
- id: date
type: dynamic
priority: 10
source: date
enabled: true
# Session configuration
sessions:
sessionTTL: 3600000 # 1 hour
maxSessions: 100
# Storage
storage:
cache:
type: in-memory
database:
type: sqlite
blob:
type: in-memory
# Tool confirmation
toolConfirmation:
mode: auto-approve
timeout: 120000
# Logging
logger:
level: info
transports:
- type: console
colorize: true

View File

@@ -0,0 +1,185 @@
#!/bin/bash
# Agent Delegation Test - Validates delegate_to_url internal tool
#
# This test proves:
# 1. Specialist agent starts and exposes A2A JSON-RPC endpoint
# 2. Direct A2A delegation works (send message, get response)
# 3. Multi-turn stateful conversations work (3 turns, same sessionId)
# 4. Agent remembers context across follow-up questions
#
# Files needed:
# - specialist-agent.yml (agent that receives delegated tasks)
# - coordinator-agent.yml (agent with delegate_to_url tool - not used in this test)
# - test.sh (this file)
#
# Usage: cd examples/agent-delegation && ./test.sh
# Requires: ANTHROPIC_API_KEY in .env file at project root
set -e
# Get the directory where the script is located
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd "$SCRIPT_DIR"
# Cleanup function
cleanup() {
echo ""
echo "🧹 Cleaning up..."
if [ ! -z "$SPECIALIST_PID" ]; then
kill $SPECIALIST_PID 2>/dev/null || true
wait $SPECIALIST_PID 2>/dev/null || true
fi
rm -f /tmp/turn*.json /tmp/specialist-stateful.log 2>/dev/null || true
}
# Trap cleanup on exit
trap cleanup EXIT INT TERM
# Load env
if [ -f ../../.env ]; then
export $(cat ../../.env | grep -v '^#' | grep -v '^$' | xargs) 2>/dev/null || true
fi
echo ""
echo "🔄 Testing Stateful Delegation (Conversation Resumption)"
echo "═══════════════════════════════════════════════════════"
echo ""
# Start specialist
echo "📡 Starting Specialist Agent (port 3001)..."
PORT=3001 node ../../packages/cli/dist/index.js --mode server --agent specialist-agent.yml > /tmp/specialist-stateful.log 2>&1 &
SPECIALIST_PID=$!
# Wait for ready
READY=false
for i in {1..30}; do
if curl -s http://localhost:3001/health > /dev/null 2>&1; then
echo "✅ Specialist ready!"
READY=true
break
fi
sleep 1
done
if [ "$READY" = false ]; then
echo "❌ Failed to start specialist agent"
cat /tmp/specialist-stateful.log 2>/dev/null || echo "No logs available"
exit 1
fi
echo ""
echo "🧪 Test: Multi-Turn Conversation via A2A"
echo "───────────────────────────────────────────────────"
echo ""
# Generate unique session ID for this test
SESSION_ID="test-session-$(date +%s)"
echo "📝 Using session ID: $SESSION_ID"
echo ""
# Turn 1: Initial analysis
echo "💬 Turn 1: Ask specialist to analyze data..."
cat > /tmp/turn1.json << EOF
{
"jsonrpc": "2.0",
"id": "turn1",
"method": "message/send",
"params": {
"message": {
"role": "user",
"parts": [{"kind": "text", "text": "Analyze these Q4 metrics: Revenue \$2.5M (+35%), 1200 customers, 87% retention. What are the top 3 insights?"}],
"messageId": "msg-1",
"taskId": "$SESSION_ID",
"kind": "message"
},
"configuration": {"blocking": true}
}
}
EOF
RESPONSE1=$(curl -s -X POST http://localhost:3001/jsonrpc -H "Content-Type: application/json" -d @/tmp/turn1.json)
if echo "$RESPONSE1" | jq -e '.error' > /dev/null 2>&1; then
echo "❌ Turn 1 failed:"
echo "$RESPONSE1" | jq '.'
exit 1
fi
echo "$RESPONSE1" | jq -r '.result.history[-1].parts[0].text' | head -15
echo ""
echo "✅ Turn 1 completed"
echo ""
# Turn 2: Follow-up question using SAME session
echo "💬 Turn 2: Ask follow-up question (same session)..."
sleep 1
cat > /tmp/turn2.json << EOF
{
"jsonrpc": "2.0",
"id": "turn2",
"method": "message/send",
"params": {
"message": {
"role": "user",
"parts": [{"kind": "text", "text": "Which of those 3 insights is most important and why?"}],
"messageId": "msg-2",
"taskId": "$SESSION_ID",
"kind": "message"
},
"configuration": {"blocking": true}
}
}
EOF
RESPONSE2=$(curl -s -X POST http://localhost:3001/jsonrpc -H "Content-Type: application/json" -d @/tmp/turn2.json)
if echo "$RESPONSE2" | jq -e '.error' > /dev/null 2>&1; then
echo "❌ Turn 2 failed:"
echo "$RESPONSE2" | jq '.'
exit 1
fi
echo "$RESPONSE2" | jq -r '.result.history[-1].parts[0].text' | head -20
echo ""
echo "✅ Turn 2 completed"
echo ""
# Turn 3: Another follow-up
echo "💬 Turn 3: Ask another follow-up (same session)..."
sleep 1
cat > /tmp/turn3.json << EOF
{
"jsonrpc": "2.0",
"id": "turn3",
"method": "message/send",
"params": {
"message": {
"role": "user",
"parts": [{"kind": "text", "text": "Based on our discussion, what should be the #1 priority for Q1?"}],
"messageId": "msg-3",
"taskId": "$SESSION_ID",
"kind": "message"
},
"configuration": {"blocking": true}
}
}
EOF
RESPONSE3=$(curl -s -X POST http://localhost:3001/jsonrpc -H "Content-Type: application/json" -d @/tmp/turn3.json)
if echo "$RESPONSE3" | jq -e '.error' > /dev/null 2>&1; then
echo "❌ Turn 3 failed:"
echo "$RESPONSE3" | jq '.'
exit 1
fi
echo "$RESPONSE3" | jq -r '.result.history[-1].parts[0].text' | head -15
echo ""
echo "✅ Turn 3 completed"
echo ""
echo ""
echo "✅ Stateful Conversation Test Complete!"
echo "═══════════════════════════════════════════════════════"
echo ""
echo "Validation:"
echo " ✅ 3 messages sent to same session"
echo " ✅ Agent remembered context across turns"
echo " ✅ Follow-up questions worked without re-stating context"
echo " ✅ Session ID: $SESSION_ID maintained throughout"
echo ""