Process large codebases using the RLM (Recursive Language Model) pattern
Project description
coderlm
Make codex, gemini-cli, or any other coding agent into an RLM.
Install
# npm / bun
bunx coderlm@latest
npx coderlm@latest
# pypi
uvx coderlm
pipx run coderlm
Or install globally:
npm i -g coderlm # npm
uv tool install coderlm # pypi
Usage
coderlm <agent> --prompt "<task>" [--max-depth N] [--allowedTools TOOLS]
Examples
# Codex
coderlm codex --prompt "Find all TODO comments in src/"
coderlm codex --prompt "Find dead code in src/, lib/, and test/"
coderlm codex --prompt "Summarize the codebase" --max-depth 2
# Gemini
coderlm "bunx --bun @google/gemini-cli" --prompt "Review **/*.py for security issues"
coderlm "bunx --bun @google/gemini-cli" --prompt "Architecture overview of src/"
# Claude (non-recursive only — Claude cannot spawn nested Claude sessions)
coderlm claude --prompt "Fix type errors in src/" --allowedTools "Bash,Edit"
How It Works
- Build a system prompt with RLM instructions (discover, explore, decompose, aggregate)
- Inject context guards via
BASH_ENVso every bash subshell the agent spawns has output truncation active - Launch the agent with agent-specific flags for non-interactive execution
The agent starts with no file contents in context. It uses shell tools (fd, rg, cat, head, jq, etc.) to discover and inspect files as needed. For large file sets (>20 files), it spawns recursive sub-agents on subsets.
Context Guards (bundled)
bashrlm.sh is bundled and auto-activates for every agent run. It wraps high-output commands (cat, grep, rg, jq, find, ls, curl, etc.) with automatic truncation, preventing the agent from flooding its own context window with oversized output.
Truncation uses head+tail mode — the agent sees the start and end of any large output, with the middle omitted:
[TRUNCATED — showing 2000 of 15000 chars, first and last 1000]
Guards are redirect-aware: piping to a file (> /tmp/out.txt) bypasses truncation, so multi-step processing works naturally. The agent's system prompt includes instructions for this pattern.
Supported Agents
| Agent | Command | Notes |
|---|---|---|
| OpenAI Codex | codex |
Recommended — supports recursive sub-agents |
| Google Gemini | bunx --bun @google/gemini-cli |
Supports recursive sub-agents |
| Claude Code | claude |
Non-recursive only — cannot spawn nested Claude sessions |
| Any CLI | my-agent |
Combined prompt passed as single argument |
When to Use
- Many files to analyze (>10)
- Task benefits from divide-and-conquer
- Total content exceeds a comfortable context window
- You want the agent to explore strategically rather than read everything upfront
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file coderlm-0.2.0.tar.gz.
File metadata
- Download URL: coderlm-0.2.0.tar.gz
- Upload date:
- Size: 18.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.6 {"installer":{"name":"uv","version":"0.10.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4bdeb9d682db9114abe9e6afd5bc14ffde6a5b3c7bf7694c58bba269578f177c
|
|
| MD5 |
658fc3c5ad2369dc1d123a1576173b34
|
|
| BLAKE2b-256 |
22e9adbb7a32678d5e6459d5f5a3ae96c34d9ee18b1b976f0e086a35d7578fbb
|
File details
Details for the file coderlm-0.2.0-py3-none-any.whl.
File metadata
- Download URL: coderlm-0.2.0-py3-none-any.whl
- Upload date:
- Size: 12.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.6 {"installer":{"name":"uv","version":"0.10.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
80cd35d52b4fe8b86333a43b618cbb87f34bc7c17d33f0bf623ca7fb215b6735
|
|
| MD5 |
83e3e5b14de98ec5cd5c61f945aea5b1
|
|
| BLAKE2b-256 |
987e4f9d0b4de644ea6a1cee4266b72692e54bd160e3f0da6a97ad5a99add56b
|