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/test_real_integration.py

rUv3f64f80f40bc
diff --git a/benchmark/.claude/checkpoints/1754447010.json b/benchmark/.claude/checkpoints/1754447010.json
new file mode 100644
index 0000000000..c14fac6a5c
--- /dev/null
+++ b/benchmark/.claude/checkpoints/1754447010.json
@@ -0,0 +1 @@
+{"branch": "checkpoint/pre-edit-20250806-022330", "file": "/workspaces/claude-code-flow/benchmark/tests/integration/test_real_claude_flow_integration.py", "timestamp": "2025-08-06T02:23:30Z", "type": "pre-edit", "original_branch": "alpha-88"}
diff --git a/benchmark/.claude/checkpoints/1754447012.json b/benchmark/.claude/checkpoints/1754447012.json
new file mode 100644
index 0000000000..54f2cb362f
--- /dev/null
+++ b/benchmark/.claude/checkpoints/1754447012.json
@@ -0,0 +1 @@
+{"tag": "checkpoint-20250806-022332", "file": "/workspaces/claude-code-flow/benchmark/tests/integration/test_real_claude_flow_integration.py", "timestamp": "2025-08-06T02:23:32Z", "type": "post-edit", "branch": "alpha-88", "diff_summary": " .claude-flow/metrics/system-metrics.json | 204 +++++ benchmark/.claude-flow/metrics/performance.json | 2 +- benchmark/.claude-flow/metrics/system-metrics.json | 26 +- benchmark/.claude-flow/metrics/task-metrics.json | 6 +- benchmark/.claude/checkpoints/1754447000.json | 1 + benchmark/.claude/checkpoints/1754447002.json | 1 + benchmark/ci_performance_integration.py | 754 ----------------- benchmark/compare_optimizations.py | 172 ---- benchmark/continuous_performance_monitor.py | 673 --------------- benchmark/demo_comprehensive.py | 233 ----- benchmark/demo_mle_star.py | 152 ---- benchmark/demo_real_benchmark.py | 219 ----- benchmark/example_usage.py | 249 ------ benchmark/examples/real_hive_mind_benchmark.py | 0 benchmark/examples/real_sparc_benchmark.py | 0 benchmark/examples/real_swarm_benchmark.py | 0 benchmark/hello_world.py | 21 - benchmark/hive-mind-load-test.py | 902 -------------------- benchmark/hive-mind-stress-test.py | 935 --------------------- benchmark/mle_star_benchmark_example.py | 229 ----- benchmark/performance_dashboard.py | 769 ----------------- benchmark/quick_test_integration.py | 44 - benchmark/run-load-tests.py | 479 ----------- benchmark/run_performance_tests.py | 550 ------------ benchmark/run_real_benchmarks.py | 0 benchmark/simple-load-test.py | 322 ------- .../__pycache__/benchmark_engine.cpython-312.pyc | Bin 7620 -> 8413 bytes .../src/swarm_benchmark/core/benchmark_engine.py | 122 ++- benchmark/swarm_performance_suite.py | 840 ------------------ benchmark/test_claude_optimizer.py | 235 ------ benchmark/test_hello_world.py | 33 - benchmark/test_integration.py | 274 ------ benchmark/test_mle_star_integration.py | 225 ----- benchmark/test_real_benchmark_engine.py | 317 ------- benchmark/test_real_benchmarks.py | 0 benchmark/test_real_claude_flow.py | 218 ----- benchmark/test_real_metrics.py | 128 --- benchmark/test_real_simple.py | 104 --- benchmark/test_simple_run.py | 35 - .../conftest.cpython-312-pytest-8.4.0.pyc | Bin 22406 -> 22448 bytes .../tests/integration/quick_test_integration.py | 2 +- .../tests/integration/test_claude_optimizer.py | 2 +- benchmark/tests/integration/test_integration.py | 2 +- .../tests/integration/test_mle_star_integration.py | 4 +- .../integration/test_real_benchmark_engine.py | 4 +- .../tests/integration/test_real_claude_flow.py | 2 +- .../test_real_claude_flow_integration.py | 3 +- benchmark/tests/integration/test_real_metrics.py | 2 +- benchmark/tests/integration/test_simple_run.py | 2 +- claude-flow-wiki | 0 50 files changed, 362 insertions(+), 9135 deletions(-) "}
diff --git a/benchmark/examples/.claude-flow/metrics/agent-metrics.json b/benchmark/examples/.claude-flow/metrics/agent-metrics.json
new file mode 100644
index 0000000000..9e26dfeeb6
--- /dev/null
+++ b/benchmark/examples/.claude-flow/metrics/agent-metrics.json
@@ -0,0 +1 @@
+{}
\ No newline at end of file
diff --git a/benchmark/examples/.claude-flow/metrics/performance.json b/benchmark/examples/.claude-flow/metrics/performance.json
new file mode 100644
index 0000000000..bbb2224c45
--- /dev/null
+++ b/benchmark/examples/.claude-flow/metrics/performance.json
@@ -0,0 +1,9 @@
+{
+ "startTime": 1754447041800,
+ "totalTasks": 1,
+ "successfulTasks": 1,
+ "failedTasks": 0,
+ "totalAgents": 0,
+ "activeAgents": 0,
+ "neuralEvents": 0
+}
\ No newline at end of file
diff --git a/benchmark/examples/.claude-flow/metrics/task-metrics.json b/benchmark/examples/.claude-flow/metrics/task-metrics.json
new file mode 100644
index 0000000000..b0336a9123
--- /dev/null
+++ b/benchmark/examples/.claude-flow/metrics/task-metrics.json
@@ -0,0 +1,10 @@
+[
+ {
+ "id": "cmd-hooks-1754447041910",
+ "type": "hooks",
+ "success": true,
+ "duration": 10.26506599999999,
+ "timestamp": 1754447041920,
+ "metadata": {}
+ }
+]
\ No newline at end of file
diff --git a/benchmark/examples/real_integration_results.json b/benchmark/examples/real_integration_results.json
new file mode 100644
index 0000000000..bd594bda42
--- /dev/null
+++ b/benchmark/examples/real_integration_results.json
@@ -0,0 +1,78 @@
+{
+ "timestamp": 1754447040.1255798,
+ "verification_results": [
+ {
+ "test_name": "Version Check",
+ "success": true,
+ "duration": 0.002352476119995117,
+ "command": "/workspaces/claude-code-flow/bin/claude-flow --version",
+ "json_responses_count": 0,
+ "metrics": {
+ "output_lines": 2,
+ "error_lines": 1,
+ "json_responses_count": 0,
+ "agents_detected": 0,
+ "tasks_detected": 0,
+ "errors_detected": 0,
+ "memory_operations": 0,
+ "response_types": {}
+ }
+ },
+ {
+ "test_name": "Help Command",
+ "success": true,
+ "duration": 0.30375146865844727,
+ "command": "/workspaces/claude-code-flow/bin/claude-flow --help",
+ "json_responses_count": 1,
+ "metrics": {
+ "output_lines": 83,
+ "error_lines": 1,
+ "json_responses_count": 1,
+ "agents_detected": 1,
+ "tasks_detected": 0,
+ "errors_detected": 0,
+ "memory_operations": 0,
+ "response_types": {
+ "structured_output": 1
+ }
+ }
+ },
+ {
+ "test_name": "Simple Swarm",
+ "success": false,
+ "duration": 20.00809097290039,
+ "command": "/workspaces/claude-code-flow/bin/claude-flow swarm echo 'Hello World' --non-interactive --timeout 10",
+ "json_responses_count": 9,
+ "metrics": {
+ "output_lines": 19,
+ "error_lines": 1,
+ "json_responses_count": 9,
+ "agents_detected": 5,
+ "tasks_detected": 0,
+ "errors_detected": 1,
+ "memory_operations": 3,
+ "response_types": {
+ "system": 1,
+ "assistant": 8
+ }
+ }
+ },
+ {
+ "test_name": "SPARC Coder Mode",
+ "success": true,
+ "duration": 0.29969286918640137,
+ "command": "/workspaces/claude-code-flow/bin/claude-flow sparc coder print('Hello from SPARC') --non-interactive --timeout 15",
+ "json_responses_count": 0,
+ "metrics": {
+ "output_lines": 6,
+ "error_lines": 1,
+ "json_responses_count": 0,
+ "agents_detected": 0,
+ "tasks_detected": 0,
+ "errors_detected": 0,
+ "memory_operations": 0,
+ "response_types": {}
+ }
+ }
+ ]
+}
\ No newline at end of file
diff --git a/benchmark/test_real_integration.py b/benchmark/test_real_integration.py
new file mode 100644
index 0000000000..967e95b580
--- /dev/null
+++ b/benchmark/test_real_integration.py
@@ -0,0 +1,225 @@
+#!/usr/bin/env python3
+"""
+Test script for real Claude Flow integration.
+
+This script tests the RealClaudeFlowExecutor to ensure it can execute
+actual ./claude-flow commands and parse the results properly.
+"""
+
+import asyncio
+import logging
+import sys
+from pathlib import Path
+
+# Add src to path
+sys.path.insert(0, str(Path(__file__).parent / "src"))
+
+from swarm_benchmark.core.claude_flow_real_executor import (
+ RealClaudeFlowExecutor,
+ SwarmCommand,
+ HiveMindCommand,
+ SparcCommand,
+ execute_swarm_benchmark
+)
+from swarm_benchmark.core.real_benchmark_engine_v2 import RealBenchmarkEngine
+
+# Configure logging
+logging.basicConfig(
+ level=logging.INFO,
+ format='%(asctime)s - %(name)s - %(levelname)s - %(message)s'
+)
+logger = logging.getLogger(__name__)
+
+
+async def test_real_executor():
+ """Test the real Claude Flow executor."""
+ logger.info("=" * 60)
+ logger.info("TESTING REAL CLAUDE FLOW EXECUTOR")
+ logger.info("=" * 60)
+
+ try:
+ # Initialize executor
+ executor = RealClaudeFlowExecutor()
+
+ # Test installation validation
+ logger.info("Testing installation validation...")
+ is_valid = executor.validate_installation()
+ logger.info(f"Installation valid: {is_valid}")
+
+ if not is_valid:
+ logger.warning("Claude Flow installation not found or invalid")
+ logger.info("Continuing with tests anyway...")
+
+ # Test available modes
+ logger.info("Getting available modes...")
+ modes = executor.get_available_modes()
+ logger.info(f"Available modes: {modes}")
+
+ # Test simple swarm command
+ logger.info("\nTesting simple swarm command...")
+ swarm_config = SwarmCommand(
+ objective="Create a simple hello world function",
+ strategy="development",
+ mode="centralized",
+ max_agents=3,
+ timeout=5 # 5 minute timeout for testing
+ )
+
+ result = await executor.execute_swarm_async(swarm_config)
+
+ logger.info("Swarm execution completed!")
+ logger.info(f"Success: {result.success}")
+ logger.info(f"Exit code: {result.exit_code}")
+ logger.info(f"Duration: {result.duration:.2f}s")
+ logger.info(f"Tokens: {result.input_tokens} input, {result.output_tokens} output")
+ logger.info(f"Agents spawned: {result.agents_spawned}")
+ logger.info(f"Tasks completed: {result.tasks_completed}")
+ logger.info(f"Tool calls: {len(result.tool_calls)}")
+ logger.info(f"Errors: {len(result.errors)}")
+ logger.info(f"Warnings: {len(result.warnings)}")
+
+ if result.stdout_lines:
+ logger.info(f"First few stdout lines:")
+ for line in result.stdout_lines[:5]:
+ logger.info(f" {line}")
+
+ if result.stderr_lines:
+ logger.info(f"Stderr lines:")
+ for line in result.stderr_lines[:3]:
+ logger.info(f" {line}")
+
+ if result.errors:
+ logger.info(f"Errors encountered:")
+ for error in result.errors[:3]:
+ logger.info(f" {error}")
+
+ return result
+
+ except Exception as e:
+ logger.error(f"Test failed: {e}")
+ import traceback
+ traceback.print_exc()
+ return None
+
+
+async def test_real_benchmark_engine():
+ """Test the real benchmark engine."""
+ logger.info("\n" + "=" * 60)
+ logger.info("TESTING REAL BENCHMARK ENGINE")
+ logger.info("=" * 60)
+
+ try:
+ # Initialize engine
+ engine = RealBenchmarkEngine()
+
+ # Test simple benchmark
+ logger.info("Running simple swarm benchmark...")
+ result = await engine.run_swarm_benchmark(
+ objective="Write a Python function that calculates fibonacci numbers",
+ strategy="development",
+ mode="centralized",
+ max_agents=3,
+ timeout=5
+ )
+
+ logger.info("Benchmark completed!")
+ logger.info(f"Benchmark ID: {result.benchmark_id}")
+ logger.info(f"Success: {result.success}")
+ logger.info(f"Duration: {result.duration:.2f}s")
+ logger.info(f"Total tokens: {result.total_tokens}")
+ logger.info(f"Agents spawned: {result.agents_spawned}")
+
+ # Test engine statistics
+ stats = engine.get_summary_stats()
+ logger.info(f"Engine stats: {stats}")
+
+ return result
+
+ except Exception as e:
+ logger.error(f"Benchmark engine test failed: {e}")
+ import traceback
+ traceback.print_exc()
+ return None
+
+
+async def test_convenience_functions():
+ """Test convenience functions."""
+ logger.info("\n" + "=" * 60)
+ logger.info("TESTING CONVENIENCE FUNCTIONS")
+ logger.info("=" * 60)
+
+ try:
+ # Test convenience function
+ logger.info("Testing convenience function...")
+ result = await execute_swarm_benchmark(
+ objective="Generate a simple test case",
+ strategy="testing",
+ mode="centralized",
+ max_agents=2,
+ timeout=3
+ )
+
+ logger.info("Convenience function test completed!")
+ logger.info(f"Success: {result.success}")
+ logger.info(f"Duration: {result.duration:.2f}s")
+
+ return result
+
+ except Exception as e:
+ logger.error(f"Convenience function test failed: {e}")
+ import traceback
+ traceback.print_exc()
+ return None
+
+
+async def main():
+ """Run all tests."""
+ logger.info("Starting Real Claude Flow Integration Tests")
+ logger.info(f"Working directory: {Path.cwd()}")
+
+ # Check if claude-flow exists
+ claude_flow_path = Path.cwd() / "claude-flow"
+ if not claude_flow_path.exists():
+ logger.warning(f"claude-flow not found at {claude_flow_path}")
+ logger.info("Tests will show how the system handles missing executable")
+
+ results = []
+
+ # Test 1: Real executor
+ logger.info("\n🔧 Test 1: Real Executor")
+ result1 = await test_real_executor()
+ results.append(("Real Executor", result1 is not None))
+
+ # Test 2: Real benchmark engine
+ logger.info("\n🏗️ Test 2: Real Benchmark Engine")
+ result2 = await test_real_benchmark_engine()
+ results.append(("Real Benchmark Engine", result2 is not None))
+
+ # Test 3: Convenience functions
+ logger.info("\n⚡ Test 3: Convenience Functions")
+ result3 = await test_convenience_functions()
+ results.append(("Convenience Functions", result3 is not None))
+
+ # Summary
+ logger.info("\n" + "=" * 60)
+ logger.info("TEST SUMMARY")
+ logger.info("=" * 60)
+
+ for test_name, success in results:
+ status = "✅ PASS" if success else "❌ FAIL"
+ logger.info(f"{status} {test_name}")
+
+ total_passed = sum(1 for _, success in results if success)
+ logger.info(f"\nTotal: {total_passed}/{len(results)} tests passed")
+
+ if total_passed == len(results):
+ logger.info("🎉 All tests passed! Real Claude Flow integration is working!")
+ else:
+ logger.info("⚠️ Some tests failed. Check logs for details.")
+
+ return total_passed == len(results)
+
+
+if __name__ == "__main__":
+ success = asyncio.run(main())
+ sys.exit(0 if success else 1)
\ No newline at end of file