agentleFS
andremoreira73andremoreira73/Useful-Skills-from-lyfX/skills/rlm/SKILL.md

rlm

Skill8 starsChanged 10 months agoMITView on GitHub

Process large codebases (>100 files) using the Recursive Language Model pattern. Treats code as an external environment, using parallel background agents to map-reduce complex tasks without context rot. Use when asked to "analyze codebase", "scan all files", deal with a "large repository", or "find usage of X across the project".

4 other projects use a version of this.

Adopted by

Most recently taken up by

  • Other versions4 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 4

    1. brainqub3/RLM★ 393same name
    2. Tenobrus/claude-rlm★ 95same name
    3. richardwhiteii/rlm★ 49same name
    4. saint0x/my-skills★ 1same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repository4 other files it gives its agents.

The file

Show its rules and text

We split this skill into the rules it gives an agent

14 rules. 0 are common, 9 are distinctive, and 5 are very specific to this project.

  • 0

    Common

    Most of the 3 edited versions we read keep these.

  • 9

    Distinctive

    This author's own choices. Worth a look.

  • 5

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    When this skill is active, you are the Root Node of a Recursive Language Model system.

    line 18
  2. Very specific:

    Native: Use Glob for file patterns, Grep with output_mode: "files_with_matches" for content.

    line 35
  3. Distinctive:

    Spawn: Use the Task tool to launch parallel sub-agents.

    line 44
  4. Very specific:

    Use subagent_type="Explore" for read-only analysis, subagent_type="general-purpose" if the agent needs to write.

    line 47
  5. Very specific:

    Collect: Read background agent outputs via the Read tool on output_file paths, or use TaskOutput to retrieve results.

    line 64
  6. Distinctive:

    Synthesize: Look for patterns, consensus, or specific answers in the aggregated data.

    line 66
  7. Distinctive:

    Refine: If the answer is incomplete, perform a second RLM recursion on the missing pieces.

    line 67
  8. Distinctive:

    NEVER: read more than 3-5 files into your main context at once.

    line 71
  9. Distinctive:

    ALWAYS: prefer the Task tool for reading/analyzing files when count > 1.

    line 72
  10. Very specific:

    Python is your Memory: If you need to track state across 50+ files, write a Python script (or use rlm.py) to scan them and output a summary.

    line 74
  11. Very specific:

    Read src/api/routes.ts, then src/api/users.ts, then ...

    line 80
  12. Distinctive:

    If Task tool agents are unavailable or failing:

    line 89
  13. Distinctive:

    Write a Python script that loads each file, runs a regex/AST check, and prints results to stdout.

    line 91
  14. Distinctive:

    Read the script's stdout via Bash.

    line 92

“Common” is measured: kept by at least 6 in 10 of the 3 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Recursive Language Model (RLM) Skill

Adapted from the RLM skill by BowTiedSwan for the Claude Code CLI environment.

License notice: The original repository does not specify a license. This adaptation is provided with attribution; upstream licensing status is unresolved.

Core Philosophy

"Context is an external resource, not a local variable."

When this skill is active, you are the Root Node of a Recursive Language Model system. Your job is NOT to read every file yourself, but to orchestrate sub-agents that read code in parallel and report back summaries.

Protocol: The RLM Loop

Phase 1: Choose Your Engine

EngineUse CaseTool
Native ModeGeneral codebase traversal, finding files, structure.Glob, Grep, Bash
Strict ModeDense data analysis (logs, CSVs, massive single files).python3 ~/.claude/skills/rlm/scripts/rlm.py

Phase 2: Index & Filter (The "Peeking" Phase)

Goal: Identify relevant data without loading it into your main context.

  1. Native: Use Glob for file patterns, Grep with output_mode: "files_with_matches" for content.
  2. Strict: Use python3 ~/.claude/skills/rlm/scripts/rlm.py peek "query".

Phase 3: Parallel Map (The "Sub-Query" Phase)

Goal: Process chunks in parallel using fresh agent contexts.

  1. Divide: Split the work into atomic units (one file or chunk per agent).
    • Strict Mode: python3 ~/.claude/skills/rlm/scripts/rlm.py chunk --pattern "*.log" -> JSON chunks.
  2. Spawn: Use the Task tool to launch parallel sub-agents.
    • Launch 3-5+ agents in parallel for broad tasks.
    • Give each agent one specific file or chunk and a focused question.
    • Use subagent_type="Explore" for read-only analysis, subagent_type="general-purpose" if the agent needs to write.
    • Set run_in_background=true for true parallelism.
Example — launch in a single message with multiple Task tool calls:

Task(subagent_type="Explore", run_in_background=true,
     prompt="Read src/api/routes.ts. Extract all endpoints and their @Auth decorators.")
Task(subagent_type="Explore", run_in_background=true,
     prompt="Read src/api/users.ts. Extract all endpoints and their @Auth decorators.")
...

Phase 4: Reduce & Synthesize (The "Aggregation" Phase)

Goal: Combine results into a coherent answer.

  1. Collect: Read background agent outputs via the Read tool on output_file paths, or use TaskOutput to retrieve results.
  2. Synthesize: Look for patterns, consensus, or specific answers in the aggregated data.
  3. Refine: If the answer is incomplete, perform a second RLM recursion on the missing pieces.

Critical Instructions

  1. NEVER read more than 3-5 files into your main context at once.
  2. ALWAYS prefer the Task tool for reading/analyzing files when count > 1.
  3. Use rlm.py for programmatic slicing of large files that Grep can't handle well.
  4. Python is your Memory: If you need to track state across 50+ files, write a Python script (or use rlm.py) to scan them and output a summary.

Example Workflow: "Find all API endpoints and check for Auth"

Wrong Way (Monolithic):

  • Read src/api/routes.ts, then src/api/users.ts, then ... (context fills up, reasoning degrades)

RLM Way (Recursive):

  1. Filter: Grep(pattern="@Controller", output_mode="files_with_matches") -> 20 files.
  2. Map: Launch 20 Task agents in parallel (background), each extracting endpoints + auth decorators from one file.
  3. Reduce: Collect all 20 outputs. Compile into a single table. Identify missing auth.

Recovery Mode

If Task tool agents are unavailable or failing:

  1. Fall back to Iterative Python Scripting.
  2. Write a Python script that loads each file, runs a regex/AST check, and prints results to stdout.
  3. Read the script's stdout via Bash.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.