# Claude Flow Web UI - Demo Examples ## 🎯 Overview This guide provides practical examples demonstrating how to use the Claude Flow Web UI for various tasks, from basic operations to advanced swarm orchestration. ## 🚀 Basic Operations ### Example 1: Starting the Web UI and First Commands ```bash # Terminal 1: Start the web server $ claude-flow start --ui --port 3000 🚀 Starting Claude Code Web UI... 🌐 Claude Code Web UI started successfully 📍 Web Interface: http://localhost:3000/console 🔗 WebSocket: ws://localhost:3000/ws 📁 Serving UI from: /src/ui/console ``` ```javascript // In the Web Console claude-flow> help Available commands: help Show this help message status Display system status agent list List all active agents agent spawn Spawn a new agent task list List all tasks memory list Show memory entries clear Clear the console claude-flow> status Claude Flow Status: Version: 2.0.0 Mode: Web Console Active Processes: 3 Memory Usage: 47MB Uptime: 120s ``` ### Example 2: Basic Agent Management ```javascript // Spawn a research agent claude-flow> agent spawn researcher ✅ Agent spawned successfully ID: agent_1736201234567_abc123 Type: researcher Name: Research Agent Status: active // List all agents claude-flow> agent list Active Agents: • agent_1736201234567_abc123 (researcher) - idle - 0 tasks Total: 1 agent // Check agent status claude-flow> agent status agent_1736201234567_abc123 Agent Status: ID: agent_1736201234567_abc123 Type: researcher Status: idle Created: 2 minutes ago Tasks Completed: 0 Current Task: None ``` ## 🧠 Neural Network Operations ### Example 3: Training a Neural Network ```javascript // Open Neural Networks panel (click 🧠 Neural button or type) claude-flow> neural status Neural System Status: Models Loaded: 0 Training Active: false WASM Optimized: true Memory Usage: 12MB // Start training a coordination pattern claude-flow> neural train --pattern coordination --data "task allocation strategies" --epochs 50 🚀 Training Started Model ID: model_coordination_1736201345678 Pattern: coordination Epochs: 50 Training Progress: Epoch 10/50 [████████░░░░░░░░░░░░] 20% | Loss: 0.3421 Epoch 20/50 [████████████████░░░░] 40% | Loss: 0.2156 ... ✅ Training Complete Final Accuracy: 69.1% Model Saved: model_coordination_1736201345678 ``` ### Example 4: Making Predictions ```javascript // Load a trained model claude-flow> model load model_coordination_1736201345678 ✅ Model loaded successfully // Make a prediction claude-flow> neural predict --model model_coordination_1736201345678 --input "distribute tasks across 5 agents" Prediction Results: Strategy: hierarchical Confidence: 87.3% Recommended Distribution: - Coordinator: 1 agent - Workers: 4 agents Optimal Topology: star ``` ## 🐝 Swarm Orchestration ### Example 5: Creating and Managing a Swarm ```javascript // Initialize a swarm claude-flow> swarm init --topology hierarchical --agents 5 🐝 Swarm Initialization Complete Swarm ID: swarm_1736201456789 Topology: hierarchical Max Agents: 5 Status: active // Spawn agents for the swarm claude-flow> swarm spawn coordinator --name "Lead" claude-flow> swarm spawn coder --name "Backend Dev" claude-flow> swarm spawn coder --name "Frontend Dev" claude-flow> swarm spawn tester --name "QA Engineer" claude-flow> swarm spawn analyst --name "Data Analyst" // Check swarm status claude-flow> swarm status Swarm Status: 🐝 Swarm: ACTIVE 🏗️ Topology: hierarchical 👥 Agents: 5/5 active 📊 Tasks: 0 total ⚡ Mode: ready 🧠 Memory: 0 coordination points Agent Activity: 🟢 coordinator (Lead): Ready for tasks 🟢 coder (Backend Dev): Ready for tasks 🟢 coder (Frontend Dev): Ready for tasks 🟢 tester (QA Engineer): Ready for tasks 🟢 analyst (Data Analyst): Ready for tasks ``` ### Example 6: Orchestrating a Complex Task ```javascript // Orchestrate a task across the swarm claude-flow> task orchestrate "Build a REST API with authentication, database, and tests" 📋 Task Created Task ID: task_1736201567890 Strategy: adaptive Priority: medium 🔄 Task Distribution: → coordinator (Lead): Planning API architecture → coder (Backend Dev): Implementing authentication system → coder (Frontend Dev): Creating API endpoints → analyst (Data Analyst): Designing database schema → tester (QA Engineer): Preparing test framework ⏳ Execution Progress: [████████░░░░░░░░░░░░] 40% | 2/5 subtasks complete 📊 Real-time Updates: ✅ Database schema designed ✅ Test framework initialized 🔄 Authentication system 70% complete 🔄 API endpoints 45% complete ⏳ Architecture planning in progress ``` ## 📊 Analytics and Monitoring ### Example 7: Performance Monitoring ```javascript // Open Analytics Dashboard or use commands claude-flow> benchmark run --type swarm --iterations 10 Running Benchmark: swarm Iterations: 10 📊 Benchmark Results: Average Response Time: 245ms Memory Usage: 128MB CPU Utilization: 15% Success Rate: 98.5% Throughput: 420 ops/sec 🏆 Performance Grade: A+ ⚡ Optimization Suggestions: - Enable caching for 12% improvement - Consider mesh topology for better distribution ``` ### Example 8: Token Usage Analysis ```javascript claude-flow> token usage --period 24h Token Usage Report (Last 24 Hours): Total Tokens: 125,847 Input Tokens: 45,231 Output Tokens: 80,616 By Operation: • Neural Training: 35,421 (28.1%) • Task Orchestration: 28,567 (22.7%) • Agent Communication: 22,143 (17.6%) • Analysis: 18,234 (14.5%) • Other: 21,482 (17.1%) Estimated Cost: $2.38 Efficiency Score: 87/100 ``` ## 💾 Memory Management ### Example 9: Working with Persistent Memory ```javascript // Store important data claude-flow> memory store --key "project/api/config" --value '{"database": "postgres", "port": 5432}' ✅ Memory stored successfully Key: project/api/config Namespace: default Timestamp: 2025-07-06T10:30:45Z // Search memory claude-flow> memory search "project/*" Memory Search Results: • project/api/config - API configuration • project/api/routes - Route definitions • project/tests/setup - Test configuration Total: 3 entries found // Create a memory backup claude-flow> memory backup --path "./backups/project-backup.json" ✅ Backup created successfully File: ./backups/project-backup.json Entries: 15 Size: 4.2KB ``` ## 🔄 Workflow Automation ### Example 10: Creating an Automated Workflow ```javascript // Create a workflow claude-flow> workflow create "Daily Analysis Pipeline" 📋 Workflow Created ID: workflow_1736201678901 Name: Daily Analysis Pipeline Status: draft // Add workflow steps claude-flow> workflow add-step "Collect metrics" --tool "metrics_collect" claude-flow> workflow add-step "Analyze performance" --tool "performance_report" claude-flow> workflow add-step "Check errors" --tool "error_analysis" claude-flow> workflow add-step "Generate report" --tool "quality_assess" // Set up scheduling claude-flow> scheduler create --workflow workflow_1736201678901 --cron "0 9 * * *" ⏰ Schedule Created Workflow: Daily Analysis Pipeline Schedule: Every day at 9:00 AM Next Run: Tomorrow at 9:00 AM Status: active ``` ## 🎯 Advanced Scenarios ### Example 11: Multi-Agent Code Review ```javascript // Create a code review swarm claude-flow> swarm init --topology mesh --agents 4 claude-flow> swarm spawn reviewer --name "Senior Reviewer" claude-flow> swarm spawn analyzer --name "Code Analyzer" claude-flow> swarm spawn tester --name "Test Validator" claude-flow> swarm spawn documenter --name "Doc Checker" // Submit code for review claude-flow> task orchestrate "Review pull request #123 for security, performance, and code quality" 🔍 Code Review in Progress: Senior Reviewer: Checking design patterns... Code Analyzer: Running static analysis... Test Validator: Verifying test coverage... Doc Checker: Reviewing documentation... 📊 Review Results: ✅ Security: No vulnerabilities found ⚠️ Performance: 2 optimization opportunities ✅ Code Quality: Score 8.5/10 ❌ Documentation: 3 missing docstrings 💡 Recommendations: 1. Optimize database queries in UserService 2. Add caching for frequently accessed data 3. Document public API methods ``` ### Example 12: Real-time System Monitoring ```javascript // Start real-time monitoring claude-flow> monitor start --interval 5s --duration 5m 📊 Real-time System Monitor ═══════════════════════════════════════════ Time CPU Memory Network Agents Tasks 10:45:00 12% 145MB 2.1MB/s 5 3 10:45:05 15% 148MB 3.4MB/s 5 4 10:45:10 18% 152MB 4.2MB/s 6 4 10:45:15 14% 149MB 2.8MB/s 6 3 ⚠️ Alert: Memory usage increasing 📈 Trend: CPU stable, Memory +5%, Network variable Live Agent Status: 🟢 coordinator: Processing task_123 🟢 coder-1: Idle 🟡 coder-2: High load (85% CPU) 🟢 analyst: Running analysis 🔴 tester: Error - retrying ``` ## 🛠️ Troubleshooting Examples ### Example 13: Debugging Connection Issues ```javascript // Check connection status claude-flow> connection status WebSocket Connection: Status: 🔴 Disconnected Last Connected: 2 minutes ago Reconnect Attempts: 3 Error: Connection timeout // Manually reconnect claude-flow> connection reconnect --server ws://localhost:3000/ws 🔄 Attempting to reconnect... ✅ Connection established Latency: 12ms Protocol: WSS Server Version: 2.0.0 ``` ### Example 14: Performance Diagnostics ```javascript // Run system diagnostics claude-flow> diagnostic run --comprehensive 🔍 Running System Diagnostics... Component Health: ✅ Web Server: Healthy ✅ WebSocket: Healthy ⚠️ Memory System: 85% used ✅ Agent Manager: Healthy ❌ Neural Engine: Error - Model not loaded Performance Metrics: • Response Time: 187ms (average) • Memory Usage: 425MB/500MB • Active Connections: 3 • Error Rate: 0.2% Recommendations: 1. Clear memory cache to free up space 2. Load neural models for AI operations 3. Consider increasing memory limit ``` ## 📚 Learning Resources ### Interactive Tutorials 1. **Basic Console Operations** - 15 minutes - Command syntax - Navigation shortcuts - Output interpretation 2. **Agent Management** - 30 minutes - Creating agents - Task assignment - Monitoring performance 3. **Neural Network Training** - 45 minutes - Data preparation - Training configuration - Model evaluation 4. **Swarm Orchestration** - 60 minutes - Topology selection - Agent coordination - Task distribution ### Video Walkthroughs - [Getting Started with Claude Flow Web UI](https://example.com/video1) - [Advanced Swarm Orchestration Techniques](https://example.com/video2) - [Neural Network Training Best Practices](https://example.com/video3) ## 🎉 Next Steps 1. **Explore More Tools** - Try different tool categories 2. **Build Custom Workflows** - Automate your tasks 3. **Train Neural Models** - Create AI-powered solutions 4. **Join the Community** - Share your experiences --- **Pro Tips**: - Use Tab completion for faster command entry - Press ↑/↓ to navigate command history - Type `clear` or press Ctrl+L to clear the console - Use `help ` for detailed command help - Enable real-time monitoring for production systems Happy orchestrating! 🚀