π 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: Edit /workspaces/claude-code-flow/benchmark/src/swarm_benchmark/cli/swe_bench_command.py
rUv864b28b39c12
diff --git a/.claude/checkpoints/1754573928.json b/.claude/checkpoints/1754573928.jsonnew file mode 100644index 0000000000..b56ba36e23--- /dev/null+++ b/.claude/checkpoints/1754573928.json@@ -0,0 +1 @@+{"branch": "checkpoint/pre-edit-20250807-133848", "file": "/workspaces/claude-code-flow/benchmark/src/swarm_benchmark/swe_bench/optimizer.py", "timestamp": "2025-08-07T13:38:48Z", "type": "pre-edit", "original_branch": "swe-bench"}diff --git a/.claude/checkpoints/1754573930.json b/.claude/checkpoints/1754573930.jsonnew file mode 100644index 0000000000..7e6858d5a0--- /dev/null+++ b/.claude/checkpoints/1754573930.json@@ -0,0 +1 @@+{"tag": "checkpoint-20250807-133850", "file": "/workspaces/claude-code-flow/benchmark/src/swarm_benchmark/swe_bench/optimizer.py", "timestamp": "2025-08-07T13:38:50Z", "type": "post-edit", "branch": "swe-bench", "diff_summary": " .claude-flow/metrics/performance.json | 2 +- .claude-flow/metrics/system-metrics.json | 264 +++++ .claude-flow/metrics/task-metrics.json | 6 +- .claude/checkpoints/1754573779.json | 1 + .claude/checkpoints/1754573781.json | 1 + .../src/swarm_benchmark/swe_bench/optimizer.py | 1013 ++++++++++++++++++++ 6 files changed, 1283 insertions(+), 4 deletions(-) "}diff --git a/benchmark/src/swarm_benchmark/cli/swe_bench_command.py b/benchmark/src/swarm_benchmark/cli/swe_bench_command.pynew file mode 100644index 0000000000..836cd57fff--- /dev/null+++ b/benchmark/src/swarm_benchmark/cli/swe_bench_command.py@@ -0,0 +1,177 @@+"""SWE-Bench CLI command integration."""++import click+import asyncio+import json+from pathlib import Path+from typing import Optional++from ..swe_bench import SWEBenchEngine+from ..core.models import BenchmarkConfig, StrategyType, CoordinationMode++[email protected]_context+def swe_bench(ctx):+ """Run SWE-Bench software engineering benchmarks."""+ ctx.ensure_object(dict)+++@swe_bench.command()[email protected]('--categories', '-c', multiple=True, help='Categories to test')[email protected]('--difficulty', '-d', type=click.Choice(['easy', 'medium', 'hard']), help='Difficulty level')[email protected]('--strategy', '-s', type=click.Choice(['development', 'optimization', 'testing', 'analysis']),+ default='development', help='Execution strategy')[email protected]('--mode', '-m', type=click.Choice(['hierarchical', 'mesh', 'distributed', 'centralized']),+ default='hierarchical', help='Coordination mode')[email protected]('--agents', '-a', type=int, default=5, help='Maximum number of agents')[email protected]('--optimize', '-o', is_flag=True, help='Enable optimization iterations')[email protected]('--iterations', '-i', type=int, default=1, help='Number of iterations')[email protected]('--output', '-o', type=click.Path(), help='Output directory for reports')[email protected]_context+def run(ctx, categories, difficulty, strategy, mode, agents, optimize, iterations, output):+ """Run SWE-Bench benchmark suite."""++ # Create configuration+ config = BenchmarkConfig(+ name="SWE-Bench",+ description="Software Engineering Benchmark",+ strategy=StrategyType[strategy.upper()],+ mode=CoordinationMode[mode.upper()],+ max_agents=agents,+ output_directory=output or "benchmark/swe-bench/reports"+ )++ # Initialize engine+ engine = SWEBenchEngine(config)++ # Convert categories tuple to list+ category_list = list(categories) if categories else None++ # Run benchmark+ click.echo(f"\nπ Starting SWE-Bench with {iterations} iteration(s)")+ click.echo(f" Strategy: {strategy}, Mode: {mode}, Agents: {agents}")++ if category_list:+ click.echo(f" Categories: {', '.join(category_list)}")+ if difficulty:+ click.echo(f" Difficulty: {difficulty}")++ results = asyncio.run(engine.run_swe_benchmark(+ categories=category_list,+ difficulty=difficulty,+ optimize=optimize,+ iterations=iterations+ ))++ # Display summary+ summary = results.get('summary', {})+ final_perf = summary.get('final_performance', {})++ click.echo("\nπ SWE-Bench Results:")+ click.echo(f" Success Rate: {final_perf.get('success_rate', 0):.1%}")+ click.echo(f" Average Duration: {final_perf.get('average_duration', 0):.2f}s")+ click.echo(f" Total Tasks: {final_perf.get('total_tasks', 0)}")++ if optimize and summary.get('improvement'):+ imp = summary['improvement']+ click.echo(f"\nπ Optimization Impact:")+ click.echo(f" Success Rate Change: {imp.get('success_rate_change', 0):+.1%}")+ click.echo(f" Duration Change: {imp.get('duration_change', 0):+.2f}s")++ click.echo(f"\nβ Report saved to {config.output_directory}")+++@swe_bench.command()[email protected]('--output', '-o', type=click.Path(), help='Output directory')[email protected]_context+def status(ctx, output):+ """Show current SWE-Bench status and recent results."""++ output_dir = Path(output or "benchmark/swe-bench/reports")++ if not output_dir.exists():+ click.echo("No SWE-Bench results found.")+ return++ # Find most recent report+ reports = list(output_dir.glob("swe_bench_report_*.json"))++ if not reports:+ click.echo("No SWE-Bench reports found.")+ return++ latest = max(reports, key=lambda p: p.stat().st_mtime)++ with open(latest) as f:+ data = json.load(f)++ click.echo(f"\nπ Latest SWE-Bench Results ({latest.name}):")+ click.echo(f" Timestamp: {data.get('timestamp', 'Unknown')}")++ summary = data.get('summary', {})+ final_perf = summary.get('final_performance', {})++ click.echo(f"\n Performance:")+ click.echo(f" - Success Rate: {final_perf.get('success_rate', 0):.1%}")+ click.echo(f" - Tasks Completed: {final_perf.get('successful_tasks', 0)}/{final_perf.get('total_tasks', 0)}")+ click.echo(f" - Average Duration: {final_perf.get('average_duration', 0):.2f}s")++ if summary.get('improvement'):+ imp = summary['improvement']+ click.echo(f"\n Optimization Results:")+ click.echo(f" - Success Rate Improved: {imp.get('success_rate_change', 0):+.1%}")+ click.echo(f" - Speed Change: {imp.get('duration_change', 0):+.2f}s")+ click.echo(f" - Optimization Effective: {'β ' if imp.get('optimization_effective') else 'β'}")+++@swe_bench.command()[email protected]('--target-success', '-s', type=float, default=0.8, help='Target success rate')[email protected]('--target-duration', '-d', type=float, default=15.0, help='Target average duration')[email protected]('--max-iterations', '-i', type=int, default=10, help='Maximum optimization iterations')[email protected]('--output', '-o', type=click.Path(), help='Output directory')[email protected]_context+def optimize(ctx, target_success, target_duration, max_iterations, output):+ """Run automated optimization to achieve target metrics."""++ from ..swe_bench.optimizer import SWEBenchOptimizer++ click.echo(f"\nπ§ Starting SWE-Bench Optimization")+ click.echo(f" Target Success Rate: {target_success:.1%}")+ click.echo(f" Target Duration: {target_duration}s")+ click.echo(f" Max Iterations: {max_iterations}")++ # Initialize optimizer+ optimizer = SWEBenchOptimizer()++ # Run auto-tuning+ config = optimizer.auto_tune(+ target_metrics={+ 'success_rate': target_success,+ 'average_duration': target_duration+ },+ max_iterations=max_iterations+ )++ click.echo(f"\nβ Optimization Complete!")+ click.echo(f" Optimal Configuration:")+ click.echo(f" - Strategy: {config.strategy.value}")+ click.echo(f" - Mode: {config.mode.value}")+ click.echo(f" - Max Agents: {config.max_agents}")+ click.echo(f" - Task Timeout: {config.task_timeout}s")++ # Save configuration+ output_dir = Path(output or "benchmark/swe-bench/configs")+ output_dir.mkdir(parents=True, exist_ok=True)++ config_path = output_dir / "optimized_config.json"+ with open(config_path, 'w') as f:+ json.dump({+ 'strategy': config.strategy.value,+ 'mode': config.mode.value,+ 'max_agents': config.max_agents,+ 'task_timeout': config.task_timeout,+ 'max_retries': config.max_retries+ }, f, indent=2)++ click.echo(f"\nπΎ Configuration saved to {config_path}")\ No newline at end of file