Skip to content

Derived facts and an all-facts baseline; body layer stores only checked outcomes and retries with feedback - #13

Merged
FMXExpress merged 3 commits into
mainfrom
claude/optimistic-allen-i3bd3d
Nov 7, 2026
Merged

FMXExpress merged 3 commits into
mainfrom
claude/optimistic-allen-i3bd3d

Conversation

@FMXExpress

Copy link
Copy Markdown
Owner

This PR holds the two commits that came after #12 was merged. They act on what the papers reviewed this week suggested.

Derived facts (TMemStore.SyncDerived, [agent] derive_facts, default on)

memagent now stores the link between two facts as a fact of its own. It joins a relation fact ("Your sister's name is Ana.") with a fact about that person ("Ana's job is nurse."). The result is a derived fact, "Your sister Ana's job is nurse.", with kind = 'derived' and subject "my sister's job".

This should turn the two kinds of question the benchmark still fails into one-fact lookups:

  • Bridge: "Which city does my sister live in?" failed 21/24 with one retrieval.
  • Inverse: "Which of my relatives is a nurse?" failed 18/24 even with two retrievals.

The ideas come from AI-native memory (2406.18312), A-MEM (2502.12110) and GraphRAG (2404.16130).

How it behaves:

  • A plain database join, no model, run after every store and /forget.
  • Stale derived facts are deleted. When Ana moves, "…city is Lisbon" goes and "…is Porto" comes in.
  • A forgotten derived fact never comes back.
  • Merges and the same-subject lookup skip derived facts, so they can never overwrite a fact the user stated.

All facts in the prompt ([agent] rag_all, default off)

Puts every active fact in the prompt instead of retrieving. It is the baseline that Mem0's own paper (2504.19413) found ahead of its memory system. bench_integration.py --derive / --all-facts runs both.

Body: verified outcomes and a closed loop

Only checked claims become facts. A robot's own "done" is a belief: robots that reported their own success corrupted their memory (From Language to Action, 2603.03148), and Voyager lost 73% without its success check (2305.16291).

  • New protocol message: {"op": "check", "claim": ...} returns yes, no or unknown. A body opts in with "checks": true in its ready event.
  • How a claim is checked: each step's claim ("The mug is in the left cabinet.") goes to the body's own check, or else to the judge reading the act's observations (TJudge.Observed).
  • Only a confirmed claim is stored as a fact. An unconfirmed one is reported and left out; a refuted one is retried.

Closed loop (Inner Monologue, 2207.05608):

  • Retries: a failed act, or a step whose claim the check refutes, goes back to the body with a line saying what happened, at most [body] retries (1) times.
  • Only the unfinished steps are resent when the body ran the task's own steps.
  • A rule stop is never retried.

Drivers:

  • The mock keeps a world and answers checks. In test plans, ! fails a step once and ~ claims it once without doing it.
  • The LeRobot stub answers checks. A real rollout answers unknown until it has a scene check, so its steps are confirmed only by the judge reading its observations.

Testing

  • make test: extraction 710/710, priors 39/39, retrieval, HTTPS and the Python tests pass.
  • scripts/e2e_body.sh: the mock and LeRobot-stub runs pass as before; confirmed steps still become facts. A new loop scenario passes too: the jar step fails and is retried, the box step claims success without doing it, the check refutes it, it is retried, and both facts are stored once.
  • Derived facts, live:
    • "Ana's job is nurse" produced "Your sister Ana's job is nurse.".
    • Ana's move replaced the Lisbon derived fact with Porto.
    • /recall Which of my relatives is a nurse? ranks the derived fact first, above the stranger Tom.
  • Not measured yet:
    • Benchmark: the integration runs with derived facts and with all facts in the prompt are still going. derive_facts defaults to on, and that default may change with the result.
    • Judge on observations: the observation path of the body check is not exercised by the tests.
    • Real robot: nothing ran on hardware.

Generated by Claude Code

…rse."); [agent] rag_all puts every fact in the prompt

- TMemStore.SyncDerived: a relation fact ("my sister's name" = Ana) and a fact
  about that name ("Ana's job is nurse.") give a derived fact "Your sister
  Ana's job is nurse." (kind 'derived', subject "my sister's job"): bridge and
  inverse questions become one-fact lookups. A plain join after every store and
  /forget; stale ones are deleted, a forgotten one never comes back, merges and
  the same-subject lookup skip derived facts. [agent] derive_facts (default on)
  pending the benchmark. After AI-native memory (2406.18312), A-MEM (2502.12110)
  and GraphRAG (2404.16130).
- [agent] rag_all: every active fact in the prompt instead of retrieval, the
  baseline Mem0's paper found ahead of its own memory (2504.19413).
- bench_integration.py --derive, --all-facts.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NPVFJHeBeotAKkU7EPbTgn
…retried with feedback

A robot's own "done" is a belief: robots that reported their own success
corrupted their memory (From Language to Action, 2603.03148), and Voyager
lost 73% without its success check (2305.16291).

- protocol: {"op": "check", "claim": ...} -> {"event": "checked", "text":
  yes|no|unknown}, for a body whose ready event says "checks": true
- TAgent.RunBody: each step's claim ("The mug is in the left cabinet.") is
  checked by the body, else by the judge reading the act's observations
  (TJudge.Observed); only a confirmed claim is stored, an unconfirmed one is
  reported and left out, a refuted one is retried
- closed loop (Inner Monologue, 2207.05608): a failed act or refuted step goes
  back with a line saying what happened, at most [body] retries (1) times; a
  body that ran the task's own steps gets only the unfinished ones; a rule
  stop is never retried
- the mock keeps a world and answers checks; "!" fails a step once and "~"
  claims it once without doing it; the LeRobot stub answers checks, a real
  rollout says unknown
- scripts/e2e_body.sh: a loop scenario (fail, retry, refuted claim, retry)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NPVFJHeBeotAKkU7EPbTgn
@FMXExpress
FMXExpress merged commit 169532b 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