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

rUvd9c30deac328
diff --git a/benchmark/.claude/checkpoints/1754575586.json b/benchmark/.claude/checkpoints/1754575586.json
new file mode 100644
index 0000000000..9a9dd6dc3f
--- /dev/null
+++ b/benchmark/.claude/checkpoints/1754575586.json
@@ -0,0 +1 @@
+{"branch": "checkpoint/pre-edit-20250807-140626", "file": "/workspaces/claude-code-flow/benchmark/src/swarm_benchmark/swe_bench/official_integration.py", "timestamp": "2025-08-07T14:06:26Z", "type": "pre-edit", "original_branch": "swe-bench"}
diff --git a/benchmark/.claude/checkpoints/1754575588.json b/benchmark/.claude/checkpoints/1754575588.json
new file mode 100644
index 0000000000..e1153f9b5c
--- /dev/null
+++ b/benchmark/.claude/checkpoints/1754575588.json
@@ -0,0 +1 @@
+{"tag": "checkpoint-20250807-140628", "file": "/workspaces/claude-code-flow/benchmark/src/swarm_benchmark/swe_bench/official_integration.py", "timestamp": "2025-08-07T14:06:28Z", "type": "post-edit", "branch": "swe-bench", "diff_summary": " .claude-flow/metrics/system-metrics.json | 12 ++++++++++++ benchmark/.claude-flow/metrics/performance.json | 2 +- benchmark/.claude-flow/metrics/task-metrics.json | 6 +++--- benchmark/.claude/checkpoints/task-1754575556.json | 1 + .../src/swarm_benchmark/swe_bench/official_integration.py | 13 ++++++++++--- 5 files changed, 27 insertions(+), 7 deletions(-) "}
diff --git a/benchmark/run_real_swe_bench.py b/benchmark/run_real_swe_bench.py
new file mode 100644
index 0000000000..3323f23624
--- /dev/null
+++ b/benchmark/run_real_swe_bench.py
@@ -0,0 +1,174 @@
+#!/usr/bin/env python3
+"""
+Run REAL SWE-bench evaluation with actual claude-flow commands.
+This generates actual code fixes for real GitHub issues.
+"""
+
+import asyncio
+import sys
+import json
+from pathlib import Path
+
+# Add src to path
+sys.path.insert(0, str(Path(__file__).parent / "src"))
+
+from swarm_benchmark.swe_bench.official_integration import OfficialSWEBenchEngine
+from swarm_benchmark.core.models import BenchmarkConfig, StrategyType, CoordinationMode
+
+
+async def run_real_swe_bench():
+ """Run real SWE-bench with actual claude-flow execution."""
+
+ print("""
+╔══════════════════════════════════════════════════════════════╗
+β•‘ REAL SWE-Bench Evaluation β•‘
+β•‘ Using Claude Flow to Generate Actual Fixes β•‘
+β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•
+""")
+
+ # Use the optimal configuration we found
+ config = BenchmarkConfig(
+ name="Real-SWE-bench",
+ description="Real SWE-bench evaluation with code generation",
+ strategy=StrategyType.OPTIMIZATION, # Best for bug fixes
+ mode=CoordinationMode.MESH, # Best performance
+ max_agents=8, # Optimal agent count
+ task_timeout=180, # 3 minutes per instance
+ output_directory="benchmark/swe-bench-official/real-results"
+ )
+
+ print(f"Configuration:")
+ print(f" Mode: {config.mode.value}")
+ print(f" Strategy: {config.strategy.value}")
+ print(f" Agents: {config.max_agents}")
+ print(f" Timeout: {config.task_timeout}s per instance")
+ print()
+
+ # Initialize engine
+ engine = OfficialSWEBenchEngine(config)
+
+ # Load dataset
+ print("πŸ“₯ Loading SWE-bench-Lite dataset...")
+ if not await engine.load_dataset(use_lite=True):
+ print("❌ Failed to load dataset")
+ return
+
+ print(f"βœ… Loaded {len(engine.dataset)} instances")
+
+ # Select a few specific instances to test
+ # These are real GitHub issues that need fixing
+ test_instances = [
+ # Start with simpler instances
+ "django__django-11099", # Django issue
+ "sympy__sympy-13437", # SymPy math library
+ "matplotlib__matplotlib-23299", # Matplotlib plotting
+ ]
+
+ print(f"\nπŸ”§ Testing on {len(test_instances)} selected instances:")
+ for inst_id in test_instances:
+ print(f" - {inst_id}")
+
+ # Filter dataset to our test instances
+ selected = []
+ for instance in engine.dataset:
+ if instance["instance_id"] in test_instances:
+ selected.append(instance)
+ if len(selected) == len(test_instances):
+ break
+
+ if not selected:
+ # If specific instances not found, just use first 3
+ selected = list(engine.dataset)[:3]
+ print("\n⚠️ Using first 3 instances instead")
+
+ print("\n" + "="*60)
+ print("Starting Real Evaluation")
+ print("="*60)
+
+ results = []
+ for i, instance in enumerate(selected, 1):
+ print(f"\nπŸ“ [{i}/{len(selected)}] Processing: {instance['instance_id']}")
+ print(f" Repository: {instance['repo']}")
+ print(f" Problem: {instance['problem_statement'][:100]}...")
+
+ # Run claude-flow to generate fix
+ result = await engine.run_instance(instance)
+ results.append(result)
+
+ if result["success"] and result["patch"]:
+ print(f" βœ… Generated patch ({len(result['patch'])} chars)")
+ print(f" ⏱️ Duration: {result['duration']:.1f}s")
+
+ # Show first few lines of patch
+ patch_lines = result['patch'].split('\n')[:5]
+ for line in patch_lines:
+ print(f" {line}")
+ if len(result['patch'].split('\n')) > 5:
+ print(f" ... ({len(result['patch'].split('\n'))} total lines)")
+ else:
+ print(f" ❌ Failed: {result.get('error', 'No patch generated')}")
+
+ # Calculate metrics
+ successful = sum(1 for r in results if r["success"])
+ total = len(results)
+ success_rate = successful / total if total > 0 else 0
+ avg_duration = sum(r["duration"] for r in results) / total if total > 0 else 0
+
+ print("\n" + "="*60)
+ print("πŸ“Š RESULTS")
+ print("="*60)
+ print(f"Success Rate: {success_rate:.1%} ({successful}/{total})")
+ print(f"Average Duration: {avg_duration:.1f}s")
+
+ # Save predictions
+ if engine.predictions:
+ predictions_file = Path(config.output_directory) / "predictions.json"
+ predictions_file.parent.mkdir(parents=True, exist_ok=True)
+
+ with open(predictions_file, 'w') as f:
+ json.dump(engine.predictions, f, indent=2)
+
+ print(f"\nπŸ’Ύ Predictions saved to: {predictions_file}")
+
+ # Validate format
+ is_valid = await engine.validate_submission(str(predictions_file))
+ if is_valid:
+ print("βœ… Submission format is valid for leaderboard!")
+ else:
+ print("⚠️ Submission format needs adjustment")
+
+ # Show next steps
+ print("\nπŸ“‹ Next Steps:")
+ print("1. Review generated patches in predictions.json")
+ print("2. Run full evaluation: swarm-bench swe-bench official")
+ print("3. Submit to leaderboard: https://www.swebench.com/submit")
+
+ # Save detailed report
+ report = {
+ "config": {
+ "mode": config.mode.value,
+ "strategy": config.strategy.value,
+ "agents": config.max_agents
+ },
+ "results": results,
+ "metrics": {
+ "success_rate": success_rate,
+ "avg_duration": avg_duration,
+ "successful": successful,
+ "total": total
+ }
+ }
+
+ report_file = Path(config.output_directory) / "evaluation_report.json"
+ with open(report_file, 'w') as f:
+ json.dump(report, f, indent=2)
+
+ print(f"\nπŸ“ Detailed report: {report_file}")
+
+
+if __name__ == "__main__":
+ print("πŸš€ Starting Real SWE-bench Evaluation")
+ print("This will use claude-flow to generate actual code fixes")
+ print()
+
+ asyncio.run(run_real_swe_bench())
\ No newline at end of file