zircote-plugins/rlm-rs-plugin/rlm
Claude Code and agent skill by zircote-plugins/rlm-rs-plugin
- community
Checking that the SKILL.md file is still in the repository.
This skill should be used when the user asks to "process a large file", "analyze document exceeding context", "use RLM", "recursive language model workflow", "chunk and analyze a file", "handle long context", or needs to work with documents too large to fit in the context window. Orchestrates the full RLM loop using the rlm-rs CLI.
Install
npx vskill@latest install zircote-plugins/rlm-rs-plugin/rlmSKILL.md
The same SKILL.md was published earlier as zircote-plugins/rlm-rs-plugin/rlm.
RLM (Recursive Language Model) Workflow
Orchestrate processing of documents that exceed context window limits using the rlm-rs CLI tool. This skill implements the RLM pattern from arXiv:2512.24601, enabling analysis of content up to 100x larger than typical context windows.
Architecture Mapping
| RLM Concept | Implementation | |
|---|---|---|
| Root LLM | Main Claude Code conversation (Opus/Sonnet) | |
Sub-LLM (llm_query) | rlm-subcall agent (Haiku) | |
| External Environment | rlm-rs CLI with SQLite storage |
Prerequisites
Verify rlm-rs is installed and available:
Installation options:
Workflow Steps
Step 1: Initialize Database
Create or verify the RLM database:
If already initialized, status shows current buffers and state.
Step 2: Load Context File
Load the large document into a buffer with appropriate chunking:
Step 3: Scout the Content
Examine the beginning and end to understand structure:
Search for relevant sections:
Step 4: Search for Relevant Chunks
Use hybrid semantic + BM25 search to find chunks matching your query:
Output includes chunk IDs with relevance scores and document position (index):
index: Sequential position within the document (0-based) - use for temporal orderingbuffer_id: Which buffer/document this chunk belongs to
Extract chunk IDs sorted by document position: jq -r '.results | sort_by(.index) | .[].chunk_id'
Step 5: Retrieve Chunks by ID
Get specific chunk content via pass-by-reference:
Step 6: Subcall Loop (Batched, Parallel)
Only process chunks returned by search. Batch chunk IDs to reduce agent calls:
- Search returns chunk IDs with relevance scores and document indices
- Sort all chunk IDs by `index` (document position) to preserve temporal context
- Group sorted chunk IDs into batches (default 10, configurable via
batch_sizeargument) - Invoke
rlm-subcallagent once per batch using only the two required arguments - Launch batches in parallel via multiple Task calls in one response
- Agent handles retrieval internally via
rlm-rs chunk get <id>(NO buffer ID needed) - Collect structured JSON findings from all batches
IMPORTANT: Sort chunks by index before batching to preserve document flow. Each subagent should receive chunks in document order (e.g., 3,7,12,15,22 not 22,3,15,7,12). This ensures temporal context is maintained - definitions appear before usages, causes before effects.
CORRECT Task invocation - pass ONLY query and chunk_ids arguments (sorted by index):
CRITICAL - DO NOT:
- Write narrative prompts - the agent already knows what to do
- Include buffer ID or buffer NAME anywhere in the prompt
- Mention the buffer at all - chunk IDs are globally unique across all buffers
WRONG (causes exit code 2):
RIGHT:
Step 7: Synthesis
Once all chunks are processed:
- Collect all JSON findings from subcall agents
- Pass findings directly to
rlm-synthesizeragent (no intermediate files) - Present the final synthesized response to the user
Example Task tool invocation:
Guardrails
- Never paste large chunks into main context - Use peek/grep to extract only relevant excerpts
- Keep subagent outputs compact - Request JSON format with short evidence fields
- Orchestration stays in main conversation - Subagents cannot spawn other subagents
- State persists in SQLite - All buffers survive across sessions via
.rlm/rlm-state.db - No file I/O for chunk passing - Use pass-by-reference with chunk IDs
Chunking Strategy Selection
| Content Type | Recommended Strategy | |
|---|---|---|
| Markdown docs | semantic | |
| Source code | semantic | |
| JSON/XML | semantic | |
| Plain logs | fixed with overlap | |
| Unstructured text | fixed |
For detailed chunking guidance, refer to the rlm-chunking skill.
CLI Command Reference
| Command | Purpose | |
|---|---|---|
init | Initialize database | |
status | Show state summary | |
load | Load file into buffer | |
list | List all buffers | |
show | Show buffer details | |
peek | View buffer content slice | |
grep | Search with regex | |
search | Hybrid semantic + BM25 search | |
chunk get | Retrieve chunk by ID | |
chunk list | List buffer chunks | |
chunk embed | Generate embeddings | |
chunk status | Show embedding status | |
write-chunks | Export chunks to files (legacy) | |
add-buffer | Store intermediate results | |
export-buffers | Export all buffers | |
var | Get/set context variables | |
reset | Clear all state |
Example Session
Additional Resources
Reference Files
- `references/cli-reference.md` - Complete CLI documentation
Related Components
- `rlm-subcall` agent - Chunk-level analysis (Haiku)
- `rlm-synthesizer` agent - Result aggregation (Sonnet)
- `rlm-chunking` skill - Chunking strategy selection
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/rlm/SKILL.md
Popularity
- Repository stars
- 3
- Repository forks
- 2
- 7-day trend score
- 7
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/zircote-plugins/rlm-rs-plugin/rlm)