🔖 Checkpoint: Edit /workspaces/claude-code-flow/benchmark/src/swarm_benchmark/claude_optimizer/optimizer.py

This commit is contained in:
rUv committed 2025-08-06 01:20:42 +00:00
1 parent 1e1196265a
commit c28783eb04
3 files changed
+43 -1

No files matched your search

@@ -0,0 +1 @@
{"branch": "checkpoint/pre-edit-20250806-012038", "file": "/workspaces/claude-code-flow/benchmark/src/swarm_benchmark/automation/decision_engine.py", "timestamp": "2025-08-06T01:20:38Z", "type": "pre-edit", "original_branch": "alpha-88"}
@@ -0,0 +1 @@
{"tag": "checkpoint-20250806-012039", "file": "/workspaces/claude-code-flow/benchmark/src/swarm_benchmark/automation/decision_engine.py", "timestamp": "2025-08-06T01:20:39Z", "type": "post-edit", "branch": "alpha-88", "diff_summary": " .claude-flow/metrics/performance.json | 4 +- .claude-flow/metrics/system-metrics.json | 324 +++++++++++++++++++ benchmark/.claude-flow/metrics/performance.json | 2 +- benchmark/.claude-flow/metrics/task-metrics.json | 6 +- benchmark/.claude/checkpoints/1754443228.json | 1 + benchmark/.claude/checkpoints/1754443230.json | 1 + .../swarm_benchmark/automation/decision_engine.py | 359 +++++++++++++++++++++ .../__pycache__/__init__.cpython-312.pyc | Bin 606 -> 738 bytes .../config/__pycache__/__init__.cpython-312.pyc | Bin 891 -> 524 bytes .../mle_star/__pycache__/__init__.cpython-312.pyc | Bin 986 -> 1091 bytes claude-flow-wiki | 0 11 files changed, 691 insertions(+), 6 deletions(-) "}
@@ -625,4 +625,44 @@ class ClaudeMdOptimizer:
parallel_score * weights["parallel_efficiency"]
)
return min(1.0, max(0.0, total_score))
return min(1.0, max(0.0, total_score))
def _optimize_swarm(self, config: Dict, target_value: Any) -> Dict:
"""Optimize swarm coordination settings."""
optimized = config.copy()
# Optimize topology based on use case
if config.get("use_case") in ["ml_pipeline", "testing_automation"]:
optimized["swarm_topology"] = "mesh"
elif config.get("use_case") in ["api_development", "documentation"]:
optimized["swarm_topology"] = "hierarchical"
# Add coordination rules
if "critical_rules" not in optimized:
optimized["critical_rules"] = []
optimized["critical_rules"].extend([
"Enable swarm memory synchronization",
"Use collective decision making",
"Implement agent load balancing"
])
return optimized
def _optimize_tools(self, config: Dict, target_value: Any) -> Dict:
"""Optimize tool selection and priorities."""
optimized = config.copy()
# Set tool priorities based on use case
use_case = config.get("use_case", "")
if use_case == "api_development":
optimized["tool_priorities"] = ["MultiEdit", "Edit", "Bash", "Grep"]
elif use_case == "ml_pipeline":
optimized["tool_priorities"] = ["MultiEdit", "Bash", "Edit", "Read"]
elif use_case == "performance_optimization":
optimized["tool_priorities"] = ["Bash", "MultiEdit", "Grep", "Edit"]
else:
optimized["tool_priorities"] = ["MultiEdit", "Edit", "Read", "Bash"]
return optimized