claude-flow-novice 2.14.11 → 2.14.12
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_LOOP_TASK_MODE.md +7 -51
- package/.claude/commands/cfn-loop-cli.md +1 -1
- package/.claude/skills/cfn-agent-selector/SKILL.md +2 -2
- package/.claude/skills/cfn-loop-orchestration/orchestrate.sh +5 -72
- package/.claude/skills/cfn-redis-coordination/get-context.sh +113 -0
- package/.claude/skills/cfn-redis-coordination/store-context.sh +74 -19
- package/claude-assets/agents/cfn-dev-team/CLAUDE.md +3 -3
- package/claude-assets/agents/cfn-dev-team/README.md +1 -1
- package/claude-assets/agents/cfn-dev-team/coordinators/cfn-v3-coordinator.md +2 -2
- package/claude-assets/agents/cfn-dev-team/developers/README.md +3 -3
- package/claude-assets/agents/cfn-dev-team/documentation/agent-type-guidelines.md +1 -1
- package/claude-assets/agents/cfn-dev-team/test-agent.md +2 -2
- package/claude-assets/commands/CFN_LOOP_TASK_MODE.md +7 -51
- package/claude-assets/commands/cfn-loop-cli.md +1 -1
- package/claude-assets/skills/cfn-agent-selector/SKILL.md +2 -2
- package/claude-assets/skills/cfn-loop-orchestration/orchestrate.sh +5 -72
- package/claude-assets/skills/cfn-redis-coordination/get-context.sh +113 -0
- package/claude-assets/skills/cfn-redis-coordination/store-context.sh +74 -19
- package/dist/cli/config-manager.js +91 -109
- package/dist/cli/config-manager.js.map +1 -1
- package/package.json +1 -1
- package/scripts/init-project.js +21 -3
- package/.claude/skills/cfn-agent-selector/SKILL.md.backup_before_replace +0 -91
- package/claude-assets/agents/cfn-dev-team/CLAUDE.md.backup_before_replace +0 -1086
- package/claude-assets/agents/cfn-dev-team/README.md.backup_before_replace +0 -116
- package/claude-assets/agents/cfn-dev-team/coordinators/cfn-v3-coordinator.md.backup_before_replace +0 -451
- package/claude-assets/agents/cfn-dev-team/developers/README.md.backup_before_replace +0 -69
- package/claude-assets/agents/cfn-dev-team/documentation/agent-type-guidelines.md.backup_before_replace +0 -465
- package/claude-assets/agents/cfn-dev-team/test-agent.md.backup_before_replace +0 -141
- package/claude-assets/skills/cfn-agent-selector/SKILL.md.backup_before_replace +0 -91
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
|
|
7
7
|
## Overview
|
|
8
8
|
|
|
9
|
-
Task Mode: Main Chat
|
|
9
|
+
Task Mode: Main Chat spawns coordinator and agents via Task() tool with full context injection and visibility.
|
|
10
10
|
|
|
11
11
|
| Aspect | Task Mode | CLI Mode |
|
|
12
12
|
|--------|-----------|----------|
|
|
13
|
-
| **Spawning** | Main Chat
|
|
13
|
+
| **Spawning** | Main Chat via Task() | Coordinator via npx CLI |
|
|
14
14
|
| **Visibility** | Full transparency in Main Chat | Background, Redis logs |
|
|
15
15
|
| **Provider** | All Anthropic | CLI uses Z.ai routing |
|
|
16
16
|
| **Cost** | ~$0.150/iteration | ~$0.054/iteration (64% savings) |
|
|
@@ -35,50 +35,6 @@ Task Mode: Main Chat acts as coordinator and spawns agents directly via Task() t
|
|
|
35
35
|
|
|
36
36
|
---
|
|
37
37
|
|
|
38
|
-
## Task Mode Execution Pattern
|
|
39
|
-
|
|
40
|
-
**Key Principle: Main Chat IS the coordinator**
|
|
41
|
-
|
|
42
|
-
In Task Mode, Main Chat directly spawns all agents via Task() tool. No coordinator agent is used.
|
|
43
|
-
|
|
44
|
-
### Example: Zone A React Router Migration
|
|
45
|
-
|
|
46
|
-
```javascript
|
|
47
|
-
// ✅ CORRECT - Main Chat spawns agents directly
|
|
48
|
-
Task("backend-developer", `
|
|
49
|
-
Migrate React Router from v4 to v6 in Zone A components
|
|
50
|
-
Deliverables: Updated Routes, component fixes, tests
|
|
51
|
-
Directory: frontend/src/zone-a/
|
|
52
|
-
`);
|
|
53
|
-
|
|
54
|
-
Task("react-frontend-engineer", `
|
|
55
|
-
Review and fix any component issues after router migration
|
|
56
|
-
Focus on route parameters, navigation, and component integration
|
|
57
|
-
`);
|
|
58
|
-
|
|
59
|
-
Task("tester", `
|
|
60
|
-
Test React Router v6 migration in Zone A
|
|
61
|
-
Verify all routes work, navigation functions, no regressions
|
|
62
|
-
`);
|
|
63
|
-
|
|
64
|
-
// Later: Process outputs, collect confidence, decide next iteration
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
### What NOT to Do in Task Mode
|
|
68
|
-
|
|
69
|
-
```javascript
|
|
70
|
-
// ❌ INCORRECT - Don't spawn coordinator agent
|
|
71
|
-
Task("cfn-v3-coordinator", "Coordinate React Router migration");
|
|
72
|
-
|
|
73
|
-
// ❌ INCORRECT - Don't use CLI commands in Task Mode
|
|
74
|
-
Bash("npx claude-flow-novice swarm 'task description'");
|
|
75
|
-
|
|
76
|
-
// ❌ INCORRECT - Don't nest CFN Loop calls
|
|
77
|
-
Task("reviewer", "/cfn-loop 'review this code'"); // Causes infinite loops
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
---
|
|
81
|
-
|
|
82
38
|
## Agent Specialization
|
|
83
39
|
|
|
84
40
|
### Loop 3 (Implementation)
|
|
@@ -132,15 +88,15 @@ return validators.slice(0, 6); // Max 6
|
|
|
132
88
|
## Sprint Completion Workflow
|
|
133
89
|
|
|
134
90
|
**Key Difference in Task Mode:**
|
|
135
|
-
- Product Owner spawned via `Task()` by
|
|
91
|
+
- Product Owner spawned via `Task()` by coordinator (NOT via `execute-decision.sh`)
|
|
136
92
|
- Use helper scripts for parsing/validation: `parse-decision.sh`, `validate-deliverables.sh`
|
|
137
93
|
- CLI Mode uses `execute-decision.sh` which handles spawning + all logic
|
|
138
94
|
|
|
139
95
|
### 1. Consensus Validation
|
|
140
96
|
|
|
141
|
-
**Task Mode** -
|
|
97
|
+
**Task Mode** - Coordinator spawns Product Owner via Task():
|
|
142
98
|
```javascript
|
|
143
|
-
//
|
|
99
|
+
// Coordinator builds context and spawns PO
|
|
144
100
|
const poContext = `
|
|
145
101
|
CFN Loop iteration ${iteration} complete.
|
|
146
102
|
Loop 2 Consensus: ${consensus} (threshold: ${threshold})
|
|
@@ -208,7 +164,7 @@ EOF
|
|
|
208
164
|
### 5. Execute Product Owner Suggested Next Steps
|
|
209
165
|
|
|
210
166
|
**After PROCEED Decision:**
|
|
211
|
-
Product Owner may suggest follow-up tasks (documentation, testing, refactoring).
|
|
167
|
+
Product Owner may suggest follow-up tasks (documentation, testing, refactoring). Coordinator (main chat) must proceed by spawning specialized agents to execute these tasks:
|
|
212
168
|
|
|
213
169
|
```javascript
|
|
214
170
|
// Parse PO feedback for suggested next steps
|
|
@@ -349,7 +305,7 @@ threshold = Math.min(threshold, 0.98); // Cap at 0.98
|
|
|
349
305
|
## Background Backlog Worker
|
|
350
306
|
|
|
351
307
|
### Architecture
|
|
352
|
-
- **Main Chat
|
|
308
|
+
- **Main Chat**: Spawns Task() agents for Sprint N (foreground)
|
|
353
309
|
- **Background CLI**: Processes P3 backlog items (detached process)
|
|
354
310
|
|
|
355
311
|
### Launch Background Worker
|
|
@@ -149,7 +149,7 @@ Task("cfn-v3-coordinator", `
|
|
|
149
149
|
|
|
150
150
|
1. INVOKE ORCHESTRATOR (CLI spawning):
|
|
151
151
|
|
|
152
|
-
TASK_ID="cfn-cli-$(date +%s
|
|
152
|
+
TASK_ID="cfn-cli-$(date +%s)"
|
|
153
153
|
MODE="${mode}"
|
|
154
154
|
LOOP3_AGENTS="backend-dev,researcher,devops" # Customize for task
|
|
155
155
|
LOOP2_AGENTS="reviewer,tester,architect,security-specialist" # Scale by complexity
|
|
@@ -17,7 +17,7 @@ AGENTS=$(./.claude/skills/cfn-agent-selector/select-agents.sh \
|
|
|
17
17
|
--task-type "software-development" \
|
|
18
18
|
--description "Implement JWT authentication with refresh tokens")
|
|
19
19
|
|
|
20
|
-
echo "$AGENTS" | jq '.loop3[]' # ["backend-
|
|
20
|
+
echo "$AGENTS" | jq '.loop3[]' # ["backend-dev", "security-specialist"]
|
|
21
21
|
echo "$AGENTS" | jq '.loop2[]' # ["reviewer", "tester", "security-auditor"]
|
|
22
22
|
```
|
|
23
23
|
|
|
@@ -35,7 +35,7 @@ echo "$AGENTS" | jq '.loop2[]' # ["reviewer", "tester", "security-auditor"]
|
|
|
35
35
|
## Agent Selection Rules
|
|
36
36
|
|
|
37
37
|
### Software Development
|
|
38
|
-
**Base Loop 3:** backend-
|
|
38
|
+
**Base Loop 3:** backend-dev, coder
|
|
39
39
|
**Add if keywords:**
|
|
40
40
|
- "security", "authentication", "JWT" → security-specialist
|
|
41
41
|
- "database", "SQL", "schema" → database-engineer (if exists)
|
|
@@ -66,19 +66,6 @@ LOOP3_FINAL_CONFIDENCE=0.0
|
|
|
66
66
|
LOOP2_FINAL_CONSENSUS=0.0
|
|
67
67
|
DELIVERABLES_VERIFIED=false
|
|
68
68
|
|
|
69
|
-
# Cleanup Redis keys before exit
|
|
70
|
-
cleanup_redis_keys() {
|
|
71
|
-
if [ -n "$TASK_ID" ]; then
|
|
72
|
-
echo "🧹 Cleaning up Redis keys for task $TASK_ID"
|
|
73
|
-
# Set TTL on remaining task keys (1 hour)
|
|
74
|
-
redis-cli keys "swarm:${TASK_ID}:*" 2>/dev/null | xargs -I {} redis-cli expire {} 3600 2>/dev/null || true
|
|
75
|
-
redis-cli keys "cfn_loop:task:${TASK_ID}:*" 2>/dev/null | xargs -I {} redis-cli expire {} 3600 2>/dev/null || true
|
|
76
|
-
fi
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
# Trap cleanup on script exit
|
|
80
|
-
trap cleanup_redis_keys EXIT
|
|
81
|
-
|
|
82
69
|
##############################################################################
|
|
83
70
|
# Argument Parsing
|
|
84
71
|
##############################################################################
|
|
@@ -707,17 +694,6 @@ EOF
|
|
|
707
694
|
# Main CFN Loop
|
|
708
695
|
##############################################################################
|
|
709
696
|
|
|
710
|
-
# Validate CLI environment before spawning agents
|
|
711
|
-
echo "🔧 Validating CLI environment..."
|
|
712
|
-
if [ -f "$PROJECT_ROOT/.claude/skills/cfn-cli-setup/validate-cli-environment.sh" ]; then
|
|
713
|
-
if ! bash "$PROJECT_ROOT/.claude/skills/cfn-cli-setup/validate-cli-environment.sh"; then
|
|
714
|
-
echo "❌ CLI environment validation failed. Agents may not have required tools."
|
|
715
|
-
echo "⚠️ Continuing anyway, but expect potential tool failures..."
|
|
716
|
-
fi
|
|
717
|
-
else
|
|
718
|
-
echo "⚠️ CLI environment validation script not found. Skipping validation."
|
|
719
|
-
fi
|
|
720
|
-
|
|
721
697
|
# Store context in Redis
|
|
722
698
|
store_context "$TASK_ID"
|
|
723
699
|
|
|
@@ -775,41 +751,11 @@ for ((ITERATION=1; ITERATION<=MAX_ITERATIONS; ITERATION++)); do
|
|
|
775
751
|
--agents "$LOOP3_IDS" \
|
|
776
752
|
--threshold "$GATE" \
|
|
777
753
|
--min-quorum "$MIN_QUORUM_LOOP3"; then
|
|
778
|
-
# Gate passed -
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
VALIDATED_CONFIDENCE=0
|
|
784
|
-
|
|
785
|
-
for agent_id in ${LOOP3_IDS//,/ }; do
|
|
786
|
-
# Get agent's reported confidence
|
|
787
|
-
agent_confidence=$(redis-cli get "swarm:${TASK_ID}:${agent_id}:confidence" 2>/dev/null || echo "0.5")
|
|
788
|
-
|
|
789
|
-
# Calculate deliverable-based confidence
|
|
790
|
-
deliverable_confidence=$("$PROJECT_ROOT/.claude/skills/cfn-deliverable-validation/confidence-calculator.sh" \
|
|
791
|
-
"$TASK_ID" "$agent_id" "$EXPECTED_FILES" "$PROJECT_ROOT")
|
|
792
|
-
|
|
793
|
-
echo " Agent $agent_id: reported=$agent_confidence, deliverable-based=$deliverable_confidence"
|
|
794
|
-
|
|
795
|
-
# Use the lower of the two scores (inflation prevention)
|
|
796
|
-
if (( $(echo "$deliverable_confidence < $agent_confidence" | bc -l) )); then
|
|
797
|
-
echo " ⚠️ Downgrading confidence for $agent_id (inflated score detected)"
|
|
798
|
-
VALIDATED_CONFIDENCE=$deliverable_confidence
|
|
799
|
-
else
|
|
800
|
-
VALIDATED_CONFIDENCE=$agent_confidence
|
|
801
|
-
fi
|
|
802
|
-
done
|
|
803
|
-
|
|
804
|
-
LOOP3_FINAL_CONFIDENCE=$VALIDATED_CONFIDENCE
|
|
805
|
-
echo "✅ Final validated Loop 3 confidence: $LOOP3_FINAL_CONFIDENCE"
|
|
806
|
-
else
|
|
807
|
-
# Store confidence (fallback method)
|
|
808
|
-
LOOP3_FINAL_CONFIDENCE=$("$REDIS_COORD_SKILL/invoke-waiting-mode.sh" collect \
|
|
809
|
-
--task-id "$TASK_ID" \
|
|
810
|
-
--agent-ids "$LOOP3_IDS" \
|
|
811
|
-
--min-quorum "$MIN_QUORUM_LOOP3")
|
|
812
|
-
fi
|
|
754
|
+
# Gate passed - store confidence
|
|
755
|
+
LOOP3_FINAL_CONFIDENCE=$("$REDIS_COORD_SKILL/invoke-waiting-mode.sh" collect \
|
|
756
|
+
--task-id "$TASK_ID" \
|
|
757
|
+
--agent-ids "$LOOP3_IDS" \
|
|
758
|
+
--min-quorum "$MIN_QUORUM_LOOP3")
|
|
813
759
|
else
|
|
814
760
|
# Gate failed - iterate Loop 3
|
|
815
761
|
echo "❌ Gate check failed - iterating Loop 3"
|
|
@@ -932,19 +878,6 @@ EOF
|
|
|
932
878
|
esac
|
|
933
879
|
done
|
|
934
880
|
|
|
935
|
-
# Cleanup Redis keys before exit
|
|
936
|
-
cleanup_redis_keys() {
|
|
937
|
-
if [ -n "$TASK_ID" ]; then
|
|
938
|
-
echo "🧹 Cleaning up Redis keys for task $TASK_ID"
|
|
939
|
-
# Set TTL on remaining task keys (1 hour)
|
|
940
|
-
redis-cli keys "swarm:${TASK_ID}:*" 2>/dev/null | xargs -I {} redis-cli expire {} 3600 2>/dev/null || true
|
|
941
|
-
redis-cli keys "cfn_loop:task:${TASK_ID}:*" 2>/dev/null | xargs -I {} redis-cli expire {} 3600 2>/dev/null || true
|
|
942
|
-
fi
|
|
943
|
-
}
|
|
944
|
-
|
|
945
|
-
# Trap cleanup on script exit
|
|
946
|
-
trap cleanup_redis_keys EXIT
|
|
947
|
-
|
|
948
881
|
# Max iterations reached without success
|
|
949
882
|
echo "❌ Max iterations ($MAX_ITERATIONS) reached without PROCEED decision"
|
|
950
883
|
output_result "failed"
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Retrieve CFN Loop task context from Redis
|
|
3
|
+
# Used by CLI-spawned agents to get structured context from orchestrator
|
|
4
|
+
#
|
|
5
|
+
# Usage:
|
|
6
|
+
# get-context.sh --task-id <id> [--namespace <ns>]
|
|
7
|
+
# get-context.sh --task-id <id> --key <key> [--namespace <ns>]
|
|
8
|
+
# get-context.sh <task_id> (legacy mode)
|
|
9
|
+
|
|
10
|
+
set -euo pipefail
|
|
11
|
+
|
|
12
|
+
# Initialize variables
|
|
13
|
+
TASK_ID=""
|
|
14
|
+
KEY=""
|
|
15
|
+
NAMESPACE="swarm"
|
|
16
|
+
FORMAT="json" # json or raw
|
|
17
|
+
|
|
18
|
+
# Parse arguments
|
|
19
|
+
while [[ $# -gt 0 ]]; do
|
|
20
|
+
case $1 in
|
|
21
|
+
--task-id)
|
|
22
|
+
TASK_ID="$2"
|
|
23
|
+
shift 2
|
|
24
|
+
;;
|
|
25
|
+
--key)
|
|
26
|
+
KEY="$2"
|
|
27
|
+
shift 2
|
|
28
|
+
;;
|
|
29
|
+
--namespace)
|
|
30
|
+
NAMESPACE="$2"
|
|
31
|
+
shift 2
|
|
32
|
+
;;
|
|
33
|
+
--format)
|
|
34
|
+
FORMAT="$2"
|
|
35
|
+
shift 2
|
|
36
|
+
;;
|
|
37
|
+
*)
|
|
38
|
+
# Legacy mode: positional argument
|
|
39
|
+
if [ -z "$TASK_ID" ]; then
|
|
40
|
+
TASK_ID="$1"
|
|
41
|
+
fi
|
|
42
|
+
shift
|
|
43
|
+
;;
|
|
44
|
+
esac
|
|
45
|
+
done
|
|
46
|
+
|
|
47
|
+
# Validate required arguments
|
|
48
|
+
if [ -z "$TASK_ID" ]; then
|
|
49
|
+
echo "Error: --task-id or TASK_ID required" >&2
|
|
50
|
+
echo "Usage: $0 --task-id <id> [--key <key>] [--namespace <ns>] [--format <json|raw>]" >&2
|
|
51
|
+
echo " or: $0 <task_id> (legacy)" >&2
|
|
52
|
+
exit 1
|
|
53
|
+
fi
|
|
54
|
+
|
|
55
|
+
REDIS_KEY="${NAMESPACE}:${TASK_ID}:context"
|
|
56
|
+
|
|
57
|
+
# Check if context exists
|
|
58
|
+
if ! redis-cli EXISTS "$REDIS_KEY" >/dev/null 2>&1; then
|
|
59
|
+
echo "⚠️ No context found for task: $TASK_ID" >&2
|
|
60
|
+
exit 1
|
|
61
|
+
fi
|
|
62
|
+
|
|
63
|
+
# Handle specific key retrieval
|
|
64
|
+
if [ -n "$KEY" ]; then
|
|
65
|
+
VALUE=$(redis-cli HGET "$REDIS_KEY" "$KEY" 2>/dev/null || echo "")
|
|
66
|
+
if [ -z "$VALUE" ]; then
|
|
67
|
+
echo "⚠️ Key '$KEY' not found in context for task: $TASK_ID" >&2
|
|
68
|
+
exit 1
|
|
69
|
+
fi
|
|
70
|
+
|
|
71
|
+
if [ "$FORMAT" = "raw" ]; then
|
|
72
|
+
echo "$VALUE"
|
|
73
|
+
else
|
|
74
|
+
echo "{\"$KEY\":$VALUE}"
|
|
75
|
+
fi
|
|
76
|
+
exit 0
|
|
77
|
+
fi
|
|
78
|
+
|
|
79
|
+
# Handle full context retrieval
|
|
80
|
+
ALL_FIELDS=$(redis-cli HGETALL "$REDIS_KEY" 2>/dev/null || echo "")
|
|
81
|
+
|
|
82
|
+
if [ -z "$ALL_FIELDS" ]; then
|
|
83
|
+
echo "⚠️ Empty context for task: $TASK_ID" >&2
|
|
84
|
+
exit 1
|
|
85
|
+
fi
|
|
86
|
+
|
|
87
|
+
# Format as JSON
|
|
88
|
+
if [ "$FORMAT" = "json" ]; then
|
|
89
|
+
echo "{"
|
|
90
|
+
first=true
|
|
91
|
+
while IFS= read -r field; do
|
|
92
|
+
if [ -z "$field" ]; then continue; fi
|
|
93
|
+
if [ "$first" = true ]; then
|
|
94
|
+
first=false
|
|
95
|
+
else
|
|
96
|
+
echo ","
|
|
97
|
+
fi
|
|
98
|
+
# Skip empty lines and properly format JSON values
|
|
99
|
+
if [[ $field =~ ^[0-9]+$ ]]; then
|
|
100
|
+
# Numeric value
|
|
101
|
+
echo -n " \"$field\": $(redis-cli HGET "$REDIS_KEY" "$field")"
|
|
102
|
+
else
|
|
103
|
+
# String value
|
|
104
|
+
value=$(redis-cli HGET "$REDIS_KEY" "$field" | sed 's/"/\\"/g')
|
|
105
|
+
echo -n " \"$field\": \"$value\""
|
|
106
|
+
fi
|
|
107
|
+
done <<< "$ALL_FIELDS"
|
|
108
|
+
echo ""
|
|
109
|
+
echo "}"
|
|
110
|
+
else
|
|
111
|
+
# Raw format
|
|
112
|
+
redis-cli HGETALL "$REDIS_KEY"
|
|
113
|
+
fi
|
|
@@ -1,34 +1,89 @@
|
|
|
1
1
|
#!/bin/bash
|
|
2
2
|
# Store CFN Loop task context in Redis
|
|
3
|
-
# Used by orchestrator to pass context to CLI-spawned agents
|
|
3
|
+
# Used by orchestrator to pass structured context to CLI-spawned agents
|
|
4
4
|
#
|
|
5
|
-
# Usage:
|
|
5
|
+
# Usage:
|
|
6
|
+
# store-context.sh --task-id <id> --key <key> --value <value> [--namespace <ns>]
|
|
7
|
+
# store-context.sh <task_id> <context_json> (legacy mode)
|
|
6
8
|
|
|
7
9
|
set -euo pipefail
|
|
8
10
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
+
# Initialize variables
|
|
12
|
+
TASK_ID=""
|
|
13
|
+
KEY=""
|
|
14
|
+
VALUE=""
|
|
15
|
+
NAMESPACE="swarm"
|
|
16
|
+
CONTEXT=""
|
|
11
17
|
|
|
18
|
+
# Parse arguments
|
|
19
|
+
while [[ $# -gt 0 ]]; do
|
|
20
|
+
case $1 in
|
|
21
|
+
--task-id)
|
|
22
|
+
TASK_ID="$2"
|
|
23
|
+
shift 2
|
|
24
|
+
;;
|
|
25
|
+
--key)
|
|
26
|
+
KEY="$2"
|
|
27
|
+
shift 2
|
|
28
|
+
;;
|
|
29
|
+
--value)
|
|
30
|
+
VALUE="$2"
|
|
31
|
+
shift 2
|
|
32
|
+
;;
|
|
33
|
+
--namespace)
|
|
34
|
+
NAMESPACE="$2"
|
|
35
|
+
shift 2
|
|
36
|
+
;;
|
|
37
|
+
*)
|
|
38
|
+
# Legacy mode: positional arguments
|
|
39
|
+
if [ -z "$TASK_ID" ]; then
|
|
40
|
+
TASK_ID="$1"
|
|
41
|
+
elif [ -z "$CONTEXT" ]; then
|
|
42
|
+
CONTEXT="$1"
|
|
43
|
+
fi
|
|
44
|
+
shift
|
|
45
|
+
;;
|
|
46
|
+
esac
|
|
47
|
+
done
|
|
48
|
+
|
|
49
|
+
# Validate required arguments
|
|
12
50
|
if [ -z "$TASK_ID" ]; then
|
|
13
|
-
echo "Error: TASK_ID required" >&2
|
|
14
|
-
echo "Usage: $0 <
|
|
51
|
+
echo "Error: --task-id or TASK_ID required" >&2
|
|
52
|
+
echo "Usage: $0 --task-id <id> --key <key> --value <value> [--namespace <ns>]" >&2
|
|
53
|
+
echo " or: $0 <task_id> <context_json> (legacy)" >&2
|
|
15
54
|
exit 1
|
|
16
55
|
fi
|
|
17
56
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
57
|
+
# Handle structured mode (new)
|
|
58
|
+
if [ -n "$KEY" ] && [ -n "$VALUE" ]; then
|
|
59
|
+
# Store structured context with specific key
|
|
60
|
+
REDIS_KEY="${NAMESPACE}:${TASK_ID}:context"
|
|
61
|
+
|
|
62
|
+
redis-cli HSET "$REDIS_KEY" \
|
|
63
|
+
"$KEY" "$VALUE" \
|
|
64
|
+
"updated_at" "$(date -u +%Y-%m-%dT%H:%M:%SZ)" \
|
|
65
|
+
> /dev/null
|
|
66
|
+
|
|
67
|
+
# Set TTL (24 hours)
|
|
68
|
+
redis-cli EXPIRE "$REDIS_KEY" 86400 > /dev/null
|
|
69
|
+
|
|
70
|
+
echo "✅ Context stored: $KEY for task: $TASK_ID"
|
|
71
|
+
exit 0
|
|
22
72
|
fi
|
|
23
73
|
|
|
24
|
-
#
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
74
|
+
# Handle legacy mode
|
|
75
|
+
if [ -n "$CONTEXT" ]; then
|
|
76
|
+
redis-cli HSET "swarm:${TASK_ID}:context" \
|
|
77
|
+
"task_description" "$CONTEXT" \
|
|
78
|
+
"stored_at" "$(date -u +%Y-%m-%dT%H:%M:%SZ)" \
|
|
79
|
+
> /dev/null
|
|
80
|
+
|
|
81
|
+
# Set TTL (24 hours)
|
|
82
|
+
redis-cli EXPIRE "swarm:${TASK_ID}:context" 86400 > /dev/null
|
|
29
83
|
|
|
30
|
-
|
|
31
|
-
|
|
84
|
+
echo "✅ Context stored for task: $TASK_ID"
|
|
85
|
+
exit 0
|
|
86
|
+
fi
|
|
32
87
|
|
|
33
|
-
echo "
|
|
34
|
-
exit
|
|
88
|
+
echo "Error: Either --key/--value or <context_json> required" >&2
|
|
89
|
+
exit 1
|
|
@@ -112,7 +112,7 @@ npx claude-flow-novice agent-spawn my-first-agent --task-id test-1
|
|
|
112
112
|
│ ├── tester.md # Testing & validation
|
|
113
113
|
│ └── coordinator.md # Multi-agent coordination
|
|
114
114
|
├── development/ # Development-focused agents
|
|
115
|
-
│ ├── backend-
|
|
115
|
+
│ ├── backend-dev.md
|
|
116
116
|
│ ├── react-frontend-engineer.md
|
|
117
117
|
│ └── devops-engineer.md
|
|
118
118
|
├── security/ # Security-focused agents
|
|
@@ -613,7 +613,7 @@ Agents can work together using Redis pub/sub and CLI spawning:
|
|
|
613
613
|
### Agent Spawning Pattern
|
|
614
614
|
```bash
|
|
615
615
|
# Spawn agents via CLI (coordinators only)
|
|
616
|
-
npx claude-flow-novice agent-spawn backend-
|
|
616
|
+
npx claude-flow-novice agent-spawn backend-dev --task-id "${TASK_ID}"
|
|
617
617
|
npx claude-flow-novice agent-spawn reviewer --task-id "${TASK_ID}"
|
|
618
618
|
```
|
|
619
619
|
|
|
@@ -948,7 +948,7 @@ acl_level: 1
|
|
|
948
948
|
- `.claude/agents/core-agents/coder.md` - Code implementation
|
|
949
949
|
- `.claude/agents/core-agents/reviewer.md` - Code review
|
|
950
950
|
- `.claude/agents/core-agents/tester.md` - Testing & validation
|
|
951
|
-
- `.claude/agents/development/backend-
|
|
951
|
+
- `.claude/agents/development/backend-dev.md` - Backend development
|
|
952
952
|
- `.claude/agents/security/security-specialist.md` - Security analysis
|
|
953
953
|
|
|
954
954
|
### Documentation
|
|
@@ -15,7 +15,7 @@ The CFN (Claude Flow Novice) development team comprises 23 production agents org
|
|
|
15
15
|
- **Purpose**: Core implementation and creative problem-solving
|
|
16
16
|
- **Key Agents**:
|
|
17
17
|
- `coder`: Production code implementation
|
|
18
|
-
- `backend-
|
|
18
|
+
- `backend-dev`: Backend system design and implementation
|
|
19
19
|
- `researcher`: Technical research and solution exploration
|
|
20
20
|
- `architect`: System design and architectural planning
|
|
21
21
|
- `agent-builder`: Agent template and workflow design
|
|
@@ -149,7 +149,7 @@ LOOP2_AGENTS=("${VERIFIED_LOOP2_AGENTS[@]:-default_loop2_agent}")
|
|
|
149
149
|
**Agent Selection Rules (Enhanced):**
|
|
150
150
|
|
|
151
151
|
**Software Development:**
|
|
152
|
-
- Base Loop 3: `backend-
|
|
152
|
+
- Base Loop 3: `backend-dev`, `coder`, `devops-engineer`
|
|
153
153
|
- If security keywords → add `security-specialist`
|
|
154
154
|
- If database keywords → add `database-engineer`
|
|
155
155
|
- Base Loop 2: `reviewer`, `tester`, `security-auditor`
|
|
@@ -388,7 +388,7 @@ Mode: task
|
|
|
388
388
|
```json
|
|
389
389
|
{
|
|
390
390
|
"task_type": "software-development",
|
|
391
|
-
"loop3_agents": ["backend-
|
|
391
|
+
"loop3_agents": ["backend-dev", "security-specialist"],
|
|
392
392
|
"loop2_agents": ["reviewer", "tester", "security-auditor"],
|
|
393
393
|
"loop4_agent": "product-owner",
|
|
394
394
|
"validation_criteria": {
|
|
@@ -5,7 +5,7 @@ Implementation agents focused on building features and components.
|
|
|
5
5
|
## Active Agents (7)
|
|
6
6
|
|
|
7
7
|
**Backend Development:**
|
|
8
|
-
- `backend-
|
|
8
|
+
- `backend-dev.md` - Backend services, APIs, server-side logic
|
|
9
9
|
- `dev-backend-api.md` - Specialized REST/GraphQL API development
|
|
10
10
|
|
|
11
11
|
**Frontend Development:**
|
|
@@ -42,12 +42,12 @@ All developers follow:
|
|
|
42
42
|
Automatically spawned by orchestrator in Loop 3:
|
|
43
43
|
```bash
|
|
44
44
|
./.claude/skills/cfn-loop-orchestration/orchestrate.sh \
|
|
45
|
-
--loop3-agents "backend-
|
|
45
|
+
--loop3-agents "backend-dev,react-frontend-engineer"
|
|
46
46
|
```
|
|
47
47
|
|
|
48
48
|
**Standalone Implementation:**
|
|
49
49
|
```bash
|
|
50
|
-
npx claude-flow-novice agent-spawn backend-
|
|
50
|
+
npx claude-flow-novice agent-spawn backend-dev --task-id "$TASK_ID"
|
|
51
51
|
```
|
|
52
52
|
|
|
53
53
|
## Deliverables
|
|
@@ -453,7 +453,7 @@ Deployment Process:
|
|
|
453
453
|
## Agent Selection Guide
|
|
454
454
|
|
|
455
455
|
**Core Development**: coder, tester, reviewer
|
|
456
|
-
**Backend**: backend-
|
|
456
|
+
**Backend**: backend-dev, api-docs, system-architect
|
|
457
457
|
**Frontend**: coder (specialized), mobile-dev
|
|
458
458
|
**Quality**: tester, reviewer, security-specialist, perf-analyzer
|
|
459
459
|
**Planning**: researcher, planner, architect
|
|
@@ -19,7 +19,7 @@ The `epic-creator.md` coordinator agent kept getting deleted from `.claude/agent
|
|
|
19
19
|
### Why It Happened
|
|
20
20
|
|
|
21
21
|
1. `package.json` has `"postinstall": "node scripts/init-project.js"`
|
|
22
|
-
2. Running `npx claude-flow-novice agent backend-
|
|
22
|
+
2. Running `npx claude-flow-novice agent backend-dev` triggers postinstall
|
|
23
23
|
3. `init-project.js` ran `cfn-init` unconditionally
|
|
24
24
|
4. cfn-init copied package version of cfn-dev-team/, overwriting local files
|
|
25
25
|
5. epic-creator.md (and other local customizations) got deleted
|
|
@@ -28,7 +28,7 @@ The `epic-creator.md` coordinator agent kept getting deleted from `.claude/agent
|
|
|
28
28
|
|
|
29
29
|
```bash
|
|
30
30
|
# Each of these triggered cfn-init:
|
|
31
|
-
npx claude-flow-novice agent backend-
|
|
31
|
+
npx claude-flow-novice agent backend-dev
|
|
32
32
|
npx claude-flow-novice agent reviewer
|
|
33
33
|
npx claude-flow-novice agent epic-creator
|
|
34
34
|
|
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
|
|
7
7
|
## Overview
|
|
8
8
|
|
|
9
|
-
Task Mode: Main Chat
|
|
9
|
+
Task Mode: Main Chat spawns coordinator and agents via Task() tool with full context injection and visibility.
|
|
10
10
|
|
|
11
11
|
| Aspect | Task Mode | CLI Mode |
|
|
12
12
|
|--------|-----------|----------|
|
|
13
|
-
| **Spawning** | Main Chat
|
|
13
|
+
| **Spawning** | Main Chat via Task() | Coordinator via npx CLI |
|
|
14
14
|
| **Visibility** | Full transparency in Main Chat | Background, Redis logs |
|
|
15
15
|
| **Provider** | All Anthropic | CLI uses Z.ai routing |
|
|
16
16
|
| **Cost** | ~$0.150/iteration | ~$0.054/iteration (64% savings) |
|
|
@@ -35,50 +35,6 @@ Task Mode: Main Chat acts as coordinator and spawns agents directly via Task() t
|
|
|
35
35
|
|
|
36
36
|
---
|
|
37
37
|
|
|
38
|
-
## Task Mode Execution Pattern
|
|
39
|
-
|
|
40
|
-
**Key Principle: Main Chat IS the coordinator**
|
|
41
|
-
|
|
42
|
-
In Task Mode, Main Chat directly spawns all agents via Task() tool. No coordinator agent is used.
|
|
43
|
-
|
|
44
|
-
### Example: Zone A React Router Migration
|
|
45
|
-
|
|
46
|
-
```javascript
|
|
47
|
-
// ✅ CORRECT - Main Chat spawns agents directly
|
|
48
|
-
Task("backend-developer", `
|
|
49
|
-
Migrate React Router from v4 to v6 in Zone A components
|
|
50
|
-
Deliverables: Updated Routes, component fixes, tests
|
|
51
|
-
Directory: frontend/src/zone-a/
|
|
52
|
-
`);
|
|
53
|
-
|
|
54
|
-
Task("react-frontend-engineer", `
|
|
55
|
-
Review and fix any component issues after router migration
|
|
56
|
-
Focus on route parameters, navigation, and component integration
|
|
57
|
-
`);
|
|
58
|
-
|
|
59
|
-
Task("tester", `
|
|
60
|
-
Test React Router v6 migration in Zone A
|
|
61
|
-
Verify all routes work, navigation functions, no regressions
|
|
62
|
-
`);
|
|
63
|
-
|
|
64
|
-
// Later: Process outputs, collect confidence, decide next iteration
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
### What NOT to Do in Task Mode
|
|
68
|
-
|
|
69
|
-
```javascript
|
|
70
|
-
// ❌ INCORRECT - Don't spawn coordinator agent
|
|
71
|
-
Task("cfn-v3-coordinator", "Coordinate React Router migration");
|
|
72
|
-
|
|
73
|
-
// ❌ INCORRECT - Don't use CLI commands in Task Mode
|
|
74
|
-
Bash("npx claude-flow-novice swarm 'task description'");
|
|
75
|
-
|
|
76
|
-
// ❌ INCORRECT - Don't nest CFN Loop calls
|
|
77
|
-
Task("reviewer", "/cfn-loop 'review this code'"); // Causes infinite loops
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
---
|
|
81
|
-
|
|
82
38
|
## Agent Specialization
|
|
83
39
|
|
|
84
40
|
### Loop 3 (Implementation)
|
|
@@ -132,15 +88,15 @@ return validators.slice(0, 6); // Max 6
|
|
|
132
88
|
## Sprint Completion Workflow
|
|
133
89
|
|
|
134
90
|
**Key Difference in Task Mode:**
|
|
135
|
-
- Product Owner spawned via `Task()` by
|
|
91
|
+
- Product Owner spawned via `Task()` by coordinator (NOT via `execute-decision.sh`)
|
|
136
92
|
- Use helper scripts for parsing/validation: `parse-decision.sh`, `validate-deliverables.sh`
|
|
137
93
|
- CLI Mode uses `execute-decision.sh` which handles spawning + all logic
|
|
138
94
|
|
|
139
95
|
### 1. Consensus Validation
|
|
140
96
|
|
|
141
|
-
**Task Mode** -
|
|
97
|
+
**Task Mode** - Coordinator spawns Product Owner via Task():
|
|
142
98
|
```javascript
|
|
143
|
-
//
|
|
99
|
+
// Coordinator builds context and spawns PO
|
|
144
100
|
const poContext = `
|
|
145
101
|
CFN Loop iteration ${iteration} complete.
|
|
146
102
|
Loop 2 Consensus: ${consensus} (threshold: ${threshold})
|
|
@@ -208,7 +164,7 @@ EOF
|
|
|
208
164
|
### 5. Execute Product Owner Suggested Next Steps
|
|
209
165
|
|
|
210
166
|
**After PROCEED Decision:**
|
|
211
|
-
Product Owner may suggest follow-up tasks (documentation, testing, refactoring).
|
|
167
|
+
Product Owner may suggest follow-up tasks (documentation, testing, refactoring). Coordinator (main chat) must proceed by spawning specialized agents to execute these tasks:
|
|
212
168
|
|
|
213
169
|
```javascript
|
|
214
170
|
// Parse PO feedback for suggested next steps
|
|
@@ -349,7 +305,7 @@ threshold = Math.min(threshold, 0.98); // Cap at 0.98
|
|
|
349
305
|
## Background Backlog Worker
|
|
350
306
|
|
|
351
307
|
### Architecture
|
|
352
|
-
- **Main Chat
|
|
308
|
+
- **Main Chat**: Spawns Task() agents for Sprint N (foreground)
|
|
353
309
|
- **Background CLI**: Processes P3 backlog items (detached process)
|
|
354
310
|
|
|
355
311
|
### Launch Background Worker
|