claude-code-rlm
CLAUDE.md0 starsChanged 9 months agoMITView on GitHub
claude-code-rlm is a Claude Code plugin that integrates Recursive Language Models (RLM) for deep analysis of large codebases. Instead of loading entire codebases into context, it gives Claude a Python REPL where it can programmatically explore code and recursively delegate sub-analysis to focused sub-LM calls. Config is loaded in priority order (lowest → highest): built-in defaults, global ~/.config/claude-rlm/config.yaml, project .claude-rlm.yaml, environment variables. Key settings: backend, backend_kwargs.model_name, max_depth (recursion depth, default 2), max_iterations (REPL iterations, default 20), max_timeout (seconds, default 120),…
- Installs packages
In this repositoryOne other file it gives its agents.
- rlmSkill
The file
Files
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Commands
# Install in development mode
pip install -e .
# Run all tests (no API keys required)
pytest tests/
# Run a single test file
pytest tests/test_classifier.py
# Run a single test by name
pytest tests/test_classifier.py::TestRLMClassifier::test_bypass_keywords
# Run the plugin (from parent directory)
claude --plugin-dir ./claude-code-rlmArchitecture
claude-code-rlm is a Claude Code plugin that integrates Recursive Language Models (RLM) for deep analysis of large codebases. Instead of loading entire codebases into context, it gives Claude a Python REPL where it can programmatically explore code and recursively delegate sub-analysis to focused sub-LM calls.
Three integration points with Claude Code
UserPromptSubmithook (scripts/classify-hook.py) — Fast (<1s) regex-based classification with no API calls. If the query needs deep analysis, injectsadditionalContexttelling Claude to userlm_analyze. Usesscripts/quick_classifier.pyfor heuristics.- MCP Server (
python/mcp_server.py) — Long-lived process started via.mcp.json. Exposes three tools:rlm_analyze(query, focus_paths),rlm_search(query, file_pattern),rlm_status(). Uses lazy initialization — heavy dependencies only load on first tool call. - Skill (
skills/rlm/SKILL.md) —/rlmslash command for manual activation.
Request flow
User query
→ UserPromptSubmit hook (classify-hook.py → quick_classifier.py)
→ RLM needed? inject additionalContext → Claude calls rlm_analyze
→ MCP Server (mcp_server.py)
→ RLM.completion() runs Python REPL
→ custom tools: read_file, search_code, file_tree, git_*
→ recursive sub-LM calls via llm_query / rlm_query
→ returns analysis to ClaudeKey modules
| File | Purpose |
python/mcp_server.py | MCP tool definitions + RLM lifecycle management |
python/bridge.py | RLMBridge — wraps the rlms library, manages RLM instance |
python/config.py | Config loading: defaults → ~/.config/claude-rlm/config.yaml → .claude-rlm.yaml → env vars |
python/classifier.py | RLMClassifier — heuristic routing decisions (bypass vs. trigger keywords, context size) |
python/tools.py | Custom tools injected into RLM's REPL (read_file, search_code, git_info, file_tree, etc.) |
python/prompts.py | System prompts optimized for code analysis |
python/events.py | JSON event emission for state tracking |
Configuration
Config is loaded in priority order (lowest → highest): built-in defaults, global ~/.config/claude-rlm/config.yaml, project .claude-rlm.yaml, environment variables.
Key settings: backend, backend_kwargs.model_name, max_depth (recursion depth, default 2), max_iterations (REPL iterations, default 20), max_timeout (seconds, default 120), persistent (keep REPL alive, default true), auto_trigger (classification settings).
See .claude-rlm.example.yaml for the full example config.
Auto-trigger classifier decision order
/rlmprefix → force RLM- Auto-trigger disabled → standard CC
- Bypass keywords match (create file, run tests, commit…) → skip RLM
- Trigger keywords match (analyze, refactor, security, entire codebase…) → use RLM
- Context size thresholds exceeded → use RLM
- Default → standard CC
REPL security model
read_file and write_file are sandboxed to project root. write_file and run_command are disabled by default (opt-in via config). Dangerous builtins (eval, exec, compile, input) are removed. However, __import__ remains available, so there is no full isolation — intended for local development only.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

