Repository navigation
Dreaming: check facts against the messages they came from; set aside what a message never said - #14
Merged
Merged
Conversation
…what a message never said After Anthropic's "The Components of Agent Memory" (2026): a note that is wrong from the start is read and trusted in every later session, and checking notes against the raw history is what fixed it there. - TAgent.Dream (/dream, /dream all; automatic before each deep sleep with [consolidate] dream=1): every fact newer than the last pass is checked against its source message, by the judge when there is one (set aside only when it is sure, p < 1 - guard_min), else by its value appearing in the message. Facts from /remember, a body (checked when it acted) and derived facts are not reviewed. - set aside = forgotten 2: out of retrieval and training without a schema change; /review lists them, /keep <id> brings one back - duplicates the write-time check let through (same value, near-identical wording, the judge agreeing) are merged into the newer fact - TJudge.Supports: P(a message states a fact) - scripts/e2e_dream.sh: a planted wrong fact is set aside, true facts survive, /review lists it, /keep restores it Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01NPVFJHeBeotAKkU7EPbTgn
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds an offline review pass over the fact store itself, separate from the weight training that sleep already does. It follows Anthropic's "The Components of Agent Memory" (2026). That study found that a note wrong from the start is read and trusted in every later session, and that checking notes against the raw history is what fixed it.
What it does (
TAgent.Dream)When it runs:
/dreamchecks the facts added since the last pass;/dream allrechecks every fact.[consolidate] dream=1), so the weights never learn a fact that was set aside.Checking each fact against its source message: memagent already links every fact to the message it came from (
source_msg).[judge] modelset: the judge reads the message and the fact (TJudge.Supports). It sets the fact aside only when it is confident the message does not state it (p < 1 −guard_min). On the guard benchmark, every answer the judge scored that low was wrong.Not reviewed:
/remember, which have no message;Set aside, not deleted:
forgotten = 2. Every existing query already filters onforgotten = 0, so it leaves retrieval and training with no schema change./reviewlists set-aside facts, and/keep <id>brings one back.Duplicates: facts the write-time check let through, with the same value and near-identical wording, are merged into the newer fact. The judge must agree when it is on.
Testing
make test: extraction 710/710, priors 39/39, retrieval, HTTPS and the Python tests pass.scripts/e2e_dream.sh, a planted-error test as in the article: a fake "Your brother's name is Bob." is attributed to the message "My sister's name is Ana.", which never said it./dreamsets it aside, and the true facts survive./reviewlists it./keeprestores it.scripts/e2e_body.sh(mock, LeRobot stub, closed loop) passes.Pending
The integration benchmark run with derived facts (merged in #13, on by default) is still running. The all-facts-in-the-prompt baseline runs after it. If derived facts don't help, a follow-up will change their default.
Generated by Claude Code