claude-mpm 1.1.0__py3-none-any.whl → 2.1.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 (38) hide show
  1. claude_mpm/_version.py +4 -33
  2. claude_mpm/agents/INSTRUCTIONS.md +109 -319
  3. claude_mpm/agents/agent_loader.py +184 -278
  4. claude_mpm/agents/base_agent.json +1 -1
  5. claude_mpm/agents/templates/backup/data_engineer_agent_20250726_234551.json +46 -0
  6. claude_mpm/agents/templates/{engineer_agent.json → backup/engineer_agent_20250726_234551.json} +1 -1
  7. claude_mpm/agents/templates/data_engineer.json +107 -0
  8. claude_mpm/agents/templates/documentation.json +106 -0
  9. claude_mpm/agents/templates/engineer.json +110 -0
  10. claude_mpm/agents/templates/ops.json +106 -0
  11. claude_mpm/agents/templates/qa.json +106 -0
  12. claude_mpm/agents/templates/research.json +75 -0
  13. claude_mpm/agents/templates/security.json +105 -0
  14. claude_mpm/agents/templates/version_control.json +103 -0
  15. claude_mpm/cli.py +80 -11
  16. claude_mpm/core/simple_runner.py +45 -5
  17. claude_mpm/hooks/claude_hooks/hook_handler.py +115 -1
  18. claude_mpm/schemas/agent_schema.json +328 -0
  19. claude_mpm/services/agent_capabilities_generator.py +182 -0
  20. claude_mpm/services/agent_deployment.py +228 -37
  21. claude_mpm/services/deployed_agent_discovery.py +222 -0
  22. claude_mpm/services/framework_claude_md_generator/content_assembler.py +29 -0
  23. claude_mpm/services/framework_claude_md_generator/deployment_manager.py +29 -7
  24. claude_mpm/utils/framework_detection.py +39 -0
  25. claude_mpm/validation/agent_validator.py +252 -125
  26. {claude_mpm-1.1.0.dist-info → claude_mpm-2.1.0.dist-info}/METADATA +108 -26
  27. {claude_mpm-1.1.0.dist-info → claude_mpm-2.1.0.dist-info}/RECORD +36 -25
  28. claude_mpm/agents/templates/data_engineer_agent.json +0 -46
  29. claude_mpm/agents/templates/update-optimized-specialized-agents.json +0 -374
  30. /claude_mpm/agents/templates/{documentation_agent.json → backup/documentation_agent_20250726_234551.json} +0 -0
  31. /claude_mpm/agents/templates/{ops_agent.json → backup/ops_agent_20250726_234551.json} +0 -0
  32. /claude_mpm/agents/templates/{qa_agent.json → backup/qa_agent_20250726_234551.json} +0 -0
  33. /claude_mpm/agents/templates/{research_agent.json → backup/research_agent_20250726_234551.json} +0 -0
  34. /claude_mpm/agents/templates/{security_agent.json → backup/security_agent_20250726_234551.json} +0 -0
  35. /claude_mpm/agents/templates/{version_control_agent.json → backup/version_control_agent_20250726_234551.json} +0 -0
  36. {claude_mpm-1.1.0.dist-info → claude_mpm-2.1.0.dist-info}/WHEEL +0 -0
  37. {claude_mpm-1.1.0.dist-info → claude_mpm-2.1.0.dist-info}/entry_points.txt +0 -0
  38. {claude_mpm-1.1.0.dist-info → claude_mpm-2.1.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,328 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "title": "Claude MPM Agent Schema",
4
+ "description": "Schema definition for Claude MPM agent templates",
5
+ "type": "object",
6
+ "required": ["id", "version", "metadata", "capabilities", "instructions"],
7
+ "properties": {
8
+ "id": {
9
+ "type": "string",
10
+ "pattern": "^[a-z][a-z0-9_]*$",
11
+ "description": "Unique agent identifier (lowercase, alphanumeric with underscores)",
12
+ "examples": ["research", "engineer", "qa", "security"]
13
+ },
14
+ "version": {
15
+ "type": "string",
16
+ "pattern": "^\\d+\\.\\d+\\.\\d+$",
17
+ "description": "Semantic version of the agent template",
18
+ "examples": ["1.0.0", "2.1.3"]
19
+ },
20
+ "metadata": {
21
+ "type": "object",
22
+ "required": ["name", "description", "category", "tags"],
23
+ "properties": {
24
+ "name": {
25
+ "type": "string",
26
+ "minLength": 3,
27
+ "maxLength": 50,
28
+ "description": "Human-readable agent name"
29
+ },
30
+ "description": {
31
+ "type": "string",
32
+ "minLength": 10,
33
+ "maxLength": 200,
34
+ "description": "Brief description of agent purpose"
35
+ },
36
+ "category": {
37
+ "type": "string",
38
+ "enum": ["engineering", "research", "quality", "operations", "specialized"],
39
+ "description": "Agent category for organization"
40
+ },
41
+ "tags": {
42
+ "type": "array",
43
+ "items": {
44
+ "type": "string",
45
+ "pattern": "^[a-z][a-z0-9-]*$"
46
+ },
47
+ "minItems": 1,
48
+ "maxItems": 10,
49
+ "uniqueItems": true,
50
+ "description": "Tags for agent discovery"
51
+ },
52
+ "author": {
53
+ "type": "string",
54
+ "description": "Agent template author"
55
+ },
56
+ "created_at": {
57
+ "type": "string",
58
+ "format": "date-time",
59
+ "description": "Creation timestamp"
60
+ },
61
+ "updated_at": {
62
+ "type": "string",
63
+ "format": "date-time",
64
+ "description": "Last update timestamp"
65
+ }
66
+ }
67
+ },
68
+ "capabilities": {
69
+ "type": "object",
70
+ "required": ["model", "tools", "resource_tier"],
71
+ "properties": {
72
+ "model": {
73
+ "type": "string",
74
+ "enum": [
75
+ "claude-3-haiku-20240307",
76
+ "claude-3-5-haiku-20241022",
77
+ "claude-3-sonnet-20240229",
78
+ "claude-3-5-sonnet-20241022",
79
+ "claude-3-opus-20240229",
80
+ "claude-3-5-sonnet-20240620",
81
+ "claude-sonnet-4-20250514",
82
+ "claude-4-sonnet-20250514",
83
+ "claude-opus-4-20250514",
84
+ "claude-4-opus-20250514"
85
+ ],
86
+ "description": "Claude model to use for this agent"
87
+ },
88
+ "tools": {
89
+ "type": "array",
90
+ "items": {
91
+ "type": "string",
92
+ "enum": [
93
+ "Read", "Write", "Edit", "MultiEdit",
94
+ "Grep", "Glob", "LS", "Bash",
95
+ "WebSearch", "WebFetch",
96
+ "NotebookRead", "NotebookEdit",
97
+ "TodoWrite", "ExitPlanMode",
98
+ "git", "docker", "kubectl", "terraform",
99
+ "aws", "gcloud", "azure"
100
+ ]
101
+ },
102
+ "uniqueItems": true,
103
+ "description": "Available tools for the agent"
104
+ },
105
+ "resource_tier": {
106
+ "type": "string",
107
+ "enum": ["intensive", "standard", "lightweight"],
108
+ "description": "Resource allocation tier"
109
+ },
110
+ "max_tokens": {
111
+ "type": "integer",
112
+ "minimum": 1000,
113
+ "maximum": 200000,
114
+ "default": 8192,
115
+ "description": "Maximum tokens for response"
116
+ },
117
+ "temperature": {
118
+ "type": "number",
119
+ "minimum": 0,
120
+ "maximum": 1,
121
+ "default": 0.7,
122
+ "description": "Model temperature setting"
123
+ },
124
+ "timeout": {
125
+ "type": "integer",
126
+ "minimum": 30,
127
+ "maximum": 3600,
128
+ "default": 300,
129
+ "description": "Operation timeout in seconds"
130
+ },
131
+ "memory_limit": {
132
+ "type": "integer",
133
+ "minimum": 512,
134
+ "maximum": 8192,
135
+ "description": "Memory limit in MB (for resource tier)"
136
+ },
137
+ "cpu_limit": {
138
+ "type": "integer",
139
+ "minimum": 10,
140
+ "maximum": 100,
141
+ "description": "CPU limit percentage (for resource tier)"
142
+ },
143
+ "network_access": {
144
+ "type": "boolean",
145
+ "default": false,
146
+ "description": "Whether agent needs network access"
147
+ },
148
+ "file_access": {
149
+ "type": "object",
150
+ "properties": {
151
+ "read_paths": {
152
+ "type": "array",
153
+ "items": {"type": "string"},
154
+ "description": "Allowed read paths"
155
+ },
156
+ "write_paths": {
157
+ "type": "array",
158
+ "items": {"type": "string"},
159
+ "description": "Allowed write paths"
160
+ }
161
+ }
162
+ }
163
+ }
164
+ },
165
+ "instructions": {
166
+ "type": "string",
167
+ "minLength": 100,
168
+ "maxLength": 8000,
169
+ "description": "Agent system instructions (8000 character limit)"
170
+ },
171
+ "knowledge": {
172
+ "type": "object",
173
+ "description": "Agent-specific knowledge and context",
174
+ "properties": {
175
+ "domain_expertise": {
176
+ "type": "array",
177
+ "items": {"type": "string"},
178
+ "description": "Areas of expertise"
179
+ },
180
+ "best_practices": {
181
+ "type": "array",
182
+ "items": {"type": "string"},
183
+ "description": "Best practices the agent follows"
184
+ },
185
+ "constraints": {
186
+ "type": "array",
187
+ "items": {"type": "string"},
188
+ "description": "Operating constraints"
189
+ },
190
+ "examples": {
191
+ "type": "array",
192
+ "items": {
193
+ "type": "object",
194
+ "properties": {
195
+ "scenario": {"type": "string"},
196
+ "approach": {"type": "string"}
197
+ }
198
+ },
199
+ "description": "Example scenarios and approaches"
200
+ }
201
+ }
202
+ },
203
+ "interactions": {
204
+ "type": "object",
205
+ "description": "Agent interaction patterns",
206
+ "properties": {
207
+ "input_format": {
208
+ "type": "object",
209
+ "properties": {
210
+ "required_fields": {
211
+ "type": "array",
212
+ "items": {"type": "string"}
213
+ },
214
+ "optional_fields": {
215
+ "type": "array",
216
+ "items": {"type": "string"}
217
+ }
218
+ }
219
+ },
220
+ "output_format": {
221
+ "type": "object",
222
+ "properties": {
223
+ "structure": {
224
+ "type": "string",
225
+ "enum": ["markdown", "json", "structured", "free-form"]
226
+ },
227
+ "includes": {
228
+ "type": "array",
229
+ "items": {"type": "string"}
230
+ }
231
+ }
232
+ },
233
+ "handoff_agents": {
234
+ "type": "array",
235
+ "items": {"type": "string"},
236
+ "description": "Agents this agent can hand off to"
237
+ },
238
+ "triggers": {
239
+ "type": "array",
240
+ "items": {
241
+ "type": "object",
242
+ "properties": {
243
+ "condition": {"type": "string"},
244
+ "action": {"type": "string"}
245
+ }
246
+ },
247
+ "description": "Conditions that trigger specific actions"
248
+ }
249
+ }
250
+ },
251
+ "testing": {
252
+ "type": "object",
253
+ "description": "Testing configuration for the agent",
254
+ "properties": {
255
+ "test_cases": {
256
+ "type": "array",
257
+ "items": {
258
+ "type": "object",
259
+ "required": ["input", "expected_behavior"],
260
+ "properties": {
261
+ "name": {"type": "string"},
262
+ "input": {"type": "string"},
263
+ "expected_behavior": {"type": "string"},
264
+ "validation_criteria": {
265
+ "type": "array",
266
+ "items": {"type": "string"}
267
+ }
268
+ }
269
+ }
270
+ },
271
+ "performance_benchmarks": {
272
+ "type": "object",
273
+ "properties": {
274
+ "response_time": {"type": "integer"},
275
+ "token_usage": {"type": "integer"},
276
+ "success_rate": {"type": "number"}
277
+ }
278
+ }
279
+ }
280
+ },
281
+ "hooks": {
282
+ "type": "object",
283
+ "description": "Hook configurations for extensibility",
284
+ "properties": {
285
+ "pre_execution": {
286
+ "type": "array",
287
+ "items": {
288
+ "type": "object",
289
+ "properties": {
290
+ "name": {"type": "string"},
291
+ "enabled": {"type": "boolean"}
292
+ }
293
+ }
294
+ },
295
+ "post_execution": {
296
+ "type": "array",
297
+ "items": {
298
+ "type": "object",
299
+ "properties": {
300
+ "name": {"type": "string"},
301
+ "enabled": {"type": "boolean"}
302
+ }
303
+ }
304
+ }
305
+ }
306
+ }
307
+ },
308
+ "additionalProperties": false,
309
+ "definitions": {
310
+ "resource_tier_limits": {
311
+ "intensive": {
312
+ "memory_limit": {"min": 4096, "max": 8192},
313
+ "cpu_limit": {"min": 60, "max": 100},
314
+ "timeout": {"min": 600, "max": 3600}
315
+ },
316
+ "standard": {
317
+ "memory_limit": {"min": 2048, "max": 4096},
318
+ "cpu_limit": {"min": 30, "max": 60},
319
+ "timeout": {"min": 300, "max": 1200}
320
+ },
321
+ "lightweight": {
322
+ "memory_limit": {"min": 512, "max": 2048},
323
+ "cpu_limit": {"min": 10, "max": 30},
324
+ "timeout": {"min": 30, "max": 600}
325
+ }
326
+ }
327
+ }
328
+ }
@@ -0,0 +1,182 @@
1
+ """Agent Capabilities Content Generator.
2
+
3
+ This service generates markdown content for agent capabilities section
4
+ from discovered deployed agents.
5
+ """
6
+
7
+ from typing import List, Dict, Any
8
+ import logging
9
+
10
+ from jinja2 import Template
11
+
12
+ logger = logging.getLogger(__name__)
13
+
14
+
15
+ class AgentCapabilitiesGenerator:
16
+ """Generates markdown content for agent capabilities section."""
17
+
18
+ def __init__(self):
19
+ """Initialize the generator with default template."""
20
+ self.template = self._load_template()
21
+ logger.debug("Initialized AgentCapabilitiesGenerator")
22
+
23
+ def generate_capabilities_section(self, deployed_agents: List[Dict[str, Any]]) -> str:
24
+ """Generate the complete agent capabilities markdown section.
25
+
26
+ Args:
27
+ deployed_agents: List of agent information dictionaries
28
+
29
+ Returns:
30
+ Generated markdown content for agent capabilities
31
+ """
32
+ try:
33
+ # Group agents by source tier for organized display
34
+ agents_by_tier = self._group_by_tier(deployed_agents)
35
+
36
+ # Generate core agent list
37
+ core_agent_list = self._generate_core_agent_list(deployed_agents)
38
+
39
+ # Generate detailed capabilities
40
+ detailed_capabilities = self._generate_detailed_capabilities(deployed_agents)
41
+
42
+ # Render template
43
+ content = self.template.render(
44
+ core_agents=core_agent_list,
45
+ detailed_capabilities=detailed_capabilities,
46
+ agents_by_tier=agents_by_tier,
47
+ total_agents=len(deployed_agents)
48
+ )
49
+
50
+ logger.info(f"Generated capabilities section for {len(deployed_agents)} agents")
51
+ return content
52
+
53
+ except Exception as e:
54
+ logger.error(f"Failed to generate capabilities section: {e}")
55
+ # Return fallback content on error
56
+ return self._generate_fallback_content()
57
+
58
+ def _group_by_tier(self, agents: List[Dict[str, Any]]) -> Dict[str, List[Dict[str, Any]]]:
59
+ """Group agents by their source tier.
60
+
61
+ Args:
62
+ agents: List of agent information dictionaries
63
+
64
+ Returns:
65
+ Dictionary mapping tiers to lists of agents
66
+ """
67
+ tiers = {'system': [], 'user': [], 'project': []}
68
+
69
+ for agent in agents:
70
+ tier = agent.get('source_tier', 'system')
71
+ if tier in tiers:
72
+ tiers[tier].append(agent)
73
+ else:
74
+ # Handle unknown tiers gracefully
75
+ tiers['system'].append(agent)
76
+ logger.warning(f"Unknown source tier '{tier}' for agent {agent.get('id')}, defaulting to system")
77
+
78
+ return tiers
79
+
80
+ def _generate_core_agent_list(self, agents: List[Dict[str, Any]]) -> str:
81
+ """Generate comma-separated list of core agent IDs.
82
+
83
+ Args:
84
+ agents: List of agent information dictionaries
85
+
86
+ Returns:
87
+ Comma-separated string of agent IDs
88
+ """
89
+ agent_ids = [agent['id'] for agent in agents]
90
+ return ', '.join(sorted(agent_ids))
91
+
92
+ def _generate_detailed_capabilities(self, agents: List[Dict[str, Any]]) -> List[Dict[str, str]]:
93
+ """Generate detailed capability descriptions for each agent.
94
+
95
+ Args:
96
+ agents: List of agent information dictionaries
97
+
98
+ Returns:
99
+ List of capability dictionaries for template rendering
100
+ """
101
+ capabilities = []
102
+
103
+ for agent in sorted(agents, key=lambda a: a['id']):
104
+ # Extract key capabilities
105
+ specializations = agent.get('specializations', [])
106
+ when_to_use = agent.get('capabilities', {}).get('when_to_use', [])
107
+
108
+ # Create capability summary
109
+ if when_to_use:
110
+ capability_text = '; '.join(when_to_use[:2]) # First 2 items
111
+ elif specializations:
112
+ capability_text = ', '.join(specializations[:3]) # First 3 specializations
113
+ else:
114
+ capability_text = agent.get('description', 'General purpose agent')
115
+
116
+ # Truncate long capability text
117
+ if len(capability_text) > 100:
118
+ capability_text = capability_text[:97] + '...'
119
+
120
+ capabilities.append({
121
+ 'name': agent['name'],
122
+ 'id': agent['id'],
123
+ 'capability_text': capability_text,
124
+ 'tools': ', '.join(agent.get('tools', [])[:5]) # First 5 tools
125
+ })
126
+
127
+ return capabilities
128
+
129
+ def _load_template(self) -> Template:
130
+ """Load the Jinja2 template for agent capabilities.
131
+
132
+ Returns:
133
+ Configured Jinja2 template
134
+ """
135
+ template_content = """
136
+ ## Agent Names & Capabilities
137
+ **Core Agents**: {{ core_agents }}
138
+
139
+ {% if agents_by_tier.project %}
140
+ ### Project-Specific Agents
141
+ {% for agent in agents_by_tier.project %}
142
+ - **{{ agent.name }}** ({{ agent.id }}): {{ agent.description }}
143
+ {% endfor %}
144
+
145
+ {% endif %}
146
+ **Agent Capabilities**:
147
+ {% for cap in detailed_capabilities %}
148
+ - **{{ cap.name }}**: {{ cap.capability_text }}
149
+ {% endfor %}
150
+
151
+ **Agent Name Formats** (both valid):
152
+ - Capitalized: {{ detailed_capabilities | map(attribute='name') | join('", "') }}
153
+ - Lowercase-hyphenated: {{ detailed_capabilities | map(attribute='id') | join('", "') }}
154
+
155
+ *Generated from {{ total_agents }} deployed agents*
156
+ """.strip()
157
+
158
+ return Template(template_content)
159
+
160
+ def _generate_fallback_content(self) -> str:
161
+ """Generate fallback content when agent discovery fails.
162
+
163
+ Returns:
164
+ Static fallback markdown content
165
+ """
166
+ logger.warning("Using fallback content due to generation failure")
167
+ return """
168
+ ## Agent Names & Capabilities
169
+ **Core Agents**: research, engineer, qa, documentation, security, ops, version_control, data_engineer
170
+
171
+ **Agent Capabilities**:
172
+ - **Research**: Codebase analysis, best practices, technical investigation
173
+ - **Engineer**: Implementation, refactoring, debugging
174
+ - **QA**: Quality assurance, testing, code review
175
+ - **Documentation**: Technical writing, API docs, user guides
176
+ - **Security**: Security analysis, vulnerability assessment
177
+ - **Ops**: Operations, deployment, infrastructure
178
+ - **Version Control**: Git operations, branch management
179
+ - **Data Engineer**: Data pipelines, ETL, database operations
180
+
181
+ *Note: Unable to dynamically generate agent list. Using default agents.*
182
+ """.strip()