feat: add RLM (Recursive Language Model) engine#13499
Closed
ooo-mmm wants to merge 1 commit into
Closed
Conversation
Implements a JavaScript REPL-based recursive reasoning system that enables LLMs to iteratively execute code in a sandboxed VM environment. Core implementation: - Sandboxed vm-based REPL with execution timeout (30s default) - const/let hoisting for variable persistence across executions - Whitelisted globals only (Math, JSON, Array, etc.) - Injected functions: llm_query(), FINAL(), FINAL_VAR(), SHOW_VARS() Integration: - context_query tool for LLM verification during RLM execution - Structured context extraction preserving message history as JSON - Context overflow dialog prompting compact vs RLM mode - Session-level RLM toggle via TUI and keybind (rlm_toggle) - RLM status badge in footer - Shared REPL architecture across agent tasks Configuration (rlm section): - enabled: Enable RLM globally (default: false) - max_iterations: Iteration limit before forcing answer (default: 30) - max_depth: Recursion depth limit (default: 1) - sub_model: Model for sub-LLM queries inside REPL - verbose: Enable verbose logging Includes test suite for parsing, environment, and flow.
Contributor
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
Contributor
|
The following comment was made by an LLM, it may be inaccurate: Potential Duplicate FoundPR #8555: feat(tool): add rlm_repl tool for recursive LLM pattern This appears to be a related or duplicate PR that implements a similar REPL-based recursive LLM pattern. You should review this existing PR to understand:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds a JavaScript REPL-based recursive reasoning system that enables LLMs to execute code iteratively in a sandboxed VM environment.
What this enables:
With RLM, the model can now handle session context questions that were previously impossible — things like:
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