claude-mpm 4.1.7__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 (109) hide show
  1. claude_mpm/VERSION +1 -1
  2. claude_mpm/agents/INSTRUCTIONS.md +26 -1
  3. claude_mpm/agents/OUTPUT_STYLE.md +73 -0
  4. claude_mpm/agents/agents_metadata.py +57 -0
  5. claude_mpm/agents/templates/.claude-mpm/memories/README.md +17 -0
  6. claude_mpm/agents/templates/.claude-mpm/memories/engineer_memories.md +3 -0
  7. claude_mpm/agents/templates/agent-manager.json +263 -17
  8. claude_mpm/agents/templates/agent-manager.md +248 -10
  9. claude_mpm/agents/templates/agentic_coder_optimizer.json +222 -0
  10. claude_mpm/agents/templates/code_analyzer.json +18 -8
  11. claude_mpm/agents/templates/engineer.json +1 -1
  12. claude_mpm/agents/templates/logs/prompts/agent_engineer_20250826_014258_728.md +39 -0
  13. claude_mpm/agents/templates/qa.json +1 -1
  14. claude_mpm/agents/templates/research.json +1 -1
  15. claude_mpm/cli/__init__.py +4 -0
  16. claude_mpm/cli/commands/__init__.py +6 -0
  17. claude_mpm/cli/commands/analyze.py +547 -0
  18. claude_mpm/cli/commands/analyze_code.py +524 -0
  19. claude_mpm/cli/commands/configure.py +223 -25
  20. claude_mpm/cli/commands/configure_tui.py +65 -61
  21. claude_mpm/cli/commands/debug.py +1387 -0
  22. claude_mpm/cli/parsers/analyze_code_parser.py +170 -0
  23. claude_mpm/cli/parsers/analyze_parser.py +135 -0
  24. claude_mpm/cli/parsers/base_parser.py +29 -0
  25. claude_mpm/cli/parsers/configure_parser.py +23 -0
  26. claude_mpm/cli/parsers/debug_parser.py +319 -0
  27. claude_mpm/config/socketio_config.py +21 -21
  28. claude_mpm/constants.py +3 -1
  29. claude_mpm/core/framework_loader.py +148 -6
  30. claude_mpm/core/log_manager.py +16 -13
  31. claude_mpm/core/logger.py +1 -1
  32. claude_mpm/core/unified_agent_registry.py +1 -1
  33. claude_mpm/dashboard/.claude-mpm/socketio-instances.json +1 -0
  34. claude_mpm/dashboard/analysis_runner.py +428 -0
  35. claude_mpm/dashboard/static/built/components/activity-tree.js +2 -0
  36. claude_mpm/dashboard/static/built/components/agent-inference.js +1 -1
  37. claude_mpm/dashboard/static/built/components/event-viewer.js +1 -1
  38. claude_mpm/dashboard/static/built/components/file-tool-tracker.js +1 -1
  39. claude_mpm/dashboard/static/built/components/module-viewer.js +1 -1
  40. claude_mpm/dashboard/static/built/components/session-manager.js +1 -1
  41. claude_mpm/dashboard/static/built/components/working-directory.js +1 -1
  42. claude_mpm/dashboard/static/built/dashboard.js +1 -1
  43. claude_mpm/dashboard/static/built/socket-client.js +1 -1
  44. claude_mpm/dashboard/static/css/activity.css +549 -0
  45. claude_mpm/dashboard/static/css/code-tree.css +846 -0
  46. claude_mpm/dashboard/static/css/dashboard.css +245 -0
  47. claude_mpm/dashboard/static/dist/components/activity-tree.js +2 -0
  48. claude_mpm/dashboard/static/dist/components/code-tree.js +2 -0
  49. claude_mpm/dashboard/static/dist/components/code-viewer.js +2 -0
  50. claude_mpm/dashboard/static/dist/components/event-viewer.js +1 -1
  51. claude_mpm/dashboard/static/dist/components/session-manager.js +1 -1
  52. claude_mpm/dashboard/static/dist/components/working-directory.js +1 -1
  53. claude_mpm/dashboard/static/dist/dashboard.js +1 -1
  54. claude_mpm/dashboard/static/dist/socket-client.js +1 -1
  55. claude_mpm/dashboard/static/js/components/activity-tree.js +1139 -0
  56. claude_mpm/dashboard/static/js/components/code-tree.js +1357 -0
  57. claude_mpm/dashboard/static/js/components/code-viewer.js +480 -0
  58. claude_mpm/dashboard/static/js/components/event-viewer.js +11 -0
  59. claude_mpm/dashboard/static/js/components/session-manager.js +40 -4
  60. claude_mpm/dashboard/static/js/components/socket-manager.js +12 -0
  61. claude_mpm/dashboard/static/js/components/ui-state-manager.js +4 -0
  62. claude_mpm/dashboard/static/js/components/working-directory.js +17 -1
  63. claude_mpm/dashboard/static/js/dashboard.js +39 -0
  64. claude_mpm/dashboard/static/js/socket-client.js +414 -20
  65. claude_mpm/dashboard/templates/index.html +184 -4
  66. claude_mpm/hooks/claude_hooks/hook_handler.py +182 -5
  67. claude_mpm/hooks/claude_hooks/installer.py +728 -0
  68. claude_mpm/scripts/claude-hook-handler.sh +161 -0
  69. claude_mpm/scripts/socketio_daemon.py +121 -8
  70. claude_mpm/services/agents/deployment/agent_config_provider.py +127 -27
  71. claude_mpm/services/agents/deployment/agent_lifecycle_manager_refactored.py +2 -2
  72. claude_mpm/services/agents/deployment/agent_record_service.py +1 -2
  73. claude_mpm/services/agents/memory/memory_format_service.py +1 -5
  74. claude_mpm/services/cli/agent_cleanup_service.py +1 -2
  75. claude_mpm/services/cli/agent_dependency_service.py +1 -1
  76. claude_mpm/services/cli/agent_validation_service.py +3 -4
  77. claude_mpm/services/cli/dashboard_launcher.py +2 -3
  78. claude_mpm/services/cli/startup_checker.py +0 -10
  79. claude_mpm/services/core/cache_manager.py +1 -2
  80. claude_mpm/services/core/path_resolver.py +1 -4
  81. claude_mpm/services/core/service_container.py +2 -2
  82. claude_mpm/services/diagnostics/checks/instructions_check.py +2 -5
  83. claude_mpm/services/event_bus/direct_relay.py +98 -20
  84. claude_mpm/services/infrastructure/monitoring/__init__.py +11 -11
  85. claude_mpm/services/infrastructure/monitoring.py +11 -11
  86. claude_mpm/services/project/architecture_analyzer.py +1 -1
  87. claude_mpm/services/project/dependency_analyzer.py +4 -4
  88. claude_mpm/services/project/language_analyzer.py +3 -3
  89. claude_mpm/services/project/metrics_collector.py +3 -6
  90. claude_mpm/services/socketio/handlers/__init__.py +2 -0
  91. claude_mpm/services/socketio/handlers/code_analysis.py +170 -0
  92. claude_mpm/services/socketio/handlers/registry.py +2 -0
  93. claude_mpm/services/socketio/server/connection_manager.py +95 -65
  94. claude_mpm/services/socketio/server/core.py +125 -17
  95. claude_mpm/services/socketio/server/main.py +44 -5
  96. claude_mpm/services/visualization/__init__.py +19 -0
  97. claude_mpm/services/visualization/mermaid_generator.py +938 -0
  98. claude_mpm/tools/__main__.py +208 -0
  99. claude_mpm/tools/code_tree_analyzer.py +778 -0
  100. claude_mpm/tools/code_tree_builder.py +632 -0
  101. claude_mpm/tools/code_tree_events.py +318 -0
  102. claude_mpm/tools/socketio_debug.py +671 -0
  103. {claude_mpm-4.1.7.dist-info → claude_mpm-4.1.10.dist-info}/METADATA +1 -1
  104. {claude_mpm-4.1.7.dist-info → claude_mpm-4.1.10.dist-info}/RECORD +108 -77
  105. claude_mpm/agents/schema/agent_schema.json +0 -314
  106. {claude_mpm-4.1.7.dist-info → claude_mpm-4.1.10.dist-info}/WHEEL +0 -0
  107. {claude_mpm-4.1.7.dist-info → claude_mpm-4.1.10.dist-info}/entry_points.txt +0 -0
  108. {claude_mpm-4.1.7.dist-info → claude_mpm-4.1.10.dist-info}/licenses/LICENSE +0 -0
  109. {claude_mpm-4.1.7.dist-info → claude_mpm-4.1.10.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,161 @@
1
+ #!/bin/bash
2
+ #
3
+ # Claude MPM Hook Handler Entry Point Script
4
+ #
5
+ # OVERVIEW:
6
+ # This script serves as the bridge between Claude Code hook system and the Python-based
7
+ # Claude MPM hook handler. It is executed directly by Claude Code when events occur
8
+ # and ensures proper environment setup before delegating to the Python handler.
9
+ #
10
+ # ARCHITECTURE:
11
+ # Claude Code → This Script → Python Environment → hook_handler.py → Socket.IO/EventBus
12
+ #
13
+ # KEY RESPONSIBILITIES:
14
+ # - Virtual environment detection and activation
15
+ # - Python executable resolution with fallbacks
16
+ # - Error handling and logging for troubleshooting
17
+ # - Path resolution for cross-platform compatibility
18
+ # - Environment variable propagation
19
+ #
20
+ # DEPLOYMENT:
21
+ # This script is deployed to Claude Code's hooks directory during installation.
22
+ # Location: ~/.claude/hooks/claude-mpm/claude-hook-handler.sh
23
+ # Permissions: Must be executable (chmod +x)
24
+ #
25
+ # ENVIRONMENT VARIABLES:
26
+ # - CLAUDE_MPM_HOOK_DEBUG: Enable debug logging to /tmp/claude-mpm-hook.log
27
+ # - CLAUDE_MPM_ROOT: Override project root detection
28
+ # - VIRTUAL_ENV: Standard virtual environment variable
29
+ # - PYTHONPATH: Extended with src/ directory for imports
30
+ #
31
+ # PERFORMANCE CONSIDERATIONS:
32
+ # - Minimal shell operations to reduce latency (~10ms overhead)
33
+ # - Cached virtual environment detection
34
+ # - Early exit on errors to prevent hanging
35
+ # - Lightweight logging for debugging without performance impact
36
+ #
37
+ # SECURITY:
38
+ # - Restricts Python execution to project virtual environments
39
+ # - Validates paths before execution
40
+ # - No external network access or privileged operations
41
+ # - Logs to temporary files only (no persistent sensitive data)
42
+ #
43
+ # TROUBLESHOOTING:
44
+ # Enable debug logging: export CLAUDE_MPM_HOOK_DEBUG=true
45
+ # Check permissions: ls -la ~/.claude/hooks/claude-mpm/claude-hook-handler.sh
46
+ # Test manually: echo '{"test": "data"}' | ./claude-hook-handler.sh
47
+ #
48
+ # GOTCHAS:
49
+ # - Must activate virtual environment in same shell process
50
+ # - Path resolution differs between development and installed environments
51
+ # - Claude Code passes event data via stdin (not command line arguments)
52
+ # - Exit codes must be 0 for success, non-zero indicates failure to Claude Code
53
+ #
54
+ # @author Claude MPM Development Team
55
+ # @version 1.0
56
+ # @since v4.0.25
57
+
58
+ # Exit on any error
59
+ set -e
60
+
61
+ # Get the directory where this script is located
62
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
63
+
64
+ # Determine the claude-mpm root
65
+ # The script is at src/claude_mpm/scripts/, so we go up 3 levels
66
+ CLAUDE_MPM_ROOT="$(cd "$SCRIPT_DIR/../../.." && pwd)"
67
+
68
+ # Debug logging (can be enabled via environment variable)
69
+ if [ "${CLAUDE_MPM_HOOK_DEBUG}" = "true" ]; then
70
+ echo "[$(date -u +%Y-%m-%dT%H:%M:%S.%3NZ)] Claude hook handler starting..." >> /tmp/claude-mpm-hook.log
71
+ echo "[$(date -u +%Y-%m-%dT%H:%M:%S.%3NZ)] Script dir: $SCRIPT_DIR" >> /tmp/claude-mpm-hook.log
72
+ echo "[$(date -u +%Y-%m-%dT%H:%M:%S.%3NZ)] Claude MPM root: $CLAUDE_MPM_ROOT" >> /tmp/claude-mpm-hook.log
73
+ fi
74
+
75
+ #
76
+ # Find and return the appropriate Python executable for hook processing.
77
+ #
78
+ # STRATEGY:
79
+ # This function implements a fallback chain to find Python with claude-mpm dependencies:
80
+ # 1. Project-specific virtual environments (venv, .venv)
81
+ # 2. Currently active virtual environment ($VIRTUAL_ENV)
82
+ # 3. System python3 (may lack dependencies)
83
+ # 4. System python (last resort)
84
+ #
85
+ # WHY THIS APPROACH:
86
+ # - Claude MPM requires specific packages (socketio, eventlet) not in system Python
87
+ # - Virtual environments ensure dependency isolation and availability
88
+ # - Multiple naming conventions supported (venv vs .venv)
89
+ # - Graceful degradation to system Python if no venv found
90
+ #
91
+ # ACTIVATION STRATEGY:
92
+ # - Sources activate script to set up environment variables
93
+ # - Returns specific Python path for exec (not just 'python')
94
+ # - Maintains environment in same shell process
95
+ #
96
+ # PERFORMANCE:
97
+ # - Fast path detection using file existence checks
98
+ # - Early returns to minimize overhead
99
+ # - Caches result in process environment
100
+ #
101
+ # RETURNS:
102
+ # Absolute path to Python executable with claude-mpm dependencies
103
+ #
104
+ find_python_command() {
105
+ # 1. Check for project-local virtual environment (common in development)
106
+ if [ -f "$CLAUDE_MPM_ROOT/venv/bin/activate" ]; then
107
+ source "$CLAUDE_MPM_ROOT/venv/bin/activate"
108
+ echo "$CLAUDE_MPM_ROOT/venv/bin/python"
109
+ elif [ -f "$CLAUDE_MPM_ROOT/.venv/bin/activate" ]; then
110
+ source "$CLAUDE_MPM_ROOT/.venv/bin/activate"
111
+ echo "$CLAUDE_MPM_ROOT/.venv/bin/python"
112
+ elif [ -n "$VIRTUAL_ENV" ]; then
113
+ # Already in a virtual environment
114
+ echo "$VIRTUAL_ENV/bin/python"
115
+ elif command -v python3 &> /dev/null; then
116
+ echo "python3"
117
+ else
118
+ echo "python"
119
+ fi
120
+ }
121
+
122
+ # Set up Python command
123
+ PYTHON_CMD=$(find_python_command)
124
+
125
+ # Check if we're in a development environment (has src directory)
126
+ if [ -d "$CLAUDE_MPM_ROOT/src" ]; then
127
+ # Development install - add src to PYTHONPATH
128
+ export PYTHONPATH="$CLAUDE_MPM_ROOT/src:$PYTHONPATH"
129
+
130
+ if [ "${CLAUDE_MPM_HOOK_DEBUG}" = "true" ]; then
131
+ echo "[$(date -u +%Y-%m-%dT%H:%M:%S.%3NZ)] Development environment detected" >> /tmp/claude-mpm-hook.log
132
+ fi
133
+ else
134
+ # Pip install - claude_mpm should be in site-packages
135
+ # No need to modify PYTHONPATH
136
+ if [ "${CLAUDE_MPM_HOOK_DEBUG}" = "true" ]; then
137
+ echo "[$(date -u +%Y-%m-%dT%H:%M:%S.%3NZ)] Pip installation detected" >> /tmp/claude-mpm-hook.log
138
+ fi
139
+ fi
140
+
141
+ # Debug logging
142
+ if [ "${CLAUDE_MPM_HOOK_DEBUG}" = "true" ]; then
143
+ echo "[$(date -u +%Y-%m-%dT%H:%M:%S.%3NZ)] PYTHON_CMD: $PYTHON_CMD" >> /tmp/claude-mpm-hook.log
144
+ echo "[$(date -u +%Y-%m-%dT%H:%M:%S.%3NZ)] PYTHONPATH: $PYTHONPATH" >> /tmp/claude-mpm-hook.log
145
+ fi
146
+
147
+ # Set Socket.IO configuration for hook events
148
+ export CLAUDE_MPM_SOCKETIO_PORT="${CLAUDE_MPM_SOCKETIO_PORT:-8765}"
149
+
150
+ # Run the Python hook handler with all input
151
+ # Use exec to replace the shell process with Python
152
+ if ! exec "$PYTHON_CMD" -m claude_mpm.hooks.claude_hooks.hook_handler "$@" 2>/tmp/claude-mpm-hook-error.log; then
153
+ # If the Python handler fails, always return continue to not block Claude
154
+ if [ "${CLAUDE_MPM_HOOK_DEBUG}" = "true" ]; then
155
+ echo "[$(date -u +%Y-%m-%dT%H:%M:%S.%3NZ)] Hook handler failed, see /tmp/claude-mpm-hook-error.log" >> /tmp/claude-mpm-hook.log
156
+ echo "[$(date -u +%Y-%m-%dT%H:%M:%S.%3NZ)] Error: $(cat /tmp/claude-mpm-hook-error.log 2>/dev/null | head -5)" >> /tmp/claude-mpm-hook.log
157
+ fi
158
+ # Return continue action to prevent blocking Claude Code
159
+ echo '{"action": "continue"}'
160
+ exit 0
161
+ fi
@@ -1,7 +1,45 @@
1
1
  #!/usr/bin/env python3
2
2
  """
3
- Pure Python daemon management for Socket.IO server.
4
- No external dependencies required.
3
+ Socket.IO Daemon Management for Claude MPM.
4
+
5
+ This module provides pure Python daemon management for the Claude MPM Socket.IO server
6
+ without requiring external process management dependencies. It handles server lifecycle,
7
+ process detection, and virtual environment discovery.
8
+
9
+ Key Features:
10
+ - Pure Python implementation (no external deps)
11
+ - Virtual environment auto-detection
12
+ - Process management with PID tracking
13
+ - Signal handling for clean shutdown
14
+ - Port availability checking
15
+ - Background daemon execution
16
+
17
+ Architecture:
18
+ - Uses subprocess for server execution
19
+ - Implements daemon pattern with double-fork
20
+ - Maintains PID files for process tracking
21
+ - Auto-detects Python environment (venv/conda)
22
+
23
+ Thread Safety:
24
+ - Signal handlers are async-signal-safe
25
+ - PID file operations use atomic writes
26
+ - Process checks use system-level primitives
27
+
28
+ Performance Considerations:
29
+ - Minimal memory footprint for daemon mode
30
+ - Fast process detection using PID files
31
+ - Lazy loading of heavy imports
32
+ - Efficient port scanning
33
+
34
+ Security:
35
+ - Localhost-only binding for server
36
+ - PID file permissions restrict access
37
+ - Process ownership validation
38
+ - Signal handling prevents orphans
39
+
40
+ @author Claude MPM Team
41
+ @version 1.0
42
+ @since v4.0.25
5
43
  """
6
44
 
7
45
  import os
@@ -13,13 +51,45 @@ from pathlib import Path
13
51
 
14
52
 
15
53
  # Detect and use virtual environment Python if available
16
- def get_python_executable():
54
+ def get_python_executable() -> str:
17
55
  """
18
- Get the appropriate Python executable, preferring virtual environment.
19
-
20
- WHY: The daemon must use the same Python environment as the parent process
21
- to ensure all dependencies are available. System Python won't have the
22
- required packages installed.
56
+ Detect and return the appropriate Python executable for Socket.IO daemon.
57
+
58
+ Intelligently detects virtual environments (venv, conda, poetry, pipenv)
59
+ and returns the correct Python path to ensure dependency availability.
60
+
61
+ Detection Strategy:
62
+ 1. Check if already running in virtual environment
63
+ 2. Look for VIRTUAL_ENV environment variable
64
+ 3. Analyze executable path structure
65
+ 4. Search for project-specific virtual environments
66
+ 5. Fall back to system Python
67
+
68
+ WHY this complex detection:
69
+ - Socket.IO server requires specific Python packages (socketio, eventlet)
70
+ - System Python rarely has these packages installed
71
+ - Virtual environments contain isolated dependencies
72
+ - Multiple venv tools have different conventions
73
+
74
+ Thread Safety:
75
+ - Read-only operations on sys and os modules
76
+ - File system checks are atomic
77
+ - No shared state modification
78
+
79
+ Performance:
80
+ - Early returns for common cases
81
+ - Minimal file system operations
82
+ - Cached in practice by Python import system
83
+
84
+ Returns:
85
+ str: Path to Python executable with required dependencies
86
+
87
+ Raises:
88
+ FileNotFoundError: If no suitable Python executable found
89
+
90
+ Examples:
91
+ >>> python_path = get_python_executable()
92
+ >>> # Returns: '/path/to/venv/bin/python' or '/usr/bin/python3'
23
93
  """
24
94
  # First, check if we're already in a virtual environment
25
95
  if hasattr(sys, "real_prefix") or (
@@ -274,6 +344,49 @@ def start_server():
274
344
  # Start server using synchronous method
275
345
  server.start_sync()
276
346
 
347
+ # Debug: Check if handlers are registered (write to file for daemon)
348
+ with open(LOG_FILE, "a") as f:
349
+ f.write(
350
+ f"\n[{time.strftime('%Y-%m-%d %H:%M:%S')}] Server started, checking handlers...\n"
351
+ )
352
+ if server.event_registry:
353
+ f.write(
354
+ f"[{time.strftime('%Y-%m-%d %H:%M:%S')}] Event registry exists with {len(server.event_registry.handlers)} handlers\n"
355
+ )
356
+ for handler in server.event_registry.handlers:
357
+ f.write(
358
+ f"[{time.strftime('%Y-%m-%d %H:%M:%S')}] - {handler.__class__.__name__}\n"
359
+ )
360
+ else:
361
+ f.write(
362
+ f"[{time.strftime('%Y-%m-%d %H:%M:%S')}] WARNING: No event registry found!\n"
363
+ )
364
+
365
+ # Check Socket.IO events
366
+ if server.core and server.core.sio:
367
+ handlers = getattr(server.core.sio, "handlers", {})
368
+ f.write(
369
+ f"[{time.strftime('%Y-%m-%d %H:%M:%S')}] Socket.IO has {len(handlers)} namespaces\n"
370
+ )
371
+ for namespace, events in handlers.items():
372
+ f.write(
373
+ f"[{time.strftime('%Y-%m-%d %H:%M:%S')}] Namespace '{namespace}': {len(events)} events\n"
374
+ )
375
+ # List all events to debug
376
+ event_list = list(events.keys())
377
+ f.write(
378
+ f"[{time.strftime('%Y-%m-%d %H:%M:%S')}] Events: {event_list}\n"
379
+ )
380
+ if "code:analyze:request" in events:
381
+ f.write(
382
+ f"[{time.strftime('%Y-%m-%d %H:%M:%S')}] ✅ code:analyze:request is registered!\n"
383
+ )
384
+ else:
385
+ f.write(
386
+ f"[{time.strftime('%Y-%m-%d %H:%M:%S')}] ❌ code:analyze:request NOT found\n"
387
+ )
388
+ f.flush()
389
+
277
390
  # Keep running
278
391
  try:
279
392
  while True:
@@ -90,8 +90,19 @@ class AgentConfigProvider:
90
90
  "engineer": {
91
91
  **base_config,
92
92
  "description": "Code implementation, development, and inline documentation",
93
- "tags": '["engineer", "development", "coding", "implementation"]',
94
- "tools": '["Read", "Write", "Edit", "MultiEdit", "Bash", "Grep", "Glob", "LS", "WebSearch", "TodoWrite"]',
93
+ "tags": ["engineer", "development", "coding", "implementation"],
94
+ "tools": [
95
+ "Read",
96
+ "Write",
97
+ "Edit",
98
+ "MultiEdit",
99
+ "Bash",
100
+ "Grep",
101
+ "Glob",
102
+ "LS",
103
+ "WebSearch",
104
+ "TodoWrite",
105
+ ],
95
106
  "temperature": 0.2,
96
107
  "when_to_use": [
97
108
  "Code implementation needed",
@@ -109,14 +120,28 @@ class AgentConfigProvider:
109
120
  "Refactor codebases",
110
121
  ],
111
122
  "primary_role": "Code implementation and development",
112
- "specializations": '["coding", "debugging", "refactoring", "optimization"]',
123
+ "specializations": [
124
+ "coding",
125
+ "debugging",
126
+ "refactoring",
127
+ "optimization",
128
+ ],
113
129
  "authority": "ALL code implementation decisions",
114
130
  },
115
131
  "qa": {
116
132
  **base_config,
117
133
  "description": "Quality assurance, testing, and validation",
118
- "tags": '["qa", "testing", "quality", "validation"]',
119
- "tools": '["Read", "Write", "Edit", "Bash", "Grep", "Glob", "LS", "TodoWrite"]',
134
+ "tags": ["qa", "testing", "quality", "validation"],
135
+ "tools": [
136
+ "Read",
137
+ "Write",
138
+ "Edit",
139
+ "Bash",
140
+ "Grep",
141
+ "Glob",
142
+ "LS",
143
+ "TodoWrite",
144
+ ],
120
145
  "temperature": 0.1,
121
146
  "when_to_use": [
122
147
  "Testing needed",
@@ -134,14 +159,29 @@ class AgentConfigProvider:
134
159
  "Validate quality",
135
160
  ],
136
161
  "primary_role": "Testing and quality assurance",
137
- "specializations": '["testing", "validation", "quality-assurance", "coverage"]',
162
+ "specializations": [
163
+ "testing",
164
+ "validation",
165
+ "quality-assurance",
166
+ "coverage",
167
+ ],
138
168
  "authority": "ALL testing and quality decisions",
139
169
  },
140
170
  "documentation": {
141
171
  **base_config,
142
172
  "description": "Documentation creation, maintenance, and changelog generation",
143
- "tags": '["documentation", "writing", "changelog", "docs"]',
144
- "tools": '["Read", "Write", "Edit", "MultiEdit", "Grep", "Glob", "LS", "WebSearch", "TodoWrite"]',
173
+ "tags": ["documentation", "writing", "changelog", "docs"],
174
+ "tools": [
175
+ "Read",
176
+ "Write",
177
+ "Edit",
178
+ "MultiEdit",
179
+ "Grep",
180
+ "Glob",
181
+ "LS",
182
+ "WebSearch",
183
+ "TodoWrite",
184
+ ],
145
185
  "temperature": 0.3,
146
186
  "when_to_use": [
147
187
  "Documentation updates needed",
@@ -159,14 +199,27 @@ class AgentConfigProvider:
159
199
  "Maintain docs",
160
200
  ],
161
201
  "primary_role": "Documentation and technical writing",
162
- "specializations": '["technical-writing", "changelog", "api-docs", "guides"]',
202
+ "specializations": [
203
+ "technical-writing",
204
+ "changelog",
205
+ "api-docs",
206
+ "guides",
207
+ ],
163
208
  "authority": "ALL documentation decisions",
164
209
  },
165
210
  "research": {
166
211
  **base_config,
167
212
  "description": "Technical research, analysis, and investigation",
168
- "tags": '["research", "analysis", "investigation", "evaluation"]',
169
- "tools": '["Read", "Grep", "Glob", "LS", "WebSearch", "WebFetch", "TodoWrite"]',
213
+ "tags": ["research", "analysis", "investigation", "evaluation"],
214
+ "tools": [
215
+ "Read",
216
+ "Grep",
217
+ "Glob",
218
+ "LS",
219
+ "WebSearch",
220
+ "WebFetch",
221
+ "TodoWrite",
222
+ ],
170
223
  "temperature": 0.4,
171
224
  "when_to_use": [
172
225
  "Technical research needed",
@@ -184,14 +237,27 @@ class AgentConfigProvider:
184
237
  "Evidence-based recommendations",
185
238
  ],
186
239
  "primary_role": "Research and technical analysis",
187
- "specializations": '["investigation", "analysis", "evaluation", "recommendations"]',
240
+ "specializations": [
241
+ "investigation",
242
+ "analysis",
243
+ "evaluation",
244
+ "recommendations",
245
+ ],
188
246
  "authority": "ALL research decisions",
189
247
  },
190
248
  "security": {
191
249
  **base_config,
192
250
  "description": "Security analysis, vulnerability assessment, and protection",
193
- "tags": '["security", "vulnerability", "protection", "audit"]',
194
- "tools": '["Read", "Grep", "Glob", "LS", "Bash", "WebSearch", "TodoWrite"]',
251
+ "tags": ["security", "vulnerability", "protection", "audit"],
252
+ "tools": [
253
+ "Read",
254
+ "Grep",
255
+ "Glob",
256
+ "LS",
257
+ "Bash",
258
+ "WebSearch",
259
+ "TodoWrite",
260
+ ],
195
261
  "temperature": 0.1,
196
262
  "when_to_use": [
197
263
  "Security review needed",
@@ -209,14 +275,28 @@ class AgentConfigProvider:
209
275
  "Threat modeling",
210
276
  ],
211
277
  "primary_role": "Security analysis and protection",
212
- "specializations": '["vulnerability-assessment", "security-audit", "threat-modeling", "protection"]',
278
+ "specializations": [
279
+ "vulnerability-assessment",
280
+ "security-audit",
281
+ "threat-modeling",
282
+ "protection",
283
+ ],
213
284
  "authority": "ALL security decisions",
214
285
  },
215
286
  "ops": {
216
287
  **base_config,
217
288
  "description": "Deployment, operations, and infrastructure management",
218
- "tags": '["ops", "deployment", "infrastructure", "devops"]',
219
- "tools": '["Read", "Write", "Edit", "Bash", "Grep", "Glob", "LS", "TodoWrite"]',
289
+ "tags": ["ops", "deployment", "infrastructure", "devops"],
290
+ "tools": [
291
+ "Read",
292
+ "Write",
293
+ "Edit",
294
+ "Bash",
295
+ "Grep",
296
+ "Glob",
297
+ "LS",
298
+ "TodoWrite",
299
+ ],
220
300
  "temperature": 0.2,
221
301
  "when_to_use": [
222
302
  "Deployment configuration",
@@ -234,14 +314,29 @@ class AgentConfigProvider:
234
314
  "Automate operations",
235
315
  ],
236
316
  "primary_role": "Operations and deployment management",
237
- "specializations": '["deployment", "infrastructure", "automation", "monitoring"]',
317
+ "specializations": [
318
+ "deployment",
319
+ "infrastructure",
320
+ "automation",
321
+ "monitoring",
322
+ ],
238
323
  "authority": "ALL operations decisions",
239
324
  },
240
325
  "data_engineer": {
241
326
  **base_config,
242
327
  "description": "Data pipeline management and AI API integrations",
243
- "tags": '["data", "pipeline", "etl", "ai-integration"]',
244
- "tools": '["Read", "Write", "Edit", "Bash", "Grep", "Glob", "LS", "WebSearch", "TodoWrite"]',
328
+ "tags": ["data", "pipeline", "etl", "ai-integration"],
329
+ "tools": [
330
+ "Read",
331
+ "Write",
332
+ "Edit",
333
+ "Bash",
334
+ "Grep",
335
+ "Glob",
336
+ "LS",
337
+ "WebSearch",
338
+ "TodoWrite",
339
+ ],
245
340
  "temperature": 0.2,
246
341
  "when_to_use": [
247
342
  "Data pipeline setup",
@@ -259,14 +354,19 @@ class AgentConfigProvider:
259
354
  "Integrate AI services",
260
355
  ],
261
356
  "primary_role": "Data engineering and AI integration",
262
- "specializations": '["data-pipelines", "etl", "database", "ai-integration"]',
357
+ "specializations": [
358
+ "data-pipelines",
359
+ "etl",
360
+ "database",
361
+ "ai-integration",
362
+ ],
263
363
  "authority": "ALL data engineering decisions",
264
364
  },
265
365
  "version_control": {
266
366
  **base_config,
267
367
  "description": "Git operations, version management, and release coordination",
268
- "tags": '["git", "version-control", "release", "branching"]',
269
- "tools": '["Read", "Bash", "Grep", "Glob", "LS", "TodoWrite"]',
368
+ "tags": ["git", "version-control", "release", "branching"],
369
+ "tools": ["Read", "Bash", "Grep", "Glob", "LS", "TodoWrite"],
270
370
  "temperature": 0.1,
271
371
  "network_access": False, # Git operations are local
272
372
  "when_to_use": [
@@ -285,7 +385,7 @@ class AgentConfigProvider:
285
385
  "Release coordination",
286
386
  ],
287
387
  "primary_role": "Version control and release management",
288
- "specializations": '["git", "versioning", "branching", "releases"]',
388
+ "specializations": ["git", "versioning", "branching", "releases"],
289
389
  "authority": "ALL version control decisions",
290
390
  },
291
391
  }
@@ -298,13 +398,13 @@ class AgentConfigProvider:
298
398
  return {
299
399
  **base_config,
300
400
  "description": f"{agent_name.title()} agent for specialized tasks",
301
- "tags": f'["{agent_name}", "specialized", "mpm"]',
302
- "tools": '["Read", "Write", "Edit", "Grep", "Glob", "LS", "TodoWrite"]',
401
+ "tags": [agent_name, "specialized", "mpm"],
402
+ "tools": ["Read", "Write", "Edit", "Grep", "Glob", "LS", "TodoWrite"],
303
403
  "temperature": 0.3,
304
404
  "when_to_use": [f"When {agent_name} expertise is needed"],
305
405
  "specialized_knowledge": [f"{agent_name.title()} domain knowledge"],
306
406
  "unique_capabilities": [f"{agent_name.title()} specialized operations"],
307
407
  "primary_role": f"{agent_name.title()} operations",
308
- "specializations": f'["{agent_name}"]',
408
+ "specializations": [agent_name],
309
409
  "authority": f"ALL {agent_name} decisions",
310
410
  }
@@ -141,7 +141,7 @@ class AgentLifecycleManager(BaseService):
141
141
  records = await self.record_service.load_records()
142
142
  self.state_service.agent_records = records
143
143
 
144
- history = await self.record_service.load_history()
144
+ await self.record_service.load_history()
145
145
  # Convert history back to operation results if needed
146
146
  # For now, we'll start with empty history
147
147
 
@@ -299,7 +299,7 @@ class AgentLifecycleManager(BaseService):
299
299
  # Update state if successful
300
300
  if result.success:
301
301
  # Create state record
302
- record = self.state_service.create_record(
302
+ self.state_service.create_record(
303
303
  agent_name=agent_name,
304
304
  tier=tier,
305
305
  file_path=result.metadata.get("file_path", ""),
@@ -217,7 +217,7 @@ class AgentRecordService(BaseService):
217
217
  Returns:
218
218
  Deserialized AgentLifecycleRecord
219
219
  """
220
- record = AgentLifecycleRecord(
220
+ return AgentLifecycleRecord(
221
221
  agent_name=data["agent_name"],
222
222
  current_state=LifecycleState(data["current_state"]),
223
223
  tier=ModificationTier(data["tier"]),
@@ -232,7 +232,6 @@ class AgentRecordService(BaseService):
232
232
  validation_errors=data.get("validation_errors", []),
233
233
  metadata=data.get("metadata", {}),
234
234
  )
235
- return record
236
235
 
237
236
  async def export_records(self, output_path: Path, format: str = "json") -> bool:
238
237
  """
@@ -62,11 +62,7 @@ class MemoryFormatService:
62
62
  line = line.strip()
63
63
  # Skip headers, empty lines, and metadata
64
64
  if (
65
- not line
66
- or line.startswith("#")
67
- or line.startswith("Last Updated:")
68
- or line.startswith("**")
69
- or line == "---"
65
+ not line or line.startswith(("#", "Last Updated:", "**")) or line == "---"
70
66
  ):
71
67
  continue
72
68
 
@@ -233,11 +233,10 @@ class AgentCleanupService(IAgentCleanupService):
233
233
  all_agents = multi_source_service.discover_agents_from_all_sources()
234
234
 
235
235
  # Detect orphaned agents
236
- orphaned = multi_source_service.detect_orphaned_agents(
236
+ return multi_source_service.detect_orphaned_agents(
237
237
  agents_dir, all_agents
238
238
  )
239
239
 
240
- return orphaned
241
240
 
242
241
  except Exception as e:
243
242
  self.logger.error(f"Error finding orphaned agents: {e}", exc_info=True)
@@ -225,7 +225,7 @@ class AgentDependencyService(IAgentDependencyService):
225
225
  all_python_deps = set()
226
226
  all_system_deps = set()
227
227
 
228
- for agent_id, deps in loader.agent_dependencies.items():
228
+ for _agent_id, deps in loader.agent_dependencies.items():
229
229
  if "python" in deps:
230
230
  all_python_deps.update(deps["python"])
231
231
  if "system" in deps:
@@ -324,10 +324,9 @@ class AgentValidationService(IAgentValidationService):
324
324
  if fix_result.warnings:
325
325
  total_issues += len(fix_result.warnings)
326
326
 
327
- if fix_result.corrections:
328
- if not dry_run:
329
- total_fixed += len(fix_result.corrections)
330
- agents_fixed.append(agent_id)
327
+ if fix_result.corrections and not dry_run:
328
+ total_fixed += len(fix_result.corrections)
329
+ agents_fixed.append(agent_id)
331
330
 
332
331
  return {
333
332
  "success": True,