Uses a recursive approach to explore large files and documents for token-efficient analysis.
Install
mkdir -p .claude/skills/rlm-xiaoconstantine && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/13188" && unzip -o skill.zip -d .claude/skills/rlm-xiaoconstantine && rm skill.zipInstalls to .claude/skills/rlm-xiaoconstantine
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
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.Key capabilities
- →Process large text contexts programmatically
- →Achieve token efficiency for large inputs
- →Perform iterative data exploration
- →Make recursive sub-LLM calls for focused analysis
- →Use Go operations for text processing
- →Signal completion with `FINAL()`
How it works
RLM uses a Go REPL environment where the LLM generates code to access context, make recursive sub-LLM calls via `Query()`, and use Go operations for text processing. It signals completion with `FINAL()`.
Inputs & outputs
When to use rlm
- →Analyze large documentation
- →Query massive log files
- →Iterative data analysis
About this skill
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
When not to use it
- →When the context is small (<10KB)
- →When answering simple single-turn questions
- →When the task does not require data exploration
Prerequisites
Limitations
- →Overhead is not worth it for small contexts
- →Requires `ANTHROPIC_API_KEY` to be set
- →Requires `rlm` binary to be installed
How it compares
This skill allows an LLM to programmatically explore and process large contexts iteratively, which differs from direct LLM calls that process the entire context at once.
Compared to similar skills
rlm side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| rlm (this skill) | 0 | 7mo | Review | Advanced |
| verify-language-support | 0 | 2mo | No flags | Advanced |
| copilot-sdk | 0 | 4mo | Review | Intermediate |
| instructor | 1 | 7mo | Review | Intermediate |
Try saying
Example prompts that trigger this skill in your AI assistant.
You might also like
verify-language-support
LegacyCodeHQ
End-to-end workflow for validating language support changes in the clarity dependency graph analyzer
copilot-sdk
wegonbeok45
Build applications that programmatically interact with GitHub Copilot. The SDK wraps the Copilot CLI via JSON-RPC, providing session management, custom tools, hooks, MCP server integration, and streaming across Node.js, Python, Go, and .NET.
instructor
davila7
Extract structured data from LLM responses with Pydantic validation, retry failed extractions automatically, parse complex JSON with type safety, and stream partial results with Instructor - battle-tested structured output library
llm-tuning-patterns
parcadei
LLM Tuning Patterns
prompt-analyzer
huangserva
提示词分析与洞察 - 查看Prompt详情、对比差异、推荐相似提示词、元素库统计
context-engineering
itallstartedwithaidea
>-