claude-mpm 3.9.9__py3-none-any.whl → 3.9.11__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/VERSION +1 -1
- claude_mpm/agents/templates/memory_manager.json +155 -0
- claude_mpm/cli/__init__.py +15 -2
- claude_mpm/cli/commands/__init__.py +3 -0
- claude_mpm/cli/commands/mcp.py +280 -134
- claude_mpm/cli/commands/run_guarded.py +511 -0
- claude_mpm/cli/parser.py +8 -2
- claude_mpm/config/experimental_features.py +219 -0
- claude_mpm/config/memory_guardian_yaml.py +335 -0
- claude_mpm/constants.py +1 -0
- claude_mpm/core/memory_aware_runner.py +353 -0
- claude_mpm/services/infrastructure/context_preservation.py +537 -0
- claude_mpm/services/infrastructure/graceful_degradation.py +616 -0
- claude_mpm/services/infrastructure/health_monitor.py +775 -0
- claude_mpm/services/infrastructure/memory_dashboard.py +479 -0
- claude_mpm/services/infrastructure/memory_guardian.py +189 -15
- claude_mpm/services/infrastructure/restart_protection.py +642 -0
- claude_mpm/services/infrastructure/state_manager.py +774 -0
- claude_mpm/services/mcp_gateway/__init__.py +11 -11
- claude_mpm/services/mcp_gateway/core/__init__.py +2 -2
- claude_mpm/services/mcp_gateway/core/interfaces.py +10 -9
- claude_mpm/services/mcp_gateway/main.py +35 -5
- claude_mpm/services/mcp_gateway/manager.py +334 -0
- claude_mpm/services/mcp_gateway/registry/service_registry.py +4 -8
- claude_mpm/services/mcp_gateway/server/__init__.py +2 -2
- claude_mpm/services/mcp_gateway/server/{mcp_server.py → mcp_gateway.py} +60 -59
- claude_mpm/services/mcp_gateway/tools/base_adapter.py +1 -2
- claude_mpm/services/ticket_manager.py +8 -8
- claude_mpm/services/ticket_manager_di.py +5 -5
- claude_mpm/storage/__init__.py +9 -0
- claude_mpm/storage/state_storage.py +556 -0
- {claude_mpm-3.9.9.dist-info → claude_mpm-3.9.11.dist-info}/METADATA +25 -2
- {claude_mpm-3.9.9.dist-info → claude_mpm-3.9.11.dist-info}/RECORD +37 -24
- claude_mpm/services/mcp_gateway/server/mcp_server_simple.py +0 -444
- {claude_mpm-3.9.9.dist-info → claude_mpm-3.9.11.dist-info}/WHEEL +0 -0
- {claude_mpm-3.9.9.dist-info → claude_mpm-3.9.11.dist-info}/entry_points.txt +0 -0
- {claude_mpm-3.9.9.dist-info → claude_mpm-3.9.11.dist-info}/licenses/LICENSE +0 -0
- {claude_mpm-3.9.9.dist-info → claude_mpm-3.9.11.dist-info}/top_level.txt +0 -0
claude_mpm/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
3.9.
|
|
1
|
+
3.9.11
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schema_version": "1.2.0",
|
|
3
|
+
"agent_id": "memory-manager-agent",
|
|
4
|
+
"agent_version": "1.0.0",
|
|
5
|
+
"agent_type": "memory_manager",
|
|
6
|
+
"metadata": {
|
|
7
|
+
"name": "Memory Manager Agent",
|
|
8
|
+
"description": "Manages project-specific agent memories for improved context retention and knowledge accumulation",
|
|
9
|
+
"created_at": "2025-08-16T00:00:00.000000Z",
|
|
10
|
+
"updated_at": "2025-08-16T00:00:00.000000Z",
|
|
11
|
+
"tags": [
|
|
12
|
+
"memory",
|
|
13
|
+
"knowledge-management",
|
|
14
|
+
"context-retention",
|
|
15
|
+
"agent-memories",
|
|
16
|
+
"optimization"
|
|
17
|
+
],
|
|
18
|
+
"category": "infrastructure",
|
|
19
|
+
"color": "indigo"
|
|
20
|
+
},
|
|
21
|
+
"capabilities": {
|
|
22
|
+
"model": "sonnet",
|
|
23
|
+
"tools": [
|
|
24
|
+
"Read",
|
|
25
|
+
"Write",
|
|
26
|
+
"Edit",
|
|
27
|
+
"MultiEdit",
|
|
28
|
+
"Grep",
|
|
29
|
+
"Glob",
|
|
30
|
+
"LS",
|
|
31
|
+
"TodoWrite"
|
|
32
|
+
],
|
|
33
|
+
"resource_tier": "lightweight",
|
|
34
|
+
"temperature": 0.2,
|
|
35
|
+
"max_tokens": 8192,
|
|
36
|
+
"timeout": 600,
|
|
37
|
+
"memory_limit": 2048,
|
|
38
|
+
"cpu_limit": 20,
|
|
39
|
+
"network_access": false,
|
|
40
|
+
"file_access": {
|
|
41
|
+
"read_paths": [
|
|
42
|
+
".claude-mpm/memories/"
|
|
43
|
+
],
|
|
44
|
+
"write_paths": [
|
|
45
|
+
".claude-mpm/memories/"
|
|
46
|
+
]
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
"knowledge": {
|
|
50
|
+
"domain_expertise": [
|
|
51
|
+
"Agent memory file management and optimization",
|
|
52
|
+
"Memory token limit management (18k tokens maximum)",
|
|
53
|
+
"Memory consolidation and deduplication strategies",
|
|
54
|
+
"Context-aware memory pruning techniques",
|
|
55
|
+
"Cross-agent memory integration patterns",
|
|
56
|
+
"Memory verification and validation protocols",
|
|
57
|
+
"Memory format standardization and best practices"
|
|
58
|
+
],
|
|
59
|
+
"best_practices": [
|
|
60
|
+
"Keep memories terse and specific - single line facts",
|
|
61
|
+
"Verify memory accuracy with Research agent when needed",
|
|
62
|
+
"Consolidate redundant memories to save token space",
|
|
63
|
+
"Organize memories by agent role and responsibility",
|
|
64
|
+
"Maintain backward compatibility when updating memory formats",
|
|
65
|
+
"Regular memory audits to remove outdated information",
|
|
66
|
+
"Prioritize recent and frequently accessed memories"
|
|
67
|
+
],
|
|
68
|
+
"constraints": [
|
|
69
|
+
"Total memory must stay under 18k tokens when consolidated",
|
|
70
|
+
"Memory files must be in .claude-mpm/memories/ directory",
|
|
71
|
+
"Each agent has separate memory file (pm.md, engineer.md, etc.)",
|
|
72
|
+
"Memory format must be single-line facts and behaviors",
|
|
73
|
+
"Cannot delete critical system memories without confirmation",
|
|
74
|
+
"Must maintain memory file integrity and structure"
|
|
75
|
+
]
|
|
76
|
+
},
|
|
77
|
+
"instructions": "# Memory Manager Agent\n\nManage and optimize project-specific agent memories to enhance context retention and knowledge accumulation across the Claude MPM system.\n\n## Primary Responsibilities\n\n### Memory Management Core Functions\n1. **List**: Display existing memories for each agent with token counts\n2. **Update**: Add new memories to specific agent files following format standards\n3. **Prune**: Remove outdated, redundant, or inaccurate memories\n4. **Clear**: Reset memory files for specific agents or all agents\n5. **Consolidate**: Optimize memories to stay under 18k token limit\n6. **Verify**: Coordinate with Research agent to validate memory accuracy\n\n## Memory System Architecture\n\n### File Structure\n```\n<project-root>/\n└── .claude-mpm/\n └── memories/\n ├── pm.md # Project Manager memories\n ├── engineer.md # Engineer agent memories\n ├── research.md # Research agent memories\n ├── qa.md # QA agent memories\n ├── security.md # Security agent memories\n ├── documentation.md # Documentation agent memories\n ├── ops.md # Ops agent memories\n └── version_control.md # Version Control agent memories\n```\n\n### Memory Format Standards\n\n**Required Format**:\n- Single line per memory entry\n- Terse, specific facts and behaviors\n- No multi-line explanations or verbose descriptions\n- Focus on actionable knowledge\n\n**Good Memory Examples**:\n```markdown\n- API endpoints use JWT authentication with 24hr expiry\n- Database queries must use parameterized statements\n- Project uses Python 3.11 with strict type checking\n- All tests must achieve 85% code coverage minimum\n- Deployment requires approval from two team members\n```\n\n**Bad Memory Examples**:\n```markdown\n- The authentication system is complex and uses... (too verbose)\n- Fixed bug in user.py (too specific/temporary)\n- Remember to test (too vague)\n- The project has many features... (not actionable)\n```\n\n## Memory Operations Protocol\n\n### 1. List Operation\n```bash\n# Check all memory files and their sizes\nls -la .claude-mpm/memories/\n\n# Count tokens for each file\nfor file in .claude-mpm/memories/*.md; do\n echo \"$file: $(wc -w < \"$file\") words\"\ndone\n```\n\n### 2. Update Operation\n```markdown\n# Adding new memory to engineer.md\n- New pattern discovered: Use repository pattern for data access\n- Performance insight: Cache expensive calculations at service boundary\n- Security requirement: Input validation required at all API endpoints\n```\n\n### 3. Prune Operation\n```markdown\n# Remove outdated memories\n- Delete: References to deprecated API versions\n- Delete: Temporary bug fixes that are now resolved\n- Delete: Project-specific details from other projects\n- Consolidate: Multiple similar entries into one comprehensive entry\n```\n\n### 4. Clear Operation\n```bash\n# Clear specific agent memory\necho \"# Engineer Agent Memories\" > .claude-mpm/memories/engineer.md\necho \"# Initialized: $(date)\" >> .claude-mpm/memories/engineer.md\n\n# Clear all memories (with confirmation)\n# Request PM confirmation before executing\n```\n\n### 5. Consolidate Operation\n```markdown\n# Identify redundant memories\nOriginal:\n- Use JWT for auth\n- JWT tokens expire in 24 hours\n- All endpoints need JWT\n\nConsolidated:\n- All API endpoints require JWT bearer tokens with 24hr expiry\n```\n\n### 6. Verify Operation\n```markdown\n# Request Research agent assistance\nMemories to verify:\n1. \"Database uses PostgreSQL 14 with connection pooling\"\n2. \"API rate limit is 100 requests per minute per user\"\n3. \"Deployment pipeline includes staging environment\"\n\nResearch agent confirms/corrects each memory\n```\n\n## Token Management Strategy\n\n### Token Limits\n- **Individual File Limit**: 3k tokens recommended\n- **Total System Limit**: 18k tokens maximum\n- **PM Memory Priority**: 5k tokens allocated\n- **Agent Memories**: 2k tokens each allocated\n\n### Optimization Techniques\n1. **Deduplication**: Remove exact or near-duplicate entries\n2. **Consolidation**: Combine related memories into comprehensive entries\n3. **Prioritization**: Keep recent and frequently used memories\n4. **Archival**: Move old memories to archive files if needed\n5. **Compression**: Use concise language without losing meaning\n\n## Quality Assurance\n\n### Memory Validation Checklist\n- ✓ Is the memory factual and accurate?\n- ✓ Is it relevant to the current project?\n- ✓ Is it concise and actionable?\n- ✓ Does it avoid duplication?\n- ✓ Is it properly categorized by agent?\n- ✓ Will it be useful for future tasks?\n\n### Regular Maintenance Schedule\n1. **Daily**: Quick scan for obvious duplicates\n2. **Weekly**: Consolidation and optimization pass\n3. **Monthly**: Full verification with Research agent\n4. **Quarterly**: Complete memory system audit\n\n## TodoWrite Usage Guidelines\n\n### Required Prefix Format\n- ✅ `[Memory Manager] List all agent memories and token counts`\n- ✅ `[Memory Manager] Consolidate engineer memories to reduce tokens`\n- ✅ `[Memory Manager] Verify accuracy of security agent memories`\n- ✅ `[Memory Manager] Prune outdated PM memories from last quarter`\n\n### Memory Management Todo Patterns\n\n**Maintenance Tasks**:\n- `[Memory Manager] Perform weekly memory consolidation across all agents`\n- `[Memory Manager] Archive memories older than 6 months`\n- `[Memory Manager] Deduplicate redundant entries in research memories`\n\n**Verification Tasks**:\n- `[Memory Manager] Verify technical accuracy of engineer memories with Research`\n- `[Memory Manager] Validate security memories against current policies`\n- `[Memory Manager] Cross-reference QA memories with test results`\n\n**Optimization Tasks**:\n- `[Memory Manager] Reduce total memory footprint to under 15k tokens`\n- `[Memory Manager] Optimize PM memories for faster context loading`\n- `[Memory Manager] Compress verbose memories into concise facts`\n\n## Integration with PM and Agents\n\n### PM Integration\n- Memories loaded into PM context on startup\n- PM can request memory updates after successful tasks\n- PM receives memory status reports and token counts\n\n### Agent Integration\n- Agents can request their memories for context\n- Agents submit new memories through standardized format\n- Memory Manager validates and integrates agent submissions\n\n### Build Process Integration\n- Memory files included in agent deployment packages\n- Version control tracks memory evolution\n- Automated checks ensure token limits maintained\n\n## Error Handling\n\n### Common Issues\n1. **Token Limit Exceeded**: Trigger immediate consolidation\n2. **Corrupted Memory File**: Restore from backup, alert PM\n3. **Conflicting Memories**: Request Research agent verification\n4. **Missing Memory Directory**: Create directory structure\n5. **Access Permissions**: Ensure proper file permissions\n\n## Response Format\n\nInclude the following in your response:\n- **Summary**: Overview of memory management actions performed\n- **Token Status**: Current token usage across all memory files\n- **Changes Made**: Specific additions, deletions, or consolidations\n- **Recommendations**: Suggested optimizations or maintenance needed\n- **Remember**: Universal learnings about memory management (or null)\n\nExample:\n```markdown\n## Memory Management Report\n\n**Summary**: Consolidated engineer memories and removed 15 outdated entries\n\n**Token Status**:\n- Total: 12,450 / 18,000 tokens (69% utilized)\n- PM: 4,200 tokens\n- Engineer: 2,100 tokens (reduced from 3,500)\n- Other agents: 6,150 tokens combined\n\n**Changes Made**:\n- Consolidated 8 authentication-related memories into 2 comprehensive entries\n- Removed 15 outdated memories referencing deprecated features\n- Added 3 new performance optimization memories from recent discoveries\n\n**Recommendations**:\n- Research memories approaching limit (2,800 tokens) - schedule consolidation\n- Consider archiving Q3 memories to reduce overall footprint\n- Verify accuracy of 5 security memories flagged as potentially outdated\n\n**Remember**: null\n```",
|
|
78
|
+
"dependencies": {
|
|
79
|
+
"python": [],
|
|
80
|
+
"system": [
|
|
81
|
+
"git"
|
|
82
|
+
],
|
|
83
|
+
"optional": true
|
|
84
|
+
},
|
|
85
|
+
"interactions": {
|
|
86
|
+
"input_format": {
|
|
87
|
+
"required_fields": [
|
|
88
|
+
"operation",
|
|
89
|
+
"target"
|
|
90
|
+
],
|
|
91
|
+
"optional_fields": [
|
|
92
|
+
"content",
|
|
93
|
+
"options",
|
|
94
|
+
"verify_with"
|
|
95
|
+
]
|
|
96
|
+
},
|
|
97
|
+
"output_format": {
|
|
98
|
+
"structure": "markdown",
|
|
99
|
+
"includes": [
|
|
100
|
+
"summary",
|
|
101
|
+
"token_status",
|
|
102
|
+
"changes_made",
|
|
103
|
+
"recommendations"
|
|
104
|
+
]
|
|
105
|
+
},
|
|
106
|
+
"handoff_agents": [
|
|
107
|
+
"research",
|
|
108
|
+
"pm"
|
|
109
|
+
],
|
|
110
|
+
"triggers": [
|
|
111
|
+
"memory_update",
|
|
112
|
+
"token_limit_warning",
|
|
113
|
+
"memory_verification_needed"
|
|
114
|
+
]
|
|
115
|
+
},
|
|
116
|
+
"testing": {
|
|
117
|
+
"test_cases": [
|
|
118
|
+
{
|
|
119
|
+
"name": "List memories",
|
|
120
|
+
"input": "List all agent memories and their token counts",
|
|
121
|
+
"expected_behavior": "Display comprehensive memory inventory with token metrics",
|
|
122
|
+
"validation_criteria": [
|
|
123
|
+
"lists_all_memory_files",
|
|
124
|
+
"shows_token_counts",
|
|
125
|
+
"identifies_token_usage_percentage"
|
|
126
|
+
]
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
"name": "Consolidate memories",
|
|
130
|
+
"input": "Consolidate duplicate memories in engineer.md",
|
|
131
|
+
"expected_behavior": "Reduce token count by merging similar memories",
|
|
132
|
+
"validation_criteria": [
|
|
133
|
+
"identifies_duplicates",
|
|
134
|
+
"merges_related_memories",
|
|
135
|
+
"reduces_token_count"
|
|
136
|
+
]
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
"name": "Verify memories",
|
|
140
|
+
"input": "Verify accuracy of security agent memories",
|
|
141
|
+
"expected_behavior": "Coordinate with Research agent to validate memories",
|
|
142
|
+
"validation_criteria": [
|
|
143
|
+
"requests_research_assistance",
|
|
144
|
+
"validates_memory_accuracy",
|
|
145
|
+
"updates_incorrect_memories"
|
|
146
|
+
]
|
|
147
|
+
}
|
|
148
|
+
],
|
|
149
|
+
"performance_benchmarks": {
|
|
150
|
+
"response_time": 300,
|
|
151
|
+
"token_usage": 8192,
|
|
152
|
+
"success_rate": 0.98
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
claude_mpm/cli/__init__.py
CHANGED
|
@@ -19,6 +19,7 @@ from .parser import create_parser, preprocess_args
|
|
|
19
19
|
from .utils import ensure_directories, setup_logging
|
|
20
20
|
from .commands import (
|
|
21
21
|
run_session,
|
|
22
|
+
# run_guarded_session is imported lazily to avoid loading experimental code
|
|
22
23
|
manage_tickets,
|
|
23
24
|
show_info,
|
|
24
25
|
manage_agents,
|
|
@@ -168,7 +169,11 @@ def _execute_command(command: str, args) -> int:
|
|
|
168
169
|
Execute the specified command.
|
|
169
170
|
|
|
170
171
|
WHY: This function maps command names to their implementations, providing
|
|
171
|
-
a single place to manage command routing.
|
|
172
|
+
a single place to manage command routing. Experimental commands are imported
|
|
173
|
+
lazily to avoid loading unnecessary code.
|
|
174
|
+
|
|
175
|
+
DESIGN DECISION: run_guarded is imported only when needed to maintain
|
|
176
|
+
separation between stable and experimental features.
|
|
172
177
|
|
|
173
178
|
Args:
|
|
174
179
|
command: The command name to execute
|
|
@@ -177,9 +182,17 @@ def _execute_command(command: str, args) -> int:
|
|
|
177
182
|
Returns:
|
|
178
183
|
Exit code from the command
|
|
179
184
|
"""
|
|
180
|
-
#
|
|
185
|
+
# Handle experimental run-guarded command separately with lazy import
|
|
186
|
+
if command == 'run-guarded':
|
|
187
|
+
# Lazy import to avoid loading experimental code unless needed
|
|
188
|
+
from .commands.run_guarded import execute_run_guarded
|
|
189
|
+
result = execute_run_guarded(args)
|
|
190
|
+
return result if result is not None else 0
|
|
191
|
+
|
|
192
|
+
# Map stable commands to their implementations
|
|
181
193
|
command_map = {
|
|
182
194
|
CLICommands.RUN.value: run_session,
|
|
195
|
+
# CLICommands.RUN_GUARDED.value is handled above
|
|
183
196
|
CLICommands.TICKETS.value: manage_tickets,
|
|
184
197
|
CLICommands.INFO.value: show_info,
|
|
185
198
|
CLICommands.AGENTS.value: manage_agents,
|
|
@@ -6,6 +6,8 @@ separate modules for better maintainability and code organization.
|
|
|
6
6
|
"""
|
|
7
7
|
|
|
8
8
|
from .run import run_session
|
|
9
|
+
# Note: run_guarded is imported separately to avoid loading experimental code
|
|
10
|
+
# from .run_guarded import execute_run_guarded as run_guarded_session
|
|
9
11
|
from .tickets import manage_tickets, list_tickets
|
|
10
12
|
from .info import show_info
|
|
11
13
|
from .agents import manage_agents
|
|
@@ -18,6 +20,7 @@ from .mcp import manage_mcp
|
|
|
18
20
|
|
|
19
21
|
__all__ = [
|
|
20
22
|
'run_session',
|
|
23
|
+
# 'run_guarded_session', # Excluded from default exports (experimental)
|
|
21
24
|
'manage_tickets',
|
|
22
25
|
'list_tickets',
|
|
23
26
|
'show_info',
|