Skip to main content
ClaudeWave
Skill47 estrellas del repoactualizado yesterday

rlm-orchestrator

>-

Instalar en Claude Code
Copiar
git clone --depth 1 https://github.com/belumume/claude-skills /tmp/rlm-orchestrator && cp -r /tmp/rlm-orchestrator/rlm-orchestrator ~/.claude/skills/rlm-orchestrator
Después abre una sesión nueva de Claude Code; el skill carga automáticamente.

SKILL.md

# RLM-Style Recursive Orchestrator

Implement the orchestrator pattern from RLM research to handle arbitrarily large contexts
and complex multi-part tasks. The main conversation acts as the recursive coordinator,
spawning depth-1 subagents and aggregating results.

## Core Principle

> "No single language model call should require handling a huge context."
> — RLM Research (arXiv:2512.24601)

Since Claude Code subagents cannot spawn children (architectural limit), the main
conversation becomes the "recursion stack," enabling functional depth >1.

## When to Use This Skill

**Ideal for:**
- Tasks requiring >100K tokens of context
- Multi-file analysis or refactoring
- Research tasks with many sources
- Batch processing with independent partitions
- Any task showing signs of context rot (degraded recall, repeated mistakes)

**Not ideal for:**
- Simple single-file changes
- Tasks requiring tight sequential dependencies
- Quick exploratory questions

## The RLM Orchestration Pattern

```
Main Session (orchestrator/recursion stack)
    │
    ├─[DECOMPOSE]─ Analyze task, identify independent partitions
    │
    ├─[SPAWN BATCH 1]──┬── Subagent A (fresh 200K context) → summary
    │                  ├── Subagent B (fresh 200K context) → summary
    │                  └── Subagent C (fresh 200K context) → summary
    │
    ├─[AGGREGATE]─ Combine results, identify gaps
    │
    ├─[SPAWN BATCH 2]──┬── Subagent D (uses batch 1 results) → summary
    │                  └── Subagent E (uses batch 1 results) → summary
    │
    ├─[AGGREGATE]─ Final combination
    │
    └─[COMPLETE]─ Return unified result
```

## Orchestration Protocol

### Phase 1: Task Analysis and Decomposition

Before spawning any subagents, analyze the task:

1. **Estimate context requirements**
   - Count files/sources to process
   - Estimate tokens (~4 bytes per token)
   - If <50K tokens total, consider direct execution

2. **Identify partition boundaries**
   - Find natural divisions (files, sections, topics)
   - Ensure partitions are independent (no cross-dependencies)
   - Aim for 3-7 partitions per batch (Claude Code limit: ~10 concurrent)

3. **Define aggregation strategy**
   - How will partition results combine?
   - What format should subagent outputs use?
   - What information must propagate between batches?

### Phase 2: Subagent Dispatch

For each batch of partitions:

1. **Prepare subagent prompts** using the template in `references/subagent-prompt-template.md`

2. **Spawn subagents in parallel** using the Task tool:
   ```
   Task(subagent_type="general-purpose", description="[partition description]", prompt="...")
   Task(subagent_type="Explore", description="[research partition]", prompt="...")
   ```

3. **Use appropriate subagent types:**
   - `Explore` - For read-only research, file discovery
   - `general-purpose` - For tasks requiring code changes
   - `Plan` - For architecture/design work

4. **Run in background when appropriate:**
   - Set `run_in_background=true` for long-running tasks
   - Check results via `TaskOutput` or `Read` on output file

### Phase 3: Result Aggregation

When subagents complete:

1. **Collect all results** - Read summaries from each subagent

2. **Validate completeness** - Check for error indicators:
   - "could not find", "unable to", "failed to"
   - Missing expected outputs
   - Incomplete coverage of partition

3. **Merge results** using appropriate strategy:
   - **Union**: Combine all findings (research tasks)
   - **Synthesis**: Create unified narrative (analysis tasks)
   - **Reduce**: Aggregate metrics (measurement tasks)

4. **Identify gaps** - What wasn't covered? What needs follow-up?

### Phase 4: Iteration (if needed)

If gaps exist:

1. **Create follow-up partitions** for uncovered areas
2. **Include previous batch context** in new subagent prompts
3. **Spawn next batch** with refined focus
4. **Repeat until complete** or max iterations reached

## Emerged Strategies (from RLM Research)

Encode these strategies in subagent prompts:

### Peeking
> Sample the beginning of context to understand structure before deep processing.

```markdown
Before analyzing fully, first peek at the structure:
1. Read first 50 lines of each file
2. Identify file types and organization
3. Then proceed with targeted analysis
```

### Grepping
> Use pattern-based filtering to narrow context before semantic processing.

```markdown
Use Grep to filter before reading:
1. Search for relevant patterns: `Grep(pattern="error|exception|fail")`
2. Read only matching files fully
3. This reduces context consumption by 80%+
```

### Partition + Map
> Break context into chunks, process in parallel, then aggregate.

```markdown
This task uses partition+map strategy:
1. You handle partition [X] of [N]
2. Your partition covers: [specific scope]
3. Return findings in this format: [format spec]
4. Orchestrator will aggregate all partition results
```

### Summarization
> Extract condensed information for parent decision-making.

```markdown
Return a structured summary, not raw data:
- Key findings (3-5 bullet points)
- Specific file:line references
- Confidence level (high/medium/low)
- Gaps or uncertainties
```

## Token Budget Management

Track token consumption across the orchestration:

| Component | Estimated Tokens | Notes |
|-----------|------------------|-------|
| Main conversation | 200K max | Reserve 50K for orchestration |
| Per subagent | 200K max | Fresh context each |
| Subagent overhead | ~20K | System prompt + tools |
| Summary return | ~2-5K | Per subagent result |

**Budget formula:**
```
Effective capacity = (Main 150K usable) + (N subagents × 180K usable each)
For 5 subagents: 150K + 900K = ~1M effective tokens
```

## Integration with Existing Skills

This skill works with:

- **superpowers:brainstorming** - Use first to decompose complex problems
- **superpowers:writing-plans** - Create task partition structure
- **superpowers:dispatching-parallel-agents** - Detailed parallel dis
deep-brainstormingSkill

Use when brainstorming a product or feature where multiple valid technology choices exist and the wrong one is costly, when the user asks for 'objectively best' or 'highest quality', or when the domain has tools/frameworks where marketing or popularity biases could mislead research agents. Also use when starting architecture decisions, evaluating tech stacks, or when the user mentions bias, vendor lock-in, hallucinated benchmarks, or wants research-backed decisions rather than default recommendations.

document-quality-standardsSkill

Use when creating or editing documents (DOCX, PDF, XLSX, PPTX) that need professional output. Adds visual verification, typography hygiene, and formula patterns.

docx-advanced-patternsSkill

Advanced python-docx patterns for nested tables, complex cells, and content extraction beyond .text property. Techniques for forms, checklists, and complex layouts.

docx-template-fillingSkill

Fill DOCX template forms preserving 100% original structure - logos, footers, styles, metadata. Zero-artifact insertion. Output indistinguishable from manual entry.

obsidian-vault-builderSkill

Use when adding/editing/querying content in an existing Obsidian vault, configuring plugins, integrating Claude Code with Obsidian via Local REST API or CLI, automating ongoing capture/organization/retrieval, designing a personal knowledge management workflow, OR building academic study vaults (course prep, exam-ready, mock-exam content — the durable academic-study patterns from a deprecated companion skill have been folded into this one).

pdf-handlingSkill

Extract PDFs to text and images before reading

project-retrospectiveSkill

>-

ralph-loopSkill

Activate autonomous Ralph Wiggum loop mode for iterative task completion. Use when you have a well-defined task with clear completion criteria that benefits from persistent, autonomous execution.