Tenobrus/claude-rlm

83 stars · Last commit 2026-02-09

Recursive Language Models for Claude Code — process arbitrarily long inputs via recursive sub-agent delegation

README preview

# RLM: Recursive Language Models for Claude Code

A Claude Code skill that implements **Recursive Language Models (RLMs)** — enabling Claude to process arbitrarily long inputs by treating them as external data and recursively delegating analysis to sub-agents.

Based on the paper [Recursive Language Models](https://arxiv.org/abs/2512.24601) (Zhang, Kraska, Khattab; MIT CSAIL, 2026).

## What are Recursive Language Models?

LLMs have limited context windows, and their performance degrades as prompts get longer — a phenomenon called **context rot**. The standard solution is context compaction (summarization), but this loses fine-grained information.

RLMs take a fundamentally different approach: **treat the input as an external object in a programming environment, and let the LLM programmatically interact with it through code — including recursively calling itself on slices of the input.**

Three design choices distinguish RLMs from naive agent scaffolds:

1. **Symbolic handle**: The prompt is stored as a variable in the environment, not pasted into the LLM's context. The model gets metadata (length, preview) and manipulates it through code.
2. **Unbounded output via variables**: Results are built up in environment variables/files, not limited by the LLM's output length.
3. **Symbolic recursion**: The LLM can invoke sub-LM calls inside programmatic loops, enabling O(n) or O(n^2) semantic work over inputs of any length.

## Installation

View full repository on GitHub →