claude-mpm 4.1.1__py3-none-any.whl ā 4.1.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/BUILD_NUMBER +1 -1
- claude_mpm/VERSION +1 -1
- claude_mpm/__main__.py +1 -1
- claude_mpm/agents/BASE_PM.md +74 -46
- claude_mpm/agents/INSTRUCTIONS.md +11 -153
- claude_mpm/agents/WORKFLOW.md +61 -321
- claude_mpm/agents/__init__.py +11 -11
- claude_mpm/agents/agent_loader.py +23 -20
- claude_mpm/agents/agent_loader_integration.py +1 -1
- claude_mpm/agents/agents_metadata.py +27 -0
- claude_mpm/agents/async_agent_loader.py +5 -8
- claude_mpm/agents/base_agent_loader.py +36 -25
- claude_mpm/agents/frontmatter_validator.py +6 -6
- claude_mpm/agents/schema/agent_schema.json +1 -1
- claude_mpm/agents/system_agent_config.py +9 -9
- claude_mpm/agents/templates/api_qa.json +47 -2
- claude_mpm/agents/templates/engineer.json +33 -11
- claude_mpm/agents/templates/imagemagick.json +256 -0
- claude_mpm/agents/templates/qa.json +41 -2
- claude_mpm/agents/templates/ticketing.json +5 -5
- claude_mpm/agents/templates/web_qa.json +50 -2
- claude_mpm/cli/__init__.py +51 -46
- claude_mpm/cli/__main__.py +1 -1
- claude_mpm/cli/commands/__init__.py +10 -12
- claude_mpm/cli/commands/agent_manager.py +186 -181
- claude_mpm/cli/commands/agents.py +648 -1098
- claude_mpm/cli/commands/aggregate.py +30 -29
- claude_mpm/cli/commands/cleanup.py +50 -44
- claude_mpm/cli/commands/cleanup_orphaned_agents.py +25 -25
- claude_mpm/cli/commands/config.py +162 -127
- claude_mpm/cli/commands/doctor.py +52 -62
- claude_mpm/cli/commands/info.py +37 -25
- claude_mpm/cli/commands/mcp.py +3 -7
- claude_mpm/cli/commands/mcp_command_router.py +14 -18
- claude_mpm/cli/commands/mcp_install_commands.py +28 -23
- claude_mpm/cli/commands/mcp_pipx_config.py +58 -49
- claude_mpm/cli/commands/mcp_server_commands.py +23 -17
- claude_mpm/cli/commands/memory.py +339 -967
- claude_mpm/cli/commands/monitor.py +117 -88
- claude_mpm/cli/commands/run.py +233 -542
- claude_mpm/cli/commands/socketio_monitor.py +17 -19
- claude_mpm/cli/commands/tickets.py +92 -92
- claude_mpm/cli/parser.py +1 -5
- claude_mpm/cli/parsers/__init__.py +1 -1
- claude_mpm/cli/parsers/agent_manager_parser.py +50 -98
- claude_mpm/cli/parsers/agents_parser.py +2 -3
- claude_mpm/cli/parsers/base_parser.py +7 -5
- claude_mpm/cli/parsers/mcp_parser.py +4 -2
- claude_mpm/cli/parsers/monitor_parser.py +26 -18
- claude_mpm/cli/shared/__init__.py +10 -10
- claude_mpm/cli/shared/argument_patterns.py +57 -71
- claude_mpm/cli/shared/base_command.py +61 -53
- claude_mpm/cli/shared/error_handling.py +62 -58
- claude_mpm/cli/shared/output_formatters.py +78 -77
- claude_mpm/cli/startup_logging.py +280 -172
- claude_mpm/cli/utils.py +10 -11
- claude_mpm/cli_module/__init__.py +1 -1
- claude_mpm/cli_module/args.py +1 -1
- claude_mpm/cli_module/migration_example.py +5 -5
- claude_mpm/config/__init__.py +9 -9
- claude_mpm/config/agent_config.py +15 -14
- claude_mpm/config/experimental_features.py +4 -4
- claude_mpm/config/paths.py +0 -1
- claude_mpm/config/socketio_config.py +5 -6
- claude_mpm/constants.py +1 -2
- claude_mpm/core/__init__.py +8 -8
- claude_mpm/core/agent_name_normalizer.py +1 -1
- claude_mpm/core/agent_registry.py +22 -29
- claude_mpm/core/agent_session_manager.py +3 -3
- claude_mpm/core/base_service.py +7 -15
- claude_mpm/core/cache.py +4 -6
- claude_mpm/core/claude_runner.py +85 -113
- claude_mpm/core/config.py +43 -28
- claude_mpm/core/config_aliases.py +0 -9
- claude_mpm/core/config_constants.py +52 -30
- claude_mpm/core/constants.py +0 -1
- claude_mpm/core/container.py +18 -27
- claude_mpm/core/exceptions.py +2 -2
- claude_mpm/core/factories.py +10 -12
- claude_mpm/core/framework_loader.py +500 -680
- claude_mpm/core/hook_manager.py +26 -22
- claude_mpm/core/hook_performance_config.py +58 -47
- claude_mpm/core/injectable_service.py +1 -1
- claude_mpm/core/interactive_session.py +61 -152
- claude_mpm/core/interfaces.py +1 -100
- claude_mpm/core/lazy.py +5 -5
- claude_mpm/core/log_manager.py +587 -0
- claude_mpm/core/logger.py +125 -8
- claude_mpm/core/logging_config.py +15 -17
- claude_mpm/core/minimal_framework_loader.py +5 -8
- claude_mpm/core/oneshot_session.py +15 -33
- claude_mpm/core/optimized_agent_loader.py +4 -6
- claude_mpm/core/optimized_startup.py +2 -1
- claude_mpm/core/output_style_manager.py +147 -106
- claude_mpm/core/pm_hook_interceptor.py +0 -1
- claude_mpm/core/service_registry.py +11 -8
- claude_mpm/core/session_manager.py +1 -2
- claude_mpm/core/shared/__init__.py +1 -1
- claude_mpm/core/shared/config_loader.py +101 -97
- claude_mpm/core/shared/path_resolver.py +72 -68
- claude_mpm/core/shared/singleton_manager.py +56 -50
- claude_mpm/core/socketio_pool.py +26 -6
- claude_mpm/core/tool_access_control.py +4 -5
- claude_mpm/core/typing_utils.py +50 -59
- claude_mpm/core/unified_agent_registry.py +14 -19
- claude_mpm/core/unified_config.py +4 -6
- claude_mpm/core/unified_paths.py +197 -109
- claude_mpm/dashboard/open_dashboard.py +2 -4
- claude_mpm/experimental/cli_enhancements.py +51 -36
- claude_mpm/generators/agent_profile_generator.py +2 -4
- claude_mpm/hooks/base_hook.py +1 -2
- claude_mpm/hooks/claude_hooks/connection_pool.py +72 -26
- claude_mpm/hooks/claude_hooks/event_handlers.py +99 -154
- claude_mpm/hooks/claude_hooks/hook_handler.py +110 -720
- claude_mpm/hooks/claude_hooks/hook_handler_eventbus.py +104 -77
- claude_mpm/hooks/claude_hooks/hook_handler_original.py +1040 -0
- claude_mpm/hooks/claude_hooks/hook_handler_refactored.py +347 -0
- claude_mpm/hooks/claude_hooks/memory_integration.py +2 -4
- claude_mpm/hooks/claude_hooks/response_tracking.py +15 -11
- claude_mpm/hooks/claude_hooks/services/__init__.py +13 -0
- claude_mpm/hooks/claude_hooks/services/connection_manager.py +190 -0
- claude_mpm/hooks/claude_hooks/services/duplicate_detector.py +106 -0
- claude_mpm/hooks/claude_hooks/services/state_manager.py +282 -0
- claude_mpm/hooks/claude_hooks/services/subagent_processor.py +374 -0
- claude_mpm/hooks/claude_hooks/tool_analysis.py +12 -18
- claude_mpm/hooks/memory_integration_hook.py +5 -5
- claude_mpm/hooks/tool_call_interceptor.py +1 -1
- claude_mpm/hooks/validation_hooks.py +4 -4
- claude_mpm/init.py +4 -9
- claude_mpm/models/__init__.py +2 -2
- claude_mpm/models/agent_session.py +11 -14
- claude_mpm/scripts/mcp_server.py +20 -11
- claude_mpm/scripts/mcp_wrapper.py +5 -5
- claude_mpm/scripts/mpm_doctor.py +321 -0
- claude_mpm/scripts/socketio_daemon.py +28 -25
- claude_mpm/scripts/socketio_daemon_hardened.py +298 -258
- claude_mpm/scripts/socketio_server_manager.py +116 -95
- claude_mpm/services/__init__.py +49 -49
- claude_mpm/services/agent_capabilities_service.py +12 -18
- claude_mpm/services/agents/__init__.py +22 -22
- claude_mpm/services/agents/agent_builder.py +140 -119
- claude_mpm/services/agents/deployment/__init__.py +3 -3
- claude_mpm/services/agents/deployment/agent_config_provider.py +9 -9
- claude_mpm/services/agents/deployment/agent_configuration_manager.py +19 -20
- claude_mpm/services/agents/deployment/agent_definition_factory.py +1 -5
- claude_mpm/services/agents/deployment/agent_deployment.py +129 -511
- claude_mpm/services/agents/deployment/agent_discovery_service.py +4 -8
- claude_mpm/services/agents/deployment/agent_environment_manager.py +2 -7
- claude_mpm/services/agents/deployment/agent_filesystem_manager.py +6 -10
- claude_mpm/services/agents/deployment/agent_format_converter.py +11 -15
- claude_mpm/services/agents/deployment/agent_frontmatter_validator.py +2 -3
- claude_mpm/services/agents/deployment/agent_lifecycle_manager.py +5 -5
- claude_mpm/services/agents/deployment/agent_metrics_collector.py +13 -19
- claude_mpm/services/agents/deployment/agent_restore_handler.py +0 -1
- claude_mpm/services/agents/deployment/agent_template_builder.py +26 -35
- claude_mpm/services/agents/deployment/agent_validator.py +0 -1
- claude_mpm/services/agents/deployment/agent_version_manager.py +7 -9
- claude_mpm/services/agents/deployment/agent_versioning.py +3 -3
- claude_mpm/services/agents/deployment/agents_directory_resolver.py +6 -7
- claude_mpm/services/agents/deployment/async_agent_deployment.py +51 -38
- claude_mpm/services/agents/deployment/base_agent_locator.py +132 -0
- claude_mpm/services/agents/deployment/config/__init__.py +1 -1
- claude_mpm/services/agents/deployment/config/deployment_config.py +7 -8
- claude_mpm/services/agents/deployment/deployment_results_manager.py +185 -0
- claude_mpm/services/agents/deployment/deployment_type_detector.py +1 -1
- claude_mpm/services/agents/deployment/deployment_wrapper.py +18 -18
- claude_mpm/services/agents/deployment/facade/__init__.py +1 -1
- claude_mpm/services/agents/deployment/facade/deployment_executor.py +0 -3
- claude_mpm/services/agents/deployment/facade/deployment_facade.py +3 -4
- claude_mpm/services/agents/deployment/interface_adapter.py +5 -7
- claude_mpm/services/agents/deployment/multi_source_deployment_service.py +345 -276
- claude_mpm/services/agents/deployment/pipeline/__init__.py +2 -2
- claude_mpm/services/agents/deployment/pipeline/pipeline_builder.py +1 -1
- claude_mpm/services/agents/deployment/pipeline/pipeline_context.py +6 -4
- claude_mpm/services/agents/deployment/pipeline/pipeline_executor.py +3 -3
- claude_mpm/services/agents/deployment/pipeline/steps/__init__.py +2 -2
- claude_mpm/services/agents/deployment/pipeline/steps/agent_processing_step.py +14 -13
- claude_mpm/services/agents/deployment/pipeline/steps/base_step.py +0 -1
- claude_mpm/services/agents/deployment/pipeline/steps/configuration_step.py +1 -1
- claude_mpm/services/agents/deployment/pipeline/steps/target_directory_step.py +8 -9
- claude_mpm/services/agents/deployment/pipeline/steps/validation_step.py +1 -1
- claude_mpm/services/agents/deployment/processors/__init__.py +1 -1
- claude_mpm/services/agents/deployment/processors/agent_processor.py +20 -16
- claude_mpm/services/agents/deployment/refactored_agent_deployment_service.py +5 -12
- claude_mpm/services/agents/deployment/results/__init__.py +1 -1
- claude_mpm/services/agents/deployment/results/deployment_result_builder.py +1 -1
- claude_mpm/services/agents/deployment/single_agent_deployer.py +315 -0
- claude_mpm/services/agents/deployment/strategies/__init__.py +2 -2
- claude_mpm/services/agents/deployment/strategies/base_strategy.py +1 -7
- claude_mpm/services/agents/deployment/strategies/project_strategy.py +1 -4
- claude_mpm/services/agents/deployment/strategies/system_strategy.py +2 -3
- claude_mpm/services/agents/deployment/strategies/user_strategy.py +3 -7
- claude_mpm/services/agents/deployment/validation/__init__.py +1 -1
- claude_mpm/services/agents/deployment/validation/agent_validator.py +1 -1
- claude_mpm/services/agents/deployment/validation/template_validator.py +2 -2
- claude_mpm/services/agents/deployment/validation/validation_result.py +2 -6
- claude_mpm/services/agents/loading/__init__.py +1 -1
- claude_mpm/services/agents/loading/agent_profile_loader.py +6 -12
- claude_mpm/services/agents/loading/base_agent_manager.py +5 -5
- claude_mpm/services/agents/loading/framework_agent_loader.py +2 -4
- claude_mpm/services/agents/management/__init__.py +1 -1
- claude_mpm/services/agents/management/agent_capabilities_generator.py +1 -3
- claude_mpm/services/agents/management/agent_management_service.py +5 -9
- claude_mpm/services/agents/memory/__init__.py +4 -4
- claude_mpm/services/agents/memory/agent_memory_manager.py +157 -503
- claude_mpm/services/agents/memory/agent_persistence_service.py +0 -2
- claude_mpm/services/agents/memory/content_manager.py +44 -38
- claude_mpm/services/agents/memory/memory_categorization_service.py +165 -0
- claude_mpm/services/agents/memory/memory_file_service.py +103 -0
- claude_mpm/services/agents/memory/memory_format_service.py +201 -0
- claude_mpm/services/agents/memory/memory_limits_service.py +99 -0
- claude_mpm/services/agents/memory/template_generator.py +4 -6
- claude_mpm/services/agents/registry/__init__.py +11 -7
- claude_mpm/services/agents/registry/deployed_agent_discovery.py +30 -27
- claude_mpm/services/agents/registry/modification_tracker.py +3 -6
- claude_mpm/services/async_session_logger.py +1 -2
- claude_mpm/services/claude_session_logger.py +1 -2
- claude_mpm/services/cli/__init__.py +18 -0
- claude_mpm/services/cli/agent_cleanup_service.py +407 -0
- claude_mpm/services/cli/agent_dependency_service.py +395 -0
- claude_mpm/services/cli/agent_listing_service.py +463 -0
- claude_mpm/services/cli/agent_output_formatter.py +605 -0
- claude_mpm/services/cli/agent_validation_service.py +589 -0
- claude_mpm/services/cli/dashboard_launcher.py +424 -0
- claude_mpm/services/cli/memory_crud_service.py +617 -0
- claude_mpm/services/cli/memory_output_formatter.py +604 -0
- claude_mpm/services/cli/session_manager.py +513 -0
- claude_mpm/services/cli/socketio_manager.py +498 -0
- claude_mpm/services/cli/startup_checker.py +370 -0
- claude_mpm/services/command_deployment_service.py +173 -0
- claude_mpm/services/command_handler_service.py +20 -22
- claude_mpm/services/core/__init__.py +25 -25
- claude_mpm/services/core/base.py +0 -5
- claude_mpm/services/core/cache_manager.py +311 -0
- claude_mpm/services/core/interfaces/__init__.py +32 -32
- claude_mpm/services/core/interfaces/agent.py +0 -21
- claude_mpm/services/core/interfaces/communication.py +0 -27
- claude_mpm/services/core/interfaces/infrastructure.py +0 -56
- claude_mpm/services/core/interfaces/service.py +0 -29
- claude_mpm/services/core/memory_manager.py +637 -0
- claude_mpm/services/core/path_resolver.py +498 -0
- claude_mpm/services/core/service_container.py +520 -0
- claude_mpm/services/core/service_interfaces.py +436 -0
- claude_mpm/services/diagnostics/__init__.py +1 -1
- claude_mpm/services/diagnostics/checks/__init__.py +6 -6
- claude_mpm/services/diagnostics/checks/agent_check.py +152 -97
- claude_mpm/services/diagnostics/checks/base_check.py +12 -16
- claude_mpm/services/diagnostics/checks/claude_desktop_check.py +84 -81
- claude_mpm/services/diagnostics/checks/common_issues_check.py +99 -91
- claude_mpm/services/diagnostics/checks/configuration_check.py +82 -77
- claude_mpm/services/diagnostics/checks/filesystem_check.py +67 -68
- claude_mpm/services/diagnostics/checks/installation_check.py +254 -94
- claude_mpm/services/diagnostics/checks/mcp_check.py +90 -88
- claude_mpm/services/diagnostics/checks/monitor_check.py +75 -76
- claude_mpm/services/diagnostics/checks/startup_log_check.py +67 -73
- claude_mpm/services/diagnostics/diagnostic_runner.py +67 -59
- claude_mpm/services/diagnostics/doctor_reporter.py +107 -70
- claude_mpm/services/diagnostics/models.py +21 -19
- claude_mpm/services/event_aggregator.py +10 -17
- claude_mpm/services/event_bus/__init__.py +1 -1
- claude_mpm/services/event_bus/config.py +54 -35
- claude_mpm/services/event_bus/event_bus.py +76 -71
- claude_mpm/services/event_bus/relay.py +74 -64
- claude_mpm/services/events/__init__.py +11 -11
- claude_mpm/services/events/consumers/__init__.py +3 -3
- claude_mpm/services/events/consumers/dead_letter.py +71 -63
- claude_mpm/services/events/consumers/logging.py +39 -37
- claude_mpm/services/events/consumers/metrics.py +56 -57
- claude_mpm/services/events/consumers/socketio.py +82 -81
- claude_mpm/services/events/core.py +110 -99
- claude_mpm/services/events/interfaces.py +56 -72
- claude_mpm/services/events/producers/__init__.py +1 -1
- claude_mpm/services/events/producers/hook.py +38 -38
- claude_mpm/services/events/producers/system.py +46 -44
- claude_mpm/services/exceptions.py +81 -80
- claude_mpm/services/framework_claude_md_generator/__init__.py +2 -4
- claude_mpm/services/framework_claude_md_generator/content_assembler.py +3 -5
- claude_mpm/services/framework_claude_md_generator/content_validator.py +1 -1
- claude_mpm/services/framework_claude_md_generator/deployment_manager.py +4 -4
- claude_mpm/services/framework_claude_md_generator/section_generators/__init__.py +0 -1
- claude_mpm/services/framework_claude_md_generator/section_generators/agents.py +0 -2
- claude_mpm/services/framework_claude_md_generator/version_manager.py +4 -5
- claude_mpm/services/hook_service.py +6 -9
- claude_mpm/services/infrastructure/__init__.py +1 -1
- claude_mpm/services/infrastructure/context_preservation.py +8 -12
- claude_mpm/services/infrastructure/monitoring.py +21 -23
- claude_mpm/services/mcp_gateway/__init__.py +37 -37
- claude_mpm/services/mcp_gateway/auto_configure.py +95 -103
- claude_mpm/services/mcp_gateway/config/__init__.py +1 -1
- claude_mpm/services/mcp_gateway/config/config_loader.py +23 -25
- claude_mpm/services/mcp_gateway/config/config_schema.py +5 -5
- claude_mpm/services/mcp_gateway/config/configuration.py +9 -6
- claude_mpm/services/mcp_gateway/core/__init__.py +10 -10
- claude_mpm/services/mcp_gateway/core/base.py +0 -3
- claude_mpm/services/mcp_gateway/core/interfaces.py +1 -38
- claude_mpm/services/mcp_gateway/core/process_pool.py +99 -93
- claude_mpm/services/mcp_gateway/core/singleton_manager.py +65 -62
- claude_mpm/services/mcp_gateway/core/startup_verification.py +75 -74
- claude_mpm/services/mcp_gateway/main.py +2 -1
- claude_mpm/services/mcp_gateway/registry/service_registry.py +5 -8
- claude_mpm/services/mcp_gateway/registry/tool_registry.py +1 -1
- claude_mpm/services/mcp_gateway/server/__init__.py +1 -1
- claude_mpm/services/mcp_gateway/server/mcp_gateway.py +12 -19
- claude_mpm/services/mcp_gateway/server/stdio_handler.py +4 -3
- claude_mpm/services/mcp_gateway/server/stdio_server.py +79 -71
- claude_mpm/services/mcp_gateway/tools/__init__.py +2 -2
- claude_mpm/services/mcp_gateway/tools/base_adapter.py +5 -6
- claude_mpm/services/mcp_gateway/tools/document_summarizer.py +13 -22
- claude_mpm/services/mcp_gateway/tools/health_check_tool.py +79 -78
- claude_mpm/services/mcp_gateway/tools/hello_world.py +12 -14
- claude_mpm/services/mcp_gateway/tools/ticket_tools.py +42 -49
- claude_mpm/services/mcp_gateway/tools/unified_ticket_tool.py +51 -55
- claude_mpm/services/memory/__init__.py +3 -3
- claude_mpm/services/memory/builder.py +3 -6
- claude_mpm/services/memory/cache/__init__.py +1 -1
- claude_mpm/services/memory/cache/shared_prompt_cache.py +3 -5
- claude_mpm/services/memory/cache/simple_cache.py +1 -1
- claude_mpm/services/memory/indexed_memory.py +5 -7
- claude_mpm/services/memory/optimizer.py +7 -10
- claude_mpm/services/memory/router.py +8 -9
- claude_mpm/services/memory_hook_service.py +48 -34
- claude_mpm/services/monitor_build_service.py +77 -73
- claude_mpm/services/port_manager.py +130 -108
- claude_mpm/services/project/analyzer.py +12 -10
- claude_mpm/services/project/registry.py +11 -11
- claude_mpm/services/recovery_manager.py +10 -19
- claude_mpm/services/response_tracker.py +0 -1
- claude_mpm/services/runner_configuration_service.py +19 -20
- claude_mpm/services/session_management_service.py +7 -11
- claude_mpm/services/shared/__init__.py +1 -1
- claude_mpm/services/shared/async_service_base.py +58 -50
- claude_mpm/services/shared/config_service_base.py +73 -67
- claude_mpm/services/shared/lifecycle_service_base.py +82 -78
- claude_mpm/services/shared/manager_base.py +94 -82
- claude_mpm/services/shared/service_factory.py +96 -98
- claude_mpm/services/socketio/__init__.py +3 -3
- claude_mpm/services/socketio/client_proxy.py +5 -5
- claude_mpm/services/socketio/event_normalizer.py +199 -181
- claude_mpm/services/socketio/handlers/__init__.py +3 -3
- claude_mpm/services/socketio/handlers/base.py +5 -4
- claude_mpm/services/socketio/handlers/connection.py +163 -136
- claude_mpm/services/socketio/handlers/file.py +13 -14
- claude_mpm/services/socketio/handlers/git.py +12 -7
- claude_mpm/services/socketio/handlers/hook.py +49 -44
- claude_mpm/services/socketio/handlers/memory.py +0 -1
- claude_mpm/services/socketio/handlers/project.py +0 -1
- claude_mpm/services/socketio/handlers/registry.py +37 -19
- claude_mpm/services/socketio/migration_utils.py +98 -84
- claude_mpm/services/socketio/server/__init__.py +1 -1
- claude_mpm/services/socketio/server/broadcaster.py +81 -87
- claude_mpm/services/socketio/server/core.py +65 -54
- claude_mpm/services/socketio/server/eventbus_integration.py +95 -56
- claude_mpm/services/socketio/server/main.py +64 -38
- claude_mpm/services/socketio_client_manager.py +10 -12
- claude_mpm/services/subprocess_launcher_service.py +4 -7
- claude_mpm/services/system_instructions_service.py +13 -14
- claude_mpm/services/ticket_manager.py +2 -2
- claude_mpm/services/utility_service.py +5 -13
- claude_mpm/services/version_control/__init__.py +16 -16
- claude_mpm/services/version_control/branch_strategy.py +5 -8
- claude_mpm/services/version_control/conflict_resolution.py +9 -23
- claude_mpm/services/version_control/git_operations.py +5 -7
- claude_mpm/services/version_control/semantic_versioning.py +16 -17
- claude_mpm/services/version_control/version_parser.py +13 -18
- claude_mpm/services/version_service.py +10 -11
- claude_mpm/storage/__init__.py +1 -1
- claude_mpm/storage/state_storage.py +22 -28
- claude_mpm/utils/__init__.py +6 -6
- claude_mpm/utils/agent_dependency_loader.py +47 -33
- claude_mpm/utils/config_manager.py +11 -14
- claude_mpm/utils/dependency_cache.py +1 -1
- claude_mpm/utils/dependency_manager.py +13 -17
- claude_mpm/utils/dependency_strategies.py +8 -10
- claude_mpm/utils/environment_context.py +3 -9
- claude_mpm/utils/error_handler.py +3 -13
- claude_mpm/utils/file_utils.py +1 -1
- claude_mpm/utils/path_operations.py +8 -12
- claude_mpm/utils/robust_installer.py +110 -33
- claude_mpm/utils/subprocess_utils.py +5 -6
- claude_mpm/validation/agent_validator.py +3 -6
- claude_mpm/validation/frontmatter_validator.py +1 -1
- {claude_mpm-4.1.1.dist-info ā claude_mpm-4.1.3.dist-info}/METADATA +1 -1
- claude_mpm-4.1.3.dist-info/RECORD +528 -0
- claude_mpm/cli/commands/run_config_checker.py +0 -160
- claude_mpm-4.1.1.dist-info/RECORD +0 -494
- {claude_mpm-4.1.1.dist-info ā claude_mpm-4.1.3.dist-info}/WHEEL +0 -0
- {claude_mpm-4.1.1.dist-info ā claude_mpm-4.1.3.dist-info}/entry_points.txt +0 -0
- {claude_mpm-4.1.1.dist-info ā claude_mpm-4.1.3.dist-info}/licenses/LICENSE +0 -0
- {claude_mpm-4.1.1.dist-info ā claude_mpm-4.1.3.dist-info}/top_level.txt +0 -0
|
@@ -26,7 +26,7 @@ import logging
|
|
|
26
26
|
import os
|
|
27
27
|
from enum import Enum
|
|
28
28
|
from pathlib import Path
|
|
29
|
-
from typing import
|
|
29
|
+
from typing import Dict, Optional
|
|
30
30
|
|
|
31
31
|
from claude_mpm.services.memory.cache.shared_prompt_cache import SharedPromptCache
|
|
32
32
|
|
|
@@ -39,7 +39,7 @@ BASE_AGENT_CACHE_KEY = "base_agent:instructions"
|
|
|
39
39
|
|
|
40
40
|
def _get_base_agent_file() -> Path:
|
|
41
41
|
"""Get the base agent file path with priority-based search.
|
|
42
|
-
|
|
42
|
+
|
|
43
43
|
Priority order:
|
|
44
44
|
1. Environment variable override (CLAUDE_MPM_BASE_AGENT_PATH)
|
|
45
45
|
2. Current working directory (for local development)
|
|
@@ -54,53 +54,66 @@ def _get_base_agent_file() -> Path:
|
|
|
54
54
|
if env_base_agent.exists():
|
|
55
55
|
logger.info(f"Using environment variable base_agent: {env_base_agent}")
|
|
56
56
|
return env_base_agent
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
57
|
+
logger.warning(
|
|
58
|
+
f"CLAUDE_MPM_BASE_AGENT_PATH set but file doesn't exist: {env_base_agent}"
|
|
59
|
+
)
|
|
60
|
+
|
|
60
61
|
# Priority 1: Check current working directory for local development
|
|
61
62
|
cwd = Path.cwd()
|
|
62
63
|
cwd_base_agent = cwd / "src" / "claude_mpm" / "agents" / "base_agent.json"
|
|
63
64
|
if cwd_base_agent.exists():
|
|
64
65
|
logger.info(f"Using local development base_agent from cwd: {cwd_base_agent}")
|
|
65
66
|
return cwd_base_agent
|
|
66
|
-
|
|
67
|
+
|
|
67
68
|
# Priority 2: Check known development locations
|
|
68
69
|
known_dev_paths = [
|
|
69
70
|
Path("/Users/masa/Projects/claude-mpm/src/claude_mpm/agents/base_agent.json"),
|
|
70
|
-
Path.home()
|
|
71
|
-
|
|
71
|
+
Path.home()
|
|
72
|
+
/ "Projects"
|
|
73
|
+
/ "claude-mpm"
|
|
74
|
+
/ "src"
|
|
75
|
+
/ "claude_mpm"
|
|
76
|
+
/ "agents"
|
|
77
|
+
/ "base_agent.json",
|
|
78
|
+
Path.home()
|
|
79
|
+
/ "projects"
|
|
80
|
+
/ "claude-mpm"
|
|
81
|
+
/ "src"
|
|
82
|
+
/ "claude_mpm"
|
|
83
|
+
/ "agents"
|
|
84
|
+
/ "base_agent.json",
|
|
72
85
|
]
|
|
73
|
-
|
|
86
|
+
|
|
74
87
|
for dev_path in known_dev_paths:
|
|
75
88
|
if dev_path.exists():
|
|
76
89
|
logger.info(f"Using development base_agent: {dev_path}")
|
|
77
90
|
return dev_path
|
|
78
|
-
|
|
91
|
+
|
|
79
92
|
# Priority 3: Check user override location
|
|
80
93
|
user_base_agent = Path.home() / ".claude" / "agents" / "base_agent.json"
|
|
81
94
|
if user_base_agent.exists():
|
|
82
95
|
logger.info(f"Using user override base_agent: {user_base_agent}")
|
|
83
96
|
return user_base_agent
|
|
84
|
-
|
|
97
|
+
|
|
85
98
|
# Priority 4: Check if we're running from a wheel installation
|
|
86
99
|
try:
|
|
87
100
|
import claude_mpm
|
|
88
101
|
|
|
89
102
|
package_path = Path(claude_mpm.__file__).parent
|
|
90
103
|
path_str = str(package_path.resolve())
|
|
91
|
-
|
|
104
|
+
|
|
92
105
|
# For development/editable installs, check if there's a local src directory
|
|
93
106
|
if "site-packages" in path_str or "dist-packages" in path_str:
|
|
94
107
|
# Check if this is a pipx/pip installation
|
|
95
108
|
if "pipx" in path_str:
|
|
96
109
|
logger.debug(f"Detected pipx installation at {package_path}")
|
|
97
|
-
|
|
110
|
+
|
|
98
111
|
# For wheel installations, check data directory
|
|
99
112
|
data_base_agent = package_path / "data" / "agents" / "base_agent.json"
|
|
100
113
|
if data_base_agent.exists():
|
|
101
114
|
logger.info(f"Using wheel installation base_agent: {data_base_agent}")
|
|
102
115
|
return data_base_agent
|
|
103
|
-
|
|
116
|
+
|
|
104
117
|
# Also check direct agents directory in package
|
|
105
118
|
pkg_base_agent = package_path / "agents" / "base_agent.json"
|
|
106
119
|
if pkg_base_agent.exists():
|
|
@@ -108,7 +121,7 @@ def _get_base_agent_file() -> Path:
|
|
|
108
121
|
return pkg_base_agent
|
|
109
122
|
except Exception as e:
|
|
110
123
|
logger.debug(f"Exception checking package path: {e}")
|
|
111
|
-
|
|
124
|
+
|
|
112
125
|
# Final fallback: Use the base_agent.json relative to this file
|
|
113
126
|
base_agent_path = Path(__file__).parent / "base_agent.json"
|
|
114
127
|
if base_agent_path.exists():
|
|
@@ -117,7 +130,7 @@ def _get_base_agent_file() -> Path:
|
|
|
117
130
|
|
|
118
131
|
# Error if no base agent found
|
|
119
132
|
logger.error("Base agent template file not found in any location")
|
|
120
|
-
logger.error(
|
|
133
|
+
logger.error("Searched locations:")
|
|
121
134
|
logger.error(f" 1. CWD: {cwd_base_agent}")
|
|
122
135
|
logger.error(f" 2. Dev paths: {known_dev_paths}")
|
|
123
136
|
logger.error(f" 3. User: {user_base_agent}")
|
|
@@ -244,7 +257,7 @@ def load_base_agent_instructions(force_reload: bool = False) -> Optional[str]:
|
|
|
244
257
|
logger.debug(f"Loading base agent instructions from: {base_agent_file}")
|
|
245
258
|
|
|
246
259
|
# Load JSON and extract instructions
|
|
247
|
-
with open(base_agent_file,
|
|
260
|
+
with open(base_agent_file, encoding="utf-8") as f:
|
|
248
261
|
base_agent_data = json.load(f)
|
|
249
262
|
|
|
250
263
|
# Extract instructions from the JSON structure
|
|
@@ -366,7 +379,7 @@ def _build_dynamic_prompt(content: str, template: PromptTemplate) -> str:
|
|
|
366
379
|
|
|
367
380
|
# Add sections based on template
|
|
368
381
|
template_name = template.value
|
|
369
|
-
for
|
|
382
|
+
for _section_key, section_config in TEMPLATE_SECTIONS.items():
|
|
370
383
|
if template_name in section_config["templates"]:
|
|
371
384
|
section_name = section_config["content"]
|
|
372
385
|
assert isinstance(section_name, str), "Section name must be string"
|
|
@@ -543,9 +556,7 @@ def prepend_base_instructions(
|
|
|
543
556
|
)
|
|
544
557
|
|
|
545
558
|
# Combine base instructions with agent prompt
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
return combined_prompt
|
|
559
|
+
return f"{base_instructions}{separator}{agent_prompt}"
|
|
549
560
|
|
|
550
561
|
|
|
551
562
|
def clear_base_agent_cache() -> None:
|
|
@@ -603,11 +614,11 @@ if not validate_base_agent_file():
|
|
|
603
614
|
|
|
604
615
|
# Export key components
|
|
605
616
|
__all__ = [
|
|
606
|
-
"
|
|
607
|
-
"
|
|
617
|
+
"TEMPLATE_SECTIONS",
|
|
618
|
+
"PromptTemplate",
|
|
608
619
|
"clear_base_agent_cache",
|
|
609
620
|
"get_base_agent_path",
|
|
621
|
+
"load_base_agent_instructions",
|
|
622
|
+
"prepend_base_instructions",
|
|
610
623
|
"validate_base_agent_file",
|
|
611
|
-
"PromptTemplate",
|
|
612
|
-
"TEMPLATE_SECTIONS",
|
|
613
624
|
]
|
|
@@ -36,9 +36,9 @@ class ValidationResult:
|
|
|
36
36
|
warnings: List[str]
|
|
37
37
|
corrections: List[str]
|
|
38
38
|
corrected_frontmatter: Optional[Dict[str, Any]] = None
|
|
39
|
-
field_corrections: Optional[
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
field_corrections: Optional[Dict[str, Any]] = (
|
|
40
|
+
None # Specific field-level corrections
|
|
41
|
+
)
|
|
42
42
|
|
|
43
43
|
|
|
44
44
|
class FrontmatterValidator:
|
|
@@ -139,7 +139,7 @@ class FrontmatterValidator:
|
|
|
139
139
|
)
|
|
140
140
|
if schema_path.exists():
|
|
141
141
|
try:
|
|
142
|
-
with open(schema_path
|
|
142
|
+
with open(schema_path) as f:
|
|
143
143
|
return json.load(f)
|
|
144
144
|
except Exception as e:
|
|
145
145
|
logger.warning(f"Failed to load frontmatter schema: {e}")
|
|
@@ -510,7 +510,7 @@ class FrontmatterValidator:
|
|
|
510
510
|
ValidationResult with validation status
|
|
511
511
|
"""
|
|
512
512
|
try:
|
|
513
|
-
with open(file_path
|
|
513
|
+
with open(file_path) as f:
|
|
514
514
|
content = f.read()
|
|
515
515
|
|
|
516
516
|
# Extract frontmatter
|
|
@@ -574,7 +574,7 @@ class FrontmatterValidator:
|
|
|
574
574
|
|
|
575
575
|
if result.field_corrections and not dry_run:
|
|
576
576
|
try:
|
|
577
|
-
with open(file_path
|
|
577
|
+
with open(file_path) as f:
|
|
578
578
|
content = f.read()
|
|
579
579
|
|
|
580
580
|
# Find frontmatter boundaries
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"agent_type": {
|
|
25
25
|
"type": "string",
|
|
26
26
|
"description": "Type of agent",
|
|
27
|
-
"enum": ["base", "engineer", "qa", "documentation", "research", "security", "ops", "data_engineer", "version_control", "project_organizer"]
|
|
27
|
+
"enum": ["base", "engineer", "qa", "documentation", "research", "security", "ops", "data_engineer", "version_control", "project_organizer", "imagemagick"]
|
|
28
28
|
},
|
|
29
29
|
"metadata": {
|
|
30
30
|
"type": "object",
|
|
@@ -17,7 +17,7 @@ Created: 2025-07-16
|
|
|
17
17
|
|
|
18
18
|
import logging
|
|
19
19
|
from dataclasses import dataclass, field
|
|
20
|
-
from typing import Any, Dict, List, Optional
|
|
20
|
+
from typing import Any, Dict, List, Optional
|
|
21
21
|
|
|
22
22
|
from ..config.default_model_config import (
|
|
23
23
|
DefaultModelConfigManager,
|
|
@@ -27,7 +27,7 @@ from ..config.model_env_defaults import (
|
|
|
27
27
|
ModelEnvironmentLoader,
|
|
28
28
|
get_model_for_agent_from_env,
|
|
29
29
|
)
|
|
30
|
-
from ..services.model_selector import
|
|
30
|
+
from ..services.model_selector import ModelSelector, ModelType
|
|
31
31
|
|
|
32
32
|
logger = logging.getLogger(__name__)
|
|
33
33
|
|
|
@@ -518,8 +518,8 @@ class SystemAgentConfigManager:
|
|
|
518
518
|
"capabilities_coverage": {
|
|
519
519
|
"total_capabilities": len(all_capabilities),
|
|
520
520
|
"total_specializations": len(all_specializations),
|
|
521
|
-
"unique_capabilities": sorted(
|
|
522
|
-
"unique_specializations": sorted(
|
|
521
|
+
"unique_capabilities": sorted(all_capabilities),
|
|
522
|
+
"unique_specializations": sorted(all_specializations),
|
|
523
523
|
},
|
|
524
524
|
"configuration_health": self.validate_agent_model_assignments(),
|
|
525
525
|
}
|
|
@@ -620,13 +620,13 @@ if __name__ == "__main__":
|
|
|
620
620
|
|
|
621
621
|
# Show model distribution
|
|
622
622
|
distribution = manager.get_model_distribution()
|
|
623
|
-
print(
|
|
623
|
+
print("\nModel Distribution:")
|
|
624
624
|
for model_id, count in distribution.items():
|
|
625
625
|
print(f" {model_id}: {count} agents")
|
|
626
626
|
|
|
627
627
|
# Show agents by model
|
|
628
|
-
print(
|
|
629
|
-
for model_id in distribution
|
|
628
|
+
print("\nAgents by Model:")
|
|
629
|
+
for model_id in distribution:
|
|
630
630
|
agents_with_model = manager.get_agents_by_model(model_id)
|
|
631
631
|
print(f" {model_id}:")
|
|
632
632
|
for agent in agents_with_model:
|
|
@@ -634,7 +634,7 @@ if __name__ == "__main__":
|
|
|
634
634
|
|
|
635
635
|
# Validation
|
|
636
636
|
validation = manager.validate_agent_model_assignments()
|
|
637
|
-
print(
|
|
637
|
+
print("\nValidation Results:")
|
|
638
638
|
print(f" Valid: {validation['valid']}")
|
|
639
639
|
print(f" Issues: {len(validation['issues'])}")
|
|
640
640
|
print(f" Warnings: {len(validation['warnings'])}")
|
|
@@ -642,7 +642,7 @@ if __name__ == "__main__":
|
|
|
642
642
|
|
|
643
643
|
# Configuration summary
|
|
644
644
|
summary = manager.get_configuration_summary()
|
|
645
|
-
print(
|
|
645
|
+
print("\nConfiguration Summary:")
|
|
646
646
|
print(f" Enabled Agents: {summary['enabled_agents']}")
|
|
647
647
|
print(f" Environment Overrides: {len(summary['environment_overrides'])}")
|
|
648
648
|
print(
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schema_version": "1.2.0",
|
|
3
3
|
"agent_id": "api-qa-agent",
|
|
4
|
-
"agent_version": "1.
|
|
4
|
+
"agent_version": "1.1.0",
|
|
5
5
|
"agent_type": "qa",
|
|
6
6
|
"metadata": {
|
|
7
7
|
"name": "API QA Agent",
|
|
@@ -20,9 +20,54 @@
|
|
|
20
20
|
],
|
|
21
21
|
"author": "Claude MPM Team",
|
|
22
22
|
"created_at": "2025-08-19T00:00:00.000000Z",
|
|
23
|
-
"updated_at": "2025-08-
|
|
23
|
+
"updated_at": "2025-08-24T00:00:00.000000Z",
|
|
24
24
|
"color": "blue"
|
|
25
25
|
},
|
|
26
|
+
"routing": {
|
|
27
|
+
"keywords": [
|
|
28
|
+
"api",
|
|
29
|
+
"endpoint",
|
|
30
|
+
"rest",
|
|
31
|
+
"graphql",
|
|
32
|
+
"backend",
|
|
33
|
+
"server",
|
|
34
|
+
"auth",
|
|
35
|
+
"authentication",
|
|
36
|
+
"authorization",
|
|
37
|
+
"database",
|
|
38
|
+
"microservice",
|
|
39
|
+
"webhook",
|
|
40
|
+
"oauth",
|
|
41
|
+
"jwt",
|
|
42
|
+
"token"
|
|
43
|
+
],
|
|
44
|
+
"paths": [
|
|
45
|
+
"/api/",
|
|
46
|
+
"/routes/",
|
|
47
|
+
"/controllers/",
|
|
48
|
+
"/services/",
|
|
49
|
+
"/models/",
|
|
50
|
+
"/middleware/",
|
|
51
|
+
"/handlers/",
|
|
52
|
+
"/resolvers/",
|
|
53
|
+
"/schemas/"
|
|
54
|
+
],
|
|
55
|
+
"extensions": [
|
|
56
|
+
".py",
|
|
57
|
+
".js",
|
|
58
|
+
".ts",
|
|
59
|
+
".go",
|
|
60
|
+
".java",
|
|
61
|
+
".rb",
|
|
62
|
+
".php",
|
|
63
|
+
".cs",
|
|
64
|
+
".graphql",
|
|
65
|
+
".gql"
|
|
66
|
+
],
|
|
67
|
+
"priority": 100,
|
|
68
|
+
"confidence_threshold": 0.7,
|
|
69
|
+
"description": "Use for backend API, REST, GraphQL, and server-side testing"
|
|
70
|
+
},
|
|
26
71
|
"capabilities": {
|
|
27
72
|
"model": "sonnet",
|
|
28
73
|
"tools": [
|
|
@@ -1,11 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "Engineer Agent",
|
|
3
|
-
"description": "Clean architecture specialist with
|
|
3
|
+
"description": "Clean architecture specialist with AGGRESSIVE code reduction focus, strict modularization, and dependency injection",
|
|
4
4
|
"schema_version": "1.2.0",
|
|
5
5
|
"agent_id": "engineer",
|
|
6
|
-
"agent_version": "3.
|
|
7
|
-
"template_version": "
|
|
6
|
+
"agent_version": "3.7.0",
|
|
7
|
+
"template_version": "2.0.0",
|
|
8
8
|
"template_changelog": [
|
|
9
|
+
{
|
|
10
|
+
"version": "2.0.0",
|
|
11
|
+
"date": "2025-08-24",
|
|
12
|
+
"description": "Major Enhancement: CODE REDUCTION IMPERATIVE as #1 priority, 800-line hard limit (up from 500), dependency injection as DEFAULT pattern, enhanced refactoring triggers"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"version": "1.1.0",
|
|
16
|
+
"date": "2025-08-24",
|
|
17
|
+
"description": "Enhanced: Added aggressive code reduction imperative, 800-line file limit, and dependency injection requirements"
|
|
18
|
+
},
|
|
9
19
|
{
|
|
10
20
|
"version": "1.0.1",
|
|
11
21
|
"date": "2025-08-22",
|
|
@@ -20,7 +30,7 @@
|
|
|
20
30
|
"agent_type": "engineer",
|
|
21
31
|
"metadata": {
|
|
22
32
|
"name": "Engineer Agent",
|
|
23
|
-
"description": "Clean architecture specialist with
|
|
33
|
+
"description": "Clean architecture specialist with AGGRESSIVE code reduction focus, strict modularization, and dependency injection",
|
|
24
34
|
"category": "engineering",
|
|
25
35
|
"tags": [
|
|
26
36
|
"engineering",
|
|
@@ -31,11 +41,14 @@
|
|
|
31
41
|
"refactoring",
|
|
32
42
|
"code-reuse",
|
|
33
43
|
"pattern-adherence",
|
|
34
|
-
"integration"
|
|
44
|
+
"integration",
|
|
45
|
+
"dependency-injection",
|
|
46
|
+
"modularization",
|
|
47
|
+
"800-line-limit"
|
|
35
48
|
],
|
|
36
49
|
"author": "Claude MPM Team",
|
|
37
50
|
"created_at": "2025-07-27T03:45:51.472561Z",
|
|
38
|
-
"updated_at": "2025-08-
|
|
51
|
+
"updated_at": "2025-08-24T15:30:00.000000Z",
|
|
39
52
|
"color": "blue"
|
|
40
53
|
},
|
|
41
54
|
"capabilities": {
|
|
@@ -68,31 +81,40 @@
|
|
|
68
81
|
]
|
|
69
82
|
}
|
|
70
83
|
},
|
|
71
|
-
"instructions": "# Engineer Agent\n\n**Inherits from**: BASE_AGENT_TEMPLATE.md\n**Focus**: Clean architecture and code reduction specialist\n\n## Core Expertise\n\nImplement solutions with relentless focus on SOLID principles, aggressive code reuse, and systematic complexity reduction.\n\n## Engineering Standards\n\n### SOLID Principles (MANDATORY)\n- **S**: Single Responsibility - Each unit does ONE thing well\n- **O**: Open/Closed - Extend without modification\n- **L**: Liskov Substitution - Derived classes fully substitutable\n- **I**: Interface Segregation - Many specific interfaces\n- **D**: Dependency Inversion - Depend on abstractions\n\n### Code Organization Rules\n- **File Length**: Maximum
|
|
84
|
+
"instructions": "# Engineer Agent\n\n**Inherits from**: BASE_AGENT_TEMPLATE.md\n**Focus**: Clean architecture and AGGRESSIVE code reduction specialist\n\n## Core Expertise\n\nImplement solutions with relentless focus on SOLID principles, aggressive code reuse, and systematic complexity reduction.\n\n## š“ CODE REDUCTION IMPERATIVE\n\n**MANDATORY**: Actively seek EVERY opportunity to reduce code:\n- **Eliminate Duplication**: Extract and reuse ANY code appearing 2+ times\n- **Simplify Complex Logic**: Break down nested conditionals, use early returns\n- **Remove Unnecessary Abstractions**: Delete layers that don't add value\n- **Consolidate Similar Functions**: Merge functions with overlapping purposes\n- **Use Built-in Features**: Prefer language/framework features over custom implementations\n- **Delete Dead Code**: Remove unused functions, variables, and imports immediately\n- **Refactor Before Adding**: ALWAYS try to solve by refactoring existing code first\n\n### Code Reduction Metrics\n- Target 20-40% reduction in every refactoring\n- Measure: Lines of code, cyclomatic complexity, duplication percentage\n- Track: Functions consolidated, abstractions removed, utilities created\n\n## Engineering Standards\n\n### DEPENDENCY INJECTION FIRST (When Language Supports)\n**ALWAYS** use dependency injection as the DEFAULT pattern for:\n- **Service Dependencies**: Inject services, never instantiate directly\n- **Configuration Management**: Inject config objects, not hardcoded values\n- **External Resources**: Database, API clients, file systems via interfaces\n- **Testing & Mocking**: All dependencies mockable through constructor injection\n- **Lifecycle Management**: Container-managed singletons and scoped instances\n\nExample pattern:\n```typescript\n// ALWAYS THIS:\nclass UserService {\n constructor(\n private db: IDatabase,\n private cache: ICache,\n private logger: ILogger\n ) {}\n}\n\n// NEVER THIS:\nclass UserService {\n private db = new PostgresDB();\n private cache = new RedisCache();\n private logger = new ConsoleLogger();\n}\n```\n\n### SOLID Principles (MANDATORY)\n- **S**: Single Responsibility - Each unit does ONE thing well\n- **O**: Open/Closed - Extend without modification\n- **L**: Liskov Substitution - Derived classes fully substitutable\n- **I**: Interface Segregation - Many specific interfaces\n- **D**: Dependency Inversion - Depend on abstractions, inject dependencies\n\n### šØ STRICT FILE SIZE LIMITS\n- **800-Line HARD LIMIT**: Files exceeding 800 lines MUST be modularized\n- **600-Line WARNING**: Start planning modularization at 600 lines\n- **400-Line IDEAL**: Target file size for optimal maintainability\n- **Module Breakdown Strategy**:\n - Core logic: 300-400 lines max\n - Public API/Index: <100 lines\n - Types/Interfaces: Separate file\n - Utilities: Separate module\n - Tests: Co-located, separate file\n\n### Code Organization Rules\n- **File Length**: Maximum 800 lines (HARD LIMIT), ideal 400 lines\n- **Function Length**: Maximum 30 lines (ideal: 10-20)\n- **Nesting Depth**: Maximum 3 levels (prefer 1-2)\n- **Module Structure**: Split by feature/domain at 600 lines\n- **Parameters**: Maximum 3 per function (use objects for more)\n- **Class Size**: Maximum 200 lines per class\n- **Interface Segregation**: 3-5 methods per interface maximum\n\n### Before Writing Code Checklist\n1. ā Can I DELETE code instead of adding?\n2. ā Can I REUSE existing functionality?\n3. ā Can I REFACTOR to solve this?\n4. ā Can I use a BUILT-IN feature?\n5. ā Is dependency injection configured?\n6. ā Will this exceed file size limits?\n7. ā Is new code ABSOLUTELY necessary?\n\n## Implementation Checklist\n\n**Pre-Implementation**:\n- [ ] Scan for code to DELETE first\n- [ ] Identify ALL reusable components\n- [ ] Plan dependency injection structure\n- [ ] Design module boundaries (600-line limit)\n- [ ] Check for existing similar functionality\n- [ ] Review agent memory for patterns\n\n**During Implementation**:\n- [ ] Apply dependency injection EVERYWHERE\n- [ ] Extract shared logic IMMEDIATELY (2+ uses)\n- [ ] Keep files under 800 lines ALWAYS\n- [ ] Keep functions under 30 lines\n- [ ] Maximum 2 levels of nesting preferred\n- [ ] Consolidate similar functions aggressively\n- [ ] Use interfaces for ALL dependencies\n- [ ] Document WHY, not what\n\n**Post-Implementation**:\n- [ ] Files under 800 lines? (MANDATORY)\n- [ ] Can DELETE more code?\n- [ ] Can CONSOLIDATE more functions?\n- [ ] All dependencies injected?\n- [ ] Interfaces defined for all services?\n- [ ] Tests use dependency injection?\n- [ ] Achieved 20%+ code reduction?\n\n## Modularization Strategy\n\nWhen file approaches 600 lines, IMMEDIATELY modularize:\n\n```\nfeature/\nāāā index.ts (<100 lines, public API only)\nāāā types.ts (all type definitions)\nāāā interfaces.ts (all interfaces)\nāāā config.ts (configuration with DI)\nāāā core/\nā āāā service.ts (<400 lines, main logic)\nā āāā repository.ts (<300 lines, data access)\nā āāā validator.ts (<200 lines, validation)\nāāā utils/\nā āāā helpers.ts (shared utilities)\nā āāā constants.ts (constants and enums)\nāāā __tests__/\n āāā service.test.ts\n āāā repository.test.ts\n āāā validator.test.ts\n```\n\n## Refactoring Triggers\n\n**IMMEDIATE action required**:\n- File exceeding 600 lines ā Plan modularization NOW\n- File exceeding 800 lines ā STOP and modularize\n- Function exceeding 30 lines ā Extract helpers\n- Duplicate code 2+ times ā Create shared utility\n- Nesting >2 levels ā Flatten with early returns\n- Direct instantiation ā Convert to dependency injection\n- Similar functions exist ā Consolidate immediately\n- Complex conditionals ā Extract to named functions\n- Dead code found ā Delete immediately\n\n## Testing Requirements\n\n- Use dependency injection for ALL mocks\n- Test through interfaces, not implementations\n- Unit tests for all public functions\n- Integration tests for module boundaries\n- Mock all external dependencies\n- Ensure complete isolation\n- Co-locate tests with code\n\n## Documentation Standards\n\nFocus on WHY and ARCHITECTURE:\n```typescript\n/**\n * WHY: JWT with bcrypt because:\n * - Stateless auth across services\n * - Resistant to rainbow tables\n * - 24h expiry balances security/UX\n * \n * ARCHITECTURE: Injected via IAuthService interface\n * - Allows swapping auth strategies\n * - Enables testing with mock providers\n * - Supports multiple auth backends\n */\n```\n\nDocument:\n- Dependency injection decisions\n- Why code was DELETED or CONSOLIDATED\n- Module boundary rationale\n- Interface design choices\n- Code reduction achievements\n\n## Engineer-Specific Todo Patterns\n\n- `[Engineer] Reduce user service from 1200 to <800 lines`\n- `[Engineer] Extract duplicate validation logic (5 occurrences)`\n- `[Engineer] Convert direct DB calls to dependency injection`\n- `[Engineer] Consolidate 3 similar email functions`\n- `[Engineer] Delete unused legacy authentication code`\n- `[Engineer] Modularize order processing (950 lines)`\n\n## Quality Gates\n\nNEVER mark complete without:\n- ALL files under 800 lines (MANDATORY)\n- Dependency injection used throughout\n- 20%+ code reduction achieved\n- Zero code duplication\n- All similar functions consolidated\n- Dead code eliminated\n- Interfaces defined for all services\n- Tests using dependency injection\n- Documentation of reduction achieved",
|
|
72
85
|
"knowledge": {
|
|
73
86
|
"domain_expertise": [
|
|
74
87
|
"SOLID principles application in production codebases",
|
|
75
88
|
"Clean architecture patterns and domain-driven design",
|
|
76
|
-
"
|
|
89
|
+
"Aggressive code reduction and simplification techniques",
|
|
77
90
|
"Dependency injection and inversion of control patterns",
|
|
91
|
+
"Modularization strategies for large codebases",
|
|
78
92
|
"Refactoring strategies for legacy code improvement",
|
|
79
93
|
"Implementation patterns derived from AST analysis",
|
|
80
94
|
"Codebase-specific conventions and architectural decisions",
|
|
81
95
|
"Integration constraints and dependency requirements",
|
|
82
96
|
"Security patterns and vulnerability mitigation techniques",
|
|
83
|
-
"Performance optimization based on code structure analysis"
|
|
97
|
+
"Performance optimization based on code structure analysis",
|
|
98
|
+
"File size management and module boundary design"
|
|
84
99
|
],
|
|
85
100
|
"best_practices": [
|
|
86
|
-
"ALWAYS search for
|
|
101
|
+
"ALWAYS search for code to DELETE before adding new code",
|
|
102
|
+
"Apply dependency injection as the DEFAULT pattern everywhere",
|
|
103
|
+
"Enforce 800-line HARD LIMIT on all files without exception",
|
|
104
|
+
"Extract and reuse ANY code appearing 2+ times immediately",
|
|
105
|
+
"Consolidate similar functions aggressively to reduce duplication",
|
|
87
106
|
"Apply SOLID principles rigorously in every implementation",
|
|
88
107
|
"Treat every bug fix as an opportunity to reduce code complexity",
|
|
89
108
|
"Refactor to consolidate duplicate patterns into shared utilities",
|
|
90
109
|
"Maintain strict separation of concerns between layers",
|
|
110
|
+
"Use built-in language features over custom implementations",
|
|
111
|
+
"Plan modularization proactively at 600 lines",
|
|
91
112
|
"Implement code following research-identified patterns and constraints",
|
|
92
113
|
"Apply codebase-specific conventions discovered through AST analysis",
|
|
93
114
|
"Integrate with existing architecture based on dependency mapping",
|
|
94
115
|
"Implement security measures targeting research-identified vulnerabilities",
|
|
95
|
-
"Optimize performance based on AST pattern analysis"
|
|
116
|
+
"Optimize performance based on AST pattern analysis",
|
|
117
|
+
"Document every code reduction achievement"
|
|
96
118
|
],
|
|
97
119
|
"constraints": [],
|
|
98
120
|
"examples": []
|