Token导航 LogoToken导航TokenDH.com
研究检索敏感数据github未标认证来源可访问clear审计提醒

rlm罗姆

Agent Skill

rlm 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

196

周安装

8

GitHub Stars

63

下载量

63
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

3

许可证

MIT

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:rlm(罗姆)
来源仓库:https://github.com/rawwerks/rlm-cli
仓库路径:skills/rlm
安装命令:
npx skills add https://github.com/rawwerks/rlm-cli --skill rlm
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/rawwerks/rlm-cli --skill rlm

简介

仅当 add_summaries=True 时才填充

  • 在 pi.index() 中
  • 儿童
  • 对于叶节点(没有小节的部分)为 None
  • 树.raw[“结构”]
  • 是一个平面列表;层次结构位于 PINode.children 中
  • PageIndex 提取文档结构 (TOC),而不是内容。使用页码来定位原始 PDF 中的各个部分。
  • pi.toc() 的输出示例:
  • 📄 年度报告.pdf
  • • 执行摘要(第 1-5 页)
  • • 财务概览(第 6-20 页)
  • • 收入(第 6-10 页)
  • • 费用(第 11-15 页)
  • • 预测(第 16-20 页)
  • • 风险因素(第21-35页)
  • 每周安装量
  • 8
  • 存储库
  • rawwerks/rlm-cli
  • GitHub 之星
  • 63
  • 第一次看到
  • 2026 年 1 月 24 日
  • 安全审计
  • Gen Agent Trust Hub 通行证
  • 套接字通行证
  • 斯尼克警告

SKILL.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

pip install rlm-cli    # or: pipx install rlm-cli
uvx rlm-cli ask ...    # run without installing

Set an API key for your backend (openrouter is default):

export OPENROUTER_API_KEY=...  # default backend
export OPENAI_API_KEY=...      # for --backend openai
export ANTHROPIC_API_KEY=...   # for --backend anthropic

Commands

ask - Query with context

rlm ask <inputs> -q "question"

Inputs (combinable):

TypeExampleNotes
Directoryrlm ask. -q "..."Recursive, respects.gitignore
Filerlm ask main.py -q "..."Single file
URLrlm ask https://x.com -q "..."Auto-converts to markdown
stdin`git diff \rlm ask - -q "..."`- reads from pipe
Literalrlm ask "text" -q "..." --literalTreat as raw text
Multiplerlm ask a.py b.py -q "..."Combine any types

Options:

FlagDescription
-q "..."Question/prompt (required)
--backendProvider: openrouter (default), openai, anthropic
--model NAMEModel override (format: provider/model or just model)
--jsonMachine-readable output
--output-formatOutput format: text, json, or json-tree
--summaryShow execution summary with depth statistics
--extensions.py.tsFilter by extension
--include/--excludeGlob patterns
--max-iterations NLimit REPL iterations (default: 30)
--max-depth NRecursive RLM depth (default: 1 = no recursion)
--max-budget N.NNSpending limit in USD (requires OpenRouter)
--max-timeout NTime limit in seconds
--max-tokens NTotal token limit (input + output)
--max-errors NConsecutive error limit before stopping
--no-indexSkip auto-indexing
--exaEnable Exa web search (requires EXA_API_KEY)
--inject-file FILEExecute Python code between iterations

JSON output structure:

{"ok": true, "exit_code": 0, "result": {"response": "..."}, "stats": {...}}

JSON-tree output (--output-format=json-tree): Adds execution tree showing nested RLM calls:

{
  "result": {
    "response": "...",
    "tree": {
      "depth": 0,
      "model": "openai/gpt-4",
      "duration": 2.3,
      "cost": 0.05,
      "iterations": [...],
      "children": [...]
    }
  }
}

Summary output (--summary): Shows depth-wise statistics after completion:

  • JSON mode: adds summary field to stats
  • Text mode: prints summary to stderr
=== RLM Execution Summary ===
Total depth: 2 | Nodes: 3 | Cost: $0.0054 | Duration: 17.38s
Depth 0: 1 call(s) ($0.0047, 13.94s)
Depth 1: 2 call(s) ($0.0007, 3.44s)

complete - Query without context

rlm complete "prompt text"
rlm complete "Generate SQL" --json --backend openai

search - Search indexed files

rlm search "query" [options]
FlagDescription
--limit NMax results (default: 20)
--language pythonFilter by language
--paths-onlyOutput file paths only
--jsonJSON output

Auto-indexes on first use. Manual index: rlm index.

index - Build search index

rlm index .              # Index current dir
rlm index ./src --force  # Force full reindex

doctor - Check setup

rlm doctor       # Check config, API keys, deps
rlm doctor --json

Workflows

Git diff review:

git diff | rlm ask - -q "Review for bugs"
git diff --cached | rlm ask - -q "Ready to commit?"
git diff HEAD~3 | rlm ask - -q "Summarize changes"

Codebase analysis:

rlm ask . -q "Explain architecture"
rlm ask src/ -q "How does auth work?" --extensions .py

Search + analyze:

rlm search "database" --paths-only
rlm ask src/db.py -q "How is connection pooling done?"

Compare files:

rlm ask old.py new.py -q "What changed?"

Configuration

Precedence: CLI flags > env vars > config file > defaults

Config locations: ./rlm.yaml, ./.rlm.yaml, ~/.config/rlm/config.yaml

backend: openrouter
model: google/gemini-3-flash-preview
max_iterations: 30

Environment variables:

  • RLM_BACKEND - Default backend
  • RLM_MODEL - Default model
  • RLM_CONFIG - Config file path
  • RLM_JSON=1 - Always output JSON

Recursion and Budget Limits

Recursive RLM (--max-depth)

Enable recursive llm_query() calls where child RLMs process sub-tasks:

# 2 levels of recursion
rlm ask . -q "Research thoroughly" --max-depth 2

# With budget cap
rlm ask . -q "Analyze codebase" --max-depth 3 --max-budget 0.50

Budget Control (--max-budget)

Limit spending per completion. Raises BudgetExceededError when exceeded:

# Cap at $1.00
rlm complete "Complex task" --max-budget 1.00

# Very low budget (will likely exceed)
rlm ask . -q "Analyze everything" --max-budget 0.001

Requirements: OpenRouter backend (returns cost data in responses).

Other Limits

Timeout (--max-timeout) - Stop after N seconds:

rlm complete "Complex task" --max-timeout 30

Token limit (--max-tokens) - Stop after N total tokens:

rlm ask . -q "Analyze" --max-tokens 10000

Error threshold (--max-errors) - Stop after N consecutive code errors:

rlm complete "Write code" --max-errors 3

Stop Conditions

RLM execution stops when any of these occur:

  1. Final answer - LLM calls FINAL_VAR("variable_name") with the NAME of a variable (as a string)
  2. Max iterations - Exceeds --max-iterations (exit code 0, graceful - forces final answer)

FINAL_VAR usage (common mistake - pass variable NAME, not value):

# CORRECT:
result = {"answer": "hello", "score": 42}
FINAL_VAR("result")  # pass the variable NAME as a string

# WRONG:
FINAL_VAR(result)  # passing the dict directly causes AttributeError
  1. Max budget exceeded - Spending > --max-budget (exit code 20, error)
  2. Max timeout exceeded - Time > --max-timeout (exit code 20, error with partial answer)
  3. Max tokens exceeded - Tokens > --max-tokens (exit code 20, error with partial answer)
  4. Max errors exceeded - Consecutive errors > --max-errors (exit code 20, error with partial answer)
  5. User cancellation - Ctrl+C or SIGUSR1 (exit code 0, returns partial answer as success)
  6. 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:

# Create inject file
echo 'focus = "authentication"' > inject.py

# Run with inject file
rlm ask . -q "Analyze based on 'focus'" --inject-file inject.py

# In another terminal, update mid-run
echo 'focus = "authorization"' > inject.py

The file is checked before each iteration and executed if modified.

Exit Codes

CodeMeaning
0Success
2CLI usage error
10Input error (file not found)
11Config error (missing API key)
20Backend/API error (includes budget exceeded)
30Runtime error
40Index/search error

LLM Search Tools

When rlm ask runs on a directory, the LLM gets search tools:

ToolCostPrivacyUse For
rg.search()FreeLocalExact patterns, function names, imports
tv.search()FreeLocalTopics, concepts, related files
exa.search()$APIWeb search (requires --exa flag)
pi.*$$$APIHierarchical 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:

export EXA_API_KEY=...  # Get from https://exa.ai

Usage in REPL:

from rlm_cli.tools_search import exa, web

# Basic search
results = exa.search(query="Python async patterns", limit=5)
for r in results:
    print(f"{r['title']}: {r['url']}")

# With highlights (relevant excerpts)
results = exa.search(
    query="error handling best practices",
    limit=3,
    include_highlights=True
)

# Semantic alias
results = web(query="machine learning tutorial", limit=5)

# Find similar pages
results = exa.find_similar(url="https://example.com/article", limit=5)

exa.search() parameters:

ParamDefaultDescription
queryrequiredSearch query
limit10Max results
search_type"auto""auto", "neural", or "keyword"
include_domainsNoneOnly these domains
exclude_domainsNoneExclude these domains
include_textFalseInclude full page text
include_highlightsTrueInclude relevant excerpts
categoryNone"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:

  1. User explicitly requests document/PDF analysis
  2. Document has hierarchical structure (reports, manuals)
  3. 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):**

import sys
sys.path.insert(0, "/path/to/rlm-cli/rlm")        # rlm submodule
sys.path.insert(0, "/path/to/rlm-cli/pageindex")  # pageindex submodule

from rlm.clients import get_client
from rlm_cli.tools_pageindex import pi

# Configure with existing rlm backend
client = get_client(backend="openrouter", backend_kwargs={"model_name": "google/gemini-2.0-flash-001"})
pi.configure(client)

Indexing (costs $$$):

# Build tree index - THIS COSTS MONEY (no caching, re-indexes each call)
tree = pi.index(path="report.pdf")
# Returns: PITree object with doc_name, nodes, doc_description, raw

Viewing structure (free after indexing):

# Display table of contents
print(pi.toc(tree))

# Get section by node_id (IDs are "0000", "0001", "0002", etc.)
section = pi.get_section(tree, "0003")
# Returns: PINode with title, node_id, start_index, end_index, summary, children
# Returns: None if not found

if section:
    print(f"{section.title}: pages {section.start_index}-{section.end_index}")

Finding node IDs: Node IDs are assigned sequentially ("0000", "0001",...) in tree traversal order. To see all node IDs, access the raw tree structure:

import json
print(json.dumps(tree.raw["structure"], indent=2))
# Each node has: title, node_id, start_index, end_index

**pi.* API Reference:**

MethodCostReturnsDescription
pi.configure(client)FreeNoneSet rlm backend (REQUIRED first)
pi.status()FreedictCheck availability, config, warning
pi.index(path=str)$$$PITreeBuild tree from PDF
pi.toc(tree, max_depth=3)FreestrFormatted table of contents
pi.get_section(tree, node_id)FreePINode or NoneGet section by ID
pi.available()FreeboolCheck if PageIndex installed
pi.configured()FreeboolCheck if client configured

PITree attributes: doc_name, nodes (list of PINode), doc_description, raw (dict) PINode attributes: title, node_id, start_index, end_index, summary (may be None), children (may be None)

Notes:

  • summary is only populated if add_summaries=True in pi.index()
  • children is None for leaf nodes (sections with no subsections)
  • tree.raw["structure"] is a flat list; hierarchy is in PINode.children
  • PageIndex extracts document structure (TOC), not content. Use page numbers to locate sections in the original PDF.

Example output from pi.toc():

📄 annual_report.pdf

• Executive Summary (p.1-5)
• Financial Overview (p.6-20)
  • Revenue (p.6-10)
  • Expenses (p.11-15)
  • Projections (p.16-20)
• Risk Factors (p.21-35)

适合场景

01

调用多模型

02

代码和文本生成

03

Agent 推理流程

04

OpenRouter 模型接入

能力概览

能力 1

统一调用多种 LLM

能力 2

支持 Claude、Gemini、Kimi 等模型

能力 3

适合聊天、代码和推理任务

能力 4

可作为 Agent 模型调用入口

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

31.76%
按下载量换算20

Claude Code

23.43%
按下载量换算15

Antigravity

17.87%
按下载量换算11

Gemini CLI

12.26%
按下载量换算8

windsurf

7.67%
按下载量换算5

OpenCode

3.61%
按下载量换算2

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

可疑

权限和风险

敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。

来源信息

继续浏览同类 Skills