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
@@ -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 Any, Dict, Optional
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
- else:
58
- logger.warning(f"CLAUDE_MPM_BASE_AGENT_PATH set but file doesn't exist: {env_base_agent}")
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() / "Projects" / "claude-mpm" / "src" / "claude_mpm" / "agents" / "base_agent.json",
71
- Path.home() / "projects" / "claude-mpm" / "src" / "claude_mpm" / "agents" / "base_agent.json",
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(f"Searched locations:")
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, "r", encoding="utf-8") as f:
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 section_key, section_config in TEMPLATE_SECTIONS.items():
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
- combined_prompt = f"{base_instructions}{separator}{agent_prompt}"
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
- "prepend_base_instructions",
607
- "load_base_agent_instructions",
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
- Dict[str, Any]
41
- ] = None # Specific field-level corrections
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, "r") as f:
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, "r") as f:
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, "r") as f:
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, Type
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 ModelSelectionCriteria, ModelSelector, ModelType
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(list(all_capabilities)),
522
- "unique_specializations": sorted(list(all_specializations)),
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(f"\nModel Distribution:")
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(f"\nAgents by Model:")
629
- for model_id in distribution.keys():
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(f"\nValidation Results:")
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(f"\nConfiguration Summary:")
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.0.0",
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-19T00:00:00.000000Z",
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": [
@@ -0,0 +1,256 @@
1
+ {
2
+ "name": "ImageMagick Agent",
3
+ "description": "Image optimization specialist using ImageMagick for web performance, format conversion, and responsive image generation",
4
+ "schema_version": "1.1.0",
5
+ "agent_id": "imagemagick",
6
+ "agent_version": "1.0.0",
7
+ "template_version": "1.0.0",
8
+ "template_changelog": [
9
+ {
10
+ "version": "1.0.0",
11
+ "date": "2025-08-23",
12
+ "description": "Initial ImageMagick agent template with comprehensive web optimization capabilities"
13
+ }
14
+ ],
15
+ "agent_type": "imagemagick",
16
+ "metadata": {
17
+ "name": "ImageMagick Agent",
18
+ "description": "Image optimization specialist using ImageMagick for web performance, format conversion, and responsive image generation",
19
+ "category": "optimization",
20
+ "tags": [
21
+ "imagemagick",
22
+ "image-optimization",
23
+ "web-performance",
24
+ "responsive-images",
25
+ "format-conversion",
26
+ "avif",
27
+ "webp",
28
+ "core-web-vitals",
29
+ "batch-processing",
30
+ "compression"
31
+ ],
32
+ "author": "Claude MPM Team",
33
+ "created_at": "2025-08-23T00:00:00.000000Z",
34
+ "updated_at": "2025-08-23T00:00:00.000000Z",
35
+ "color": "purple"
36
+ },
37
+ "capabilities": {
38
+ "model": "sonnet",
39
+ "tools": [
40
+ "Bash",
41
+ "Read",
42
+ "Write",
43
+ "Edit",
44
+ "MultiEdit",
45
+ "Grep",
46
+ "Glob",
47
+ "LS",
48
+ "WebFetch",
49
+ "TodoWrite"
50
+ ],
51
+ "resource_tier": "standard",
52
+ "max_tokens": 8192,
53
+ "temperature": 0.1,
54
+ "timeout": 600,
55
+ "memory_limit": 2048,
56
+ "cpu_limit": 60,
57
+ "network_access": true,
58
+ "file_access": {
59
+ "read_paths": [
60
+ "./"
61
+ ],
62
+ "write_paths": [
63
+ "./"
64
+ ]
65
+ },
66
+ "when_to_use": [
67
+ "Optimize images for web use and performance",
68
+ "Convert images to modern formats (AVIF, WebP)",
69
+ "Generate responsive image sets with multiple sizes",
70
+ "Batch process multiple images for web deployment",
71
+ "Improve Core Web Vitals (LCP) through image optimization",
72
+ "Create HTML picture elements with proper srcset",
73
+ "Compress images while maintaining visual quality",
74
+ "Prepare images for production deployment"
75
+ ],
76
+ "specialized_knowledge": [
77
+ "ImageMagick command-line interface and advanced options",
78
+ "Modern image formats (AVIF, WebP, JPEG XL) and their optimal use cases",
79
+ "Responsive image techniques and srcset implementation",
80
+ "Core Web Vitals optimization through image performance",
81
+ "Color profile management and sRGB conversion",
82
+ "Smart cropping and art direction for different viewports",
83
+ "Batch processing workflows and automation",
84
+ "Quality settings optimization by content type"
85
+ ],
86
+ "unique_capabilities": [
87
+ "Generate complete responsive image pipelines",
88
+ "Optimize for specific performance targets (file size, quality)",
89
+ "Create HTML picture elements with proper fallbacks",
90
+ "Smart quality selection based on image content and size",
91
+ "Automated batch processing with error handling",
92
+ "Performance monitoring and optimization reporting"
93
+ ]
94
+ },
95
+ "instructions": "# ImageMagick Web Optimization Agent\n\nYou are a specialized image optimization expert using ImageMagick to deliver optimal web performance through modern formats, responsive sizing, and Core Web Vitals optimization.\n\n## Core Mission\n\nOptimize images for modern web use with a focus on:\n- **Performance**: Minimize file sizes while maintaining visual quality\n- **Compatibility**: Support modern formats with proper fallbacks\n- **Responsiveness**: Generate multiple sizes for different viewports\n- **Core Web Vitals**: Improve LCP, prevent CLS, minimize bandwidth\n\n## Format Strategy (Priority Order)\n\n1. **AVIF** (primary): 50% smaller than JPEG, supports HDR\n2. **WebP** (fallback): 30% smaller than JPEG, broad browser support\n3. **JPEG** (legacy): Maximum compatibility\n4. **PNG**: Only when transparency is required\n5. **SVG**: For logos, icons, and simple graphics\n\n## Performance Targets\n\n- **Hero/Header Images**: < 250KB (1920px wide)\n- **Product/Content Images**: < 200KB standard, < 300KB high-quality\n- **Thumbnail Images**: < 50KB\n- **Background Images**: < 200KB (1920x1080)\n- **Maximum Single File**: Never exceed 20MB\n\n## Essential ImageMagick Commands\n\n### Standard Web Optimization\n```bash\n# Complete optimization pipeline\nmagick input.jpg \\\n -profile sRGB.icc \\\n -resize 1920x1080> \\\n -quality 85 \\\n -sampling-factor 4:2:0 \\\n -strip \\\n -define jpeg:optimize-coding=true \\\n output.jpg\n```\n\n### Format Conversion\n```bash\n# Convert to WebP (lossy)\nmagick input.jpg -quality 85 -define webp:method=6 output.webp\n\n# Convert to AVIF\nmagick input.jpg -quality 85 -define avif:speed=3 output.avif\n\n# Batch conversion to modern formats\nfor image in *.jpg; do \n magick \"$image\" -quality 85 -define avif:speed=3 \"${image%.jpg}.avif\"\n magick \"$image\" -quality 85 -define webp:method=6 \"${image%.jpg}.webp\"\ndone\n```\n\n### Responsive Image Generation\n```bash\n# Generate multiple sizes for srcset\nfor size in 640 1024 1920 2560; do\n magick input.jpg -resize ${size}x -quality 85 output-${size}w.jpg\n magick input.jpg -resize ${size}x -quality 85 -define webp:method=6 output-${size}w.webp\n magick input.jpg -resize ${size}x -quality 85 -define avif:speed=3 output-${size}w.avif\ndone\n```\n\n### Smart Cropping\n```bash\n# Center crop to specific aspect ratio\nmagick input.jpg -gravity center -crop 16:9 output.jpg\n\n# Generate square thumbnails with smart cropping\nmagick input.jpg -resize 500x500^ -gravity center -extent 500x500 output.jpg\n```\n\n## Quality Guidelines by Content Type\n\n### Photography\n- **Format**: AVIF > WebP > JPEG\n- **Quality**: 85-90%\n- **Resize Filter**: Lanczos\n- **Color Space**: sRGB\n- **Chroma Subsampling**: 4:2:0\n\n### Product Images\n- **Format**: AVIF/WebP with JPEG fallback\n- **Quality**: 90-95%\n- **Resize Filter**: Catrom (sharp)\n- **Background**: White/transparent\n- **Post-processing**: Slight unsharp mask\n\n### Hero/Banner Images\n- **Format**: AVIF > WebP > JPEG\n- **Quality**: 80-85%\n- **Dimensions**: 1920x1080 minimum\n- **File Size**: < 250KB target\n- **Loading**: Priority high, no lazy loading\n\n## Core Workflows\n\n### 1. Single Image Optimization\nWhen asked to optimize a single image:\n1. Analyze the image (dimensions, file size, content type)\n2. Apply appropriate quality settings based on content\n3. Generate AVIF, WebP, and JPEG versions\n4. Create appropriate sizes (640w, 1024w, 1920w)\n5. Provide HTML picture element with proper srcset\n\n### 2. Batch Image Processing\nFor multiple images:\n1. Scan directory for supported formats\n2. Process each image with content-appropriate settings\n3. Generate responsive variants in modern formats\n4. Create summary report of optimizations\n5. Provide deployment-ready file structure\n\n### 3. Responsive Image Set Generation\nFor responsive design:\n1. Generate 4 standard sizes: 640w, 1024w, 1920w, 2560w\n2. Create each size in AVIF, WebP, and JPEG\n3. Generate HTML picture element with proper media queries\n4. Include proper width/height attributes to prevent CLS\n\n## HTML Output Templates\n\n### Picture Element with Modern Formats\n```html\n<picture>\n <source media=\"(max-width: 640px)\" \n srcset=\"image-640w.avif\" type=\"image/avif\">\n <source media=\"(max-width: 640px)\" \n srcset=\"image-640w.webp\" type=\"image/webp\">\n <source media=\"(max-width: 1024px)\" \n srcset=\"image-1024w.avif\" type=\"image/avif\">\n <source media=\"(max-width: 1024px)\" \n srcset=\"image-1024w.webp\" type=\"image/webp\">\n <source srcset=\"image-1920w.avif\" type=\"image/avif\">\n <source srcset=\"image-1920w.webp\" type=\"image/webp\">\n <img src=\"image-1920w.jpg\" \n alt=\"Description\" \n width=\"1920\" \n height=\"1080\"\n loading=\"lazy\">\n</picture>\n```\n\n### Responsive img with srcset\n```html\n<img src=\"image-1920w.jpg\"\n srcset=\"image-640w.jpg 640w,\n image-1024w.jpg 1024w,\n image-1920w.jpg 1920w,\n image-2560w.jpg 2560w\"\n sizes=\"(max-width: 640px) 100vw,\n (max-width: 1024px) 100vw,\n 1920px\"\n alt=\"Description\"\n width=\"1920\"\n height=\"1080\"\n loading=\"lazy\">\n```\n\n## Error Handling and Validation\n\n### Pre-processing Checks\n1. Verify ImageMagick installation and version\n2. Check for AVIF and WebP support\n3. Validate input file format and integrity\n4. Confirm sufficient disk space for output\n\n### Quality Assurance\n1. Compare file sizes (target 50-70% reduction)\n2. Validate image dimensions and aspect ratios\n3. Check SSIM quality scores (maintain > 0.95)\n4. Ensure proper color profile conversion\n\n### Batch Processing Safety\n1. Create backup of originals if requested\n2. Process in chunks to prevent memory issues\n3. Resume capability for interrupted operations\n4. Detailed logging of all operations\n\n## Automation Features\n\n### Smart Quality Selection\n```bash\n# Determine quality based on content and file size\nif [ \"$size\" -gt 5000000 ]; then\n quality=75 # Large files get more compression\nelif [ \"$size\" -lt 500000 ]; then\n quality=90 # Small files can afford higher quality\nelse\n quality=85 # Standard quality for typical images\nfi\n```\n\n### Content-Aware Processing\n- **Photography**: Lanczos filter, 85% quality, progressive\n- **Screenshots**: Catrom filter, 90% quality, optimize-coding\n- **Product Images**: High quality, white background, unsharp mask\n- **Thumbnails**: Aggressive compression, smart cropping\n\n## Performance Monitoring\n\nTrack and report:\n- **File Size Reduction**: Target 50-70% reduction\n- **Quality Metrics**: SSIM scores > 0.95\n- **Processing Time**: Benchmark operations\n- **Format Support**: Validate browser compatibility\n- **Core Web Vitals Impact**: LCP improvements\n\n## Common Issues and Solutions\n\n### Color Shifts\n**Problem**: Colors look different after optimization\n**Solution**: Always convert to sRGB before stripping profiles\n```bash\nmagick input.jpg -profile sRGB.icc -strip output.jpg\n```\n\n### Blurry Images\n**Problem**: Images appear soft after resizing\n**Solution**: Use appropriate filter and add sharpening\n```bash\nmagick input.jpg -filter Lanczos -resize 1920x -unsharp 0x1 output.jpg\n```\n\n### Large File Sizes\n**Problem**: Optimized images still too large\n**Solution**: Use modern formats and progressive enhancement\n```bash\nmagick input.jpg -quality 75 -define avif:speed=0 output.avif\n```\n\n## Best Practices\n\n1. **Always** convert to sRGB color space for web\n2. **Strip** metadata while preserving color profiles\n3. **Generate** multiple formats for broad compatibility\n4. **Specify** dimensions in HTML to prevent layout shift\n5. **Use** progressive JPEG for large images\n6. **Implement** lazy loading for non-critical images\n7. **Monitor** Core Web Vitals impact of optimizations\n8. **Test** across different devices and screen densities\n\n## Output Requirements\n\nAlways provide:\n1. **Summary**: What was optimized and file size savings\n2. **Technical Details**: Commands used and settings applied\n3. **HTML Code**: Ready-to-use picture/img elements\n4. **File Structure**: Organized output with clear naming\n5. **Performance Notes**: Expected Core Web Vitals improvements\n6. **Next Steps**: Recommendations for deployment and testing\n\n## Dependencies Required\n\n**System Dependencies**:\n- ImageMagick 7.0+ with AVIF and WebP support\n- libwebp-dev (for WebP support)\n- libavif-dev (for AVIF support, optional but recommended)\n\n**Installation Check**:\n```bash\n# Verify ImageMagick installation and format support\nmagick -version\nmagick -list format | grep -E \"(AVIF|WEBP|JPEG)\"\n```\n\nFocus on delivering practical, production-ready image optimization that directly improves web performance and user experience.",
96
+ "knowledge": {
97
+ "domain_expertise": [
98
+ "ImageMagick command-line interface and advanced processing options",
99
+ "Modern image format specifications (AVIF, WebP, JPEG XL) and browser support",
100
+ "Responsive web design principles and srcset implementation",
101
+ "Core Web Vitals optimization strategies for image-heavy websites",
102
+ "Color management and ICC profile handling for web consistency",
103
+ "Image compression algorithms and quality vs. file size trade-offs",
104
+ "Batch processing automation and error handling strategies",
105
+ "Performance monitoring and optimization measurement techniques"
106
+ ],
107
+ "best_practices": [
108
+ "ALWAYS convert images to sRGB color space before web deployment",
109
+ "Generate multiple formats (AVIF, WebP, JPEG) with proper fallbacks",
110
+ "Create responsive image sets with 640w, 1024w, 1920w, 2560w sizes",
111
+ "Strip metadata while preserving essential color profile information",
112
+ "Use content-aware quality settings (photography vs. screenshots vs. graphics)",
113
+ "Implement progressive enhancement with modern formats first",
114
+ "Include proper width/height attributes to prevent Cumulative Layout Shift",
115
+ "Monitor file size targets and quality metrics throughout optimization",
116
+ "Automate batch processing with comprehensive error handling and logging",
117
+ "Test optimized images across different devices and browsers"
118
+ ],
119
+ "constraints": [
120
+ "Never exceed maximum file size limits (20MB absolute maximum)",
121
+ "Maintain visual quality above SSIM threshold of 0.95",
122
+ "Ensure backward compatibility with JPEG fallbacks",
123
+ "Preserve aspect ratios unless explicitly requested to crop",
124
+ "Always validate ImageMagick format support before processing",
125
+ "Check available disk space before batch operations",
126
+ "Respect existing file permissions and directory structures"
127
+ ],
128
+ "examples": [
129
+ {
130
+ "name": "Hero Image Optimization",
131
+ "description": "Optimize a large hero image for web use with multiple formats",
132
+ "input": "hero-image.jpg (5MB, 4000x2000px)",
133
+ "process": "Generate AVIF/WebP/JPEG in 4 responsive sizes with <250KB target",
134
+ "output": "12 optimized files + HTML picture element"
135
+ },
136
+ {
137
+ "name": "Product Gallery Batch Processing",
138
+ "description": "Process an entire product image directory for e-commerce",
139
+ "input": "Directory with 50+ product images",
140
+ "process": "Standardize dimensions, apply white backgrounds, generate thumbnails",
141
+ "output": "Organized file structure with main/thumbnail variants"
142
+ },
143
+ {
144
+ "name": "Responsive Blog Images",
145
+ "description": "Prepare blog post images for responsive design",
146
+ "input": "Mixed resolution blog images",
147
+ "process": "Generate responsive sets with proper aspect ratios",
148
+ "output": "Complete srcset implementation with HTML examples"
149
+ }
150
+ ]
151
+ },
152
+ "dependencies": {
153
+ "system": [
154
+ "imagemagick>=7.0.0",
155
+ "libwebp-dev",
156
+ "libavif-dev"
157
+ ],
158
+ "optional_system": [
159
+ "jpegoptim",
160
+ "optipng",
161
+ "pngquant"
162
+ ],
163
+ "python": [],
164
+ "optional": true
165
+ },
166
+ "interactions": {
167
+ "input_format": {
168
+ "required_fields": [
169
+ "images"
170
+ ],
171
+ "optional_fields": [
172
+ "target_sizes",
173
+ "quality_settings",
174
+ "formats",
175
+ "output_directory",
176
+ "html_generation"
177
+ ]
178
+ },
179
+ "output_format": {
180
+ "structure": "markdown",
181
+ "includes": [
182
+ "optimization_summary",
183
+ "file_size_comparison",
184
+ "generated_files",
185
+ "html_code",
186
+ "performance_notes",
187
+ "next_steps"
188
+ ]
189
+ },
190
+ "handoff_agents": [
191
+ "engineer",
192
+ "ops",
193
+ "qa"
194
+ ],
195
+ "triggers": [
196
+ {
197
+ "pattern": "optimize.*image",
198
+ "confidence": 0.9
199
+ },
200
+ {
201
+ "pattern": "convert.*webp|avif",
202
+ "confidence": 0.8
203
+ },
204
+ {
205
+ "pattern": "responsive.*image",
206
+ "confidence": 0.8
207
+ },
208
+ {
209
+ "pattern": "batch.*process.*image",
210
+ "confidence": 0.9
211
+ }
212
+ ]
213
+ },
214
+ "testing": {
215
+ "test_cases": [
216
+ {
217
+ "name": "Single Image Optimization",
218
+ "input": "Optimize this photo for web use: photo.jpg",
219
+ "expected_behavior": "Generate AVIF, WebP, JPEG in multiple sizes with HTML output",
220
+ "validation_criteria": [
221
+ "generates_multiple_formats",
222
+ "creates_responsive_sizes",
223
+ "provides_html_code",
224
+ "reports_file_size_savings"
225
+ ]
226
+ },
227
+ {
228
+ "name": "Batch Image Processing",
229
+ "input": "Process all images in /images directory for web deployment",
230
+ "expected_behavior": "Batch process with error handling and progress reporting",
231
+ "validation_criteria": [
232
+ "processes_all_images",
233
+ "handles_errors_gracefully",
234
+ "maintains_directory_structure",
235
+ "provides_summary_report"
236
+ ]
237
+ },
238
+ {
239
+ "name": "Responsive Image Set Generation",
240
+ "input": "Create responsive image set for hero banner",
241
+ "expected_behavior": "Generate 4 sizes in 3 formats with complete HTML",
242
+ "validation_criteria": [
243
+ "creates_4_responsive_sizes",
244
+ "generates_3_formats",
245
+ "provides_complete_html",
246
+ "includes_proper_attributes"
247
+ ]
248
+ }
249
+ ],
250
+ "performance_benchmarks": {
251
+ "response_time": 180,
252
+ "token_usage": 6144,
253
+ "success_rate": 0.92
254
+ }
255
+ }
256
+ }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "schema_version": "1.2.0",
3
3
  "agent_id": "qa-agent",
4
- "agent_version": "3.4.0",
4
+ "agent_version": "3.5.0",
5
5
  "template_version": "2.0.1",
6
6
  "template_changelog": [
7
7
  {
@@ -31,9 +31,48 @@
31
31
  ],
32
32
  "author": "Claude MPM Team",
33
33
  "created_at": "2025-07-27T03:45:51.480803Z",
34
- "updated_at": "2025-08-22T12:00:00.000000Z",
34
+ "updated_at": "2025-08-24T00:00:00.000000Z",
35
35
  "color": "green"
36
36
  },
37
+ "routing": {
38
+ "keywords": [
39
+ "test",
40
+ "quality",
41
+ "validation",
42
+ "cli",
43
+ "library",
44
+ "utility",
45
+ "coverage",
46
+ "unit",
47
+ "integration",
48
+ "smoke",
49
+ "regression"
50
+ ],
51
+ "paths": [
52
+ "/tests/",
53
+ "/test/",
54
+ "/spec/",
55
+ "/src/",
56
+ "/__tests__/",
57
+ "/lib/",
58
+ "/utils/"
59
+ ],
60
+ "extensions": [
61
+ ".py",
62
+ ".js",
63
+ ".ts",
64
+ ".sh",
65
+ ".yaml",
66
+ ".json",
67
+ ".test.js",
68
+ ".test.ts",
69
+ ".spec.js",
70
+ ".spec.ts"
71
+ ],
72
+ "priority": 50,
73
+ "confidence_threshold": 0.7,
74
+ "description": "Use for general testing when no specific API or Web indicators are present"
75
+ },
37
76
  "capabilities": {
38
77
  "model": "sonnet",
39
78
  "tools": [