Claude
Skills
Sign in
โ† Back

orchestrator-implementation

Included with Lifetime
$97 forever

Detailed implementation strategies for the four-tier orchestrator agent architecture including sub-agent definitions and group coordination protocols.

AI Agents

What this skill does


# Orchestrator Implementation Reference

This skill provides detailed implementation guidance for the orchestrator agent.
It covers sub-agent definitions, group coordination, and the complete four-tier
workflow. The orchestrator agent will reference this skill when detailed
implementation context is needed.

## Implementation Strategy

### Phase 1: Four-Tier Architecture Foundation (v6.2.0)
- Implement core four-tier workflow system
- Create new specialized agents for each tier
- Enhance existing learning systems for four-tier support
- Maintain full backward compatibility

### Phase 2: Advanced Features (v6.3.0)
- Cross-tier learning acceleration
- Advanced performance optimization
- Enhanced user personalization across tiers
- Predictive decision-making capabilities

### Phase 3: AI-Driven Optimization (v6.4.0)
- Machine learning integration for tier selection
- Predictive performance optimization
- Advanced cross-tier knowledge synthesis
- Real-time adaptation and improvement

**Integration with Existing Systems**:
- **Pattern Learning**: Both tiers contribute to `.claude-patterns/patterns.json`
- **Agent Performance**: Individual agent metrics in `.claude-patterns/agent_performance.json`
- **Agent Feedback**: Cross-tier communication in `.claude-patterns/agent_feedback.json`
- **User Preferences**: Learned preferences in `.claude-patterns/user_preferences.json`

**Benefits of Two-Tier Architecture**:
- [OK] **Separation of Concerns**: Analysis vs Execution clearly separated
- [OK] **Better Decisions**: Tier 2 evaluates multiple Tier 1 recommendations
- [OK] **Continuous Learning**: Explicit feedback loops between tiers
- [OK] **User Adaptation**: Tier 2 incorporates learned user preferences
- [OK] **Independent Growth**: Each agent improves its specialized skills
- [OK] **Risk Mitigation**: Analysis identifies risks before execution

### 1. Autonomous Task Analysis
When receiving a task:
- Analyze the task context and requirements independently
- Identify the task category (coding, refactoring, documentation, testing, optimization)
- Determine project scope and complexity level
- Make autonomous decisions about approach without asking for confirmation
- **NEW**: Explicitly delegate to Tier 1 (Analysis) agents first, then Tier 2 (Execution) agents

### 2. Intelligent Skill Auto-Selection with Model Adaptation
Automatically select and load relevant skills based on model capabilities and task context:

**Model-Adaptive Skill Loading**:

**Claude Models (Sonnet/4.5)** - Progressive Disclosure:
```javascript
// Load skill metadata first, then full content based on context
const skillLoadingStrategy = {
  claude: {
    approach: "progressive_disclosure",
    context_aware: true,
    weight_based: true,
    merging_enabled: true
  }
}
```

**GLM Models** - Complete Loading:
```javascript
// Load complete skill content upfront with clear structure
const skillLoadingStrategy = {
  glm: {
    approach: "complete_loading",
    explicit_criteria: true,
    priority_sequenced: true,
    structured_handoffs: true
  }
}
```

**Universal Pattern Recognition**:
- Analyze historical patterns from the project
- **CRITICAL**: Check if `.claude-patterns/` directory exists and contains data before loading
- Review `.claude-patterns/` directory for learned patterns ONLY if they exist
- **EMPTY PATTERN HANDLING**: If no patterns exist, use default skill loading without caching
- Match current task against known successful approaches (skip if no patterns available)
- Auto-load skills that have proven effective for similar tasks (skip if no history)

**๐Ÿšจ CRITICAL: Empty Pattern Prevention - ENFORCED VALIDATION**:
```javascript
// COMPREHENSIVE validation before applying cache_control
function validateContentForCaching(content) {
  // Handle null/undefined
  if (content === null || content === undefined) {
    return false;
  }

  // Convert to string if it's not already
  const contentStr = String(content);

  // Check for empty string
  if (contentStr.length === 0) {
    return false;
  }

  // Check for whitespace-only string
  if (contentStr.trim().length === 0) {
    return false;
  }

  // Check for minimal meaningful content (at least 5 characters)
  if (contentStr.trim().length < 5) {
    return false;
  }

  // Check for common empty indicators
  const emptyIndicators = ['null', 'undefined', '[]', '{}', 'none', 'empty'];
  if (emptyIndicators.includes(contentStr.trim().toLowerCase())) {
    return false;
  }

  return true;
}

// SAFE pattern loading with cache_control
if (validateContentForCaching(existingPatterns)) {
  // ONLY add with caching if content passes validation
  messages.push({
    type: "text",
    text: String(existingPatterns),
    /* cache_control removed for emergency fix */
  });
} else {
  // ALWAYS provide meaningful fallback content
  messages.push({
    type: "text",
    text: "Pattern learning will be initialized after first task execution. Using default skill selection for optimal results.",
    /* cache_control removed for emergency fix */
  });
}
```

**Context Analysis**:
- Scan project structure and technologies
- Identify programming languages, frameworks, and tools in use
- Select skills matching the technology stack
- **EMPTY CONTENT PREVENTION**: Only load skills if framework/language data exists
- Load domain-specific knowledge automatically (with fallback defaults if empty)

**Model-Enhanced Skill Loading Strategy**:
```
IF current model = "claude-sonnet-4.5":
  โ†’ Use progressive disclosure with context merging
  โ†’ Apply weight-based skill ranking
  โ†’ Enable cross-skill synergy detection

IF current model = "claude-haiku-4.5":
  โ†’ Use selective disclosure with fast loading
  โ†’ Apply efficient skill prioritization
  โ†’ Enable focused skill deployment

IF current model = "claude-opus-4.1":
  โ†’ Use intelligent progressive disclosure with prediction
  โ†’ Apply advanced weight-based skill ranking
  โ†’ Enable enhanced cross-skill synergy detection

IF current model = "glm-4.6":
  โ†’ Use complete upfront loading
  โ†’ Apply priority-based sequencing
  โ†’ Use explicit skill selection criteria

IF task involves Python:
  โ†’ Auto-load: code-analysis, quality-standards
  โ†’ **PATTERN LEARNING**: Only load if patterns exist (check .claude-patterns/patterns.json)
IF task involves testing:
  โ†’ Auto-load: testing-strategies
IF task involves documentation:
  โ†’ Auto-load: documentation-best-practices
IF refactoring detected:
  โ†’ Auto-load: code-analysis
  โ†’ **PATTERN LEARNING**: Only load if patterns exist (check .claude-patterns/patterns.json)
IF cross-model compatibility needed:
  โ†’ Auto-load: model-detection
IF GUI development detected (dashboard, web app, UI, frontend):
  โ†’ Auto-load: gui-design-principles, quality-standards
  โ†’ **PATTERN LEARNING**: Only load if patterns exist (check .claude-patterns/patterns.json)

**ENFORCED FIRST RUN HANDLING - EXECUTE SUBPROCESS**:
```python
# MANDATORY: Execute this subprocess call to validate pattern loading
# This ensures pattern learning is only enabled when safe

import subprocess
import sys
from pathlib import Path

def enforce_pattern_safety():
    """Execute the pattern safety script and return status."""

    # Find and execute safety script
    safety_script = Path("lib/pattern_loading_safety.py")

    if not safety_script.exists():
        # Fallback: check manually if script doesn't exist
        patterns_file = Path(".claude-patterns/patterns.json")
        if patterns_file.exists():
            try:
                with open(patterns_file, 'r') as f:
                    data = f.read().strip()
                SKIP_PATTERN_LEARNING = len(data) < 50  # Very basic check
                print(f"[FALLBACK] Pattern learning: {'ENABLED' if not SKIP_PATTERN_LEARNING else 'DISABLED'}")
            except:
                SKIP_PATTERN_LEARNING = True
                print("[FALLBACK] Pattern learning DISABLED: Error reading patterns")
        else:
            SKIP_PATTERN_LEARNING = True
            pri

Related in AI Agents