claude-mpm 3.3.0__py3-none-any.whl → 3.4.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.
- claude_mpm/agents/templates/data_engineer.json +1 -1
- claude_mpm/agents/templates/documentation.json +1 -1
- claude_mpm/agents/templates/engineer.json +1 -1
- claude_mpm/agents/templates/ops.json +1 -1
- claude_mpm/agents/templates/pm.json +1 -1
- claude_mpm/agents/templates/qa.json +1 -1
- claude_mpm/agents/templates/research.json +1 -1
- claude_mpm/agents/templates/security.json +1 -1
- claude_mpm/agents/templates/test_integration.json +112 -0
- claude_mpm/agents/templates/version_control.json +1 -1
- claude_mpm/cli/commands/memory.py +749 -26
- claude_mpm/cli/commands/run.py +115 -14
- claude_mpm/cli/parser.py +89 -1
- claude_mpm/constants.py +6 -0
- claude_mpm/core/claude_runner.py +74 -11
- claude_mpm/core/config.py +1 -1
- claude_mpm/core/session_manager.py +46 -0
- claude_mpm/core/simple_runner.py +74 -11
- claude_mpm/hooks/builtin/mpm_command_hook.py +5 -5
- claude_mpm/hooks/claude_hooks/hook_handler.py +213 -30
- claude_mpm/hooks/claude_hooks/hook_wrapper.sh +9 -2
- claude_mpm/hooks/memory_integration_hook.py +51 -5
- claude_mpm/services/__init__.py +23 -5
- claude_mpm/services/agent_memory_manager.py +800 -71
- claude_mpm/services/memory_builder.py +823 -0
- claude_mpm/services/memory_optimizer.py +619 -0
- claude_mpm/services/memory_router.py +445 -0
- claude_mpm/services/project_analyzer.py +771 -0
- claude_mpm/services/socketio_server.py +649 -45
- claude_mpm/services/version_control/git_operations.py +26 -0
- claude_mpm-3.4.0.dist-info/METADATA +183 -0
- {claude_mpm-3.3.0.dist-info → claude_mpm-3.4.0.dist-info}/RECORD +36 -52
- claude_mpm/agents/agent-template.yaml +0 -83
- claude_mpm/agents/templates/test-integration-agent.md +0 -34
- claude_mpm/agents/test_fix_deployment/.claude-pm/config/project.json +0 -6
- claude_mpm/cli/README.md +0 -109
- claude_mpm/cli_module/refactoring_guide.md +0 -253
- claude_mpm/core/agent_registry.py.bak +0 -312
- claude_mpm/core/base_service.py.bak +0 -406
- claude_mpm/core/websocket_handler.py +0 -233
- claude_mpm/hooks/README.md +0 -97
- claude_mpm/orchestration/SUBPROCESS_DESIGN.md +0 -66
- claude_mpm/schemas/README_SECURITY.md +0 -92
- claude_mpm/schemas/agent_schema.json +0 -395
- claude_mpm/schemas/agent_schema_documentation.md +0 -181
- claude_mpm/schemas/agent_schema_security_notes.md +0 -165
- claude_mpm/schemas/examples/standard_workflow.json +0 -505
- claude_mpm/schemas/ticket_workflow_documentation.md +0 -482
- claude_mpm/schemas/ticket_workflow_schema.json +0 -590
- claude_mpm/services/framework_claude_md_generator/README.md +0 -92
- claude_mpm/services/parent_directory_manager/README.md +0 -83
- claude_mpm/services/version_control/VERSION +0 -1
- claude_mpm/services/websocket_server.py +0 -376
- claude_mpm-3.3.0.dist-info/METADATA +0 -432
- {claude_mpm-3.3.0.dist-info → claude_mpm-3.4.0.dist-info}/WHEEL +0 -0
- {claude_mpm-3.3.0.dist-info → claude_mpm-3.4.0.dist-info}/entry_points.txt +0 -0
- {claude_mpm-3.3.0.dist-info → claude_mpm-3.4.0.dist-info}/licenses/LICENSE +0 -0
- {claude_mpm-3.3.0.dist-info → claude_mpm-3.4.0.dist-info}/top_level.txt +0 -0
|
@@ -1,181 +0,0 @@
|
|
|
1
|
-
# Agent Schema Documentation
|
|
2
|
-
|
|
3
|
-
This document preserves the inline documentation from the agent_schema.json file. The JSON Schema itself must remain comment-free for proper parsing.
|
|
4
|
-
|
|
5
|
-
## Schema Version 1.2.0
|
|
6
|
-
|
|
7
|
-
### Required Fields
|
|
8
|
-
|
|
9
|
-
- **schema_version**: Must match the schema version this agent was built for
|
|
10
|
-
- **agent_id**: Unique identifier for the agent type
|
|
11
|
-
- **agent_version**: Semantic version of this specific agent template
|
|
12
|
-
- **agent_type**: Categorizes the agent's primary function
|
|
13
|
-
- **metadata**: Human-readable information about the agent
|
|
14
|
-
- **capabilities**: Technical specifications and resource requirements
|
|
15
|
-
- **instructions**: System prompt that defines agent behavior
|
|
16
|
-
|
|
17
|
-
### Field Descriptions
|
|
18
|
-
|
|
19
|
-
#### schema_version
|
|
20
|
-
- **Pattern**: `^\d+\.\d+\.\d+$` (Enforces semantic versioning format X.Y.Z)
|
|
21
|
-
- **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.
|
|
22
|
-
- **Examples**: "1.0.0", "1.2.0"
|
|
23
|
-
|
|
24
|
-
#### agent_id
|
|
25
|
-
- **Pattern**: `^[a-z][a-z0-9_]*$` (Must start with lowercase letter, followed by lowercase letters, numbers, or underscores)
|
|
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
|
-
- **Pattern**: `^\d+\.\d+\.\d+$` (Enforces semantic versioning for agent templates)
|
|
31
|
-
- **Description**: Semantic version of the agent template itself (not the schema). Increment major for breaking changes, minor for new features, patch for bug fixes.
|
|
32
|
-
- **Examples**: "1.0.0", "2.1.3"
|
|
33
|
-
|
|
34
|
-
#### agent_type
|
|
35
|
-
- **Description**: Type of agent that determines its primary function and default capabilities. This categorization helps in agent discovery and capability matching.
|
|
36
|
-
- **Enum values**:
|
|
37
|
-
- `base`: Generic agent with no specialization
|
|
38
|
-
- `engineer`: Code implementation and development
|
|
39
|
-
- `qa`: Quality assurance and testing
|
|
40
|
-
- `documentation`: Documentation creation and maintenance
|
|
41
|
-
- `research`: Code analysis and research
|
|
42
|
-
- `security`: Security analysis and vulnerability detection
|
|
43
|
-
- `ops`: Operations and infrastructure management
|
|
44
|
-
- `data_engineer`: Data pipeline and ETL development
|
|
45
|
-
- `version_control`: Git and version control operations
|
|
46
|
-
|
|
47
|
-
### Metadata Object
|
|
48
|
-
|
|
49
|
-
#### Required metadata fields:
|
|
50
|
-
- **name**: Human-readable name for UI display
|
|
51
|
-
- **description**: Brief explanation of agent's purpose
|
|
52
|
-
- **tags**: Searchable tags for agent discovery
|
|
53
|
-
|
|
54
|
-
#### Metadata field constraints:
|
|
55
|
-
- **name**:
|
|
56
|
-
- minLength: 3 (Minimum 3 characters for meaningful names)
|
|
57
|
-
- maxLength: 50 (Maximum 50 characters to prevent UI overflow)
|
|
58
|
-
- **description**:
|
|
59
|
-
- minLength: 10 (Minimum 10 characters to ensure meaningful descriptions)
|
|
60
|
-
- maxLength: 200 (Maximum 200 characters for conciseness)
|
|
61
|
-
- **tags**:
|
|
62
|
-
- Pattern: `^[a-z][a-z0-9-]*$` (Lowercase letters, numbers, and hyphens only)
|
|
63
|
-
- minItems: 1 (At least one tag required for discovery)
|
|
64
|
-
- maxItems: 10 (Maximum 10 tags to prevent over-tagging)
|
|
65
|
-
- uniqueItems: true (No duplicate tags allowed)
|
|
66
|
-
|
|
67
|
-
### Capabilities Object
|
|
68
|
-
|
|
69
|
-
#### Required capabilities fields:
|
|
70
|
-
- **model**: Claude model version to use
|
|
71
|
-
- **tools**: Array of allowed tools for the agent
|
|
72
|
-
- **resource_tier**: Resource allocation category
|
|
73
|
-
|
|
74
|
-
#### Model Options
|
|
75
|
-
Available Claude models grouped by performance tier:
|
|
76
|
-
|
|
77
|
-
**Haiku models** (fastest, most cost-effective):
|
|
78
|
-
- claude-3-haiku-20240307
|
|
79
|
-
- claude-3-5-haiku-20241022
|
|
80
|
-
|
|
81
|
-
**Sonnet models** (balanced performance):
|
|
82
|
-
- claude-3-sonnet-20240229
|
|
83
|
-
- claude-3-5-sonnet-20241022
|
|
84
|
-
- claude-3-5-sonnet-20240620
|
|
85
|
-
- claude-sonnet-4-20250514
|
|
86
|
-
- claude-4-sonnet-20250514
|
|
87
|
-
|
|
88
|
-
**Opus models** (highest capability):
|
|
89
|
-
- claude-3-opus-20240229
|
|
90
|
-
- claude-opus-4-20250514
|
|
91
|
-
- claude-4-opus-20250514
|
|
92
|
-
|
|
93
|
-
#### Available Tools
|
|
94
|
-
Tools are grouped by functionality:
|
|
95
|
-
|
|
96
|
-
**File operations**:
|
|
97
|
-
- `Read`: Read file contents
|
|
98
|
-
- `Write`: Write new files
|
|
99
|
-
- `Edit`: Edit existing files
|
|
100
|
-
- `MultiEdit`: Multiple edits in one operation
|
|
101
|
-
|
|
102
|
-
**Search and navigation**:
|
|
103
|
-
- `Grep`: Search file contents
|
|
104
|
-
- `Glob`: Find files by pattern
|
|
105
|
-
- `LS`: List directory contents
|
|
106
|
-
|
|
107
|
-
**System operations**:
|
|
108
|
-
- `Bash`: Execute shell commands
|
|
109
|
-
|
|
110
|
-
**Web operations**:
|
|
111
|
-
- `WebSearch`: Search the web
|
|
112
|
-
- `WebFetch`: Fetch web content
|
|
113
|
-
|
|
114
|
-
**Notebook operations**:
|
|
115
|
-
- `NotebookRead`: Read Jupyter notebooks
|
|
116
|
-
- `NotebookEdit`: Edit Jupyter notebooks
|
|
117
|
-
|
|
118
|
-
**Workflow operations**:
|
|
119
|
-
- `TodoWrite`: Manage task lists
|
|
120
|
-
- `ExitPlanMode`: Exit planning mode
|
|
121
|
-
|
|
122
|
-
**CLI tools** (future expansion):
|
|
123
|
-
- `git`: Git operations
|
|
124
|
-
- `docker`: Docker commands
|
|
125
|
-
- `kubectl`: Kubernetes operations
|
|
126
|
-
- `terraform`: Infrastructure as code
|
|
127
|
-
- `aws`: AWS CLI
|
|
128
|
-
- `gcloud`: Google Cloud CLI
|
|
129
|
-
- `azure`: Azure CLI
|
|
130
|
-
|
|
131
|
-
#### Resource Tiers
|
|
132
|
-
Resource allocation tiers determine memory, CPU, and timeout limits:
|
|
133
|
-
|
|
134
|
-
- **basic**: Default resources for simple tasks
|
|
135
|
-
- **standard**: Medium resources for typical operations
|
|
136
|
-
- **intensive**: High resources for complex tasks
|
|
137
|
-
- **lightweight**: Minimal resources for quick operations
|
|
138
|
-
|
|
139
|
-
#### Capability Constraints
|
|
140
|
-
|
|
141
|
-
**max_tokens**:
|
|
142
|
-
- minimum: 1000 (Minimum for meaningful responses)
|
|
143
|
-
- maximum: 200000 (Maximum supported by Claude models)
|
|
144
|
-
- default: 8192 (Default suitable for most tasks)
|
|
145
|
-
|
|
146
|
-
**temperature**:
|
|
147
|
-
- minimum: 0 (0 = deterministic, focused)
|
|
148
|
-
- maximum: 1 (1 = creative, varied)
|
|
149
|
-
- default: 0.7 (Balanced default)
|
|
150
|
-
|
|
151
|
-
**timeout**:
|
|
152
|
-
- minimum: 30 (Minimum 30 seconds for basic operations)
|
|
153
|
-
- maximum: 3600 (Maximum 1 hour for long-running tasks)
|
|
154
|
-
- default: 300 (Default 5 minutes)
|
|
155
|
-
|
|
156
|
-
### Instructions Field
|
|
157
|
-
- **minLength**: 100 (Minimum to ensure meaningful instructions)
|
|
158
|
-
- **maxLength**: 8000 (Maximum to fit within context limits)
|
|
159
|
-
- **Description**: Agent system instructions that define behavior, approach, and constraints. This becomes the agent's system prompt.
|
|
160
|
-
|
|
161
|
-
### Additional Properties
|
|
162
|
-
- **additionalProperties**: false (Strict validation - no extra properties allowed)
|
|
163
|
-
|
|
164
|
-
## Resource Tier Definitions
|
|
165
|
-
|
|
166
|
-
These definitions provide guidance for resource allocation (not enforced by schema but used by runtime):
|
|
167
|
-
|
|
168
|
-
### Intensive Tier
|
|
169
|
-
- memory_limit: 4096-8192 MB
|
|
170
|
-
- cpu_limit: 60-100%
|
|
171
|
-
- timeout: 600-3600 seconds
|
|
172
|
-
|
|
173
|
-
### Standard Tier
|
|
174
|
-
- memory_limit: 2048-4096 MB
|
|
175
|
-
- cpu_limit: 30-60%
|
|
176
|
-
- timeout: 300-1200 seconds
|
|
177
|
-
|
|
178
|
-
### Lightweight Tier
|
|
179
|
-
- memory_limit: 512-2048 MB
|
|
180
|
-
- cpu_limit: 10-30%
|
|
181
|
-
- timeout: 30-600 seconds
|
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
# Security Analysis: Agent Schema and Validation System
|
|
2
|
-
|
|
3
|
-
## Overview
|
|
4
|
-
This document provides a comprehensive security analysis of the claude-mpm agent validation system, highlighting security features, considerations, and recommendations.
|
|
5
|
-
|
|
6
|
-
## Schema Security Features (agent_schema.json)
|
|
7
|
-
|
|
8
|
-
### 1. Input Validation
|
|
9
|
-
- **Strict Type Enforcement**: All fields have explicit types preventing type confusion attacks
|
|
10
|
-
- **Pattern Validation**: Agent IDs use pattern `^[a-z][a-z0-9_]*$` preventing injection attacks
|
|
11
|
-
- **Enum Restrictions**: Tools and models restricted to known safe values
|
|
12
|
-
- **Length Limits**: All string fields have min/max length to prevent memory exhaustion
|
|
13
|
-
- Instructions: max 8000 characters
|
|
14
|
-
- Name: max 50 characters
|
|
15
|
-
- Description: max 200 characters
|
|
16
|
-
|
|
17
|
-
### 2. Resource Controls
|
|
18
|
-
- **Memory Limits**: 512MB-8192MB range prevents OOM attacks
|
|
19
|
-
- **CPU Limits**: 10%-100% prevents resource hogging
|
|
20
|
-
- **Timeout Limits**: 30s-3600s prevents infinite operations
|
|
21
|
-
- **Token Limits**: 1000-200000 prevents API abuse
|
|
22
|
-
|
|
23
|
-
### 3. Access Controls
|
|
24
|
-
- **Network Access**: Default false, explicit opt-in required
|
|
25
|
-
- **File Access Paths**: Explicit read/write path restrictions
|
|
26
|
-
- **Tool Access**: Enumerated list prevents arbitrary tool usage
|
|
27
|
-
- **Additional Properties**: Set to false preventing field injection
|
|
28
|
-
|
|
29
|
-
### 4. Dangerous Tool Combinations
|
|
30
|
-
The schema allows these potentially dangerous combinations:
|
|
31
|
-
- **Bash + Write**: Can create and execute arbitrary scripts
|
|
32
|
-
- **docker + kubectl**: Container escape potential
|
|
33
|
-
- **aws + gcloud + azure**: Multiple cloud access increases attack surface
|
|
34
|
-
|
|
35
|
-
## Validator Security Features (agent_validator.py)
|
|
36
|
-
|
|
37
|
-
### 1. File Operation Security
|
|
38
|
-
- **Path Validation**: Checks file exists and is regular file
|
|
39
|
-
- **File Size Limits**: 1MB max prevents memory exhaustion
|
|
40
|
-
- **Symlink Protection**: Skips symlinks to prevent directory traversal
|
|
41
|
-
- **Directory Limits**: Max 100 files per directory prevents DoS
|
|
42
|
-
|
|
43
|
-
### 2. Business Rule Security
|
|
44
|
-
- **Double Validation**: Schema + business rules for defense in depth
|
|
45
|
-
- **ID Format Checking**: Additional validation beyond schema pattern
|
|
46
|
-
- **Resource Tier Validation**: Ensures limits match tier constraints
|
|
47
|
-
- **Tool Compatibility**: Validates dangerous tool combinations
|
|
48
|
-
|
|
49
|
-
### 3. Migration Security
|
|
50
|
-
- **Privilege Escalation Prevention**: Flags dangerous tools added during migration
|
|
51
|
-
- **Functionality Preservation**: Ensures security constraints maintained
|
|
52
|
-
- **Instruction Validation**: Prevents loss of security instructions
|
|
53
|
-
|
|
54
|
-
## Security Recommendations
|
|
55
|
-
|
|
56
|
-
### 1. Immediate Improvements
|
|
57
|
-
```python
|
|
58
|
-
# Add to validator.py
|
|
59
|
-
def _validate_path_injection(self, path: str) -> bool:
|
|
60
|
-
"""Prevent path traversal attacks"""
|
|
61
|
-
if '..' in path or path.startswith('/'):
|
|
62
|
-
return False
|
|
63
|
-
return True
|
|
64
|
-
|
|
65
|
-
def _validate_command_injection(self, value: str) -> bool:
|
|
66
|
-
"""Prevent command injection in string values"""
|
|
67
|
-
dangerous_chars = ['$', '`', ';', '&', '|', '>', '<']
|
|
68
|
-
return not any(char in value for char in dangerous_chars)
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
### 2. Schema Enhancements
|
|
72
|
-
```json
|
|
73
|
-
{
|
|
74
|
-
"capabilities": {
|
|
75
|
-
"properties": {
|
|
76
|
-
"sandbox_mode": {
|
|
77
|
-
"type": "boolean",
|
|
78
|
-
"default": true,
|
|
79
|
-
"description": "Run agent in sandboxed environment"
|
|
80
|
-
},
|
|
81
|
-
"max_file_size": {
|
|
82
|
-
"type": "integer",
|
|
83
|
-
"default": 10485760,
|
|
84
|
-
"description": "Maximum file size agent can read/write (10MB default)"
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
### 3. Audit Logging
|
|
92
|
-
```python
|
|
93
|
-
def validate_agent(self, agent_data: Dict[str, Any]) -> ValidationResult:
|
|
94
|
-
# Add security audit logging
|
|
95
|
-
audit_log = {
|
|
96
|
-
"timestamp": datetime.utcnow().isoformat(),
|
|
97
|
-
"agent_id": agent_data.get("id"),
|
|
98
|
-
"tools": agent_data.get("capabilities", {}).get("tools", []),
|
|
99
|
-
"network_access": agent_data.get("capabilities", {}).get("network_access", False),
|
|
100
|
-
"validation_result": "pending"
|
|
101
|
-
}
|
|
102
|
-
# Log to security audit trail
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
### 4. Runtime Security Checks
|
|
106
|
-
- Implement runtime validation of actual tool usage vs declared tools
|
|
107
|
-
- Monitor resource usage against declared limits
|
|
108
|
-
- Validate file access against declared paths
|
|
109
|
-
- Check for privilege escalation attempts
|
|
110
|
-
|
|
111
|
-
## Potential Security Issues
|
|
112
|
-
|
|
113
|
-
### 1. Missing Validations
|
|
114
|
-
- No validation of hook configurations
|
|
115
|
-
- No validation of file path patterns for malicious patterns
|
|
116
|
-
- No rate limiting on validation operations
|
|
117
|
-
- No cryptographic signing of agent configurations
|
|
118
|
-
|
|
119
|
-
### 2. Information Disclosure
|
|
120
|
-
- Error messages may reveal system paths
|
|
121
|
-
- Schema version in metadata could aid attackers
|
|
122
|
-
- No sanitization of user-provided descriptions
|
|
123
|
-
|
|
124
|
-
### 3. Trust Boundaries
|
|
125
|
-
- No verification of agent template sources
|
|
126
|
-
- No integrity checking of loaded schemas
|
|
127
|
-
- Migration process trusts old configurations
|
|
128
|
-
|
|
129
|
-
## Security Best Practices for Agent Authors
|
|
130
|
-
|
|
131
|
-
1. **Principle of Least Privilege**: Only request tools actually needed
|
|
132
|
-
2. **Avoid Dangerous Combinations**: Don't combine Bash with Write unless essential
|
|
133
|
-
3. **Explicit Path Restrictions**: Always specify file access paths
|
|
134
|
-
4. **Network Isolation**: Only enable network_access when required
|
|
135
|
-
5. **Resource Limits**: Set appropriate limits for agent workload
|
|
136
|
-
6. **Input Sanitization**: Never trust user input in agent instructions
|
|
137
|
-
7. **Secure Defaults**: Start with minimal permissions and add as needed
|
|
138
|
-
|
|
139
|
-
## Compliance Considerations
|
|
140
|
-
|
|
141
|
-
### OWASP Top 10 Coverage
|
|
142
|
-
- **A01:2021 Broken Access Control**: ✓ Tool and file access restrictions
|
|
143
|
-
- **A02:2021 Cryptographic Failures**: ⚠️ No encryption of agent configs
|
|
144
|
-
- **A03:2021 Injection**: ✓ Pattern validation, enum restrictions
|
|
145
|
-
- **A04:2021 Insecure Design**: ✓ Defense in depth validation
|
|
146
|
-
- **A05:2021 Security Misconfiguration**: ✓ Secure defaults, explicit opt-in
|
|
147
|
-
- **A06:2021 Vulnerable Components**: ⚠️ No component version checking
|
|
148
|
-
- **A07:2021 Identification and Authentication**: N/A (handled elsewhere)
|
|
149
|
-
- **A08:2021 Software and Data Integrity**: ⚠️ No integrity verification
|
|
150
|
-
- **A09:2021 Security Logging**: ⚠️ Limited security event logging
|
|
151
|
-
- **A10:2021 SSRF**: ✓ Network access controls
|
|
152
|
-
|
|
153
|
-
## Conclusion
|
|
154
|
-
|
|
155
|
-
The claude-mpm validation system implements strong security controls through:
|
|
156
|
-
- Strict schema validation with type safety
|
|
157
|
-
- Resource limits preventing DoS attacks
|
|
158
|
-
- Access controls for tools and files
|
|
159
|
-
- Defense in depth with multiple validation layers
|
|
160
|
-
|
|
161
|
-
Key areas for improvement:
|
|
162
|
-
- Cryptographic signing of configurations
|
|
163
|
-
- Enhanced audit logging
|
|
164
|
-
- Runtime security monitoring
|
|
165
|
-
- Integrity verification
|