Recursive Language Model - iteratively refine answers through multiple reasoning passes using Self-Refine, Reflexion, and Tree of Thoughts techniques. Use when asked to "think deeply", "refine iteratively", "use RLM", or when facing complex problems that benefit from multi-pass reasoning.
Applies recursive reasoning techniques to iteratively refine solutions through self-critique and multi-pass analysis.
/plugin marketplace add lollipopkit/rlm-skill/plugin install rlm@lk-rlmThis skill is limited to using the following tools:
advanced-techniques.mdexamples.mdThis skill implements state-of-the-art recursive reasoning techniques from research, including Self-Refine, Reflexion, Tree of Thoughts, and Constitutional AI principles.
RLM synthesizes multiple research paradigms:
| Technique | Core Idea | Source |
|---|---|---|
| Self-Refine | Single LLM acts as generator, critic, and refiner iteratively | Madaan et al. 2023 |
| Reflexion | Maintain reflective memory buffer across iterations | Shinn et al. 2023 |
| Tree of Thoughts | Explore multiple reasoning branches with backtracking | Yao et al. 2023 |
| Self-Consistency | Sample diverse paths, select most consistent answer | Wang et al. 2023 |
| Constitutional AI | Principle-guided self-critique and revision | Anthropic 2022 |
| Least-to-Most | Decompose complex problems into sequential subproblems | Zhou et al. 2022 |
┌─────────────────────────────────────────────────────────────┐
│ RLM EXECUTION FLOW │
├─────────────────────────────────────────────────────────────┤
│ │
│ ┌─────────────┐ │
│ │ DECOMPOSE │ ← Least-to-Most: Break into subproblems │
│ └──────┬──────┘ │
│ ▼ │
│ ┌─────────────┐ │
│ │ GENERATE │ ← Initial solution attempt │
│ └──────┬──────┘ │
│ ▼ │
│ ┌─────────────┐ │
│ │ CRITIQUE │ ← Self-Refine: Identify weaknesses │
│ └──────┬──────┘ │
│ ▼ │
│ ┌─────────────┐ │
│ │ REFLECT │ ← Reflexion: Update memory buffer │
│ └──────┬──────┘ │
│ ▼ │
│ ┌─────────────┐ │
│ │ REFINE │ ← Apply improvements │
│ └──────┬──────┘ │
│ ▼ │
│ Converged? ─── No ──→ Branch? ─── Yes ──→ ToT Search │
│ │ │ │ │
│ Yes No │ │
│ │ │ │ │
│ ▼ └──────────────────────┘ │
│ ┌─────────────┐ │ │
│ │ SYNTHESIZE │ ◄──────────────────┘ │
│ └─────────────┘ │
│ │
└─────────────────────────────────────────────────────────────┘
Before solving, break complex problems into manageable subproblems:
## 📋 Problem Decomposition
**Original Problem**: [Complex task]
**Subproblems** (solve in order):
1. [Foundational subproblem] → enables 2, 3
2. [Intermediate subproblem] → enables 3
3. [Final subproblem] → produces solution
**Dependencies**: 1 → 2 → 3
For each iteration, act as three roles:
Maintain a memory buffer of insights across iterations:
## 🧠 Reflection Memory
| Iteration | Key Insight | Action Taken |
|-----------|-------------|--------------|
| 1 | Missed edge case X | Added validation |
| 2 | Algorithm inefficient | Switched to O(n) |
| 3 | API misused | Checked documentation |
This memory prevents repeating mistakes and compounds learning.
When facing uncertainty, explore multiple paths:
## 🌳 Reasoning Branches
**Decision Point**: [What approach to take?]
### Branch A: [Approach 1]
- Pros: ...
- Cons: ...
- Confidence: X/10
### Branch B: [Approach 2]
- Pros: ...
- Cons: ...
- Confidence: X/10
**Selected**: Branch [A/B] because [reasoning]
**Backtrack if**: [conditions that would trigger reconsideration]
Before finalizing, verify consistency across reasoning paths:
## ✓ Consistency Verification
**Multiple Reasoning Paths**:
1. Path via [method A] → Result: X
2. Path via [method B] → Result: X
3. Path via [method C] → Result: Y (outlier)
**Consensus**: X (2/3 paths agree)
**Outlier Analysis**: Path C failed because [reason]
## 🔄 Iteration [N]
### 💡 Current Solution
[Your current best answer]
### 🔍 Self-Critique (Constitutional Principles)
- [ ] **Correctness**: Is it factually accurate?
- [ ] **Completeness**: Are all requirements addressed?
- [ ] **Clarity**: Is it easy to understand?
- [ ] **Efficiency**: Is it optimal?
- [ ] **Safety**: Are there security/edge case issues?
**Identified Issues**:
1. [Issue 1]: [Severity: High/Medium/Low]
2. [Issue 2]: [Severity: High/Medium/Low]
### 📝 Reflection (→ Memory Buffer)
> [Key insight from this iteration to remember]
### 🔧 Refinement Plan
| Priority | Improvement | Expected Impact |
|----------|-------------|-----------------|
| 1 | [Change 1] | [Impact] |
| 2 | [Change 2] | [Impact] |
### 📊 Metrics
- **Confidence**: [1-10]
- **Completeness**: [%]
- **Quality Delta**: [+X% from previous]
---
## ✅ Final Answer
[Refined solution]
### 📈 Evolution Summary
| Iter | Technique Used | Key Change | Confidence |
|------|----------------|------------|------------|
| 1 | Generate | Initial attempt | 4/10 |
| 2 | Self-Refine | Fixed [issue] | 6/10 |
| 3 | ToT Branch | Explored alt. | 7/10 |
| 4 | Consistency | Verified paths | 9/10 |
### 🧠 Accumulated Insights
[Key learnings from reflection memory]
### ⚠️ Remaining Considerations
[Any caveats, edge cases, or future improvements]
Stop iterating when ANY of these are met:
| Problem Type | Recommended Mode | Iterations |
|---|---|---|
| Simple bug fix | Light RLM | 2 |
| Algorithm design | Full RLM | 3-4 |
| Architecture decision | Full RLM + ToT | 4-5 |
| Creative/open-ended | Full RLM + Branching | 5+ |
| Mission-critical code | Full RLM + Consistency | 5+ |
For maximum depth, combine RLM with mcp__seq-think__sequentialthinking:
RLM Iteration 1
└── Sequential Thinking (steps 1-5)
RLM Iteration 2
└── Sequential Thinking (steps 1-7)
...