Recursive Memory Compaction Claude Code  ·  Codex

Agent memory that gets cheaper
the more you use it.

For Claude Code and Codex. It learns what you had to correct, so you never have to say it twice — and the context it costs you goes down the longer you use it.

Get started Read the docs
Watch it learn once, then get cheaper twice
rose  — Fix the silent S3 retry failure
without ROSE with ROSE 20 sessions later +
47 more exchanges…
▸▸ bypass permissions on (shift+tab to cycle) · esc to interrupt
ROSE store  ·  ~/.rose empty
L2
L1
L0
0:00 / 0:00
Learned once, then shortened every time it proves itself. Same behaviour, a third of the tokens.

By session three it knew more
and cost half as much.

Nobody wrote that lesson. You corrected the agent once, in the course of normal work, and ROSE kept the conclusion instead of the transcript — 4,200 tokens of fumbling reduced to 260.

Then it earned its way shorter twice: used, worked, shortened. A second lesson arrived from another repo and the two became one. Store went up, tokens loaded went 260 → 118.

Every other memory moves those together — remember more, load more. Pulling them apart is the entire product.

How it works →

Why it's different

Every other memory either
bankrupts you or forgets.

APPEND EVERYTHING over budget BUDGET every specific kept Overflows. SUMMARISE EVERYTHING BUDGET five specifics gone Fits. Lossy. ROSE BUDGET every specific kept Fits. Complete.
Bar height: what enters your context each prompt. Squares below: individual specifics — a port, a flag, a constant. ROSE keeps its own one level down, still reachable.

Append-only stores keep everything and grow until retrieval is guesswork and the context bill dwarfs the task it was meant to help with.

Summarisers stay cheap by throwing things away, and what they throw away first is the exact port, the one flag that mattered. The loss is invisible until something breaks.

Why you can trust it to shorten

It gets shorter without losing anything.

01

Use is the signal

Not age, not size, not a schedule. A lesson earns a shorter form only when it was loaded, actually used, and the work succeeded — which is proof it contained slack. Served but ignored earns nothing.

02

Nothing is deleted

Compression adds a level above. The verbose original sits underneath it forever, so "shorter" is never a bet you can lose. The worst case is that you walk back down.

03

Every loss is on the record

A shorter lesson must declare exactly what it dropped, as discrete claims. That turns walking back down from a search into a lookup — and it is why the short form is safe to load first.

The obvious objection

What happens when the short lesson isn't enough?

This is the question that sinks most compression schemes. Compression normally destroys the very information you would need to invert it, so recovering the right detail becomes a blind walk down a tree.

ROSE makes recording the loss mandatory. Every compressed lesson carries a manifest of the claims it removed and which node still holds each one — so "which detail do I need back?" is a short ranked list, not an exploration.

n_7f2a · L2 didn't cover it DROPPED[] retry budget is 3 0.34 parse body, not status 0.81 logs go to stderr 0.12 patch
One extra claim, roughly 40 tokens — not the whole verbose lesson.
What it costs you

Nothing on the turn you are waiting for.

WhenWhat runsYou wait
You submit a prompt Matching lessons are injected ~0.1s, and no model call at all until the store outgrows the budget
A substantial turn ends A reflector reads the session off-thread nothing — it is a detached process
The session ends Lessons minted, compression attempted, replayed against past work nothing
Once a day, with new evidence Lessons used together earn a shared parent nothing

Everything expensive is detached, so the only cost on your critical path is the injected text itself — and that is the number the whole design drives downwards.

An injection is never silent. You see ⋯ ROSE · 2 lessons · 512 tok — Retry policy, Cache TTLs above your prompt, naming what was loaded. A memory system that edits your prompts without saying so is one you cannot notice going wrong.

Install

Install once. It runs in every repo you open.

Install once, then work normally. ROSE runs in hooks: it injects on prompt submit, reflects off-thread when a turn ends, mints and compresses when a session ends, and consolidates once a day. Every expensive step is detached, so nothing blocks your turn.

Python 3.10+, at least one of claude or codex, and zero third-party Python dependencies. The store is plain files in your repo — nothing is sent anywhere.

Read the docs →   Source ↗

Install
uv tool install rose-memory
rose install --scope user
Or as a Claude Code plugin
/plugin marketplace add yiheinchai/rose
/plugin install rose@rose
Then, whenever you're curious
rose status     # what it knows, what it cost
rose tree       # the graph, by level
rose recall --prompt "..."  # what it would inject
Where it is honest

What it still gets wrong.

ROSE is young and its claims are falsifiable, which is the point. rose eval replays held-out work against every level of a lesson, with a control arm and blind grading, so a compression that stopped working shows up as a number rather than a feeling.

Read the honest gaps →

01

Recall over-serves

Precision is the weakest number in the system today. It injects lessons that turn out not to matter, and that is measured rather than hidden — rose status prints it.

02

One retrieval pass

There is no second look mid-turn when the agent discovers it needs more, and it cannot search the store itself.

03

Capture is young

The reflector still misses lessons a person would catch. When it does, that is a defect to file, not a fact of life.