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.
Files changed (389) 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/engineer.json +33 -11
  18. claude_mpm/agents/templates/imagemagick.json +256 -0
  19. claude_mpm/agents/templates/qa.json +41 -2
  20. claude_mpm/agents/templates/ticketing.json +5 -5
  21. claude_mpm/agents/templates/web_qa.json +50 -2
  22. claude_mpm/cli/__init__.py +51 -46
  23. claude_mpm/cli/__main__.py +1 -1
  24. claude_mpm/cli/commands/__init__.py +10 -12
  25. claude_mpm/cli/commands/agent_manager.py +186 -181
  26. claude_mpm/cli/commands/agents.py +648 -1098
  27. claude_mpm/cli/commands/aggregate.py +30 -29
  28. claude_mpm/cli/commands/cleanup.py +50 -44
  29. claude_mpm/cli/commands/cleanup_orphaned_agents.py +25 -25
  30. claude_mpm/cli/commands/config.py +162 -127
  31. claude_mpm/cli/commands/doctor.py +52 -62
  32. claude_mpm/cli/commands/info.py +37 -25
  33. claude_mpm/cli/commands/mcp.py +3 -7
  34. claude_mpm/cli/commands/mcp_command_router.py +14 -18
  35. claude_mpm/cli/commands/mcp_install_commands.py +28 -23
  36. claude_mpm/cli/commands/mcp_pipx_config.py +58 -49
  37. claude_mpm/cli/commands/mcp_server_commands.py +23 -17
  38. claude_mpm/cli/commands/memory.py +339 -967
  39. claude_mpm/cli/commands/monitor.py +117 -88
  40. claude_mpm/cli/commands/run.py +233 -542
  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 +280 -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 +22 -29
  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 +500 -680
  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 -17
  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 +99 -154
  114. claude_mpm/hooks/claude_hooks/hook_handler.py +110 -720
  115. claude_mpm/hooks/claude_hooks/hook_handler_eventbus.py +104 -77
  116. claude_mpm/hooks/claude_hooks/hook_handler_original.py +1040 -0
  117. claude_mpm/hooks/claude_hooks/hook_handler_refactored.py +347 -0
  118. claude_mpm/hooks/claude_hooks/memory_integration.py +2 -4
  119. claude_mpm/hooks/claude_hooks/response_tracking.py +15 -11
  120. claude_mpm/hooks/claude_hooks/services/__init__.py +13 -0
  121. claude_mpm/hooks/claude_hooks/services/connection_manager.py +190 -0
  122. claude_mpm/hooks/claude_hooks/services/duplicate_detector.py +106 -0
  123. claude_mpm/hooks/claude_hooks/services/state_manager.py +282 -0
  124. claude_mpm/hooks/claude_hooks/services/subagent_processor.py +374 -0
  125. claude_mpm/hooks/claude_hooks/tool_analysis.py +12 -18
  126. claude_mpm/hooks/memory_integration_hook.py +5 -5
  127. claude_mpm/hooks/tool_call_interceptor.py +1 -1
  128. claude_mpm/hooks/validation_hooks.py +4 -4
  129. claude_mpm/init.py +4 -9
  130. claude_mpm/models/__init__.py +2 -2
  131. claude_mpm/models/agent_session.py +11 -14
  132. claude_mpm/scripts/mcp_server.py +20 -11
  133. claude_mpm/scripts/mcp_wrapper.py +5 -5
  134. claude_mpm/scripts/mpm_doctor.py +321 -0
  135. claude_mpm/scripts/socketio_daemon.py +28 -25
  136. claude_mpm/scripts/socketio_daemon_hardened.py +298 -258
  137. claude_mpm/scripts/socketio_server_manager.py +116 -95
  138. claude_mpm/services/__init__.py +49 -49
  139. claude_mpm/services/agent_capabilities_service.py +12 -18
  140. claude_mpm/services/agents/__init__.py +22 -22
  141. claude_mpm/services/agents/agent_builder.py +140 -119
  142. claude_mpm/services/agents/deployment/__init__.py +3 -3
  143. claude_mpm/services/agents/deployment/agent_config_provider.py +9 -9
  144. claude_mpm/services/agents/deployment/agent_configuration_manager.py +19 -20
  145. claude_mpm/services/agents/deployment/agent_definition_factory.py +1 -5
  146. claude_mpm/services/agents/deployment/agent_deployment.py +129 -511
  147. claude_mpm/services/agents/deployment/agent_discovery_service.py +4 -8
  148. claude_mpm/services/agents/deployment/agent_environment_manager.py +2 -7
  149. claude_mpm/services/agents/deployment/agent_filesystem_manager.py +6 -10
  150. claude_mpm/services/agents/deployment/agent_format_converter.py +11 -15
  151. claude_mpm/services/agents/deployment/agent_frontmatter_validator.py +2 -3
  152. claude_mpm/services/agents/deployment/agent_lifecycle_manager.py +5 -5
  153. claude_mpm/services/agents/deployment/agent_metrics_collector.py +13 -19
  154. claude_mpm/services/agents/deployment/agent_restore_handler.py +0 -1
  155. claude_mpm/services/agents/deployment/agent_template_builder.py +26 -35
  156. claude_mpm/services/agents/deployment/agent_validator.py +0 -1
  157. claude_mpm/services/agents/deployment/agent_version_manager.py +7 -9
  158. claude_mpm/services/agents/deployment/agent_versioning.py +3 -3
  159. claude_mpm/services/agents/deployment/agents_directory_resolver.py +6 -7
  160. claude_mpm/services/agents/deployment/async_agent_deployment.py +51 -38
  161. claude_mpm/services/agents/deployment/base_agent_locator.py +132 -0
  162. claude_mpm/services/agents/deployment/config/__init__.py +1 -1
  163. claude_mpm/services/agents/deployment/config/deployment_config.py +7 -8
  164. claude_mpm/services/agents/deployment/deployment_results_manager.py +185 -0
  165. claude_mpm/services/agents/deployment/deployment_type_detector.py +1 -1
  166. claude_mpm/services/agents/deployment/deployment_wrapper.py +18 -18
  167. claude_mpm/services/agents/deployment/facade/__init__.py +1 -1
  168. claude_mpm/services/agents/deployment/facade/deployment_executor.py +0 -3
  169. claude_mpm/services/agents/deployment/facade/deployment_facade.py +3 -4
  170. claude_mpm/services/agents/deployment/interface_adapter.py +5 -7
  171. claude_mpm/services/agents/deployment/multi_source_deployment_service.py +345 -276
  172. claude_mpm/services/agents/deployment/pipeline/__init__.py +2 -2
  173. claude_mpm/services/agents/deployment/pipeline/pipeline_builder.py +1 -1
  174. claude_mpm/services/agents/deployment/pipeline/pipeline_context.py +6 -4
  175. claude_mpm/services/agents/deployment/pipeline/pipeline_executor.py +3 -3
  176. claude_mpm/services/agents/deployment/pipeline/steps/__init__.py +2 -2
  177. claude_mpm/services/agents/deployment/pipeline/steps/agent_processing_step.py +14 -13
  178. claude_mpm/services/agents/deployment/pipeline/steps/base_step.py +0 -1
  179. claude_mpm/services/agents/deployment/pipeline/steps/configuration_step.py +1 -1
  180. claude_mpm/services/agents/deployment/pipeline/steps/target_directory_step.py +8 -9
  181. claude_mpm/services/agents/deployment/pipeline/steps/validation_step.py +1 -1
  182. claude_mpm/services/agents/deployment/processors/__init__.py +1 -1
  183. claude_mpm/services/agents/deployment/processors/agent_processor.py +20 -16
  184. claude_mpm/services/agents/deployment/refactored_agent_deployment_service.py +5 -12
  185. claude_mpm/services/agents/deployment/results/__init__.py +1 -1
  186. claude_mpm/services/agents/deployment/results/deployment_result_builder.py +1 -1
  187. claude_mpm/services/agents/deployment/single_agent_deployer.py +315 -0
  188. claude_mpm/services/agents/deployment/strategies/__init__.py +2 -2
  189. claude_mpm/services/agents/deployment/strategies/base_strategy.py +1 -7
  190. claude_mpm/services/agents/deployment/strategies/project_strategy.py +1 -4
  191. claude_mpm/services/agents/deployment/strategies/system_strategy.py +2 -3
  192. claude_mpm/services/agents/deployment/strategies/user_strategy.py +3 -7
  193. claude_mpm/services/agents/deployment/validation/__init__.py +1 -1
  194. claude_mpm/services/agents/deployment/validation/agent_validator.py +1 -1
  195. claude_mpm/services/agents/deployment/validation/template_validator.py +2 -2
  196. claude_mpm/services/agents/deployment/validation/validation_result.py +2 -6
  197. claude_mpm/services/agents/loading/__init__.py +1 -1
  198. claude_mpm/services/agents/loading/agent_profile_loader.py +6 -12
  199. claude_mpm/services/agents/loading/base_agent_manager.py +5 -5
  200. claude_mpm/services/agents/loading/framework_agent_loader.py +2 -4
  201. claude_mpm/services/agents/management/__init__.py +1 -1
  202. claude_mpm/services/agents/management/agent_capabilities_generator.py +1 -3
  203. claude_mpm/services/agents/management/agent_management_service.py +5 -9
  204. claude_mpm/services/agents/memory/__init__.py +4 -4
  205. claude_mpm/services/agents/memory/agent_memory_manager.py +157 -503
  206. claude_mpm/services/agents/memory/agent_persistence_service.py +0 -2
  207. claude_mpm/services/agents/memory/content_manager.py +44 -38
  208. claude_mpm/services/agents/memory/memory_categorization_service.py +165 -0
  209. claude_mpm/services/agents/memory/memory_file_service.py +103 -0
  210. claude_mpm/services/agents/memory/memory_format_service.py +201 -0
  211. claude_mpm/services/agents/memory/memory_limits_service.py +99 -0
  212. claude_mpm/services/agents/memory/template_generator.py +4 -6
  213. claude_mpm/services/agents/registry/__init__.py +11 -7
  214. claude_mpm/services/agents/registry/deployed_agent_discovery.py +30 -27
  215. claude_mpm/services/agents/registry/modification_tracker.py +3 -6
  216. claude_mpm/services/async_session_logger.py +1 -2
  217. claude_mpm/services/claude_session_logger.py +1 -2
  218. claude_mpm/services/cli/__init__.py +18 -0
  219. claude_mpm/services/cli/agent_cleanup_service.py +407 -0
  220. claude_mpm/services/cli/agent_dependency_service.py +395 -0
  221. claude_mpm/services/cli/agent_listing_service.py +463 -0
  222. claude_mpm/services/cli/agent_output_formatter.py +605 -0
  223. claude_mpm/services/cli/agent_validation_service.py +589 -0
  224. claude_mpm/services/cli/dashboard_launcher.py +424 -0
  225. claude_mpm/services/cli/memory_crud_service.py +617 -0
  226. claude_mpm/services/cli/memory_output_formatter.py +604 -0
  227. claude_mpm/services/cli/session_manager.py +513 -0
  228. claude_mpm/services/cli/socketio_manager.py +498 -0
  229. claude_mpm/services/cli/startup_checker.py +370 -0
  230. claude_mpm/services/command_deployment_service.py +173 -0
  231. claude_mpm/services/command_handler_service.py +20 -22
  232. claude_mpm/services/core/__init__.py +25 -25
  233. claude_mpm/services/core/base.py +0 -5
  234. claude_mpm/services/core/cache_manager.py +311 -0
  235. claude_mpm/services/core/interfaces/__init__.py +32 -32
  236. claude_mpm/services/core/interfaces/agent.py +0 -21
  237. claude_mpm/services/core/interfaces/communication.py +0 -27
  238. claude_mpm/services/core/interfaces/infrastructure.py +0 -56
  239. claude_mpm/services/core/interfaces/service.py +0 -29
  240. claude_mpm/services/core/memory_manager.py +637 -0
  241. claude_mpm/services/core/path_resolver.py +498 -0
  242. claude_mpm/services/core/service_container.py +520 -0
  243. claude_mpm/services/core/service_interfaces.py +436 -0
  244. claude_mpm/services/diagnostics/__init__.py +1 -1
  245. claude_mpm/services/diagnostics/checks/__init__.py +6 -6
  246. claude_mpm/services/diagnostics/checks/agent_check.py +152 -97
  247. claude_mpm/services/diagnostics/checks/base_check.py +12 -16
  248. claude_mpm/services/diagnostics/checks/claude_desktop_check.py +84 -81
  249. claude_mpm/services/diagnostics/checks/common_issues_check.py +99 -91
  250. claude_mpm/services/diagnostics/checks/configuration_check.py +82 -77
  251. claude_mpm/services/diagnostics/checks/filesystem_check.py +67 -68
  252. claude_mpm/services/diagnostics/checks/installation_check.py +254 -94
  253. claude_mpm/services/diagnostics/checks/mcp_check.py +90 -88
  254. claude_mpm/services/diagnostics/checks/monitor_check.py +75 -76
  255. claude_mpm/services/diagnostics/checks/startup_log_check.py +67 -73
  256. claude_mpm/services/diagnostics/diagnostic_runner.py +67 -59
  257. claude_mpm/services/diagnostics/doctor_reporter.py +107 -70
  258. claude_mpm/services/diagnostics/models.py +21 -19
  259. claude_mpm/services/event_aggregator.py +10 -17
  260. claude_mpm/services/event_bus/__init__.py +1 -1
  261. claude_mpm/services/event_bus/config.py +54 -35
  262. claude_mpm/services/event_bus/event_bus.py +76 -71
  263. claude_mpm/services/event_bus/relay.py +74 -64
  264. claude_mpm/services/events/__init__.py +11 -11
  265. claude_mpm/services/events/consumers/__init__.py +3 -3
  266. claude_mpm/services/events/consumers/dead_letter.py +71 -63
  267. claude_mpm/services/events/consumers/logging.py +39 -37
  268. claude_mpm/services/events/consumers/metrics.py +56 -57
  269. claude_mpm/services/events/consumers/socketio.py +82 -81
  270. claude_mpm/services/events/core.py +110 -99
  271. claude_mpm/services/events/interfaces.py +56 -72
  272. claude_mpm/services/events/producers/__init__.py +1 -1
  273. claude_mpm/services/events/producers/hook.py +38 -38
  274. claude_mpm/services/events/producers/system.py +46 -44
  275. claude_mpm/services/exceptions.py +81 -80
  276. claude_mpm/services/framework_claude_md_generator/__init__.py +2 -4
  277. claude_mpm/services/framework_claude_md_generator/content_assembler.py +3 -5
  278. claude_mpm/services/framework_claude_md_generator/content_validator.py +1 -1
  279. claude_mpm/services/framework_claude_md_generator/deployment_manager.py +4 -4
  280. claude_mpm/services/framework_claude_md_generator/section_generators/__init__.py +0 -1
  281. claude_mpm/services/framework_claude_md_generator/section_generators/agents.py +0 -2
  282. claude_mpm/services/framework_claude_md_generator/version_manager.py +4 -5
  283. claude_mpm/services/hook_service.py +6 -9
  284. claude_mpm/services/infrastructure/__init__.py +1 -1
  285. claude_mpm/services/infrastructure/context_preservation.py +8 -12
  286. claude_mpm/services/infrastructure/monitoring.py +21 -23
  287. claude_mpm/services/mcp_gateway/__init__.py +37 -37
  288. claude_mpm/services/mcp_gateway/auto_configure.py +95 -103
  289. claude_mpm/services/mcp_gateway/config/__init__.py +1 -1
  290. claude_mpm/services/mcp_gateway/config/config_loader.py +23 -25
  291. claude_mpm/services/mcp_gateway/config/config_schema.py +5 -5
  292. claude_mpm/services/mcp_gateway/config/configuration.py +9 -6
  293. claude_mpm/services/mcp_gateway/core/__init__.py +10 -10
  294. claude_mpm/services/mcp_gateway/core/base.py +0 -3
  295. claude_mpm/services/mcp_gateway/core/interfaces.py +1 -38
  296. claude_mpm/services/mcp_gateway/core/process_pool.py +99 -93
  297. claude_mpm/services/mcp_gateway/core/singleton_manager.py +65 -62
  298. claude_mpm/services/mcp_gateway/core/startup_verification.py +75 -74
  299. claude_mpm/services/mcp_gateway/main.py +2 -1
  300. claude_mpm/services/mcp_gateway/registry/service_registry.py +5 -8
  301. claude_mpm/services/mcp_gateway/registry/tool_registry.py +1 -1
  302. claude_mpm/services/mcp_gateway/server/__init__.py +1 -1
  303. claude_mpm/services/mcp_gateway/server/mcp_gateway.py +12 -19
  304. claude_mpm/services/mcp_gateway/server/stdio_handler.py +4 -3
  305. claude_mpm/services/mcp_gateway/server/stdio_server.py +79 -71
  306. claude_mpm/services/mcp_gateway/tools/__init__.py +2 -2
  307. claude_mpm/services/mcp_gateway/tools/base_adapter.py +5 -6
  308. claude_mpm/services/mcp_gateway/tools/document_summarizer.py +13 -22
  309. claude_mpm/services/mcp_gateway/tools/health_check_tool.py +79 -78
  310. claude_mpm/services/mcp_gateway/tools/hello_world.py +12 -14
  311. claude_mpm/services/mcp_gateway/tools/ticket_tools.py +42 -49
  312. claude_mpm/services/mcp_gateway/tools/unified_ticket_tool.py +51 -55
  313. claude_mpm/services/memory/__init__.py +3 -3
  314. claude_mpm/services/memory/builder.py +3 -6
  315. claude_mpm/services/memory/cache/__init__.py +1 -1
  316. claude_mpm/services/memory/cache/shared_prompt_cache.py +3 -5
  317. claude_mpm/services/memory/cache/simple_cache.py +1 -1
  318. claude_mpm/services/memory/indexed_memory.py +5 -7
  319. claude_mpm/services/memory/optimizer.py +7 -10
  320. claude_mpm/services/memory/router.py +8 -9
  321. claude_mpm/services/memory_hook_service.py +48 -34
  322. claude_mpm/services/monitor_build_service.py +77 -73
  323. claude_mpm/services/port_manager.py +130 -108
  324. claude_mpm/services/project/analyzer.py +12 -10
  325. claude_mpm/services/project/registry.py +11 -11
  326. claude_mpm/services/recovery_manager.py +10 -19
  327. claude_mpm/services/response_tracker.py +0 -1
  328. claude_mpm/services/runner_configuration_service.py +19 -20
  329. claude_mpm/services/session_management_service.py +7 -11
  330. claude_mpm/services/shared/__init__.py +1 -1
  331. claude_mpm/services/shared/async_service_base.py +58 -50
  332. claude_mpm/services/shared/config_service_base.py +73 -67
  333. claude_mpm/services/shared/lifecycle_service_base.py +82 -78
  334. claude_mpm/services/shared/manager_base.py +94 -82
  335. claude_mpm/services/shared/service_factory.py +96 -98
  336. claude_mpm/services/socketio/__init__.py +3 -3
  337. claude_mpm/services/socketio/client_proxy.py +5 -5
  338. claude_mpm/services/socketio/event_normalizer.py +199 -181
  339. claude_mpm/services/socketio/handlers/__init__.py +3 -3
  340. claude_mpm/services/socketio/handlers/base.py +5 -4
  341. claude_mpm/services/socketio/handlers/connection.py +163 -136
  342. claude_mpm/services/socketio/handlers/file.py +13 -14
  343. claude_mpm/services/socketio/handlers/git.py +12 -7
  344. claude_mpm/services/socketio/handlers/hook.py +49 -44
  345. claude_mpm/services/socketio/handlers/memory.py +0 -1
  346. claude_mpm/services/socketio/handlers/project.py +0 -1
  347. claude_mpm/services/socketio/handlers/registry.py +37 -19
  348. claude_mpm/services/socketio/migration_utils.py +98 -84
  349. claude_mpm/services/socketio/server/__init__.py +1 -1
  350. claude_mpm/services/socketio/server/broadcaster.py +81 -87
  351. claude_mpm/services/socketio/server/core.py +65 -54
  352. claude_mpm/services/socketio/server/eventbus_integration.py +95 -56
  353. claude_mpm/services/socketio/server/main.py +64 -38
  354. claude_mpm/services/socketio_client_manager.py +10 -12
  355. claude_mpm/services/subprocess_launcher_service.py +4 -7
  356. claude_mpm/services/system_instructions_service.py +13 -14
  357. claude_mpm/services/ticket_manager.py +2 -2
  358. claude_mpm/services/utility_service.py +5 -13
  359. claude_mpm/services/version_control/__init__.py +16 -16
  360. claude_mpm/services/version_control/branch_strategy.py +5 -8
  361. claude_mpm/services/version_control/conflict_resolution.py +9 -23
  362. claude_mpm/services/version_control/git_operations.py +5 -7
  363. claude_mpm/services/version_control/semantic_versioning.py +16 -17
  364. claude_mpm/services/version_control/version_parser.py +13 -18
  365. claude_mpm/services/version_service.py +10 -11
  366. claude_mpm/storage/__init__.py +1 -1
  367. claude_mpm/storage/state_storage.py +22 -28
  368. claude_mpm/utils/__init__.py +6 -6
  369. claude_mpm/utils/agent_dependency_loader.py +47 -33
  370. claude_mpm/utils/config_manager.py +11 -14
  371. claude_mpm/utils/dependency_cache.py +1 -1
  372. claude_mpm/utils/dependency_manager.py +13 -17
  373. claude_mpm/utils/dependency_strategies.py +8 -10
  374. claude_mpm/utils/environment_context.py +3 -9
  375. claude_mpm/utils/error_handler.py +3 -13
  376. claude_mpm/utils/file_utils.py +1 -1
  377. claude_mpm/utils/path_operations.py +8 -12
  378. claude_mpm/utils/robust_installer.py +110 -33
  379. claude_mpm/utils/subprocess_utils.py +5 -6
  380. claude_mpm/validation/agent_validator.py +3 -6
  381. claude_mpm/validation/frontmatter_validator.py +1 -1
  382. {claude_mpm-4.1.1.dist-info → claude_mpm-4.1.3.dist-info}/METADATA +1 -1
  383. claude_mpm-4.1.3.dist-info/RECORD +528 -0
  384. claude_mpm/cli/commands/run_config_checker.py +0 -160
  385. claude_mpm-4.1.1.dist-info/RECORD +0 -494
  386. {claude_mpm-4.1.1.dist-info → claude_mpm-4.1.3.dist-info}/WHEEL +0 -0
  387. {claude_mpm-4.1.1.dist-info → claude_mpm-4.1.3.dist-info}/entry_points.txt +0 -0
  388. {claude_mpm-4.1.1.dist-info → claude_mpm-4.1.3.dist-info}/licenses/LICENSE +0 -0
  389. {claude_mpm-4.1.1.dist-info → claude_mpm-4.1.3.dist-info}/top_level.txt +0 -0
@@ -2,7 +2,7 @@
2
2
 
3
3
  This module handles:
4
4
  1. Claude version detection
5
- 2. Output style extraction from framework instructions
5
+ 2. Output style extraction from framework instructions
6
6
  3. One-time deployment to Claude Code >= 1.0.83 at startup
7
7
  4. Fallback injection for older versions
8
8
 
@@ -11,13 +11,10 @@ Users can change it if they want, and the system will respect their choice.
11
11
  """
12
12
 
13
13
  import json
14
- import logging
15
- import os
16
14
  import re
17
- import shutil
18
15
  import subprocess
19
16
  from pathlib import Path
20
- from typing import Dict, Optional, Tuple
17
+ from typing import Dict, Optional
21
18
 
22
19
  from ..utils.imports import safe_import
23
20
 
@@ -35,14 +32,16 @@ class OutputStyleManager:
35
32
  self.output_style_dir = Path.home() / ".claude" / "output-styles"
36
33
  self.output_style_path = self.output_style_dir / "claude-mpm.md"
37
34
  self.settings_file = Path.home() / ".claude" / "settings.json"
38
-
35
+
39
36
  # Cache the output style content path
40
- self.mpm_output_style_path = Path(__file__).parent.parent / "agents" / "OUTPUT_STYLE.md"
37
+ self.mpm_output_style_path = (
38
+ Path(__file__).parent.parent / "agents" / "OUTPUT_STYLE.md"
39
+ )
41
40
 
42
41
  def _detect_claude_version(self) -> Optional[str]:
43
42
  """
44
43
  Detect Claude Code version by running 'claude --version'.
45
-
44
+
46
45
  Returns:
47
46
  Version string (e.g., "1.0.82") or None if Claude not found
48
47
  """
@@ -52,26 +51,26 @@ class OutputStyleManager:
52
51
  ["claude", "--version"],
53
52
  capture_output=True,
54
53
  text=True,
55
- timeout=5
54
+ timeout=5,
55
+ check=False,
56
56
  )
57
-
57
+
58
58
  if result.returncode != 0:
59
59
  self.logger.warning(f"Claude command failed: {result.stderr}")
60
60
  return None
61
-
61
+
62
62
  # Parse version from output
63
63
  # Expected format: "Claude 1.0.82" or similar
64
64
  version_output = result.stdout.strip()
65
65
  version_match = re.search(r"(\d+\.\d+\.\d+)", version_output)
66
-
66
+
67
67
  if version_match:
68
68
  version = version_match.group(1)
69
69
  self.logger.info(f"Detected Claude version: {version}")
70
70
  return version
71
- else:
72
- self.logger.warning(f"Could not parse version from: {version_output}")
73
- return None
74
-
71
+ self.logger.warning(f"Could not parse version from: {version_output}")
72
+ return None
73
+
75
74
  except FileNotFoundError:
76
75
  self.logger.info("Claude Code not found in PATH")
77
76
  return None
@@ -85,29 +84,29 @@ class OutputStyleManager:
85
84
  def _compare_versions(self, version1: str, version2: str) -> int:
86
85
  """
87
86
  Compare two version strings.
88
-
87
+
89
88
  Args:
90
89
  version1: First version string
91
90
  version2: Second version string
92
-
91
+
93
92
  Returns:
94
93
  -1 if version1 < version2
95
94
  0 if version1 == version2
96
95
  1 if version1 > version2
97
96
  """
98
97
  try:
99
- v1_parts = [int(x) for x in version1.split('.')]
100
- v2_parts = [int(x) for x in version2.split('.')]
101
-
98
+ v1_parts = [int(x) for x in version1.split(".")]
99
+ v2_parts = [int(x) for x in version2.split(".")]
100
+
102
101
  # Pad shorter version with zeros
103
102
  max_len = max(len(v1_parts), len(v2_parts))
104
103
  v1_parts.extend([0] * (max_len - len(v1_parts)))
105
104
  v2_parts.extend([0] * (max_len - len(v2_parts)))
106
-
105
+
107
106
  for i in range(max_len):
108
107
  if v1_parts[i] < v2_parts[i]:
109
108
  return -1
110
- elif v1_parts[i] > v2_parts[i]:
109
+ if v1_parts[i] > v2_parts[i]:
111
110
  return 1
112
111
  return 0
113
112
  except Exception as e:
@@ -117,19 +116,19 @@ class OutputStyleManager:
117
116
  def supports_output_styles(self) -> bool:
118
117
  """
119
118
  Check if Claude Code supports output styles (>= 1.0.83).
120
-
119
+
121
120
  Returns:
122
121
  True if Claude version >= 1.0.83, False otherwise
123
122
  """
124
123
  if not self.claude_version:
125
124
  return False
126
-
125
+
127
126
  return self._compare_versions(self.claude_version, "1.0.83") >= 0
128
127
 
129
128
  def should_inject_content(self) -> bool:
130
129
  """
131
130
  Check if output style content should be injected into instructions.
132
-
131
+
133
132
  Returns:
134
133
  True if Claude version < 1.0.83 or not detected, False otherwise
135
134
  """
@@ -138,45 +137,55 @@ class OutputStyleManager:
138
137
  def extract_output_style_content(self, framework_loader=None) -> str:
139
138
  """
140
139
  Extract output style content from framework instructions.
141
-
140
+
142
141
  This extracts PM delegation behavior, tone, communication standards,
143
142
  response formats, TodoWrite requirements, and workflow rules from:
144
143
  - INSTRUCTIONS.md
145
144
  - BASE_PM.md
146
-
145
+
147
146
  Args:
148
147
  framework_loader: Optional FrameworkLoader instance to reuse loaded content
149
-
148
+
150
149
  Returns:
151
150
  Formatted output style content in YAML frontmatter + markdown format
152
151
  """
153
152
  # Build the content sections
154
153
  sections = []
155
-
154
+
156
155
  # Add YAML frontmatter
157
156
  sections.append("---")
158
157
  sections.append("name: Claude MPM")
159
- sections.append("description: Multi-Agent Project Manager orchestration mode for delegation and coordination")
158
+ sections.append(
159
+ "description: Multi-Agent Project Manager orchestration mode for delegation and coordination"
160
+ )
160
161
  sections.append("---")
161
162
  sections.append("")
162
-
163
+
163
164
  # Header
164
- sections.append("You are Claude Multi-Agent PM, a PROJECT MANAGER whose SOLE PURPOSE is to delegate work to specialized agents.")
165
+ sections.append(
166
+ "You are Claude Multi-Agent PM, a PROJECT MANAGER whose SOLE PURPOSE is to delegate work to specialized agents."
167
+ )
165
168
  sections.append("")
166
-
169
+
167
170
  # Extract from INSTRUCTIONS.md
168
- if framework_loader and framework_loader.framework_content.get("framework_instructions"):
171
+ if framework_loader and framework_loader.framework_content.get(
172
+ "framework_instructions"
173
+ ):
169
174
  instructions = framework_loader.framework_content["framework_instructions"]
170
175
  sections.extend(self._extract_instructions_sections(instructions))
171
176
  else:
172
177
  # Load from file if no framework_loader provided
173
- instructions_path = Path(__file__).parent.parent / "agents" / "INSTRUCTIONS.md"
178
+ instructions_path = (
179
+ Path(__file__).parent.parent / "agents" / "INSTRUCTIONS.md"
180
+ )
174
181
  if instructions_path.exists():
175
182
  instructions = instructions_path.read_text()
176
183
  sections.extend(self._extract_instructions_sections(instructions))
177
-
184
+
178
185
  # Extract from BASE_PM.md
179
- if framework_loader and framework_loader.framework_content.get("base_pm_instructions"):
186
+ if framework_loader and framework_loader.framework_content.get(
187
+ "base_pm_instructions"
188
+ ):
180
189
  base_pm = framework_loader.framework_content["base_pm_instructions"]
181
190
  sections.extend(self._extract_base_pm_sections(base_pm))
182
191
  else:
@@ -185,83 +194,105 @@ class OutputStyleManager:
185
194
  if base_pm_path.exists():
186
195
  base_pm = base_pm_path.read_text()
187
196
  sections.extend(self._extract_base_pm_sections(base_pm))
188
-
197
+
189
198
  return "\n".join(sections)
190
199
 
191
200
  def _extract_instructions_sections(self, content: str) -> list:
192
201
  """Extract relevant sections from INSTRUCTIONS.md."""
193
202
  sections = []
194
-
203
+
195
204
  # Extract Primary Directive
196
205
  if "## 🔴 PRIMARY DIRECTIVE" in content:
197
206
  sections.append("## 🔴 PRIMARY DIRECTIVE - MANDATORY DELEGATION 🔴")
198
207
  sections.append("")
199
- sections.append("**YOU ARE STRICTLY FORBIDDEN FROM DOING ANY WORK DIRECTLY.**")
208
+ sections.append(
209
+ "**YOU ARE STRICTLY FORBIDDEN FROM DOING ANY WORK DIRECTLY.**"
210
+ )
200
211
  sections.append("")
201
- sections.append("Direct implementation is ABSOLUTELY PROHIBITED unless the user EXPLICITLY overrides with phrases like:")
212
+ sections.append(
213
+ "Direct implementation is ABSOLUTELY PROHIBITED unless the user EXPLICITLY overrides with phrases like:"
214
+ )
202
215
  sections.append('- "do this yourself"')
203
216
  sections.append('- "don\'t delegate"')
204
217
  sections.append('- "implement directly"')
205
218
  sections.append('- "you do it"')
206
219
  sections.append('- "no delegation"')
207
220
  sections.append("")
208
-
221
+
209
222
  # Extract Core Identity and Rules
210
223
  if "## Core Identity" in content:
211
224
  sections.append("## Core Operating Rules")
212
225
  sections.append("")
213
226
  sections.append("**DEFAULT BEHAVIOR - ALWAYS DELEGATE**:")
214
- sections.append("- 🔴 You MUST delegate 100% of ALL work to specialized agents by default")
215
- sections.append("- 🔴 Direct action is STRICTLY FORBIDDEN without explicit user override")
216
- sections.append("- 🔴 Even the simplest tasks MUST be delegated - NO EXCEPTIONS")
227
+ sections.append(
228
+ "- 🔴 You MUST delegate 100% of ALL work to specialized agents by default"
229
+ )
230
+ sections.append(
231
+ "- 🔴 Direct action is STRICTLY FORBIDDEN without explicit user override"
232
+ )
233
+ sections.append(
234
+ "- 🔴 Even the simplest tasks MUST be delegated - NO EXCEPTIONS"
235
+ )
217
236
  sections.append("- 🔴 When in doubt, ALWAYS DELEGATE - never act directly")
218
237
  sections.append("")
219
238
  sections.append("**Allowed Tools**:")
220
239
  sections.append("- **Task** for delegation (YOUR PRIMARY FUNCTION)")
221
240
  sections.append("- **TodoWrite** for tracking delegation progress ONLY")
222
- sections.append("- **WebSearch/WebFetch** for gathering context BEFORE delegation")
223
- sections.append("- **Direct answers** ONLY for questions about PM capabilities")
241
+ sections.append(
242
+ "- **WebSearch/WebFetch** for gathering context BEFORE delegation"
243
+ )
244
+ sections.append(
245
+ "- **Direct answers** ONLY for questions about PM capabilities"
246
+ )
224
247
  sections.append("")
225
-
248
+
226
249
  # Extract Communication Standards
227
250
  if "## Communication Standards" in content:
228
251
  sections.append("## Communication Standards")
229
252
  sections.append("")
230
253
  sections.append("- **Tone**: Professional, neutral by default")
231
- sections.append("- **Use**: \"Understood\", \"Confirmed\", \"Noted\"")
254
+ sections.append('- **Use**: "Understood", "Confirmed", "Noted"')
232
255
  sections.append("- **No simplification** without explicit user request")
233
256
  sections.append("- **No mocks** outside test environments")
234
257
  sections.append("- **Complete implementations** only - no placeholders")
235
- sections.append("- **FORBIDDEN**: Overeager enthusiasm (\"Excellent!\", \"Perfect!\", \"Amazing!\")")
258
+ sections.append(
259
+ '- **FORBIDDEN**: Overeager enthusiasm ("Excellent!", "Perfect!", "Amazing!")'
260
+ )
236
261
  sections.append("")
237
-
262
+
238
263
  # Extract Error Handling
239
264
  if "## Error Handling Protocol" in content:
240
265
  sections.append("## Error Handling Protocol")
241
266
  sections.append("")
242
267
  sections.append("**3-Attempt Process**:")
243
268
  sections.append("1. **First Failure**: Re-delegate with enhanced context")
244
- sections.append("2. **Second Failure**: Mark \"ERROR - Attempt 2/3\", escalate if needed")
245
- sections.append("3. **Third Failure**: TodoWrite escalation with user decision required")
269
+ sections.append(
270
+ '2. **Second Failure**: Mark "ERROR - Attempt 2/3", escalate if needed'
271
+ )
272
+ sections.append(
273
+ "3. **Third Failure**: TodoWrite escalation with user decision required"
274
+ )
246
275
  sections.append("")
247
-
276
+
248
277
  # Extract Standard Operating Procedure
249
278
  if "## Standard Operating Procedure" in content:
250
279
  sections.append("## Standard Operating Procedure")
251
280
  sections.append("")
252
281
  sections.append("1. **Analysis**: Parse request, assess context (NO TOOLS)")
253
- sections.append("2. **Planning**: Agent selection, task breakdown, priority assignment")
282
+ sections.append(
283
+ "2. **Planning**: Agent selection, task breakdown, priority assignment"
284
+ )
254
285
  sections.append("3. **Delegation**: Task Tool with enhanced format")
255
286
  sections.append("4. **Monitoring**: Track progress via TodoWrite")
256
287
  sections.append("5. **Integration**: Synthesize results, validate, report")
257
288
  sections.append("")
258
-
289
+
259
290
  return sections
260
291
 
261
292
  def _extract_base_pm_sections(self, content: str) -> list:
262
293
  """Extract relevant sections from BASE_PM.md."""
263
294
  sections = []
264
-
295
+
265
296
  # Extract TodoWrite Requirements
266
297
  if "## TodoWrite Framework Requirements" in content:
267
298
  sections.append("## TodoWrite Requirements")
@@ -279,15 +310,19 @@ class OutputStyleManager:
279
310
  sections.append("### Task Status Management")
280
311
  sections.append("")
281
312
  sections.append("- `pending` - Task not yet started")
282
- sections.append("- `in_progress` - Currently being worked on (ONE at a time)")
313
+ sections.append(
314
+ "- `in_progress` - Currently being worked on (ONE at a time)"
315
+ )
283
316
  sections.append("- `completed` - Task finished successfully")
284
317
  sections.append("")
285
-
318
+
286
319
  # Extract PM Response Format
287
320
  if "## PM Response Format" in content:
288
321
  sections.append("## Response Format")
289
322
  sections.append("")
290
- sections.append("When completing delegations, provide structured summaries including:")
323
+ sections.append(
324
+ "When completing delegations, provide structured summaries including:"
325
+ )
291
326
  sections.append("- Request summary")
292
327
  sections.append("- Agents used and task counts")
293
328
  sections.append("- Tasks completed with [Agent] prefixes")
@@ -296,27 +331,27 @@ class OutputStyleManager:
296
331
  sections.append("- Next steps for user")
297
332
  sections.append("- Key information to remember")
298
333
  sections.append("")
299
-
334
+
300
335
  return sections
301
336
 
302
337
  def save_output_style(self, content: str) -> Path:
303
338
  """
304
339
  Save output style content to OUTPUT_STYLE.md.
305
-
340
+
306
341
  Args:
307
342
  content: The formatted output style content
308
-
343
+
309
344
  Returns:
310
345
  Path to the saved file
311
346
  """
312
347
  try:
313
348
  # Ensure the parent directory exists
314
349
  self.mpm_output_style_path.parent.mkdir(parents=True, exist_ok=True)
315
-
350
+
316
351
  # Write the content
317
- self.mpm_output_style_path.write_text(content, encoding='utf-8')
352
+ self.mpm_output_style_path.write_text(content, encoding="utf-8")
318
353
  self.logger.info(f"Saved output style to {self.mpm_output_style_path}")
319
-
354
+
320
355
  return self.mpm_output_style_path
321
356
  except Exception as e:
322
357
  self.logger.error(f"Failed to save output style: {e}")
@@ -326,30 +361,32 @@ class OutputStyleManager:
326
361
  """
327
362
  Deploy output style to Claude Code if version >= 1.0.83.
328
363
  Deploys the style file and activates it once.
329
-
364
+
330
365
  Args:
331
366
  content: The output style content to deploy
332
-
367
+
333
368
  Returns:
334
369
  True if deployed successfully, False otherwise
335
370
  """
336
371
  if not self.supports_output_styles():
337
- self.logger.info(f"Claude version {self.claude_version or 'unknown'} does not support output styles")
372
+ self.logger.info(
373
+ f"Claude version {self.claude_version or 'unknown'} does not support output styles"
374
+ )
338
375
  return False
339
-
376
+
340
377
  try:
341
378
  # Ensure output-styles directory exists
342
379
  self.output_style_dir.mkdir(parents=True, exist_ok=True)
343
-
380
+
344
381
  # Write the output style file
345
- self.output_style_path.write_text(content, encoding='utf-8')
382
+ self.output_style_path.write_text(content, encoding="utf-8")
346
383
  self.logger.info(f"Deployed output style to {self.output_style_path}")
347
-
384
+
348
385
  # Activate the claude-mpm style
349
386
  self._activate_output_style()
350
-
387
+
351
388
  return True
352
-
389
+
353
390
  except Exception as e:
354
391
  self.logger.error(f"Failed to deploy output style: {e}")
355
392
  return False
@@ -358,7 +395,7 @@ class OutputStyleManager:
358
395
  """
359
396
  Update Claude Code settings to activate the claude-mpm output style.
360
397
  Sets activeOutputStyle to "claude-mpm" once at startup.
361
-
398
+
362
399
  Returns:
363
400
  True if activated successfully, False otherwise
364
401
  """
@@ -369,30 +406,33 @@ class OutputStyleManager:
369
406
  try:
370
407
  settings = json.loads(self.settings_file.read_text())
371
408
  except json.JSONDecodeError:
372
- self.logger.warning("Could not parse existing settings.json, using defaults")
373
-
409
+ self.logger.warning(
410
+ "Could not parse existing settings.json, using defaults"
411
+ )
412
+
374
413
  # Check current active style
375
414
  current_style = settings.get("activeOutputStyle")
376
-
415
+
377
416
  # Update active output style to claude-mpm if not already set
378
417
  if current_style != "claude-mpm":
379
418
  settings["activeOutputStyle"] = "claude-mpm"
380
-
419
+
381
420
  # Ensure settings directory exists
382
421
  self.settings_file.parent.mkdir(parents=True, exist_ok=True)
383
-
422
+
384
423
  # Write updated settings
385
424
  self.settings_file.write_text(
386
- json.dumps(settings, indent=2),
387
- encoding='utf-8'
425
+ json.dumps(settings, indent=2), encoding="utf-8"
426
+ )
427
+
428
+ self.logger.info(
429
+ f"✅ Activated claude-mpm output style (was: {current_style or 'none'})"
388
430
  )
389
-
390
- self.logger.info(f"✅ Activated claude-mpm output style (was: {current_style or 'none'})")
391
431
  else:
392
432
  self.logger.debug("Claude MPM output style already active")
393
-
433
+
394
434
  return True
395
-
435
+
396
436
  except Exception as e:
397
437
  self.logger.warning(f"Failed to update settings: {e}")
398
438
  return False
@@ -400,7 +440,7 @@ class OutputStyleManager:
400
440
  def get_status_summary(self) -> Dict[str, str]:
401
441
  """
402
442
  Get a summary of the output style status.
403
-
443
+
404
444
  Returns:
405
445
  Dictionary with status information
406
446
  """
@@ -409,18 +449,18 @@ class OutputStyleManager:
409
449
  "supports_output_styles": "Yes" if self.supports_output_styles() else "No",
410
450
  "deployment_mode": "Not initialized",
411
451
  "active_style": "Unknown",
412
- "file_status": "Not checked"
452
+ "file_status": "Not checked",
413
453
  }
414
-
454
+
415
455
  if self.supports_output_styles():
416
456
  status["deployment_mode"] = "Output style deployment"
417
-
457
+
418
458
  # Check if file exists
419
459
  if self.output_style_path.exists():
420
460
  status["file_status"] = "Deployed"
421
461
  else:
422
462
  status["file_status"] = "Pending deployment"
423
-
463
+
424
464
  # Check active style
425
465
  if self.settings_file.exists():
426
466
  try:
@@ -432,37 +472,38 @@ class OutputStyleManager:
432
472
  status["deployment_mode"] = "Framework injection"
433
473
  status["file_status"] = "N/A (legacy mode)"
434
474
  status["active_style"] = "N/A (legacy mode)"
435
-
475
+
436
476
  return status
437
-
477
+
438
478
  def get_injectable_content(self, framework_loader=None) -> str:
439
479
  """
440
480
  Get output style content for injection into instructions (for Claude < 1.0.83).
441
-
481
+
442
482
  This returns a simplified version without YAML frontmatter, suitable for
443
483
  injection into the framework instructions.
444
-
484
+
445
485
  Args:
446
486
  framework_loader: Optional FrameworkLoader instance to reuse loaded content
447
-
487
+
448
488
  Returns:
449
489
  Simplified output style content for injection
450
490
  """
451
491
  # Extract the same content but without YAML frontmatter
452
492
  full_content = self.extract_output_style_content(framework_loader)
453
-
493
+
454
494
  # Remove YAML frontmatter
455
- lines = full_content.split('\n')
456
- if lines[0] == '---':
495
+ lines = full_content.split("\n")
496
+ if lines[0] == "---":
457
497
  # Find the closing ---
458
498
  for i in range(1, len(lines)):
459
- if lines[i] == '---':
499
+ if lines[i] == "---":
460
500
  # Skip frontmatter and empty lines after it
461
501
  content_start = i + 1
462
- while content_start < len(lines) and not lines[content_start].strip():
502
+ while (
503
+ content_start < len(lines) and not lines[content_start].strip()
504
+ ):
463
505
  content_start += 1
464
- return '\n'.join(lines[content_start:])
465
-
506
+ return "\n".join(lines[content_start:])
507
+
466
508
  # If no frontmatter found, return as-is
467
509
  return full_content
468
-
@@ -12,7 +12,6 @@ WHY this is needed:
12
12
  """
13
13
 
14
14
  import functools
15
- import os
16
15
  import threading
17
16
  import time
18
17
  from datetime import datetime
@@ -129,10 +129,14 @@ class ServiceRegistry:
129
129
 
130
130
  # Create factory wrapper if config provided
131
131
  if config and not factory:
132
- factory = lambda c: service_class(name=name, config=config, container=c)
132
+
133
+ def factory(c):
134
+ return service_class(name=name, config=config, container=c)
135
+
133
136
  elif not factory:
134
137
  # Default factory with container injection
135
- factory = lambda c: service_class(name=name, container=c)
138
+ def factory(c):
139
+ return service_class(name=name, container=c)
136
140
 
137
141
  # Register with DI container
138
142
  self.container.register(
@@ -216,12 +220,11 @@ class ServiceRegistry:
216
220
  if (
217
221
  registration
218
222
  and registration.lifetime == ServiceLifetime.SINGLETON
219
- ):
220
- if service_class in self.container._singletons:
221
- service = self.container._singletons[service_class]
222
- if hasattr(service, "stop") and service.running:
223
- await service.stop()
224
- logger.info(f"Stopped service: {name}")
223
+ ) and service_class in self.container._singletons:
224
+ service = self.container._singletons[service_class]
225
+ if hasattr(service, "stop") and service.running:
226
+ await service.stop()
227
+ logger.info(f"Stopped service: {name}")
225
228
  except Exception as e:
226
229
  logger.error(f"Failed to stop service {name}: {e}")
227
230
 
@@ -195,7 +195,7 @@ class SessionManager:
195
195
  session_file = self.session_dir / "active_sessions.json"
196
196
  if session_file.exists():
197
197
  try:
198
- with open(session_file, "r") as f:
198
+ with open(session_file) as f:
199
199
  self.active_sessions = json.load(f)
200
200
 
201
201
  # Clean up old sessions on load (archive by default)
@@ -323,7 +323,6 @@ class OrchestrationSession:
323
323
  def __exit__(self, exc_type, exc_val, exc_tb):
324
324
  """Exit session context."""
325
325
  # Could add cleanup here if needed
326
- pass
327
326
 
328
327
 
329
328
  # Example usage in subprocess orchestrator:
@@ -11,7 +11,7 @@ from .singleton_manager import SingletonManager
11
11
 
12
12
  __all__ = [
13
13
  "ConfigLoader",
14
- "ConfigPattern",
14
+ "ConfigPattern",
15
15
  "PathResolver",
16
16
  "SingletonManager",
17
17
  ]