agentic-qe 1.1.0 → 1.3.0
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/qe-coverage-analyzer.md +8 -0
- package/.claude/agents/qe-flaky-test-hunter.md +9 -1
- package/.claude/agents/qe-test-generator.md +7 -0
- package/.claude/agents/reasoning/agent.md +816 -0
- package/.claude/agents/reasoning/goal-planner.md +73 -0
- package/.claude/settings.json +64 -25
- package/.claude/skills/README.md +124 -0
- package/.claude/skills/accessibility-testing/SKILL.md +777 -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-quality-engineering/SKILL.md +604 -0
- package/.claude/skills/api-testing-patterns/SKILL.md +686 -0
- package/.claude/skills/bug-reporting-excellence/SKILL.md +632 -0
- package/.claude/skills/chaos-engineering-resilience/SKILL.md +109 -0
- package/.claude/skills/code-review-quality/SKILL.md +683 -0
- package/.claude/skills/compatibility-testing/SKILL.md +101 -0
- package/.claude/skills/compliance-testing/SKILL.md +162 -0
- package/.claude/skills/consultancy-practices/SKILL.md +540 -0
- package/.claude/skills/context-driven-testing/SKILL.md +466 -0
- package/.claude/skills/contract-testing/SKILL.md +193 -0
- package/.claude/skills/database-testing/SKILL.md +243 -0
- package/.claude/skills/exploratory-testing-advanced/SKILL.md +676 -0
- package/.claude/skills/flow-nexus-neural/SKILL.md +738 -0
- package/.claude/skills/flow-nexus-platform/SKILL.md +1157 -0
- package/.claude/skills/flow-nexus-swarm/SKILL.md +610 -0
- package/.claude/skills/github-code-review/SKILL.md +1140 -0
- package/.claude/skills/github-multi-repo/SKILL.md +874 -0
- package/.claude/skills/github-project-management/SKILL.md +1277 -0
- package/.claude/skills/github-release-management/SKILL.md +1081 -0
- package/.claude/skills/github-workflow-automation/SKILL.md +1065 -0
- package/.claude/skills/hive-mind-advanced/SKILL.md +712 -0
- package/.claude/skills/holistic-testing-pact/SKILL.md +225 -0
- package/.claude/skills/hooks-automation/SKILL.md +1201 -0
- package/.claude/skills/localization-testing/SKILL.md +115 -0
- package/.claude/skills/mobile-testing/SKILL.md +548 -0
- package/.claude/skills/mutation-testing/SKILL.md +129 -0
- package/.claude/skills/pair-programming/SKILL.md +1202 -0
- package/.claude/skills/performance-analysis/SKILL.md +563 -0
- package/.claude/skills/performance-testing/SKILL.md +662 -0
- package/.claude/skills/quality-metrics/SKILL.md +592 -0
- package/.claude/skills/reasoningbank-agentdb/SKILL.md +446 -0
- package/.claude/skills/reasoningbank-intelligence/SKILL.md +201 -0
- package/.claude/skills/refactoring-patterns/SKILL.md +778 -0
- package/.claude/skills/regression-testing/SKILL.md +1045 -0
- package/.claude/skills/risk-based-testing/SKILL.md +721 -0
- package/.claude/skills/security-testing/SKILL.md +651 -0
- package/.claude/skills/shift-left-testing/SKILL.md +535 -0
- package/.claude/skills/shift-right-testing/SKILL.md +591 -0
- package/.claude/skills/skill-builder/SKILL.md +910 -0
- package/.claude/skills/sparc-methodology/SKILL.md +1115 -0
- package/.claude/skills/stream-chain/SKILL.md +563 -0
- package/.claude/skills/swarm-advanced/SKILL.md +973 -0
- package/.claude/skills/swarm-orchestration/SKILL.md +179 -0
- package/.claude/skills/tdd-london-chicago/SKILL.md +567 -0
- package/.claude/skills/technical-writing/SKILL.md +235 -0
- package/.claude/skills/test-automation-strategy/SKILL.md +842 -0
- package/.claude/skills/test-data-management/SKILL.md +1067 -0
- package/.claude/skills/test-design-techniques/SKILL.md +160 -0
- package/.claude/skills/test-environment-management/SKILL.md +204 -0
- package/.claude/skills/test-reporting-analytics/SKILL.md +143 -0
- package/.claude/skills/verification-quality/SKILL.md +649 -0
- package/.claude/skills/visual-testing-advanced/SKILL.md +148 -0
- package/.claude/skills/xp-practices/SKILL.md +671 -0
- package/.claude/statusline-command.sh +176 -0
- package/CHANGELOG.md +623 -6
- package/README.md +101 -5
- package/config/improvement-loop.config.ts +323 -0
- package/config/neural-agent.config.ts +197 -0
- package/dist/adapters/MemoryStoreAdapter.d.ts +16 -16
- package/dist/adapters/MemoryStoreAdapter.d.ts.map +1 -1
- package/dist/adapters/MemoryStoreAdapter.js +16 -16
- package/dist/adapters/MemoryStoreAdapter.js.map +1 -1
- package/dist/agents/BaseAgent.d.ts +69 -0
- package/dist/agents/BaseAgent.d.ts.map +1 -1
- package/dist/agents/BaseAgent.js +387 -5
- package/dist/agents/BaseAgent.js.map +1 -1
- package/dist/agents/CoverageAnalyzerAgent.d.ts +13 -2
- package/dist/agents/CoverageAnalyzerAgent.d.ts.map +1 -1
- package/dist/agents/CoverageAnalyzerAgent.js +112 -12
- package/dist/agents/CoverageAnalyzerAgent.js.map +1 -1
- package/dist/agents/DeploymentReadinessAgent.d.ts.map +1 -1
- package/dist/agents/DeploymentReadinessAgent.js +13 -13
- package/dist/agents/DeploymentReadinessAgent.js.map +1 -1
- package/dist/agents/FlakyTestHunterAgent.d.ts +28 -0
- package/dist/agents/FlakyTestHunterAgent.d.ts.map +1 -1
- package/dist/agents/FlakyTestHunterAgent.js +160 -4
- package/dist/agents/FlakyTestHunterAgent.js.map +1 -1
- package/dist/agents/FleetCommanderAgent.d.ts.map +1 -1
- package/dist/agents/FleetCommanderAgent.js +4 -3
- package/dist/agents/FleetCommanderAgent.js.map +1 -1
- package/dist/agents/LearningAgent.d.ts +14 -5
- package/dist/agents/LearningAgent.d.ts.map +1 -1
- package/dist/agents/LearningAgent.js +36 -16
- package/dist/agents/LearningAgent.js.map +1 -1
- package/dist/agents/NeuralAgentExtension.d.ts +117 -0
- package/dist/agents/NeuralAgentExtension.d.ts.map +1 -0
- package/dist/agents/NeuralAgentExtension.js +288 -0
- package/dist/agents/NeuralAgentExtension.js.map +1 -0
- package/dist/agents/PerformanceTesterAgent.d.ts.map +1 -1
- package/dist/agents/PerformanceTesterAgent.js +11 -9
- package/dist/agents/PerformanceTesterAgent.js.map +1 -1
- package/dist/agents/ProductionIntelligenceAgent.d.ts.map +1 -1
- package/dist/agents/ProductionIntelligenceAgent.js +14 -13
- package/dist/agents/ProductionIntelligenceAgent.js.map +1 -1
- package/dist/agents/QualityAnalyzerAgent.d.ts.map +1 -1
- package/dist/agents/QualityAnalyzerAgent.js +39 -38
- package/dist/agents/QualityAnalyzerAgent.js.map +1 -1
- package/dist/agents/QualityGateAgent.d.ts.map +1 -1
- package/dist/agents/QualityGateAgent.js +7 -6
- package/dist/agents/QualityGateAgent.js.map +1 -1
- package/dist/agents/RegressionRiskAnalyzerAgent.d.ts.map +1 -1
- package/dist/agents/RegressionRiskAnalyzerAgent.js +22 -21
- package/dist/agents/RegressionRiskAnalyzerAgent.js.map +1 -1
- package/dist/agents/RequirementsValidatorAgent.d.ts.map +1 -1
- package/dist/agents/RequirementsValidatorAgent.js +1 -1
- package/dist/agents/RequirementsValidatorAgent.js.map +1 -1
- package/dist/agents/SecurityScannerAgent.d.ts.map +1 -1
- package/dist/agents/SecurityScannerAgent.js +8 -7
- package/dist/agents/SecurityScannerAgent.js.map +1 -1
- package/dist/agents/TestDataArchitectAgent.d.ts.map +1 -1
- package/dist/agents/TestDataArchitectAgent.js +12 -11
- package/dist/agents/TestDataArchitectAgent.js.map +1 -1
- package/dist/agents/TestExecutorAgent.d.ts.map +1 -1
- package/dist/agents/TestExecutorAgent.js +18 -19
- package/dist/agents/TestExecutorAgent.js.map +1 -1
- package/dist/agents/TestGeneratorAgent.d.ts +15 -4
- package/dist/agents/TestGeneratorAgent.d.ts.map +1 -1
- package/dist/agents/TestGeneratorAgent.js +172 -49
- package/dist/agents/TestGeneratorAgent.js.map +1 -1
- package/dist/agents/index.d.ts.map +1 -1
- package/dist/agents/index.js +2 -1
- package/dist/agents/index.js.map +1 -1
- package/dist/agents/mixins/NeuralCapableMixin.d.ts +130 -0
- package/dist/agents/mixins/NeuralCapableMixin.d.ts.map +1 -0
- package/dist/agents/mixins/NeuralCapableMixin.js +358 -0
- package/dist/agents/mixins/NeuralCapableMixin.js.map +1 -0
- package/dist/agents/mixins/QUICCapableMixin.d.ts +34 -0
- package/dist/agents/mixins/QUICCapableMixin.d.ts.map +1 -0
- package/dist/agents/mixins/QUICCapableMixin.js +346 -0
- package/dist/agents/mixins/QUICCapableMixin.js.map +1 -0
- package/dist/cli/commands/agent/benchmark.d.ts.map +1 -1
- package/dist/cli/commands/agent/benchmark.js +2 -1
- package/dist/cli/commands/agent/benchmark.js.map +1 -1
- package/dist/cli/commands/agent/index.d.ts +5 -0
- package/dist/cli/commands/agent/index.d.ts.map +1 -1
- package/dist/cli/commands/agent/index.js +11 -6
- package/dist/cli/commands/agent/index.js.map +1 -1
- package/dist/cli/commands/agent/kill.d.ts +13 -0
- package/dist/cli/commands/agent/kill.d.ts.map +1 -0
- package/dist/cli/commands/agent/kill.js +65 -0
- package/dist/cli/commands/agent/kill.js.map +1 -0
- package/dist/cli/commands/agent/list.d.ts +19 -0
- package/dist/cli/commands/agent/list.d.ts.map +1 -0
- package/dist/cli/commands/agent/list.js +92 -0
- package/dist/cli/commands/agent/list.js.map +1 -0
- package/dist/cli/commands/agent/logs.d.ts +14 -0
- package/dist/cli/commands/agent/logs.d.ts.map +1 -0
- package/dist/cli/commands/agent/logs.js +77 -0
- package/dist/cli/commands/agent/logs.js.map +1 -0
- package/dist/cli/commands/agent/metrics.d.ts +21 -0
- package/dist/cli/commands/agent/metrics.d.ts.map +1 -0
- package/dist/cli/commands/agent/metrics.js +87 -0
- package/dist/cli/commands/agent/metrics.js.map +1 -0
- package/dist/cli/commands/agent/spawn.d.ts +28 -0
- package/dist/cli/commands/agent/spawn.d.ts.map +1 -0
- package/dist/cli/commands/agent/spawn.js +84 -0
- package/dist/cli/commands/agent/spawn.js.map +1 -0
- package/dist/cli/commands/analyze.d.ts.map +1 -1
- package/dist/cli/commands/analyze.js +2 -1
- package/dist/cli/commands/analyze.js.map +1 -1
- package/dist/cli/commands/config/list.d.ts.map +1 -1
- package/dist/cli/commands/config/list.js +2 -1
- package/dist/cli/commands/config/list.js.map +1 -1
- package/dist/cli/commands/config/set.d.ts +7 -0
- package/dist/cli/commands/config/set.d.ts.map +1 -1
- package/dist/cli/commands/config/set.js +35 -4
- package/dist/cli/commands/config/set.js.map +1 -1
- package/dist/cli/commands/fleet/logs.d.ts.map +1 -1
- package/dist/cli/commands/fleet/logs.js +2 -1
- package/dist/cli/commands/fleet/logs.js.map +1 -1
- package/dist/cli/commands/fleet/metrics.d.ts.map +1 -1
- package/dist/cli/commands/fleet/metrics.js +2 -1
- package/dist/cli/commands/fleet/metrics.js.map +1 -1
- package/dist/cli/commands/fleet/monitor.d.ts.map +1 -1
- package/dist/cli/commands/fleet/monitor.js +7 -5
- package/dist/cli/commands/fleet/monitor.js.map +1 -1
- package/dist/cli/commands/fleet.d.ts.map +1 -1
- package/dist/cli/commands/fleet.js +2 -1
- package/dist/cli/commands/fleet.js.map +1 -1
- package/dist/cli/commands/generate.d.ts.map +1 -1
- package/dist/cli/commands/generate.js +2 -1
- package/dist/cli/commands/generate.js.map +1 -1
- package/dist/cli/commands/improve/index.d.ts.map +1 -1
- package/dist/cli/commands/improve/index.js +12 -11
- package/dist/cli/commands/improve/index.js.map +1 -1
- package/dist/cli/commands/init.d.ts +24 -0
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +503 -11
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/learn/index.d.ts.map +1 -1
- package/dist/cli/commands/learn/index.js +13 -12
- package/dist/cli/commands/learn/index.js.map +1 -1
- package/dist/cli/commands/monitor/alerts.d.ts.map +1 -1
- package/dist/cli/commands/monitor/alerts.js +2 -1
- package/dist/cli/commands/monitor/alerts.js.map +1 -1
- package/dist/cli/commands/patterns/index.d.ts.map +1 -1
- package/dist/cli/commands/patterns/index.js +20 -19
- package/dist/cli/commands/patterns/index.js.map +1 -1
- package/dist/cli/commands/quality/decision.d.ts.map +1 -1
- package/dist/cli/commands/quality/decision.js +9 -7
- package/dist/cli/commands/quality/decision.js.map +1 -1
- package/dist/cli/commands/quality/gate.d.ts.map +1 -1
- package/dist/cli/commands/quality/gate.js +10 -8
- package/dist/cli/commands/quality/gate.js.map +1 -1
- package/dist/cli/commands/quality/policy.d.ts.map +1 -1
- package/dist/cli/commands/quality/policy.js +10 -8
- package/dist/cli/commands/quality/policy.js.map +1 -1
- package/dist/cli/commands/quality/risk.d.ts.map +1 -1
- package/dist/cli/commands/quality/risk.js +5 -3
- package/dist/cli/commands/quality/risk.js.map +1 -1
- package/dist/cli/commands/quality/validate.d.ts.map +1 -1
- package/dist/cli/commands/quality/validate.js +10 -8
- package/dist/cli/commands/quality/validate.js.map +1 -1
- package/dist/cli/commands/quantization.d.ts +6 -0
- package/dist/cli/commands/quantization.d.ts.map +1 -0
- package/dist/cli/commands/quantization.js +188 -0
- package/dist/cli/commands/quantization.js.map +1 -0
- package/dist/cli/commands/routing/index.d.ts +0 -6
- package/dist/cli/commands/routing/index.d.ts.map +1 -1
- package/dist/cli/commands/routing/index.js +17 -16
- package/dist/cli/commands/routing/index.js.map +1 -1
- package/dist/cli/commands/run.d.ts.map +1 -1
- package/dist/cli/commands/run.js +2 -1
- package/dist/cli/commands/run.js.map +1 -1
- package/dist/cli/commands/skills/index.d.ts +51 -0
- package/dist/cli/commands/skills/index.d.ts.map +1 -0
- package/dist/cli/commands/skills/index.js +365 -0
- package/dist/cli/commands/skills/index.js.map +1 -0
- package/dist/cli/commands/test/debug.d.ts.map +1 -1
- package/dist/cli/commands/test/debug.js +2 -1
- package/dist/cli/commands/test/debug.js.map +1 -1
- package/dist/cli/commands/test/mutate.d.ts.map +1 -1
- package/dist/cli/commands/test/mutate.js +2 -1
- package/dist/cli/commands/test/mutate.js.map +1 -1
- package/dist/cli/commands/test/parallel.d.ts.map +1 -1
- package/dist/cli/commands/test/parallel.js +6 -4
- package/dist/cli/commands/test/parallel.js.map +1 -1
- package/dist/cli/commands/test/profile.d.ts.map +1 -1
- package/dist/cli/commands/test/profile.js +3 -2
- package/dist/cli/commands/test/profile.js.map +1 -1
- package/dist/cli/commands/test/queue.d.ts.map +1 -1
- package/dist/cli/commands/test/queue.js +2 -1
- package/dist/cli/commands/test/queue.js.map +1 -1
- package/dist/cli/commands/test/retry.d.ts.map +1 -1
- package/dist/cli/commands/test/retry.js +6 -4
- package/dist/cli/commands/test/retry.js.map +1 -1
- package/dist/cli/commands/test/trace.d.ts.map +1 -1
- package/dist/cli/commands/test/trace.js +2 -1
- package/dist/cli/commands/test/trace.js.map +1 -1
- package/dist/cli/commands/test/watch.d.ts.map +1 -1
- package/dist/cli/commands/test/watch.js +3 -2
- package/dist/cli/commands/test/watch.js.map +1 -1
- package/dist/cli/commands/workflow/cancel.d.ts.map +1 -1
- package/dist/cli/commands/workflow/cancel.js +2 -1
- package/dist/cli/commands/workflow/cancel.js.map +1 -1
- package/dist/cli/index-working.js +9 -8
- package/dist/cli/index-working.js.map +1 -1
- package/dist/cli/index.js +97 -1
- package/dist/cli/index.js.map +1 -1
- package/dist/core/EventBus.d.ts +38 -0
- package/dist/core/EventBus.d.ts.map +1 -1
- package/dist/core/EventBus.js +176 -31
- package/dist/core/EventBus.js.map +1 -1
- package/dist/core/FleetManager.d.ts +35 -1
- package/dist/core/FleetManager.d.ts.map +1 -1
- package/dist/core/FleetManager.js +121 -45
- package/dist/core/FleetManager.js.map +1 -1
- package/dist/core/MemoryManager.d.ts +19 -1
- package/dist/core/MemoryManager.d.ts.map +1 -1
- package/dist/core/MemoryManager.js +25 -1
- package/dist/core/MemoryManager.js.map +1 -1
- package/dist/core/coordination/OODACoordination.d.ts.map +1 -1
- package/dist/core/coordination/OODACoordination.js +2 -1
- package/dist/core/coordination/OODACoordination.js.map +1 -1
- package/dist/core/embeddings/EmbeddingCache.d.ts +134 -0
- package/dist/core/embeddings/EmbeddingCache.d.ts.map +1 -0
- package/dist/core/embeddings/EmbeddingCache.js +239 -0
- package/dist/core/embeddings/EmbeddingCache.js.map +1 -0
- package/dist/core/embeddings/EmbeddingGenerator.d.ts +224 -0
- package/dist/core/embeddings/EmbeddingGenerator.d.ts.map +1 -0
- package/dist/core/embeddings/EmbeddingGenerator.js +459 -0
- package/dist/core/embeddings/EmbeddingGenerator.js.map +1 -0
- package/dist/core/embeddings/index.d.ts +15 -0
- package/dist/core/embeddings/index.d.ts.map +1 -0
- package/dist/core/embeddings/index.js +22 -0
- package/dist/core/embeddings/index.js.map +1 -0
- package/dist/core/memory/AgentDBIntegration.d.ts +35 -0
- package/dist/core/memory/AgentDBIntegration.d.ts.map +1 -0
- package/dist/core/memory/AgentDBIntegration.js +75 -0
- package/dist/core/memory/AgentDBIntegration.js.map +1 -0
- package/dist/core/memory/AgentDBManager.d.ts +200 -0
- package/dist/core/memory/AgentDBManager.d.ts.map +1 -0
- package/dist/core/memory/AgentDBManager.js +246 -0
- package/dist/core/memory/AgentDBManager.js.map +1 -0
- package/dist/core/memory/AgentDBService.d.ts +160 -0
- package/dist/core/memory/AgentDBService.d.ts.map +1 -0
- package/dist/core/memory/AgentDBService.js +450 -0
- package/dist/core/memory/AgentDBService.js.map +1 -0
- package/dist/core/memory/RealAgentDBAdapter.d.ts +51 -0
- package/dist/core/memory/RealAgentDBAdapter.d.ts.map +1 -0
- package/dist/core/memory/RealAgentDBAdapter.js +231 -0
- package/dist/core/memory/RealAgentDBAdapter.js.map +1 -0
- package/dist/core/memory/ReasoningBankAdapter.d.ts +58 -0
- package/dist/core/memory/ReasoningBankAdapter.d.ts.map +1 -0
- package/dist/core/memory/ReasoningBankAdapter.js +77 -0
- package/dist/core/memory/ReasoningBankAdapter.js.map +1 -0
- package/dist/core/memory/SwarmMemoryManager.d.ts +75 -3
- package/dist/core/memory/SwarmMemoryManager.d.ts.map +1 -1
- package/dist/core/memory/SwarmMemoryManager.js +240 -55
- package/dist/core/memory/SwarmMemoryManager.js.map +1 -1
- package/dist/core/memory/index.d.ts +4 -0
- package/dist/core/memory/index.d.ts.map +1 -1
- package/dist/core/memory/index.js +9 -1
- package/dist/core/memory/index.js.map +1 -1
- package/dist/core/neural/NeuralTrainer.d.ts +137 -0
- package/dist/core/neural/NeuralTrainer.d.ts.map +1 -0
- package/dist/core/neural/NeuralTrainer.js +544 -0
- package/dist/core/neural/NeuralTrainer.js.map +1 -0
- package/dist/core/neural/index.d.ts +8 -0
- package/dist/core/neural/index.d.ts.map +1 -0
- package/dist/core/neural/index.js +24 -0
- package/dist/core/neural/index.js.map +1 -0
- package/dist/core/neural/types.d.ts +216 -0
- package/dist/core/neural/types.d.ts.map +1 -0
- package/dist/core/neural/types.js +8 -0
- package/dist/core/neural/types.js.map +1 -0
- package/dist/core/quantization/QuantizationManager.d.ts +83 -0
- package/dist/core/quantization/QuantizationManager.d.ts.map +1 -0
- package/dist/core/quantization/QuantizationManager.js +264 -0
- package/dist/core/quantization/QuantizationManager.js.map +1 -0
- package/dist/core/quantization/index.d.ts +5 -0
- package/dist/core/quantization/index.d.ts.map +1 -0
- package/dist/core/quantization/index.js +9 -0
- package/dist/core/quantization/index.js.map +1 -0
- package/dist/core/security/CertificateValidator.d.ts +130 -0
- package/dist/core/security/CertificateValidator.d.ts.map +1 -0
- package/dist/core/security/CertificateValidator.js +376 -0
- package/dist/core/security/CertificateValidator.js.map +1 -0
- package/dist/core/transport/QUICTransport.d.ts +62 -0
- package/dist/core/transport/QUICTransport.d.ts.map +1 -0
- package/dist/core/transport/QUICTransport.js +381 -0
- package/dist/core/transport/QUICTransport.js.map +1 -0
- package/dist/core/transport/SecureQUICTransport.d.ts +71 -0
- package/dist/core/transport/SecureQUICTransport.d.ts.map +1 -0
- package/dist/core/transport/SecureQUICTransport.js +253 -0
- package/dist/core/transport/SecureQUICTransport.js.map +1 -0
- package/dist/learning/AdvancedFeatureExtractor.d.ts +123 -0
- package/dist/learning/AdvancedFeatureExtractor.d.ts.map +1 -0
- package/dist/learning/AdvancedFeatureExtractor.js +423 -0
- package/dist/learning/AdvancedFeatureExtractor.js.map +1 -0
- package/dist/learning/FlakyPredictionModel.d.ts +11 -1
- package/dist/learning/FlakyPredictionModel.d.ts.map +1 -1
- package/dist/learning/FlakyPredictionModel.js +82 -35
- package/dist/learning/FlakyPredictionModel.js.map +1 -1
- package/dist/learning/FlakyTestDetector.d.ts +9 -0
- package/dist/learning/FlakyTestDetector.d.ts.map +1 -1
- package/dist/learning/FlakyTestDetector.js +28 -6
- package/dist/learning/FlakyTestDetector.js.map +1 -1
- package/dist/learning/ImprovementLoop.d.ts +16 -2
- package/dist/learning/ImprovementLoop.d.ts.map +1 -1
- package/dist/learning/ImprovementLoop.js +67 -8
- package/dist/learning/ImprovementLoop.js.map +1 -1
- package/dist/learning/ImprovementWorker.d.ts +83 -0
- package/dist/learning/ImprovementWorker.d.ts.map +1 -0
- package/dist/learning/ImprovementWorker.js +164 -0
- package/dist/learning/ImprovementWorker.js.map +1 -0
- package/dist/learning/NeuralPatternMatcher.d.ts +184 -0
- package/dist/learning/NeuralPatternMatcher.d.ts.map +1 -0
- package/dist/learning/NeuralPatternMatcher.js +702 -0
- package/dist/learning/NeuralPatternMatcher.js.map +1 -0
- package/dist/learning/NeuralTrainer.d.ts +209 -0
- package/dist/learning/NeuralTrainer.d.ts.map +1 -0
- package/dist/learning/NeuralTrainer.js +478 -0
- package/dist/learning/NeuralTrainer.js.map +1 -0
- package/dist/learning/index.d.ts +13 -7
- package/dist/learning/index.d.ts.map +1 -1
- package/dist/learning/index.js +27 -11
- package/dist/learning/index.js.map +1 -1
- package/dist/learning/types.d.ts +1 -0
- package/dist/learning/types.d.ts.map +1 -1
- package/dist/learning/types.js +16 -0
- package/dist/learning/types.js.map +1 -1
- package/dist/mcp/MCPToolRegistry.d.ts +34 -0
- package/dist/mcp/MCPToolRegistry.d.ts.map +1 -0
- package/dist/mcp/MCPToolRegistry.js +48 -0
- package/dist/mcp/MCPToolRegistry.js.map +1 -0
- package/dist/mcp/handlers/advanced/mutation-test-execute.d.ts +3 -3
- package/dist/mcp/handlers/advanced/mutation-test-execute.d.ts.map +1 -1
- package/dist/mcp/handlers/advanced/mutation-test-execute.js +5 -4
- package/dist/mcp/handlers/advanced/mutation-test-execute.js.map +1 -1
- package/dist/mcp/handlers/agent-spawn.d.ts.map +1 -1
- package/dist/mcp/handlers/agent-spawn.js +2 -1
- package/dist/mcp/handlers/agent-spawn.js.map +1 -1
- package/dist/mcp/handlers/analysis/coverageAnalyzeSublinear.d.ts.map +1 -1
- package/dist/mcp/handlers/analysis/coverageAnalyzeSublinear.js +9 -8
- package/dist/mcp/handlers/analysis/coverageAnalyzeSublinear.js.map +1 -1
- package/dist/mcp/handlers/analysis/coverageGapsDetect.d.ts.map +1 -1
- package/dist/mcp/handlers/analysis/coverageGapsDetect.js +6 -5
- package/dist/mcp/handlers/analysis/coverageGapsDetect.js.map +1 -1
- package/dist/mcp/handlers/analysis/performance-monitor-realtime-handler.d.ts.map +1 -1
- package/dist/mcp/handlers/analysis/performance-monitor-realtime-handler.js +5 -4
- package/dist/mcp/handlers/analysis/performance-monitor-realtime-handler.js.map +1 -1
- package/dist/mcp/handlers/analysis/performanceBenchmarkRun.d.ts.map +1 -1
- package/dist/mcp/handlers/analysis/performanceBenchmarkRun.js +8 -7
- package/dist/mcp/handlers/analysis/performanceBenchmarkRun.js.map +1 -1
- package/dist/mcp/handlers/analysis/performanceMonitorRealtime.d.ts.map +1 -1
- package/dist/mcp/handlers/analysis/performanceMonitorRealtime.js +7 -6
- package/dist/mcp/handlers/analysis/performanceMonitorRealtime.js.map +1 -1
- package/dist/mcp/handlers/analysis/securityScanComprehensive.d.ts.map +1 -1
- package/dist/mcp/handlers/analysis/securityScanComprehensive.js +18 -21
- package/dist/mcp/handlers/analysis/securityScanComprehensive.js.map +1 -1
- package/dist/mcp/handlers/base-handler.d.ts.map +1 -1
- package/dist/mcp/handlers/base-handler.js +2 -9
- package/dist/mcp/handlers/base-handler.js.map +1 -1
- package/dist/mcp/handlers/chaos/chaos-inject-failure.d.ts.map +1 -1
- package/dist/mcp/handlers/chaos/chaos-inject-failure.js +4 -3
- package/dist/mcp/handlers/chaos/chaos-inject-failure.js.map +1 -1
- package/dist/mcp/handlers/chaos/chaos-inject-latency.d.ts.map +1 -1
- package/dist/mcp/handlers/chaos/chaos-inject-latency.js +6 -5
- package/dist/mcp/handlers/chaos/chaos-inject-latency.js.map +1 -1
- package/dist/mcp/handlers/coordination/event-emit.d.ts.map +1 -1
- package/dist/mcp/handlers/coordination/event-emit.js +2 -1
- package/dist/mcp/handlers/coordination/event-emit.js.map +1 -1
- package/dist/mcp/handlers/coordination/event-subscribe.d.ts.map +1 -1
- package/dist/mcp/handlers/coordination/event-subscribe.js +2 -1
- package/dist/mcp/handlers/coordination/event-subscribe.js.map +1 -1
- package/dist/mcp/handlers/coordination/workflow-checkpoint.d.ts.map +1 -1
- package/dist/mcp/handlers/coordination/workflow-checkpoint.js +2 -1
- package/dist/mcp/handlers/coordination/workflow-checkpoint.js.map +1 -1
- package/dist/mcp/handlers/coordination/workflow-create.d.ts.map +1 -1
- package/dist/mcp/handlers/coordination/workflow-create.js +2 -1
- package/dist/mcp/handlers/coordination/workflow-create.js.map +1 -1
- package/dist/mcp/handlers/coordination/workflow-execute.d.ts.map +1 -1
- package/dist/mcp/handlers/coordination/workflow-execute.js +2 -1
- package/dist/mcp/handlers/coordination/workflow-execute.js.map +1 -1
- package/dist/mcp/handlers/coordination/workflow-resume.d.ts.map +1 -1
- package/dist/mcp/handlers/coordination/workflow-resume.js +2 -1
- package/dist/mcp/handlers/coordination/workflow-resume.js.map +1 -1
- package/dist/mcp/handlers/fleet-init.d.ts.map +1 -1
- package/dist/mcp/handlers/fleet-init.js +2 -1
- package/dist/mcp/handlers/fleet-init.js.map +1 -1
- package/dist/mcp/handlers/fleet-status.d.ts.map +1 -1
- package/dist/mcp/handlers/fleet-status.js +31 -30
- package/dist/mcp/handlers/fleet-status.js.map +1 -1
- package/dist/mcp/handlers/integration/dependency-check.d.ts.map +1 -1
- package/dist/mcp/handlers/integration/dependency-check.js +3 -2
- package/dist/mcp/handlers/integration/dependency-check.js.map +1 -1
- package/dist/mcp/handlers/integration/integration-test-orchestrate.d.ts.map +1 -1
- package/dist/mcp/handlers/integration/integration-test-orchestrate.js +2 -1
- package/dist/mcp/handlers/integration/integration-test-orchestrate.js.map +1 -1
- package/dist/mcp/handlers/optimize-tests.d.ts.map +1 -1
- package/dist/mcp/handlers/optimize-tests.js +33 -32
- package/dist/mcp/handlers/optimize-tests.js.map +1 -1
- package/dist/mcp/handlers/predict-defects.d.ts.map +1 -1
- package/dist/mcp/handlers/predict-defects.js +46 -45
- package/dist/mcp/handlers/predict-defects.js.map +1 -1
- package/dist/mcp/handlers/prediction/deployment-readiness-check.d.ts.map +1 -1
- package/dist/mcp/handlers/prediction/deployment-readiness-check.js +24 -23
- package/dist/mcp/handlers/prediction/deployment-readiness-check.js.map +1 -1
- package/dist/mcp/handlers/prediction/predict-defects-ai.d.ts.map +1 -1
- package/dist/mcp/handlers/prediction/predict-defects-ai.js +10 -9
- package/dist/mcp/handlers/prediction/predict-defects-ai.js.map +1 -1
- package/dist/mcp/handlers/prediction/regression-risk-analyze.d.ts.map +1 -1
- package/dist/mcp/handlers/prediction/regression-risk-analyze.js +10 -9
- package/dist/mcp/handlers/prediction/regression-risk-analyze.js.map +1 -1
- package/dist/mcp/handlers/prediction/visual-test-regression.d.ts.map +1 -1
- package/dist/mcp/handlers/prediction/visual-test-regression.js +7 -6
- package/dist/mcp/handlers/prediction/visual-test-regression.js.map +1 -1
- package/dist/mcp/handlers/quality-analyze.d.ts.map +1 -1
- package/dist/mcp/handlers/quality-analyze.js +53 -52
- package/dist/mcp/handlers/quality-analyze.js.map +1 -1
- package/dist/mcp/handlers/task-orchestrate.d.ts.map +1 -1
- package/dist/mcp/handlers/task-orchestrate.js +19 -18
- package/dist/mcp/handlers/task-orchestrate.js.map +1 -1
- package/dist/mcp/handlers/test/test-execute-parallel.d.ts.map +1 -1
- package/dist/mcp/handlers/test/test-execute-parallel.js +7 -6
- package/dist/mcp/handlers/test/test-execute-parallel.js.map +1 -1
- package/dist/mcp/handlers/test/test-generate-enhanced.d.ts.map +1 -1
- package/dist/mcp/handlers/test/test-generate-enhanced.js +2 -1
- package/dist/mcp/handlers/test/test-generate-enhanced.js.map +1 -1
- package/dist/mcp/handlers/test/test-optimize-sublinear.d.ts.map +1 -1
- package/dist/mcp/handlers/test/test-optimize-sublinear.js +3 -2
- package/dist/mcp/handlers/test/test-optimize-sublinear.js.map +1 -1
- package/dist/mcp/handlers/test-execute.d.ts.map +1 -1
- package/dist/mcp/handlers/test-execute.js +11 -10
- package/dist/mcp/handlers/test-execute.js.map +1 -1
- package/dist/mcp/handlers/test-generate.d.ts.map +1 -1
- package/dist/mcp/handlers/test-generate.js +4 -3
- package/dist/mcp/handlers/test-generate.js.map +1 -1
- package/dist/mcp/server.d.ts +4 -4
- package/dist/mcp/services/AgentRegistry.d.ts.map +1 -1
- package/dist/mcp/services/AgentRegistry.js +9 -2
- package/dist/mcp/services/AgentRegistry.js.map +1 -1
- package/dist/mcp/streaming/CoverageAnalyzeStreamHandler.d.ts.map +1 -1
- package/dist/mcp/streaming/CoverageAnalyzeStreamHandler.js +10 -9
- package/dist/mcp/streaming/CoverageAnalyzeStreamHandler.js.map +1 -1
- package/dist/mcp/streaming/StreamingMCPTool.d.ts.map +1 -1
- package/dist/mcp/streaming/StreamingMCPTool.js +2 -1
- package/dist/mcp/streaming/StreamingMCPTool.js.map +1 -1
- package/dist/mcp/streaming/TestExecuteStreamHandler.d.ts.map +1 -1
- package/dist/mcp/streaming/TestExecuteStreamHandler.js +6 -5
- package/dist/mcp/streaming/TestExecuteStreamHandler.js.map +1 -1
- package/dist/reasoning/TestTemplateCreator.d.ts +10 -2
- package/dist/reasoning/TestTemplateCreator.d.ts.map +1 -1
- package/dist/reasoning/TestTemplateCreator.js +81 -21
- package/dist/reasoning/TestTemplateCreator.js.map +1 -1
- package/dist/transport/QUICTransport.d.ts +340 -0
- package/dist/transport/QUICTransport.d.ts.map +1 -0
- package/dist/transport/QUICTransport.js +814 -0
- package/dist/transport/QUICTransport.js.map +1 -0
- package/dist/transport/UDPTransport.d.ts +348 -0
- package/dist/transport/UDPTransport.d.ts.map +1 -0
- package/dist/transport/UDPTransport.js +820 -0
- package/dist/transport/UDPTransport.js.map +1 -0
- package/dist/types/errors.d.ts +1 -1
- package/dist/types/index.d.ts +37 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +2 -0
- package/dist/types/index.js.map +1 -1
- package/dist/types/pattern.types.d.ts +39 -3
- package/dist/types/pattern.types.d.ts.map +1 -1
- package/dist/types/quic.d.ts +339 -0
- package/dist/types/quic.d.ts.map +1 -0
- package/dist/types/quic.js +48 -0
- package/dist/types/quic.js.map +1 -0
- package/dist/utils/Config.js +3 -3
- package/dist/utils/Config.js.map +1 -1
- package/dist/utils/Database.d.ts +14 -0
- package/dist/utils/Database.d.ts.map +1 -1
- package/dist/utils/Database.js +51 -4
- package/dist/utils/Database.js.map +1 -1
- package/dist/utils/Logger.d.ts.map +1 -1
- package/dist/utils/Logger.js +111 -26
- package/dist/utils/Logger.js.map +1 -1
- package/dist/utils/ProcessExit.d.ts +23 -0
- package/dist/utils/ProcessExit.d.ts.map +1 -0
- package/dist/utils/ProcessExit.js +40 -0
- package/dist/utils/ProcessExit.js.map +1 -0
- package/dist/utils/SecureRandom.d.ts +171 -0
- package/dist/utils/SecureRandom.d.ts.map +1 -0
- package/dist/utils/SecureRandom.js +229 -0
- package/dist/utils/SecureRandom.js.map +1 -0
- package/dist/utils/SecureUrlValidator.d.ts +167 -0
- package/dist/utils/SecureUrlValidator.d.ts.map +1 -0
- package/dist/utils/SecureUrlValidator.js +306 -0
- package/dist/utils/SecureUrlValidator.js.map +1 -0
- package/dist/utils/SecureValidation.d.ts +131 -0
- package/dist/utils/SecureValidation.d.ts.map +1 -0
- package/dist/utils/SecureValidation.js +265 -0
- package/dist/utils/SecureValidation.js.map +1 -0
- package/dist/utils/validation.d.ts.map +1 -1
- package/dist/utils/validation.js +5 -4
- package/dist/utils/validation.js.map +1 -1
- package/package.json +31 -8
|
@@ -0,0 +1,1201 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Hooks Automation
|
|
3
|
+
description: Automated coordination, formatting, and learning from Claude Code operations using intelligent hooks with MCP integration. Includes pre/post task hooks, session management, Git integration, memory coordination, and neural pattern training for enhanced development workflows.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Hooks Automation
|
|
7
|
+
|
|
8
|
+
Intelligent automation system that coordinates, validates, and learns from Claude Code operations through hooks integrated with MCP tools and neural pattern training.
|
|
9
|
+
|
|
10
|
+
## What This Skill Does
|
|
11
|
+
|
|
12
|
+
This skill provides a comprehensive hook system that automatically manages development operations, coordinates swarm agents, maintains session state, and continuously learns from coding patterns. It enables automated agent assignment, code formatting, performance tracking, and cross-session memory persistence.
|
|
13
|
+
|
|
14
|
+
**Key Capabilities:**
|
|
15
|
+
- **Pre-Operation Hooks**: Validate, prepare, and auto-assign agents before operations
|
|
16
|
+
- **Post-Operation Hooks**: Format, analyze, and train patterns after operations
|
|
17
|
+
- **Session Management**: Persist state, restore context, generate summaries
|
|
18
|
+
- **Memory Coordination**: Synchronize knowledge across swarm agents
|
|
19
|
+
- **Git Integration**: Automated commit hooks with quality verification
|
|
20
|
+
- **Neural Training**: Continuous learning from successful patterns
|
|
21
|
+
- **MCP Integration**: Seamless coordination with swarm tools
|
|
22
|
+
|
|
23
|
+
## Prerequisites
|
|
24
|
+
|
|
25
|
+
**Required:**
|
|
26
|
+
- Claude Flow CLI installed (`npm install -g claude-flow@alpha`)
|
|
27
|
+
- Claude Code with hooks enabled
|
|
28
|
+
- `.claude/settings.json` with hook configurations
|
|
29
|
+
|
|
30
|
+
**Optional:**
|
|
31
|
+
- MCP servers configured (claude-flow, ruv-swarm, flow-nexus)
|
|
32
|
+
- Git repository for version control
|
|
33
|
+
- Testing framework for quality verification
|
|
34
|
+
|
|
35
|
+
## Quick Start
|
|
36
|
+
|
|
37
|
+
### Initialize Hooks System
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
# Initialize with default hooks configuration
|
|
41
|
+
npx claude-flow init --hooks
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
This creates:
|
|
45
|
+
- `.claude/settings.json` with pre-configured hooks
|
|
46
|
+
- Hook command documentation in `.claude/commands/hooks/`
|
|
47
|
+
- Default hook handlers for common operations
|
|
48
|
+
|
|
49
|
+
### Basic Hook Usage
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
# Pre-task hook (auto-spawns agents)
|
|
53
|
+
npx claude-flow hook pre-task --description "Implement authentication"
|
|
54
|
+
|
|
55
|
+
# Post-edit hook (auto-formats and stores in memory)
|
|
56
|
+
npx claude-flow hook post-edit --file "src/auth.js" --memory-key "auth/login"
|
|
57
|
+
|
|
58
|
+
# Session end hook (saves state and metrics)
|
|
59
|
+
npx claude-flow hook session-end --session-id "dev-session" --export-metrics
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## Complete Guide
|
|
65
|
+
|
|
66
|
+
### Available Hooks
|
|
67
|
+
|
|
68
|
+
#### Pre-Operation Hooks
|
|
69
|
+
|
|
70
|
+
Hooks that execute BEFORE operations to prepare and validate:
|
|
71
|
+
|
|
72
|
+
**pre-edit** - Validate and assign agents before file modifications
|
|
73
|
+
```bash
|
|
74
|
+
npx claude-flow hook pre-edit [options]
|
|
75
|
+
|
|
76
|
+
Options:
|
|
77
|
+
--file, -f <path> File path to be edited
|
|
78
|
+
--auto-assign-agent Automatically assign best agent (default: true)
|
|
79
|
+
--validate-syntax Pre-validate syntax before edit
|
|
80
|
+
--check-conflicts Check for merge conflicts
|
|
81
|
+
--backup-file Create backup before editing
|
|
82
|
+
|
|
83
|
+
Examples:
|
|
84
|
+
npx claude-flow hook pre-edit --file "src/auth/login.js"
|
|
85
|
+
npx claude-flow hook pre-edit -f "config/db.js" --validate-syntax
|
|
86
|
+
npx claude-flow hook pre-edit -f "production.env" --backup-file --check-conflicts
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
**Features:**
|
|
90
|
+
- Auto agent assignment based on file type
|
|
91
|
+
- Syntax validation to prevent broken code
|
|
92
|
+
- Conflict detection for concurrent edits
|
|
93
|
+
- Automatic file backups for safety
|
|
94
|
+
|
|
95
|
+
**pre-bash** - Check command safety and resource requirements
|
|
96
|
+
```bash
|
|
97
|
+
npx claude-flow hook pre-bash --command <cmd>
|
|
98
|
+
|
|
99
|
+
Options:
|
|
100
|
+
--command, -c <cmd> Command to validate
|
|
101
|
+
--check-safety Verify command safety (default: true)
|
|
102
|
+
--estimate-resources Estimate resource usage
|
|
103
|
+
--require-confirmation Request user confirmation for risky commands
|
|
104
|
+
|
|
105
|
+
Examples:
|
|
106
|
+
npx claude-flow hook pre-bash -c "rm -rf /tmp/cache"
|
|
107
|
+
npx claude-flow hook pre-bash --command "docker build ." --estimate-resources
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
**Features:**
|
|
111
|
+
- Command safety validation
|
|
112
|
+
- Resource requirement estimation
|
|
113
|
+
- Destructive command confirmation
|
|
114
|
+
- Permission checks
|
|
115
|
+
|
|
116
|
+
**pre-task** - Auto-spawn agents and prepare for complex tasks
|
|
117
|
+
```bash
|
|
118
|
+
npx claude-flow hook pre-task [options]
|
|
119
|
+
|
|
120
|
+
Options:
|
|
121
|
+
--description, -d <text> Task description for context
|
|
122
|
+
--auto-spawn-agents Automatically spawn required agents (default: true)
|
|
123
|
+
--load-memory Load relevant memory from previous sessions
|
|
124
|
+
--optimize-topology Select optimal swarm topology
|
|
125
|
+
--estimate-complexity Analyze task complexity
|
|
126
|
+
|
|
127
|
+
Examples:
|
|
128
|
+
npx claude-flow hook pre-task --description "Implement user authentication"
|
|
129
|
+
npx claude-flow hook pre-task -d "Continue API dev" --load-memory
|
|
130
|
+
npx claude-flow hook pre-task -d "Refactor codebase" --optimize-topology
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
**Features:**
|
|
134
|
+
- Automatic agent spawning based on task analysis
|
|
135
|
+
- Memory loading for context continuity
|
|
136
|
+
- Topology optimization for task structure
|
|
137
|
+
- Complexity estimation and time prediction
|
|
138
|
+
|
|
139
|
+
**pre-search** - Prepare and optimize search operations
|
|
140
|
+
```bash
|
|
141
|
+
npx claude-flow hook pre-search --query <query>
|
|
142
|
+
|
|
143
|
+
Options:
|
|
144
|
+
--query, -q <text> Search query
|
|
145
|
+
--check-cache Check cache first (default: true)
|
|
146
|
+
--optimize-query Optimize search pattern
|
|
147
|
+
|
|
148
|
+
Examples:
|
|
149
|
+
npx claude-flow hook pre-search -q "authentication middleware"
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
**Features:**
|
|
153
|
+
- Cache checking for faster results
|
|
154
|
+
- Query optimization
|
|
155
|
+
- Search pattern improvement
|
|
156
|
+
|
|
157
|
+
#### Post-Operation Hooks
|
|
158
|
+
|
|
159
|
+
Hooks that execute AFTER operations to process and learn:
|
|
160
|
+
|
|
161
|
+
**post-edit** - Auto-format, validate, and update memory
|
|
162
|
+
```bash
|
|
163
|
+
npx claude-flow hook post-edit [options]
|
|
164
|
+
|
|
165
|
+
Options:
|
|
166
|
+
--file, -f <path> File path that was edited
|
|
167
|
+
--auto-format Automatically format code (default: true)
|
|
168
|
+
--memory-key, -m <key> Store edit context in memory
|
|
169
|
+
--train-patterns Train neural patterns from edit
|
|
170
|
+
--validate-output Validate edited file
|
|
171
|
+
|
|
172
|
+
Examples:
|
|
173
|
+
npx claude-flow hook post-edit --file "src/components/Button.jsx"
|
|
174
|
+
npx claude-flow hook post-edit -f "api/auth.js" --memory-key "auth/login"
|
|
175
|
+
npx claude-flow hook post-edit -f "utils/helpers.ts" --train-patterns
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
**Features:**
|
|
179
|
+
- Language-specific auto-formatting (Prettier, Black, gofmt)
|
|
180
|
+
- Memory storage for edit context and decisions
|
|
181
|
+
- Neural pattern training for continuous improvement
|
|
182
|
+
- Output validation with linting
|
|
183
|
+
|
|
184
|
+
**post-bash** - Log execution and update metrics
|
|
185
|
+
```bash
|
|
186
|
+
npx claude-flow hook post-bash --command <cmd>
|
|
187
|
+
|
|
188
|
+
Options:
|
|
189
|
+
--command, -c <cmd> Command that was executed
|
|
190
|
+
--log-output Log command output (default: true)
|
|
191
|
+
--update-metrics Update performance metrics
|
|
192
|
+
--store-result Store result in memory
|
|
193
|
+
|
|
194
|
+
Examples:
|
|
195
|
+
npx claude-flow hook post-bash -c "npm test" --update-metrics
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
**Features:**
|
|
199
|
+
- Command execution logging
|
|
200
|
+
- Performance metric tracking
|
|
201
|
+
- Result storage for analysis
|
|
202
|
+
- Error pattern detection
|
|
203
|
+
|
|
204
|
+
**post-task** - Performance analysis and decision storage
|
|
205
|
+
```bash
|
|
206
|
+
npx claude-flow hook post-task [options]
|
|
207
|
+
|
|
208
|
+
Options:
|
|
209
|
+
--task-id, -t <id> Task identifier for tracking
|
|
210
|
+
--analyze-performance Generate performance metrics (default: true)
|
|
211
|
+
--store-decisions Save task decisions to memory
|
|
212
|
+
--export-learnings Export neural pattern learnings
|
|
213
|
+
--generate-report Create task completion report
|
|
214
|
+
|
|
215
|
+
Examples:
|
|
216
|
+
npx claude-flow hook post-task --task-id "auth-implementation"
|
|
217
|
+
npx claude-flow hook post-task -t "api-refactor" --analyze-performance
|
|
218
|
+
npx claude-flow hook post-task -t "bug-fix-123" --store-decisions
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
**Features:**
|
|
222
|
+
- Execution time and token usage measurement
|
|
223
|
+
- Decision and implementation choice recording
|
|
224
|
+
- Neural learning pattern export
|
|
225
|
+
- Completion report generation
|
|
226
|
+
|
|
227
|
+
**post-search** - Cache results and improve patterns
|
|
228
|
+
```bash
|
|
229
|
+
npx claude-flow hook post-search --query <query> --results <path>
|
|
230
|
+
|
|
231
|
+
Options:
|
|
232
|
+
--query, -q <text> Original search query
|
|
233
|
+
--results, -r <path> Results file path
|
|
234
|
+
--cache-results Cache for future use (default: true)
|
|
235
|
+
--train-patterns Improve search patterns
|
|
236
|
+
|
|
237
|
+
Examples:
|
|
238
|
+
npx claude-flow hook post-search -q "auth" -r "results.json" --train-patterns
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
**Features:**
|
|
242
|
+
- Result caching for faster subsequent searches
|
|
243
|
+
- Search pattern improvement
|
|
244
|
+
- Relevance scoring
|
|
245
|
+
|
|
246
|
+
#### MCP Integration Hooks
|
|
247
|
+
|
|
248
|
+
Hooks that coordinate with MCP swarm tools:
|
|
249
|
+
|
|
250
|
+
**mcp-initialized** - Persist swarm configuration
|
|
251
|
+
```bash
|
|
252
|
+
npx claude-flow hook mcp-initialized --swarm-id <id>
|
|
253
|
+
|
|
254
|
+
Features:
|
|
255
|
+
- Save swarm topology and configuration
|
|
256
|
+
- Store agent roster in memory
|
|
257
|
+
- Initialize coordination namespace
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
**agent-spawned** - Update agent roster and memory
|
|
261
|
+
```bash
|
|
262
|
+
npx claude-flow hook agent-spawned --agent-id <id> --type <type>
|
|
263
|
+
|
|
264
|
+
Features:
|
|
265
|
+
- Register agent in coordination memory
|
|
266
|
+
- Update agent roster
|
|
267
|
+
- Initialize agent-specific memory namespace
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
**task-orchestrated** - Monitor task progress
|
|
271
|
+
```bash
|
|
272
|
+
npx claude-flow hook task-orchestrated --task-id <id>
|
|
273
|
+
|
|
274
|
+
Features:
|
|
275
|
+
- Track task progress through memory
|
|
276
|
+
- Monitor agent assignments
|
|
277
|
+
- Update coordination state
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
**neural-trained** - Save pattern improvements
|
|
281
|
+
```bash
|
|
282
|
+
npx claude-flow hook neural-trained --pattern <name>
|
|
283
|
+
|
|
284
|
+
Features:
|
|
285
|
+
- Export trained neural patterns
|
|
286
|
+
- Update coordination models
|
|
287
|
+
- Share learning across agents
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
#### Memory Coordination Hooks
|
|
291
|
+
|
|
292
|
+
**memory-write** - Triggered when agents write to coordination memory
|
|
293
|
+
```bash
|
|
294
|
+
Features:
|
|
295
|
+
- Validate memory key format
|
|
296
|
+
- Update cross-agent indexes
|
|
297
|
+
- Trigger dependent hooks
|
|
298
|
+
- Notify subscribed agents
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
**memory-read** - Triggered when agents read from coordination memory
|
|
302
|
+
```bash
|
|
303
|
+
Features:
|
|
304
|
+
- Log access patterns
|
|
305
|
+
- Update popularity metrics
|
|
306
|
+
- Preload related data
|
|
307
|
+
- Track usage statistics
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
**memory-sync** - Synchronize memory across swarm agents
|
|
311
|
+
```bash
|
|
312
|
+
npx claude-flow hook memory-sync --namespace <ns>
|
|
313
|
+
|
|
314
|
+
Features:
|
|
315
|
+
- Sync memory state across agents
|
|
316
|
+
- Resolve conflicts
|
|
317
|
+
- Propagate updates
|
|
318
|
+
- Maintain consistency
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
#### Session Hooks
|
|
322
|
+
|
|
323
|
+
**session-start** - Initialize new session
|
|
324
|
+
```bash
|
|
325
|
+
npx claude-flow hook session-start --session-id <id>
|
|
326
|
+
|
|
327
|
+
Options:
|
|
328
|
+
--session-id, -s <id> Session identifier
|
|
329
|
+
--load-context Load context from previous session
|
|
330
|
+
--init-agents Initialize required agents
|
|
331
|
+
|
|
332
|
+
Features:
|
|
333
|
+
- Create session directory
|
|
334
|
+
- Initialize metrics tracking
|
|
335
|
+
- Load previous context
|
|
336
|
+
- Set up coordination namespace
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
**session-restore** - Load previous session state
|
|
340
|
+
```bash
|
|
341
|
+
npx claude-flow hook session-restore --session-id <id>
|
|
342
|
+
|
|
343
|
+
Options:
|
|
344
|
+
--session-id, -s <id> Session to restore
|
|
345
|
+
--restore-memory Restore memory state (default: true)
|
|
346
|
+
--restore-agents Restore agent configurations
|
|
347
|
+
|
|
348
|
+
Examples:
|
|
349
|
+
npx claude-flow hook session-restore --session-id "swarm-20241019"
|
|
350
|
+
npx claude-flow hook session-restore -s "feature-auth" --restore-memory
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
**Features:**
|
|
354
|
+
- Load previous session context
|
|
355
|
+
- Restore memory state and decisions
|
|
356
|
+
- Reconfigure agents to previous state
|
|
357
|
+
- Resume in-progress tasks
|
|
358
|
+
|
|
359
|
+
**session-end** - Cleanup and persist session state
|
|
360
|
+
```bash
|
|
361
|
+
npx claude-flow hook session-end [options]
|
|
362
|
+
|
|
363
|
+
Options:
|
|
364
|
+
--session-id, -s <id> Session identifier to end
|
|
365
|
+
--save-state Save current session state (default: true)
|
|
366
|
+
--export-metrics Export session metrics
|
|
367
|
+
--generate-summary Create session summary
|
|
368
|
+
--cleanup-temp Remove temporary files
|
|
369
|
+
|
|
370
|
+
Examples:
|
|
371
|
+
npx claude-flow hook session-end --session-id "dev-session-2024"
|
|
372
|
+
npx claude-flow hook session-end -s "feature-auth" --export-metrics --generate-summary
|
|
373
|
+
npx claude-flow hook session-end -s "quick-fix" --cleanup-temp
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
**Features:**
|
|
377
|
+
- Save current context and progress
|
|
378
|
+
- Export session metrics (duration, commands, tokens, files)
|
|
379
|
+
- Generate work summary with decisions and next steps
|
|
380
|
+
- Cleanup temporary files and optimize storage
|
|
381
|
+
|
|
382
|
+
**notify** - Custom notifications with swarm status
|
|
383
|
+
```bash
|
|
384
|
+
npx claude-flow hook notify --message <msg>
|
|
385
|
+
|
|
386
|
+
Options:
|
|
387
|
+
--message, -m <text> Notification message
|
|
388
|
+
--level <level> Notification level (info|warning|error)
|
|
389
|
+
--swarm-status Include swarm status (default: true)
|
|
390
|
+
--broadcast Send to all agents
|
|
391
|
+
|
|
392
|
+
Examples:
|
|
393
|
+
npx claude-flow hook notify -m "Task completed" --level info
|
|
394
|
+
npx claude-flow hook notify -m "Critical error" --level error --broadcast
|
|
395
|
+
```
|
|
396
|
+
|
|
397
|
+
**Features:**
|
|
398
|
+
- Send notifications to coordination system
|
|
399
|
+
- Include swarm status and metrics
|
|
400
|
+
- Broadcast to all agents
|
|
401
|
+
- Log important events
|
|
402
|
+
|
|
403
|
+
### Configuration
|
|
404
|
+
|
|
405
|
+
#### Basic Configuration
|
|
406
|
+
|
|
407
|
+
Edit `.claude/settings.json` to configure hooks:
|
|
408
|
+
|
|
409
|
+
```json
|
|
410
|
+
{
|
|
411
|
+
"hooks": {
|
|
412
|
+
"PreToolUse": [
|
|
413
|
+
{
|
|
414
|
+
"matcher": "^(Write|Edit|MultiEdit)$",
|
|
415
|
+
"hooks": [{
|
|
416
|
+
"type": "command",
|
|
417
|
+
"command": "npx claude-flow hook pre-edit --file '${tool.params.file_path}' --memory-key 'swarm/editor/current'"
|
|
418
|
+
}]
|
|
419
|
+
},
|
|
420
|
+
{
|
|
421
|
+
"matcher": "^Bash$",
|
|
422
|
+
"hooks": [{
|
|
423
|
+
"type": "command",
|
|
424
|
+
"command": "npx claude-flow hook pre-bash --command '${tool.params.command}'"
|
|
425
|
+
}]
|
|
426
|
+
}
|
|
427
|
+
],
|
|
428
|
+
"PostToolUse": [
|
|
429
|
+
{
|
|
430
|
+
"matcher": "^(Write|Edit|MultiEdit)$",
|
|
431
|
+
"hooks": [{
|
|
432
|
+
"type": "command",
|
|
433
|
+
"command": "npx claude-flow hook post-edit --file '${tool.params.file_path}' --memory-key 'swarm/editor/complete' --auto-format --train-patterns"
|
|
434
|
+
}]
|
|
435
|
+
},
|
|
436
|
+
{
|
|
437
|
+
"matcher": "^Bash$",
|
|
438
|
+
"hooks": [{
|
|
439
|
+
"type": "command",
|
|
440
|
+
"command": "npx claude-flow hook post-bash --command '${tool.params.command}' --update-metrics"
|
|
441
|
+
}]
|
|
442
|
+
}
|
|
443
|
+
]
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
```
|
|
447
|
+
|
|
448
|
+
#### Advanced Configuration
|
|
449
|
+
|
|
450
|
+
Complete hook configuration with all features:
|
|
451
|
+
|
|
452
|
+
```json
|
|
453
|
+
{
|
|
454
|
+
"hooks": {
|
|
455
|
+
"enabled": true,
|
|
456
|
+
"debug": false,
|
|
457
|
+
"timeout": 5000,
|
|
458
|
+
|
|
459
|
+
"PreToolUse": [
|
|
460
|
+
{
|
|
461
|
+
"matcher": "^(Write|Edit|MultiEdit)$",
|
|
462
|
+
"hooks": [
|
|
463
|
+
{
|
|
464
|
+
"type": "command",
|
|
465
|
+
"command": "npx claude-flow hook pre-edit --file '${tool.params.file_path}' --auto-assign-agent --validate-syntax",
|
|
466
|
+
"timeout": 3000,
|
|
467
|
+
"continueOnError": true
|
|
468
|
+
}
|
|
469
|
+
]
|
|
470
|
+
},
|
|
471
|
+
{
|
|
472
|
+
"matcher": "^Task$",
|
|
473
|
+
"hooks": [
|
|
474
|
+
{
|
|
475
|
+
"type": "command",
|
|
476
|
+
"command": "npx claude-flow hook pre-task --description '${tool.params.task}' --auto-spawn-agents --load-memory",
|
|
477
|
+
"async": true
|
|
478
|
+
}
|
|
479
|
+
]
|
|
480
|
+
},
|
|
481
|
+
{
|
|
482
|
+
"matcher": "^Grep$",
|
|
483
|
+
"hooks": [
|
|
484
|
+
{
|
|
485
|
+
"type": "command",
|
|
486
|
+
"command": "npx claude-flow hook pre-search --query '${tool.params.pattern}' --check-cache"
|
|
487
|
+
}
|
|
488
|
+
]
|
|
489
|
+
}
|
|
490
|
+
],
|
|
491
|
+
|
|
492
|
+
"PostToolUse": [
|
|
493
|
+
{
|
|
494
|
+
"matcher": "^(Write|Edit|MultiEdit)$",
|
|
495
|
+
"hooks": [
|
|
496
|
+
{
|
|
497
|
+
"type": "command",
|
|
498
|
+
"command": "npx claude-flow hook post-edit --file '${tool.params.file_path}' --memory-key 'edits/${tool.params.file_path}' --auto-format --train-patterns",
|
|
499
|
+
"async": true
|
|
500
|
+
}
|
|
501
|
+
]
|
|
502
|
+
},
|
|
503
|
+
{
|
|
504
|
+
"matcher": "^Task$",
|
|
505
|
+
"hooks": [
|
|
506
|
+
{
|
|
507
|
+
"type": "command",
|
|
508
|
+
"command": "npx claude-flow hook post-task --task-id '${result.task_id}' --analyze-performance --store-decisions --export-learnings",
|
|
509
|
+
"async": true
|
|
510
|
+
}
|
|
511
|
+
]
|
|
512
|
+
},
|
|
513
|
+
{
|
|
514
|
+
"matcher": "^Grep$",
|
|
515
|
+
"hooks": [
|
|
516
|
+
{
|
|
517
|
+
"type": "command",
|
|
518
|
+
"command": "npx claude-flow hook post-search --query '${tool.params.pattern}' --cache-results --train-patterns"
|
|
519
|
+
}
|
|
520
|
+
]
|
|
521
|
+
}
|
|
522
|
+
],
|
|
523
|
+
|
|
524
|
+
"SessionStart": [
|
|
525
|
+
{
|
|
526
|
+
"hooks": [
|
|
527
|
+
{
|
|
528
|
+
"type": "command",
|
|
529
|
+
"command": "npx claude-flow hook session-start --session-id '${session.id}' --load-context"
|
|
530
|
+
}
|
|
531
|
+
]
|
|
532
|
+
}
|
|
533
|
+
],
|
|
534
|
+
|
|
535
|
+
"SessionEnd": [
|
|
536
|
+
{
|
|
537
|
+
"hooks": [
|
|
538
|
+
{
|
|
539
|
+
"type": "command",
|
|
540
|
+
"command": "npx claude-flow hook session-end --session-id '${session.id}' --export-metrics --generate-summary --cleanup-temp"
|
|
541
|
+
}
|
|
542
|
+
]
|
|
543
|
+
}
|
|
544
|
+
]
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
```
|
|
548
|
+
|
|
549
|
+
#### Protected File Patterns
|
|
550
|
+
|
|
551
|
+
Add protection for sensitive files:
|
|
552
|
+
|
|
553
|
+
```json
|
|
554
|
+
{
|
|
555
|
+
"hooks": {
|
|
556
|
+
"PreToolUse": [
|
|
557
|
+
{
|
|
558
|
+
"matcher": "^(Write|Edit|MultiEdit)$",
|
|
559
|
+
"hooks": [
|
|
560
|
+
{
|
|
561
|
+
"type": "command",
|
|
562
|
+
"command": "npx claude-flow hook check-protected --file '${tool.params.file_path}'"
|
|
563
|
+
}
|
|
564
|
+
]
|
|
565
|
+
}
|
|
566
|
+
]
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
```
|
|
570
|
+
|
|
571
|
+
#### Automatic Testing
|
|
572
|
+
|
|
573
|
+
Run tests after file modifications:
|
|
574
|
+
|
|
575
|
+
```json
|
|
576
|
+
{
|
|
577
|
+
"hooks": {
|
|
578
|
+
"PostToolUse": [
|
|
579
|
+
{
|
|
580
|
+
"matcher": "^Write$",
|
|
581
|
+
"hooks": [
|
|
582
|
+
{
|
|
583
|
+
"type": "command",
|
|
584
|
+
"command": "test -f '${tool.params.file_path%.js}.test.js' && npm test '${tool.params.file_path%.js}.test.js'",
|
|
585
|
+
"continueOnError": true
|
|
586
|
+
}
|
|
587
|
+
]
|
|
588
|
+
}
|
|
589
|
+
]
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
```
|
|
593
|
+
|
|
594
|
+
### MCP Tool Integration
|
|
595
|
+
|
|
596
|
+
Hooks automatically integrate with MCP tools for coordination:
|
|
597
|
+
|
|
598
|
+
#### Pre-Task Hook with Agent Spawning
|
|
599
|
+
|
|
600
|
+
```javascript
|
|
601
|
+
// Hook command
|
|
602
|
+
npx claude-flow hook pre-task --description "Build REST API"
|
|
603
|
+
|
|
604
|
+
// Internally calls MCP tools:
|
|
605
|
+
mcp__claude-flow__agent_spawn {
|
|
606
|
+
type: "backend-dev",
|
|
607
|
+
capabilities: ["api", "database", "testing"]
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
mcp__claude-flow__memory_usage {
|
|
611
|
+
action: "store",
|
|
612
|
+
key: "swarm/task/api-build/context",
|
|
613
|
+
namespace: "coordination",
|
|
614
|
+
value: JSON.stringify({
|
|
615
|
+
description: "Build REST API",
|
|
616
|
+
agents: ["backend-dev"],
|
|
617
|
+
started: Date.now()
|
|
618
|
+
})
|
|
619
|
+
}
|
|
620
|
+
```
|
|
621
|
+
|
|
622
|
+
#### Post-Edit Hook with Memory Storage
|
|
623
|
+
|
|
624
|
+
```javascript
|
|
625
|
+
// Hook command
|
|
626
|
+
npx claude-flow hook post-edit --file "api/auth.js"
|
|
627
|
+
|
|
628
|
+
// Internally calls MCP tools:
|
|
629
|
+
mcp__claude-flow__memory_usage {
|
|
630
|
+
action: "store",
|
|
631
|
+
key: "swarm/edits/api/auth.js",
|
|
632
|
+
namespace: "coordination",
|
|
633
|
+
value: JSON.stringify({
|
|
634
|
+
file: "api/auth.js",
|
|
635
|
+
timestamp: Date.now(),
|
|
636
|
+
changes: { added: 45, removed: 12 },
|
|
637
|
+
formatted: true,
|
|
638
|
+
linted: true
|
|
639
|
+
})
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
mcp__claude-flow__neural_train {
|
|
643
|
+
pattern_type: "coordination",
|
|
644
|
+
training_data: { /* edit patterns */ }
|
|
645
|
+
}
|
|
646
|
+
```
|
|
647
|
+
|
|
648
|
+
#### Session End Hook with State Persistence
|
|
649
|
+
|
|
650
|
+
```javascript
|
|
651
|
+
// Hook command
|
|
652
|
+
npx claude-flow hook session-end --session-id "dev-2024"
|
|
653
|
+
|
|
654
|
+
// Internally calls MCP tools:
|
|
655
|
+
mcp__claude-flow__memory_persist {
|
|
656
|
+
sessionId: "dev-2024"
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
mcp__claude-flow__swarm_status {
|
|
660
|
+
swarmId: "current"
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
// Generates metrics and summary
|
|
664
|
+
```
|
|
665
|
+
|
|
666
|
+
### Memory Coordination Protocol
|
|
667
|
+
|
|
668
|
+
All hooks follow a standardized memory coordination pattern:
|
|
669
|
+
|
|
670
|
+
#### Three-Phase Memory Protocol
|
|
671
|
+
|
|
672
|
+
**Phase 1: STATUS** - Hook starts
|
|
673
|
+
```javascript
|
|
674
|
+
mcp__claude-flow__memory_usage {
|
|
675
|
+
action: "store",
|
|
676
|
+
key: "swarm/hooks/pre-edit/status",
|
|
677
|
+
namespace: "coordination",
|
|
678
|
+
value: JSON.stringify({
|
|
679
|
+
status: "running",
|
|
680
|
+
hook: "pre-edit",
|
|
681
|
+
file: "src/auth.js",
|
|
682
|
+
timestamp: Date.now()
|
|
683
|
+
})
|
|
684
|
+
}
|
|
685
|
+
```
|
|
686
|
+
|
|
687
|
+
**Phase 2: PROGRESS** - Hook processes
|
|
688
|
+
```javascript
|
|
689
|
+
mcp__claude-flow__memory_usage {
|
|
690
|
+
action: "store",
|
|
691
|
+
key: "swarm/hooks/pre-edit/progress",
|
|
692
|
+
namespace: "coordination",
|
|
693
|
+
value: JSON.stringify({
|
|
694
|
+
progress: 50,
|
|
695
|
+
action: "validating syntax",
|
|
696
|
+
file: "src/auth.js"
|
|
697
|
+
})
|
|
698
|
+
}
|
|
699
|
+
```
|
|
700
|
+
|
|
701
|
+
**Phase 3: COMPLETE** - Hook finishes
|
|
702
|
+
```javascript
|
|
703
|
+
mcp__claude-flow__memory_usage {
|
|
704
|
+
action: "store",
|
|
705
|
+
key: "swarm/hooks/pre-edit/complete",
|
|
706
|
+
namespace: "coordination",
|
|
707
|
+
value: JSON.stringify({
|
|
708
|
+
status: "complete",
|
|
709
|
+
result: "success",
|
|
710
|
+
agent_assigned: "backend-dev",
|
|
711
|
+
syntax_valid: true,
|
|
712
|
+
backup_created: true
|
|
713
|
+
})
|
|
714
|
+
}
|
|
715
|
+
```
|
|
716
|
+
|
|
717
|
+
### Hook Response Format
|
|
718
|
+
|
|
719
|
+
Hooks return JSON responses to control operation flow:
|
|
720
|
+
|
|
721
|
+
#### Continue Response
|
|
722
|
+
```json
|
|
723
|
+
{
|
|
724
|
+
"continue": true,
|
|
725
|
+
"reason": "All validations passed",
|
|
726
|
+
"metadata": {
|
|
727
|
+
"agent_assigned": "backend-dev",
|
|
728
|
+
"syntax_valid": true,
|
|
729
|
+
"file": "src/auth.js"
|
|
730
|
+
}
|
|
731
|
+
}
|
|
732
|
+
```
|
|
733
|
+
|
|
734
|
+
#### Block Response
|
|
735
|
+
```json
|
|
736
|
+
{
|
|
737
|
+
"continue": false,
|
|
738
|
+
"reason": "Protected file - manual review required",
|
|
739
|
+
"metadata": {
|
|
740
|
+
"file": ".env.production",
|
|
741
|
+
"protection_level": "high",
|
|
742
|
+
"requires": "manual_approval"
|
|
743
|
+
}
|
|
744
|
+
}
|
|
745
|
+
```
|
|
746
|
+
|
|
747
|
+
#### Warning Response
|
|
748
|
+
```json
|
|
749
|
+
{
|
|
750
|
+
"continue": true,
|
|
751
|
+
"reason": "Syntax valid but complexity high",
|
|
752
|
+
"warnings": [
|
|
753
|
+
"Cyclomatic complexity: 15 (threshold: 10)",
|
|
754
|
+
"Consider refactoring for better maintainability"
|
|
755
|
+
],
|
|
756
|
+
"metadata": {
|
|
757
|
+
"complexity": 15,
|
|
758
|
+
"threshold": 10
|
|
759
|
+
}
|
|
760
|
+
}
|
|
761
|
+
```
|
|
762
|
+
|
|
763
|
+
### Git Integration
|
|
764
|
+
|
|
765
|
+
Hooks can integrate with Git operations for quality control:
|
|
766
|
+
|
|
767
|
+
#### Pre-Commit Hook
|
|
768
|
+
```bash
|
|
769
|
+
# Add to .git/hooks/pre-commit or use husky
|
|
770
|
+
|
|
771
|
+
#!/bin/bash
|
|
772
|
+
# Run quality checks before commit
|
|
773
|
+
|
|
774
|
+
# Get staged files
|
|
775
|
+
FILES=$(git diff --cached --name-only --diff-filter=ACM)
|
|
776
|
+
|
|
777
|
+
for FILE in $FILES; do
|
|
778
|
+
# Run pre-edit hook for validation
|
|
779
|
+
npx claude-flow hook pre-edit --file "$FILE" --validate-syntax
|
|
780
|
+
|
|
781
|
+
if [ $? -ne 0 ]; then
|
|
782
|
+
echo "Validation failed for $FILE"
|
|
783
|
+
exit 1
|
|
784
|
+
fi
|
|
785
|
+
|
|
786
|
+
# Run post-edit hook for formatting
|
|
787
|
+
npx claude-flow hook post-edit --file "$FILE" --auto-format
|
|
788
|
+
done
|
|
789
|
+
|
|
790
|
+
# Run tests
|
|
791
|
+
npm test
|
|
792
|
+
|
|
793
|
+
exit $?
|
|
794
|
+
```
|
|
795
|
+
|
|
796
|
+
#### Post-Commit Hook
|
|
797
|
+
```bash
|
|
798
|
+
# Add to .git/hooks/post-commit
|
|
799
|
+
|
|
800
|
+
#!/bin/bash
|
|
801
|
+
# Track commit metrics
|
|
802
|
+
|
|
803
|
+
COMMIT_HASH=$(git rev-parse HEAD)
|
|
804
|
+
COMMIT_MSG=$(git log -1 --pretty=%B)
|
|
805
|
+
|
|
806
|
+
npx claude-flow hook notify \
|
|
807
|
+
--message "Commit completed: $COMMIT_MSG" \
|
|
808
|
+
--level info \
|
|
809
|
+
--swarm-status
|
|
810
|
+
```
|
|
811
|
+
|
|
812
|
+
#### Pre-Push Hook
|
|
813
|
+
```bash
|
|
814
|
+
# Add to .git/hooks/pre-push
|
|
815
|
+
|
|
816
|
+
#!/bin/bash
|
|
817
|
+
# Quality gate before push
|
|
818
|
+
|
|
819
|
+
# Run full test suite
|
|
820
|
+
npm run test:all
|
|
821
|
+
|
|
822
|
+
# Run quality checks
|
|
823
|
+
npx claude-flow hook session-end \
|
|
824
|
+
--generate-report \
|
|
825
|
+
--export-metrics
|
|
826
|
+
|
|
827
|
+
# Verify quality thresholds
|
|
828
|
+
TRUTH_SCORE=$(npx claude-flow metrics score --format json | jq -r '.truth_score')
|
|
829
|
+
|
|
830
|
+
if (( $(echo "$TRUTH_SCORE < 0.95" | bc -l) )); then
|
|
831
|
+
echo "Truth score below threshold: $TRUTH_SCORE < 0.95"
|
|
832
|
+
exit 1
|
|
833
|
+
fi
|
|
834
|
+
|
|
835
|
+
exit 0
|
|
836
|
+
```
|
|
837
|
+
|
|
838
|
+
### Agent Coordination Workflow
|
|
839
|
+
|
|
840
|
+
How agents use hooks for coordination:
|
|
841
|
+
|
|
842
|
+
#### Agent Workflow Example
|
|
843
|
+
|
|
844
|
+
```bash
|
|
845
|
+
# Agent 1: Backend Developer
|
|
846
|
+
# STEP 1: Pre-task preparation
|
|
847
|
+
npx claude-flow hook pre-task \
|
|
848
|
+
--description "Implement user authentication API" \
|
|
849
|
+
--auto-spawn-agents \
|
|
850
|
+
--load-memory
|
|
851
|
+
|
|
852
|
+
# STEP 2: Work begins - pre-edit validation
|
|
853
|
+
npx claude-flow hook pre-edit \
|
|
854
|
+
--file "api/auth.js" \
|
|
855
|
+
--auto-assign-agent \
|
|
856
|
+
--validate-syntax
|
|
857
|
+
|
|
858
|
+
# STEP 3: Edit file (via Claude Code Edit tool)
|
|
859
|
+
# ... code changes ...
|
|
860
|
+
|
|
861
|
+
# STEP 4: Post-edit processing
|
|
862
|
+
npx claude-flow hook post-edit \
|
|
863
|
+
--file "api/auth.js" \
|
|
864
|
+
--memory-key "swarm/backend/auth-api" \
|
|
865
|
+
--auto-format \
|
|
866
|
+
--train-patterns
|
|
867
|
+
|
|
868
|
+
# STEP 5: Notify coordination system
|
|
869
|
+
npx claude-flow hook notify \
|
|
870
|
+
--message "Auth API implementation complete" \
|
|
871
|
+
--swarm-status \
|
|
872
|
+
--broadcast
|
|
873
|
+
|
|
874
|
+
# STEP 6: Task completion
|
|
875
|
+
npx claude-flow hook post-task \
|
|
876
|
+
--task-id "auth-api" \
|
|
877
|
+
--analyze-performance \
|
|
878
|
+
--store-decisions \
|
|
879
|
+
--export-learnings
|
|
880
|
+
```
|
|
881
|
+
|
|
882
|
+
```bash
|
|
883
|
+
# Agent 2: Test Engineer (receives notification)
|
|
884
|
+
# STEP 1: Check memory for API details
|
|
885
|
+
npx claude-flow hook session-restore \
|
|
886
|
+
--session-id "swarm-current" \
|
|
887
|
+
--restore-memory
|
|
888
|
+
|
|
889
|
+
# Memory contains: swarm/backend/auth-api with implementation details
|
|
890
|
+
|
|
891
|
+
# STEP 2: Generate tests
|
|
892
|
+
npx claude-flow hook pre-task \
|
|
893
|
+
--description "Write tests for auth API" \
|
|
894
|
+
--load-memory
|
|
895
|
+
|
|
896
|
+
# STEP 3: Create test file
|
|
897
|
+
npx claude-flow hook post-edit \
|
|
898
|
+
--file "api/auth.test.js" \
|
|
899
|
+
--memory-key "swarm/testing/auth-api-tests" \
|
|
900
|
+
--train-patterns
|
|
901
|
+
|
|
902
|
+
# STEP 4: Share test results
|
|
903
|
+
npx claude-flow hook notify \
|
|
904
|
+
--message "Auth API tests complete - 100% coverage" \
|
|
905
|
+
--broadcast
|
|
906
|
+
```
|
|
907
|
+
|
|
908
|
+
### Custom Hook Creation
|
|
909
|
+
|
|
910
|
+
Create custom hooks for specific workflows:
|
|
911
|
+
|
|
912
|
+
#### Custom Hook Template
|
|
913
|
+
|
|
914
|
+
```javascript
|
|
915
|
+
// .claude/hooks/custom-quality-check.js
|
|
916
|
+
|
|
917
|
+
module.exports = {
|
|
918
|
+
name: 'custom-quality-check',
|
|
919
|
+
type: 'pre',
|
|
920
|
+
matcher: /\.(ts|js)$/,
|
|
921
|
+
|
|
922
|
+
async execute(context) {
|
|
923
|
+
const { file, content } = context;
|
|
924
|
+
|
|
925
|
+
// Custom validation logic
|
|
926
|
+
const complexity = await analyzeComplexity(content);
|
|
927
|
+
const securityIssues = await scanSecurity(content);
|
|
928
|
+
|
|
929
|
+
// Store in memory
|
|
930
|
+
await storeInMemory({
|
|
931
|
+
key: `quality/${file}`,
|
|
932
|
+
value: { complexity, securityIssues }
|
|
933
|
+
});
|
|
934
|
+
|
|
935
|
+
// Return decision
|
|
936
|
+
if (complexity > 15 || securityIssues.length > 0) {
|
|
937
|
+
return {
|
|
938
|
+
continue: false,
|
|
939
|
+
reason: 'Quality checks failed',
|
|
940
|
+
warnings: [
|
|
941
|
+
`Complexity: ${complexity} (max: 15)`,
|
|
942
|
+
`Security issues: ${securityIssues.length}`
|
|
943
|
+
]
|
|
944
|
+
};
|
|
945
|
+
}
|
|
946
|
+
|
|
947
|
+
return {
|
|
948
|
+
continue: true,
|
|
949
|
+
reason: 'Quality checks passed',
|
|
950
|
+
metadata: { complexity, securityIssues: 0 }
|
|
951
|
+
};
|
|
952
|
+
}
|
|
953
|
+
};
|
|
954
|
+
```
|
|
955
|
+
|
|
956
|
+
#### Register Custom Hook
|
|
957
|
+
|
|
958
|
+
```json
|
|
959
|
+
{
|
|
960
|
+
"hooks": {
|
|
961
|
+
"PreToolUse": [
|
|
962
|
+
{
|
|
963
|
+
"matcher": "^(Write|Edit)$",
|
|
964
|
+
"hooks": [
|
|
965
|
+
{
|
|
966
|
+
"type": "script",
|
|
967
|
+
"script": ".claude/hooks/custom-quality-check.js"
|
|
968
|
+
}
|
|
969
|
+
]
|
|
970
|
+
}
|
|
971
|
+
]
|
|
972
|
+
}
|
|
973
|
+
}
|
|
974
|
+
```
|
|
975
|
+
|
|
976
|
+
### Real-World Examples
|
|
977
|
+
|
|
978
|
+
#### Example 1: Full-Stack Development Workflow
|
|
979
|
+
|
|
980
|
+
```bash
|
|
981
|
+
# Session start - initialize coordination
|
|
982
|
+
npx claude-flow hook session-start --session-id "fullstack-feature"
|
|
983
|
+
|
|
984
|
+
# Pre-task planning
|
|
985
|
+
npx claude-flow hook pre-task \
|
|
986
|
+
--description "Build user profile feature - frontend + backend + tests" \
|
|
987
|
+
--auto-spawn-agents \
|
|
988
|
+
--optimize-topology
|
|
989
|
+
|
|
990
|
+
# Backend work
|
|
991
|
+
npx claude-flow hook pre-edit --file "api/profile.js"
|
|
992
|
+
# ... implement backend ...
|
|
993
|
+
npx claude-flow hook post-edit \
|
|
994
|
+
--file "api/profile.js" \
|
|
995
|
+
--memory-key "profile/backend" \
|
|
996
|
+
--train-patterns
|
|
997
|
+
|
|
998
|
+
# Frontend work (reads backend details from memory)
|
|
999
|
+
npx claude-flow hook pre-edit --file "components/Profile.jsx"
|
|
1000
|
+
# ... implement frontend ...
|
|
1001
|
+
npx claude-flow hook post-edit \
|
|
1002
|
+
--file "components/Profile.jsx" \
|
|
1003
|
+
--memory-key "profile/frontend" \
|
|
1004
|
+
--train-patterns
|
|
1005
|
+
|
|
1006
|
+
# Testing (reads both backend and frontend from memory)
|
|
1007
|
+
npx claude-flow hook pre-task \
|
|
1008
|
+
--description "Test profile feature" \
|
|
1009
|
+
--load-memory
|
|
1010
|
+
|
|
1011
|
+
# Session end - export everything
|
|
1012
|
+
npx claude-flow hook session-end \
|
|
1013
|
+
--session-id "fullstack-feature" \
|
|
1014
|
+
--export-metrics \
|
|
1015
|
+
--generate-summary
|
|
1016
|
+
```
|
|
1017
|
+
|
|
1018
|
+
#### Example 2: Debugging with Hooks
|
|
1019
|
+
|
|
1020
|
+
```bash
|
|
1021
|
+
# Start debugging session
|
|
1022
|
+
npx claude-flow hook session-start --session-id "debug-memory-leak"
|
|
1023
|
+
|
|
1024
|
+
# Pre-task: analyze issue
|
|
1025
|
+
npx claude-flow hook pre-task \
|
|
1026
|
+
--description "Debug memory leak in event handlers" \
|
|
1027
|
+
--load-memory \
|
|
1028
|
+
--estimate-complexity
|
|
1029
|
+
|
|
1030
|
+
# Search for event emitters
|
|
1031
|
+
npx claude-flow hook pre-search --query "EventEmitter"
|
|
1032
|
+
# ... search executes ...
|
|
1033
|
+
npx claude-flow hook post-search \
|
|
1034
|
+
--query "EventEmitter" \
|
|
1035
|
+
--cache-results
|
|
1036
|
+
|
|
1037
|
+
# Fix the issue
|
|
1038
|
+
npx claude-flow hook pre-edit \
|
|
1039
|
+
--file "services/events.js" \
|
|
1040
|
+
--backup-file
|
|
1041
|
+
# ... fix code ...
|
|
1042
|
+
npx claude-flow hook post-edit \
|
|
1043
|
+
--file "services/events.js" \
|
|
1044
|
+
--memory-key "debug/memory-leak-fix" \
|
|
1045
|
+
--validate-output
|
|
1046
|
+
|
|
1047
|
+
# Verify fix
|
|
1048
|
+
npx claude-flow hook post-task \
|
|
1049
|
+
--task-id "memory-leak-fix" \
|
|
1050
|
+
--analyze-performance \
|
|
1051
|
+
--generate-report
|
|
1052
|
+
|
|
1053
|
+
# End session
|
|
1054
|
+
npx claude-flow hook session-end \
|
|
1055
|
+
--session-id "debug-memory-leak" \
|
|
1056
|
+
--export-metrics
|
|
1057
|
+
```
|
|
1058
|
+
|
|
1059
|
+
#### Example 3: Multi-Agent Refactoring
|
|
1060
|
+
|
|
1061
|
+
```bash
|
|
1062
|
+
# Initialize swarm for refactoring
|
|
1063
|
+
npx claude-flow hook pre-task \
|
|
1064
|
+
--description "Refactor legacy codebase to modern patterns" \
|
|
1065
|
+
--auto-spawn-agents \
|
|
1066
|
+
--optimize-topology
|
|
1067
|
+
|
|
1068
|
+
# Agent 1: Code Analyzer
|
|
1069
|
+
npx claude-flow hook pre-task --description "Analyze code complexity"
|
|
1070
|
+
# ... analysis ...
|
|
1071
|
+
npx claude-flow hook post-task \
|
|
1072
|
+
--task-id "analysis" \
|
|
1073
|
+
--store-decisions
|
|
1074
|
+
|
|
1075
|
+
# Agent 2: Refactoring (reads analysis from memory)
|
|
1076
|
+
npx claude-flow hook session-restore \
|
|
1077
|
+
--session-id "swarm-refactor" \
|
|
1078
|
+
--restore-memory
|
|
1079
|
+
|
|
1080
|
+
for file in src/**/*.js; do
|
|
1081
|
+
npx claude-flow hook pre-edit --file "$file" --backup-file
|
|
1082
|
+
# ... refactor ...
|
|
1083
|
+
npx claude-flow hook post-edit \
|
|
1084
|
+
--file "$file" \
|
|
1085
|
+
--memory-key "refactor/$file" \
|
|
1086
|
+
--auto-format \
|
|
1087
|
+
--train-patterns
|
|
1088
|
+
done
|
|
1089
|
+
|
|
1090
|
+
# Agent 3: Testing (reads refactored code from memory)
|
|
1091
|
+
npx claude-flow hook pre-task \
|
|
1092
|
+
--description "Generate tests for refactored code" \
|
|
1093
|
+
--load-memory
|
|
1094
|
+
|
|
1095
|
+
# Broadcast completion
|
|
1096
|
+
npx claude-flow hook notify \
|
|
1097
|
+
--message "Refactoring complete - all tests passing" \
|
|
1098
|
+
--broadcast
|
|
1099
|
+
```
|
|
1100
|
+
|
|
1101
|
+
### Performance Tips
|
|
1102
|
+
|
|
1103
|
+
1. **Keep Hooks Lightweight** - Target < 100ms execution time
|
|
1104
|
+
2. **Use Async for Heavy Operations** - Don't block the main flow
|
|
1105
|
+
3. **Cache Aggressively** - Store frequently accessed data
|
|
1106
|
+
4. **Batch Related Operations** - Combine multiple actions
|
|
1107
|
+
5. **Use Memory Wisely** - Set appropriate TTLs
|
|
1108
|
+
6. **Monitor Hook Performance** - Track execution times
|
|
1109
|
+
7. **Parallelize When Possible** - Run independent hooks concurrently
|
|
1110
|
+
|
|
1111
|
+
### Debugging Hooks
|
|
1112
|
+
|
|
1113
|
+
Enable debug mode for troubleshooting:
|
|
1114
|
+
|
|
1115
|
+
```bash
|
|
1116
|
+
# Enable debug output
|
|
1117
|
+
export CLAUDE_FLOW_DEBUG=true
|
|
1118
|
+
|
|
1119
|
+
# Test specific hook with verbose output
|
|
1120
|
+
npx claude-flow hook pre-edit --file "test.js" --debug
|
|
1121
|
+
|
|
1122
|
+
# Check hook execution logs
|
|
1123
|
+
cat .claude-flow/logs/hooks-$(date +%Y-%m-%d).log
|
|
1124
|
+
|
|
1125
|
+
# Validate configuration
|
|
1126
|
+
npx claude-flow hook validate-config
|
|
1127
|
+
```
|
|
1128
|
+
|
|
1129
|
+
### Benefits
|
|
1130
|
+
|
|
1131
|
+
- **Automatic Agent Assignment**: Right agent for every file type
|
|
1132
|
+
- **Consistent Code Formatting**: Language-specific formatters
|
|
1133
|
+
- **Continuous Learning**: Neural patterns improve over time
|
|
1134
|
+
- **Cross-Session Memory**: Context persists between sessions
|
|
1135
|
+
- **Performance Tracking**: Comprehensive metrics and analytics
|
|
1136
|
+
- **Automatic Coordination**: Agents sync via memory
|
|
1137
|
+
- **Smart Agent Spawning**: Task-based agent selection
|
|
1138
|
+
- **Quality Gates**: Pre-commit validation and verification
|
|
1139
|
+
- **Error Prevention**: Syntax validation before edits
|
|
1140
|
+
- **Knowledge Sharing**: Decisions stored and shared
|
|
1141
|
+
- **Reduced Manual Work**: Automation of repetitive tasks
|
|
1142
|
+
- **Better Collaboration**: Seamless multi-agent coordination
|
|
1143
|
+
|
|
1144
|
+
### Best Practices
|
|
1145
|
+
|
|
1146
|
+
1. **Configure Hooks Early** - Set up during project initialization
|
|
1147
|
+
2. **Use Memory Keys Strategically** - Organize with clear namespaces
|
|
1148
|
+
3. **Enable Auto-Formatting** - Maintain code consistency
|
|
1149
|
+
4. **Train Patterns Continuously** - Learn from successful operations
|
|
1150
|
+
5. **Monitor Performance** - Track hook execution times
|
|
1151
|
+
6. **Validate Configuration** - Test hooks before production use
|
|
1152
|
+
7. **Document Custom Hooks** - Maintain hook documentation
|
|
1153
|
+
8. **Set Appropriate Timeouts** - Prevent hanging operations
|
|
1154
|
+
9. **Handle Errors Gracefully** - Use continueOnError when appropriate
|
|
1155
|
+
10. **Review Metrics Regularly** - Optimize based on usage patterns
|
|
1156
|
+
|
|
1157
|
+
### Troubleshooting
|
|
1158
|
+
|
|
1159
|
+
#### Hooks Not Executing
|
|
1160
|
+
- Verify `.claude/settings.json` syntax
|
|
1161
|
+
- Check hook matcher patterns
|
|
1162
|
+
- Enable debug mode
|
|
1163
|
+
- Review permission settings
|
|
1164
|
+
- Ensure claude-flow CLI is in PATH
|
|
1165
|
+
|
|
1166
|
+
#### Hook Timeouts
|
|
1167
|
+
- Increase timeout values in configuration
|
|
1168
|
+
- Make hooks asynchronous for heavy operations
|
|
1169
|
+
- Optimize hook logic
|
|
1170
|
+
- Check network connectivity for MCP tools
|
|
1171
|
+
|
|
1172
|
+
#### Memory Issues
|
|
1173
|
+
- Set appropriate TTLs for memory keys
|
|
1174
|
+
- Clean up old memory entries
|
|
1175
|
+
- Use memory namespaces effectively
|
|
1176
|
+
- Monitor memory usage
|
|
1177
|
+
|
|
1178
|
+
#### Performance Problems
|
|
1179
|
+
- Profile hook execution times
|
|
1180
|
+
- Use caching for repeated operations
|
|
1181
|
+
- Batch operations when possible
|
|
1182
|
+
- Reduce hook complexity
|
|
1183
|
+
|
|
1184
|
+
### Related Commands
|
|
1185
|
+
|
|
1186
|
+
- `npx claude-flow init --hooks` - Initialize hooks system
|
|
1187
|
+
- `npx claude-flow hook --list` - List available hooks
|
|
1188
|
+
- `npx claude-flow hook --test <hook>` - Test specific hook
|
|
1189
|
+
- `npx claude-flow memory usage` - Manage memory
|
|
1190
|
+
- `npx claude-flow agent spawn` - Spawn agents
|
|
1191
|
+
- `npx claude-flow swarm init` - Initialize swarm
|
|
1192
|
+
|
|
1193
|
+
### Integration with Other Skills
|
|
1194
|
+
|
|
1195
|
+
This skill works seamlessly with:
|
|
1196
|
+
- **SPARC Methodology** - Hooks enhance SPARC workflows
|
|
1197
|
+
- **Pair Programming** - Automated quality in pairing sessions
|
|
1198
|
+
- **Verification Quality** - Truth-score validation in hooks
|
|
1199
|
+
- **GitHub Workflows** - Git integration for commits/PRs
|
|
1200
|
+
- **Performance Analysis** - Metrics collection in hooks
|
|
1201
|
+
- **Swarm Advanced** - Multi-agent coordination via hooks
|