claude-mpm 5.1.8__py3-none-any.whl → 5.4.22__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 (191) hide show
  1. claude_mpm/VERSION +1 -1
  2. claude_mpm/__init__.py +4 -0
  3. claude_mpm/agents/{PM_INSTRUCTIONS_TEACH.md → CLAUDE_MPM_TEACHER_OUTPUT_STYLE.md} +721 -41
  4. claude_mpm/agents/PM_INSTRUCTIONS.md +290 -34
  5. claude_mpm/agents/agent_loader.py +13 -44
  6. claude_mpm/agents/frontmatter_validator.py +68 -0
  7. claude_mpm/agents/templates/circuit-breakers.md +138 -1
  8. claude_mpm/cli/__main__.py +4 -0
  9. claude_mpm/cli/chrome_devtools_installer.py +175 -0
  10. claude_mpm/cli/commands/agent_state_manager.py +8 -17
  11. claude_mpm/cli/commands/agents.py +169 -31
  12. claude_mpm/cli/commands/auto_configure.py +210 -25
  13. claude_mpm/cli/commands/config.py +88 -2
  14. claude_mpm/cli/commands/configure.py +1111 -161
  15. claude_mpm/cli/commands/configure_agent_display.py +15 -6
  16. claude_mpm/cli/commands/mpm_init/core.py +160 -46
  17. claude_mpm/cli/commands/mpm_init/knowledge_extractor.py +481 -0
  18. claude_mpm/cli/commands/mpm_init/prompts.py +280 -0
  19. claude_mpm/cli/commands/skills.py +214 -189
  20. claude_mpm/cli/commands/summarize.py +413 -0
  21. claude_mpm/cli/executor.py +11 -3
  22. claude_mpm/cli/parsers/agents_parser.py +54 -9
  23. claude_mpm/cli/parsers/auto_configure_parser.py +0 -138
  24. claude_mpm/cli/parsers/base_parser.py +5 -0
  25. claude_mpm/cli/parsers/config_parser.py +153 -83
  26. claude_mpm/cli/parsers/skills_parser.py +3 -2
  27. claude_mpm/cli/startup.py +550 -94
  28. claude_mpm/commands/mpm-config.md +265 -0
  29. claude_mpm/commands/mpm-help.md +14 -95
  30. claude_mpm/commands/mpm-organize.md +500 -0
  31. claude_mpm/config/agent_sources.py +27 -0
  32. claude_mpm/core/framework/formatters/content_formatter.py +3 -13
  33. claude_mpm/core/framework/loaders/agent_loader.py +8 -5
  34. claude_mpm/core/framework_loader.py +4 -2
  35. claude_mpm/core/logger.py +13 -0
  36. claude_mpm/core/output_style_manager.py +173 -43
  37. claude_mpm/core/socketio_pool.py +3 -3
  38. claude_mpm/core/unified_agent_registry.py +134 -16
  39. claude_mpm/hooks/claude_hooks/correlation_manager.py +60 -0
  40. claude_mpm/hooks/claude_hooks/event_handlers.py +211 -78
  41. claude_mpm/hooks/claude_hooks/hook_handler.py +6 -0
  42. claude_mpm/hooks/claude_hooks/installer.py +33 -10
  43. claude_mpm/hooks/claude_hooks/memory_integration.py +26 -9
  44. claude_mpm/hooks/claude_hooks/response_tracking.py +2 -3
  45. claude_mpm/hooks/claude_hooks/services/connection_manager.py +4 -0
  46. claude_mpm/hooks/memory_integration_hook.py +46 -1
  47. claude_mpm/init.py +0 -19
  48. claude_mpm/models/agent_definition.py +7 -0
  49. claude_mpm/scripts/claude-hook-handler.sh +58 -18
  50. claude_mpm/scripts/launch_monitor.py +93 -13
  51. claude_mpm/scripts/start_activity_logging.py +0 -0
  52. claude_mpm/services/agents/agent_recommendation_service.py +278 -0
  53. claude_mpm/services/agents/agent_review_service.py +280 -0
  54. claude_mpm/services/agents/deployment/agent_discovery_service.py +2 -3
  55. claude_mpm/services/agents/deployment/agent_template_builder.py +4 -2
  56. claude_mpm/services/agents/deployment/multi_source_deployment_service.py +188 -12
  57. claude_mpm/services/agents/deployment/remote_agent_discovery_service.py +531 -55
  58. claude_mpm/services/agents/git_source_manager.py +34 -0
  59. claude_mpm/services/agents/loading/base_agent_manager.py +1 -13
  60. claude_mpm/services/agents/sources/git_source_sync_service.py +8 -1
  61. claude_mpm/services/agents/toolchain_detector.py +10 -6
  62. claude_mpm/services/analysis/__init__.py +11 -1
  63. claude_mpm/services/analysis/clone_detector.py +1030 -0
  64. claude_mpm/services/command_deployment_service.py +81 -10
  65. claude_mpm/services/event_bus/config.py +3 -1
  66. claude_mpm/services/git/git_operations_service.py +93 -8
  67. claude_mpm/services/monitor/daemon.py +9 -2
  68. claude_mpm/services/monitor/daemon_manager.py +39 -3
  69. claude_mpm/services/monitor/server.py +225 -19
  70. claude_mpm/services/self_upgrade_service.py +120 -12
  71. claude_mpm/services/skills/__init__.py +3 -0
  72. claude_mpm/services/skills/git_skill_source_manager.py +32 -2
  73. claude_mpm/services/skills/selective_skill_deployer.py +704 -0
  74. claude_mpm/services/skills/skill_to_agent_mapper.py +406 -0
  75. claude_mpm/services/skills_deployer.py +126 -9
  76. claude_mpm/services/socketio/event_normalizer.py +15 -1
  77. claude_mpm/services/socketio/server/core.py +160 -21
  78. claude_mpm/services/version_control/git_operations.py +103 -0
  79. claude_mpm/utils/agent_filters.py +17 -44
  80. {claude_mpm-5.1.8.dist-info → claude_mpm-5.4.22.dist-info}/METADATA +47 -84
  81. {claude_mpm-5.1.8.dist-info → claude_mpm-5.4.22.dist-info}/RECORD +86 -176
  82. claude_mpm-5.4.22.dist-info/entry_points.txt +5 -0
  83. claude_mpm-5.4.22.dist-info/licenses/LICENSE +94 -0
  84. claude_mpm-5.4.22.dist-info/licenses/LICENSE-FAQ.md +153 -0
  85. claude_mpm/agents/BASE_AGENT_TEMPLATE.md +0 -292
  86. claude_mpm/agents/BASE_DOCUMENTATION.md +0 -53
  87. claude_mpm/agents/BASE_ENGINEER.md +0 -658
  88. claude_mpm/agents/BASE_OPS.md +0 -219
  89. claude_mpm/agents/BASE_PM.md +0 -480
  90. claude_mpm/agents/BASE_PROMPT_ENGINEER.md +0 -787
  91. claude_mpm/agents/BASE_QA.md +0 -167
  92. claude_mpm/agents/BASE_RESEARCH.md +0 -53
  93. claude_mpm/agents/base_agent.json +0 -31
  94. claude_mpm/agents/base_agent_loader.py +0 -601
  95. claude_mpm/cli/commands/agents_detect.py +0 -380
  96. claude_mpm/cli/commands/agents_recommend.py +0 -309
  97. claude_mpm/cli/ticket_cli.py +0 -35
  98. claude_mpm/commands/mpm-agents-auto-configure.md +0 -278
  99. claude_mpm/commands/mpm-agents-detect.md +0 -177
  100. claude_mpm/commands/mpm-agents-list.md +0 -131
  101. claude_mpm/commands/mpm-agents-recommend.md +0 -223
  102. claude_mpm/commands/mpm-config-view.md +0 -150
  103. claude_mpm/commands/mpm-ticket-organize.md +0 -304
  104. claude_mpm/dashboard/analysis_runner.py +0 -455
  105. claude_mpm/dashboard/index.html +0 -13
  106. claude_mpm/dashboard/open_dashboard.py +0 -66
  107. claude_mpm/dashboard/static/css/activity.css +0 -1958
  108. claude_mpm/dashboard/static/css/connection-status.css +0 -370
  109. claude_mpm/dashboard/static/css/dashboard.css +0 -4701
  110. claude_mpm/dashboard/static/js/components/activity-tree.js +0 -1871
  111. claude_mpm/dashboard/static/js/components/agent-hierarchy.js +0 -777
  112. claude_mpm/dashboard/static/js/components/agent-inference.js +0 -956
  113. claude_mpm/dashboard/static/js/components/build-tracker.js +0 -333
  114. claude_mpm/dashboard/static/js/components/code-simple.js +0 -857
  115. claude_mpm/dashboard/static/js/components/connection-debug.js +0 -654
  116. claude_mpm/dashboard/static/js/components/diff-viewer.js +0 -891
  117. claude_mpm/dashboard/static/js/components/event-processor.js +0 -542
  118. claude_mpm/dashboard/static/js/components/event-viewer.js +0 -1155
  119. claude_mpm/dashboard/static/js/components/export-manager.js +0 -368
  120. claude_mpm/dashboard/static/js/components/file-change-tracker.js +0 -443
  121. claude_mpm/dashboard/static/js/components/file-change-viewer.js +0 -690
  122. claude_mpm/dashboard/static/js/components/file-tool-tracker.js +0 -724
  123. claude_mpm/dashboard/static/js/components/file-viewer.js +0 -580
  124. claude_mpm/dashboard/static/js/components/hud-library-loader.js +0 -211
  125. claude_mpm/dashboard/static/js/components/hud-manager.js +0 -671
  126. claude_mpm/dashboard/static/js/components/hud-visualizer.js +0 -1718
  127. claude_mpm/dashboard/static/js/components/module-viewer.js +0 -2764
  128. claude_mpm/dashboard/static/js/components/session-manager.js +0 -579
  129. claude_mpm/dashboard/static/js/components/socket-manager.js +0 -368
  130. claude_mpm/dashboard/static/js/components/ui-state-manager.js +0 -749
  131. claude_mpm/dashboard/static/js/components/unified-data-viewer.js +0 -1824
  132. claude_mpm/dashboard/static/js/components/working-directory.js +0 -920
  133. claude_mpm/dashboard/static/js/connection-manager.js +0 -536
  134. claude_mpm/dashboard/static/js/dashboard.js +0 -1914
  135. claude_mpm/dashboard/static/js/extension-error-handler.js +0 -164
  136. claude_mpm/dashboard/static/js/socket-client.js +0 -1474
  137. claude_mpm/dashboard/static/js/tab-isolation-fix.js +0 -185
  138. claude_mpm/dashboard/static/socket.io.min.js +0 -7
  139. claude_mpm/dashboard/static/socket.io.v4.8.1.backup.js +0 -7
  140. claude_mpm/dashboard/templates/code_simple.html +0 -153
  141. claude_mpm/dashboard/templates/index.html +0 -606
  142. claude_mpm/dashboard/test_dashboard.html +0 -372
  143. claude_mpm/hooks/claude_hooks/__pycache__/__init__.cpython-313.pyc +0 -0
  144. claude_mpm/hooks/claude_hooks/__pycache__/event_handlers.cpython-313.pyc +0 -0
  145. claude_mpm/hooks/claude_hooks/__pycache__/hook_handler.cpython-313.pyc +0 -0
  146. claude_mpm/hooks/claude_hooks/__pycache__/memory_integration.cpython-313.pyc +0 -0
  147. claude_mpm/hooks/claude_hooks/__pycache__/response_tracking.cpython-313.pyc +0 -0
  148. claude_mpm/hooks/claude_hooks/__pycache__/tool_analysis.cpython-313.pyc +0 -0
  149. claude_mpm/hooks/claude_hooks/services/__pycache__/__init__.cpython-313.pyc +0 -0
  150. claude_mpm/hooks/claude_hooks/services/__pycache__/connection_manager_http.cpython-313.pyc +0 -0
  151. claude_mpm/hooks/claude_hooks/services/__pycache__/duplicate_detector.cpython-313.pyc +0 -0
  152. claude_mpm/hooks/claude_hooks/services/__pycache__/state_manager.cpython-313.pyc +0 -0
  153. claude_mpm/hooks/claude_hooks/services/__pycache__/subagent_processor.cpython-313.pyc +0 -0
  154. claude_mpm/scripts/mcp_server.py +0 -75
  155. claude_mpm/scripts/mcp_wrapper.py +0 -39
  156. claude_mpm/services/mcp_gateway/__init__.py +0 -159
  157. claude_mpm/services/mcp_gateway/auto_configure.py +0 -369
  158. claude_mpm/services/mcp_gateway/config/__init__.py +0 -17
  159. claude_mpm/services/mcp_gateway/config/config_loader.py +0 -296
  160. claude_mpm/services/mcp_gateway/config/config_schema.py +0 -243
  161. claude_mpm/services/mcp_gateway/config/configuration.py +0 -429
  162. claude_mpm/services/mcp_gateway/core/__init__.py +0 -43
  163. claude_mpm/services/mcp_gateway/core/base.py +0 -312
  164. claude_mpm/services/mcp_gateway/core/exceptions.py +0 -253
  165. claude_mpm/services/mcp_gateway/core/interfaces.py +0 -443
  166. claude_mpm/services/mcp_gateway/core/process_pool.py +0 -977
  167. claude_mpm/services/mcp_gateway/core/singleton_manager.py +0 -315
  168. claude_mpm/services/mcp_gateway/core/startup_verification.py +0 -316
  169. claude_mpm/services/mcp_gateway/main.py +0 -589
  170. claude_mpm/services/mcp_gateway/registry/__init__.py +0 -12
  171. claude_mpm/services/mcp_gateway/registry/service_registry.py +0 -412
  172. claude_mpm/services/mcp_gateway/registry/tool_registry.py +0 -489
  173. claude_mpm/services/mcp_gateway/server/__init__.py +0 -15
  174. claude_mpm/services/mcp_gateway/server/mcp_gateway.py +0 -414
  175. claude_mpm/services/mcp_gateway/server/stdio_handler.py +0 -372
  176. claude_mpm/services/mcp_gateway/server/stdio_server.py +0 -712
  177. claude_mpm/services/mcp_gateway/tools/__init__.py +0 -36
  178. claude_mpm/services/mcp_gateway/tools/base_adapter.py +0 -485
  179. claude_mpm/services/mcp_gateway/tools/document_summarizer.py +0 -789
  180. claude_mpm/services/mcp_gateway/tools/external_mcp_services.py +0 -654
  181. claude_mpm/services/mcp_gateway/tools/health_check_tool.py +0 -456
  182. claude_mpm/services/mcp_gateway/tools/hello_world.py +0 -551
  183. claude_mpm/services/mcp_gateway/tools/kuzu_memory_service.py +0 -555
  184. claude_mpm/services/mcp_gateway/utils/__init__.py +0 -14
  185. claude_mpm/services/mcp_gateway/utils/package_version_checker.py +0 -160
  186. claude_mpm/services/mcp_gateway/utils/update_preferences.py +0 -170
  187. claude_mpm-5.1.8.dist-info/entry_points.txt +0 -10
  188. claude_mpm-5.1.8.dist-info/licenses/LICENSE +0 -21
  189. /claude_mpm/agents/{OUTPUT_STYLE.md → CLAUDE_MPM_OUTPUT_STYLE.md} +0 -0
  190. {claude_mpm-5.1.8.dist-info → claude_mpm-5.4.22.dist-info}/WHEEL +0 -0
  191. {claude_mpm-5.1.8.dist-info → claude_mpm-5.4.22.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,500 @@
1
+ ---
2
+ namespace: mpm/system
3
+ command: organize
4
+ aliases: [mpm-organize]
5
+ migration_target: /mpm/system:organize
6
+ category: system
7
+ description: Organize all project files including documentation, source code, tests, scripts, and configuration with intelligent consolidation and pruning
8
+ ---
9
+ # /mpm-organize
10
+
11
+ Organize ALL project files into a clean, structured format with intelligent detection of existing patterns. Includes special handling for documentation consolidation, pruning, and triage into research/user/developer categories.
12
+
13
+ ## Usage
14
+
15
+ ```
16
+ /mpm-organize # Interactive mode with preview
17
+ /mpm-organize --dry-run # Preview changes without applying
18
+ /mpm-organize --force # Proceed even with uncommitted changes
19
+ /mpm-organize --no-backup # Skip backup creation (not recommended)
20
+ /mpm-organize --docs-only # Only organize documentation files
21
+ ```
22
+
23
+ ## Description
24
+
25
+ This slash command delegates to the **Project Organizer agent** to perform intelligent project organization across ALL file types. The agent analyzes your project structure, detects existing patterns, consolidates duplicates, removes stale content, and organizes everything into a clean, logical structure.
26
+
27
+ **Comprehensive Scope**: This command organizes ALL project files including:
28
+ - **Documentation** (.md, .rst, .txt) - consolidate, prune, triage into research/user/developer
29
+ - **Source code** - proper module structure and organization
30
+ - **Tests** - organized test suites
31
+ - **Scripts** - automation tools and utilities
32
+ - **Configuration** - project config files
33
+
34
+ **Smart Detection**: The agent first looks for existing organization patterns in your project (e.g., PROJECT_ORGANIZATION.md, CONTRIBUTING.md). If found, it respects and extends those patterns. If not found, it applies framework-appropriate defaults.
35
+
36
+ ## Features
37
+
38
+ - **📁 Pattern Detection**: Analyzes existing project structure and detects organization conventions
39
+ - **🔄 Consolidation**: Merges duplicate or related files (especially documentation)
40
+ - **✂️ Pruning**: Identifies and removes outdated, stale, or redundant content
41
+ - **📋 Triage**: Categorizes documentation into research/user/developer directories
42
+ - **🏗️ Code Organization**: Ensures proper module structure and file placement
43
+ - **🧪 Test Organization**: Organizes test suites into proper directories
44
+ - **📜 Script Organization**: Moves scripts to dedicated scripts/ directory
45
+ - **✅ Safe Operations**: Uses `git mv` for tracked files to preserve history
46
+ - **💾 Automatic Backups**: Creates backups before major reorganizations
47
+ - **📊 Organization Report**: Detailed summary of changes and recommendations
48
+ - **🎯 Smart Scope**: Full project or documentation-only mode (--docs-only)
49
+
50
+ ## Options
51
+
52
+ ### Safety Options
53
+ - `--dry-run`: Preview all changes without making them (recommended first run)
54
+ - `--no-backup`: Skip backup creation before reorganization (not recommended)
55
+ - `--force`: Proceed even with uncommitted changes (use with caution)
56
+
57
+ ### Scope Options
58
+ - `--docs-only`: Only organize documentation files (legacy behavior)
59
+ - `--code-only`: Only organize source code files
60
+ - `--tests-only`: Only organize test files
61
+ - `--scripts-only`: Only organize script files
62
+
63
+ ### Organization Options
64
+ - `--consolidate-only`: Only consolidate duplicate files, skip reorganization
65
+ - `--prune-only`: Only identify and remove stale files
66
+ - `--triage-only`: Only categorize files without moving them
67
+ - `--no-prune`: Skip pruning phase (keep all existing files)
68
+
69
+ ### Output Options
70
+ - `--verbose`: Show detailed analysis and reasoning
71
+ - `--quiet`: Minimal output, errors only
72
+ - `--report [path]`: Save organization report to file
73
+
74
+ ## What This Command Does
75
+
76
+ ### 1. Pattern Detection
77
+ - Scans existing project structure across all file types
78
+ - Identifies organization conventions (PROJECT_ORGANIZATION.md, CONTRIBUTING.md)
79
+ - Detects framework-specific patterns (Next.js, Django, Flask, etc.)
80
+ - Detects existing documentation organization
81
+ - Falls back to framework-appropriate defaults if no pattern found
82
+
83
+ ### 2. Standard Project Structure
84
+
85
+ If no existing pattern is detected, organizes according to project type:
86
+
87
+ **Documentation** (all project types):
88
+ ```
89
+ docs/
90
+ ├── research/ # Research findings, analysis, investigations
91
+ │ ├── spikes/ # Technical spikes and experiments
92
+ │ └── notes/ # Development notes and brainstorming
93
+ ├── user/ # User-facing documentation
94
+ │ ├── guides/ # How-to guides and tutorials
95
+ │ ├── faq/ # Frequently asked questions
96
+ │ └── examples/ # Usage examples
97
+ └── developer/ # Developer documentation
98
+ ├── api/ # API documentation
99
+ ├── architecture/ # Architecture decisions and diagrams
100
+ └── contributing/ # Contribution guidelines
101
+ ```
102
+
103
+ **Source Code** (framework-specific):
104
+ - Python: `src/package_name/` structure
105
+ - JavaScript/TypeScript: Framework conventions (Next.js, React, etc.)
106
+ - Other: Language-appropriate module structure
107
+
108
+ **Tests**: `tests/` with mirrored source structure
109
+
110
+ **Scripts**: `scripts/` for automation tools
111
+
112
+ **Configuration**: Root or `config/` depending on project size
113
+
114
+ ### 3. File Consolidation
115
+
116
+ Identifies and merges duplicate/similar files:
117
+
118
+ **Documentation**:
119
+ - Duplicate README files
120
+ - Similar guide documents
121
+ - Redundant architecture notes
122
+ - Multiple versions of same doc
123
+ - Scattered meeting notes
124
+
125
+ **Code**:
126
+ - Duplicate utility functions
127
+ - Similar helper modules
128
+ - Redundant configuration files
129
+
130
+ ### 4. Content Pruning
131
+
132
+ Removes or archives stale/obsolete content:
133
+
134
+ **Documentation**:
135
+ - Outdated documentation (last modified >6 months)
136
+ - Stale TODO lists and notes
137
+ - Obsolete architecture documents
138
+ - Deprecated API documentation
139
+ - Empty or placeholder files
140
+
141
+ **Code**:
142
+ - Commented-out code blocks
143
+ - Unused imports and dependencies
144
+ - Dead code (unreferenced functions/classes)
145
+
146
+ ### 5. File Categorization & Triage
147
+
148
+ Categorizes and organizes files by purpose:
149
+
150
+ **Documentation**:
151
+ - **Research**: Analysis, spikes, investigations, experiments
152
+ - **User**: Guides, tutorials, FAQs, how-tos
153
+ - **Developer**: API docs, architecture, contributing guides
154
+
155
+ **Code**:
156
+ - Source code to proper module structure
157
+ - Tests to organized test suites
158
+ - Scripts to scripts/ directory
159
+ - Configuration to appropriate locations
160
+
161
+ ### 6. Safe File Movement
162
+
163
+ For each file being organized:
164
+ 1. Analyzes file type, content, and purpose
165
+ 2. Determines optimal location based on detected patterns
166
+ 3. Uses `git mv` for version-controlled files
167
+ 4. Preserves git history
168
+ 5. Creates backup before major changes
169
+ 6. Validates move doesn't break imports or references
170
+
171
+ ### 7. Backup Creation
172
+
173
+ Before reorganization:
174
+ ```bash
175
+ backup_project_YYYYMMDD_HHMMSS.tar.gz # Full project backup (or docs-only)
176
+ ```
177
+
178
+ ### 8. Protected Files (Never Moved)
179
+
180
+ These files remain in project root:
181
+ - `README.md`, `CHANGELOG.md`, `LICENSE.md`
182
+ - `CONTRIBUTING.md`, `CODE_OF_CONDUCT.md`
183
+ - `CLAUDE.md`, `CODE.md`, `DEVELOPER.md`
184
+ - Package files: `package.json`, `pyproject.toml`, `Cargo.toml`, etc.
185
+ - Build configs: `Makefile`, `Dockerfile`, `docker-compose.yml`
186
+ - Git files: `.gitignore`, `.gitattributes`
187
+ - Environment templates: `.env.example`, `.env.sample`
188
+
189
+ ### 9. Files Excluded from Organization
190
+
191
+ Never touched:
192
+ - Build artifacts: `dist/`, `build/`, `node_modules/`, `__pycache__/`
193
+ - Version control: `.git/`, `.svn/`, `.hg/`
194
+ - Virtual environments: `venv/`, `.venv/`, `env/`
195
+ - IDE configs: `.vscode/`, `.idea/` (unless --config-only)
196
+
197
+ ### 10. Organization Report
198
+
199
+ Generates detailed report including:
200
+ - All files moved with before/after locations
201
+ - Files consolidated (merged) with change summary
202
+ - Files pruned (removed or archived) with reasoning
203
+ - Pattern analysis and detected conventions
204
+ - Import/reference validation results
205
+ - Recommendations for further improvements
206
+
207
+ ## Examples
208
+
209
+ ### Preview Full Project Organization (Recommended First Run)
210
+ ```bash
211
+ /mpm-organize --dry-run
212
+ ```
213
+ Shows what changes would be made across ALL project files without applying them.
214
+
215
+ ### Preview Documentation Organization Only
216
+ ```bash
217
+ /mpm-organize --docs-only --dry-run
218
+ ```
219
+ Shows what documentation changes would be made (legacy behavior).
220
+
221
+ ### Full Project Organization with Backup
222
+ ```bash
223
+ /mpm-organize
224
+ ```
225
+ Interactive mode with automatic backup before organizing all project files.
226
+
227
+ ### Organize Tests and Scripts Only
228
+ ```bash
229
+ /mpm-organize --tests-only --scripts-only
230
+ ```
231
+ Focus on organizing test files and scripts, leave everything else untouched.
232
+
233
+ ### Consolidate Duplicate Files Only
234
+ ```bash
235
+ /mpm-organize --consolidate-only --dry-run
236
+ ```
237
+ Preview which duplicate files would be merged across the project.
238
+
239
+ ### Identify Stale Files (All Types)
240
+ ```bash
241
+ /mpm-organize --prune-only --dry-run
242
+ ```
243
+ See which outdated files would be removed or archived.
244
+
245
+ ### Triage Documentation by Category
246
+ ```bash
247
+ /mpm-organize --docs-only --triage-only --verbose
248
+ ```
249
+ Categorize documentation into research/user/developer without moving files.
250
+
251
+ ### Full Organization Without Pruning
252
+ ```bash
253
+ /mpm-organize --no-prune
254
+ ```
255
+ Organize and consolidate all files but keep everything (no deletions).
256
+
257
+ ### Save Organization Report
258
+ ```bash
259
+ /mpm-organize --report /tmp/project-organize-report.md
260
+ ```
261
+ Save detailed organization report to file for review.
262
+
263
+ ## Implementation
264
+
265
+ This slash command delegates to the **Project Organizer agent** (`project-organizer`), which performs intelligent project organization based on detected patterns and content analysis across all file types.
266
+
267
+ The agent receives the command options as context and then:
268
+ 1. **Scans** for all project files (or scope-specific with --docs-only, --tests-only, etc.)
269
+ 2. **Detects** existing organization patterns (PROJECT_ORGANIZATION.md, CONTRIBUTING.md, framework conventions)
270
+ 3. **Analyzes** file content, purpose, and relationships
271
+ 4. **Categorizes** files by type and purpose (documentation by audience, code by module, tests by coverage)
272
+ 5. **Identifies** duplicates, stale content, and misplaced files
273
+ 6. **Validates** that moves won't break imports or references
274
+ 7. **Creates** safe reorganization plan with detailed reasoning
275
+ 8. **Executes** file moves with git integration (preserves history)
276
+ 9. **Generates** comprehensive organization report
277
+
278
+ When you invoke `/mpm-organize [options]`, Claude MPM:
279
+ - Passes the options to the Project Organizer agent as task context
280
+ - The agent executes the comprehensive organization workflow
281
+ - Results are returned through structured output with detailed change log
282
+
283
+ **Scope Control**:
284
+ - Default: Organizes ALL project files (comprehensive)
285
+ - `--docs-only`: Only documentation files (legacy behavior)
286
+ - `--code-only`, `--tests-only`, `--scripts-only`: Specific file types
287
+
288
+ ## Expected Output
289
+
290
+ ### Dry Run Mode (Full Project)
291
+ ```
292
+ 🔍 Analyzing project structure...
293
+ ✓ Detected PROJECT_ORGANIZATION.md - using project standards
294
+ ✓ Found Python Flask project with standard structure
295
+ ✓ Found 23 documentation files
296
+ ✓ Found 15 misplaced test files
297
+ ✓ Found 8 scripts in root directory
298
+ ✓ Identified 3 duplicate READMEs
299
+ ✓ Found 5 stale files
300
+
301
+ 📁 Proposed Changes:
302
+
303
+ Documentation:
304
+ Consolidate:
305
+ → Merge README_OLD.md + README_BACKUP.md → docs/user/README.md
306
+ → Merge architecture-v1.md + architecture-v2.md → docs/developer/architecture/decisions.md
307
+
308
+ Organize:
309
+ docs/research/
310
+ ← spike-oauth.md (from root)
311
+ ← performance-analysis.md (from root)
312
+ docs/user/guides/
313
+ ← getting-started.md (from root)
314
+ ← installation.md (from docs/)
315
+
316
+ Prune:
317
+ ✂ Remove TODO_2023.md (last modified 18 months ago)
318
+ ✂ Archive deprecated-api.md → docs/_archive/
319
+
320
+ Tests:
321
+ tests/unit/
322
+ ← test_auth.py (from root)
323
+ ← test_utils.py (from src/)
324
+ tests/integration/
325
+ ← test_api_integration.py (from root)
326
+
327
+ Scripts:
328
+ scripts/
329
+ ← deploy.sh (from root)
330
+ ← run_tests.py (from root)
331
+ ← backup_db.sh (from utils/)
332
+
333
+ Source Code:
334
+ src/myapp/utils/
335
+ → Consolidate helpers.py + utility_functions.py → utils.py
336
+
337
+ 📊 Summary:
338
+ - 8 documentation files to move
339
+ - 4 files to consolidate (2 merged)
340
+ - 5 files to prune (3 removed, 2 archived)
341
+ - 15 test files to organize
342
+ - 8 scripts to move
343
+ - 2 code files to consolidate
344
+
345
+ Run without --dry-run to apply changes.
346
+ ```
347
+
348
+ ### Dry Run Mode (Documentation Only)
349
+ ```bash
350
+ /mpm-organize --docs-only --dry-run
351
+ ```
352
+ ```
353
+ 🔍 Analyzing documentation structure...
354
+ ✓ Detected existing pattern: docs/guides/ and docs/reference/
355
+ ✓ Found 23 documentation files
356
+ ✓ Identified 3 duplicate READMEs
357
+ ✓ Found 5 stale documentation files
358
+
359
+ 📁 Proposed Changes:
360
+
361
+ Consolidate:
362
+ → Merge README_OLD.md + README_BACKUP.md → docs/user/README.md
363
+ → Merge architecture-v1.md + architecture-v2.md → docs/developer/architecture/decisions.md
364
+
365
+ Prune:
366
+ ✂ Remove TODO_2023.md (last modified 18 months ago)
367
+ ✂ Archive deprecated-api.md → docs/_archive/
368
+ ✂ Remove empty placeholder.md
369
+
370
+ Organize:
371
+ docs/research/
372
+ ← spike-oauth.md (from root)
373
+ ← performance-analysis.md (from root)
374
+ docs/user/guides/
375
+ ← getting-started.md (from root)
376
+ ← installation.md (from docs/)
377
+
378
+ 📊 Summary:
379
+ - 8 documentation files to move
380
+ - 4 files to consolidate (2 merged files)
381
+ - 5 files to prune (3 removed, 2 archived)
382
+
383
+ Run without --dry-run to apply changes.
384
+ ```
385
+
386
+ ### Actual Organization
387
+ ```
388
+ 🔍 Analyzing project structure...
389
+ ✓ Detected PROJECT_ORGANIZATION.md - using project standards
390
+ ✓ Created backup: backup_project_20250102_143022.tar.gz
391
+
392
+ 📁 Organizing project files...
393
+ ✓ Consolidated README_OLD.md + README_BACKUP.md → docs/user/README.md
394
+ ✓ Moved spike-oauth.md → docs/research/
395
+ ✓ Moved test_auth.py → tests/unit/
396
+ ✓ Moved deploy.sh → scripts/
397
+ ✓ Consolidated helpers.py + utility_functions.py → src/myapp/utils/utils.py
398
+ ✓ Pruned TODO_2023.md (stale)
399
+ ✓ Archived deprecated-api.md
400
+
401
+ ✅ Project organization complete!
402
+
403
+ 📊 Report saved to: /tmp/project-organization-report.md
404
+ ```
405
+
406
+ ## Safety Guarantees
407
+
408
+ - **Full Project Backup**: Backup of all affected files before changes (unless --no-backup)
409
+ - **Git Integration**: Uses `git mv` to preserve file history for tracked files
410
+ - **Dry Run Available**: Preview all changes before applying (--dry-run)
411
+ - **Import Validation**: Validates that code moves won't break imports/references
412
+ - **Protected Files**: Critical root files never moved (README.md, package.json, etc.)
413
+ - **Rollback Support**: Backup enables full rollback if needed
414
+ - **Conservative Pruning**: Stale files are archived rather than deleted when in doubt
415
+ - **Scope Control**: Limit changes to specific file types (--docs-only, --tests-only, etc.)
416
+
417
+ ## When to Use This Command
418
+
419
+ Use `/mpm-organize` when:
420
+ - **Project has grown organically** and structure has become messy
421
+ - **Test files are scattered** across the codebase
422
+ - **Scripts are in root** instead of scripts/ directory
423
+ - **Documentation is disorganized** with duplicates and stale content
424
+ - **Code has duplicated utilities** that should be consolidated
425
+ - **Starting a new project** and establishing clean structure
426
+ - **Before a major release** (clean up everything)
427
+ - **After a major refactor** (reorganize changed files)
428
+ - **When onboarding new team members** (clear, organized structure)
429
+ - **After accumulating research notes** and experimental code
430
+
431
+ ## Best Practices
432
+
433
+ 1. **Always Start with Dry Run**: Use `--dry-run` first to preview ALL changes
434
+ 2. **Commit First**: Commit your work before organizing (or use --force, but not recommended)
435
+ 3. **Start Small**: Use `--docs-only` first, then expand to full project organization
436
+ 4. **Review Proposed Changes**: Carefully review consolidations and moves
437
+ 5. **Verify Pruning Decisions**: Review stale files before removal, some may still be valuable
438
+ 6. **Test After Organization**: Run tests after organizing to ensure imports still work
439
+ 7. **Update Links**: Check that documentation links and imports still work
440
+ 8. **Document Structure**: Update README or PROJECT_ORGANIZATION.md to reflect new structure
441
+ 9. **Use Scope Flags**: Limit scope with `--docs-only`, `--tests-only`, etc. for focused changes
442
+ 10. **Review Report**: Always check the organization report for detailed change log
443
+
444
+ ## Notes
445
+
446
+ - This slash command delegates to the **Project Organizer agent** (`project-organizer`)
447
+ - The agent performs intelligent organization across **all project file types**
448
+ - **Default behavior**: Organizes ALL files (comprehensive project organization)
449
+ - **Legacy behavior**: Use `--docs-only` to only organize documentation (old default)
450
+ - Integrates with git to preserve file history
451
+ - Creates comprehensive reports for audit trails
452
+ - Can be run repeatedly safely (idempotent within scope)
453
+ - Detects existing patterns and respects them (PROJECT_ORGANIZATION.md, CONTRIBUTING.md)
454
+ - Falls back to framework-appropriate defaults if no pattern detected
455
+
456
+ ## What Gets Organized (by Default)
457
+
458
+ **ALL project files by default**, including:
459
+
460
+ **Documentation**:
461
+ - Markdown files (*.md)
462
+ - reStructuredText files (*.rst)
463
+ - Text documentation (*.txt in docs/ or with doc-like names)
464
+ - README files in various locations (except root README.md)
465
+ - Guide and tutorial files
466
+ - Architecture and design documents
467
+
468
+ **Source Code**:
469
+ - Python files (*.py) - organized into proper module structure
470
+ - JavaScript/TypeScript (*.js, *.ts, *.jsx, *.tsx)
471
+ - Other language source files
472
+ - Utilities and helper modules
473
+
474
+ **Tests**:
475
+ - Unit tests (*_test.*, test_*.*)
476
+ - Integration tests
477
+ - Test fixtures and utilities
478
+
479
+ **Scripts**:
480
+ - Shell scripts (*.sh, *.bash)
481
+ - Python scripts (identified by patterns)
482
+ - Build and deployment scripts
483
+
484
+ **Configuration** (with caution):
485
+ - Project-specific configs (not package.json, pyproject.toml, etc.)
486
+ - Environment config templates
487
+
488
+ **Files NEVER touched (protected)**:
489
+ - Root README.md, CHANGELOG.md, LICENSE.md
490
+ - Package files (package.json, pyproject.toml, Cargo.toml, etc.)
491
+ - Build artifacts (dist/, build/, target/, node_modules/, __pycache__/)
492
+ - Git files (.git/, .gitignore, .gitattributes)
493
+ - CI/CD files (.github/, .gitlab-ci.yml, etc.)
494
+ - Virtual environments (venv/, .venv/, env/)
495
+
496
+ ## Related Commands
497
+
498
+ - `/mpm-init`: Initialize or update project documentation and structure
499
+ - `/mpm-doctor`: Diagnose project health and issues (includes documentation checks)
500
+ - `/mpm-status`: Check current project state
@@ -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