r/ClaudeCode • • 2d ago

Discussion Would you let Claude rewrite its own memory while you sleep? Dreams, and how they turn into nightmares

Anthropic has been writing about "dreaming" for agent memory. Between sessions, Claude goes back over its own transcripts, fixes notes it thinks are wrong, merges duplicates, and promotes the important ones into what gets loaded at the start of the next session: https://anthropic.com/research/components-of-agent-memory

I like the instinct. Anyone who has watched an agent walk into the same wall three sessions running wants it to learn from its own history.

The pushback has been just as interesting though (The New Stack collected a lot of it: https://thenewstack.io/anthropic-agent-memory-dreaming/). The worries that stuck with me:

  • a mistake repeated a few times gets consolidated into a rule
  • a wrong note loaded into every session is worse than no note at all
  • "a human reviews it" stops meaning much by the hundredth diff
  • transcripts are full of text Claude didn't write (tool output, web pages, pasted files), and now something reads them to decide what to remember

So I'm curious how people here actually handle memory day to day:- Has a wrong line in CLAUDE.md or a memory file ever stuck and quietly steered your sessions? How did you spot it?

  • Do you read what Claude writes to memory, or mostly trust it?
  • If dreaming ran over your sessions overnight, what would you need to see in the morning to trust it? A diff? The sessions each change came from? An undo?
  • Is there anything you'd never want consolidated automatically?
  • Where's your line between "learn from my sessions" and "don't touch my instructions"?

Disclosure, since it shapes my view: I work on an open source memory server (OmniMem, https://github.com/richarvey/OmniMem) and went the other way there. It only learns from transcripts while a person is around, and nothing counts until someone accepts it. I've been calling that daydreaming. But I'm much more interested in what's working, or going wrong, for people using Claude Code as it comes.

3 Upvotes

18 comments sorted by

•

u/AutoModerator 2d ago

Hey! Thanks for posting to r/ClaudeCode

While participating in this thread, please follow our community rules. Keep discussions constructive. Attack the idea, not the person.

For help, project discussions, tips, and general chat, join the ClaudeCode Discord.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

4

u/AlarmedNatural4347 2d ago

It’s funny how we treat text files as some sort of innovation that “furthers” AI development. Every thing new for Claude Code is just “it now adds a new text file itself”. I mean it’s neat and all, and it is better at keeping track of things than it was a year ago. But it’s all just band aids on what fundamentally are serious limitations at the core of LLMs. And that limitation hasn’t really changed in forever and no “dreaming” is gonna fix that fundamental limitation

1

u/TheMadSaiyantist 2d ago

You can safely do this for repo that has your ideas and thoughts whether of the past/present/future or combination, and let the agent propose some new ideas/ways of thinking while you sleep, I said safely because there's nothing at stake it's just words being changed in md files or whatever, tho if it's on a real codebase then those "refresh yourself" moments to the agent(s) should be less frequent since even tho they may remove something stale and buggy they may also add something new that crushes something else, so for that be more precise about it

1

u/pmward 2d ago edited 2d ago

Absolutely poison pills in context are a major problem. “Dreaming” is akin to compaction. The agent decides what to keep, what to summarize, and what to delete. So it’s a dice roll if it’s the right calls. I use agents to help me audit our shared context stores. It makes recommendations on what to do, but ultimately it’s my call to approve, deny, or alter those recs. As the team lead I’ve taken it on as my responsibility to maintain the teams context stores. I don’t think AI is at a point yet that you can trust it to manage its own memory without you being in the loop.

1

u/Far_Reindeer8428 2d ago

no, not without a diff and someone reading it. memory that self-edits is just a slower way to lose the reason behind a decision

1

u/MurkyCommission8853 Workflow Engineer 2d ago

I let Claude work overnight on a production app, so I've had to answer most of these for myself.

Memory: I read most of it. Each one shows up in the chat as "Memory Updated" it happens and I can click to see the exact line. In practice a wrong line has never wrecked a session. What I get is stale info, and it gets corrected fast because one of my standing rules is that a note is a claim to check, not a fact. A memory line, a runbook note or a code comment that says "X is done" gets verified before anything is built on it.

For overnight work, my rules are roughly:

- Keep working through the list; a check-in every 20 minutes so a quiet moment doesn't end the session.

- Where it would normally ask me, it decides by the written rules and marks it APPROVED IN KAMI'S PLACE, with one line why.

- Nothing irreversible and nothing live: no deploys, no releases, no deletes, nothing users see. It prepares those and leaves them for me.

- Stuck on a choice the rules don't settle: write down both options, take the safer one, move on.

- In the morning: one short summary of what's done, what was approved in my place, what's waiting for me, and what went wrong.

That's also what I'd want from dreaming. Not a hundred diffs to review, but the few changes that matter, each marked and each with its reason, so I review decisions instead of text.

Where I'd draw the line: learning facts from my sessions is fine. Changing my instructions is not. A rule only changes when I say so. And anything that came from tool output, web pages or pasted files should never become memory on its own, for exactly the reason you list.

1

u/Decent-Finish-2585 2d ago

This seems to vary with each model version, but I actively watch every memory I see Claude write, and end up saying “delete that memory” about 20-30% of the time.

1

u/shetritr 2d ago

for your morning question: keep the memory files in git and make each overnight run one commit, every changed line tagged with the session it came from. then the morning read is one git show, and a line with no source session is the one to throw out. your "mistake repeated a few times becomes a rule" case shows up as three tags pointing at the same bad session

1

u/AgentYurt 2d ago

I draw the line at instructions. Facts can be learned from sessions; the rules about what not to do live in a separate file the agent doesn't get to edit.

What keeps me sane is a short handoff note at the end of each session: what changed, what was decided and why, and what we deliberately didn't do. The next session's first job is a quick check of that note against the files, not trusting it blind. A wrong note then shows up as a mismatch instead of quietly becoming a rule.

For the morning question: I'd want that same note, plus the diff of anything the overnight run changed in memory. If I can't see what changed and why in a minute or two, I don't trust it.

1

u/MeGriml0ck 2d ago

Oh neat, I didn’t know they had the same idea I did haha. 

1

u/torvalds75 2d ago

The failure I'd worry about most isn't a wrong fact, it's a stale decision. A note saying "we rejected approach X" outlives the day you went back to X, and every session after that steers away from it and explains why with total confidence. Wrong facts get caught by the code. Stale decisions don't, because nothing in the repo contradicts them.

What helps is splitting memory by kind, because each kind fails differently:

  • Facts about the code (where things live, how to run tests): fine to learn automatically, cheap to verify, and a wrong one breaks something quickly.
  • Decisions (chose A, rejected B because C): never auto-written, never consolidated. Each carries its reason and a date. A decision with no reason is the first one to delete, because nobody can tell when it stopped being true.
  • Instructions: only you edit them, same line AgentYurt drew.

On the morning diff: the riskiest thing dreaming does is merge. Two notes that disagree are useful, they tell you something changed. A merge picks a winner and hides that there ever was a conflict. If it ran overnight I'd want conflicts surfaced as questions, not resolved.

And agreed that transcripts as input is the scary part. Tool output and fetched pages can be a source for a fact you can recheck, never for a decision or a rule.

1

u/Excellent-Issue-5956 2d ago

Not dreaming exactly, but my local model is allowed to write to the same memory folder Claude reads, so I had to figure out the trust part. The one condition I set was that it clearly marks anything it wrote. Every write saves the old copy to a timestamped backup folder, adds a line to an append only log of its edits, and tags the note as coming from the local model. If the note already exists it appends a dated update instead of rewriting it. There's also a standing note telling Claude to verify anything with that tag before relying on it.

So if something looks off I can see exactly what it changed and put the old copy back, without reading every note.

1

u/mylifeasacoder 2d ago

I think it works the same during the day...

1

u/PhilbertNoyce 2d ago

Mine has been doing this for months now. I blocked all memory and claudemd writes during normal day to day operations. If it thinks a change needs to be made it can log it as a ticket. An opus high subagent run does a weekly pass on all tickets and builds its own edits based on what it sees and keeps the suggestions that have merit.

Without this you get sonnet med and haiku just stomping around in memory and arbitrarily changing stuff left and right.

1

u/japbujan 2d ago

The part I'd keep out of the overnight pass is decisions. Merging duplicate notes or dropping stale todo items is fine to automate. But a rule that came from a person choosing something, for a reason, shouldn't be rewritten from transcripts: a transcript shows what happened, not what was decided. What we do: the agent may flag a decision as outdated, but the change only lands as a new record with its reason, and the old one stays readable. Reviewing ten of those is doable; a hundred-line memory diff isn't.

1

u/Random96503 1d ago

my agents write memories. those flagged with a wide blast radius, as well as changing and removing memories still require my approval. this along with daily and weekly audits help me spot the accumulation of cruft. it's like maintaining a garden.

1

u/vorixi 18h ago

I actually ran a version of this on my own history, so here's one data point.

Claude "dreamed" over 8 days of my real sessions and wrote 56 wiki-style pages. Then I checked my next 144 real searches. The pages would have done better than plain search over the raw transcripts in just 3. Plain search was enough in 70, and in the other 71 the pages had nothing relevant at all.

When memory fell short, it was mostly not missing knowledge. Claude just didn't search, or the right answer ranked too low. Better search fixes that, and you don't have to rewrite anything.

So I mostly agree with the "keep a human in the loop" comments here, but I'd put the line somewhere else:

- Things that must not be wrong (rules, decisions, how deploys work) belong in code or docs, where they get reviewed and you can check them. Not in memory that rewrites itself.

- Things that are fine to recall imperfectly ("what were we doing yesterday", "how did we handle that request last week") work well as raw transcripts plus good search. If it's a bit off, you notice right away and nothing gets quietly overwritten.

I think dreaming tries to make memory reliable enough for the first kind. In my data it didn't pay off for the second kind either.