/rlm:rlmfrom rlm
Processes large contexts (>50KB) with token-efficient recursive sub-queries using Query() and FINAL() patterns. Achieves ~40% token savings for complex analysis tasks.
Ships in rlm. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
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.
Use rlm instead of direct LLM calls when:
# 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
| 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 | - |
RLM uses a Go REPL environment where LLM-generated code can:
Query() for focused analysisFINAL() when done// 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 LLM signals completion by calling:
FINAL("answer") - Return a string answerFINAL_VAR(variableName) - Return value of a variableFor large contexts (>50KB), RLM typically achieves 40% token savings by:
rlm -context server.log -query "Find all unique error patterns and their frequencies"
rlm -context data.json -query "Extract all user IDs with failed transactions" -verbose
cat src/*.go | rlm -query "Identify all exported functions and their purposes"
ANTHROPIC_API_KEY environment variable must be set~/.local/bin/rlm# 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
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub xiaoconstantine/rlm-go --plugin rlmOther plugins' skills for the same job