claude-flow-novice 2.14.18 → 2.14.19
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/commands/CFN_EXPERT_UPDATE.md +142 -0
- package/.claude/commands/cfn-docker/CFN_DOCKER_CLI.md +527 -0
- package/.claude/commands/cfn-docker/CFN_DOCKER_LOOP.md +377 -0
- package/.claude/commands/cfn-docker/CFN_DOCKER_TASK.md +490 -0
- package/.claude/commands/cfn-loop-cli.md +220 -46
- package/.claude/commands/deprecated/README.md +55 -0
- package/claude-assets/agents/docker-coordinators/cfn-docker-v3-coordinator.md +199 -0
- package/claude-assets/commands/CFN_EXPERT_UPDATE.md +142 -0
- package/claude-assets/commands/cfn-docker/CFN_DOCKER_CLI.md +527 -0
- package/claude-assets/commands/cfn-docker/CFN_DOCKER_LOOP.md +377 -0
- package/claude-assets/commands/cfn-docker/CFN_DOCKER_TASK.md +490 -0
- package/claude-assets/commands/cfn-loop-cli.md +220 -46
- package/claude-assets/commands/deprecated/README.md +55 -0
- package/claude-assets/skills/cfn-docker-agent-spawning/SKILL.md +394 -0
- package/claude-assets/skills/cfn-docker-agent-spawning/spawn-agent.sh +461 -0
- package/claude-assets/skills/cfn-docker-loop-orchestration/SKILL.md +449 -0
- package/claude-assets/skills/cfn-docker-loop-orchestration/orchestrate.sh +787 -0
- package/claude-assets/skills/cfn-docker-redis-coordination/SKILL.md +435 -0
- package/claude-assets/skills/cfn-docker-redis-coordination/coordinate.sh +635 -0
- package/claude-assets/skills/cfn-docker-skill-mcp-selection/SKILL.md +289 -0
- package/claude-assets/skills/cfn-docker-skill-mcp-selection/skill-mcp-selector.js +472 -0
- package/claude-assets/skills/cfn-expert-update/update-expert.sh +346 -0
- package/dist/agents/agent-loader.js +165 -146
- package/dist/agents/agent-loader.js.map +1 -1
- package/package.json +1 -1
- /package/.claude/commands/{cfn-loop-epic.md → deprecated/cfn-loop-epic.md} +0 -0
- /package/.claude/commands/{cfn-loop-single.md → deprecated/cfn-loop-single.md} +0 -0
- /package/.claude/commands/{cfn-loop-sprints.md → deprecated/cfn-loop-sprints.md} +0 -0
- /package/.claude/commands/{cfn-loop.md → deprecated/cfn-loop.md} +0 -0
- /package/.claude/commands/{cfn/run-tests.md → run-tests.md} +0 -0
- /package/claude-assets/commands/{cfn-loop-epic.md → deprecated/cfn-loop-epic.md} +0 -0
- /package/claude-assets/commands/{cfn-loop-single.md → deprecated/cfn-loop-single.md} +0 -0
- /package/claude-assets/commands/{cfn-loop-sprints.md → deprecated/cfn-loop-sprints.md} +0 -0
- /package/claude-assets/commands/{cfn-loop.md → deprecated/cfn-loop.md} +0 -0
- /package/claude-assets/commands/{cfn/run-tests.md → run-tests.md} +0 -0
|
@@ -0,0 +1,394 @@
|
|
|
1
|
+
# CFN Docker Agent Spawning Skill
|
|
2
|
+
|
|
3
|
+
**Purpose:** Spawn agents in isolated Docker containers with skill-based MCP selection, resource management, and authentication.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
This skill manages the lifecycle of container-based agents, providing isolated execution environments with controlled resource usage, secure MCP access, and comprehensive monitoring capabilities.
|
|
8
|
+
|
|
9
|
+
## Architecture
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
Agent Spawning Request
|
|
13
|
+
↓
|
|
14
|
+
Container Configuration (memory, CPU, volumes)
|
|
15
|
+
↓
|
|
16
|
+
Docker Container Creation
|
|
17
|
+
↓
|
|
18
|
+
MCP Token Generation & Injection
|
|
19
|
+
↓
|
|
20
|
+
Agent Initialization (claude-flow-novice agent-spawn)
|
|
21
|
+
↓
|
|
22
|
+
Resource Monitoring & Management
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Core Functions
|
|
26
|
+
|
|
27
|
+
### 1. Container Configuration
|
|
28
|
+
Generate Docker container specifications based on agent type and requirements:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
# Configure container for frontend engineer
|
|
32
|
+
cfn-docker-agent-spawn configure \
|
|
33
|
+
--agent-type react-frontend-engineer \
|
|
34
|
+
--memory-limit 1g \
|
|
35
|
+
--cpu-limit 1.0 \
|
|
36
|
+
--network mcp-network
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### 2. Container Creation
|
|
40
|
+
Create and start Docker containers with proper isolation:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
# Spawn agent container
|
|
44
|
+
cfn-docker-agent-spawn create \
|
|
45
|
+
--agent-id agent-frontend-001 \
|
|
46
|
+
--agent-type react-frontend-engineer \
|
|
47
|
+
--task-id task-authentication \
|
|
48
|
+
--context "${TASK_CONTEXT}"
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### 3. MCP Integration
|
|
52
|
+
Configure secure MCP server access with authentication tokens:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
# Setup MCP access for container
|
|
56
|
+
cfn-docker-agent-spawn setup-mcp \
|
|
57
|
+
--container-id agent-frontend-001 \
|
|
58
|
+
--mcp-servers playwright \
|
|
59
|
+
--token-file /tmp/mcp-tokens.json
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### 4. Resource Management
|
|
63
|
+
Monitor and manage container resources:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
# Monitor container resources
|
|
67
|
+
cfn-docker-agent-spawn monitor \
|
|
68
|
+
--container-id agent-frontend-001 \
|
|
69
|
+
--alert-threshold 90%
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Container Specification
|
|
73
|
+
|
|
74
|
+
### Standard Configuration
|
|
75
|
+
```yaml
|
|
76
|
+
# Docker container specification
|
|
77
|
+
agent-container:
|
|
78
|
+
image: claude-flow-novice:agent
|
|
79
|
+
hostname: agent-{{AGENT_ID}}
|
|
80
|
+
networks:
|
|
81
|
+
- mcp-network
|
|
82
|
+
volumes:
|
|
83
|
+
- ./.claude:/app/.claude:ro
|
|
84
|
+
- ./src:/app/src:ro
|
|
85
|
+
- agent-workspace-{{AGENT_ID}}:/app/workspace
|
|
86
|
+
environment:
|
|
87
|
+
- AGENT_ID={{AGENT_ID}}
|
|
88
|
+
- AGENT_TYPE={{AGENT_TYPE}}
|
|
89
|
+
- TASK_ID={{TASK_ID}}
|
|
90
|
+
- REDIS_URL=redis://redis:6379
|
|
91
|
+
- MCP_TOKENS_FILE=/tmp/mcp-tokens.json
|
|
92
|
+
resources:
|
|
93
|
+
memory: {{MEMORY_LIMIT}}
|
|
94
|
+
cpu: {{CPU_LIMIT}}
|
|
95
|
+
restart_policy: unless-stopped
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Volume Mounts
|
|
99
|
+
- **Codebase**: Read-only mount for source code and skills
|
|
100
|
+
- **Agent Configuration**: Read-only mount for .claude directory
|
|
101
|
+
- **Workspace**: Writable mount for agent work output
|
|
102
|
+
- **Token Store**: Temporary file for MCP authentication tokens
|
|
103
|
+
|
|
104
|
+
### Environment Variables
|
|
105
|
+
- `AGENT_ID`: Unique container identifier
|
|
106
|
+
- `AGENT_TYPE`: Agent type for skill-based selection
|
|
107
|
+
- `TASK_ID`: CFN Loop task identifier
|
|
108
|
+
- `REDIS_URL`: Redis connection string
|
|
109
|
+
- `MCP_TOKENS_FILE`: Path to MCP authentication tokens
|
|
110
|
+
|
|
111
|
+
## Usage Patterns
|
|
112
|
+
|
|
113
|
+
### Basic Agent Spawning
|
|
114
|
+
```bash
|
|
115
|
+
# Spawn single agent
|
|
116
|
+
cfn-docker-agent-spawn \
|
|
117
|
+
--agent-type react-frontend-engineer \
|
|
118
|
+
--task-id "implement-ui" \
|
|
119
|
+
--memory-limit 1g
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### Batch Agent Spawning
|
|
123
|
+
```bash
|
|
124
|
+
# Spawn team of agents
|
|
125
|
+
cfn-docker-agent-spawn batch \
|
|
126
|
+
--team frontend \
|
|
127
|
+
--agents 3 \
|
|
128
|
+
--task-id "ui-development" \
|
|
129
|
+
--memory-limit 1g \
|
|
130
|
+
--network mcp-network
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### Custom Configuration
|
|
134
|
+
```bash
|
|
135
|
+
# Spawn with custom configuration
|
|
136
|
+
cfn-docker-agent-spawn \
|
|
137
|
+
--agent-type security-specialist \
|
|
138
|
+
--custom-config config/security-agent.json \
|
|
139
|
+
--environment "DEBUG=true,LOG_LEVEL=verbose" \
|
|
140
|
+
--volume /data/secrets:/app/secrets:ro
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
## Resource Management
|
|
144
|
+
|
|
145
|
+
### Memory Limits
|
|
146
|
+
| Agent Type | Default Limit | Maximum Recommended |
|
|
147
|
+
|------------|---------------|---------------------|
|
|
148
|
+
| **Frontend Engineer** | 1GB | 2GB |
|
|
149
|
+
| **Backend Developer** | 768MB | 1.5GB |
|
|
150
|
+
| **Security Specialist** | 1.5GB | 3GB |
|
|
151
|
+
| **DevOps Engineer** | 1GB | 2GB |
|
|
152
|
+
|
|
153
|
+
### CPU Limits
|
|
154
|
+
- **Standard Agents**: 0.5-1.0 CPU units
|
|
155
|
+
- **Resource-Intensive Agents**: 1.0-2.0 CPU units
|
|
156
|
+
- **Batch Operations**: 0.3-0.5 CPU units per agent
|
|
157
|
+
|
|
158
|
+
### Network Configuration
|
|
159
|
+
```bash
|
|
160
|
+
# Create isolated network for MCP communication
|
|
161
|
+
docker network create mcp-network --driver bridge
|
|
162
|
+
|
|
163
|
+
# Connect containers to MCP network
|
|
164
|
+
docker network connect mcp-network agent-frontend-001
|
|
165
|
+
docker network connect mcp-network playwright-mcp
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
## Integration with CFN Docker Skills
|
|
169
|
+
|
|
170
|
+
### Skill-Based MCP Selection
|
|
171
|
+
```bash
|
|
172
|
+
# Get MCP configuration for agent
|
|
173
|
+
MCP_CONFIG=$(cfn-docker-skill-mcp-selector select --agent-type ${AGENT_TYPE})
|
|
174
|
+
|
|
175
|
+
# Spawn with MCP configuration
|
|
176
|
+
cfn-docker-agent-spawn \
|
|
177
|
+
--agent-type ${AGENT_TYPE} \
|
|
178
|
+
--mcp-config "${MCP_CONFIG}" \
|
|
179
|
+
--auto-tokens
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### Redis Coordination
|
|
183
|
+
```bash
|
|
184
|
+
# Register agent in Redis
|
|
185
|
+
cfn-docker-redis-coordination register \
|
|
186
|
+
--agent-id ${AGENT_ID} \
|
|
187
|
+
--container-id ${CONTAINER_ID} \
|
|
188
|
+
--status "spawning"
|
|
189
|
+
|
|
190
|
+
# Update agent status
|
|
191
|
+
cfn-docker-redis-coordination update-status \
|
|
192
|
+
--agent-id ${AGENT_ID} \
|
|
193
|
+
--status "running"
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
### Loop Orchestration
|
|
197
|
+
```bash
|
|
198
|
+
# Spawn agents for Loop 3 implementation
|
|
199
|
+
cfn-docker-loop-orchestration spawn-loop3 \
|
|
200
|
+
--task-context "${TASK_CONTEXT}" \
|
|
201
|
+
--agent-count 3 \
|
|
202
|
+
--parallel
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
## Monitoring and Observability
|
|
206
|
+
|
|
207
|
+
### Resource Monitoring
|
|
208
|
+
```bash
|
|
209
|
+
# Real-time resource usage
|
|
210
|
+
cfn-docker-agent-spawn stats \
|
|
211
|
+
--agent-id agent-frontend-001 \
|
|
212
|
+
--format json
|
|
213
|
+
|
|
214
|
+
# Historical resource data
|
|
215
|
+
cfn-docker-agent-spawn history \
|
|
216
|
+
--agent-id agent-frontend-001 \
|
|
217
|
+
--duration 1h
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
### Health Checks
|
|
221
|
+
```bash
|
|
222
|
+
# Container health status
|
|
223
|
+
cfn-docker-agent-spawn health \
|
|
224
|
+
--agent-id agent-frontend-001
|
|
225
|
+
|
|
226
|
+
# MCP server connectivity
|
|
227
|
+
cfn-docker-agent-spawn check-mcp \
|
|
228
|
+
--agent-id agent-frontend-001 \
|
|
229
|
+
--servers playwright,redis
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
### Logging
|
|
233
|
+
```bash
|
|
234
|
+
# Container logs
|
|
235
|
+
cfn-docker-agent-spawn logs \
|
|
236
|
+
--agent-id agent-frontend-001 \
|
|
237
|
+
--tail 100
|
|
238
|
+
|
|
239
|
+
# Structured logs for monitoring
|
|
240
|
+
cfn-docker-agent-spawn logs \
|
|
241
|
+
--agent-id agent-frontend-001 \
|
|
242
|
+
--format json \
|
|
243
|
+
--output /var/log/agents/${AGENT_ID}.log
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
## Error Handling
|
|
247
|
+
|
|
248
|
+
### Container Failure Recovery
|
|
249
|
+
```bash
|
|
250
|
+
# Automatic restart on failure
|
|
251
|
+
cfn-docker-agent-spawn \
|
|
252
|
+
--agent-type ${AGENT_TYPE} \
|
|
253
|
+
--restart-policy on-failure \
|
|
254
|
+
--restart-count 3
|
|
255
|
+
|
|
256
|
+
# Manual recovery
|
|
257
|
+
cfn-docker-agent-spawn recover \
|
|
258
|
+
--agent-id agent-frontend-001 \
|
|
259
|
+
--backup-state
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
### Resource Exhaustion Handling
|
|
263
|
+
```bash
|
|
264
|
+
# Memory pressure handling
|
|
265
|
+
cfn-docker-agent-spawn \
|
|
266
|
+
--memory-limit 1g \
|
|
267
|
+
--memory-swap 1.5g \
|
|
268
|
+
--oom-kill-disable
|
|
269
|
+
|
|
270
|
+
# CPU throttling
|
|
271
|
+
cfn-docker-agent-spawn \
|
|
272
|
+
--cpu-limit 1.0 \
|
|
273
|
+
--cpu-shares 1024
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
### Network Isolation Issues
|
|
277
|
+
```bash
|
|
278
|
+
# Network connectivity validation
|
|
279
|
+
cfn-docker-agent-spawn validate-network \
|
|
280
|
+
--agent-id agent-frontend-001 \
|
|
281
|
+
--targets redis:6379,playwright-mcp:3000
|
|
282
|
+
|
|
283
|
+
# Network repair
|
|
284
|
+
cfn-docker-agent-spawn repair-network \
|
|
285
|
+
--agent-id agent-frontend-001 \
|
|
286
|
+
--recreate-network
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
## Performance Optimization
|
|
290
|
+
|
|
291
|
+
### Startup Optimization
|
|
292
|
+
- **Pre-warmed Images**: Use Docker image layer caching
|
|
293
|
+
- **Parallel Startup**: Spawn multiple containers concurrently
|
|
294
|
+
- **Lazy Loading**: Load MCP servers on-demand
|
|
295
|
+
- **Resource Pre-allocation**: Reserve resources in advance
|
|
296
|
+
|
|
297
|
+
### Memory Optimization
|
|
298
|
+
- **Selective MCP Loading**: Only load required MCP servers
|
|
299
|
+
- **Workspace Cleanup**: Clean temporary files automatically
|
|
300
|
+
- **Garbage Collection**: Optimize Node.js memory management
|
|
301
|
+
- **Shared Libraries**: Use shared mounts for common dependencies
|
|
302
|
+
|
|
303
|
+
### Network Optimization
|
|
304
|
+
- **Local Network**: Use Docker bridge networks for MCP communication
|
|
305
|
+
- **Connection Pooling**: Reuse MCP server connections
|
|
306
|
+
- **DNS Caching**: Cache MCP server DNS resolution
|
|
307
|
+
- **Compression**: Compress large data transfers
|
|
308
|
+
|
|
309
|
+
## Security Considerations
|
|
310
|
+
|
|
311
|
+
### Container Isolation
|
|
312
|
+
- **Read-only Codebase**: Prevent code modification
|
|
313
|
+
- **Limited Privileges**: Run as non-root user
|
|
314
|
+
- **Resource Limits**: Prevent DoS attacks
|
|
315
|
+
- **Network Segmentation**: Isolate agent networks
|
|
316
|
+
|
|
317
|
+
### Token Security
|
|
318
|
+
- **Secure Token Storage**: Use tmpfs for token files
|
|
319
|
+
- **Token Expiration**: Automatic token rotation
|
|
320
|
+
- **Access Logging**: Log all token usage
|
|
321
|
+
- **Revocation**: Immediate token invalidation
|
|
322
|
+
|
|
323
|
+
### File System Security
|
|
324
|
+
- **Restricted Access**: Limit file system access
|
|
325
|
+
- **Workspace Isolation**: Isolate agent workspaces
|
|
326
|
+
- **Temporary Files**: Secure cleanup of temporary files
|
|
327
|
+
- **Audit Logging**: Log all file system operations
|
|
328
|
+
|
|
329
|
+
## Testing and Validation
|
|
330
|
+
|
|
331
|
+
### Unit Tests
|
|
332
|
+
- Container creation and configuration
|
|
333
|
+
- Resource limit enforcement
|
|
334
|
+
- Network connectivity validation
|
|
335
|
+
- Token injection and validation
|
|
336
|
+
|
|
337
|
+
### Integration Tests
|
|
338
|
+
- End-to-end agent spawning workflow
|
|
339
|
+
- MCP server connectivity and authentication
|
|
340
|
+
- Resource monitoring and alerting
|
|
341
|
+
- Error handling and recovery
|
|
342
|
+
|
|
343
|
+
### Performance Tests
|
|
344
|
+
- Container startup time measurement
|
|
345
|
+
- Resource usage benchmarking
|
|
346
|
+
- Concurrent spawning scalability
|
|
347
|
+
- Network performance validation
|
|
348
|
+
|
|
349
|
+
## Troubleshooting
|
|
350
|
+
|
|
351
|
+
### Common Issues
|
|
352
|
+
1. **Container Won't Start**: Check image availability and resource limits
|
|
353
|
+
2. **MCP Connection Failed**: Verify network configuration and token validity
|
|
354
|
+
3. **Memory Issues**: Monitor usage and adjust limits
|
|
355
|
+
4. **Permission Errors**: Check volume mounts and user permissions
|
|
356
|
+
|
|
357
|
+
### Debug Commands
|
|
358
|
+
```bash
|
|
359
|
+
# Debug container creation
|
|
360
|
+
cfn-docker-agent-spawn debug \
|
|
361
|
+
--agent-type ${AGENT_TYPE} \
|
|
362
|
+
--verbose \
|
|
363
|
+
--dry-run
|
|
364
|
+
|
|
365
|
+
# Inspect container configuration
|
|
366
|
+
cfn-docker-agent-spawn inspect \
|
|
367
|
+
--container-id ${CONTAINER_ID} \
|
|
368
|
+
--format json
|
|
369
|
+
|
|
370
|
+
# Validate MCP connectivity
|
|
371
|
+
cfn-docker-agent-spawn test-mcp \
|
|
372
|
+
--container-id ${CONTAINER_ID} \
|
|
373
|
+
--all-servers
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
## Best Practices
|
|
377
|
+
|
|
378
|
+
### Resource Planning
|
|
379
|
+
- **Conservative Limits**: Start with lower memory limits and increase as needed
|
|
380
|
+
- **Monitoring**: Implement comprehensive resource monitoring
|
|
381
|
+
- **Capacity Planning**: Plan for peak usage scenarios
|
|
382
|
+
- **Resource Cleanup**: Clean up unused containers and volumes
|
|
383
|
+
|
|
384
|
+
### Security Hardening
|
|
385
|
+
- **Minimal Images**: Use minimal Docker images
|
|
386
|
+
- **Regular Updates**: Keep base images updated
|
|
387
|
+
- **Scanning**: Regularly scan images for vulnerabilities
|
|
388
|
+
- **Access Control**: Implement proper access controls
|
|
389
|
+
|
|
390
|
+
### Operational Excellence
|
|
391
|
+
- **Automation**: Automate container lifecycle management
|
|
392
|
+
- **Observability**: Implement comprehensive monitoring
|
|
393
|
+
- **Documentation**: Maintain detailed configuration documentation
|
|
394
|
+
- **Backup**: Backup critical container configurations
|