Dspy Rlm Module

Use dspy.RLM (Recursive Language Model) for reasoning over contexts too large to fit in an LLM's working window — entire codebases, long logs, massive documents, or multi-step data exploration that needs a sandboxed Python REPL. Use when the input is >100k tokens, needs recursive chunking, or benefits from the LLM writing and running code to probe data.

280 stars 24 forksAI, LLMs & Agents Plugin marketplace

Install

Claude Code plugin
/plugin marketplace add intertwine/dspy-agent-skills

The repo is a Claude Code plugin marketplace. Run /plugin afterwards to pick the plugin that includes this skill.

skills CLI (Claude Code, Cursor, Codex and more)
npx skills add intertwine/dspy-agent-skills --skill dspy-rlm-module
Manual install
git clone --depth 1 https://github.com/intertwine/dspy-agent-skills.git /tmp/dspy-agent-skills
mkdir -p ~/.claude/skills
cp -r /tmp/dspy-agent-skills/skills/dspy-rlm-module ~/.claude/skills/dspy-rlm-module

Personal skills live in ~/.claude/skills. Use .claude/skills in a project folder to share a skill with your team.

From the SKILL.md

# `dspy.RLM` — Recursive Language Model

`dspy.RLM` runs the LLM in a sandboxed Python REPL (Pyodide/WASM via Deno) with access to the full context as variables. The LLM writes code to slice, grep, summarize, and recursively sub-query the data, iterating until it can answer. Use it when the context is too large to cram into a single prompt.

## Prerequisites

- **Deno installed** (for the default `PythonInterpreter`): `brew install deno` or see https://deno.land. The interpreter is a Pyodide-in-WASM sandbox spawned by Deno.
- A sub-LM for inner calls — usually a cheaper model than the outer LM. Defaults to `dspy.settings.lm`.

## Canonical usage

```python
import dspy

dspy.configure(lm=dspy.LM("openai/gpt-4o"))
sub_lm = dspy.LM("openai/gpt-4o-mini")    # cheap inner model

rlm = dspy.RLM(
    "context, query -> answer",
    max_iterations=20,
    max_llm_calls=50,
    max_output_chars=10_000,
    sub_lm=sub_lm,
    tools=[],
    verbose=False,
)

result = rlm(
    context=open("huge_log.txt").read(),   # can be 500k+ tokens
    query="Summarize every unique error class and how many times each appeared.",
)
print(result.answer)
```

## Full constructor
Read the full skill on GitHub

Details

Skill name
dspy-rlm-module
Path
skills/dspy-rlm-module/SKILL.md
License
MIT
Repo updated
6 September 2026

FAQ

What does the Dspy Rlm Module skill do?

Use dspy.RLM (Recursive Language Model) for reasoning over contexts too large to fit in an LLM's working window — entire codebases, long logs, massive documents, or multi-step data exploration that needs a sandboxed Python REPL. Use when the input is >100k tokens, needs recursive chunking, or benefits from the LLM writing and running code to probe data.

How do I install the Dspy Rlm Module skill?

Claude Code plugin: /plugin marketplace add intertwine/dspy-agent-skills. Skills go in ~/.claude/skills (personal) or .claude/skills (project), and Claude loads them automatically when a task matches the description.

Is Dspy Rlm Module popular?

It lives in intertwine/dspy-agent-skills, which has 280 GitHub stars and 24 forks.

Related skills

Dspy Advanced Workflow

280

intertwine/dspy-agent-skills

Build DSPy 3.2.x programs through spec, program, metric and baseline; extend to optimization and export when requested and justified by task budget. Orchestrates the other four DSPy skills (dspy-fundamentals, dspy-evaluation-harness, dspy-gepa-optimizer, dspy-rlm-module) in the correct order. Use for greenfield DSPy builds; prototypes may stop at a validated baseline.

Productivity & Notes24

Dspy Evaluation Harness

280

intertwine/dspy-agent-skills

Build DSPy evaluation harnesses with rich-feedback metrics that are essential for GEPA optimization. Use when writing a metric function, calling dspy.Evaluate, splitting dev/val sets, debugging "why is my optimizer not improving?", or designing CI-ready DSPy eval suites.

Writing & Content24

Dspy Fundamentals

280

intertwine/dspy-agent-skills

Write idiomatic DSPy 3.2.x programs — typed Signatures, dspy.Module subclasses, Predict/ChainOfThought/ReAct/ProgramOfThought, and save/load. Use this when starting any new DSPy project or when fixing non-idiomatic DSPy code (hard-coded prompts, ad-hoc string templates, untyped outputs, non-serializable classes).

Software Development24

Review Skill

206

mongodb/agent-skills

Review a proposed Agent Skill for structural validity and content quality before publishing. Runs the skill-validator CLI to check for structural issues, scores the skill with an LLM judge, and interprets results to advise SMEs on what to address. Use when a user wants to review, validate, or quality-check an Agent Skill.

AI, LLMs & Agents46

Building with Typesafe Jev

156

aaddrick/building-with-typesafe-jev

Use when code needs a judgment about natural language that rules or regex cannot make (classify, route, triage, moderate, score, rank, match, dedupe, filter, extract, verify, or gate an action), when brainstorming where AI could fit in an app, when an LLM call exists only to pick a label, score, or yes/no, or when code uses TypeSafe AI, Jev, System One, typesafe-sdk, or @typesafe-ai/sdk.

AI, LLMs & AgentsIn 1 list12

AI News

133

Drix10/ai-resources

Answers "what's new in AI", "latest on <model/company/topic>", "AI news this week", "who raised" and similar questions about recent AI models, companies, funding rounds, tools and research, using the AI Resources daily briefings (blogs.drix10.com, CC BY 4.0) with cited sources. Use whenever the user asks for recent AI news or developments.

AI, LLMs & AgentsIn 1 list26

Browse the most popular Claude skills, all ai, llms & agents skills, or write your own with the skills generator.