MIT论文中的一个插件并实现了该模式(arXiv:2512.24601)。不要把大量数据塞进上下文窗口,而是把它当作REPL中的外部变量,然后写代码到......
概览
MIT论文中的一个插件并实现了该模式(arXiv:2512.24601)。不要把大量数据塞进上下文窗口,而是把它当作REPL中的外部变量,编写代码进行程序性检查、分解和搜索。只有结果才会进入上下文。 (插件/rlm-interceptor.ts)会自动将大文件读取重写为元数据摘要,并提供沙盒执行和知识库搜索的定制工具。 在OpenCode中,使用Ctrl+K然后选择:- project:rlm — 用于大型上下文任务调用RLM - project:rlm-stats — 显示令牌节省仪表盘 - @rlm — 直接调用RLM代理 当检测到大型上下文任务时,该技能会自动激活。拦截器会无声地重写工具调用,以防止原始数据进入上下文。 该插件提供了MCP工具(Claude代码)和自定义工具(OpenCode): 搜索结果使用——搜索不会返回完整区块,而是高亮显示与......匹配的查询词窗口。
概述(AI 翻译)
一个针对 Claude Code 和 OpenCode 的插件,实现了 MIT 论文中的 递归语言模型(RLM) 模式(arXiv:2512.24601)。不要把大量数据塞进上下文窗口,而是将其当作 REPL 中的外部变量,编写代码进行程序化检查、分解和搜索。只有结果才会进入上下文。
安装
克劳德·科德
重启Claude代码。完成。
或者加载一次会话:
开放代码
RLM 拦截插件(plugins/rlm-interceptor.ts)自动将大文件读取重写为元数据摘要,并提供沙盒执行和知识库搜索的定制工具。
在OpenCode中,使用Ctrl+K然后选择:
project:rlm— 在大上下文任务中调用RLMproject:rlm-stats— 显示代币储蓄仪表盘@rlm— 直接调用RLM代理
RLM CLI(可选,适用于海量数据集)
用途
当检测到大型上下文任务时,该技能会自动激活。拦截器会无声地重写工具调用,以防止原始数据进入上下文。
直接在Claude代码中调用:
在OpenCode中调用:
查看代币折扣:
定制工具
本页由 AI 翻译,技术细节请以原文为准。
README
以下为原文 README 节选,完整内容请查看原文。
RLM Skill
A plugin for Claude Code and OpenCode implementing the Recursive Language Model (RLM) pattern from MIT’s paper (arXiv:2512.24601). Instead of stuffing massive data into the context window, treat it as an external variable in a REPL and write code to programmatically examine, decompose, and search it. Only results enter context.
Install
Claude Code
/plugin marketplace add lets7512/rlm-skill
/plugin install rlm@rlm-skill
Restart Claude Code. Done.
Or load for a single session:
claude --plugin-dir /path/to/rlm-skill
OpenCode
# Copy agents, commands, and plugins to your project or user config
cp -r .opencode/agents/ .opencode/commands/ .opencode/plugins/ ~/.config/opencode/
# Or use from project root (auto-detected from .opencode/)
# Install plugin dependencies
cd .opencode && npm install
The RLM interceptor plugin (plugins/rlm-interceptor.ts) automatically rewrites large file reads into metadata summaries and provides custom tools for sandbox execution and knowledge base search.
In OpenCode, use Ctrl+K then select:
project:rlm— invoke RLM for large-context tasksproject:rlm-stats— show token savings dashboard@rlm— invoke the RLM agent directly
RLM CLI (optional, for massive datasets)
uv pip install -e .
Usage
The skill activates automatically when large-context tasks are detected. The interceptor silently rewrites tool calls to prevent raw data from entering context.
Invoke directly in Claude Code:
/rlm:rlm analyze this 500MB log file for error patterns
Invoke in OpenCode:
@rlm analyze this 500MB log file for error patterns
Check token savings:
/rlm:stats
Custom Tools
The plugin provides MCP tools (Claude Code) and custom tools (OpenCode):
| Tool | Purpose |
|---|---|
rlm_execute |
Run code in a sandboxed subprocess (python/js/shell). Only stdout enters context. |
rlm_execute_file |
Run code against a file. Content loaded as FILE_CONTENT variable, never enters context. |
rlm_index |
Index file content into an FTS5 knowledge base for later search. |
rlm_search |
Search indexed content with smart snippets + BM25 ranking + 3-layer fallback (porter/trigram/fuzzy). |
rlm_batch_execute |
Run multiple commands + search queries in ONE call. Saves tool-call overhead. |
rlm_fetch_and_index |
Fetch URL, convert HTML to text, chunk and index. Raw page never enters context. |
rlm_stats |
Show knowledge base statistics (indexed sources, chunk count, DB size). |
Smart Snippets
Search results use smart snippet extraction — instead of returning full chunks, the search highlights windows around matching query terms with ... context bridges. This minimizes tokens while preserving relevance.
3-Layer Search Fallback
- Porter stemming (FTS5 default) — handles word variants (
runningmatchesrun)
推荐工具
换一个关键词,或者移除筛选条件。
安装
npx skillfish add lets7512/rlm-skill