@aigentic/claude-flow 3.7.0-alpha.69
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/MIGRATION_SUMMARY.md +222 -0
- package/.claude/agents/analysis/analyze-code-quality.md +58 -0
- package/.claude/agents/analysis/code-analyzer.md +189 -0
- package/.claude/agents/analysis/code-review/analyze-code-quality.md +58 -0
- package/.claude/agents/architecture/arch-system-design.md +157 -0
- package/.claude/agents/architecture/system-design/arch-system-design.md +36 -0
- package/.claude/agents/base-template-generator.md +41 -0
- package/.claude/agents/browser/browser-agent.yaml +182 -0
- package/.claude/agents/consensus/byzantine-coordinator.md +43 -0
- package/.claude/agents/consensus/crdt-synchronizer.md +977 -0
- package/.claude/agents/consensus/gossip-coordinator.md +43 -0
- package/.claude/agents/consensus/performance-benchmarker.md +831 -0
- package/.claude/agents/consensus/quorum-manager.md +803 -0
- package/.claude/agents/consensus/raft-manager.md +43 -0
- package/.claude/agents/consensus/security-manager.md +602 -0
- package/.claude/agents/core/coder.md +255 -0
- package/.claude/agents/core/planner.md +152 -0
- package/.claude/agents/core/researcher.md +174 -0
- package/.claude/agents/core/reviewer.md +309 -0
- package/.claude/agents/core/tester.md +300 -0
- package/.claude/agents/custom/test-long-runner.md +43 -0
- package/.claude/agents/data/data-ml-model.md +445 -0
- package/.claude/agents/data/ml/data-ml-model.md +76 -0
- package/.claude/agents/database-specialist.md +9 -0
- package/.claude/agents/development/backend/dev-backend-api.md +29 -0
- package/.claude/agents/development/dev-backend-api.md +178 -0
- package/.claude/agents/devops/ci-cd/ops-cicd-github.md +52 -0
- package/.claude/agents/devops/ops-cicd-github.md +165 -0
- package/.claude/agents/documentation/api-docs/docs-api-openapi.md +63 -0
- package/.claude/agents/documentation/docs-api-openapi.md +355 -0
- package/.claude/agents/dual-mode/codex-coordinator.md +206 -0
- package/.claude/agents/dual-mode/codex-worker.md +190 -0
- package/.claude/agents/dual-mode/dual-orchestrator.md +253 -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 +521 -0
- package/.claude/agents/github/github-modes.md +154 -0
- package/.claude/agents/github/issue-tracker.md +299 -0
- package/.claude/agents/github/multi-repo-swarm.md +525 -0
- package/.claude/agents/github/pr-manager.md +163 -0
- package/.claude/agents/github/project-board-sync.md +478 -0
- package/.claude/agents/github/release-manager.md +336 -0
- package/.claude/agents/github/release-swarm.md +551 -0
- package/.claude/agents/github/repo-architect.md +365 -0
- package/.claude/agents/github/swarm-issue.md +548 -0
- package/.claude/agents/github/swarm-pr.md +399 -0
- package/.claude/agents/github/sync-coordinator.md +423 -0
- package/.claude/agents/github/workflow-automation.md +605 -0
- package/.claude/agents/goal/agent.md +817 -0
- package/.claude/agents/goal/code-goal-planner.md +445 -0
- package/.claude/agents/goal/goal-planner.md +168 -0
- package/.claude/agents/hive-mind/collective-intelligence-coordinator.md +129 -0
- package/.claude/agents/hive-mind/queen-coordinator.md +202 -0
- package/.claude/agents/hive-mind/scout-explorer.md +241 -0
- package/.claude/agents/hive-mind/swarm-memory-manager.md +192 -0
- package/.claude/agents/hive-mind/worker-specialist.md +216 -0
- package/.claude/agents/neural/safla-neural.md +74 -0
- package/.claude/agents/optimization/benchmark-suite.md +663 -0
- package/.claude/agents/optimization/load-balancer.md +429 -0
- package/.claude/agents/optimization/performance-monitor.md +670 -0
- package/.claude/agents/optimization/resource-allocator.md +672 -0
- package/.claude/agents/optimization/topology-optimizer.md +806 -0
- package/.claude/agents/payments/agentic-payments.md +126 -0
- package/.claude/agents/project-coordinator.md +8 -0
- package/.claude/agents/python-specialist.md +9 -0
- package/.claude/agents/reasoning/agent.md +817 -0
- package/.claude/agents/reasoning/goal-planner.md +73 -0
- package/.claude/agents/security-auditor.md +9 -0
- package/.claude/agents/sona/sona-learning-optimizer.md +65 -0
- package/.claude/agents/sparc/architecture.md +453 -0
- package/.claude/agents/sparc/pseudocode.md +299 -0
- package/.claude/agents/sparc/refinement.md +504 -0
- package/.claude/agents/sparc/specification.md +258 -0
- package/.claude/agents/specialized/mobile/spec-mobile-react-native.md +88 -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 +364 -0
- package/.claude/agents/swarm/hierarchical-coordinator.md +300 -0
- package/.claude/agents/swarm/mesh-coordinator.md +363 -0
- package/.claude/agents/templates/automation-smart-agent.md +185 -0
- package/.claude/agents/templates/base-template-generator.md +289 -0
- package/.claude/agents/templates/coordinator-swarm-init.md +83 -0
- package/.claude/agents/templates/github-pr-manager.md +155 -0
- package/.claude/agents/templates/implementer-sparc-coder.md +243 -0
- package/.claude/agents/templates/memory-coordinator.md +163 -0
- package/.claude/agents/templates/migration-plan.md +724 -0
- package/.claude/agents/templates/orchestrator-task.md +120 -0
- package/.claude/agents/templates/performance-analyzer.md +179 -0
- package/.claude/agents/templates/sparc-coordinator.md +163 -0
- package/.claude/agents/testing/production-validator.md +373 -0
- package/.claude/agents/testing/tdd-london-swarm.md +222 -0
- package/.claude/agents/testing/unit/tdd-london-swarm.md +222 -0
- package/.claude/agents/testing/validation/production-validator.md +373 -0
- package/.claude/agents/typescript-specialist.md +9 -0
- package/.claude/agents/v3/adr-architect.md +184 -0
- package/.claude/agents/v3/aidefence-guardian.md +282 -0
- package/.claude/agents/v3/claims-authorizer.md +208 -0
- package/.claude/agents/v3/collective-intelligence-coordinator.md +993 -0
- package/.claude/agents/v3/database-specialist.md +9 -0
- package/.claude/agents/v3/ddd-domain-expert.md +220 -0
- package/.claude/agents/v3/injection-analyst.md +236 -0
- package/.claude/agents/v3/memory-specialist.md +995 -0
- package/.claude/agents/v3/performance-engineer.md +1233 -0
- package/.claude/agents/v3/pii-detector.md +151 -0
- package/.claude/agents/v3/project-coordinator.md +8 -0
- package/.claude/agents/v3/python-specialist.md +9 -0
- package/.claude/agents/v3/reasoningbank-learner.md +213 -0
- package/.claude/agents/v3/security-architect-aidefence.md +410 -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/test-architect.md +9 -0
- package/.claude/agents/v3/typescript-specialist.md +9 -0
- package/.claude/agents/v3/v3-integration-architect.md +312 -0
- package/.claude/agents/v3/v3-memory-specialist.md +281 -0
- package/.claude/agents/v3/v3-performance-engineer.md +363 -0
- package/.claude/agents/v3/v3-queen-coordinator.md +63 -0
- package/.claude/agents/v3/v3-security-architect.md +140 -0
- package/.claude/checkpoints/1767754460.json +8 -0
- package/.claude/commands/agents/README.md +10 -0
- package/.claude/commands/agents/agent-capabilities.md +21 -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 +26 -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 +27 -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/config/v3-dependency-optimization.json +266 -0
- package/.claude/config/v3-performance-targets.json +251 -0
- package/.claude/helpers/README.md +97 -0
- package/.claude/helpers/adr-compliance.sh +186 -0
- package/.claude/helpers/aggressive-microcompact.mjs +36 -0
- package/.claude/helpers/auto-commit.sh +178 -0
- package/.claude/helpers/auto-memory-hook.mjs +564 -0
- package/.claude/helpers/checkpoint-manager.sh +251 -0
- package/.claude/helpers/context-persistence-hook.mjs +1979 -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/hook-handler.cjs +269 -0
- package/.claude/helpers/intelligence.cjs +230 -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.cjs +84 -0
- package/.claude/helpers/memory.js +83 -0
- package/.claude/helpers/metrics-db.mjs +488 -0
- package/.claude/helpers/patch-aggressive-prune.mjs +184 -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.cjs +62 -0
- package/.claude/helpers/router.js +66 -0
- package/.claude/helpers/security-scanner.sh +127 -0
- package/.claude/helpers/session.cjs +125 -0
- package/.claude/helpers/session.js +135 -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.cjs +878 -0
- package/.claude/helpers/statusline.js +352 -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/mcp.json +13 -0
- package/.claude/scheduled_tasks.lock +1 -0
- package/.claude/settings.json +285 -0
- package/.claude/settings.json.bak +526 -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/browser/SKILL.md +204 -0
- package/.claude/skills/dual-mode/README.md +71 -0
- package/.claude/skills/dual-mode/dual-collect.md +103 -0
- package/.claude/skills/dual-mode/dual-coordinate.md +85 -0
- package/.claude/skills/dual-mode/dual-spawn.md +81 -0
- package/.claude/skills/flow-nexus-neural/SKILL.md +727 -0
- package/.claude/skills/flow-nexus-platform/SKILL.md +1154 -0
- package/.claude/skills/flow-nexus-swarm/SKILL.md +604 -0
- package/.claude/skills/github-code-review/SKILL.md +1125 -0
- package/.claude/skills/github-multi-repo/SKILL.md +862 -0
- package/.claude/skills/github-project-management/SKILL.md +1263 -0
- package/.claude/skills/github-release-management/SKILL.md +1064 -0
- package/.claude/skills/github-workflow-automation/SKILL.md +1047 -0
- package/.claude/skills/hive-mind-advanced/SKILL.md +709 -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 +560 -0
- package/.claude/skills/reasoningbank-agentdb/SKILL.md +446 -0
- package/.claude/skills/reasoningbank-intelligence/SKILL.md +201 -0
- package/.claude/skills/skill-builder/SKILL.md +910 -0
- package/.claude/skills/sparc-methodology/SKILL.md +1106 -0
- package/.claude/skills/stream-chain/SKILL.md +560 -0
- package/.claude/skills/swarm-advanced/SKILL.md +970 -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 +691 -0
- package/.claude/skills/worker-benchmarks/SKILL.md +129 -0
- package/.claude/skills/worker-integration/SKILL.md +147 -0
- package/.claude/statusline-command.sh +176 -0
- package/.claude/statusline.mjs +109 -0
- package/.claude/statusline.sh +431 -0
- package/.claude-plugin/README.md +720 -0
- package/.claude-plugin/docs/INSTALLATION.md +261 -0
- package/.claude-plugin/docs/PLUGIN_SUMMARY.md +361 -0
- package/.claude-plugin/docs/QUICKSTART.md +361 -0
- package/.claude-plugin/docs/STRUCTURE.md +128 -0
- package/.claude-plugin/hooks/hooks.json +75 -0
- package/.claude-plugin/marketplace.json +170 -0
- package/.claude-plugin/plugin.json +71 -0
- package/.claude-plugin/scripts/install.sh +234 -0
- package/.claude-plugin/scripts/ruflo-hook.sh +33 -0
- package/.claude-plugin/scripts/uninstall.sh +36 -0
- package/.claude-plugin/scripts/verify.sh +108 -0
- package/LICENSE +21 -0
- package/README.md +410 -0
- package/bin/cli.js +11 -0
- package/bin/npx-repair.js +7 -0
- package/bin/npx-safe-launch.js +9 -0
- package/package.json +159 -0
- package/v3/@claude-flow/cli/README.md +410 -0
- package/v3/@claude-flow/cli/bin/cli.js +233 -0
- package/v3/@claude-flow/cli/bin/mcp-server.js +224 -0
- package/v3/@claude-flow/cli/bin/preinstall.cjs +2 -0
- package/v3/@claude-flow/cli/dist/src/appliance/gguf-engine.d.ts +91 -0
- package/v3/@claude-flow/cli/dist/src/appliance/gguf-engine.js +425 -0
- package/v3/@claude-flow/cli/dist/src/appliance/ruvllm-bridge.d.ts +102 -0
- package/v3/@claude-flow/cli/dist/src/appliance/ruvllm-bridge.js +292 -0
- package/v3/@claude-flow/cli/dist/src/appliance/rvfa-builder.d.ts +44 -0
- package/v3/@claude-flow/cli/dist/src/appliance/rvfa-builder.js +329 -0
- package/v3/@claude-flow/cli/dist/src/appliance/rvfa-distribution.d.ts +97 -0
- package/v3/@claude-flow/cli/dist/src/appliance/rvfa-distribution.js +370 -0
- package/v3/@claude-flow/cli/dist/src/appliance/rvfa-format.d.ts +111 -0
- package/v3/@claude-flow/cli/dist/src/appliance/rvfa-format.js +393 -0
- package/v3/@claude-flow/cli/dist/src/appliance/rvfa-runner.d.ts +69 -0
- package/v3/@claude-flow/cli/dist/src/appliance/rvfa-runner.js +237 -0
- package/v3/@claude-flow/cli/dist/src/appliance/rvfa-signing.d.ts +123 -0
- package/v3/@claude-flow/cli/dist/src/appliance/rvfa-signing.js +347 -0
- package/v3/@claude-flow/cli/dist/src/autopilot-state.d.ts +77 -0
- package/v3/@claude-flow/cli/dist/src/autopilot-state.js +271 -0
- package/v3/@claude-flow/cli/dist/src/benchmarks/pretrain/index.d.ts +58 -0
- package/v3/@claude-flow/cli/dist/src/benchmarks/pretrain/index.js +404 -0
- package/v3/@claude-flow/cli/dist/src/commands/agent-wasm.d.ts +14 -0
- package/v3/@claude-flow/cli/dist/src/commands/agent-wasm.js +333 -0
- package/v3/@claude-flow/cli/dist/src/commands/agent.d.ts +8 -0
- package/v3/@claude-flow/cli/dist/src/commands/agent.js +927 -0
- package/v3/@claude-flow/cli/dist/src/commands/analyze.d.ts +19 -0
- package/v3/@claude-flow/cli/dist/src/commands/analyze.js +2048 -0
- package/v3/@claude-flow/cli/dist/src/commands/appliance-advanced.d.ts +9 -0
- package/v3/@claude-flow/cli/dist/src/commands/appliance-advanced.js +215 -0
- package/v3/@claude-flow/cli/dist/src/commands/appliance.d.ts +8 -0
- package/v3/@claude-flow/cli/dist/src/commands/appliance.js +404 -0
- package/v3/@claude-flow/cli/dist/src/commands/autopilot.d.ts +15 -0
- package/v3/@claude-flow/cli/dist/src/commands/autopilot.js +362 -0
- package/v3/@claude-flow/cli/dist/src/commands/benchmark.d.ts +10 -0
- package/v3/@claude-flow/cli/dist/src/commands/benchmark.js +460 -0
- package/v3/@claude-flow/cli/dist/src/commands/claims.d.ts +10 -0
- package/v3/@claude-flow/cli/dist/src/commands/claims.js +620 -0
- package/v3/@claude-flow/cli/dist/src/commands/cleanup.d.ts +13 -0
- package/v3/@claude-flow/cli/dist/src/commands/cleanup.js +250 -0
- package/v3/@claude-flow/cli/dist/src/commands/completions.d.ts +10 -0
- package/v3/@claude-flow/cli/dist/src/commands/completions.js +539 -0
- package/v3/@claude-flow/cli/dist/src/commands/config.d.ts +8 -0
- package/v3/@claude-flow/cli/dist/src/commands/config.js +430 -0
- package/v3/@claude-flow/cli/dist/src/commands/daemon.d.ts +28 -0
- package/v3/@claude-flow/cli/dist/src/commands/daemon.js +1093 -0
- package/v3/@claude-flow/cli/dist/src/commands/deployment.d.ts +10 -0
- package/v3/@claude-flow/cli/dist/src/commands/deployment.js +672 -0
- package/v3/@claude-flow/cli/dist/src/commands/doctor.d.ts +10 -0
- package/v3/@claude-flow/cli/dist/src/commands/doctor.js +885 -0
- package/v3/@claude-flow/cli/dist/src/commands/embeddings.d.ts +18 -0
- package/v3/@claude-flow/cli/dist/src/commands/embeddings.js +1623 -0
- package/v3/@claude-flow/cli/dist/src/commands/guidance.d.ts +8 -0
- package/v3/@claude-flow/cli/dist/src/commands/guidance.js +556 -0
- package/v3/@claude-flow/cli/dist/src/commands/hive-mind.d.ts +11 -0
- package/v3/@claude-flow/cli/dist/src/commands/hive-mind.js +1297 -0
- package/v3/@claude-flow/cli/dist/src/commands/hooks.d.ts +8 -0
- package/v3/@claude-flow/cli/dist/src/commands/hooks.js +4499 -0
- package/v3/@claude-flow/cli/dist/src/commands/index.d.ts +118 -0
- package/v3/@claude-flow/cli/dist/src/commands/index.js +344 -0
- package/v3/@claude-flow/cli/dist/src/commands/init.d.ts +8 -0
- package/v3/@claude-flow/cli/dist/src/commands/init.js +997 -0
- package/v3/@claude-flow/cli/dist/src/commands/issues.d.ts +21 -0
- package/v3/@claude-flow/cli/dist/src/commands/issues.js +567 -0
- package/v3/@claude-flow/cli/dist/src/commands/mcp.d.ts +11 -0
- package/v3/@claude-flow/cli/dist/src/commands/mcp.js +718 -0
- package/v3/@claude-flow/cli/dist/src/commands/memory.d.ts +8 -0
- package/v3/@claude-flow/cli/dist/src/commands/memory.js +1456 -0
- package/v3/@claude-flow/cli/dist/src/commands/migrate.d.ts +8 -0
- package/v3/@claude-flow/cli/dist/src/commands/migrate.js +742 -0
- package/v3/@claude-flow/cli/dist/src/commands/neural.d.ts +10 -0
- package/v3/@claude-flow/cli/dist/src/commands/neural.js +1531 -0
- package/v3/@claude-flow/cli/dist/src/commands/performance.d.ts +10 -0
- package/v3/@claude-flow/cli/dist/src/commands/performance.js +583 -0
- package/v3/@claude-flow/cli/dist/src/commands/plugins.d.ts +11 -0
- package/v3/@claude-flow/cli/dist/src/commands/plugins.js +826 -0
- package/v3/@claude-flow/cli/dist/src/commands/process.d.ts +10 -0
- package/v3/@claude-flow/cli/dist/src/commands/process.js +694 -0
- package/v3/@claude-flow/cli/dist/src/commands/progress.d.ts +11 -0
- package/v3/@claude-flow/cli/dist/src/commands/progress.js +259 -0
- package/v3/@claude-flow/cli/dist/src/commands/providers.d.ts +10 -0
- package/v3/@claude-flow/cli/dist/src/commands/providers.js +502 -0
- package/v3/@claude-flow/cli/dist/src/commands/route.d.ts +16 -0
- package/v3/@claude-flow/cli/dist/src/commands/route.js +813 -0
- package/v3/@claude-flow/cli/dist/src/commands/ruvector/backup.d.ts +11 -0
- package/v3/@claude-flow/cli/dist/src/commands/ruvector/backup.js +747 -0
- package/v3/@claude-flow/cli/dist/src/commands/ruvector/benchmark.d.ts +11 -0
- package/v3/@claude-flow/cli/dist/src/commands/ruvector/benchmark.js +490 -0
- package/v3/@claude-flow/cli/dist/src/commands/ruvector/import.d.ts +18 -0
- package/v3/@claude-flow/cli/dist/src/commands/ruvector/import.js +373 -0
- package/v3/@claude-flow/cli/dist/src/commands/ruvector/index.d.ts +29 -0
- package/v3/@claude-flow/cli/dist/src/commands/ruvector/index.js +129 -0
- package/v3/@claude-flow/cli/dist/src/commands/ruvector/init.d.ts +11 -0
- package/v3/@claude-flow/cli/dist/src/commands/ruvector/init.js +467 -0
- package/v3/@claude-flow/cli/dist/src/commands/ruvector/migrate.d.ts +11 -0
- package/v3/@claude-flow/cli/dist/src/commands/ruvector/migrate.js +498 -0
- package/v3/@claude-flow/cli/dist/src/commands/ruvector/optimize.d.ts +11 -0
- package/v3/@claude-flow/cli/dist/src/commands/ruvector/optimize.js +505 -0
- package/v3/@claude-flow/cli/dist/src/commands/ruvector/pg-utils.d.ts +14 -0
- package/v3/@claude-flow/cli/dist/src/commands/ruvector/pg-utils.js +41 -0
- package/v3/@claude-flow/cli/dist/src/commands/ruvector/setup.d.ts +18 -0
- package/v3/@claude-flow/cli/dist/src/commands/ruvector/setup.js +765 -0
- package/v3/@claude-flow/cli/dist/src/commands/ruvector/status.d.ts +11 -0
- package/v3/@claude-flow/cli/dist/src/commands/ruvector/status.js +479 -0
- package/v3/@claude-flow/cli/dist/src/commands/security.d.ts +10 -0
- package/v3/@claude-flow/cli/dist/src/commands/security.js +920 -0
- package/v3/@claude-flow/cli/dist/src/commands/session.d.ts +8 -0
- package/v3/@claude-flow/cli/dist/src/commands/session.js +757 -0
- package/v3/@claude-flow/cli/dist/src/commands/start.d.ts +8 -0
- package/v3/@claude-flow/cli/dist/src/commands/start.js +418 -0
- package/v3/@claude-flow/cli/dist/src/commands/status.d.ts +8 -0
- package/v3/@claude-flow/cli/dist/src/commands/status.js +591 -0
- package/v3/@claude-flow/cli/dist/src/commands/swarm.d.ts +8 -0
- package/v3/@claude-flow/cli/dist/src/commands/swarm.js +887 -0
- package/v3/@claude-flow/cli/dist/src/commands/task.d.ts +8 -0
- package/v3/@claude-flow/cli/dist/src/commands/task.js +675 -0
- package/v3/@claude-flow/cli/dist/src/commands/transfer-store.d.ts +13 -0
- package/v3/@claude-flow/cli/dist/src/commands/transfer-store.js +428 -0
- package/v3/@claude-flow/cli/dist/src/commands/update.d.ts +8 -0
- package/v3/@claude-flow/cli/dist/src/commands/update.js +276 -0
- package/v3/@claude-flow/cli/dist/src/commands/verify.d.ts +19 -0
- package/v3/@claude-flow/cli/dist/src/commands/verify.js +261 -0
- package/v3/@claude-flow/cli/dist/src/commands/workflow.d.ts +8 -0
- package/v3/@claude-flow/cli/dist/src/commands/workflow.js +617 -0
- package/v3/@claude-flow/cli/dist/src/config-adapter.d.ts +15 -0
- package/v3/@claude-flow/cli/dist/src/config-adapter.js +186 -0
- package/v3/@claude-flow/cli/dist/src/encryption/vault.d.ts +94 -0
- package/v3/@claude-flow/cli/dist/src/encryption/vault.js +172 -0
- package/v3/@claude-flow/cli/dist/src/fs-secure.d.ts +67 -0
- package/v3/@claude-flow/cli/dist/src/fs-secure.js +74 -0
- package/v3/@claude-flow/cli/dist/src/index.d.ts +81 -0
- package/v3/@claude-flow/cli/dist/src/index.js +538 -0
- package/v3/@claude-flow/cli/dist/src/infrastructure/in-memory-repositories.d.ts +68 -0
- package/v3/@claude-flow/cli/dist/src/infrastructure/in-memory-repositories.js +264 -0
- package/v3/@claude-flow/cli/dist/src/init/claudemd-generator.d.ts +16 -0
- package/v3/@claude-flow/cli/dist/src/init/claudemd-generator.js +363 -0
- package/v3/@claude-flow/cli/dist/src/init/executor.d.ts +41 -0
- package/v3/@claude-flow/cli/dist/src/init/executor.js +1904 -0
- package/v3/@claude-flow/cli/dist/src/init/helpers-generator.d.ts +60 -0
- package/v3/@claude-flow/cli/dist/src/init/helpers-generator.js +1185 -0
- package/v3/@claude-flow/cli/dist/src/init/index.d.ts +13 -0
- package/v3/@claude-flow/cli/dist/src/init/index.js +15 -0
- package/v3/@claude-flow/cli/dist/src/init/mcp-generator.d.ts +26 -0
- package/v3/@claude-flow/cli/dist/src/init/mcp-generator.js +116 -0
- package/v3/@claude-flow/cli/dist/src/init/settings-generator.d.ts +14 -0
- package/v3/@claude-flow/cli/dist/src/init/settings-generator.js +456 -0
- package/v3/@claude-flow/cli/dist/src/init/statusline-generator.d.ts +28 -0
- package/v3/@claude-flow/cli/dist/src/init/statusline-generator.js +937 -0
- package/v3/@claude-flow/cli/dist/src/init/types.d.ts +308 -0
- package/v3/@claude-flow/cli/dist/src/init/types.js +263 -0
- package/v3/@claude-flow/cli/dist/src/log-filters.d.ts +22 -0
- package/v3/@claude-flow/cli/dist/src/log-filters.js +36 -0
- package/v3/@claude-flow/cli/dist/src/mcp-client.d.ts +92 -0
- package/v3/@claude-flow/cli/dist/src/mcp-client.js +287 -0
- package/v3/@claude-flow/cli/dist/src/mcp-server.d.ts +163 -0
- package/v3/@claude-flow/cli/dist/src/mcp-server.js +732 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/agent-execute-core.d.ts +92 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/agent-execute-core.js +328 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/agent-tools.d.ts +9 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/agent-tools.js +716 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/agentdb-tools.d.ts +33 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/agentdb-tools.js +867 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/analyze-tools.d.ts +38 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/analyze-tools.js +346 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/auto-install.d.ts +83 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/auto-install.js +131 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/autopilot-tools.d.ts +12 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/autopilot-tools.js +231 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/browser-session-tools.d.ts +23 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/browser-session-tools.js +324 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/browser-tools.d.ts +13 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/browser-tools.js +757 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/claims-tools.d.ts +12 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/claims-tools.js +863 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/config-tools.d.ts +8 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/config-tools.js +411 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/coordination-tools.d.ts +13 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/coordination-tools.js +729 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/daa-tools.d.ts +13 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/daa-tools.js +534 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/embeddings-tools.d.ts +9 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/embeddings-tools.js +904 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/github-tools.d.ts +9 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/github-tools.js +659 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/guidance-tools.d.ts +15 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/guidance-tools.js +639 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/hive-mind-tools.d.ts +8 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/hive-mind-tools.js +953 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/hooks-tools.d.ts +46 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/hooks-tools.js +3939 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/index.d.ts +27 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/index.js +26 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/managed-agent-tools.d.ts +22 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/managed-agent-tools.js +357 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/memory-tools.d.ts +14 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/memory-tools.js +1240 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/neural-tools.d.ts +16 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/neural-tools.js +793 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/performance-tools.d.ts +16 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/performance-tools.js +675 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/progress-tools.d.ts +14 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/progress-tools.js +348 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/request-tracker.d.ts +17 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/request-tracker.js +27 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/ruvllm-tools.d.ts +9 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/ruvllm-tools.js +339 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/security-tools.d.ts +18 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/security-tools.js +556 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/session-tools.d.ts +8 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/session-tools.js +517 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/swarm-tools.d.ts +9 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/swarm-tools.js +388 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/system-tools.d.ts +13 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/system-tools.js +674 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/task-tools.d.ts +8 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/task-tools.js +487 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/terminal-tools.d.ts +8 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/terminal-tools.js +306 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/transfer-tools.d.ts +14 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/transfer-tools.js +447 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/types.d.ts +8 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/types.js +8 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/validate-input.d.ts +9 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/validate-input.js +9 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/wasm-agent-tools.d.ts +9 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/wasm-agent-tools.js +291 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/workflow-tools.d.ts +8 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/workflow-tools.js +884 -0
- package/v3/@claude-flow/cli/dist/src/memory/ewc-consolidation.d.ts +295 -0
- package/v3/@claude-flow/cli/dist/src/memory/ewc-consolidation.js +601 -0
- package/v3/@claude-flow/cli/dist/src/memory/intelligence.d.ts +357 -0
- package/v3/@claude-flow/cli/dist/src/memory/intelligence.js +1200 -0
- package/v3/@claude-flow/cli/dist/src/memory/memory-bridge.d.ts +492 -0
- package/v3/@claude-flow/cli/dist/src/memory/memory-bridge.js +2101 -0
- package/v3/@claude-flow/cli/dist/src/memory/memory-initializer.d.ts +420 -0
- package/v3/@claude-flow/cli/dist/src/memory/memory-initializer.js +2376 -0
- package/v3/@claude-flow/cli/dist/src/memory/neural-package-bridge.d.ts +48 -0
- package/v3/@claude-flow/cli/dist/src/memory/neural-package-bridge.js +87 -0
- package/v3/@claude-flow/cli/dist/src/memory/rabitq-index.d.ts +60 -0
- package/v3/@claude-flow/cli/dist/src/memory/rabitq-index.js +242 -0
- package/v3/@claude-flow/cli/dist/src/memory/sona-optimizer.d.ts +267 -0
- package/v3/@claude-flow/cli/dist/src/memory/sona-optimizer.js +779 -0
- package/v3/@claude-flow/cli/dist/src/output.d.ts +9 -0
- package/v3/@claude-flow/cli/dist/src/output.js +9 -0
- package/v3/@claude-flow/cli/dist/src/parser.d.ts +69 -0
- package/v3/@claude-flow/cli/dist/src/parser.js +473 -0
- package/v3/@claude-flow/cli/dist/src/plugins/manager.d.ts +133 -0
- package/v3/@claude-flow/cli/dist/src/plugins/manager.js +402 -0
- package/v3/@claude-flow/cli/dist/src/plugins/store/discovery.d.ts +91 -0
- package/v3/@claude-flow/cli/dist/src/plugins/store/discovery.js +1202 -0
- package/v3/@claude-flow/cli/dist/src/plugins/store/index.d.ts +76 -0
- package/v3/@claude-flow/cli/dist/src/plugins/store/index.js +141 -0
- package/v3/@claude-flow/cli/dist/src/plugins/store/search.d.ts +46 -0
- package/v3/@claude-flow/cli/dist/src/plugins/store/search.js +230 -0
- package/v3/@claude-flow/cli/dist/src/plugins/store/types.d.ts +274 -0
- package/v3/@claude-flow/cli/dist/src/plugins/store/types.js +7 -0
- package/v3/@claude-flow/cli/dist/src/plugins/tests/demo-plugin-store.d.ts +7 -0
- package/v3/@claude-flow/cli/dist/src/plugins/tests/demo-plugin-store.js +126 -0
- package/v3/@claude-flow/cli/dist/src/plugins/tests/standalone-test.d.ts +12 -0
- package/v3/@claude-flow/cli/dist/src/plugins/tests/standalone-test.js +188 -0
- package/v3/@claude-flow/cli/dist/src/plugins/tests/test-plugin-store.d.ts +7 -0
- package/v3/@claude-flow/cli/dist/src/plugins/tests/test-plugin-store.js +206 -0
- package/v3/@claude-flow/cli/dist/src/production/circuit-breaker.d.ts +101 -0
- package/v3/@claude-flow/cli/dist/src/production/circuit-breaker.js +241 -0
- package/v3/@claude-flow/cli/dist/src/production/error-handler.d.ts +92 -0
- package/v3/@claude-flow/cli/dist/src/production/error-handler.js +299 -0
- package/v3/@claude-flow/cli/dist/src/production/index.d.ts +23 -0
- package/v3/@claude-flow/cli/dist/src/production/index.js +18 -0
- package/v3/@claude-flow/cli/dist/src/production/monitoring.d.ts +161 -0
- package/v3/@claude-flow/cli/dist/src/production/monitoring.js +356 -0
- package/v3/@claude-flow/cli/dist/src/production/rate-limiter.d.ts +80 -0
- package/v3/@claude-flow/cli/dist/src/production/rate-limiter.js +201 -0
- package/v3/@claude-flow/cli/dist/src/production/retry.d.ts +48 -0
- package/v3/@claude-flow/cli/dist/src/production/retry.js +179 -0
- package/v3/@claude-flow/cli/dist/src/prompt.d.ts +44 -0
- package/v3/@claude-flow/cli/dist/src/prompt.js +501 -0
- package/v3/@claude-flow/cli/dist/src/runtime/headless.d.ts +60 -0
- package/v3/@claude-flow/cli/dist/src/runtime/headless.js +284 -0
- package/v3/@claude-flow/cli/dist/src/ruvector/agent-wasm.d.ts +193 -0
- package/v3/@claude-flow/cli/dist/src/ruvector/agent-wasm.js +354 -0
- package/v3/@claude-flow/cli/dist/src/ruvector/ast-analyzer.d.ts +67 -0
- package/v3/@claude-flow/cli/dist/src/ruvector/ast-analyzer.js +277 -0
- package/v3/@claude-flow/cli/dist/src/ruvector/coverage-router.d.ts +160 -0
- package/v3/@claude-flow/cli/dist/src/ruvector/coverage-router.js +531 -0
- package/v3/@claude-flow/cli/dist/src/ruvector/coverage-tools.d.ts +33 -0
- package/v3/@claude-flow/cli/dist/src/ruvector/coverage-tools.js +157 -0
- package/v3/@claude-flow/cli/dist/src/ruvector/diff-classifier.d.ts +175 -0
- package/v3/@claude-flow/cli/dist/src/ruvector/diff-classifier.js +699 -0
- package/v3/@claude-flow/cli/dist/src/ruvector/diskann-backend.d.ts +78 -0
- package/v3/@claude-flow/cli/dist/src/ruvector/diskann-backend.js +310 -0
- package/v3/@claude-flow/cli/dist/src/ruvector/enhanced-model-router.d.ts +146 -0
- package/v3/@claude-flow/cli/dist/src/ruvector/enhanced-model-router.js +529 -0
- package/v3/@claude-flow/cli/dist/src/ruvector/graph-analyzer.d.ts +187 -0
- package/v3/@claude-flow/cli/dist/src/ruvector/graph-analyzer.js +929 -0
- package/v3/@claude-flow/cli/dist/src/ruvector/graph-backend.d.ts +79 -0
- package/v3/@claude-flow/cli/dist/src/ruvector/graph-backend.js +220 -0
- package/v3/@claude-flow/cli/dist/src/ruvector/index.d.ts +38 -0
- package/v3/@claude-flow/cli/dist/src/ruvector/index.js +82 -0
- package/v3/@claude-flow/cli/dist/src/ruvector/lora-adapter.d.ts +240 -0
- package/v3/@claude-flow/cli/dist/src/ruvector/lora-adapter.js +550 -0
- package/v3/@claude-flow/cli/dist/src/ruvector/model-router.d.ts +241 -0
- package/v3/@claude-flow/cli/dist/src/ruvector/model-router.js +608 -0
- package/v3/@claude-flow/cli/dist/src/ruvector/q-learning-router.d.ts +211 -0
- package/v3/@claude-flow/cli/dist/src/ruvector/q-learning-router.js +681 -0
- package/v3/@claude-flow/cli/dist/src/ruvector/ruvllm-wasm.d.ts +179 -0
- package/v3/@claude-flow/cli/dist/src/ruvector/ruvllm-wasm.js +367 -0
- package/v3/@claude-flow/cli/dist/src/ruvector/semantic-router.d.ts +77 -0
- package/v3/@claude-flow/cli/dist/src/ruvector/semantic-router.js +178 -0
- package/v3/@claude-flow/cli/dist/src/ruvector/vector-db.d.ts +73 -0
- package/v3/@claude-flow/cli/dist/src/ruvector/vector-db.js +264 -0
- package/v3/@claude-flow/cli/dist/src/services/agentic-flow-bridge.d.ts +50 -0
- package/v3/@claude-flow/cli/dist/src/services/agentic-flow-bridge.js +95 -0
- package/v3/@claude-flow/cli/dist/src/services/claim-service.d.ts +204 -0
- package/v3/@claude-flow/cli/dist/src/services/claim-service.js +818 -0
- package/v3/@claude-flow/cli/dist/src/services/config-file-manager.d.ts +37 -0
- package/v3/@claude-flow/cli/dist/src/services/config-file-manager.js +233 -0
- package/v3/@claude-flow/cli/dist/src/services/container-worker-pool.d.ts +197 -0
- package/v3/@claude-flow/cli/dist/src/services/container-worker-pool.js +583 -0
- package/v3/@claude-flow/cli/dist/src/services/headless-worker-executor.d.ts +310 -0
- package/v3/@claude-flow/cli/dist/src/services/headless-worker-executor.js +1058 -0
- package/v3/@claude-flow/cli/dist/src/services/index.d.ts +13 -0
- package/v3/@claude-flow/cli/dist/src/services/index.js +11 -0
- package/v3/@claude-flow/cli/dist/src/services/registry-api.d.ts +58 -0
- package/v3/@claude-flow/cli/dist/src/services/registry-api.js +146 -0
- package/v3/@claude-flow/cli/dist/src/services/ruvector-training.d.ts +222 -0
- package/v3/@claude-flow/cli/dist/src/services/ruvector-training.js +688 -0
- package/v3/@claude-flow/cli/dist/src/services/worker-daemon.d.ts +323 -0
- package/v3/@claude-flow/cli/dist/src/services/worker-daemon.js +1323 -0
- package/v3/@claude-flow/cli/dist/src/services/worker-queue.d.ts +194 -0
- package/v3/@claude-flow/cli/dist/src/services/worker-queue.js +513 -0
- package/v3/@claude-flow/cli/dist/src/suggest.d.ts +53 -0
- package/v3/@claude-flow/cli/dist/src/suggest.js +200 -0
- package/v3/@claude-flow/cli/dist/src/transfer/anonymization/index.d.ts +25 -0
- package/v3/@claude-flow/cli/dist/src/transfer/anonymization/index.js +175 -0
- package/v3/@claude-flow/cli/dist/src/transfer/deploy-seraphine.d.ts +13 -0
- package/v3/@claude-flow/cli/dist/src/transfer/deploy-seraphine.js +205 -0
- package/v3/@claude-flow/cli/dist/src/transfer/export.d.ts +25 -0
- package/v3/@claude-flow/cli/dist/src/transfer/export.js +113 -0
- package/v3/@claude-flow/cli/dist/src/transfer/index.d.ts +12 -0
- package/v3/@claude-flow/cli/dist/src/transfer/index.js +31 -0
- package/v3/@claude-flow/cli/dist/src/transfer/ipfs/client.d.ts +109 -0
- package/v3/@claude-flow/cli/dist/src/transfer/ipfs/client.js +307 -0
- package/v3/@claude-flow/cli/dist/src/transfer/ipfs/upload.d.ts +95 -0
- package/v3/@claude-flow/cli/dist/src/transfer/ipfs/upload.js +413 -0
- package/v3/@claude-flow/cli/dist/src/transfer/models/seraphine.d.ts +72 -0
- package/v3/@claude-flow/cli/dist/src/transfer/models/seraphine.js +373 -0
- package/v3/@claude-flow/cli/dist/src/transfer/serialization/cfp.d.ts +49 -0
- package/v3/@claude-flow/cli/dist/src/transfer/serialization/cfp.js +183 -0
- package/v3/@claude-flow/cli/dist/src/transfer/storage/gcs.d.ts +82 -0
- package/v3/@claude-flow/cli/dist/src/transfer/storage/gcs.js +272 -0
- package/v3/@claude-flow/cli/dist/src/transfer/storage/index.d.ts +6 -0
- package/v3/@claude-flow/cli/dist/src/transfer/storage/index.js +6 -0
- package/v3/@claude-flow/cli/dist/src/transfer/store/discovery.d.ts +84 -0
- package/v3/@claude-flow/cli/dist/src/transfer/store/discovery.js +382 -0
- package/v3/@claude-flow/cli/dist/src/transfer/store/download.d.ts +70 -0
- package/v3/@claude-flow/cli/dist/src/transfer/store/download.js +334 -0
- package/v3/@claude-flow/cli/dist/src/transfer/store/index.d.ts +84 -0
- package/v3/@claude-flow/cli/dist/src/transfer/store/index.js +153 -0
- package/v3/@claude-flow/cli/dist/src/transfer/store/publish.d.ts +76 -0
- package/v3/@claude-flow/cli/dist/src/transfer/store/publish.js +294 -0
- package/v3/@claude-flow/cli/dist/src/transfer/store/registry.d.ts +58 -0
- package/v3/@claude-flow/cli/dist/src/transfer/store/registry.js +285 -0
- package/v3/@claude-flow/cli/dist/src/transfer/store/search.d.ts +54 -0
- package/v3/@claude-flow/cli/dist/src/transfer/store/search.js +232 -0
- package/v3/@claude-flow/cli/dist/src/transfer/store/tests/standalone-test.d.ts +12 -0
- package/v3/@claude-flow/cli/dist/src/transfer/store/tests/standalone-test.js +190 -0
- package/v3/@claude-flow/cli/dist/src/transfer/store/types.d.ts +193 -0
- package/v3/@claude-flow/cli/dist/src/transfer/store/types.js +6 -0
- package/v3/@claude-flow/cli/dist/src/transfer/test-seraphine.d.ts +6 -0
- package/v3/@claude-flow/cli/dist/src/transfer/test-seraphine.js +105 -0
- package/v3/@claude-flow/cli/dist/src/transfer/tests/test-store.d.ts +7 -0
- package/v3/@claude-flow/cli/dist/src/transfer/tests/test-store.js +214 -0
- package/v3/@claude-flow/cli/dist/src/transfer/types.d.ts +245 -0
- package/v3/@claude-flow/cli/dist/src/transfer/types.js +6 -0
- package/v3/@claude-flow/cli/dist/src/types.d.ts +13 -0
- package/v3/@claude-flow/cli/dist/src/types.js +13 -0
- package/v3/@claude-flow/cli/dist/src/update/checker.d.ts +34 -0
- package/v3/@claude-flow/cli/dist/src/update/checker.js +191 -0
- package/v3/@claude-flow/cli/dist/src/update/executor.d.ts +33 -0
- package/v3/@claude-flow/cli/dist/src/update/executor.js +217 -0
- package/v3/@claude-flow/cli/dist/src/update/index.d.ts +33 -0
- package/v3/@claude-flow/cli/dist/src/update/index.js +64 -0
- package/v3/@claude-flow/cli/dist/src/update/rate-limiter.d.ts +20 -0
- package/v3/@claude-flow/cli/dist/src/update/rate-limiter.js +96 -0
- package/v3/@claude-flow/cli/dist/src/update/validator.d.ts +17 -0
- package/v3/@claude-flow/cli/dist/src/update/validator.js +123 -0
- package/v3/@claude-flow/cli/package.json +133 -0
- package/v3/@claude-flow/guidance/README.md +1195 -0
- package/v3/@claude-flow/guidance/package.json +198 -0
- package/v3/@claude-flow/shared/README.md +323 -0
- package/v3/@claude-flow/shared/package.json +43 -0
- package/v3/README.md +493 -0
|
@@ -0,0 +1,953 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hive-Mind MCP Tools for CLI
|
|
3
|
+
*
|
|
4
|
+
* Tool definitions for collective intelligence and swarm coordination.
|
|
5
|
+
*/
|
|
6
|
+
import { existsSync, readFileSync, writeFileSync, mkdirSync } from 'node:fs';
|
|
7
|
+
import { join } from 'node:path';
|
|
8
|
+
import { getProjectCwd } from './types.js';
|
|
9
|
+
import { validateIdentifier, validateText } from './validate-input.js';
|
|
10
|
+
// Storage paths
|
|
11
|
+
const STORAGE_DIR = '.claude-flow';
|
|
12
|
+
const HIVE_DIR = 'hive-mind';
|
|
13
|
+
const HIVE_FILE = 'state.json';
|
|
14
|
+
/**
|
|
15
|
+
* Calculate required votes for a given strategy and total node count.
|
|
16
|
+
*/
|
|
17
|
+
function calculateRequiredVotes(strategy, totalNodes, quorumPreset = 'majority') {
|
|
18
|
+
if (totalNodes <= 0)
|
|
19
|
+
return 1;
|
|
20
|
+
switch (strategy) {
|
|
21
|
+
case 'bft':
|
|
22
|
+
// BFT: requires 2/3 + 1 of total nodes
|
|
23
|
+
return Math.floor((totalNodes * 2) / 3) + 1;
|
|
24
|
+
case 'raft':
|
|
25
|
+
// Raft: simple majority
|
|
26
|
+
return Math.floor(totalNodes / 2) + 1;
|
|
27
|
+
case 'quorum':
|
|
28
|
+
switch (quorumPreset) {
|
|
29
|
+
case 'unanimous':
|
|
30
|
+
return totalNodes;
|
|
31
|
+
case 'supermajority':
|
|
32
|
+
return Math.floor((totalNodes * 2) / 3) + 1;
|
|
33
|
+
case 'majority':
|
|
34
|
+
default:
|
|
35
|
+
return Math.floor(totalNodes / 2) + 1;
|
|
36
|
+
}
|
|
37
|
+
default:
|
|
38
|
+
return Math.floor(totalNodes / 2) + 1;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Detect Byzantine behavior: a voter who has cast conflicting votes
|
|
43
|
+
* across proposals in the same round (same type, overlapping time).
|
|
44
|
+
* Here we check if the voter already voted differently on this proposal
|
|
45
|
+
* (which shouldn't happen if we block double-votes, so this checks
|
|
46
|
+
* cross-proposal conflicting votes for same type within the pending set).
|
|
47
|
+
*/
|
|
48
|
+
function detectByzantineVoters(pending, currentProposal, voterId, newVote) {
|
|
49
|
+
// Check if voter cast opposite votes on proposals of the same type
|
|
50
|
+
for (const p of pending) {
|
|
51
|
+
if (p.proposalId === currentProposal.proposalId)
|
|
52
|
+
continue;
|
|
53
|
+
if (p.type !== currentProposal.type)
|
|
54
|
+
continue;
|
|
55
|
+
if (voterId in p.votes && p.votes[voterId] !== newVote) {
|
|
56
|
+
return true; // Conflicting vote detected
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Try to resolve a proposal based on its strategy.
|
|
63
|
+
* Returns 'approved', 'rejected', or null if still pending.
|
|
64
|
+
*/
|
|
65
|
+
function tryResolveProposal(proposal, totalNodes) {
|
|
66
|
+
const votesFor = Object.values(proposal.votes).filter(v => v).length;
|
|
67
|
+
const votesAgainst = Object.values(proposal.votes).filter(v => !v).length;
|
|
68
|
+
const required = calculateRequiredVotes(proposal.strategy, totalNodes, proposal.quorumPreset);
|
|
69
|
+
if (votesFor >= required)
|
|
70
|
+
return 'approved';
|
|
71
|
+
if (votesAgainst >= required)
|
|
72
|
+
return 'rejected';
|
|
73
|
+
// For quorum with 'unanimous', also reject if any vote is against
|
|
74
|
+
if (proposal.strategy === 'quorum' && proposal.quorumPreset === 'unanimous' && votesAgainst > 0) {
|
|
75
|
+
return 'rejected';
|
|
76
|
+
}
|
|
77
|
+
// Check if it's impossible to reach quorum (remaining potential votes can't tip it)
|
|
78
|
+
const totalVotes = Object.keys(proposal.votes).length;
|
|
79
|
+
const remaining = totalNodes - totalVotes;
|
|
80
|
+
if (votesFor + remaining < required && votesAgainst + remaining < required) {
|
|
81
|
+
// Deadlock: neither side can win -- reject
|
|
82
|
+
return 'rejected';
|
|
83
|
+
}
|
|
84
|
+
return null;
|
|
85
|
+
}
|
|
86
|
+
function getHiveDir() {
|
|
87
|
+
return join(getProjectCwd(), STORAGE_DIR, HIVE_DIR);
|
|
88
|
+
}
|
|
89
|
+
function getHivePath() {
|
|
90
|
+
return join(getHiveDir(), HIVE_FILE);
|
|
91
|
+
}
|
|
92
|
+
function ensureHiveDir() {
|
|
93
|
+
const dir = getHiveDir();
|
|
94
|
+
if (!existsSync(dir)) {
|
|
95
|
+
mkdirSync(dir, { recursive: true });
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
function loadHiveState() {
|
|
99
|
+
try {
|
|
100
|
+
const path = getHivePath();
|
|
101
|
+
if (existsSync(path)) {
|
|
102
|
+
const data = readFileSync(path, 'utf-8');
|
|
103
|
+
return JSON.parse(data);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
catch {
|
|
107
|
+
// Return default state on error
|
|
108
|
+
}
|
|
109
|
+
return {
|
|
110
|
+
initialized: false,
|
|
111
|
+
topology: 'mesh',
|
|
112
|
+
workers: [],
|
|
113
|
+
consensus: { pending: [], history: [] },
|
|
114
|
+
sharedMemory: {},
|
|
115
|
+
createdAt: new Date().toISOString(),
|
|
116
|
+
updatedAt: new Date().toISOString(),
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
function saveHiveState(state) {
|
|
120
|
+
ensureHiveDir();
|
|
121
|
+
state.updatedAt = new Date().toISOString();
|
|
122
|
+
writeFileSync(getHivePath(), JSON.stringify(state, null, 2), 'utf-8');
|
|
123
|
+
}
|
|
124
|
+
// Import agent store helpers for spawn functionality
|
|
125
|
+
import { existsSync as agentStoreExists, readFileSync as readAgentStore, writeFileSync as writeAgentStore, mkdirSync as mkdirAgentStore } from 'node:fs';
|
|
126
|
+
function loadAgentStore() {
|
|
127
|
+
const storePath = join(getProjectCwd(), '.claude-flow', 'agents.json');
|
|
128
|
+
try {
|
|
129
|
+
if (agentStoreExists(storePath)) {
|
|
130
|
+
return JSON.parse(readAgentStore(storePath, 'utf-8'));
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
catch { /* ignore */ }
|
|
134
|
+
return { agents: {} };
|
|
135
|
+
}
|
|
136
|
+
function saveAgentStore(store) {
|
|
137
|
+
const storeDir = join(getProjectCwd(), '.claude-flow');
|
|
138
|
+
if (!agentStoreExists(storeDir)) {
|
|
139
|
+
mkdirAgentStore(storeDir, { recursive: true });
|
|
140
|
+
}
|
|
141
|
+
writeAgentStore(join(storeDir, 'agents.json'), JSON.stringify(store, null, 2), 'utf-8');
|
|
142
|
+
}
|
|
143
|
+
export const hiveMindTools = [
|
|
144
|
+
{
|
|
145
|
+
name: 'hive-mind_spawn',
|
|
146
|
+
description: 'Spawn workers and automatically join them to the hive-mind (combines agent/spawn + hive-mind/join) Use when native Task is wrong because you need queen-led collective intelligence — Byzantine-FT consensus, broadcast across many worker agents, shared memory with bounded conflict. For a single subagent, native Task is fine. Pair with swarm_init first to set topology.',
|
|
147
|
+
category: 'hive-mind',
|
|
148
|
+
inputSchema: {
|
|
149
|
+
type: 'object',
|
|
150
|
+
properties: {
|
|
151
|
+
count: { type: 'number', description: 'Number of workers to spawn (default: 1)', default: 1 },
|
|
152
|
+
role: { type: 'string', enum: ['worker', 'specialist', 'scout'], description: 'Worker role in hive', default: 'worker' },
|
|
153
|
+
agentType: { type: 'string', description: 'Agent type for spawned workers', default: 'worker' },
|
|
154
|
+
prefix: { type: 'string', description: 'Prefix for worker IDs', default: 'hive-worker' },
|
|
155
|
+
},
|
|
156
|
+
},
|
|
157
|
+
handler: async (input) => {
|
|
158
|
+
const state = loadHiveState();
|
|
159
|
+
if (!state.initialized) {
|
|
160
|
+
return { success: false, error: 'Hive-mind not initialized. Run hive-mind/init first.' };
|
|
161
|
+
}
|
|
162
|
+
if (input.agentType) {
|
|
163
|
+
const v = validateIdentifier(input.agentType, 'agentType');
|
|
164
|
+
if (!v.valid)
|
|
165
|
+
return { success: false, error: v.error };
|
|
166
|
+
}
|
|
167
|
+
if (input.prefix) {
|
|
168
|
+
const v = validateIdentifier(input.prefix, 'prefix');
|
|
169
|
+
if (!v.valid)
|
|
170
|
+
return { success: false, error: v.error };
|
|
171
|
+
}
|
|
172
|
+
const count = Math.min(Math.max(1, input.count || 1), 20); // Cap at 20
|
|
173
|
+
const role = input.role || 'worker';
|
|
174
|
+
const agentType = input.agentType || 'worker';
|
|
175
|
+
const prefix = input.prefix || 'hive-worker';
|
|
176
|
+
const agentStore = loadAgentStore();
|
|
177
|
+
const spawnedWorkers = [];
|
|
178
|
+
for (let i = 0; i < count; i++) {
|
|
179
|
+
const agentId = `${prefix}-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`;
|
|
180
|
+
// Create agent record (like agent/spawn)
|
|
181
|
+
agentStore.agents[agentId] = {
|
|
182
|
+
agentId,
|
|
183
|
+
agentType,
|
|
184
|
+
status: 'idle',
|
|
185
|
+
health: 1.0,
|
|
186
|
+
taskCount: 0,
|
|
187
|
+
config: { role, hiveRole: role },
|
|
188
|
+
createdAt: new Date().toISOString(),
|
|
189
|
+
domain: 'hive-mind',
|
|
190
|
+
};
|
|
191
|
+
// Join to hive-mind (like hive-mind/join)
|
|
192
|
+
if (!state.workers.includes(agentId)) {
|
|
193
|
+
state.workers.push(agentId);
|
|
194
|
+
}
|
|
195
|
+
spawnedWorkers.push({
|
|
196
|
+
agentId,
|
|
197
|
+
role,
|
|
198
|
+
joinedAt: new Date().toISOString(),
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
saveAgentStore(agentStore);
|
|
202
|
+
saveHiveState(state);
|
|
203
|
+
return {
|
|
204
|
+
success: true,
|
|
205
|
+
spawned: count,
|
|
206
|
+
workers: spawnedWorkers,
|
|
207
|
+
totalWorkers: state.workers.length,
|
|
208
|
+
hiveStatus: 'active',
|
|
209
|
+
message: `Spawned ${count} worker(s) and joined them to the hive-mind`,
|
|
210
|
+
};
|
|
211
|
+
},
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
name: 'hive-mind_init',
|
|
215
|
+
description: 'Initialize the hive-mind collective Use when native Task is wrong because you need queen-led collective intelligence — Byzantine-FT consensus, broadcast across many worker agents, shared memory with bounded conflict. For a single subagent, native Task is fine. Pair with swarm_init first to set topology.',
|
|
216
|
+
category: 'hive-mind',
|
|
217
|
+
inputSchema: {
|
|
218
|
+
type: 'object',
|
|
219
|
+
properties: {
|
|
220
|
+
topology: { type: 'string', enum: ['mesh', 'hierarchical', 'ring', 'star'], description: 'Network topology' },
|
|
221
|
+
// ADR-093 F3: schema now exposes the consensus strategy so callers
|
|
222
|
+
// can actually request raft / byzantine / quorum / etc. Default
|
|
223
|
+
// matches the documented anti-drift posture (raft).
|
|
224
|
+
consensus: {
|
|
225
|
+
type: 'string',
|
|
226
|
+
enum: ['raft', 'byzantine', 'gossip', 'crdt', 'quorum'],
|
|
227
|
+
description: 'Consensus strategy. Default: raft (anti-drift). Use byzantine for f<n/3 fault tolerance.',
|
|
228
|
+
},
|
|
229
|
+
queenId: { type: 'string', description: 'Initial queen agent ID' },
|
|
230
|
+
},
|
|
231
|
+
},
|
|
232
|
+
handler: async (input) => {
|
|
233
|
+
if (input.queenId) {
|
|
234
|
+
const v = validateIdentifier(input.queenId, 'queenId');
|
|
235
|
+
if (!v.valid)
|
|
236
|
+
return { success: false, error: v.error };
|
|
237
|
+
}
|
|
238
|
+
const state = loadHiveState();
|
|
239
|
+
const hiveId = `hive-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
|
|
240
|
+
const queenId = input.queenId || `queen-${Date.now()}`;
|
|
241
|
+
const requestedConsensus = input.consensus || 'raft';
|
|
242
|
+
state.initialized = true;
|
|
243
|
+
state.topology = input.topology || 'mesh';
|
|
244
|
+
state.consensusStrategy = requestedConsensus;
|
|
245
|
+
state.createdAt = new Date().toISOString();
|
|
246
|
+
state.queen = {
|
|
247
|
+
agentId: queenId,
|
|
248
|
+
electedAt: new Date().toISOString(),
|
|
249
|
+
term: 1,
|
|
250
|
+
};
|
|
251
|
+
saveHiveState(state);
|
|
252
|
+
return {
|
|
253
|
+
success: true,
|
|
254
|
+
hiveId,
|
|
255
|
+
topology: state.topology,
|
|
256
|
+
consensus: state.consensusStrategy,
|
|
257
|
+
queenId,
|
|
258
|
+
status: 'initialized',
|
|
259
|
+
config: {
|
|
260
|
+
topology: state.topology,
|
|
261
|
+
consensus: state.consensusStrategy,
|
|
262
|
+
maxAgents: input.maxAgents || 15,
|
|
263
|
+
persist: input.persist !== false,
|
|
264
|
+
memoryBackend: input.memoryBackend || 'hybrid',
|
|
265
|
+
},
|
|
266
|
+
createdAt: state.createdAt,
|
|
267
|
+
};
|
|
268
|
+
},
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
name: 'hive-mind_status',
|
|
272
|
+
description: 'Get hive-mind status Use when native Task is wrong because you need queen-led collective intelligence — Byzantine-FT consensus, broadcast across many worker agents, shared memory with bounded conflict. For a single subagent, native Task is fine. Pair with swarm_init first to set topology.',
|
|
273
|
+
category: 'hive-mind',
|
|
274
|
+
inputSchema: {
|
|
275
|
+
type: 'object',
|
|
276
|
+
properties: {
|
|
277
|
+
verbose: { type: 'boolean', description: 'Include detailed information' },
|
|
278
|
+
},
|
|
279
|
+
},
|
|
280
|
+
handler: async (input) => {
|
|
281
|
+
const state = loadHiveState();
|
|
282
|
+
const uptime = state.createdAt ? Date.now() - new Date(state.createdAt).getTime() : 0;
|
|
283
|
+
// Load agent store once for all workers
|
|
284
|
+
const agentStore = loadAgentStore();
|
|
285
|
+
// Compute real task metrics from task store
|
|
286
|
+
const taskStorePath = join(getProjectCwd(), '.claude-flow', 'tasks', 'store.json');
|
|
287
|
+
let pendingTaskCount = 0;
|
|
288
|
+
let activeTaskCount = 0;
|
|
289
|
+
let completedTaskCount = 0;
|
|
290
|
+
try {
|
|
291
|
+
if (existsSync(taskStorePath)) {
|
|
292
|
+
const taskStore = JSON.parse(readFileSync(taskStorePath, 'utf-8'));
|
|
293
|
+
for (const task of Object.values(taskStore.tasks || {})) {
|
|
294
|
+
if (task.status === 'pending')
|
|
295
|
+
pendingTaskCount++;
|
|
296
|
+
else if (task.status === 'in_progress')
|
|
297
|
+
activeTaskCount++;
|
|
298
|
+
else if (task.status === 'completed')
|
|
299
|
+
completedTaskCount++;
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
catch { /* ignore */ }
|
|
304
|
+
const workerCount = Math.max(1, state.workers.length);
|
|
305
|
+
const realLoad = activeTaskCount / workerCount;
|
|
306
|
+
const status = {
|
|
307
|
+
// CLI expected fields
|
|
308
|
+
hiveId: `hive-${state.createdAt ? new Date(state.createdAt).getTime() : Date.now()}`,
|
|
309
|
+
status: state.initialized ? 'active' : 'offline',
|
|
310
|
+
topology: state.topology,
|
|
311
|
+
// ADR-093 F3: surface the persisted strategy instead of a hardcoded "byzantine".
|
|
312
|
+
consensus: state.consensusStrategy ?? 'byzantine',
|
|
313
|
+
queen: state.queen ? {
|
|
314
|
+
id: state.queen.agentId,
|
|
315
|
+
agentId: state.queen.agentId,
|
|
316
|
+
status: 'active',
|
|
317
|
+
load: Math.round(realLoad * 1000) / 1000,
|
|
318
|
+
tasksQueued: pendingTaskCount,
|
|
319
|
+
electedAt: state.queen.electedAt,
|
|
320
|
+
term: state.queen.term,
|
|
321
|
+
} : { id: 'N/A', status: 'offline', load: 0, tasksQueued: 0 },
|
|
322
|
+
workers: state.workers.map(w => {
|
|
323
|
+
const agent = agentStore.agents[w];
|
|
324
|
+
return {
|
|
325
|
+
id: w,
|
|
326
|
+
type: agent?.agentType || 'worker',
|
|
327
|
+
status: agent?.status || 'unknown',
|
|
328
|
+
currentTask: agent?.currentTask || null,
|
|
329
|
+
tasksCompleted: agent?.taskCount || 0,
|
|
330
|
+
};
|
|
331
|
+
}),
|
|
332
|
+
metrics: {
|
|
333
|
+
totalTasks: pendingTaskCount + activeTaskCount + completedTaskCount,
|
|
334
|
+
completedTasks: completedTaskCount,
|
|
335
|
+
activeTasks: activeTaskCount,
|
|
336
|
+
pendingTasks: pendingTaskCount,
|
|
337
|
+
failedTasks: 0,
|
|
338
|
+
consensusRounds: state.consensus.history.length,
|
|
339
|
+
memoryUsage: `${Object.keys(state.sharedMemory).length * 2} KB`,
|
|
340
|
+
},
|
|
341
|
+
health: {
|
|
342
|
+
overall: 'healthy',
|
|
343
|
+
queen: state.queen ? 'healthy' : 'unhealthy',
|
|
344
|
+
workers: state.workers.length > 0 ? 'healthy' : 'degraded',
|
|
345
|
+
consensus: 'healthy',
|
|
346
|
+
memory: 'healthy',
|
|
347
|
+
},
|
|
348
|
+
// Additional fields
|
|
349
|
+
id: `hive-${state.createdAt ? new Date(state.createdAt).getTime() : Date.now()}`,
|
|
350
|
+
initialized: state.initialized,
|
|
351
|
+
workerCount: state.workers.length,
|
|
352
|
+
pendingConsensus: state.consensus.pending.length,
|
|
353
|
+
sharedMemoryKeys: Object.keys(state.sharedMemory).length,
|
|
354
|
+
uptime,
|
|
355
|
+
createdAt: state.createdAt,
|
|
356
|
+
updatedAt: state.updatedAt,
|
|
357
|
+
};
|
|
358
|
+
if (input.verbose) {
|
|
359
|
+
return {
|
|
360
|
+
...status,
|
|
361
|
+
workerDetails: state.workers,
|
|
362
|
+
consensusHistory: state.consensus.history.slice(-10),
|
|
363
|
+
sharedMemory: state.sharedMemory,
|
|
364
|
+
};
|
|
365
|
+
}
|
|
366
|
+
return status;
|
|
367
|
+
},
|
|
368
|
+
},
|
|
369
|
+
{
|
|
370
|
+
name: 'hive-mind_join',
|
|
371
|
+
description: 'Join an agent to the hive-mind Use when native Task is wrong because you need queen-led collective intelligence — Byzantine-FT consensus, broadcast across many worker agents, shared memory with bounded conflict. For a single subagent, native Task is fine. Pair with swarm_init first to set topology.',
|
|
372
|
+
category: 'hive-mind',
|
|
373
|
+
inputSchema: {
|
|
374
|
+
type: 'object',
|
|
375
|
+
properties: {
|
|
376
|
+
agentId: { type: 'string', description: 'Agent ID to join' },
|
|
377
|
+
role: { type: 'string', enum: ['worker', 'specialist', 'scout'], description: 'Agent role in hive' },
|
|
378
|
+
},
|
|
379
|
+
required: ['agentId'],
|
|
380
|
+
},
|
|
381
|
+
handler: async (input) => {
|
|
382
|
+
const state = loadHiveState();
|
|
383
|
+
const agentId = input.agentId;
|
|
384
|
+
{
|
|
385
|
+
const v = validateIdentifier(agentId, 'agentId');
|
|
386
|
+
if (!v.valid)
|
|
387
|
+
return { success: false, error: v.error };
|
|
388
|
+
}
|
|
389
|
+
if (!state.initialized) {
|
|
390
|
+
return { success: false, error: 'Hive-mind not initialized' };
|
|
391
|
+
}
|
|
392
|
+
if (!state.workers.includes(agentId)) {
|
|
393
|
+
state.workers.push(agentId);
|
|
394
|
+
saveHiveState(state);
|
|
395
|
+
}
|
|
396
|
+
return {
|
|
397
|
+
success: true,
|
|
398
|
+
agentId,
|
|
399
|
+
role: input.role || 'worker',
|
|
400
|
+
totalWorkers: state.workers.length,
|
|
401
|
+
joinedAt: new Date().toISOString(),
|
|
402
|
+
};
|
|
403
|
+
},
|
|
404
|
+
},
|
|
405
|
+
{
|
|
406
|
+
name: 'hive-mind_leave',
|
|
407
|
+
description: 'Remove an agent from the hive-mind Use when native Task is wrong because you need queen-led collective intelligence — Byzantine-FT consensus, broadcast across many worker agents, shared memory with bounded conflict. For a single subagent, native Task is fine. Pair with swarm_init first to set topology.',
|
|
408
|
+
category: 'hive-mind',
|
|
409
|
+
inputSchema: {
|
|
410
|
+
type: 'object',
|
|
411
|
+
properties: {
|
|
412
|
+
agentId: { type: 'string', description: 'Agent ID to remove' },
|
|
413
|
+
},
|
|
414
|
+
required: ['agentId'],
|
|
415
|
+
},
|
|
416
|
+
handler: async (input) => {
|
|
417
|
+
const state = loadHiveState();
|
|
418
|
+
const agentId = input.agentId;
|
|
419
|
+
{
|
|
420
|
+
const v = validateIdentifier(agentId, 'agentId');
|
|
421
|
+
if (!v.valid)
|
|
422
|
+
return { success: false, agentId, error: v.error };
|
|
423
|
+
}
|
|
424
|
+
const index = state.workers.indexOf(agentId);
|
|
425
|
+
if (index > -1) {
|
|
426
|
+
state.workers.splice(index, 1);
|
|
427
|
+
saveHiveState(state);
|
|
428
|
+
return {
|
|
429
|
+
success: true,
|
|
430
|
+
agentId,
|
|
431
|
+
leftAt: new Date().toISOString(),
|
|
432
|
+
remainingWorkers: state.workers.length,
|
|
433
|
+
};
|
|
434
|
+
}
|
|
435
|
+
return { success: false, agentId, error: 'Agent not in hive' };
|
|
436
|
+
},
|
|
437
|
+
},
|
|
438
|
+
{
|
|
439
|
+
name: 'hive-mind_consensus',
|
|
440
|
+
description: 'Propose or vote on consensus with BFT, Raft, or Quorum strategies Use when native Task is wrong because you need queen-led collective intelligence — Byzantine-FT consensus, broadcast across many worker agents, shared memory with bounded conflict. For a single subagent, native Task is fine. Pair with swarm_init first to set topology.',
|
|
441
|
+
category: 'hive-mind',
|
|
442
|
+
inputSchema: {
|
|
443
|
+
type: 'object',
|
|
444
|
+
properties: {
|
|
445
|
+
action: { type: 'string', enum: ['propose', 'vote', 'status', 'list'], description: 'Consensus action' },
|
|
446
|
+
proposalId: { type: 'string', description: 'Proposal ID (for vote/status)' },
|
|
447
|
+
type: { type: 'string', description: 'Proposal type (for propose)' },
|
|
448
|
+
value: { description: 'Proposal value (for propose)' },
|
|
449
|
+
vote: { type: 'boolean', description: 'Vote (true=for, false=against)' },
|
|
450
|
+
voterId: { type: 'string', description: 'Voter agent ID' },
|
|
451
|
+
strategy: { type: 'string', enum: ['bft', 'raft', 'quorum'], description: 'Consensus strategy (default: raft)' },
|
|
452
|
+
quorumPreset: { type: 'string', enum: ['unanimous', 'majority', 'supermajority'], description: 'Quorum threshold preset (for quorum strategy, default: majority)' },
|
|
453
|
+
term: { type: 'number', description: 'Term number (for raft strategy)' },
|
|
454
|
+
timeoutMs: { type: 'number', description: 'Timeout in ms for raft re-proposal (default: 30000)' },
|
|
455
|
+
},
|
|
456
|
+
required: ['action'],
|
|
457
|
+
},
|
|
458
|
+
handler: async (input) => {
|
|
459
|
+
if (input.proposalId) {
|
|
460
|
+
const v = validateIdentifier(input.proposalId, 'proposalId');
|
|
461
|
+
if (!v.valid)
|
|
462
|
+
return { action: input.action, error: v.error };
|
|
463
|
+
}
|
|
464
|
+
if (input.voterId) {
|
|
465
|
+
const v = validateIdentifier(input.voterId, 'voterId');
|
|
466
|
+
if (!v.valid)
|
|
467
|
+
return { action: input.action, error: v.error };
|
|
468
|
+
}
|
|
469
|
+
if (input.type) {
|
|
470
|
+
const v = validateText(input.type, 'type');
|
|
471
|
+
if (!v.valid)
|
|
472
|
+
return { action: input.action, error: v.error };
|
|
473
|
+
}
|
|
474
|
+
const state = loadHiveState();
|
|
475
|
+
const action = input.action;
|
|
476
|
+
const strategy = input.strategy || 'raft';
|
|
477
|
+
const totalNodes = state.workers.length || 1;
|
|
478
|
+
if (action === 'propose') {
|
|
479
|
+
const proposalId = `proposal-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
|
|
480
|
+
const quorumPreset = input.quorumPreset || 'majority';
|
|
481
|
+
const term = input.term || (state.queen?.term ?? 1);
|
|
482
|
+
const timeoutMs = input.timeoutMs || 30000;
|
|
483
|
+
// Raft: check if there's already a pending proposal for this term
|
|
484
|
+
if (strategy === 'raft') {
|
|
485
|
+
const existingTermProposal = state.consensus.pending.find(p => p.strategy === 'raft' && p.term === term && p.status === 'pending');
|
|
486
|
+
if (existingTermProposal) {
|
|
487
|
+
return {
|
|
488
|
+
action,
|
|
489
|
+
error: `Raft term ${term} already has a pending proposal: ${existingTermProposal.proposalId}. Wait for resolution or use a higher term.`,
|
|
490
|
+
existingProposalId: existingTermProposal.proposalId,
|
|
491
|
+
term,
|
|
492
|
+
};
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
const required = calculateRequiredVotes(strategy, totalNodes, quorumPreset);
|
|
496
|
+
const proposal = {
|
|
497
|
+
proposalId,
|
|
498
|
+
type: input.type || 'general',
|
|
499
|
+
value: input.value,
|
|
500
|
+
proposedBy: input.voterId || 'system',
|
|
501
|
+
proposedAt: new Date().toISOString(),
|
|
502
|
+
votes: {},
|
|
503
|
+
status: 'pending',
|
|
504
|
+
strategy,
|
|
505
|
+
term: strategy === 'raft' ? term : undefined,
|
|
506
|
+
quorumPreset: strategy === 'quorum' ? quorumPreset : undefined,
|
|
507
|
+
byzantineVoters: strategy === 'bft' ? [] : undefined,
|
|
508
|
+
timeoutAt: strategy === 'raft' ? new Date(Date.now() + timeoutMs).toISOString() : undefined,
|
|
509
|
+
};
|
|
510
|
+
state.consensus.pending.push(proposal);
|
|
511
|
+
saveHiveState(state);
|
|
512
|
+
return {
|
|
513
|
+
action,
|
|
514
|
+
proposalId,
|
|
515
|
+
type: proposal.type,
|
|
516
|
+
strategy,
|
|
517
|
+
status: 'pending',
|
|
518
|
+
required,
|
|
519
|
+
totalNodes,
|
|
520
|
+
term: proposal.term,
|
|
521
|
+
quorumPreset: proposal.quorumPreset,
|
|
522
|
+
timeoutAt: proposal.timeoutAt,
|
|
523
|
+
};
|
|
524
|
+
}
|
|
525
|
+
if (action === 'vote') {
|
|
526
|
+
const proposal = state.consensus.pending.find(p => p.proposalId === input.proposalId);
|
|
527
|
+
if (!proposal) {
|
|
528
|
+
return { action, error: 'Proposal not found or already resolved' };
|
|
529
|
+
}
|
|
530
|
+
const voterId = input.voterId;
|
|
531
|
+
if (!voterId) {
|
|
532
|
+
return { action, error: 'voterId is required for voting' };
|
|
533
|
+
}
|
|
534
|
+
const voteValue = input.vote;
|
|
535
|
+
const proposalStrategy = proposal.strategy || 'raft';
|
|
536
|
+
const required = calculateRequiredVotes(proposalStrategy, totalNodes, proposal.quorumPreset);
|
|
537
|
+
// Prevent double-voting
|
|
538
|
+
if (voterId in proposal.votes) {
|
|
539
|
+
const previousVote = proposal.votes[voterId];
|
|
540
|
+
if (previousVote === voteValue) {
|
|
541
|
+
return {
|
|
542
|
+
action,
|
|
543
|
+
error: `Voter ${voterId} has already cast the same vote on this proposal`,
|
|
544
|
+
proposalId: proposal.proposalId,
|
|
545
|
+
existingVote: previousVote,
|
|
546
|
+
};
|
|
547
|
+
}
|
|
548
|
+
// Conflicting vote from same voter
|
|
549
|
+
if (proposalStrategy === 'bft') {
|
|
550
|
+
// BFT: detect as Byzantine behavior
|
|
551
|
+
if (!proposal.byzantineVoters)
|
|
552
|
+
proposal.byzantineVoters = [];
|
|
553
|
+
if (!proposal.byzantineVoters.includes(voterId)) {
|
|
554
|
+
proposal.byzantineVoters.push(voterId);
|
|
555
|
+
}
|
|
556
|
+
// Remove their vote entirely -- Byzantine voter is excluded
|
|
557
|
+
delete proposal.votes[voterId];
|
|
558
|
+
saveHiveState(state);
|
|
559
|
+
return {
|
|
560
|
+
action,
|
|
561
|
+
proposalId: proposal.proposalId,
|
|
562
|
+
voterId,
|
|
563
|
+
byzantineDetected: true,
|
|
564
|
+
message: `Byzantine behavior detected: voter ${voterId} attempted conflicting vote. Vote invalidated.`,
|
|
565
|
+
byzantineVoters: proposal.byzantineVoters,
|
|
566
|
+
status: proposal.status,
|
|
567
|
+
};
|
|
568
|
+
}
|
|
569
|
+
if (proposalStrategy === 'raft') {
|
|
570
|
+
// Raft: only one vote per node per term, reject the change
|
|
571
|
+
return {
|
|
572
|
+
action,
|
|
573
|
+
error: `Raft: voter ${voterId} already voted in term ${proposal.term}. Cannot change vote.`,
|
|
574
|
+
proposalId: proposal.proposalId,
|
|
575
|
+
term: proposal.term,
|
|
576
|
+
};
|
|
577
|
+
}
|
|
578
|
+
// Quorum: reject double-vote
|
|
579
|
+
return {
|
|
580
|
+
action,
|
|
581
|
+
error: `Voter ${voterId} has already voted on this proposal`,
|
|
582
|
+
proposalId: proposal.proposalId,
|
|
583
|
+
};
|
|
584
|
+
}
|
|
585
|
+
// BFT: check for cross-proposal Byzantine behavior
|
|
586
|
+
if (proposalStrategy === 'bft') {
|
|
587
|
+
const isByzantine = detectByzantineVoters(state.consensus.pending, proposal, voterId, voteValue);
|
|
588
|
+
if (isByzantine) {
|
|
589
|
+
if (!proposal.byzantineVoters)
|
|
590
|
+
proposal.byzantineVoters = [];
|
|
591
|
+
if (!proposal.byzantineVoters.includes(voterId)) {
|
|
592
|
+
proposal.byzantineVoters.push(voterId);
|
|
593
|
+
}
|
|
594
|
+
saveHiveState(state);
|
|
595
|
+
return {
|
|
596
|
+
action,
|
|
597
|
+
proposalId: proposal.proposalId,
|
|
598
|
+
voterId,
|
|
599
|
+
byzantineDetected: true,
|
|
600
|
+
message: `Byzantine behavior detected: voter ${voterId} cast conflicting votes across proposals of same type. Vote rejected.`,
|
|
601
|
+
byzantineVoters: proposal.byzantineVoters,
|
|
602
|
+
status: proposal.status,
|
|
603
|
+
};
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
// Record the vote
|
|
607
|
+
proposal.votes[voterId] = voteValue;
|
|
608
|
+
const votesFor = Object.values(proposal.votes).filter(v => v).length;
|
|
609
|
+
const votesAgainst = Object.values(proposal.votes).filter(v => !v).length;
|
|
610
|
+
// Try to resolve
|
|
611
|
+
const resolution = tryResolveProposal(proposal, totalNodes);
|
|
612
|
+
let resolved = false;
|
|
613
|
+
if (resolution !== null) {
|
|
614
|
+
resolved = true;
|
|
615
|
+
proposal.status = resolution;
|
|
616
|
+
state.consensus.history.push({
|
|
617
|
+
proposalId: proposal.proposalId,
|
|
618
|
+
type: proposal.type,
|
|
619
|
+
result: resolution,
|
|
620
|
+
votes: { for: votesFor, against: votesAgainst },
|
|
621
|
+
decidedAt: new Date().toISOString(),
|
|
622
|
+
strategy: proposalStrategy,
|
|
623
|
+
term: proposal.term,
|
|
624
|
+
byzantineDetected: proposal.byzantineVoters?.length ? proposal.byzantineVoters : undefined,
|
|
625
|
+
});
|
|
626
|
+
state.consensus.pending = state.consensus.pending.filter(p => p.proposalId !== proposal.proposalId);
|
|
627
|
+
}
|
|
628
|
+
saveHiveState(state);
|
|
629
|
+
// Persist consensus result in AgentDB for searchable history
|
|
630
|
+
if (resolved) {
|
|
631
|
+
try {
|
|
632
|
+
const bridge = await import('../memory/memory-bridge.js');
|
|
633
|
+
await bridge.bridgeStoreEntry({
|
|
634
|
+
key: `consensus-${proposal.proposalId}`,
|
|
635
|
+
value: JSON.stringify({
|
|
636
|
+
proposalId: proposal.proposalId,
|
|
637
|
+
type: proposal.type,
|
|
638
|
+
strategy: proposalStrategy,
|
|
639
|
+
status: proposal.status,
|
|
640
|
+
votes: proposal.votes,
|
|
641
|
+
resolvedAt: new Date().toISOString(),
|
|
642
|
+
}),
|
|
643
|
+
namespace: 'hive-consensus',
|
|
644
|
+
tags: [proposal.type, proposalStrategy || 'raft', proposal.status],
|
|
645
|
+
});
|
|
646
|
+
}
|
|
647
|
+
catch { /* AgentDB not available — JSON store is primary */ }
|
|
648
|
+
}
|
|
649
|
+
return {
|
|
650
|
+
action,
|
|
651
|
+
proposalId: proposal.proposalId,
|
|
652
|
+
voterId,
|
|
653
|
+
vote: voteValue,
|
|
654
|
+
strategy: proposalStrategy,
|
|
655
|
+
votesFor,
|
|
656
|
+
votesAgainst,
|
|
657
|
+
required,
|
|
658
|
+
totalNodes,
|
|
659
|
+
resolved,
|
|
660
|
+
result: resolved ? resolution : undefined,
|
|
661
|
+
status: proposal.status,
|
|
662
|
+
term: proposal.term,
|
|
663
|
+
byzantineVoters: proposal.byzantineVoters?.length ? proposal.byzantineVoters : undefined,
|
|
664
|
+
};
|
|
665
|
+
}
|
|
666
|
+
if (action === 'status') {
|
|
667
|
+
const proposal = state.consensus.pending.find(p => p.proposalId === input.proposalId);
|
|
668
|
+
if (!proposal) {
|
|
669
|
+
// Check history
|
|
670
|
+
const historical = state.consensus.history.find(h => h.proposalId === input.proposalId);
|
|
671
|
+
if (historical) {
|
|
672
|
+
return { action, ...historical, historical: true, resolved: true };
|
|
673
|
+
}
|
|
674
|
+
return { action, error: 'Proposal not found' };
|
|
675
|
+
}
|
|
676
|
+
const votesFor = Object.values(proposal.votes).filter(v => v).length;
|
|
677
|
+
const votesAgainst = Object.values(proposal.votes).filter(v => !v).length;
|
|
678
|
+
const proposalStrategy = proposal.strategy || 'raft';
|
|
679
|
+
const required = calculateRequiredVotes(proposalStrategy, totalNodes, proposal.quorumPreset);
|
|
680
|
+
// Raft: check timeout
|
|
681
|
+
let timedOut = false;
|
|
682
|
+
if (proposalStrategy === 'raft' && proposal.timeoutAt) {
|
|
683
|
+
timedOut = new Date().getTime() > new Date(proposal.timeoutAt).getTime();
|
|
684
|
+
}
|
|
685
|
+
return {
|
|
686
|
+
action,
|
|
687
|
+
proposalId: proposal.proposalId,
|
|
688
|
+
type: proposal.type,
|
|
689
|
+
strategy: proposalStrategy,
|
|
690
|
+
status: proposal.status,
|
|
691
|
+
votesFor,
|
|
692
|
+
votesAgainst,
|
|
693
|
+
totalVotes: Object.keys(proposal.votes).length,
|
|
694
|
+
required,
|
|
695
|
+
totalNodes,
|
|
696
|
+
resolved: false,
|
|
697
|
+
term: proposal.term,
|
|
698
|
+
quorumPreset: proposal.quorumPreset,
|
|
699
|
+
byzantineVoters: proposal.byzantineVoters?.length ? proposal.byzantineVoters : undefined,
|
|
700
|
+
timedOut,
|
|
701
|
+
timeoutAt: proposal.timeoutAt,
|
|
702
|
+
hint: timedOut ? `Raft timeout reached. Re-propose with term ${(proposal.term || 1) + 1}.` : undefined,
|
|
703
|
+
};
|
|
704
|
+
}
|
|
705
|
+
if (action === 'list') {
|
|
706
|
+
return {
|
|
707
|
+
action,
|
|
708
|
+
pending: state.consensus.pending.map(p => ({
|
|
709
|
+
proposalId: p.proposalId,
|
|
710
|
+
type: p.type,
|
|
711
|
+
strategy: p.strategy || 'raft',
|
|
712
|
+
proposedAt: p.proposedAt,
|
|
713
|
+
totalVotes: Object.keys(p.votes).length,
|
|
714
|
+
required: calculateRequiredVotes(p.strategy || 'raft', totalNodes, p.quorumPreset),
|
|
715
|
+
term: p.term,
|
|
716
|
+
status: p.status,
|
|
717
|
+
})),
|
|
718
|
+
recentHistory: state.consensus.history.slice(-5),
|
|
719
|
+
};
|
|
720
|
+
}
|
|
721
|
+
return { action, error: 'Unknown action' };
|
|
722
|
+
},
|
|
723
|
+
},
|
|
724
|
+
{
|
|
725
|
+
name: 'hive-mind_broadcast',
|
|
726
|
+
description: 'Broadcast message to all workers Use when native Task is wrong because you need queen-led collective intelligence — Byzantine-FT consensus, broadcast across many worker agents, shared memory with bounded conflict. For a single subagent, native Task is fine. Pair with swarm_init first to set topology.',
|
|
727
|
+
category: 'hive-mind',
|
|
728
|
+
inputSchema: {
|
|
729
|
+
type: 'object',
|
|
730
|
+
properties: {
|
|
731
|
+
message: { type: 'string', description: 'Message to broadcast' },
|
|
732
|
+
priority: { type: 'string', enum: ['low', 'normal', 'high', 'critical'], description: 'Message priority' },
|
|
733
|
+
fromId: { type: 'string', description: 'Sender agent ID' },
|
|
734
|
+
},
|
|
735
|
+
required: ['message'],
|
|
736
|
+
},
|
|
737
|
+
handler: async (input) => {
|
|
738
|
+
const state = loadHiveState();
|
|
739
|
+
if (!state.initialized) {
|
|
740
|
+
return { success: false, error: 'Hive-mind not initialized' };
|
|
741
|
+
}
|
|
742
|
+
{
|
|
743
|
+
const v = validateText(input.message, 'message');
|
|
744
|
+
if (!v.valid)
|
|
745
|
+
return { success: false, error: v.error };
|
|
746
|
+
}
|
|
747
|
+
if (input.fromId) {
|
|
748
|
+
const v = validateIdentifier(input.fromId, 'fromId');
|
|
749
|
+
if (!v.valid)
|
|
750
|
+
return { success: false, error: v.error };
|
|
751
|
+
}
|
|
752
|
+
const messageId = `msg-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
|
|
753
|
+
// Store in shared memory
|
|
754
|
+
const messages = state.sharedMemory.broadcasts || [];
|
|
755
|
+
messages.push({
|
|
756
|
+
messageId,
|
|
757
|
+
message: input.message,
|
|
758
|
+
priority: input.priority || 'normal',
|
|
759
|
+
fromId: input.fromId || 'system',
|
|
760
|
+
timestamp: new Date().toISOString(),
|
|
761
|
+
});
|
|
762
|
+
// Keep only last 100 broadcasts
|
|
763
|
+
state.sharedMemory.broadcasts = messages.slice(-100);
|
|
764
|
+
saveHiveState(state);
|
|
765
|
+
return {
|
|
766
|
+
success: true,
|
|
767
|
+
messageId,
|
|
768
|
+
recipients: state.workers.length,
|
|
769
|
+
priority: input.priority || 'normal',
|
|
770
|
+
broadcastAt: new Date().toISOString(),
|
|
771
|
+
};
|
|
772
|
+
},
|
|
773
|
+
},
|
|
774
|
+
{
|
|
775
|
+
name: 'hive-mind_shutdown',
|
|
776
|
+
description: 'Shutdown the hive-mind and terminate all workers Use when native Task is wrong because you need queen-led collective intelligence — Byzantine-FT consensus, broadcast across many worker agents, shared memory with bounded conflict. For a single subagent, native Task is fine. Pair with swarm_init first to set topology.',
|
|
777
|
+
category: 'hive-mind',
|
|
778
|
+
inputSchema: {
|
|
779
|
+
type: 'object',
|
|
780
|
+
properties: {
|
|
781
|
+
graceful: { type: 'boolean', description: 'Graceful shutdown (wait for pending tasks)', default: true },
|
|
782
|
+
force: { type: 'boolean', description: 'Force immediate shutdown', default: false },
|
|
783
|
+
},
|
|
784
|
+
},
|
|
785
|
+
handler: async (input) => {
|
|
786
|
+
const state = loadHiveState();
|
|
787
|
+
if (!state.initialized) {
|
|
788
|
+
return { success: false, error: 'Hive-mind not initialized or already shut down' };
|
|
789
|
+
}
|
|
790
|
+
const graceful = input.graceful !== false;
|
|
791
|
+
const force = input.force === true;
|
|
792
|
+
const workerCount = state.workers.length;
|
|
793
|
+
const pendingConsensus = state.consensus.pending.length;
|
|
794
|
+
// If graceful and there are pending consensus items, warn (unless forced)
|
|
795
|
+
if (graceful && pendingConsensus > 0 && !force) {
|
|
796
|
+
return {
|
|
797
|
+
success: false,
|
|
798
|
+
error: `Cannot gracefully shutdown with ${pendingConsensus} pending consensus items. Use force: true to override.`,
|
|
799
|
+
pendingConsensus,
|
|
800
|
+
workerCount,
|
|
801
|
+
};
|
|
802
|
+
}
|
|
803
|
+
// Clear workers from agent store
|
|
804
|
+
const agentStore = loadAgentStore();
|
|
805
|
+
for (const workerId of state.workers) {
|
|
806
|
+
if (agentStore.agents[workerId]) {
|
|
807
|
+
delete agentStore.agents[workerId];
|
|
808
|
+
}
|
|
809
|
+
}
|
|
810
|
+
saveAgentStore(agentStore);
|
|
811
|
+
// Reset hive state
|
|
812
|
+
const shutdownTime = new Date().toISOString();
|
|
813
|
+
const previousQueen = state.queen?.agentId;
|
|
814
|
+
state.initialized = false;
|
|
815
|
+
state.queen = undefined;
|
|
816
|
+
state.workers = [];
|
|
817
|
+
state.consensus.pending = [];
|
|
818
|
+
// Keep history for reference
|
|
819
|
+
state.sharedMemory = {};
|
|
820
|
+
saveHiveState(state);
|
|
821
|
+
return {
|
|
822
|
+
success: true,
|
|
823
|
+
shutdownAt: shutdownTime,
|
|
824
|
+
graceful,
|
|
825
|
+
workersTerminated: workerCount,
|
|
826
|
+
previousQueen,
|
|
827
|
+
consensusCleared: pendingConsensus,
|
|
828
|
+
message: `Hive-mind shutdown complete. ${workerCount} workers terminated.`,
|
|
829
|
+
};
|
|
830
|
+
},
|
|
831
|
+
},
|
|
832
|
+
{
|
|
833
|
+
name: 'hive-mind_memory',
|
|
834
|
+
description: 'Access hive shared memory Use when native Task is wrong because you need queen-led collective intelligence — Byzantine-FT consensus, broadcast across many worker agents, shared memory with bounded conflict. For a single subagent, native Task is fine. Pair with swarm_init first to set topology.',
|
|
835
|
+
category: 'hive-mind',
|
|
836
|
+
inputSchema: {
|
|
837
|
+
type: 'object',
|
|
838
|
+
properties: {
|
|
839
|
+
action: { type: 'string', enum: ['get', 'set', 'delete', 'list'], description: 'Memory action' },
|
|
840
|
+
key: { type: 'string', description: 'Memory key' },
|
|
841
|
+
value: { description: 'Value to store (for set)' },
|
|
842
|
+
},
|
|
843
|
+
required: ['action'],
|
|
844
|
+
},
|
|
845
|
+
handler: async (input) => {
|
|
846
|
+
if (input.key) {
|
|
847
|
+
const v = validateIdentifier(input.key, 'key');
|
|
848
|
+
if (!v.valid)
|
|
849
|
+
return { action: input.action, error: v.error };
|
|
850
|
+
}
|
|
851
|
+
const state = loadHiveState();
|
|
852
|
+
const action = input.action;
|
|
853
|
+
const key = input.key;
|
|
854
|
+
if (action === 'get') {
|
|
855
|
+
if (!key)
|
|
856
|
+
return { action, error: 'Key required' };
|
|
857
|
+
return {
|
|
858
|
+
action,
|
|
859
|
+
key,
|
|
860
|
+
value: state.sharedMemory[key],
|
|
861
|
+
exists: key in state.sharedMemory,
|
|
862
|
+
};
|
|
863
|
+
}
|
|
864
|
+
if (action === 'set') {
|
|
865
|
+
if (!key)
|
|
866
|
+
return { action, error: 'Key required' };
|
|
867
|
+
state.sharedMemory[key] = input.value;
|
|
868
|
+
saveHiveState(state);
|
|
869
|
+
// Also store in AgentDB for searchable hive memory
|
|
870
|
+
try {
|
|
871
|
+
const bridge = await import('../memory/memory-bridge.js');
|
|
872
|
+
await bridge.bridgeStoreEntry({
|
|
873
|
+
key: `hive-memory-${key}`,
|
|
874
|
+
value: JSON.stringify(input.value),
|
|
875
|
+
namespace: 'hive-memory',
|
|
876
|
+
});
|
|
877
|
+
}
|
|
878
|
+
catch { /* AgentDB not available */ }
|
|
879
|
+
return {
|
|
880
|
+
action,
|
|
881
|
+
key,
|
|
882
|
+
success: true,
|
|
883
|
+
updatedAt: new Date().toISOString(),
|
|
884
|
+
};
|
|
885
|
+
}
|
|
886
|
+
if (action === 'delete') {
|
|
887
|
+
if (!key)
|
|
888
|
+
return { action, error: 'Key required' };
|
|
889
|
+
const existed = key in state.sharedMemory;
|
|
890
|
+
delete state.sharedMemory[key];
|
|
891
|
+
saveHiveState(state);
|
|
892
|
+
return {
|
|
893
|
+
action,
|
|
894
|
+
key,
|
|
895
|
+
deleted: existed,
|
|
896
|
+
};
|
|
897
|
+
}
|
|
898
|
+
if (action === 'list') {
|
|
899
|
+
return {
|
|
900
|
+
action,
|
|
901
|
+
keys: Object.keys(state.sharedMemory),
|
|
902
|
+
count: Object.keys(state.sharedMemory).length,
|
|
903
|
+
};
|
|
904
|
+
}
|
|
905
|
+
return { action, error: 'Unknown action' };
|
|
906
|
+
},
|
|
907
|
+
},
|
|
908
|
+
{
|
|
909
|
+
// #1916: `ruflo hive-mind optimize-memory` referenced an unregistered
|
|
910
|
+
// `hive-mind_optimize-memory` tool. Best-effort today: prunes obviously-
|
|
911
|
+
// empty shared-memory keys and reports the before/after counts; pattern
|
|
912
|
+
// quality consolidation is a follow-up (it belongs in the intelligence
|
|
913
|
+
// pipeline / agentdb curator, not here).
|
|
914
|
+
name: 'hive-mind_optimize-memory',
|
|
915
|
+
description: 'Compact the hive-mind shared-memory store (drops null/empty keys) and report before/after pattern counts. Use when native conversation memory is wrong because you need the queen-led collective\'s persisted shared state cleaned up between phases. For one-shot scratch state, no tool needed. (Pattern-quality consolidation is delegated to the intelligence pipeline — this only does the cheap structural pass for now.)',
|
|
916
|
+
category: 'hive-mind',
|
|
917
|
+
inputSchema: {
|
|
918
|
+
type: 'object',
|
|
919
|
+
properties: {
|
|
920
|
+
qualityThreshold: { type: 'number', description: 'Quality threshold for pattern retention (advisory — not enforced yet)' },
|
|
921
|
+
},
|
|
922
|
+
},
|
|
923
|
+
handler: async () => {
|
|
924
|
+
const t0 = Date.now();
|
|
925
|
+
const state = loadHiveState();
|
|
926
|
+
if (!state.initialized)
|
|
927
|
+
return { optimized: false, error: 'Hive-mind not initialized', before: { patterns: 0, memory: '0' }, after: { patterns: 0, memory: '0' }, removed: 0, consolidated: 0, timeMs: 0 };
|
|
928
|
+
const beforeKeys = Object.keys(state.sharedMemory);
|
|
929
|
+
const before = beforeKeys.length;
|
|
930
|
+
for (const k of beforeKeys) {
|
|
931
|
+
const v = state.sharedMemory[k];
|
|
932
|
+
if (v === null || v === undefined || (typeof v === 'object' && v !== null && Object.keys(v).length === 0)) {
|
|
933
|
+
delete state.sharedMemory[k];
|
|
934
|
+
}
|
|
935
|
+
}
|
|
936
|
+
const after = Object.keys(state.sharedMemory).length;
|
|
937
|
+
const removed = before - after;
|
|
938
|
+
if (removed > 0)
|
|
939
|
+
saveHiveState(state);
|
|
940
|
+
const sizeStr = (n) => `${Buffer.byteLength(JSON.stringify(state.sharedMemory))}B (~${n} keys)`;
|
|
941
|
+
return {
|
|
942
|
+
optimized: removed > 0,
|
|
943
|
+
before: { patterns: before, memory: `~${before} keys` },
|
|
944
|
+
after: { patterns: after, memory: sizeStr(after) },
|
|
945
|
+
removed,
|
|
946
|
+
consolidated: 0,
|
|
947
|
+
timeMs: Date.now() - t0,
|
|
948
|
+
note: 'structural compaction only; pattern-quality consolidation is delegated to the intelligence pipeline (#1916 follow-up)',
|
|
949
|
+
};
|
|
950
|
+
},
|
|
951
|
+
},
|
|
952
|
+
];
|
|
953
|
+
//# sourceMappingURL=hive-mind-tools.js.map
|