claude-mpm 3.9.9__py3-none-any.whl → 4.0.3__py3-none-any.whl
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.
- claude_mpm/VERSION +1 -1
- claude_mpm/__init__.py +2 -2
- claude_mpm/__main__.py +3 -2
- claude_mpm/agents/__init__.py +85 -79
- claude_mpm/agents/agent_loader.py +464 -1003
- claude_mpm/agents/agent_loader_integration.py +45 -45
- claude_mpm/agents/agents_metadata.py +29 -30
- claude_mpm/agents/async_agent_loader.py +156 -138
- claude_mpm/agents/base_agent.json +1 -1
- claude_mpm/agents/base_agent_loader.py +179 -151
- claude_mpm/agents/frontmatter_validator.py +229 -130
- claude_mpm/agents/schema/agent_schema.json +1 -1
- claude_mpm/agents/system_agent_config.py +213 -147
- claude_mpm/agents/templates/__init__.py +13 -13
- claude_mpm/agents/templates/code_analyzer.json +2 -2
- claude_mpm/agents/templates/data_engineer.json +1 -1
- claude_mpm/agents/templates/documentation.json +23 -11
- claude_mpm/agents/templates/engineer.json +22 -6
- claude_mpm/agents/templates/memory_manager.json +155 -0
- claude_mpm/agents/templates/ops.json +2 -2
- claude_mpm/agents/templates/project_organizer.json +1 -1
- claude_mpm/agents/templates/qa.json +1 -1
- claude_mpm/agents/templates/refactoring_engineer.json +222 -0
- claude_mpm/agents/templates/research.json +20 -14
- claude_mpm/agents/templates/security.json +1 -1
- claude_mpm/agents/templates/ticketing.json +1 -1
- claude_mpm/agents/templates/version_control.json +1 -1
- claude_mpm/agents/templates/web_qa.json +3 -1
- claude_mpm/agents/templates/web_ui.json +2 -2
- claude_mpm/cli/__init__.py +90 -49
- claude_mpm/cli/__main__.py +3 -2
- claude_mpm/cli/commands/__init__.py +21 -18
- claude_mpm/cli/commands/agents.py +279 -247
- claude_mpm/cli/commands/aggregate.py +138 -157
- claude_mpm/cli/commands/cleanup.py +147 -147
- claude_mpm/cli/commands/config.py +93 -76
- claude_mpm/cli/commands/info.py +17 -16
- claude_mpm/cli/commands/mcp.py +143 -762
- claude_mpm/cli/commands/mcp_command_router.py +139 -0
- claude_mpm/cli/commands/mcp_config_commands.py +20 -0
- claude_mpm/cli/commands/mcp_install_commands.py +20 -0
- claude_mpm/cli/commands/mcp_server_commands.py +175 -0
- claude_mpm/cli/commands/mcp_tool_commands.py +34 -0
- claude_mpm/cli/commands/memory.py +239 -203
- claude_mpm/cli/commands/monitor.py +203 -81
- claude_mpm/cli/commands/run.py +380 -429
- claude_mpm/cli/commands/run_config_checker.py +160 -0
- claude_mpm/cli/commands/socketio_monitor.py +235 -0
- claude_mpm/cli/commands/tickets.py +305 -197
- claude_mpm/cli/parser.py +24 -1150
- claude_mpm/cli/parsers/__init__.py +29 -0
- claude_mpm/cli/parsers/agents_parser.py +136 -0
- claude_mpm/cli/parsers/base_parser.py +331 -0
- claude_mpm/cli/parsers/config_parser.py +85 -0
- claude_mpm/cli/parsers/mcp_parser.py +152 -0
- claude_mpm/cli/parsers/memory_parser.py +138 -0
- claude_mpm/cli/parsers/monitor_parser.py +104 -0
- claude_mpm/cli/parsers/run_parser.py +147 -0
- claude_mpm/cli/parsers/tickets_parser.py +203 -0
- claude_mpm/cli/ticket_cli.py +7 -3
- claude_mpm/cli/utils.py +55 -37
- claude_mpm/cli_module/__init__.py +6 -6
- claude_mpm/cli_module/args.py +188 -140
- claude_mpm/cli_module/commands.py +79 -70
- claude_mpm/cli_module/migration_example.py +38 -60
- claude_mpm/config/__init__.py +32 -25
- claude_mpm/config/agent_config.py +151 -119
- claude_mpm/config/experimental_features.py +217 -0
- claude_mpm/config/paths.py +94 -208
- claude_mpm/config/socketio_config.py +84 -73
- claude_mpm/constants.py +36 -18
- claude_mpm/core/__init__.py +9 -6
- claude_mpm/core/agent_name_normalizer.py +68 -71
- claude_mpm/core/agent_registry.py +372 -521
- claude_mpm/core/agent_session_manager.py +74 -63
- claude_mpm/core/base_service.py +116 -87
- claude_mpm/core/cache.py +119 -153
- claude_mpm/core/claude_runner.py +425 -1120
- claude_mpm/core/config.py +263 -168
- claude_mpm/core/config_aliases.py +69 -61
- claude_mpm/core/config_constants.py +292 -0
- claude_mpm/core/constants.py +57 -99
- claude_mpm/core/container.py +211 -178
- claude_mpm/core/exceptions.py +233 -89
- claude_mpm/core/factories.py +92 -54
- claude_mpm/core/framework_loader.py +378 -220
- claude_mpm/core/hook_manager.py +198 -83
- claude_mpm/core/hook_performance_config.py +136 -0
- claude_mpm/core/injectable_service.py +61 -55
- claude_mpm/core/interactive_session.py +165 -155
- claude_mpm/core/interfaces.py +221 -195
- claude_mpm/core/lazy.py +96 -96
- claude_mpm/core/logger.py +133 -107
- claude_mpm/core/logging_config.py +185 -157
- claude_mpm/core/minimal_framework_loader.py +20 -15
- claude_mpm/core/mixins.py +30 -29
- claude_mpm/core/oneshot_session.py +215 -181
- claude_mpm/core/optimized_agent_loader.py +134 -138
- claude_mpm/core/optimized_startup.py +159 -157
- claude_mpm/core/pm_hook_interceptor.py +85 -72
- claude_mpm/core/service_registry.py +103 -101
- claude_mpm/core/session_manager.py +97 -87
- claude_mpm/core/socketio_pool.py +212 -158
- claude_mpm/core/tool_access_control.py +58 -51
- claude_mpm/core/types.py +46 -24
- claude_mpm/core/typing_utils.py +166 -82
- claude_mpm/core/unified_agent_registry.py +721 -0
- claude_mpm/core/unified_config.py +550 -0
- claude_mpm/core/unified_paths.py +549 -0
- claude_mpm/dashboard/index.html +1 -1
- claude_mpm/dashboard/open_dashboard.py +51 -17
- claude_mpm/dashboard/static/css/dashboard.css +27 -8
- claude_mpm/dashboard/static/dist/components/agent-inference.js +2 -0
- claude_mpm/dashboard/static/dist/components/event-processor.js +2 -0
- claude_mpm/dashboard/static/dist/components/event-viewer.js +2 -0
- claude_mpm/dashboard/static/dist/components/export-manager.js +2 -0
- claude_mpm/dashboard/static/dist/components/file-tool-tracker.js +2 -0
- claude_mpm/dashboard/static/dist/components/hud-library-loader.js +2 -0
- claude_mpm/dashboard/static/dist/components/hud-manager.js +2 -0
- claude_mpm/dashboard/static/dist/components/hud-visualizer.js +2 -0
- claude_mpm/dashboard/static/dist/components/module-viewer.js +2 -0
- claude_mpm/dashboard/static/dist/components/session-manager.js +2 -0
- claude_mpm/dashboard/static/dist/components/socket-manager.js +2 -0
- claude_mpm/dashboard/static/dist/components/ui-state-manager.js +2 -0
- claude_mpm/dashboard/static/dist/components/working-directory.js +2 -0
- claude_mpm/dashboard/static/dist/dashboard.js +2 -0
- claude_mpm/dashboard/static/dist/socket-client.js +2 -0
- claude_mpm/dashboard/static/js/components/agent-inference.js +80 -76
- claude_mpm/dashboard/static/js/components/event-processor.js +71 -67
- claude_mpm/dashboard/static/js/components/event-viewer.js +74 -70
- claude_mpm/dashboard/static/js/components/export-manager.js +31 -28
- claude_mpm/dashboard/static/js/components/file-tool-tracker.js +106 -92
- claude_mpm/dashboard/static/js/components/hud-library-loader.js +11 -11
- claude_mpm/dashboard/static/js/components/hud-manager.js +73 -73
- claude_mpm/dashboard/static/js/components/hud-visualizer.js +163 -163
- claude_mpm/dashboard/static/js/components/module-viewer.js +305 -233
- claude_mpm/dashboard/static/js/components/session-manager.js +32 -29
- claude_mpm/dashboard/static/js/components/socket-manager.js +27 -20
- claude_mpm/dashboard/static/js/components/ui-state-manager.js +21 -18
- claude_mpm/dashboard/static/js/components/working-directory.js +74 -71
- claude_mpm/dashboard/static/js/dashboard.js +178 -453
- claude_mpm/dashboard/static/js/extension-error-handler.js +164 -0
- claude_mpm/dashboard/static/js/socket-client.js +120 -54
- claude_mpm/dashboard/templates/index.html +40 -50
- claude_mpm/experimental/cli_enhancements.py +60 -58
- claude_mpm/generators/__init__.py +1 -1
- claude_mpm/generators/agent_profile_generator.py +75 -65
- claude_mpm/hooks/__init__.py +1 -1
- claude_mpm/hooks/base_hook.py +33 -28
- claude_mpm/hooks/claude_hooks/__init__.py +1 -1
- claude_mpm/hooks/claude_hooks/connection_pool.py +120 -0
- claude_mpm/hooks/claude_hooks/event_handlers.py +743 -0
- claude_mpm/hooks/claude_hooks/hook_handler.py +415 -1331
- claude_mpm/hooks/claude_hooks/hook_wrapper.sh +4 -4
- claude_mpm/hooks/claude_hooks/memory_integration.py +221 -0
- claude_mpm/hooks/claude_hooks/response_tracking.py +348 -0
- claude_mpm/hooks/claude_hooks/tool_analysis.py +230 -0
- claude_mpm/hooks/memory_integration_hook.py +140 -100
- claude_mpm/hooks/tool_call_interceptor.py +89 -76
- claude_mpm/hooks/validation_hooks.py +57 -49
- claude_mpm/init.py +145 -121
- claude_mpm/models/__init__.py +9 -9
- claude_mpm/models/agent_definition.py +33 -23
- claude_mpm/models/agent_session.py +228 -200
- claude_mpm/scripts/__init__.py +1 -1
- claude_mpm/scripts/socketio_daemon.py +192 -75
- claude_mpm/scripts/socketio_server_manager.py +328 -0
- claude_mpm/scripts/start_activity_logging.py +25 -22
- claude_mpm/services/__init__.py +68 -43
- claude_mpm/services/agent_capabilities_service.py +271 -0
- claude_mpm/services/agents/__init__.py +23 -32
- claude_mpm/services/agents/deployment/__init__.py +3 -3
- claude_mpm/services/agents/deployment/agent_config_provider.py +310 -0
- claude_mpm/services/agents/deployment/agent_configuration_manager.py +359 -0
- claude_mpm/services/agents/deployment/agent_definition_factory.py +84 -0
- claude_mpm/services/agents/deployment/agent_deployment.py +415 -2113
- claude_mpm/services/agents/deployment/agent_discovery_service.py +387 -0
- claude_mpm/services/agents/deployment/agent_environment_manager.py +293 -0
- claude_mpm/services/agents/deployment/agent_filesystem_manager.py +387 -0
- claude_mpm/services/agents/deployment/agent_format_converter.py +453 -0
- claude_mpm/services/agents/deployment/agent_frontmatter_validator.py +161 -0
- claude_mpm/services/agents/deployment/agent_lifecycle_manager.py +345 -495
- claude_mpm/services/agents/deployment/agent_metrics_collector.py +279 -0
- claude_mpm/services/agents/deployment/agent_restore_handler.py +88 -0
- claude_mpm/services/agents/deployment/agent_template_builder.py +406 -0
- claude_mpm/services/agents/deployment/agent_validator.py +352 -0
- claude_mpm/services/agents/deployment/agent_version_manager.py +313 -0
- claude_mpm/services/agents/deployment/agent_versioning.py +6 -9
- claude_mpm/services/agents/deployment/agents_directory_resolver.py +79 -0
- claude_mpm/services/agents/deployment/async_agent_deployment.py +298 -234
- claude_mpm/services/agents/deployment/config/__init__.py +13 -0
- claude_mpm/services/agents/deployment/config/deployment_config.py +182 -0
- claude_mpm/services/agents/deployment/config/deployment_config_manager.py +200 -0
- claude_mpm/services/agents/deployment/deployment_config_loader.py +54 -0
- claude_mpm/services/agents/deployment/deployment_type_detector.py +124 -0
- claude_mpm/services/agents/deployment/facade/__init__.py +18 -0
- claude_mpm/services/agents/deployment/facade/async_deployment_executor.py +159 -0
- claude_mpm/services/agents/deployment/facade/deployment_executor.py +73 -0
- claude_mpm/services/agents/deployment/facade/deployment_facade.py +270 -0
- claude_mpm/services/agents/deployment/facade/sync_deployment_executor.py +178 -0
- claude_mpm/services/agents/deployment/interface_adapter.py +227 -0
- claude_mpm/services/agents/deployment/lifecycle_health_checker.py +85 -0
- claude_mpm/services/agents/deployment/lifecycle_performance_tracker.py +100 -0
- claude_mpm/services/agents/deployment/pipeline/__init__.py +32 -0
- claude_mpm/services/agents/deployment/pipeline/pipeline_builder.py +158 -0
- claude_mpm/services/agents/deployment/pipeline/pipeline_context.py +159 -0
- claude_mpm/services/agents/deployment/pipeline/pipeline_executor.py +169 -0
- claude_mpm/services/agents/deployment/pipeline/steps/__init__.py +19 -0
- claude_mpm/services/agents/deployment/pipeline/steps/agent_processing_step.py +195 -0
- claude_mpm/services/agents/deployment/pipeline/steps/base_step.py +119 -0
- claude_mpm/services/agents/deployment/pipeline/steps/configuration_step.py +79 -0
- claude_mpm/services/agents/deployment/pipeline/steps/target_directory_step.py +90 -0
- claude_mpm/services/agents/deployment/pipeline/steps/validation_step.py +100 -0
- claude_mpm/services/agents/deployment/processors/__init__.py +15 -0
- claude_mpm/services/agents/deployment/processors/agent_deployment_context.py +98 -0
- claude_mpm/services/agents/deployment/processors/agent_deployment_result.py +235 -0
- claude_mpm/services/agents/deployment/processors/agent_processor.py +258 -0
- claude_mpm/services/agents/deployment/refactored_agent_deployment_service.py +318 -0
- claude_mpm/services/agents/deployment/results/__init__.py +13 -0
- claude_mpm/services/agents/deployment/results/deployment_metrics.py +200 -0
- claude_mpm/services/agents/deployment/results/deployment_result_builder.py +249 -0
- claude_mpm/services/agents/deployment/strategies/__init__.py +25 -0
- claude_mpm/services/agents/deployment/strategies/base_strategy.py +119 -0
- claude_mpm/services/agents/deployment/strategies/project_strategy.py +150 -0
- claude_mpm/services/agents/deployment/strategies/strategy_selector.py +117 -0
- claude_mpm/services/agents/deployment/strategies/system_strategy.py +116 -0
- claude_mpm/services/agents/deployment/strategies/user_strategy.py +137 -0
- claude_mpm/services/agents/deployment/system_instructions_deployer.py +108 -0
- claude_mpm/services/agents/deployment/validation/__init__.py +19 -0
- claude_mpm/services/agents/deployment/validation/agent_validator.py +323 -0
- claude_mpm/services/agents/deployment/validation/deployment_validator.py +238 -0
- claude_mpm/services/agents/deployment/validation/template_validator.py +299 -0
- claude_mpm/services/agents/deployment/validation/validation_result.py +226 -0
- claude_mpm/services/agents/loading/__init__.py +2 -2
- claude_mpm/services/agents/loading/agent_profile_loader.py +259 -229
- claude_mpm/services/agents/loading/base_agent_manager.py +90 -81
- claude_mpm/services/agents/loading/framework_agent_loader.py +154 -129
- claude_mpm/services/agents/management/__init__.py +2 -2
- claude_mpm/services/agents/management/agent_capabilities_generator.py +72 -58
- claude_mpm/services/agents/management/agent_management_service.py +209 -156
- claude_mpm/services/agents/memory/__init__.py +9 -6
- claude_mpm/services/agents/memory/agent_memory_manager.py +218 -1152
- claude_mpm/services/agents/memory/agent_persistence_service.py +20 -16
- claude_mpm/services/agents/memory/analyzer.py +430 -0
- claude_mpm/services/agents/memory/content_manager.py +376 -0
- claude_mpm/services/agents/memory/template_generator.py +468 -0
- claude_mpm/services/agents/registry/__init__.py +7 -10
- claude_mpm/services/agents/registry/deployed_agent_discovery.py +122 -97
- claude_mpm/services/agents/registry/modification_tracker.py +351 -285
- claude_mpm/services/async_session_logger.py +187 -153
- claude_mpm/services/claude_session_logger.py +87 -72
- claude_mpm/services/command_handler_service.py +217 -0
- claude_mpm/services/communication/__init__.py +3 -2
- claude_mpm/services/core/__init__.py +50 -97
- claude_mpm/services/core/base.py +60 -53
- claude_mpm/services/core/interfaces/__init__.py +188 -0
- claude_mpm/services/core/interfaces/agent.py +351 -0
- claude_mpm/services/core/interfaces/communication.py +343 -0
- claude_mpm/services/core/interfaces/infrastructure.py +413 -0
- claude_mpm/services/core/interfaces/service.py +434 -0
- claude_mpm/services/core/interfaces.py +19 -944
- claude_mpm/services/event_aggregator.py +208 -170
- claude_mpm/services/exceptions.py +387 -308
- claude_mpm/services/framework_claude_md_generator/__init__.py +75 -79
- claude_mpm/services/framework_claude_md_generator/content_assembler.py +69 -60
- claude_mpm/services/framework_claude_md_generator/content_validator.py +65 -61
- claude_mpm/services/framework_claude_md_generator/deployment_manager.py +68 -49
- claude_mpm/services/framework_claude_md_generator/section_generators/__init__.py +34 -34
- claude_mpm/services/framework_claude_md_generator/section_generators/agents.py +25 -22
- claude_mpm/services/framework_claude_md_generator/section_generators/claude_pm_init.py +10 -10
- claude_mpm/services/framework_claude_md_generator/section_generators/core_responsibilities.py +4 -3
- claude_mpm/services/framework_claude_md_generator/section_generators/delegation_constraints.py +4 -3
- claude_mpm/services/framework_claude_md_generator/section_generators/environment_config.py +4 -3
- claude_mpm/services/framework_claude_md_generator/section_generators/footer.py +6 -5
- claude_mpm/services/framework_claude_md_generator/section_generators/header.py +8 -7
- claude_mpm/services/framework_claude_md_generator/section_generators/orchestration_principles.py +4 -3
- claude_mpm/services/framework_claude_md_generator/section_generators/role_designation.py +6 -5
- claude_mpm/services/framework_claude_md_generator/section_generators/subprocess_validation.py +9 -8
- claude_mpm/services/framework_claude_md_generator/section_generators/todo_task_tools.py +4 -3
- claude_mpm/services/framework_claude_md_generator/section_generators/troubleshooting.py +5 -4
- claude_mpm/services/framework_claude_md_generator/section_manager.py +28 -27
- claude_mpm/services/framework_claude_md_generator/version_manager.py +30 -28
- claude_mpm/services/hook_service.py +106 -114
- claude_mpm/services/infrastructure/__init__.py +7 -5
- claude_mpm/services/infrastructure/context_preservation.py +571 -0
- claude_mpm/services/infrastructure/daemon_manager.py +279 -0
- claude_mpm/services/infrastructure/logging.py +83 -76
- claude_mpm/services/infrastructure/monitoring.py +547 -404
- claude_mpm/services/mcp_gateway/__init__.py +40 -23
- claude_mpm/services/mcp_gateway/config/__init__.py +2 -2
- claude_mpm/services/mcp_gateway/config/config_loader.py +61 -56
- claude_mpm/services/mcp_gateway/config/config_schema.py +50 -41
- claude_mpm/services/mcp_gateway/config/configuration.py +82 -75
- claude_mpm/services/mcp_gateway/core/__init__.py +14 -21
- claude_mpm/services/mcp_gateway/core/base.py +80 -67
- claude_mpm/services/mcp_gateway/core/exceptions.py +60 -46
- claude_mpm/services/mcp_gateway/core/interfaces.py +97 -93
- claude_mpm/services/mcp_gateway/main.py +307 -127
- claude_mpm/services/mcp_gateway/registry/__init__.py +1 -1
- claude_mpm/services/mcp_gateway/registry/service_registry.py +100 -101
- claude_mpm/services/mcp_gateway/registry/tool_registry.py +135 -126
- claude_mpm/services/mcp_gateway/server/__init__.py +4 -4
- claude_mpm/services/mcp_gateway/server/{mcp_server.py → mcp_gateway.py} +149 -153
- claude_mpm/services/mcp_gateway/server/stdio_handler.py +105 -107
- claude_mpm/services/mcp_gateway/server/stdio_server.py +691 -0
- claude_mpm/services/mcp_gateway/tools/__init__.py +4 -2
- claude_mpm/services/mcp_gateway/tools/base_adapter.py +110 -121
- claude_mpm/services/mcp_gateway/tools/document_summarizer.py +283 -215
- claude_mpm/services/mcp_gateway/tools/hello_world.py +122 -120
- claude_mpm/services/mcp_gateway/tools/ticket_tools.py +652 -0
- claude_mpm/services/mcp_gateway/tools/unified_ticket_tool.py +606 -0
- claude_mpm/services/memory/__init__.py +2 -2
- claude_mpm/services/memory/builder.py +451 -362
- claude_mpm/services/memory/cache/__init__.py +2 -2
- claude_mpm/services/memory/cache/shared_prompt_cache.py +232 -194
- claude_mpm/services/memory/cache/simple_cache.py +107 -93
- claude_mpm/services/memory/indexed_memory.py +195 -193
- claude_mpm/services/memory/optimizer.py +267 -234
- claude_mpm/services/memory/router.py +571 -263
- claude_mpm/services/memory_hook_service.py +237 -0
- claude_mpm/services/port_manager.py +223 -0
- claude_mpm/services/project/__init__.py +3 -3
- claude_mpm/services/project/analyzer.py +451 -305
- claude_mpm/services/project/registry.py +262 -240
- claude_mpm/services/recovery_manager.py +287 -231
- claude_mpm/services/response_tracker.py +87 -67
- claude_mpm/services/runner_configuration_service.py +587 -0
- claude_mpm/services/session_management_service.py +304 -0
- claude_mpm/services/socketio/__init__.py +4 -4
- claude_mpm/services/socketio/client_proxy.py +174 -0
- claude_mpm/services/socketio/handlers/__init__.py +3 -3
- claude_mpm/services/socketio/handlers/base.py +44 -30
- claude_mpm/services/socketio/handlers/connection.py +145 -65
- claude_mpm/services/socketio/handlers/file.py +123 -108
- claude_mpm/services/socketio/handlers/git.py +607 -373
- claude_mpm/services/socketio/handlers/hook.py +170 -0
- claude_mpm/services/socketio/handlers/memory.py +4 -4
- claude_mpm/services/socketio/handlers/project.py +4 -4
- claude_mpm/services/socketio/handlers/registry.py +53 -38
- claude_mpm/services/socketio/server/__init__.py +18 -0
- claude_mpm/services/socketio/server/broadcaster.py +252 -0
- claude_mpm/services/socketio/server/core.py +399 -0
- claude_mpm/services/socketio/server/main.py +323 -0
- claude_mpm/services/socketio_client_manager.py +160 -133
- claude_mpm/services/socketio_server.py +36 -1885
- claude_mpm/services/subprocess_launcher_service.py +316 -0
- claude_mpm/services/system_instructions_service.py +258 -0
- claude_mpm/services/ticket_manager.py +20 -534
- claude_mpm/services/utility_service.py +285 -0
- claude_mpm/services/version_control/__init__.py +18 -21
- claude_mpm/services/version_control/branch_strategy.py +20 -10
- claude_mpm/services/version_control/conflict_resolution.py +37 -13
- claude_mpm/services/version_control/git_operations.py +52 -21
- claude_mpm/services/version_control/semantic_versioning.py +92 -53
- claude_mpm/services/version_control/version_parser.py +145 -125
- claude_mpm/services/version_service.py +270 -0
- claude_mpm/storage/__init__.py +9 -0
- claude_mpm/storage/state_storage.py +552 -0
- claude_mpm/ticket_wrapper.py +2 -2
- claude_mpm/utils/__init__.py +2 -2
- claude_mpm/utils/agent_dependency_loader.py +453 -243
- claude_mpm/utils/config_manager.py +157 -118
- claude_mpm/utils/console.py +1 -1
- claude_mpm/utils/dependency_cache.py +102 -107
- claude_mpm/utils/dependency_manager.py +52 -47
- claude_mpm/utils/dependency_strategies.py +131 -96
- claude_mpm/utils/environment_context.py +110 -102
- claude_mpm/utils/error_handler.py +75 -55
- claude_mpm/utils/file_utils.py +80 -67
- claude_mpm/utils/framework_detection.py +12 -11
- claude_mpm/utils/import_migration_example.py +12 -60
- claude_mpm/utils/imports.py +48 -45
- claude_mpm/utils/path_operations.py +100 -93
- claude_mpm/utils/robust_installer.py +172 -164
- claude_mpm/utils/session_logging.py +30 -23
- claude_mpm/utils/subprocess_utils.py +99 -61
- claude_mpm/validation/__init__.py +1 -1
- claude_mpm/validation/agent_validator.py +151 -111
- claude_mpm/validation/frontmatter_validator.py +92 -71
- {claude_mpm-3.9.9.dist-info → claude_mpm-4.0.3.dist-info}/METADATA +51 -2
- claude_mpm-4.0.3.dist-info/RECORD +402 -0
- {claude_mpm-3.9.9.dist-info → claude_mpm-4.0.3.dist-info}/entry_points.txt +1 -0
- {claude_mpm-3.9.9.dist-info → claude_mpm-4.0.3.dist-info}/licenses/LICENSE +1 -1
- claude_mpm/config/memory_guardian_config.py +0 -325
- claude_mpm/core/config_paths.py +0 -150
- claude_mpm/dashboard/static/js/dashboard-original.js +0 -4134
- claude_mpm/deployment_paths.py +0 -261
- claude_mpm/hooks/claude_hooks/hook_handler_fixed.py +0 -454
- claude_mpm/models/state_models.py +0 -433
- claude_mpm/services/agent/__init__.py +0 -24
- claude_mpm/services/agent/deployment.py +0 -2548
- claude_mpm/services/agent/management.py +0 -598
- claude_mpm/services/agent/registry.py +0 -813
- claude_mpm/services/agents/registry/agent_registry.py +0 -813
- claude_mpm/services/communication/socketio.py +0 -1935
- claude_mpm/services/communication/websocket.py +0 -479
- claude_mpm/services/framework_claude_md_generator.py +0 -624
- claude_mpm/services/health_monitor.py +0 -893
- claude_mpm/services/infrastructure/memory_guardian.py +0 -770
- claude_mpm/services/mcp_gateway/server/mcp_server_simple.py +0 -444
- claude_mpm/services/optimized_hook_service.py +0 -542
- claude_mpm/services/project_analyzer.py +0 -864
- claude_mpm/services/project_registry.py +0 -608
- claude_mpm/services/standalone_socketio_server.py +0 -1300
- claude_mpm/services/ticket_manager_di.py +0 -318
- claude_mpm/services/ticketing_service_original.py +0 -510
- claude_mpm/utils/paths.py +0 -395
- claude_mpm/utils/platform_memory.py +0 -524
- claude_mpm-3.9.9.dist-info/RECORD +0 -293
- {claude_mpm-3.9.9.dist-info → claude_mpm-4.0.3.dist-info}/WHEEL +0 -0
- {claude_mpm-3.9.9.dist-info → claude_mpm-4.0.3.dist-info}/top_level.txt +0 -0
| @@ -21,239 +21,516 @@ users understand why content was assigned to specific agents. | |
| 21 21 | 
             
            """
         | 
| 22 22 |  | 
| 23 23 | 
             
            import re
         | 
| 24 | 
            -
            from typing import Dict, List, Optional, Any, Tuple
         | 
| 25 24 | 
             
            from datetime import datetime
         | 
| 25 | 
            +
            from typing import Any, Dict, List, Optional, Tuple
         | 
| 26 26 |  | 
| 27 | 
            -
            from claude_mpm.core.mixins import LoggerMixin
         | 
| 28 27 | 
             
            from claude_mpm.core.config import Config
         | 
| 28 | 
            +
            from claude_mpm.core.mixins import LoggerMixin
         | 
| 29 29 |  | 
| 30 30 |  | 
| 31 31 | 
             
            class MemoryRouter(LoggerMixin):
         | 
| 32 32 | 
             
                """Routes memory commands to appropriate agents based on content analysis.
         | 
| 33 | 
            -
             | 
| 33 | 
            +
             | 
| 34 34 | 
             
                WHY: Different types of learnings belong to different agents. Engineering
         | 
| 35 35 | 
             
                insights should go to the engineer agent, while research findings should
         | 
| 36 36 | 
             
                go to the research agent. This service provides intelligent routing.
         | 
| 37 | 
            -
             | 
| 37 | 
            +
             | 
| 38 38 | 
             
                DESIGN DECISION: Uses explicit keyword patterns and rules rather than ML
         | 
| 39 39 | 
             
                to ensure predictable, transparent routing decisions that users can understand.
         | 
| 40 40 | 
             
                """
         | 
| 41 | 
            -
             | 
| 41 | 
            +
             | 
| 42 42 | 
             
                # Agent routing patterns - keywords that indicate agent specialization
         | 
| 43 43 | 
             
                AGENT_PATTERNS = {
         | 
| 44 | 
            -
                     | 
| 45 | 
            -
                         | 
| 46 | 
            -
                             | 
| 47 | 
            -
                             | 
| 48 | 
            -
                             | 
| 49 | 
            -
                             | 
| 50 | 
            -
                             | 
| 51 | 
            -
                             | 
| 44 | 
            +
                    "engineer": {
         | 
| 45 | 
            +
                        "keywords": [
         | 
| 46 | 
            +
                            "implementation",
         | 
| 47 | 
            +
                            "code",
         | 
| 48 | 
            +
                            "coding",
         | 
| 49 | 
            +
                            "programming",
         | 
| 50 | 
            +
                            "function",
         | 
| 51 | 
            +
                            "method",
         | 
| 52 | 
            +
                            "class",
         | 
| 53 | 
            +
                            "module",
         | 
| 54 | 
            +
                            "import",
         | 
| 55 | 
            +
                            "dependency",
         | 
| 56 | 
            +
                            "build",
         | 
| 57 | 
            +
                            "compile",
         | 
| 58 | 
            +
                            "deploy",
         | 
| 59 | 
            +
                            "refactor",
         | 
| 60 | 
            +
                            "optimize",
         | 
| 61 | 
            +
                            "performance",
         | 
| 62 | 
            +
                            "algorithm",
         | 
| 63 | 
            +
                            "data structure",
         | 
| 64 | 
            +
                            "design pattern",
         | 
| 65 | 
            +
                            "architecture",
         | 
| 66 | 
            +
                            "api",
         | 
| 67 | 
            +
                            "interface",
         | 
| 68 | 
            +
                            "library",
         | 
| 69 | 
            +
                            "framework",
         | 
| 70 | 
            +
                            "testing",
         | 
| 71 | 
            +
                            "unit test",
         | 
| 72 | 
            +
                            "integration test",
         | 
| 73 | 
            +
                            "debug",
         | 
| 74 | 
            +
                            "error handling",
         | 
| 75 | 
            +
                            "exception",
         | 
| 76 | 
            +
                        ],
         | 
| 77 | 
            +
                        "sections": [
         | 
| 78 | 
            +
                            "Coding Patterns Learned",
         | 
| 79 | 
            +
                            "Implementation Guidelines",
         | 
| 80 | 
            +
                            "Performance Considerations",
         | 
| 81 | 
            +
                            "Integration Points",
         | 
| 52 82 | 
             
                        ],
         | 
| 53 | 
            -
                        'sections': [
         | 
| 54 | 
            -
                            'Coding Patterns Learned', 'Implementation Guidelines', 
         | 
| 55 | 
            -
                            'Performance Considerations', 'Integration Points'
         | 
| 56 | 
            -
                        ]
         | 
| 57 83 | 
             
                    },
         | 
| 58 | 
            -
                     | 
| 59 | 
            -
                         | 
| 60 | 
            -
                             | 
| 61 | 
            -
                             | 
| 62 | 
            -
                             | 
| 63 | 
            -
                             | 
| 64 | 
            -
                             | 
| 84 | 
            +
                    "research": {
         | 
| 85 | 
            +
                        "keywords": [
         | 
| 86 | 
            +
                            "research",
         | 
| 87 | 
            +
                            "analysis",
         | 
| 88 | 
            +
                            "investigate",
         | 
| 89 | 
            +
                            "explore",
         | 
| 90 | 
            +
                            "study",
         | 
| 91 | 
            +
                            "examine",
         | 
| 92 | 
            +
                            "findings",
         | 
| 93 | 
            +
                            "discovery",
         | 
| 94 | 
            +
                            "insights",
         | 
| 95 | 
            +
                            "documentation",
         | 
| 96 | 
            +
                            "specification",
         | 
| 97 | 
            +
                            "requirements",
         | 
| 98 | 
            +
                            "use case",
         | 
| 99 | 
            +
                            "user story",
         | 
| 100 | 
            +
                            "business logic",
         | 
| 101 | 
            +
                            "domain knowledge",
         | 
| 102 | 
            +
                            "best practices",
         | 
| 103 | 
            +
                            "standards",
         | 
| 104 | 
            +
                            "compliance",
         | 
| 105 | 
            +
                            "security",
         | 
| 106 | 
            +
                            "vulnerability",
         | 
| 107 | 
            +
                            "threat",
         | 
| 108 | 
            +
                            "risk",
         | 
| 109 | 
            +
                        ],
         | 
| 110 | 
            +
                        "sections": [
         | 
| 111 | 
            +
                            "Domain-Specific Knowledge",
         | 
| 112 | 
            +
                            "Research Findings",
         | 
| 113 | 
            +
                            "Security Considerations",
         | 
| 114 | 
            +
                            "Compliance Requirements",
         | 
| 65 115 | 
             
                        ],
         | 
| 66 | 
            -
                        'sections': [
         | 
| 67 | 
            -
                            'Domain-Specific Knowledge', 'Research Findings', 
         | 
| 68 | 
            -
                            'Security Considerations', 'Compliance Requirements'
         | 
| 69 | 
            -
                        ]
         | 
| 70 116 | 
             
                    },
         | 
| 71 | 
            -
                     | 
| 72 | 
            -
                         | 
| 73 | 
            -
                             | 
| 74 | 
            -
                             | 
| 75 | 
            -
                             | 
| 76 | 
            -
                             | 
| 77 | 
            -
                             | 
| 117 | 
            +
                    "qa": {
         | 
| 118 | 
            +
                        "keywords": [
         | 
| 119 | 
            +
                            "test",
         | 
| 120 | 
            +
                            "testing",
         | 
| 121 | 
            +
                            "quality",
         | 
| 122 | 
            +
                            "bug",
         | 
| 123 | 
            +
                            "defect",
         | 
| 124 | 
            +
                            "issue",
         | 
| 125 | 
            +
                            "validation",
         | 
| 126 | 
            +
                            "verification",
         | 
| 127 | 
            +
                            "quality assurance",
         | 
| 128 | 
            +
                            "test case",
         | 
| 129 | 
            +
                            "test plan",
         | 
| 130 | 
            +
                            "coverage",
         | 
| 131 | 
            +
                            "automation",
         | 
| 132 | 
            +
                            "regression",
         | 
| 133 | 
            +
                            "smoke test",
         | 
| 134 | 
            +
                            "acceptance",
         | 
| 135 | 
            +
                            "criteria",
         | 
| 136 | 
            +
                            "checklist",
         | 
| 137 | 
            +
                            "review",
         | 
| 138 | 
            +
                            "audit",
         | 
| 139 | 
            +
                            "compliance",
         | 
| 140 | 
            +
                            "standards",
         | 
| 141 | 
            +
                            "metrics",
         | 
| 142 | 
            +
                            "measurement",
         | 
| 143 | 
            +
                        ],
         | 
| 144 | 
            +
                        "sections": [
         | 
| 145 | 
            +
                            "Quality Standards",
         | 
| 146 | 
            +
                            "Testing Strategies",
         | 
| 147 | 
            +
                            "Common Issues Found",
         | 
| 148 | 
            +
                            "Verification Patterns",
         | 
| 78 149 | 
             
                        ],
         | 
| 79 | 
            -
                        'sections': [
         | 
| 80 | 
            -
                            'Quality Standards', 'Testing Strategies', 
         | 
| 81 | 
            -
                            'Common Issues Found', 'Verification Patterns'
         | 
| 82 | 
            -
                        ]
         | 
| 83 150 | 
             
                    },
         | 
| 84 | 
            -
                     | 
| 85 | 
            -
                         | 
| 86 | 
            -
                             | 
| 87 | 
            -
                             | 
| 88 | 
            -
                             | 
| 89 | 
            -
                             | 
| 151 | 
            +
                    "documentation": {
         | 
| 152 | 
            +
                        "keywords": [
         | 
| 153 | 
            +
                            "document",
         | 
| 154 | 
            +
                            "documentation",
         | 
| 155 | 
            +
                            "readme",
         | 
| 156 | 
            +
                            "guide",
         | 
| 157 | 
            +
                            "manual",
         | 
| 158 | 
            +
                            "help",
         | 
| 159 | 
            +
                            "instructions",
         | 
| 160 | 
            +
                            "tutorial",
         | 
| 161 | 
            +
                            "explanation",
         | 
| 162 | 
            +
                            "description",
         | 
| 163 | 
            +
                            "overview",
         | 
| 164 | 
            +
                            "summary",
         | 
| 165 | 
            +
                            "specification",
         | 
| 166 | 
            +
                            "reference",
         | 
| 167 | 
            +
                            "glossary",
         | 
| 168 | 
            +
                            "faq",
         | 
| 169 | 
            +
                            "examples",
         | 
| 170 | 
            +
                            "usage",
         | 
| 171 | 
            +
                            "howto",
         | 
| 172 | 
            +
                            "walkthrough",
         | 
| 173 | 
            +
                        ],
         | 
| 174 | 
            +
                        "sections": [
         | 
| 175 | 
            +
                            "Documentation Patterns",
         | 
| 176 | 
            +
                            "User Guide Standards",
         | 
| 177 | 
            +
                            "Content Organization",
         | 
| 178 | 
            +
                            "Writing Guidelines",
         | 
| 90 179 | 
             
                        ],
         | 
| 91 | 
            -
                        'sections': [
         | 
| 92 | 
            -
                            'Documentation Patterns', 'User Guide Standards',
         | 
| 93 | 
            -
                            'Content Organization', 'Writing Guidelines'
         | 
| 94 | 
            -
                        ]
         | 
| 95 180 | 
             
                    },
         | 
| 96 | 
            -
                     | 
| 97 | 
            -
                         | 
| 98 | 
            -
                             | 
| 99 | 
            -
                             | 
| 100 | 
            -
                             | 
| 101 | 
            -
                             | 
| 102 | 
            -
                             | 
| 181 | 
            +
                    "security": {
         | 
| 182 | 
            +
                        "keywords": [
         | 
| 183 | 
            +
                            "security",
         | 
| 184 | 
            +
                            "authentication",
         | 
| 185 | 
            +
                            "authorization",
         | 
| 186 | 
            +
                            "encryption",
         | 
| 187 | 
            +
                            "decrypt",
         | 
| 188 | 
            +
                            "password",
         | 
| 189 | 
            +
                            "token",
         | 
| 190 | 
            +
                            "certificate",
         | 
| 191 | 
            +
                            "ssl",
         | 
| 192 | 
            +
                            "tls",
         | 
| 193 | 
            +
                            "vulnerability",
         | 
| 194 | 
            +
                            "exploit",
         | 
| 195 | 
            +
                            "attack",
         | 
| 196 | 
            +
                            "malware",
         | 
| 197 | 
            +
                            "virus",
         | 
| 198 | 
            +
                            "firewall",
         | 
| 199 | 
            +
                            "access control",
         | 
| 200 | 
            +
                            "permissions",
         | 
| 201 | 
            +
                            "privilege",
         | 
| 202 | 
            +
                            "audit",
         | 
| 203 | 
            +
                            "compliance",
         | 
| 204 | 
            +
                            "privacy",
         | 
| 205 | 
            +
                            "data protection",
         | 
| 206 | 
            +
                            "gdpr",
         | 
| 207 | 
            +
                            "sensitive data",
         | 
| 208 | 
            +
                        ],
         | 
| 209 | 
            +
                        "sections": [
         | 
| 210 | 
            +
                            "Security Patterns",
         | 
| 211 | 
            +
                            "Threat Analysis",
         | 
| 212 | 
            +
                            "Compliance Requirements",
         | 
| 213 | 
            +
                            "Access Control Patterns",
         | 
| 103 214 | 
             
                        ],
         | 
| 104 | 
            -
                        'sections': [
         | 
| 105 | 
            -
                            'Security Patterns', 'Threat Analysis',
         | 
| 106 | 
            -
                            'Compliance Requirements', 'Access Control Patterns'
         | 
| 107 | 
            -
                        ]
         | 
| 108 215 | 
             
                    },
         | 
| 109 | 
            -
                     | 
| 110 | 
            -
                         | 
| 111 | 
            -
                             | 
| 112 | 
            -
                             | 
| 113 | 
            -
                             | 
| 114 | 
            -
                             | 
| 115 | 
            -
                             | 
| 216 | 
            +
                    "pm": {
         | 
| 217 | 
            +
                        "keywords": [
         | 
| 218 | 
            +
                            "project",
         | 
| 219 | 
            +
                            "management",
         | 
| 220 | 
            +
                            "coordination",
         | 
| 221 | 
            +
                            "planning",
         | 
| 222 | 
            +
                            "schedule",
         | 
| 223 | 
            +
                            "timeline",
         | 
| 224 | 
            +
                            "milestone",
         | 
| 225 | 
            +
                            "deliverable",
         | 
| 226 | 
            +
                            "stakeholder",
         | 
| 227 | 
            +
                            "requirement",
         | 
| 228 | 
            +
                            "priority",
         | 
| 229 | 
            +
                            "resource",
         | 
| 230 | 
            +
                            "allocation",
         | 
| 231 | 
            +
                            "budget",
         | 
| 232 | 
            +
                            "scope",
         | 
| 233 | 
            +
                            "risk",
         | 
| 234 | 
            +
                            "communication",
         | 
| 235 | 
            +
                            "meeting",
         | 
| 236 | 
            +
                            "status",
         | 
| 237 | 
            +
                            "progress",
         | 
| 238 | 
            +
                            "workflow",
         | 
| 239 | 
            +
                            "process",
         | 
| 240 | 
            +
                            "methodology",
         | 
| 241 | 
            +
                            "agile",
         | 
| 242 | 
            +
                            "scrum",
         | 
| 243 | 
            +
                            "kanban",
         | 
| 244 | 
            +
                        ],
         | 
| 245 | 
            +
                        "sections": [
         | 
| 246 | 
            +
                            "Project Coordination",
         | 
| 247 | 
            +
                            "Team Communication",
         | 
| 248 | 
            +
                            "Process Improvements",
         | 
| 249 | 
            +
                            "Risk Management",
         | 
| 116 250 | 
             
                        ],
         | 
| 117 | 
            -
                        'sections': [
         | 
| 118 | 
            -
                            'Project Coordination', 'Team Communication',
         | 
| 119 | 
            -
                            'Process Improvements', 'Risk Management'
         | 
| 120 | 
            -
                        ]
         | 
| 121 251 | 
             
                    },
         | 
| 122 | 
            -
                     | 
| 123 | 
            -
                         | 
| 124 | 
            -
                             | 
| 125 | 
            -
                             | 
| 126 | 
            -
                             | 
| 127 | 
            -
                             | 
| 128 | 
            -
                             | 
| 129 | 
            -
                             | 
| 130 | 
            -
                             | 
| 131 | 
            -
                             | 
| 252 | 
            +
                    "data_engineer": {
         | 
| 253 | 
            +
                        "keywords": [
         | 
| 254 | 
            +
                            "data",
         | 
| 255 | 
            +
                            "database",
         | 
| 256 | 
            +
                            "sql",
         | 
| 257 | 
            +
                            "pipeline",
         | 
| 258 | 
            +
                            "etl",
         | 
| 259 | 
            +
                            "elt",
         | 
| 260 | 
            +
                            "extract",
         | 
| 261 | 
            +
                            "transform",
         | 
| 262 | 
            +
                            "load",
         | 
| 263 | 
            +
                            "analytics",
         | 
| 264 | 
            +
                            "warehouse",
         | 
| 265 | 
            +
                            "lake",
         | 
| 266 | 
            +
                            "schema",
         | 
| 267 | 
            +
                            "migration",
         | 
| 268 | 
            +
                            "replication",
         | 
| 269 | 
            +
                            "streaming",
         | 
| 270 | 
            +
                            "batch",
         | 
| 271 | 
            +
                            "kafka",
         | 
| 272 | 
            +
                            "spark",
         | 
| 273 | 
            +
                            "hadoop",
         | 
| 274 | 
            +
                            "mongodb",
         | 
| 275 | 
            +
                            "postgres",
         | 
| 276 | 
            +
                            "mysql",
         | 
| 277 | 
            +
                            "redis",
         | 
| 278 | 
            +
                            "elasticsearch",
         | 
| 279 | 
            +
                            "index",
         | 
| 280 | 
            +
                            "query",
         | 
| 281 | 
            +
                            "optimization",
         | 
| 282 | 
            +
                            "performance",
         | 
| 283 | 
            +
                            "partitioning",
         | 
| 284 | 
            +
                            "sharding",
         | 
| 285 | 
            +
                            "normalization",
         | 
| 286 | 
            +
                            "denormalization",
         | 
| 287 | 
            +
                            "aggregation",
         | 
| 288 | 
            +
                            "cleansing",
         | 
| 289 | 
            +
                            "validation",
         | 
| 290 | 
            +
                            "quality",
         | 
| 291 | 
            +
                            "lineage",
         | 
| 292 | 
            +
                            "governance",
         | 
| 293 | 
            +
                            "backup",
         | 
| 294 | 
            +
                            "restore",
         | 
| 295 | 
            +
                            "ai api",
         | 
| 296 | 
            +
                            "openai",
         | 
| 297 | 
            +
                            "claude",
         | 
| 298 | 
            +
                            "llm",
         | 
| 299 | 
            +
                            "embedding",
         | 
| 300 | 
            +
                            "vector database",
         | 
| 301 | 
            +
                        ],
         | 
| 302 | 
            +
                        "sections": [
         | 
| 303 | 
            +
                            "Database Architecture Patterns",
         | 
| 304 | 
            +
                            "Pipeline Design Strategies",
         | 
| 305 | 
            +
                            "Data Quality Standards",
         | 
| 306 | 
            +
                            "Performance Optimization Techniques",
         | 
| 132 307 | 
             
                        ],
         | 
| 133 | 
            -
                        'sections': [
         | 
| 134 | 
            -
                            'Database Architecture Patterns', 'Pipeline Design Strategies',
         | 
| 135 | 
            -
                            'Data Quality Standards', 'Performance Optimization Techniques'
         | 
| 136 | 
            -
                        ]
         | 
| 137 308 | 
             
                    },
         | 
| 138 | 
            -
                     | 
| 139 | 
            -
                         | 
| 140 | 
            -
                             | 
| 141 | 
            -
                             | 
| 142 | 
            -
                             | 
| 143 | 
            -
                             | 
| 144 | 
            -
                             | 
| 145 | 
            -
                             | 
| 146 | 
            -
                             | 
| 147 | 
            -
                             | 
| 309 | 
            +
                    "test_integration": {
         | 
| 310 | 
            +
                        "keywords": [
         | 
| 311 | 
            +
                            "integration",
         | 
| 312 | 
            +
                            "e2e",
         | 
| 313 | 
            +
                            "end-to-end",
         | 
| 314 | 
            +
                            "system test",
         | 
| 315 | 
            +
                            "workflow test",
         | 
| 316 | 
            +
                            "cross-system",
         | 
| 317 | 
            +
                            "api test",
         | 
| 318 | 
            +
                            "contract test",
         | 
| 319 | 
            +
                            "service test",
         | 
| 320 | 
            +
                            "boundary test",
         | 
| 321 | 
            +
                            "interface test",
         | 
| 322 | 
            +
                            "component test",
         | 
| 323 | 
            +
                            "smoke test",
         | 
| 324 | 
            +
                            "acceptance test",
         | 
| 325 | 
            +
                            "scenario test",
         | 
| 326 | 
            +
                            "user journey",
         | 
| 327 | 
            +
                            "flow test",
         | 
| 328 | 
            +
                            "regression",
         | 
| 329 | 
            +
                            "compatibility",
         | 
| 330 | 
            +
                            "interoperability",
         | 
| 331 | 
            +
                            "validation",
         | 
| 332 | 
            +
                            "verification",
         | 
| 333 | 
            +
                            "mock",
         | 
| 334 | 
            +
                            "stub",
         | 
| 335 | 
            +
                            "test data",
         | 
| 336 | 
            +
                            "test environment",
         | 
| 337 | 
            +
                            "test setup",
         | 
| 338 | 
            +
                            "teardown",
         | 
| 339 | 
            +
                            "isolation",
         | 
| 340 | 
            +
                            "coordination",
         | 
| 341 | 
            +
                            "synchronization",
         | 
| 342 | 
            +
                            "selenium",
         | 
| 343 | 
            +
                            "cypress",
         | 
| 344 | 
            +
                            "playwright",
         | 
| 345 | 
            +
                            "postman",
         | 
| 346 | 
            +
                            "newman",
         | 
| 347 | 
            +
                        ],
         | 
| 348 | 
            +
                        "sections": [
         | 
| 349 | 
            +
                            "Integration Test Patterns",
         | 
| 350 | 
            +
                            "Cross-System Validation",
         | 
| 351 | 
            +
                            "Test Environment Management",
         | 
| 352 | 
            +
                            "End-to-End Workflow Testing",
         | 
| 148 353 | 
             
                        ],
         | 
| 149 | 
            -
                        'sections': [
         | 
| 150 | 
            -
                            'Integration Test Patterns', 'Cross-System Validation',
         | 
| 151 | 
            -
                            'Test Environment Management', 'End-to-End Workflow Testing'
         | 
| 152 | 
            -
                        ]
         | 
| 153 354 | 
             
                    },
         | 
| 154 | 
            -
                     | 
| 155 | 
            -
                         | 
| 156 | 
            -
                             | 
| 157 | 
            -
                             | 
| 158 | 
            -
                             | 
| 159 | 
            -
                             | 
| 160 | 
            -
                             | 
| 161 | 
            -
                             | 
| 162 | 
            -
                             | 
| 163 | 
            -
                             | 
| 355 | 
            +
                    "ops": {
         | 
| 356 | 
            +
                        "keywords": [
         | 
| 357 | 
            +
                            "deployment",
         | 
| 358 | 
            +
                            "infrastructure",
         | 
| 359 | 
            +
                            "devops",
         | 
| 360 | 
            +
                            "cicd",
         | 
| 361 | 
            +
                            "ci/cd",
         | 
| 362 | 
            +
                            "docker",
         | 
| 363 | 
            +
                            "container",
         | 
| 364 | 
            +
                            "kubernetes",
         | 
| 365 | 
            +
                            "helm",
         | 
| 366 | 
            +
                            "terraform",
         | 
| 367 | 
            +
                            "ansible",
         | 
| 368 | 
            +
                            "jenkins",
         | 
| 369 | 
            +
                            "pipeline",
         | 
| 370 | 
            +
                            "build",
         | 
| 371 | 
            +
                            "release",
         | 
| 372 | 
            +
                            "staging",
         | 
| 373 | 
            +
                            "production",
         | 
| 374 | 
            +
                            "environment",
         | 
| 375 | 
            +
                            "monitoring",
         | 
| 376 | 
            +
                            "logging",
         | 
| 377 | 
            +
                            "metrics",
         | 
| 378 | 
            +
                            "alerts",
         | 
| 379 | 
            +
                            "observability",
         | 
| 380 | 
            +
                            "scaling",
         | 
| 381 | 
            +
                            "load balancer",
         | 
| 382 | 
            +
                            "proxy",
         | 
| 383 | 
            +
                            "nginx",
         | 
| 384 | 
            +
                            "apache",
         | 
| 385 | 
            +
                            "server",
         | 
| 386 | 
            +
                            "network",
         | 
| 387 | 
            +
                            "firewall",
         | 
| 388 | 
            +
                            "vpc",
         | 
| 389 | 
            +
                            "aws",
         | 
| 390 | 
            +
                            "azure",
         | 
| 391 | 
            +
                            "gcp",
         | 
| 392 | 
            +
                            "cloud",
         | 
| 393 | 
            +
                            "backup",
         | 
| 394 | 
            +
                            "disaster recovery",
         | 
| 395 | 
            +
                            "failover",
         | 
| 396 | 
            +
                            "redundancy",
         | 
| 397 | 
            +
                            "uptime",
         | 
| 398 | 
            +
                            "prometheus",
         | 
| 399 | 
            +
                            "grafana",
         | 
| 400 | 
            +
                            "splunk",
         | 
| 401 | 
            +
                            "datadog",
         | 
| 402 | 
            +
                            "newrelic",
         | 
| 403 | 
            +
                        ],
         | 
| 404 | 
            +
                        "sections": [
         | 
| 405 | 
            +
                            "Deployment Strategies",
         | 
| 406 | 
            +
                            "Infrastructure Patterns",
         | 
| 407 | 
            +
                            "Monitoring and Observability",
         | 
| 408 | 
            +
                            "Scaling and Performance",
         | 
| 164 409 | 
             
                        ],
         | 
| 165 | 
            -
                        'sections': [
         | 
| 166 | 
            -
                            'Deployment Strategies', 'Infrastructure Patterns',
         | 
| 167 | 
            -
                            'Monitoring and Observability', 'Scaling and Performance'
         | 
| 168 | 
            -
                        ]
         | 
| 169 410 | 
             
                    },
         | 
| 170 | 
            -
                     | 
| 171 | 
            -
                         | 
| 172 | 
            -
                             | 
| 173 | 
            -
                             | 
| 174 | 
            -
                             | 
| 175 | 
            -
                             | 
| 176 | 
            -
                             | 
| 177 | 
            -
                             | 
| 411 | 
            +
                    "version_control": {
         | 
| 412 | 
            +
                        "keywords": [
         | 
| 413 | 
            +
                            "git",
         | 
| 414 | 
            +
                            "github",
         | 
| 415 | 
            +
                            "gitlab",
         | 
| 416 | 
            +
                            "bitbucket",
         | 
| 417 | 
            +
                            "branch",
         | 
| 418 | 
            +
                            "merge",
         | 
| 419 | 
            +
                            "commit",
         | 
| 420 | 
            +
                            "pull request",
         | 
| 421 | 
            +
                            "merge request",
         | 
| 422 | 
            +
                            "tag",
         | 
| 423 | 
            +
                            "release",
         | 
| 424 | 
            +
                            "version",
         | 
| 425 | 
            +
                            "changelog",
         | 
| 426 | 
            +
                            "semantic versioning",
         | 
| 427 | 
            +
                            "semver",
         | 
| 428 | 
            +
                            "workflow",
         | 
| 429 | 
            +
                            "gitflow",
         | 
| 430 | 
            +
                            "conflict",
         | 
| 431 | 
            +
                            "resolution",
         | 
| 432 | 
            +
                            "rebase",
         | 
| 433 | 
            +
                            "cherry-pick",
         | 
| 434 | 
            +
                            "stash",
         | 
| 435 | 
            +
                            "bisect",
         | 
| 436 | 
            +
                            "blame",
         | 
| 437 | 
            +
                            "diff",
         | 
| 438 | 
            +
                            "patch",
         | 
| 439 | 
            +
                            "submodule",
         | 
| 440 | 
            +
                            "hook",
         | 
| 441 | 
            +
                            "pre-commit",
         | 
| 442 | 
            +
                            "post-commit",
         | 
| 443 | 
            +
                            "repository",
         | 
| 444 | 
            +
                            "remote",
         | 
| 445 | 
            +
                            "origin",
         | 
| 446 | 
            +
                            "upstream",
         | 
| 447 | 
            +
                            "fork",
         | 
| 448 | 
            +
                            "clone",
         | 
| 178 449 | 
             
                        ],
         | 
| 179 | 
            -
                         | 
| 180 | 
            -
                             | 
| 181 | 
            -
                             | 
| 182 | 
            -
             | 
| 183 | 
            -
             | 
| 450 | 
            +
                        "sections": [
         | 
| 451 | 
            +
                            "Branching Strategies",
         | 
| 452 | 
            +
                            "Release Management",
         | 
| 453 | 
            +
                            "Version Control Workflows",
         | 
| 454 | 
            +
                            "Collaboration Patterns",
         | 
| 455 | 
            +
                        ],
         | 
| 456 | 
            +
                    },
         | 
| 184 457 | 
             
                }
         | 
| 185 | 
            -
             | 
| 458 | 
            +
             | 
| 186 459 | 
             
                # Default agent for unmatched content
         | 
| 187 | 
            -
                DEFAULT_AGENT =  | 
| 188 | 
            -
             | 
| 460 | 
            +
                DEFAULT_AGENT = "pm"
         | 
| 461 | 
            +
             | 
| 189 462 | 
             
                def __init__(self, config: Optional[Config] = None):
         | 
| 190 463 | 
             
                    """Initialize the memory router.
         | 
| 191 | 
            -
             | 
| 464 | 
            +
             | 
| 192 465 | 
             
                    Args:
         | 
| 193 466 | 
             
                        config: Optional Config object
         | 
| 194 467 | 
             
                    """
         | 
| 195 468 | 
             
                    super().__init__()
         | 
| 196 469 | 
             
                    self.config = config or Config()
         | 
| 197 | 
            -
             | 
| 470 | 
            +
             | 
| 198 471 | 
             
                def get_supported_agents(self) -> List[str]:
         | 
| 199 472 | 
             
                    """Get list of supported agent types.
         | 
| 200 | 
            -
             | 
| 473 | 
            +
             | 
| 201 474 | 
             
                    WHY: Other components need to know which agent types are supported
         | 
| 202 475 | 
             
                    for validation and UI display purposes.
         | 
| 203 | 
            -
             | 
| 476 | 
            +
             | 
| 204 477 | 
             
                    Returns:
         | 
| 205 478 | 
             
                        List of supported agent type names
         | 
| 206 479 | 
             
                    """
         | 
| 207 480 | 
             
                    return list(self.AGENT_PATTERNS.keys())
         | 
| 208 | 
            -
             | 
| 481 | 
            +
             | 
| 209 482 | 
             
                def is_agent_supported(self, agent_type: str) -> bool:
         | 
| 210 483 | 
             
                    """Check if an agent type is supported by the memory router.
         | 
| 211 | 
            -
             | 
| 484 | 
            +
             | 
| 212 485 | 
             
                    WHY: Provides validation for agent types before attempting routing.
         | 
| 213 486 | 
             
                    This prevents errors and provides clear feedback about unsupported types.
         | 
| 214 | 
            -
             | 
| 487 | 
            +
             | 
| 215 488 | 
             
                    Args:
         | 
| 216 489 | 
             
                        agent_type: Agent type to check
         | 
| 217 | 
            -
             | 
| 490 | 
            +
             | 
| 218 491 | 
             
                    Returns:
         | 
| 219 492 | 
             
                        True if agent type is supported, False otherwise
         | 
| 220 493 | 
             
                    """
         | 
| 221 494 | 
             
                    return agent_type in self.AGENT_PATTERNS
         | 
| 222 | 
            -
             | 
| 223 | 
            -
                def analyze_and_route( | 
| 495 | 
            +
             | 
| 496 | 
            +
                def analyze_and_route(
         | 
| 497 | 
            +
                    self, content: str, context: Optional[Dict] = None
         | 
| 498 | 
            +
                ) -> Dict[str, Any]:
         | 
| 224 499 | 
             
                    """Analyze content and determine target agent for memory storage.
         | 
| 225 | 
            -
             | 
| 500 | 
            +
             | 
| 226 501 | 
             
                    WHY: Different types of information belong to different agents. This method
         | 
| 227 502 | 
             
                    analyzes content using keyword patterns and context to make intelligent
         | 
| 228 503 | 
             
                    routing decisions.
         | 
| 229 | 
            -
             | 
| 504 | 
            +
             | 
| 230 505 | 
             
                    Args:
         | 
| 231 506 | 
             
                        content: The content to be remembered
         | 
| 232 507 | 
             
                        context: Optional context for routing decisions
         | 
| 233 | 
            -
             | 
| 508 | 
            +
             | 
| 234 509 | 
             
                    Returns:
         | 
| 235 510 | 
             
                        Dict containing routing decision and reasoning
         | 
| 236 511 | 
             
                    """
         | 
| 237 512 | 
             
                    try:
         | 
| 238 513 | 
             
                        # Clean and normalize content for analysis
         | 
| 239 514 | 
             
                        normalized_content = self._normalize_content(content)
         | 
| 240 | 
            -
             | 
| 515 | 
            +
             | 
| 241 516 | 
             
                        # Analyze content for agent patterns
         | 
| 242 517 | 
             
                        agent_scores = self._calculate_agent_scores(normalized_content)
         | 
| 243 | 
            -
             | 
| 518 | 
            +
             | 
| 244 519 | 
             
                        # Apply context-based adjustments
         | 
| 245 520 | 
             
                        if context:
         | 
| 246 521 | 
             
                            agent_scores = self._apply_context_adjustments(agent_scores, context)
         | 
| 247 | 
            -
             | 
| 522 | 
            +
             | 
| 248 523 | 
             
                        # Select target agent
         | 
| 249 524 | 
             
                        target_agent, confidence = self._select_target_agent(agent_scores)
         | 
| 250 | 
            -
             | 
| 525 | 
            +
             | 
| 251 526 | 
             
                        # Determine appropriate section
         | 
| 252 527 | 
             
                        section = self._determine_section(target_agent, normalized_content)
         | 
| 253 | 
            -
             | 
| 528 | 
            +
             | 
| 254 529 | 
             
                        # Build reasoning
         | 
| 255 | 
            -
                        reasoning = self._build_reasoning( | 
| 256 | 
            -
             | 
| 530 | 
            +
                        reasoning = self._build_reasoning(
         | 
| 531 | 
            +
                            target_agent, agent_scores, section, context
         | 
| 532 | 
            +
                        )
         | 
| 533 | 
            +
             | 
| 257 534 | 
             
                        result = {
         | 
| 258 535 | 
             
                            "target_agent": target_agent,
         | 
| 259 536 | 
             
                            "section": section,
         | 
| @@ -261,12 +538,14 @@ class MemoryRouter(LoggerMixin): | |
| 261 538 | 
             
                            "reasoning": reasoning,
         | 
| 262 539 | 
             
                            "agent_scores": agent_scores,
         | 
| 263 540 | 
             
                            "timestamp": datetime.now().isoformat(),
         | 
| 264 | 
            -
                            "content_length": len(content)
         | 
| 541 | 
            +
                            "content_length": len(content),
         | 
| 265 542 | 
             
                        }
         | 
| 266 | 
            -
             | 
| 267 | 
            -
                        self.logger.debug( | 
| 543 | 
            +
             | 
| 544 | 
            +
                        self.logger.debug(
         | 
| 545 | 
            +
                            f"Routed content to {target_agent} with confidence {confidence}"
         | 
| 546 | 
            +
                        )
         | 
| 268 547 | 
             
                        return result
         | 
| 269 | 
            -
             | 
| 548 | 
            +
             | 
| 270 549 | 
             
                    except Exception as e:
         | 
| 271 550 | 
             
                        self.logger.error(f"Error analyzing content for routing: {e}")
         | 
| 272 551 | 
             
                        return {
         | 
| @@ -276,49 +555,53 @@ class MemoryRouter(LoggerMixin): | |
| 276 555 | 
             
                            "reasoning": f"Error during analysis, defaulting to {self.DEFAULT_AGENT}",
         | 
| 277 556 | 
             
                            "error": str(e),
         | 
| 278 557 | 
             
                            "timestamp": datetime.now().isoformat(),
         | 
| 279 | 
            -
                            "content_length": len(content) if content else 0
         | 
| 558 | 
            +
                            "content_length": len(content) if content else 0,
         | 
| 280 559 | 
             
                        }
         | 
| 281 | 
            -
             | 
| 282 | 
            -
                def test_routing_patterns( | 
| 560 | 
            +
             | 
| 561 | 
            +
                def test_routing_patterns(
         | 
| 562 | 
            +
                    self, test_cases: List[Dict[str, str]]
         | 
| 563 | 
            +
                ) -> List[Dict[str, Any]]:
         | 
| 283 564 | 
             
                    """Test routing logic with provided test cases.
         | 
| 284 | 
            -
             | 
| 565 | 
            +
             | 
| 285 566 | 
             
                    WHY: Routing patterns need validation to ensure they work correctly.
         | 
| 286 567 | 
             
                    This method allows testing of routing logic with known inputs.
         | 
| 287 | 
            -
             | 
| 568 | 
            +
             | 
| 288 569 | 
             
                    Args:
         | 
| 289 570 | 
             
                        test_cases: List of test cases with 'content' and optional 'expected_agent'
         | 
| 290 | 
            -
             | 
| 571 | 
            +
             | 
| 291 572 | 
             
                    Returns:
         | 
| 292 573 | 
             
                        List of routing results for each test case
         | 
| 293 574 | 
             
                    """
         | 
| 294 575 | 
             
                    results = []
         | 
| 295 | 
            -
             | 
| 576 | 
            +
             | 
| 296 577 | 
             
                    for i, test_case in enumerate(test_cases):
         | 
| 297 | 
            -
                        content = test_case.get( | 
| 298 | 
            -
                        expected = test_case.get( | 
| 299 | 
            -
             | 
| 578 | 
            +
                        content = test_case.get("content", "")
         | 
| 579 | 
            +
                        expected = test_case.get("expected_agent")
         | 
| 580 | 
            +
             | 
| 300 581 | 
             
                        routing_result = self.analyze_and_route(content)
         | 
| 301 | 
            -
             | 
| 582 | 
            +
             | 
| 302 583 | 
             
                        test_result = {
         | 
| 303 584 | 
             
                            "test_case": i + 1,
         | 
| 304 585 | 
             
                            "content": content[:100] + "..." if len(content) > 100 else content,
         | 
| 305 586 | 
             
                            "expected_agent": expected,
         | 
| 306 | 
            -
                            "actual_agent": routing_result[ | 
| 307 | 
            -
                            "confidence": routing_result[ | 
| 308 | 
            -
                            "correct": expected == routing_result[ | 
| 309 | 
            -
                             | 
| 587 | 
            +
                            "actual_agent": routing_result["target_agent"],
         | 
| 588 | 
            +
                            "confidence": routing_result["confidence"],
         | 
| 589 | 
            +
                            "correct": expected == routing_result["target_agent"]
         | 
| 590 | 
            +
                            if expected
         | 
| 591 | 
            +
                            else None,
         | 
| 592 | 
            +
                            "reasoning": routing_result["reasoning"],
         | 
| 310 593 | 
             
                        }
         | 
| 311 | 
            -
             | 
| 594 | 
            +
             | 
| 312 595 | 
             
                        results.append(test_result)
         | 
| 313 | 
            -
             | 
| 596 | 
            +
             | 
| 314 597 | 
             
                    return results
         | 
| 315 | 
            -
             | 
| 598 | 
            +
             | 
| 316 599 | 
             
                def get_routing_patterns(self) -> Dict[str, Any]:
         | 
| 317 600 | 
             
                    """Get current routing patterns and statistics.
         | 
| 318 | 
            -
             | 
| 601 | 
            +
             | 
| 319 602 | 
             
                    WHY: Users and developers need to understand how routing works and
         | 
| 320 603 | 
             
                    potentially customize patterns for their specific use cases.
         | 
| 321 | 
            -
             | 
| 604 | 
            +
             | 
| 322 605 | 
             
                    Returns:
         | 
| 323 606 | 
             
                        Dict containing routing patterns and statistics
         | 
| 324 607 | 
             
                    """
         | 
| @@ -327,191 +610,216 @@ class MemoryRouter(LoggerMixin): | |
| 327 610 | 
             
                        "default_agent": self.DEFAULT_AGENT,
         | 
| 328 611 | 
             
                        "patterns": {
         | 
| 329 612 | 
             
                            agent: {
         | 
| 330 | 
            -
                                "keyword_count": len(patterns[ | 
| 331 | 
            -
                                "section_count": len(patterns[ | 
| 332 | 
            -
                                "keywords": patterns[ | 
| 333 | 
            -
                                "sections": patterns[ | 
| 613 | 
            +
                                "keyword_count": len(patterns["keywords"]),
         | 
| 614 | 
            +
                                "section_count": len(patterns["sections"]),
         | 
| 615 | 
            +
                                "keywords": patterns["keywords"][:10],  # Show first 10
         | 
| 616 | 
            +
                                "sections": patterns["sections"],
         | 
| 334 617 | 
             
                            }
         | 
| 335 618 | 
             
                            for agent, patterns in self.AGENT_PATTERNS.items()
         | 
| 336 619 | 
             
                        },
         | 
| 337 | 
            -
                        "total_keywords": sum( | 
| 620 | 
            +
                        "total_keywords": sum(
         | 
| 621 | 
            +
                            len(p["keywords"]) for p in self.AGENT_PATTERNS.values()
         | 
| 622 | 
            +
                        ),
         | 
| 338 623 | 
             
                    }
         | 
| 339 | 
            -
             | 
| 624 | 
            +
             | 
| 340 625 | 
             
                def _normalize_content(self, content: str) -> str:
         | 
| 341 626 | 
             
                    """Normalize content for analysis.
         | 
| 342 | 
            -
             | 
| 627 | 
            +
             | 
| 343 628 | 
             
                    Args:
         | 
| 344 629 | 
             
                        content: Raw content
         | 
| 345 | 
            -
             | 
| 630 | 
            +
             | 
| 346 631 | 
             
                    Returns:
         | 
| 347 632 | 
             
                        Normalized content string
         | 
| 348 633 | 
             
                    """
         | 
| 349 634 | 
             
                    # Convert to lowercase and remove extra whitespace
         | 
| 350 | 
            -
                    normalized = re.sub(r | 
| 351 | 
            -
             | 
| 635 | 
            +
                    normalized = re.sub(r"\s+", " ", content.lower().strip())
         | 
| 636 | 
            +
             | 
| 352 637 | 
             
                    # Remove common noise words that don't help with routing
         | 
| 353 | 
            -
                    noise_words = [ | 
| 638 | 
            +
                    noise_words = [
         | 
| 639 | 
            +
                        "the",
         | 
| 640 | 
            +
                        "and",
         | 
| 641 | 
            +
                        "or",
         | 
| 642 | 
            +
                        "but",
         | 
| 643 | 
            +
                        "in",
         | 
| 644 | 
            +
                        "on",
         | 
| 645 | 
            +
                        "at",
         | 
| 646 | 
            +
                        "to",
         | 
| 647 | 
            +
                        "for",
         | 
| 648 | 
            +
                        "of",
         | 
| 649 | 
            +
                        "with",
         | 
| 650 | 
            +
                        "by",
         | 
| 651 | 
            +
                    ]
         | 
| 354 652 | 
             
                    words = normalized.split()
         | 
| 355 653 | 
             
                    filtered_words = [w for w in words if w not in noise_words and len(w) > 2]
         | 
| 356 | 
            -
             | 
| 357 | 
            -
                    return  | 
| 358 | 
            -
             | 
| 654 | 
            +
             | 
| 655 | 
            +
                    return " ".join(filtered_words)
         | 
| 656 | 
            +
             | 
| 359 657 | 
             
                def _calculate_agent_scores(self, content: str) -> Dict[str, float]:
         | 
| 360 658 | 
             
                    """Calculate relevance scores for each agent.
         | 
| 361 | 
            -
             | 
| 659 | 
            +
             | 
| 362 660 | 
             
                    Args:
         | 
| 363 661 | 
             
                        content: Normalized content
         | 
| 364 | 
            -
             | 
| 662 | 
            +
             | 
| 365 663 | 
             
                    Returns:
         | 
| 366 664 | 
             
                        Dict mapping agent names to relevance scores
         | 
| 367 665 | 
             
                    """
         | 
| 368 666 | 
             
                    scores = {}
         | 
| 369 | 
            -
             | 
| 667 | 
            +
             | 
| 370 668 | 
             
                    for agent, patterns in self.AGENT_PATTERNS.items():
         | 
| 371 669 | 
             
                        score = 0.0
         | 
| 372 670 | 
             
                        matched_keywords = []
         | 
| 373 | 
            -
             | 
| 374 | 
            -
                        for keyword in patterns[ | 
| 671 | 
            +
             | 
| 672 | 
            +
                        for keyword in patterns["keywords"]:
         | 
| 375 673 | 
             
                            # Exact keyword match gets higher score
         | 
| 376 674 | 
             
                            if keyword in content:
         | 
| 377 675 | 
             
                                # Multi-word keywords get bonus score
         | 
| 378 | 
            -
                                bonus = 1.5 if  | 
| 676 | 
            +
                                bonus = 1.5 if " " in keyword else 1.0
         | 
| 379 677 | 
             
                                score += bonus
         | 
| 380 678 | 
             
                                matched_keywords.append(keyword)
         | 
| 381 679 | 
             
                            # Partial match (word contains keyword)
         | 
| 382 680 | 
             
                            elif any(keyword in word for word in content.split()):
         | 
| 383 681 | 
             
                                score += 0.5
         | 
| 384 | 
            -
             | 
| 682 | 
            +
             | 
| 385 683 | 
             
                        # Normalize score by square root to avoid penalizing agents with many keywords
         | 
| 386 | 
            -
                        if patterns[ | 
| 684 | 
            +
                        if patterns["keywords"]:
         | 
| 387 685 | 
             
                            import math
         | 
| 388 | 
            -
             | 
| 389 | 
            -
             | 
| 686 | 
            +
             | 
| 687 | 
            +
                            score = score / math.sqrt(len(patterns["keywords"]))
         | 
| 688 | 
            +
             | 
| 390 689 | 
             
                        scores[agent] = {
         | 
| 391 | 
            -
                             | 
| 392 | 
            -
                             | 
| 393 | 
            -
                             | 
| 690 | 
            +
                            "score": score,
         | 
| 691 | 
            +
                            "matched_keywords": matched_keywords[:5],  # Limit for readability
         | 
| 692 | 
            +
                            "match_count": len(matched_keywords),
         | 
| 394 693 | 
             
                        }
         | 
| 395 | 
            -
             | 
| 694 | 
            +
             | 
| 396 695 | 
             
                    return scores
         | 
| 397 | 
            -
             | 
| 398 | 
            -
                def _apply_context_adjustments( | 
| 696 | 
            +
             | 
| 697 | 
            +
                def _apply_context_adjustments(
         | 
| 698 | 
            +
                    self, agent_scores: Dict[str, Any], context: Dict
         | 
| 699 | 
            +
                ) -> Dict[str, Any]:
         | 
| 399 700 | 
             
                    """Apply context-based adjustments to agent scores.
         | 
| 400 | 
            -
             | 
| 701 | 
            +
             | 
| 401 702 | 
             
                    Args:
         | 
| 402 703 | 
             
                        agent_scores: Current agent scores
         | 
| 403 704 | 
             
                        context: Context information
         | 
| 404 | 
            -
             | 
| 705 | 
            +
             | 
| 405 706 | 
             
                    Returns:
         | 
| 406 707 | 
             
                        Adjusted agent scores
         | 
| 407 708 | 
             
                    """
         | 
| 408 709 | 
             
                    # Context hints for routing
         | 
| 409 | 
            -
                    if  | 
| 410 | 
            -
                        hint = context[ | 
| 710 | 
            +
                    if "agent_hint" in context:
         | 
| 711 | 
            +
                        hint = context["agent_hint"].lower()
         | 
| 411 712 | 
             
                        if hint in agent_scores:
         | 
| 412 | 
            -
                            agent_scores[hint][ | 
| 413 | 
            -
                            agent_scores[hint][ | 
| 414 | 
            -
             | 
| 713 | 
            +
                            agent_scores[hint]["score"] += 0.3
         | 
| 714 | 
            +
                            agent_scores[hint]["context_boost"] = True
         | 
| 715 | 
            +
             | 
| 415 716 | 
             
                    # Task type hints
         | 
| 416 | 
            -
                    if  | 
| 417 | 
            -
                        task_type = context[ | 
| 717 | 
            +
                    if "task_type" in context:
         | 
| 718 | 
            +
                        task_type = context["task_type"].lower()
         | 
| 418 719 | 
             
                        task_mappings = {
         | 
| 419 | 
            -
                             | 
| 420 | 
            -
                             | 
| 421 | 
            -
                             | 
| 422 | 
            -
                             | 
| 423 | 
            -
                             | 
| 424 | 
            -
                             | 
| 425 | 
            -
                             | 
| 720 | 
            +
                            "implementation": "engineer",
         | 
| 721 | 
            +
                            "coding": "engineer",
         | 
| 722 | 
            +
                            "analysis": "research",
         | 
| 723 | 
            +
                            "testing": "qa",
         | 
| 724 | 
            +
                            "documentation": "documentation",
         | 
| 725 | 
            +
                            "security": "security",
         | 
| 726 | 
            +
                            "planning": "pm",
         | 
| 426 727 | 
             
                        }
         | 
| 427 | 
            -
             | 
| 728 | 
            +
             | 
| 428 729 | 
             
                        if task_type in task_mappings:
         | 
| 429 730 | 
             
                            target_agent = task_mappings[task_type]
         | 
| 430 731 | 
             
                            if target_agent in agent_scores:
         | 
| 431 | 
            -
                                agent_scores[target_agent][ | 
| 432 | 
            -
                                agent_scores[target_agent][ | 
| 433 | 
            -
             | 
| 732 | 
            +
                                agent_scores[target_agent]["score"] += 0.2
         | 
| 733 | 
            +
                                agent_scores[target_agent]["task_type_boost"] = True
         | 
| 734 | 
            +
             | 
| 434 735 | 
             
                    return agent_scores
         | 
| 435 | 
            -
             | 
| 736 | 
            +
             | 
| 436 737 | 
             
                def _select_target_agent(self, agent_scores: Dict[str, Any]) -> Tuple[str, float]:
         | 
| 437 738 | 
             
                    """Select target agent based on scores.
         | 
| 438 | 
            -
             | 
| 739 | 
            +
             | 
| 439 740 | 
             
                    Args:
         | 
| 440 741 | 
             
                        agent_scores: Agent relevance scores
         | 
| 441 | 
            -
             | 
| 742 | 
            +
             | 
| 442 743 | 
             
                    Returns:
         | 
| 443 744 | 
             
                        Tuple of (target_agent, confidence)
         | 
| 444 745 | 
             
                    """
         | 
| 445 746 | 
             
                    # Find agent with highest score
         | 
| 446 747 | 
             
                    best_agent = self.DEFAULT_AGENT
         | 
| 447 748 | 
             
                    best_score = 0.0
         | 
| 448 | 
            -
             | 
| 749 | 
            +
             | 
| 449 750 | 
             
                    for agent, score_data in agent_scores.items():
         | 
| 450 | 
            -
                        score = score_data[ | 
| 751 | 
            +
                        score = score_data["score"]
         | 
| 451 752 | 
             
                        if score > best_score:
         | 
| 452 753 | 
             
                            best_score = score
         | 
| 453 754 | 
             
                            best_agent = agent
         | 
| 454 | 
            -
             | 
| 755 | 
            +
             | 
| 455 756 | 
             
                    # If no clear winner, use default
         | 
| 456 757 | 
             
                    # Lowered threshold to handle diverse agent patterns better
         | 
| 457 758 | 
             
                    if best_score < 0.05:
         | 
| 458 759 | 
             
                        return self.DEFAULT_AGENT, 0.1
         | 
| 459 | 
            -
             | 
| 760 | 
            +
             | 
| 460 761 | 
             
                    # Convert score to confidence (0.0 to 1.0)
         | 
| 461 762 | 
             
                    confidence = min(1.0, best_score * 2)  # Scale up for better confidence values
         | 
| 462 | 
            -
             | 
| 763 | 
            +
             | 
| 463 764 | 
             
                    return best_agent, confidence
         | 
| 464 | 
            -
             | 
| 765 | 
            +
             | 
| 465 766 | 
             
                def _determine_section(self, agent: str, content: str) -> str:
         | 
| 466 767 | 
             
                    """Determine appropriate section for the content.
         | 
| 467 | 
            -
             | 
| 768 | 
            +
             | 
| 468 769 | 
             
                    Args:
         | 
| 469 770 | 
             
                        agent: Target agent
         | 
| 470 771 | 
             
                        content: Normalized content
         | 
| 471 | 
            -
             | 
| 772 | 
            +
             | 
| 472 773 | 
             
                    Returns:
         | 
| 473 774 | 
             
                        Section name for memory storage
         | 
| 474 775 | 
             
                    """
         | 
| 475 776 | 
             
                    if agent not in self.AGENT_PATTERNS:
         | 
| 476 777 | 
             
                        return "Recent Learnings"
         | 
| 477 | 
            -
             | 
| 478 | 
            -
                    sections = self.AGENT_PATTERNS[agent][ | 
| 479 | 
            -
             | 
| 778 | 
            +
             | 
| 779 | 
            +
                    sections = self.AGENT_PATTERNS[agent]["sections"]
         | 
| 780 | 
            +
             | 
| 480 781 | 
             
                    # Simple heuristics for section selection
         | 
| 481 | 
            -
                    if  | 
| 482 | 
            -
                        return  | 
| 483 | 
            -
                    elif  | 
| 484 | 
            -
                        return  | 
| 485 | 
            -
             | 
| 486 | 
            -
                         | 
| 487 | 
            -
                    elif  | 
| 488 | 
            -
                        return  | 
| 782 | 
            +
                    if "mistake" in content or "error" in content or "avoid" in content:
         | 
| 783 | 
            +
                        return "Common Mistakes to Avoid"
         | 
| 784 | 
            +
                    elif "pattern" in content or "architecture" in content:
         | 
| 785 | 
            +
                        return (
         | 
| 786 | 
            +
                            sections[0] if sections else "Recent Learnings"
         | 
| 787 | 
            +
                        )  # First section is usually patterns
         | 
| 788 | 
            +
                    elif "guideline" in content or "standard" in content:
         | 
| 789 | 
            +
                        return "Implementation Guidelines"
         | 
| 790 | 
            +
                    elif "context" in content or "current" in content:
         | 
| 791 | 
            +
                        return "Current Technical Context"
         | 
| 489 792 | 
             
                    else:
         | 
| 490 793 | 
             
                        # Default to first available section or Recent Learnings
         | 
| 491 | 
            -
                        return sections[0] if sections else  | 
| 492 | 
            -
             | 
| 493 | 
            -
                def _build_reasoning( | 
| 494 | 
            -
             | 
| 794 | 
            +
                        return sections[0] if sections else "Recent Learnings"
         | 
| 795 | 
            +
             | 
| 796 | 
            +
                def _build_reasoning(
         | 
| 797 | 
            +
                    self,
         | 
| 798 | 
            +
                    target_agent: str,
         | 
| 799 | 
            +
                    agent_scores: Dict[str, Any],
         | 
| 800 | 
            +
                    section: str,
         | 
| 801 | 
            +
                    context: Optional[Dict],
         | 
| 802 | 
            +
                ) -> str:
         | 
| 495 803 | 
             
                    """Build human-readable reasoning for routing decision.
         | 
| 496 | 
            -
             | 
| 804 | 
            +
             | 
| 497 805 | 
             
                    Args:
         | 
| 498 806 | 
             
                        target_agent: Selected target agent
         | 
| 499 807 | 
             
                        agent_scores: All agent scores
         | 
| 500 808 | 
             
                        section: Selected section
         | 
| 501 809 | 
             
                        context: Optional context
         | 
| 502 | 
            -
             | 
| 810 | 
            +
             | 
| 503 811 | 
             
                    Returns:
         | 
| 504 812 | 
             
                        Human-readable reasoning string
         | 
| 505 813 | 
             
                    """
         | 
| 506 814 | 
             
                    if target_agent not in agent_scores:
         | 
| 507 815 | 
             
                        return f"Defaulted to {target_agent} agent due to analysis error"
         | 
| 508 | 
            -
             | 
| 816 | 
            +
             | 
| 509 817 | 
             
                    score_data = agent_scores[target_agent]
         | 
| 510 | 
            -
                    score = score_data[ | 
| 511 | 
            -
                    matched_keywords = score_data.get( | 
| 512 | 
            -
             | 
| 818 | 
            +
                    score = score_data["score"]
         | 
| 819 | 
            +
                    matched_keywords = score_data.get("matched_keywords", [])
         | 
| 820 | 
            +
             | 
| 513 821 | 
             
                    reasoning_parts = []
         | 
| 514 | 
            -
             | 
| 822 | 
            +
             | 
| 515 823 | 
             
                    # Primary reasoning
         | 
| 516 824 | 
             
                    if score > 0.3:
         | 
| 517 825 | 
             
                        reasoning_parts.append(f"Strong match for {target_agent} agent")
         | 
| @@ -519,20 +827,20 @@ class MemoryRouter(LoggerMixin): | |
| 519 827 | 
             
                        reasoning_parts.append(f"Moderate match for {target_agent} agent")
         | 
| 520 828 | 
             
                    else:
         | 
| 521 829 | 
             
                        reasoning_parts.append(f"Weak match, defaulting to {target_agent} agent")
         | 
| 522 | 
            -
             | 
| 830 | 
            +
             | 
| 523 831 | 
             
                    # Keyword evidence
         | 
| 524 832 | 
             
                    if matched_keywords:
         | 
| 525 833 | 
             
                        keyword_str = ", ".join(matched_keywords)
         | 
| 526 834 | 
             
                        reasoning_parts.append(f"matched keywords: {keyword_str}")
         | 
| 527 | 
            -
             | 
| 835 | 
            +
             | 
| 528 836 | 
             
                    # Context boosts
         | 
| 529 | 
            -
                    if score_data.get( | 
| 837 | 
            +
                    if score_data.get("context_boost"):
         | 
| 530 838 | 
             
                        reasoning_parts.append("boosted by context hint")
         | 
| 531 | 
            -
                    if score_data.get( | 
| 839 | 
            +
                    if score_data.get("task_type_boost"):
         | 
| 532 840 | 
             
                        reasoning_parts.append("boosted by task type")
         | 
| 533 | 
            -
             | 
| 841 | 
            +
             | 
| 534 842 | 
             
                    # Section selection
         | 
| 535 843 | 
             
                    if section != "Recent Learnings":
         | 
| 536 844 | 
             
                        reasoning_parts.append(f"assigned to '{section}' section")
         | 
| 537 | 
            -
             | 
| 538 | 
            -
                    return "; ".join(reasoning_parts).capitalize()
         | 
| 845 | 
            +
             | 
| 846 | 
            +
                    return "; ".join(reasoning_parts).capitalize()
         |