claude-flow-novice 2.14.36 → 2.14.37

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.
@@ -1,221 +1,221 @@
1
- #!/bin/bash
2
- #
3
- # Invoke Waiting Mode - Agent Coordination for CFN Loop
4
- # Purpose: Handle coordination between agents using waiting mode and collection
5
- # Usage: invoke-waiting-mode.sh <collect|wait|signal> [task-id] [agent-id] [timeout]
6
- #
7
-
8
- set -euo pipefail
9
-
10
- SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
11
- REDIS_COORD_SKILL="$SCRIPT_DIR"
12
-
13
- # Parse arguments
14
- COMMAND=${1:-"collect"}
15
- TASK_ID=${2:-""}
16
- AGENT_ID=${3:-""}
17
- TIMEOUT=${4:-120}
18
-
19
- # Redis configuration
20
- REDIS_HOST=${REDIS_HOST:-"localhost"}
21
- REDIS_PORT=${REDIS_PORT:-6379}
22
- REDIS_DB=${REDIS_DB:-0}
23
-
24
- # Debug output
25
- DEBUG=${DEBUG:-false}
26
- if [[ "$DEBUG" == "true" ]]; then
27
- echo "DEBUG: invoke-waiting-mode called with: $*" >&2
28
- echo "DEBUG: REDIS_HOST=$REDIS_HOST, REDIS_PORT=$REDIS_PORT, REDIS_DB=$REDIS_DB" >&2
29
- fi
30
-
31
- # Function to connect to Redis with error handling
32
- redis_cmd() {
33
- local cmd="$1"
34
- shift
35
-
36
- if command -v redis-cli >/dev/null 2>&1; then
37
- redis-cli -h "$REDIS_HOST" -p "$REDIS_PORT" -n "$REDIS_DB" "$cmd" "$@" 2>/dev/null
38
- else
39
- echo "Warning: redis-cli not available, using mock mode" >&2
40
- return 0
41
- fi
42
- }
43
-
44
- # Function to collect agent signals
45
- collect_signals() {
46
- local task_id="$1"
47
- local agent_type="$2"
48
- local timeout="${3:-120}"
49
-
50
- echo "📡 Collecting ${agent_type} signals for task: $task_id (timeout: ${timeout}s)" >&2
51
-
52
- local signals_key="swarm:${task_id}:signals:${agent_type}"
53
- local start_time=$(date +%s)
54
- local signals_collected=()
55
-
56
- while true; do
57
- # Get all available signals
58
- local signals=($(redis_cmd SMEMBERS "$signals_key" 2>/dev/null || echo ""))
59
-
60
- if [[ ${#signals[@]} -gt 0 ]]; then
61
- for signal in "${signals[@]}"; do
62
- if [[ ! " ${signals_collected[@]} " =~ " ${signal} " ]]; then
63
- signals_collected+=("$signal")
64
- echo " ✓ Signal collected: $signal" >&2
65
-
66
- # Get detailed signal data
67
- local signal_key="swarm:${task_id}:agent:${signal}:data"
68
- local signal_data=$(redis_cmd HGETALL "$signal_key" 2>/dev/null || echo "")
69
-
70
- if [[ -n "$signal_data" ]]; then
71
- echo " Data: $signal_data" >&2
72
- fi
73
- fi
74
- done
75
- fi
76
-
77
- # Check if we have all expected signals (this would be based on agent count)
78
- local expected_signals=${EXPECTED_AGENTS:-1}
79
- if [[ ${#signals_collected[@]} -ge $expected_signals ]]; then
80
- echo "✅ All signals collected" >&2
81
- break
82
- fi
83
-
84
- # Check timeout
85
- local current_time=$(date +%s)
86
- if [[ $((current_time - start_time)) -ge $timeout ]]; then
87
- echo "⚠️ Timeout reached, proceeding with collected signals" >&2
88
- break
89
- fi
90
-
91
- sleep 2
92
- done
93
-
94
- # Return collected signals as JSON
95
- local json_output="{"
96
- json_output+="\"task_id\":\"$task_id\","
97
- json_output+="\"agent_type\":\"$agent_type\","
98
- json_output+="\"signals\":["
99
-
100
- for i in "${!signals_collected[@]}"; do
101
- if [[ $i -gt 0 ]]; then
102
- json_output+=","
103
- fi
104
- json_output+='"'"${signals_collected[$i]}"'"'
105
- done
106
-
107
- json_output+="],"
108
- json_output+="\"count\":${#signals_collected[@]},"
109
- json_output+="\"timeout\":$timeout"
110
- json_output+="}"
111
-
112
- echo "$json_output"
113
- }
114
-
115
- # Function to wait for specific condition
116
- wait_for_signal() {
117
- local task_id="$1"
118
- local condition="$2"
119
- local timeout="${3:-120}"
120
-
121
- echo "⏳ Waiting for signal: $condition (timeout: ${timeout}s)" >&2
122
-
123
- local start_time=$(date +%s)
124
- local condition_key="swarm:${task_id}:condition:${condition}"
125
-
126
- while true; do
127
- local condition_met=$(redis_cmd GET "$condition_key" 2>/dev/null || echo "")
128
-
129
- if [[ "$condition_met" == "true" ]]; then
130
- echo "✅ Condition met: $condition" >&2
131
- redis_cmd DEL "$condition_key" 2>/dev/null
132
- echo "true"
133
- return 0
134
- fi
135
-
136
- # Check timeout
137
- local current_time=$(date +%s)
138
- if [[ $((current_time - start_time)) -ge $timeout ]]; then
139
- echo "⚠️ Timeout waiting for: $condition" >&2
140
- echo "false"
141
- return 1
142
- fi
143
-
144
- sleep 2
145
- done
146
- }
147
-
148
- # Function to signal completion
149
- signal_completion() {
150
- local task_id="$1"
151
- local agent_id="$2"
152
- local status="${3:-complete}"
153
-
154
- echo "📤 Signaling completion: $agent_id -> $status" >&2
155
-
156
- # Add to completed set
157
- redis_cmd SADD "swarm:${task_id}:completed" "$agent_id" 2>/dev/null || true
158
-
159
- # Set completion status
160
- redis_cmd HSET "swarm:${task_id}:agent:${agent_id}:status" "status" "$status" 2>/dev/null || true
161
- redis_cmd HSET "swarm:${task_id}:agent:${agent_id}:status" "completed_at" "$(date +%s)" 2>/dev/null || true
162
-
163
- # Broadcast completion signal
164
- redis_cmd PUBLISH "swarm:${task_id}:signals" "agent:$agent_id:status:$status" 2>/dev/null || true
165
-
166
- echo "✅ Signal sent: $agent_id completed"
167
- }
168
-
169
- # Main command routing
170
- case "$COMMAND" in
171
- "collect")
172
- if [[ -z "$TASK_ID" ]]; then
173
- echo "Error: collect command requires task-id" >&2
174
- echo "Usage: $0 collect <task-id> <agent-type> [timeout]" >&2
175
- exit 1
176
- fi
177
- collect_signals "$TASK_ID" "${AGENT_ID:-"loop3"}" "$TIMEOUT"
178
- ;;
179
- "wait")
180
- if [[ -z "$TASK_ID" ]] || [[ -z "$AGENT_ID" ]]; then
181
- echo "Error: wait command requires task-id and condition" >&2
182
- echo "Usage: $0 wait <task-id> <condition> [timeout]" >&2
183
- exit 1
184
- fi
185
- wait_for_signal "$TASK_ID" "$AGENT_ID" "$TIMEOUT"
186
- ;;
187
- "signal")
188
- if [[ -z "$TASK_ID" ]] || [[ -z "$AGENT_ID" ]]; then
189
- echo "Error: signal command requires task-id and agent-id" >&2
190
- echo "Usage: $0 signal <task-id> <agent-id> [status]" >&2
191
- exit 1
192
- fi
193
- signal_completion "$TASK_ID" "$AGENT_ID" "$TIMEOUT"
194
- ;;
195
- "help"|"-h"|"--help")
196
- cat <<EOF
197
- Usage: $0 <command> [arguments]
198
-
199
- Commands:
200
- collect <task-id> <agent-type> [timeout] Collect signals from agents
201
- wait <task-id> <condition> [timeout] Wait for condition to be met
202
- signal <task-id> <agent-id> [status] Signal agent completion
203
-
204
- Examples:
205
- $0 collect cfn-cli-12345 loop3 300
206
- $0 wait cfn-cli-12345 gate-passed 60
207
- $0 signal cfn-cli-12345 backend-developer-1 complete
208
-
209
- Environment Variables:
210
- REDIS_HOST Redis host (default: localhost)
211
- REDIS_PORT Redis port (default: 6379)
212
- REDIS_DB Redis database (default: 0)
213
- DEBUG Enable debug output (true/false)
214
- EOF
215
- ;;
216
- *)
217
- echo "Error: Unknown command '$COMMAND'" >&2
218
- echo "Use '$0 help' for usage information" >&2
219
- exit 1
220
- ;;
1
+ #!/bin/bash
2
+ #
3
+ # Invoke Waiting Mode - Agent Coordination for CFN Loop
4
+ # Purpose: Handle coordination between agents using waiting mode and collection
5
+ # Usage: invoke-waiting-mode.sh <collect|wait|signal> [task-id] [agent-id] [timeout]
6
+ #
7
+
8
+ set -euo pipefail
9
+
10
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
11
+ REDIS_COORD_SKILL="$SCRIPT_DIR"
12
+
13
+ # Parse arguments
14
+ COMMAND=${1:-"collect"}
15
+ TASK_ID=${2:-""}
16
+ AGENT_ID=${3:-""}
17
+ TIMEOUT=${4:-120}
18
+
19
+ # Redis configuration
20
+ REDIS_HOST=${REDIS_HOST:-"localhost"}
21
+ REDIS_PORT=${REDIS_PORT:-6379}
22
+ REDIS_DB=${REDIS_DB:-0}
23
+
24
+ # Debug output
25
+ DEBUG=${DEBUG:-false}
26
+ if [[ "$DEBUG" == "true" ]]; then
27
+ echo "DEBUG: invoke-waiting-mode called with: $*" >&2
28
+ echo "DEBUG: REDIS_HOST=$REDIS_HOST, REDIS_PORT=$REDIS_PORT, REDIS_DB=$REDIS_DB" >&2
29
+ fi
30
+
31
+ # Function to connect to Redis with error handling
32
+ redis_cmd() {
33
+ local cmd="$1"
34
+ shift
35
+
36
+ if command -v redis-cli >/dev/null 2>&1; then
37
+ redis-cli -h "$REDIS_HOST" -p "$REDIS_PORT" -n "$REDIS_DB" "$cmd" "$@" 2>/dev/null
38
+ else
39
+ echo "Warning: redis-cli not available, using mock mode" >&2
40
+ return 0
41
+ fi
42
+ }
43
+
44
+ # Function to collect agent signals
45
+ collect_signals() {
46
+ local task_id="$1"
47
+ local agent_type="$2"
48
+ local timeout="${3:-120}"
49
+
50
+ echo "📡 Collecting ${agent_type} signals for task: $task_id (timeout: ${timeout}s)" >&2
51
+
52
+ local signals_key="swarm:${task_id}:signals:${agent_type}"
53
+ local start_time=$(date +%s)
54
+ local signals_collected=()
55
+
56
+ while true; do
57
+ # Get all available signals
58
+ local signals=($(redis_cmd SMEMBERS "$signals_key" 2>/dev/null || echo ""))
59
+
60
+ if [[ ${#signals[@]} -gt 0 ]]; then
61
+ for signal in "${signals[@]}"; do
62
+ if [[ ! " ${signals_collected[@]} " =~ " ${signal} " ]]; then
63
+ signals_collected+=("$signal")
64
+ echo " ✓ Signal collected: $signal" >&2
65
+
66
+ # Get detailed signal data
67
+ local signal_key="swarm:${task_id}:agent:${signal}:data"
68
+ local signal_data=$(redis_cmd HGETALL "$signal_key" 2>/dev/null || echo "")
69
+
70
+ if [[ -n "$signal_data" ]]; then
71
+ echo " Data: $signal_data" >&2
72
+ fi
73
+ fi
74
+ done
75
+ fi
76
+
77
+ # Check if we have all expected signals (this would be based on agent count)
78
+ local expected_signals=${EXPECTED_AGENTS:-1}
79
+ if [[ ${#signals_collected[@]} -ge $expected_signals ]]; then
80
+ echo "✅ All signals collected" >&2
81
+ break
82
+ fi
83
+
84
+ # Check timeout
85
+ local current_time=$(date +%s)
86
+ if [[ $((current_time - start_time)) -ge $timeout ]]; then
87
+ echo "⚠️ Timeout reached, proceeding with collected signals" >&2
88
+ break
89
+ fi
90
+
91
+ sleep 2
92
+ done
93
+
94
+ # Return collected signals as JSON
95
+ local json_output="{"
96
+ json_output+="\"task_id\":\"$task_id\","
97
+ json_output+="\"agent_type\":\"$agent_type\","
98
+ json_output+="\"signals\":["
99
+
100
+ for i in "${!signals_collected[@]}"; do
101
+ if [[ $i -gt 0 ]]; then
102
+ json_output+=","
103
+ fi
104
+ json_output+='"'"${signals_collected[$i]}"'"'
105
+ done
106
+
107
+ json_output+="],"
108
+ json_output+="\"count\":${#signals_collected[@]},"
109
+ json_output+="\"timeout\":$timeout"
110
+ json_output+="}"
111
+
112
+ echo "$json_output"
113
+ }
114
+
115
+ # Function to wait for specific condition
116
+ wait_for_signal() {
117
+ local task_id="$1"
118
+ local condition="$2"
119
+ local timeout="${3:-120}"
120
+
121
+ echo "⏳ Waiting for signal: $condition (timeout: ${timeout}s)" >&2
122
+
123
+ local start_time=$(date +%s)
124
+ local condition_key="swarm:${task_id}:condition:${condition}"
125
+
126
+ while true; do
127
+ local condition_met=$(redis_cmd GET "$condition_key" 2>/dev/null || echo "")
128
+
129
+ if [[ "$condition_met" == "true" ]]; then
130
+ echo "✅ Condition met: $condition" >&2
131
+ redis_cmd DEL "$condition_key" 2>/dev/null
132
+ echo "true"
133
+ return 0
134
+ fi
135
+
136
+ # Check timeout
137
+ local current_time=$(date +%s)
138
+ if [[ $((current_time - start_time)) -ge $timeout ]]; then
139
+ echo "⚠️ Timeout waiting for: $condition" >&2
140
+ echo "false"
141
+ return 1
142
+ fi
143
+
144
+ sleep 2
145
+ done
146
+ }
147
+
148
+ # Function to signal completion
149
+ signal_completion() {
150
+ local task_id="$1"
151
+ local agent_id="$2"
152
+ local status="${3:-complete}"
153
+
154
+ echo "📤 Signaling completion: $agent_id -> $status" >&2
155
+
156
+ # Add to completed set
157
+ redis_cmd SADD "swarm:${task_id}:completed" "$agent_id" 2>/dev/null || true
158
+
159
+ # Set completion status
160
+ redis_cmd HSET "swarm:${task_id}:agent:${agent_id}:status" "status" "$status" 2>/dev/null || true
161
+ redis_cmd HSET "swarm:${task_id}:agent:${agent_id}:status" "completed_at" "$(date +%s)" 2>/dev/null || true
162
+
163
+ # Broadcast completion signal
164
+ redis_cmd PUBLISH "swarm:${task_id}:signals" "agent:$agent_id:status:$status" 2>/dev/null || true
165
+
166
+ echo "✅ Signal sent: $agent_id completed"
167
+ }
168
+
169
+ # Main command routing
170
+ case "$COMMAND" in
171
+ "collect")
172
+ if [[ -z "$TASK_ID" ]]; then
173
+ echo "Error: collect command requires task-id" >&2
174
+ echo "Usage: $0 collect <task-id> <agent-type> [timeout]" >&2
175
+ exit 1
176
+ fi
177
+ collect_signals "$TASK_ID" "${AGENT_ID:-"loop3"}" "$TIMEOUT"
178
+ ;;
179
+ "wait")
180
+ if [[ -z "$TASK_ID" ]] || [[ -z "$AGENT_ID" ]]; then
181
+ echo "Error: wait command requires task-id and condition" >&2
182
+ echo "Usage: $0 wait <task-id> <condition> [timeout]" >&2
183
+ exit 1
184
+ fi
185
+ wait_for_signal "$TASK_ID" "$AGENT_ID" "$TIMEOUT"
186
+ ;;
187
+ "signal")
188
+ if [[ -z "$TASK_ID" ]] || [[ -z "$AGENT_ID" ]]; then
189
+ echo "Error: signal command requires task-id and agent-id" >&2
190
+ echo "Usage: $0 signal <task-id> <agent-id> [status]" >&2
191
+ exit 1
192
+ fi
193
+ signal_completion "$TASK_ID" "$AGENT_ID" "$TIMEOUT"
194
+ ;;
195
+ "help"|"-h"|"--help")
196
+ cat <<EOF
197
+ Usage: $0 <command> [arguments]
198
+
199
+ Commands:
200
+ collect <task-id> <agent-type> [timeout] Collect signals from agents
201
+ wait <task-id> <condition> [timeout] Wait for condition to be met
202
+ signal <task-id> <agent-id> [status] Signal agent completion
203
+
204
+ Examples:
205
+ $0 collect cfn-cli-12345 loop3 300
206
+ $0 wait cfn-cli-12345 gate-passed 60
207
+ $0 signal cfn-cli-12345 backend-developer-1 complete
208
+
209
+ Environment Variables:
210
+ REDIS_HOST Redis host (default: localhost)
211
+ REDIS_PORT Redis port (default: 6379)
212
+ REDIS_DB Redis database (default: 0)
213
+ DEBUG Enable debug output (true/false)
214
+ EOF
215
+ ;;
216
+ *)
217
+ echo "Error: Unknown command '$COMMAND'" >&2
218
+ echo "Use '$0 help' for usage information" >&2
219
+ exit 1
220
+ ;;
221
221
  esac
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: claude-code-expert
3
- description: MUST BE USED when answering questions about Claude Code features, documentation, and best practices. Use PROACTIVELY for Claude Code guidance, sub-agent creation, workflow questions. Keywords - claude-code, sub-agents, documentation, guides, best-practices, workflows
4
- tools: [WebFetch, Read, Grep, Glob]
3
+ description: MUST BE USED when answering questions about Claude Code features, documentation, and best practices or adding/removing MCPs. Use PROACTIVELY for Claude Code guidance, sub-agent creation, workflow questions. Keywords - claude-code, sub-agents, documentation, guides, best-practices, workflows, MCP
4
+ tools: [WebFetch, Read, Grep, Glob, Bash, Write]
5
5
  model: sonnet
6
6
  type: specialist
7
7
  capabilities:
@@ -80,6 +80,155 @@ You are a specialized agent with deep expertise in Claude Code, Anthropic's offi
80
80
  - "How do I use MCP tools in Claude Code?"
81
81
  - "How do I monitor agent execution?"
82
82
 
83
+ ## MCP Server Configuration
84
+
85
+ ### Configuration Files
86
+ MCP servers are configured in two locations:
87
+ 1. **Global config**: `~/.claude.json` (user-level, applies to all projects)
88
+ 2. **Project config**: `.claude/settings.json` (project-specific overrides)
89
+
90
+ ### Adding MCP Servers Globally
91
+
92
+ **Location**: `~/.claude.json`
93
+
94
+ Add to the `mcpServers` object:
95
+ ```json
96
+ {
97
+ "mcpServers": {
98
+ "server-name": {
99
+ "type": "stdio",
100
+ "command": "npx",
101
+ "args": ["-y", "@package/mcp-server"],
102
+ "env": {}
103
+ }
104
+ }
105
+ }
106
+ ```
107
+
108
+ **HTTP-based MCP servers**:
109
+ ```json
110
+ {
111
+ "mcpServers": {
112
+ "shadcn": {
113
+ "type": "http",
114
+ "url": "https://www.shadcn.io/api/mcp"
115
+ }
116
+ }
117
+ }
118
+ ```
119
+
120
+ ### Enabling/Disabling MCP Servers
121
+
122
+ **Enable globally** (add to `enabledMcpjsonServers` array):
123
+ ```json
124
+ {
125
+ "enabledMcpjsonServers": ["sequential-thinking", "n8n-mcp"]
126
+ }
127
+ ```
128
+
129
+ **Disable globally** (add to `disabledMcpjsonServers` array):
130
+ ```json
131
+ {
132
+ "disabledMcpjsonServers": ["playwright", "shadcn", "chrome-devtools"]
133
+ }
134
+ ```
135
+
136
+ **Disable for specific project** (in `~/.claude.json` under `projects` key):
137
+ ```json
138
+ {
139
+ "projects": {
140
+ "/path/to/project": {
141
+ "disabledMcpServers": ["claude-flow", "ruv-swarm", "playwright"]
142
+ }
143
+ }
144
+ }
145
+ ```
146
+
147
+ ### Project-Level MCP Configuration
148
+
149
+ **Location**: `.claude/settings.json` (in project root)
150
+
151
+ ```json
152
+ {
153
+ "mcpServers": {
154
+ "n8n-mcp": {
155
+ "command": "npx",
156
+ "args": ["-y", "n8n-mcp"],
157
+ "env": {
158
+ "N8N_API_KEY": "${N8N_API_KEY}"
159
+ }
160
+ }
161
+ },
162
+ "enabledMcpjsonServers": ["n8n-mcp"]
163
+ }
164
+ ```
165
+
166
+ ### Configuration Precedence
167
+ 1. Project-level `disabledMcpServers` overrides global settings
168
+ 2. Project-level `mcpServers` supplements global servers
169
+ 3. `enabledMcpjsonServers` must explicitly list servers to enable
170
+
171
+ ### Common MCP Servers
172
+
173
+ **Sequential Thinking** (multi-step reasoning):
174
+ ```json
175
+ {
176
+ "sequential-thinking": {
177
+ "type": "stdio",
178
+ "command": "npx",
179
+ "args": ["-y", "@modelcontextprotocol/server-sequential-thinking"],
180
+ "env": {}
181
+ }
182
+ }
183
+ ```
184
+
185
+ **Playwright** (browser automation):
186
+ ```json
187
+ {
188
+ "playwright": {
189
+ "type": "stdio",
190
+ "command": "npx",
191
+ "args": ["-y", "@playwright/mcp"],
192
+ "env": {}
193
+ }
194
+ }
195
+ ```
196
+
197
+ **Chrome DevTools** (browser debugging):
198
+ ```json
199
+ {
200
+ "chrome-devtools": {
201
+ "type": "stdio",
202
+ "command": "npx",
203
+ "args": ["-y", "chrome-devtools-mcp@latest"],
204
+ "env": {}
205
+ }
206
+ }
207
+ ```
208
+
209
+ **Z.ai MCP** (AI routing):
210
+ ```json
211
+ {
212
+ "zai-mcp-server": {
213
+ "type": "stdio",
214
+ "command": "npx",
215
+ "args": ["-y", "@z_ai/mcp-server"],
216
+ "env": {
217
+ "Z_AI_API_KEY": "${Z_AI_API_KEY}",
218
+ "Z_AI_MODE": "ZAI"
219
+ }
220
+ }
221
+ }
222
+ ```
223
+
224
+ ### Auto-Discovery
225
+ Claude Code auto-discovers MCP servers from:
226
+ - Globally installed npm packages with MCP exports
227
+ - Tool permissions (e.g., `mcp__package-name__tool`)
228
+ - `.mcp.json` files in project roots
229
+
230
+ To prevent auto-discovered servers from connecting, add them to `disabledMcpServers`.
231
+
83
232
  ## Documentation URLs to Reference
84
233
 
85
234
  Primary resources:
@@ -1,12 +1,17 @@
1
1
  ---
2
- description: "CFN Docker v3 Coordinator - Container-based agent orchestration with skill-based MCP isolation"
2
+ name: cfn-docker-v3-coordinator
3
+ description: "MUST BE USED when orchestrating container-based CFN Loop execution with skill-based MCP isolation and resource management"
3
4
  argument-hint: "[task-description] --mode=mvp|standard|enterprise --memory-limit=1g --docker-network=mcp-network"
4
- allowed-tools: ["Bash", "Read", "Write", "Edit", "Grep", "Glob", "TodoWrite", "Task"]
5
+ tools: [Bash, Read, Write, Edit, Grep, Glob, TodoWrite]
6
+ model: sonnet
7
+ type: coordinator
8
+ acl_level: 3
9
+ capabilities: [docker-orchestration, container-management, mcp-authentication, redis-coordination, skill-based-selection, resource-management, swarm-recovery, cost-optimization, security-isolation, monitoring]
5
10
  ---
6
11
 
7
12
  # CFN Docker V3 Coordinator
8
13
 
9
- **Purpose:** Orchestrate container-based CFN Loop execution with skill-based MCP isolation and resource management.
14
+ I am the cfn-docker-v3-coordinator, a specialized coordinator agent for container-based CFN Loop execution with skill-based MCP isolation and resource management.
10
15
 
11
16
  ## Architecture
12
17
 
@@ -176,6 +181,41 @@ CFN_DOCKER_MCP_TOKEN_EXPIRY=24h
176
181
  - Skill requirements: `config/skill-requirements.json`
177
182
  - MCP server definitions: `config/mcp-servers.json`
178
183
 
184
+ ## Core Responsibilities
185
+
186
+ 1. **Task Analysis and Context Extraction**: Parse task descriptions for deliverables and acceptance criteria, determine required agent types based on complexity, extract sprint/epic context for proper coordination
187
+
188
+ 2. **Agent Container Spawning**: Use `cfn-docker-agent-spawning` skill for container creation, apply memory limits and resource constraints, mount codebase and skills as read-only volumes, configure environment variables for agent identity
189
+
190
+ 3. **Skill-Based MCP Selection**: Use `cfn-docker-skill-mcp-selection` to map agent skills to MCP servers, generate authentication tokens for MCP access, configure MCP server connections for each container
191
+
192
+ 4. **Redis Coordination**: Use `cfn-docker-redis-coordination` for swarm communication, store context and agent state in Redis for swarm recovery, manage agent completion signaling and consensus collection
193
+
194
+ 5. **Loop Orchestration**: Use `cfn-docker-loop-orchestration` for CFN Loop execution, handle Loop 3 (implementer) → Loop 2 (validator) → Product Owner decision flow, manage iterations and adaptive agent specialization
195
+
196
+ 6. **Resource Management**: Monitor container resource usage (memory, CPU, network), enforce resource limits and constraints, optimize resource allocation for cost efficiency
197
+
198
+ 7. **Security and Compliance**: Enforce multi-layer security architecture, manage token-based authentication, implement rate limiting and audit logging, ensure container isolation and access control
199
+
200
+ ## Completion Protocol
201
+
202
+ 1. **Task Completion**: All containers terminated gracefully, Redis coordination state cleaned up, resource usage reported, cost savings documented
203
+
204
+ 2. **Error Handling**: Swarm recovery initiated via Redis state, failed containers restarted with clean state, fallback mechanisms activated when needed, manual intervention hooks triggered for critical issues
205
+
206
+ 3. **State Cleanup**: Docker containers removed, temporary volumes cleaned up, authentication tokens revoked, coordination keys expired in Redis
207
+
208
+ 4. **Reporting**: Generate comprehensive completion report with metrics, document container performance and resource usage, provide cost optimization recommendations, log security events and compliance status
209
+
210
+ ## Success Metrics
211
+
212
+ - **Container Success Rate**: ≥95% of containers complete tasks successfully (confidence threshold: 0.85)
213
+ - **Resource Efficiency**: Achieve 50%+ memory savings vs monolithic agent approach
214
+ - **Cost Optimization**: Maintain 95%+ cost savings vs Task-based spawning
215
+ - **Security Compliance**: 100% authentication token validation success
216
+ - **Recovery Capability**: ≤90 seconds for swarm recovery from container failure
217
+ - **MCP Connection Success**: ≥98% successful MCP server connections
218
+
179
219
  ## Implementation Status
180
220
 
181
221
  ✅ **Complete Implementation:**