claude-mpm 4.1.8__py3-none-any.whl → 4.1.10__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 (103) hide show
  1. claude_mpm/VERSION +1 -1
  2. claude_mpm/agents/INSTRUCTIONS.md +26 -1
  3. claude_mpm/agents/agents_metadata.py +57 -0
  4. claude_mpm/agents/templates/.claude-mpm/memories/README.md +17 -0
  5. claude_mpm/agents/templates/.claude-mpm/memories/engineer_memories.md +3 -0
  6. claude_mpm/agents/templates/agent-manager.json +263 -17
  7. claude_mpm/agents/templates/agentic_coder_optimizer.json +222 -0
  8. claude_mpm/agents/templates/code_analyzer.json +18 -8
  9. claude_mpm/agents/templates/engineer.json +1 -1
  10. claude_mpm/agents/templates/logs/prompts/agent_engineer_20250826_014258_728.md +39 -0
  11. claude_mpm/agents/templates/qa.json +1 -1
  12. claude_mpm/agents/templates/research.json +1 -1
  13. claude_mpm/cli/__init__.py +4 -0
  14. claude_mpm/cli/commands/__init__.py +6 -0
  15. claude_mpm/cli/commands/analyze.py +547 -0
  16. claude_mpm/cli/commands/analyze_code.py +524 -0
  17. claude_mpm/cli/commands/configure.py +77 -28
  18. claude_mpm/cli/commands/configure_tui.py +60 -60
  19. claude_mpm/cli/commands/debug.py +1387 -0
  20. claude_mpm/cli/parsers/analyze_code_parser.py +170 -0
  21. claude_mpm/cli/parsers/analyze_parser.py +135 -0
  22. claude_mpm/cli/parsers/base_parser.py +29 -0
  23. claude_mpm/cli/parsers/debug_parser.py +319 -0
  24. claude_mpm/constants.py +3 -1
  25. claude_mpm/core/framework_loader.py +148 -6
  26. claude_mpm/core/log_manager.py +16 -13
  27. claude_mpm/core/logger.py +1 -1
  28. claude_mpm/core/unified_agent_registry.py +1 -1
  29. claude_mpm/dashboard/.claude-mpm/socketio-instances.json +1 -0
  30. claude_mpm/dashboard/analysis_runner.py +428 -0
  31. claude_mpm/dashboard/static/built/components/activity-tree.js +2 -0
  32. claude_mpm/dashboard/static/built/components/agent-inference.js +1 -1
  33. claude_mpm/dashboard/static/built/components/event-viewer.js +1 -1
  34. claude_mpm/dashboard/static/built/components/file-tool-tracker.js +1 -1
  35. claude_mpm/dashboard/static/built/components/module-viewer.js +1 -1
  36. claude_mpm/dashboard/static/built/components/session-manager.js +1 -1
  37. claude_mpm/dashboard/static/built/components/working-directory.js +1 -1
  38. claude_mpm/dashboard/static/built/dashboard.js +1 -1
  39. claude_mpm/dashboard/static/built/socket-client.js +1 -1
  40. claude_mpm/dashboard/static/css/activity.css +549 -0
  41. claude_mpm/dashboard/static/css/code-tree.css +846 -0
  42. claude_mpm/dashboard/static/css/dashboard.css +245 -0
  43. claude_mpm/dashboard/static/dist/components/activity-tree.js +2 -0
  44. claude_mpm/dashboard/static/dist/components/code-tree.js +2 -0
  45. claude_mpm/dashboard/static/dist/components/code-viewer.js +2 -0
  46. claude_mpm/dashboard/static/dist/components/event-viewer.js +1 -1
  47. claude_mpm/dashboard/static/dist/components/session-manager.js +1 -1
  48. claude_mpm/dashboard/static/dist/components/working-directory.js +1 -1
  49. claude_mpm/dashboard/static/dist/dashboard.js +1 -1
  50. claude_mpm/dashboard/static/dist/socket-client.js +1 -1
  51. claude_mpm/dashboard/static/js/components/activity-tree.js +1139 -0
  52. claude_mpm/dashboard/static/js/components/code-tree.js +1357 -0
  53. claude_mpm/dashboard/static/js/components/code-viewer.js +480 -0
  54. claude_mpm/dashboard/static/js/components/event-viewer.js +11 -0
  55. claude_mpm/dashboard/static/js/components/session-manager.js +40 -4
  56. claude_mpm/dashboard/static/js/components/socket-manager.js +12 -0
  57. claude_mpm/dashboard/static/js/components/ui-state-manager.js +4 -0
  58. claude_mpm/dashboard/static/js/components/working-directory.js +17 -1
  59. claude_mpm/dashboard/static/js/dashboard.js +39 -0
  60. claude_mpm/dashboard/static/js/socket-client.js +414 -20
  61. claude_mpm/dashboard/templates/index.html +184 -4
  62. claude_mpm/hooks/claude_hooks/hook_handler.py +182 -5
  63. claude_mpm/hooks/claude_hooks/installer.py +386 -113
  64. claude_mpm/scripts/claude-hook-handler.sh +161 -0
  65. claude_mpm/scripts/socketio_daemon.py +121 -8
  66. claude_mpm/services/agents/deployment/agent_lifecycle_manager_refactored.py +2 -2
  67. claude_mpm/services/agents/deployment/agent_record_service.py +1 -2
  68. claude_mpm/services/agents/memory/memory_format_service.py +1 -5
  69. claude_mpm/services/cli/agent_cleanup_service.py +1 -2
  70. claude_mpm/services/cli/agent_dependency_service.py +1 -1
  71. claude_mpm/services/cli/agent_validation_service.py +3 -4
  72. claude_mpm/services/cli/dashboard_launcher.py +2 -3
  73. claude_mpm/services/cli/startup_checker.py +0 -10
  74. claude_mpm/services/core/cache_manager.py +1 -2
  75. claude_mpm/services/core/path_resolver.py +1 -4
  76. claude_mpm/services/core/service_container.py +2 -2
  77. claude_mpm/services/diagnostics/checks/instructions_check.py +1 -2
  78. claude_mpm/services/infrastructure/monitoring/__init__.py +11 -11
  79. claude_mpm/services/infrastructure/monitoring.py +11 -11
  80. claude_mpm/services/project/architecture_analyzer.py +1 -1
  81. claude_mpm/services/project/dependency_analyzer.py +4 -4
  82. claude_mpm/services/project/language_analyzer.py +3 -3
  83. claude_mpm/services/project/metrics_collector.py +3 -6
  84. claude_mpm/services/socketio/handlers/__init__.py +2 -0
  85. claude_mpm/services/socketio/handlers/code_analysis.py +170 -0
  86. claude_mpm/services/socketio/handlers/registry.py +2 -0
  87. claude_mpm/services/socketio/server/connection_manager.py +4 -4
  88. claude_mpm/services/socketio/server/core.py +100 -11
  89. claude_mpm/services/socketio/server/main.py +8 -2
  90. claude_mpm/services/visualization/__init__.py +19 -0
  91. claude_mpm/services/visualization/mermaid_generator.py +938 -0
  92. claude_mpm/tools/__main__.py +208 -0
  93. claude_mpm/tools/code_tree_analyzer.py +778 -0
  94. claude_mpm/tools/code_tree_builder.py +632 -0
  95. claude_mpm/tools/code_tree_events.py +318 -0
  96. claude_mpm/tools/socketio_debug.py +671 -0
  97. {claude_mpm-4.1.8.dist-info → claude_mpm-4.1.10.dist-info}/METADATA +1 -1
  98. {claude_mpm-4.1.8.dist-info → claude_mpm-4.1.10.dist-info}/RECORD +102 -73
  99. claude_mpm/agents/schema/agent_schema.json +0 -314
  100. {claude_mpm-4.1.8.dist-info → claude_mpm-4.1.10.dist-info}/WHEEL +0 -0
  101. {claude_mpm-4.1.8.dist-info → claude_mpm-4.1.10.dist-info}/entry_points.txt +0 -0
  102. {claude_mpm-4.1.8.dist-info → claude_mpm-4.1.10.dist-info}/licenses/LICENSE +0 -0
  103. {claude_mpm-4.1.8.dist-info → claude_mpm-4.1.10.dist-info}/top_level.txt +0 -0
@@ -1,20 +1,23 @@
1
1
  {
2
2
  "schema_version": "1.2.0",
3
3
  "agent_id": "code-analyzer",
4
- "agent_version": "2.5.0",
4
+ "agent_version": "2.6.0",
5
5
  "agent_type": "research",
6
6
  "metadata": {
7
7
  "name": "Code Analysis Agent",
8
- "description": "Multi-language code analysis using Python AST and tree-sitter packages",
8
+ "description": "Multi-language code analysis with AST parsing and Mermaid diagram visualization",
9
9
  "created_at": "2025-08-12T00:00:00.000000Z",
10
- "updated_at": "2025-08-25T00:00:00.000000Z",
10
+ "updated_at": "2025-08-26T00:00:00.000000Z",
11
11
  "tags": [
12
12
  "code-analysis",
13
13
  "ast-analysis",
14
14
  "tree-sitter",
15
15
  "multi-language",
16
16
  "code-quality",
17
- "pattern-detection"
17
+ "pattern-detection",
18
+ "mermaid",
19
+ "visualization",
20
+ "architecture-diagrams"
18
21
  ],
19
22
  "category": "research"
20
23
  },
@@ -26,6 +29,7 @@
26
29
  "Glob",
27
30
  "LS",
28
31
  "Bash",
32
+ "Write",
29
33
  "TodoWrite",
30
34
  "WebSearch",
31
35
  "WebFetch"
@@ -46,7 +50,9 @@
46
50
  "Design pattern recognition",
47
51
  "Performance bottleneck identification",
48
52
  "Security vulnerability detection",
49
- "Refactoring opportunity identification"
53
+ "Refactoring opportunity identification",
54
+ "Mermaid diagram generation for code visualization",
55
+ "Visual representation of code structure and relationships"
50
56
  ],
51
57
  "best_practices": [
52
58
  "Use Python's native AST for Python files",
@@ -56,14 +62,18 @@
56
62
  "Identify dead code and unused dependencies",
57
63
  "Check for SOLID principle violations",
58
64
  "Detect security vulnerabilities (OWASP Top 10)",
59
- "Measure code duplication"
65
+ "Measure code duplication",
66
+ "Generate Mermaid diagrams for visual documentation",
67
+ "Create interactive visualizations for complex relationships"
60
68
  ],
61
69
  "constraints": [
62
70
  "Focus on static analysis without execution",
63
71
  "Provide actionable, specific recommendations",
64
72
  "Include code examples for improvements",
65
73
  "Prioritize findings by impact and effort",
66
- "Consider language-specific idioms"
74
+ "Consider language-specific idioms",
75
+ "Generate diagrams only when requested or highly beneficial",
76
+ "Keep diagram complexity manageable for readability"
67
77
  ]
68
78
  },
69
79
  "dependencies": {
@@ -81,5 +91,5 @@
81
91
  ],
82
92
  "optional": false
83
93
  },
84
- "instructions": "# Code Analysis Agent\n\n**Inherits from**: BASE_AGENT_TEMPLATE.md\n**Focus**: Multi-language code analysis with memory protection\n\n## Core Expertise\n\nAnalyze code quality, detect patterns, and identify improvements using AST analysis.\n\n## Analysis Approach\n\n### Language Detection & Tool Selection\n1. **Python files (.py)**: Always use native `ast` module\n2. **Other languages**: Use appropriate tree-sitter packages\n3. **Unsupported files**: Fallback to text/grep analysis\n\n### Memory-Protected Processing\n1. **Check file size** before reading (max 500KB for AST parsing)\n2. **Process sequentially** - one file at a time\n3. **Extract patterns immediately** and discard AST\n4. **Use grep for targeted searches** instead of full parsing\n5. **Batch process** maximum 3-5 files before summarization\n\n## Analysis Patterns\n\n### Code Quality Issues\n- **Complexity**: Functions >50 lines, cyclomatic complexity >10\n- **God Objects**: Classes >500 lines, too many responsibilities\n- **Duplication**: Similar code blocks appearing 3+ times\n- **Dead Code**: Unused functions, variables, imports\n\n### Security Vulnerabilities\n- Hardcoded secrets and API keys\n- SQL injection risks\n- Command injection vulnerabilities\n- Unsafe deserialization\n- Path traversal risks\n\n### Performance Bottlenecks\n- Nested loops with O(n²) complexity\n- Synchronous I/O in async contexts\n- String concatenation in loops\n- Unclosed resources and memory leaks\n\n## Implementation Patterns\n\nFor detailed implementation examples and code patterns, refer to:\n- `/scripts/code_analysis_patterns.py` for AST analysis implementations\n- Use `Bash` tool to create analysis scripts on-the-fly\n- Dynamic installation of tree-sitter packages as needed\n\n## Key Thresholds\n- **Complexity**: >10 high, >20 critical\n- **Function Length**: >50 lines long, >100 critical\n- **Class Size**: >300 lines needs refactoring, >500 critical\n- **Import Count**: >20 high coupling, >40 critical\n- **Duplication**: >5% needs attention, >10% critical\n\n## Output Format\n\n```markdown\n# Code Analysis Report\n\n## Summary\n- Languages analyzed: [List]\n- Files analyzed: X\n- Critical issues: X\n- Overall health: [A-F grade]\n\n## Critical Issues\n1. [Issue]: file:line\n - Impact: [Description]\n - Fix: [Specific remediation]\n\n## Metrics\n- Avg Complexity: X.X\n- Code Duplication: X%\n- Security Issues: X\n```"
94
+ "instructions": "# Code Analysis Agent\n\n**Inherits from**: BASE_AGENT_TEMPLATE.md\n**Focus**: Multi-language code analysis with visualization capabilities\n\n## Core Expertise\n\nAnalyze code quality, detect patterns, identify improvements using AST analysis, and generate visual diagrams.\n\n## Analysis Approach\n\n### Language Detection & Tool Selection\n1. **Python files (.py)**: Always use native `ast` module\n2. **Other languages**: Use appropriate tree-sitter packages\n3. **Unsupported files**: Fallback to text/grep analysis\n\n### Memory-Protected Processing\n1. **Check file size** before reading (max 500KB for AST parsing)\n2. **Process sequentially** - one file at a time\n3. **Extract patterns immediately** and discard AST\n4. **Use grep for targeted searches** instead of full parsing\n5. **Batch process** maximum 3-5 files before summarization\n\n## Visualization Capabilities\n\n### Mermaid Diagram Generation\nGenerate interactive diagrams when users request:\n- **\"visualization\"**, **\"diagram\"**, **\"show relationships\"**\n- **\"architecture overview\"**, **\"dependency graph\"**\n- **\"class structure\"**, **\"call flow\"**\n\n### Available Diagram Types\n1. **entry_points**: Application entry points and initialization flow\n2. **module_deps**: Module dependency relationships\n3. **class_hierarchy**: Class inheritance and relationships\n4. **call_graph**: Function call flow analysis\n\n### Using MermaidGeneratorService\n```python\nfrom claude_mpm.services.visualization import (\n DiagramConfig,\n DiagramType,\n MermaidGeneratorService\n)\n\n# Initialize service\nservice = MermaidGeneratorService()\nservice.initialize()\n\n# Configure diagram\nconfig = DiagramConfig(\n title=\"Module Dependencies\",\n direction=\"TB\", # Top-Bottom\n show_parameters=True,\n include_external=False\n)\n\n# Generate diagram from analysis results\ndiagram = service.generate_diagram(\n DiagramType.MODULE_DEPS,\n analysis_results, # Your analysis data\n config\n)\n\n# Save diagram to file\nwith open('architecture.mmd', 'w') as f:\n f.write(diagram)\n```\n\n## Analysis Patterns\n\n### Code Quality Issues\n- **Complexity**: Functions >50 lines, cyclomatic complexity >10\n- **God Objects**: Classes >500 lines, too many responsibilities\n- **Duplication**: Similar code blocks appearing 3+ times\n- **Dead Code**: Unused functions, variables, imports\n\n### Security Vulnerabilities\n- Hardcoded secrets and API keys\n- SQL injection risks\n- Command injection vulnerabilities\n- Unsafe deserialization\n- Path traversal risks\n\n### Performance Bottlenecks\n- Nested loops with O(n²) complexity\n- Synchronous I/O in async contexts\n- String concatenation in loops\n- Unclosed resources and memory leaks\n\n## Implementation Patterns\n\nFor detailed implementation examples and code patterns:\n- `/scripts/code_analysis_patterns.py` for AST analysis\n- `/scripts/example_mermaid_generator.py` for diagram generation\n- Use `Bash` tool to create analysis scripts on-the-fly\n- Dynamic installation of tree-sitter packages as needed\n\n## Key Thresholds\n- **Complexity**: >10 high, >20 critical\n- **Function Length**: >50 lines long, >100 critical\n- **Class Size**: >300 lines needs refactoring, >500 critical\n- **Import Count**: >20 high coupling, >40 critical\n- **Duplication**: >5% needs attention, >10% critical\n\n## Output Format\n\n### Standard Analysis Report\n```markdown\n# Code Analysis Report\n\n## Summary\n- Languages analyzed: [List]\n- Files analyzed: X\n- Critical issues: X\n- Overall health: [A-F grade]\n\n## Critical Issues\n1. [Issue]: file:line\n - Impact: [Description]\n - Fix: [Specific remediation]\n\n## Metrics\n- Avg Complexity: X.X\n- Code Duplication: X%\n- Security Issues: X\n```\n\n### With Visualization\n```markdown\n# Code Analysis Report with Visualizations\n\n## Architecture Overview\n```mermaid\nflowchart TB\n A[Main Entry] --> B[Core Module]\n B --> C[Service Layer]\n C --> D[Database]\n```\n\n## Module Dependencies\n```mermaid\nflowchart LR\n ModuleA --> ModuleB\n ModuleA --> ModuleC\n ModuleB --> CommonUtils\n```\n\n[Analysis continues...]\n```\n\n## When to Generate Diagrams\n\n### Automatically Generate When:\n- User explicitly asks for visualization/diagram\n- Analyzing complex module structures (>10 modules)\n- Identifying circular dependencies\n- Documenting class hierarchies (>5 classes)\n\n### Include in Report When:\n- Diagram adds clarity to findings\n- Visual representation simplifies understanding\n- Architecture overview is requested\n- Relationship complexity warrants visualization"
85
95
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "Engineer Agent",
3
3
  "description": "Clean architecture specialist with code reduction focus and dependency injection",
4
- "schema_version": "1.2.0",
4
+ "schema_version": "1.3.0",
5
5
  "agent_id": "engineer",
6
6
  "agent_version": "3.8.0",
7
7
  "template_version": "2.2.0",
@@ -0,0 +1,39 @@
1
+ ---
2
+ timestamp: 2025-08-26T01:42:58.729008
3
+ type: agent_engineer
4
+ metadata: {"agent_type": "engineer", "agent_id": "engineer_b34a6307-9304-4961-b5a8-0d659444aa07", "session_id": "b34a6307-9304-4961-b5a8-0d659444aa07", "delegation_context": {"description": "Fix agent-manager template", "timestamp": "2025-08-26T01:42:58.728080"}}
5
+ ---
6
+
7
+
8
+ AGENT MEMORY - PROJECT-SPECIFIC KNOWLEDGE:
9
+ # Agent Memory: engineer
10
+ <!-- Last Updated: 2025-08-26T01:42:58.720337Z -->
11
+
12
+
13
+
14
+ INSTRUCTIONS: Review your memory above before proceeding. Apply learned patterns and avoid known mistakes.
15
+
16
+
17
+ Fix the agent-manager template with proper schema and metadata based on the research findings.
18
+
19
+ The research identified these critical missing components:
20
+ 1. Schema version fields (schema_version, agent_version, template_version, template_changelog)
21
+ 2. Expanded metadata (created_at, updated_at, color)
22
+ 3. Complete capabilities configuration (resource_tier, temperature, max_tokens, timeout, limits, tools array)
23
+ 4. Embedded instructions instead of just reference
24
+ 5. Knowledge configuration (domain_expertise, best_practices, constraints, examples)
25
+ 6. Dependencies specification (python, system packages)
26
+ 7. Memory routing configuration for the memory system
27
+ 8. Interactions protocol (input/output format, handoff_agents, triggers)
28
+ 9. Testing configuration with test cases and benchmarks
29
+
30
+ Please:
31
+ 1. Read the current agent-manager template at src/claude_mpm/agents/templates/agent_manager_agent.json
32
+ 2. Read the agent-manager instructions from src/claude_mpm/agents/templates/agent_manager_agent.md
33
+ 3. Look at well-structured templates like engineer_agent.json and research_agent.json as references
34
+ 4. Update the agent-manager template with ALL missing components identified
35
+ 5. Ensure the template follows the same comprehensive structure as other production agents
36
+ 6. Make sure the capabilities match what an agent-manager would need (managing other agents, PM configuration, etc.)
37
+ 7. Include appropriate memory routing rules for storing agent management knowledge
38
+
39
+ The agent-manager is a critical system agent that manages agent creation, customization, deployment, and PM instruction configuration, so it needs a complete and robust template structure.
@@ -1,5 +1,5 @@
1
1
  {
2
- "schema_version": "1.2.0",
2
+ "schema_version": "1.3.0",
3
3
  "agent_id": "qa-agent",
4
4
  "agent_version": "3.5.0",
5
5
  "template_version": "2.1.0",
@@ -1,5 +1,5 @@
1
1
  {
2
- "schema_version": "1.2.0",
2
+ "schema_version": "1.3.0",
3
3
  "agent_id": "research-agent",
4
4
  "agent_version": "4.4.0",
5
5
  "template_version": "2.3.0",
@@ -25,6 +25,7 @@ from .commands import ( # run_guarded_session is imported lazily to avoid loadi
25
25
  manage_agents,
26
26
  manage_config,
27
27
  manage_configure,
28
+ manage_debug,
28
29
  manage_mcp,
29
30
  manage_memory,
30
31
  manage_monitor,
@@ -33,6 +34,7 @@ from .commands import ( # run_guarded_session is imported lazily to avoid loadi
33
34
  run_session,
34
35
  show_info,
35
36
  )
37
+ from .commands.analyze_code import manage_analyze_code
36
38
  from .parser import create_parser, preprocess_args
37
39
  from .utils import ensure_directories, setup_logging
38
40
 
@@ -401,9 +403,11 @@ def _execute_command(command: str, args) -> int:
401
403
  CLICommands.CONFIG.value: manage_config,
402
404
  CLICommands.CONFIGURE.value: manage_configure,
403
405
  CLICommands.AGGREGATE.value: aggregate_command,
406
+ CLICommands.ANALYZE_CODE.value: manage_analyze_code,
404
407
  CLICommands.CLEANUP.value: cleanup_memory,
405
408
  CLICommands.MCP.value: manage_mcp,
406
409
  CLICommands.DOCTOR.value: run_doctor,
410
+ "debug": manage_debug, # Add debug command
407
411
  }
408
412
 
409
413
  # Execute command if found
@@ -8,9 +8,12 @@ separate modules for better maintainability and code organization.
8
8
  from .agent_manager import manage_agent_manager
9
9
  from .agents import manage_agents
10
10
  from .aggregate import aggregate_command
11
+ from .analyze import analyze_command
12
+ from .analyze_code import AnalyzeCodeCommand
11
13
  from .cleanup import cleanup_memory
12
14
  from .config import manage_config
13
15
  from .configure import manage_configure
16
+ from .debug import manage_debug
14
17
  from .doctor import run_doctor
15
18
  from .info import show_info
16
19
  from .mcp import manage_mcp
@@ -20,13 +23,16 @@ from .run import run_session
20
23
  from .tickets import list_tickets, manage_tickets
21
24
 
22
25
  __all__ = [
26
+ "AnalyzeCodeCommand",
23
27
  "aggregate_command",
28
+ "analyze_command",
24
29
  "cleanup_memory",
25
30
  "list_tickets",
26
31
  "manage_agent_manager",
27
32
  "manage_agents",
28
33
  "manage_config",
29
34
  "manage_configure",
35
+ "manage_debug",
30
36
  "manage_mcp",
31
37
  "manage_memory",
32
38
  "manage_monitor",