Help us improve
Share bugs, ideas, or general feedback.
From rlm
Processes large contexts (>50KB) with recursive LLM sub-queries via Query() and FINAL() in Go REPL, achieving 40% token savings for complex analysis tasks.
npx claudepluginhub xiaoconstantine/rlm-go --plugin rlmHow this skill is triggered — by the user, by Claude, or both
Slash command
/rlm:rlmThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this 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.
Uses dspy.RLM to recursively reason over huge contexts (>100k tokens) via a sandboxed Python REPL that writes code to slice, grep, and sub-query data.
Loads large local files and data into external memory for searching, recursive reasoning loops, Python execution, and session persistence. Useful for analyzing big docs, repos, or logs via /aleph.
Share bugs, ideas, or general feedback.
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