claude-mpm 4.0.20__py3-none-any.whl → 4.0.23__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.
Files changed (46) hide show
  1. claude_mpm/BUILD_NUMBER +1 -1
  2. claude_mpm/VERSION +1 -1
  3. claude_mpm/agents/INSTRUCTIONS.md +74 -0
  4. claude_mpm/agents/WORKFLOW.md +308 -4
  5. claude_mpm/agents/agents_metadata.py +52 -0
  6. claude_mpm/agents/base_agent_loader.py +75 -19
  7. claude_mpm/agents/templates/__init__.py +4 -0
  8. claude_mpm/agents/templates/api_qa.json +206 -0
  9. claude_mpm/agents/templates/code_analyzer.json +2 -2
  10. claude_mpm/agents/templates/data_engineer.json +2 -2
  11. claude_mpm/agents/templates/documentation.json +36 -9
  12. claude_mpm/agents/templates/engineer.json +2 -2
  13. claude_mpm/agents/templates/ops.json +2 -2
  14. claude_mpm/agents/templates/qa.json +2 -2
  15. claude_mpm/agents/templates/refactoring_engineer.json +65 -43
  16. claude_mpm/agents/templates/research.json +24 -16
  17. claude_mpm/agents/templates/security.json +2 -2
  18. claude_mpm/agents/templates/ticketing.json +18 -5
  19. claude_mpm/agents/templates/vercel_ops_agent.json +281 -0
  20. claude_mpm/agents/templates/vercel_ops_instructions.md +582 -0
  21. claude_mpm/agents/templates/version_control.json +2 -2
  22. claude_mpm/agents/templates/web_ui.json +2 -2
  23. claude_mpm/cli/commands/mcp_command_router.py +87 -1
  24. claude_mpm/cli/commands/mcp_install_commands.py +207 -26
  25. claude_mpm/cli/parsers/mcp_parser.py +23 -0
  26. claude_mpm/constants.py +1 -0
  27. claude_mpm/core/base_service.py +7 -1
  28. claude_mpm/core/config.py +64 -39
  29. claude_mpm/core/framework_loader.py +100 -37
  30. claude_mpm/core/interactive_session.py +28 -17
  31. claude_mpm/scripts/socketio_daemon.py +67 -7
  32. claude_mpm/scripts/socketio_daemon_hardened.py +897 -0
  33. claude_mpm/services/agents/deployment/agent_deployment.py +65 -3
  34. claude_mpm/services/agents/deployment/async_agent_deployment.py +65 -1
  35. claude_mpm/services/agents/memory/agent_memory_manager.py +42 -203
  36. claude_mpm/services/memory_hook_service.py +62 -4
  37. claude_mpm/services/runner_configuration_service.py +5 -9
  38. claude_mpm/services/socketio/server/broadcaster.py +32 -1
  39. claude_mpm/services/socketio/server/core.py +4 -0
  40. claude_mpm/services/socketio/server/main.py +23 -4
  41. {claude_mpm-4.0.20.dist-info → claude_mpm-4.0.23.dist-info}/METADATA +1 -1
  42. {claude_mpm-4.0.20.dist-info → claude_mpm-4.0.23.dist-info}/RECORD +46 -42
  43. {claude_mpm-4.0.20.dist-info → claude_mpm-4.0.23.dist-info}/WHEEL +0 -0
  44. {claude_mpm-4.0.20.dist-info → claude_mpm-4.0.23.dist-info}/entry_points.txt +0 -0
  45. {claude_mpm-4.0.20.dist-info → claude_mpm-4.0.23.dist-info}/licenses/LICENSE +0 -0
  46. {claude_mpm-4.0.20.dist-info → claude_mpm-4.0.23.dist-info}/top_level.txt +0 -0
claude_mpm/BUILD_NUMBER CHANGED
@@ -1 +1 @@
1
- 288
1
+ 290
claude_mpm/VERSION CHANGED
@@ -1 +1 @@
1
- 4.0.20
1
+ 4.0.23
@@ -177,6 +177,80 @@ PM: "Understood. Since you've explicitly requested I handle this directly, I'll
177
177
  *Now PM can use implementation tools*
178
178
  ```
179
179
 
180
+ ## Intelligent QA Agent Selection
181
+
182
+ When entering Phase 3 (Quality Assurance), analyze the implementation context to select the appropriate QA agent:
183
+
184
+ ### QA Type Detection Protocol
185
+
186
+ **Analyze implementation context for QA routing**:
187
+
188
+ 1. **Backend/API Indicators → Use API QA Agent**:
189
+ - Keywords: API, endpoint, route, REST, GraphQL, server, backend, auth, database
190
+ - Files: `/api`, `/routes`, `/controllers`, `/services` directories
191
+ - Extensions: `.py` (FastAPI/Flask), `.js` (Express), `.go`, `.java`
192
+ - Patterns: Database models, auth middleware, API documentation
193
+
194
+ 2. **Frontend/Web Indicators → Use Web QA Agent**:
195
+ - Keywords: web, UI, page, frontend, browser, component, responsive, accessibility
196
+ - Files: `/components`, `/pages`, `/views`, `/public` directories
197
+ - Extensions: `.jsx`, `.tsx`, `.vue`, `.svelte`, `.html`, `.css`
198
+ - Patterns: React/Vue components, CSS changes, static assets
199
+
200
+ 3. **Mixed Implementation → Sequential QA**:
201
+ - Run API QA first for backend validation
202
+ - Then Web QA for frontend integration
203
+ - Finally coordinate results for full coverage
204
+
205
+ 4. **Neither → Use General QA Agent**:
206
+ - CLI tools, libraries, utilities, scripts
207
+ - Non-web, non-API code changes
208
+
209
+ ### QA Handoff Patterns
210
+
211
+ **Engineer → API QA**:
212
+ ```
213
+ Engineer: "Implemented REST API endpoints for user management with JWT authentication"
214
+ PM: "I'll delegate to the API QA agent to validate the REST endpoints and authentication flow."
215
+ Task to API QA: "Test the newly implemented user management REST API endpoints including JWT authentication, CRUD operations, and error handling."
216
+ ```
217
+
218
+ **Web UI → Web QA**:
219
+ ```
220
+ Web UI: "Created responsive checkout flow with form validation"
221
+ PM: "I'll delegate to the Web QA agent to test the checkout flow across browsers."
222
+ Task to Web QA: "Validate the responsive checkout flow including form validation, browser compatibility, and accessibility compliance."
223
+ ```
224
+
225
+ **Engineer → API QA → Web QA (Full-stack)**:
226
+ ```
227
+ Engineer: "Implemented complete user authentication with backend API and React frontend"
228
+ PM: "I'll coordinate testing with both API QA and Web QA agents sequentially."
229
+ Task to API QA: "Test authentication API endpoints, JWT flow, and database operations."
230
+ [After API QA completion]
231
+ Task to Web QA: "Test login UI, form validation, and session management in browsers."
232
+ ```
233
+
234
+ ### TodoWrite Patterns for QA Coordination
235
+
236
+ **API Testing Tasks**:
237
+ - `[PM] Route to API QA for REST endpoint validation`
238
+ - `[API QA] Test user management REST endpoints for CRUD operations`
239
+ - `[API QA] Validate JWT authentication and authorization flow`
240
+ - `[API QA] Load test payment processing endpoints`
241
+
242
+ **Web Testing Tasks**:
243
+ - `[PM] Route to Web QA for browser-based testing`
244
+ - `[Web QA] Test responsive checkout flow in Chrome/Firefox/Safari`
245
+ - `[Web QA] Validate WCAG 2.1 accessibility compliance`
246
+ - `[Web QA] Test React component rendering and state management`
247
+
248
+ **Full-Stack Testing Tasks**:
249
+ - `[PM] Coordinate sequential QA for authentication feature`
250
+ - `[API QA] Validate backend auth API (Phase 1 of 2)`
251
+ - `[Web QA] Test frontend login UI (Phase 2 of 2)`
252
+ - `[PM] Synthesize QA results from API and Web testing`
253
+
180
254
  ## Memory-Conscious Delegation
181
255
 
182
256
  <!-- MEMORY WARNING: Claude Code retains all file contents read during execution -->
@@ -20,10 +20,275 @@
20
20
  - Ops Agent for infrastructure/deployment
21
21
 
22
22
  ### Phase 3: Quality Assurance (AFTER Implementation)
23
- - **CRITICAL**: QA Agent MUST receive original user instructions
24
- - Validation against acceptance criteria
25
- - Edge case testing and error scenarios
26
- - **Required Output**: "QA Complete: [Pass/Fail] - [Details]"
23
+
24
+ **Intelligent QA Agent Selection**:
25
+
26
+ The PM must analyze the implementation context to route to the appropriate QA agent based on a comprehensive decision tree. This ensures that each QA type focuses on their area of expertise while maintaining comprehensive coverage.
27
+
28
+ #### QA Agent Types and Capabilities
29
+
30
+ 1. **API QA Agent** - Specialized for server-side and backend testing:
31
+ - **Primary Focus**: REST APIs, GraphQL, server routes, authentication systems
32
+ - **Triggered by keywords**: API, endpoint, route, REST, GraphQL, server, backend, authentication, authorization, database, microservice, webhook
33
+ - **File indicators**:
34
+ - Directories: `/api`, `/routes`, `/controllers`, `/services`, `/models`, `/middleware`
35
+ - Files: `.py` (FastAPI/Flask/Django), `.js/.ts` (Express/NestJS), `.go`, `.java`, `.php`, `.rb`
36
+ - **Testing capabilities**:
37
+ - REST endpoint validation (CRUD operations, status codes, headers)
38
+ - GraphQL query and mutation testing
39
+ - Authentication and authorization flows (JWT, OAuth2, API keys)
40
+ - Database operation validation and data integrity
41
+ - Request/response schema validation (OpenAPI/Swagger)
42
+ - API performance and load testing
43
+ - Contract testing between services
44
+ - Security testing (OWASP API Security Top 10)
45
+ - **Tools and frameworks**: Postman/Newman, curl, HTTPie, Jest/Mocha for API tests
46
+ - **Required Output**: "API QA Complete: [Pass/Fail] - [Endpoints tested: X, Avg response time: Xms, Auth flows: X, Security checks: X, Issues: X]"
47
+
48
+ 2. **Web QA Agent** - Specialized for browser-based and frontend testing:
49
+ - **Primary Focus**: Web pages, UI components, browser testing, user experience
50
+ - **Triggered by keywords**: web, UI, page, frontend, browser, component, responsive, accessibility, user interface, client-side, SPA
51
+ - **File indicators**:
52
+ - Directories: `/components`, `/pages`, `/views`, `/public`, `/assets`, `/styles`
53
+ - Files: `.jsx/.tsx` (React), `.vue` (Vue.js), `.svelte`, `.html`, `.css/.scss`, `.js` (client-side)
54
+ - **Testing capabilities**:
55
+ - UI component functionality and rendering
56
+ - User flow validation (registration, login, checkout, etc.)
57
+ - Responsive design testing across devices and screen sizes
58
+ - Cross-browser compatibility (Chrome, Firefox, Safari, Edge)
59
+ - Accessibility compliance (WCAG 2.1 AA standards)
60
+ - Client-side performance (Core Web Vitals, load times)
61
+ - Interactive element testing (forms, buttons, navigation)
62
+ - Visual regression testing
63
+ - **Tools and frameworks**: Selenium, Playwright, Cypress, browser dev tools
64
+ - **Required Output**: "Web QA Complete: [Pass/Fail] - [Browsers tested: X, Pages validated: X, Accessibility score: X%, Performance score: X%, Issues: X]"
65
+
66
+ 3. **General QA Agent** - Default for comprehensive testing needs:
67
+ - **Primary Focus**: Libraries, CLI tools, utilities, integration testing
68
+ - **Default selection**: When neither API nor Web indicators are present
69
+ - **File indicators**: CLI tools, libraries, utilities, scripts, configuration files, test files
70
+ - **Testing capabilities**:
71
+ - Unit test execution and coverage analysis
72
+ - Integration testing between components
73
+ - CLI functionality and command validation
74
+ - Library method and function testing
75
+ - Configuration file validation
76
+ - Build and deployment process testing
77
+ - Cross-platform compatibility
78
+ - **Tools and frameworks**: pytest, Jest, JUnit, Mocha, CLI testing frameworks
79
+ - **Required Output**: "QA Complete: [Pass/Fail] - [Tests run: X, Coverage: X%, CLI commands: X, Issues: X]"
80
+
81
+ 4. **Full-Stack Testing** - Coordinated testing for complete features:
82
+ - **Triggered when**: Both backend AND frontend changes detected in implementation
83
+ - **Sequential execution order**:
84
+ a. **First: API QA** validates backend functionality and data flows
85
+ b. **Then: Web QA** validates frontend integration and user experience
86
+ c. **Finally: Integration validation** between all layers
87
+ - **Coordination requirements**:
88
+ - API QA must complete successfully before Web QA begins
89
+ - Both agents receive original user requirements
90
+ - Integration testing covers end-to-end user workflows
91
+ - Data consistency validation across frontend and backend
92
+ - **Required Output**: "Full-Stack QA Complete: [Pass/Fail] - API: [API results], Web: [Web results], Integration: [End-to-end results]"
93
+
94
+ #### QA Selection Decision Tree
95
+
96
+ The PM follows this decision logic to route QA testing appropriately:
97
+
98
+ ```
99
+ 📊 QA ROUTING DECISION TREE
100
+
101
+ ├─ 🔍 ANALYZE IMPLEMENTATION CONTEXT
102
+ │ ├─ Keywords Analysis
103
+ │ ├─ File Path Analysis
104
+ │ ├─ Technology Stack Detection
105
+ │ └─ Feature Scope Assessment
106
+
107
+ ├─ 🌐 BACKEND INDICATORS → API QA Agent
108
+ │ ├─ Keywords: api, endpoint, route, rest, graphql, server, backend, auth, database, microservice
109
+ │ ├─ File Paths: /api/, /routes/, /controllers/, /services/, /models/, /middleware/
110
+ │ ├─ Extensions: .py, .js/.ts (server), .go, .java, .php, .rb
111
+ │ ├─ Content: @app.route, router.get, API decorators, database schemas
112
+ │ └─ Output: "API QA Complete: [detailed API testing results]"
113
+
114
+ ├─ 💻 FRONTEND INDICATORS → Web QA Agent
115
+ │ ├─ Keywords: web, ui, page, frontend, browser, component, responsive, accessibility, spa
116
+ │ ├─ File Paths: /components/, /pages/, /views/, /public/, /assets/, /styles/
117
+ │ ├─ Extensions: .jsx/.tsx, .vue, .svelte, .html, .css/.scss, .js (client)
118
+ │ ├─ Content: React components, Vue templates, CSS frameworks, client-side logic
119
+ │ └─ Output: "Web QA Complete: [detailed UI/UX testing results]"
120
+
121
+ ├─ 🔄 FULL-STACK INDICATORS → Sequential QA (API → Web)
122
+ │ ├─ Mixed Context: Both backend AND frontend changes
123
+ │ ├─ User Stories: End-to-end feature requirements
124
+ │ ├─ Integration: Frontend consumes backend APIs
125
+ │ ├─ Execution: API QA first, then Web QA, then integration validation
126
+ │ └─ Output: "Full-Stack QA Complete: [combined testing results]"
127
+
128
+ └─ ⚙️ DEFAULT → General QA Agent
129
+ ├─ No specific indicators detected
130
+ ├─ CLI tools, libraries, utilities
131
+ ├─ Configuration files, scripts
132
+ ├─ Pure logic/algorithm implementations
133
+ └─ Output: "QA Complete: [general testing results]"
134
+ ```
135
+
136
+ **Detailed Detection Logic**:
137
+
138
+ ```
139
+ Backend Indicators → Route to API QA:
140
+ - API route definitions (e.g., @app.route, router.get, @api.route)
141
+ - Database models, migrations, or ORM configurations
142
+ - Authentication/authorization middleware and logic
143
+ - GraphQL schemas, resolvers, or mutations
144
+ - Server configuration files (server.js, app.py, main.go)
145
+ - Backend service implementations and business logic
146
+ - Microservice definitions and inter-service communication
147
+ - API documentation or OpenAPI specifications
148
+
149
+ Frontend Indicators → Route to Web QA:
150
+ - React/Vue/Angular/Svelte components and pages
151
+ - HTML templates, views, or page definitions
152
+ - CSS/SCSS/Tailwind style files and responsive design
153
+ - Client-side JavaScript for user interactions
154
+ - Static assets (images, fonts, icons) and asset optimization
155
+ - Frontend build configurations (webpack, vite, rollup)
156
+ - Progressive Web App (PWA) configurations
157
+ - Client-side routing and navigation logic
158
+
159
+ Mixed Indicators → Sequential QA (API QA → Web QA → Integration):
160
+ - Both backend and frontend files modified in implementation
161
+ - Full-stack feature implementation (e.g., auth system, e-commerce)
162
+ - End-to-end user stories spanning multiple layers
163
+ - Features requiring backend API and frontend UI coordination
164
+ - Real-time features (WebSocket, SSE) with client-server interaction
165
+ - Data flow from database through API to user interface
166
+
167
+ Default Indicators → General QA:
168
+ - CLI tools and command-line applications
169
+ - Libraries, utilities, and helper functions
170
+ - Configuration file processing
171
+ - Data processing scripts and algorithms
172
+ - Testing frameworks and test utilities
173
+ - Build tools and automation scripts
174
+ ```
175
+
176
+ #### Practical Usage Examples
177
+
178
+ **Example 1: API Implementation**
179
+ ```
180
+ User Request: "Create a REST API for user management with CRUD operations"
181
+ Engineer Output: "Implemented FastAPI endpoints in /api/users.py with authentication"
182
+
183
+ PM Analysis:
184
+ ✅ Backend Keywords: "REST API", "endpoints", "authentication"
185
+ ✅ File Indicators: "/api/users.py"
186
+ ✅ Technology: FastAPI (Python backend)
187
+
188
+ PM Decision: Route to API QA Agent
189
+ API QA Tasks:
190
+ - Test GET /users (list users)
191
+ - Test POST /users (create user)
192
+ - Test PUT /users/{id} (update user)
193
+ - Test DELETE /users/{id} (delete user)
194
+ - Validate authentication headers
195
+ - Check error responses (400, 401, 404, 500)
196
+ - Verify response schemas match OpenAPI spec
197
+ - Performance test with 100 concurrent requests
198
+
199
+ API QA Output: "API QA Complete: Pass - [Endpoints tested: 4, Avg response time: 45ms, Auth flows: 2, Security checks: 3, Issues: 0]"
200
+ ```
201
+
202
+ **Example 2: Web UI Implementation**
203
+ ```
204
+ User Request: "Build a responsive dashboard with charts and user profile"
205
+ Web UI Output: "Created React dashboard in /components/Dashboard.tsx with mobile-first design"
206
+
207
+ PM Analysis:
208
+ ✅ Frontend Keywords: "responsive dashboard", "charts", "user profile"
209
+ ✅ File Indicators: "/components/Dashboard.tsx"
210
+ ✅ Technology: React (frontend framework)
211
+
212
+ PM Decision: Route to Web QA Agent
213
+ Web QA Tasks:
214
+ - Test dashboard rendering on desktop (1920x1080)
215
+ - Test mobile responsiveness (375x667, 768x1024)
216
+ - Verify chart interactivity and data visualization
217
+ - Test user profile edit functionality
218
+ - Check accessibility (WCAG 2.1 AA compliance)
219
+ - Cross-browser testing (Chrome, Firefox, Safari)
220
+ - Measure Core Web Vitals (LCP, FID, CLS)
221
+
222
+ Web QA Output: "Web QA Complete: Pass - [Browsers tested: 3, Pages validated: 2, Accessibility score: 95%, Performance score: 88%, Issues: 1 minor]"
223
+ ```
224
+
225
+ **Example 3: Full-Stack Feature**
226
+ ```
227
+ User Request: "Implement complete authentication system with login UI and JWT backend"
228
+ Engineer Output: "Built auth API in /api/auth.py and login components in /components/auth/"
229
+
230
+ PM Analysis:
231
+ ✅ Backend Keywords: "JWT backend", "auth API"
232
+ ✅ Frontend Keywords: "login UI", "components"
233
+ ✅ File Indicators: "/api/auth.py", "/components/auth/"
234
+ ✅ Full-Stack Feature: Both backend and frontend implementation
235
+
236
+ PM Decision: Sequential QA (API QA → Web QA → Integration)
237
+
238
+ Phase 1 - API QA:
239
+ - Test POST /auth/login endpoint
240
+ - Test POST /auth/register endpoint
241
+ - Test JWT token generation and validation
242
+ - Test protected endpoint access with tokens
243
+ - Verify password hashing and security
244
+
245
+ API QA Output: "API QA Complete: Pass - [Endpoints tested: 3, Auth flows: 2, Security checks: 5, Issues: 0]"
246
+
247
+ Phase 2 - Web QA:
248
+ - Test login form submission and validation
249
+ - Test registration form with field validation
250
+ - Test token storage and automatic logout
251
+ - Test protected route navigation
252
+ - Test error handling for invalid credentials
253
+
254
+ Web QA Output: "Web QA Complete: Pass - [Forms tested: 2, User flows: 3, Error states: 4, Issues: 0]"
255
+
256
+ Phase 3 - Integration:
257
+ - Test end-to-end user registration flow
258
+ - Test login → protected page access flow
259
+ - Test token refresh and session management
260
+ - Test logout and token cleanup
261
+
262
+ PM Final Output: "Full-Stack QA Complete: Pass - API: [3 endpoints validated], Web: [2 forms tested], Integration: [E2E flows working]"
263
+ ```
264
+
265
+ **Example 4: CLI Tool Implementation**
266
+ ```
267
+ User Request: "Create a command-line tool for file processing"
268
+ Engineer Output: "Built CLI tool in /src/file_processor.py with argparse"
269
+
270
+ PM Analysis:
271
+ ❌ No Backend API Keywords
272
+ ❌ No Frontend UI Keywords
273
+ ✅ Default Indicators: CLI tool, file processing, Python script
274
+
275
+ PM Decision: Route to General QA Agent
276
+ General QA Tasks:
277
+ - Test CLI commands with various arguments
278
+ - Test file input/output operations
279
+ - Test error handling for invalid files
280
+ - Test cross-platform compatibility
281
+ - Verify help documentation and usage
282
+
283
+ General QA Output: "QA Complete: Pass - [CLI commands: 5, File operations: 3, Error cases: 4, Issues: 0]"
284
+ ```
285
+
286
+ **CRITICAL Requirements**:
287
+ - QA Agent MUST receive original user instructions for context
288
+ - Validation against acceptance criteria defined in user request
289
+ - Edge case testing and error scenarios for robust implementation
290
+ - Performance and security validation where applicable
291
+ - Clear, standardized output format for tracking and reporting
27
292
 
28
293
  ### Phase 4: Documentation (ONLY after QA sign-off)
29
294
  - API documentation updates
@@ -58,6 +323,45 @@ Context:
58
323
  Risk Factors: <Potential issues and mitigation strategies>
59
324
  ```
60
325
 
326
+ ### QA Agent Selection Logic
327
+
328
+ When delegating QA tasks, the PM must intelligently select the appropriate QA agent based on implementation context:
329
+
330
+ ```python
331
+ # Pseudo-code for QA agent selection
332
+ def select_qa_agent(implementation_context, available_agents):
333
+ backend_keywords = ['api', 'endpoint', 'route', 'rest', 'graphql',
334
+ 'server', 'backend', 'auth', 'database', 'service']
335
+ frontend_keywords = ['web', 'ui', 'page', 'frontend', 'browser',
336
+ 'component', 'responsive', 'accessibility', 'react', 'vue']
337
+
338
+ context_lower = implementation_context.lower()
339
+
340
+ has_backend = any(keyword in context_lower for keyword in backend_keywords)
341
+ has_frontend = any(keyword in context_lower for keyword in frontend_keywords)
342
+
343
+ # Check file extensions and paths
344
+ if any(ext in implementation_context for ext in ['.py', '.go', '.java', '/api/', '/routes/']):
345
+ has_backend = True
346
+ if any(ext in implementation_context for ext in ['.jsx', '.tsx', '.vue', '/components/', '/pages/']):
347
+ has_frontend = True
348
+
349
+ # Determine QA agent(s) to use
350
+ if has_backend and has_frontend:
351
+ return ['api_qa', 'web_qa'] # Sequential testing for full-stack
352
+ elif has_backend and 'api_qa' in available_agents:
353
+ return ['api_qa']
354
+ elif has_frontend and 'web_qa' in available_agents:
355
+ return ['web_qa']
356
+ else:
357
+ return ['qa'] # Default general QA
358
+
359
+ # Example usage in delegation
360
+ selected_qa = select_qa_agent(engineer_output, deployed_agents)
361
+ for qa_agent in selected_qa:
362
+ delegate_to(qa_agent, original_requirements)
363
+ ```
364
+
61
365
  ### Research-First Scenarios
62
366
 
63
367
  Delegate to Research when:
@@ -75,6 +75,56 @@ QA_CONFIG = {
75
75
  },
76
76
  }
77
77
 
78
+ # API QA Agent Metadata
79
+ API_QA_CONFIG = {
80
+ "name": "api_qa_agent",
81
+ "version": "1.0.0",
82
+ "type": "core_agent",
83
+ "capabilities": [
84
+ "rest_api_testing",
85
+ "graphql_testing",
86
+ "endpoint_validation",
87
+ "authentication_testing",
88
+ "authorization_testing",
89
+ "contract_testing",
90
+ "load_testing",
91
+ "api_performance_testing",
92
+ ],
93
+ "primary_interface": "api_testing_framework",
94
+ "performance_targets": {
95
+ "endpoint_validation": "2m",
96
+ "auth_flow_testing": "5m",
97
+ "load_testing": "10m",
98
+ "contract_validation": "5m",
99
+ "response_time_target": "200ms",
100
+ },
101
+ }
102
+
103
+ # Web QA Agent Metadata
104
+ WEB_QA_CONFIG = {
105
+ "name": "web_qa_agent",
106
+ "version": "1.0.0",
107
+ "type": "core_agent",
108
+ "capabilities": [
109
+ "browser_automation",
110
+ "e2e_testing",
111
+ "ui_testing",
112
+ "responsive_testing",
113
+ "accessibility_testing",
114
+ "cross_browser_testing",
115
+ "performance_testing",
116
+ "visual_regression",
117
+ ],
118
+ "primary_interface": "browser_testing_framework",
119
+ "performance_targets": {
120
+ "e2e_test_suite": "15m",
121
+ "accessibility_audit": "5m",
122
+ "cross_browser_test": "20m",
123
+ "page_load_target": "2.5s",
124
+ "lighthouse_score": "90",
125
+ },
126
+ }
127
+
78
128
  # Research Agent Metadata
79
129
  RESEARCH_CONFIG = {
80
130
  "name": "research_agent",
@@ -218,6 +268,8 @@ ALL_AGENT_CONFIGS = {
218
268
  "documentation": DOCUMENTATION_CONFIG,
219
269
  "version_control": VERSION_CONTROL_CONFIG,
220
270
  "qa": QA_CONFIG,
271
+ "api_qa": API_QA_CONFIG,
272
+ "web_qa": WEB_QA_CONFIG,
221
273
  "research": RESEARCH_CONFIG,
222
274
  "ops": OPS_CONFIG,
223
275
  "security": SECURITY_CONFIG,
@@ -38,31 +38,91 @@ BASE_AGENT_CACHE_KEY = "base_agent:instructions"
38
38
 
39
39
 
40
40
  def _get_base_agent_file() -> Path:
41
- """Get the base agent file path."""
42
- # Check if we're running from a wheel installation
41
+ """Get the base agent file path with priority-based search.
42
+
43
+ Priority order:
44
+ 1. Environment variable override (CLAUDE_MPM_BASE_AGENT_PATH)
45
+ 2. Current working directory (for local development)
46
+ 3. Known development locations
47
+ 4. User override location (~/.claude/agents/)
48
+ 5. Package installation location (fallback)
49
+ """
50
+ # Priority 0: Check environment variable override
51
+ env_path = os.environ.get("CLAUDE_MPM_BASE_AGENT_PATH")
52
+ if env_path:
53
+ env_base_agent = Path(env_path)
54
+ if env_base_agent.exists():
55
+ logger.info(f"Using environment variable base_agent: {env_base_agent}")
56
+ return env_base_agent
57
+ else:
58
+ logger.warning(f"CLAUDE_MPM_BASE_AGENT_PATH set but file doesn't exist: {env_base_agent}")
59
+
60
+ # Priority 1: Check current working directory for local development
61
+ cwd = Path.cwd()
62
+ cwd_base_agent = cwd / "src" / "claude_mpm" / "agents" / "base_agent.json"
63
+ if cwd_base_agent.exists():
64
+ logger.info(f"Using local development base_agent from cwd: {cwd_base_agent}")
65
+ return cwd_base_agent
66
+
67
+ # Priority 2: Check known development locations
68
+ known_dev_paths = [
69
+ Path("/Users/masa/Projects/claude-mpm/src/claude_mpm/agents/base_agent.json"),
70
+ Path.home() / "Projects" / "claude-mpm" / "src" / "claude_mpm" / "agents" / "base_agent.json",
71
+ Path.home() / "projects" / "claude-mpm" / "src" / "claude_mpm" / "agents" / "base_agent.json",
72
+ ]
73
+
74
+ for dev_path in known_dev_paths:
75
+ if dev_path.exists():
76
+ logger.info(f"Using development base_agent: {dev_path}")
77
+ return dev_path
78
+
79
+ # Priority 3: Check user override location
80
+ user_base_agent = Path.home() / ".claude" / "agents" / "base_agent.json"
81
+ if user_base_agent.exists():
82
+ logger.info(f"Using user override base_agent: {user_base_agent}")
83
+ return user_base_agent
84
+
85
+ # Priority 4: Check if we're running from a wheel installation
43
86
  try:
44
87
  import claude_mpm
45
88
 
46
89
  package_path = Path(claude_mpm.__file__).parent
47
90
  path_str = str(package_path.resolve())
91
+
92
+ # For development/editable installs, check if there's a local src directory
48
93
  if "site-packages" in path_str or "dist-packages" in path_str:
94
+ # Check if this is a pipx/pip installation
95
+ if "pipx" in path_str:
96
+ logger.debug(f"Detected pipx installation at {package_path}")
97
+
49
98
  # For wheel installations, check data directory
50
99
  data_base_agent = package_path / "data" / "agents" / "base_agent.json"
51
100
  if data_base_agent.exists():
52
- logger.debug(f"Using wheel installation base_agent: {data_base_agent}")
101
+ logger.info(f"Using wheel installation base_agent: {data_base_agent}")
53
102
  return data_base_agent
54
- except Exception:
55
- pass
56
-
57
- # Use the base_agent.json in the agents directory
103
+
104
+ # Also check direct agents directory in package
105
+ pkg_base_agent = package_path / "agents" / "base_agent.json"
106
+ if pkg_base_agent.exists():
107
+ logger.info(f"Using package base_agent: {pkg_base_agent}")
108
+ return pkg_base_agent
109
+ except Exception as e:
110
+ logger.debug(f"Exception checking package path: {e}")
111
+
112
+ # Final fallback: Use the base_agent.json relative to this file
58
113
  base_agent_path = Path(__file__).parent / "base_agent.json"
59
114
  if base_agent_path.exists():
60
- logger.debug(f"Using base agent template: {base_agent_path}")
115
+ logger.info(f"Using fallback base_agent relative to module: {base_agent_path}")
61
116
  return base_agent_path
62
117
 
63
- # Fallback error
64
- logger.error("Base agent template file not found")
65
- raise FileNotFoundError("base_agent.json not found in agents directory")
118
+ # Error if no base agent found
119
+ logger.error("Base agent template file not found in any location")
120
+ logger.error(f"Searched locations:")
121
+ logger.error(f" 1. CWD: {cwd_base_agent}")
122
+ logger.error(f" 2. Dev paths: {known_dev_paths}")
123
+ logger.error(f" 3. User: {user_base_agent}")
124
+ logger.error(f" 4. Module: {base_agent_path}")
125
+ raise FileNotFoundError("base_agent.json not found in any expected location")
66
126
 
67
127
 
68
128
  # Base agent file path (dynamically determined)
@@ -252,19 +312,15 @@ def _remove_test_mode_instructions(content: str) -> str:
252
312
 
253
313
  # Check if we're in the test section and need to continue skipping
254
314
  if skip_section:
255
- # Check if we've reached a section that's NOT part of test protocol
256
- # This includes any heading that's not a subsection of the test protocol
257
- if (
258
- line.startswith("####")
259
- or line.startswith("###")
260
- or line.startswith("##")
261
- ) and "Standard Test Response Protocol" not in line:
315
+ # Check if we've reached a new top-level section (## but not ###)
316
+ # Only stop skipping when we hit another ## section (same level as test section)
317
+ if line.startswith("##") and not line.startswith("###"):
262
318
  skip_section = False
263
319
  # Don't skip this line - it's the start of a new section
264
320
  filtered_lines.append(line)
265
321
  i += 1
266
322
  continue
267
- # Skip this line as we're still in test section
323
+ # Skip this line as we're still in test section (includes ### subsections)
268
324
  i += 1
269
325
  continue
270
326
 
@@ -17,6 +17,8 @@ AGENT_TEMPLATES = {
17
17
  "documentation": "documentation_agent.md",
18
18
  "engineer": "engineer_agent.md",
19
19
  "qa": "qa_agent.md",
20
+ "api_qa": "api_qa_agent.md",
21
+ "web_qa": "web_qa_agent.md",
20
22
  "version_control": "version_control_agent.md",
21
23
  "research": "research_agent.md",
22
24
  "ops": "ops_agent.md",
@@ -29,6 +31,8 @@ AGENT_NICKNAMES = {
29
31
  "documentation": "Documenter",
30
32
  "engineer": "Engineer",
31
33
  "qa": "QA",
34
+ "api_qa": "API QA",
35
+ "web_qa": "Web QA",
32
36
  "version_control": "Versioner",
33
37
  "research": "Researcher",
34
38
  "ops": "Ops",