
orchestrator
by alfredolopez80
v2.66.8 - Multi-Agent Ralph Wiggum: Smart orchestration with adversarial validation (22 issues fixed), SEC-053 compliant, Dynamic Contexts, Plan Lifecycle CLI, Task Primitive integration, 55 hooks, 266+ skills
SKILL.md
VERSION: 2.47.2
name: orchestrator description: "Full orchestration workflow with Smart Memory-Driven context (v2.47), RLM-inspired routing (v2.46), and quality gates: clarify, smart memory search, classify 3D, plan, delegate, execute with parallel memory, validate quality-first, retrospect. Use when: (1) implementing features, (2) complex refactoring, (3) multi-file changes, (4) tasks requiring coordination. Triggers: /orchestrator, /orch, 'orchestrate', 'full workflow', 'implement feature'." context: fork user-invocable: true agent: orchestrator allowed-tools:
- Task
- AskUserQuestion
- EnterPlanMode
- ExitPlanMode
- TodoWrite
- Read
- Edit
- Write
- Bash
- Glob
- Grep
- mcp__plugin_claude-mem_*
hooks:
SessionStart:
- path: ~/.claude/hooks/orchestrator-init.sh once: true PreToolUse:
- event: "Task" path: ~/.claude/hooks/smart-memory-search.sh PostToolUse:
- event: "Task" path: ~/.claude/hooks/parallel-explore.sh Stop:
- path: ~/.claude/hooks/orchestrator-report.sh
Orchestrator - Multi-Agent Ralph v2.52
Smart Memory-Driven Orchestration with parallel memory search, RLM-inspired routing, and quality-first validation.
Based on @PerceptualPeak Smart Forking concept:
"Why not utilize the knowledge gained from your hundreds/thousands of other Claude code sessions? Don't let that valuable context go to waste!!"
Quick Start
# Via skill invocation
/orchestrator Implement OAuth2 authentication with Google
# Via CLI
ralph orch "Migrate database from MySQL to PostgreSQL"
Core Workflow (v2.52.0 - 8 Major Steps, 23 Sub-steps)
Step 0: EVALUATE (3-Dimension Classification)
0a. Classification (v2.46 RLM):
| Dimension | Values | Purpose |
|---|---|---|
| Complexity | 1-10 | Scope, risk, ambiguity |
| Information Density | CONSTANT / LINEAR / QUADRATIC | How answer scales |
| Context Requirement | FITS / CHUNKED / RECURSIVE | Decomposition needs |
0b. SMART MEMORY SEARCH (v2.47 NEW):
┌────────────────────────────────────────────────────────────────┐
│ SMART MEMORY SEARCH (PARALLEL) │
├────────────────────────────────────────────────────────────────┤
│ │
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐ │
│ │claude-mem│ │ memvid │ │ handoffs │ │ ledgers │ │
│ └────┬─────┘ └────┬─────┘ └────┬─────┘ └────┬─────┘ │
│ │ PARALLEL │ PARALLEL │ PARALLEL │ PARALLEL │
│ └────────────┴────────────┴────────────┘ │
│ ↓ │
│ .claude/memory-context.json │
│ ├── past_successes │
│ ├── past_errors │
│ ├── recommended_patterns │
│ └── fork_suggestions (top 5) │
└────────────────────────────────────────────────────────────────┘
AUTOMATIC: Triggered by PreToolUse hook on Task invocation.
Workflow Routing:
| Density | Context | Complexity | Route |
|---|---|---|---|
| CONSTANT | FITS | 1-3 | FAST_PATH (3 steps) |
| CONSTANT | FITS | 4-10 | STANDARD |
| LINEAR | CHUNKED | ANY | PARALLEL_CHUNKS |
| QUADRATIC | ANY | ANY | RECURSIVE_DECOMPOSE |
Step 0c: FAST_PATH Decision
If FAST_PATH eligible (complexity <= 3, CONSTANT, FITS):
DIRECT_EXECUTE -> MICRO_VALIDATE -> DONE (3 steps)
Otherwise, continue to Step 1.
Step 1: CLARIFY (Memory-Enhanced)
AUTOMATIC TLDR + MEMORY CONTEXT:
# 1. Check memory context for similar past implementations
cat .claude/memory-context.json | jq '.fork_suggestions[:3]'
# 2. Semantic search for existing code
tldr semantic "$USER_TASK_KEYWORDS" .
MUST_HAVE Questions (Blocking):
AskUserQuestion:
questions:
- question: "What is the primary goal?"
header: "Goal"
options:
- label: "New feature"
- label: "Bug fix"
- label: "Refactoring"
- label: "Performance"
Step 1b: GAP-ANALYST (Memory-Enhanced)
Pre-implementation gap analysis using memory context:
- Check
past_errorsto avoid known pitfalls - Review
recommended_patternsfor best practices - Identify requirements not covered by memory
Step 1c: PARALLEL_EXPLORE (5 Concurrent + Memory)
Launch 5 parallel exploration tasks:
- Semantic Search - Code patterns
- Structure Analysis - Codebase overview
- Dependency Scan - Understanding deps
- Pattern Search - Similar implementations
- Memory Correlation - Match with past sessions
Results aggregated to .claude/exploration-context.json
Step 2: CLASSIFY (3-Dimension)
| Score | Complexity | Model | Adversarial |
|---|---|---|---|
| 1-2 | Trivial | MiniMax-lightning | No |
| 3-4 | Simple | MiniMax M2.1 | No |
| 5-6 | Medium | Sonnet | Optional |
| 7-8 | Complex | Opus | Yes |
| 9-10 | Critical | Opus (thinking) | Yes |
Step 2b: WORKTREE DECISION
AskUserQuestion:
questions:
- question: "Requires isolated worktree?"
header: "Isolation"
options:
- label: "Yes, create worktree"
- label: "No, current branch"
Step 3: PLAN (Memory-Informed)
Use memory context in planning:
# Review what worked before
cat .claude/memory-context.json | jq '.insights.past_successes'
# Review what to avoid
cat .claude/memory-context.json | jq '.insights.past_errors'
Write plan with:
- Summary (informed by memory)
- Files to modify/create
- Dependencies
- Testing strategy
- Risks (include known issues from memory)
Step 3b: PERSIST
Write to .claude/orchestrator-analysis.md
Step 3c: PLAN-STATE
Initialize .claude/plan-state.json with spec vs actual tracking.
Step 3d: RECURSIVE_DECOMPOSE (if needed)
For QUADRATIC or RECURSIVE tasks, spawn sub-orchestrators (max depth 3).
Step 4: PLAN MODE
EnterPlanMode: {} # Claude Code reads orchestrator-analysis.md
Exit with ExitPlanMode when approved.
Step 5: DELEGATE (Parallel-First)
PRIORITY: Parallel execution when possible
# PARALLEL: Independent tasks
Task:
subagent_type: "security-auditor"
model: "opus"
run_in_background: true
prompt: "Audit: $FILES"
Task:
subagent_type: "test-architect"
model: "sonnet"
run_in_background: true
prompt: "Generate tests: $FILES"
# SEQUENTIAL: Dependent tasks
# Wait for results before continuing
Step 6: EXECUTE-WITH-SYNC
Nested loop with parallel substeps:
EXTERNAL RALPH LOOP (max 25)
└── For EACH step:
├── LSA-VERIFY (architecture check)
├── IMPLEMENT (parallel if independent)
├── PLAN-SYNC (drift detection)
└── MICRO-GATE (max 3 retries)
CRITICAL: model: "sonnet" for all subagents
Step 7: VALIDATE (Quality-First v2.46)
Stage 1: CORRECTNESS (BLOCKING)
- Meets requirements?
- Edge cases handled?
Stage 2: QUALITY (BLOCKING)
- Security verified?
- Performance OK?
- Tests adequate?
Stage 3: CONSISTENCY (ADVISORY - not blocking)
- Follows patterns?
- Style matches?
Stage 4: ADVERSARIAL (if complexity >= 7)
ralph adversarial "Design review"
Step 8: RETROSPECTIVE (Mandatory)
ralph retrospective
NEW v2.47: Save learnings to memory for future sessions:
# Save successful patterns
ralph memvid save "Implemented OAuth2 successfully: [pattern details]"
# Record errors to avoid
ralph memvid save "AVOID: [error pattern] caused [issue]"
-> VERIFIED_DONE
Model Routing (v2.47)
| Route | Primary | Secondary | Max Iter |
|---|---|---|---|
| FAST_PATH | sonnet | - | 3 |
| STANDARD (1-4) | minimax-m2.1 | sonnet | 25 |
| STANDARD (5-6) | sonnet | opus | 25 |
| STANDARD (7-10) | opus | sonnet | 25 |
| PARALLEL_CHUNKS | sonnet (chunks) | opus (aggregate) | 15/chunk |
| RECURSIVE | opus (root) | sonnet (sub) | 15/sub |
Integration Points
| Component | Role | When |
|---|---|---|
| smart-memory-search.sh | PARALLEL memory search | Step 0b (NEW) |
| /smart-fork | Find relevant sessions | Manual invocation |
| /fast-path-check | Trivial task detection | Step 0c |
| /parallel-explore | 5 concurrent exploration | Step 1c |
| /classify | 3-dimension classification | Step 2 |
| /gates | Quality validation | Step 7 |
| /adversarial | Spec refinement | Step 7 |
| /retrospective | Post-analysis | Step 8 |
Memory Sources (Searched in Parallel)
| Source | Content | Speed |
|---|---|---|
| claude-mem MCP | Semantic observations | Fast |
| memvid | Vector-encoded context | Sub-5ms |
| handoffs | Session snapshots | Fast |
| ledgers | Continuity data | Fast |
Anti-Patterns
- Never start without smart memory search
- Never skip clarification
- Never use model: "haiku" for subagents
- Never skip retrospective
- Never attempt more than 3 fixes (3-Fix Rule)
- Never block on consistency issues (quality over consistency)
- Never ignore memory context (learn from history)
Completion Criteria
VERIFIED_DONE requires ALL:
- Smart Memory Search complete (memory-context.json exists)
- Task classified (3 dimensions)
- MUST_HAVE questions answered
- Plan approved
- Implementation complete
- CORRECTNESS passed (blocking)
- QUALITY passed (blocking)
- Adversarial passed (if complexity >= 7)
- Retrospective done + learnings saved to memory
Examples
Standard Task with Memory
User: "Add JWT authentication"
Step 0a: Classify -> Complexity: 7, LINEAR, FITS
Step 0b: Smart Memory Search
-> Found: 3 past sessions with auth implementations
-> past_successes: "Use passport.js for OAuth"
-> past_errors: "Don't store tokens in localStorage"
-> fork_suggestion: session-abc123
Step 1: Clarify (informed by memory)
-> Skip questions about token storage (already known)
-> Focus on new requirements
... (continue with memory-informed implementation)
Step 8: Retrospective
-> Save: "JWT with refresh tokens implemented successfully"
-> Save: "AVOID: Token expiry not handled - fix applied"
CLI Commands (v2.47)
# Smart memory search
ralph memory-search "OAuth implementation"
ralph fork-suggest "Add authentication"
ralph memory-stats
# Standard orchestration
ralph orch "task description"
ralph gates
ralph adversarial "spec"
Score
Total Score
Based on repository quality metrics
SKILL.mdファイルが含まれている
ライセンスが設定されている
100文字以上の説明がある
GitHub Stars 100以上
1ヶ月以内に更新
10回以上フォークされている
オープンIssueが50未満
プログラミング言語が設定されている
1つ以上のタグが設定されている
Reviews
Reviews coming soon
