展示HN:使用麻省理工学院的递归语言模型论文在Claude代码中分析文件的RLM-MCP

1作者: ahmedm2414 天前原帖
RLM-MCP – 使用麻省理工学院的递归语言模型分析Claude Code中的大型文件。 我构建了一个MCP服务器,允许Claude Code分析超出其上下文窗口的文件,采用了麻省理工学院的递归语言模型方法(arXiv:2512.24601)。 问题:Claude Code无法将一个10GB的日志文件放入其上下文中。传统的grep/read返回数千个原始匹配的token。 解决方案:与其将数据塞入上下文,不如将文件视为外部环境。Claude编写Python代码,MCP服务器在完整文件上执行该代码,只有结果返回。 你:“在这个5GB的日志中找到所有错误” Claude:加载文件 → 编写正则表达式 → 在REPL中执行 → 返回匹配结果 结果:token减少78%,准确性相同 实际基准测试(300KB日志文件): - Grep/Read: 约12,500个token - RLM: 约2,700个token - 两者找到的结果完全相同 不需要API密钥 – 适用于Claude Code订阅。Claude本身是“大脑”,MCP服务器只是执行Python的“手”。 安装: ``` pip install rlm-mcp ``` 在Claude Code设置中添加: ```json {"mcpServers": {"rlm": {"command": "rlm-mcp"}}} ``` GitHub: https://github.com/ahmedm224/rlm-mcp 论文: https://arxiv.org/abs/2512.24601 欢迎对该方法提供反馈。麻省理工学院的论文是在GPT-5和Qwen上进行测试的 – 本文将其适配于Claude Code的MCP架构。
查看原文
RLM-MCP – Analyze massive files in Claude Code using MIT&#x27;s Recursive Language Models.<p>I built an MCP server that lets Claude Code analyze files that exceed its context window by implementing the Recursive Language Models approach from MIT (arXiv:2512.24601).<p>The problem: Claude Code can&#x27;t fit a 10GB log file in its context. Traditional grep&#x2F;read returns thousands of tokens of raw matches.<p>The solution: Instead of stuffing data into context, treat the file as an external environment. Claude writes Python code, the MCP server executes it on the full file, and only the results come back.<p>You: &quot;Find all errors in this 5GB log&quot;<p>Claude: loads file → writes regex → executes in REPL → returns matches<p>Result: 78% fewer tokens, same accuracy<p>Real benchmark (300KB log file): - Grep&#x2F;Read: ~12,500 tokens - RLM: ~2,700 tokens - Both found identical results<p>No API keys needed – works with Claude Code subscriptions. Claude itself is the &quot;brain,&quot; the MCP server is just the &quot;hands&quot; executing Python.<p>Install: pip install rlm-mcp<p><pre><code> Add to Claude Code settings: {&quot;mcpServers&quot;: {&quot;rlm&quot;: {&quot;command&quot;: &quot;rlm-mcp&quot;}}} GitHub: https:&#x2F;&#x2F;github.com&#x2F;ahmedm224&#x2F;rlm-mcp Paper: https:&#x2F;&#x2F;arxiv.org&#x2F;abs&#x2F;2512.24601 </code></pre> Would love feedback on the approach. The MIT paper tested with GPT-5 and Qwen – this adapts it for Claude Code&#x27;s MCP architecture