RLM-Claude-Code
Transform Claude Code into a Recursive Language Model (RLM) agent with intelligent orchestration, unbounded context handling, persistent memory, and REPL-based decomposition.
rlm-core integration: This project bundles rlm-core as a required dependency, providing shared Rust-based implementations with recurse. rlm-core provides 10-50x faster pattern classification via PyO3 bindings. Pre-built wheels are available for common platforms.
What is RLM?
RLM (Recursive Language Model) enables Claude to handle arbitrarily large contexts by decomposing complex tasks into smaller sub-queries. Instead of processing 500K tokens at once, RLM lets Claude:
- Peek at context structure before deep analysis
- Search using patterns to narrow focus
- Partition large contexts and process in parallel via map-reduce
- Recurse with sub-queries for verification
- Remember facts and experiences across sessions
This results in better accuracy on complex tasks while optimizing cost through intelligent model selection.
Quick Start
Prerequisites
- Python 3.12+:
brew install python@3.12 or python.org
- uv (Python package manager):
curl -LsSf https://astral.sh/uv/install.sh | sh
- Rust 1.75+ (for dev builds):
rustup update stable — not needed if installing from pre-built wheels
Installation (from pre-built wheel)
Download the wheel for your platform from GitHub Releases, then:
pip install rlm_claude_code-*.whl
Installation (from source, requires Rust)
# Clone with submodules (rlm-core is bundled)
git clone --recurse-submodules https://github.com/rand/rlm-claude-code.git
cd rlm-claude-code
# Build and install (compiles rlm-core Rust library)
maturin develop --release
# Install Python dependencies
uv sync --all-extras
# Verify
python -c "import rlm_core; print(rlm_core.version())"
uv run pytest tests/ -v
As a Claude Code Plugin
Step 1: Install the Plugin
# Add the marketplace (one-time setup)
claude plugin marketplace add github:rand/rlm-claude-code
# Install the plugin
claude plugin install rlm-claude-code@rlm-claude-code
Step 2: Set Up the Plugin Environment
The plugin includes rlm-core (bundled via maturin). After installation:
# Navigate to the plugin directory (adjust version number as needed)
PLUGIN_DIR=~/.claude/plugins/cache/rlm-claude-code/rlm-claude-code/$(ls ~/.claude/plugins/cache/rlm-claude-code/rlm-claude-code/ | sort -V | tail -1)
cd "$PLUGIN_DIR"
# Create venv and install (includes rlm-core)
uv venv && uv sync
# Verify rlm-core is available
"$PLUGIN_DIR/.venv/bin/python" -c "import rlm_core; print('rlm_core OK:', rlm_core.version())"
Step 3: Verify Installation
Restart Claude Code. You should see "RLM initialized" on startup.
Test the hooks manually:
PLUGIN_DIR=~/.claude/plugins/cache/rlm-claude-code/rlm-claude-code/$(ls ~/.claude/plugins/cache/rlm-claude-code/rlm-claude-code/ | sort -V | tail -1)
"$PLUGIN_DIR/.venv/bin/python" "$PLUGIN_DIR/scripts/init_rlm.py"
# Should print: RLM initialized
Updating the Plugin
When updating, you'll need to re-create the venv:
claude plugin update rlm-claude-code@rlm-claude-code
# Re-setup the new version
PLUGIN_DIR=~/.claude/plugins/cache/rlm-claude-code/rlm-claude-code/$(ls ~/.claude/plugins/cache/rlm-claude-code/rlm-claude-code/ | sort -V | tail -1)
cd "$PLUGIN_DIR" && uv venv && uv sync
# rlm-core is bundled — no extra linking needed
Architecture