rawwerks/rlm-cli/rlm
Claude Code and agent skill by rawwerks/rlm-cli
- community
Checking that the SKILL.md file is still in the repository.
Recursive Language Models (RLM) CLI - enables LLMs to recursively process large contexts by decomposing inputs and calling themselves over parts. Use for code analysis, diff reviews, codebase exploration. Triggers on "rlm ask", "rlm complete", "rlm search", "rlm index".
Install
npx vskill@latest install rawwerks/rlm-cli/rlmSKILL.md
RLM CLI
Recursive Language Models (RLM) CLI - enables LLMs to handle near-infinite context by recursively decomposing inputs and calling themselves over parts. Supports files, directories, URLs, and stdin.
Installation
Set an API key for your backend (openrouter is default):
Commands
ask - Query with context
Inputs (combinable):
| Type | Example | Notes | ||
|---|---|---|---|---|
| Directory | rlm ask . -q "..." | Recursive, respects .gitignore | ||
| File | rlm ask main.py -q "..." | Single file | ||
| URL | rlm ask https://x.com -q "..." | Auto-converts to markdown | ||
| stdin | `git diff \ | rlm ask - -q "..."` | - reads from pipe | |
| Literal | rlm ask "text" -q "..." --literal | Treat as raw text | ||
| Multiple | rlm ask a.py b.py -q "..." | Combine any types |
Options:
| Flag | Description | |
|---|---|---|
-q "..." | Question/prompt (required) | |
--backend | Provider: openrouter (default), openai, anthropic | |
--model NAME | Model override (format: provider/model or just model) | |
--json | Machine-readable output | |
--output-format | Output format: text, json, or json-tree | |
--summary | Show execution summary with depth statistics | |
--extensions .py .ts | Filter by extension | |
--include/--exclude | Glob patterns | |
--max-iterations N | Limit REPL iterations (default: 30) | |
--max-depth N | Recursive RLM depth (default: 1 = no recursion) | |
--max-budget N.NN | Spending limit in USD (requires OpenRouter) | |
--max-timeout N | Time limit in seconds | |
--max-tokens N | Total token limit (input + output) | |
--max-errors N | Consecutive error limit before stopping | |
--no-index | Skip auto-indexing | |
--exa | Enable Exa web search (requires EXA_API_KEY) | |
--inject-file FILE | Execute Python code between iterations |
JSON output structure:
JSON-tree output (`--output-format=json-tree`): Adds execution tree showing nested RLM calls:
Summary output (`--summary`): Shows depth-wise statistics after completion:
- JSON mode: adds
summaryfield tostats - Text mode: prints summary to stderr
complete - Query without context
search - Search indexed files
| Flag | Description | |
|---|---|---|
--limit N | Max results (default: 20) | |
--language python | Filter by language | |
--paths-only | Output file paths only | |
--json | JSON output |
Auto-indexes on first use. Manual index: rlm index .
index - Build search index
doctor - Check setup
Workflows
Git diff review:
Codebase analysis:
Search + analyze:
Compare files:
Configuration
Precedence: CLI flags > env vars > config file > defaults
Config locations: ./rlm.yaml, ./.rlm.yaml, ~/.config/rlm/config.yaml
Environment variables:
RLM_BACKEND- Default backendRLM_MODEL- Default modelRLM_CONFIG- Config file pathRLM_JSON=1- Always output JSON
Recursion and Budget Limits
Recursive RLM (--max-depth)
Enable recursive llm_query() calls where child RLMs process sub-tasks:
Budget Control (--max-budget)
Limit spending per completion. Raises BudgetExceededError when exceeded:
Requirements: OpenRouter backend (returns cost data in responses).
Other Limits
Timeout (`--max-timeout`) - Stop after N seconds:
Token limit (`--max-tokens`) - Stop after N total tokens:
Error threshold (`--max-errors`) - Stop after N consecutive code errors:
Stop Conditions
RLM execution stops when any of these occur:
- Final answer - LLM calls
FINAL_VAR("variable_name")with the NAME of a variable (as a string) - Max iterations - Exceeds
--max-iterations(exit code 0, graceful - forces final answer)
FINAL_VAR usage (common mistake - pass variable NAME, not value):
- Max budget exceeded - Spending >
--max-budget(exit code 20, error) - Max timeout exceeded - Time >
--max-timeout(exit code 20, error with partial answer) - Max tokens exceeded - Tokens >
--max-tokens(exit code 20, error with partial answer) - Max errors exceeded - Consecutive errors >
--max-errors(exit code 20, error with partial answer) - User cancellation - Ctrl+C or SIGUSR1 (exit code 0, returns partial answer as success)
- Max depth reached - Child RLM at depth 0 cannot recurse further
Note on max iterations: This is a soft limit. When exceeded, RLM prompts the LLM one more time to provide a final answer. Modern LLMs typically complete in 1-2 iterations.
Partial answers: When timeout, tokens, or errors stop execution, the error includes partial_answer if any response was generated before stopping.
Early exit (Ctrl+C): Pressing Ctrl+C (or sending SIGUSR1) returns the partial answer as success (exit code 0) with early_exit: true in the result.
Inject File (--inject-file)
Update REPL variables mid-run by modifying an inject file:
The file is checked before each iteration and executed if modified.
Exit Codes
| Code | Meaning | |
|---|---|---|
| 0 | Success | |
| 2 | CLI usage error | |
| 10 | Input error (file not found) | |
| 11 | Config error (missing API key) | |
| 20 | Backend/API error (includes budget exceeded) | |
| 30 | Runtime error | |
| 40 | Index/search error |
LLM Search Tools
When rlm ask runs on a directory, the LLM gets search tools:
| Tool | Cost | Privacy | Use For | |
|---|---|---|---|---|
rg.search() | Free | Local | Exact patterns, function names, imports | |
tv.search() | Free | Local | Topics, concepts, related files | |
exa.search() | $ | API | Web search (requires --exa flag) | |
pi.* | $$$ | API | Hierarchical PDF/document navigation |
Free Local Tools (auto-loaded)
- rg.search(pattern, paths, globs) - ripgrep for exact patterns
- tv.search(query, limit) - Tantivy BM25 for concepts
Exa Web Search (--exa flag, Costs Money)
⚠️ Opt-in: Requires --exa flag and EXA_API_KEY environment variable.
Setup:
Usage in REPL:
exa.search() parameters:
| Param | Default | Description | |
|---|---|---|---|
query | required | Search query | |
limit | 10 | Max results | |
search_type | "auto" | "auto", "neural", or "keyword" | |
include_domains | None | Only these domains | |
exclude_domains | None | Exclude these domains | |
include_text | False | Include full page text | |
include_highlights | True | Include relevant excerpts | |
category | None | "company", "research paper", "news", etc. |
When to use exa.search() / web():
- Finding external documentation, tutorials, articles
- Researching topics beyond the local codebase
- Finding similar pages to a reference URL
PageIndex (pi.* - Opt-in, Costs Money)
⚠️ WARNING: PageIndex sends document content to LLM APIs and costs money.
Only use when:
- User explicitly requests document/PDF analysis
- Document has hierarchical structure (reports, manuals)
- User accepts cost/privacy tradeoffs
Prerequisites:
OPENROUTER_API_KEY(or other backend key) must be set in environment- PageIndex submodule must be initialized
- Run within rlm-cli's virtual environment (has required dependencies)
Setup (REQUIRED before any pi.* operation):
Indexing (costs $$$):
Viewing structure (free after indexing):
Finding node IDs: Node IDs are assigned sequentially ("0000", "0001", ...) in tree traversal order. To see all node IDs, access the raw tree structure:
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/rlm/SKILL.md
Popularity
- Repository stars
- 64
- Repository forks
- 3
- 7-day trend score
- 21
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 3 Apr 2026, 7 months ago.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/rawwerks/rlm-cli/rlm)