Automated summary
rlm is a command-line tool that uses recursive sub-queries to process very long contexts while reducing token usage.
Strengths
- Handles arbitrarily long contexts by programmatically exploring chunks of text.
- Typically saves about 40% tokens on documents larger than 50KB.
- Flexible Query() and FINAL() patterns enable targeted, iterative analysis.
- Supports multiple input modes: file, string, and stdin.
Limitations
- Requires binary installation and an Anthropic API key.
- Not worth the overhead for contexts under 10KB or simple questions.
- Effectiveness depends on the generated code and the max-iterations setting.
Use rlm when analyzing large files or logs over 50KB where token efficiency is important.
Avoid rlm for short contexts, simple single-turn questions, or tasks that do not require data exploration.
Security analysis
SafeThe skill describes a legitimate tool for processing large contexts with an LLM. It does not instruct the agent to perform destructive, exfiltrating, or obfuscated actions. The installation command using curl|sh is for user reference and not automatically executed.
No concerns found
How this analysis is madeExamples
Use the rlm tool to analyze server.log and find all unique error patterns with their frequencies.Process data.json with rlm and extract all user IDs that have failed transactions, showing the result in JSON.Pipe all .go source files in the current directory into rlm and identify every exported function with its purpose.name: rlm description: Recursive Language Model for processing large contexts (>50KB). Use for complex analysis tasks where token efficiency matters. Achieves 40% token savings by letting the LLM programmatically explore context via Query() and FINAL() patterns. allowed-tools:
- Bash
RLM - Recursive Language Model
RLM is an inference-time scaling strategy that enables LLMs to handle arbitrarily long contexts by treating prompts as external objects that can be programmatically examined and recursively processed.
- License: MIT
- Repository: https://github.com/XiaoConstantine/rlm-go
When to Use
Use rlm instead of direct LLM calls when:
- Processing large contexts (>50KB of text)
- Token efficiency is important (40% savings on large contexts)
- The task requires iterative exploration of data
- Complex analysis that benefits from sub-queries
Do NOT Use When
- Context is small (<10KB) - overhead not worth it
- Simple single-turn questions
- Tasks that don't require data exploration
Command Usage
# Basic usage with context file
~/.local/bin/rlm -context <file> -query "<query>" -verbose
# With inline context
~/.local/bin/rlm -context-string "data" -query "<query>"
# Pipe context from stdin
cat largefile.txt | ~/.local/bin/rlm -query "<query>"
# JSON output for programmatic use
~/.local/bin/rlm -context <file> -query "<query>" -json
Options
| Flag | Description | Default |
|------|-------------|---------|
| -context | Path to context file | - |
| -context-string | Context string directly | - |
| -query | Query to run against context | Required |
| -model | LLM model to use | claude-sonnet-4-20250514 |
| -max-iterations | Maximum iterations | 30 |
| -verbose | Enable verbose output | false |
| -json | Output result as JSON | false |
| -log-dir | Directory for JSONL logs | - |
How It Works
RLM uses a Go REPL environment where LLM-generated code can:
- Access context as a string variable
- Make recursive sub-LLM calls via
Query()for focused analysis - Use standard Go operations for text processing
- Signal completion with
FINAL()when done
The Query() Pattern
// LLM generates code like this inside the REPL:
chunk := context[0:10000]
summary := Query("Summarize the key findings in this text: " + chunk)
// ... iterate through more chunks
FINAL(combinedResult)
The FINAL() Pattern
The LLM signals completion by calling:
FINAL("answer")- Return a string answerFINAL_VAR(variableName)- Return value of a variable
Token Efficiency Benefits
For large contexts (>50KB), RLM typically achieves 40% token savings by:
- Only sending relevant context chunks to sub-queries
- Avoiding repeated full-context processing
- Using programmatic iteration instead of full-context reasoning
Examples
Analyze Log Files
rlm -context server.log -query "Find all unique error patterns and their frequencies"
Process JSON Data
rlm -context data.json -query "Extract all user IDs with failed transactions" -verbose
Code Analysis
cat src/*.go | rlm -query "Identify all exported functions and their purposes"
Requirements
ANTHROPIC_API_KEYenvironment variable must be set- Binary installed at
~/.local/bin/rlm
Installation
# Quick install
curl -fsSL https://raw.githubusercontent.com/XiaoConstantine/rlm-go/main/install.sh | bash
# Or with Go
go install github.com/XiaoConstantine/rlm-go/cmd/rlm@latest
From the file to a first result
The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.
View the source and supporting filesThis download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.
1. Download the file
Download SKILL.mdFrom the root of a test project, save the file as .skill-downloads/rlm-recursive-language-model-msfn18i3/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.
Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.
mkdir -p '.skill-downloads/rlm-recursive-language-model-msfn18i3' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/rlm-recursive-language-model-msfn18i3/download' --output '.skill-downloads/rlm-recursive-language-model-msfn18i3/SKILL.md.part' && mv '.skill-downloads/rlm-recursive-language-model-msfn18i3/SKILL.md.part' '.skill-downloads/rlm-recursive-language-model-msfn18i3/SKILL.md'2. Check prerequisites
Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.
Original excerpt: Requirements
ANTHROPIC_API_KEYenvironment variable must be set- Binary installed at
~/.local/bin/rlm
The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.
3. Load the skill
After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.
Claude Code
test -f '.skill-downloads/rlm-recursive-language-model-msfn18i3/SKILL.md' && test -s '.skill-downloads/rlm-recursive-language-model-msfn18i3/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/rlm' && cp -R '.skill-downloads/rlm-recursive-language-model-msfn18i3' '.claude/skills/rlm'OpenSkills
OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.
Official OpenSkills installationopenskills install './.skill-downloads/rlm-recursive-language-model-msfn18i3'openskills read 'rlm-recursive-language-model-msfn18i3'Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.
For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.
openskills syncManual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.
4. Try a first task
Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:
Read .skill-downloads/rlm-recursive-language-model-msfn18i3/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.
Create Interactive Maps with kepler.gl
Data & AI
Create interactive map visualizations and export standalone HTML using the keplergl Python package. Use to plot geospatial data from DataFrames, GeoJSON, or CSV.
Agent-Driven Parameter Optimization
Data & AI
Guide for optimizing configurable systems with a measurable objective, using bounded trials and evidence-based recommendations.
ICP Visitor Outreach
Data & AI
Identify signed-up users matching the ideal customer profile but stalled, and draft personalized outreach to re-engage them.