RésuméSay hello
All write-ups

Agents · 7 min read

Moodify had to listen

Turning Google's ReasoningBank into memory for a playlist agent.

Moodify is a small app I built that turns how you feel into a Spotify playlist. Four friends and I use it. You type something like “gym session, running on 4 hours of sleep”, it writes a brief, picks the songs and saves the playlist to your account. Afterwards you can rate it and write a review.

At first, Moodify had no memory of what you thought of its playlists. If a workout playlist was too slow, the next one could be too slow in exactly the same way.

I didn’t want to invent agent memory from scratch, so I built it on a published design: Google’s ReasoningBank. This post is about what I kept from the paper, what broke when I applied it to music, and the four feedback loops Moodify runs now.

०१What the paper does

ReasoningBank is memory for agents that do long, multi-step tasks, like browsing the web or fixing code. Most agents start every task from zero: they repeat yesterday’s mistakes and forget what worked. The paper’s answer is to write down short lessons after every task and read the relevant ones back before the next.

The paper
RetrieveActLLM judgeExtractAppendMemory bank by similarityrun the task≤ 3 items per runonly grows grades its own runnothing is ever edited itemsthe runsuccess or failureitemsaddsnext task
ReasoningBank's loop. The two stages in rust are the ones that didn't fit Moodify: a model grading its own work, and a memory that can only grow.

Three ideas carried straight over:

  1. Lessons, not logs. A memory item is three short fields: a title, a description of when it applies, and the content, the advice itself. A transcript of a run is long and hard to reuse. “Keep workout sections at energy 8 or more” isn’t.
  2. Failures count. The paper learns from “both successful and failed experiences”. A playlist that missed teaches as much as one that landed.
  3. At most three per run. A few sharp lessons beat a pile of vague ones.

०२Where the paper broke

a)Self-graded outcomes

The paper usually has no answer key, so it asks a model to grade its own run: “LLM-as-a-judge … without any ground-truth reference”. Moodify has something better, the listener’s review. But a review is free text in any shape (slang, typos, one word or a paragraph), and a model reading it can still put words in the listener’s mouth.

What workedThe review is the judge, and every lesson has to quote it. One LLM call reads the review next to everything about the build: the tracks by section, likes, the rating and the build log. It returns a verdict and up to three lessons, each carrying the exact words it rests on. Code checks those words are really in the review, and a lesson without a real quote is dropped. Meta's Early Experience work makes the same point: reflect on what happened, not on the model's opinion.
review    "the workout part was way too slow, rest was great"
verdict   partly
title     Workout sections need more energy
content   Keep workout sections at energy 8 or more from the first song.
kind      pitfall, lasting · tags: workout, energy
evidence  "the workout part was way too slow"

Each lesson also has a kind. Pitfalls and strategies are the paper’s failures and successes. Preferences are new: general taste like “too much Drake”, which outranks the taste Moodify reads from Spotify when the two disagree.

b)Append-only memory

The paper adds new items “with a simple addition operation”. Nothing is ever edited. That works for web tasks, where a strategy that worked stays true. People change their minds. If a listener once wrote “loves long intros” and later “skip the long intros, they bore me”, an append-only memory keeps both, and the next build gets two lessons that contradict each other.

What workedConsolidation with four operations instead of one. A second LLM call compares each new lesson with the existing ones that share a tag or are close in meaning, and picks ADD, UPDATE, SUPERSEDE or NOOP. Newer feedback always wins. A superseded lesson stays in the table, pointing at the one that replaced it.
After
DraftActiveNot storedThis playlistSupersededExpired from a reviewrecalled into buildsnever in memoryonly feeds Fix itkept as historynot recalled add / update no exact quote,or already knownabout one playlista newer lessoncontradicts itor “from now on”unused 180 daysor past 40 active
A lesson's life. In the paper an item is appended and never changes. Here a draft can be dropped, kept for one playlist, added, or folded into an existing lesson, and an active lesson can be superseded or expire. Both stay in the table as a record.

A few rules keep it safe:

  • Lessons about one playlist (“track 4 didn’t fit”) never reach memory. They only feed the Fix it button.
  • At most 40 active lessons per listener. Past that, consolidation merges near-duplicates, and as a last resort the least-used lessons expire.
  • If the consolidation call fails, every new lesson is simply added, so a grounded lesson is never lost.

c)Similarity-only recall

The paper recalls memory “using embedding-based similarity search”. With at most 40 lessons per listener, I started with plain tags, plus a word list so “gym session” finds a lesson tagged workout. Tags still missed “leg day”. When I added embeddings, they missed things too: “homework” never reached the focus lesson. And one similarity threshold either missed half the matches or let in up to ten wrong ones.

What workedBoth paths, and either one is enough. A lesson is recalled if it shares a tag with the request, or if its similarity is at least 0.36, or 0.15 above the median of that listener's lessons. The relative rule fixed the threshold. If the embeddings call fails, recall falls back to tags and the build carries on.
After
QueryWords → tagsTag overlapLessonsEmbedClose in meaningEither way prompt, thenbrief + sectionsgym → workoutshares a tagtags + vectors3-large, 512 dims≥ 0.36 or median + 0.15≤ 8 lessonsinto the prompt by tagby meaning if the call fails: tags only
Recall. The paper recalls by embedding similarity alone, the lower path. Moodify added the tag path, and a lesson gets in if either path finds it. Each build runs this twice: once on the prompt, then on the brief and on each section alone.

०३Four loops, four clocks

The paper describes one loop. Moodify now runs four, each on a different clock.

Moodify, now
Ask one questionRead promptPick songsPlaylistListenerFix itLessonsConsolidateReflect waits up to 20 swrites the briefsearch and orderon Spotifylikes, reviewbuilds version 2≤ 40 per listeneradd · supersede≤ 3, quoted brieftracksreviewwritesrecall 1recall 2 clashanswercorrectionthis playlist's lessons 1234 ask first · secondsfix this playlist · minutes to daysunused 180 days → expired between playliststhe paper's loop
The four loops. The heavy dark loop is the paper's; the three blue loops are what Moodify added around it.
  1. Seconds: ask before building. When a prompt pulls against a lesson (“gym session, running on 4 hours of sleep” against “workout energy 8 or more”), Moodify asks one question and waits up to 20 seconds. The call that writes the brief spots the clash itself, so asking costs no extra LLM call. “From now on” retires the lesson. No answer keeps it, so a build never stalls. This is the first step of Meta’s PAHF loop, which the paper doesn’t have.
  2. Minutes to days: Fix it. The lessons about one playlist, plus the review itself, rebuild that playlist as version 2.
  3. Between playlists: the paper’s loop. Reviews become lessons, and later builds recall them.
  4. Months: upkeep. Every recall marks a lesson as used. Pitfalls and strategies nobody recalls for 180 days expire. Preferences never expire; they can only be superseded.

०४What it measured

Memory has a cost the paper doesn’t deal with: it changes the prompt, and a prompt that changes on every build can’t be reused from OpenAI’s prompt cache. So memory comes in two parts. A per-listener block (preferences, liked songs, playlists rated 8 or more) is rendered once and kept until new feedback arrives, and sits right after the fixed rules. Only the lessons recalled for this request change from build to build. My first layout cached 53% of input tokens; this one caches 98%.

Each of these phases shipped with a live check against the real model, next to the mocked tests.

CheckResult
Builds with lessons vs without
judged against 5 test reviews
5 of 5
Next gym brief after a “too slow” review
energy, out of 10
8 → 9
Input tokens cached
second build, a minute later
98%
Ask before building
6 prompts, 3 runs
17 of 18 right
Recall by meaning
14 live requests
12 found, 1 wrong
Building agent memory too?Say hello
ReferencesThe 11 sources this write-up draws on
  • ReasoningBank
  • Agent memory
  • Embeddings
  • OpenAI