claude-mpm 3.5.4__py3-none-any.whl → 3.6.0__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 (68) hide show
  1. claude_mpm/.claude-mpm/logs/hooks_20250728.log +10 -0
  2. claude_mpm/VERSION +1 -1
  3. claude_mpm/agents/BASE_AGENT_TEMPLATE.md +96 -23
  4. claude_mpm/agents/BASE_PM.md +273 -0
  5. claude_mpm/agents/INSTRUCTIONS.md +114 -102
  6. claude_mpm/agents/agent-template.yaml +83 -0
  7. claude_mpm/agents/agent_loader.py +36 -1
  8. claude_mpm/agents/async_agent_loader.py +421 -0
  9. claude_mpm/agents/templates/code_analyzer.json +81 -0
  10. claude_mpm/agents/templates/data_engineer.json +18 -3
  11. claude_mpm/agents/templates/documentation.json +18 -3
  12. claude_mpm/agents/templates/engineer.json +19 -4
  13. claude_mpm/agents/templates/ops.json +18 -3
  14. claude_mpm/agents/templates/qa.json +20 -4
  15. claude_mpm/agents/templates/research.json +20 -4
  16. claude_mpm/agents/templates/security.json +18 -3
  17. claude_mpm/agents/templates/version_control.json +16 -3
  18. claude_mpm/cli/README.md +108 -0
  19. claude_mpm/cli/__init__.py +5 -1
  20. claude_mpm/cli/commands/__init__.py +5 -1
  21. claude_mpm/cli/commands/agents.py +233 -6
  22. claude_mpm/cli/commands/aggregate.py +462 -0
  23. claude_mpm/cli/commands/config.py +277 -0
  24. claude_mpm/cli/commands/run.py +228 -47
  25. claude_mpm/cli/parser.py +176 -1
  26. claude_mpm/cli/utils.py +9 -1
  27. claude_mpm/cli_module/refactoring_guide.md +253 -0
  28. claude_mpm/config/async_logging_config.yaml +145 -0
  29. claude_mpm/constants.py +19 -0
  30. claude_mpm/core/.claude-mpm/logs/hooks_20250730.log +34 -0
  31. claude_mpm/core/claude_runner.py +413 -76
  32. claude_mpm/core/config.py +161 -4
  33. claude_mpm/core/config_paths.py +0 -1
  34. claude_mpm/core/factories.py +9 -3
  35. claude_mpm/core/framework_loader.py +81 -0
  36. claude_mpm/dashboard/.claude-mpm/memories/README.md +36 -0
  37. claude_mpm/dashboard/README.md +121 -0
  38. claude_mpm/dashboard/static/js/dashboard.js.backup +1973 -0
  39. claude_mpm/dashboard/templates/.claude-mpm/memories/README.md +36 -0
  40. claude_mpm/dashboard/templates/.claude-mpm/memories/engineer_agent.md +39 -0
  41. claude_mpm/dashboard/templates/.claude-mpm/memories/version_control_agent.md +38 -0
  42. claude_mpm/hooks/README.md +96 -0
  43. claude_mpm/hooks/claude_hooks/hook_handler.py +391 -9
  44. claude_mpm/init.py +123 -18
  45. claude_mpm/models/agent_session.py +511 -0
  46. claude_mpm/schemas/agent_schema.json +435 -0
  47. claude_mpm/scripts/__init__.py +15 -0
  48. claude_mpm/scripts/start_activity_logging.py +86 -0
  49. claude_mpm/services/agents/deployment/agent_deployment.py +326 -24
  50. claude_mpm/services/agents/deployment/async_agent_deployment.py +461 -0
  51. claude_mpm/services/agents/management/agent_management_service.py +2 -1
  52. claude_mpm/services/event_aggregator.py +547 -0
  53. claude_mpm/services/framework_claude_md_generator/README.md +92 -0
  54. claude_mpm/services/framework_claude_md_generator/section_generators/agents.py +3 -3
  55. claude_mpm/services/framework_claude_md_generator/section_generators/claude_pm_init.py +2 -2
  56. claude_mpm/services/version_control/VERSION +1 -0
  57. claude_mpm/utils/agent_dependency_loader.py +655 -0
  58. claude_mpm/utils/console.py +11 -0
  59. claude_mpm/utils/dependency_cache.py +376 -0
  60. claude_mpm/utils/dependency_strategies.py +343 -0
  61. claude_mpm/utils/environment_context.py +310 -0
  62. {claude_mpm-3.5.4.dist-info → claude_mpm-3.6.0.dist-info}/METADATA +87 -1
  63. {claude_mpm-3.5.4.dist-info → claude_mpm-3.6.0.dist-info}/RECORD +67 -37
  64. claude_mpm/agents/templates/pm.json +0 -122
  65. {claude_mpm-3.5.4.dist-info → claude_mpm-3.6.0.dist-info}/WHEEL +0 -0
  66. {claude_mpm-3.5.4.dist-info → claude_mpm-3.6.0.dist-info}/entry_points.txt +0 -0
  67. {claude_mpm-3.5.4.dist-info → claude_mpm-3.6.0.dist-info}/licenses/LICENSE +0 -0
  68. {claude_mpm-3.5.4.dist-info → claude_mpm-3.6.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,435 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "version": "1.2.0",
4
+ "title": "Claude MPM Agent Schema",
5
+ "description": "Schema definition for Claude MPM agent templates. This schema enforces the structure and validation rules for all agent configurations in the Claude MPM system.",
6
+ "type": "object",
7
+ "required": [
8
+ "schema_version",
9
+ "agent_id",
10
+ "agent_version",
11
+ "agent_type",
12
+ "metadata",
13
+ "capabilities",
14
+ "instructions"
15
+ ],
16
+ "properties": {
17
+ "schema_version": {
18
+ "type": "string",
19
+ "pattern": "^\\d+\\.\\d+\\.\\d+$",
20
+ "description": "Schema version for the agent template format. This ensures compatibility between the agent template and the schema validator. Must be updated when breaking changes are made to the schema.",
21
+ "examples": ["1.0.0", "1.2.0"]
22
+ },
23
+ "agent_id": {
24
+ "type": "string",
25
+ "pattern": "^[a-z][a-z0-9_]*$",
26
+ "description": "Unique agent identifier used for agent discovery and loading. This ID must be unique across all agents in the system and follows snake_case naming convention.",
27
+ "examples": ["research_agent", "engineer_agent", "qa_agent", "security_agent"]
28
+ },
29
+ "agent_version": {
30
+ "type": "string",
31
+ "pattern": "^\\d+\\.\\d+\\.\\d+$",
32
+ "description": "Semantic version of the agent template itself (not the schema). Increment major for breaking changes, minor for new features, patch for bug fixes.",
33
+ "examples": ["1.0.0", "2.1.3"]
34
+ },
35
+ "agent_type": {
36
+ "type": "string",
37
+ "description": "Type of agent that determines its primary function and default capabilities. This categorization helps in agent discovery and capability matching.",
38
+ "enum": [
39
+ "base",
40
+ "engineer",
41
+ "qa",
42
+ "documentation",
43
+ "research",
44
+ "security",
45
+ "ops",
46
+ "data_engineer",
47
+ "version_control"
48
+ ]
49
+ },
50
+ "metadata": {
51
+ "type": "object",
52
+ "required": [
53
+ "name",
54
+ "description",
55
+ "tags"
56
+ ],
57
+ "properties": {
58
+ "name": {
59
+ "type": "string",
60
+ "minLength": 3,
61
+ "maxLength": 50,
62
+ "description": "Human-readable agent name displayed in UI and logs. Should be concise but descriptive."
63
+ },
64
+ "description": {
65
+ "type": "string",
66
+ "minLength": 10,
67
+ "maxLength": 200,
68
+ "description": "Brief description of agent purpose and capabilities. Used in agent selection and documentation."
69
+ },
70
+ "category": {
71
+ "type": "string",
72
+ "enum": ["engineering", "research", "quality", "operations", "specialized"],
73
+ "description": "Agent category for organization"
74
+ },
75
+ "tags": {
76
+ "type": "array",
77
+ "items": {
78
+ "type": "string",
79
+ "pattern": "^[a-z][a-z0-9-]*$"
80
+ },
81
+ "minItems": 1,
82
+ "maxItems": 10,
83
+ "uniqueItems": true,
84
+ "description": "Tags for agent discovery and categorization. Used by the agent registry for searching and filtering."
85
+ },
86
+ "author": {
87
+ "type": "string",
88
+ "description": "Agent template author"
89
+ },
90
+ "created_at": {
91
+ "type": "string",
92
+ "format": "date-time",
93
+ "description": "Creation timestamp"
94
+ },
95
+ "updated_at": {
96
+ "type": "string",
97
+ "format": "date-time",
98
+ "description": "Last update timestamp"
99
+ },
100
+ "color": {
101
+ "type": "string",
102
+ "enum": ["red", "blue", "green", "yellow", "purple", "orange", "pink", "cyan"],
103
+ "description": "Agent color for visual identification in Claude Code interface. Helps distinguish agents at a glance."
104
+ }
105
+ }
106
+ },
107
+ "dependencies": {
108
+ "type": "object",
109
+ "description": "External dependencies required for this agent to function properly",
110
+ "properties": {
111
+ "python": {
112
+ "type": "array",
113
+ "items": {
114
+ "type": "string"
115
+ },
116
+ "description": "Python packages required (pip installable) with optional version specifiers",
117
+ "examples": [["tree-sitter>=0.21.0", "pandas>=2.0.0"]]
118
+ },
119
+ "system": {
120
+ "type": "array",
121
+ "items": {
122
+ "type": "string"
123
+ },
124
+ "description": "System-level dependencies (e.g., commands that should be available in PATH)",
125
+ "examples": [["ripgrep", "git", "docker"]]
126
+ },
127
+ "optional": {
128
+ "type": "boolean",
129
+ "default": false,
130
+ "description": "Whether these dependencies are optional (agent can function without them)"
131
+ }
132
+ }
133
+ },
134
+ "capabilities": {
135
+ "type": "object",
136
+ "required": [
137
+ "model",
138
+ "tools",
139
+ "resource_tier"
140
+ ],
141
+ "properties": {
142
+ "model": {
143
+ "type": "string",
144
+ "enum": [
145
+ "opus",
146
+ "sonnet",
147
+ "haiku"
148
+ ],
149
+ "description": "Claude model tier to use for this agent. Choose based on task complexity and performance requirements: opus (most capable), sonnet (balanced), haiku (fastest)."
150
+ },
151
+ "tools": {
152
+ "type": "array",
153
+ "items": {
154
+ "type": "string",
155
+ "enum": [
156
+ "Read",
157
+ "Write",
158
+ "Edit",
159
+ "MultiEdit",
160
+ "Grep",
161
+ "Glob",
162
+ "LS",
163
+ "Bash",
164
+ "WebSearch",
165
+ "WebFetch",
166
+ "NotebookRead",
167
+ "NotebookEdit",
168
+ "TodoWrite",
169
+ "ExitPlanMode",
170
+ "git",
171
+ "docker",
172
+ "kubectl",
173
+ "terraform",
174
+ "aws",
175
+ "gcloud",
176
+ "azure"
177
+ ]
178
+ },
179
+ "uniqueItems": true,
180
+ "description": "Available tools for the agent. Tools determine what operations the agent can perform."
181
+ },
182
+ "resource_tier": {
183
+ "type": "string",
184
+ "enum": [
185
+ "basic",
186
+ "standard",
187
+ "intensive",
188
+ "lightweight"
189
+ ],
190
+ "description": "Resource allocation tier that determines memory, CPU, and timeout limits. See definitions section for specific limits."
191
+ },
192
+ "max_tokens": {
193
+ "type": "integer",
194
+ "minimum": 1000,
195
+ "maximum": 200000,
196
+ "default": 8192,
197
+ "description": "Maximum tokens for response generation. Higher values allow longer responses but increase cost and latency."
198
+ },
199
+ "temperature": {
200
+ "type": "number",
201
+ "minimum": 0,
202
+ "maximum": 1,
203
+ "default": 0.7,
204
+ "description": "Model temperature setting controlling response randomness. Lower values for consistency, higher for creativity."
205
+ },
206
+ "timeout": {
207
+ "type": "integer",
208
+ "minimum": 30,
209
+ "maximum": 3600,
210
+ "default": 300,
211
+ "description": "Operation timeout in seconds. Should align with resource_tier settings."
212
+ },
213
+ "memory_limit": {
214
+ "type": "integer",
215
+ "minimum": 512,
216
+ "maximum": 8192,
217
+ "description": "Memory limit in MB (for resource tier)"
218
+ },
219
+ "cpu_limit": {
220
+ "type": "integer",
221
+ "minimum": 10,
222
+ "maximum": 100,
223
+ "description": "CPU limit percentage (for resource tier)"
224
+ },
225
+ "network_access": {
226
+ "type": "boolean",
227
+ "default": false,
228
+ "description": "Whether agent needs network access"
229
+ },
230
+ "file_access": {
231
+ "type": "object",
232
+ "properties": {
233
+ "read_paths": {
234
+ "type": "array",
235
+ "items": {"type": "string"},
236
+ "description": "Allowed read paths"
237
+ },
238
+ "write_paths": {
239
+ "type": "array",
240
+ "items": {"type": "string"},
241
+ "description": "Allowed write paths"
242
+ }
243
+ }
244
+ },
245
+ "allowed_tools": {
246
+ "type": "array",
247
+ "items": {"type": "string"},
248
+ "description": "Glob patterns for allowed file paths. Restricts which files the agent can access (e.g., 'tests/**' for test files only)."
249
+ },
250
+ "disallowed_tools": {
251
+ "type": "array",
252
+ "items": {"type": "string"},
253
+ "description": "Tool names to explicitly disallow, overriding the tools array. Use for security restrictions (e.g., 'Bash' to prevent shell access)."
254
+ }
255
+ }
256
+ },
257
+ "instructions": {
258
+ "type": "string",
259
+ "minLength": 100,
260
+ "maxLength": 8000,
261
+ "description": "Agent system instructions that define behavior, approach, and constraints. This becomes the agent's system prompt."
262
+ },
263
+ "knowledge": {
264
+ "type": "object",
265
+ "description": "Agent-specific knowledge and context",
266
+ "properties": {
267
+ "domain_expertise": {
268
+ "type": "array",
269
+ "items": {"type": "string"},
270
+ "description": "Areas of expertise"
271
+ },
272
+ "best_practices": {
273
+ "type": "array",
274
+ "items": {"type": "string"},
275
+ "description": "Best practices the agent follows"
276
+ },
277
+ "constraints": {
278
+ "type": "array",
279
+ "items": {"type": "string"},
280
+ "description": "Operating constraints"
281
+ },
282
+ "examples": {
283
+ "type": "array",
284
+ "items": {
285
+ "type": "object",
286
+ "properties": {
287
+ "scenario": {"type": "string"},
288
+ "approach": {"type": "string"}
289
+ }
290
+ },
291
+ "description": "Example scenarios and approaches"
292
+ }
293
+ }
294
+ },
295
+ "interactions": {
296
+ "type": "object",
297
+ "description": "Agent interaction patterns",
298
+ "properties": {
299
+ "input_format": {
300
+ "type": "object",
301
+ "properties": {
302
+ "required_fields": {
303
+ "type": "array",
304
+ "items": {"type": "string"}
305
+ },
306
+ "optional_fields": {
307
+ "type": "array",
308
+ "items": {"type": "string"}
309
+ }
310
+ }
311
+ },
312
+ "output_format": {
313
+ "type": "object",
314
+ "properties": {
315
+ "structure": {
316
+ "type": "string",
317
+ "enum": ["markdown", "json", "structured", "free-form"]
318
+ },
319
+ "includes": {
320
+ "type": "array",
321
+ "items": {"type": "string"}
322
+ }
323
+ }
324
+ },
325
+ "handoff_agents": {
326
+ "type": "array",
327
+ "items": {"type": "string"},
328
+ "description": "Agents this agent can hand off to"
329
+ },
330
+ "triggers": {
331
+ "type": "array",
332
+ "items": {
333
+ "type": "object",
334
+ "properties": {
335
+ "condition": {"type": "string"},
336
+ "action": {"type": "string"}
337
+ }
338
+ },
339
+ "description": "Conditions that trigger specific actions"
340
+ }
341
+ }
342
+ },
343
+ "testing": {
344
+ "type": "object",
345
+ "description": "Testing configuration for the agent",
346
+ "properties": {
347
+ "test_cases": {
348
+ "type": "array",
349
+ "items": {
350
+ "type": "object",
351
+ "required": ["input", "expected_behavior"],
352
+ "properties": {
353
+ "name": {"type": "string"},
354
+ "input": {"type": "string"},
355
+ "expected_behavior": {"type": "string"},
356
+ "validation_criteria": {
357
+ "type": "array",
358
+ "items": {"type": "string"}
359
+ }
360
+ }
361
+ }
362
+ },
363
+ "performance_benchmarks": {
364
+ "type": "object",
365
+ "properties": {
366
+ "response_time": {"type": "integer"},
367
+ "token_usage": {"type": "integer"},
368
+ "success_rate": {"type": "number"}
369
+ }
370
+ }
371
+ }
372
+ },
373
+ "hooks": {
374
+ "type": "object",
375
+ "description": "Hook configurations for extensibility",
376
+ "properties": {
377
+ "pre_execution": {
378
+ "type": "array",
379
+ "items": {
380
+ "type": "object",
381
+ "properties": {
382
+ "name": {"type": "string"},
383
+ "enabled": {"type": "boolean"}
384
+ }
385
+ }
386
+ },
387
+ "post_execution": {
388
+ "type": "array",
389
+ "items": {
390
+ "type": "object",
391
+ "properties": {
392
+ "name": {"type": "string"},
393
+ "enabled": {"type": "boolean"}
394
+ }
395
+ }
396
+ }
397
+ }
398
+ }
399
+ },
400
+ "additionalProperties": false,
401
+ "definitions": {
402
+ "model_mappings": {
403
+ "description": "Mappings for model normalization from full names to tiers",
404
+ "mappings": {
405
+ "claude-3-5-sonnet-20241022": "sonnet",
406
+ "claude-3-5-sonnet-20240620": "sonnet",
407
+ "claude-sonnet-4-20250514": "sonnet",
408
+ "claude-4-sonnet-20250514": "sonnet",
409
+ "claude-3-sonnet-20240229": "sonnet",
410
+ "claude-3-opus-20240229": "opus",
411
+ "claude-opus-4-20250514": "opus",
412
+ "claude-4-opus-20250514": "opus",
413
+ "claude-3-haiku-20240307": "haiku",
414
+ "claude-3-5-haiku-20241022": "haiku"
415
+ }
416
+ },
417
+ "resource_tier_limits": {
418
+ "intensive": {
419
+ "memory_limit": {"min": 4096, "max": 8192},
420
+ "cpu_limit": {"min": 60, "max": 100},
421
+ "timeout": {"min": 600, "max": 3600}
422
+ },
423
+ "standard": {
424
+ "memory_limit": {"min": 2048, "max": 4096},
425
+ "cpu_limit": {"min": 30, "max": 60},
426
+ "timeout": {"min": 300, "max": 1200}
427
+ },
428
+ "lightweight": {
429
+ "memory_limit": {"min": 512, "max": 2048},
430
+ "cpu_limit": {"min": 10, "max": 30},
431
+ "timeout": {"min": 30, "max": 600}
432
+ }
433
+ }
434
+ }
435
+ }
@@ -0,0 +1,15 @@
1
+ """
2
+ Production scripts for claude-mpm.
3
+
4
+ WHY: This module contains production-ready scripts that can be run independently
5
+ for various claude-mpm operations like activity logging, monitoring, etc.
6
+
7
+ DESIGN DECISION: These scripts are kept as part of the main package rather than
8
+ in the top-level scripts/ directory to ensure they have proper access to the
9
+ claude_mpm module and can be distributed with the package.
10
+ """
11
+
12
+ # Export commonly used scripts for programmatic access
13
+ from .start_activity_logging import signal_handler
14
+
15
+ __all__ = ['signal_handler']
@@ -0,0 +1,86 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ Start the event aggregator service for activity logging.
4
+
5
+ This script starts the event aggregator that captures all agent activity
6
+ from the Socket.IO dashboard and saves it to .claude-mpm/activity/
7
+ """
8
+
9
+ import sys
10
+ import time
11
+ import signal
12
+ from pathlib import Path
13
+
14
+ # Since we're now inside the claude_mpm package, use relative imports
15
+ from ..core.config import Config
16
+ from ..services.event_aggregator import EventAggregator
17
+ from ..core.logger import get_logger
18
+
19
+ logger = get_logger("activity_logging")
20
+
21
+ def signal_handler(signum, frame):
22
+ """Handle shutdown signals gracefully."""
23
+ logger.info("Shutting down activity logging...")
24
+ if aggregator:
25
+ aggregator.stop()
26
+ sys.exit(0)
27
+
28
+ if __name__ == "__main__":
29
+ # Load configuration
30
+ config = Config()
31
+
32
+ # Check if event aggregator is enabled
33
+ if not config.get('event_aggregator.enabled', True):
34
+ logger.warning("Event aggregator is disabled in configuration")
35
+ logger.warning("Enable it by setting event_aggregator.enabled: true")
36
+ sys.exit(1)
37
+
38
+ # Get configuration values
39
+ activity_dir = config.get('event_aggregator.activity_directory', '.claude-mpm/activity')
40
+ dashboard_port = config.get('event_aggregator.dashboard_port', 8765)
41
+
42
+ logger.info("=" * 60)
43
+ logger.info("Starting Activity Logging Service")
44
+ logger.info("=" * 60)
45
+ logger.info(f"Activity Directory: {activity_dir}")
46
+ logger.info(f"Dashboard Port: {dashboard_port}")
47
+ logger.info("Connecting to Socket.IO dashboard...")
48
+
49
+ # Initialize aggregator
50
+ aggregator = EventAggregator(
51
+ host="localhost",
52
+ port=dashboard_port,
53
+ save_dir=None # Will use config value
54
+ )
55
+
56
+ # Set up signal handlers
57
+ signal.signal(signal.SIGINT, signal_handler)
58
+ signal.signal(signal.SIGTERM, signal_handler)
59
+
60
+ # Start the aggregator
61
+ try:
62
+ aggregator.start()
63
+ logger.info("✅ Activity logging started successfully!")
64
+ logger.info(f"📁 Saving activity to: {aggregator.save_dir}")
65
+ logger.info("Press Ctrl+C to stop")
66
+
67
+ # Keep running and show periodic status
68
+ while aggregator.running:
69
+ time.sleep(30)
70
+
71
+ # Show status every 30 seconds
72
+ status = aggregator.get_status()
73
+ if status['active_sessions'] > 0:
74
+ logger.info(f"📊 Status: {status['active_sessions']} active sessions, "
75
+ f"{status['total_events']} events captured")
76
+
77
+ except KeyboardInterrupt:
78
+ logger.info("Received shutdown signal")
79
+ except Exception as e:
80
+ logger.error(f"Error running activity logging: {e}")
81
+ finally:
82
+ if aggregator:
83
+ aggregator.stop()
84
+ # Save any remaining sessions
85
+ aggregator._save_all_sessions()
86
+ logger.info("Activity logging stopped")