rlm-tools
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@rlm-toolsexplore the auth module and summarize its imports"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
RLM Tools
Your AI coding agent spends most of its token budget just reading your code — not reasoning about it. Every grep, file read, and glob result gets dumped into the conversation. On a large codebase, that's 25-35% of your context (and cost) burned on raw data the model never needed to see.
RLM Tools gives your agent a persistent sandbox to explore code in. Data stays server-side. Only the conclusions come back.
# Install in one line (Claude Code)
claude mcp add rlm-tools -- uvx rlm-tools
# Or Codex
codex mcp add rlm-tools -- uvx rlm-toolsThat's it. Your agent automatically uses the sandbox for exploration. No config, no prompting changes.
What Changes
Without RLM Tools — agent greps for import UIKit, gets 500 matches dumped into context. Reads 10 files, burns all their content as tokens. Context window fills up. Agent forgets what it was doing.
With RLM Tools — agent runs the same exploration in a server-side Python sandbox. Data stays in sandbox memory. Only the print() output enters context:
matches = grep("import UIKit")
by_module = {}
for m in matches:
module = m["file"].split("/")[0]
by_module.setdefault(module, []).append(m)
for module, ms in sorted(by_module.items(), key=lambda x: -len(x[1]))[:5]:
print(f"{module}: {len(ms)} files")500 lines of grep results become 5 lines of summary. The agent sees what it needs, nothing more.
Related MCP server: projscan
Real-World Impact
In typical coding workflows: 25-35% context reduction. That means your agent can explore roughly 40-50% more code before hitting context limits.
In heavy exploration tasks (reading many files, broad searches), savings go much further:
Scenario | Standard Tools | RLM Tools | Saved |
Grep across full app | 40,045 chars | 1,644 chars | 95.9% |
Read 10 large files | 1,493,720 chars | 13,588 chars | 99.1% |
Multi-step exploration | 136,102 chars | 5,285 chars | 96.1% |
Grep then read matches | 340,408 chars | 6,022 chars | 98.2% |
Find all usages of a pattern | 13,478 chars | 3,691 chars | 72.6% |
Understand a module | 94,745 chars | 16,925 chars | 82.1% |
Full benchmark methodology and reproduction steps: docs/benchmarks.md
How It Works
Three MCP tools. That's the entire API:
Tool | Purpose |
| Open a session on a directory |
| Run Python in the sandbox |
| Close session, free resources |
The sandbox provides built-in helpers:
read_file(path)/read_files(paths)— Read files into variables (cached across calls)grep(pattern)/grep_summary(pattern)/grep_read(pattern)— Searchglob_files(pattern)— Find files by patterntree(path, max_depth)— Directory structurellm_query(prompt, context)— Sub-LLM analysis (optional, requires API key)
Variables persist across rlm_execute calls within a session. The agent can build up understanding incrementally — search, filter, read, analyze — without any intermediate data touching the context window.
Works With
RLM Tools is a standard MCP server. It works with any MCP-compatible client: Claude Code, Codex, Cursor, and others.
JSON MCP config (Cursor, Windsurf, etc.)
{
"mcpServers": {
"rlm-tools": {
"command": "uvx",
"args": ["rlm-tools"]
}
}
}Direct run
uvx rlm-toolsFrom source
git clone https://github.com/stefanoshea/rlm-tools.git
cd rlm-tools
uv sync
uv run rlm-toolsThen point your MCP client to command: uv, args: ["--directory", "/path/to/rlm-tools", "run", "rlm-tools"].
Configuration
Copy .env.example to .env to customize. All settings are optional — RLM Tools works out of the box with zero config.
The core exploration features (read, grep, glob, tree) require no API key. The optional llm_query() helper calls the Anthropic API for semantic analysis within the sandbox — this is the only feature that requires a key.
Variable | Default | Description |
| — | Required for |
|
| Claude model used for |
|
| Max concurrent sessions |
|
| Session timeout in minutes |
Security
The sandbox is read-only and restricted:
Imports: Safe stdlib only (re, json, collections, math, etc.)
Builtins: Blocks exec, eval, compile,
__import__, breakpointFile access: Read-only, scoped to session directory, path traversal blocked
Execution: Configurable per-call timeout (default 30s)
Rate limits: Configurable max calls per session
Background
RLM Tools implements an RLM-style exploration loop: keep raw data in tool-side memory, send only compact outputs to the model. Built on the Model Context Protocol.
Development
git clone https://github.com/stefanoshea/rlm-tools.git
cd rlm-tools
uv sync --dev
pytest testsRun comparative benchmarks (requires a local project checkout):
RLM_EVAL_PROJECT_PATH=/path/to/project pytest evals -q -sLicense
MIT
Available Tools
3 toolsrlm_endA
End an RLM exploration session and free resources.
| Name | Required | Description | Default |
|---|---|---|---|
| session_id | Yes | Session ID to end |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
The description mentions 'free resources' which hints at cleanup, but does not disclose potential side effects, required permissions, or behavior if the session is already ended. Without annotations, more detail would be beneficial.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, efficient sentence with no wasted words. It is front-loaded and clear.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the simplicity of the tool (one required parameter, output schema exists), the description is mostly complete. However, it could mention error conditions for invalid session IDs.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The schema already provides a description for the only parameter ('Session ID to end'). The tool description adds no extra semantic value beyond that, so baseline 3 applies.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the action ('End') and the resource ('RLM exploration session') with the additional benefit of freeing resources. It is distinct from siblings 'rlm_start' and 'rlm_execute'.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies usage when the session is no longer needed, but provides no explicit guidance on when to use this tool versus alternatives, nor any prerequisites or exclusions.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
rlm_executeA
Execute Python in the session sandbox. detail_level controls response payload size (compact, usage, or full).
| Name | Required | Description | Default |
|---|---|---|---|
| session_id | Yes | Session ID from rlm_start | |
| code | Yes | Python code to execute. IMPORTANT: Batch multiple related operations into each call. A good call does: grep -> read top matches -> extract patterns -> print summary. A bad call does just one grep or one read_file. Variables persist between calls. | |
| detail_level | No | Response payload level: compact=stdout+error, usage=add usage metrics, full=add variable details | compact |
| max_new_variables | No | When detail_level=full, cap returned new_variables list to this size |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries full burden. The main description only mentions execution and detail_level. The code parameter description adds that variables persist between calls, which is crucial. Still missing details like sandbox limitations, timeouts, or security restrictions.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The main description is two concise sentences with no redundancy. Parameter descriptions are structured and informative. Every sentence serves a purpose, making the definition efficient.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
With output schema existing and full parameter coverage, the description still lacks high-level context about the sandbox environment, Python version, allowed modules, and error handling. The usage advice in code parameter is good but not exhaustive.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100%, giving a baseline of 3. The description adds value beyond schema by explaining the detail_level options and providing usage guidance in the code parameter (batching, persistence), enriching the agent's understanding.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states 'Execute Python in the session sandbox,' providing a specific verb and resource. It distinguishes from siblings (rlm_start, rlm_end) implicitly, but could be more explicit about the sandbox context.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The main description lacks usage guidance, but the code parameter description offers explicit advice on batching operations and variable persistence, helping the agent use the tool effectively. No direct comparison to alternatives is given, but the sibling tools make the execution purpose clear.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
rlm_startB
Start an RLM exploration session. Returns session_id, metadata, limits, and available functions. Set include_guidance=true to include strategy/example coaching text.
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Absolute path to the directory to explore | |
| query | Yes | What you want to find or analyze | |
| max_output_chars | No | Max characters per execute output | |
| max_llm_calls | No | Maximum llm_query/llm_query_batched calls for this session | |
| max_execute_calls | No | Maximum rlm_execute calls for this session | |
| execution_timeout_seconds | No | Per-rlm_execute timeout in seconds | |
| include_guidance | No | Include strategy/example guidance text in the response (larger payload) | |
| include_metadata | No | Scan directory and include file counts/types in response (set false for faster startup) |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden. It mentions return values (session_id, metadata, limits, functions) and the include_guidance flag, but does not disclose side effects, state creation, or access requirements for the directory path.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is very concise: two sentences with the purpose front-loaded. No wasted words.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given an output schema exists and 8 parameters (2 required), the description adequately outlines the tool's purpose and key returns. It could be slightly more complete by mentioning the include_metadata parameter's effect, but overall sufficient.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so the schema already documents all parameters. The description only adds context for the include_guidance parameter, which is minimal. It does not meaningfully augment the schema definitions.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool starts an RLM exploration session. It identifies the resource and action, but does not explicitly differentiate from sibling tools rlm_end and rlm_execute, which are for ending and executing within sessions.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies it's the first step in an RLM workflow, but it does not provide explicit guidance on when to use versus alternatives, nor does it mention prerequisites or when not to use.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
3 tool updates
v0.1.0- First observed
rlm_end - First observed
rlm_execute - First observed
rlm_start
TDQS
Scored across 3 tools
Each tool has a distinct purpose: starting, executing, and ending a session. No overlap.
All tools share the 'rlm_' prefix followed by a clear verb (start, execute, end), forming a consistent pattern.
Three tools cover the full session lifecycle efficiently without excess or deficiency.
The set provides complete lifecycle coverage for RLM sessions: start, execute, end. No obvious gaps.
Maintenance
Related MCP Connectors
An MCP server that gives your AI access to the source code and docs of all public github repos
MCP server for building and testing AI agents with multi-model experimentation and insights.
Driflyte MCP server which lets AI assistants query topic-specific knowledge from web and GitHub.
Hosted MCP server connecting claude.ai, ChatGPT and other AI apps to your own computer
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceAn MCP server that gives AI agents structured code understanding and precise code intelligence via local indexing of AST, call graphs, and semantic search.81 npm4Apache 2.0
- AlicenseNot gradedqualityAmaintenanceAn MCP server that provides AI coding agents with AST-accurate, context-budget-aware codebase querying, safety gates, and team policy integration via structured tools and a local plugin layer.562 npm4MIT
- AlicenseNot gradedqualityDmaintenanceA local MCP server that gives AI coding agents persistent memory and context across sessions.24 npmMIT
- AlicenseNot gradedqualityDmaintenanceAn MCP server that enables AI agents to navigate and understand codebases through file descriptions, semantic search, and code recommendations without repeatedly scanning files.MIT