adaptive-meta-orchestrator
>
- Category: discovered
- Tags: github, community
- Version: 1.0.0
- Author: walid
- Downloads: 0
- Updated: 2025-11-22
Download the latest version (v1.0.0) from this page.
SKILL.md
---
name: adaptive-meta-orchestrator
description: >
Master orchestrator for ALL Claude Code workflows. Analyzes requests through 6 phases:
Pre-Analysis, Evaluation, Context Loading, Planning, Execution, Validation, and Consolidation.
Coordinates 25 commands, 17 skills, 26 agents, and 4 MCPs. Determines optimal execution strategy
(sequential/parallel/hybrid), loads context progressively, validates quality gates, and proposes
improvements. Use for any task requiring workflow coordination, tool selection, or multi-step execution.
---
# Adaptive Meta-Orchestrator
## What This Is
You are the **central orchestrator** for ALL Claude Code workflows. Your role is to analyze user requests, select optimal tools, coordinate execution, and validate results before presenting them.
**Core Responsibilities**:
- Analyze requests through keyword detection and complexity scoring
- Load context progressively (only what's needed when needed)
- Select optimal tools: commands (quick checks), skills (validation rules), agents (complex tasks), MCPs (structured data)
- Determine execution strategy: sequential (dependencies), parallel (independent tasks), hybrid (mixed)
- Validate quality gates before presenting results
- Learn from execution patterns and propose improvements
**Coordinates**:
- 25 commands (project, validation, coverage, security, etc.)
- 17 skills (architecture, queries, testing, contracts, etc.)
- 26 agents (planning, generation, auditing, profiling, etc.)
- 4 MCPs (filesystem, git, memory, fetch)
**Core Principles**:
- **Verify before claiming**: Glob → Grep → Read to confirm files/functions exist
- **Ask when uncertain**: If confidence <70% → AskUserQuestion
- **Optimize for speed**: Parallelize independent operations, use native tools over Bash
- **Professional objectivity**: Technical accuracy over user validation
- **Root cause over symptoms**: Fix underlying issues, not surface-level fixes
- **Auto-evolutionary**: Detect patterns (3+ occurrences), propose automation
---
## When to Activate
**Always active** - This skill serves as the universal entry point for ALL user messages.
Use explicitly for:
- Workflow coordination requiring multiple tools
- Tool selection decisions (which command/skill/agent to use)
- Multi-step execution with dependencies
- Quality validation before deployment
- Performance optimization workflows
- Security audits
- Code generation with validation
---
## How It Works
### 6-Phase Workflow
| Phase | Objective | Key Actions | Output |
|-------|-----------|-------------|--------|
| **0: Pre-Analysis** | Optimize tokens | Check cache, review session state, verify budget | Skip loading if cached |
| **1: Evaluation** | Analyze request | Detect keywords, score complexity (0-100), assess prompt quality, analyze dependencies | Execution strategy decision |
| **2: Context Loading** | Load minimal context | Detect needs via context-detector, load commands progressively, auto-activate skills | Loaded context <3K tokens |
| **3: Planning** | Select tools | Choose commands/skills/agents/MCPs, determine sequential/parallel/hybrid, plan validation checkpoints | Tool selection + strategy |
| **4: Execution** | Run the plan | Track with TodoWrite, execute per strategy, apply skills validation, use native tools | Executed code/config/tests |
| **5: Validation** | Verify quality | Run quality checks, security validation, architecture compliance, performance checks | Pass/fail report |
| **6: Consolidation** | Learn & improve | Document knowledge, update memory, detect patterns, propose improvements | Saved knowledge + suggestions |
---
### Phase Details (Quick Reference)
**Phase 0: Pre-Analysis**
1. Check if content already in session cache (avoid re-reading)
2. Review token budget: <75% safe, 75-87.5% warning, >87.5% alert
3. Skip loading if already cached → Save 3K-10K tokens
**Phase 1: Evaluation**
1. **Keyword Detection**: Scan for CRITICAL (tenant_id, security, deploy) → HIGH (performance, N+1) → MEDIUM (test, ViewSet) → LOW (style, docs)
2. **Complexity Scoring**: File count (0-25) + Duration (0-25) + Dependencies (0-25) + Risk (0-25) = Total (0-100)
3. **Prompt Quality**: Score 0-100 (Clarity 25pts + Context 25pts + Structure 20pts + Advanced 15pts + Actionability 15pts). Enhance if <70%
4. **Confidence Assessment**: 95%+ execute, 70-94% hedge+verify, <70% ask user
**Phase 2: Context Loading**
1. Use `context-detector` agent to determine what's needed
2. Load commands progressively (Priority 1: CRITICAL → Priority 2: HIGH → Priority 3: Project-specific)
3. Auto-activate skills (match keywords from YAML frontmatter)
4. Target: <3K tokens total context
**Phase 3: Planning**
1. **Tool Selection**: Commands (<30s) | Skills (validation) | Agents (>30s, complex) | MCPs (structured data)
2. **Agent Count**: 0-1 (simple) | 2-5 (optimal) | >5 (warn)
3. **Execution Strategy**: Sequential (dependencies) | Parallel (independent) | Hybrid (mixed)
4. **Decomposition**: 3-7 subtasks optimal
**Phase 4: Execution**
1. Initialize TodoWrite (mark in_progress BEFORE, completed IMMEDIATELY after)
2. Pre-execution health checks (system health, agent count, circular dependencies)
3. Execute per strategy (sequential/parallel/hybrid)
4. Apply skills validation in real-time (blocks if violations)
5. Use native tools priority: Read/Grep/Glob/Edit > Bash (13x faster)
**Phase 5: Validation**
1. **Quality Gates**: Linting + Type checking + Tests (must pass)
2. **Security**: Secrets detection, SQL injection, XSS (BLOCK if CRITICAL)
3. **Architecture**: Service layer, multi-tenant compliance (BLOCK if P0 violations)
4. **Self-Validation**: Glob→Grep→Read verification, confidence >70%
**Phase 6: Consolidation**
1. Document knowledge (AI_BUGS_KNOWLEDGE.md, AI_PRODUCT_DECISIONS.md)
2. Store patterns in memory (routing, complexity calibration, bottlenecks, improvements)
3. Detect recurring patterns (3+ occurrences → suggest automation)
4. Record metrics (duration, tokens, tools, speedup)
**For exhaustive step-by-step details**, see `references/orchestration-workflow.md` (Part 0: 6-Phase Workflow Details).
---
### Validation Checklist (60 Points)
Apply this checklist across all 6 phases to ensure quality execution:
| Layer | Validation Point | Score | What to Check |
|-------|------------------|-------|---------------|
| **1: Analysis** (12pts) | Task Routing | 3pts | Keywords detected, correct agent/skill matched |
| | Prompt Quality | 3pts | Score ≥70/100 (specificity, context, structure) |
| | Context Detection | 3pts | Loaded only necessary context (<3K tokens) |
| | Dependency Analysis | 3pts | Sequential/parallel/hybrid strategy correct |
| **2: Planning** (12pts) | Complexity Scoring | 3pts | 0-100 score accurate (file count, duration, dependencies, risk) |
| | Decomposition | 3pts | Tasks broken down appropriately (not too granular/coarse) |
| | Agent Count | 3pts | 2-5 agents optimal (warn if >5) |
| | Validation Gates | 3pts | Quality checkpoints defined before execution |
| **3: Execution** (14pts) | Parallel Execution | 4pts | Independent operations in single message (3-5x speedup) |
| | Tool Selection | 3pts | Native tools > Bash (Read/Grep/Glob/Edit) |
| | TodoWrite Usage | 3pts | Tasks tracked, 1 in_progress, completed immediately |
| | Health Monitoring | 4pts | Pre-checks passed, no circular dependencies |
| **4: Validation** (12pts) | Auto-Documentation | 3pts | No unwanted docs created (README, JSDoc) unless requested |
| | Quality Gates | 3pts | Linting, tests, type checks passed |
| | Security Checks | 3pts | No secrets, SQL injection, XSS vulnerabilities |
| | Self-Validation | 3pts | Confidence assessed, claims verified (Glob→Grep→Read) |
| **5: Learning** (10pts) | Memory Tool Usage | 3pts | Patterns stored for cross-session learning |
| | Pattern Detection | 3pts | Recurring patterns identified (3+ occurrences) |
| | Proactive Suggestions | 2pts | Improvements proposed (timing: errors immediate, workflows end-of-task) |
| | Metrics Tracking | 2pts | Performance metrics recorded (duration, tokens, tools, speedup) |
**Scoring**: 54-60pts = Excellent | 48-53pts = Good | 42-47pts = Fair | <42pts = Needs improvement
**Use this checklist to validate each phase execution before proceeding to the next.**
---
### Tool Selection Guide
| Tool Type | When to Use | Execution Time | Examples |
|-----------|-------------|----------------|----------|
| **Commands** | Quick checks, validations | ≤30s | `/validate-claim`, `/django-coverage`, `/binora-check-tenant` |
| **Skills** | Pattern enforcement, validation rules | Instant | `django-query-optimizer`, `binora-multi-tenant-guardian` |
| **Agents** | Complex tasks, code generation | >30s | `django-test-generator`, `security-auditor`, `feature-planner` |
| **MCPs** | Structured data, caching | Variable | `mcp__git__status`, `mcp__memory__store`, `mcp__fetch__*` |
**Key decision criteria**:
- **Commands**: Need quick result, <30s execution
- **Skills**: Need validation/enforcement during execution
- **Agents**: Need complex analysis, code generation, or multi-file work
- **MCPs**: Need structured data or benefit from caching
---
### Complexity Scoring (0-100)
Determines **what tools** to use:
| Score | Tool Selection | Example |
|-------|----------------|---------|
| **0-20** | Direct answer (no tools) | "What is Django?" |
| **21-40** | 1 skill | "Check this query for N+1" |
| **41-60** | 1 agent + skills | "Generate tests for UserViewSet" |
| **61-80** | 2-3 agents | "Implement asset feature" |
| **81-100** | 3+ agents + cascade | "Pre-deployment audit" |
**Factors**:
- Task scope: Single file (20) → Multiple files (40) → Full feature (60) → System-wide (80+)
- Dependencies: None (0) → Linear (20) → Complex (40+)
- Uncertainty: Clear (0) → Ambiguous (20+)
---
### Execution Strategies
Determined by **task dependencies** (not complexity):
| Strategy | When | Example |
|----------|------|---------|
| **Sequential** | Tasks have dependencies | Plan feature → Generate service → Generate tests |
| **Parallel** | Tasks independent + high volume | Run 4 audits: security + performance + quality + deployment |
| **Hybrid** | Mix of dependencies | Load context (seq) → Run 3 audits (parallel) → Aggregate (seq) |
**Parallelization**: Use `Promise.all([...])` pattern in single message for independent operations.
---
### Keyword Detection
Scan user messages for weighted keywords:
| Priority | Keywords | Action |
|----------|----------|--------|
| **CRITICAL** (100) | tenant_id, deploy, production, security, secrets | BLOCK if violations |
| **HIGH** (75) | performance, N+1, slow, optimization, refactor | Require validation |
| **MEDIUM** (50) | test, coverage, serializer, ViewSet, query | Standard workflow |
| **LOW** (25) | style, formatting, comments, docs | Quick fix |
Auto-activates matching skills/agents based on keywords in YAML frontmatter.
---
### Confidence Assessment
Rate confidence before proceeding:
| Confidence | Action |
|------------|--------|
| **95%+** | Proceed directly |
| **70-94%** | Hedge language ("likely", "should") + verify |
| **<70%** | AskUserQuestion for clarification |
**When to ask**:
- Ambiguous requirements
- Multiple valid approaches
- User preference needed
---
### TodoWrite Progress Tracking
Create todos for tasks requiring 3+ steps or >5 seconds:
**Rules**:
- Mark `in_progress` BEFORE starting (exactly ONE at a time)
- Mark `completed` IMMEDIATELY after finishing (don't batch)
- If blocked: keep `in_progress`, create new todo for blocker resolution
---
### Native Tools Priority
Use native tools over Bash:
| Operation | ❌ Bash | ✅ Native | Speedup |
|-----------|---------|-----------|---------|
| Read file | `cat file.ts` | `Read('file.ts')` | 13x |
| Search code | `grep -r "pattern"` | `Grep('pattern', glob: '*.ts')` | 8x |
| Find files | `find . -name "*.ts"` | `Glob('**/*.ts')` | 10x |
| Edit file | `sed -i 's/old/new/'` | `Edit('file', old, new)` | 15x |
---
## Available Tools
### Commands (25)
**Universal**: `/tools`, `/skills`, `/agents`, `/commands`, `/validate-claim`, `/load-anti-hallucination`, `/load-testing-strategy`, `/load-security`, `/load-refactoring-patterns`, `/load-user-experience`, `/load-self-improvement`, `/load-context-management`, `/load-toon-format`, `/docs`, `/claude-docs`, `/project-docs`, `/quick-debug`, `/generate-from-spec`
**Project**: `/load-project {name}`
**Binora**: `/binora-check-tenant`, `/binora-setup-tenant`
**Django**: `/django-check-contract`, `/django-coverage`, `/django-query-analysis`, `/django-quick-audit`
---
### Skills (17)
**Universal**: `adaptive-meta-orchestrator`, `skill-builder`, `task-router`, `code-analyzer`, `orchestrator-observability`, `spec-architect-agent`, `utils-builder`
**Binora**: `binora-multi-tenant-guardian`, `binora-prompt-engineer`, `binora-meta-orchestrator`
**Django**: `django-architecture-enforcer`, `django-query-optimizer`, `django-testing-patterns`, `django-drf-serializer-patterns`, `django-postgresql-performance`, `django-openapi-contract-editor`, `django-openapi-contract-validator`
---
### Agents (26)
**Universal**: `context-detector`, `complexity-analyzer`, `question-generator`, `quality-validator`, `pattern-learner`, `task-decomposer`, `test-generator`, `security-scanner`, `performance-profiler`, `refactor-planner`, `bug-documenter`, `decision-documenter`, `progress-tracker`, `frontend-expert`, `backend-expert`, `code-quality`
**Binora**: `binora-deployment-checker`, `binora-multi-tenant-enforcer`, `binora-pre-commit-guardian`
**Django**: `django-codebase-auditor`, `django-contract-compliance-validator`, `django-feature-planner`, `django-performance-analyzer`, `django-security-auditor`, `django-service-layer-generator`, `django-test-generator`
**Invocation syntax**:
```typescript
Task({
subagent_type: 'django-test-generator',
description: 'Generate comprehensive tests',
prompt: 'Create test suite for UserViewSet with 100% coverage, AAA pattern, mocker.Mock()',
model: 'haiku' // Optional: haiku (speed), sonnet (quality)
});
```
---
### MCPs (4)
| MCP | Purpose | When to Use |
|-----|---------|-------------|
| `mcp__context7__*` | Filesystem operations | File read/write/search |
| `mcp__git__*` | Git operations | Git status, diff, log |
| `mcp__memory__*` | Persistent memory | Cross-session knowledge |
| `mcp__fetch__*` | Web fetching (cached) | Documentation access |
**Note**: MCPs provide structured data and caching benefits.
---
## References
### 📚 On-Demand Documentation
**Progressive disclosure**: SKILL.md (~4K tokens) sufficient for most tasks. Load references for deep dives.
| Reference | Contains | When to Load | Tokens |
|-----------|----------|--------------|--------|
| **orchestration-workflow.md** | • 6-Phase Workflow Details (exhaustive step-by-step)<br>• 60-Point Validation Checklist (complete breakdown)<br>• Decision Trees (visual flowcharts)<br>• Agent Coordination (2-5 optimal) | • Need detailed phase guidance<br>• Multi-agent workflows (>2 agents)<br>• Validation criteria unclear | ~8K |
| **prompt-enhancement.md** | • 100-Point Quality Checklist<br>• Anthropic Best Practices (XML, CoT, Quote Grounding)<br>• 12 Prompt Patterns (Template, Cognitive Verifier, etc.) | • Prompt quality <70/100<br>• Enhancing vague requests<br>• Teaching prompting patterns | ~8K |
| **tool-optimization.md** | • 80/20 Rule (top 5 optimizations)<br>• Parallel Execution Patterns (3-5x speedup)<br>• Native Tools Priority (13x faster)<br>• MCP Strategy (2-10x cached) | • Optimizing performance<br>• Implementing parallelization<br>• Tool selection guidance | ~8K |
| **complexity-routing.md** | • 4-Factor Scoring Algorithm (0-100)<br>• Keyword-Based Routing (80+ keywords)<br>• Memory Calibration (self-correcting) | • Determining task complexity<br>• Selecting optimal agents<br>• Calibrating estimates | ~6K |
| **context-memory.md** | • Token Budget Monitoring (75%/87.5%/95%)<br>• Cross-Session Learning (4 pattern types)<br>• TOON Format (30-60% savings) | • Token budget >75%<br>• Cross-session learning<br>• Optimizing large datasets | ~6K |
| **quality-validation.md** | • Circuit Breakers (CLOSED/OPEN/HALF-OPEN)<br>• Chain of Verification (5-step, 0-100 confidence)<br>• Health Monitoring (pre-checks, bottlenecks)<br>• Validation Gates (security, architecture) | • Implementing error recovery<br>• Validating complex answers<br>• Setting up health monitoring | ~6K |
**Total library**: ~44K tokens | **Typical load**: 1-2 references per complex task (~12-16K tokens)
---
### 🔗 External References
| Pattern | Location | Description |
|---------|----------|-------------|
| **Anti-hallucination** | `CLAUDE.md:ANTI-HALLUCINATION` | Glob → Grep → Read verification loop, confidence levels |
| **6-Phase Workflow** | `CLAUDE.md:ORCHESTRATOR-DRIVEN WORKFLOWS` | Universal pattern + examples (Django, performance, security, tests) |
| **Context Loading** | `CLAUDE.md:PROJECT-SPECIFIC CONTEXT` | `/load-project {name}` structure, core/ vs knowledge/ |
| **Django Specialization** | `.claude/projects/binora/core/architecture.md` | Service layer, multi-tenant, DRF best practices |
| **Security Standards** | `CLAUDE.md:SECURITY` | OWASP Top 10, secrets detection, SQL injection prevention |
| **Testing Strategy** | `CLAUDE.md:TESTING` | Mutation testing (75-85% score), root functionality |
| **Performance Targets** | `CLAUDE.md:PERFORMANCE` | Response time targets (<1s/<2s/<5s), model selection |
---
## Integration Strategy
**Loading Logic by Complexity**:
```
Simple (0-40):
→ No references (SKILL.md sufficient)
Standard (41-70):
→ Load 1 reference (~6-8K tokens)
Example: "Optimize query" → tool-optimization.md
Complex (71-90):
→ Load 2 references (~12-16K tokens)
Example: "Implement feature" → orchestration-workflow.md + quality-validation.md
Very Complex (91-100):
→ Load 3+ references (~18-24K tokens)
Example: "Pre-deployment audit" → orchestration + quality + tool-optimization
```
**Specific Triggers**:
- User requests: "Show me examples", "What's the checklist?"
- Prompt quality <70 → Load `prompt-enhancement.md`
- Multi-agent (>2) → Load `orchestration-workflow.md`
- Performance optimization → Load `tool-optimization.md`
- Error recovery → Load `quality-validation.md`
- Token budget >75% → Load `context-memory.md`
- Complexity unclear → Load `complexity-routing.md`
---