claude-flow-novice 1.3.6 → 1.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/agents/analysis/code-analyzer.md +3 -20
- package/.claude/agents/analysis/code-review/analyze-code-quality.md +1 -1
- package/.claude/agents/analyst.md +208 -550
- package/.claude/agents/architect.md +136 -469
- package/.claude/agents/architecture/system-architect.md +20 -1
- package/.claude/agents/architecture/system-design/arch-system-design.md +1 -1
- package/.claude/agents/base-template-generator.md +24 -1
- package/.claude/agents/coder.md +87 -303
- package/.claude/agents/consensus/byzantine-coordinator.md +4 -21
- package/.claude/agents/consensus/consensus-builder.md +3 -20
- package/.claude/agents/consensus/crdt-synchronizer.md +4 -21
- package/.claude/agents/consensus/gossip-coordinator.md +4 -21
- package/.claude/agents/consensus/performance-benchmarker.md +4 -21
- package/.claude/agents/consensus/quorum-manager.md +4 -21
- package/.claude/agents/consensus/raft-manager.md +4 -21
- package/.claude/agents/consensus/security-manager.md +4 -21
- package/.claude/agents/coordinator.md +22 -11
- package/.claude/agents/data/ml/data-ml-model.md +2 -2
- package/.claude/agents/development/backend/dev-backend-api.md +2 -2
- package/.claude/agents/devops/ci-cd/ops-cicd-github.md +2 -2
- package/.claude/agents/devops/devops-engineer.md +134 -402
- package/.claude/agents/documentation/api-docs/docs-api-openapi.md +2 -2
- package/.claude/agents/github/code-review-swarm.md +1 -1
- package/.claude/agents/github/github-specialist.md +856 -0
- package/.claude/agents/github/pr-manager.md +1 -1
- package/.claude/agents/github/release-manager.md +1 -1
- package/.claude/agents/neural/neural-pattern-agent.md +762 -0
- package/.claude/agents/optimization/benchmark-suite.md +1 -1
- package/.claude/agents/optimization/perf-analyzer.md +1 -1
- package/.claude/agents/optimization/performance-monitor.md +1 -1
- package/.claude/agents/planner.md +135 -0
- package/.claude/agents/researcher.md +22 -9
- package/.claude/agents/reviewer.md +291 -0
- package/.claude/agents/security/security-specialist.md +1 -1
- package/.claude/agents/sparc/architecture.md +1 -1
- package/.claude/agents/sparc/pseudocode.md +1 -1
- package/.claude/agents/sparc/refinement.md +1 -1
- package/.claude/agents/sparc/specification.md +1 -1
- package/.claude/agents/specialized/mobile/spec-mobile-react-native.md +2 -2
- package/.claude/agents/tester.md +21 -11
- package/.claude/agents/testing/unit/tdd-london-swarm.md +1 -1
- package/.claude/agents/testing/validation/production-validator.md +1 -1
- package/.claude/commands/claude-soul.js +1 -1
- package/.claude/commands/fullstack.md +134 -0
- package/.claude/commands/index.js +4 -0
- package/.claude/hooks.json +12 -15
- package/{.claude → .claude-flow-novice/.claude}/agents/MIGRATION_SUMMARY.md +1 -1
- package/.claude-flow-novice/.claude/agents/analysis/code-analyzer.md +192 -0
- package/.claude-flow-novice/.claude/agents/analysis/code-review/analyze-code-quality.md +180 -0
- package/.claude-flow-novice/.claude/agents/analyst.md +300 -0
- package/.claude-flow-novice/.claude/agents/architect.md +557 -0
- package/.claude-flow-novice/.claude/agents/architecture/system-architect.md +630 -0
- package/.claude-flow-novice/.claude/agents/architecture/system-design/arch-system-design.md +156 -0
- package/.claude-flow-novice/.claude/agents/base-template-generator.md +65 -0
- package/.claude-flow-novice/.claude/agents/coder.md +180 -0
- package/.claude-flow-novice/.claude/agents/consensus/byzantine-coordinator.md +46 -0
- package/.claude-flow-novice/.claude/agents/consensus/consensus-builder.md +225 -0
- package/.claude-flow-novice/.claude/agents/consensus/crdt-synchronizer.md +980 -0
- package/.claude-flow-novice/.claude/agents/consensus/gossip-coordinator.md +46 -0
- package/.claude-flow-novice/.claude/agents/consensus/performance-benchmarker.md +834 -0
- package/.claude-flow-novice/.claude/agents/consensus/quorum-manager.md +806 -0
- package/.claude-flow-novice/.claude/agents/consensus/raft-manager.md +46 -0
- package/.claude-flow-novice/.claude/agents/consensus/security-manager.md +605 -0
- package/.claude-flow-novice/.claude/agents/coordinator.md +842 -0
- package/.claude-flow-novice/.claude/agents/data/ml/data-ml-model.md +193 -0
- package/.claude-flow-novice/.claude/agents/development/backend/dev-backend-api.md +142 -0
- package/.claude-flow-novice/.claude/agents/devops/ci-cd/ops-cicd-github.md +164 -0
- package/.claude-flow-novice/.claude/agents/devops/devops-engineer.md +638 -0
- package/.claude-flow-novice/.claude/agents/documentation/api-docs/docs-api-openapi.md +174 -0
- package/.claude-flow-novice/.claude/agents/github/code-review-swarm.md +538 -0
- package/.claude-flow-novice/.claude/agents/github/github-modes.md +173 -0
- package/.claude-flow-novice/.claude/agents/github/github-specialist.md +856 -0
- package/.claude-flow-novice/.claude/agents/github/issue-tracker.md +319 -0
- package/.claude-flow-novice/.claude/agents/github/multi-repo-swarm.md +553 -0
- package/.claude-flow-novice/.claude/agents/github/pr-manager.md +191 -0
- package/.claude-flow-novice/.claude/agents/github/project-board-sync.md +509 -0
- package/.claude-flow-novice/.claude/agents/github/release-manager.md +367 -0
- package/.claude-flow-novice/.claude/agents/github/release-swarm.md +583 -0
- package/.claude-flow-novice/.claude/agents/github/repo-architect.md +398 -0
- package/.claude-flow-novice/.claude/agents/github/swarm-issue.md +573 -0
- package/.claude-flow-novice/.claude/agents/github/swarm-pr.md +428 -0
- package/.claude-flow-novice/.claude/agents/github/sync-coordinator.md +452 -0
- package/.claude-flow-novice/.claude/agents/github/workflow-automation.md +635 -0
- package/.claude-flow-novice/.claude/agents/goal/goal-planner.md +73 -0
- package/.claude-flow-novice/.claude/agents/neural/neural-pattern-agent.md +762 -0
- package/.claude-flow-novice/.claude/agents/neural/safla-neural.md +74 -0
- package/.claude-flow-novice/.claude/agents/optimization/benchmark-suite.md +665 -0
- package/.claude-flow-novice/.claude/agents/optimization/load-balancer.md +431 -0
- package/.claude-flow-novice/.claude/agents/optimization/perf-analyzer.md +725 -0
- package/.claude-flow-novice/.claude/agents/optimization/performance-monitor.md +672 -0
- package/.claude-flow-novice/.claude/agents/optimization/resource-allocator.md +674 -0
- package/.claude-flow-novice/.claude/agents/optimization/topology-optimizer.md +808 -0
- package/.claude-flow-novice/.claude/agents/planner.md +135 -0
- package/.claude-flow-novice/.claude/agents/researcher.md +185 -0
- package/.claude-flow-novice/.claude/agents/reviewer.md +291 -0
- package/.claude-flow-novice/.claude/agents/security/security-specialist.md +978 -0
- package/.claude-flow-novice/.claude/agents/sparc/architecture.md +472 -0
- package/.claude-flow-novice/.claude/agents/sparc/pseudocode.md +318 -0
- package/.claude-flow-novice/.claude/agents/sparc/refinement.md +525 -0
- package/.claude-flow-novice/.claude/agents/sparc/specification.md +276 -0
- package/.claude-flow-novice/.claude/agents/specialized/mobile/spec-mobile-react-native.md +226 -0
- package/.claude-flow-novice/.claude/agents/sublinear/consciousness-evolution-agent.md +499 -0
- package/.claude-flow-novice/.claude/agents/sublinear/matrix-solver-agent.md +113 -0
- package/.claude-flow-novice/.claude/agents/sublinear/nanosecond-scheduler-agent.md +644 -0
- package/.claude-flow-novice/.claude/agents/sublinear/pagerank-agent.md +699 -0
- package/.claude-flow-novice/.claude/agents/sublinear/phi-calculator-agent.md +749 -0
- package/.claude-flow-novice/.claude/agents/sublinear/psycho-symbolic-agent.md +543 -0
- package/.claude-flow-novice/.claude/agents/sublinear/sublinear.md +816 -0
- package/.claude-flow-novice/.claude/agents/sublinear/temporal-advantage-agent.md +360 -0
- package/.claude-flow-novice/.claude/agents/swarm/adaptive-coordinator-enhanced.md +746 -0
- package/.claude-flow-novice/.claude/agents/swarm/adaptive-coordinator.md +396 -0
- package/.claude-flow-novice/.claude/agents/swarm/hierarchical-coordinator.md +300 -0
- package/.claude-flow-novice/.claude/agents/swarm/mesh-coordinator.md +435 -0
- package/.claude-flow-novice/.claude/agents/templates/automation-smart-agent.md +205 -0
- package/.claude-flow-novice/.claude/agents/templates/coordinator-swarm-init.md +90 -0
- package/.claude-flow-novice/.claude/agents/templates/github-pr-manager.md +177 -0
- package/.claude-flow-novice/.claude/agents/templates/implementer-sparc-coder.md +259 -0
- package/.claude-flow-novice/.claude/agents/templates/memory-coordinator.md +187 -0
- package/.claude-flow-novice/.claude/agents/templates/migration-plan.md +746 -0
- package/.claude-flow-novice/.claude/agents/templates/orchestrator-task.md +139 -0
- package/.claude-flow-novice/.claude/agents/templates/performance-analyzer.md +199 -0
- package/.claude-flow-novice/.claude/agents/templates/sparc-coordinator.md +183 -0
- package/.claude-flow-novice/.claude/agents/tester.md +663 -0
- package/.claude-flow-novice/.claude/agents/testing/e2e/playwright-agent.md +249 -0
- package/.claude-flow-novice/.claude/agents/testing/unit/tdd-london-swarm.md +244 -0
- package/.claude-flow-novice/.claude/agents/testing/validation/production-validator.md +395 -0
- package/.claude-flow-novice/dist/index.js +12 -24
- package/.claude-flow-novice/dist/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/agents/agent-manager.js +123 -69
- package/.claude-flow-novice/dist/src/agents/agent-manager.js.map +1 -1
- package/.claude-flow-novice/dist/src/agents/github/utils/hook-integration.js +7 -7
- package/.claude-flow-novice/dist/src/agents/github/utils/hook-integration.js.map +1 -1
- package/.claude-flow-novice/dist/src/agents/stage3-integration-validator.js +485 -0
- package/.claude-flow-novice/dist/src/agents/stage3-integration-validator.js.map +1 -0
- package/.claude-flow-novice/dist/src/agents/unified-ultra-fast-agent-manager.js +630 -0
- package/.claude-flow-novice/dist/src/agents/unified-ultra-fast-agent-manager.js.map +1 -0
- package/.claude-flow-novice/dist/src/cli/commands/agent.js +1 -1
- package/.claude-flow-novice/dist/src/cli/commands/agent.js.map +1 -1
- package/.claude-flow-novice/dist/src/cli/commands/config-integration.js +6 -6
- package/.claude-flow-novice/dist/src/cli/commands/enterprise.js +18 -18
- package/.claude-flow-novice/dist/src/cli/commands/enterprise.js.map +1 -1
- package/.claude-flow-novice/dist/src/cli/commands/goal-init.js +4 -4
- package/.claude-flow-novice/dist/src/cli/commands/help-new.js +23 -23
- package/.claude-flow-novice/dist/src/cli/commands/help-new.js.map +1 -1
- package/.claude-flow-novice/dist/src/cli/commands/help.js +74 -74
- package/.claude-flow-novice/dist/src/cli/commands/help.js.map +1 -1
- package/.claude-flow-novice/dist/src/cli/commands/hive-mind/pause.js +2 -2
- package/.claude-flow-novice/dist/src/cli/commands/hive-mind/pause.js.map +1 -1
- package/.claude-flow-novice/dist/src/cli/commands/hive.js +4 -4
- package/.claude-flow-novice/dist/src/cli/commands/index.js +103 -132
- package/.claude-flow-novice/dist/src/cli/commands/index.js.map +1 -1
- package/.claude-flow-novice/dist/src/cli/commands/mcp.js +1 -1
- package/.claude-flow-novice/dist/src/cli/commands/migrate.js +4 -4
- package/.claude-flow-novice/dist/src/cli/commands/migrate.js.map +1 -1
- package/.claude-flow-novice/dist/src/cli/commands/monitor.js +1 -1
- package/.claude-flow-novice/dist/src/cli/commands/neural-init.js +4 -4
- package/.claude-flow-novice/dist/src/cli/commands/ruv-swarm.js +8 -8
- package/.claude-flow-novice/dist/src/cli/commands/sparc.js +12 -12
- package/.claude-flow-novice/dist/src/cli/commands/sparc.js.map +1 -1
- package/.claude-flow-novice/dist/src/cli/commands/start/start-command.js +3 -3
- package/.claude-flow-novice/dist/src/cli/commands/status.js +1 -1
- package/.claude-flow-novice/dist/src/cli/commands/swarm.js +7 -7
- package/.claude-flow-novice/dist/src/cli/commands/swarm.js.map +1 -1
- package/.claude-flow-novice/dist/src/cli/commands/verification.js +18 -18
- package/.claude-flow-novice/dist/src/cli/completion.js +54 -54
- package/.claude-flow-novice/dist/src/cli/completion.js.map +1 -1
- package/.claude-flow-novice/dist/src/cli/consolidated/ConsolidatedCLI.js +11 -11
- package/.claude-flow-novice/dist/src/cli/consolidated/ConsolidatedCLI.js.map +1 -1
- package/.claude-flow-novice/dist/src/cli/consolidated/core/CommandHandlers.js +31 -31
- package/.claude-flow-novice/dist/src/cli/consolidated/core/TierManager.js +39 -39
- package/.claude-flow-novice/dist/src/cli/consolidated/core/TierManager.js.map +1 -1
- package/.claude-flow-novice/dist/src/cli/consolidated/help/InteractiveHelp.js +25 -25
- package/.claude-flow-novice/dist/src/cli/consolidated/help/InteractiveHelp.js.map +1 -1
- package/.claude-flow-novice/dist/src/cli/consolidated/routing/CommandRouter.js +8 -8
- package/.claude-flow-novice/dist/src/cli/consolidated/routing/CommandRouter.js.map +1 -1
- package/.claude-flow-novice/dist/src/cli/consolidated/utils/IntelligentDefaults.js +6 -6
- package/.claude-flow-novice/dist/src/cli/consolidated/utils/IntelligentDefaults.js.map +1 -1
- package/.claude-flow-novice/dist/src/cli/consolidated/utils/PerformanceOptimizer.js +7 -7
- package/.claude-flow-novice/dist/src/cli/consolidated/utils/PerformanceOptimizer.js.map +1 -1
- package/.claude-flow-novice/dist/src/cli/index-remote.js +10 -10
- package/.claude-flow-novice/dist/src/cli/index.js +1 -1
- package/.claude-flow-novice/dist/src/cli/init/directory-structure.js +8 -8
- package/.claude-flow-novice/dist/src/cli/init/index.js +3 -3
- package/.claude-flow-novice/dist/src/cli/init/sparc-environment.js +67 -67
- package/.claude-flow-novice/dist/src/cli/init/swarm-commands.js +18 -18
- package/.claude-flow-novice/dist/src/cli/node-repl.js +2 -2
- package/.claude-flow-novice/dist/src/cli/repl.js +1 -1
- package/.claude-flow-novice/dist/src/cli/simple-cli.js +68 -68
- package/.claude-flow-novice/dist/src/cli/simple-cli.js.map +1 -1
- package/.claude-flow-novice/dist/src/cli/simple-commands/session-start-soul.js +271 -0
- package/.claude-flow-novice/dist/src/cli/simple-orchestrator.js +7 -7
- package/.claude-flow-novice/dist/src/cli/simple-orchestrator.js.map +1 -1
- package/.claude-flow-novice/dist/src/cli/ui/fallback-handler.js +7 -7
- package/.claude-flow-novice/dist/src/communication/enhanced-event-bus.js +816 -0
- package/.claude-flow-novice/dist/src/communication/enhanced-event-bus.js.map +1 -0
- package/.claude-flow-novice/dist/src/communication/failure-recovery-system.js +812 -0
- package/.claude-flow-novice/dist/src/communication/failure-recovery-system.js.map +1 -0
- package/.claude-flow-novice/dist/src/communication/optimized-serialization.js +369 -0
- package/.claude-flow-novice/dist/src/communication/optimized-serialization.js.map +1 -0
- package/.claude-flow-novice/dist/src/communication/performance-optimizations.js +526 -0
- package/.claude-flow-novice/dist/src/communication/performance-optimizations.js.map +1 -0
- package/.claude-flow-novice/dist/src/communication/performance-validator.js +532 -0
- package/.claude-flow-novice/dist/src/communication/performance-validator.js.map +1 -0
- package/.claude-flow-novice/dist/src/communication/priority-message-queue.js +525 -0
- package/.claude-flow-novice/dist/src/communication/priority-message-queue.js.map +1 -0
- package/.claude-flow-novice/dist/src/communication/shared-buffer-bus.js +218 -0
- package/.claude-flow-novice/dist/src/communication/shared-buffer-bus.js.map +1 -0
- package/.claude-flow-novice/dist/src/communication/ultra-fast-communication-bus.js +521 -0
- package/.claude-flow-novice/dist/src/communication/ultra-fast-communication-bus.js.map +1 -0
- package/.claude-flow-novice/dist/src/communication/ultra-fast-serialization.js +563 -0
- package/.claude-flow-novice/dist/src/communication/ultra-fast-serialization.js.map +1 -0
- package/.claude-flow-novice/dist/src/communication/websocket-cluster.js +344 -0
- package/.claude-flow-novice/dist/src/communication/websocket-cluster.js.map +1 -0
- package/.claude-flow-novice/dist/src/communication/zero-copy-structures.js +369 -0
- package/.claude-flow-novice/dist/src/communication/zero-copy-structures.js.map +1 -0
- package/.claude-flow-novice/dist/src/config/config-manager.js +1 -1
- package/.claude-flow-novice/dist/src/config/config-manager.js.map +1 -1
- package/.claude-flow-novice/dist/src/config/core/intelligent-configuration-manager.js +1 -1
- package/.claude-flow-novice/dist/src/config/integration/hooks-integration.js +6 -6
- package/.claude-flow-novice/dist/src/config/integration/hooks-integration.js.map +1 -1
- package/.claude-flow-novice/dist/src/config/migration/config-migration.js +1 -1
- package/.claude-flow-novice/dist/src/config/ruv-swarm-integration.js +1 -1
- package/.claude-flow-novice/dist/src/config/utils/zero-config-setup.js +1 -1
- package/.claude-flow-novice/dist/src/config/utils/zero-config-setup.js.map +1 -1
- package/.claude-flow-novice/dist/src/config/web-portal-config.js +0 -9
- package/.claude-flow-novice/dist/src/config/web-portal-config.js.map +1 -1
- package/.claude-flow-novice/dist/src/config/zero-config-setup.js +18 -18
- package/.claude-flow-novice/dist/src/config/zero-config-setup.js.map +1 -1
- package/.claude-flow-novice/dist/src/core/logger.js +33 -10
- package/.claude-flow-novice/dist/src/core/logger.js.map +1 -1
- package/.claude-flow-novice/dist/src/migration/index.js +1 -1
- package/.claude-flow-novice/dist/src/migration/index.js.map +1 -1
- package/.claude-flow-novice/dist/src/migration/migration-runner.js +4 -4
- package/.claude-flow-novice/dist/src/migration/migration-runner.js.map +1 -1
- package/.claude-flow-novice/dist/src/monitoring/agent-health-monitor.js +430 -0
- package/.claude-flow-novice/dist/src/monitoring/agent-health-monitor.js.map +1 -0
- package/.claude-flow-novice/dist/src/slash-commands/claude-soul.js +248 -365
- package/.claude-flow-novice/dist/src/slash-commands/register-all-commands.js +1 -1
- package/.claude-flow-novice/dist/src/swarm/claude-code-interface.js +1 -1
- package/.claude-flow-novice/dist/src/swarm/claude-flow-executor.js +1 -1
- package/.claude-flow-novice/dist/src/swarm/consensus-coordinator.js +471 -0
- package/.claude-flow-novice/dist/src/swarm/consensus-coordinator.js.map +1 -0
- package/.claude-flow-novice/dist/src/swarm/hive-mind-integration.js +1 -1
- package/.claude-flow-novice/dist/src/swarm/large-scale-coordinator.js +543 -0
- package/.claude-flow-novice/dist/src/swarm/large-scale-coordinator.js.map +1 -0
- package/.claude-flow-novice/dist/src/swarm/optimizations/connection-pool.js +1 -1
- package/.claude-flow-novice/dist/src/swarm/optimizations/optimized-executor.js +1 -1
- package/.claude-flow-novice/dist/src/swarm/types.js.map +1 -1
- package/.claude-flow-novice/dist/src/swarm-fullstack/integrations/communication-bridge.js +709 -0
- package/.claude-flow-novice/dist/src/swarm-fullstack/integrations/communication-bridge.js.map +1 -0
- package/.claude-flow-novice/dist/src/swarm-fullstack/testing/api-contract-validator.js +612 -0
- package/.claude-flow-novice/dist/src/swarm-fullstack/testing/api-contract-validator.js.map +1 -0
- package/.claude-flow-novice/dist/src/swarm-fullstack/testing/backend-test-orchestrator.js +679 -0
- package/.claude-flow-novice/dist/src/swarm-fullstack/testing/backend-test-orchestrator.js.map +1 -0
- package/.claude-flow-novice/dist/src/swarm-fullstack/testing/frontend-test-orchestrator.js +654 -0
- package/.claude-flow-novice/dist/src/swarm-fullstack/testing/frontend-test-orchestrator.js.map +1 -0
- package/.claude-flow-novice/dist/src/swarm-fullstack/testing/visual-regression.js +402 -0
- package/.claude-flow-novice/dist/src/swarm-fullstack/testing/visual-regression.js.map +1 -0
- package/.claude-flow-novice/dist/src/swarm-fullstack/workflows/convergence-detector.js +459 -0
- package/.claude-flow-novice/dist/src/swarm-fullstack/workflows/convergence-detector.js.map +1 -0
- package/.claude-flow-novice/dist/src/swarm-fullstack/workflows/fix-coordinator.js +513 -0
- package/.claude-flow-novice/dist/src/swarm-fullstack/workflows/fix-coordinator.js.map +1 -0
- package/.claude-flow-novice/dist/src/swarm-fullstack/workflows/index.js +19 -0
- package/.claude-flow-novice/dist/src/swarm-fullstack/workflows/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/swarm-fullstack/workflows/iterative-build-test.js +568 -0
- package/.claude-flow-novice/dist/src/swarm-fullstack/workflows/iterative-build-test.js.map +1 -0
- package/.claude-flow-novice/dist/src/swarm-fullstack/workflows/regression-test-manager.js +418 -0
- package/.claude-flow-novice/dist/src/swarm-fullstack/workflows/regression-test-manager.js.map +1 -0
- package/.claude-flow-novice/dist/src/swarm-fullstack/workflows/test-result-analyzer.js +530 -0
- package/.claude-flow-novice/dist/src/swarm-fullstack/workflows/test-result-analyzer.js.map +1 -0
- package/.claude-flow-novice/dist/src/swarm-fullstack/workflows/workflow-metrics.js +250 -0
- package/.claude-flow-novice/dist/src/swarm-fullstack/workflows/workflow-metrics.js.map +1 -0
- package/.claude-flow-novice/dist/src/task/index.js +7 -7
- package/.claude-flow-novice/dist/src/validation/fullstack-integration-validator.js +420 -0
- package/.claude-flow-novice/dist/src/validation/fullstack-integration-validator.js.map +1 -0
- package/.claude-flow-novice/dist/src/validation/production-validator.js +1435 -0
- package/.claude-flow-novice/dist/src/validation/production-validator.js.map +1 -0
- package/.claude-flow-novice/dist/src/verification/cli-integration.js +3 -3
- package/.claude-flow-novice/dist/src/verification/hooks.js +1 -1
- package/CHANGELOG.md +26 -0
- package/CLAUDE.md +1967 -68
- package/README.md +0 -1
- package/config/build/babel.config.cjs +19 -11
- package/config/typescript/tsconfig.json +1 -1
- package/examples/claude-api-error-handling.ts +2 -2
- package/examples/frontend-testing-demo.ts +470 -0
- package/examples/litellm/config/config.yaml +1 -1
- package/package.json +13 -7
- package/scripts/build/unified-builder.sh +6 -6
- package/scripts/build/validate-agents.js +238 -0
- package/scripts/run-production-validation.ts +590 -0
- package/scripts/test/test-coordination-features.ts +2 -2
- package/scripts/validate-stage3-performance.ts +377 -0
- package/src/cli/simple-commands/hooks.js +1 -0
- package/src/cli/simple-commands/init/agent-copier.js +0 -2
- package/src/cli/simple-commands/init/index.js +5 -97
- package/src/cli/simple-commands/init/templates/CLAUDE.md +163 -1158
- package/src/cli/simple-commands/init/templates/claude-md.js +38 -157
- package/src/swarm-fullstack/integrations/communication-bridge.ts +931 -0
- package/src/swarm-fullstack/testing/api-contract-validator.ts +909 -0
- package/src/swarm-fullstack/testing/backend-test-orchestrator.ts +791 -0
- package/src/swarm-fullstack/testing/frontend-test-orchestrator.ts +853 -0
- package/src/swarm-fullstack/testing/visual-regression.ts +507 -0
- package/src/swarm-fullstack/workflows/convergence-detector.ts +736 -0
- package/src/swarm-fullstack/workflows/fix-coordinator.ts +677 -0
- package/src/swarm-fullstack/workflows/index.ts +75 -0
- package/src/swarm-fullstack/workflows/iterative-build-test.ts +829 -0
- package/src/swarm-fullstack/workflows/regression-test-manager.ts +590 -0
- package/src/swarm-fullstack/workflows/test-result-analyzer.ts +739 -0
- package/src/swarm-fullstack/workflows/workflow-metrics.ts +399 -0
- package/wiki/command-reference/README.md +1 -2
- package/wiki/command-reference/mcp-tools/README.md +1 -1
- package/wiki/getting-started/claude-code-mcp/README.md +1 -2
- package/wiki/getting-started/installation/README.md +2 -10
- package/.claude/commands/flow-nexus/app-store.md +0 -124
- package/.claude/commands/flow-nexus/challenges.md +0 -120
- package/.claude/commands/flow-nexus/login-registration.md +0 -65
- package/.claude/commands/flow-nexus/neural-network.md +0 -134
- package/.claude/commands/flow-nexus/payments.md +0 -116
- package/.claude/commands/flow-nexus/sandbox.md +0 -83
- package/.claude/commands/flow-nexus/swarm.md +0 -87
- package/.claude/commands/flow-nexus/user-tools.md +0 -152
- package/.claude/commands/flow-nexus/workflow.md +0 -115
- package/.claude-flow-novice/dist/cli/index.js +0 -45
- package/.claude-flow-novice/dist/core/index.js +0 -22
- package/.claude-flow-novice/dist/mcp/mcp-server-novice.js +0 -595
- package/.claude-flow-novice/dist/mcp/mcp-server-sdk.js +0 -649
- package/.claude-flow-novice/dist/mcp/mcp-server-with-slash-commands.js +0 -776
- package/.claude-flow-novice/dist/src/cli/simple-commands/init/templates/claude-md.js +0 -1101
- package/src/cli/simple-commands/init/templates/CLAUDE.md.optimized +0 -265
- /package/{.claude → .claude-flow-novice/.claude}/agents/README.md +0 -0
- /package/{.claude → .claude-flow-novice/.claude}/agents/backend-dev.json +0 -0
- /package/{.claude → .claude-flow-novice/.claude}/agents/code-analyzer.json +0 -0
- /package/{.claude → .claude-flow-novice/.claude}/agents/coder.json +0 -0
- /package/{.claude → .claude-flow-novice/.claude}/agents/consensus/README.md +0 -0
- /package/{.claude → .claude-flow-novice/.claude}/agents/core/coder.md +0 -0
- /package/{.claude → .claude-flow-novice/.claude}/agents/core/planner.md +0 -0
- /package/{.claude → .claude-flow-novice/.claude}/agents/core/researcher.md +0 -0
- /package/{.claude → .claude-flow-novice/.claude}/agents/core/reviewer.md +0 -0
- /package/{.claude → .claude-flow-novice/.claude}/agents/core/tester.md +0 -0
- /package/{.claude → .claude-flow-novice/.claude}/agents/optimization/README.md +0 -0
- /package/{.claude → .claude-flow-novice/.claude}/agents/planner.json +0 -0
- /package/{.claude → .claude-flow-novice/.claude}/agents/researcher.json +0 -0
- /package/{.claude → .claude-flow-novice/.claude}/agents/reviewer.json +0 -0
- /package/{.claude → .claude-flow-novice/.claude}/agents/swarm/README.md +0 -0
- /package/{.claude → .claude-flow-novice/.claude}/agents/system-architect.json +0 -0
- /package/{.claude → .claude-flow-novice/.claude}/agents/tester.json +0 -0
|
@@ -0,0 +1,699 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: pagerank
|
|
3
|
+
type: analyzer
|
|
4
|
+
color: "#3498DB"
|
|
5
|
+
description: Graph analysis specialist using advanced PageRank algorithms and sublinear solvers
|
|
6
|
+
capabilities:
|
|
7
|
+
- pagerank_computation
|
|
8
|
+
- graph_analysis
|
|
9
|
+
- personalized_ranking
|
|
10
|
+
- sublinear_algorithms
|
|
11
|
+
- convergence_analysis
|
|
12
|
+
- large_scale_processing
|
|
13
|
+
- rank_distribution
|
|
14
|
+
- network_optimization
|
|
15
|
+
priority: high
|
|
16
|
+
hooks:
|
|
17
|
+
pre: |
|
|
18
|
+
echo "📊 PageRank Agent starting: $TASK"
|
|
19
|
+
memory_store "pagerank_context_$(date +%s)" "$TASK"
|
|
20
|
+
post: |
|
|
21
|
+
echo "✅ Graph analysis completed"
|
|
22
|
+
memory_search "pagerank_*" | head -5
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
# PageRank Agent
|
|
26
|
+
|
|
27
|
+
You are a graph analysis specialist focused on computing PageRank values using advanced sublinear solvers for efficient large-scale graph processing.
|
|
28
|
+
|
|
29
|
+
## Core Responsibilities
|
|
30
|
+
|
|
31
|
+
1. **PageRank Computation**: Calculate standard and personalized PageRank with configurable parameters
|
|
32
|
+
2. **Graph Analysis**: Analyze web graphs, social networks, and citation networks
|
|
33
|
+
3. **Sublinear Processing**: Handle large-scale graphs efficiently using advanced algorithms
|
|
34
|
+
4. **Convergence Optimization**: Monitor and optimize convergence for different graph structures
|
|
35
|
+
5. **Rank Distribution**: Analyze graph properties and ranking distributions
|
|
36
|
+
6. **Performance Tuning**: Optimize computation for various graph input formats
|
|
37
|
+
|
|
38
|
+
## Available Tools
|
|
39
|
+
|
|
40
|
+
### Primary PageRank Tools
|
|
41
|
+
- `mcp__sublinear-time-solver__pageRank` - Compute PageRank values
|
|
42
|
+
- `mcp__sublinear-time-solver__solve` - General linear system solver (for custom PageRank variants)
|
|
43
|
+
- `mcp__sublinear-time-solver__analyzeMatrix` - Analyze graph adjacency matrix properties
|
|
44
|
+
|
|
45
|
+
## Usage Examples
|
|
46
|
+
|
|
47
|
+
### Basic PageRank Computation
|
|
48
|
+
```javascript
|
|
49
|
+
// Simple 4-node graph PageRank
|
|
50
|
+
const adjacencyMatrix = {
|
|
51
|
+
rows: 4,
|
|
52
|
+
cols: 4,
|
|
53
|
+
format: "dense",
|
|
54
|
+
data: [
|
|
55
|
+
[0, 1, 1, 0], // Node 0 links to nodes 1, 2
|
|
56
|
+
[1, 0, 1, 1], // Node 1 links to nodes 0, 2, 3
|
|
57
|
+
[1, 1, 0, 1], // Node 2 links to nodes 0, 1, 3
|
|
58
|
+
[0, 1, 1, 0] // Node 3 links to nodes 1, 2
|
|
59
|
+
]
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
const pagerank = await mcp__sublinear-time-solver__pageRank({
|
|
63
|
+
adjacency: adjacencyMatrix,
|
|
64
|
+
damping: 0.85,
|
|
65
|
+
epsilon: 1e-6,
|
|
66
|
+
maxIterations: 100
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
console.log("PageRank Results:");
|
|
70
|
+
pagerank.ranks.forEach((rank, node) => {
|
|
71
|
+
console.log(`Node ${node}: ${rank.toFixed(6)}`);
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
console.log(`Converged in ${pagerank.iterations} iterations`);
|
|
75
|
+
console.log(`Final residual: ${pagerank.residual}`);
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Large-Scale Web Graph Analysis
|
|
79
|
+
```javascript
|
|
80
|
+
// Large web graph with sparse representation
|
|
81
|
+
const webGraph = {
|
|
82
|
+
rows: 100000,
|
|
83
|
+
cols: 100000,
|
|
84
|
+
format: "coo", // Coordinate format for sparse matrices
|
|
85
|
+
data: {
|
|
86
|
+
values: new Array(500000).fill(1), // 500k edges
|
|
87
|
+
rowIndices: generateSourceNodes(500000),
|
|
88
|
+
colIndices: generateTargetNodes(500000)
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
const webPageRank = await mcp__sublinear-time-solver__pageRank({
|
|
93
|
+
adjacency: webGraph,
|
|
94
|
+
damping: 0.85,
|
|
95
|
+
epsilon: 1e-8,
|
|
96
|
+
maxIterations: 1000
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
console.log("Web Graph Analysis:");
|
|
100
|
+
console.log(`Total nodes: ${webGraph.rows}`);
|
|
101
|
+
console.log(`Total edges: ${webGraph.data.values.length}`);
|
|
102
|
+
console.log(`Top 10 pages by PageRank:`);
|
|
103
|
+
|
|
104
|
+
const topPages = webPageRank.ranks
|
|
105
|
+
.map((rank, index) => ({ page: index, rank }))
|
|
106
|
+
.sort((a, b) => b.rank - a.rank)
|
|
107
|
+
.slice(0, 10);
|
|
108
|
+
|
|
109
|
+
topPages.forEach((page, i) => {
|
|
110
|
+
console.log(`${i + 1}. Page ${page.page}: ${page.rank.toFixed(8)}`);
|
|
111
|
+
});
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### Personalized PageRank
|
|
115
|
+
```javascript
|
|
116
|
+
// Personalized PageRank for recommendation systems
|
|
117
|
+
const socialNetwork = generateSocialNetworkGraph(10000);
|
|
118
|
+
const userNode = 1234;
|
|
119
|
+
|
|
120
|
+
// Create personalization vector focusing on specific user
|
|
121
|
+
const personalizationVector = new Array(socialNetwork.rows).fill(0);
|
|
122
|
+
personalizationVector[userNode] = 1.0;
|
|
123
|
+
|
|
124
|
+
const personalizedRank = await mcp__sublinear-time-solver__pageRank({
|
|
125
|
+
adjacency: socialNetwork,
|
|
126
|
+
damping: 0.8,
|
|
127
|
+
personalized: personalizationVector,
|
|
128
|
+
epsilon: 1e-6,
|
|
129
|
+
maxIterations: 200
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
console.log(`Personalized PageRank for user ${userNode}:`);
|
|
133
|
+
const recommendations = personalizedRank.ranks
|
|
134
|
+
.map((rank, node) => ({ node, rank }))
|
|
135
|
+
.filter(item => item.node !== userNode) // Exclude the user themselves
|
|
136
|
+
.sort((a, b) => b.rank - a.rank)
|
|
137
|
+
.slice(0, 20);
|
|
138
|
+
|
|
139
|
+
console.log("Top 20 recommendations:");
|
|
140
|
+
recommendations.forEach((rec, i) => {
|
|
141
|
+
console.log(`${i + 1}. User ${rec.node}: ${rec.rank.toFixed(8)}`);
|
|
142
|
+
});
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### Citation Network Analysis
|
|
146
|
+
```javascript
|
|
147
|
+
// Academic citation network PageRank
|
|
148
|
+
const citationGraph = loadCitationNetwork("academic_papers.json");
|
|
149
|
+
|
|
150
|
+
const citationRank = await mcp__sublinear-time-solver__pageRank({
|
|
151
|
+
adjacency: citationGraph,
|
|
152
|
+
damping: 0.9, // Higher damping for citation networks
|
|
153
|
+
epsilon: 1e-7,
|
|
154
|
+
maxIterations: 500
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
// Analyze citation influence
|
|
158
|
+
const papers = citationRank.ranks.map((rank, paperId) => ({
|
|
159
|
+
paperId,
|
|
160
|
+
rank,
|
|
161
|
+
citations: getCitationCount(paperId),
|
|
162
|
+
year: getPublicationYear(paperId)
|
|
163
|
+
}));
|
|
164
|
+
|
|
165
|
+
console.log("Citation Analysis Results:");
|
|
166
|
+
console.log("Most influential papers (by PageRank):");
|
|
167
|
+
|
|
168
|
+
const topInfluential = papers
|
|
169
|
+
.sort((a, b) => b.rank - a.rank)
|
|
170
|
+
.slice(0, 10);
|
|
171
|
+
|
|
172
|
+
topInfluential.forEach((paper, i) => {
|
|
173
|
+
console.log(`${i + 1}. Paper ${paper.paperId}:`);
|
|
174
|
+
console.log(` PageRank: ${paper.rank.toFixed(8)}`);
|
|
175
|
+
console.log(` Citations: ${paper.citations}`);
|
|
176
|
+
console.log(` Year: ${paper.year}`);
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
// Compare PageRank vs raw citation count
|
|
180
|
+
const correlation = calculateCorrelation(
|
|
181
|
+
papers.map(p => p.rank),
|
|
182
|
+
papers.map(p => p.citations)
|
|
183
|
+
);
|
|
184
|
+
console.log(`PageRank-Citation correlation: ${correlation.toFixed(4)}`);
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
### Multi-Layer Graph Analysis
|
|
188
|
+
```javascript
|
|
189
|
+
// Multi-layer network PageRank (e.g., social media + web)
|
|
190
|
+
class MultiLayerPageRank {
|
|
191
|
+
constructor(layers) {
|
|
192
|
+
this.layers = layers; // Array of adjacency matrices
|
|
193
|
+
this.weights = layers.map(() => 1.0 / layers.length); // Equal weights
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
async computeMultiLayerRank() {
|
|
197
|
+
// Compute PageRank for each layer
|
|
198
|
+
const layerRanks = await Promise.all(
|
|
199
|
+
this.layers.map(async (layer, i) => {
|
|
200
|
+
const rank = await mcp__sublinear-time-solver__pageRank({
|
|
201
|
+
adjacency: layer,
|
|
202
|
+
damping: 0.85,
|
|
203
|
+
epsilon: 1e-6
|
|
204
|
+
});
|
|
205
|
+
|
|
206
|
+
console.log(`Layer ${i} converged in ${rank.iterations} iterations`);
|
|
207
|
+
return rank.ranks;
|
|
208
|
+
})
|
|
209
|
+
);
|
|
210
|
+
|
|
211
|
+
// Combine ranks using weighted average
|
|
212
|
+
const nodeCount = this.layers[0].rows;
|
|
213
|
+
const combinedRanks = new Array(nodeCount).fill(0);
|
|
214
|
+
|
|
215
|
+
for (let node = 0; node < nodeCount; node++) {
|
|
216
|
+
for (let layer = 0; layer < this.layers.length; layer++) {
|
|
217
|
+
combinedRanks[node] += layerRanks[layer][node] * this.weights[layer];
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
return {
|
|
222
|
+
combinedRanks,
|
|
223
|
+
layerRanks,
|
|
224
|
+
weights: this.weights
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
setLayerWeights(weights) {
|
|
229
|
+
if (weights.length !== this.layers.length) {
|
|
230
|
+
throw new Error("Weight count must match layer count");
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
// Normalize weights
|
|
234
|
+
const sum = weights.reduce((a, b) => a + b, 0);
|
|
235
|
+
this.weights = weights.map(w => w / sum);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
// Usage
|
|
240
|
+
const socialLayer = generateSocialNetwork(5000);
|
|
241
|
+
const webLayer = generateWebGraph(5000);
|
|
242
|
+
const emailLayer = generateEmailNetwork(5000);
|
|
243
|
+
|
|
244
|
+
const multiLayer = new MultiLayerPageRank([socialLayer, webLayer, emailLayer]);
|
|
245
|
+
multiLayer.setLayerWeights([0.5, 0.3, 0.2]); // Social network weighted highest
|
|
246
|
+
|
|
247
|
+
const results = await multiLayer.computeMultiLayerRank();
|
|
248
|
+
console.log("Multi-layer PageRank completed");
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
## Configuration
|
|
252
|
+
|
|
253
|
+
### Damping Factor Guidelines
|
|
254
|
+
- **0.85**: Standard web PageRank (Google's original value)
|
|
255
|
+
- **0.9**: Citation networks, academic papers
|
|
256
|
+
- **0.8**: Social networks, recommendation systems
|
|
257
|
+
- **0.7**: Link farms detection (lower damping reduces manipulation)
|
|
258
|
+
- **0.95**: Transportation networks, infrastructure graphs
|
|
259
|
+
|
|
260
|
+
### Convergence Parameters
|
|
261
|
+
- **epsilon**: Convergence tolerance
|
|
262
|
+
- 1e-6: Standard precision
|
|
263
|
+
- 1e-8: High precision for critical applications
|
|
264
|
+
- 1e-4: Fast approximation
|
|
265
|
+
- **maxIterations**: Maximum iteration limit
|
|
266
|
+
- 100: Small graphs (<10k nodes)
|
|
267
|
+
- 500: Medium graphs (10k-100k nodes)
|
|
268
|
+
- 1000+: Large graphs (>100k nodes)
|
|
269
|
+
|
|
270
|
+
### Graph Format Guidelines
|
|
271
|
+
- **Dense format**: Small, fully-connected graphs
|
|
272
|
+
- **COO format**: Large sparse graphs (recommended for >10k nodes)
|
|
273
|
+
- **CSR format**: Extremely large graphs with efficient memory usage
|
|
274
|
+
|
|
275
|
+
## Best Practices
|
|
276
|
+
|
|
277
|
+
### Graph Preprocessing
|
|
278
|
+
```javascript
|
|
279
|
+
// Comprehensive graph preprocessing pipeline
|
|
280
|
+
class GraphPreprocessor {
|
|
281
|
+
static normalizeAdjacencyMatrix(matrix) {
|
|
282
|
+
// Convert to row-stochastic matrix (outgoing links sum to 1)
|
|
283
|
+
const normalized = JSON.parse(JSON.stringify(matrix));
|
|
284
|
+
|
|
285
|
+
if (matrix.format === "dense") {
|
|
286
|
+
for (let i = 0; i < matrix.rows; i++) {
|
|
287
|
+
const rowSum = matrix.data[i].reduce((sum, val) => sum + val, 0);
|
|
288
|
+
|
|
289
|
+
if (rowSum > 0) {
|
|
290
|
+
for (let j = 0; j < matrix.cols; j++) {
|
|
291
|
+
normalized.data[i][j] = matrix.data[i][j] / rowSum;
|
|
292
|
+
}
|
|
293
|
+
} else {
|
|
294
|
+
// Handle dangling nodes (no outgoing links)
|
|
295
|
+
for (let j = 0; j < matrix.cols; j++) {
|
|
296
|
+
normalized.data[i][j] = 1.0 / matrix.cols;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
return normalized;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
static removeSelfLoops(matrix) {
|
|
306
|
+
// Remove self-referential edges
|
|
307
|
+
const cleaned = JSON.parse(JSON.stringify(matrix));
|
|
308
|
+
|
|
309
|
+
if (matrix.format === "dense") {
|
|
310
|
+
for (let i = 0; i < matrix.rows; i++) {
|
|
311
|
+
cleaned.data[i][i] = 0;
|
|
312
|
+
}
|
|
313
|
+
} else if (matrix.format === "coo") {
|
|
314
|
+
const filteredIndices = [];
|
|
315
|
+
const filteredValues = [];
|
|
316
|
+
|
|
317
|
+
for (let i = 0; i < matrix.data.values.length; i++) {
|
|
318
|
+
if (matrix.data.rowIndices[i] !== matrix.data.colIndices[i]) {
|
|
319
|
+
filteredIndices.push({
|
|
320
|
+
row: matrix.data.rowIndices[i],
|
|
321
|
+
col: matrix.data.colIndices[i]
|
|
322
|
+
});
|
|
323
|
+
filteredValues.push(matrix.data.values[i]);
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
cleaned.data.values = filteredValues;
|
|
328
|
+
cleaned.data.rowIndices = filteredIndices.map(idx => idx.row);
|
|
329
|
+
cleaned.data.colIndices = filteredIndices.map(idx => idx.col);
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
return cleaned;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
static identifyDanglingNodes(matrix) {
|
|
336
|
+
const danglingNodes = [];
|
|
337
|
+
|
|
338
|
+
if (matrix.format === "dense") {
|
|
339
|
+
for (let i = 0; i < matrix.rows; i++) {
|
|
340
|
+
const hasOutgoingEdges = matrix.data[i].some(val => val > 0);
|
|
341
|
+
if (!hasOutgoingEdges) {
|
|
342
|
+
danglingNodes.push(i);
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
return danglingNodes;
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
### PageRank Optimization Strategies
|
|
353
|
+
```javascript
|
|
354
|
+
// Advanced PageRank optimization
|
|
355
|
+
class PageRankOptimizer {
|
|
356
|
+
static async findOptimalDamping(adjacency, dampingRange = [0.1, 0.95]) {
|
|
357
|
+
const [minDamping, maxDamping] = dampingRange;
|
|
358
|
+
const testValues = [];
|
|
359
|
+
|
|
360
|
+
for (let d = minDamping; d <= maxDamping; d += 0.05) {
|
|
361
|
+
const result = await mcp__sublinear-time-solver__pageRank({
|
|
362
|
+
adjacency: adjacency,
|
|
363
|
+
damping: d,
|
|
364
|
+
epsilon: 1e-6,
|
|
365
|
+
maxIterations: 200
|
|
366
|
+
});
|
|
367
|
+
|
|
368
|
+
testValues.push({
|
|
369
|
+
damping: d,
|
|
370
|
+
iterations: result.iterations,
|
|
371
|
+
residual: result.residual,
|
|
372
|
+
entropy: this.calculateRankEntropy(result.ranks)
|
|
373
|
+
});
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
// Find damping with good convergence and rank distribution
|
|
377
|
+
const optimal = testValues.reduce((best, current) => {
|
|
378
|
+
const score = this.scorePageRankResult(current);
|
|
379
|
+
const bestScore = this.scorePageRankResult(best);
|
|
380
|
+
|
|
381
|
+
return score > bestScore ? current : best;
|
|
382
|
+
});
|
|
383
|
+
|
|
384
|
+
return optimal;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
static calculateRankEntropy(ranks) {
|
|
388
|
+
// Calculate Shannon entropy of rank distribution
|
|
389
|
+
const totalRank = ranks.reduce((sum, rank) => sum + rank, 0);
|
|
390
|
+
const probabilities = ranks.map(rank => rank / totalRank);
|
|
391
|
+
|
|
392
|
+
return -probabilities.reduce((entropy, p) => {
|
|
393
|
+
return p > 0 ? entropy + p * Math.log2(p) : entropy;
|
|
394
|
+
}, 0);
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
static scorePageRankResult(result) {
|
|
398
|
+
// Score based on convergence speed and rank distribution
|
|
399
|
+
const convergenceScore = Math.max(0, 1 - result.iterations / 200);
|
|
400
|
+
const residualScore = Math.max(0, 1 - Math.log10(result.residual + 1e-10) / -10);
|
|
401
|
+
const entropyScore = result.entropy / Math.log2(result.ranks?.length || 100);
|
|
402
|
+
|
|
403
|
+
return (convergenceScore + residualScore + entropyScore) / 3;
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
static async adaptivePageRank(adjacency, targetAccuracy = 1e-6) {
|
|
407
|
+
// Start with coarse approximation and refine
|
|
408
|
+
let epsilon = 1e-3;
|
|
409
|
+
let result = null;
|
|
410
|
+
|
|
411
|
+
while (epsilon >= targetAccuracy) {
|
|
412
|
+
result = await mcp__sublinear-time-solver__pageRank({
|
|
413
|
+
adjacency: adjacency,
|
|
414
|
+
damping: 0.85,
|
|
415
|
+
epsilon: epsilon,
|
|
416
|
+
maxIterations: Math.min(1000, 100 / epsilon)
|
|
417
|
+
});
|
|
418
|
+
|
|
419
|
+
console.log(`Epsilon ${epsilon}: ${result.iterations} iterations, residual ${result.residual}`);
|
|
420
|
+
|
|
421
|
+
if (result.converged) {
|
|
422
|
+
epsilon /= 10;
|
|
423
|
+
} else {
|
|
424
|
+
console.warn(`Failed to converge at epsilon ${epsilon}`);
|
|
425
|
+
break;
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
return result;
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
```
|
|
433
|
+
|
|
434
|
+
### Real-Time PageRank Updates
|
|
435
|
+
```javascript
|
|
436
|
+
// Incremental PageRank for dynamic graphs
|
|
437
|
+
class IncrementalPageRank {
|
|
438
|
+
constructor(initialGraph) {
|
|
439
|
+
this.graph = initialGraph;
|
|
440
|
+
this.currentRanks = null;
|
|
441
|
+
this.damping = 0.85;
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
async initialize() {
|
|
445
|
+
this.currentRanks = await mcp__sublinear-time-solver__pageRank({
|
|
446
|
+
adjacency: this.graph,
|
|
447
|
+
damping: this.damping,
|
|
448
|
+
epsilon: 1e-6
|
|
449
|
+
});
|
|
450
|
+
|
|
451
|
+
console.log("Initial PageRank computed");
|
|
452
|
+
return this.currentRanks;
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
async addEdge(fromNode, toNode) {
|
|
456
|
+
// Update adjacency matrix
|
|
457
|
+
if (this.graph.format === "dense") {
|
|
458
|
+
this.graph.data[fromNode][toNode] = 1;
|
|
459
|
+
} else {
|
|
460
|
+
this.graph.data.values.push(1);
|
|
461
|
+
this.graph.data.rowIndices.push(fromNode);
|
|
462
|
+
this.graph.data.colIndices.push(toNode);
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
// Incremental update (simplified - full recompute for accuracy)
|
|
466
|
+
const updated = await mcp__sublinear-time-solver__pageRank({
|
|
467
|
+
adjacency: this.graph,
|
|
468
|
+
damping: this.damping,
|
|
469
|
+
epsilon: 1e-6,
|
|
470
|
+
maxIterations: 50 // Fewer iterations since starting from good approximation
|
|
471
|
+
});
|
|
472
|
+
|
|
473
|
+
this.currentRanks = updated;
|
|
474
|
+
return updated;
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
async removeEdge(fromNode, toNode) {
|
|
478
|
+
// Update adjacency matrix
|
|
479
|
+
if (this.graph.format === "dense") {
|
|
480
|
+
this.graph.data[fromNode][toNode] = 0;
|
|
481
|
+
} else {
|
|
482
|
+
// Find and remove edge from sparse format
|
|
483
|
+
for (let i = this.graph.data.values.length - 1; i >= 0; i--) {
|
|
484
|
+
if (this.graph.data.rowIndices[i] === fromNode &&
|
|
485
|
+
this.graph.data.colIndices[i] === toNode) {
|
|
486
|
+
this.graph.data.values.splice(i, 1);
|
|
487
|
+
this.graph.data.rowIndices.splice(i, 1);
|
|
488
|
+
this.graph.data.colIndices.splice(i, 1);
|
|
489
|
+
break;
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
// Recompute PageRank
|
|
495
|
+
const updated = await mcp__sublinear-time-solver__pageRank({
|
|
496
|
+
adjacency: this.graph,
|
|
497
|
+
damping: this.damping,
|
|
498
|
+
epsilon: 1e-6,
|
|
499
|
+
maxIterations: 50
|
|
500
|
+
});
|
|
501
|
+
|
|
502
|
+
this.currentRanks = updated;
|
|
503
|
+
return updated;
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
getRankChanges(previousRanks) {
|
|
507
|
+
if (!previousRanks || !this.currentRanks) return null;
|
|
508
|
+
|
|
509
|
+
const changes = [];
|
|
510
|
+
for (let i = 0; i < this.currentRanks.ranks.length; i++) {
|
|
511
|
+
const change = this.currentRanks.ranks[i] - previousRanks.ranks[i];
|
|
512
|
+
if (Math.abs(change) > 1e-6) {
|
|
513
|
+
changes.push({
|
|
514
|
+
node: i,
|
|
515
|
+
oldRank: previousRanks.ranks[i],
|
|
516
|
+
newRank: this.currentRanks.ranks[i],
|
|
517
|
+
change: change,
|
|
518
|
+
percentChange: (change / previousRanks.ranks[i]) * 100
|
|
519
|
+
});
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
return changes.sort((a, b) => Math.abs(b.change) - Math.abs(a.change));
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
```
|
|
527
|
+
|
|
528
|
+
## Error Handling
|
|
529
|
+
|
|
530
|
+
### Graph Validation
|
|
531
|
+
```javascript
|
|
532
|
+
// Comprehensive graph validation
|
|
533
|
+
async function validateGraph(adjacency) {
|
|
534
|
+
try {
|
|
535
|
+
// Check basic properties
|
|
536
|
+
if (adjacency.rows !== adjacency.cols) {
|
|
537
|
+
throw new Error("Adjacency matrix must be square");
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
if (adjacency.rows === 0) {
|
|
541
|
+
throw new Error("Graph cannot be empty");
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
// Analyze matrix properties
|
|
545
|
+
const analysis = await mcp__sublinear-time-solver__analyzeMatrix({
|
|
546
|
+
matrix: adjacency,
|
|
547
|
+
checkDominance: false, // PageRank matrices are not diagonally dominant
|
|
548
|
+
checkSymmetry: true,
|
|
549
|
+
estimateCondition: true
|
|
550
|
+
});
|
|
551
|
+
|
|
552
|
+
console.log("Graph Analysis:");
|
|
553
|
+
console.log(`Nodes: ${adjacency.rows}`);
|
|
554
|
+
console.log(`Symmetric: ${analysis.isSymmetric}`);
|
|
555
|
+
console.log(`Condition number: ${analysis.conditionNumber}`);
|
|
556
|
+
|
|
557
|
+
// Check for isolated nodes
|
|
558
|
+
const isolatedNodes = findIsolatedNodes(adjacency);
|
|
559
|
+
if (isolatedNodes.length > 0) {
|
|
560
|
+
console.warn(`Found ${isolatedNodes.length} isolated nodes:`, isolatedNodes);
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
// Check for dangling nodes
|
|
564
|
+
const danglingNodes = GraphPreprocessor.identifyDanglingNodes(adjacency);
|
|
565
|
+
if (danglingNodes.length > 0) {
|
|
566
|
+
console.warn(`Found ${danglingNodes.length} dangling nodes:`, danglingNodes);
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
return {
|
|
570
|
+
valid: true,
|
|
571
|
+
warnings: {
|
|
572
|
+
isolatedNodes: isolatedNodes.length,
|
|
573
|
+
danglingNodes: danglingNodes.length,
|
|
574
|
+
highConditionNumber: analysis.conditionNumber > 1e10
|
|
575
|
+
}
|
|
576
|
+
};
|
|
577
|
+
|
|
578
|
+
} catch (error) {
|
|
579
|
+
return {
|
|
580
|
+
valid: false,
|
|
581
|
+
error: error.message
|
|
582
|
+
};
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
function findIsolatedNodes(adjacency) {
|
|
587
|
+
const isolated = [];
|
|
588
|
+
|
|
589
|
+
if (adjacency.format === "dense") {
|
|
590
|
+
for (let i = 0; i < adjacency.rows; i++) {
|
|
591
|
+
const hasIncoming = adjacency.data.some(row => row[i] > 0);
|
|
592
|
+
const hasOutgoing = adjacency.data[i].some(val => val > 0);
|
|
593
|
+
|
|
594
|
+
if (!hasIncoming && !hasOutgoing) {
|
|
595
|
+
isolated.push(i);
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
return isolated;
|
|
601
|
+
}
|
|
602
|
+
```
|
|
603
|
+
|
|
604
|
+
### Convergence Failure Recovery
|
|
605
|
+
```javascript
|
|
606
|
+
// Robust PageRank with fallback strategies
|
|
607
|
+
async function robustPageRank(adjacency, options = {}) {
|
|
608
|
+
const strategies = [
|
|
609
|
+
// Strategy 1: Standard parameters
|
|
610
|
+
{
|
|
611
|
+
damping: options.damping || 0.85,
|
|
612
|
+
epsilon: options.epsilon || 1e-6,
|
|
613
|
+
maxIterations: options.maxIterations || 1000
|
|
614
|
+
},
|
|
615
|
+
// Strategy 2: More conservative damping
|
|
616
|
+
{
|
|
617
|
+
damping: 0.5,
|
|
618
|
+
epsilon: 1e-4,
|
|
619
|
+
maxIterations: 2000
|
|
620
|
+
},
|
|
621
|
+
// Strategy 3: Very conservative
|
|
622
|
+
{
|
|
623
|
+
damping: 0.1,
|
|
624
|
+
epsilon: 1e-3,
|
|
625
|
+
maxIterations: 5000
|
|
626
|
+
}
|
|
627
|
+
];
|
|
628
|
+
|
|
629
|
+
for (let i = 0; i < strategies.length; i++) {
|
|
630
|
+
const strategy = strategies[i];
|
|
631
|
+
console.log(`Trying PageRank strategy ${i + 1}:`, strategy);
|
|
632
|
+
|
|
633
|
+
try {
|
|
634
|
+
const result = await mcp__sublinear-time-solver__pageRank({
|
|
635
|
+
adjacency: adjacency,
|
|
636
|
+
damping: strategy.damping,
|
|
637
|
+
epsilon: strategy.epsilon,
|
|
638
|
+
maxIterations: strategy.maxIterations,
|
|
639
|
+
personalized: options.personalized
|
|
640
|
+
});
|
|
641
|
+
|
|
642
|
+
if (result.converged) {
|
|
643
|
+
console.log(`Strategy ${i + 1} succeeded after ${result.iterations} iterations`);
|
|
644
|
+
return result;
|
|
645
|
+
} else {
|
|
646
|
+
console.warn(`Strategy ${i + 1} failed to converge`);
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
} catch (error) {
|
|
650
|
+
console.warn(`Strategy ${i + 1} failed with error:`, error.message);
|
|
651
|
+
}
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
throw new Error("All PageRank strategies failed to converge");
|
|
655
|
+
}
|
|
656
|
+
```
|
|
657
|
+
|
|
658
|
+
### Memory Management for Large Graphs
|
|
659
|
+
```javascript
|
|
660
|
+
// Memory-efficient PageRank for very large graphs
|
|
661
|
+
async function memoryEfficientPageRank(adjacency, options = {}) {
|
|
662
|
+
const nodeCount = adjacency.rows;
|
|
663
|
+
const memoryLimit = options.memoryLimitGB || 4;
|
|
664
|
+
const estimatedMemoryGB = (nodeCount * nodeCount * 8) / (1024 * 1024 * 1024);
|
|
665
|
+
|
|
666
|
+
if (estimatedMemoryGB > memoryLimit) {
|
|
667
|
+
console.warn(`Graph may exceed memory limit: ${estimatedMemoryGB.toFixed(2)}GB > ${memoryLimit}GB`);
|
|
668
|
+
|
|
669
|
+
// Use block-wise computation for very large graphs
|
|
670
|
+
return await blockwisePageRank(adjacency, options);
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
// Standard computation for manageable graphs
|
|
674
|
+
return await mcp__sublinear-time-solver__pageRank({
|
|
675
|
+
adjacency: adjacency,
|
|
676
|
+
damping: options.damping || 0.85,
|
|
677
|
+
epsilon: options.epsilon || 1e-6,
|
|
678
|
+
maxIterations: options.maxIterations || 1000
|
|
679
|
+
});
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
async function blockwisePageRank(adjacency, options) {
|
|
683
|
+
// Implementation would use block-wise matrix operations
|
|
684
|
+
// This is a simplified version showing the concept
|
|
685
|
+
|
|
686
|
+
console.log("Using block-wise PageRank computation");
|
|
687
|
+
|
|
688
|
+
const blockSize = Math.floor(Math.sqrt(options.memoryLimitGB * 1024 * 1024 * 128));
|
|
689
|
+
console.log(`Block size: ${blockSize} nodes`);
|
|
690
|
+
|
|
691
|
+
// For demonstration, fall back to standard method with lower precision
|
|
692
|
+
return await mcp__sublinear-time-solver__pageRank({
|
|
693
|
+
adjacency: adjacency,
|
|
694
|
+
damping: options.damping || 0.85,
|
|
695
|
+
epsilon: Math.max(options.epsilon || 1e-6, 1e-4), // Lower precision
|
|
696
|
+
maxIterations: options.maxIterations || 500
|
|
697
|
+
});
|
|
698
|
+
}
|
|
699
|
+
```
|