DEV Community

Cover image for How I Gave Claude Code Infinite Memory (Using MIT's RLM Paper)
EncrEor
EncrEor

Posted on

How I Gave Claude Code Infinite Memory (Using MIT's RLM Paper)

I use Claude Code every day to build my startup — a one-person tech stack with Odoo, n8n, and a lot of Claude. It's incredible, except for one thing:

Claude forgets everything.

Every time the context window fills up, you /compact and poof — decisions, insights, architecture choices, all gone. You explain the same things again. Claude makes mistakes it already corrected. It's like working with a brilliant colleague who has amnesia.

The paper that changed everything

In December 2025, MIT CSAIL published a paper called "Recursive Language Models" (arXiv:2512.24601). The core idea:

Instead of cramming everything into the context window, treat history as an external object that the model navigates with tools — peek, grep, search — rather than loading entirely.

This clicked immediately. That's exactly what Claude Code needs.

So I built RLM

RLM is an MCP server (Model Context Protocol) that plugs into Claude Code and gives it persistent memory. Here's what it does:

1. Auto-save before context loss

RLM hooks into Claude Code's /compact event. Before your context is wiped, it automatically saves a snapshot. You never lose context silently again.

2. Two memory systems

System Purpose Example
Insights Key decisions, facts, rules "Backend is source of truth"
Chunks Full conversation segments "Session Jan 18 — API redesign discussion"

3. Powerful search

  • BM25 ranked search across all your history (French + English)
  • Fuzzy grep that tolerates typos (buisness → finds business)
  • Multi-project filtering — organize memory by project and domain

4. Smart retention

Old, unused chunks get auto-archived (gzip compressed). Important ones are protected by an immunity system (critical tags, frequent access). Archived chunks auto-restore when you need them.

The install

git clone https://github.com/EncrEor/rlm-claude.git
cd rlm-claude
./install.sh
Enter fullscreen mode Exit fullscreen mode

3 lines. Restart Claude Code. 14 tools available immediately.

Before vs After

Before RLM:

"We discussed this 2 hours ago... the API should use JWT, not sessions. I already explained why."

After RLM:

Claude recalls the JWT decision from 3 days ago, cites the reasoning, and builds on it.

It genuinely transformed how I work on long-running projects.

How it compares

Feature. Raw Context Letta/MemGPT RLM
Persistent memory. No Yes Yes
Works with Claude Code N/A No MCP
Auto-save before compact No N/A Yes
Fuzzy search. No No Yes
Multi-project. No No Yes
Install complexity N/A Complex 3 lines
Cost Free Self-hosted Free

What's next

RLM is at v0.9.0. The roadmap includes tests, CI/CD, and PyPI distribution (pip install rlm-claude). Contributions welcome.

If you use Claude Code for anything beyond one-shot tasks, give it a try. Stars and feedback appreciated.


Built with Claude Opus 4.5 — yes, Claude helped build its own memory system.

Top comments (0)