Orchestration

From masharratt/claude-flow-novice · View interactive version

Orchestration is an AI agent skill from the GitHub repository masharratt/claude-flow-novice. **Purpose:** Orchestrate container-based CFN Loop execution with agent spawning, loop management, consensus collection, and product owner decision flow.

How to use this skill

Skill file

CFN Docker Loop Orchestration Skill

Purpose: Orchestrate container-based CFN Loop execution with agent spawning, loop management, consensus collection, and product owner decision flow.

Overview

This skill manages the complete CFN Loop execution lifecycle for docker-based agents, coordinating Loop 3 (implementer) and Loop 2 (validator) phases, collecting confidence scores and consensus, and triggering Product Owner decisions.

Architecture

CFN Docker V3 Coordinator
    ↓ (task analysis)
CFN Docker Loop Orchestration
    ↓ (context storage)
Redis (State Management)
    ↓ (agent spawning)
CFN Docker Agent Spawning
    ↓ (container execution)
Docker Containers (Agents)
    ↓ (completion signals)
Consensus Collection
    ↓ (decision flow)
Product Owner Decision

Loop Execution Model

Loop 3: Primary Implementation (Implementers)

Loop 2: Consensus Validation (Validators)

Loop 4: Product Owner Decision

Core Functions

1. Task Analysis and Context Setup

Analyze task requirements and prepare execution context:

# Initialize loop orchestration
cfn-docker-loop-orchestration init \
  --task-id task-authentication \
  --task-description "Implement user authentication system" \
  --mode standard \
  --max-iterations 5

2. Loop 3 Agent Spawning

Spawn implementer agents based on task requirements:

# Spawn Loop 3 implementers
cfn-docker-loop-orchestration spawn-loop3 \
  --task-id task-authentication \
  --agents backend-developer,frontend-engineer,security-specialist \
  --context "${TASK_CONTEXT}"

3. Loop 3 Completion Monitoring

Monitor implementer progress and collect confidence scores:

# Monitor Loop 3 completion
cfn-docker-loop-orchestration monitor-loop3 \
  --task-id task-authentication \
  --wait-for-complete \
  --gate-threshold 0.75

4. Gate Check and Decision

Evaluate Loop 3 results and decide next steps:

# Check Loop 3 gate
cfn-docker-loop-orchestration gate-check \
  --task-id task-authentication \
  --gate-threshold 0.75 \
  --max-iterations 5

5. Loop 2 Validator Spawning

Spawn validator agents if gate passed:

# Spawn Loop 2 validators
cfn-docker-loop-orchestration spawn-loop2 \
  --task-id task-authentication \
  --agents reviewer,tester,security-specialist \
  --loop3-work "${WORK_SUMMARY}"

6. Consensus Collection

Collect and analyze validator consensus:

# Collect Loop 2 consensus
cfn-docker-loop-orchestration collect-consensus \
  --task-id task-authentication \
  --required-consensus 0.90 \
  --timeout 300

7. Product Owner Decision

Trigger final decision process:

# Trigger Product Owner decision
cfn-docker-loop-orchestration trigger-po-decision \
  --task-id task-authentication \
  --consensus-data "${CONSENSUS_RESULTS}"

Loop Management

Iteration Control

# Control loop iterations
cfn-docker-loop-orchestration control-iterations \
  --task-id task-authentication \
  --current-iteration 2 \
  --max-iterations 5 \
  --gate-threshold 0.75 \
  --consensus-threshold 0.90

Adaptive Agent Selection

# Select agents based on iteration and feedback
cfn-docker-loop-orchestration select-adaptive-agents \
  --task-id task-authentication \
  --iteration 2 \
  --previous-feedback "${FEEDBACK_DATA}"

Error Handling and Recovery

# Handle execution errors
cfn-docker-loop-orchestration handle-errors \
  --task-id task-authentication \
  --error-type agent-failure \
  --failed-agent-id agent-backend-001 \
  --restart-strategy adaptive

Configuration Modes

MVP Mode (Quick Execution)

cfn-docker-loop-orchestration execute \
  --task-id task-authentication \
  --mode mvp \
  --max-iterations 3 \
  --gate-threshold 0.70 \
  --consensus-threshold 0.80 \
  --validators 2

Standard Mode (Balanced)

cfn-docker-loop-orchestration execute \
  --task-id task-authentication \
  --mode standard \
  --max-iterations 10 \
  --gate-threshold 0.75 \
  --consensus-threshold 0.90 \
  --validators 3

Enterprise Mode (Thorough)

cfn-docker-loop-orchestration execute \
  --task-id task-authentication \
  --mode enterprise \
  --max-iterations 15 \
  --gate-threshold 0.85 \
  --consensus-threshold 0.95 \
  --validators 5

Agent Selection Strategy

Task-Based Agent Selection

# Analyze task and select appropriate agents
cfn-docker-loop-orchestration analyze-and-select \
  --task-description "Implement secure user authentication" \
  --output-agent-types

Skill-Based Selection

# Select agents based on required skills
cfn-docker-loop-orchestration select-by-skills \
  --required-skills "security,backend-development,frontend-development" \
  --agent-count 3

Experience-Based Selection

# Select agents based on previous performance
cfn-docker-loop-orchestration select-by-experience \
  --task-domain authentication \
  --success-threshold 0.85

Integration with CFN Docker Skills

Redis Coordination Integration

# Store loop state in Redis
cfn-docker-redis-coordination store-loop-state \
  --task-id task-authentication \
  --loop-number 3 \
  --iteration 1 \
  --state "in-progress"

# Retrieve loop state
cfn-docker-redis-coordination get-loop-state \
  --task-id task-authentication \
  --loop-number 3

Agent Spawning Integration

# Spawn agents with MCP configuration
cfn-docker-agent-spawn batch \
  --agent-types backend-developer,frontend-engineer \
  --task-id task-authentication \
  --mcp-auto-select

Skill Selection Integration

# Configure MCP access for agents
for agent_type in backend-developer frontend-engineer; do
  cfn-docker-skill-mcp-selector configure \
    --agent-type $agent_type \
    --task-id task-authentication
done

Monitoring and Observability

Loop Progress Monitoring

# Monitor overall loop progress
cfn-docker-loop-orchestration monitor-progress \
  --task-id task-authentication \
  --real-time \
  --include-agents

# Monitor specific loop
cfn-docker-loop-orchestration monitor-loop \
  --task-id task-authentication \
  --loop-number 3 \
  --detailed

Performance Metrics

# Collect performance metrics
cfn-docker-loop-orchestration metrics \
  --task-id task-authentication \
  --include-timing \
  --include-resource-usage \
  --include-confidence-trends

Agent Performance Tracking

# Track agent performance across loops
cfn-docker-loop-orchestration agent-performance \
  --task-id task-authentication \
  --agent-id agent-backend-001 \
  --all-iterations

Decision Flow Logic

Gate Check Algorithm

  1. Collect Confidence Scores: Gather all Loop 3 confidence scores
  2. Calculate Average: Compute mean confidence score
  3. Check Threshold: Compare against gate threshold
  4. Decision Logic:

Consensus Validation Algorithm

  1. Collect Validator Feedback: Gather all Loop 2 validator responses
  2. Calculate Consensus: Compute average confidence and agreement level
  3. Check Threshold: Compare against consensus threshold
  4. Decision Logic:

Product Owner Decision Triggers

  1. High Consensus (≥0.95): AUTO-COMPLETE
  2. Good Consensus (≥threshold): PROCEED to Product Owner
  3. Low Consensus (<threshold): ITERATE with specific feedback

Error Handling Strategies

Agent Failure Handling

# Handle agent container failure
cfn-docker-loop-orchestration handle-agent-failure \
  --task-id task-authentication \
  --failed-agent-id agent-backend-001 \
  --strategy respawn \
  --backup-agent-type backend-developer

Timeout Handling

# Handle loop timeouts
cfn-docker-loop-orchestration handle-timeout \
  --task-id task-authentication \
  --loop-number 3 \
  --timeout-extension 300

MCP Server Failures

# Handle MCP server connectivity issues
cfn-docker-loop-orchestration handle-mcp-failure \
  --task-id task-authentication \
  --failed-mcp playwright \
  --fallback direct-tools

Performance Optimization

Parallel Execution

Adaptive Iteration

Resource Optimization

Quality Assurance

Deliverable Validation

# Validate required deliverables created
cfn-docker-loop-orchestration validate-deliverables \
  --task-id task-authentication \
  --required-files "auth-service.js,login.html" \
  --acceptance-criteria "${CRITERIA}"

Code Quality Checks

# Run automated quality checks
cfn-docker-loop-orchestration quality-check \
  --task-id task-authentication \
  --include-linting \
  --include-security-scan \
  --include-tests

Integration Testing

# Run integration tests for complete solution
cfn-docker-loop-orchestration integration-test \
  --task-id task-authentication \
  --test-suite authentication-tests

Best Practices

Loop Design

Agent Selection

Error Recovery

Configuration

Environment Variables

# Loop configuration
CFN_DOCKER_MAX_ITERATIONS=10
CFN_DOCKER_GATE_THRESHOLD=0.75
CFN_DOCKER_CONSENSUS_THRESHOLD=0.90
CFN_DOCKER_LOOP_TIMEOUT=600

# Agent configuration
CFN_DOCKER_MAX_CONCURRENT_AGENTS=5
CFN_DOCKER_AGENT_TIMEOUT=300
CFN_DOCKER_CONTAINER_MEMORY_LIMIT=1g

# Decision configuration
CFN_DOCKER_AUTO_COMPLETE_THRESHOLD=0.95
CFN_DOCKER_FORCE_ITERATION_THRESHOLD=0.60

Loop Configuration File

{
  "loopConfig": {
    "maxIterations": 10,
    "gateThreshold": 0.75,
    "consensusThreshold": 0.90,
    "loopTimeouts": {
      "loop3": 600,
      "loop2": 300,
      "productOwner": 180
    }
  },
  "agentConfig": {
    "maxConcurrentAgents": 5,
    "defaultMemoryLimit": "1g",
    "defaultCpuLimit": 1.0,
    "restartPolicy": "on-failure"
  },
  "decisionConfig": {
    "autoCompleteThreshold": 0.95,
    "forceIterationThreshold": 0.60,
    "enableAdaptiveSelection": true
  }
}
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.