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.
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
Search for places (restaurants, cafes, etc.) via Google Places API proxy on localhost.
Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Start voice calls via the OpenClaw voice-call plugin.
Notion API for creating and managing pages, databases, and blocks.
Gemini CLI for one-shot Q&A, summaries, and generation.
Category:developer