Skip to content

armgit / ruflo

Public Imported from GitHub
0

🌊 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

🔖 Checkpoint: Edit /workspaces/claude-code-flow/benchmark/CLI_USAGE.md

rUv50b8638070fe
diff --git a/benchmark/CLI_USAGE.md b/benchmark/CLI_USAGE.md
new file mode 100644
index 0000000000..07fcc36be9
--- /dev/null
+++ b/benchmark/CLI_USAGE.md
@@ -0,0 +1,178 @@
+# Swarm-Benchmark CLI Usage Guide
+
+## Overview
+The `swarm-benchmark` CLI provides comprehensive benchmarking for Claude Flow with real command execution.
+
+## Installation
+```bash
+cd benchmark
+pip install -e .
+```
+
+## Commands
+
+### Real Execution (Production)
+Execute actual claude-flow commands and measure real performance:
+
+```bash
+# Basic swarm benchmark
+swarm-benchmark real swarm "Build a REST API" --strategy development
+
+# Hive-mind benchmark
+swarm-benchmark real hive-mind "Design architecture" --max-workers 8
+
+# SPARC mode benchmark
+swarm-benchmark real sparc coder "Implement authentication"
+
+# Test all modes
+swarm-benchmark real swarm "Create microservice" --all-modes --parallel
+```
+
+### Options
+
+#### Global Options
+- `--verbose, -v`: Enable verbose output
+- `--config PATH`: Configuration file path
+- `--version`: Show version
+
+#### Real Command Options
+- `--strategy`: Execution strategy (auto, research, development, etc.)
+- `--mode`: Coordination mode (centralized, distributed, hierarchical, mesh, hybrid)
+- `--sparc-mode`: Specific SPARC mode to test
+- `--all-modes`: Test all SPARC modes and strategies
+- `--max-agents`: Maximum number of agents (default: 5)
+- `--timeout`: Overall timeout in minutes (default: 60)
+- `--task-timeout`: Individual task timeout in seconds (default: 300)
+- `--parallel`: Enable parallel execution
+- `--monitor`: Enable real-time monitoring
+- `--output`: Output format (json, sqlite)
+- `--output-dir`: Output directory (default: ./reports)
+
+## Examples
+
+### Simple Benchmark
+```bash
+swarm-benchmark real swarm "echo hello world" --max-agents 1 --timeout 1
+```
+
+### Development Benchmark
+```bash
+swarm-benchmark real swarm "Build user authentication system" \
+ --strategy development \
+ --mode hierarchical \
+ --max-agents 5 \
+ --monitor \
+ --output json \
+ --output-dir ./results
+```
+
+### Comparative Analysis
+```bash
+# Test different strategies
+for strategy in auto research development optimization; do
+ swarm-benchmark real swarm "Optimize database queries" \
+ --strategy $strategy \
+ --output json \
+ --name "strategy-$strategy"
+done
+```
+
+### Batch Processing
+```bash
+# Run multiple benchmarks
+cat tasks.txt | while read task; do
+ swarm-benchmark real swarm "$task" \
+ --parallel \
+ --output json
+done
+```
+
+## Output
+
+Results are saved in JSON format with comprehensive metrics:
+- Token usage (input/output)
+- Execution time
+- Agent activity
+- Memory usage
+- Error rates
+- Command details
+
+Example output structure:
+```json
+{
+ "benchmark_id": "...",
+ "objective": "Build a REST API",
+ "metrics": {
+ "total_tokens": 4351,
+ "execution_time": 95.2,
+ "agents_spawned": 3,
+ "memory_peak_mb": 156.4
+ },
+ "command": ["./claude-flow", "swarm", "..."],
+ "timestamp": "2025-01-06T02:45:00Z"
+}
+```
+
+## Performance Tips
+
+1. **Use --parallel** for multiple independent tasks
+2. **Set appropriate timeouts** to avoid hanging
+3. **Monitor resource usage** with --monitor flag
+4. **Use --all-modes** for comprehensive testing
+5. **Save results** with --output-dir for analysis
+
+## Troubleshooting
+
+### Command not found
+```bash
+# Ensure installation
+pip install -e .
+# Check PATH
+which swarm-benchmark
+```
+
+### Timeout issues
+```bash
+# Increase timeouts for complex tasks
+swarm-benchmark real swarm "Complex task" --timeout 120 --task-timeout 600
+```
+
+### Memory issues
+```bash
+# Limit agents for resource-constrained environments
+swarm-benchmark real swarm "Task" --max-agents 2
+```
+
+## Integration
+
+### CI/CD Pipeline
+```yaml
+# GitHub Actions example
+- name: Run benchmarks
+ run: |
+ cd benchmark
+ pip install -e .
+ swarm-benchmark real swarm "${{ github.event.inputs.task }}" \
+ --output json \
+ --output-dir ./artifacts
+```
+
+### Python API
+```python
+from swarm_benchmark import BenchmarkEngine
+
+engine = BenchmarkEngine(use_real_executor=True)
+result = await engine.run_real_benchmark("Your task here")
+```
+
+## Best Practices
+
+1. **Start small**: Test with simple tasks first
+2. **Monitor resources**: Use --monitor for production runs
+3. **Save results**: Always specify --output-dir
+4. **Use timeouts**: Prevent hanging on complex tasks
+5. **Parallel execution**: Use --parallel for independent tasks
+
+---
+
+For more information, see the [full documentation](README.md).
\ No newline at end of file
diff --git a/benchmark/examples/.claude/checkpoints/1754448738.json b/benchmark/examples/.claude/checkpoints/1754448738.json
new file mode 100644
index 0000000000..256c8271b7
--- /dev/null
+++ b/benchmark/examples/.claude/checkpoints/1754448738.json
@@ -0,0 +1 @@
+{"branch": "checkpoint/pre-edit-20250806-025218", "file": "/workspaces/claude-code-flow/benchmark/examples/quick_test.py", "timestamp": "2025-08-06T02:52:18Z", "type": "pre-edit", "original_branch": "alpha-88"}
diff --git a/benchmark/examples/.claude/checkpoints/1754448741.json b/benchmark/examples/.claude/checkpoints/1754448741.json
new file mode 100644
index 0000000000..aefd1e92c4
--- /dev/null
+++ b/benchmark/examples/.claude/checkpoints/1754448741.json
@@ -0,0 +1 @@
+{"tag": "checkpoint-20250806-025220", "file": "/workspaces/claude-code-flow/benchmark/examples/quick_test.py", "timestamp": "2025-08-06T02:52:21Z", "type": "post-edit", "branch": "alpha-88", "diff_summary": " .claude-flow/metrics/system-metrics.json | 432 +++++++++++++ benchmark/.claude-flow/metrics/performance.json | 2 +- benchmark/.claude-flow/metrics/task-metrics.json | 6 +- .../examples/.claude-flow/metrics/performance.json | 2 +- .../.claude-flow/metrics/task-metrics.json | 6 +- .../examples/.claude/checkpoints/1754448586.json | 1 + .../examples/.claude/checkpoints/1754448587.json | 1 + benchmark/examples/claude_optimizer_example.py | 520 --------------- benchmark/examples/cli/batch_benchmarks.sh | 0 benchmark/examples/cli/cli_examples.sh | 0 benchmark/examples/demo_comprehensive.py | 233 ------- benchmark/examples/demo_mle_star.py | 152 ----- benchmark/examples/demo_real_benchmark.py | 219 ------- benchmark/examples/demos/demo_comprehensive.py | 233 ------- benchmark/examples/demos/demo_mle_star.py | 152 ----- benchmark/examples/demos/demo_real_benchmark.py | 219 ------- benchmark/examples/example_usage.py | 249 -------- benchmark/examples/mle_star_benchmark_example.py | 229 ------- benchmark/examples/optimization_demo.py | 133 ---- benchmark/examples/parallel_benchmark_demo.py | 254 -------- benchmark/examples/quick_test.py | 53 ++ benchmark/examples/real/real_swarm_benchmark.py | 701 ++++----------------- benchmark/examples/real_benchmark_examples.py | 376 ----------- benchmark/examples/real_hive_mind_benchmark.py | 191 ------ benchmark/examples/real_integration_results.json | 78 --- benchmark/examples/real_metrics_demo.py | 238 ------- benchmark/examples/real_sparc_benchmark.py | 228 ------- benchmark/examples/real_swarm_benchmark.py | 146 ----- benchmark/examples/verify_real_integration.py | 408 ------------ .../cli/__pycache__/main.cpython-312.pyc | Bin 21009 -> 22009 bytes .../optimized_benchmark_engine.cpython-312.pyc | Bin 15770 -> 15428 bytes .../__pycache__/engine.cpython-312.pyc | Bin 32449 -> 33620 bytes benchmark/test_optimization_fix.py | 167 ----- .../tests/.claude-flow/metrics/performance.json | 2 +- .../tests/.claude-flow/metrics/task-metrics.json | 6 +- claude-flow-wiki | 0 36 files changed, 629 insertions(+), 5008 deletions(-) "}
diff --git a/benchmark/examples/reports/metrics_edcb3fff-6fe4-432c-ab07-f01483a4cb46.json b/benchmark/examples/reports/metrics_edcb3fff-6fe4-432c-ab07-f01483a4cb46.json
new file mode 100644
index 0000000000..203c302627
--- /dev/null
+++ b/benchmark/examples/reports/metrics_edcb3fff-6fe4-432c-ab07-f01483a4cb46.json
@@ -0,0 +1,66 @@
+{
+ "summary": {
+ "wall_clock_time": 1.3063719272613525,
+ "tasks_per_second": 0.7654787883389201,
+ "success_rate": 1.0,
+ "peak_memory_mb": 0.0,
+ "average_cpu_percent": 0.0
+ },
+ "performance": {
+ "average_duration": 0.0,
+ "median_duration": 0.0,
+ "p95_duration": 0.0,
+ "p99_duration": 0.0,
+ "total_cpu_seconds": 0.0
+ },
+ "resources": {
+ "memory": {
+ "peak_mb": 0.0,
+ "average_mb": 0.0
+ },
+ "cpu": {
+ "average_percent": 0.0,
+ "total_seconds": 0.0
+ },
+ "io": {
+ "disk_read_mb": 0.0,
+ "disk_write_mb": 0.0,
+ "network_sent_mb": 0.0,
+ "network_recv_mb": 0.0
+ }
+ },
+ "processes": {
+ "total": 1,
+ "peak_threads": 0,
+ "peak_fds": 0
+ },
+ "output": {
+ "total_size": 5,
+ "average_size": 5,
+ "complexity_score": 3.8273939416946003
+ },
+ "collectors": {
+ "performance": 1,
+ "resource": 1
+ },
+ "timestamp": "2025-08-06T02:53:11.998590",
+ "process_executions": {
+ "sparc:{\"positional\": [\"orchestrator\", \"echo hello world\"]}": {
+ "command_type": "sparc",
+ "args": {
+ "positional": [
+ "orchestrator",
+ "echo hello world"
+ ]
+ },
+ "execution_count": 1,
+ "success_count": 1,
+ "failure_count": 0,
+ "success_rate": 1.0,
+ "average_duration": 0.30389904975891113,
+ "total_duration": 0.30389904975891113,
+ "average_memory_mb": 42.127604166666664,
+ "peak_memory_mb": 70.16015625
+ }
+ }
+}
\ No newline at end of file
diff --git a/benchmark/examples/reports/process_report_edcb3fff-6fe4-432c-ab07-f01483a4cb46.json b/benchmark/examples/reports/process_report_edcb3fff-6fe4-432c-ab07-f01483a4cb46.json
new file mode 100644
index 0000000000..4c9ec6a90e
--- /dev/null
+++ b/benchmark/examples/reports/process_report_edcb3fff-6fe4-432c-ab07-f01483a4cb46.json
@@ -0,0 +1,47 @@
+{
+ "summary": {
+ "total_executions": 1,
+ "successful_executions": 1,
+ "failed_executions": 0,
+ "overall_success_rate": 1.0,
+ "total_duration": 0.30389904975891113,
+ "average_duration": 0.30389904975891113,
+ "peak_memory_mb": 70.16015625,
+ "average_memory_mb": 42.127604166666664,
+ "total_output_lines": 5,
+ "total_errors": 0
+ },
+ "command_statistics": {
+ "sparc:{\"positional\": [\"orchestrator\", \"echo hello world\"]}": {
+ "command_type": "sparc",
+ "args": {
+ "positional": [
+ "orchestrator",
+ "echo hello world"
+ ]
+ },
+ "execution_count": 1,
+ "success_count": 1,
+ "failure_count": 0,
+ "success_rate": 1.0,
+ "average_duration": 0.30389904975891113,
+ "total_duration": 0.30389904975891113,
+ "average_memory_mb": 42.127604166666664,
+ "peak_memory_mb": 70.16015625
+ }
+ },
+ "executions": [
+ {
+ "command": "claude-flow sparc orchestrator echo hello world",
+ "exit_code": 0,
+ "success": true,
+ "duration": 0.30389904975891113,
+ "start_time": 1754448788.6899831,
+ "output_size": 5,
+ "error_count": 0,
+ "cpu_percent": 99.33333333333333,
+ "memory_mb": 42.127604166666664,
+ "peak_memory_mb": 70.16015625
+ }
+ ]
+}
\ No newline at end of file
diff --git a/benchmark/examples/reports/real-benchmark-auto-centralized_edcb3fff-6fe4-432c-ab07-f01483a4cb46.json b/benchmark/examples/reports/real-benchmark-auto-centralized_edcb3fff-6fe4-432c-ab07-f01483a4cb46.json
new file mode 100644
index 0000000000..eb7a166fdc
--- /dev/null
+++ b/benchmark/examples/reports/real-benchmark-auto-centralized_edcb3fff-6fe4-432c-ab07-f01483a4cb46.json
@@ -0,0 +1,136 @@
+{
+ "id": "edcb3fff-6fe4-432c-ab07-f01483a4cb46",
+ "name": "real-benchmark-auto-centralized",
+ "description": "Real Benchmark: echo hello world",
+ "status": "completed",
+ "config": {
+ "name": "real-benchmark-auto-centralized",
+ "description": "Real Benchmark: echo hello world",
+ "strategy": "auto",
+ "mode": "centralized",
+ "max_agents": 1,
+ "max_tasks": 100,
+ "timeout": 600,
+ "task_timeout": 300,
+ "max_retries": 3,
+ "parallel": false,
+ "background": false,
+ "monitoring": false,
+ "quality_threshold": 0.8,
+ "resource_limits": {
+ "max_memory_mb": 1024,
+ "max_cpu_percent": 80,
+ "max_network_mbps": 100
+ },
+ "output_formats": [
+ "json"
+ ],
+ "output_directory": "./reports",
+ "verbose": false
+ },
+ "tasks": [
+ {
+ "id": "24608454-1526-4f3d-9d6e-3b5d493bd120",
+ "objective": "echo hello world",
+ "description": "Benchmark task: echo hello world",
+ "strategy": "auto",
+ "mode": "centralized",
+ "parameters": {},
+ "timeout": 300,
+ "max_retries": 3,
+ "priority": 1,
+ "status": "pending",
+ "created_at": "2025-08-06T02:53:08.689381",
+ "started_at": null,
+ "completed_at": null,
+ "duration": null,
+ "assigned_agents": [],
+ "parent_task_id": null,
+ "subtasks": [],
+ "dependencies": []
+ }
+ ],
+ "results": [
+ {
+ "id": "e9a49bfd-f7cd-4ceb-9ff1-2ca93c450cb3",
+ "task_id": "24608454-1526-4f3d-9d6e-3b5d493bd120",
+ "agent_id": "claude-flow",
+ "status": "success",
+ "output": {
+ "raw_output": "\u274c SPARC configuration file (.roomodes) not found\nPlease ensure .roomodes file exists in: /workspaces/claude-code-flow/benchmark/examples\n\nTo enable SPARC development modes, run:\n npx claude-flow@latest init --sparc",
+ "lines": [
+ "\u274c SPARC configuration file (.roomodes) not found",
+ "Please ensure .roomodes file exists in: /workspaces/claude-code-flow/benchmark/examples",
+ "",
+ "To enable SPARC development modes, run:",
+ " npx claude-flow@latest init --sparc"
+ ],
+ "sections": {}
+ },
+ "errors": [],
+ "warnings": [],
+ "performance_metrics": {
+ "execution_time": 0.2679762840270996,
+ "queue_time": 0.0,
+ "throughput": 3.7316735084619395,
+ "success_rate": 1.0,
+ "error_rate": 0.0,
+ "retry_count": 0,
+ "coordination_overhead": 0.0,
+ "communication_latency": 0.0
+ },
+ "quality_metrics": {
+ "accuracy_score": 1.0,
+ "completeness_score": 1.0,
+ "consistency_score": 0.0,
+ "relevance_score": 0.0,
+ "overall_quality": 1.0,
+ "review_score": null,
+ "automated_score": null
+ },
+ "resource_usage": {
+ "cpu_percent": 99.33333333333333,
+ "memory_mb": 42.127604166666664,
+ "network_bytes_sent": 0,
+ "network_bytes_recv": 0,
+ "disk_bytes_read": 0,
+ "disk_bytes_write": 0,
+ "peak_memory_mb": 70.16015625,
+ "average_cpu_percent": 99.33333333333333
+ },
+ "execution_details": {
+ "command": "claude-flow sparc orchestrator echo hello world",
+ "exit_code": 0,
+ "output_lines": 5,
+ "error_count": 0
+ },
+ "created_at": "2025-08-06T02:53:08.994341",
+ "started_at": "2025-08-06T02:53:08.689983",
+ "completed_at": "2025-08-06T02:53:08.993882",
+ "duration": 0.303899
+ }
+ ],
+ "metrics": {
+ "total_tasks": 1,
+ "completed_tasks": 1,
+ "failed_tasks": 0,
+ "total_agents": 0,
+ "active_agents": 0,
+ "average_execution_time": 0.0,
+ "total_execution_time": 1.3063719272613525,
+ "success_rate": 1.0,
+ "throughput": 0.7654787883389201,
+ "resource_efficiency": 0.0,
+ "coordination_efficiency": 1.0,
+ "quality_score": 0.0,
+ "peak_memory_usage": 0.0,
+ "total_cpu_time": 0.0,
+ "network_overhead": 0.0
+ },
+ "created_at": "2025-08-06T02:53:08.689408",
+ "started_at": "2025-08-06T02:53:08.689413",
+ "completed_at": "2025-08-06T02:53:08.994361",
+ "duration": 0.304948,
+ "error_log": [],
+ "metadata": {}
+}
\ No newline at end of file