@claude-flow/cli 3.0.0-alpha.6 → 3.0.0-alpha.61
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/agents/analysis/analyze-code-quality.md +181 -0
- package/.claude/agents/analysis/code-analyzer.md +210 -0
- package/.claude/agents/architecture/arch-system-design.md +157 -0
- package/.claude/agents/consensus/byzantine-coordinator.md +63 -0
- package/.claude/agents/consensus/crdt-synchronizer.md +997 -0
- package/.claude/agents/consensus/gossip-coordinator.md +63 -0
- package/.claude/agents/consensus/performance-benchmarker.md +851 -0
- package/.claude/agents/consensus/quorum-manager.md +823 -0
- package/.claude/agents/consensus/raft-manager.md +63 -0
- package/.claude/agents/consensus/security-manager.md +622 -0
- package/.claude/agents/core/coder.md +453 -0
- package/.claude/agents/core/planner.md +375 -0
- package/.claude/agents/core/researcher.md +369 -0
- package/.claude/agents/core/reviewer.md +520 -0
- package/.claude/agents/core/tester.md +512 -0
- package/.claude/agents/custom/test-long-runner.md +44 -0
- package/.claude/agents/data/data-ml-model.md +445 -0
- package/.claude/agents/development/dev-backend-api.md +346 -0
- package/.claude/agents/devops/ops-cicd-github.md +165 -0
- package/.claude/agents/documentation/docs-api-openapi.md +355 -0
- package/.claude/agents/flow-nexus/app-store.md +88 -0
- package/.claude/agents/flow-nexus/authentication.md +69 -0
- package/.claude/agents/flow-nexus/challenges.md +81 -0
- package/.claude/agents/flow-nexus/neural-network.md +88 -0
- package/.claude/agents/flow-nexus/payments.md +83 -0
- package/.claude/agents/flow-nexus/sandbox.md +76 -0
- package/.claude/agents/flow-nexus/swarm.md +76 -0
- package/.claude/agents/flow-nexus/user-tools.md +96 -0
- package/.claude/agents/flow-nexus/workflow.md +84 -0
- package/.claude/agents/github/code-review-swarm.md +377 -0
- package/.claude/agents/github/github-modes.md +173 -0
- package/.claude/agents/github/issue-tracker.md +576 -0
- package/.claude/agents/github/multi-repo-swarm.md +553 -0
- package/.claude/agents/github/pr-manager.md +438 -0
- package/.claude/agents/github/project-board-sync.md +509 -0
- package/.claude/agents/github/release-manager.md +605 -0
- package/.claude/agents/github/release-swarm.md +583 -0
- package/.claude/agents/github/repo-architect.md +398 -0
- package/.claude/agents/github/swarm-issue.md +573 -0
- package/.claude/agents/github/swarm-pr.md +428 -0
- package/.claude/agents/github/sync-coordinator.md +452 -0
- package/.claude/agents/github/workflow-automation.md +903 -0
- package/.claude/agents/goal/agent.md +816 -0
- package/.claude/agents/goal/goal-planner.md +73 -0
- package/.claude/agents/optimization/benchmark-suite.md +665 -0
- package/.claude/agents/optimization/load-balancer.md +431 -0
- package/.claude/agents/optimization/performance-monitor.md +672 -0
- package/.claude/agents/optimization/resource-allocator.md +674 -0
- package/.claude/agents/optimization/topology-optimizer.md +808 -0
- package/.claude/agents/payments/agentic-payments.md +126 -0
- package/.claude/agents/sona/sona-learning-optimizer.md +254 -0
- package/.claude/agents/sparc/architecture.md +699 -0
- package/.claude/agents/sparc/pseudocode.md +520 -0
- package/.claude/agents/sparc/refinement.md +802 -0
- package/.claude/agents/sparc/specification.md +478 -0
- package/.claude/agents/specialized/spec-mobile-react-native.md +227 -0
- package/.claude/agents/sublinear/consensus-coordinator.md +338 -0
- package/.claude/agents/sublinear/matrix-optimizer.md +185 -0
- package/.claude/agents/sublinear/pagerank-analyzer.md +299 -0
- package/.claude/agents/sublinear/performance-optimizer.md +368 -0
- package/.claude/agents/sublinear/trading-predictor.md +246 -0
- package/.claude/agents/swarm/adaptive-coordinator.md +1127 -0
- package/.claude/agents/swarm/hierarchical-coordinator.md +710 -0
- package/.claude/agents/swarm/mesh-coordinator.md +963 -0
- package/.claude/agents/templates/automation-smart-agent.md +205 -0
- package/.claude/agents/templates/base-template-generator.md +268 -0
- package/.claude/agents/templates/coordinator-swarm-init.md +90 -0
- package/.claude/agents/templates/github-pr-manager.md +177 -0
- package/.claude/agents/templates/implementer-sparc-coder.md +259 -0
- package/.claude/agents/templates/memory-coordinator.md +187 -0
- package/.claude/agents/templates/orchestrator-task.md +139 -0
- package/.claude/agents/templates/performance-analyzer.md +199 -0
- package/.claude/agents/templates/sparc-coordinator.md +514 -0
- package/.claude/agents/testing/production-validator.md +395 -0
- package/.claude/agents/testing/tdd-london-swarm.md +244 -0
- package/.claude/agents/v3/adr-architect.md +184 -0
- package/.claude/agents/v3/claims-authorizer.md +208 -0
- package/.claude/agents/v3/collective-intelligence-coordinator.md +993 -0
- package/.claude/agents/v3/ddd-domain-expert.md +220 -0
- package/.claude/agents/v3/memory-specialist.md +995 -0
- package/.claude/agents/v3/performance-engineer.md +1233 -0
- package/.claude/agents/v3/reasoningbank-learner.md +213 -0
- package/.claude/agents/v3/security-architect.md +867 -0
- package/.claude/agents/v3/security-auditor.md +771 -0
- package/.claude/agents/v3/sparc-orchestrator.md +182 -0
- package/.claude/agents/v3/swarm-memory-manager.md +157 -0
- package/.claude/agents/v3/v3-integration-architect.md +205 -0
- package/.claude/commands/agents/README.md +50 -0
- package/.claude/commands/agents/agent-capabilities.md +140 -0
- package/.claude/commands/agents/agent-coordination.md +28 -0
- package/.claude/commands/agents/agent-spawning.md +28 -0
- package/.claude/commands/agents/agent-types.md +216 -0
- package/.claude/commands/agents/health.md +139 -0
- package/.claude/commands/agents/list.md +100 -0
- package/.claude/commands/agents/logs.md +130 -0
- package/.claude/commands/agents/metrics.md +122 -0
- package/.claude/commands/agents/pool.md +127 -0
- package/.claude/commands/agents/spawn.md +140 -0
- package/.claude/commands/agents/status.md +115 -0
- package/.claude/commands/agents/stop.md +102 -0
- package/.claude/commands/analysis/COMMAND_COMPLIANCE_REPORT.md +54 -0
- package/.claude/commands/analysis/README.md +9 -0
- package/.claude/commands/analysis/bottleneck-detect.md +162 -0
- package/.claude/commands/analysis/performance-bottlenecks.md +59 -0
- package/.claude/commands/analysis/performance-report.md +25 -0
- package/.claude/commands/analysis/token-efficiency.md +45 -0
- package/.claude/commands/analysis/token-usage.md +25 -0
- package/.claude/commands/automation/README.md +9 -0
- package/.claude/commands/automation/auto-agent.md +122 -0
- package/.claude/commands/automation/self-healing.md +106 -0
- package/.claude/commands/automation/session-memory.md +90 -0
- package/.claude/commands/automation/smart-agents.md +73 -0
- package/.claude/commands/automation/smart-spawn.md +25 -0
- package/.claude/commands/automation/workflow-select.md +25 -0
- package/.claude/commands/claude-flow-help.md +103 -0
- package/.claude/commands/claude-flow-memory.md +107 -0
- package/.claude/commands/claude-flow-swarm.md +205 -0
- package/.claude/commands/coordination/README.md +9 -0
- package/.claude/commands/coordination/agent-spawn.md +25 -0
- package/.claude/commands/coordination/init.md +44 -0
- package/.claude/commands/coordination/orchestrate.md +43 -0
- package/.claude/commands/coordination/spawn.md +45 -0
- package/.claude/commands/coordination/swarm-init.md +85 -0
- package/.claude/commands/coordination/task-orchestrate.md +25 -0
- package/.claude/commands/flow-nexus/app-store.md +124 -0
- package/.claude/commands/flow-nexus/challenges.md +120 -0
- package/.claude/commands/flow-nexus/login-registration.md +65 -0
- package/.claude/commands/flow-nexus/neural-network.md +134 -0
- package/.claude/commands/flow-nexus/payments.md +116 -0
- package/.claude/commands/flow-nexus/sandbox.md +83 -0
- package/.claude/commands/flow-nexus/swarm.md +87 -0
- package/.claude/commands/flow-nexus/user-tools.md +152 -0
- package/.claude/commands/flow-nexus/workflow.md +115 -0
- package/.claude/commands/github/README.md +11 -0
- package/.claude/commands/github/code-review-swarm.md +514 -0
- package/.claude/commands/github/code-review.md +25 -0
- package/.claude/commands/github/github-modes.md +147 -0
- package/.claude/commands/github/github-swarm.md +121 -0
- package/.claude/commands/github/issue-tracker.md +292 -0
- package/.claude/commands/github/issue-triage.md +25 -0
- package/.claude/commands/github/multi-repo-swarm.md +519 -0
- package/.claude/commands/github/pr-enhance.md +26 -0
- package/.claude/commands/github/pr-manager.md +170 -0
- package/.claude/commands/github/project-board-sync.md +471 -0
- package/.claude/commands/github/release-manager.md +338 -0
- package/.claude/commands/github/release-swarm.md +544 -0
- package/.claude/commands/github/repo-analyze.md +25 -0
- package/.claude/commands/github/repo-architect.md +367 -0
- package/.claude/commands/github/swarm-issue.md +482 -0
- package/.claude/commands/github/swarm-pr.md +285 -0
- package/.claude/commands/github/sync-coordinator.md +301 -0
- package/.claude/commands/github/workflow-automation.md +442 -0
- package/.claude/commands/hive-mind/README.md +17 -0
- package/.claude/commands/hive-mind/hive-mind-consensus.md +8 -0
- package/.claude/commands/hive-mind/hive-mind-init.md +18 -0
- package/.claude/commands/hive-mind/hive-mind-memory.md +8 -0
- package/.claude/commands/hive-mind/hive-mind-metrics.md +8 -0
- package/.claude/commands/hive-mind/hive-mind-resume.md +8 -0
- package/.claude/commands/hive-mind/hive-mind-sessions.md +8 -0
- package/.claude/commands/hive-mind/hive-mind-spawn.md +21 -0
- package/.claude/commands/hive-mind/hive-mind-status.md +8 -0
- package/.claude/commands/hive-mind/hive-mind-stop.md +8 -0
- package/.claude/commands/hive-mind/hive-mind-wizard.md +8 -0
- package/.claude/commands/hive-mind/hive-mind.md +27 -0
- package/.claude/commands/hooks/README.md +11 -0
- package/.claude/commands/hooks/overview.md +58 -0
- package/.claude/commands/hooks/post-edit.md +117 -0
- package/.claude/commands/hooks/post-task.md +112 -0
- package/.claude/commands/hooks/pre-edit.md +113 -0
- package/.claude/commands/hooks/pre-task.md +111 -0
- package/.claude/commands/hooks/session-end.md +118 -0
- package/.claude/commands/hooks/setup.md +103 -0
- package/.claude/commands/memory/README.md +9 -0
- package/.claude/commands/memory/memory-persist.md +25 -0
- package/.claude/commands/memory/memory-search.md +25 -0
- package/.claude/commands/memory/memory-usage.md +25 -0
- package/.claude/commands/memory/neural.md +47 -0
- package/.claude/commands/monitoring/README.md +9 -0
- package/.claude/commands/monitoring/agent-metrics.md +25 -0
- package/.claude/commands/monitoring/agents.md +44 -0
- package/.claude/commands/monitoring/real-time-view.md +25 -0
- package/.claude/commands/monitoring/status.md +46 -0
- package/.claude/commands/monitoring/swarm-monitor.md +25 -0
- package/.claude/commands/optimization/README.md +9 -0
- package/.claude/commands/optimization/auto-topology.md +62 -0
- package/.claude/commands/optimization/cache-manage.md +25 -0
- package/.claude/commands/optimization/parallel-execute.md +25 -0
- package/.claude/commands/optimization/parallel-execution.md +50 -0
- package/.claude/commands/optimization/topology-optimize.md +25 -0
- package/.claude/commands/pair/README.md +261 -0
- package/.claude/commands/pair/commands.md +546 -0
- package/.claude/commands/pair/config.md +510 -0
- package/.claude/commands/pair/examples.md +512 -0
- package/.claude/commands/pair/modes.md +348 -0
- package/.claude/commands/pair/session.md +407 -0
- package/.claude/commands/pair/start.md +209 -0
- package/.claude/commands/sparc/analyzer.md +52 -0
- package/.claude/commands/sparc/architect.md +53 -0
- package/.claude/commands/sparc/ask.md +97 -0
- package/.claude/commands/sparc/batch-executor.md +54 -0
- package/.claude/commands/sparc/code.md +89 -0
- package/.claude/commands/sparc/coder.md +54 -0
- package/.claude/commands/sparc/debug.md +83 -0
- package/.claude/commands/sparc/debugger.md +54 -0
- package/.claude/commands/sparc/designer.md +53 -0
- package/.claude/commands/sparc/devops.md +109 -0
- package/.claude/commands/sparc/docs-writer.md +80 -0
- package/.claude/commands/sparc/documenter.md +54 -0
- package/.claude/commands/sparc/innovator.md +54 -0
- package/.claude/commands/sparc/integration.md +83 -0
- package/.claude/commands/sparc/mcp.md +117 -0
- package/.claude/commands/sparc/memory-manager.md +54 -0
- package/.claude/commands/sparc/optimizer.md +54 -0
- package/.claude/commands/sparc/orchestrator.md +132 -0
- package/.claude/commands/sparc/post-deployment-monitoring-mode.md +83 -0
- package/.claude/commands/sparc/refinement-optimization-mode.md +83 -0
- package/.claude/commands/sparc/researcher.md +54 -0
- package/.claude/commands/sparc/reviewer.md +54 -0
- package/.claude/commands/sparc/security-review.md +80 -0
- package/.claude/commands/sparc/sparc-modes.md +174 -0
- package/.claude/commands/sparc/sparc.md +111 -0
- package/.claude/commands/sparc/spec-pseudocode.md +80 -0
- package/.claude/commands/sparc/supabase-admin.md +348 -0
- package/.claude/commands/sparc/swarm-coordinator.md +54 -0
- package/.claude/commands/sparc/tdd.md +54 -0
- package/.claude/commands/sparc/tester.md +54 -0
- package/.claude/commands/sparc/tutorial.md +79 -0
- package/.claude/commands/sparc/workflow-manager.md +54 -0
- package/.claude/commands/sparc.md +166 -0
- package/.claude/commands/stream-chain/pipeline.md +121 -0
- package/.claude/commands/stream-chain/run.md +70 -0
- package/.claude/commands/swarm/README.md +15 -0
- package/.claude/commands/swarm/analysis.md +95 -0
- package/.claude/commands/swarm/development.md +96 -0
- package/.claude/commands/swarm/examples.md +168 -0
- package/.claude/commands/swarm/maintenance.md +102 -0
- package/.claude/commands/swarm/optimization.md +117 -0
- package/.claude/commands/swarm/research.md +136 -0
- package/.claude/commands/swarm/swarm-analysis.md +8 -0
- package/.claude/commands/swarm/swarm-background.md +8 -0
- package/.claude/commands/swarm/swarm-init.md +19 -0
- package/.claude/commands/swarm/swarm-modes.md +8 -0
- package/.claude/commands/swarm/swarm-monitor.md +8 -0
- package/.claude/commands/swarm/swarm-spawn.md +19 -0
- package/.claude/commands/swarm/swarm-status.md +8 -0
- package/.claude/commands/swarm/swarm-strategies.md +8 -0
- package/.claude/commands/swarm/swarm.md +87 -0
- package/.claude/commands/swarm/testing.md +131 -0
- package/.claude/commands/training/README.md +9 -0
- package/.claude/commands/training/model-update.md +25 -0
- package/.claude/commands/training/neural-patterns.md +74 -0
- package/.claude/commands/training/neural-train.md +25 -0
- package/.claude/commands/training/pattern-learn.md +25 -0
- package/.claude/commands/training/specialization.md +63 -0
- package/.claude/commands/truth/start.md +143 -0
- package/.claude/commands/verify/check.md +50 -0
- package/.claude/commands/verify/start.md +128 -0
- package/.claude/commands/workflows/README.md +9 -0
- package/.claude/commands/workflows/development.md +78 -0
- package/.claude/commands/workflows/research.md +63 -0
- package/.claude/commands/workflows/workflow-create.md +25 -0
- package/.claude/commands/workflows/workflow-execute.md +25 -0
- package/.claude/commands/workflows/workflow-export.md +25 -0
- package/.claude/helpers/README.md +97 -0
- package/.claude/helpers/adr-compliance.sh +186 -0
- package/.claude/helpers/auto-commit.sh +178 -0
- package/.claude/helpers/checkpoint-manager.sh +251 -0
- package/.claude/helpers/daemon-manager.sh +252 -0
- package/.claude/helpers/ddd-tracker.sh +144 -0
- package/.claude/helpers/github-safe.js +106 -0
- package/.claude/helpers/github-setup.sh +28 -0
- package/.claude/helpers/guidance-hook.sh +13 -0
- package/.claude/helpers/guidance-hooks.sh +102 -0
- package/.claude/helpers/health-monitor.sh +108 -0
- package/.claude/helpers/learning-hooks.sh +329 -0
- package/.claude/helpers/learning-optimizer.sh +127 -0
- package/.claude/helpers/learning-service.mjs +1144 -0
- package/.claude/helpers/memory.js +83 -0
- package/.claude/helpers/metrics-db.mjs +488 -0
- package/.claude/helpers/pattern-consolidator.sh +86 -0
- package/.claude/helpers/perf-worker.sh +160 -0
- package/.claude/helpers/post-commit +16 -0
- package/.claude/helpers/pre-commit +26 -0
- package/.claude/helpers/quick-start.sh +19 -0
- package/.claude/helpers/router.js +66 -0
- package/.claude/helpers/security-scanner.sh +127 -0
- package/.claude/helpers/session.js +127 -0
- package/.claude/helpers/setup-mcp.sh +18 -0
- package/.claude/helpers/standard-checkpoint-hooks.sh +189 -0
- package/.claude/helpers/statusline-hook.sh +21 -0
- package/.claude/helpers/statusline.js +316 -0
- package/.claude/helpers/swarm-comms.sh +353 -0
- package/.claude/helpers/swarm-hooks.sh +761 -0
- package/.claude/helpers/swarm-monitor.sh +211 -0
- package/.claude/helpers/sync-v3-metrics.sh +245 -0
- package/.claude/helpers/update-v3-progress.sh +166 -0
- package/.claude/helpers/v3-quick-status.sh +58 -0
- package/.claude/helpers/v3.sh +111 -0
- package/.claude/helpers/validate-v3-config.sh +216 -0
- package/.claude/helpers/worker-manager.sh +170 -0
- package/.claude/settings.json +259 -0
- package/.claude/skills/agentdb-advanced/SKILL.md +550 -0
- package/.claude/skills/agentdb-learning/SKILL.md +545 -0
- package/.claude/skills/agentdb-memory-patterns/SKILL.md +339 -0
- package/.claude/skills/agentdb-optimization/SKILL.md +509 -0
- package/.claude/skills/agentdb-vector-search/SKILL.md +339 -0
- package/.claude/skills/agentic-jujutsu/SKILL.md +645 -0
- package/.claude/skills/flow-nexus-neural/SKILL.md +738 -0
- package/.claude/skills/flow-nexus-platform/SKILL.md +1157 -0
- package/.claude/skills/flow-nexus-swarm/SKILL.md +610 -0
- package/.claude/skills/github-code-review/SKILL.md +1140 -0
- package/.claude/skills/github-multi-repo/SKILL.md +874 -0
- package/.claude/skills/github-project-management/SKILL.md +1277 -0
- package/.claude/skills/github-release-management/SKILL.md +1081 -0
- package/.claude/skills/github-workflow-automation/SKILL.md +1065 -0
- package/.claude/skills/hive-mind-advanced/SKILL.md +712 -0
- package/.claude/skills/hooks-automation/SKILL.md +1201 -0
- package/.claude/skills/pair-programming/SKILL.md +1202 -0
- package/.claude/skills/performance-analysis/SKILL.md +563 -0
- package/.claude/skills/reasoningbank-agentdb/SKILL.md +446 -0
- package/.claude/skills/reasoningbank-intelligence/SKILL.md +201 -0
- package/{.claude-flow → .claude/skills/skill-builder/.claude-flow}/metrics/performance.json +3 -3
- package/.claude/skills/skill-builder/.claude-flow/metrics/task-metrics.json +10 -0
- package/.claude/skills/skill-builder/SKILL.md +910 -0
- package/.claude/skills/sparc-methodology/SKILL.md +1115 -0
- package/.claude/skills/stream-chain/SKILL.md +563 -0
- package/.claude/skills/swarm-advanced/SKILL.md +973 -0
- package/.claude/skills/swarm-orchestration/SKILL.md +179 -0
- package/.claude/skills/v3-cli-modernization/SKILL.md +872 -0
- package/.claude/skills/v3-core-implementation/SKILL.md +797 -0
- package/.claude/skills/v3-ddd-architecture/SKILL.md +442 -0
- package/.claude/skills/v3-integration-deep/SKILL.md +241 -0
- package/.claude/skills/v3-mcp-optimization/SKILL.md +777 -0
- package/.claude/skills/v3-memory-unification/SKILL.md +174 -0
- package/.claude/skills/v3-performance-optimization/SKILL.md +390 -0
- package/.claude/skills/v3-security-overhaul/SKILL.md +82 -0
- package/.claude/skills/v3-swarm-coordination/SKILL.md +340 -0
- package/.claude/skills/verification-quality/SKILL.md +649 -0
- package/.claude/skills/worker-benchmarks/skill.md +135 -0
- package/.claude/skills/worker-integration/skill.md +154 -0
- package/README.md +428 -6
- package/bin/cli.js +142 -6
- package/bin/mcp-server.js +188 -0
- package/dist/src/commands/agent.d.ts.map +1 -1
- package/dist/src/commands/agent.js +42 -26
- package/dist/src/commands/agent.js.map +1 -1
- package/dist/src/commands/analyze.d.ts +19 -0
- package/dist/src/commands/analyze.d.ts.map +1 -0
- package/dist/src/commands/analyze.js +1823 -0
- package/dist/src/commands/analyze.js.map +1 -0
- package/dist/src/commands/claims.d.ts +10 -0
- package/dist/src/commands/claims.d.ts.map +1 -0
- package/dist/src/commands/claims.js +288 -0
- package/dist/src/commands/claims.js.map +1 -0
- package/dist/src/commands/completions.d.ts +10 -0
- package/dist/src/commands/completions.d.ts.map +1 -0
- package/dist/src/commands/completions.js +539 -0
- package/dist/src/commands/completions.js.map +1 -0
- package/dist/src/commands/daemon.d.ts +8 -0
- package/dist/src/commands/daemon.d.ts.map +1 -0
- package/dist/src/commands/daemon.js +593 -0
- package/dist/src/commands/daemon.js.map +1 -0
- package/dist/src/commands/deployment.d.ts +10 -0
- package/dist/src/commands/deployment.d.ts.map +1 -0
- package/dist/src/commands/deployment.js +289 -0
- package/dist/src/commands/deployment.js.map +1 -0
- package/dist/src/commands/doctor.d.ts +10 -0
- package/dist/src/commands/doctor.d.ts.map +1 -0
- package/dist/src/commands/doctor.js +448 -0
- package/dist/src/commands/doctor.js.map +1 -0
- package/dist/src/commands/embeddings.d.ts +18 -0
- package/dist/src/commands/embeddings.d.ts.map +1 -0
- package/dist/src/commands/embeddings.js +616 -0
- package/dist/src/commands/embeddings.js.map +1 -0
- package/dist/src/commands/hive-mind.d.ts.map +1 -1
- package/dist/src/commands/hive-mind.js +252 -35
- package/dist/src/commands/hive-mind.js.map +1 -1
- package/dist/src/commands/hooks.d.ts.map +1 -1
- package/dist/src/commands/hooks.js +800 -6
- package/dist/src/commands/hooks.js.map +1 -1
- package/dist/src/commands/index.d.ts +52 -14
- package/dist/src/commands/index.d.ts.map +1 -1
- package/dist/src/commands/index.js +191 -38
- package/dist/src/commands/index.js.map +1 -1
- package/dist/src/commands/init.d.ts.map +1 -1
- package/dist/src/commands/init.js +80 -9
- package/dist/src/commands/init.js.map +1 -1
- package/dist/src/commands/issues.d.ts +21 -0
- package/dist/src/commands/issues.d.ts.map +1 -0
- package/dist/src/commands/issues.js +567 -0
- package/dist/src/commands/issues.js.map +1 -0
- package/dist/src/commands/mcp.js +3 -3
- package/dist/src/commands/mcp.js.map +1 -1
- package/dist/src/commands/memory.d.ts.map +1 -1
- package/dist/src/commands/memory.js +223 -4
- package/dist/src/commands/memory.js.map +1 -1
- package/dist/src/commands/neural.d.ts +10 -0
- package/dist/src/commands/neural.d.ts.map +1 -0
- package/dist/src/commands/neural.js +224 -0
- package/dist/src/commands/neural.js.map +1 -0
- package/dist/src/commands/performance.d.ts +10 -0
- package/dist/src/commands/performance.d.ts.map +1 -0
- package/dist/src/commands/performance.js +262 -0
- package/dist/src/commands/performance.js.map +1 -0
- package/dist/src/commands/plugins.d.ts +11 -0
- package/dist/src/commands/plugins.d.ts.map +1 -0
- package/dist/src/commands/plugins.js +630 -0
- package/dist/src/commands/plugins.js.map +1 -0
- package/dist/src/commands/progress.d.ts +11 -0
- package/dist/src/commands/progress.d.ts.map +1 -0
- package/dist/src/commands/progress.js +259 -0
- package/dist/src/commands/progress.js.map +1 -0
- package/dist/src/commands/providers.d.ts +10 -0
- package/dist/src/commands/providers.d.ts.map +1 -0
- package/dist/src/commands/providers.js +232 -0
- package/dist/src/commands/providers.js.map +1 -0
- package/dist/src/commands/route.d.ts +16 -0
- package/dist/src/commands/route.d.ts.map +1 -0
- package/dist/src/commands/route.js +813 -0
- package/dist/src/commands/route.js.map +1 -0
- package/dist/src/commands/security.d.ts +10 -0
- package/dist/src/commands/security.d.ts.map +1 -0
- package/dist/src/commands/security.js +261 -0
- package/dist/src/commands/security.js.map +1 -0
- package/dist/src/commands/start.d.ts.map +1 -1
- package/dist/src/commands/start.js +22 -2
- package/dist/src/commands/start.js.map +1 -1
- package/dist/src/commands/swarm.d.ts.map +1 -1
- package/dist/src/commands/swarm.js +185 -32
- package/dist/src/commands/swarm.js.map +1 -1
- package/dist/src/commands/transfer-store.d.ts +13 -0
- package/dist/src/commands/transfer-store.d.ts.map +1 -0
- package/dist/src/commands/transfer-store.js +428 -0
- package/dist/src/commands/transfer-store.js.map +1 -0
- package/dist/src/index.d.ts +3 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +69 -10
- package/dist/src/index.js.map +1 -1
- package/dist/src/init/claudemd-generator.d.ts.map +1 -1
- package/dist/src/init/claudemd-generator.js +407 -405
- package/dist/src/init/claudemd-generator.js.map +1 -1
- package/dist/src/init/executor.d.ts.map +1 -1
- package/dist/src/init/executor.js +142 -31
- package/dist/src/init/executor.js.map +1 -1
- package/dist/src/init/helpers-generator.js +1 -1
- package/dist/src/init/helpers-generator.js.map +1 -1
- package/dist/src/init/mcp-generator.d.ts +9 -0
- package/dist/src/init/mcp-generator.d.ts.map +1 -1
- package/dist/src/init/mcp-generator.js +57 -28
- package/dist/src/init/mcp-generator.js.map +1 -1
- package/dist/src/init/settings-generator.d.ts.map +1 -1
- package/dist/src/init/settings-generator.js +116 -62
- package/dist/src/init/settings-generator.js.map +1 -1
- package/dist/src/init/statusline-generator.d.ts +6 -0
- package/dist/src/init/statusline-generator.d.ts.map +1 -1
- package/dist/src/init/statusline-generator.js +252 -89
- package/dist/src/init/statusline-generator.js.map +1 -1
- package/dist/src/init/types.d.ts +6 -0
- package/dist/src/init/types.d.ts.map +1 -1
- package/dist/src/init/types.js +8 -2
- package/dist/src/init/types.js.map +1 -1
- package/dist/src/mcp-client.d.ts.map +1 -1
- package/dist/src/mcp-client.js +17 -1
- package/dist/src/mcp-client.js.map +1 -1
- package/dist/src/mcp-server.d.ts +6 -1
- package/dist/src/mcp-server.d.ts.map +1 -1
- package/dist/src/mcp-server.js +169 -38
- package/dist/src/mcp-server.js.map +1 -1
- package/dist/src/mcp-tools/agent-tools.d.ts +1 -1
- package/dist/src/mcp-tools/agent-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/agent-tools.js +350 -14
- package/dist/src/mcp-tools/agent-tools.js.map +1 -1
- package/dist/src/mcp-tools/analyze-tools.d.ts +38 -0
- package/dist/src/mcp-tools/analyze-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/analyze-tools.js +317 -0
- package/dist/src/mcp-tools/analyze-tools.js.map +1 -0
- package/dist/src/mcp-tools/config-tools.d.ts +1 -1
- package/dist/src/mcp-tools/config-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/config-tools.js +262 -15
- package/dist/src/mcp-tools/config-tools.js.map +1 -1
- package/dist/src/mcp-tools/hive-mind-tools.d.ts +8 -0
- package/dist/src/mcp-tools/hive-mind-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/hive-mind-tools.js +447 -0
- package/dist/src/mcp-tools/hive-mind-tools.js.map +1 -0
- package/dist/src/mcp-tools/hooks-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/hooks-tools.js +195 -31
- package/dist/src/mcp-tools/hooks-tools.js.map +1 -1
- package/dist/src/mcp-tools/index.d.ts +6 -0
- package/dist/src/mcp-tools/index.d.ts.map +1 -1
- package/dist/src/mcp-tools/index.js +6 -0
- package/dist/src/mcp-tools/index.js.map +1 -1
- package/dist/src/mcp-tools/progress-tools.d.ts +14 -0
- package/dist/src/mcp-tools/progress-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/progress-tools.js +343 -0
- package/dist/src/mcp-tools/progress-tools.js.map +1 -0
- package/dist/src/mcp-tools/session-tools.d.ts +1 -1
- package/dist/src/mcp-tools/session-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/session-tools.js +237 -22
- package/dist/src/mcp-tools/session-tools.js.map +1 -1
- package/dist/src/mcp-tools/task-tools.d.ts +1 -1
- package/dist/src/mcp-tools/task-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/task-tools.js +219 -17
- package/dist/src/mcp-tools/task-tools.js.map +1 -1
- package/dist/src/mcp-tools/transfer-tools.d.ts +14 -0
- package/dist/src/mcp-tools/transfer-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/transfer-tools.js +396 -0
- package/dist/src/mcp-tools/transfer-tools.js.map +1 -0
- package/dist/src/mcp-tools/workflow-tools.d.ts +8 -0
- package/dist/src/mcp-tools/workflow-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/workflow-tools.js +481 -0
- package/dist/src/mcp-tools/workflow-tools.js.map +1 -0
- package/dist/src/output.d.ts +16 -0
- package/dist/src/output.d.ts.map +1 -1
- package/dist/src/output.js +42 -0
- package/dist/src/output.js.map +1 -1
- package/dist/src/plugins/store/discovery.d.ts +73 -0
- package/dist/src/plugins/store/discovery.d.ts.map +1 -0
- package/dist/src/plugins/store/discovery.js +568 -0
- package/dist/src/plugins/store/discovery.js.map +1 -0
- package/dist/src/plugins/store/index.d.ts +76 -0
- package/dist/src/plugins/store/index.d.ts.map +1 -0
- package/dist/src/plugins/store/index.js +141 -0
- package/dist/src/plugins/store/index.js.map +1 -0
- package/dist/src/plugins/store/search.d.ts +46 -0
- package/dist/src/plugins/store/search.d.ts.map +1 -0
- package/dist/src/plugins/store/search.js +230 -0
- package/dist/src/plugins/store/search.js.map +1 -0
- package/dist/src/plugins/store/types.d.ts +274 -0
- package/dist/src/plugins/store/types.d.ts.map +1 -0
- package/dist/src/plugins/store/types.js +7 -0
- package/dist/src/plugins/store/types.js.map +1 -0
- package/dist/src/plugins/tests/demo-plugin-store.d.ts +7 -0
- package/dist/src/plugins/tests/demo-plugin-store.d.ts.map +1 -0
- package/dist/src/plugins/tests/demo-plugin-store.js +126 -0
- package/dist/src/plugins/tests/demo-plugin-store.js.map +1 -0
- package/dist/src/plugins/tests/standalone-test.d.ts +12 -0
- package/dist/src/plugins/tests/standalone-test.d.ts.map +1 -0
- package/dist/src/plugins/tests/standalone-test.js +188 -0
- package/dist/src/plugins/tests/standalone-test.js.map +1 -0
- package/dist/src/plugins/tests/test-plugin-store.d.ts +7 -0
- package/dist/src/plugins/tests/test-plugin-store.d.ts.map +1 -0
- package/dist/src/plugins/tests/test-plugin-store.js +206 -0
- package/dist/src/plugins/tests/test-plugin-store.js.map +1 -0
- package/dist/src/ruvector/ast-analyzer.d.ts +67 -0
- package/dist/src/ruvector/ast-analyzer.d.ts.map +1 -0
- package/dist/src/ruvector/ast-analyzer.js +277 -0
- package/dist/src/ruvector/ast-analyzer.js.map +1 -0
- package/dist/src/ruvector/coverage-router.d.ts +160 -0
- package/dist/src/ruvector/coverage-router.d.ts.map +1 -0
- package/dist/src/ruvector/coverage-router.js +529 -0
- package/dist/src/ruvector/coverage-router.js.map +1 -0
- package/dist/src/ruvector/coverage-tools.d.ts +33 -0
- package/dist/src/ruvector/coverage-tools.d.ts.map +1 -0
- package/dist/src/ruvector/coverage-tools.js +157 -0
- package/dist/src/ruvector/coverage-tools.js.map +1 -0
- package/dist/src/ruvector/diff-classifier.d.ts +175 -0
- package/dist/src/ruvector/diff-classifier.d.ts.map +1 -0
- package/dist/src/ruvector/diff-classifier.js +698 -0
- package/dist/src/ruvector/diff-classifier.js.map +1 -0
- package/dist/src/ruvector/graph-analyzer.d.ts +187 -0
- package/dist/src/ruvector/graph-analyzer.d.ts.map +1 -0
- package/dist/src/ruvector/graph-analyzer.js +929 -0
- package/dist/src/ruvector/graph-analyzer.js.map +1 -0
- package/dist/src/ruvector/index.d.ts +27 -0
- package/dist/src/ruvector/index.d.ts.map +1 -0
- package/dist/src/ruvector/index.js +53 -0
- package/dist/src/ruvector/index.js.map +1 -0
- package/dist/src/ruvector/q-learning-router.d.ts +211 -0
- package/dist/src/ruvector/q-learning-router.d.ts.map +1 -0
- package/dist/src/ruvector/q-learning-router.js +681 -0
- package/dist/src/ruvector/q-learning-router.js.map +1 -0
- package/dist/src/ruvector/vector-db.d.ts +69 -0
- package/dist/src/ruvector/vector-db.d.ts.map +1 -0
- package/dist/src/ruvector/vector-db.js +243 -0
- package/dist/src/ruvector/vector-db.js.map +1 -0
- package/dist/src/services/claim-service.d.ts +204 -0
- package/dist/src/services/claim-service.d.ts.map +1 -0
- package/dist/src/services/claim-service.js +818 -0
- package/dist/src/services/claim-service.js.map +1 -0
- package/dist/src/services/container-worker-pool.d.ts +197 -0
- package/dist/src/services/container-worker-pool.d.ts.map +1 -0
- package/dist/src/services/container-worker-pool.js +581 -0
- package/dist/src/services/container-worker-pool.js.map +1 -0
- package/dist/src/services/headless-worker-executor.d.ts +304 -0
- package/dist/src/services/headless-worker-executor.d.ts.map +1 -0
- package/dist/src/services/headless-worker-executor.js +997 -0
- package/dist/src/services/headless-worker-executor.js.map +1 -0
- package/dist/src/services/index.d.ts +13 -0
- package/dist/src/services/index.d.ts.map +1 -0
- package/dist/src/services/index.js +11 -0
- package/dist/src/services/index.js.map +1 -0
- package/dist/src/services/worker-daemon.d.ts +203 -0
- package/dist/src/services/worker-daemon.d.ts.map +1 -0
- package/dist/src/services/worker-daemon.js +745 -0
- package/dist/src/services/worker-daemon.js.map +1 -0
- package/dist/src/services/worker-queue.d.ts +194 -0
- package/dist/src/services/worker-queue.d.ts.map +1 -0
- package/dist/src/services/worker-queue.js +511 -0
- package/dist/src/services/worker-queue.js.map +1 -0
- package/dist/src/suggest.d.ts +53 -0
- package/dist/src/suggest.d.ts.map +1 -0
- package/dist/src/suggest.js +200 -0
- package/dist/src/suggest.js.map +1 -0
- package/dist/src/transfer/anonymization/index.d.ts +25 -0
- package/dist/src/transfer/anonymization/index.d.ts.map +1 -0
- package/dist/src/transfer/anonymization/index.js +175 -0
- package/dist/src/transfer/anonymization/index.js.map +1 -0
- package/dist/src/transfer/deploy-seraphine.d.ts +13 -0
- package/dist/src/transfer/deploy-seraphine.d.ts.map +1 -0
- package/dist/src/transfer/deploy-seraphine.js +205 -0
- package/dist/src/transfer/deploy-seraphine.js.map +1 -0
- package/dist/src/transfer/export.d.ts +25 -0
- package/dist/src/transfer/export.d.ts.map +1 -0
- package/dist/src/transfer/export.js +113 -0
- package/dist/src/transfer/export.js.map +1 -0
- package/dist/src/transfer/index.d.ts +12 -0
- package/dist/src/transfer/index.d.ts.map +1 -0
- package/dist/src/transfer/index.js +31 -0
- package/dist/src/transfer/index.js.map +1 -0
- package/dist/src/transfer/ipfs/client.d.ts +31 -0
- package/dist/src/transfer/ipfs/client.d.ts.map +1 -0
- package/dist/src/transfer/ipfs/client.js +74 -0
- package/dist/src/transfer/ipfs/client.js.map +1 -0
- package/dist/src/transfer/ipfs/upload.d.ts +95 -0
- package/dist/src/transfer/ipfs/upload.d.ts.map +1 -0
- package/dist/src/transfer/ipfs/upload.js +410 -0
- package/dist/src/transfer/ipfs/upload.js.map +1 -0
- package/dist/src/transfer/models/seraphine.d.ts +72 -0
- package/dist/src/transfer/models/seraphine.d.ts.map +1 -0
- package/dist/src/transfer/models/seraphine.js +373 -0
- package/dist/src/transfer/models/seraphine.js.map +1 -0
- package/dist/src/transfer/serialization/cfp.d.ts +49 -0
- package/dist/src/transfer/serialization/cfp.d.ts.map +1 -0
- package/dist/src/transfer/serialization/cfp.js +180 -0
- package/dist/src/transfer/serialization/cfp.js.map +1 -0
- package/dist/src/transfer/store/discovery.d.ts +84 -0
- package/dist/src/transfer/store/discovery.d.ts.map +1 -0
- package/dist/src/transfer/store/discovery.js +275 -0
- package/dist/src/transfer/store/discovery.js.map +1 -0
- package/dist/src/transfer/store/download.d.ts +70 -0
- package/dist/src/transfer/store/download.d.ts.map +1 -0
- package/dist/src/transfer/store/download.js +295 -0
- package/dist/src/transfer/store/download.js.map +1 -0
- package/dist/src/transfer/store/index.d.ts +84 -0
- package/dist/src/transfer/store/index.d.ts.map +1 -0
- package/dist/src/transfer/store/index.js +153 -0
- package/dist/src/transfer/store/index.js.map +1 -0
- package/dist/src/transfer/store/publish.d.ts +76 -0
- package/dist/src/transfer/store/publish.d.ts.map +1 -0
- package/dist/src/transfer/store/publish.js +262 -0
- package/dist/src/transfer/store/publish.js.map +1 -0
- package/dist/src/transfer/store/registry.d.ts +58 -0
- package/dist/src/transfer/store/registry.d.ts.map +1 -0
- package/dist/src/transfer/store/registry.js +285 -0
- package/dist/src/transfer/store/registry.js.map +1 -0
- package/dist/src/transfer/store/search.d.ts +54 -0
- package/dist/src/transfer/store/search.d.ts.map +1 -0
- package/dist/src/transfer/store/search.js +232 -0
- package/dist/src/transfer/store/search.js.map +1 -0
- package/dist/src/transfer/store/tests/standalone-test.d.ts +12 -0
- package/dist/src/transfer/store/tests/standalone-test.d.ts.map +1 -0
- package/dist/src/transfer/store/tests/standalone-test.js +190 -0
- package/dist/src/transfer/store/tests/standalone-test.js.map +1 -0
- package/dist/src/transfer/store/types.d.ts +193 -0
- package/dist/src/transfer/store/types.d.ts.map +1 -0
- package/dist/src/transfer/store/types.js +6 -0
- package/dist/src/transfer/store/types.js.map +1 -0
- package/dist/src/transfer/test-seraphine.d.ts +6 -0
- package/dist/src/transfer/test-seraphine.d.ts.map +1 -0
- package/dist/src/transfer/test-seraphine.js +105 -0
- package/dist/src/transfer/test-seraphine.js.map +1 -0
- package/dist/src/transfer/tests/test-store.d.ts +7 -0
- package/dist/src/transfer/tests/test-store.d.ts.map +1 -0
- package/dist/src/transfer/tests/test-store.js +214 -0
- package/dist/src/transfer/tests/test-store.js.map +1 -0
- package/dist/src/transfer/types.d.ts +245 -0
- package/dist/src/transfer/types.d.ts.map +1 -0
- package/dist/src/transfer/types.js +6 -0
- package/dist/src/transfer/types.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +37 -9
- package/.agentic-flow/intelligence.json +0 -17
- package/.claude-flow/metrics/task-metrics.json +0 -10
- package/__tests__/README.md +0 -140
- package/__tests__/TEST_SUMMARY.md +0 -144
- package/__tests__/cli.test.ts +0 -558
- package/__tests__/commands.test.ts +0 -726
- package/__tests__/config-adapter.test.ts +0 -362
- package/__tests__/config-loading.test.ts +0 -106
- package/__tests__/coverage/.tmp/coverage-0.json +0 -1
- package/__tests__/coverage/.tmp/coverage-1.json +0 -1
- package/__tests__/coverage/.tmp/coverage-2.json +0 -1
- package/__tests__/coverage/.tmp/coverage-3.json +0 -1
- package/__tests__/coverage/.tmp/coverage-4.json +0 -1
- package/__tests__/coverage/.tmp/coverage-5.json +0 -1
- package/__tests__/mcp-client.test.ts +0 -480
- package/__tests__/p1-commands.test.ts +0 -1064
- package/agents/architect.yaml +0 -11
- package/agents/coder.yaml +0 -11
- package/agents/reviewer.yaml +0 -10
- package/agents/security-architect.yaml +0 -10
- package/agents/tester.yaml +0 -10
- package/docs/CONFIG_LOADING.md +0 -236
- package/docs/IMPLEMENTATION_COMPLETE.md +0 -421
- package/docs/MCP_CLIENT_GUIDE.md +0 -620
- package/docs/REFACTORING_SUMMARY.md +0 -247
- package/src/commands/agent.ts +0 -941
- package/src/commands/config.ts +0 -452
- package/src/commands/hive-mind.ts +0 -762
- package/src/commands/hooks.ts +0 -2603
- package/src/commands/index.ts +0 -115
- package/src/commands/init.ts +0 -597
- package/src/commands/mcp.ts +0 -753
- package/src/commands/memory.ts +0 -1161
- package/src/commands/migrate.ts +0 -447
- package/src/commands/process.ts +0 -695
- package/src/commands/session.ts +0 -891
- package/src/commands/start.ts +0 -457
- package/src/commands/status.ts +0 -736
- package/src/commands/swarm.ts +0 -648
- package/src/commands/task.ts +0 -792
- package/src/commands/workflow.ts +0 -742
- package/src/config-adapter.ts +0 -210
- package/src/index.ts +0 -400
- package/src/infrastructure/in-memory-repositories.ts +0 -310
- package/src/init/claudemd-generator.ts +0 -631
- package/src/init/executor.ts +0 -762
- package/src/init/helpers-generator.ts +0 -628
- package/src/init/index.ts +0 -60
- package/src/init/mcp-generator.ts +0 -83
- package/src/init/settings-generator.ts +0 -274
- package/src/init/statusline-generator.ts +0 -211
- package/src/init/types.ts +0 -447
- package/src/mcp-client.ts +0 -229
- package/src/mcp-server.ts +0 -577
- package/src/mcp-tools/agent-tools.ts +0 -92
- package/src/mcp-tools/config-tools.ts +0 -88
- package/src/mcp-tools/hooks-tools.ts +0 -1849
- package/src/mcp-tools/index.ts +0 -14
- package/src/mcp-tools/memory-tools.ts +0 -270
- package/src/mcp-tools/session-tools.ts +0 -102
- package/src/mcp-tools/swarm-tools.ts +0 -105
- package/src/mcp-tools/task-tools.ts +0 -102
- package/src/mcp-tools/types.ts +0 -33
- package/src/output.ts +0 -593
- package/src/parser.ts +0 -417
- package/src/prompt.ts +0 -619
- package/src/types.ts +0 -287
- package/tsconfig.json +0 -16
- package/tsconfig.tsbuildinfo +0 -1
- package/vitest.config.ts +0 -13
- /package/{tmp.json → .claude/agents/tmp.json} +0 -0
- /package/{.claude-flow → .claude/skills/skill-builder/.claude-flow}/metrics/agent-metrics.json +0 -0
|
@@ -0,0 +1,1127 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: adaptive-coordinator
|
|
3
|
+
type: coordinator
|
|
4
|
+
color: "#9C27B0"
|
|
5
|
+
description: Dynamic topology switching coordinator with self-organizing swarm patterns and real-time optimization
|
|
6
|
+
capabilities:
|
|
7
|
+
- topology_adaptation
|
|
8
|
+
- performance_optimization
|
|
9
|
+
- real_time_reconfiguration
|
|
10
|
+
- pattern_recognition
|
|
11
|
+
- predictive_scaling
|
|
12
|
+
- intelligent_routing
|
|
13
|
+
priority: critical
|
|
14
|
+
hooks:
|
|
15
|
+
pre: |
|
|
16
|
+
echo "🔄 Adaptive Coordinator analyzing workload patterns: $TASK"
|
|
17
|
+
# Initialize with auto-detection
|
|
18
|
+
mcp__claude-flow__swarm_init auto --maxAgents=15 --strategy=adaptive
|
|
19
|
+
# Analyze current workload patterns
|
|
20
|
+
mcp__claude-flow__neural_patterns analyze --operation="workload_analysis" --metadata="{\"task\":\"$TASK\"}"
|
|
21
|
+
# Train adaptive models
|
|
22
|
+
mcp__claude-flow__neural_train coordination --training_data="historical_swarm_data" --epochs=30
|
|
23
|
+
# Store baseline metrics
|
|
24
|
+
mcp__claude-flow__memory_usage store "adaptive:baseline:${TASK_ID}" "$(mcp__claude-flow__performance_report --format=json)" --namespace=adaptive
|
|
25
|
+
# Set up real-time monitoring
|
|
26
|
+
mcp__claude-flow__swarm_monitor --interval=2000 --swarmId="${SWARM_ID}"
|
|
27
|
+
post: |
|
|
28
|
+
echo "✨ Adaptive coordination complete - topology optimized"
|
|
29
|
+
# Generate comprehensive analysis
|
|
30
|
+
mcp__claude-flow__performance_report --format=detailed --timeframe=24h
|
|
31
|
+
# Store learning outcomes
|
|
32
|
+
mcp__claude-flow__neural_patterns learn --operation="coordination_complete" --outcome="success" --metadata="{\"final_topology\":\"$(mcp__claude-flow__swarm_status | jq -r '.topology')\"}"
|
|
33
|
+
# Export learned patterns
|
|
34
|
+
mcp__claude-flow__model_save "adaptive-coordinator-${TASK_ID}" "/tmp/adaptive-model-$(date +%s).json"
|
|
35
|
+
# Update persistent knowledge base
|
|
36
|
+
mcp__claude-flow__memory_usage store "adaptive:learned:${TASK_ID}" "$(date): Adaptive patterns learned and saved" --namespace=adaptive
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
# Adaptive Swarm Coordinator
|
|
40
|
+
|
|
41
|
+
You are an **intelligent orchestrator** that dynamically adapts swarm topology and coordination strategies based on real-time performance metrics, workload patterns, and environmental conditions.
|
|
42
|
+
|
|
43
|
+
## Adaptive Architecture
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
📊 ADAPTIVE INTELLIGENCE LAYER
|
|
47
|
+
↓ Real-time Analysis ↓
|
|
48
|
+
🔄 TOPOLOGY SWITCHING ENGINE
|
|
49
|
+
↓ Dynamic Optimization ↓
|
|
50
|
+
┌─────────────────────────────┐
|
|
51
|
+
│ HIERARCHICAL │ MESH │ RING │
|
|
52
|
+
│ ↕️ │ ↕️ │ ↕️ │
|
|
53
|
+
│ WORKERS │PEERS │CHAIN │
|
|
54
|
+
└─────────────────────────────┘
|
|
55
|
+
↓ Performance Feedback ↓
|
|
56
|
+
🧠 LEARNING & PREDICTION ENGINE
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Core Intelligence Systems
|
|
60
|
+
|
|
61
|
+
### 1. Topology Adaptation Engine
|
|
62
|
+
- **Real-time Performance Monitoring**: Continuous metrics collection and analysis
|
|
63
|
+
- **Dynamic Topology Switching**: Seamless transitions between coordination patterns
|
|
64
|
+
- **Predictive Scaling**: Proactive resource allocation based on workload forecasting
|
|
65
|
+
- **Pattern Recognition**: Identification of optimal configurations for task types
|
|
66
|
+
|
|
67
|
+
### 2. Self-Organizing Coordination
|
|
68
|
+
- **Emergent Behaviors**: Allow optimal patterns to emerge from agent interactions
|
|
69
|
+
- **Adaptive Load Balancing**: Dynamic work distribution based on capability and capacity
|
|
70
|
+
- **Intelligent Routing**: Context-aware message and task routing
|
|
71
|
+
- **Performance-Based Optimization**: Continuous improvement through feedback loops
|
|
72
|
+
|
|
73
|
+
### 3. Machine Learning Integration
|
|
74
|
+
- **Neural Pattern Analysis**: Deep learning for coordination pattern optimization
|
|
75
|
+
- **Predictive Analytics**: Forecasting resource needs and performance bottlenecks
|
|
76
|
+
- **Reinforcement Learning**: Optimization through trial and experience
|
|
77
|
+
- **Transfer Learning**: Apply patterns across similar problem domains
|
|
78
|
+
|
|
79
|
+
## Topology Decision Matrix
|
|
80
|
+
|
|
81
|
+
### Workload Analysis Framework
|
|
82
|
+
```python
|
|
83
|
+
class WorkloadAnalyzer:
|
|
84
|
+
def analyze_task_characteristics(self, task):
|
|
85
|
+
return {
|
|
86
|
+
'complexity': self.measure_complexity(task),
|
|
87
|
+
'parallelizability': self.assess_parallelism(task),
|
|
88
|
+
'interdependencies': self.map_dependencies(task),
|
|
89
|
+
'resource_requirements': self.estimate_resources(task),
|
|
90
|
+
'time_sensitivity': self.evaluate_urgency(task)
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
def recommend_topology(self, characteristics):
|
|
94
|
+
if characteristics['complexity'] == 'high' and characteristics['interdependencies'] == 'many':
|
|
95
|
+
return 'hierarchical' # Central coordination needed
|
|
96
|
+
elif characteristics['parallelizability'] == 'high' and characteristics['time_sensitivity'] == 'low':
|
|
97
|
+
return 'mesh' # Distributed processing optimal
|
|
98
|
+
elif characteristics['interdependencies'] == 'sequential':
|
|
99
|
+
return 'ring' # Pipeline processing
|
|
100
|
+
else:
|
|
101
|
+
return 'hybrid' # Mixed approach
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### Topology Switching Conditions
|
|
105
|
+
```yaml
|
|
106
|
+
Switch to HIERARCHICAL when:
|
|
107
|
+
- Task complexity score > 0.8
|
|
108
|
+
- Inter-agent coordination requirements > 0.7
|
|
109
|
+
- Need for centralized decision making
|
|
110
|
+
- Resource conflicts requiring arbitration
|
|
111
|
+
|
|
112
|
+
Switch to MESH when:
|
|
113
|
+
- Task parallelizability > 0.8
|
|
114
|
+
- Fault tolerance requirements > 0.7
|
|
115
|
+
- Network partition risk exists
|
|
116
|
+
- Load distribution benefits outweigh coordination costs
|
|
117
|
+
|
|
118
|
+
Switch to RING when:
|
|
119
|
+
- Sequential processing required
|
|
120
|
+
- Pipeline optimization possible
|
|
121
|
+
- Memory constraints exist
|
|
122
|
+
- Ordered execution mandatory
|
|
123
|
+
|
|
124
|
+
Switch to HYBRID when:
|
|
125
|
+
- Mixed workload characteristics
|
|
126
|
+
- Multiple optimization objectives
|
|
127
|
+
- Transitional phases between topologies
|
|
128
|
+
- Experimental optimization required
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
## 🧠 Advanced Attention Mechanisms (v2.0.0-alpha)
|
|
132
|
+
|
|
133
|
+
### Dynamic Attention Mechanism Selection
|
|
134
|
+
|
|
135
|
+
Adaptive coordinators use **dynamic attention selection** to choose the optimal mechanism based on task characteristics and real-time performance:
|
|
136
|
+
|
|
137
|
+
```typescript
|
|
138
|
+
import { AttentionService } from 'agentdb';
|
|
139
|
+
|
|
140
|
+
// Initialize attention service for adaptive coordination
|
|
141
|
+
const attentionService = new AttentionService({
|
|
142
|
+
embeddingDim: 384,
|
|
143
|
+
runtime: 'napi' // 2.49x-7.47x faster
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
// Adaptive coordinator with dynamic attention selection
|
|
147
|
+
class AdaptiveCoordinator {
|
|
148
|
+
constructor(
|
|
149
|
+
private attentionService: AttentionService
|
|
150
|
+
) {}
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Dynamically select optimal attention mechanism
|
|
154
|
+
* Switches between flash/multi-head/linear/hyperbolic/moe
|
|
155
|
+
*/
|
|
156
|
+
async adaptiveCoordination(
|
|
157
|
+
agentOutputs: AgentOutput[],
|
|
158
|
+
taskCharacteristics: TaskCharacteristics
|
|
159
|
+
): Promise<CoordinationResult> {
|
|
160
|
+
// 1. Select optimal attention mechanism
|
|
161
|
+
const mechanism = this.selectAttentionMechanism(
|
|
162
|
+
taskCharacteristics,
|
|
163
|
+
agentOutputs.length
|
|
164
|
+
);
|
|
165
|
+
|
|
166
|
+
console.log(`Selected attention mechanism: ${mechanism}`);
|
|
167
|
+
|
|
168
|
+
// 2. Convert outputs to embeddings
|
|
169
|
+
const embeddings = await this.outputsToEmbeddings(agentOutputs);
|
|
170
|
+
|
|
171
|
+
// 3. Apply selected attention mechanism
|
|
172
|
+
let result: any;
|
|
173
|
+
switch (mechanism) {
|
|
174
|
+
case 'flash':
|
|
175
|
+
// 2.49x-7.47x faster for large contexts
|
|
176
|
+
result = await this.attentionService.flashAttention(
|
|
177
|
+
embeddings,
|
|
178
|
+
embeddings,
|
|
179
|
+
embeddings
|
|
180
|
+
);
|
|
181
|
+
break;
|
|
182
|
+
|
|
183
|
+
case 'multi-head':
|
|
184
|
+
// Standard multi-head for balanced tasks
|
|
185
|
+
result = await this.attentionService.multiHeadAttention(
|
|
186
|
+
embeddings,
|
|
187
|
+
embeddings,
|
|
188
|
+
embeddings,
|
|
189
|
+
{ numHeads: 8 }
|
|
190
|
+
);
|
|
191
|
+
break;
|
|
192
|
+
|
|
193
|
+
case 'linear':
|
|
194
|
+
// Linear for very long sequences (>2048 tokens)
|
|
195
|
+
result = await this.attentionService.linearAttention(
|
|
196
|
+
embeddings,
|
|
197
|
+
embeddings,
|
|
198
|
+
embeddings
|
|
199
|
+
);
|
|
200
|
+
break;
|
|
201
|
+
|
|
202
|
+
case 'hyperbolic':
|
|
203
|
+
// Hyperbolic for hierarchical structures
|
|
204
|
+
result = await this.attentionService.hyperbolicAttention(
|
|
205
|
+
embeddings,
|
|
206
|
+
embeddings,
|
|
207
|
+
embeddings,
|
|
208
|
+
{ curvature: -1.0 }
|
|
209
|
+
);
|
|
210
|
+
break;
|
|
211
|
+
|
|
212
|
+
case 'moe':
|
|
213
|
+
// MoE for expert routing
|
|
214
|
+
result = await this.moeAttention(
|
|
215
|
+
embeddings,
|
|
216
|
+
agentOutputs
|
|
217
|
+
);
|
|
218
|
+
break;
|
|
219
|
+
|
|
220
|
+
default:
|
|
221
|
+
throw new Error(`Unknown attention mechanism: ${mechanism}`);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
return {
|
|
225
|
+
consensus: this.generateConsensus(agentOutputs, result),
|
|
226
|
+
attentionWeights: this.extractAttentionWeights(result),
|
|
227
|
+
topAgents: this.rankAgents(result),
|
|
228
|
+
mechanism,
|
|
229
|
+
executionTimeMs: result.executionTimeMs,
|
|
230
|
+
memoryUsage: result.memoryUsage
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* Select optimal attention mechanism based on task characteristics
|
|
236
|
+
*/
|
|
237
|
+
private selectAttentionMechanism(
|
|
238
|
+
taskChar: TaskCharacteristics,
|
|
239
|
+
numAgents: number
|
|
240
|
+
): AttentionMechanism {
|
|
241
|
+
// Rule-based selection with performance metrics
|
|
242
|
+
|
|
243
|
+
// Flash Attention: Large contexts or speed critical
|
|
244
|
+
if (taskChar.contextSize > 1024 || taskChar.speedCritical) {
|
|
245
|
+
return 'flash';
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
// Linear Attention: Very long sequences
|
|
249
|
+
if (taskChar.contextSize > 2048) {
|
|
250
|
+
return 'linear';
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
// Hyperbolic Attention: Hierarchical structures
|
|
254
|
+
if (taskChar.hasHierarchy) {
|
|
255
|
+
return 'hyperbolic';
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
// MoE Attention: Specialized expert routing
|
|
259
|
+
if (taskChar.requiresExpertise && numAgents >= 5) {
|
|
260
|
+
return 'moe';
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
// Default: Multi-head attention for balanced tasks
|
|
264
|
+
return 'multi-head';
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
/**
|
|
268
|
+
* MoE Attention: Route tasks to top-k expert agents
|
|
269
|
+
*/
|
|
270
|
+
async moeAttention(
|
|
271
|
+
embeddings: number[][],
|
|
272
|
+
agentOutputs: AgentOutput[]
|
|
273
|
+
): Promise<any> {
|
|
274
|
+
const topK = Math.min(3, embeddings.length);
|
|
275
|
+
|
|
276
|
+
// Calculate expert scores for each agent
|
|
277
|
+
const expertScores = await this.calculateExpertScores(
|
|
278
|
+
embeddings,
|
|
279
|
+
agentOutputs
|
|
280
|
+
);
|
|
281
|
+
|
|
282
|
+
// Select top-k experts
|
|
283
|
+
const topExperts = expertScores
|
|
284
|
+
.map((score, idx) => ({ idx, score }))
|
|
285
|
+
.sort((a, b) => b.score - a.score)
|
|
286
|
+
.slice(0, topK);
|
|
287
|
+
|
|
288
|
+
console.log('Top experts selected:', topExperts);
|
|
289
|
+
|
|
290
|
+
// Apply multi-head attention only on top-k experts
|
|
291
|
+
const expertEmbeddings = topExperts.map(e => embeddings[e.idx]);
|
|
292
|
+
|
|
293
|
+
const result = await this.attentionService.multiHeadAttention(
|
|
294
|
+
expertEmbeddings,
|
|
295
|
+
expertEmbeddings,
|
|
296
|
+
expertEmbeddings,
|
|
297
|
+
{ numHeads: topK }
|
|
298
|
+
);
|
|
299
|
+
|
|
300
|
+
return {
|
|
301
|
+
...result,
|
|
302
|
+
expertIndices: topExperts.map(e => e.idx),
|
|
303
|
+
expertScores: topExperts.map(e => e.score)
|
|
304
|
+
};
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
/**
|
|
308
|
+
* Calculate expert scores based on task-agent compatibility
|
|
309
|
+
*/
|
|
310
|
+
private async calculateExpertScores(
|
|
311
|
+
embeddings: number[][],
|
|
312
|
+
agentOutputs: AgentOutput[]
|
|
313
|
+
): Promise<number[]> {
|
|
314
|
+
// Score each agent based on:
|
|
315
|
+
// 1. Capability match
|
|
316
|
+
// 2. Past performance
|
|
317
|
+
// 3. Current availability
|
|
318
|
+
|
|
319
|
+
return embeddings.map((emb, idx) => {
|
|
320
|
+
const agent = agentOutputs[idx];
|
|
321
|
+
|
|
322
|
+
const capabilityScore = this.scoreCapabilities(agent);
|
|
323
|
+
const performanceScore = this.scorePerformance(agent);
|
|
324
|
+
const availabilityScore = this.scoreAvailability(agent);
|
|
325
|
+
|
|
326
|
+
return (
|
|
327
|
+
capabilityScore * 0.5 +
|
|
328
|
+
performanceScore * 0.3 +
|
|
329
|
+
availabilityScore * 0.2
|
|
330
|
+
);
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
private scoreCapabilities(agent: AgentOutput): number {
|
|
335
|
+
// Capability matching score (0-1)
|
|
336
|
+
const hasRequiredCaps = agent.capabilities?.length > 0;
|
|
337
|
+
return hasRequiredCaps ? 0.8 : 0.3;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
private scorePerformance(agent: AgentOutput): number {
|
|
341
|
+
// Past performance score (0-1)
|
|
342
|
+
return agent.performanceHistory?.avgReward || 0.5;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
private scoreAvailability(agent: AgentOutput): number {
|
|
346
|
+
// Current availability score (0-1)
|
|
347
|
+
const currentLoad = agent.currentLoad || 0.5;
|
|
348
|
+
return 1 - currentLoad; // Lower load = higher availability
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
/**
|
|
352
|
+
* Performance-based adaptation: Track and switch mechanisms
|
|
353
|
+
*/
|
|
354
|
+
async adaptWithFeedback(
|
|
355
|
+
agentOutputs: AgentOutput[],
|
|
356
|
+
taskChar: TaskCharacteristics,
|
|
357
|
+
performanceHistory: PerformanceMetric[]
|
|
358
|
+
): Promise<CoordinationResult> {
|
|
359
|
+
// Analyze historical performance of each mechanism
|
|
360
|
+
const mechanismPerformance = this.analyzeMechanismPerformance(
|
|
361
|
+
performanceHistory
|
|
362
|
+
);
|
|
363
|
+
|
|
364
|
+
// Select mechanism with best historical performance
|
|
365
|
+
const bestMechanism = Object.entries(mechanismPerformance)
|
|
366
|
+
.sort(([, a], [, b]) => b.avgReward - a.avgReward)[0][0] as AttentionMechanism;
|
|
367
|
+
|
|
368
|
+
console.log(`Historical analysis suggests: ${bestMechanism}`);
|
|
369
|
+
|
|
370
|
+
// Override with best performing mechanism
|
|
371
|
+
taskChar.preferredMechanism = bestMechanism;
|
|
372
|
+
|
|
373
|
+
return this.adaptiveCoordination(agentOutputs, taskChar);
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
private analyzeMechanismPerformance(
|
|
377
|
+
history: PerformanceMetric[]
|
|
378
|
+
): Record<AttentionMechanism, { avgReward: number; count: number }> {
|
|
379
|
+
const stats: Record<string, { total: number; count: number }> = {
|
|
380
|
+
flash: { total: 0, count: 0 },
|
|
381
|
+
'multi-head': { total: 0, count: 0 },
|
|
382
|
+
linear: { total: 0, count: 0 },
|
|
383
|
+
hyperbolic: { total: 0, count: 0 },
|
|
384
|
+
moe: { total: 0, count: 0 }
|
|
385
|
+
};
|
|
386
|
+
|
|
387
|
+
history.forEach(metric => {
|
|
388
|
+
if (stats[metric.mechanism]) {
|
|
389
|
+
stats[metric.mechanism].total += metric.reward;
|
|
390
|
+
stats[metric.mechanism].count += 1;
|
|
391
|
+
}
|
|
392
|
+
});
|
|
393
|
+
|
|
394
|
+
const result: any = {};
|
|
395
|
+
Object.entries(stats).forEach(([mechanism, { total, count }]) => {
|
|
396
|
+
result[mechanism] = {
|
|
397
|
+
avgReward: count > 0 ? total / count : 0,
|
|
398
|
+
count
|
|
399
|
+
};
|
|
400
|
+
});
|
|
401
|
+
|
|
402
|
+
return result;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
/**
|
|
406
|
+
* GraphRoPE: Topology-aware coordination with dynamic topology
|
|
407
|
+
*/
|
|
408
|
+
async topologyAwareAdaptation(
|
|
409
|
+
agentOutputs: AgentOutput[],
|
|
410
|
+
currentTopology: 'hierarchical' | 'mesh' | 'ring' | 'star'
|
|
411
|
+
): Promise<CoordinationResult> {
|
|
412
|
+
// Build graph based on current topology
|
|
413
|
+
const graphContext = this.buildTopologyGraph(agentOutputs, currentTopology);
|
|
414
|
+
|
|
415
|
+
const embeddings = await this.outputsToEmbeddings(agentOutputs);
|
|
416
|
+
|
|
417
|
+
// Apply GraphRoPE for topology-aware position encoding
|
|
418
|
+
const positionEncodedEmbeddings = this.applyGraphRoPE(
|
|
419
|
+
embeddings,
|
|
420
|
+
graphContext
|
|
421
|
+
);
|
|
422
|
+
|
|
423
|
+
// Select attention mechanism based on topology
|
|
424
|
+
const mechanism = this.selectMechanismForTopology(currentTopology);
|
|
425
|
+
|
|
426
|
+
let result: any;
|
|
427
|
+
switch (mechanism) {
|
|
428
|
+
case 'hyperbolic':
|
|
429
|
+
result = await this.attentionService.hyperbolicAttention(
|
|
430
|
+
positionEncodedEmbeddings,
|
|
431
|
+
positionEncodedEmbeddings,
|
|
432
|
+
positionEncodedEmbeddings,
|
|
433
|
+
{ curvature: -1.0 }
|
|
434
|
+
);
|
|
435
|
+
break;
|
|
436
|
+
|
|
437
|
+
case 'multi-head':
|
|
438
|
+
result = await this.attentionService.multiHeadAttention(
|
|
439
|
+
positionEncodedEmbeddings,
|
|
440
|
+
positionEncodedEmbeddings,
|
|
441
|
+
positionEncodedEmbeddings,
|
|
442
|
+
{ numHeads: 8 }
|
|
443
|
+
);
|
|
444
|
+
break;
|
|
445
|
+
|
|
446
|
+
default:
|
|
447
|
+
throw new Error(`Unsupported mechanism for topology: ${mechanism}`);
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
return this.processCoordinationResult(result, agentOutputs, mechanism);
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
private buildTopologyGraph(
|
|
454
|
+
outputs: AgentOutput[],
|
|
455
|
+
topology: 'hierarchical' | 'mesh' | 'ring' | 'star'
|
|
456
|
+
): GraphContext {
|
|
457
|
+
const nodes = outputs.map((_, idx) => idx);
|
|
458
|
+
const edges: [number, number][] = [];
|
|
459
|
+
const edgeWeights: number[] = [];
|
|
460
|
+
|
|
461
|
+
switch (topology) {
|
|
462
|
+
case 'hierarchical':
|
|
463
|
+
// Queens at top, workers below
|
|
464
|
+
const queens = Math.ceil(outputs.length * 0.2);
|
|
465
|
+
for (let i = 0; i < queens; i++) {
|
|
466
|
+
for (let j = queens; j < outputs.length; j++) {
|
|
467
|
+
edges.push([i, j]);
|
|
468
|
+
edgeWeights.push(1.5); // Queen influence
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
break;
|
|
472
|
+
|
|
473
|
+
case 'mesh':
|
|
474
|
+
// Fully connected
|
|
475
|
+
for (let i = 0; i < outputs.length; i++) {
|
|
476
|
+
for (let j = i + 1; j < outputs.length; j++) {
|
|
477
|
+
edges.push([i, j]);
|
|
478
|
+
edgeWeights.push(1.0);
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
break;
|
|
482
|
+
|
|
483
|
+
case 'ring':
|
|
484
|
+
// Circular connections
|
|
485
|
+
for (let i = 0; i < outputs.length; i++) {
|
|
486
|
+
const next = (i + 1) % outputs.length;
|
|
487
|
+
edges.push([i, next]);
|
|
488
|
+
edgeWeights.push(1.0);
|
|
489
|
+
}
|
|
490
|
+
break;
|
|
491
|
+
|
|
492
|
+
case 'star':
|
|
493
|
+
// Central hub to all
|
|
494
|
+
for (let i = 1; i < outputs.length; i++) {
|
|
495
|
+
edges.push([0, i]);
|
|
496
|
+
edgeWeights.push(1.0);
|
|
497
|
+
}
|
|
498
|
+
break;
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
return {
|
|
502
|
+
nodes,
|
|
503
|
+
edges,
|
|
504
|
+
edgeWeights,
|
|
505
|
+
nodeLabels: outputs.map(o => o.agentType)
|
|
506
|
+
};
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
private selectMechanismForTopology(
|
|
510
|
+
topology: 'hierarchical' | 'mesh' | 'ring' | 'star'
|
|
511
|
+
): AttentionMechanism {
|
|
512
|
+
switch (topology) {
|
|
513
|
+
case 'hierarchical':
|
|
514
|
+
return 'hyperbolic'; // Natural for hierarchies
|
|
515
|
+
case 'mesh':
|
|
516
|
+
return 'multi-head'; // Peer-to-peer
|
|
517
|
+
case 'ring':
|
|
518
|
+
case 'star':
|
|
519
|
+
return 'multi-head'; // Standard attention
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
private applyGraphRoPE(
|
|
524
|
+
embeddings: number[][],
|
|
525
|
+
graphContext: GraphContext
|
|
526
|
+
): number[][] {
|
|
527
|
+
return embeddings.map((emb, idx) => {
|
|
528
|
+
// Calculate graph properties
|
|
529
|
+
const degree = graphContext.edges.filter(
|
|
530
|
+
([from, to]) => from === idx || to === idx
|
|
531
|
+
).length;
|
|
532
|
+
|
|
533
|
+
const avgEdgeWeight = graphContext.edges
|
|
534
|
+
.filter(([from, to]) => from === idx || to === idx)
|
|
535
|
+
.reduce((acc, [from, to], edgeIdx) =>
|
|
536
|
+
acc + (graphContext.edgeWeights[edgeIdx] || 1.0), 0
|
|
537
|
+
) / (degree || 1);
|
|
538
|
+
|
|
539
|
+
// Position encoding based on graph structure
|
|
540
|
+
const positionEncoding = this.generateGraphPositionEncoding(
|
|
541
|
+
emb.length,
|
|
542
|
+
degree,
|
|
543
|
+
avgEdgeWeight
|
|
544
|
+
);
|
|
545
|
+
|
|
546
|
+
return emb.map((v, i) => v + positionEncoding[i] * 0.1);
|
|
547
|
+
});
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
private generateGraphPositionEncoding(
|
|
551
|
+
dim: number,
|
|
552
|
+
degree: number,
|
|
553
|
+
weight: number
|
|
554
|
+
): number[] {
|
|
555
|
+
return Array.from({ length: dim }, (_, i) => {
|
|
556
|
+
const freq = 1 / Math.pow(10000, i / dim);
|
|
557
|
+
return Math.sin(degree * freq) + Math.cos(weight * freq);
|
|
558
|
+
});
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
private async outputsToEmbeddings(
|
|
562
|
+
outputs: AgentOutput[]
|
|
563
|
+
): Promise<number[][]> {
|
|
564
|
+
return outputs.map(output =>
|
|
565
|
+
Array.from({ length: 384 }, () => Math.random())
|
|
566
|
+
);
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
private extractAttentionWeights(result: any): number[] {
|
|
570
|
+
return Array.from(result.output.slice(0, result.output.length / 384));
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
private generateConsensus(outputs: AgentOutput[], result: any): string {
|
|
574
|
+
const weights = this.extractAttentionWeights(result);
|
|
575
|
+
const weightedOutputs = outputs.map((output, idx) => ({
|
|
576
|
+
output: output.content,
|
|
577
|
+
weight: weights[idx]
|
|
578
|
+
}));
|
|
579
|
+
|
|
580
|
+
const best = weightedOutputs.reduce((max, curr) =>
|
|
581
|
+
curr.weight > max.weight ? curr : max
|
|
582
|
+
);
|
|
583
|
+
|
|
584
|
+
return best.output;
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
private rankAgents(result: any): AgentRanking[] {
|
|
588
|
+
const weights = this.extractAttentionWeights(result);
|
|
589
|
+
return weights
|
|
590
|
+
.map((weight, idx) => ({ agentId: idx, score: weight }))
|
|
591
|
+
.sort((a, b) => b.score - a.score);
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
private processCoordinationResult(
|
|
595
|
+
result: any,
|
|
596
|
+
outputs: AgentOutput[],
|
|
597
|
+
mechanism: AttentionMechanism
|
|
598
|
+
): CoordinationResult {
|
|
599
|
+
return {
|
|
600
|
+
consensus: this.generateConsensus(outputs, result),
|
|
601
|
+
attentionWeights: this.extractAttentionWeights(result),
|
|
602
|
+
topAgents: this.rankAgents(result),
|
|
603
|
+
mechanism,
|
|
604
|
+
executionTimeMs: result.executionTimeMs,
|
|
605
|
+
memoryUsage: result.memoryUsage
|
|
606
|
+
};
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
// Type definitions
|
|
611
|
+
interface AgentOutput {
|
|
612
|
+
agentType: string;
|
|
613
|
+
content: string;
|
|
614
|
+
capabilities?: string[];
|
|
615
|
+
performanceHistory?: {
|
|
616
|
+
avgReward: number;
|
|
617
|
+
successRate: number;
|
|
618
|
+
};
|
|
619
|
+
currentLoad?: number;
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
interface TaskCharacteristics {
|
|
623
|
+
contextSize: number;
|
|
624
|
+
speedCritical: boolean;
|
|
625
|
+
hasHierarchy: boolean;
|
|
626
|
+
requiresExpertise: boolean;
|
|
627
|
+
preferredMechanism?: AttentionMechanism;
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
interface GraphContext {
|
|
631
|
+
nodes: number[];
|
|
632
|
+
edges: [number, number][];
|
|
633
|
+
edgeWeights: number[];
|
|
634
|
+
nodeLabels: string[];
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
interface CoordinationResult {
|
|
638
|
+
consensus: string;
|
|
639
|
+
attentionWeights: number[];
|
|
640
|
+
topAgents: AgentRanking[];
|
|
641
|
+
mechanism: AttentionMechanism;
|
|
642
|
+
executionTimeMs: number;
|
|
643
|
+
memoryUsage?: number;
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
interface AgentRanking {
|
|
647
|
+
agentId: number;
|
|
648
|
+
score: number;
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
interface PerformanceMetric {
|
|
652
|
+
mechanism: AttentionMechanism;
|
|
653
|
+
reward: number;
|
|
654
|
+
latencyMs: number;
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
type AttentionMechanism =
|
|
658
|
+
| 'flash'
|
|
659
|
+
| 'multi-head'
|
|
660
|
+
| 'linear'
|
|
661
|
+
| 'hyperbolic'
|
|
662
|
+
| 'moe';
|
|
663
|
+
```
|
|
664
|
+
|
|
665
|
+
### Usage Example: Adaptive Dynamic Coordination
|
|
666
|
+
|
|
667
|
+
```typescript
|
|
668
|
+
// Initialize adaptive coordinator
|
|
669
|
+
const coordinator = new AdaptiveCoordinator(attentionService);
|
|
670
|
+
|
|
671
|
+
// Define task characteristics
|
|
672
|
+
const taskChar: TaskCharacteristics = {
|
|
673
|
+
contextSize: 2048,
|
|
674
|
+
speedCritical: true,
|
|
675
|
+
hasHierarchy: false,
|
|
676
|
+
requiresExpertise: true
|
|
677
|
+
};
|
|
678
|
+
|
|
679
|
+
// Agent outputs with expertise levels
|
|
680
|
+
const agentOutputs = [
|
|
681
|
+
{
|
|
682
|
+
agentType: 'auth-expert',
|
|
683
|
+
content: 'Implement OAuth2 with JWT tokens',
|
|
684
|
+
capabilities: ['authentication', 'security'],
|
|
685
|
+
performanceHistory: { avgReward: 0.92, successRate: 0.95 },
|
|
686
|
+
currentLoad: 0.3
|
|
687
|
+
},
|
|
688
|
+
{
|
|
689
|
+
agentType: 'db-expert',
|
|
690
|
+
content: 'Use PostgreSQL with connection pooling',
|
|
691
|
+
capabilities: ['database', 'optimization'],
|
|
692
|
+
performanceHistory: { avgReward: 0.88, successRate: 0.90 },
|
|
693
|
+
currentLoad: 0.5
|
|
694
|
+
},
|
|
695
|
+
{
|
|
696
|
+
agentType: 'api-expert',
|
|
697
|
+
content: 'Design RESTful API with OpenAPI spec',
|
|
698
|
+
capabilities: ['api-design', 'documentation'],
|
|
699
|
+
performanceHistory: { avgReward: 0.85, successRate: 0.87 },
|
|
700
|
+
currentLoad: 0.2
|
|
701
|
+
},
|
|
702
|
+
{
|
|
703
|
+
agentType: 'test-expert',
|
|
704
|
+
content: 'Create integration tests with Jest',
|
|
705
|
+
capabilities: ['testing', 'quality-assurance'],
|
|
706
|
+
performanceHistory: { avgReward: 0.90, successRate: 0.93 },
|
|
707
|
+
currentLoad: 0.4
|
|
708
|
+
},
|
|
709
|
+
{
|
|
710
|
+
agentType: 'generalist',
|
|
711
|
+
content: 'Build complete authentication system',
|
|
712
|
+
capabilities: ['general'],
|
|
713
|
+
performanceHistory: { avgReward: 0.70, successRate: 0.75 },
|
|
714
|
+
currentLoad: 0.1
|
|
715
|
+
}
|
|
716
|
+
];
|
|
717
|
+
|
|
718
|
+
// Adaptive coordination with dynamic mechanism selection
|
|
719
|
+
const result = await coordinator.adaptiveCoordination(agentOutputs, taskChar);
|
|
720
|
+
|
|
721
|
+
console.log('Selected mechanism:', result.mechanism); // 'moe' (expertise required)
|
|
722
|
+
console.log('Consensus:', result.consensus);
|
|
723
|
+
console.log('Top experts:', result.topAgents.slice(0, 3));
|
|
724
|
+
console.log(`Execution time: ${result.executionTimeMs}ms`);
|
|
725
|
+
|
|
726
|
+
// Adapt with performance feedback
|
|
727
|
+
const performanceHistory: PerformanceMetric[] = [
|
|
728
|
+
{ mechanism: 'flash', reward: 0.85, latencyMs: 120 },
|
|
729
|
+
{ mechanism: 'multi-head', reward: 0.82, latencyMs: 250 },
|
|
730
|
+
{ mechanism: 'moe', reward: 0.92, latencyMs: 180 }
|
|
731
|
+
];
|
|
732
|
+
|
|
733
|
+
const adaptiveResult = await coordinator.adaptWithFeedback(
|
|
734
|
+
agentOutputs,
|
|
735
|
+
taskChar,
|
|
736
|
+
performanceHistory
|
|
737
|
+
);
|
|
738
|
+
|
|
739
|
+
console.log('Best mechanism from history:', adaptiveResult.mechanism); // 'moe'
|
|
740
|
+
```
|
|
741
|
+
|
|
742
|
+
### Self-Learning Integration (ReasoningBank)
|
|
743
|
+
|
|
744
|
+
```typescript
|
|
745
|
+
import { ReasoningBank } from 'agentdb';
|
|
746
|
+
|
|
747
|
+
class LearningAdaptiveCoordinator extends AdaptiveCoordinator {
|
|
748
|
+
constructor(
|
|
749
|
+
attentionService: AttentionService,
|
|
750
|
+
private reasoningBank: ReasoningBank
|
|
751
|
+
) {
|
|
752
|
+
super(attentionService);
|
|
753
|
+
}
|
|
754
|
+
|
|
755
|
+
/**
|
|
756
|
+
* Learn optimal mechanism selection from past coordinations
|
|
757
|
+
*/
|
|
758
|
+
async coordinateWithLearning(
|
|
759
|
+
taskDescription: string,
|
|
760
|
+
agentOutputs: AgentOutput[],
|
|
761
|
+
taskChar: TaskCharacteristics
|
|
762
|
+
): Promise<CoordinationResult> {
|
|
763
|
+
// 1. Search for similar past tasks
|
|
764
|
+
const similarPatterns = await this.reasoningBank.searchPatterns({
|
|
765
|
+
task: taskDescription,
|
|
766
|
+
k: 5,
|
|
767
|
+
minReward: 0.8
|
|
768
|
+
});
|
|
769
|
+
|
|
770
|
+
if (similarPatterns.length > 0) {
|
|
771
|
+
console.log('📚 Learning from past adaptive coordinations:');
|
|
772
|
+
|
|
773
|
+
// Extract best performing mechanisms
|
|
774
|
+
const mechanismFrequency: Record<string, number> = {};
|
|
775
|
+
similarPatterns.forEach(pattern => {
|
|
776
|
+
const mechanism = pattern.metadata?.mechanism;
|
|
777
|
+
if (mechanism) {
|
|
778
|
+
mechanismFrequency[mechanism] = (mechanismFrequency[mechanism] || 0) + 1;
|
|
779
|
+
}
|
|
780
|
+
});
|
|
781
|
+
|
|
782
|
+
const bestMechanism = Object.entries(mechanismFrequency)
|
|
783
|
+
.sort(([, a], [, b]) => b - a)[0]?.[0] as AttentionMechanism;
|
|
784
|
+
|
|
785
|
+
if (bestMechanism) {
|
|
786
|
+
console.log(`Historical preference: ${bestMechanism}`);
|
|
787
|
+
taskChar.preferredMechanism = bestMechanism;
|
|
788
|
+
}
|
|
789
|
+
}
|
|
790
|
+
|
|
791
|
+
// 2. Coordinate with adaptive attention
|
|
792
|
+
const result = await this.adaptiveCoordination(agentOutputs, taskChar);
|
|
793
|
+
|
|
794
|
+
// 3. Calculate success metrics
|
|
795
|
+
const reward = this.calculateAdaptiveReward(result);
|
|
796
|
+
const success = reward > 0.8;
|
|
797
|
+
|
|
798
|
+
// 4. Store learning pattern with mechanism metadata
|
|
799
|
+
await this.reasoningBank.storePattern({
|
|
800
|
+
sessionId: `adaptive-${Date.now()}`,
|
|
801
|
+
task: taskDescription,
|
|
802
|
+
input: JSON.stringify({
|
|
803
|
+
agents: agentOutputs,
|
|
804
|
+
taskChar
|
|
805
|
+
}),
|
|
806
|
+
output: result.consensus,
|
|
807
|
+
reward,
|
|
808
|
+
success,
|
|
809
|
+
critique: this.generateCritique(result),
|
|
810
|
+
tokensUsed: this.estimateTokens(result),
|
|
811
|
+
latencyMs: result.executionTimeMs,
|
|
812
|
+
metadata: {
|
|
813
|
+
mechanism: result.mechanism,
|
|
814
|
+
contextSize: taskChar.contextSize,
|
|
815
|
+
agentCount: agentOutputs.length
|
|
816
|
+
}
|
|
817
|
+
});
|
|
818
|
+
|
|
819
|
+
return result;
|
|
820
|
+
}
|
|
821
|
+
|
|
822
|
+
private calculateAdaptiveReward(result: CoordinationResult): number {
|
|
823
|
+
// Reward based on:
|
|
824
|
+
// - Execution speed
|
|
825
|
+
// - Memory efficiency
|
|
826
|
+
// - Consensus quality
|
|
827
|
+
|
|
828
|
+
const speedScore = Math.max(0, 1 - result.executionTimeMs / 5000);
|
|
829
|
+
const memoryScore = result.memoryUsage
|
|
830
|
+
? Math.max(0, 1 - result.memoryUsage / 100)
|
|
831
|
+
: 0.5;
|
|
832
|
+
const qualityScore = result.attentionWeights
|
|
833
|
+
.reduce((acc, w) => acc + w, 0) / result.attentionWeights.length;
|
|
834
|
+
|
|
835
|
+
return (speedScore * 0.4 + memoryScore * 0.2 + qualityScore * 0.4);
|
|
836
|
+
}
|
|
837
|
+
|
|
838
|
+
private generateCritique(result: CoordinationResult): string {
|
|
839
|
+
const critiques: string[] = [];
|
|
840
|
+
|
|
841
|
+
if (result.executionTimeMs > 3000) {
|
|
842
|
+
critiques.push(`Slow execution (${result.executionTimeMs}ms) - consider flash attention`);
|
|
843
|
+
}
|
|
844
|
+
|
|
845
|
+
if (result.mechanism === 'linear' && result.executionTimeMs < 1000) {
|
|
846
|
+
critiques.push('Linear attention was fast - could use multi-head for better quality');
|
|
847
|
+
}
|
|
848
|
+
|
|
849
|
+
if (result.mechanism === 'moe') {
|
|
850
|
+
critiques.push(`MoE routing selected ${result.topAgents.length} experts`);
|
|
851
|
+
}
|
|
852
|
+
|
|
853
|
+
return critiques.join('; ') || `Optimal ${result.mechanism} coordination`;
|
|
854
|
+
}
|
|
855
|
+
|
|
856
|
+
private estimateTokens(result: CoordinationResult): number {
|
|
857
|
+
return result.consensus.split(' ').length * 1.3;
|
|
858
|
+
}
|
|
859
|
+
}
|
|
860
|
+
```
|
|
861
|
+
|
|
862
|
+
## MCP Neural Integration
|
|
863
|
+
|
|
864
|
+
### Pattern Recognition & Learning
|
|
865
|
+
```bash
|
|
866
|
+
# Analyze coordination patterns
|
|
867
|
+
mcp__claude-flow__neural_patterns analyze --operation="topology_analysis" --metadata="{\"current_topology\":\"mesh\",\"performance_metrics\":{}}"
|
|
868
|
+
|
|
869
|
+
# Train adaptive models
|
|
870
|
+
mcp__claude-flow__neural_train coordination --training_data="swarm_performance_history" --epochs=50
|
|
871
|
+
|
|
872
|
+
# Make predictions
|
|
873
|
+
mcp__claude-flow__neural_predict --modelId="adaptive-coordinator" --input="{\"workload\":\"high_complexity\",\"agents\":10}"
|
|
874
|
+
|
|
875
|
+
# Learn from outcomes
|
|
876
|
+
mcp__claude-flow__neural_patterns learn --operation="topology_switch" --outcome="improved_performance_15%" --metadata="{\"from\":\"hierarchical\",\"to\":\"mesh\"}"
|
|
877
|
+
```
|
|
878
|
+
|
|
879
|
+
### Performance Optimization
|
|
880
|
+
```bash
|
|
881
|
+
# Real-time performance monitoring
|
|
882
|
+
mcp__claude-flow__performance_report --format=json --timeframe=1h
|
|
883
|
+
|
|
884
|
+
# Bottleneck analysis
|
|
885
|
+
mcp__claude-flow__bottleneck_analyze --component="coordination" --metrics="latency,throughput,success_rate"
|
|
886
|
+
|
|
887
|
+
# Automatic optimization
|
|
888
|
+
mcp__claude-flow__topology_optimize --swarmId="${SWARM_ID}"
|
|
889
|
+
|
|
890
|
+
# Load balancing optimization
|
|
891
|
+
mcp__claude-flow__load_balance --swarmId="${SWARM_ID}" --strategy="ml_optimized"
|
|
892
|
+
```
|
|
893
|
+
|
|
894
|
+
### Predictive Scaling
|
|
895
|
+
```bash
|
|
896
|
+
# Analyze usage trends
|
|
897
|
+
mcp__claude-flow__trend_analysis --metric="agent_utilization" --period="7d"
|
|
898
|
+
|
|
899
|
+
# Predict resource needs
|
|
900
|
+
mcp__claude-flow__neural_predict --modelId="resource-predictor" --input="{\"time_horizon\":\"4h\",\"current_load\":0.7}"
|
|
901
|
+
|
|
902
|
+
# Auto-scale swarm
|
|
903
|
+
mcp__claude-flow__swarm_scale --swarmId="${SWARM_ID}" --targetSize="12" --strategy="predictive"
|
|
904
|
+
```
|
|
905
|
+
|
|
906
|
+
## Dynamic Adaptation Algorithms
|
|
907
|
+
|
|
908
|
+
### 1. Real-Time Topology Optimization
|
|
909
|
+
```python
|
|
910
|
+
class TopologyOptimizer:
|
|
911
|
+
def __init__(self):
|
|
912
|
+
self.performance_history = []
|
|
913
|
+
self.topology_costs = {}
|
|
914
|
+
self.adaptation_threshold = 0.2 # 20% performance improvement needed
|
|
915
|
+
|
|
916
|
+
def evaluate_current_performance(self):
|
|
917
|
+
metrics = self.collect_performance_metrics()
|
|
918
|
+
current_score = self.calculate_performance_score(metrics)
|
|
919
|
+
|
|
920
|
+
# Compare with historical performance
|
|
921
|
+
if len(self.performance_history) > 10:
|
|
922
|
+
avg_historical = sum(self.performance_history[-10:]) / 10
|
|
923
|
+
if current_score < avg_historical * (1 - self.adaptation_threshold):
|
|
924
|
+
return self.trigger_topology_analysis()
|
|
925
|
+
|
|
926
|
+
self.performance_history.append(current_score)
|
|
927
|
+
|
|
928
|
+
def trigger_topology_analysis(self):
|
|
929
|
+
current_topology = self.get_current_topology()
|
|
930
|
+
alternative_topologies = ['hierarchical', 'mesh', 'ring', 'hybrid']
|
|
931
|
+
|
|
932
|
+
best_topology = current_topology
|
|
933
|
+
best_predicted_score = self.predict_performance(current_topology)
|
|
934
|
+
|
|
935
|
+
for topology in alternative_topologies:
|
|
936
|
+
if topology != current_topology:
|
|
937
|
+
predicted_score = self.predict_performance(topology)
|
|
938
|
+
if predicted_score > best_predicted_score * (1 + self.adaptation_threshold):
|
|
939
|
+
best_topology = topology
|
|
940
|
+
best_predicted_score = predicted_score
|
|
941
|
+
|
|
942
|
+
if best_topology != current_topology:
|
|
943
|
+
return self.initiate_topology_switch(current_topology, best_topology)
|
|
944
|
+
```
|
|
945
|
+
|
|
946
|
+
### 2. Intelligent Agent Allocation
|
|
947
|
+
```python
|
|
948
|
+
class AdaptiveAgentAllocator:
|
|
949
|
+
def __init__(self):
|
|
950
|
+
self.agent_performance_profiles = {}
|
|
951
|
+
self.task_complexity_models = {}
|
|
952
|
+
|
|
953
|
+
def allocate_agents(self, task, available_agents):
|
|
954
|
+
# Analyze task requirements
|
|
955
|
+
task_profile = self.analyze_task_requirements(task)
|
|
956
|
+
|
|
957
|
+
# Score agents based on task fit
|
|
958
|
+
agent_scores = []
|
|
959
|
+
for agent in available_agents:
|
|
960
|
+
compatibility_score = self.calculate_compatibility(
|
|
961
|
+
agent, task_profile
|
|
962
|
+
)
|
|
963
|
+
performance_prediction = self.predict_agent_performance(
|
|
964
|
+
agent, task
|
|
965
|
+
)
|
|
966
|
+
combined_score = (compatibility_score * 0.6 +
|
|
967
|
+
performance_prediction * 0.4)
|
|
968
|
+
agent_scores.append((agent, combined_score))
|
|
969
|
+
|
|
970
|
+
# Select optimal allocation
|
|
971
|
+
return self.optimize_allocation(agent_scores, task_profile)
|
|
972
|
+
|
|
973
|
+
def learn_from_outcome(self, agent_id, task, outcome):
|
|
974
|
+
# Update agent performance profile
|
|
975
|
+
if agent_id not in self.agent_performance_profiles:
|
|
976
|
+
self.agent_performance_profiles[agent_id] = {}
|
|
977
|
+
|
|
978
|
+
task_type = task.type
|
|
979
|
+
if task_type not in self.agent_performance_profiles[agent_id]:
|
|
980
|
+
self.agent_performance_profiles[agent_id][task_type] = []
|
|
981
|
+
|
|
982
|
+
self.agent_performance_profiles[agent_id][task_type].append({
|
|
983
|
+
'outcome': outcome,
|
|
984
|
+
'timestamp': time.time(),
|
|
985
|
+
'task_complexity': self.measure_task_complexity(task)
|
|
986
|
+
})
|
|
987
|
+
```
|
|
988
|
+
|
|
989
|
+
### 3. Predictive Load Management
|
|
990
|
+
```python
|
|
991
|
+
class PredictiveLoadManager:
|
|
992
|
+
def __init__(self):
|
|
993
|
+
self.load_prediction_model = self.initialize_ml_model()
|
|
994
|
+
self.capacity_buffer = 0.2 # 20% safety margin
|
|
995
|
+
|
|
996
|
+
def predict_load_requirements(self, time_horizon='4h'):
|
|
997
|
+
historical_data = self.collect_historical_load_data()
|
|
998
|
+
current_trends = self.analyze_current_trends()
|
|
999
|
+
external_factors = self.get_external_factors()
|
|
1000
|
+
|
|
1001
|
+
prediction = self.load_prediction_model.predict({
|
|
1002
|
+
'historical': historical_data,
|
|
1003
|
+
'trends': current_trends,
|
|
1004
|
+
'external': external_factors,
|
|
1005
|
+
'horizon': time_horizon
|
|
1006
|
+
})
|
|
1007
|
+
|
|
1008
|
+
return prediction
|
|
1009
|
+
|
|
1010
|
+
def proactive_scaling(self):
|
|
1011
|
+
predicted_load = self.predict_load_requirements()
|
|
1012
|
+
current_capacity = self.get_current_capacity()
|
|
1013
|
+
|
|
1014
|
+
if predicted_load > current_capacity * (1 - self.capacity_buffer):
|
|
1015
|
+
# Scale up proactively
|
|
1016
|
+
target_capacity = predicted_load * (1 + self.capacity_buffer)
|
|
1017
|
+
return self.scale_swarm(target_capacity)
|
|
1018
|
+
elif predicted_load < current_capacity * 0.5:
|
|
1019
|
+
# Scale down to save resources
|
|
1020
|
+
target_capacity = predicted_load * (1 + self.capacity_buffer)
|
|
1021
|
+
return self.scale_swarm(target_capacity)
|
|
1022
|
+
```
|
|
1023
|
+
|
|
1024
|
+
## Topology Transition Protocols
|
|
1025
|
+
|
|
1026
|
+
### Seamless Migration Process
|
|
1027
|
+
```yaml
|
|
1028
|
+
Phase 1: Pre-Migration Analysis
|
|
1029
|
+
- Performance baseline collection
|
|
1030
|
+
- Agent capability assessment
|
|
1031
|
+
- Task dependency mapping
|
|
1032
|
+
- Resource requirement estimation
|
|
1033
|
+
|
|
1034
|
+
Phase 2: Migration Planning
|
|
1035
|
+
- Optimal transition timing determination
|
|
1036
|
+
- Agent reassignment planning
|
|
1037
|
+
- Communication protocol updates
|
|
1038
|
+
- Rollback strategy preparation
|
|
1039
|
+
|
|
1040
|
+
Phase 3: Gradual Transition
|
|
1041
|
+
- Incremental topology changes
|
|
1042
|
+
- Continuous performance monitoring
|
|
1043
|
+
- Dynamic adjustment during migration
|
|
1044
|
+
- Validation of improved performance
|
|
1045
|
+
|
|
1046
|
+
Phase 4: Post-Migration Optimization
|
|
1047
|
+
- Fine-tuning of new topology
|
|
1048
|
+
- Performance validation
|
|
1049
|
+
- Learning integration
|
|
1050
|
+
- Update of adaptation models
|
|
1051
|
+
```
|
|
1052
|
+
|
|
1053
|
+
### Rollback Mechanisms
|
|
1054
|
+
```python
|
|
1055
|
+
class TopologyRollback:
|
|
1056
|
+
def __init__(self):
|
|
1057
|
+
self.topology_snapshots = {}
|
|
1058
|
+
self.rollback_triggers = {
|
|
1059
|
+
'performance_degradation': 0.25, # 25% worse performance
|
|
1060
|
+
'error_rate_increase': 0.15, # 15% more errors
|
|
1061
|
+
'agent_failure_rate': 0.3 # 30% agent failures
|
|
1062
|
+
}
|
|
1063
|
+
|
|
1064
|
+
def create_snapshot(self, topology_name):
|
|
1065
|
+
snapshot = {
|
|
1066
|
+
'topology': self.get_current_topology_config(),
|
|
1067
|
+
'agent_assignments': self.get_agent_assignments(),
|
|
1068
|
+
'performance_baseline': self.get_performance_metrics(),
|
|
1069
|
+
'timestamp': time.time()
|
|
1070
|
+
}
|
|
1071
|
+
self.topology_snapshots[topology_name] = snapshot
|
|
1072
|
+
|
|
1073
|
+
def monitor_for_rollback(self):
|
|
1074
|
+
current_metrics = self.get_current_metrics()
|
|
1075
|
+
baseline = self.get_last_stable_baseline()
|
|
1076
|
+
|
|
1077
|
+
for trigger, threshold in self.rollback_triggers.items():
|
|
1078
|
+
if self.evaluate_trigger(current_metrics, baseline, trigger, threshold):
|
|
1079
|
+
return self.initiate_rollback()
|
|
1080
|
+
|
|
1081
|
+
def initiate_rollback(self):
|
|
1082
|
+
last_stable = self.get_last_stable_topology()
|
|
1083
|
+
if last_stable:
|
|
1084
|
+
return self.revert_to_topology(last_stable)
|
|
1085
|
+
```
|
|
1086
|
+
|
|
1087
|
+
## Performance Metrics & KPIs
|
|
1088
|
+
|
|
1089
|
+
### Adaptation Effectiveness
|
|
1090
|
+
- **Topology Switch Success Rate**: Percentage of beneficial switches
|
|
1091
|
+
- **Performance Improvement**: Average gain from adaptations
|
|
1092
|
+
- **Adaptation Speed**: Time to complete topology transitions
|
|
1093
|
+
- **Prediction Accuracy**: Correctness of performance forecasts
|
|
1094
|
+
|
|
1095
|
+
### System Efficiency
|
|
1096
|
+
- **Resource Utilization**: Optimal use of available agents and resources
|
|
1097
|
+
- **Task Completion Rate**: Percentage of successfully completed tasks
|
|
1098
|
+
- **Load Balance Index**: Even distribution of work across agents
|
|
1099
|
+
- **Fault Recovery Time**: Speed of adaptation to failures
|
|
1100
|
+
|
|
1101
|
+
### Learning Progress
|
|
1102
|
+
- **Model Accuracy Improvement**: Enhancement in prediction precision over time
|
|
1103
|
+
- **Pattern Recognition Rate**: Identification of recurring optimization opportunities
|
|
1104
|
+
- **Transfer Learning Success**: Application of patterns across different contexts
|
|
1105
|
+
- **Adaptation Convergence Time**: Speed of reaching optimal configurations
|
|
1106
|
+
|
|
1107
|
+
## Best Practices
|
|
1108
|
+
|
|
1109
|
+
### Adaptive Strategy Design
|
|
1110
|
+
1. **Gradual Transitions**: Avoid abrupt topology changes that disrupt work
|
|
1111
|
+
2. **Performance Validation**: Always validate improvements before committing
|
|
1112
|
+
3. **Rollback Preparedness**: Have quick recovery options for failed adaptations
|
|
1113
|
+
4. **Learning Integration**: Continuously incorporate new insights into models
|
|
1114
|
+
|
|
1115
|
+
### Machine Learning Optimization
|
|
1116
|
+
1. **Feature Engineering**: Identify relevant metrics for decision making
|
|
1117
|
+
2. **Model Validation**: Use cross-validation for robust model evaluation
|
|
1118
|
+
3. **Online Learning**: Update models continuously with new data
|
|
1119
|
+
4. **Ensemble Methods**: Combine multiple models for better predictions
|
|
1120
|
+
|
|
1121
|
+
### System Monitoring
|
|
1122
|
+
1. **Multi-Dimensional Metrics**: Track performance, resource usage, and quality
|
|
1123
|
+
2. **Real-Time Dashboards**: Provide visibility into adaptation decisions
|
|
1124
|
+
3. **Alert Systems**: Notify of significant performance changes or failures
|
|
1125
|
+
4. **Historical Analysis**: Learn from past adaptations and outcomes
|
|
1126
|
+
|
|
1127
|
+
Remember: As an adaptive coordinator, your strength lies in continuous learning and optimization. Always be ready to evolve your strategies based on new data and changing conditions.
|