claude-mpm 4.1.1__py3-none-any.whl → 4.1.2__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.
Files changed (357) hide show
  1. claude_mpm/BUILD_NUMBER +1 -1
  2. claude_mpm/VERSION +1 -1
  3. claude_mpm/__main__.py +1 -1
  4. claude_mpm/agents/BASE_PM.md +74 -46
  5. claude_mpm/agents/INSTRUCTIONS.md +11 -153
  6. claude_mpm/agents/WORKFLOW.md +61 -321
  7. claude_mpm/agents/__init__.py +11 -11
  8. claude_mpm/agents/agent_loader.py +23 -20
  9. claude_mpm/agents/agent_loader_integration.py +1 -1
  10. claude_mpm/agents/agents_metadata.py +27 -0
  11. claude_mpm/agents/async_agent_loader.py +5 -8
  12. claude_mpm/agents/base_agent_loader.py +36 -25
  13. claude_mpm/agents/frontmatter_validator.py +6 -6
  14. claude_mpm/agents/schema/agent_schema.json +1 -1
  15. claude_mpm/agents/system_agent_config.py +9 -9
  16. claude_mpm/agents/templates/api_qa.json +47 -2
  17. claude_mpm/agents/templates/imagemagick.json +256 -0
  18. claude_mpm/agents/templates/qa.json +41 -2
  19. claude_mpm/agents/templates/ticketing.json +5 -5
  20. claude_mpm/agents/templates/web_qa.json +50 -2
  21. claude_mpm/cli/__init__.py +51 -46
  22. claude_mpm/cli/__main__.py +1 -1
  23. claude_mpm/cli/commands/__init__.py +10 -12
  24. claude_mpm/cli/commands/agent_manager.py +186 -181
  25. claude_mpm/cli/commands/agents.py +271 -268
  26. claude_mpm/cli/commands/aggregate.py +30 -29
  27. claude_mpm/cli/commands/cleanup.py +50 -44
  28. claude_mpm/cli/commands/cleanup_orphaned_agents.py +25 -25
  29. claude_mpm/cli/commands/config.py +162 -127
  30. claude_mpm/cli/commands/doctor.py +52 -62
  31. claude_mpm/cli/commands/info.py +37 -25
  32. claude_mpm/cli/commands/mcp.py +3 -7
  33. claude_mpm/cli/commands/mcp_command_router.py +14 -18
  34. claude_mpm/cli/commands/mcp_install_commands.py +28 -23
  35. claude_mpm/cli/commands/mcp_pipx_config.py +58 -49
  36. claude_mpm/cli/commands/mcp_server_commands.py +23 -17
  37. claude_mpm/cli/commands/memory.py +192 -141
  38. claude_mpm/cli/commands/monitor.py +117 -88
  39. claude_mpm/cli/commands/run.py +120 -84
  40. claude_mpm/cli/commands/run_config_checker.py +4 -5
  41. claude_mpm/cli/commands/socketio_monitor.py +17 -19
  42. claude_mpm/cli/commands/tickets.py +92 -92
  43. claude_mpm/cli/parser.py +1 -5
  44. claude_mpm/cli/parsers/__init__.py +1 -1
  45. claude_mpm/cli/parsers/agent_manager_parser.py +50 -98
  46. claude_mpm/cli/parsers/agents_parser.py +2 -3
  47. claude_mpm/cli/parsers/base_parser.py +7 -5
  48. claude_mpm/cli/parsers/mcp_parser.py +4 -2
  49. claude_mpm/cli/parsers/monitor_parser.py +26 -18
  50. claude_mpm/cli/shared/__init__.py +10 -10
  51. claude_mpm/cli/shared/argument_patterns.py +57 -71
  52. claude_mpm/cli/shared/base_command.py +61 -53
  53. claude_mpm/cli/shared/error_handling.py +62 -58
  54. claude_mpm/cli/shared/output_formatters.py +78 -77
  55. claude_mpm/cli/startup_logging.py +204 -172
  56. claude_mpm/cli/utils.py +10 -11
  57. claude_mpm/cli_module/__init__.py +1 -1
  58. claude_mpm/cli_module/args.py +1 -1
  59. claude_mpm/cli_module/migration_example.py +5 -5
  60. claude_mpm/config/__init__.py +9 -9
  61. claude_mpm/config/agent_config.py +15 -14
  62. claude_mpm/config/experimental_features.py +4 -4
  63. claude_mpm/config/paths.py +0 -1
  64. claude_mpm/config/socketio_config.py +5 -6
  65. claude_mpm/constants.py +1 -2
  66. claude_mpm/core/__init__.py +8 -8
  67. claude_mpm/core/agent_name_normalizer.py +1 -1
  68. claude_mpm/core/agent_registry.py +20 -23
  69. claude_mpm/core/agent_session_manager.py +3 -3
  70. claude_mpm/core/base_service.py +7 -15
  71. claude_mpm/core/cache.py +4 -6
  72. claude_mpm/core/claude_runner.py +85 -113
  73. claude_mpm/core/config.py +43 -28
  74. claude_mpm/core/config_aliases.py +0 -9
  75. claude_mpm/core/config_constants.py +52 -30
  76. claude_mpm/core/constants.py +0 -1
  77. claude_mpm/core/container.py +18 -27
  78. claude_mpm/core/exceptions.py +2 -2
  79. claude_mpm/core/factories.py +10 -12
  80. claude_mpm/core/framework_loader.py +581 -280
  81. claude_mpm/core/hook_manager.py +26 -22
  82. claude_mpm/core/hook_performance_config.py +58 -47
  83. claude_mpm/core/injectable_service.py +1 -1
  84. claude_mpm/core/interactive_session.py +61 -152
  85. claude_mpm/core/interfaces.py +1 -100
  86. claude_mpm/core/lazy.py +5 -5
  87. claude_mpm/core/log_manager.py +587 -0
  88. claude_mpm/core/logger.py +125 -8
  89. claude_mpm/core/logging_config.py +15 -15
  90. claude_mpm/core/minimal_framework_loader.py +5 -8
  91. claude_mpm/core/oneshot_session.py +15 -33
  92. claude_mpm/core/optimized_agent_loader.py +4 -6
  93. claude_mpm/core/optimized_startup.py +2 -1
  94. claude_mpm/core/output_style_manager.py +147 -106
  95. claude_mpm/core/pm_hook_interceptor.py +0 -1
  96. claude_mpm/core/service_registry.py +11 -8
  97. claude_mpm/core/session_manager.py +1 -2
  98. claude_mpm/core/shared/__init__.py +1 -1
  99. claude_mpm/core/shared/config_loader.py +101 -97
  100. claude_mpm/core/shared/path_resolver.py +72 -68
  101. claude_mpm/core/shared/singleton_manager.py +56 -50
  102. claude_mpm/core/socketio_pool.py +26 -6
  103. claude_mpm/core/tool_access_control.py +4 -5
  104. claude_mpm/core/typing_utils.py +50 -59
  105. claude_mpm/core/unified_agent_registry.py +14 -19
  106. claude_mpm/core/unified_config.py +4 -6
  107. claude_mpm/core/unified_paths.py +197 -109
  108. claude_mpm/dashboard/open_dashboard.py +2 -4
  109. claude_mpm/experimental/cli_enhancements.py +51 -36
  110. claude_mpm/generators/agent_profile_generator.py +2 -4
  111. claude_mpm/hooks/base_hook.py +1 -2
  112. claude_mpm/hooks/claude_hooks/connection_pool.py +72 -26
  113. claude_mpm/hooks/claude_hooks/event_handlers.py +93 -38
  114. claude_mpm/hooks/claude_hooks/hook_handler.py +130 -76
  115. claude_mpm/hooks/claude_hooks/hook_handler_eventbus.py +104 -77
  116. claude_mpm/hooks/claude_hooks/memory_integration.py +2 -4
  117. claude_mpm/hooks/claude_hooks/response_tracking.py +15 -11
  118. claude_mpm/hooks/claude_hooks/tool_analysis.py +12 -18
  119. claude_mpm/hooks/memory_integration_hook.py +5 -5
  120. claude_mpm/hooks/tool_call_interceptor.py +1 -1
  121. claude_mpm/hooks/validation_hooks.py +4 -4
  122. claude_mpm/init.py +4 -9
  123. claude_mpm/models/__init__.py +2 -2
  124. claude_mpm/models/agent_session.py +11 -14
  125. claude_mpm/scripts/mcp_server.py +20 -11
  126. claude_mpm/scripts/mcp_wrapper.py +5 -5
  127. claude_mpm/scripts/mpm_doctor.py +321 -0
  128. claude_mpm/scripts/socketio_daemon.py +28 -25
  129. claude_mpm/scripts/socketio_daemon_hardened.py +298 -258
  130. claude_mpm/scripts/socketio_server_manager.py +116 -95
  131. claude_mpm/services/__init__.py +49 -49
  132. claude_mpm/services/agent_capabilities_service.py +12 -18
  133. claude_mpm/services/agents/__init__.py +22 -22
  134. claude_mpm/services/agents/agent_builder.py +140 -119
  135. claude_mpm/services/agents/deployment/__init__.py +3 -3
  136. claude_mpm/services/agents/deployment/agent_config_provider.py +9 -9
  137. claude_mpm/services/agents/deployment/agent_configuration_manager.py +19 -20
  138. claude_mpm/services/agents/deployment/agent_definition_factory.py +1 -5
  139. claude_mpm/services/agents/deployment/agent_deployment.py +136 -106
  140. claude_mpm/services/agents/deployment/agent_discovery_service.py +4 -8
  141. claude_mpm/services/agents/deployment/agent_environment_manager.py +2 -7
  142. claude_mpm/services/agents/deployment/agent_filesystem_manager.py +6 -10
  143. claude_mpm/services/agents/deployment/agent_format_converter.py +11 -15
  144. claude_mpm/services/agents/deployment/agent_frontmatter_validator.py +2 -3
  145. claude_mpm/services/agents/deployment/agent_lifecycle_manager.py +5 -5
  146. claude_mpm/services/agents/deployment/agent_metrics_collector.py +13 -19
  147. claude_mpm/services/agents/deployment/agent_restore_handler.py +0 -1
  148. claude_mpm/services/agents/deployment/agent_template_builder.py +26 -35
  149. claude_mpm/services/agents/deployment/agent_validator.py +0 -1
  150. claude_mpm/services/agents/deployment/agent_version_manager.py +7 -9
  151. claude_mpm/services/agents/deployment/agent_versioning.py +3 -3
  152. claude_mpm/services/agents/deployment/agents_directory_resolver.py +6 -7
  153. claude_mpm/services/agents/deployment/async_agent_deployment.py +51 -38
  154. claude_mpm/services/agents/deployment/config/__init__.py +1 -1
  155. claude_mpm/services/agents/deployment/config/deployment_config.py +7 -8
  156. claude_mpm/services/agents/deployment/deployment_type_detector.py +1 -1
  157. claude_mpm/services/agents/deployment/deployment_wrapper.py +18 -18
  158. claude_mpm/services/agents/deployment/facade/__init__.py +1 -1
  159. claude_mpm/services/agents/deployment/facade/deployment_executor.py +0 -3
  160. claude_mpm/services/agents/deployment/facade/deployment_facade.py +3 -4
  161. claude_mpm/services/agents/deployment/interface_adapter.py +5 -7
  162. claude_mpm/services/agents/deployment/multi_source_deployment_service.py +345 -276
  163. claude_mpm/services/agents/deployment/pipeline/__init__.py +2 -2
  164. claude_mpm/services/agents/deployment/pipeline/pipeline_builder.py +1 -1
  165. claude_mpm/services/agents/deployment/pipeline/pipeline_context.py +6 -4
  166. claude_mpm/services/agents/deployment/pipeline/pipeline_executor.py +3 -3
  167. claude_mpm/services/agents/deployment/pipeline/steps/__init__.py +2 -2
  168. claude_mpm/services/agents/deployment/pipeline/steps/agent_processing_step.py +14 -13
  169. claude_mpm/services/agents/deployment/pipeline/steps/base_step.py +0 -1
  170. claude_mpm/services/agents/deployment/pipeline/steps/configuration_step.py +1 -1
  171. claude_mpm/services/agents/deployment/pipeline/steps/target_directory_step.py +8 -9
  172. claude_mpm/services/agents/deployment/pipeline/steps/validation_step.py +1 -1
  173. claude_mpm/services/agents/deployment/processors/__init__.py +1 -1
  174. claude_mpm/services/agents/deployment/processors/agent_processor.py +20 -16
  175. claude_mpm/services/agents/deployment/refactored_agent_deployment_service.py +5 -12
  176. claude_mpm/services/agents/deployment/results/__init__.py +1 -1
  177. claude_mpm/services/agents/deployment/results/deployment_result_builder.py +1 -1
  178. claude_mpm/services/agents/deployment/strategies/__init__.py +2 -2
  179. claude_mpm/services/agents/deployment/strategies/base_strategy.py +1 -7
  180. claude_mpm/services/agents/deployment/strategies/project_strategy.py +1 -4
  181. claude_mpm/services/agents/deployment/strategies/system_strategy.py +2 -3
  182. claude_mpm/services/agents/deployment/strategies/user_strategy.py +3 -7
  183. claude_mpm/services/agents/deployment/validation/__init__.py +1 -1
  184. claude_mpm/services/agents/deployment/validation/agent_validator.py +1 -1
  185. claude_mpm/services/agents/deployment/validation/template_validator.py +2 -2
  186. claude_mpm/services/agents/deployment/validation/validation_result.py +2 -6
  187. claude_mpm/services/agents/loading/__init__.py +1 -1
  188. claude_mpm/services/agents/loading/agent_profile_loader.py +6 -12
  189. claude_mpm/services/agents/loading/base_agent_manager.py +5 -5
  190. claude_mpm/services/agents/loading/framework_agent_loader.py +2 -4
  191. claude_mpm/services/agents/management/__init__.py +1 -1
  192. claude_mpm/services/agents/management/agent_capabilities_generator.py +1 -3
  193. claude_mpm/services/agents/management/agent_management_service.py +5 -9
  194. claude_mpm/services/agents/memory/__init__.py +4 -4
  195. claude_mpm/services/agents/memory/agent_memory_manager.py +280 -160
  196. claude_mpm/services/agents/memory/agent_persistence_service.py +0 -2
  197. claude_mpm/services/agents/memory/content_manager.py +44 -38
  198. claude_mpm/services/agents/memory/template_generator.py +4 -6
  199. claude_mpm/services/agents/registry/__init__.py +10 -6
  200. claude_mpm/services/agents/registry/deployed_agent_discovery.py +30 -27
  201. claude_mpm/services/agents/registry/modification_tracker.py +3 -6
  202. claude_mpm/services/async_session_logger.py +1 -2
  203. claude_mpm/services/claude_session_logger.py +1 -2
  204. claude_mpm/services/command_deployment_service.py +173 -0
  205. claude_mpm/services/command_handler_service.py +20 -22
  206. claude_mpm/services/core/__init__.py +25 -25
  207. claude_mpm/services/core/base.py +0 -5
  208. claude_mpm/services/core/interfaces/__init__.py +32 -32
  209. claude_mpm/services/core/interfaces/agent.py +0 -21
  210. claude_mpm/services/core/interfaces/communication.py +0 -27
  211. claude_mpm/services/core/interfaces/infrastructure.py +0 -56
  212. claude_mpm/services/core/interfaces/service.py +0 -29
  213. claude_mpm/services/diagnostics/__init__.py +1 -1
  214. claude_mpm/services/diagnostics/checks/__init__.py +6 -6
  215. claude_mpm/services/diagnostics/checks/agent_check.py +89 -80
  216. claude_mpm/services/diagnostics/checks/base_check.py +12 -16
  217. claude_mpm/services/diagnostics/checks/claude_desktop_check.py +84 -81
  218. claude_mpm/services/diagnostics/checks/common_issues_check.py +99 -91
  219. claude_mpm/services/diagnostics/checks/configuration_check.py +82 -77
  220. claude_mpm/services/diagnostics/checks/filesystem_check.py +67 -68
  221. claude_mpm/services/diagnostics/checks/installation_check.py +254 -94
  222. claude_mpm/services/diagnostics/checks/mcp_check.py +90 -88
  223. claude_mpm/services/diagnostics/checks/monitor_check.py +75 -76
  224. claude_mpm/services/diagnostics/checks/startup_log_check.py +67 -73
  225. claude_mpm/services/diagnostics/diagnostic_runner.py +67 -59
  226. claude_mpm/services/diagnostics/doctor_reporter.py +107 -70
  227. claude_mpm/services/diagnostics/models.py +21 -19
  228. claude_mpm/services/event_aggregator.py +10 -17
  229. claude_mpm/services/event_bus/__init__.py +1 -1
  230. claude_mpm/services/event_bus/config.py +54 -35
  231. claude_mpm/services/event_bus/event_bus.py +76 -71
  232. claude_mpm/services/event_bus/relay.py +74 -64
  233. claude_mpm/services/events/__init__.py +11 -11
  234. claude_mpm/services/events/consumers/__init__.py +3 -3
  235. claude_mpm/services/events/consumers/dead_letter.py +71 -63
  236. claude_mpm/services/events/consumers/logging.py +39 -37
  237. claude_mpm/services/events/consumers/metrics.py +56 -57
  238. claude_mpm/services/events/consumers/socketio.py +82 -81
  239. claude_mpm/services/events/core.py +110 -99
  240. claude_mpm/services/events/interfaces.py +56 -72
  241. claude_mpm/services/events/producers/__init__.py +1 -1
  242. claude_mpm/services/events/producers/hook.py +38 -38
  243. claude_mpm/services/events/producers/system.py +46 -44
  244. claude_mpm/services/exceptions.py +81 -80
  245. claude_mpm/services/framework_claude_md_generator/__init__.py +2 -4
  246. claude_mpm/services/framework_claude_md_generator/content_assembler.py +3 -5
  247. claude_mpm/services/framework_claude_md_generator/content_validator.py +1 -1
  248. claude_mpm/services/framework_claude_md_generator/deployment_manager.py +4 -4
  249. claude_mpm/services/framework_claude_md_generator/section_generators/__init__.py +0 -1
  250. claude_mpm/services/framework_claude_md_generator/section_generators/agents.py +0 -2
  251. claude_mpm/services/framework_claude_md_generator/version_manager.py +4 -5
  252. claude_mpm/services/hook_service.py +6 -9
  253. claude_mpm/services/infrastructure/__init__.py +1 -1
  254. claude_mpm/services/infrastructure/context_preservation.py +8 -12
  255. claude_mpm/services/infrastructure/monitoring.py +21 -23
  256. claude_mpm/services/mcp_gateway/__init__.py +37 -37
  257. claude_mpm/services/mcp_gateway/auto_configure.py +95 -103
  258. claude_mpm/services/mcp_gateway/config/__init__.py +1 -1
  259. claude_mpm/services/mcp_gateway/config/config_loader.py +23 -25
  260. claude_mpm/services/mcp_gateway/config/config_schema.py +5 -5
  261. claude_mpm/services/mcp_gateway/config/configuration.py +9 -6
  262. claude_mpm/services/mcp_gateway/core/__init__.py +10 -10
  263. claude_mpm/services/mcp_gateway/core/base.py +0 -3
  264. claude_mpm/services/mcp_gateway/core/interfaces.py +1 -38
  265. claude_mpm/services/mcp_gateway/core/process_pool.py +99 -93
  266. claude_mpm/services/mcp_gateway/core/singleton_manager.py +65 -62
  267. claude_mpm/services/mcp_gateway/core/startup_verification.py +75 -74
  268. claude_mpm/services/mcp_gateway/main.py +2 -1
  269. claude_mpm/services/mcp_gateway/registry/service_registry.py +5 -8
  270. claude_mpm/services/mcp_gateway/registry/tool_registry.py +1 -1
  271. claude_mpm/services/mcp_gateway/server/__init__.py +1 -1
  272. claude_mpm/services/mcp_gateway/server/mcp_gateway.py +12 -19
  273. claude_mpm/services/mcp_gateway/server/stdio_handler.py +4 -3
  274. claude_mpm/services/mcp_gateway/server/stdio_server.py +79 -71
  275. claude_mpm/services/mcp_gateway/tools/__init__.py +2 -2
  276. claude_mpm/services/mcp_gateway/tools/base_adapter.py +5 -6
  277. claude_mpm/services/mcp_gateway/tools/document_summarizer.py +13 -22
  278. claude_mpm/services/mcp_gateway/tools/health_check_tool.py +79 -78
  279. claude_mpm/services/mcp_gateway/tools/hello_world.py +12 -14
  280. claude_mpm/services/mcp_gateway/tools/ticket_tools.py +42 -49
  281. claude_mpm/services/mcp_gateway/tools/unified_ticket_tool.py +51 -55
  282. claude_mpm/services/memory/__init__.py +3 -3
  283. claude_mpm/services/memory/builder.py +3 -6
  284. claude_mpm/services/memory/cache/__init__.py +1 -1
  285. claude_mpm/services/memory/cache/shared_prompt_cache.py +3 -5
  286. claude_mpm/services/memory/cache/simple_cache.py +1 -1
  287. claude_mpm/services/memory/indexed_memory.py +5 -7
  288. claude_mpm/services/memory/optimizer.py +7 -10
  289. claude_mpm/services/memory/router.py +8 -9
  290. claude_mpm/services/memory_hook_service.py +48 -34
  291. claude_mpm/services/monitor_build_service.py +77 -73
  292. claude_mpm/services/port_manager.py +130 -108
  293. claude_mpm/services/project/analyzer.py +12 -10
  294. claude_mpm/services/project/registry.py +11 -11
  295. claude_mpm/services/recovery_manager.py +10 -19
  296. claude_mpm/services/response_tracker.py +0 -1
  297. claude_mpm/services/runner_configuration_service.py +19 -20
  298. claude_mpm/services/session_management_service.py +7 -11
  299. claude_mpm/services/shared/__init__.py +1 -1
  300. claude_mpm/services/shared/async_service_base.py +58 -50
  301. claude_mpm/services/shared/config_service_base.py +73 -67
  302. claude_mpm/services/shared/lifecycle_service_base.py +82 -78
  303. claude_mpm/services/shared/manager_base.py +94 -82
  304. claude_mpm/services/shared/service_factory.py +96 -98
  305. claude_mpm/services/socketio/__init__.py +3 -3
  306. claude_mpm/services/socketio/client_proxy.py +5 -5
  307. claude_mpm/services/socketio/event_normalizer.py +199 -181
  308. claude_mpm/services/socketio/handlers/__init__.py +3 -3
  309. claude_mpm/services/socketio/handlers/base.py +5 -4
  310. claude_mpm/services/socketio/handlers/connection.py +163 -136
  311. claude_mpm/services/socketio/handlers/file.py +13 -14
  312. claude_mpm/services/socketio/handlers/git.py +12 -7
  313. claude_mpm/services/socketio/handlers/hook.py +49 -44
  314. claude_mpm/services/socketio/handlers/memory.py +0 -1
  315. claude_mpm/services/socketio/handlers/project.py +0 -1
  316. claude_mpm/services/socketio/handlers/registry.py +37 -19
  317. claude_mpm/services/socketio/migration_utils.py +98 -84
  318. claude_mpm/services/socketio/server/__init__.py +1 -1
  319. claude_mpm/services/socketio/server/broadcaster.py +81 -87
  320. claude_mpm/services/socketio/server/core.py +65 -54
  321. claude_mpm/services/socketio/server/eventbus_integration.py +95 -56
  322. claude_mpm/services/socketio/server/main.py +64 -38
  323. claude_mpm/services/socketio_client_manager.py +10 -12
  324. claude_mpm/services/subprocess_launcher_service.py +4 -7
  325. claude_mpm/services/system_instructions_service.py +13 -14
  326. claude_mpm/services/ticket_manager.py +2 -2
  327. claude_mpm/services/utility_service.py +5 -13
  328. claude_mpm/services/version_control/__init__.py +16 -16
  329. claude_mpm/services/version_control/branch_strategy.py +5 -8
  330. claude_mpm/services/version_control/conflict_resolution.py +9 -23
  331. claude_mpm/services/version_control/git_operations.py +5 -7
  332. claude_mpm/services/version_control/semantic_versioning.py +16 -17
  333. claude_mpm/services/version_control/version_parser.py +13 -18
  334. claude_mpm/services/version_service.py +10 -11
  335. claude_mpm/storage/__init__.py +1 -1
  336. claude_mpm/storage/state_storage.py +22 -28
  337. claude_mpm/utils/__init__.py +6 -6
  338. claude_mpm/utils/agent_dependency_loader.py +47 -33
  339. claude_mpm/utils/config_manager.py +11 -14
  340. claude_mpm/utils/dependency_cache.py +1 -1
  341. claude_mpm/utils/dependency_manager.py +13 -17
  342. claude_mpm/utils/dependency_strategies.py +8 -10
  343. claude_mpm/utils/environment_context.py +3 -9
  344. claude_mpm/utils/error_handler.py +3 -13
  345. claude_mpm/utils/file_utils.py +1 -1
  346. claude_mpm/utils/path_operations.py +8 -12
  347. claude_mpm/utils/robust_installer.py +110 -33
  348. claude_mpm/utils/subprocess_utils.py +5 -6
  349. claude_mpm/validation/agent_validator.py +3 -6
  350. claude_mpm/validation/frontmatter_validator.py +1 -1
  351. {claude_mpm-4.1.1.dist-info → claude_mpm-4.1.2.dist-info}/METADATA +1 -1
  352. claude_mpm-4.1.2.dist-info/RECORD +498 -0
  353. claude_mpm-4.1.1.dist-info/RECORD +0 -494
  354. {claude_mpm-4.1.1.dist-info → claude_mpm-4.1.2.dist-info}/WHEEL +0 -0
  355. {claude_mpm-4.1.1.dist-info → claude_mpm-4.1.2.dist-info}/entry_points.txt +0 -0
  356. {claude_mpm-4.1.1.dist-info → claude_mpm-4.1.2.dist-info}/licenses/LICENSE +0 -0
  357. {claude_mpm-4.1.1.dist-info → claude_mpm-4.1.2.dist-info}/top_level.txt +0 -0
@@ -7,7 +7,6 @@ providing specific fixes for each issue.
7
7
 
8
8
  import json
9
9
  from pathlib import Path
10
- from typing import Dict, Any, List
11
10
 
12
11
  from ..models import DiagnosticResult, DiagnosticStatus
13
12
  from .base_check import BaseDiagnosticCheck
@@ -15,22 +14,22 @@ from .base_check import BaseDiagnosticCheck
15
14
 
16
15
  class CommonIssuesCheck(BaseDiagnosticCheck):
17
16
  """Check for common known issues."""
18
-
17
+
19
18
  @property
20
19
  def name(self) -> str:
21
20
  return "common_issues_check"
22
-
21
+
23
22
  @property
24
23
  def category(self) -> str:
25
24
  return "Common Issues"
26
-
25
+
27
26
  def run(self) -> DiagnosticResult:
28
27
  """Run common issues diagnostics."""
29
28
  try:
30
29
  issues_found = []
31
30
  warnings_found = []
32
31
  details = {}
33
-
32
+
34
33
  # Check for large .claude.json file
35
34
  claude_json_result = self._check_claude_json_size()
36
35
  if claude_json_result.has_issues:
@@ -38,30 +37,30 @@ class CommonIssuesCheck(BaseDiagnosticCheck):
38
37
  issues_found.append(claude_json_result)
39
38
  else:
40
39
  warnings_found.append(claude_json_result)
41
-
40
+
42
41
  # Check for memory leaks
43
42
  memory_result = self._check_memory_issues()
44
43
  if memory_result.has_issues:
45
44
  warnings_found.append(memory_result)
46
-
45
+
47
46
  # Check for stale lock files
48
47
  lock_result = self._check_lock_files()
49
48
  if lock_result.has_issues:
50
49
  warnings_found.append(lock_result)
51
-
50
+
52
51
  # Check for conflicting configurations
53
52
  conflict_result = self._check_config_conflicts()
54
53
  if conflict_result.has_issues:
55
54
  warnings_found.append(conflict_result)
56
-
55
+
57
56
  # Check for outdated cache
58
57
  cache_result = self._check_cache_issues()
59
58
  if cache_result.has_issues:
60
59
  warnings_found.append(cache_result)
61
-
60
+
62
61
  # Aggregate results
63
62
  total_issues = len(issues_found) + len(warnings_found)
64
-
63
+
65
64
  if issues_found:
66
65
  status = DiagnosticStatus.ERROR
67
66
  message = f"{len(issues_found)} critical issue(s), {len(warnings_found)} warning(s)"
@@ -71,64 +70,64 @@ class CommonIssuesCheck(BaseDiagnosticCheck):
71
70
  else:
72
71
  status = DiagnosticStatus.OK
73
72
  message = "No known issues detected"
74
-
73
+
75
74
  details = {
76
75
  "total_issues": total_issues,
77
76
  "critical": len(issues_found),
78
- "warnings": len(warnings_found)
77
+ "warnings": len(warnings_found),
79
78
  }
80
-
79
+
81
80
  sub_results = issues_found + warnings_found
82
-
81
+
83
82
  return DiagnosticResult(
84
83
  category=self.category,
85
84
  status=status,
86
85
  message=message,
87
86
  details=details,
88
- sub_results=sub_results if self.verbose else []
87
+ sub_results=sub_results if self.verbose else [],
89
88
  )
90
-
89
+
91
90
  except Exception as e:
92
91
  return DiagnosticResult(
93
92
  category=self.category,
94
93
  status=DiagnosticStatus.ERROR,
95
- message=f"Common issues check failed: {str(e)}",
96
- details={"error": str(e)}
94
+ message=f"Common issues check failed: {e!s}",
95
+ details={"error": str(e)},
97
96
  )
98
-
97
+
99
98
  def _check_claude_json_size(self) -> DiagnosticResult:
100
99
  """Check for large .claude.json file causing memory issues."""
101
100
  claude_json_path = Path.cwd() / ".claude.json"
102
-
101
+
103
102
  if not claude_json_path.exists():
104
103
  return DiagnosticResult(
105
104
  category="Large .claude.json",
106
105
  status=DiagnosticStatus.OK,
107
106
  message="No .claude.json file",
108
- details={"exists": False}
107
+ details={"exists": False},
109
108
  )
110
-
109
+
111
110
  try:
112
111
  size_bytes = claude_json_path.stat().st_size
113
112
  size_mb = size_bytes / (1024 * 1024)
114
-
113
+
115
114
  # Try to count conversations
116
115
  conversation_count = 0
117
116
  try:
118
- with open(claude_json_path, 'r') as f:
117
+ with open(claude_json_path) as f:
119
118
  data = json.load(f)
120
119
  if isinstance(data, dict) and "conversations" in data:
121
120
  conversation_count = len(data["conversations"])
122
121
  except Exception:
123
122
  pass
124
-
123
+
125
124
  details = {
126
125
  "path": str(claude_json_path),
127
126
  "size_mb": round(size_mb, 2),
128
127
  "size_bytes": size_bytes,
129
- "conversations": conversation_count
128
+ "conversations": conversation_count,
130
129
  }
131
-
130
+
132
131
  if size_mb > 10: # Critical: >10MB
133
132
  return DiagnosticResult(
134
133
  category="Large .claude.json",
@@ -136,66 +135,68 @@ class CommonIssuesCheck(BaseDiagnosticCheck):
136
135
  message=f"Critical: .claude.json is {size_mb:.1f}MB (causes memory issues)",
137
136
  details=details,
138
137
  fix_command="claude-mpm cleanup-memory",
139
- fix_description="Clean up conversation history to prevent memory issues"
138
+ fix_description="Clean up conversation history to prevent memory issues",
140
139
  )
141
- elif size_mb > 1: # Warning: >1MB
140
+ if size_mb > 1: # Warning: >1MB
142
141
  return DiagnosticResult(
143
142
  category="Large .claude.json",
144
143
  status=DiagnosticStatus.WARNING,
145
144
  message=f".claude.json is {size_mb:.1f}MB (may cause memory issues)",
146
145
  details=details,
147
146
  fix_command="claude-mpm cleanup-memory",
148
- fix_description="Consider cleaning up old conversations"
147
+ fix_description="Consider cleaning up old conversations",
149
148
  )
150
-
149
+
151
150
  return DiagnosticResult(
152
151
  category="Large .claude.json",
153
152
  status=DiagnosticStatus.OK,
154
153
  message=f".claude.json size acceptable ({size_mb:.2f}MB)",
155
- details=details
154
+ details=details,
156
155
  )
157
-
156
+
158
157
  except Exception as e:
159
158
  return DiagnosticResult(
160
159
  category="Large .claude.json",
161
160
  status=DiagnosticStatus.WARNING,
162
- message=f"Could not check .claude.json: {str(e)}",
163
- details={"error": str(e)}
161
+ message=f"Could not check .claude.json: {e!s}",
162
+ details={"error": str(e)},
164
163
  )
165
-
164
+
166
165
  def _check_memory_issues(self) -> DiagnosticResult:
167
166
  """Check for potential memory leaks."""
168
- memory_dir = Path.home() / ".claude" / "memory"
169
-
167
+ # Check project-level memory directory first (v4.0.32+ architecture)
168
+ memory_dir = Path.cwd() / ".claude" / "memory"
169
+
170
170
  if not memory_dir.exists():
171
171
  return DiagnosticResult(
172
172
  category="Memory Usage",
173
173
  status=DiagnosticStatus.OK,
174
- message="No memory directory",
175
- details={"exists": False}
174
+ message="No project memory directory",
175
+ details={"exists": False, "path": str(memory_dir)},
176
176
  )
177
-
177
+
178
178
  try:
179
179
  # Count and size memory files
180
180
  memory_files = list(memory_dir.glob("**/*.json"))
181
181
  total_size = sum(f.stat().st_size for f in memory_files)
182
182
  size_mb = total_size / (1024 * 1024)
183
-
183
+
184
184
  # Check for old memory files
185
185
  import time
186
+
186
187
  current_time = time.time()
187
188
  old_files = []
188
189
  for f in memory_files:
189
190
  age_days = (current_time - f.stat().st_mtime) / (24 * 3600)
190
191
  if age_days > 30:
191
192
  old_files.append(f.name)
192
-
193
+
193
194
  details = {
194
195
  "file_count": len(memory_files),
195
196
  "total_size_mb": round(size_mb, 2),
196
- "old_files": len(old_files)
197
+ "old_files": len(old_files),
197
198
  }
198
-
199
+
199
200
  if size_mb > 100: # >100MB of memory files
200
201
  return DiagnosticResult(
201
202
  category="Memory Usage",
@@ -203,54 +204,56 @@ class CommonIssuesCheck(BaseDiagnosticCheck):
203
204
  message=f"High memory usage: {size_mb:.1f}MB in {len(memory_files)} files",
204
205
  details=details,
205
206
  fix_command="claude-mpm memory clean --days 30",
206
- fix_description="Clean up old memory files"
207
+ fix_description="Clean up old project memory files",
207
208
  )
208
- elif old_files:
209
+ if old_files:
209
210
  return DiagnosticResult(
210
211
  category="Memory Usage",
211
212
  status=DiagnosticStatus.WARNING,
212
213
  message=f"{len(old_files)} memory file(s) older than 30 days",
213
214
  details=details,
214
215
  fix_command="claude-mpm memory clean --days 30",
215
- fix_description="Clean up old memory files"
216
+ fix_description="Clean up old project memory files",
216
217
  )
217
-
218
+
218
219
  return DiagnosticResult(
219
220
  category="Memory Usage",
220
221
  status=DiagnosticStatus.OK,
221
222
  message=f"Memory usage normal ({size_mb:.1f}MB)",
222
- details=details
223
+ details=details,
223
224
  )
224
-
225
+
225
226
  except Exception as e:
226
227
  return DiagnosticResult(
227
228
  category="Memory Usage",
228
229
  status=DiagnosticStatus.WARNING,
229
- message=f"Could not check memory: {str(e)}",
230
- details={"error": str(e)}
230
+ message=f"Could not check memory: {e!s}",
231
+ details={"error": str(e)},
231
232
  )
232
-
233
+
233
234
  def _check_lock_files(self) -> DiagnosticResult:
234
235
  """Check for stale lock files."""
236
+ # Prioritize project-level lock files
235
237
  lock_locations = [
236
- Path.home() / ".claude" / "*.lock",
237
238
  Path.cwd() / ".claude" / "*.lock",
238
- Path("/tmp") / "claude-mpm-*.lock"
239
+ Path.home() / ".claude" / "*.lock",
240
+ Path("/tmp") / "claude-mpm-*.lock",
239
241
  ]
240
-
242
+
241
243
  stale_locks = []
242
-
244
+
243
245
  for pattern in lock_locations:
244
246
  try:
245
247
  for lock_file in pattern.parent.glob(pattern.name):
246
248
  # Check if lock is stale (older than 1 hour)
247
249
  import time
250
+
248
251
  age_hours = (time.time() - lock_file.stat().st_mtime) / 3600
249
252
  if age_hours > 1:
250
253
  stale_locks.append(str(lock_file))
251
254
  except Exception:
252
255
  pass
253
-
256
+
254
257
  if stale_locks:
255
258
  return DiagnosticResult(
256
259
  category="Lock Files",
@@ -258,97 +261,102 @@ class CommonIssuesCheck(BaseDiagnosticCheck):
258
261
  message=f"{len(stale_locks)} stale lock file(s) found",
259
262
  details={"stale_locks": stale_locks},
260
263
  fix_command=f"rm {' '.join(stale_locks)}",
261
- fix_description="Remove stale lock files"
264
+ fix_description="Remove stale lock files",
262
265
  )
263
-
266
+
264
267
  return DiagnosticResult(
265
268
  category="Lock Files",
266
269
  status=DiagnosticStatus.OK,
267
270
  message="No stale lock files",
268
- details={"stale_locks": []}
271
+ details={"stale_locks": []},
269
272
  )
270
-
273
+
271
274
  def _check_config_conflicts(self) -> DiagnosticResult:
272
275
  """Check for conflicting configurations."""
273
276
  conflicts = []
274
-
277
+
275
278
  # Check for both user and project configs with same settings
276
- user_config = Path.home() / ".claude" / "claude-mpm.yaml"
277
279
  project_config = Path.cwd() / ".claude" / "claude-mpm.yaml"
278
-
280
+ user_config = Path.home() / ".claude" / "claude-mpm.yaml"
281
+
279
282
  if user_config.exists() and project_config.exists():
280
283
  try:
281
284
  import yaml
282
-
283
- with open(user_config, 'r') as f:
285
+
286
+ with open(user_config) as f:
284
287
  user_data = yaml.safe_load(f) or {}
285
-
286
- with open(project_config, 'r') as f:
288
+
289
+ with open(project_config) as f:
287
290
  project_data = yaml.safe_load(f) or {}
288
-
291
+
289
292
  # Check for conflicting keys
290
293
  for key in user_data:
291
294
  if key in project_data and user_data[key] != project_data[key]:
292
- conflicts.append(f"'{key}' defined in both user and project config")
293
-
295
+ conflicts.append(
296
+ f"'{key}' defined in both user and project config"
297
+ )
298
+
294
299
  except Exception:
295
300
  pass
296
-
301
+
297
302
  if conflicts:
298
303
  return DiagnosticResult(
299
304
  category="Config Conflicts",
300
305
  status=DiagnosticStatus.WARNING,
301
306
  message=f"{len(conflicts)} configuration conflict(s)",
302
307
  details={"conflicts": conflicts},
303
- fix_description="Resolve conflicting configurations"
308
+ fix_description="Resolve conflicting configurations",
304
309
  )
305
-
310
+
306
311
  return DiagnosticResult(
307
312
  category="Config Conflicts",
308
313
  status=DiagnosticStatus.OK,
309
314
  message="No configuration conflicts",
310
- details={"conflicts": []}
315
+ details={"conflicts": []},
311
316
  )
312
-
317
+
313
318
  def _check_cache_issues(self) -> DiagnosticResult:
314
319
  """Check for cache-related issues."""
315
320
  cache_dir = Path.home() / ".cache" / "claude-mpm"
316
-
321
+
317
322
  if not cache_dir.exists():
318
323
  return DiagnosticResult(
319
324
  category="Cache",
320
325
  status=DiagnosticStatus.OK,
321
326
  message="No cache directory",
322
- details={"exists": False}
327
+ details={"exists": False},
323
328
  )
324
-
329
+
325
330
  try:
326
331
  # Check cache size
327
332
  cache_files = list(cache_dir.glob("**/*"))
328
333
  total_size = sum(f.stat().st_size for f in cache_files if f.is_file())
329
334
  size_mb = total_size / (1024 * 1024)
330
-
335
+
331
336
  if size_mb > 500: # >500MB cache
332
337
  return DiagnosticResult(
333
338
  category="Cache",
334
339
  status=DiagnosticStatus.WARNING,
335
340
  message=f"Large cache: {size_mb:.1f}MB",
336
- details={"size_mb": round(size_mb, 2), "file_count": len(cache_files)},
341
+ details={
342
+ "size_mb": round(size_mb, 2),
343
+ "file_count": len(cache_files),
344
+ },
337
345
  fix_command=f"rm -rf {cache_dir}",
338
- fix_description="Clear cache to free up space"
346
+ fix_description="Clear cache to free up space",
339
347
  )
340
-
348
+
341
349
  return DiagnosticResult(
342
350
  category="Cache",
343
351
  status=DiagnosticStatus.OK,
344
352
  message=f"Cache size normal ({size_mb:.1f}MB)",
345
- details={"size_mb": round(size_mb, 2), "file_count": len(cache_files)}
353
+ details={"size_mb": round(size_mb, 2), "file_count": len(cache_files)},
346
354
  )
347
-
355
+
348
356
  except Exception as e:
349
357
  return DiagnosticResult(
350
358
  category="Cache",
351
359
  status=DiagnosticStatus.WARNING,
352
- message=f"Could not check cache: {str(e)}",
353
- details={"error": str(e)}
354
- )
360
+ message=f"Could not check cache: {e!s}",
361
+ details={"error": str(e)},
362
+ )