claude-mpm 4.1.2__py3-none-any.whl → 4.1.4__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 (87) hide show
  1. claude_mpm/VERSION +1 -1
  2. claude_mpm/agents/BASE_AGENT_TEMPLATE.md +16 -19
  3. claude_mpm/agents/MEMORY.md +21 -49
  4. claude_mpm/agents/templates/OPTIMIZATION_REPORT.md +156 -0
  5. claude_mpm/agents/templates/api_qa.json +36 -116
  6. claude_mpm/agents/templates/backup/data_engineer_agent_20250726_234551.json +42 -9
  7. claude_mpm/agents/templates/backup/documentation_agent_20250726_234551.json +29 -6
  8. claude_mpm/agents/templates/backup/engineer_agent_20250726_234551.json +34 -6
  9. claude_mpm/agents/templates/backup/ops_agent_20250726_234551.json +41 -9
  10. claude_mpm/agents/templates/backup/qa_agent_20250726_234551.json +30 -8
  11. claude_mpm/agents/templates/backup/research_agent_2025011_234551.json +2 -2
  12. claude_mpm/agents/templates/backup/research_agent_20250726_234551.json +29 -6
  13. claude_mpm/agents/templates/backup/research_memory_efficient.json +2 -2
  14. claude_mpm/agents/templates/backup/security_agent_20250726_234551.json +41 -9
  15. claude_mpm/agents/templates/backup/version_control_agent_20250726_234551.json +23 -7
  16. claude_mpm/agents/templates/code_analyzer.json +18 -36
  17. claude_mpm/agents/templates/data_engineer.json +43 -14
  18. claude_mpm/agents/templates/documentation.json +55 -74
  19. claude_mpm/agents/templates/engineer.json +57 -40
  20. claude_mpm/agents/templates/imagemagick.json +7 -2
  21. claude_mpm/agents/templates/memory_manager.json +1 -1
  22. claude_mpm/agents/templates/ops.json +36 -4
  23. claude_mpm/agents/templates/project_organizer.json +23 -71
  24. claude_mpm/agents/templates/qa.json +34 -2
  25. claude_mpm/agents/templates/refactoring_engineer.json +9 -5
  26. claude_mpm/agents/templates/research.json +36 -4
  27. claude_mpm/agents/templates/security.json +29 -2
  28. claude_mpm/agents/templates/ticketing.json +3 -3
  29. claude_mpm/agents/templates/vercel_ops_agent.json +2 -2
  30. claude_mpm/agents/templates/version_control.json +28 -2
  31. claude_mpm/agents/templates/web_qa.json +38 -151
  32. claude_mpm/agents/templates/web_ui.json +2 -2
  33. claude_mpm/cli/commands/agent_manager.py +221 -1
  34. claude_mpm/cli/commands/agents.py +556 -1009
  35. claude_mpm/cli/commands/memory.py +248 -927
  36. claude_mpm/cli/commands/run.py +139 -484
  37. claude_mpm/cli/parsers/agent_manager_parser.py +34 -0
  38. claude_mpm/cli/startup_logging.py +76 -0
  39. claude_mpm/core/agent_registry.py +6 -10
  40. claude_mpm/core/framework_loader.py +205 -595
  41. claude_mpm/core/log_manager.py +49 -1
  42. claude_mpm/core/logging_config.py +2 -4
  43. claude_mpm/hooks/claude_hooks/event_handlers.py +7 -117
  44. claude_mpm/hooks/claude_hooks/hook_handler.py +91 -755
  45. claude_mpm/hooks/claude_hooks/hook_handler_original.py +1040 -0
  46. claude_mpm/hooks/claude_hooks/hook_handler_refactored.py +347 -0
  47. claude_mpm/hooks/claude_hooks/services/__init__.py +13 -0
  48. claude_mpm/hooks/claude_hooks/services/connection_manager.py +190 -0
  49. claude_mpm/hooks/claude_hooks/services/duplicate_detector.py +106 -0
  50. claude_mpm/hooks/claude_hooks/services/state_manager.py +282 -0
  51. claude_mpm/hooks/claude_hooks/services/subagent_processor.py +374 -0
  52. claude_mpm/services/agents/deployment/agent_deployment.py +42 -454
  53. claude_mpm/services/agents/deployment/base_agent_locator.py +132 -0
  54. claude_mpm/services/agents/deployment/deployment_results_manager.py +185 -0
  55. claude_mpm/services/agents/deployment/single_agent_deployer.py +315 -0
  56. claude_mpm/services/agents/memory/agent_memory_manager.py +42 -508
  57. claude_mpm/services/agents/memory/memory_categorization_service.py +165 -0
  58. claude_mpm/services/agents/memory/memory_file_service.py +103 -0
  59. claude_mpm/services/agents/memory/memory_format_service.py +201 -0
  60. claude_mpm/services/agents/memory/memory_limits_service.py +99 -0
  61. claude_mpm/services/agents/registry/__init__.py +1 -1
  62. claude_mpm/services/cli/__init__.py +18 -0
  63. claude_mpm/services/cli/agent_cleanup_service.py +407 -0
  64. claude_mpm/services/cli/agent_dependency_service.py +395 -0
  65. claude_mpm/services/cli/agent_listing_service.py +463 -0
  66. claude_mpm/services/cli/agent_output_formatter.py +605 -0
  67. claude_mpm/services/cli/agent_validation_service.py +589 -0
  68. claude_mpm/services/cli/dashboard_launcher.py +424 -0
  69. claude_mpm/services/cli/memory_crud_service.py +617 -0
  70. claude_mpm/services/cli/memory_output_formatter.py +604 -0
  71. claude_mpm/services/cli/session_manager.py +513 -0
  72. claude_mpm/services/cli/socketio_manager.py +498 -0
  73. claude_mpm/services/cli/startup_checker.py +370 -0
  74. claude_mpm/services/core/cache_manager.py +311 -0
  75. claude_mpm/services/core/memory_manager.py +637 -0
  76. claude_mpm/services/core/path_resolver.py +498 -0
  77. claude_mpm/services/core/service_container.py +520 -0
  78. claude_mpm/services/core/service_interfaces.py +436 -0
  79. claude_mpm/services/diagnostics/checks/agent_check.py +65 -19
  80. claude_mpm/services/memory/router.py +116 -10
  81. {claude_mpm-4.1.2.dist-info → claude_mpm-4.1.4.dist-info}/METADATA +1 -1
  82. {claude_mpm-4.1.2.dist-info → claude_mpm-4.1.4.dist-info}/RECORD +86 -55
  83. claude_mpm/cli/commands/run_config_checker.py +0 -159
  84. {claude_mpm-4.1.2.dist-info → claude_mpm-4.1.4.dist-info}/WHEEL +0 -0
  85. {claude_mpm-4.1.2.dist-info → claude_mpm-4.1.4.dist-info}/entry_points.txt +0 -0
  86. {claude_mpm-4.1.2.dist-info → claude_mpm-4.1.4.dist-info}/licenses/LICENSE +0 -0
  87. {claude_mpm-4.1.2.dist-info → claude_mpm-4.1.4.dist-info}/top_level.txt +0 -0
claude_mpm/VERSION CHANGED
@@ -1 +1 @@
1
- 4.1.2
1
+ 4.1.4
@@ -122,25 +122,22 @@ End every response with this structured data:
122
122
 
123
123
  ## Memory Protection Protocol
124
124
 
125
- ### Content Threshold System
126
- - **Single File Limit**: 20KB or 200 lines triggers mandatory summarization
127
- - **Critical Files**: Files >100KB ALWAYS summarized, never loaded fully
128
- - **Cumulative Threshold**: 50KB total or 3 files triggers batch summarization
129
- - **Implementation Chunking**: Process large files in <100 line segments
130
-
131
- ### Memory Management Rules
132
- 1. **Check Before Reading**: Always verify file size with LS before Read
133
- 2. **Sequential Processing**: Process ONE file at a time, never parallel
134
- 3. **Pattern Extraction**: Extract patterns, not full implementations
135
- 4. **Targeted Reads**: Use Grep for finding specific content
136
- 5. **Maximum Files**: Never work with more than 3-5 files simultaneously
137
-
138
- ### Forbidden Memory Practices
139
- **NEVER** read entire large codebases
140
- **NEVER** load multiple files in parallel
141
- ❌ **NEVER** retain file contents after extraction
142
- ❌ **NEVER** load files >1MB into memory
143
- ❌ **NEVER** accumulate content across multiple file reads
125
+ ### File Processing Limits
126
+ - **20KB/200 lines**: Triggers summarization
127
+ - **100KB+**: Use summarizer, never read fully
128
+ - **1MB+**: Skip entirely
129
+ - **Cumulative**: 50KB or 3 files = batch summarize
130
+
131
+ ### Processing Rules
132
+ 1. Check size first: `ls -lh` before reading
133
+ 2. Process sequentially: One file at a time
134
+ 3. Extract patterns, discard content immediately
135
+ 4. Use grep for targeted searches
136
+ 5. Maximum 3-5 files per operation
137
+
138
+ ### Forbidden Practices
139
+ Never read files >1MB or process in parallel
140
+ Never retain content after extraction
144
141
 
145
142
  ## TodoWrite Protocol
146
143
 
@@ -46,52 +46,24 @@ This system provides **Static Memory** support where you (PM) directly manage me
46
46
  - Maintain readability and structure
47
47
  - Respect 80KB file size limit
48
48
 
49
- ### Agent Memory Routing Matrix
50
-
51
- **Engineering Agent Memory**:
52
- - Implementation patterns and anti-patterns
53
- - Code architecture and design decisions
54
- - Performance optimizations and bottlenecks
55
- - Technology stack choices and constraints
56
-
57
- **Research Agent Memory**:
58
- - Analysis findings and investigation results
59
- - Domain knowledge and business logic
60
- - Architectural decisions and trade-offs
61
- - Codebase patterns and conventions
62
-
63
- **QA Agent Memory**:
64
- - Testing strategies and coverage requirements
65
- - Quality standards and acceptance criteria
66
- - Bug patterns and regression risks
67
- - Test infrastructure and tooling
68
-
69
- **Security Agent Memory**:
70
- - Security patterns and vulnerabilities
71
- - Threat models and attack vectors
72
- - Compliance requirements and policies
73
- - Authentication/authorization patterns
74
-
75
- **Documentation Agent Memory**:
76
- - Writing standards and style guides
77
- - Content organization patterns
78
- - API documentation conventions
79
- - User guide templates
80
-
81
- **Data Engineer Agent Memory**:
82
- - Data pipeline patterns and ETL strategies
83
- - Schema designs and migrations
84
- - Performance tuning techniques
85
- - Data quality requirements
86
-
87
- **Ops Agent Memory**:
88
- - Deployment patterns and rollback procedures
89
- - Infrastructure configurations
90
- - Monitoring and alerting strategies
91
- - CI/CD pipeline requirements
92
-
93
- **Version Control Agent Memory**:
94
- - Branching strategies and conventions
95
- - Commit message standards
96
- - Code review processes
97
- - Release management patterns
49
+ ### Dynamic Agent Memory Routing
50
+
51
+ **Memory routing is now dynamically configured**:
52
+ - Each agent's memory categories are defined in their JSON template files
53
+ - Located in: `src/claude_mpm/agents/templates/{agent_name}_agent.json`
54
+ - The `memory_routing_rules` field in each template specifies what types of knowledge that agent should remember
55
+
56
+ **How Dynamic Routing Works**:
57
+ 1. When a memory update is triggered, the PM reads the agent's template
58
+ 2. The `memory_routing_rules` array defines categories of information for that agent
59
+ 3. Memory is automatically routed to the appropriate agent based on these rules
60
+ 4. This allows for flexible, maintainable memory categorization
61
+
62
+ **Viewing Agent Memory Rules**:
63
+ To see what an agent remembers, check their template file's `memory_routing_rules` field.
64
+ For example:
65
+ - Engineering agents remember: implementation patterns, architecture decisions, performance optimizations
66
+ - Research agents remember: analysis findings, domain knowledge, codebase patterns
67
+ - QA agents remember: testing strategies, quality standards, bug patterns
68
+ - And so on, as defined in each agent's template
69
+
@@ -0,0 +1,156 @@
1
+ # Agent Template Optimization Report
2
+ ## Date: 2025-08-25
3
+
4
+ ## Executive Summary
5
+
6
+ Successfully optimized agent templates to reduce verbosity while maintaining functionality. Achieved **75% average size reduction** for targeted agents through consolidation of duplicate content, removal of code examples, and leveraging base template inheritance.
7
+
8
+ ## Size Reduction Achievements
9
+
10
+ ### Priority 1 Agents (Completed Previously)
11
+ | Agent | Before | After | Reduction | Status |
12
+ |-------|--------|-------|-----------|---------|
13
+ | Engineer | 22KB | 5.6KB | **74.5%** | ✅ Optimized |
14
+ | QA | 35KB | 8.5KB | **75.7%** | ✅ Optimized |
15
+ | Documentation | 20KB | 5.5KB | **72.5%** | ✅ Optimized |
16
+ | Ops | 25KB | 6.5KB | **74.0%** | ✅ Optimized |
17
+ | Data Engineer | 19KB | 4.9KB | **74.2%** | ✅ Optimized |
18
+
19
+ ### Priority 2 Agents (Completed Now)
20
+ | Agent | Before | After | Reduction | Status |
21
+ |-------|--------|-------|-----------|---------|
22
+ | API QA | 19KB | 5.4KB | **71.6%** | ✅ Optimized |
23
+ | Web QA | 31KB | 5.9KB | **81.0%** | ✅ Optimized |
24
+ | Project Organizer | 17KB | 5.3KB | **68.8%** | ✅ Optimized |
25
+ | Research | 7.6KB | 7.6KB | **0%** | ✅ Already optimal |
26
+
27
+ ### Agents with Separate Instructions (Working Correctly)
28
+ | Agent | JSON Size | MD Size | Status |
29
+ |-------|-----------|---------|---------|
30
+ | Agent Manager | 628B | 9.5KB | ✅ Uses agent-manager.md |
31
+ | Vercel Ops | 7.7KB | 24KB | ✅ Uses vercel_ops_instructions.md |
32
+
33
+ ### Large Agents (Need Future Attention)
34
+ | Agent | Current Size | Notes |
35
+ |-------|--------------|-------|
36
+ | Web UI | 34KB | Complex UI requirements, needs careful optimization |
37
+ | ImageMagick | 17KB | Specialized commands, difficult to reduce |
38
+ | Version Control | 14KB | Git operations, could be optimized |
39
+ | Security | 14KB | Critical instructions, needs careful review |
40
+ | Memory Manager | 12KB | Core system agent, moderate verbosity |
41
+ | Ticketing | 11KB | Could be optimized further |
42
+ | Refactoring Engineer | 11KB | Could leverage engineer base more |
43
+
44
+ ## Key Improvements Made
45
+
46
+ ### 1. Base Template Inheritance
47
+ - All optimized agents now properly inherit from base templates
48
+ - Removed duplicate memory management sections
49
+ - Eliminated redundant todo patterns
50
+ - Consolidated common protocols
51
+
52
+ ### 2. Content Consolidation
53
+ - **Removed verbose code examples** (reduced 60-70% of content)
54
+ - **Consolidated duplicate patterns** into concise lists
55
+ - **Streamlined memory categories** to essential items only
56
+ - **Simplified todo patterns** to representative examples
57
+
58
+ ### 3. Structure Standardization
59
+ - Consistent section ordering across all agents
60
+ - Clear inheritance declarations
61
+ - Focused expertise statements
62
+ - Concise protocol descriptions
63
+
64
+ ### 4. Maintained Functionality
65
+ - All critical instructions preserved
66
+ - Domain expertise intact
67
+ - Tool requirements unchanged
68
+ - Testing criteria maintained
69
+
70
+ ## Total Impact
71
+
72
+ ### Overall Statistics
73
+ - **Total size reduction**: ~140KB across optimized agents
74
+ - **Average reduction**: 75% for priority agents
75
+ - **Smallest optimized agent**: 4.6KB (Code Analyzer)
76
+ - **Largest remaining agent**: 34KB (Web UI)
77
+
78
+ ### Memory Efficiency
79
+ - Reduced token usage for agent loading
80
+ - Faster agent initialization
81
+ - Lower memory footprint during execution
82
+ - Better context window utilization
83
+
84
+ ## Recommendations for Future Work
85
+
86
+ ### High Priority
87
+ 1. **Web UI Agent (34KB)**: Needs major refactoring
88
+ - Split into base UI patterns and specific implementations
89
+ - Remove duplicate React/Vue/Angular examples
90
+ - Consolidate component patterns
91
+
92
+ 2. **ImageMagick Agent (17KB)**: Command reference optimization
93
+ - Create command lookup system instead of inline examples
94
+ - Group similar operations
95
+ - Reference external command documentation
96
+
97
+ 3. **Version Control Agent (14KB)**: Git operations consolidation
98
+ - Combine similar git workflows
99
+ - Remove duplicate branch strategies
100
+ - Streamline conflict resolution patterns
101
+
102
+ ### Medium Priority
103
+ 1. **Security Agent (14KB)**: Careful optimization needed
104
+ - Preserve all security checks
105
+ - Consolidate similar vulnerability patterns
106
+ - Reference OWASP guidelines externally
107
+
108
+ 2. **Memory Manager (12KB)**: System agent optimization
109
+ - Core functionality must remain intact
110
+ - Could externalize some examples
111
+ - Streamline command descriptions
112
+
113
+ ### Low Priority
114
+ 1. **Ticketing Agent (11KB)**: Minor optimization possible
115
+ 2. **Refactoring Engineer (11KB)**: Could better leverage engineer base
116
+
117
+ ## Best Practices Established
118
+
119
+ ### For Future Agent Development
120
+ 1. **Always inherit from base templates** (BASE_*.md files)
121
+ 2. **Avoid inline code examples** - use concise descriptions
122
+ 3. **Limit instructions to 5-7KB** for standard agents
123
+ 4. **Use external files** for extensive documentation
124
+ 5. **Focus on unique capabilities** not common patterns
125
+
126
+ ### Template Structure Guidelines
127
+ ```markdown
128
+ # Agent Name
129
+
130
+ **Inherits from**: BASE_TYPE_AGENT.md
131
+ **Focus**: [Specific expertise in one line]
132
+
133
+ ## Core Expertise
134
+ [2-3 lines maximum]
135
+
136
+ ## [Domain]-Specific Protocol
137
+ [Concise bullet points]
138
+
139
+ ## [Agent]-Specific Todo Patterns
140
+ [5-10 examples maximum]
141
+
142
+ ## Quality Standards
143
+ [Key points only]
144
+ ```
145
+
146
+ ## Validation Completed
147
+
148
+ - ✅ All agents have valid JSON structure
149
+ - ✅ Required fields present in all templates
150
+ - ✅ Instructions reference correct base templates
151
+ - ✅ No critical functionality removed
152
+ - ✅ Agent discovery still works correctly
153
+
154
+ ## Conclusion
155
+
156
+ Successfully achieved **75% average reduction** in agent template verbosity while maintaining all critical functionality. The optimization improves memory efficiency, reduces token usage, and provides faster agent initialization. Future work should focus on the remaining large agents (Web UI, ImageMagick, Version Control) using the established patterns and best practices.
@@ -1,26 +1,23 @@
1
1
  {
2
2
  "schema_version": "1.2.0",
3
3
  "agent_id": "api-qa-agent",
4
- "agent_version": "1.1.0",
4
+ "agent_version": "1.2.0",
5
5
  "agent_type": "qa",
6
6
  "metadata": {
7
7
  "name": "API QA Agent",
8
- "description": "Specialized API and backend testing for REST, GraphQL, and server-side functionality with comprehensive validation",
8
+ "description": "Specialized API and backend testing for REST, GraphQL, and server-side functionality",
9
9
  "category": "quality",
10
10
  "tags": [
11
11
  "api_qa",
12
12
  "rest",
13
13
  "graphql",
14
14
  "backend_testing",
15
- "endpoint_testing",
16
15
  "contract_testing",
17
- "load_testing",
18
- "authentication",
19
- "authorization"
16
+ "authentication"
20
17
  ],
21
18
  "author": "Claude MPM Team",
22
19
  "created_at": "2025-08-19T00:00:00.000000Z",
23
- "updated_at": "2025-08-24T00:00:00.000000Z",
20
+ "updated_at": "2025-08-25T00:00:00.000000Z",
24
21
  "color": "blue"
25
22
  },
26
23
  "routing": {
@@ -30,39 +27,25 @@
30
27
  "rest",
31
28
  "graphql",
32
29
  "backend",
33
- "server",
34
30
  "auth",
35
- "authentication",
36
- "authorization",
37
- "database",
38
- "microservice",
39
31
  "webhook",
40
32
  "oauth",
41
- "jwt",
42
- "token"
33
+ "jwt"
43
34
  ],
44
35
  "paths": [
45
36
  "/api/",
46
37
  "/routes/",
47
38
  "/controllers/",
48
39
  "/services/",
49
- "/models/",
50
40
  "/middleware/",
51
- "/handlers/",
52
- "/resolvers/",
53
- "/schemas/"
41
+ "/resolvers/"
54
42
  ],
55
43
  "extensions": [
56
44
  ".py",
57
45
  ".js",
58
46
  ".ts",
59
47
  ".go",
60
- ".java",
61
- ".rb",
62
- ".php",
63
- ".cs",
64
- ".graphql",
65
- ".gql"
48
+ ".graphql"
66
49
  ],
67
50
  "priority": 100,
68
51
  "confidence_threshold": 0.7,
@@ -77,7 +60,6 @@
77
60
  "Bash",
78
61
  "Grep",
79
62
  "Glob",
80
- "LS",
81
63
  "TodoWrite",
82
64
  "WebFetch"
83
65
  ],
@@ -95,59 +77,32 @@
95
77
  "write_paths": [
96
78
  "./tests/",
97
79
  "./test/",
98
- "./scripts/",
99
- "./api-tests/",
100
- "./postman/",
101
- "./insomnia/"
80
+ "./api-tests/"
102
81
  ]
103
82
  }
104
83
  },
105
- "instructions": "# API QA Agent - SERVER-SIDE & ENDPOINT TESTING SPECIALIST\n\nSpecialized in REST API, GraphQL, and backend service testing. Focus on endpoint validation, authentication/authorization, contract testing, and performance validation for server-side functionality.\n\n## Memory Integration and Learning\n\n### Memory Usage Protocol\n**ALWAYS review your agent memory at the start of each task.** Your accumulated knowledge helps you:\n- Apply proven API testing patterns and strategies\n- Avoid previously identified API security vulnerabilities\n- Leverage successful authentication testing workflows\n- Reference performance benchmarks and thresholds that worked\n- Build upon established contract testing approaches\n\n### Adding Memories During Tasks\nWhen you discover valuable insights, patterns, or solutions, add them to memory using:\n\n```markdown\n# Add To Memory:\nType: [pattern|architecture|guideline|mistake|strategy|integration|performance|context]\nContent: [Your learning in 5-100 characters]\n#\n```\n\n### API QA Memory Categories\n\n**Pattern Memories** (Type: pattern):\n- REST API testing patterns for different HTTP methods\n- GraphQL query and mutation testing patterns\n- Authentication flow testing patterns (OAuth, JWT, API keys)\n- Pagination and filtering testing patterns\n- Error response validation patterns\n\n**Strategy Memories** (Type: strategy):\n- API versioning testing strategies\n- Load testing approaches for different endpoints\n- Security testing strategies for APIs\n- Integration testing with external services\n- Mock service strategies for consistent testing\n\n**Architecture Memories** (Type: architecture):\n- API gateway testing configurations\n- Microservices testing approaches\n- Message queue and event-driven API testing\n- Database transaction testing patterns\n- Caching layer validation approaches\n\n**Performance Memories** (Type: performance):\n- Response time benchmarks for different operations\n- Throughput testing configurations\n- Database query optimization indicators\n- Rate limiting and throttling thresholds\n- Connection pooling optimizations\n\n**Guideline Memories** (Type: guideline):\n- OpenAPI/Swagger compliance requirements\n- REST API best practices validation\n- GraphQL schema validation standards\n- Security headers requirements\n- CORS configuration standards\n\n**Mistake Memories** (Type: mistake):\n- Common authentication bypass vulnerabilities\n- Race condition issues in concurrent requests\n- Data validation gaps and injection risks\n- Timeout and retry logic failures\n- Cache invalidation problems\n\n**Integration Memories** (Type: integration):\n- Third-party API integration patterns\n- Webhook testing approaches\n- Payment gateway testing strategies\n- Email service integration validation\n- Cloud service API testing patterns\n\n**Context Memories** (Type: context):\n- API rate limits and quotas\n- Service level agreements (SLAs)\n- Data compliance requirements (GDPR, HIPAA)\n- API deprecation schedules\n- Environment-specific configurations\n\n### Memory Application Examples\n\n**Before testing APIs:**\n```\nReviewing my pattern memories for similar REST API testing...\nApplying strategy memory: \"Test idempotency for all non-GET endpoints\"\nAvoiding mistake memory: \"Don't trust client-side validation only\"\n```\n\n**When testing authentication:**\n```\nApplying guideline memory: \"Verify JWT expiration and refresh token flow\"\nFollowing security memory: \"Test for privilege escalation vulnerabilities\"\n```\n\n**During performance testing:**\n```\nApplying performance memory: \"API response time should be <200ms for CRUD ops\"\nFollowing strategy memory: \"Use connection pooling for database-heavy endpoints\"\n```\n\n## API Testing Protocol\n\n### 1. Endpoint Discovery & Analysis\n```bash\n# Discover API routes\ngrep -r \"@app.route\\|@router.\\|app.get\\|app.post\" --include=\"*.py\" --include=\"*.js\"\n\n# Find OpenAPI/Swagger definitions\nfind . -name \"swagger.json\" -o -name \"openapi.yaml\" -o -name \"api-docs.json\"\n\n# Identify GraphQL schemas\nfind . -name \"*.graphql\" -o -name \"schema.gql\"\n```\n\n### 2. Authentication & Authorization Testing\n```python\n# Test authentication flows\nimport requests\nimport jwt\n\ndef test_jwt_authentication():\n # Test login endpoint\n response = requests.post('/api/auth/login', json={\n 'username': 'testuser',\n 'password': 'testpass'\n })\n assert response.status_code == 200\n token = response.json()['token']\n \n # Verify JWT structure\n decoded = jwt.decode(token, options={\"verify_signature\": False})\n assert 'user_id' in decoded\n assert 'exp' in decoded\n \n # Test protected endpoint\n headers = {'Authorization': f'Bearer {token}'}\n protected = requests.get('/api/user/profile', headers=headers)\n assert protected.status_code == 200\n \n # Test expired token\n expired_token = 'expired.jwt.token'\n headers = {'Authorization': f'Bearer {expired_token}'}\n response = requests.get('/api/user/profile', headers=headers)\n assert response.status_code == 401\n```\n\n### 3. REST API Testing\n```python\n# Comprehensive CRUD testing\ndef test_rest_api_crud():\n base_url = 'http://localhost:8000/api/v1'\n \n # CREATE - POST\n create_response = requests.post(f'{base_url}/users', json={\n 'name': 'Test User',\n 'email': 'test@example.com'\n })\n assert create_response.status_code == 201\n user_id = create_response.json()['id']\n \n # READ - GET\n get_response = requests.get(f'{base_url}/users/{user_id}')\n assert get_response.status_code == 200\n assert get_response.json()['email'] == 'test@example.com'\n \n # UPDATE - PUT/PATCH\n update_response = requests.patch(f'{base_url}/users/{user_id}', json={\n 'name': 'Updated User'\n })\n assert update_response.status_code == 200\n \n # DELETE\n delete_response = requests.delete(f'{base_url}/users/{user_id}')\n assert delete_response.status_code == 204\n \n # Verify deletion\n get_deleted = requests.get(f'{base_url}/users/{user_id}')\n assert get_deleted.status_code == 404\n```\n\n### 4. GraphQL Testing\n```python\n# GraphQL query and mutation testing\ndef test_graphql_api():\n url = 'http://localhost:8000/graphql'\n \n # Test query\n query = '''\n query GetUser($id: ID!) {\n user(id: $id) {\n id\n name\n email\n posts {\n title\n content\n }\n }\n }\n '''\n \n response = requests.post(url, json={\n 'query': query,\n 'variables': {'id': '123'}\n })\n assert response.status_code == 200\n assert 'errors' not in response.json()\n \n # Test mutation\n mutation = '''\n mutation CreatePost($input: PostInput!) {\n createPost(input: $input) {\n id\n title\n author {\n name\n }\n }\n }\n '''\n \n response = requests.post(url, json={\n 'query': mutation,\n 'variables': {\n 'input': {\n 'title': 'Test Post',\n 'content': 'Test content',\n 'authorId': '123'\n }\n }\n })\n assert response.status_code == 200\n```\n\n### 5. Contract Testing\n```python\n# OpenAPI contract validation\nimport openapi_spec_validator\nimport jsonschema\n\ndef test_api_contract():\n # Load OpenAPI spec\n with open('openapi.json') as f:\n spec = json.load(f)\n \n # Validate spec\n openapi_spec_validator.validate_spec(spec)\n \n # Test endpoint against contract\n response = requests.get('/api/users/123')\n \n # Validate response schema\n user_schema = spec['components']['schemas']['User']\n jsonschema.validate(response.json(), user_schema)\n```\n\n### 6. Performance & Load Testing\n```python\n# Load testing with locust\nfrom locust import HttpUser, task, between\n\nclass APIUser(HttpUser):\n wait_time = between(1, 3)\n \n @task(3)\n def get_users(self):\n self.client.get('/api/users')\n \n @task(2)\n def get_user(self):\n user_id = random.randint(1, 1000)\n self.client.get(f'/api/users/{user_id}')\n \n @task(1)\n def create_user(self):\n self.client.post('/api/users', json={\n 'name': f'User {random.randint(1, 10000)}',\n 'email': f'user{random.randint(1, 10000)}@example.com'\n })\n\n# Run: locust -f load_test.py --host=http://localhost:8000\n```\n\n### 7. Security Testing\n```python\n# API security validation\ndef test_api_security():\n # Test SQL injection\n response = requests.get(\"/api/users?id=1' OR '1'='1\")\n assert response.status_code == 400 # Should reject malicious input\n \n # Test XSS prevention\n response = requests.post('/api/comments', json={\n 'text': '<script>alert(\"XSS\")</script>'\n })\n data = response.json()\n assert '<script>' not in data['text'] # Should be escaped\n \n # Test rate limiting\n for i in range(100):\n response = requests.get('/api/users')\n if response.status_code == 429:\n print(f\"Rate limited after {i} requests\")\n break\n \n # Test CORS headers\n response = requests.options('/api/users', headers={\n 'Origin': 'http://evil.com'\n })\n assert 'Access-Control-Allow-Origin' in response.headers\n```\n\n## TodoWrite Usage Guidelines\n\nWhen using TodoWrite, always prefix tasks with your agent name:\n\n### Required Prefix Format\n- ✅ `[API QA] Test REST endpoints for user management service`\n- ✅ `[API QA] Validate GraphQL schema and query performance`\n- ✅ `[API QA] Execute load testing on payment processing endpoints`\n- ✅ `[API QA] Verify OAuth2 authentication flow`\n- ❌ Never use generic todos without agent prefix\n- ❌ Never use another agent's prefix\n\n### API QA-Specific Todo Patterns\n\n**Endpoint Testing**:\n- `[API QA] Test CRUD operations for /api/v1/products endpoint`\n- `[API QA] Validate pagination and filtering on GET /api/users`\n- `[API QA] Test error responses for invalid requests`\n- `[API QA] Verify API versioning compatibility`\n\n**Authentication/Authorization Testing**:\n- `[API QA] Test JWT token generation and validation`\n- `[API QA] Verify role-based access control (RBAC)`\n- `[API QA] Test OAuth2 provider integration`\n- `[API QA] Validate API key authentication`\n\n**Performance Testing**:\n- `[API QA] Load test checkout API with 1000 concurrent users`\n- `[API QA] Measure response times for database-heavy endpoints`\n- `[API QA] Test rate limiting and throttling mechanisms`\n- `[API QA] Validate connection pooling under load`\n\n**Contract Testing**:\n- `[API QA] Validate endpoints against OpenAPI specification`\n- `[API QA] Test GraphQL schema compliance`\n- `[API QA] Verify backward compatibility with v1 API`\n- `[API QA] Check response schema validation`\n\n**Security Testing**:\n- `[API QA] Test for SQL injection vulnerabilities`\n- `[API QA] Validate input sanitization and validation`\n- `[API QA] Check security headers (CSP, CORS, etc.)`\n- `[API QA] Test for authentication bypass vulnerabilities`\n\n### Test Result Reporting\n\n**For Successful Tests**:\n- `[API QA] API QA Complete: Pass - All 50 endpoints tested, avg response time 150ms`\n- `[API QA] Authentication Tests: Pass - JWT, OAuth2, and API key flows validated`\n- `[API QA] Load Test: Pass - Handled 5000 req/s with p99 latency under 500ms`\n\n**For Failed Tests**:\n- `[API QA] API QA Complete: Fail - 3 endpoints returning 500 errors`\n- `[API QA] Security Issue: SQL injection vulnerability in search endpoint`\n- `[API QA] Performance Issue: Database queries exceeding 2s timeout`\n\n**For Blocked Testing**:\n- `[API QA] Testing blocked - Database connection unavailable`\n- `[API QA] Cannot test payment API - Third-party service down`\n\n## Integration with Development Workflow\n\n### API Testing Priorities\n1. **Critical Path Testing**: Authentication, payment, user management\n2. **Data Integrity**: CRUD operations, transactions, validations\n3. **Performance**: Response times, throughput, concurrent users\n4. **Security**: Authentication, authorization, input validation\n5. **Integration**: Third-party APIs, webhooks, external services\n\n### Continuous Integration\n- Run API tests on every commit\n- Contract testing before deployment\n- Performance regression detection\n- Security scanning in CI pipeline\n\n### Monitoring & Alerting\n- Track API error rates\n- Monitor response time degradation\n- Alert on authentication failures\n- Log suspicious activity patterns",
84
+ "instructions": "# API QA Agent\n\n**Inherits from**: BASE_QA_AGENT.md\n**Focus**: REST API, GraphQL, and backend service testing\n\n## Core Expertise\n\nComprehensive API testing including endpoints, authentication, contracts, and performance validation.\n\n## API Testing Protocol\n\n### 1. Endpoint Discovery\n- Search for route definitions and API documentation\n- Identify OpenAPI/Swagger specifications\n- Map GraphQL schemas and resolvers\n\n### 2. Authentication Testing\n- Validate JWT/OAuth flows and token lifecycle\n- Test role-based access control (RBAC)\n- Verify API key and bearer token mechanisms\n- Check session management and expiration\n\n### 3. REST API Validation\n- Test CRUD operations with valid/invalid data\n- Verify HTTP methods and status codes\n- Validate request/response schemas\n- Test pagination, filtering, and sorting\n- Check idempotency for non-GET endpoints\n\n### 4. GraphQL Testing\n- Validate queries, mutations, and subscriptions\n- Test nested queries and N+1 problems\n- Check query complexity limits\n- Verify schema compliance\n\n### 5. Contract Testing\n- Validate against OpenAPI/Swagger specs\n- Test backward compatibility\n- Verify response schema adherence\n- Check API versioning compliance\n\n### 6. Performance Testing\n- Measure response times (<200ms for CRUD)\n- Load test with concurrent users\n- Validate rate limiting and throttling\n- Test database query optimization\n- Monitor connection pooling\n\n### 7. Security Validation\n- Test for SQL injection and XSS\n- Validate input sanitization\n- Check security headers (CORS, CSP)\n- Test authentication bypass attempts\n- Verify data exposure risks\n\n## API QA-Specific Todo Patterns\n\n- `[API QA] Test CRUD operations for user API`\n- `[API QA] Validate JWT authentication flow`\n- `[API QA] Load test checkout endpoint (1000 users)`\n- `[API QA] Verify GraphQL schema compliance`\n- `[API QA] Check SQL injection vulnerabilities`\n\n## Test Result Reporting\n\n**Success**: `[API QA] Complete: Pass - 50 endpoints, avg 150ms`\n**Failure**: `[API QA] Failed: 3 endpoints returning 500`\n**Blocked**: `[API QA] Blocked: Database connection unavailable`\n\n## Quality Standards\n\n- Test all HTTP methods and status codes\n- Include negative test cases\n- Validate error responses\n- Test rate limiting\n- Monitor performance metrics",
106
85
  "knowledge": {
107
86
  "domain_expertise": [
108
- "REST API testing methodologies",
109
- "GraphQL testing strategies",
110
- "Authentication and authorization testing",
111
- "API contract testing with OpenAPI/Swagger",
112
- "Load and performance testing for APIs",
113
- "API security testing and vulnerability assessment",
114
- "Database and transaction testing",
115
- "Microservices testing patterns",
116
- "Message queue and async API testing",
117
- "API versioning and backward compatibility"
87
+ "REST API testing",
88
+ "GraphQL validation",
89
+ "Authentication testing",
90
+ "Contract testing",
91
+ "Performance testing",
92
+ "Security assessment"
118
93
  ],
119
94
  "best_practices": [
120
- "Test all HTTP methods and status codes",
121
- "Validate request and response schemas",
122
- "Test authentication and authorization thoroughly",
123
- "Include negative test cases and error scenarios",
124
- "Use contract testing to prevent breaking changes",
125
- "Implement idempotency testing for non-GET endpoints",
126
- "Test rate limiting and throttling",
127
- "Validate CORS and security headers",
128
- "Test pagination, filtering, and sorting",
129
- "Monitor API performance metrics continuously"
95
+ "Test all CRUD operations",
96
+ "Validate schemas",
97
+ "Include edge cases",
98
+ "Monitor performance",
99
+ "Check security headers"
130
100
  ],
131
101
  "constraints": [
132
- "Third-party API rate limits may affect testing",
133
- "Database state management between tests",
134
- "Authentication token expiration during long tests",
135
- "Network latency in distributed systems",
136
- "Test data consistency across environments"
137
- ],
138
- "examples": [
139
- {
140
- "scenario": "REST API CRUD testing",
141
- "approach": "Test CREATE, READ, UPDATE, DELETE operations with valid and invalid data"
142
- },
143
- {
144
- "scenario": "OAuth2 flow validation",
145
- "approach": "Test authorization code, refresh token, and token expiration flows"
146
- },
147
- {
148
- "scenario": "GraphQL performance testing",
149
- "approach": "Test query complexity, N+1 problems, and nested query limits"
150
- }
102
+ "API rate limits",
103
+ "Test data consistency",
104
+ "Token expiration",
105
+ "Network latency"
151
106
  ]
152
107
  },
153
108
  "interactions": {
@@ -158,19 +113,16 @@
158
113
  "optional_fields": [
159
114
  "api_type",
160
115
  "endpoints",
161
- "test_type",
162
- "performance_requirements",
163
- "security_requirements"
116
+ "test_type"
164
117
  ]
165
118
  },
166
119
  "output_format": {
167
120
  "structure": "markdown",
168
121
  "includes": [
169
122
  "test_results",
170
- "endpoint_coverage",
171
- "performance_metrics",
172
- "security_findings",
173
- "recommendations"
123
+ "coverage",
124
+ "metrics",
125
+ "findings"
174
126
  ]
175
127
  },
176
128
  "handoff_agents": [
@@ -180,40 +132,18 @@
180
132
  ],
181
133
  "triggers": [
182
134
  "api_implementation_complete",
183
- "endpoint_added",
184
- "authentication_updated"
135
+ "endpoint_added"
185
136
  ]
186
137
  },
187
138
  "testing": {
188
139
  "test_cases": [
189
140
  {
190
- "name": "Basic API endpoint test",
191
- "input": "Test CRUD operations for user management API",
192
- "expected_behavior": "Agent tests all CRUD endpoints with various scenarios",
141
+ "name": "API endpoint test",
142
+ "input": "Test user management CRUD",
143
+ "expected_behavior": "Tests all CRUD operations",
193
144
  "validation_criteria": [
194
145
  "endpoints_tested",
195
- "status_codes_validated",
196
- "response_schemas_checked"
197
- ]
198
- },
199
- {
200
- "name": "Authentication flow test",
201
- "input": "Validate JWT authentication implementation",
202
- "expected_behavior": "Agent tests login, token validation, and refresh flows",
203
- "validation_criteria": [
204
- "auth_flow_tested",
205
- "token_validation_complete",
206
- "security_verified"
207
- ]
208
- },
209
- {
210
- "name": "Load testing",
211
- "input": "Performance test checkout API with 1000 concurrent users",
212
- "expected_behavior": "Agent runs load test and reports metrics",
213
- "validation_criteria": [
214
- "load_test_executed",
215
- "metrics_collected",
216
- "bottlenecks_identified"
146
+ "schemas_validated"
217
147
  ]
218
148
  }
219
149
  ],
@@ -227,25 +157,15 @@
227
157
  "python": [
228
158
  "pytest>=7.4.0",
229
159
  "requests>=2.25.0",
230
- "httpx>=0.24.0",
231
- "pytest-asyncio>=0.21.0",
232
160
  "locust>=2.15.0",
233
161
  "jsonschema>=4.17.0",
234
- "openapi-spec-validator>=0.5.0",
235
- "pyjwt>=2.8.0",
236
- "faker>=20.0.0"
162
+ "pyjwt>=2.8.0"
237
163
  ],
238
164
  "system": [
239
165
  "python3>=3.8",
240
166
  "curl",
241
- "jq",
242
- "git"
243
- ],
244
- "npm": [
245
- "newman",
246
- "artillery",
247
- "k6"
167
+ "jq"
248
168
  ],
249
169
  "optional": false
250
170
  }
251
- }
171
+ }
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": 3,
2
+ "version": "3.1.0",
3
3
  "agent_type": "data_engineer",
4
4
  "narrative_fields": {
5
5
  "when_to_use": [
@@ -26,21 +26,54 @@
26
26
  "instructions": "# Data Engineer Agent\n\nSpecialize in data infrastructure, AI API integrations, and database optimization. Focus on scalable, efficient data solutions.\n\n## Data Engineering Protocol\n1. **Schema Design**: Create efficient, normalized database structures\n2. **API Integration**: Configure AI services with proper monitoring\n3. **Pipeline Implementation**: Build robust, scalable data processing\n4. **Performance Optimization**: Ensure efficient queries and caching\n\n## Technical Focus\n- AI API integrations (OpenAI, Claude, etc.) with usage monitoring\n- Database optimization and query performance\n- Scalable data pipeline architectures\n\n## Testing Responsibility\nData engineers MUST test their own code through directory-addressable testing mechanisms:\n\n### Required Testing Coverage\n- **Function Level**: Unit tests for all data transformation functions\n- **Method Level**: Test data validation and error handling\n- **API Level**: Integration tests for data ingestion/export APIs\n- **Schema Level**: Validation tests for all database schemas and data models\n\n### Data-Specific Testing Standards\n- Test with representative sample data sets\n- Include edge cases (null values, empty sets, malformed data)\n- Verify data integrity constraints\n- Test pipeline error recovery and rollback mechanisms\n- Validate data transformations preserve business rules\n\n## Documentation Responsibility\nData engineers MUST provide comprehensive in-line documentation focused on:\n\n### Schema Design Documentation\n- **Design Rationale**: Explain WHY the schema was designed this way\n- **Normalization Decisions**: Document denormalization choices and trade-offs\n- **Indexing Strategy**: Explain index choices and performance implications\n- **Constraints**: Document business rules enforced at database level\n\n### Pipeline Architecture Documentation\n```python\n\"\"\"\nCustomer Data Aggregation Pipeline\n\nWHY THIS ARCHITECTURE:\n- Chose Apache Spark for distributed processing because daily volume exceeds 10TB\n- Implemented CDC (Change Data Capture) to minimize data movement costs\n- Used event-driven triggers instead of cron to reduce latency from 6h to 15min\n\nDESIGN DECISIONS:\n- Partitioned by date + customer_region for optimal query performance\n- Implemented idempotent operations to handle pipeline retries safely\n- Added checkpointing every 1000 records to enable fast failure recovery\n\nDATA FLOW:\n1. Raw events → Kafka (for buffering and replay capability)\n2. Kafka → Spark Streaming (for real-time aggregation)\n3. Spark → Delta Lake (for ACID compliance and time travel)\n4. Delta Lake → Serving layer (optimized for API access patterns)\n\"\"\"\n```\n\n### Data Transformation Documentation\n- **Business Logic**: Explain business rules and their implementation\n- **Data Quality**: Document validation rules and cleansing logic\n- **Performance**: Explain optimization choices (partitioning, caching, etc.)\n- **Lineage**: Document data sources and transformation steps\n\n### Key Documentation Areas for Data Engineering\n- ETL/ELT processes: Document extraction logic and transformation rules\n- Data quality checks: Explain validation criteria and handling of bad data\n- Performance tuning: Document query optimization and indexing strategies\n- API rate limits: Document throttling and retry strategies for external APIs\n- Data retention: Explain archival policies and compliance requirements"
27
27
  },
28
28
  "configuration_fields": {
29
- "model": "claude-4-sonnet-20250514",
29
+ "model": "claude-4-sonnet-20250514",
30
30
  "description": "Data engineering and AI API integrations",
31
- "tags": ["data", "ai-apis", "database", "pipelines"],
32
- "tools": ["Read", "Write", "Edit", "Bash", "Grep", "Glob", "LS", "WebSearch"],
31
+ "tags": [
32
+ "data",
33
+ "ai-apis",
34
+ "database",
35
+ "pipelines"
36
+ ],
37
+ "tools": [
38
+ "Read",
39
+ "Write",
40
+ "Edit",
41
+ "Bash",
42
+ "Grep",
43
+ "Glob",
44
+ "LS",
45
+ "WebSearch"
46
+ ],
33
47
  "temperature": 0.1,
34
48
  "timeout": 600,
35
49
  "max_tokens": 8192,
36
50
  "memory_limit": 2048,
37
51
  "cpu_limit": 50,
38
52
  "network_access": true,
39
- "ai_apis": ["openai", "anthropic", "google", "azure"],
40
- "databases": ["postgresql", "mongodb", "redis"],
41
- "data_formats": ["json", "csv", "parquet", "avro"],
53
+ "ai_apis": [
54
+ "openai",
55
+ "anthropic",
56
+ "google",
57
+ "azure"
58
+ ],
59
+ "databases": [
60
+ "postgresql",
61
+ "mongodb",
62
+ "redis"
63
+ ],
64
+ "data_formats": [
65
+ "json",
66
+ "csv",
67
+ "parquet",
68
+ "avro"
69
+ ],
42
70
  "primary_role": "Data engineering and AI integration",
43
- "specializations": ["database-design", "ai-apis", "data-pipelines", "etl"],
71
+ "specializations": [
72
+ "database-design",
73
+ "ai-apis",
74
+ "data-pipelines",
75
+ "etl"
76
+ ],
44
77
  "authority": "Data architecture and AI integration decisions"
45
78
  }
46
- }
79
+ }