claude-mpm 2.1.0__py3-none-any.whl → 3.0.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 (31) hide show
  1. claude_mpm/_version.py +2 -2
  2. claude_mpm/agents/agent_loader.py +682 -102
  3. claude_mpm/agents/base_agent_loader.py +23 -8
  4. claude_mpm/agents/schema/agent_schema.json +237 -83
  5. claude_mpm/agents/templates/data_engineer.json +6 -3
  6. claude_mpm/agents/templates/documentation.json +6 -3
  7. claude_mpm/agents/templates/engineer.json +7 -4
  8. claude_mpm/agents/templates/ops.json +6 -3
  9. claude_mpm/agents/templates/qa.json +10 -5
  10. claude_mpm/agents/templates/research.json +31 -42
  11. claude_mpm/agents/templates/security.json +14 -6
  12. claude_mpm/agents/templates/version_control.json +9 -5
  13. claude_mpm/core/base_service.py +61 -1
  14. claude_mpm/hooks/claude_hooks/hook_handler.py +224 -20
  15. claude_mpm/schemas/README_SECURITY.md +92 -0
  16. claude_mpm/schemas/agent_schema.json +130 -51
  17. claude_mpm/schemas/agent_schema_security_notes.md +165 -0
  18. claude_mpm/services/agent_capabilities_generator.py +0 -1
  19. claude_mpm/services/agent_deployment.py +479 -91
  20. claude_mpm/services/agent_lifecycle_manager.py +62 -4
  21. claude_mpm/services/deployed_agent_discovery.py +6 -2
  22. claude_mpm/services/version_control/semantic_versioning.py +165 -16
  23. claude_mpm/validation/agent_validator.py +147 -13
  24. {claude_mpm-2.1.0.dist-info → claude_mpm-3.0.0.dist-info}/METADATA +4 -2
  25. {claude_mpm-2.1.0.dist-info → claude_mpm-3.0.0.dist-info}/RECORD +29 -28
  26. claude_mpm-3.0.0.dist-info/licenses/LICENSE +21 -0
  27. claude_mpm/cli_old/__init__.py +0 -1
  28. claude_mpm/cli_old/ticket_cli.py +0 -102
  29. {claude_mpm-2.1.0.dist-info → claude_mpm-3.0.0.dist-info}/WHEEL +0 -0
  30. {claude_mpm-2.1.0.dist-info → claude_mpm-3.0.0.dist-info}/entry_points.txt +0 -0
  31. {claude_mpm-2.1.0.dist-info → claude_mpm-3.0.0.dist-info}/top_level.txt +0 -0
@@ -21,6 +21,7 @@ Usage:
21
21
  full_prompt = prepend_base_instructions(get_documentation_agent_prompt())
22
22
  """
23
23
 
24
+ import json
24
25
  import logging
25
26
  import os
26
27
  from pathlib import Path
@@ -39,27 +40,27 @@ def _get_base_agent_file() -> Path:
39
40
  """Get the base agent file path."""
40
41
  # Check if we're running from a wheel installation
41
42
  try:
42
- import claude_pm
43
- package_path = Path(claude_pm.__file__).parent
43
+ import claude_mpm
44
+ package_path = Path(claude_mpm.__file__).parent
44
45
  path_str = str(package_path.resolve())
45
46
  if 'site-packages' in path_str or 'dist-packages' in path_str:
46
47
  # For wheel installations, check data directory
47
- data_base_agent = package_path / "data" / "agents" / "BASE_AGENT_TEMPLATE.md"
48
+ data_base_agent = package_path / "data" / "agents" / "base_agent.json"
48
49
  if data_base_agent.exists():
49
50
  logger.debug(f"Using wheel installation base_agent: {data_base_agent}")
50
51
  return data_base_agent
51
52
  except Exception:
52
53
  pass
53
54
 
54
- # Use the BASE_AGENT_TEMPLATE.md in the agents directory
55
- base_agent_path = Path(__file__).parent / "BASE_AGENT_TEMPLATE.md"
55
+ # Use the base_agent.json in the agents directory
56
+ base_agent_path = Path(__file__).parent / "base_agent.json"
56
57
  if base_agent_path.exists():
57
58
  logger.debug(f"Using base agent template: {base_agent_path}")
58
59
  return base_agent_path
59
60
 
60
61
  # Fallback error
61
62
  logger.error("Base agent template file not found")
62
- raise FileNotFoundError("BASE_AGENT_TEMPLATE.md not found in agents directory")
63
+ raise FileNotFoundError("base_agent.json not found in agents directory")
63
64
 
64
65
 
65
66
  # Base agent file path (dynamically determined)
@@ -149,7 +150,7 @@ TEMPLATE_SECTIONS = {
149
150
 
150
151
  def load_base_agent_instructions(force_reload: bool = False) -> Optional[str]:
151
152
  """
152
- Load base agent instructions from base_agent.md with caching.
153
+ Load base agent instructions from base_agent.json with caching.
153
154
  Conditionally includes test-mode instructions based on CLAUDE_PM_TEST_MODE.
154
155
 
155
156
  Args:
@@ -184,7 +185,21 @@ def load_base_agent_instructions(force_reload: bool = False) -> Optional[str]:
184
185
  return None
185
186
 
186
187
  logger.debug(f"Loading base agent instructions from: {base_agent_file}")
187
- content = base_agent_file.read_text(encoding='utf-8')
188
+
189
+ # Load JSON and extract instructions
190
+ with open(base_agent_file, 'r', encoding='utf-8') as f:
191
+ base_agent_data = json.load(f)
192
+
193
+ # Extract instructions from the JSON structure
194
+ if 'narrative_fields' in base_agent_data and 'instructions' in base_agent_data['narrative_fields']:
195
+ content = base_agent_data['narrative_fields']['instructions']
196
+ else:
197
+ # Fallback for older format
198
+ content = base_agent_data.get('instructions', '')
199
+
200
+ if not content:
201
+ logger.error("No instructions found in base agent JSON")
202
+ return None
188
203
 
189
204
  # If NOT in test mode, remove test-specific instructions to save context
190
205
  if not test_mode:
@@ -1,156 +1,310 @@
1
1
  {
2
2
  "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "version": "1.1.0",
3
4
  "title": "Claude MPM Agent Definition Schema",
4
- "description": "Schema for defining Claude MPM agents matching the target YAML structure",
5
+ "description": "Schema for defining Claude MPM agent templates",
5
6
  "type": "object",
6
- "required": ["version", "agent_type"],
7
+ "required": ["schema_version", "agent_id", "agent_version", "agent_type", "metadata", "capabilities", "instructions"],
7
8
  "properties": {
8
- "version": {
9
- "type": "integer",
10
- "description": "Agent template version number",
11
- "minimum": 1
9
+ "schema_version": {
10
+ "type": "string",
11
+ "description": "Schema version for the agent template format",
12
+ "pattern": "^\\d+\\.\\d+\\.\\d+$"
13
+ },
14
+ "agent_id": {
15
+ "type": "string",
16
+ "description": "Unique identifier for the agent",
17
+ "pattern": "^[a-z0-9_]+$"
18
+ },
19
+ "agent_version": {
20
+ "type": "string",
21
+ "description": "Version of the agent template",
22
+ "pattern": "^\\d+\\.\\d+\\.\\d+$"
12
23
  },
13
24
  "agent_type": {
14
25
  "type": "string",
15
- "description": "Type of agent (base or specific agent name)",
26
+ "description": "Type of agent",
16
27
  "enum": ["base", "engineer", "qa", "documentation", "research", "security", "ops", "data_engineer", "version_control"]
17
28
  },
18
- "narrative_fields": {
29
+ "metadata": {
19
30
  "type": "object",
20
- "description": "Narrative content that gets combined between base and specific agents",
31
+ "description": "Agent metadata information",
32
+ "required": ["name", "description", "tags", "created_at", "updated_at"],
21
33
  "properties": {
22
- "when_to_use": {
34
+ "name": {
35
+ "type": "string",
36
+ "description": "Human-readable name of the agent"
37
+ },
38
+ "description": {
39
+ "type": "string",
40
+ "description": "Brief description of the agent's purpose"
41
+ },
42
+ "category": {
43
+ "type": "string",
44
+ "description": "Category the agent belongs to"
45
+ },
46
+ "tags": {
23
47
  "type": "array",
24
48
  "items": {
25
49
  "type": "string"
26
50
  },
27
- "description": "List of when to use this agent - maps to YAML when_to_use section"
51
+ "description": "Tags for categorizing and searching agents"
28
52
  },
29
- "specialized_knowledge": {
30
- "type": "array",
31
- "items": {
32
- "type": "string"
33
- },
34
- "description": "List of specialized knowledge areas - maps to YAML rationale.specialized_knowledge"
53
+ "author": {
54
+ "type": "string",
55
+ "description": "Author or team that created the agent"
35
56
  },
36
- "unique_capabilities": {
57
+ "created_at": {
58
+ "type": "string",
59
+ "description": "Creation timestamp in ISO 8601 format"
60
+ },
61
+ "updated_at": {
62
+ "type": "string",
63
+ "description": "Last update timestamp in ISO 8601 format"
64
+ },
65
+ "specializations": {
37
66
  "type": "array",
38
67
  "items": {
39
68
  "type": "string"
40
69
  },
41
- "description": "List of unique capabilities - maps to YAML rationale.unique_capabilities"
42
- },
43
- "instructions": {
44
- "type": "string",
45
- "description": "Additional markdown instructions for the agent - appears after YAML in system prompt"
70
+ "description": "Agent specializations (used by some agents)"
46
71
  }
47
72
  },
48
73
  "additionalProperties": false
49
74
  },
50
- "configuration_fields": {
75
+ "capabilities": {
51
76
  "type": "object",
52
- "description": "Configuration values where specific agent overrides base agent",
77
+ "description": "Agent capabilities and configuration",
53
78
  "properties": {
54
- "description": {
79
+ "model": {
55
80
  "type": "string",
56
- "description": "Agent description - maps to YAML description field"
57
- },
58
- "tags": {
59
- "type": "array",
60
- "items": {
61
- "type": "string"
62
- },
63
- "description": "Agent tags - maps to YAML tags field"
81
+ "description": "AI model to use for this agent"
64
82
  },
65
83
  "tools": {
66
84
  "type": "array",
67
85
  "items": {
68
86
  "type": "string"
69
87
  },
70
- "description": "Available tools for the agent - maps to YAML tools field"
88
+ "description": "Available tools for the agent"
89
+ },
90
+ "resource_tier": {
91
+ "type": "string",
92
+ "description": "Resource tier for the agent",
93
+ "enum": ["basic", "standard", "intensive", "lightweight"]
94
+ },
95
+ "max_tokens": {
96
+ "type": "integer",
97
+ "minimum": 1,
98
+ "description": "Maximum tokens for responses"
71
99
  },
72
100
  "temperature": {
73
101
  "type": "number",
74
102
  "minimum": 0,
75
103
  "maximum": 1,
76
- "description": "Model temperature setting - maps to YAML temperature field"
104
+ "description": "Model temperature setting"
77
105
  },
78
106
  "timeout": {
79
107
  "type": "integer",
80
108
  "minimum": 1,
81
- "description": "Timeout in seconds - maps to YAML timeout and execution_timeout fields"
82
- },
83
- "max_tokens": {
84
- "type": "integer",
85
- "minimum": 1,
86
- "description": "Maximum tokens for responses - maps to YAML max_tokens field"
109
+ "description": "Timeout in seconds"
87
110
  },
88
111
  "memory_limit": {
89
112
  "type": "integer",
90
113
  "minimum": 1,
91
- "description": "Memory limit in MB - maps to YAML memory_limit field"
114
+ "description": "Memory limit in MB"
92
115
  },
93
116
  "cpu_limit": {
94
117
  "type": "integer",
95
118
  "minimum": 1,
96
119
  "maximum": 100,
97
- "description": "CPU limit percentage - maps to YAML cpu_limit field"
120
+ "description": "CPU limit percentage"
98
121
  },
99
122
  "network_access": {
100
123
  "type": "boolean",
101
- "description": "Whether agent has network access - maps to YAML network_access field"
124
+ "description": "Whether agent has network access"
102
125
  },
103
- "primary_role": {
104
- "type": "string",
105
- "description": "Primary role of the agent - maps to YAML capabilities.primary_role field"
126
+ "file_access": {
127
+ "type": "object",
128
+ "description": "File access permissions",
129
+ "properties": {
130
+ "read_paths": {
131
+ "type": "array",
132
+ "items": {
133
+ "type": "string"
134
+ },
135
+ "description": "Paths the agent can read from"
136
+ },
137
+ "write_paths": {
138
+ "type": "array",
139
+ "items": {
140
+ "type": "string"
141
+ },
142
+ "description": "Paths the agent can write to"
143
+ }
144
+ }
106
145
  },
107
- "specializations": {
146
+ "when_to_use": {
108
147
  "type": "array",
109
148
  "items": {
110
149
  "type": "string"
111
150
  },
112
- "description": "Agent specializations - maps to YAML capabilities.specializations field"
151
+ "description": "List of scenarios when to use this agent"
113
152
  },
114
- "authority": {
115
- "type": "string",
116
- "description": "Authority level of the agent - maps to YAML capabilities.authority field"
153
+ "specialized_knowledge": {
154
+ "type": "array",
155
+ "items": {
156
+ "type": "string"
157
+ },
158
+ "description": "List of specialized knowledge areas"
117
159
  },
118
- "model": {
119
- "type": "string",
120
- "description": "Model to use - maps to YAML model field",
121
- "default": "claude-3-5-sonnet-20241022"
160
+ "unique_capabilities": {
161
+ "type": "array",
162
+ "items": {
163
+ "type": "string"
164
+ },
165
+ "description": "List of unique capabilities"
166
+ }
167
+ },
168
+ "additionalProperties": true
169
+ },
170
+ "configuration": {
171
+ "type": "object",
172
+ "description": "Alternative configuration structure (used by some agents)",
173
+ "additionalProperties": true
174
+ },
175
+ "instructions": {
176
+ "type": "string",
177
+ "description": "Markdown instructions for the agent's behavior"
178
+ },
179
+ "knowledge": {
180
+ "type": "object",
181
+ "description": "Knowledge base for the agent",
182
+ "properties": {
183
+ "domain_expertise": {
184
+ "type": "array",
185
+ "items": {
186
+ "type": "string"
187
+ },
188
+ "description": "Areas of domain expertise"
122
189
  },
123
- "file_access": {
124
- "type": "string",
125
- "description": "File access level - maps to YAML file_access field",
126
- "enum": ["project", "limited", "none"],
127
- "default": "project"
190
+ "best_practices": {
191
+ "type": "array",
192
+ "items": {
193
+ "type": "string"
194
+ },
195
+ "description": "Best practices the agent follows"
128
196
  },
129
- "dangerous_tools": {
130
- "type": "boolean",
131
- "description": "Whether dangerous tools are allowed - maps to YAML dangerous_tools field",
132
- "default": false
197
+ "constraints": {
198
+ "type": "array",
199
+ "items": {
200
+ "type": "string"
201
+ },
202
+ "description": "Constraints on the agent's behavior"
133
203
  },
134
- "review_required": {
135
- "type": "boolean",
136
- "description": "Whether review is required - maps to YAML review_required field",
137
- "default": false
204
+ "examples": {
205
+ "type": "array",
206
+ "items": {
207
+ "type": "object"
208
+ },
209
+ "description": "Example scenarios or code"
210
+ }
211
+ },
212
+ "additionalProperties": false
213
+ },
214
+ "interactions": {
215
+ "type": "object",
216
+ "description": "Agent interaction configurations",
217
+ "properties": {
218
+ "input_format": {
219
+ "type": "object",
220
+ "properties": {
221
+ "required_fields": {
222
+ "type": "array",
223
+ "items": {
224
+ "type": "string"
225
+ }
226
+ },
227
+ "optional_fields": {
228
+ "type": "array",
229
+ "items": {
230
+ "type": "string"
231
+ }
232
+ }
233
+ }
138
234
  },
139
- "team": {
140
- "type": "string",
141
- "description": "Team name - maps to YAML team field",
142
- "default": "mpm-framework"
235
+ "output_format": {
236
+ "type": "object",
237
+ "properties": {
238
+ "structure": {
239
+ "type": "string"
240
+ },
241
+ "includes": {
242
+ "type": "array",
243
+ "items": {
244
+ "type": "string"
245
+ }
246
+ }
247
+ }
143
248
  },
144
- "project": {
145
- "type": "string",
146
- "description": "Project name - maps to YAML project field",
147
- "default": "claude-mpm"
249
+ "handoff_agents": {
250
+ "type": "array",
251
+ "items": {
252
+ "type": "string"
253
+ },
254
+ "description": "Agents this agent can hand off to"
148
255
  },
149
- "priority": {
150
- "type": "string",
151
- "description": "Priority level - maps to YAML priority field",
152
- "enum": ["low", "medium", "high"],
153
- "default": "high"
256
+ "triggers": {
257
+ "type": "array",
258
+ "items": {
259
+ "type": "object"
260
+ },
261
+ "description": "Triggers for agent activation"
262
+ }
263
+ },
264
+ "additionalProperties": false
265
+ },
266
+ "testing": {
267
+ "type": "object",
268
+ "description": "Testing configuration for the agent",
269
+ "properties": {
270
+ "test_cases": {
271
+ "type": "array",
272
+ "items": {
273
+ "type": "object",
274
+ "properties": {
275
+ "name": {
276
+ "type": "string"
277
+ },
278
+ "input": {
279
+ "type": "string"
280
+ },
281
+ "expected_behavior": {
282
+ "type": "string"
283
+ },
284
+ "validation_criteria": {
285
+ "type": "array",
286
+ "items": {
287
+ "type": "string"
288
+ }
289
+ }
290
+ }
291
+ }
292
+ },
293
+ "performance_benchmarks": {
294
+ "type": "object",
295
+ "properties": {
296
+ "response_time": {
297
+ "type": "number"
298
+ },
299
+ "token_usage": {
300
+ "type": "integer"
301
+ },
302
+ "success_rate": {
303
+ "type": "number",
304
+ "minimum": 0,
305
+ "maximum": 1
306
+ }
307
+ }
154
308
  }
155
309
  },
156
310
  "additionalProperties": false
@@ -1,6 +1,8 @@
1
1
  {
2
- "id": "data_engineer",
3
- "version": "1.0.0",
2
+ "schema_version": "1.2.0",
3
+ "agent_id": "data_engineer_agent",
4
+ "agent_version": "1.2.0",
5
+ "agent_type": "data_engineer",
4
6
  "metadata": {
5
7
  "name": "Data Engineer Agent",
6
8
  "description": "Data engineering and AI API integrations",
@@ -25,7 +27,8 @@
25
27
  "Grep",
26
28
  "Glob",
27
29
  "LS",
28
- "WebSearch"
30
+ "WebSearch",
31
+ "TodoWrite"
29
32
  ],
30
33
  "resource_tier": "intensive",
31
34
  "max_tokens": 8192,
@@ -1,6 +1,8 @@
1
1
  {
2
- "id": "documentation",
3
- "version": "1.0.0",
2
+ "schema_version": "1.2.0",
3
+ "agent_id": "documentation_agent",
4
+ "agent_version": "1.1.0",
5
+ "agent_type": "documentation",
4
6
  "metadata": {
5
7
  "name": "Documentation Agent",
6
8
  "description": "Documentation creation and maintenance",
@@ -25,7 +27,8 @@
25
27
  "Grep",
26
28
  "Glob",
27
29
  "LS",
28
- "WebSearch"
30
+ "WebSearch",
31
+ "TodoWrite"
29
32
  ],
30
33
  "resource_tier": "lightweight",
31
34
  "max_tokens": 8192,
@@ -1,6 +1,8 @@
1
1
  {
2
- "id": "engineer",
3
- "version": "1.0.0",
2
+ "schema_version": "1.2.0",
3
+ "agent_id": "engineer_agent",
4
+ "agent_version": "1.1.0",
5
+ "agent_type": "engineer",
4
6
  "metadata": {
5
7
  "name": "Engineer Agent",
6
8
  "description": "Research-guided code implementation with pattern adherence",
@@ -27,11 +29,12 @@
27
29
  "Grep",
28
30
  "Glob",
29
31
  "LS",
30
- "WebSearch"
32
+ "WebSearch",
33
+ "TodoWrite"
31
34
  ],
32
35
  "resource_tier": "intensive",
33
36
  "max_tokens": 12288,
34
- "temperature": 0.05,
37
+ "temperature": 0.2,
35
38
  "timeout": 1200,
36
39
  "memory_limit": 6144,
37
40
  "cpu_limit": 80,
@@ -1,6 +1,8 @@
1
1
  {
2
- "id": "ops",
3
- "version": "1.0.0",
2
+ "schema_version": "1.2.0",
3
+ "agent_id": "ops_agent",
4
+ "agent_version": "1.1.0",
5
+ "agent_type": "ops",
4
6
  "metadata": {
5
7
  "name": "Ops Agent",
6
8
  "description": "Operations, deployment, and infrastructure",
@@ -24,7 +26,8 @@
24
26
  "Bash",
25
27
  "Grep",
26
28
  "Glob",
27
- "LS"
29
+ "LS",
30
+ "TodoWrite"
28
31
  ],
29
32
  "resource_tier": "standard",
30
33
  "max_tokens": 8192,
@@ -1,6 +1,8 @@
1
1
  {
2
- "id": "qa",
3
- "version": "1.0.0",
2
+ "schema_version": "1.2.0",
3
+ "agent_id": "qa_agent",
4
+ "agent_version": "2.3.0",
5
+ "agent_type": "qa",
4
6
  "metadata": {
5
7
  "name": "Qa Agent",
6
8
  "description": "Quality assurance and testing validation",
@@ -24,11 +26,12 @@
24
26
  "Bash",
25
27
  "Grep",
26
28
  "Glob",
27
- "LS"
29
+ "LS",
30
+ "TodoWrite"
28
31
  ],
29
32
  "resource_tier": "standard",
30
33
  "max_tokens": 8192,
31
- "temperature": 0.05,
34
+ "temperature": 0.0,
32
35
  "timeout": 600,
33
36
  "memory_limit": 3072,
34
37
  "cpu_limit": 50,
@@ -38,7 +41,9 @@
38
41
  "./"
39
42
  ],
40
43
  "write_paths": [
41
- "./"
44
+ "./tests/",
45
+ "./test/",
46
+ "./scripts/"
42
47
  ]
43
48
  }
44
49
  },