claude-mpm 5.0.2__py3-none-any.whl → 5.4.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.

Potentially problematic release.


This version of claude-mpm might be problematic. Click here for more details.

Files changed (184) hide show
  1. claude_mpm/VERSION +1 -1
  2. claude_mpm/agents/CLAUDE_MPM_TEACHER_OUTPUT_STYLE.md +2002 -0
  3. claude_mpm/agents/PM_INSTRUCTIONS.md +1218 -905
  4. claude_mpm/agents/agent_loader.py +10 -17
  5. claude_mpm/agents/base_agent_loader.py +10 -35
  6. claude_mpm/agents/frontmatter_validator.py +68 -0
  7. claude_mpm/agents/templates/circuit-breakers.md +431 -45
  8. claude_mpm/cli/__init__.py +0 -1
  9. claude_mpm/cli/commands/__init__.py +2 -0
  10. claude_mpm/cli/commands/agent_state_manager.py +67 -23
  11. claude_mpm/cli/commands/agents.py +446 -25
  12. claude_mpm/cli/commands/auto_configure.py +535 -233
  13. claude_mpm/cli/commands/configure.py +1500 -147
  14. claude_mpm/cli/commands/configure_agent_display.py +13 -6
  15. claude_mpm/cli/commands/mpm_init/core.py +158 -1
  16. claude_mpm/cli/commands/mpm_init/knowledge_extractor.py +481 -0
  17. claude_mpm/cli/commands/mpm_init/prompts.py +280 -0
  18. claude_mpm/cli/commands/postmortem.py +401 -0
  19. claude_mpm/cli/commands/run.py +1 -39
  20. claude_mpm/cli/commands/skills.py +322 -19
  21. claude_mpm/cli/commands/summarize.py +413 -0
  22. claude_mpm/cli/executor.py +8 -0
  23. claude_mpm/cli/interactive/agent_wizard.py +302 -195
  24. claude_mpm/cli/parsers/agents_parser.py +137 -0
  25. claude_mpm/cli/parsers/auto_configure_parser.py +13 -0
  26. claude_mpm/cli/parsers/base_parser.py +9 -0
  27. claude_mpm/cli/parsers/skills_parser.py +7 -0
  28. claude_mpm/cli/startup.py +133 -85
  29. claude_mpm/commands/mpm-agents-auto-configure.md +2 -2
  30. claude_mpm/commands/mpm-agents-list.md +2 -2
  31. claude_mpm/commands/mpm-config-view.md +2 -2
  32. claude_mpm/commands/mpm-help.md +3 -0
  33. claude_mpm/commands/{mpm-ticket-organize.md → mpm-organize.md} +4 -5
  34. claude_mpm/commands/mpm-postmortem.md +123 -0
  35. claude_mpm/commands/mpm-session-resume.md +2 -2
  36. claude_mpm/commands/mpm-ticket-view.md +2 -2
  37. claude_mpm/config/agent_presets.py +312 -82
  38. claude_mpm/config/agent_sources.py +27 -0
  39. claude_mpm/config/skill_presets.py +392 -0
  40. claude_mpm/constants.py +1 -0
  41. claude_mpm/core/claude_runner.py +2 -25
  42. claude_mpm/core/framework/loaders/agent_loader.py +8 -5
  43. claude_mpm/core/framework/loaders/file_loader.py +54 -101
  44. claude_mpm/core/interactive_session.py +19 -5
  45. claude_mpm/core/oneshot_session.py +16 -4
  46. claude_mpm/core/output_style_manager.py +173 -43
  47. claude_mpm/core/protocols/__init__.py +23 -0
  48. claude_mpm/core/protocols/runner_protocol.py +103 -0
  49. claude_mpm/core/protocols/session_protocol.py +131 -0
  50. claude_mpm/core/shared/singleton_manager.py +11 -4
  51. claude_mpm/core/socketio_pool.py +3 -3
  52. claude_mpm/core/system_context.py +38 -0
  53. claude_mpm/core/unified_agent_registry.py +134 -16
  54. claude_mpm/core/unified_config.py +22 -0
  55. claude_mpm/hooks/claude_hooks/__pycache__/__init__.cpython-313.pyc +0 -0
  56. claude_mpm/hooks/claude_hooks/__pycache__/correlation_manager.cpython-313.pyc +0 -0
  57. claude_mpm/hooks/claude_hooks/__pycache__/event_handlers.cpython-313.pyc +0 -0
  58. claude_mpm/hooks/claude_hooks/__pycache__/hook_handler.cpython-313.pyc +0 -0
  59. claude_mpm/hooks/claude_hooks/__pycache__/memory_integration.cpython-313.pyc +0 -0
  60. claude_mpm/hooks/claude_hooks/__pycache__/response_tracking.cpython-313.pyc +0 -0
  61. claude_mpm/hooks/claude_hooks/__pycache__/tool_analysis.cpython-313.pyc +0 -0
  62. claude_mpm/hooks/claude_hooks/correlation_manager.py +60 -0
  63. claude_mpm/hooks/claude_hooks/event_handlers.py +35 -2
  64. claude_mpm/hooks/claude_hooks/hook_handler.py +4 -0
  65. claude_mpm/hooks/claude_hooks/memory_integration.py +12 -1
  66. claude_mpm/hooks/claude_hooks/services/__pycache__/__init__.cpython-313.pyc +0 -0
  67. claude_mpm/hooks/claude_hooks/services/__pycache__/connection_manager_http.cpython-313.pyc +0 -0
  68. claude_mpm/hooks/claude_hooks/services/__pycache__/duplicate_detector.cpython-313.pyc +0 -0
  69. claude_mpm/hooks/claude_hooks/services/__pycache__/state_manager.cpython-313.pyc +0 -0
  70. claude_mpm/hooks/claude_hooks/services/__pycache__/subagent_processor.cpython-313.pyc +0 -0
  71. claude_mpm/hooks/claude_hooks/services/connection_manager.py +4 -0
  72. claude_mpm/models/agent_definition.py +7 -0
  73. claude_mpm/scripts/launch_monitor.py +93 -13
  74. claude_mpm/services/agents/agent_recommendation_service.py +279 -0
  75. claude_mpm/services/agents/cache_git_manager.py +621 -0
  76. claude_mpm/services/agents/deployment/agent_template_builder.py +3 -2
  77. claude_mpm/services/agents/deployment/multi_source_deployment_service.py +110 -3
  78. claude_mpm/services/agents/deployment/remote_agent_discovery_service.py +518 -55
  79. claude_mpm/services/agents/git_source_manager.py +20 -0
  80. claude_mpm/services/agents/sources/git_source_sync_service.py +45 -6
  81. claude_mpm/services/agents/toolchain_detector.py +6 -5
  82. claude_mpm/services/analysis/__init__.py +35 -0
  83. claude_mpm/services/analysis/clone_detector.py +1030 -0
  84. claude_mpm/services/analysis/postmortem_reporter.py +474 -0
  85. claude_mpm/services/analysis/postmortem_service.py +765 -0
  86. claude_mpm/services/command_deployment_service.py +106 -5
  87. claude_mpm/services/core/base.py +7 -2
  88. claude_mpm/services/diagnostics/checks/mcp_services_check.py +7 -15
  89. claude_mpm/services/event_bus/config.py +3 -1
  90. claude_mpm/services/git/git_operations_service.py +8 -8
  91. claude_mpm/services/mcp_config_manager.py +75 -145
  92. claude_mpm/services/mcp_service_verifier.py +6 -3
  93. claude_mpm/services/monitor/daemon.py +37 -10
  94. claude_mpm/services/monitor/daemon_manager.py +134 -21
  95. claude_mpm/services/monitor/server.py +225 -19
  96. claude_mpm/services/project/project_organizer.py +4 -0
  97. claude_mpm/services/runner_configuration_service.py +16 -3
  98. claude_mpm/services/session_management_service.py +16 -4
  99. claude_mpm/services/socketio/event_normalizer.py +15 -1
  100. claude_mpm/services/socketio/server/core.py +160 -21
  101. claude_mpm/services/version_control/git_operations.py +103 -0
  102. claude_mpm/utils/agent_filters.py +261 -0
  103. claude_mpm/utils/gitignore.py +3 -0
  104. claude_mpm/utils/migration.py +372 -0
  105. claude_mpm/utils/progress.py +5 -1
  106. {claude_mpm-5.0.2.dist-info → claude_mpm-5.4.3.dist-info}/METADATA +69 -84
  107. {claude_mpm-5.0.2.dist-info → claude_mpm-5.4.3.dist-info}/RECORD +112 -153
  108. {claude_mpm-5.0.2.dist-info → claude_mpm-5.4.3.dist-info}/entry_points.txt +0 -2
  109. claude_mpm/dashboard/analysis_runner.py +0 -455
  110. claude_mpm/dashboard/index.html +0 -13
  111. claude_mpm/dashboard/open_dashboard.py +0 -66
  112. claude_mpm/dashboard/static/css/activity.css +0 -1958
  113. claude_mpm/dashboard/static/css/connection-status.css +0 -370
  114. claude_mpm/dashboard/static/css/dashboard.css +0 -4701
  115. claude_mpm/dashboard/static/js/components/activity-tree.js +0 -1871
  116. claude_mpm/dashboard/static/js/components/agent-hierarchy.js +0 -777
  117. claude_mpm/dashboard/static/js/components/agent-inference.js +0 -956
  118. claude_mpm/dashboard/static/js/components/build-tracker.js +0 -333
  119. claude_mpm/dashboard/static/js/components/code-simple.js +0 -857
  120. claude_mpm/dashboard/static/js/components/connection-debug.js +0 -654
  121. claude_mpm/dashboard/static/js/components/diff-viewer.js +0 -891
  122. claude_mpm/dashboard/static/js/components/event-processor.js +0 -542
  123. claude_mpm/dashboard/static/js/components/event-viewer.js +0 -1155
  124. claude_mpm/dashboard/static/js/components/export-manager.js +0 -368
  125. claude_mpm/dashboard/static/js/components/file-change-tracker.js +0 -443
  126. claude_mpm/dashboard/static/js/components/file-change-viewer.js +0 -690
  127. claude_mpm/dashboard/static/js/components/file-tool-tracker.js +0 -724
  128. claude_mpm/dashboard/static/js/components/file-viewer.js +0 -580
  129. claude_mpm/dashboard/static/js/components/hud-library-loader.js +0 -211
  130. claude_mpm/dashboard/static/js/components/hud-manager.js +0 -671
  131. claude_mpm/dashboard/static/js/components/hud-visualizer.js +0 -1718
  132. claude_mpm/dashboard/static/js/components/module-viewer.js +0 -2764
  133. claude_mpm/dashboard/static/js/components/session-manager.js +0 -579
  134. claude_mpm/dashboard/static/js/components/socket-manager.js +0 -368
  135. claude_mpm/dashboard/static/js/components/ui-state-manager.js +0 -749
  136. claude_mpm/dashboard/static/js/components/unified-data-viewer.js +0 -1824
  137. claude_mpm/dashboard/static/js/components/working-directory.js +0 -920
  138. claude_mpm/dashboard/static/js/connection-manager.js +0 -536
  139. claude_mpm/dashboard/static/js/dashboard.js +0 -1914
  140. claude_mpm/dashboard/static/js/extension-error-handler.js +0 -164
  141. claude_mpm/dashboard/static/js/socket-client.js +0 -1474
  142. claude_mpm/dashboard/static/js/tab-isolation-fix.js +0 -185
  143. claude_mpm/dashboard/static/socket.io.min.js +0 -7
  144. claude_mpm/dashboard/static/socket.io.v4.8.1.backup.js +0 -7
  145. claude_mpm/dashboard/templates/code_simple.html +0 -153
  146. claude_mpm/dashboard/templates/index.html +0 -606
  147. claude_mpm/dashboard/test_dashboard.html +0 -372
  148. claude_mpm/scripts/mcp_server.py +0 -75
  149. claude_mpm/scripts/mcp_wrapper.py +0 -39
  150. claude_mpm/services/mcp_gateway/__init__.py +0 -159
  151. claude_mpm/services/mcp_gateway/auto_configure.py +0 -369
  152. claude_mpm/services/mcp_gateway/config/__init__.py +0 -17
  153. claude_mpm/services/mcp_gateway/config/config_loader.py +0 -296
  154. claude_mpm/services/mcp_gateway/config/config_schema.py +0 -243
  155. claude_mpm/services/mcp_gateway/config/configuration.py +0 -429
  156. claude_mpm/services/mcp_gateway/core/__init__.py +0 -43
  157. claude_mpm/services/mcp_gateway/core/base.py +0 -312
  158. claude_mpm/services/mcp_gateway/core/exceptions.py +0 -253
  159. claude_mpm/services/mcp_gateway/core/interfaces.py +0 -443
  160. claude_mpm/services/mcp_gateway/core/process_pool.py +0 -971
  161. claude_mpm/services/mcp_gateway/core/singleton_manager.py +0 -315
  162. claude_mpm/services/mcp_gateway/core/startup_verification.py +0 -316
  163. claude_mpm/services/mcp_gateway/main.py +0 -589
  164. claude_mpm/services/mcp_gateway/registry/__init__.py +0 -12
  165. claude_mpm/services/mcp_gateway/registry/service_registry.py +0 -412
  166. claude_mpm/services/mcp_gateway/registry/tool_registry.py +0 -489
  167. claude_mpm/services/mcp_gateway/server/__init__.py +0 -15
  168. claude_mpm/services/mcp_gateway/server/mcp_gateway.py +0 -414
  169. claude_mpm/services/mcp_gateway/server/stdio_handler.py +0 -372
  170. claude_mpm/services/mcp_gateway/server/stdio_server.py +0 -712
  171. claude_mpm/services/mcp_gateway/tools/__init__.py +0 -36
  172. claude_mpm/services/mcp_gateway/tools/base_adapter.py +0 -485
  173. claude_mpm/services/mcp_gateway/tools/document_summarizer.py +0 -789
  174. claude_mpm/services/mcp_gateway/tools/external_mcp_services.py +0 -654
  175. claude_mpm/services/mcp_gateway/tools/health_check_tool.py +0 -456
  176. claude_mpm/services/mcp_gateway/tools/hello_world.py +0 -551
  177. claude_mpm/services/mcp_gateway/tools/kuzu_memory_service.py +0 -555
  178. claude_mpm/services/mcp_gateway/utils/__init__.py +0 -14
  179. claude_mpm/services/mcp_gateway/utils/package_version_checker.py +0 -160
  180. claude_mpm/services/mcp_gateway/utils/update_preferences.py +0 -170
  181. /claude_mpm/agents/{OUTPUT_STYLE.md → CLAUDE_MPM_OUTPUT_STYLE.md} +0 -0
  182. {claude_mpm-5.0.2.dist-info → claude_mpm-5.4.3.dist-info}/WHEEL +0 -0
  183. {claude_mpm-5.0.2.dist-info → claude_mpm-5.4.3.dist-info}/licenses/LICENSE +0 -0
  184. {claude_mpm-5.0.2.dist-info → claude_mpm-5.4.3.dist-info}/top_level.txt +0 -0
@@ -444,4 +444,141 @@ Available commands:
444
444
  help="Show what would be deployed without actually deploying",
445
445
  )
446
446
 
447
+ # ============================================================================
448
+ # Collection-Based Agent Management Commands
449
+ # ============================================================================
450
+ # Purpose: Enable collection-based agent selection and deployment
451
+ # Commands: list-collections, deploy-collection, list-by-collection
452
+ # NEW: Enhanced agent matching with collection_id support
453
+ # ============================================================================
454
+
455
+ # list-collections: List all available agent collections
456
+ agents_subparsers.add_parser(
457
+ "list-collections",
458
+ help="List all available agent collections",
459
+ description="Display all agent collections with agent counts and collection metadata",
460
+ )
461
+
462
+ # deploy-collection: Deploy all agents from a specific collection
463
+ deploy_collection_parser = agents_subparsers.add_parser(
464
+ "deploy-collection",
465
+ help="Deploy all agents from a specific collection",
466
+ description="Deploy all agents from a named collection (e.g., 'bobmatnyc/claude-mpm-agents')",
467
+ )
468
+ deploy_collection_parser.add_argument(
469
+ "collection_id",
470
+ help="Collection ID in format 'owner/repo-name' (e.g., 'bobmatnyc/claude-mpm-agents')",
471
+ )
472
+ deploy_collection_parser.add_argument(
473
+ "--force",
474
+ "-f",
475
+ action="store_true",
476
+ help="Force redeployment even if agents are already deployed",
477
+ )
478
+ deploy_collection_parser.add_argument(
479
+ "--dry-run",
480
+ action="store_true",
481
+ help="Show what would be deployed without actually deploying",
482
+ )
483
+
484
+ # list-by-collection: List agents filtered by collection
485
+ list_by_collection_parser = agents_subparsers.add_parser(
486
+ "list-by-collection",
487
+ help="List agents from a specific collection",
488
+ description="Display agents from a specific collection with metadata",
489
+ )
490
+ list_by_collection_parser.add_argument(
491
+ "collection_id",
492
+ help="Collection ID to filter by (e.g., 'bobmatnyc/claude-mpm-agents')",
493
+ )
494
+ list_by_collection_parser.add_argument(
495
+ "--format",
496
+ choices=["table", "json", "yaml"],
497
+ default="table",
498
+ help="Output format (default: table)",
499
+ )
500
+
501
+ # ============================================================================
502
+ # Cache Git Management Commands (claude-mpm Issue 1M-442 Phase 2)
503
+ # ============================================================================
504
+ # Purpose: Enable git workflow for agent cache management
505
+ # Commands: cache-status, cache-pull, cache-commit, cache-push, cache-sync
506
+ # Documentation: See docs/research/cache-update-workflow-analysis-2025-12-03.md
507
+ # ============================================================================
508
+
509
+ # cache-status: Show git status of agent cache
510
+ agents_subparsers.add_parser(
511
+ "cache-status",
512
+ help="Show git status of agent cache directory",
513
+ description="Display git status including branch, uncommitted changes, and unpushed commits",
514
+ )
515
+
516
+ # cache-pull: Pull latest agents from remote
517
+ cache_pull_parser = agents_subparsers.add_parser(
518
+ "cache-pull",
519
+ help="Pull latest agents from remote repository",
520
+ description="Fetch and merge latest agent changes from GitHub remote repository",
521
+ )
522
+ cache_pull_parser.add_argument(
523
+ "--branch",
524
+ default="main",
525
+ help="Branch to pull from (default: main)",
526
+ )
527
+
528
+ # cache-commit: Commit changes to agent cache
529
+ cache_commit_parser = agents_subparsers.add_parser(
530
+ "cache-commit",
531
+ help="Commit changes to agent cache",
532
+ description="Stage and commit changes to local agent cache git repository",
533
+ )
534
+ cache_commit_parser.add_argument(
535
+ "--message",
536
+ "-m",
537
+ help="Commit message (default: 'feat: update agents from local development')",
538
+ )
539
+ cache_commit_parser.add_argument(
540
+ "--files",
541
+ nargs="+",
542
+ help="Specific files to commit (default: all modified files)",
543
+ )
544
+
545
+ # cache-push: Push agent changes to remote
546
+ cache_push_parser = agents_subparsers.add_parser(
547
+ "cache-push",
548
+ help="Push agent changes to remote repository",
549
+ description="Push committed changes from local cache to GitHub remote repository",
550
+ )
551
+ cache_push_parser.add_argument(
552
+ "--branch",
553
+ default="main",
554
+ help="Branch to push to (default: main)",
555
+ )
556
+ cache_push_parser.add_argument(
557
+ "--auto-commit",
558
+ action="store_true",
559
+ help="Automatically commit uncommitted changes before pushing",
560
+ )
561
+
562
+ # cache-sync: Full cache sync workflow
563
+ cache_sync_parser = agents_subparsers.add_parser(
564
+ "cache-sync",
565
+ help="Full agent cache sync with remote",
566
+ description="Complete sync workflow: pull latest, commit local changes, push to remote",
567
+ )
568
+ cache_sync_parser.add_argument(
569
+ "--message",
570
+ "-m",
571
+ help="Commit message for any uncommitted changes",
572
+ )
573
+ cache_sync_parser.add_argument(
574
+ "--skip-pull",
575
+ action="store_true",
576
+ help="Skip pulling from remote before sync",
577
+ )
578
+ cache_sync_parser.add_argument(
579
+ "--skip-push",
580
+ action="store_true",
581
+ help="Skip pushing to remote after sync",
582
+ )
583
+
447
584
  return agents_parser
@@ -88,6 +88,19 @@ Examples:
88
88
  help="Skip confirmation prompts and deploy automatically",
89
89
  )
90
90
 
91
+ # Scope selection
92
+ scope_group = auto_configure_parser.add_mutually_exclusive_group()
93
+ scope_group.add_argument(
94
+ "--agents-only",
95
+ action="store_true",
96
+ help="Configure agents only (skip skills)",
97
+ )
98
+ scope_group.add_argument(
99
+ "--skills-only",
100
+ action="store_true",
101
+ help="Configure skills only (skip agents)",
102
+ )
103
+
91
104
  # Configuration options
92
105
  auto_configure_parser.add_argument(
93
106
  "--min-confidence",
@@ -553,6 +553,10 @@ def create_parser(
553
553
 
554
554
  add_doctor_parser(subparsers)
555
555
 
556
+ from ..commands.postmortem import add_postmortem_parser
557
+
558
+ add_postmortem_parser(subparsers)
559
+
556
560
  # Add upgrade command
557
561
  from ..commands.upgrade import add_upgrade_parser
558
562
 
@@ -590,6 +594,11 @@ def create_parser(
590
594
  action="store_true",
591
595
  help="Skip confirmation prompts",
592
596
  )
597
+
598
+ # Add summarize command
599
+ from ..commands.summarize import add_summarize_parser
600
+
601
+ add_summarize_parser(subparsers)
593
602
  except ImportError:
594
603
  # Commands module may not be available during testing or refactoring
595
604
  pass
@@ -134,6 +134,13 @@ def add_skills_subparser(subparsers) -> argparse.ArgumentParser:
134
134
  help="Show configuration file path",
135
135
  )
136
136
 
137
+ # Configure command (interactive skills selection)
138
+ skills_subparsers.add_parser(
139
+ SkillsCommands.CONFIGURE.value,
140
+ help="Interactive skills configuration with checkbox selection (like agents configure)",
141
+ )
142
+ # No additional arguments needed - purely interactive
143
+
137
144
  # GitHub deployment commands
138
145
  # Deploy from GitHub command
139
146
  deploy_github_parser = skills_subparsers.add_parser(
claude_mpm/cli/startup.py CHANGED
@@ -10,6 +10,47 @@ Part of cli/__init__.py refactoring to reduce file size and improve modularity.
10
10
 
11
11
  import os
12
12
  import sys
13
+ import warnings
14
+ from pathlib import Path
15
+
16
+
17
+ def check_legacy_cache() -> None:
18
+ """Check for legacy cache/agents/ directory and warn user.
19
+
20
+ WHY: cache/agents/ is deprecated in favor of cache/remote-agents/.
21
+ Research confirmed that cache/remote-agents/ is the canonical location
22
+ with 26 active code references, while cache/agents/ has only 7 legacy references.
23
+
24
+ DESIGN DECISIONS:
25
+ - Non-blocking warning: Doesn't stop execution, just informs user
26
+ - Migration guidance: Provides clear path to migrate
27
+ - One-time check: Only warns if legacy cache contains files
28
+ """
29
+ home = Path.home()
30
+ legacy_cache = home / ".claude-mpm" / "cache" / "agents"
31
+ canonical_cache = home / ".claude-mpm" / "cache" / "remote-agents"
32
+ migration_marker = home / ".claude-mpm" / "cache" / ".migrated_to_remote_agents"
33
+
34
+ # Skip if already migrated or no legacy cache
35
+ if migration_marker.exists() or not legacy_cache.exists():
36
+ return
37
+
38
+ # Check if legacy cache has actual agent files
39
+ legacy_files = list(legacy_cache.glob("*.md")) + list(legacy_cache.glob("*.json"))
40
+ if not legacy_files:
41
+ return
42
+
43
+ # Only warn if canonical cache doesn't exist (indicating unmigrated system)
44
+ if not canonical_cache.exists():
45
+ warnings.warn(
46
+ f"\n⚠️ DEPRECATION: Legacy cache directory detected\n"
47
+ f" Location: {legacy_cache}\n"
48
+ f" Files found: {len(legacy_files)}\n\n"
49
+ f"The 'cache/agents/' directory is deprecated. Please migrate to 'cache/remote-agents/'.\n"
50
+ f"Run: python scripts/migrate_cache_to_remote_agents.py\n",
51
+ DeprecationWarning,
52
+ stacklevel=2,
53
+ )
13
54
 
14
55
 
15
56
  def setup_early_environment(argv):
@@ -180,75 +221,76 @@ def discover_and_link_runtime_skills():
180
221
 
181
222
  def deploy_output_style_on_startup():
182
223
  """
183
- Deploy claude-mpm output style to Claude Code on CLI startup.
224
+ Deploy claude-mpm output styles to PROJECT-LEVEL directory on CLI startup.
184
225
 
185
- WHY: Automatically deploy and activate the output style to ensure consistent,
186
- professional communication without emojis and exclamation points. This ensures
187
- the style is available even when using Claude Code directly (not via chat command).
226
+ WHY: Automatically deploy output styles to ensure consistent, professional
227
+ communication without emojis and exclamation points. Styles are project-specific
228
+ to allow different projects to have different communication styles.
188
229
 
189
- DESIGN DECISION: This is non-blocking and idempotent. It uses OutputStyleManager
190
- which handles version detection, file deployment, and settings activation.
191
- Only works for Claude Code >= 1.0.83.
230
+ DESIGN DECISION: This is non-blocking and idempotent. Deploys to project-level
231
+ directory (.claude/settings/output-styles/) instead of user-level to maintain
232
+ project isolation.
233
+
234
+ Deploys two styles:
235
+ - claude-mpm-style.md (professional mode)
236
+ - claude-mpm-teacher.md (teaching mode)
192
237
  """
193
238
  try:
239
+ import shutil
194
240
  from pathlib import Path
195
241
 
196
- from ..core.output_style_manager import OutputStyleManager
197
-
198
- # Create OutputStyleManager instance
199
- output_style_manager = OutputStyleManager()
200
-
201
- # Check if Claude Code supports output styles
202
- if not output_style_manager.supports_output_styles():
203
- # Silently skip - version too old or Claude not installed
204
- return
205
-
206
- # Check if already deployed and active
207
- settings_file = Path.home() / ".claude" / "settings.json"
208
- output_style_file = Path.home() / ".claude" / "output-styles" / "claude-mpm.md"
209
-
210
- already_configured = False
211
- if settings_file.exists() and output_style_file.exists():
212
- try:
213
- import json
214
-
215
- # Check if file has content (bug fix: was skipping empty files)
216
- if output_style_file.stat().st_size == 0:
217
- # File is empty, need to redeploy with content
218
- pass # Fall through to deployment below
219
- else:
220
- # File has content, check if already active
221
- settings = json.loads(settings_file.read_text())
222
- if settings.get("activeOutputStyle") == "claude-mpm":
223
- # Already deployed and active with content
224
- already_configured = True
225
- except Exception:
226
- pass # Continue with deployment if we can't read settings
242
+ # Source files (in framework package)
243
+ package_dir = Path(__file__).parent.parent / "agents"
244
+ professional_source = package_dir / "CLAUDE_MPM_OUTPUT_STYLE.md"
245
+ teacher_source = package_dir / "CLAUDE_MPM_TEACHER_OUTPUT_STYLE.md"
246
+
247
+ # Target directory (PROJECT-LEVEL, not user-level)
248
+ project_dir = Path.cwd()
249
+ output_styles_dir = project_dir / ".claude" / "settings" / "output-styles"
250
+ professional_target = output_styles_dir / "claude-mpm-style.md"
251
+ teacher_target = output_styles_dir / "claude-mpm-teacher.md"
252
+
253
+ # Create directory if it doesn't exist
254
+ output_styles_dir.mkdir(parents=True, exist_ok=True)
255
+
256
+ # Check if already deployed (both files exist and have content)
257
+ already_deployed = (
258
+ professional_target.exists()
259
+ and teacher_target.exists()
260
+ and professional_target.stat().st_size > 0
261
+ and teacher_target.stat().st_size > 0
262
+ )
227
263
 
228
- if already_configured:
229
- # Show feedback that output style is ready
230
- print("✓ Output style configured", flush=True)
264
+ if already_deployed:
265
+ # Show feedback that output styles are ready
266
+ print("✓ Output styles ready", flush=True)
231
267
  return
232
268
 
233
- # Read OUTPUT_STYLE.md content
234
- output_style_path = Path(__file__).parent.parent / "agents" / "OUTPUT_STYLE.md"
269
+ # Deploy both styles
270
+ deployed_count = 0
271
+ if professional_source.exists():
272
+ shutil.copy2(professional_source, professional_target)
273
+ deployed_count += 1
235
274
 
236
- if not output_style_path.exists():
237
- # No output style file to deploy
238
- return
275
+ if teacher_source.exists():
276
+ shutil.copy2(teacher_source, teacher_target)
277
+ deployed_count += 1
239
278
 
240
- output_style_content = output_style_path.read_text()
279
+ if deployed_count > 0:
280
+ print(f"✓ Output styles deployed ({deployed_count} styles)", flush=True)
281
+ else:
282
+ # Source files missing - log but don't fail
283
+ from ..core.logger import get_logger
241
284
 
242
- # Deploy the output style (deploys file and activates it)
243
- output_style_manager.deploy_output_style(output_style_content)
244
- print("✓ Output style configured", flush=True)
285
+ logger = get_logger("cli")
286
+ logger.debug("Output style source files not found")
245
287
 
246
288
  except Exception as e:
247
289
  # Non-critical - log but don't fail startup
248
290
  from ..core.logger import get_logger
249
291
 
250
292
  logger = get_logger("cli")
251
- logger.debug(f"Failed to deploy output style: {e}")
293
+ logger.debug(f"Failed to deploy output styles: {e}")
252
294
  # Continue execution - output style deployment shouldn't block startup
253
295
 
254
296
 
@@ -269,6 +311,9 @@ def sync_remote_agents_on_startup():
269
311
  2. Deploy agents to ~/.claude/agents/ - Phase 2 progress bar
270
312
  3. Log deployment results
271
313
  """
314
+ # Check for legacy cache and warn user if found
315
+ check_legacy_cache()
316
+
272
317
  try:
273
318
  from ..services.agents.deployment.agent_deployment import AgentDeploymentService
274
319
  from ..services.agents.startup_sync import sync_agents_on_startup
@@ -311,8 +356,9 @@ def sync_remote_agents_on_startup():
311
356
 
312
357
  if cache_dir.exists():
313
358
  # Count MD files in cache (agent markdown files from Git)
314
- # Only check root directory (avoid counting subdirectory duplicates)
315
- # Exclude PM templates and BASE-AGENT - only count deployable agents
359
+ # BUGFIX: Only count files in agent directories, not docs/templates/READMEs
360
+ # Valid agent paths must contain "/agents/" or be in root-level category dirs
361
+ # Exclude PM templates, BASE-AGENT, and documentation files
316
362
  pm_templates = {
317
363
  "base-agent.md",
318
364
  "circuit_breakers.md",
@@ -324,10 +370,40 @@ def sync_remote_agents_on_startup():
324
370
  "validation_templates.md",
325
371
  "git_file_tracking.md",
326
372
  }
373
+ # Documentation files to exclude (by filename)
374
+ doc_files = {
375
+ "readme.md",
376
+ "changelog.md",
377
+ "contributing.md",
378
+ "implementation-summary.md",
379
+ "reorganization-plan.md",
380
+ "auto-deploy-index.md",
381
+ }
382
+
383
+ # Find all markdown files
384
+ all_md_files = list(cache_dir.rglob("*.md"))
385
+
386
+ # Filter to only agent files:
387
+ # 1. Must have "/agents/" in path (from git repos)
388
+ # 2. Must not be in PM templates or doc files
389
+ # 3. Exclude BASE-AGENT.md which is not a deployable agent
390
+ # 4. Exclude build artifacts (dist/, build/, .cache/) to prevent double-counting
327
391
  agent_files = [
328
392
  f
329
- for f in cache_dir.glob("*.md")
330
- if f.name.lower() not in pm_templates
393
+ for f in all_md_files
394
+ if (
395
+ # Must be in an agent directory (from git repos like bobmatnyc/claude-mpm-agents/agents/)
396
+ "/agents/" in str(f)
397
+ # Exclude PM templates, doc files, and BASE-AGENT
398
+ and f.name.lower() not in pm_templates
399
+ and f.name.lower() not in doc_files
400
+ and f.name.lower() != "base-agent.md"
401
+ # Exclude build artifacts (prevents double-counting source + built files)
402
+ and not any(
403
+ part in str(f).split("/")
404
+ for part in ["dist", "build", ".cache"]
405
+ )
406
+ )
331
407
  ]
332
408
  agent_count = len(agent_files)
333
409
 
@@ -340,8 +416,8 @@ def sync_remote_agents_on_startup():
340
416
  show_counter=True,
341
417
  )
342
418
 
343
- # Deploy agents with progress callback
344
- deploy_target = Path.home() / ".claude" / "agents"
419
+ # Deploy agents to project-level directory where Claude Code expects them
420
+ deploy_target = Path.cwd() / ".claude" / "agents"
345
421
  deployment_result = deployment_service.deploy_agents(
346
422
  target_dir=deploy_target,
347
423
  force_rebuild=False, # Only deploy if versions differ
@@ -719,34 +795,6 @@ def check_mcp_auto_configuration():
719
795
  logger = get_logger("cli")
720
796
  logger.debug(f"MCP auto-configuration check failed: {e}")
721
797
 
722
- # Also ensure MCP services are properly configured in ~/.claude.json
723
- # This fixes incorrect paths and adds missing services
724
- try:
725
- from ..core.logger import get_logger
726
- from ..services.mcp_config_manager import MCPConfigManager
727
-
728
- logger = get_logger("cli")
729
- mcp_manager = MCPConfigManager()
730
-
731
- # Fix any corrupted installations first
732
- _fix_success, fix_message = mcp_manager.fix_mcp_service_issues()
733
- if fix_message and "Fixed:" in fix_message:
734
- logger.info(f"MCP service fixes applied: {fix_message}")
735
- print("✓ MCP services fixed", flush=True)
736
-
737
- # Ensure all services are configured correctly
738
- _config_success, config_message = mcp_manager.ensure_mcp_services_configured()
739
- if config_message and "Added MCP services" in config_message:
740
- logger.info(f"MCP services configured: {config_message}")
741
- print("✓ MCP services configured", flush=True)
742
-
743
- except Exception as e:
744
- # Non-critical - log but don't fail
745
- from ..core.logger import get_logger
746
-
747
- logger = get_logger("cli")
748
- logger.debug(f"MCP services configuration update failed: {e}")
749
-
750
798
 
751
799
  def verify_mcp_gateway_startup():
752
800
  """
@@ -1,10 +1,10 @@
1
1
  ---
2
2
  namespace: mpm/agents
3
3
  command: auto-configure
4
- aliases: [mpm-agents-auto-configure, mpm-auto-configure]
4
+ aliases: [mpm-agents-auto-configure]
5
5
  migration_target: /mpm/agents:auto-configure
6
6
  category: agents
7
- deprecated_aliases: []
7
+ deprecated_aliases: [mpm-auto-configure]
8
8
  description: Automatically detect project toolchain and configure appropriate agents
9
9
  ---
10
10
  # Automatically configure agents based on project detection
@@ -1,10 +1,10 @@
1
1
  ---
2
2
  namespace: mpm/agents
3
3
  command: list
4
- aliases: [mpm-agents, mpm-agents-list]
4
+ aliases: [mpm-agents-list]
5
5
  migration_target: /mpm/agents:list
6
6
  category: agents
7
- deprecated_aliases: []
7
+ deprecated_aliases: [mpm-agents]
8
8
  description: List all available Claude MPM agents with versions and deployment status
9
9
  ---
10
10
  # Show available agents and their versions
@@ -1,10 +1,10 @@
1
1
  ---
2
2
  namespace: mpm/config
3
3
  command: view
4
- aliases: [mpm-config-view, mpm-config]
4
+ aliases: [mpm-config-view]
5
5
  migration_target: /mpm/config:view
6
6
  category: config
7
- deprecated_aliases: []
7
+ deprecated_aliases: [mpm-config]
8
8
  description: View and validate Claude MPM configuration settings
9
9
  ---
10
10
  # View and validate claude-mpm configuration
@@ -72,6 +72,9 @@ Available Commands:
72
72
  /mpm-doctor [--fix] [--verbose]
73
73
  Diagnose and fix common issues
74
74
 
75
+ /mpm-postmortem [--auto-fix] [--create-prs]
76
+ Analyze session errors and suggest improvements
77
+
75
78
  /mpm-agents [list|deploy|remove] [name]
76
79
  Manage agent deployment
77
80
 
@@ -1,10 +1,9 @@
1
1
  ---
2
- namespace: mpm/ticket
2
+ namespace: mpm/system
3
3
  command: organize
4
- aliases: [mpm-ticket-organize, mpm-organize]
5
- migration_target: /mpm/ticket:organize
6
- category: tickets
7
- deprecated_aliases: []
4
+ aliases: [mpm-organize]
5
+ migration_target: /mpm/system:organize
6
+ category: system
8
7
  description: Organize project files into proper directories with intelligent pattern detection
9
8
  ---
10
9
  # /mpm-organize