claude-mpm 5.1.9__py3-none-any.whl → 5.4.14__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.

Potentially problematic release.


This version of claude-mpm might be problematic. Click here for more details.

Files changed (162) hide show
  1. claude_mpm/VERSION +1 -1
  2. claude_mpm/__init__.py +4 -0
  3. claude_mpm/agents/PM_INSTRUCTIONS.md +85 -0
  4. claude_mpm/agents/agent_loader.py +13 -44
  5. claude_mpm/agents/templates/circuit-breakers.md +138 -1
  6. claude_mpm/cli/__main__.py +4 -0
  7. claude_mpm/cli/commands/agent_state_manager.py +8 -17
  8. claude_mpm/cli/commands/auto_configure.py +210 -25
  9. claude_mpm/cli/commands/config.py +88 -2
  10. claude_mpm/cli/commands/configure.py +1097 -158
  11. claude_mpm/cli/commands/configure_agent_display.py +15 -6
  12. claude_mpm/cli/commands/mpm_init/core.py +160 -46
  13. claude_mpm/cli/commands/mpm_init/knowledge_extractor.py +481 -0
  14. claude_mpm/cli/commands/mpm_init/prompts.py +280 -0
  15. claude_mpm/cli/commands/skills.py +21 -2
  16. claude_mpm/cli/commands/summarize.py +413 -0
  17. claude_mpm/cli/executor.py +11 -3
  18. claude_mpm/cli/parsers/base_parser.py +5 -0
  19. claude_mpm/cli/parsers/config_parser.py +153 -83
  20. claude_mpm/cli/parsers/skills_parser.py +3 -2
  21. claude_mpm/cli/startup.py +333 -89
  22. claude_mpm/commands/mpm-config.md +266 -0
  23. claude_mpm/commands/{mpm-ticket-organize.md → mpm-organize.md} +4 -5
  24. claude_mpm/config/agent_sources.py +27 -0
  25. claude_mpm/core/framework/formatters/content_formatter.py +3 -13
  26. claude_mpm/core/framework/loaders/agent_loader.py +8 -5
  27. claude_mpm/core/framework_loader.py +4 -2
  28. claude_mpm/core/logger.py +13 -0
  29. claude_mpm/core/socketio_pool.py +3 -3
  30. claude_mpm/core/unified_agent_registry.py +5 -15
  31. claude_mpm/hooks/claude_hooks/correlation_manager.py +60 -0
  32. claude_mpm/hooks/claude_hooks/event_handlers.py +206 -78
  33. claude_mpm/hooks/claude_hooks/hook_handler.py +6 -0
  34. claude_mpm/hooks/claude_hooks/installer.py +33 -10
  35. claude_mpm/hooks/claude_hooks/memory_integration.py +26 -9
  36. claude_mpm/hooks/claude_hooks/response_tracking.py +2 -3
  37. claude_mpm/hooks/claude_hooks/services/connection_manager.py +4 -0
  38. claude_mpm/hooks/memory_integration_hook.py +46 -1
  39. claude_mpm/init.py +0 -19
  40. claude_mpm/scripts/claude-hook-handler.sh +58 -18
  41. claude_mpm/scripts/launch_monitor.py +93 -13
  42. claude_mpm/services/agents/agent_recommendation_service.py +278 -0
  43. claude_mpm/services/agents/agent_review_service.py +280 -0
  44. claude_mpm/services/agents/deployment/agent_discovery_service.py +2 -3
  45. claude_mpm/services/agents/deployment/agent_template_builder.py +4 -2
  46. claude_mpm/services/agents/deployment/multi_source_deployment_service.py +78 -9
  47. claude_mpm/services/agents/deployment/remote_agent_discovery_service.py +335 -53
  48. claude_mpm/services/agents/git_source_manager.py +34 -0
  49. claude_mpm/services/agents/loading/base_agent_manager.py +1 -13
  50. claude_mpm/services/agents/sources/git_source_sync_service.py +8 -1
  51. claude_mpm/services/agents/toolchain_detector.py +10 -6
  52. claude_mpm/services/analysis/__init__.py +11 -1
  53. claude_mpm/services/analysis/clone_detector.py +1030 -0
  54. claude_mpm/services/command_deployment_service.py +71 -10
  55. claude_mpm/services/event_bus/config.py +3 -1
  56. claude_mpm/services/git/git_operations_service.py +93 -8
  57. claude_mpm/services/monitor/daemon.py +9 -2
  58. claude_mpm/services/monitor/daemon_manager.py +39 -3
  59. claude_mpm/services/monitor/server.py +225 -19
  60. claude_mpm/services/self_upgrade_service.py +120 -12
  61. claude_mpm/services/skills/__init__.py +3 -0
  62. claude_mpm/services/skills/git_skill_source_manager.py +32 -2
  63. claude_mpm/services/skills/selective_skill_deployer.py +230 -0
  64. claude_mpm/services/skills/skill_to_agent_mapper.py +406 -0
  65. claude_mpm/services/skills_deployer.py +64 -3
  66. claude_mpm/services/socketio/event_normalizer.py +15 -1
  67. claude_mpm/services/socketio/server/core.py +160 -21
  68. claude_mpm/services/version_control/git_operations.py +103 -0
  69. claude_mpm/utils/agent_filters.py +17 -44
  70. {claude_mpm-5.1.9.dist-info → claude_mpm-5.4.14.dist-info}/METADATA +47 -84
  71. {claude_mpm-5.1.9.dist-info → claude_mpm-5.4.14.dist-info}/RECORD +76 -150
  72. claude_mpm-5.4.14.dist-info/entry_points.txt +5 -0
  73. claude_mpm-5.4.14.dist-info/licenses/LICENSE +94 -0
  74. claude_mpm-5.4.14.dist-info/licenses/LICENSE-FAQ.md +153 -0
  75. claude_mpm/agents/BASE_AGENT_TEMPLATE.md +0 -292
  76. claude_mpm/agents/BASE_DOCUMENTATION.md +0 -53
  77. claude_mpm/agents/BASE_ENGINEER.md +0 -658
  78. claude_mpm/agents/BASE_OPS.md +0 -219
  79. claude_mpm/agents/BASE_PM.md +0 -480
  80. claude_mpm/agents/BASE_PROMPT_ENGINEER.md +0 -787
  81. claude_mpm/agents/BASE_QA.md +0 -167
  82. claude_mpm/agents/BASE_RESEARCH.md +0 -53
  83. claude_mpm/agents/base_agent.json +0 -31
  84. claude_mpm/agents/base_agent_loader.py +0 -601
  85. claude_mpm/cli/ticket_cli.py +0 -35
  86. claude_mpm/commands/mpm-config-view.md +0 -150
  87. claude_mpm/dashboard/analysis_runner.py +0 -455
  88. claude_mpm/dashboard/index.html +0 -13
  89. claude_mpm/dashboard/open_dashboard.py +0 -66
  90. claude_mpm/dashboard/static/css/activity.css +0 -1958
  91. claude_mpm/dashboard/static/css/connection-status.css +0 -370
  92. claude_mpm/dashboard/static/css/dashboard.css +0 -4701
  93. claude_mpm/dashboard/static/js/components/activity-tree.js +0 -1871
  94. claude_mpm/dashboard/static/js/components/agent-hierarchy.js +0 -777
  95. claude_mpm/dashboard/static/js/components/agent-inference.js +0 -956
  96. claude_mpm/dashboard/static/js/components/build-tracker.js +0 -333
  97. claude_mpm/dashboard/static/js/components/code-simple.js +0 -857
  98. claude_mpm/dashboard/static/js/components/connection-debug.js +0 -654
  99. claude_mpm/dashboard/static/js/components/diff-viewer.js +0 -891
  100. claude_mpm/dashboard/static/js/components/event-processor.js +0 -542
  101. claude_mpm/dashboard/static/js/components/event-viewer.js +0 -1155
  102. claude_mpm/dashboard/static/js/components/export-manager.js +0 -368
  103. claude_mpm/dashboard/static/js/components/file-change-tracker.js +0 -443
  104. claude_mpm/dashboard/static/js/components/file-change-viewer.js +0 -690
  105. claude_mpm/dashboard/static/js/components/file-tool-tracker.js +0 -724
  106. claude_mpm/dashboard/static/js/components/file-viewer.js +0 -580
  107. claude_mpm/dashboard/static/js/components/hud-library-loader.js +0 -211
  108. claude_mpm/dashboard/static/js/components/hud-manager.js +0 -671
  109. claude_mpm/dashboard/static/js/components/hud-visualizer.js +0 -1718
  110. claude_mpm/dashboard/static/js/components/module-viewer.js +0 -2764
  111. claude_mpm/dashboard/static/js/components/session-manager.js +0 -579
  112. claude_mpm/dashboard/static/js/components/socket-manager.js +0 -368
  113. claude_mpm/dashboard/static/js/components/ui-state-manager.js +0 -749
  114. claude_mpm/dashboard/static/js/components/unified-data-viewer.js +0 -1824
  115. claude_mpm/dashboard/static/js/components/working-directory.js +0 -920
  116. claude_mpm/dashboard/static/js/connection-manager.js +0 -536
  117. claude_mpm/dashboard/static/js/dashboard.js +0 -1914
  118. claude_mpm/dashboard/static/js/extension-error-handler.js +0 -164
  119. claude_mpm/dashboard/static/js/socket-client.js +0 -1474
  120. claude_mpm/dashboard/static/js/tab-isolation-fix.js +0 -185
  121. claude_mpm/dashboard/static/socket.io.min.js +0 -7
  122. claude_mpm/dashboard/static/socket.io.v4.8.1.backup.js +0 -7
  123. claude_mpm/dashboard/templates/code_simple.html +0 -153
  124. claude_mpm/dashboard/templates/index.html +0 -606
  125. claude_mpm/dashboard/test_dashboard.html +0 -372
  126. claude_mpm/scripts/mcp_server.py +0 -75
  127. claude_mpm/scripts/mcp_wrapper.py +0 -39
  128. claude_mpm/services/mcp_gateway/__init__.py +0 -159
  129. claude_mpm/services/mcp_gateway/auto_configure.py +0 -369
  130. claude_mpm/services/mcp_gateway/config/__init__.py +0 -17
  131. claude_mpm/services/mcp_gateway/config/config_loader.py +0 -296
  132. claude_mpm/services/mcp_gateway/config/config_schema.py +0 -243
  133. claude_mpm/services/mcp_gateway/config/configuration.py +0 -429
  134. claude_mpm/services/mcp_gateway/core/__init__.py +0 -43
  135. claude_mpm/services/mcp_gateway/core/base.py +0 -312
  136. claude_mpm/services/mcp_gateway/core/exceptions.py +0 -253
  137. claude_mpm/services/mcp_gateway/core/interfaces.py +0 -443
  138. claude_mpm/services/mcp_gateway/core/process_pool.py +0 -977
  139. claude_mpm/services/mcp_gateway/core/singleton_manager.py +0 -315
  140. claude_mpm/services/mcp_gateway/core/startup_verification.py +0 -316
  141. claude_mpm/services/mcp_gateway/main.py +0 -589
  142. claude_mpm/services/mcp_gateway/registry/__init__.py +0 -12
  143. claude_mpm/services/mcp_gateway/registry/service_registry.py +0 -412
  144. claude_mpm/services/mcp_gateway/registry/tool_registry.py +0 -489
  145. claude_mpm/services/mcp_gateway/server/__init__.py +0 -15
  146. claude_mpm/services/mcp_gateway/server/mcp_gateway.py +0 -414
  147. claude_mpm/services/mcp_gateway/server/stdio_handler.py +0 -372
  148. claude_mpm/services/mcp_gateway/server/stdio_server.py +0 -712
  149. claude_mpm/services/mcp_gateway/tools/__init__.py +0 -36
  150. claude_mpm/services/mcp_gateway/tools/base_adapter.py +0 -485
  151. claude_mpm/services/mcp_gateway/tools/document_summarizer.py +0 -789
  152. claude_mpm/services/mcp_gateway/tools/external_mcp_services.py +0 -654
  153. claude_mpm/services/mcp_gateway/tools/health_check_tool.py +0 -456
  154. claude_mpm/services/mcp_gateway/tools/hello_world.py +0 -551
  155. claude_mpm/services/mcp_gateway/tools/kuzu_memory_service.py +0 -555
  156. claude_mpm/services/mcp_gateway/utils/__init__.py +0 -14
  157. claude_mpm/services/mcp_gateway/utils/package_version_checker.py +0 -160
  158. claude_mpm/services/mcp_gateway/utils/update_preferences.py +0 -170
  159. claude_mpm-5.1.9.dist-info/entry_points.txt +0 -10
  160. claude_mpm-5.1.9.dist-info/licenses/LICENSE +0 -21
  161. {claude_mpm-5.1.9.dist-info → claude_mpm-5.4.14.dist-info}/WHEEL +0 -0
  162. {claude_mpm-5.1.9.dist-info → claude_mpm-5.4.14.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,266 @@
1
+ ---
2
+ namespace: mpm/config
3
+ command: config
4
+ aliases: [mpm-config]
5
+ migration_target: /mpm/config
6
+ category: config
7
+ deprecated_aliases: [mpm-config-view]
8
+ description: Unified configuration management with auto-detection and manual viewing
9
+ ---
10
+ # Unified configuration management
11
+
12
+ Manage Claude MPM configuration with auto-detection, manual viewing, validation, and status checks.
13
+
14
+ ## Usage
15
+
16
+ ```
17
+ /mpm-config [subcommand] [options]
18
+ /mpm-config # No args = auto (detect + recommend + preview)
19
+ /mpm-config view # Show current config
20
+ /mpm-config auto # Auto-configure: detect → recommend → deploy (with confirmation)
21
+ /mpm-config auto --yes # Auto-deploy without confirmation
22
+ ```
23
+
24
+ ## Description
25
+
26
+ This unified command provides comprehensive configuration management:
27
+
28
+ 1. **Auto-configuration** (default): Detect toolchain and recommend agents/skills
29
+ 2. **Manual viewing**: Display current configuration settings
30
+ 3. **Validation**: Ensure configuration correctness
31
+ 4. **Status checks**: Show system health
32
+
33
+ ## Subcommands
34
+
35
+ ### Auto-Configure (Default)
36
+
37
+ Automatically detect project toolchain and configure appropriate agents and skills.
38
+
39
+ ```
40
+ /mpm-config # Preview recommendations (default)
41
+ /mpm-config auto # Same as no args - detect and preview
42
+ /mpm-config auto --yes # Auto-deploy without confirmation
43
+ ```
44
+
45
+ **What it does:**
46
+ 1. Scans project to detect programming languages, frameworks, and tools
47
+ 2. Recommends agents for your stack (e.g., fastapi-engineer, react-engineer)
48
+ 3. Recommends skills based on agent types
49
+ 4. Shows preview of what will be configured
50
+ 5. Deploys with confirmation (unless `--yes` is used)
51
+
52
+ **Options:**
53
+ - `--yes`: Automatically deploy without prompting
54
+ - `--preview`: Show recommendations without deploying (default when no args)
55
+ - `--min-confidence FLOAT`: Minimum confidence threshold (default: 0.8)
56
+ - `--agents-only`: Only configure agents, skip skills
57
+ - `--skills-only`: Only configure skills, skip agents
58
+ - `--json`: Output results in JSON format
59
+
60
+ **Examples:**
61
+ ```
62
+ /mpm-config # Preview auto-configuration
63
+ /mpm-config auto # Same as above
64
+ /mpm-config auto --yes # Deploy automatically
65
+ /mpm-config auto --min-confidence 0.7 # Lower threshold
66
+ ```
67
+
68
+ **Detection Capabilities:**
69
+
70
+ **Languages:**
71
+ - Python (CPython, PyPy)
72
+ - JavaScript/TypeScript (Node.js, Deno, Bun)
73
+ - Rust, Go, Java
74
+
75
+ **Python Frameworks:**
76
+ - FastAPI, Flask, Django, Starlette, Pyramid
77
+
78
+ **JavaScript/TypeScript Frameworks:**
79
+ - Next.js, React, Vue, Svelte, Angular
80
+ - Express, Nest.js, Fastify
81
+
82
+ **Testing Tools:**
83
+ - pytest, unittest (Python)
84
+ - Jest, Vitest (JavaScript)
85
+ - Playwright, Cypress (Browser)
86
+
87
+ **Example Output:**
88
+ ```
89
+ 📊 Detected Toolchain:
90
+ ✓ Python 3.11 (100% confidence)
91
+ ✓ FastAPI 0.104.0 (95% confidence)
92
+ ✓ pytest 7.4.0 (90% confidence)
93
+
94
+ 🤖 Recommended Agents:
95
+ ✓ fastapi-engineer (95% confidence)
96
+ Reason: FastAPI framework detected
97
+ ✓ python-engineer (90% confidence)
98
+ Reason: Python project support
99
+ ✓ api-qa (85% confidence)
100
+ Reason: API testing and validation
101
+
102
+ 🎯 Recommended Skills:
103
+ ✓ toolchains-python-frameworks-fastapi
104
+ ✓ toolchains-python-testing-pytest
105
+ ✓ toolchains-universal-api-testing
106
+
107
+ Deploy 3 agent(s) and 3 skill(s)? (y/n/s for select):
108
+ ```
109
+
110
+ ### View Configuration
111
+
112
+ Display current configuration settings.
113
+
114
+ ```
115
+ /mpm-config view [--section SECTION] [--format FORMAT] [--show-defaults]
116
+ ```
117
+
118
+ **Options:**
119
+ - `--section SECTION`: Specific configuration section to view
120
+ - `--format FORMAT`: Output format (yaml, json, table)
121
+ - `--show-defaults`: Include default values in output
122
+
123
+ **Examples:**
124
+ ```
125
+ /mpm-config view
126
+ /mpm-config view --section agents --format json
127
+ /mpm-config view --show-defaults
128
+ ```
129
+
130
+ ### Validate Configuration
131
+
132
+ Validate configuration files for correctness and completeness.
133
+
134
+ ```
135
+ /mpm-config validate [--config-file PATH] [--strict] [--fix]
136
+ ```
137
+
138
+ **Options:**
139
+ - `--config-file PATH`: Validate specific config file (default: all)
140
+ - `--strict`: Use strict validation rules
141
+ - `--fix`: Attempt to fix validation errors automatically
142
+
143
+ **Example:**
144
+ ```
145
+ /mpm-config validate --strict
146
+ /mpm-config validate --config-file .claude/config.yaml --fix
147
+ ```
148
+
149
+ **Expected Output:**
150
+ ```
151
+ Validating configuration files...
152
+
153
+ ✓ .claude/config.yaml: Valid
154
+ ✓ .claude/agents/config.yaml: Valid
155
+ ✓ Configuration schema: Valid
156
+
157
+ Configuration is valid and ready to use.
158
+ ```
159
+
160
+ ### Configuration Status
161
+
162
+ Show configuration health and status.
163
+
164
+ ```
165
+ /mpm-config status [--verbose]
166
+ ```
167
+
168
+ **Options:**
169
+ - `--verbose`: Show detailed status information
170
+
171
+ **Example:**
172
+ ```
173
+ /mpm-config status --verbose
174
+ ```
175
+
176
+ **Expected Output:**
177
+ ```
178
+ Configuration Status
179
+ ====================
180
+
181
+ Files Found: 2
182
+ ✓ .claude/config.yaml
183
+ ✓ .claude/agents/config.yaml
184
+
185
+ Validation: Passed
186
+ Schema Version: 4.5
187
+ Last Modified: 2025-01-15 14:30:22
188
+
189
+ Active Settings:
190
+ - WebSocket Port: 8765
191
+ - Agent Deploy Mode: project
192
+ - Logging Level: INFO
193
+ ```
194
+
195
+ ## Implementation
196
+
197
+ This command executes:
198
+ ```bash
199
+ claude-mpm config [subcommand] [options]
200
+ ```
201
+
202
+ The slash command passes through to the actual CLI configuration management system.
203
+
204
+ ## Configuration Categories
205
+
206
+ Configuration is organized into sections:
207
+
208
+ - **agents**: Agent deployment and management settings
209
+ - **memory**: Memory system configuration
210
+ - **websocket**: WebSocket server settings (port, host)
211
+ - **hooks**: Hook service configuration
212
+ - **logging**: Logging levels and output
213
+ - **tickets**: Ticket tracking settings
214
+ - **monitor**: Dashboard and monitoring settings
215
+
216
+ ## Workflow Examples
217
+
218
+ ### Quick Start (New Project)
219
+ ```
220
+ /mpm-config # Preview recommendations
221
+ # Review output, then:
222
+ /mpm-config auto --yes # Deploy recommended agents and skills
223
+ ```
224
+
225
+ ### Check Current State
226
+ ```
227
+ /mpm-config view # See current settings
228
+ /mpm-config status # Verify health
229
+ ```
230
+
231
+ ### Validate After Manual Edits
232
+ ```
233
+ /mpm-config validate --strict
234
+ ```
235
+
236
+ ### Reconfigure After Stack Changes
237
+ ```
238
+ /mpm-config auto --force # Re-run auto-detection
239
+ ```
240
+
241
+ ## Default Configuration Fallback
242
+
243
+ When auto-configuration cannot detect your project's toolchain, it falls back to sensible defaults:
244
+
245
+ **Default Agents** (moderate confidence 0.7):
246
+ - engineer (general-purpose)
247
+ - research (code exploration)
248
+ - qa (testing)
249
+ - ops (infrastructure)
250
+ - documentation (technical writing)
251
+
252
+ **Disable defaults:**
253
+ Edit `.claude-mpm/config/agent_capabilities.yaml`:
254
+ ```yaml
255
+ default_configuration:
256
+ enabled: false # Disable default fallback
257
+ ```
258
+
259
+ ## Related Commands
260
+
261
+ - `/mpm-status`: Show overall system status
262
+ - `/mpm-doctor`: Diagnose configuration issues
263
+ - `/mpm-init`: Initialize project configuration
264
+ - `/mpm-agents`: Manually manage agents
265
+ - `/mpm-agents-detect`: View detected toolchain only
266
+ - `/mpm-agents-recommend`: Show recommendations only
@@ -1,10 +1,9 @@
1
1
  ---
2
- namespace: mpm/ticket
2
+ namespace: mpm/system
3
3
  command: organize
4
- aliases: [mpm-ticket-organize]
5
- migration_target: /mpm/ticket:organize
6
- category: tickets
7
- deprecated_aliases: [mpm-organize]
4
+ aliases: [mpm-organize]
5
+ migration_target: /mpm/system:organize
6
+ category: system
8
7
  description: Organize project files into proper directories with intelligent pattern detection
9
8
  ---
10
9
  # /mpm-organize
@@ -316,6 +316,33 @@ class AgentSourceConfiguration:
316
316
 
317
317
  return errors
318
318
 
319
+ def list_sources(self) -> list[dict]:
320
+ """Return list of source configurations as dictionaries.
321
+
322
+ This method converts GitRepository objects to dictionaries for CLI
323
+ and API compatibility. Called by GitSourceManager and CLI commands.
324
+
325
+ Returns:
326
+ List of dicts with keys: identifier, url, subdirectory, enabled, priority
327
+
328
+ Example:
329
+ >>> config = AgentSourceConfiguration()
330
+ >>> sources = config.list_sources()
331
+ >>> for source in sources:
332
+ ... print(f"{source['identifier']} (priority: {source['priority']})")
333
+ """
334
+ repos = self.get_enabled_repositories()
335
+ return [
336
+ {
337
+ "identifier": repo.identifier,
338
+ "url": repo.url,
339
+ "subdirectory": repo.subdirectory,
340
+ "enabled": repo.enabled,
341
+ "priority": repo.priority,
342
+ }
343
+ for repo in repos
344
+ ]
345
+
319
346
  def __repr__(self) -> str:
320
347
  """Return string representation of configuration."""
321
348
  return (
@@ -100,19 +100,9 @@ class ContentFormatter:
100
100
  instructions += framework_content["actual_memories"]
101
101
  instructions += "\n"
102
102
 
103
- # Add agent memories if available
104
- if framework_content.get("agent_memories"):
105
- agent_memories = framework_content["agent_memories"]
106
- if agent_memories:
107
- instructions += "\n\n## Agent Memories\n\n"
108
- instructions += "**The following are accumulated memories from specialized agents:**\n\n"
109
-
110
- for agent_name in sorted(agent_memories.keys()):
111
- memory_content = agent_memories[agent_name]
112
- if memory_content:
113
- instructions += f"### {agent_name.replace('_', ' ').title()} Agent Memory\n\n"
114
- instructions += memory_content
115
- instructions += "\n\n"
103
+ # NOTE: Agent memories are now injected at agent deployment time
104
+ # in agent_template_builder.py, not in PM instructions.
105
+ # This ensures each agent gets its own memory, not all memories embedded in PM.
116
106
 
117
107
  # Add dynamic agent capabilities section
118
108
  instructions += capabilities_section
@@ -115,7 +115,11 @@ class AgentLoader:
115
115
  return agents
116
116
 
117
117
  def discover_local_json_templates(self) -> Dict[str, Dict[str, Any]]:
118
- """Discover local JSON agent templates from .claude-mpm/agents/ directories.
118
+ """Discover local JSON agent templates.
119
+
120
+ NOTE: This method is kept for backward compatibility but is deprecated.
121
+ The new architecture uses SOURCE (~/.claude-mpm/cache/remote-agents/)
122
+ and DEPLOYMENT (.claude/agents/) locations only.
119
123
 
120
124
  Returns:
121
125
  Dictionary mapping agent IDs to agent metadata
@@ -125,11 +129,10 @@ class AgentLoader:
125
129
  local_agents = {}
126
130
 
127
131
  # Check for local JSON templates in priority order
132
+ # NOTE: These directories are deprecated in the simplified architecture
128
133
  template_dirs = [
129
- Path.cwd()
130
- / ".claude-mpm"
131
- / "agents", # Project local agents (highest priority)
132
- Path.home() / ".claude-mpm" / "agents", # User local agents
134
+ Path.cwd() / ".claude-mpm" / "agents", # Deprecated: Project local agents
135
+ Path.home() / ".claude-mpm" / "agents", # Deprecated: User local agents
133
136
  ]
134
137
 
135
138
  for priority, template_dir in enumerate(template_dirs):
@@ -255,10 +255,12 @@ class FrameworkLoader:
255
255
  """Load actual memories using the MemoryManager service."""
256
256
  memories = self._memory_manager.load_memories()
257
257
 
258
+ # Only load PM memories (PM.md)
259
+ # Agent memories are loaded at deployment time in agent_template_builder.py
258
260
  if "actual_memories" in memories:
259
261
  content["actual_memories"] = memories["actual_memories"]
260
- if "agent_memories" in memories:
261
- content["agent_memories"] = memories["agent_memories"]
262
+ # NOTE: agent_memories are no longer loaded for PM instructions
263
+ # They are injected per-agent at deployment time
262
264
 
263
265
  # === Agent Discovery Methods ===
264
266
 
claude_mpm/core/logger.py CHANGED
@@ -175,6 +175,19 @@ def setup_logging(
175
175
  Returns:
176
176
  Configured logger
177
177
  """
178
+ # Detect deployment context for install-type-aware defaults
179
+ if level == "INFO": # Only override default, not explicit settings
180
+ from claude_mpm.core.unified_paths import DeploymentContext, PathContext
181
+
182
+ context = PathContext.detect_deployment_context()
183
+ if context in (
184
+ DeploymentContext.DEVELOPMENT,
185
+ DeploymentContext.EDITABLE_INSTALL,
186
+ ):
187
+ level = "INFO" # Development: verbose logging
188
+ else:
189
+ level = "OFF" # Production installs: silent by default
190
+
178
191
  logger = logging.getLogger(name)
179
192
 
180
193
  # Handle OFF level
@@ -55,8 +55,8 @@ class CircuitState(Enum):
55
55
  class ConnectionStats:
56
56
  """Connection statistics for monitoring."""
57
57
 
58
- created_at: datetime = field(default_factory=datetime.now)
59
- last_used: datetime = field(default_factory=datetime.now)
58
+ created_at: datetime = field(default_factory=lambda: datetime.now(timezone.utc))
59
+ last_used: datetime = field(default_factory=lambda: datetime.now(timezone.utc))
60
60
  events_sent: int = 0
61
61
  errors: int = 0
62
62
  consecutive_errors: int = 0
@@ -70,7 +70,7 @@ class BatchEvent:
70
70
  namespace: str
71
71
  event: str
72
72
  data: Dict[str, Any]
73
- timestamp: datetime = field(default_factory=datetime.now)
73
+ timestamp: datetime = field(default_factory=lambda: datetime.now(timezone.utc))
74
74
 
75
75
 
76
76
  class CircuitBreaker:
@@ -174,26 +174,16 @@ class UnifiedAgentRegistry:
174
174
  if project_path.exists():
175
175
  self.discovery_paths.append(project_path)
176
176
 
177
- # Also check for local JSON templates in .claude-mpm/agents/
178
- local_project_path = self.path_manager.project_root / ".claude-mpm" / "agents"
179
- if (
180
- local_project_path.exists()
181
- and local_project_path not in self.discovery_paths
182
- ):
183
- self.discovery_paths.append(local_project_path)
184
- logger.debug(f"Added local project templates path: {local_project_path}")
177
+ # NOTE: .claude-mpm/agents/ is deprecated in the simplified architecture
178
+ # Source agents come from ~/.claude-mpm/cache/remote-agents/
179
+ # Deployed agents go to .claude/agents/
185
180
 
186
- # User-level agents
181
+ # User-level agents (deprecated in simplified architecture)
182
+ # Keeping for backward compatibility but not actively used
187
183
  user_path = self.path_manager.get_user_agents_dir()
188
184
  if user_path.exists():
189
185
  self.discovery_paths.append(user_path)
190
186
 
191
- # Also check for user JSON templates in ~/.claude-mpm/agents/
192
- local_user_path = Path.home() / ".claude-mpm" / "agents"
193
- if local_user_path.exists() and local_user_path not in self.discovery_paths:
194
- self.discovery_paths.append(local_user_path)
195
- logger.debug(f"Added local user templates path: {local_user_path}")
196
-
197
187
  # System-level agents (includes templates as a subdirectory)
198
188
  system_path = self.path_manager.get_system_agents_dir()
199
189
  if system_path.exists():
@@ -0,0 +1,60 @@
1
+ """Cross-process correlation storage using .claude-mpm directory."""
2
+
3
+ import json
4
+ import time
5
+ from pathlib import Path
6
+
7
+
8
+ def get_correlation_dir() -> Path:
9
+ """Get correlation directory in project's .claude-mpm folder."""
10
+ # Use CWD's .claude-mpm directory (where hooks run from)
11
+ cwd = Path.cwd()
12
+ return cwd / ".claude-mpm" / "correlations"
13
+
14
+
15
+ TTL_SECONDS = 3600 # 1 hour
16
+
17
+
18
+ class CorrelationManager:
19
+ """Manages correlation IDs across separate hook processes."""
20
+
21
+ @staticmethod
22
+ def store(session_id: str, tool_call_id: str, tool_name: str) -> None:
23
+ """Store correlation data for later retrieval by post_tool."""
24
+ correlation_dir = get_correlation_dir()
25
+ correlation_dir.mkdir(parents=True, exist_ok=True)
26
+ filepath = correlation_dir / f"correlation_{session_id}.json"
27
+ data = {
28
+ "tool_call_id": tool_call_id,
29
+ "tool_name": tool_name,
30
+ "timestamp": time.time(),
31
+ }
32
+ filepath.write_text(json.dumps(data))
33
+
34
+ @staticmethod
35
+ def retrieve(session_id: str) -> str | None:
36
+ """Retrieve and delete correlation data from temp file."""
37
+ correlation_dir = get_correlation_dir()
38
+ filepath = correlation_dir / f"correlation_{session_id}.json"
39
+ if not filepath.exists():
40
+ return None
41
+ try:
42
+ data = json.loads(filepath.read_text())
43
+ filepath.unlink() # Delete after reading
44
+ return data.get("tool_call_id")
45
+ except (json.JSONDecodeError, OSError):
46
+ return None
47
+
48
+ @staticmethod
49
+ def cleanup_old() -> None:
50
+ """Remove correlation files older than TTL."""
51
+ correlation_dir = get_correlation_dir()
52
+ if not correlation_dir.exists():
53
+ return
54
+ now = time.time()
55
+ for filepath in correlation_dir.glob("correlation_*.json"):
56
+ try:
57
+ if now - filepath.stat().st_mtime > TTL_SECONDS:
58
+ filepath.unlink()
59
+ except OSError:
60
+ pass