[PR #13499] feat: add RLM (Recursive Language Model) engine #14693

Open
opened 2026-02-16 18:19:28 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/13499

State: open
Merged: No


This PR adds a JavaScript REPL-based recursive reasoning system that enables LLMs to execute code iteratively in a sandboxed VM environment.

Disclaimer: This code was entirely AI-generated using OpenCode. I haven't had time to review it thoroughly, but I've tested it via nix package install and it works great. Context rebuilding is surprisingly fast.
What's included:

  • Sandboxed vm-based REPL with execution timeout and variable persistence
  • context_query tool for verification during RLM execution
  • Session-level toggle via TUI and rlm_toggle keybind
  • Enabled by default
  • Last summary is always sent along with compacted context, which helps preserve long context and drastically reduces hallucination
    What this enables:
    With RLM, the model can now handle session context questions that were previously impossible — things like:
  • "What was the first error we fixed in this session?"
  • "Which files did we modify 10000 messages ago?"
  • "Summarize all the changes we've made so far using context_query"
  • "What was my original request before we went down this rabbit hole?"
    If you have long sessions where the model starts forgetting earlier context, RLM can help. Let me know how it goes!

ported from: https://github.com/alexzhang13/rlm

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/13499 **State:** open **Merged:** No --- This PR adds a JavaScript REPL-based recursive reasoning system that enables LLMs to execute code iteratively in a sandboxed VM environment. > Disclaimer: This code was entirely AI-generated using OpenCode. I haven't had time to review it thoroughly, but I've tested it via nix package install and it works great. Context rebuilding is surprisingly fast. What's included: - Sandboxed vm-based REPL with execution timeout and variable persistence - context_query tool for verification during RLM execution - Session-level toggle via TUI and rlm_toggle keybind - Enabled by default - Last summary is always sent along with compacted context, which helps preserve long context and drastically reduces hallucination What this enables: With RLM, the model can now handle session context questions that were previously impossible — things like: - "What was the first error we fixed in this session?" - "Which files did we modify 10000 messages ago?" - "Summarize all the changes we've made so far using context_query" - "What was my original request before we went down this rabbit hole?" If you have long sessions where the model starts forgetting earlier context, RLM can help. Let me know how it goes! ported from: https://github.com/alexzhang13/rlm
yindo added the pull-request label 2026-02-16 18:19:28 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#14693