claude-mpm 4.1.3__py3-none-any.whl → 4.1.5__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 (77) hide show
  1. claude_mpm/VERSION +1 -1
  2. claude_mpm/agents/BASE_AGENT_TEMPLATE.md +16 -19
  3. claude_mpm/agents/MEMORY.md +21 -49
  4. claude_mpm/agents/templates/OPTIMIZATION_REPORT.md +156 -0
  5. claude_mpm/agents/templates/api_qa.json +36 -116
  6. claude_mpm/agents/templates/backup/data_engineer_agent_20250726_234551.json +42 -9
  7. claude_mpm/agents/templates/backup/documentation_agent_20250726_234551.json +29 -6
  8. claude_mpm/agents/templates/backup/engineer_agent_20250726_234551.json +34 -6
  9. claude_mpm/agents/templates/backup/ops_agent_20250726_234551.json +41 -9
  10. claude_mpm/agents/templates/backup/qa_agent_20250726_234551.json +30 -8
  11. claude_mpm/agents/templates/backup/research_agent_2025011_234551.json +2 -2
  12. claude_mpm/agents/templates/backup/research_agent_20250726_234551.json +29 -6
  13. claude_mpm/agents/templates/backup/research_memory_efficient.json +2 -2
  14. claude_mpm/agents/templates/backup/security_agent_20250726_234551.json +41 -9
  15. claude_mpm/agents/templates/backup/version_control_agent_20250726_234551.json +23 -7
  16. claude_mpm/agents/templates/code_analyzer.json +18 -36
  17. claude_mpm/agents/templates/data_engineer.json +43 -14
  18. claude_mpm/agents/templates/documentation.json +55 -74
  19. claude_mpm/agents/templates/engineer.json +56 -61
  20. claude_mpm/agents/templates/imagemagick.json +7 -2
  21. claude_mpm/agents/templates/memory_manager.json +1 -1
  22. claude_mpm/agents/templates/ops.json +36 -4
  23. claude_mpm/agents/templates/project_organizer.json +23 -71
  24. claude_mpm/agents/templates/qa.json +34 -2
  25. claude_mpm/agents/templates/refactoring_engineer.json +9 -5
  26. claude_mpm/agents/templates/research.json +36 -4
  27. claude_mpm/agents/templates/security.json +29 -2
  28. claude_mpm/agents/templates/ticketing.json +3 -3
  29. claude_mpm/agents/templates/vercel_ops_agent.json +2 -2
  30. claude_mpm/agents/templates/version_control.json +28 -2
  31. claude_mpm/agents/templates/web_qa.json +38 -151
  32. claude_mpm/agents/templates/web_ui.json +2 -2
  33. claude_mpm/cli/commands/agent_manager.py +221 -1
  34. claude_mpm/cli/commands/tickets.py +365 -784
  35. claude_mpm/cli/parsers/agent_manager_parser.py +34 -0
  36. claude_mpm/core/framework_loader.py +91 -0
  37. claude_mpm/core/log_manager.py +49 -1
  38. claude_mpm/core/output_style_manager.py +24 -0
  39. claude_mpm/core/unified_agent_registry.py +46 -15
  40. claude_mpm/services/agents/deployment/agent_discovery_service.py +12 -3
  41. claude_mpm/services/agents/deployment/agent_lifecycle_manager.py +172 -233
  42. claude_mpm/services/agents/deployment/agent_lifecycle_manager_refactored.py +575 -0
  43. claude_mpm/services/agents/deployment/agent_operation_service.py +573 -0
  44. claude_mpm/services/agents/deployment/agent_record_service.py +419 -0
  45. claude_mpm/services/agents/deployment/agent_state_service.py +381 -0
  46. claude_mpm/services/agents/deployment/multi_source_deployment_service.py +4 -2
  47. claude_mpm/services/infrastructure/__init__.py +31 -5
  48. claude_mpm/services/infrastructure/monitoring/__init__.py +43 -0
  49. claude_mpm/services/infrastructure/monitoring/aggregator.py +437 -0
  50. claude_mpm/services/infrastructure/monitoring/base.py +130 -0
  51. claude_mpm/services/infrastructure/monitoring/legacy.py +203 -0
  52. claude_mpm/services/infrastructure/monitoring/network.py +218 -0
  53. claude_mpm/services/infrastructure/monitoring/process.py +342 -0
  54. claude_mpm/services/infrastructure/monitoring/resources.py +243 -0
  55. claude_mpm/services/infrastructure/monitoring/service.py +367 -0
  56. claude_mpm/services/infrastructure/monitoring.py +67 -1030
  57. claude_mpm/services/memory/router.py +116 -10
  58. claude_mpm/services/project/analyzer.py +13 -4
  59. claude_mpm/services/project/analyzer_refactored.py +450 -0
  60. claude_mpm/services/project/analyzer_v2.py +566 -0
  61. claude_mpm/services/project/architecture_analyzer.py +461 -0
  62. claude_mpm/services/project/dependency_analyzer.py +462 -0
  63. claude_mpm/services/project/language_analyzer.py +265 -0
  64. claude_mpm/services/project/metrics_collector.py +410 -0
  65. claude_mpm/services/ticket_manager.py +5 -1
  66. claude_mpm/services/ticket_services/__init__.py +26 -0
  67. claude_mpm/services/ticket_services/crud_service.py +328 -0
  68. claude_mpm/services/ticket_services/formatter_service.py +290 -0
  69. claude_mpm/services/ticket_services/search_service.py +324 -0
  70. claude_mpm/services/ticket_services/validation_service.py +303 -0
  71. claude_mpm/services/ticket_services/workflow_service.py +244 -0
  72. {claude_mpm-4.1.3.dist-info → claude_mpm-4.1.5.dist-info}/METADATA +1 -1
  73. {claude_mpm-4.1.3.dist-info → claude_mpm-4.1.5.dist-info}/RECORD +77 -52
  74. {claude_mpm-4.1.3.dist-info → claude_mpm-4.1.5.dist-info}/WHEEL +0 -0
  75. {claude_mpm-4.1.3.dist-info → claude_mpm-4.1.5.dist-info}/entry_points.txt +0 -0
  76. {claude_mpm-4.1.3.dist-info → claude_mpm-4.1.5.dist-info}/licenses/LICENSE +0 -0
  77. {claude_mpm-4.1.3.dist-info → claude_mpm-4.1.5.dist-info}/top_level.txt +0 -0
@@ -57,6 +57,7 @@ class AgentManagerCommand(AgentCommand):
57
57
  "show": self._show_agent,
58
58
  "test": self._test_agent,
59
59
  "templates": self._list_templates,
60
+ "reset": self._reset_agents,
60
61
  }
61
62
 
62
63
  command = args.agent_manager_command
@@ -330,6 +331,218 @@ class AgentManagerCommand(AgentCommand):
330
331
  output += f" {template['description']}\n"
331
332
  return CommandResult.success_result(output)
332
333
 
334
+ def _reset_agents(self, args) -> CommandResult:
335
+ """Reset by removing claude-mpm authored agents from project and user directories.
336
+
337
+ This command removes any agents with "author: claude-mpm" in their frontmatter,
338
+ preserving user-created agents. This is useful for clean reinstalls or when
339
+ wanting to get fresh versions of system agents.
340
+ """
341
+ try:
342
+ # Determine which directories to clean
343
+ clean_project = not getattr(args, "user_only", False)
344
+ clean_user = not getattr(args, "project_only", False)
345
+ dry_run = getattr(args, "dry_run", False)
346
+ force = getattr(args, "force", False)
347
+ output_format = getattr(args, "format", "text")
348
+
349
+ # Track results
350
+ results = {
351
+ "project": {"checked": False, "removed": [], "preserved": []},
352
+ "user": {"checked": False, "removed": [], "preserved": []},
353
+ "dry_run": dry_run,
354
+ "total_removed": 0,
355
+ "total_preserved": 0,
356
+ }
357
+
358
+ # Check project directory - always scan first to see what's there
359
+ if clean_project:
360
+ project_dir = Path.cwd() / ".claude" / "agents"
361
+ if project_dir.exists():
362
+ results["project"]["checked"] = True
363
+ # Always scan with dry_run=True first to see what's there
364
+ self._scan_and_clean_directory(
365
+ project_dir, results["project"], dry_run=True
366
+ )
367
+
368
+ # Check user directory - always scan first to see what's there
369
+ if clean_user:
370
+ user_dir = Path.home() / ".claude" / "agents"
371
+ if user_dir.exists():
372
+ results["user"]["checked"] = True
373
+ # Always scan with dry_run=True first to see what's there
374
+ self._scan_and_clean_directory(
375
+ user_dir, results["user"], dry_run=True
376
+ )
377
+
378
+ # Calculate totals
379
+ results["total_removed"] = len(results["project"]["removed"]) + len(
380
+ results["user"]["removed"]
381
+ )
382
+ results["total_preserved"] = len(results["project"]["preserved"]) + len(
383
+ results["user"]["preserved"]
384
+ )
385
+
386
+ # Handle output based on format
387
+ if output_format == "json":
388
+ return CommandResult.success_result("Reset completed", data=results)
389
+
390
+ # Generate text output
391
+ output = self._format_reset_results(results, dry_run, force)
392
+
393
+ # If not dry-run, perform actual removal
394
+ if not dry_run and results["total_removed"] > 0:
395
+ # If force mode, remove immediately; otherwise get confirmation
396
+ if not force:
397
+ # Get confirmation first
398
+ print(output)
399
+ print("\n⚠️ This will permanently remove the agents listed above.")
400
+
401
+ # Ensure stdout is flushed before reading input
402
+ sys.stdout.flush()
403
+
404
+ # Get confirmation
405
+ try:
406
+ response = input("Continue? [y/N]: ").strip().lower()
407
+ if response not in ["y", "yes"]:
408
+ return CommandResult.success_result(
409
+ "Reset cancelled by user"
410
+ )
411
+ except (KeyboardInterrupt, EOFError):
412
+ return CommandResult.success_result("\nReset cancelled")
413
+
414
+ # Perform actual removal using the list we already have
415
+ if clean_project and results["project"]["removed"]:
416
+ project_dir = Path.cwd() / ".claude" / "agents"
417
+ for agent in results["project"]["removed"]:
418
+ agent_file = project_dir / agent
419
+ try:
420
+ if agent_file.exists():
421
+ agent_file.unlink()
422
+ self.logger.info(
423
+ f"Removed claude-mpm agent: {agent_file}"
424
+ )
425
+ except Exception as e:
426
+ self.logger.warning(f"Could not remove {agent_file}: {e}")
427
+
428
+ if clean_user and results["user"]["removed"]:
429
+ user_dir = Path.home() / ".claude" / "agents"
430
+ for agent in results["user"]["removed"]:
431
+ agent_file = user_dir / agent
432
+ try:
433
+ if agent_file.exists():
434
+ agent_file.unlink()
435
+ self.logger.info(
436
+ f"Removed claude-mpm agent: {agent_file}"
437
+ )
438
+ except Exception as e:
439
+ self.logger.warning(f"Could not remove {agent_file}: {e}")
440
+
441
+ # Update output to show actual removal
442
+ output = self._format_reset_results(results, dry_run=False, force=force)
443
+
444
+ return CommandResult.success_result(output)
445
+
446
+ except Exception as e:
447
+ self.logger.error(f"Failed to reset agents: {e}", exc_info=True)
448
+ return CommandResult.error_result(f"Failed to reset agents: {e}")
449
+
450
+ def _scan_and_clean_directory(
451
+ self, directory: Path, results: Dict[str, Any], dry_run: bool
452
+ ) -> None:
453
+ """Scan a directory for claude-mpm authored agents and optionally remove them.
454
+
455
+ Args:
456
+ directory: Directory to scan
457
+ results: Results dictionary to update
458
+ dry_run: If True, only scan without removing
459
+ """
460
+ for agent_file in directory.glob("*.md"):
461
+ try:
462
+ content = agent_file.read_text()
463
+ # Check if this is a claude-mpm authored agent
464
+ if "author: claude-mpm" in content.lower():
465
+ results["removed"].append(agent_file.name)
466
+ if not dry_run:
467
+ agent_file.unlink()
468
+ self.logger.info(f"Removed claude-mpm agent: {agent_file}")
469
+ else:
470
+ results["preserved"].append(agent_file.name)
471
+ self.logger.debug(f"Preserved user agent: {agent_file}")
472
+ except Exception as e:
473
+ self.logger.warning(f"Could not process {agent_file}: {e}")
474
+
475
+ def _format_reset_results(
476
+ self, results: Dict[str, Any], dry_run: bool, force: bool
477
+ ) -> str:
478
+ """Format reset results for display.
479
+
480
+ Args:
481
+ results: Results dictionary
482
+ dry_run: Whether this was a dry run
483
+ force: Whether force mode was used
484
+
485
+ Returns:
486
+ Formatted output string
487
+ """
488
+ if dry_run:
489
+ output = "🔍 DRY RUN - No changes will be made\n"
490
+ output += "=" * 50 + "\n\n"
491
+ else:
492
+ output = "🧹 Agent Reset Complete\n"
493
+ output += "=" * 50 + "\n\n"
494
+
495
+ # Show project results
496
+ if results["project"]["checked"]:
497
+ output += "📁 Project Level (.claude/agents):\n"
498
+ if results["project"]["removed"]:
499
+ action = "Would remove" if dry_run else "Removed"
500
+ output += f" {action} {len(results['project']['removed'])} claude-mpm agent(s):\n"
501
+ for agent in results["project"]["removed"][:5]:
502
+ output += f" • {agent}\n"
503
+ if len(results["project"]["removed"]) > 5:
504
+ output += (
505
+ f" ... and {len(results['project']['removed']) - 5} more\n"
506
+ )
507
+ else:
508
+ output += " No claude-mpm agents found\n"
509
+
510
+ if results["project"]["preserved"]:
511
+ output += f" Preserved {len(results['project']['preserved'])} user-created agent(s)\n"
512
+ output += "\n"
513
+
514
+ # Show user results
515
+ if results["user"]["checked"]:
516
+ output += "📁 User Level (~/.claude/agents):\n"
517
+ if results["user"]["removed"]:
518
+ action = "Would remove" if dry_run else "Removed"
519
+ output += f" {action} {len(results['user']['removed'])} claude-mpm agent(s):\n"
520
+ for agent in results["user"]["removed"][:5]:
521
+ output += f" • {agent}\n"
522
+ if len(results["user"]["removed"]) > 5:
523
+ output += (
524
+ f" ... and {len(results['user']['removed']) - 5} more\n"
525
+ )
526
+ else:
527
+ output += " No claude-mpm agents found\n"
528
+
529
+ if results["user"]["preserved"]:
530
+ output += f" Preserved {len(results['user']['preserved'])} user-created agent(s)\n"
531
+ output += "\n"
532
+
533
+ # Show summary
534
+ output += "📊 Summary:\n"
535
+ if dry_run:
536
+ output += f" • Would remove: {results['total_removed']} agent(s)\n"
537
+ else:
538
+ output += f" • Removed: {results['total_removed']} agent(s)\n"
539
+ output += f" • Preserved: {results['total_preserved']} user agent(s)\n"
540
+
541
+ if dry_run and results["total_removed"] > 0:
542
+ output += "\n💡 Run with --force to execute this cleanup immediately"
543
+
544
+ return output
545
+
333
546
  def _interactive_create(self) -> CommandResult:
334
547
  """Interactive agent creation wizard."""
335
548
  print("\n=== Agent Creation Wizard ===\n")
@@ -493,6 +706,7 @@ Commands:
493
706
  show Display detailed agent information
494
707
  test Validate agent configuration
495
708
  templates List available agent templates
709
+ reset Remove claude-mpm authored agents for clean install
496
710
 
497
711
  Examples:
498
712
  claude-mpm agent-manager list
@@ -500,6 +714,8 @@ Examples:
500
714
  claude-mpm agent-manager variant --base research --id research-v2
501
715
  claude-mpm agent-manager deploy --agent-id my-agent --tier user
502
716
  claude-mpm agent-manager customize-pm --level project
717
+ claude-mpm agent-manager reset --dry-run
718
+ claude-mpm agent-manager reset --force --project-only
503
719
 
504
720
  Note: PM customization writes to .claude-mpm/INSTRUCTIONS.md, not CLAUDE.md
505
721
  """
@@ -520,7 +736,11 @@ def manage_agent_manager(args) -> int:
520
736
  result = command.run(args)
521
737
 
522
738
  if result.success:
523
- if result.message:
739
+ # Handle JSON output format
740
+ output_format = getattr(args, "format", "text")
741
+ if output_format == "json" and result.data is not None:
742
+ print(json.dumps(result.data, indent=2))
743
+ elif result.message:
524
744
  print(result.message)
525
745
  return 0
526
746
  if result.message: