orchestrator-implementation
Detailed implementation strategies for the four-tier orchestrator agent architecture including sub-agent definitions and group coordination protocols.
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
priRelated in AI Agents
skill-development
IncludedComprehensive meta-skill for creating, managing, validating, auditing, and distributing Claude Code skills and slash commands (unified in v2.1.3+). Provides skill templates, creation workflows, validation patterns, audit checklists, naming conventions, YAML frontmatter guidance, progressive disclosure examples, and best practices lookup. Use when creating new skills, validating existing skills, auditing skill quality, understanding skill architecture, needing skill templates, learning about YAML frontmatter requirements, progressive disclosure patterns, tool restrictions (allowed-tools), skill composition, skill naming conventions, troubleshooting skill activation issues, creating custom slash commands, configuring command frontmatter, using command arguments ($ARGUMENTS, $1, $2), bash execution in commands, file references in commands, command namespacing, plugin commands, MCP slash commands, Skill tool configuration, or deciding between skills vs slash commands. Delegates to docs-management skill for official documentation.
reprompter
IncludedTransform messy prompts into well-structured, effective prompts โ single or multi-agent. Use when: "reprompt", "reprompt this", "clean up this prompt", "structure my prompt", rough text needing XML tags and best practices, "reprompter teams", "repromptception", "run with quality", "smart run", "smart agents", multi-agent tasks, audits, parallel work, anything going to agent teams. Don't use when: simple Q&A, pure chat, immediate execution-only tasks. See "Don't Use When" section for details. Outputs: Structured XML/Markdown prompt, quality score (before/after), optional team brief + per-agent sub-prompts, agent team output files. Success criteria: Single mode quality score โฅ 7/10; Repromptception per-agent prompt quality score 8+/10; all required sections present, actionable and specific.
adaptive-compaction
IncludedAdaptive add-on policy and recovery layer that decides WHEN to compact, prune, snapshot, or fork -- replacing fixed-percent auto-compaction across Claude Code, Codex, and MCP-capable hosts. Trigger on auto-compact timing or damage: "when should I compact", "is it safe to compact now or start a fresh session", "auto-compact fires too early/mid-task", "switching to an unrelated task but the window still has space", "context rot", "answers get worse the longer the session runs", "the agent forgot the plan or my decisions after it summarized", "add a layer on top that manages context without changing the agent", raising autoCompactWindow to give the policy room, or installing/tuning a cross-tool compaction policy or PreCompact hook -- even when "compaction" is never said but the problem is context-window pressure or post-summarization memory loss. Do NOT use to summarize a conversation, build RAG, write a summarization prompt (decides WHEN not HOW), or answer max-context-length trivia.
agent-skill-creator
IncludedCreate cross-platform agent skills from workflow descriptions. Activates when users ask to create an agent, automate a repetitive workflow, create a custom skill, or need advanced agent creation. Triggers on phrases like create agent for, automate workflow, create skill for, every day I have to, daily I need to, turn process into agent, need to automate, create a cross-platform skill, validate this skill, export this skill, migrate this skill. Supports single skills, multi-agent suites, transcript processing, template-based creation, interactive configuration, cross-platform export, and spec validation.
llm-wiki
IncludedUse when building or maintaining a persistent personal knowledge base (second brain) in Obsidian where an LLM incrementally ingests sources, updates entity/concept pages, maintains cross-references, and keeps a synthesis current. Triggers include "second brain", "Obsidian wiki", "personal knowledge management", "ingest this paper/article/book", "build a research wiki", "compound knowledge", "Memex", or whenever the user wants knowledge to accumulate across sessions instead of being re-derived by RAG on every query.
skill-master
IncludedAgent Skills authoring, evaluation, and optimization. Create, edit, validate, benchmark, and improve skills following the agentskills.io specification. Use when designing SKILL.md files, structuring skill folders (references, scripts, assets), ingesting external documentation into skills, running trigger evals, benchmarking skill quality, optimizing descriptions, or performing blind A/B comparisons. Keywords: agentskills.io, SKILL.md, skill authoring, eval, benchmark, trigger optimization.