claude-mpm 4.15.6__py3-none-any.whl → 4.21.3__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 (209) hide show
  1. claude_mpm/VERSION +1 -1
  2. claude_mpm/agents/BASE_ENGINEER.md +286 -0
  3. claude_mpm/agents/BASE_PM.md +272 -23
  4. claude_mpm/agents/PM_INSTRUCTIONS.md +49 -0
  5. claude_mpm/agents/agent_loader.py +4 -4
  6. claude_mpm/agents/templates/engineer.json +5 -1
  7. claude_mpm/agents/templates/php-engineer.json +10 -4
  8. claude_mpm/agents/templates/python_engineer.json +8 -3
  9. claude_mpm/agents/templates/rust_engineer.json +12 -7
  10. claude_mpm/agents/templates/svelte-engineer.json +225 -0
  11. claude_mpm/cli/commands/__init__.py +2 -0
  12. claude_mpm/cli/commands/mpm_init/__init__.py +73 -0
  13. claude_mpm/cli/commands/mpm_init/core.py +525 -0
  14. claude_mpm/cli/commands/mpm_init/display.py +341 -0
  15. claude_mpm/cli/commands/mpm_init/git_activity.py +427 -0
  16. claude_mpm/cli/commands/mpm_init/modes.py +397 -0
  17. claude_mpm/cli/commands/mpm_init/prompts.py +442 -0
  18. claude_mpm/cli/commands/mpm_init_cli.py +396 -0
  19. claude_mpm/cli/commands/mpm_init_handler.py +67 -1
  20. claude_mpm/cli/commands/skills.py +488 -0
  21. claude_mpm/cli/executor.py +2 -0
  22. claude_mpm/cli/parsers/base_parser.py +7 -0
  23. claude_mpm/cli/parsers/mpm_init_parser.py +42 -0
  24. claude_mpm/cli/parsers/skills_parser.py +137 -0
  25. claude_mpm/cli/startup.py +57 -0
  26. claude_mpm/commands/mpm-auto-configure.md +52 -0
  27. claude_mpm/commands/mpm-help.md +6 -0
  28. claude_mpm/commands/mpm-init.md +112 -6
  29. claude_mpm/commands/mpm-resume.md +372 -0
  30. claude_mpm/commands/mpm-version.md +113 -0
  31. claude_mpm/commands/mpm.md +2 -0
  32. claude_mpm/config/agent_config.py +2 -2
  33. claude_mpm/constants.py +12 -0
  34. claude_mpm/core/config.py +42 -0
  35. claude_mpm/core/factories.py +1 -1
  36. claude_mpm/core/interfaces.py +56 -1
  37. claude_mpm/core/optimized_agent_loader.py +3 -3
  38. claude_mpm/hooks/__init__.py +8 -0
  39. claude_mpm/hooks/claude_hooks/response_tracking.py +35 -1
  40. claude_mpm/hooks/session_resume_hook.py +121 -0
  41. claude_mpm/models/resume_log.py +340 -0
  42. claude_mpm/services/agents/auto_config_manager.py +1 -1
  43. claude_mpm/services/agents/deployment/agent_configuration_manager.py +1 -1
  44. claude_mpm/services/agents/deployment/agent_record_service.py +1 -1
  45. claude_mpm/services/agents/deployment/agent_validator.py +17 -1
  46. claude_mpm/services/agents/deployment/async_agent_deployment.py +1 -1
  47. claude_mpm/services/agents/deployment/local_template_deployment.py +1 -1
  48. claude_mpm/services/agents/local_template_manager.py +1 -1
  49. claude_mpm/services/agents/recommender.py +47 -0
  50. claude_mpm/services/cli/resume_service.py +617 -0
  51. claude_mpm/services/cli/session_manager.py +87 -0
  52. claude_mpm/services/cli/session_pause_manager.py +504 -0
  53. claude_mpm/services/cli/session_resume_helper.py +372 -0
  54. claude_mpm/services/core/base.py +26 -11
  55. claude_mpm/services/core/interfaces.py +56 -1
  56. claude_mpm/services/core/models/agent_config.py +3 -0
  57. claude_mpm/services/core/models/process.py +4 -0
  58. claude_mpm/services/core/path_resolver.py +1 -1
  59. claude_mpm/services/diagnostics/models.py +21 -0
  60. claude_mpm/services/event_bus/relay.py +23 -7
  61. claude_mpm/services/infrastructure/resume_log_generator.py +439 -0
  62. claude_mpm/services/local_ops/__init__.py +2 -0
  63. claude_mpm/services/mcp_config_manager.py +7 -131
  64. claude_mpm/services/mcp_gateway/auto_configure.py +31 -25
  65. claude_mpm/services/mcp_gateway/core/process_pool.py +19 -10
  66. claude_mpm/services/mcp_gateway/tools/external_mcp_services.py +26 -21
  67. claude_mpm/services/memory/failure_tracker.py +19 -4
  68. claude_mpm/services/session_manager.py +205 -1
  69. claude_mpm/services/unified/deployment_strategies/local.py +1 -1
  70. claude_mpm/services/version_service.py +104 -1
  71. claude_mpm/skills/__init__.py +21 -0
  72. claude_mpm/skills/agent_skills_injector.py +324 -0
  73. claude_mpm/skills/bundled/LICENSE_ATTRIBUTIONS.md +79 -0
  74. claude_mpm/skills/bundled/api-documentation.md +393 -0
  75. claude_mpm/skills/bundled/async-testing.md +571 -0
  76. claude_mpm/skills/bundled/code-review.md +143 -0
  77. claude_mpm/skills/bundled/collaboration/brainstorming/SKILL.md +79 -0
  78. claude_mpm/skills/bundled/collaboration/dispatching-parallel-agents/SKILL.md +178 -0
  79. claude_mpm/skills/bundled/collaboration/dispatching-parallel-agents/references/agent-prompts.md +577 -0
  80. claude_mpm/skills/bundled/collaboration/dispatching-parallel-agents/references/coordination-patterns.md +467 -0
  81. claude_mpm/skills/bundled/collaboration/dispatching-parallel-agents/references/examples.md +537 -0
  82. claude_mpm/skills/bundled/collaboration/dispatching-parallel-agents/references/troubleshooting.md +730 -0
  83. claude_mpm/skills/bundled/collaboration/requesting-code-review/SKILL.md +112 -0
  84. claude_mpm/skills/bundled/collaboration/requesting-code-review/references/code-reviewer-template.md +146 -0
  85. claude_mpm/skills/bundled/collaboration/requesting-code-review/references/review-examples.md +412 -0
  86. claude_mpm/skills/bundled/collaboration/writing-plans/SKILL.md +81 -0
  87. claude_mpm/skills/bundled/collaboration/writing-plans/references/best-practices.md +362 -0
  88. claude_mpm/skills/bundled/collaboration/writing-plans/references/plan-structure-templates.md +312 -0
  89. claude_mpm/skills/bundled/database-migration.md +199 -0
  90. claude_mpm/skills/bundled/debugging/root-cause-tracing/SKILL.md +152 -0
  91. claude_mpm/skills/bundled/debugging/root-cause-tracing/references/advanced-techniques.md +668 -0
  92. claude_mpm/skills/bundled/debugging/root-cause-tracing/references/examples.md +587 -0
  93. claude_mpm/skills/bundled/debugging/root-cause-tracing/references/integration.md +438 -0
  94. claude_mpm/skills/bundled/debugging/root-cause-tracing/references/tracing-techniques.md +391 -0
  95. claude_mpm/skills/bundled/debugging/systematic-debugging/CREATION-LOG.md +119 -0
  96. claude_mpm/skills/bundled/debugging/systematic-debugging/SKILL.md +148 -0
  97. claude_mpm/skills/bundled/debugging/systematic-debugging/references/anti-patterns.md +483 -0
  98. claude_mpm/skills/bundled/debugging/systematic-debugging/references/examples.md +452 -0
  99. claude_mpm/skills/bundled/debugging/systematic-debugging/references/troubleshooting.md +449 -0
  100. claude_mpm/skills/bundled/debugging/systematic-debugging/references/workflow.md +411 -0
  101. claude_mpm/skills/bundled/debugging/systematic-debugging/test-academic.md +14 -0
  102. claude_mpm/skills/bundled/debugging/systematic-debugging/test-pressure-1.md +58 -0
  103. claude_mpm/skills/bundled/debugging/systematic-debugging/test-pressure-2.md +68 -0
  104. claude_mpm/skills/bundled/debugging/systematic-debugging/test-pressure-3.md +69 -0
  105. claude_mpm/skills/bundled/debugging/verification-before-completion/SKILL.md +131 -0
  106. claude_mpm/skills/bundled/debugging/verification-before-completion/references/gate-function.md +325 -0
  107. claude_mpm/skills/bundled/debugging/verification-before-completion/references/integration-and-workflows.md +490 -0
  108. claude_mpm/skills/bundled/debugging/verification-before-completion/references/red-flags-and-failures.md +425 -0
  109. claude_mpm/skills/bundled/debugging/verification-before-completion/references/verification-patterns.md +499 -0
  110. claude_mpm/skills/bundled/docker-containerization.md +194 -0
  111. claude_mpm/skills/bundled/express-local-dev.md +1429 -0
  112. claude_mpm/skills/bundled/fastapi-local-dev.md +1199 -0
  113. claude_mpm/skills/bundled/git-workflow.md +414 -0
  114. claude_mpm/skills/bundled/imagemagick.md +204 -0
  115. claude_mpm/skills/bundled/json-data-handling.md +223 -0
  116. claude_mpm/skills/bundled/main/artifacts-builder/SKILL.md +86 -0
  117. claude_mpm/skills/bundled/main/internal-comms/SKILL.md +43 -0
  118. claude_mpm/skills/bundled/main/internal-comms/examples/3p-updates.md +47 -0
  119. claude_mpm/skills/bundled/main/internal-comms/examples/company-newsletter.md +65 -0
  120. claude_mpm/skills/bundled/main/internal-comms/examples/faq-answers.md +30 -0
  121. claude_mpm/skills/bundled/main/internal-comms/examples/general-comms.md +16 -0
  122. claude_mpm/skills/bundled/main/mcp-builder/SKILL.md +160 -0
  123. claude_mpm/skills/bundled/main/mcp-builder/reference/design_principles.md +412 -0
  124. claude_mpm/skills/bundled/main/mcp-builder/reference/evaluation.md +602 -0
  125. claude_mpm/skills/bundled/main/mcp-builder/reference/mcp_best_practices.md +915 -0
  126. claude_mpm/skills/bundled/main/mcp-builder/reference/node_mcp_server.md +916 -0
  127. claude_mpm/skills/bundled/main/mcp-builder/reference/python_mcp_server.md +752 -0
  128. claude_mpm/skills/bundled/main/mcp-builder/reference/workflow.md +1237 -0
  129. claude_mpm/skills/bundled/main/mcp-builder/scripts/connections.py +157 -0
  130. claude_mpm/skills/bundled/main/mcp-builder/scripts/evaluation.py +425 -0
  131. claude_mpm/skills/bundled/main/skill-creator/SKILL.md +189 -0
  132. claude_mpm/skills/bundled/main/skill-creator/references/best-practices.md +500 -0
  133. claude_mpm/skills/bundled/main/skill-creator/references/creation-workflow.md +464 -0
  134. claude_mpm/skills/bundled/main/skill-creator/references/examples.md +619 -0
  135. claude_mpm/skills/bundled/main/skill-creator/references/progressive-disclosure.md +437 -0
  136. claude_mpm/skills/bundled/main/skill-creator/references/skill-structure.md +231 -0
  137. claude_mpm/skills/bundled/main/skill-creator/scripts/init_skill.py +303 -0
  138. claude_mpm/skills/bundled/main/skill-creator/scripts/package_skill.py +113 -0
  139. claude_mpm/skills/bundled/main/skill-creator/scripts/quick_validate.py +72 -0
  140. claude_mpm/skills/bundled/nextjs-local-dev.md +807 -0
  141. claude_mpm/skills/bundled/pdf.md +141 -0
  142. claude_mpm/skills/bundled/performance-profiling.md +567 -0
  143. claude_mpm/skills/bundled/php/espocrm-development/SKILL.md +170 -0
  144. claude_mpm/skills/bundled/php/espocrm-development/references/architecture.md +602 -0
  145. claude_mpm/skills/bundled/php/espocrm-development/references/common-tasks.md +821 -0
  146. claude_mpm/skills/bundled/php/espocrm-development/references/development-workflow.md +742 -0
  147. claude_mpm/skills/bundled/php/espocrm-development/references/frontend-customization.md +726 -0
  148. claude_mpm/skills/bundled/php/espocrm-development/references/hooks-and-services.md +764 -0
  149. claude_mpm/skills/bundled/php/espocrm-development/references/testing-debugging.md +831 -0
  150. claude_mpm/skills/bundled/refactoring-patterns.md +180 -0
  151. claude_mpm/skills/bundled/rust/desktop-applications/SKILL.md +226 -0
  152. claude_mpm/skills/bundled/rust/desktop-applications/references/architecture-patterns.md +901 -0
  153. claude_mpm/skills/bundled/rust/desktop-applications/references/native-gui-frameworks.md +901 -0
  154. claude_mpm/skills/bundled/rust/desktop-applications/references/platform-integration.md +775 -0
  155. claude_mpm/skills/bundled/rust/desktop-applications/references/state-management.md +937 -0
  156. claude_mpm/skills/bundled/rust/desktop-applications/references/tauri-framework.md +770 -0
  157. claude_mpm/skills/bundled/rust/desktop-applications/references/testing-deployment.md +961 -0
  158. claude_mpm/skills/bundled/security-scanning.md +327 -0
  159. claude_mpm/skills/bundled/systematic-debugging.md +473 -0
  160. claude_mpm/skills/bundled/test-driven-development.md +378 -0
  161. claude_mpm/skills/bundled/testing/condition-based-waiting/SKILL.md +119 -0
  162. claude_mpm/skills/bundled/testing/condition-based-waiting/references/patterns-and-implementation.md +253 -0
  163. claude_mpm/skills/bundled/testing/test-driven-development/SKILL.md +145 -0
  164. claude_mpm/skills/bundled/testing/test-driven-development/references/anti-patterns.md +543 -0
  165. claude_mpm/skills/bundled/testing/test-driven-development/references/examples.md +741 -0
  166. claude_mpm/skills/bundled/testing/test-driven-development/references/integration.md +470 -0
  167. claude_mpm/skills/bundled/testing/test-driven-development/references/philosophy.md +458 -0
  168. claude_mpm/skills/bundled/testing/test-driven-development/references/workflow.md +639 -0
  169. claude_mpm/skills/bundled/testing/testing-anti-patterns/SKILL.md +140 -0
  170. claude_mpm/skills/bundled/testing/testing-anti-patterns/references/completeness-anti-patterns.md +572 -0
  171. claude_mpm/skills/bundled/testing/testing-anti-patterns/references/core-anti-patterns.md +411 -0
  172. claude_mpm/skills/bundled/testing/testing-anti-patterns/references/detection-guide.md +569 -0
  173. claude_mpm/skills/bundled/testing/testing-anti-patterns/references/tdd-connection.md +695 -0
  174. claude_mpm/skills/bundled/testing/webapp-testing/SKILL.md +184 -0
  175. claude_mpm/skills/bundled/testing/webapp-testing/decision-tree.md +459 -0
  176. claude_mpm/skills/bundled/testing/webapp-testing/examples/console_logging.py +35 -0
  177. claude_mpm/skills/bundled/testing/webapp-testing/examples/element_discovery.py +44 -0
  178. claude_mpm/skills/bundled/testing/webapp-testing/examples/static_html_automation.py +34 -0
  179. claude_mpm/skills/bundled/testing/webapp-testing/playwright-patterns.md +479 -0
  180. claude_mpm/skills/bundled/testing/webapp-testing/reconnaissance-pattern.md +687 -0
  181. claude_mpm/skills/bundled/testing/webapp-testing/scripts/with_server.py +129 -0
  182. claude_mpm/skills/bundled/testing/webapp-testing/server-management.md +758 -0
  183. claude_mpm/skills/bundled/testing/webapp-testing/troubleshooting.md +868 -0
  184. claude_mpm/skills/bundled/vite-local-dev.md +1061 -0
  185. claude_mpm/skills/bundled/web-performance-optimization.md +2305 -0
  186. claude_mpm/skills/bundled/xlsx.md +157 -0
  187. claude_mpm/skills/registry.py +97 -9
  188. claude_mpm/skills/skills_registry.py +348 -0
  189. claude_mpm/skills/skills_service.py +739 -0
  190. claude_mpm/tools/code_tree_analyzer/__init__.py +45 -0
  191. claude_mpm/tools/code_tree_analyzer/analysis.py +299 -0
  192. claude_mpm/tools/code_tree_analyzer/cache.py +131 -0
  193. claude_mpm/tools/code_tree_analyzer/core.py +380 -0
  194. claude_mpm/tools/code_tree_analyzer/discovery.py +403 -0
  195. claude_mpm/tools/code_tree_analyzer/events.py +168 -0
  196. claude_mpm/tools/code_tree_analyzer/gitignore.py +308 -0
  197. claude_mpm/tools/code_tree_analyzer/models.py +39 -0
  198. claude_mpm/tools/code_tree_analyzer/multilang_analyzer.py +224 -0
  199. claude_mpm/tools/code_tree_analyzer/python_analyzer.py +284 -0
  200. claude_mpm/utils/agent_dependency_loader.py +2 -2
  201. {claude_mpm-4.15.6.dist-info → claude_mpm-4.21.3.dist-info}/METADATA +211 -33
  202. {claude_mpm-4.15.6.dist-info → claude_mpm-4.21.3.dist-info}/RECORD +206 -64
  203. claude_mpm/agents/INSTRUCTIONS_OLD_DEPRECATED.md +0 -602
  204. claude_mpm/cli/commands/mpm_init.py +0 -2008
  205. claude_mpm/tools/code_tree_analyzer.py +0 -1825
  206. {claude_mpm-4.15.6.dist-info → claude_mpm-4.21.3.dist-info}/WHEEL +0 -0
  207. {claude_mpm-4.15.6.dist-info → claude_mpm-4.21.3.dist-info}/entry_points.txt +0 -0
  208. {claude_mpm-4.15.6.dist-info → claude_mpm-4.21.3.dist-info}/licenses/LICENSE +0 -0
  209. {claude_mpm-4.15.6.dist-info → claude_mpm-4.21.3.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,730 @@
1
+ # Troubleshooting
2
+
3
+ Complete guide to handling conflicts, verification strategies, and resolving common problems in parallel agent dispatch.
4
+
5
+ ## Conflict Detection
6
+
7
+ ### File-Level Conflicts
8
+
9
+ **Symptom:** Multiple agents modified the same file
10
+
11
+ **Detection:**
12
+ ```bash
13
+ # After agent returns, check which files changed
14
+ git diff --name-only
15
+
16
+ # Compare with other agents' file lists
17
+ # If overlap exists → conflict potential
18
+ ```
19
+
20
+ **Resolution strategy:**
21
+
22
+ ```
23
+ Level 1: Non-overlapping changes
24
+ - Agent A changed lines 10-20
25
+ - Agent B changed lines 50-60
26
+ → Git auto-merge handles this
27
+ → Verify: Run tests after merge
28
+
29
+ Level 2: Nearby changes
30
+ - Agent A changed lines 10-20
31
+ - Agent B changed lines 25-35
32
+ → Git might merge, but logic conflict possible
33
+ → Verify: Review both changes for interaction
34
+ → Test: Run full suite, check edge cases
35
+
36
+ Level 3: Overlapping changes
37
+ - Agent A changed lines 10-20
38
+ - Agent B changed lines 15-25
39
+ → Git merge conflict
40
+ → Verify: Understand both changes
41
+ → Resolve: Manual merge or redesign
42
+ ```
43
+
44
+ ### Logic-Level Conflicts
45
+
46
+ **Symptom:** No merge conflicts, but changes interact poorly
47
+
48
+ **Example:**
49
+ ```javascript
50
+ // Agent A changed function signature
51
+ function processPayment(userId, amount) { ... }
52
+ // Previously: processPayment(amount)
53
+
54
+ // Agent B added calls using old signature
55
+ processPayment(100); // Now breaks!
56
+ ```
57
+
58
+ **Detection strategy:**
59
+
60
+ 1. **Review all agent summaries** before integrating
61
+ 2. **Identify interface changes** (function signatures, API contracts)
62
+ 3. **Check if other agents** use those interfaces
63
+ 4. **Run full test suite** after each integration
64
+ 5. **Watch for new failures** in code you didn't touch
65
+
66
+ **Prevention:**
67
+
68
+ ```markdown
69
+ Agent prompts should specify:
70
+
71
+ Constraints:
72
+ - Do NOT change public interfaces without coordination
73
+ - Do NOT modify shared utilities
74
+ - If you must change a signature, report it before implementing
75
+ ```
76
+
77
+ ### State-Level Conflicts
78
+
79
+ **Symptom:** Tests pass individually but fail when integrated
80
+
81
+ **Example:**
82
+ ```
83
+ Agent A: Clears cache on startup
84
+ Agent B: Expects cache to be populated
85
+
86
+ Individually:
87
+ - Agent A tests: Cache clearing works ✓
88
+ - Agent B tests: Cache usage works ✓
89
+
90
+ Together:
91
+ - Agent B tests fail: Cache is empty ✗
92
+ ```
93
+
94
+ **Detection:**
95
+ ```bash
96
+ # Test each agent's changes in isolation
97
+ git checkout agent-A-branch
98
+ npm test # Pass ✓
99
+
100
+ git checkout agent-B-branch
101
+ npm test # Pass ✓
102
+
103
+ # Test integrated
104
+ git checkout integration-branch
105
+ npm test # Fail ✗ → State conflict detected
106
+ ```
107
+
108
+ **Resolution:**
109
+ 1. Understand state assumptions each agent made
110
+ 2. Determine correct initialization order
111
+ 3. Add explicit state setup in tests
112
+ 4. Or refactor to remove shared state dependency
113
+
114
+ ## Verification Strategies
115
+
116
+ ### Strategy 1: Progressive Integration
117
+
118
+ **Approach:** Integrate one agent at a time, verify between each
119
+
120
+ ```bash
121
+ # Start from clean main
122
+ git checkout main
123
+
124
+ # Integrate Agent 1
125
+ git merge agent-1-fixes
126
+ npm test # Verify Agent 1 only
127
+ # If pass: continue
128
+ # If fail: fix Agent 1 before integrating others
129
+
130
+ # Integrate Agent 2
131
+ git merge agent-2-fixes
132
+ npm test # Verify Agent 1 + 2
133
+ # If pass: continue
134
+ # If fail: identify which combination breaks
135
+
136
+ # Integrate Agent 3
137
+ git merge agent-3-fixes
138
+ npm test # Verify all 3
139
+ ```
140
+
141
+ **Benefits:**
142
+ - Isolates which integration causes failures
143
+ - Easier to debug conflicts
144
+ - Clear rollback points
145
+
146
+ **Cost:**
147
+ - More integration steps
148
+ - Takes longer than all-at-once
149
+
150
+ **Use when:** High risk of conflicts, complex changes
151
+
152
+ ### Strategy 2: Parallel Verification
153
+
154
+ **Approach:** Verify each agent's changes in parallel, then integrate all
155
+
156
+ ```bash
157
+ # Parallel verification (can run simultaneously)
158
+ # Terminal 1
159
+ git checkout agent-1-fixes
160
+ npm test # Verify Agent 1 in isolation
161
+
162
+ # Terminal 2
163
+ git checkout agent-2-fixes
164
+ npm test # Verify Agent 2 in isolation
165
+
166
+ # Terminal 3
167
+ git checkout agent-3-fixes
168
+ npm test # Verify Agent 3 in isolation
169
+
170
+ # After all pass individually
171
+ git checkout integration-branch
172
+ git merge agent-1-fixes agent-2-fixes agent-3-fixes
173
+ npm test # Verify integrated
174
+ ```
175
+
176
+ **Benefits:**
177
+ - Fast verification of individual agents
178
+ - All agents validated before integration
179
+ - Clear that issues are integration-specific
180
+
181
+ **Cost:**
182
+ - Integration failures are harder to isolate
183
+ - Might need to back out and use progressive approach
184
+
185
+ **Use when:** Low risk of conflicts, well-scoped agents
186
+
187
+ ### Strategy 3: Staged Integration
188
+
189
+ **Approach:** Group related agents, integrate by groups
190
+
191
+ ```bash
192
+ # Group 1: Test fixes (low conflict risk)
193
+ git merge agent-1-test-fixes agent-2-test-fixes
194
+ npm test
195
+
196
+ # Group 2: Implementation changes (higher conflict risk)
197
+ git merge agent-3-impl-changes
198
+ npm test
199
+
200
+ # Group 3: Refactoring (highest conflict risk)
201
+ git merge agent-4-refactor
202
+ npm test
203
+ ```
204
+
205
+ **Benefits:**
206
+ - Balances speed and safety
207
+ - Groups likely-compatible changes
208
+ - Easier conflict isolation than all-at-once
209
+
210
+ **Use when:** Mixed risk levels across agents
211
+
212
+ ## Common Problems
213
+
214
+ ### Problem 1: Agent Changed Too Much
215
+
216
+ **Symptom:**
217
+ ```
218
+ Agent task: "Fix login.test.ts (3 tests)"
219
+ Agent result: Changed 12 files, refactored auth module
220
+ ```
221
+
222
+ **Why this happened:**
223
+ - Prompt was too vague
224
+ - No constraints specified
225
+ - Agent "improved" code beyond scope
226
+
227
+ **Immediate fix:**
228
+ 1. Review changes - which are necessary for the task?
229
+ 2. Extract only required changes
230
+ 3. Discard "improvements" outside scope
231
+
232
+ **Prevention:**
233
+ ```markdown
234
+ Better prompt:
235
+
236
+ Fix the 3 failing tests in login.test.ts.
237
+
238
+ Allowed changes:
239
+ - login.service.ts (if bug found)
240
+ - login.test.ts (if test expectations wrong)
241
+
242
+ NOT allowed:
243
+ - Other files in auth module
244
+ - Refactoring
245
+ - Code style changes
246
+
247
+ Stay focused on making the 3 tests pass.
248
+ ```
249
+
250
+ ### Problem 2: Agent Didn't Explain Changes
251
+
252
+ **Symptom:**
253
+ ```
254
+ Agent: "Fixed the tests ✓"
255
+ You: "What did you change?"
256
+ Agent: [no summary provided]
257
+ ```
258
+
259
+ **Immediate fix:**
260
+ 1. Review git diff manually
261
+ 2. Understand each change
262
+ 3. Ask agent to explain (in follow-up)
263
+
264
+ **Prevention:**
265
+ ```markdown
266
+ Agent prompt must include:
267
+
268
+ Return:
269
+ - Root cause explanation
270
+ - List of files changed with brief explanation EACH
271
+ - How you verified the fix
272
+ - Any risks or edge cases
273
+
274
+ Do NOT just say "fixed" - I need to understand what changed.
275
+ ```
276
+
277
+ ### Problem 3: Agents Have Conflicting Approaches
278
+
279
+ **Symptom:**
280
+ ```
281
+ Agent A: Fixed race condition by adding mutex locks
282
+ Agent B: Fixed race condition by making operation synchronous
283
+
284
+ Both approaches work individually but conflict when integrated
285
+ ```
286
+
287
+ **Why this happened:**
288
+ - Agents made independent architectural decisions
289
+ - No coordination on approach
290
+ - Both valid but incompatible
291
+
292
+ **Resolution:**
293
+ 1. **Evaluate approaches:**
294
+ - Which is more aligned with codebase patterns?
295
+ - Which has better performance/correctness?
296
+ - Which has fewer side effects?
297
+
298
+ 2. **Choose one approach:**
299
+ - Discard the other agent's changes
300
+ - Or merge best parts of both
301
+
302
+ 3. **Re-test with chosen approach:**
303
+ - Verify all original issues resolved
304
+ - Ensure no new issues introduced
305
+
306
+ **Prevention:**
307
+ ```markdown
308
+ For architectural decisions, use two-phase approach:
309
+
310
+ Phase 1: Investigate and propose
311
+ - Agents research problem
312
+ - Agents propose solutions
313
+ - Coordinator reviews and aligns approaches
314
+
315
+ Phase 2: Implement approved solutions
316
+ - Agents implement with aligned approach
317
+ - No architectural conflicts
318
+ ```
319
+
320
+ ### Problem 4: Integration Introduces New Failures
321
+
322
+ **Symptom:**
323
+ ```
324
+ Agent 1 tests: Pass ✓
325
+ Agent 2 tests: Pass ✓
326
+ Agent 3 tests: Pass ✓
327
+
328
+ Integrated: Agent 1 & 2 tests pass, but Agent 3 tests fail ✗
329
+ ```
330
+
331
+ **Diagnosis process:**
332
+
333
+ ```bash
334
+ # Identify which combination breaks
335
+ git checkout main
336
+ git merge agent-1-fixes # Test → Pass ✓
337
+ git merge agent-2-fixes # Test → Pass ✓
338
+ # So far so good
339
+
340
+ git merge agent-3-fixes # Test → Fail ✗
341
+ # Agent 3 conflicts with Agent 1 + 2 integration
342
+
343
+ # Isolate the conflict
344
+ # Test Agent 3 with each individually
345
+ git checkout main
346
+ git merge agent-1-fixes agent-3-fixes # Test → ?
347
+ git checkout main
348
+ git merge agent-2-fixes agent-3-fixes # Test → ?
349
+
350
+ # Identify which specific interaction breaks
351
+ ```
352
+
353
+ **Common causes:**
354
+
355
+ 1. **Initialization order dependency**
356
+ ```
357
+ Agent 1 & 2 changed initialization order
358
+ Agent 3 assumes old order
359
+ → Solution: Update Agent 3 to new order
360
+ ```
361
+
362
+ 2. **Shared state assumption**
363
+ ```
364
+ Agent 1 & 2 now clear state between tests
365
+ Agent 3 assumes state persists
366
+ → Solution: Update Agent 3 to set up its state
367
+ ```
368
+
369
+ 3. **Interface change**
370
+ ```
371
+ Agent 1 changed function signature
372
+ Agent 3 uses old signature
373
+ → Solution: Update Agent 3 calls to new signature
374
+ ```
375
+
376
+ ### Problem 5: Can't Reproduce Agent's Success
377
+
378
+ **Symptom:**
379
+ ```
380
+ Agent: "All tests pass ✓"
381
+ You integrate: Tests fail ✗
382
+ ```
383
+
384
+ **Possible causes:**
385
+
386
+ 1. **Agent ran subset of tests**
387
+ ```
388
+ Agent ran: npm test login.test.ts
389
+ You ran: npm test (all tests)
390
+
391
+ Agent's tests pass, but broke other tests
392
+ ```
393
+
394
+ 2. **Environment difference**
395
+ ```
396
+ Agent: Used cached dependencies
397
+ You: Fresh install
398
+
399
+ Or vice versa
400
+ ```
401
+
402
+ 3. **State pollution**
403
+ ```
404
+ Agent: Tests passed in specific order
405
+ You: Tests run in different order
406
+
407
+ Agent's tests depend on state from previous tests
408
+ ```
409
+
410
+ **Debugging steps:**
411
+
412
+ ```bash
413
+ # 1. Exact reproduction
414
+ Run EXACTLY what agent ran:
415
+ - Same test command
416
+ - Same working directory
417
+ - Same git commit
418
+
419
+ # 2. Expand scope
420
+ Run broader test suite:
421
+ npm test # All tests
422
+ npm test --runInBand # Sequential execution
423
+ npm test --randomize # Random order
424
+
425
+ # 3. Clean environment
426
+ rm -rf node_modules package-lock.json
427
+ npm install
428
+ npm test
429
+
430
+ # 4. Check for state
431
+ npm test -- --forceExit # Kill process after tests
432
+ npm test -- --detectOpenHandles # Find state leaks
433
+ ```
434
+
435
+ ## Verification Checklist
436
+
437
+ ### Pre-Integration
438
+
439
+ Before integrating any agent's work:
440
+
441
+ ```
442
+ □ Agent provided clear summary of changes
443
+ □ Root cause explained and makes sense
444
+ □ Changed files list reviewed
445
+ □ Changes are within assigned scope
446
+ □ No unexpected files modified
447
+ □ No public interface changes (or coordinated if needed)
448
+ □ Agent verified their tests pass
449
+ ```
450
+
451
+ ### During Integration
452
+
453
+ While integrating each agent:
454
+
455
+ ```
456
+ □ Git merge conflicts resolved correctly
457
+ □ Both agents' logic preserved (not just picked one side)
458
+ □ Ran tests after resolving conflicts
459
+ □ No new warnings or errors introduced
460
+ □ Code style consistent (linting passes)
461
+ ```
462
+
463
+ ### Post-Integration
464
+
465
+ After all agents integrated:
466
+
467
+ ```
468
+ □ Full test suite passes
469
+ □ No new failures in unrelated tests
470
+ □ Performance hasn't degraded (if relevant)
471
+ □ All original issues resolved
472
+ □ No regressions introduced
473
+ □ Code review completed (if team process)
474
+ ```
475
+
476
+ ## Recovery Procedures
477
+
478
+ ### Procedure 1: Rollback Individual Agent
479
+
480
+ **When:** One agent's changes cause issues
481
+
482
+ ```bash
483
+ # Identify problematic agent
484
+ git log --oneline
485
+
486
+ # Revert that agent's merge
487
+ git revert -m 1 <merge-commit-hash>
488
+
489
+ # Or reset if not pushed yet
490
+ git reset --hard HEAD~1
491
+
492
+ # Re-test without that agent
493
+ npm test
494
+
495
+ # Fix or re-do that agent's work
496
+ ```
497
+
498
+ ### Procedure 2: Start Over with Integration
499
+
500
+ **When:** Multiple conflicts, unclear which combination breaks
501
+
502
+ ```bash
503
+ # Save all agent branches
504
+ git branch agent-1-fixes-backup agent-1-fixes
505
+ git branch agent-2-fixes-backup agent-2-fixes
506
+ git branch agent-3-fixes-backup agent-3-fixes
507
+
508
+ # Reset integration branch
509
+ git checkout integration
510
+ git reset --hard main
511
+
512
+ # Try progressive integration instead of all-at-once
513
+ # (See Strategy 1: Progressive Integration)
514
+ ```
515
+
516
+ ### Procedure 3: Rebase and Retry
517
+
518
+ **When:** Conflicts due to diverged branches
519
+
520
+ ```bash
521
+ # Update all agent branches from main
522
+ git checkout agent-1-fixes
523
+ git rebase main
524
+
525
+ git checkout agent-2-fixes
526
+ git rebase main
527
+
528
+ git checkout agent-3-fixes
529
+ git rebase main
530
+
531
+ # Now integrate with updated branches
532
+ # Conflicts should be reduced
533
+ ```
534
+
535
+ ## Advanced Conflict Resolution
536
+
537
+ ### Conflict Type 1: Competing Implementations
538
+
539
+ **Scenario:**
540
+ ```javascript
541
+ // Agent A's approach: Add caching layer
542
+ async function fetchUser(id) {
543
+ const cached = cache.get(id);
544
+ if (cached) return cached;
545
+ const user = await db.query(id);
546
+ cache.set(id, user);
547
+ return user;
548
+ }
549
+
550
+ // Agent B's approach: Optimize database query
551
+ async function fetchUser(id) {
552
+ return await db.query(id, {
553
+ include: ['profile', 'settings'] // Single query vs N+1
554
+ });
555
+ }
556
+ ```
557
+
558
+ **Resolution:**
559
+ 1. **Understand goals:**
560
+ - Agent A: Reduce database load
561
+ - Agent B: Reduce query count
562
+
563
+ 2. **Evaluate compatibility:**
564
+ - Can we do both?
565
+ - Are they solving same problem differently?
566
+
567
+ 3. **Best approach:**
568
+ ```javascript
569
+ // Combined: Optimized query + caching
570
+ async function fetchUser(id) {
571
+ const cached = cache.get(id);
572
+ if (cached) return cached;
573
+ const user = await db.query(id, {
574
+ include: ['profile', 'settings']
575
+ });
576
+ cache.set(id, user);
577
+ return user;
578
+ }
579
+ ```
580
+
581
+ ### Conflict Type 2: Test Expectations
582
+
583
+ **Scenario:**
584
+ ```javascript
585
+ // Agent A: Made function async
586
+ async function validateEmail(email) { ... }
587
+
588
+ // Agent B: Test expects synchronous
589
+ test('validates email', () => {
590
+ const result = validateEmail('test@example.com');
591
+ expect(result).toBe(true); // Fails: result is Promise
592
+ });
593
+ ```
594
+
595
+ **Resolution:**
596
+ 1. **Identify which is correct:**
597
+ - Should function be async? (Agent A)
598
+ - Or should test be updated? (Agent B)
599
+
600
+ 2. **Fix approach:**
601
+ ```javascript
602
+ // Update test to handle async
603
+ test('validates email', async () => {
604
+ const result = await validateEmail('test@example.com');
605
+ expect(result).toBe(true);
606
+ });
607
+ ```
608
+
609
+ ### Conflict Type 3: Shared Utility Changes
610
+
611
+ **Scenario:**
612
+ ```javascript
613
+ // Shared utility
614
+ function formatDate(date) { ... }
615
+
616
+ // Agent A: Changed signature to add timezone
617
+ function formatDate(date, timezone) { ... }
618
+
619
+ // Agent B: Added calls without timezone
620
+ const formatted = formatDate(new Date()); // Breaks!
621
+ ```
622
+
623
+ **Resolution options:**
624
+
625
+ **Option 1: Backward compatible**
626
+ ```javascript
627
+ function formatDate(date, timezone = 'UTC') {
628
+ // Default timezone maintains backward compatibility
629
+ }
630
+ ```
631
+
632
+ **Option 2: Update Agent B's calls**
633
+ ```javascript
634
+ // Find all Agent B's calls and update
635
+ const formatted = formatDate(new Date(), 'UTC');
636
+ ```
637
+
638
+ **Option 3: Coordination**
639
+ ```markdown
640
+ Prevention: Agent prompts should say:
641
+ "Do NOT change shared utilities. If needed, coordinate first."
642
+ ```
643
+
644
+ ## Monitoring Integration Health
645
+
646
+ ### Health Indicators
647
+
648
+ **Green (healthy integration):**
649
+ ```
650
+ ✓ All agents completed on time
651
+ ✓ All summaries clear and detailed
652
+ ✓ No file overlaps between agents
653
+ ✓ All individual tests pass
654
+ ✓ Full suite passes after integration
655
+ ✓ No new warnings or errors
656
+ ✓ Integration took <10 min
657
+ ```
658
+
659
+ **Yellow (caution):**
660
+ ```
661
+ ⚠ Some agents took longer than expected
662
+ ⚠ Minor file overlaps (non-conflicting)
663
+ ⚠ Had to resolve 1-2 merge conflicts
664
+ ⚠ Integration took 10-20 min
665
+ ⚠ Found one unexpected test failure (quickly fixed)
666
+ ```
667
+
668
+ **Red (problematic integration):**
669
+ ```
670
+ ✗ Multiple agents overlapped significantly
671
+ ✗ Many merge conflicts
672
+ ✗ Logic conflicts (no git conflicts but breaks)
673
+ ✗ New test failures in unrelated code
674
+ ✗ Integration took >30 min
675
+ ✗ Had to rollback and restart
676
+ ```
677
+
678
+ ### Post-Mortem Template
679
+
680
+ After problematic integration:
681
+
682
+ ```markdown
683
+ ## What Went Wrong
684
+
685
+ [Describe the issue]
686
+
687
+ ## Root Cause
688
+
689
+ [Why did this happen?]
690
+ - Unclear scope definition?
691
+ - Missed dependency?
692
+ - Agents made incompatible decisions?
693
+
694
+ ## What We Learned
695
+
696
+ [Specific learnings from this incident]
697
+
698
+ ## Prevention Strategy
699
+
700
+ [How to prevent this in future dispatches]
701
+ - Better prompt structure?
702
+ - More investigation before dispatch?
703
+ - Different grouping of problems?
704
+
705
+ ## Action Items
706
+
707
+ [Concrete changes to process]
708
+ ```
709
+
710
+ ## Best Practices
711
+
712
+ ### Do's
713
+
714
+ ✓ **Verify independence** before dispatching
715
+ ✓ **Define clear scopes** for each agent
716
+ ✓ **Request detailed summaries** from agents
717
+ ✓ **Integrate progressively** when high risk
718
+ ✓ **Test after each integration** step
719
+ ✓ **Document conflicts** and resolutions
720
+ ✓ **Learn from issues** and improve process
721
+
722
+ ### Don'ts
723
+
724
+ ✗ **Don't dispatch without investigation** if independence unclear
725
+ ✗ **Don't allow vague prompts** ("fix the issues")
726
+ ✗ **Don't integrate blindly** without reviewing summaries
727
+ ✗ **Don't skip verification** steps to save time
728
+ ✗ **Don't ignore warning signs** (overlapping files, etc.)
729
+ ✗ **Don't let agents change shared code** without coordination
730
+ ✗ **Don't forget to run full suite** after integration