🌊 The original agent harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, federation, vector RAG integration, and native Claude Code / Codex / Hermes and many more Integrated
TypeScript agentic-aiagentic-frameworkagentic-workflowagentsai-agentsai-assistantai-skillsautonomous-agentsclaudecodexdsh-pluginharnessmcp-servermulti-agentmulti-agent-systemsnpmskillsswarmswarm-intelligencetypescript
checkpoint: File edit:
rUv716abea0e233
diff --git a/.agentic-flow/intelligence.json b/.agentic-flow/intelligence.jsonindex 164e01c7d6..957589ade4 100644--- a/.agentic-flow/intelligence.json+++ b/.agentic-flow/intelligence.json@@ -456,8 +456,8 @@},"errorPatterns": [],"metrics": {- "totalRoutes": 151,- "successfulRoutes": 151,+ "totalRoutes": 152,+ "successfulRoutes": 152,"routingHistory": [{"timestamp": "2026-01-04T15:51:13.039Z",@@ -878,6 +878,12 @@"task": "edit:","agent": "unknown","success": true+ },+ {+ "timestamp": "2026-01-04T17:35:01.041Z",+ "task": "edit:",+ "agent": "unknown",+ "success": true}]},diff --git a/.claude/helpers/swarm-monitor.sh b/.claude/helpers/swarm-monitor.shnew file mode 100644index 0000000000..c38419b9c3--- /dev/null+++ b/.claude/helpers/swarm-monitor.sh@@ -0,0 +1,206 @@+#!/bin/bash+# Claude Flow V3 - Real-time Swarm Activity Monitor+# Continuously monitors and updates metrics based on running processes++SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"+PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"+METRICS_DIR="$PROJECT_ROOT/.claude-flow/metrics"+UPDATE_SCRIPT="$SCRIPT_DIR/update-v3-progress.sh"++# Ensure metrics directory exists+mkdir -p "$METRICS_DIR"++# Colors for logging+GREEN='\033[0;32m'+YELLOW='\033[1;33m'+CYAN='\033[0;36m'+RED='\033[0;31m'+RESET='\033[0m'++log() {+ echo -e "${CYAN}[$(date '+%H:%M:%S')] ${1}${RESET}"+}++warn() {+ echo -e "${YELLOW}[$(date '+%H:%M:%S')] WARNING: ${1}${RESET}"+}++error() {+ echo -e "${RED}[$(date '+%H:%M:%S')] ERROR: ${1}${RESET}"+}++success() {+ echo -e "${GREEN}[$(date '+%H:%M:%S')] ${1}${RESET}"+}++# Function to count active processes+count_active_processes() {+ local agentic_flow_count=0+ local mcp_count=0+ local agent_count=0++ # Count agentic-flow processes+ agentic_flow_count=$(ps aux 2>/dev/null | grep -E "agentic-flow" | grep -v grep | grep -v "swarm-monitor" | wc -l)++ # Count MCP server processes+ mcp_count=$(ps aux 2>/dev/null | grep -E "mcp.*start" | grep -v grep | wc -l)++ # Count specific agent processes+ agent_count=$(ps aux 2>/dev/null | grep -E "(agent|swarm|coordinator)" | grep -v grep | grep -v "swarm-monitor" | wc -l)++ # Calculate total active "agents" using heuristic+ local total_agents=0+ if [ "$agentic_flow_count" -gt 0 ]; then+ # Use agent count if available, otherwise estimate from processes+ if [ "$agent_count" -gt 0 ]; then+ total_agents="$agent_count"+ else+ # Heuristic: some processes are management, some are agents+ total_agents=$((agentic_flow_count / 2))+ if [ "$total_agents" -eq 0 ] && [ "$agentic_flow_count" -gt 0 ]; then+ total_agents=1+ fi+ fi+ fi++ echo "agentic:$agentic_flow_count mcp:$mcp_count agents:$total_agents"+}++# Function to update metrics based on detected activity+update_activity_metrics() {+ local process_info="$1"+ local agentic_count=$(echo "$process_info" | cut -d' ' -f1 | cut -d':' -f2)+ local mcp_count=$(echo "$process_info" | cut -d' ' -f2 | cut -d':' -f2)+ local agent_count=$(echo "$process_info" | cut -d' ' -f3 | cut -d':' -f2)++ # Update active agents in metrics+ if [ -f "$UPDATE_SCRIPT" ]; then+ "$UPDATE_SCRIPT" agents "$agent_count" >/dev/null 2>&1+ fi++ # Update integration status based on activity+ local integration_status="false"+ if [ "$agentic_count" -gt 0 ] || [ "$mcp_count" -gt 0 ]; then+ integration_status="true"+ fi++ # Create/update activity metrics file+ local activity_file="$METRICS_DIR/swarm-activity.json"+ cat > "$activity_file" << EOF+{+ "timestamp": "$(date -Iseconds)",+ "processes": {+ "agentic_flow": $agentic_count,+ "mcp_server": $mcp_count,+ "estimated_agents": $agent_count+ },+ "swarm": {+ "active": $([ "$agent_count" -gt 0 ] && echo "true" || echo "false"),+ "agent_count": $agent_count,+ "coordination_active": $([ "$agentic_count" -gt 0 ] && echo "true" || echo "false")+ },+ "integration": {+ "agentic_flow_active": $integration_status,+ "mcp_active": $([ "$mcp_count" -gt 0 ] && echo "true" || echo "false")+ }+}+EOF++ return 0+}++# Function to monitor continuously+monitor_continuous() {+ local monitor_interval="${1:-5}" # Default 5 seconds+ local last_state=""+ local current_state=""++ log "Starting continuous swarm monitoring (interval: ${monitor_interval}s)"+ log "Press Ctrl+C to stop monitoring"++ while true; do+ current_state=$(count_active_processes)++ # Only update if state changed+ if [ "$current_state" != "$last_state" ]; then+ update_activity_metrics "$current_state"++ local agent_count=$(echo "$current_state" | cut -d' ' -f3 | cut -d':' -f2)+ local agentic_count=$(echo "$current_state" | cut -d' ' -f1 | cut -d':' -f2)++ if [ "$agent_count" -gt 0 ] || [ "$agentic_count" -gt 0 ]; then+ success "Swarm activity detected: $current_state"+ else+ warn "No swarm activity detected"+ fi++ last_state="$current_state"+ fi++ sleep "$monitor_interval"+ done+}++# Function to run a single check+check_once() {+ log "Running single swarm activity check..."++ local process_info=$(count_active_processes)+ update_activity_metrics "$process_info"++ local agent_count=$(echo "$process_info" | cut -d' ' -f3 | cut -d':' -f2)+ local agentic_count=$(echo "$process_info" | cut -d' ' -f1 | cut -d':' -f2)+ local mcp_count=$(echo "$process_info" | cut -d' ' -f2 | cut -d':' -f2)++ log "Process Detection Results:"+ log " Agentic Flow processes: $agentic_count"+ log " MCP Server processes: $mcp_count"+ log " Estimated agents: $agent_count"++ if [ "$agent_count" -gt 0 ] || [ "$agentic_count" -gt 0 ]; then+ success "✓ Swarm activity detected and metrics updated"+ return 0+ else+ warn "⚠No swarm activity detected"+ return 1+ fi+}++# Main command handling+case "${1:-check}" in+ "monitor"|"continuous")+ monitor_continuous "${2:-5}"+ ;;+ "check"|"once")+ check_once+ ;;+ "status")+ if [ -f "$METRICS_DIR/swarm-activity.json" ]; then+ log "Current swarm activity status:"+ cat "$METRICS_DIR/swarm-activity.json" | jq . 2>/dev/null || cat "$METRICS_DIR/swarm-activity.json"+ else+ warn "No activity data available. Run 'check' first."+ fi+ ;;+ "help"|"-h"|"--help")+ echo "Claude Flow V3 Swarm Monitor"+ echo ""+ echo "Usage: $0 [command] [options]"+ echo ""+ echo "Commands:"+ echo " check, once Run a single activity check and update metrics"+ echo " monitor [N] Monitor continuously every N seconds (default: 5)"+ echo " status Show current activity status"+ echo " help Show this help message"+ echo ""+ echo "Examples:"+ echo " $0 check # Single check"+ echo " $0 monitor 3 # Monitor every 3 seconds"+ echo " $0 status # Show current status"+ ;;+ *)+ error "Unknown command: $1"+ echo "Use '$0 help' for usage information"+ exit 1+ ;;+esac\ No newline at end of filediff --git a/v3/swarm/types.ts b/v3/swarm/types.tsindex 4c1b926ff0..37366a9fd5 100644--- a/v3/swarm/types.ts+++ b/v3/swarm/types.ts@@ -350,18 +350,22 @@ export type SwarmEventType =| 'agent.left'| 'agent.status_changed'| 'agent.heartbeat'+ | 'agent.domain_assigned'| 'task.created'| 'task.assigned'| 'task.started'| 'task.completed'| 'task.failed'+ | 'task.queued'| 'topology.updated'| 'topology.rebalanced'| 'consensus.proposed'| 'consensus.achieved'| 'consensus.failed'| 'message.sent'- | 'message.received';+ | 'message.received'+ | 'parallel.execution.completed'+ | 'hierarchy.spawned';export interface SwarmEvent {id: string;