claude-flow-novice 2.15.7 → 2.15.9

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 (52) hide show
  1. package/.claude/cfn-extras/agents/google-sheets/google-sheets-coordinator.md +1 -1
  2. package/.claude/cfn-extras/docs/GOOGLE_SHEETS_CFN_LOOP.md +13 -11
  3. package/.claude/skills/cfn-loop-orchestration/helpers/consensus-ts.sh +104 -0
  4. package/.claude/skills/cfn-loop-orchestration/helpers/deliverable-verifier-ts.sh +123 -0
  5. package/.claude/skills/cfn-loop-orchestration/helpers/iteration-manager-ts.sh +89 -0
  6. package/.claude/skills/cfn-loop-orchestration/helpers/timeout-calculator-ts.sh +47 -0
  7. package/.claude/skills/cfn-loop-orchestration/src/helpers/deliverable-verifier.ts +103 -0
  8. package/.claude/skills/cfn-loop-orchestration/src/helpers/iteration-manager.ts +45 -0
  9. package/.claude/skills/cfn-loop-orchestration/src/helpers/timeout-calculator.ts +41 -0
  10. package/.claude/skills/cfn-loop-orchestration/tests/consensus.test.ts +1 -1
  11. package/.claude/skills/cfn-loop-orchestration/tests/deliverable-verifier.test.ts +1 -3
  12. package/.claude/skills/cfn-loop-orchestration/tests/iteration-manager.test.ts +1 -1
  13. package/.claude/skills/cfn-redis-coordination/report-completion.sh +55 -10
  14. package/.claude/skills/cfn-redis-coordination/store-context.sh +31 -1
  15. package/claude-assets/agents/cfn-dev-team/coordinators/cfn-frontend-coordinator.md +6 -1
  16. package/claude-assets/agents/cfn-dev-team/coordinators/consensus-builder.md +6 -1
  17. package/claude-assets/agents/cfn-dev-team/coordinators/handoff-coordinator.md +6 -1
  18. package/claude-assets/agents/cfn-dev-team/coordinators/multi-sprint-coordinator.md +6 -1
  19. package/claude-assets/agents/cfn-dev-team/dev-ops/docker-specialist.md +18 -8
  20. package/claude-assets/agents/cfn-dev-team/dev-ops/kubernetes-specialist.md +18 -8
  21. package/claude-assets/agents/cfn-dev-team/developers/api-gateway-specialist.md +18 -8
  22. package/claude-assets/agents/cfn-dev-team/developers/backend-developer.md +17 -7
  23. package/claude-assets/agents/cfn-dev-team/developers/graphql-specialist.md +17 -8
  24. package/claude-assets/agents/cfn-dev-team/developers/rust-developer.md +18 -8
  25. package/claude-assets/agents/cfn-dev-team/reviewers/code-reviewer.md +9 -5
  26. package/claude-assets/agents/cfn-dev-team/reviewers/quality/code-quality-validator.md +13 -6
  27. package/claude-assets/agents/cfn-dev-team/reviewers/quality/perf-analyzer.md +13 -6
  28. package/claude-assets/agents/cfn-dev-team/reviewers/quality/performance-benchmarker.md +13 -6
  29. package/claude-assets/agents/cfn-dev-team/reviewers/quality/security-specialist.md +15 -5
  30. package/claude-assets/agents/cfn-dev-team/testers/api-testing-specialist.md +9 -5
  31. package/claude-assets/agents/cfn-dev-team/testers/chaos-engineering-specialist.md +8 -4
  32. package/claude-assets/agents/cfn-dev-team/testers/interaction-tester.md +16 -13
  33. package/claude-assets/agents/cfn-dev-team/testers/playwright-tester.md +9 -5
  34. package/claude-assets/agents/cfn-dev-team/testers/tester.md +9 -5
  35. package/claude-assets/cfn-extras/agents/google-sheets/google-sheets-coordinator.md +1 -1
  36. package/claude-assets/cfn-extras/docs/GOOGLE_SHEETS_CFN_LOOP.md +13 -11
  37. package/claude-assets/skills/cfn-loop-orchestration/helpers/consensus-ts.sh +104 -0
  38. package/claude-assets/skills/cfn-loop-orchestration/helpers/deliverable-verifier-ts.sh +123 -0
  39. package/claude-assets/skills/cfn-loop-orchestration/helpers/iteration-manager-ts.sh +89 -0
  40. package/claude-assets/skills/cfn-loop-orchestration/helpers/timeout-calculator-ts.sh +47 -0
  41. package/claude-assets/skills/cfn-loop-orchestration/src/helpers/consensus.ts +87 -0
  42. package/claude-assets/skills/cfn-loop-orchestration/src/helpers/deliverable-verifier.ts +103 -0
  43. package/claude-assets/skills/cfn-loop-orchestration/src/helpers/iteration-manager.ts +45 -0
  44. package/claude-assets/skills/cfn-loop-orchestration/src/helpers/timeout-calculator.ts +41 -0
  45. package/claude-assets/skills/cfn-loop-orchestration/tests/consensus.test.ts +1 -1
  46. package/claude-assets/skills/cfn-loop-orchestration/tests/deliverable-verifier.test.ts +1 -3
  47. package/claude-assets/skills/cfn-loop-orchestration/tests/iteration-manager.test.ts +1 -1
  48. package/claude-assets/skills/cfn-redis-coordination/report-completion.sh +55 -10
  49. package/claude-assets/skills/cfn-redis-coordination/store-context.sh +31 -1
  50. package/dist/cli/config-manager.js +109 -91
  51. package/dist/cli/config-manager.js.map +1 -1
  52. package/package.json +1 -1
@@ -0,0 +1,89 @@
1
+ #!/usr/bin/env bash
2
+
3
+ ##############################################################################
4
+ # Iteration Manager (TypeScript Wrapper)
5
+ # Prepares next iteration and generates wake signals
6
+ #
7
+ # Usage:
8
+ # iteration-manager-ts.sh --current-iteration <n> \
9
+ # --agents <agent1,agent2,...> \
10
+ # [--feedback <json>]
11
+ #
12
+ # Returns:
13
+ # Next iteration metadata (JSON)
14
+ ##############################################################################
15
+
16
+ set -euo pipefail
17
+
18
+ # Get script directory
19
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
20
+ HELPERS_DIR="$SCRIPT_DIR/../src/helpers"
21
+
22
+ # Parameters
23
+ CURRENT_ITERATION=""
24
+ AGENTS=""
25
+ FEEDBACK="{}"
26
+
27
+ # Parse arguments
28
+ while [[ $# -gt 0 ]]; do
29
+ case $1 in
30
+ --current-iteration) CURRENT_ITERATION="$2"; shift 2 ;;
31
+ --agents) AGENTS="$2"; shift 2 ;;
32
+ --feedback) FEEDBACK="$2"; shift 2 ;;
33
+ *) echo "Unknown option: $1" >&2; exit 1 ;;
34
+ esac
35
+ done
36
+
37
+ # Validation
38
+ if [ -z "$CURRENT_ITERATION" ] || [ -z "$AGENTS" ]; then
39
+ echo "Error: Missing required parameters" >&2
40
+ exit 1
41
+ fi
42
+
43
+ # Convert comma-separated agents to JSON array
44
+ IFS=',' read -ra AGENT_ARRAY <<< "$AGENTS"
45
+ AGENTS_JSON="["
46
+ for i in "${!AGENT_ARRAY[@]}"; do
47
+ if [ $i -gt 0 ]; then
48
+ AGENTS_JSON+=","
49
+ fi
50
+ AGENTS_JSON+="\"${AGENT_ARRAY[$i]}\""
51
+ done
52
+ AGENTS_JSON+="]"
53
+
54
+ # Build TypeScript invocation
55
+ TS_CODE="
56
+ import { prepareIteration, wakeAgents } from './iteration-manager';
57
+
58
+ const iteration = prepareIteration({
59
+ currentIteration: $CURRENT_ITERATION,
60
+ feedback: $FEEDBACK
61
+ });
62
+
63
+ console.log('Iteration Preparation:');
64
+ console.log(\` Next Iteration: \${iteration.nextIteration}\`);
65
+ console.log(\` Timestamp: \${iteration.timestamp}\`);
66
+ console.log();
67
+
68
+ const agentIds = $AGENTS_JSON;
69
+ const wake = wakeAgents(agentIds);
70
+
71
+ console.log('Wake Signals Generated:');
72
+ wake.signals.forEach((signal, idx) => {
73
+ console.log(\` [\${idx + 1}] \${signal}\`);
74
+ });
75
+ console.log();
76
+ console.log(\`✅ Prepared iteration \${iteration.nextIteration} for \${agentIds.length} agents\`);
77
+
78
+ // Output JSON for programmatic consumption
79
+ console.log();
80
+ console.log('JSON_OUTPUT:', JSON.stringify({
81
+ nextIteration: iteration.nextIteration,
82
+ timestamp: iteration.timestamp,
83
+ signals: wake.signals
84
+ }));
85
+ "
86
+
87
+ # Execute TypeScript code
88
+ cd "$HELPERS_DIR"
89
+ ts-node -e "$TS_CODE"
@@ -0,0 +1,47 @@
1
+ #!/usr/bin/env bash
2
+
3
+ ##############################################################################
4
+ # Timeout Calculator (TypeScript Wrapper)
5
+ # Calculates mode and phase-specific timeouts for agent execution
6
+ #
7
+ # Usage:
8
+ # timeout-calculator-ts.sh --mode <mvp|standard|enterprise> [--phase <phase-id>]
9
+ #
10
+ # Returns:
11
+ # Timeout value in seconds (stdout)
12
+ ##############################################################################
13
+
14
+ set -euo pipefail
15
+
16
+ # Get script directory
17
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
18
+ HELPERS_DIR="$SCRIPT_DIR/../src/helpers"
19
+
20
+ # Parameters
21
+ MODE="standard"
22
+ PHASE=""
23
+
24
+ # Parse arguments
25
+ while [[ $# -gt 0 ]]; do
26
+ case $1 in
27
+ --mode) MODE="$2"; shift 2 ;;
28
+ --phase) PHASE="$2"; shift 2 ;;
29
+ *) echo "Unknown option: $1" >&2; exit 1 ;;
30
+ esac
31
+ done
32
+
33
+ # Build TypeScript invocation
34
+ TS_CODE="
35
+ import { calculateTimeout } from './timeout-calculator';
36
+
37
+ const timeout = calculateTimeout({
38
+ mode: '$MODE',
39
+ ${PHASE:+phase: '$PHASE'}
40
+ });
41
+
42
+ console.log(timeout);
43
+ "
44
+
45
+ # Execute TypeScript code
46
+ cd "$HELPERS_DIR"
47
+ ts-node -e "$TS_CODE"
@@ -0,0 +1,87 @@
1
+ /**
2
+ * Consensus Collection and Validation
3
+ * Collects Loop 2 validator scores and validates against thresholds
4
+ */
5
+
6
+ export interface ConsensusResult {
7
+ scores: number[];
8
+ average: number;
9
+ count: number;
10
+ min: number;
11
+ max: number;
12
+ }
13
+
14
+ export interface ConsensusValidation {
15
+ passed: boolean;
16
+ average: number;
17
+ threshold: number;
18
+ mode: string;
19
+ gap: number;
20
+ }
21
+
22
+ export type Mode = 'mvp' | 'standard' | 'enterprise';
23
+
24
+ const MODE_THRESHOLDS: Record<Mode, number> = {
25
+ mvp: 0.80,
26
+ standard: 0.90,
27
+ enterprise: 0.95
28
+ };
29
+
30
+ /**
31
+ * Collects consensus scores from multiple validators
32
+ * @param scores Array of validator confidence scores (0.0-1.0)
33
+ * @returns ConsensusResult with statistics
34
+ */
35
+ export function collectConsensus(scores: number[]): ConsensusResult {
36
+ if (!scores || scores.length === 0) {
37
+ throw new Error('No consensus scores provided');
38
+ }
39
+
40
+ // Validate all scores are in valid range
41
+ for (const score of scores) {
42
+ if (score < 0 || score > 1.0) {
43
+ throw new Error(`Invalid consensus score: ${score} (must be 0.0-1.0)`);
44
+ }
45
+ }
46
+
47
+ // Calculate statistics
48
+ const sum = scores.reduce((acc, score) => acc + score, 0);
49
+ const average = sum / scores.length;
50
+ const min = Math.min(...scores);
51
+ const max = Math.max(...scores);
52
+
53
+ return {
54
+ scores,
55
+ average,
56
+ count: scores.length,
57
+ min,
58
+ max
59
+ };
60
+ }
61
+
62
+ /**
63
+ * Validates consensus against mode-specific threshold
64
+ * @param params Validation parameters
65
+ * @returns ConsensusValidation result
66
+ */
67
+ export function validateConsensus(params: {
68
+ average: number;
69
+ threshold?: number;
70
+ mode: Mode | string;
71
+ }): ConsensusValidation {
72
+ // Use explicit threshold if provided, otherwise use mode default
73
+ const threshold = params.threshold !== undefined
74
+ ? params.threshold
75
+ : MODE_THRESHOLDS[params.mode as Mode] || 0.90;
76
+
77
+ const passed = params.average >= threshold;
78
+ const gap = params.average - threshold;
79
+
80
+ return {
81
+ passed,
82
+ average: params.average,
83
+ threshold,
84
+ mode: params.mode,
85
+ gap
86
+ };
87
+ }
@@ -0,0 +1,103 @@
1
+ /**
2
+ * Deliverable Verifier
3
+ * Verifies expected deliverables exist (prevents "consensus on vapor")
4
+ */
5
+
6
+ import * as fs from 'fs';
7
+ import * as path from 'path';
8
+ import { execSync } from 'child_process';
9
+
10
+ export interface VerificationResult {
11
+ verified: boolean;
12
+ files: string[];
13
+ missing: string[];
14
+ found: string[];
15
+ typeErrors?: string[];
16
+ gitChanges?: number;
17
+ requiresChanges?: boolean;
18
+ reason?: string;
19
+ }
20
+
21
+ const IMPLEMENTATION_KEYWORDS = [
22
+ 'create', 'build', 'implement', 'add', 'generate'
23
+ ];
24
+
25
+ /**
26
+ * Verifies expected deliverables exist
27
+ * @param params Verification parameters
28
+ * @returns VerificationResult with detailed verification status
29
+ */
30
+ export function verifyDeliverables(params: {
31
+ files: string[];
32
+ expectedTypes?: string[];
33
+ requireGitChanges?: boolean;
34
+ taskType?: string;
35
+ }): VerificationResult {
36
+ const found: string[] = [];
37
+ const missing: string[] = [];
38
+ const typeErrors: string[] = [];
39
+
40
+ // Check each file
41
+ for (const file of params.files) {
42
+ if (fs.existsSync(file)) {
43
+ found.push(file);
44
+
45
+ // Type validation if expected types specified
46
+ if (params.expectedTypes && params.expectedTypes.length > 0) {
47
+ const ext = path.extname(file);
48
+ if (!params.expectedTypes.includes(ext)) {
49
+ typeErrors.push(file);
50
+ }
51
+ }
52
+ } else {
53
+ missing.push(file);
54
+ }
55
+ }
56
+
57
+ // Git change detection
58
+ let gitChanges = 0;
59
+ if (params.requireGitChanges !== undefined) {
60
+ try {
61
+ const gitStatus = execSync('git status --short', { encoding: 'utf-8' });
62
+ gitChanges = gitStatus.trim().split('\n').filter(line => line.length > 0).length;
63
+ } catch (error) {
64
+ // Git not available or not a git repo
65
+ gitChanges = -1;
66
+ }
67
+ }
68
+
69
+ // Detect if task requires changes (implementation keywords)
70
+ const requiresChanges = params.taskType
71
+ ? IMPLEMENTATION_KEYWORDS.some(keyword =>
72
+ params.taskType!.toLowerCase().includes(keyword)
73
+ )
74
+ : false;
75
+
76
+ // Check for "consensus on vapor"
77
+ let verified = missing.length === 0 && typeErrors.length === 0;
78
+ let reason: string | undefined;
79
+
80
+ if (requiresChanges && params.requireGitChanges && gitChanges === 0 && params.files.length === 0) {
81
+ verified = false;
82
+ reason = 'Implementation task detected but no deliverables created (consensus on vapor)';
83
+ }
84
+
85
+ const result: VerificationResult = {
86
+ verified,
87
+ files: params.files,
88
+ missing,
89
+ found,
90
+ gitChanges,
91
+ requiresChanges
92
+ };
93
+
94
+ // Add optional properties only if they have values
95
+ if (typeErrors.length > 0) {
96
+ result.typeErrors = typeErrors;
97
+ }
98
+ if (reason !== undefined) {
99
+ result.reason = reason;
100
+ }
101
+
102
+ return result;
103
+ }
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Iteration Manager
3
+ * Manages CFN Loop iteration transitions and agent wake operations
4
+ */
5
+
6
+ export interface IterationPreparation {
7
+ nextIteration: number;
8
+ feedback: any;
9
+ timestamp: string;
10
+ }
11
+
12
+ export interface WakeResult {
13
+ signals: string[];
14
+ }
15
+
16
+ /**
17
+ * Prepares next iteration with feedback
18
+ * @param params Current iteration and feedback data
19
+ * @returns IterationPreparation for next iteration
20
+ */
21
+ export function prepareIteration(params: {
22
+ currentIteration: number;
23
+ feedback: any;
24
+ }): IterationPreparation {
25
+ return {
26
+ nextIteration: params.currentIteration + 1,
27
+ feedback: params.feedback,
28
+ timestamp: new Date().toISOString()
29
+ };
30
+ }
31
+
32
+ /**
33
+ * Prepares wake signals for agents
34
+ * @param agentIds Array of agent IDs to wake
35
+ * @returns WakeResult with signal identifiers
36
+ */
37
+ export function wakeAgents(agentIds: string[]): WakeResult {
38
+ const signals = agentIds.map(agentId => {
39
+ return `wake:${agentId}:${Date.now()}`;
40
+ });
41
+
42
+ return {
43
+ signals
44
+ };
45
+ }
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Timeout Calculator
3
+ * Calculates mode and phase-specific timeouts for agent execution
4
+ */
5
+
6
+ export type Mode = 'mvp' | 'standard' | 'enterprise';
7
+
8
+ const BASE_TIMEOUTS: Record<Mode, number> = {
9
+ mvp: 1800, // 30 minutes
10
+ standard: 3600, // 60 minutes
11
+ enterprise: 7200 // 120 minutes
12
+ };
13
+
14
+ const PHASE_MULTIPLIERS: Record<string, number> = {
15
+ 'phase-1': 1.0, // Backend work
16
+ 'phase-2': 1.5, // React components
17
+ 'phase-3': 2.0, // Advanced components
18
+ 'phase-4': 1.0 // Testing/integration
19
+ };
20
+
21
+ /**
22
+ * Calculates timeout based on mode and optional phase
23
+ * @param params Mode and optional phase identifier
24
+ * @returns Timeout in seconds
25
+ */
26
+ export function calculateTimeout(params: {
27
+ mode: Mode;
28
+ phase?: string;
29
+ }): number {
30
+ const baseTimeout = BASE_TIMEOUTS[params.mode] || BASE_TIMEOUTS.standard;
31
+
32
+ if (!params.phase) {
33
+ return baseTimeout;
34
+ }
35
+
36
+ // Normalize phase to lowercase for case-insensitive matching
37
+ const normalizedPhase = params.phase.toLowerCase();
38
+ const multiplier = PHASE_MULTIPLIERS[normalizedPhase] || 1.0;
39
+
40
+ return Math.floor(baseTimeout * multiplier);
41
+ }
@@ -3,7 +3,7 @@
3
3
  * Tests for collecting Loop 2 validator scores and checking thresholds
4
4
  */
5
5
 
6
- import { collectConsensus, validateConsensus, ConsensusResult, ConsensusValidation } from '../src/helpers/consensus';
6
+ import { collectConsensus, validateConsensus } from '../src/helpers/consensus';
7
7
 
8
8
  describe('consensus', () => {
9
9
  describe('collectConsensus', () => {
@@ -3,9 +3,7 @@
3
3
  * Tests for verifying expected deliverables exist (prevents "consensus on vapor")
4
4
  */
5
5
 
6
- import { verifyDeliverables, VerificationResult } from '../src/helpers/deliverable-verifier';
7
- import * as fs from 'fs';
8
- import * as path from 'path';
6
+ import { verifyDeliverables } from '../src/helpers/deliverable-verifier';
9
7
 
10
8
  describe('deliverable-verifier', () => {
11
9
  describe('file existence verification', () => {
@@ -3,7 +3,7 @@
3
3
  * Tests for managing CFN Loop iteration transitions and feedback
4
4
  */
5
5
 
6
- import { prepareIteration, wakeAgents, IterationPreparation } from '../src/helpers/iteration-manager';
6
+ import { prepareIteration, wakeAgents } from '../src/helpers/iteration-manager';
7
7
 
8
8
  describe('iteration-manager', () => {
9
9
  describe('prepareIteration', () => {
@@ -2,7 +2,10 @@
2
2
  # Report agent completion and confidence to Redis
3
3
  # Replaces deprecated invoke-waiting-mode.sh for CFN Loop coordination
4
4
  #
5
- # Usage: report-completion.sh --task-id <id> --agent-id <id> --confidence <0.0-1.0> [--result <json>]
5
+ # Usage:
6
+ # report-completion.sh --task-id <id> --agent-id <id> --confidence <0.0-1.0>
7
+ # [--iteration <n>] [--namespace <ns>] [--result <json>]
8
+ # [--test-pass-rate <pct>] [--tests-run <n>] [--tests-passed <n>]
6
9
 
7
10
  set -euo pipefail
8
11
 
@@ -16,6 +19,10 @@ AGENT_ID=""
16
19
  CONFIDENCE=""
17
20
  RESULT=""
18
21
  ITERATION="1"
22
+ NAMESPACE="swarm"
23
+ TEST_PASS_RATE=""
24
+ TESTS_RUN=""
25
+ TESTS_PASSED=""
19
26
 
20
27
  while [[ $# -gt 0 ]]; do
21
28
  case $1 in
@@ -39,6 +46,22 @@ while [[ $# -gt 0 ]]; do
39
46
  ITERATION="$2"
40
47
  shift 2
41
48
  ;;
49
+ --namespace)
50
+ NAMESPACE="$2"
51
+ shift 2
52
+ ;;
53
+ --test-pass-rate)
54
+ TEST_PASS_RATE="$2"
55
+ shift 2
56
+ ;;
57
+ --tests-run)
58
+ TESTS_RUN="$2"
59
+ shift 2
60
+ ;;
61
+ --tests-passed)
62
+ TESTS_PASSED="$2"
63
+ shift 2
64
+ ;;
42
65
  *)
43
66
  echo "Unknown option: $1" >&2
44
67
  exit 1
@@ -51,7 +74,9 @@ done
51
74
  # Wrapper provides graceful Task mode fallback when Redis unavailable
52
75
  if [ -z "$TASK_ID" ] || [ -z "$AGENT_ID" ] || [ -z "$CONFIDENCE" ]; then
53
76
  echo "Error: Missing required parameters" >&2
54
- echo "Usage: $0 --task-id <id> --agent-id <id> --confidence <0.0-1.0> [--result <json>] [--iteration <n>]" >&2
77
+ echo "Usage: $0 --task-id <id> --agent-id <id> --confidence <0.0-1.0>" >&2
78
+ echo " [--iteration <n>] [--namespace <ns>] [--result <json>]" >&2
79
+ echo " [--test-pass-rate <pct>] [--tests-run <n>] [--tests-passed <n>]" >&2
55
80
  exit 1
56
81
  fi
57
82
 
@@ -66,24 +91,44 @@ fi
66
91
  # Measured improvement: ~62% coordination overhead reduction in standard mode
67
92
  {
68
93
  echo "MULTI"
69
- echo "LPUSH swarm:${TASK_ID}:${AGENT_ID}:done complete"
70
- echo "SET swarm:${TASK_ID}:${AGENT_ID}:confidence $CONFIDENCE EX 3600"
94
+ echo "LPUSH ${NAMESPACE}:${TASK_ID}:${AGENT_ID}:done complete"
95
+ echo "SET ${NAMESPACE}:${TASK_ID}:${AGENT_ID}:confidence $CONFIDENCE EX 3600"
96
+
97
+ # Build result hash with test metrics if provided
98
+ RESULT_HASH_ARGS="confidence $CONFIDENCE iteration $ITERATION"
71
99
 
72
100
  if [ -n "$RESULT" ]; then
73
- echo "HSET swarm:${TASK_ID}:${AGENT_ID}:result confidence $CONFIDENCE iteration $ITERATION result $RESULT timestamp $(date -u +%Y-%m-%dT%H:%M:%SZ)"
74
- else
75
- echo "HSET swarm:${TASK_ID}:${AGENT_ID}:result confidence $CONFIDENCE iteration $ITERATION timestamp $(date -u +%Y-%m-%dT%H:%M:%SZ)"
101
+ RESULT_HASH_ARGS="$RESULT_HASH_ARGS result $RESULT"
76
102
  fi
77
103
 
104
+ if [ -n "$TEST_PASS_RATE" ]; then
105
+ RESULT_HASH_ARGS="$RESULT_HASH_ARGS test_pass_rate $TEST_PASS_RATE"
106
+ fi
107
+
108
+ if [ -n "$TESTS_RUN" ]; then
109
+ RESULT_HASH_ARGS="$RESULT_HASH_ARGS tests_run $TESTS_RUN"
110
+ fi
111
+
112
+ if [ -n "$TESTS_PASSED" ]; then
113
+ RESULT_HASH_ARGS="$RESULT_HASH_ARGS tests_passed $TESTS_PASSED"
114
+ fi
115
+
116
+ RESULT_HASH_ARGS="$RESULT_HASH_ARGS timestamp $(date -u +%Y-%m-%dT%H:%M:%SZ)"
117
+
118
+ echo "HSET ${NAMESPACE}:${TASK_ID}:${AGENT_ID}:result $RESULT_HASH_ARGS"
119
+
78
120
  echo "EXEC"
79
121
  } | redis-cli > /dev/null
80
122
 
81
123
  # Step 4: Add to agent completion list (for orchestrator tracking)
82
- redis-cli LPUSH "swarm:${TASK_ID}:completed_agents" "$AGENT_ID" > /dev/null
124
+ redis-cli LPUSH "${NAMESPACE}:${TASK_ID}:completed_agents" "$AGENT_ID" > /dev/null
83
125
 
84
126
  # Step 5: Set TTL on keys (auto-cleanup)
85
- redis-cli EXPIRE "swarm:${TASK_ID}:${AGENT_ID}:result" 3600 > /dev/null
86
- redis-cli EXPIRE "swarm:${TASK_ID}:${AGENT_ID}:done" 3600 > /dev/null
127
+ redis-cli EXPIRE "${NAMESPACE}:${TASK_ID}:${AGENT_ID}:result" 3600 > /dev/null
128
+ redis-cli EXPIRE "${NAMESPACE}:${TASK_ID}:${AGENT_ID}:done" 3600 > /dev/null
87
129
 
88
130
  echo "✅ Reported completion for agent: $AGENT_ID (confidence: $CONFIDENCE)"
131
+ if [ -n "$TEST_PASS_RATE" ]; then
132
+ echo " Test pass rate: $TEST_PASS_RATE%"
133
+ fi
89
134
  exit 0
@@ -4,6 +4,7 @@
4
4
  #
5
5
  # Usage:
6
6
  # store-context.sh --task-id <id> --key <key> --value <value> [--namespace <ns>]
7
+ # store-context.sh --task-id <id> --epic <epic> --mode <mode> [--namespace <ns>]
7
8
  # store-context.sh <task_id> <context_json> (legacy mode)
8
9
 
9
10
  set -euo pipefail
@@ -18,6 +19,8 @@ KEY=""
18
19
  VALUE=""
19
20
  NAMESPACE="swarm"
20
21
  CONTEXT=""
22
+ EPIC=""
23
+ MODE=""
21
24
 
22
25
  # Parse arguments
23
26
  while [[ $# -gt 0 ]]; do
@@ -38,6 +41,14 @@ while [[ $# -gt 0 ]]; do
38
41
  NAMESPACE="$2"
39
42
  shift 2
40
43
  ;;
44
+ --epic)
45
+ EPIC="$2"
46
+ shift 2
47
+ ;;
48
+ --mode)
49
+ MODE="$2"
50
+ shift 2
51
+ ;;
41
52
  *)
42
53
  # Legacy mode: positional arguments
43
54
  if [ -z "$TASK_ID" ]; then
@@ -54,10 +65,29 @@ done
54
65
  if [ -z "$TASK_ID" ]; then
55
66
  echo "Error: --task-id or TASK_ID required" >&2
56
67
  echo "Usage: $0 --task-id <id> --key <key> --value <value> [--namespace <ns>]" >&2
68
+ echo " or: $0 --task-id <id> --epic <epic> --mode <mode> [--namespace <ns>]" >&2
57
69
  echo " or: $0 <task_id> <context_json> (legacy)" >&2
58
70
  exit 1
59
71
  fi
60
72
 
73
+ # Handle epic+mode mode (new)
74
+ if [ -n "$EPIC" ] && [ -n "$MODE" ]; then
75
+ # Store epic and mode with task context
76
+ REDIS_KEY="${NAMESPACE}:${TASK_ID}:context"
77
+
78
+ redis-cli HSET "$REDIS_KEY" \
79
+ "epic" "$EPIC" \
80
+ "mode" "$MODE" \
81
+ "updated_at" "$(date -u +%Y-%m-%dT%H:%M:%SZ)" \
82
+ > /dev/null
83
+
84
+ # Set TTL (24 hours)
85
+ redis-cli EXPIRE "$REDIS_KEY" 86400 > /dev/null
86
+
87
+ echo "✅ Context stored: epic=$EPIC, mode=$MODE for task: $TASK_ID"
88
+ exit 0
89
+ fi
90
+
61
91
  # Handle structured mode (new)
62
92
  if [ -n "$KEY" ] && [ -n "$VALUE" ]; then
63
93
  # Store structured context with specific key
@@ -89,5 +119,5 @@ if [ -n "$CONTEXT" ]; then
89
119
  exit 0
90
120
  fi
91
121
 
92
- echo "Error: Either --key/--value or <context_json> required" >&2
122
+ echo "Error: Either --epic/--mode, --key/--value, or <context_json> required" >&2
93
123
  exit 1