Skip to content

Comments

Move RLM system prompt into first user prompt#764

Merged
snimu merged 3 commits intomainfrom
sebastian/rlm-system-prompt-as-user-prompt-2026-01-22
Jan 22, 2026
Merged

Move RLM system prompt into first user prompt#764
snimu merged 3 commits intomainfrom
sebastian/rlm-system-prompt-as-user-prompt-2026-01-22

Conversation

@snimu
Copy link
Contributor

@snimu snimu commented Jan 22, 2026

Description

The RLM contains a system prompt that describes the scaffolding, as well as dynamic information such as the tools available to the sub-LLMs, the tools available to the RLM inside the REPL, and in Python mode, the installed packages. This is crucial information, but so is the normal system prompt which describes the tool parser among other important facts. Therefore, the RLM system prompt should neither overwrite the user-set system prompt, nor be overwritten by it. Previously, it was however overwritten by the user-set system prompt.

This PR changes that by changing the user prompt like this:

<RLM_SCAFFOLDING>
{rlm_system_prompt}
<RLM_SCAFFOLDING>

{user_prompt}

This preserves any user-provided system prompt, but still properly separates the rlm-scaffolding information from the actual user prompt.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Test improvement

Testing

  • All existing tests pass when running uv run pytest locally.
  • New tests have been added to cover the changes

Checklist

  • My code follows the style guidelines of this project as outlined in AGENTS.md
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

Note

Behavior change

  • RLMEnv.get_prompt_messages: On first turn, prepends the RLM scaffolding (filesystem summary, REPL workflow, tool docs) to the first user message, wrapped in <RLM_SCAFFOLDING>...</RLM_SCAFFOLDING>, instead of modifying the system message.
  • Preserves any existing system prompt; detects and avoids duplicate insertion; handles content as str/list-of-parts/dict; falls back to adding a new user message if needed.

Docs

  • Updates docs/environments.md and environments/AGENTS.md to describe the new scaffolding injection into the first user message and clarify RLM prompts/tooling behavior.

Written by Cursor Bugbot for commit accc98a. This will update automatically on new commits. Configure here.

@snimu snimu merged commit 4c77cba into main Jan 22, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant