From fd02fa09f544d6d5a610a70bbdc40f9d4bbc1b85 Mon Sep 17 00:00:00 2001 From: rUv Date: Wed, 6 Aug 2025 12:21:53 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=96=20Checkpoint:=20Edit=20/workspaces?= =?UTF-8?q?/claude-code-flow/benchmark/src/swarm=5Fbenchmark/core/real=5Fb?= =?UTF-8?q?enchmark=5Fengine.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .claude/checkpoints/1754482844.json | 1 + .claude/checkpoints/1754482845.json | 1 + .../core/real_benchmark_engine.py | 42 ++++-- ..._da350a69-d597-44ba-8bfb-22ee1e8d5dcc.json | 48 ++++++ ..._da350a69-d597-44ba-8bfb-22ee1e8d5dcc.json | 66 ++++++++ ..._da350a69-d597-44ba-8bfb-22ee1e8d5dcc.json | 47 ++++++ ..._da350a69-d597-44ba-8bfb-22ee1e8d5dcc.json | 142 ++++++++++++++++++ 7 files changed, 333 insertions(+), 14 deletions(-) create mode 100644 .claude/checkpoints/1754482844.json create mode 100644 .claude/checkpoints/1754482845.json create mode 100644 reports/benchmark_da350a69-d597-44ba-8bfb-22ee1e8d5dcc.json create mode 100644 reports/metrics_da350a69-d597-44ba-8bfb-22ee1e8d5dcc.json create mode 100644 reports/process_report_da350a69-d597-44ba-8bfb-22ee1e8d5dcc.json create mode 100644 reports/real-benchmark-development-centralized_da350a69-d597-44ba-8bfb-22ee1e8d5dcc.json diff --git a/.claude/checkpoints/1754482844.json b/.claude/checkpoints/1754482844.json new file mode 100644 index 0000000000..4be764de53 --- /dev/null +++ b/.claude/checkpoints/1754482844.json @@ -0,0 +1 @@ +{"branch": "checkpoint/pre-edit-20250806-122044", "file": "/workspaces/claude-code-flow/benchmark/src/swarm_benchmark/core/claude_flow_real_executor.py", "timestamp": "2025-08-06T12:20:44Z", "type": "pre-edit", "original_branch": "alpha-88"} diff --git a/.claude/checkpoints/1754482845.json b/.claude/checkpoints/1754482845.json new file mode 100644 index 0000000000..52a3b1a976 --- /dev/null +++ b/.claude/checkpoints/1754482845.json @@ -0,0 +1 @@ +{"tag": "checkpoint-20250806-122045", "file": "/workspaces/claude-code-flow/benchmark/src/swarm_benchmark/core/claude_flow_real_executor.py", "timestamp": "2025-08-06T12:20:45Z", "type": "post-edit", "branch": "alpha-88", "diff_summary": " .claude-flow/metrics/performance.json | 2 +- .claude-flow/metrics/system-metrics.json | 12 ++++++++++++ .claude-flow/metrics/task-metrics.json | 6 +++--- .claude/checkpoints/1754482826.json | 1 + .claude/checkpoints/1754482828.json | 1 + .../src/swarm_benchmark/core/claude_flow_real_executor.py | 8 ++++++++ claude-flow-wiki | 0 7 files changed, 26 insertions(+), 4 deletions(-) "} diff --git a/benchmark/src/swarm_benchmark/core/real_benchmark_engine.py b/benchmark/src/swarm_benchmark/core/real_benchmark_engine.py index 5b7c5d046c..403ab6da6a 100644 --- a/benchmark/src/swarm_benchmark/core/real_benchmark_engine.py +++ b/benchmark/src/swarm_benchmark/core/real_benchmark_engine.py @@ -170,24 +170,38 @@ class RealBenchmarkEngine(BenchmarkEngine): """Convert a task to claude-flow command arguments.""" command = [] - # Determine command type based on task - # Map strategies to valid SPARC modes: spec, architect, tdd, integration, refactor - if task.strategy == StrategyType.RESEARCH: - command.extend(["sparc", "spec", task.objective]) - elif task.strategy == StrategyType.DEVELOPMENT: - command.extend(["sparc", "tdd", task.objective]) - elif task.strategy == StrategyType.ANALYSIS: - command.extend(["sparc", "architect", task.objective]) - elif task.strategy == StrategyType.TESTING: - command.extend(["sparc", "integration", task.objective]) - elif task.strategy == StrategyType.OPTIMIZATION: - command.extend(["sparc", "refactor", task.objective]) - else: - # Use swarm command for all other tasks with executor flag + # Check if we should use swarm (based on config or task name) + use_swarm = ( + task.parameters.get("use_swarm", False) or + "swarm" in task.name.lower() or + self.config.parameters.get("force_swarm", False) + ) + + if use_swarm: + # Use swarm command with executor flag command.extend(["swarm", task.objective]) command.extend(["--strategy", task.strategy.value]) command.extend(["--mode", task.mode.value]) command.append("--executor") # Non-interactive mode + else: + # Determine command type based on task strategy + # Map strategies to valid SPARC modes: spec, architect, tdd, integration, refactor + if task.strategy == StrategyType.RESEARCH: + command.extend(["sparc", "spec", task.objective]) + elif task.strategy == StrategyType.DEVELOPMENT: + command.extend(["sparc", "tdd", task.objective]) + elif task.strategy == StrategyType.ANALYSIS: + command.extend(["sparc", "architect", task.objective]) + elif task.strategy == StrategyType.TESTING: + command.extend(["sparc", "integration", task.objective]) + elif task.strategy == StrategyType.OPTIMIZATION: + command.extend(["sparc", "refactor", task.objective]) + else: + # Default to swarm for unknown strategies + command.extend(["swarm", task.objective]) + command.extend(["--strategy", task.strategy.value]) + command.extend(["--mode", task.mode.value]) + command.append("--executor") # Non-interactive mode # Add common parameters if task.parameters.get("parallel"): diff --git a/reports/benchmark_da350a69-d597-44ba-8bfb-22ee1e8d5dcc.json b/reports/benchmark_da350a69-d597-44ba-8bfb-22ee1e8d5dcc.json new file mode 100644 index 0000000000..25739a398e --- /dev/null +++ b/reports/benchmark_da350a69-d597-44ba-8bfb-22ee1e8d5dcc.json @@ -0,0 +1,48 @@ +{ + "benchmark_id": "da350a69-d597-44ba-8bfb-22ee1e8d5dcc", + "status": "success", + "summary": "Completed 1 tasks", + "duration": 0.304579, + "metrics": { + "wall_clock_time": 1.30592942237854, + "tasks_per_second": 0.7657381653739458, + "success_rate": 1.0, + "peak_memory_mb": 0.0, + "average_cpu_percent": 0.0, + "total_output_lines": 11 + }, + "results": [ + { + "id": "3b1b3c41-79ef-46ff-acaa-749fe5c0657d", + "task_id": "05a1b265-1182-4526-9131-9d307896b1ad", + "agent_id": "claude-flow", + "status": "success", + "output": { + "raw_output": "\u2705 Starting SPARC TDD Workflow\nFollowing Test-Driven Development with SPARC methodology\n\nTDD Phases:\n Red: Write failing tests (tdd mode)\n Green: Minimal implementation (code mode)\n Refactor: Optimize and clean (tdd mode)\n\n\u2705 Starting full TDD workflow\nThis would execute all phases automatically\nUse --interactive for step-by-step control", + "lines": [ + "\u2705 Starting SPARC TDD Workflow", + "Following Test-Driven Development with SPARC methodology", + "", + "TDD Phases:", + " Red: Write failing tests (tdd mode)", + " Green: Minimal implementation (code mode)", + " Refactor: Optimize and clean (tdd mode)", + "", + "\u2705 Starting full TDD workflow", + "This would execute all phases automatically", + "Use --interactive for step-by-step control" + ], + "sections": {} + }, + "errors": [], + "warnings": [], + "execution_time": 0.2622191905975342, + "resource_usage": { + "cpu_percent": 96.1, + "memory_mb": 41.375 + }, + "created_at": "2025-08-06T12:21:04.352322", + "completed_at": "2025-08-06T12:21:04.351878" + } + ] +} \ No newline at end of file diff --git a/reports/metrics_da350a69-d597-44ba-8bfb-22ee1e8d5dcc.json b/reports/metrics_da350a69-d597-44ba-8bfb-22ee1e8d5dcc.json new file mode 100644 index 0000000000..044a844adf --- /dev/null +++ b/reports/metrics_da350a69-d597-44ba-8bfb-22ee1e8d5dcc.json @@ -0,0 +1,66 @@ +{ + "summary": { + "wall_clock_time": 1.30592942237854, + "tasks_per_second": 0.7657381653739458, + "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": 11, + "average_size": 11, + "complexity_score": 8.423119819113404 + }, + "collectors": { + "performance": 1, + "resource": 1 + }, + "timestamp": "2025-08-06T12:21:07.356982", + "process_executions": { + "sparc:{\"positional\": [\"tdd\", \"Build a REST API endpoint\"]}": { + "command_type": "sparc", + "args": { + "positional": [ + "tdd", + "Build a REST API endpoint" + ] + }, + "execution_count": 1, + "success_count": 1, + "failure_count": 0, + "success_rate": 1.0, + "average_duration": 0.3036065101623535, + "total_duration": 0.3036065101623535, + "average_memory_mb": 41.375, + "peak_memory_mb": 67.3828125 + } + } +} \ No newline at end of file diff --git a/reports/process_report_da350a69-d597-44ba-8bfb-22ee1e8d5dcc.json b/reports/process_report_da350a69-d597-44ba-8bfb-22ee1e8d5dcc.json new file mode 100644 index 0000000000..3b3f557ee1 --- /dev/null +++ b/reports/process_report_da350a69-d597-44ba-8bfb-22ee1e8d5dcc.json @@ -0,0 +1,47 @@ +{ + "summary": { + "total_executions": 1, + "successful_executions": 1, + "failed_executions": 0, + "overall_success_rate": 1.0, + "total_duration": 0.3036065101623535, + "average_duration": 0.3036065101623535, + "peak_memory_mb": 67.3828125, + "average_memory_mb": 41.375, + "total_output_lines": 11, + "total_errors": 0 + }, + "command_statistics": { + "sparc:{\"positional\": [\"tdd\", \"Build a REST API endpoint\"]}": { + "command_type": "sparc", + "args": { + "positional": [ + "tdd", + "Build a REST API endpoint" + ] + }, + "execution_count": 1, + "success_count": 1, + "failure_count": 0, + "success_rate": 1.0, + "average_duration": 0.3036065101623535, + "total_duration": 0.3036065101623535, + "average_memory_mb": 41.375, + "peak_memory_mb": 67.3828125 + } + }, + "executions": [ + { + "command": "claude-flow sparc tdd Build a REST API endpoint", + "exit_code": 0, + "success": true, + "duration": 0.3036065101623535, + "start_time": 1754482864.0482712, + "output_size": 11, + "error_count": 0, + "cpu_percent": 96.1, + "memory_mb": 41.375, + "peak_memory_mb": 67.3828125 + } + ] +} \ No newline at end of file diff --git a/reports/real-benchmark-development-centralized_da350a69-d597-44ba-8bfb-22ee1e8d5dcc.json b/reports/real-benchmark-development-centralized_da350a69-d597-44ba-8bfb-22ee1e8d5dcc.json new file mode 100644 index 0000000000..c5aef904a0 --- /dev/null +++ b/reports/real-benchmark-development-centralized_da350a69-d597-44ba-8bfb-22ee1e8d5dcc.json @@ -0,0 +1,142 @@ +{ + "id": "da350a69-d597-44ba-8bfb-22ee1e8d5dcc", + "name": "real-benchmark-development-centralized", + "description": "Real Benchmark: Build a REST API endpoint", + "status": "completed", + "config": { + "name": "real-benchmark-development-centralized", + "description": "Real Benchmark: Build a REST API endpoint", + "strategy": "development", + "mode": "centralized", + "max_agents": 5, + "max_tasks": 100, + "timeout": 60, + "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": "05a1b265-1182-4526-9131-9d307896b1ad", + "objective": "Build a REST API endpoint", + "description": "Benchmark task: Build a REST API endpoint", + "strategy": "development", + "mode": "centralized", + "parameters": {}, + "timeout": 300, + "max_retries": 3, + "priority": 1, + "status": "pending", + "created_at": "2025-08-06T12:21:04.047722", + "started_at": null, + "completed_at": null, + "duration": null, + "assigned_agents": [], + "parent_task_id": null, + "subtasks": [], + "dependencies": [] + } + ], + "results": [ + { + "id": "3b1b3c41-79ef-46ff-acaa-749fe5c0657d", + "task_id": "05a1b265-1182-4526-9131-9d307896b1ad", + "agent_id": "claude-flow", + "status": "success", + "output": { + "raw_output": "\u2705 Starting SPARC TDD Workflow\nFollowing Test-Driven Development with SPARC methodology\n\nTDD Phases:\n Red: Write failing tests (tdd mode)\n Green: Minimal implementation (code mode)\n Refactor: Optimize and clean (tdd mode)\n\n\u2705 Starting full TDD workflow\nThis would execute all phases automatically\nUse --interactive for step-by-step control", + "lines": [ + "\u2705 Starting SPARC TDD Workflow", + "Following Test-Driven Development with SPARC methodology", + "", + "TDD Phases:", + " Red: Write failing tests (tdd mode)", + " Green: Minimal implementation (code mode)", + " Refactor: Optimize and clean (tdd mode)", + "", + "\u2705 Starting full TDD workflow", + "This would execute all phases automatically", + "Use --interactive for step-by-step control" + ], + "sections": {} + }, + "errors": [], + "warnings": [], + "performance_metrics": { + "execution_time": 0.2622191905975342, + "queue_time": 0.0, + "throughput": 3.8136034121730056, + "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": 96.1, + "memory_mb": 41.375, + "network_bytes_sent": 0, + "network_bytes_recv": 0, + "disk_bytes_read": 0, + "disk_bytes_write": 0, + "peak_memory_mb": 67.3828125, + "average_cpu_percent": 96.1 + }, + "execution_details": { + "command": "claude-flow sparc tdd Build a REST API endpoint", + "exit_code": 0, + "output_lines": 11, + "error_count": 0 + }, + "created_at": "2025-08-06T12:21:04.352322", + "started_at": "2025-08-06T12:21:04.048271", + "completed_at": "2025-08-06T12:21:04.351878", + "duration": 0.303607 + } + ], + "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.30592942237854, + "success_rate": 1.0, + "throughput": 0.7657381653739458, + "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-06T12:21:04.047756", + "started_at": "2025-08-06T12:21:04.047763", + "completed_at": "2025-08-06T12:21:04.352342", + "duration": 0.304579, + "error_log": [], + "metadata": {} +} \ No newline at end of file