claude-flow-novice 2.14.31 → 2.14.33
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.
- package/.claude/cfn-data/cfn-loop.db +0 -0
- package/.claude/commands/CFN_LOOP_TASK_MODE.md +1 -1
- package/.claude/skills/cfn-agent-discovery/agents-registry.json +10 -9
- package/.claude/skills/cfn-docker-agent-spawning/SKILL.md +394 -0
- package/.claude/skills/cfn-docker-agent-spawning/spawn-agent.sh +521 -0
- package/.claude/skills/cfn-docker-loop-orchestration/SKILL.md +449 -0
- package/.claude/skills/cfn-docker-loop-orchestration/orchestrate.sh +787 -0
- package/.claude/skills/cfn-docker-redis-coordination/SKILL.md +435 -0
- package/.claude/skills/cfn-docker-redis-coordination/coordinate.sh +635 -0
- package/.claude/skills/cfn-docker-skill-mcp-selection/SKILL.md +289 -0
- package/.claude/skills/cfn-docker-skill-mcp-selection/skill-mcp-selector.js +472 -0
- package/.claude/skills/cfn-loop-validation/config.json +2 -2
- package/.claude/skills/pre-edit-backup/backup.sh +107 -0
- package/README.md +95 -0
- package/claude-assets/agents/README-AGENT_LIFECYCLE.md +10 -37
- package/claude-assets/agents/README-VALIDATION.md +8 -0
- package/claude-assets/agents/cfn-dev-team/README.md +8 -0
- package/claude-assets/agents/cfn-dev-team/coordinators/README.md +9 -1
- package/claude-assets/agents/cfn-dev-team/coordinators/cfn-v3-coordinator.md +71 -9
- package/claude-assets/agents/cfn-dev-team/developers/README.md +9 -1
- package/claude-assets/agents/cfn-dev-team/documentation/README-VALIDATION.md +8 -0
- package/claude-assets/agents/cfn-dev-team/documentation/agent-type-guidelines.md +10 -0
- package/claude-assets/agents/cfn-dev-team/reviewers/README.md +9 -1
- package/claude-assets/agents/cfn-dev-team/reviewers/quality/quality-metrics.md +10 -0
- package/claude-assets/agents/cfn-dev-team/test-agent.md +10 -0
- package/claude-assets/agents/cfn-dev-team/testers/README.md +9 -1
- package/claude-assets/agents/csuite/cto-agent.md +10 -0
- package/claude-assets/agents/custom/cfn-system-expert.md +128 -1
- package/claude-assets/agents/docker-coordinators/cfn-docker-v3-coordinator.md +5 -1
- package/claude-assets/agents/docker-team/csuite/c-suite-template.md +5 -1
- package/claude-assets/agents/docker-team/infrastructure/team-coordinator-template.md +5 -1
- package/claude-assets/agents/marketing_hybrid/cost_tracker.md +10 -0
- package/claude-assets/agents/marketing_hybrid/docker_deployer.md +10 -0
- package/claude-assets/agents/marketing_hybrid/zai_worker_spawner.md +10 -0
- package/claude-assets/commands/CFN_LOOP_TASK_MODE.md +1 -1
- package/claude-assets/hooks/cfn-post-execution/memory-cleanup.sh +20 -0
- package/claude-assets/hooks/cfn-pre-execution/memory-check.sh +20 -0
- package/claude-assets/skills/cfn-agent-discovery/agents-registry.json +10 -9
- package/claude-assets/skills/cfn-docker-agent-spawning/spawn-agent.sh +70 -10
- package/claude-assets/skills/cfn-loop-validation/config.json +2 -2
- package/claude-assets/skills/cfn-memory-management/SKILL.md +271 -0
- package/claude-assets/skills/cfn-memory-management/check-memory.sh +160 -0
- package/claude-assets/skills/cfn-memory-management/cleanup-memory.sh +197 -0
- package/claude-assets/skills/cfn-redis-data-extraction/SKILL.md +442 -0
- package/claude-assets/skills/cfn-redis-data-extraction/extract.sh +306 -0
- package/claude-assets/skills/cfn-task-config-init/initialize-config.sh +2 -2
- package/claude-assets/skills/hook-pipeline/security-scanner.sh +102 -0
- package/claude-assets/skills/pre-edit-backup/backup.sh +107 -0
- package/dist/cli/agent-command.js +44 -2
- package/dist/cli/agent-command.js.map +1 -1
- package/dist/cli/config-manager.js +91 -109
- package/dist/cli/config-manager.js.map +1 -1
- package/dist/cli/index.js +29 -2
- package/dist/cli/index.js.map +1 -1
- package/package.json +22 -5
- package/scripts/deploy-production.sh +356 -0
- package/scripts/memory-leak-prevention.sh +306 -0
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
# CFN Docker Skill-Based MCP Selection Skill
|
|
2
|
+
|
|
3
|
+
**Purpose:** Map agent skills to required MCP servers for container-based agent orchestration with authentication and resource optimization.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
This skill enables dynamic MCP server selection based on agent skills, ensuring that agents only connect to the MCP servers they need. This provides significant memory optimization (50%+ savings) and security through skill-based access control.
|
|
8
|
+
|
|
9
|
+
## Architecture
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
Agent Skills → Skill Analyzer → MCP Server Selection → Token Generation → Container Configuration
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Core Functions
|
|
16
|
+
|
|
17
|
+
### 1. Skill-to-MCP Mapping
|
|
18
|
+
Analyze agent skills and determine required MCP servers:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
# Frontend engineer with browser automation skills
|
|
22
|
+
frontend-engineer + browser-automation → playwright MCP
|
|
23
|
+
|
|
24
|
+
# Backend developer with database skills
|
|
25
|
+
backend-developer + redis-operations → redis MCP
|
|
26
|
+
backend-developer + postgres-operations → postgres MCP
|
|
27
|
+
|
|
28
|
+
# Security specialist with auditing skills
|
|
29
|
+
security-specialist + security-auditing → security-scanner MCP
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### 2. Token Generation
|
|
33
|
+
Generate authentication tokens for selected MCP servers:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
# Generate tokens for agent MCP access
|
|
37
|
+
cfn-docker-skill-mcp-selector generate-tokens \
|
|
38
|
+
--agent-type react-frontend-engineer \
|
|
39
|
+
--mcp-servers playwright \
|
|
40
|
+
--expiry 24h
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### 3. Resource Calculation
|
|
44
|
+
Calculate memory and CPU requirements for containers:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
# Calculate container resources based on MCP servers
|
|
48
|
+
cfn-docker-skill-mcp-selector calculate-resources \
|
|
49
|
+
--agent-type backend-developer \
|
|
50
|
+
--mcp-servers redis,postgres
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### 4. Docker Configuration Generation
|
|
54
|
+
Generate Docker Compose and container configurations:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
# Generate Docker configuration for agent containers
|
|
58
|
+
cfn-docker-skill-mcp-selector generate-docker-config \
|
|
59
|
+
--agent-type react-frontend-engineer \
|
|
60
|
+
--output docker-compose.yml
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Usage Patterns
|
|
64
|
+
|
|
65
|
+
### Basic MCP Selection
|
|
66
|
+
```bash
|
|
67
|
+
# Get MCP servers for an agent type
|
|
68
|
+
cfn-docker-skill-mcp-selector select \
|
|
69
|
+
--agent-type react-frontend-engineer
|
|
70
|
+
|
|
71
|
+
# Response:
|
|
72
|
+
# Selected MCP Servers: playwright
|
|
73
|
+
# Memory Required: 1024MB
|
|
74
|
+
# CPU Required: 1.0 units
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### Token Management
|
|
78
|
+
```bash
|
|
79
|
+
# Generate tokens for multiple agents
|
|
80
|
+
cfn-docker-skill-mcp-selector generate-tokens \
|
|
81
|
+
--agent-types frontend-team,backend-team \
|
|
82
|
+
--mcp-servers playwright,redis,postgres \
|
|
83
|
+
--batch-mode
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Container Configuration
|
|
87
|
+
```bash
|
|
88
|
+
# Generate complete container setup
|
|
89
|
+
cfn-docker-skill-mcp-selector setup-containers \
|
|
90
|
+
--team frontend \
|
|
91
|
+
--agents 3 \
|
|
92
|
+
--memory-limit 1g \
|
|
93
|
+
--network mcp-network
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Configuration Files
|
|
97
|
+
|
|
98
|
+
### Agent Skills Configuration
|
|
99
|
+
```json
|
|
100
|
+
{
|
|
101
|
+
"agents": [
|
|
102
|
+
{
|
|
103
|
+
"type": "react-frontend-engineer",
|
|
104
|
+
"skills": ["ui-development", "browser-automation", "screenshot-capture"],
|
|
105
|
+
"allowedMcpServers": ["playwright"],
|
|
106
|
+
"memoryLimit": "1g",
|
|
107
|
+
"cpuLimit": 1.0
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
"type": "backend-developer",
|
|
111
|
+
"skills": ["api-development", "redis-operations", "postgres-operations"],
|
|
112
|
+
"allowedMcpServers": ["redis", "postgres"],
|
|
113
|
+
"memoryLimit": "768m",
|
|
114
|
+
"cpuLimit": 0.8
|
|
115
|
+
}
|
|
116
|
+
]
|
|
117
|
+
}
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### MCP Server Configuration
|
|
121
|
+
```json
|
|
122
|
+
{
|
|
123
|
+
"mcpServers": {
|
|
124
|
+
"playwright": {
|
|
125
|
+
"requiredSkills": ["browser-automation"],
|
|
126
|
+
"memoryImpact": 512,
|
|
127
|
+
"cpuImpact": 0.5,
|
|
128
|
+
"tools": ["take_screenshot", "google_search", "page_interaction"]
|
|
129
|
+
},
|
|
130
|
+
"redis": {
|
|
131
|
+
"requiredSkills": ["redis-operations"],
|
|
132
|
+
"memoryImpact": 256,
|
|
133
|
+
"cpuImpact": 0.3,
|
|
134
|
+
"tools": ["redis_get", "redis_set", "redis_keys"]
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
## Implementation Details
|
|
141
|
+
|
|
142
|
+
### Skill Analysis Algorithm
|
|
143
|
+
1. **Parse Agent Skills**: Extract skills from agent configuration
|
|
144
|
+
2. **Match MCP Requirements**: Find MCP servers matching required skills
|
|
145
|
+
3. **Calculate Resources**: Sum memory/CPU requirements for selected MCPs
|
|
146
|
+
4. **Generate Tokens**: Create authentication tokens for each selected MCP
|
|
147
|
+
5. **Validate Configuration**: Ensure all constraints are satisfied
|
|
148
|
+
|
|
149
|
+
### Token Security
|
|
150
|
+
- Cryptographically secure token generation using crypto.randomBytes
|
|
151
|
+
- Redis-based token storage with TTL for automatic expiration
|
|
152
|
+
- Agent-specific token scopes limiting access to required tools only
|
|
153
|
+
- Token revocation capability for security incidents
|
|
154
|
+
|
|
155
|
+
### Resource Optimization
|
|
156
|
+
- **Memory Savings**: 50-75% reduction vs loading all MCP servers
|
|
157
|
+
- **CPU Efficiency**: Only allocate CPU for required MCP servers
|
|
158
|
+
- **Network Optimization**: Local Docker networking for MCP communication
|
|
159
|
+
- **Storage Efficiency**: Read-only codebase mounts with tmpfs workspaces
|
|
160
|
+
|
|
161
|
+
## Integration Points
|
|
162
|
+
|
|
163
|
+
### With CFN Docker Agent Spawning
|
|
164
|
+
```bash
|
|
165
|
+
# Agent spawning calls MCP selection
|
|
166
|
+
cfn-docker-agent-spawn \
|
|
167
|
+
--agent-type security-specialist \
|
|
168
|
+
--mcp-selection $(cfn-docker-skill-mcp-selector select --agent-type security-specialist)
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
### With CFN Docker Redis Coordination
|
|
172
|
+
```bash
|
|
173
|
+
# Store MCP configuration in Redis for swarm recovery
|
|
174
|
+
cfn-docker-redis-coordination store \
|
|
175
|
+
--key "agent:${AGENT_ID}:mcp-config" \
|
|
176
|
+
--value "$(cfn-docker-skill-mcp-selector get-config --agent-type ${AGENT_TYPE})"
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
### With CFN Docker Loop Orchestration
|
|
180
|
+
```bash
|
|
181
|
+
# Loop orchestration uses MCP selection for agent configuration
|
|
182
|
+
cfn-docker-loop-orchestration spawn-agents \
|
|
183
|
+
--task-context "${TASK_CONTEXT}" \
|
|
184
|
+
--mcp-auto-select
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
## Error Handling
|
|
188
|
+
|
|
189
|
+
### Configuration Validation
|
|
190
|
+
- Validate agent skill requirements against available MCP servers
|
|
191
|
+
- Check resource limits against system capacity
|
|
192
|
+
- Verify network connectivity to MCP servers
|
|
193
|
+
|
|
194
|
+
### Fallback Mechanisms
|
|
195
|
+
- Graceful degradation when MCP servers unavailable
|
|
196
|
+
- Direct tool access fallback for critical operations
|
|
197
|
+
- Manual override capabilities for emergency situations
|
|
198
|
+
|
|
199
|
+
### Monitoring and Alerting
|
|
200
|
+
- Token expiration monitoring and automatic renewal
|
|
201
|
+
- Resource usage tracking and alerting
|
|
202
|
+
- MCP server health checks and failover
|
|
203
|
+
|
|
204
|
+
## Performance Metrics
|
|
205
|
+
|
|
206
|
+
### Resource Optimization
|
|
207
|
+
- **Memory Usage**: 50-75% reduction vs monolithic approach
|
|
208
|
+
- **Startup Time**: 30% faster with selective MCP loading
|
|
209
|
+
- **Network Traffic**: 60% reduction with local MCP communication
|
|
210
|
+
- **CPU Efficiency**: 40% improvement with targeted tool loading
|
|
211
|
+
|
|
212
|
+
### Scalability Improvements
|
|
213
|
+
- **Concurrent Agents**: 10x increase in concurrent agent capacity
|
|
214
|
+
- **Resource Contention**: Eliminated through container isolation
|
|
215
|
+
- **WSL2 Stability**: 100% reduction in crash incidents
|
|
216
|
+
|
|
217
|
+
## Testing and Validation
|
|
218
|
+
|
|
219
|
+
### Unit Tests
|
|
220
|
+
- Skill-to-MCP mapping accuracy
|
|
221
|
+
- Token generation and validation
|
|
222
|
+
- Resource calculation precision
|
|
223
|
+
- Configuration generation correctness
|
|
224
|
+
|
|
225
|
+
### Integration Tests
|
|
226
|
+
- End-to-end container spawning with MCP access
|
|
227
|
+
- Multi-agent coordination with shared MCP servers
|
|
228
|
+
- Error handling and recovery scenarios
|
|
229
|
+
- Performance benchmarking vs standard approach
|
|
230
|
+
|
|
231
|
+
### Security Tests
|
|
232
|
+
- Token security and expiration handling
|
|
233
|
+
- Unauthorized access prevention
|
|
234
|
+
- Rate limiting effectiveness
|
|
235
|
+
- Audit logging completeness
|
|
236
|
+
|
|
237
|
+
## Best Practices
|
|
238
|
+
|
|
239
|
+
### Skill Definition
|
|
240
|
+
- Use specific, granular skills for precise MCP selection
|
|
241
|
+
- Document skill prerequisites and dependencies
|
|
242
|
+
- Regular skill review and cleanup for optimization
|
|
243
|
+
|
|
244
|
+
### Token Management
|
|
245
|
+
- Use appropriate token expiration times (24h default)
|
|
246
|
+
- Implement token rotation for long-running tasks
|
|
247
|
+
- Monitor token usage patterns for anomalies
|
|
248
|
+
|
|
249
|
+
### Resource Planning
|
|
250
|
+
- Plan memory limits based on worst-case MCP usage
|
|
251
|
+
- Include buffer capacity for spike loads
|
|
252
|
+
- Monitor resource utilization and adjust limits
|
|
253
|
+
|
|
254
|
+
## Troubleshooting
|
|
255
|
+
|
|
256
|
+
### Common Issues
|
|
257
|
+
1. **Token Authentication Failures**: Check Redis connectivity and token expiration
|
|
258
|
+
2. **MCP Server Connection Issues**: Verify Docker network configuration
|
|
259
|
+
3. **Resource Limits Exceeded**: Adjust memory/CPU limits or optimize MCP selection
|
|
260
|
+
4. **Skill Mapping Errors**: Validate skill definitions and MCP requirements
|
|
261
|
+
|
|
262
|
+
### Debug Commands
|
|
263
|
+
```bash
|
|
264
|
+
# Debug skill-to-MCP mapping
|
|
265
|
+
cfn-docker-skill-mcp-selector debug --agent-type frontend-engineer --verbose
|
|
266
|
+
|
|
267
|
+
# Validate token generation
|
|
268
|
+
cfn-docker-skill-mcp-selector validate-tokens --agent-id ${AGENT_ID}
|
|
269
|
+
|
|
270
|
+
# Check resource calculations
|
|
271
|
+
cfn-docker-skill-mcp-selector resources --agent-type backend-developer --detailed
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
## Future Enhancements
|
|
275
|
+
|
|
276
|
+
### Dynamic Skill Learning
|
|
277
|
+
- Machine learning-based skill optimization
|
|
278
|
+
- Automatic skill discovery from agent behavior
|
|
279
|
+
- Adaptive MCP selection based on task patterns
|
|
280
|
+
|
|
281
|
+
### Advanced Resource Management
|
|
282
|
+
- Predictive resource allocation
|
|
283
|
+
- Dynamic resource scaling based on load
|
|
284
|
+
- Cost optimization algorithms
|
|
285
|
+
|
|
286
|
+
### Multi-Cloud Support
|
|
287
|
+
- Cross-cloud MCP server deployment
|
|
288
|
+
- Geographic optimization for latency reduction
|
|
289
|
+
- Cloud-specific resource optimizations
|