This guide walks you through installing and using RLM-Claude-Code.
- Python 3.12+
- uv package manager (install uv)
- Claude Code (optional, for plugin usage)
Verify your setup:
uv --version
python --versiongit clone https://github.com/rand/rlm-claude-code.git
cd rlm-claude-code
# Install all dependencies
uv sync --all-extras# Run tests (should see 3000+ pass)
uv run pytest tests/ -v --tb=short
# Type check
uv run ty check src/If you want to use RLM with Claude Code:
# 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-codeAlternative: Install from local clone:
# From the rlm-claude-code directory
claude plugin install .Start Claude Code and you should see:
RLM initialized
Test it works:
/rlm status
RLM provides a sandboxed Python environment with context variables and helper functions:
# Context is automatically available:
conversation # List of messages
files # Dict of filename → content
tool_outputs # List of tool results
working_memory # Scratchpad dict
# Helper functions:
peek(files['main.py'], 0, 500) # View first 500 chars
search(files, 'def authenticate') # Find patterns
llm("Summarize this code", context=files['auth.py']) # Sub-query| Command | What it does |
|---|---|
/rlm |
Show current status |
/rlm on |
Enable RLM mode |
/rlm off |
Disable RLM mode |
/rlm mode fast |
Quick mode (depth=1, Haiku) |
/rlm mode thorough |
Deep mode (depth=3, Opus) |
/simple |
Bypass RLM for one query |
RLM automatically activates for complex tasks:
- Large context (>80K tokens)
- Cross-file questions
- Debugging requests
- Architecture discussions
For simple questions, RLM stays off to avoid overhead.
RLM stores settings at ~/.claude/rlm-config.json:
{
"activation": {
"mode": "complexity",
"fallback_token_threshold": 80000
},
"depth": {
"default": 2,
"max": 3
},
"trajectory": {
"verbosity": "normal",
"streaming": true
}
}Edit directly or use slash commands:
/rlm mode thorough
/rlm depth 3
/rlm save
| Mode | Depth | Model | Best For |
|---|---|---|---|
fast |
1 | Haiku | Quick questions |
balanced |
2 | Sonnet | Most tasks (default) |
thorough |
3 | Opus | Complex debugging |
RLM can persist knowledge across sessions:
from src import MemoryStore, MemoryEvolution
store = MemoryStore(db_path="~/.claude/rlm-memory.db")
# Store facts
store.create_node(
node_type="fact",
content="Project uses PostgreSQL",
confidence=0.9,
)
# Memory evolves: task → session → longterm
evolution = MemoryEvolution(store)
evolution.consolidate(task_id="task-1")
evolution.promote(session_id="session-1")Control costs with limits:
from src import EnhancedBudgetTracker, BudgetLimits
tracker = EnhancedBudgetTracker()
tracker.set_limits(BudgetLimits(
max_cost_per_task=5.0,
max_recursive_calls=10,
))Or via slash command:
/rlm budget $5
# Check dependencies
uv sync --all-extras
# Run with verbose output
uv run pytest tests/ -v --tb=long- Verify installation:
claude plugins list - Check hooks exist:
ls hooks/hooks.json - Test manually:
uv run python scripts/init_rlm.py
rm ~/.claude/rlm-config.json
rm ~/.claude/rlm-memory.db- User Guide - Complete usage documentation
- Architecture - Design decisions
- SPEC Overview - Capability specifications
- README - Quick reference