Skip to content

Dreaming: check facts against the messages they came from; set aside what a message never said - #14

Merged
FMXExpress merged 1 commit into
mainfrom
claude/optimistic-allen-i3bd3d
Nov 7, 2026
Merged

FMXExpress merged 1 commit into
mainfrom
claude/optimistic-allen-i3bd3d

Conversation

@FMXExpress

Copy link
Copy Markdown
Owner

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:

  • /dream checks the facts added since the last pass; /dream all rechecks every fact.
  • It also runs automatically before each deep sleep ([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).

  • With [judge] model set: 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.
  • Without a judge (the CPU default): the fact's value must appear in the message.

Not reviewed:

  • facts from /remember, which have no message;
  • facts from the body, already checked when it acted;
  • derived facts, rebuilt from their sources.

Set aside, not deleted:

  • A set-aside fact is stored as forgotten = 2. Every existing query already filters on forgotten = 0, so it leaves retrieval and training with no schema change.
  • /review lists 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.
  • New 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.
    • /dream sets it aside, and the true facts survive.
    • Retrieval stops returning it, and /review lists it.
    • /keep restores it.
  • scripts/e2e_body.sh (mock, LeRobot stub, closed loop) passes.
  • Not tested: the judge's version of the check, and the automatic pass before a real deep sleep.

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

…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
@FMXExpress
FMXExpress merged commit 717bfab into main Nov 7, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants