Skip to content

fix(memory): remember only what the user says, and lead the memory page with it - #5243

Merged
kovtcharov-amd merged 9 commits into
amd:mainfrom
kovtcharov:claude/memory-user-first-177da6
Oct 19, 2026
Merged

kovtcharov-amd merged 9 commits into
amd:mainfrom
kovtcharov:claude/memory-user-first-177da6

Conversation

@kovtcharov

@kovtcharov kovtcharov commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

GAIA's memory was filling up with things that aren't about the user. One weather chat stored weather trivia, a PDF summary became five "facts", and those resurfaced in later chats as if the user had said them. Facts the user asked GAIA to forget came back once old chats were consolidated, and an extraction already running made the user's next message wait behind it. Now memory only keeps what the user says about themselves. Forgotten facts aren't re-learned from old chats, and a new message stops a running extraction, which re-runs once the chat is idle. The memory page now opens on What GAIA knows about you: each item has an Edit button and a Forget button, and stats, confidence scores and sources move to an Advanced tab. This lands after v0.25.0.

Closes #5027
Closes #5022
Closes #4730
Closes #4824
Closes #4814
Closes #4815

Builds on #5194 (conversation titles in the memory page), whose commit is included unchanged. If #5194 merges first, rebasing drops it.

Eval categories to watch on the next RC: memory, gaia_memory. The extraction and consolidation prompts changed, and extraction now drops facts grounded only in tool output, so a scenario that expects a tool result to become a memory will now fail.

Test plan

  • python -m pytest tests/unit/ -k "memory or sdk or lemonade_chat_slots or skill_synthesis or cli_memory" tests/integration/test_memory_integration.py. The new tests use a real MemoryStore: test_memory_extraction_grounding.py, test_memory_extraction_yields.py, test_memory_forget_sticks.py, plus router tests for Memory dashboard shows zeros and success where operations actually failed #4824
  • cd src/gaia/apps/webui && npx vitest run and npx tsc --noEmit, including the new MemoryDashboard.aboutYou.test.tsx
  • python util/lint.py --all
  • Agent UI, with the backend on a fresh GAIA home and Qwen3-30B-A3B: index a quarterly-report document (.txt) and ask for a summary. The extraction ran and stored nothing from the document
  • Agent UI: tell GAIA two facts, then Forget one on the memory page. Seed an old 6-turn chat that states the forgotten fact and restart. Consolidation distilled it, stored no memory for that fact, and left it out of the summary
  • Agent UI: send a second message about 1 s after an extraction starts. The extraction stopped 1.4 s in, the reply came in 2 s, and all seven facts were stored when it re-ran
  • Agent UI: Forget then Undo an item. It came back, and its forgotten record was cleared. Deleting a session summary from Advanced recorded nothing as forgotten
  • Memory page checked in dark and light theme and at phone width (375 px): no horizontal scroll; the add input takes its own row and the tab bar scrolls

Decision for review: the forgotten table keeps the text of non-sensitive forgotten memories until memory is cleared, so consolidation can be told what not to relearn. Sensitive ones keep only word stems. If keeping any text after a forget is unacceptable, the fallback is stems only for everything, which loses paraphrase coverage.

Screenshots

About you · dark Advanced · dark
About you, dark Advanced, dark
About you · light About you · 375 px
About you, light About you at phone width
🔍 Technical details
  • fix(memory): document and tool content is stored as long-term facts about the user #5027: the extraction prompt no longer includes tool output, and grounded must be "user". _copied_from_material drops an add/update whose content words come from the answer or tool record rather than the user's message. The model labels lifted content "user" too, so the label alone wasn't enough. Consolidation applies the same check to user vs. assistant lines.
  • fix(memory): an extraction already in progress still blocks the user's next turn #5022: AgentSDK.send_messages(cancel=Event) streams and raises LLMCallCancelled. Closing the stream makes the server stop generating and releases the model-slot lease. process_query marks the turn started before any of its own model calls. A cancelled job goes back to the front of the queue. A flush (wait_for_memory_extraction) is never cancelled. Only a turn in the same chat (the same cached agent) preempts an extraction.
  • fix(memory): consolidation re-learns facts the user asked GAIA to forget #4730: schema v6 adds a forgotten table. forget() deletes the row and records it in one transaction. Sensitive rows keep only their word stems and are never put in a prompt. Forgetting is time-aware, so anything the user says after forgetting is learned as usual, and re-teaching it (remember, Add, Undo) clears the record. Consolidation is told what was forgotten after each window began, so a forget later in the same chat counts, and it drops matching items and summaries. Extraction checks from the moment the turn started. The forget tool and the memory page's DELETE use forget(). DELETE only records forgets for rows about the user, not for tool lessons or session summaries.
  • Memory dashboard shows zeros and success where operations actually failed #4824: the made-up reconciliation zeros are gone from /api/memory/stats. A failed coverage query now returns embedding: null plus embedding_error. reinitialize reports a discovery failure. commit-inference uses the new atomic MemoryStore.replace_by_source.
  • Memory dashboard: saving Profile items leaves the Dashboard tab showing old data #4814 / Memory dashboard: goal actions fail silently, and Select All/None aren't keyboard reachable #4815: profile saves refresh every memory view. Goal actions show a toast when they fail. Delete uses an inline second click. The goal header and Select All/None work from the keyboard.
  • About you is filtered on the server (?about_user=true), so paging never fills up with GAIA's own notes.
  • Extraction streams now, so the reasoning-only check runs after <think> is stripped. Each job gets its own cancel event, which is also set on timeout, so an abandoned call stops generating.
  • Docs: docs/guides/memory.mdx and docs/sdk/sdks/memory.mdx.

github-actions Bot and others added 2 commits October 16, 2026 15:55
Conversation History rows showed the first 8 characters of the session ID.
They now show the chat's sidebar title, keeping the short ID only for chats
the sidebar no longer has, and the conversation detail gets an Open chat
button.

Closes amd#5188
…ge with it

Memory was storing document and tool content as facts about the user (a
weather chat filled it with weather trivia), forgotten facts came back when
old chats were consolidated, and a running extraction made the next message
wait behind it. Extraction now keeps only what the user says about
themselves, forgetting is recorded so old conversations don't teach it
again, and a new turn stops a running extraction, which reruns when idle.

The memory page opens on "What GAIA knows about you", with an Edit and a
Forget button on each item, plus Undo and Add; stats, confidence and
sources move to an Advanced tab. Also fixes the page's stale views after
profile saves, silent goal failures, keyboard access, and stats that showed
zeros or success where operations failed.

Closes amd#5027, amd#5022, amd#4730, amd#4824, amd#4814, amd#4815.
@github-actions github-actions Bot added documentation Documentation changes chat Chat SDK changes cli CLI changes tests Test changes electron Electron app changes agents labels Oct 17, 2026
…lands first

The test raced on slow runners: with no turn in flight the job could start
before the forget, and stored the fact (failed on macOS CI).
The forget-vs-turn comparison was strict, so a forget stamped in the same
tick as the turn was missed and the fact stored. The queued-before-forget
test also pins the turn a second back so it never rests on two clock reads.
If the About-you list's reload landed after a Forget, it restored the stale
list and the forgotten item reappeared; this also made the undo test flaky
under the parallel run. Loads and changes now share a generation counter,
and a load that is no longer the latest is dropped.
…rst-177da6

# Conflicts:
#	src/gaia/apps/webui/src/components/__tests__/MemoryDashboard.conversations.test.tsx
@github-actions

Copy link
Copy Markdown
Contributor

Verdict: Approve with suggestions

The memory changes look correct and well tested. Extraction now only keeps what the user says, forgets stay forgotten when old chats are consolidated, and a new message stops a running extraction. I found no blocking bugs. The forget/undo flow, the time-aware forget check, the atomic profile replace and the cancellable stream all hold up, and each comes with tests against a real MemoryStore.

🟡 Screenshots of the new memory page are missing. The PR redesigns the memory page (About you first, Edit/Forget, an Advanced tab). The test plan describes Agent UI runs in words but embeds no before/after screenshot, and the Agent UI is the one surface where text doesn't count as evidence. Please add a screenshot of the About you tab and the Advanced tab. The open light-theme / narrow-width check could use the same capture.

🟢 Nits:

  • The stats endpoint's docstring still says it returns reconciliation stats, which this PR removes.
  • A stopped extraction goes back in the queue even when the queue is already full. It then runs right away while the user's turn is still going. This only happens under heavy backlog.
🔍 Technical details
  • src/gaia/ui/routers/memory.py memory_stats() docstring: "Includes v2 embedding coverage and reconciliation stats…". reconciliation is no longer returned, and test_memory_router.py asserts it is gone. Update the docstring to match.
  • src/gaia/agents/base/memory.py _run_extraction_job, except LLMCallCancelled: appendleft(job) doesn't check EXTRACTION_QUEUE_MAX. When the queue is already full, _wait_for_extraction_turn exits its wait loop (len(queue) >= EXTRACTION_QUEUE_MAX), so the requeued job restarts mid-turn and competes with the user's call. That is the same full-queue behaviour as before, but cancellation now feeds it. You could drop the oldest queued job when requeueing, as _schedule_memory_extraction already does.
  • I checked these and found no problems: forget() deletes the row and records it in one transaction. Both sides of the time comparison use aware _now_iso() timestamps. is_about_user agrees with the SQL about_user filter (source is NOT NULL). Undo goes through POST /api/memory/knowledge with source="user", which un-forgets. A flush is never cancelled.

kovtcharov added a commit to kovtcharov/gaia that referenced this pull request Oct 18, 2026
Resolves the Memory dashboard test conflict (the Advanced tab from amd#5243
plus main's conversation-search test) and regenerates the API types.
…unning it mid-turn

A stopped extraction went back on the queue even when it was full, and a
full queue starts work at once, so it restarted during the user's turn. It
is the oldest job, so it is now the one dropped, as a new turn on a full
queue already does. Also corrects the stats endpoint's docstring.
At 375 px the add-a-memory input shrank to a sliver and the four-tab bar
clipped Advanced. The input now takes its own row and the tab bar scrolls.
@kovtcharov

Copy link
Copy Markdown
Contributor Author

All three suggestions are addressed, plus a phone-width layout fix that the screenshots turned up.

  • Screenshots: the PR body now shows About you and Advanced in dark theme, About you in light theme, and About you at 375 px. The light-theme and narrow-width check is now ticked.
  • Phone width: the add-a-memory input had shrunk to a sliver and the four-tab bar clipped Advanced. The input now gets its own row and the tab bar scrolls.
  • Stale docstring: the stats endpoint's docstring now describes what it returns.
  • Full queue: a stopped extraction is now dropped when the queue is full instead of rerunning mid-turn. It is the oldest job, so this matches the "drop the oldest" rule new turns already follow.
🔍 Technical details
  • _run_extraction_job checks len(queue) >= EXTRACTION_QUEUE_MAX under the extraction lock before appendleft, and logs the drop. New test: test_a_stopped_extraction_is_dropped_when_the_queue_is_full (EXTRACTION_QUEUE_MAX=1; without the fix the stopped job reruns, giving three model calls instead of two).
  • CSS: under max-width: 600px, .mem-about-add .mem-input { flex-basis: 100% }, and .mem-tab-bar { overflow-x: auto } with non-shrinking tabs. Measured at 375 px: page scrollWidth 375, input 327 px wide.
  • Commits 58bfcfe16 and 18178bc43. Memory and router tests pass, as do 236 dashboard and style vitests.

@kovtcharov-amd
kovtcharov-amd added this pull request to the merge queue Oct 19, 2026
Merged via the queue into amd:main with commit 0a14f8f Oct 19, 2026
60 of 61 checks passed
@kovtcharov-amd
kovtcharov-amd deleted the claude/memory-user-first-177da6 branch October 19, 2026 08:28
kovtcharov-amd added a commit to kovtcharov/gaia that referenced this pull request Oct 19, 2026
amd#5324)

GAIA stored the right facts after amd#5243, but chats rarely used them.
Asking "what should I get my sister for her birthday?" never brought up
"my sister Priya lives in Vancouver", and a long-time user's older facts
dropped out of the prompt, where stale facts could outrank the facts
that replaced them. Now a natural question surfaces the memories it's
about (8 of 9 in the test below, up from 1). The always-on memory
section holds as many memories as fit, newest first, instead of 5 facts.
Memory also stays in the background: the activity list no longer shows
"Saved to memory" steps.

Part of amd#5234.

- **Recall per turn.** The old cut-off (cosine 0.5) is above what the
default embedder gives a natural question, which scores the memory it's
about at 0.35–0.55. A match now passes when it stands clear of how the
question scores against the whole store and sits close to the best
match. A memory that names the same person comes along too: "snack ideas
for my kids" brings "Leo is allergic to peanuts" with "two children
named Ada and Leo".
- **Always-on section.** There's no fixed count per kind any more. Kinds
take turns, most recently confirmed first, until the 4,000-character
budget is full. Notes and upcoming reminders are now included. The
prompt says how many memories are left out so the model knows to search.
Confidence numbers are gone, since a true fact shown as "confidence:
0.42" invites the model to doubt it.
- **Out of sight.** Successful
`remember`/`recall`/`update_memory`/`forget` steps are hidden from the
activity list. A failed one still shows. The agent still saves without
announcing it.

<details>
<summary>🔍 Technical details</summary>

Recall hits for natural questions, measured with the same
`embeddinggemma-300M-Q8_0` GGUF Lemonade serves. It ran in a private CPU
llama-server because an eval held the shared Lemonade. Store A has 9
user facts; store B adds 20 unrelated ones.

| Question | Before (A) | After (A) | After (B, 29 facts) |
|---|---|---|---|
| What should I get my sister for her birthday? | — | Priya | Priya |
| snack ideas for my kids' lunchboxes | — | children, peanut allergy,
vegetarian | + sourdough |
| Plan a dinner menu for this weekend | — | vegetarian, cello on
weekends | + 5k run |
| How far to Banff by car, how much fuel? | — | Subaru | Subaru |
| Any hobbies my partner and I could do together? | Sam | Sam | Sam |
| Help me write a cover letter for a new job | — | data engineer | +
manager Dana |
| What's the capital of Australia? | — | — | — |
| Explain how binary search works | — | — | — |

- Rule in `_recall_memories_for_turn`: cosine ≥ 0.5, or (store ≥ 8) ≥
max(0.38, median of the 200 nearest + 0.08, best − 0.06). Top 3, plus up
to 2 memories that share a name with a match (cosine ≥ 0.35). The
thresholds come from a grid over both stores: the most expected hits
with no leaks on unrelated questions.
- Hybrid BM25 isn't used on this path, for two reasons.
`MemoryStore.search` bumps confidence, and surfacing a memory must not
count as a use. Natural questions also share few words with the fact
they're about ("kids" vs "children").
- A memory shown in the always-on section still isn't repeated per turn,
and one left out of it stays recallable.
- Reminders whose due day has passed stay with the existing once-only
upcoming/overdue path.
</details>

**Evals to watch** (this changes the memory prompt and the per-turn
context): `memory`, `gaia_memory`, `context_retention`, `personality`,
`gaia_tool_selection`. They weren't run locally; the next RC's eval
covers them.

## Test plan
- [ ] `python -m pytest tests/unit/test_memory_turn_recall.py
tests/unit/test_memory_mixin.py tests/unit/test_memory_prompt_growth.py
tests/unit/test_memory_heal_lessons.py
tests/unit/test_system_prompt_composition.py`
- [ ] `cd src/gaia/apps/webui && npx vitest run
src/components/__tests__/AgentActivity`
- [ ] `python util/lint.py --black --isort --pylint --flake8`
- [ ] In the Agent UI, with a few personal facts stored, ask "what
should I get my sister for her birthday?" and check the answer uses the
stored fact
- [ ] Say "also remember that I live in Calgary" and check no memory
step appears in the activity list

---------

Co-authored-by: Kalin Ovtcharov <[email protected]>
kovtcharov-amd added a commit to kovtcharov/gaia that referenced this pull request Oct 19, 2026
…ter (amd#5290)

The Agent UI looked developer-built: copper on cool blue-grey, 19 font
sizes, labels in spaced-out monospace capitals, and buttons in three
different shapes. This lands the foundation of the approved redesign
(amd#1001). It brings warm gray neutrals and muted brass for actions and
focus only. Inter replaces DM Sans and Space Mono. Controls are soft
tinted, rise slightly on hover and settle on press, and dialogs use calm
sentence-case titles. Every token keeps its name, so the open feature
PRs pick up the new look without edits. With no saved theme, the app now
follows the OS instead of defaulting to dark, so a light-mode user who
never picked a theme opens it in light.

**Decided: brass on both the Agent UI and the TUI.** This PR moves the
Agent UI first. The TUI keeps copper only until amd#5291 lands a
terminal-safe brass, because the light brass `#7A5A22` rounds to
`#875F00` on a 256-colour terminal, which is the TUI's Warning and
Selected entry. Until then the cross-surface test pins the TUI's copper
on its own, and amd#5291 restores the shared-accent assertion. The commit
marked `[decision pending]` predates the decision.

**Stacked on amd#5266.** This branch includes amd#5266's motion commit,
because its tokens are the motion base; review the commits after it.
Lands after v0.25.0.

| Before (`main`) | After |
|---|---|
|
![](https://raw.githubusercontent.com/kovtcharov/gaia/ui-redesign-1001-before/finished-answer-light-win32.png)
|
![](https://raw.githubusercontent.com/kovtcharov/gaia/5eb5f66b5ff11ed138c04b692443ee044caa5352/src/gaia/apps/webui/visual/__screenshots__/finished-answer-light-win32.png)
|
|
![](https://raw.githubusercontent.com/kovtcharov/gaia/ui-redesign-1001-before/scheduled-tasks-light-win32.png)
|
![](https://raw.githubusercontent.com/kovtcharov/gaia/5eb5f66b5ff11ed138c04b692443ee044caa5352/src/gaia/apps/webui/visual/__screenshots__/scheduled-tasks-light-win32.png)
|
|
![](https://raw.githubusercontent.com/kovtcharov/gaia/ui-redesign-1001-before/documents-dark-win32.png)
|
![](https://raw.githubusercontent.com/kovtcharov/gaia/5eb5f66b5ff11ed138c04b692443ee044caa5352/src/gaia/apps/webui/visual/__screenshots__/documents-dark-win32.png)
|
|
![](https://raw.githubusercontent.com/kovtcharov/gaia/ui-redesign-1001-before/new-chat-dark-win32.png)
|
![](https://raw.githubusercontent.com/kovtcharov/gaia/5eb5f66b5ff11ed138c04b692443ee044caa5352/src/gaia/apps/webui/visual/__screenshots__/new-chat-dark-win32.png)
|

**Defaulted, easy to change.** The four round-3 design questions went
unanswered, so the recommended answers stand: a green tick for a
finished step, neutral markers for the selected chat and current
chapter, a small dark dot for an unread answer, and an icon shadow that
falls only outside each shape. They apply in the follow-ups below, which
own those components.

## Test plan

- [ ] `npm test` in `src/gaia/apps/webui`: 899 pass, including new
contrast cases for the raw brass and the switch knob on it
- [ ] `npx tsc --noEmit -p .` and `npx tsc --noEmit -p visual` in
`src/gaia/apps/webui` are clean
- [ ] `npx vitest run` in `website/`: 236 pass
- [ ] `go test ./internal/ui/theme/...` in `tui/` passes against the
updated spec
- [ ] `npm run test:visual` in `src/gaia/apps/webui`: 12 snapshots, six
screens in light and dark, match on Windows (set `GAIA_VISUAL_CHROMIUM`
to a local Chromium if `npx playwright install chromium` can't download)
- [ ] `gaia chat --ui`: switch Light, Dark and Match system in Settings
› General. The composer shows a brass focus ring, buttons lift on hover,
the warning notice shows its icon, and Settings switches are brass when
on.

<details>
<summary>🔍 Technical details</summary>

**What moved**
- `index.css` tokens: warm-gray palette in both themes; brass `--accent`
(`#7A5A22` / `#D4B47E`); soft-tinted `--accent-fill`; new
`--accent-solid`, `--accent-ring`, `--shadow-press`, `--ease-spring`,
`--duration-spring`, `--duration-press` and `--fs-*`. The layered
`--shadow-sm/md/lg` carry a light top rim. None of them is a glow, and
the no-glow guard passes.
- Each place that used `--accent-fill` as a solid mark moved to a role
that stays visible on the new pale wash: switch tracks, native
checkboxes and progress bars, the suggested permission button, and the
count badges in `Sidebar.css` and `NotificationCenter.css`.
- `ScheduleManager.css` redefined `.btn-primary` and `.btn-secondary`
unscoped. Once its lazy chunk loaded, every button in the app changed
shape. Those rules are removed.
- Labels that were uppercase or monospace in stylesheets no other open
PR touches are now sentence-case Inter. Paths, keys and code stay
monospace.
- `--bg-active` rejoins the contrast matrix. The pinned copper used to
fail on it; the brass clears every floor.
- The Electron mirrors (`main.cjs`, the installer dialog), `index.html`
`theme-color` and `utils/theme.ts` follow the new canvas.

**Visual suite** (`src/gaia/apps/webui/visual/`): `vite preview` of the
production build, every `/api` call answered from fixtures, a frozen
clock, animations off, and at most 50 differing pixels. An API call
without a fixture fails the test by name. Baselines are Windows-only and
no CI job runs the suite yet; follow-up below.

**Follow-ups once these PRs merge** (each restyle goes through tokens;
no code here depends on them)
- amd#5242: sidebar rich rows (status, preview line, time), titles that
fade instead of truncating, borderless search.
- amd#5240: 28px greeting, raised suggestion cards that lift, first-run
stepper. `SetupScreen.css` gets a one-line change here, outside amd#5240's
hunks.
- amd#5243: Memory with neutral stat figures, brass switches instead of
green, and no per-tile hues.
- amd#5245: live checklist with each step's time, a shimmering live step,
and sans labels.
- amd#5269 / amd#5266: a raised user bubble, 15px answer prose, path chips and
the answer footer.
- amd#5244: AdvancedSettings headings in sentence case, and warning status
text with its icon.
- amd#5246, amd#5241, amd#5275, amd#5283, amd#5239: side rail, queue rows, context
panel, session panel and turn changes adopt the type and elevation
tokens.
- New behaviour, each its own PR: resizable panes, chapter bars (amd#5271),
the outer-only icon shadow wrapper, and Linux baselines plus a CI job
for `test:visual`.
- TUI: brass that survives 256-colour rounding, re-unifying the accent
(amd#5291).
</details>

---------

Co-authored-by: Kalin Ovtcharov <[email protected]>
kovtcharov-amd added a commit to kovtcharov/gaia that referenced this pull request Oct 19, 2026
Resolved against main's squash of amd#5243 by taking main's side and reapplying this branch's three commits, then scoping the consolidation checks to the agent's read context.
kovtcharov-amd added a commit to kovtcharov/gaia that referenced this pull request Oct 19, 2026
Memory went stale over months of use. Old facts out-ranked new ones
because every turn's background lookup raised their confidence, so a
user who moved was still shown the old city. Dated plans lost their
date, consolidating an old chat could undo a later correction ("Ada is
6" came back after "Ada is 7"), and routine upkeep re-dated every idle
memory as "last confirmed" today. After this, only a real recall counts
as a use, reminders keep their dates, old chats don't overwrite newer
facts, and "last confirmed" moves only on a real confirmation.

**Depends on amd#5243.** This branch is stacked on it, so until amd#5243
merges the diff includes its commits; review the last three commits. It
merges cleanly with amd#5324 (no shared changes; this keeps amd#5324's
newest-first ordering meaningful). Split out of amd#5340 so the fixes can
land without the benchmark.

Changes memory extraction and consolidation behavior, so it needs a
flagship eval on the `memory` and `gaia_memory` categories before merge.

## Test plan
- [ ] `python -m pytest tests/unit/test_memory_stays_current.py
tests/unit/test_memory_store.py tests/unit/test_memory_forget_sticks.py
tests/unit/test_skill_synthesis_incremental.py
tests/integration/test_memory_integration.py`
- [ ] An existing v6 memory database upgrades to v7 on first start
(`test_a_v6_database_gains_decayed_at`)
- [ ] Flagship eval: `memory` and `gaia_memory` categories show no PASS
to FAIL against the baseline

---------

Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
Co-authored-by: Kalin Ovtcharov <[email protected]>
kovtcharov-amd added a commit to kovtcharov/gaia that referenced this pull request Oct 19, 2026
…it found (amd#5340)

Nothing tested what memory does after weeks of use. Unit tests mock the
model, and eval scenarios last one chat. `gaia eval memory` replays six
people's months of chats through the real memory pipeline on a simulated
clock. Their facts change, they ask GAIA to forget things, the agent
trips over a repo's quirks, and documents and emails full of other
people's first-person lines pass through. The bench then checks what the
agent is shown and what is stored. The `pr` suite is deterministic and
gates PRs check by check, so memory can't quietly regress. Its runs
found four bugs that made memory go stale, fixed in amd#5395: the share of
what the agent is shown that is current and correct went from 81% to
100%.

Builds on amd#5395 (the stale-memory fixes, split out so they can land on
their own), which builds on amd#5243. Their commits are included; review
only the last three. Refs amd#4727.

- **Old facts out-ranked new ones.** Every turn's extraction lookup
counted as a "use" and raised the confidence of up to 40 matching
memories. A user who moved from Calgary to Toronto was still shown "tech
lead at Northwind", and "lives in Toronto" wasn't shown at all. Now only
an explicit recall counts, and only for the results it returns.
- **Dated plans lost their dates.** Extraction ignored `due_at`, so a
mentioned appointment never came up as upcoming, and rewording a dated
reminder replaced it with an undated copy.
- **"Last confirmed" meant nothing.** Upkeep re-dated memories nobody
confirmed: decay stamped every idle memory with the day each new chat
opened, and reconciliation re-dated up to 40 rows a chat. That defeated
newest-first ordering. Now only a real confirmation moves it.
- **Corrections didn't stick.** Consolidating an old chat filed an
untagged copy of a fact, such as "Ada is 6", that the user's later
correction never reached. Consolidation now skips what memory already
says and what the user changed after that chat.

**Eval categories to watch on the next RC:** `memory`, `gaia_memory`
(the extraction prompt gained `due_at`, and recall ranking changed).

| `pr` suite, 88 checks | Before | After |
|---|---|---|
| Shown recall | 62% | 74% |
| Shown clean (no stale, forgotten or planted text) | 81% | 100% |
| Store accuracy | 94% | 100% |

Remaining failures are recall gaps: an older fact or a far-off reminder
doesn't reach the agent. amd#5324 targets those, and this bench measures
them.

## Test plan

- [x] `gaia eval memory --suite pr --gate
tests/fixtures/eval_baselines/memory-bench/pr.json` passes; three runs
gave identical results
- [x] `python -m pytest tests/unit/eval/test_memory_bench.py
tests/unit/test_memory_stays_current.py`
- [x] `python -m pytest tests/unit/ -k "memory or sdk or
lemonade_chat_slots or skill_synthesis or cli_memory"
tests/integration/test_memory_integration.py`
- [x] `python util/lint.py --all`
- [ ] `gaia eval memory --suite full` (not run: two other sessions'
`gaia eval agent` runs held the machine-wide eval lock, and the bench
doesn't bypass it)

<details>
<summary>🔍 Technical details</summary>

- **Harness** (`src/gaia/eval/memory/`):
- Each chat is a fresh `MemoryMixin` agent on one shared DB:
`init_memory`, the first message's upkeep, then every turn through
`process_query`. That covers tool calls and the tool record, extraction,
lessons, and the scenario's explicit `remember`/`update_memory`/`forget`
calls.
- Only the agent loop is stood in for. Its scripted tool calls are
checked against what was executed.
- The clock patches `datetime` in `memory.py` and `memory_store.py`,
with DST-safe aware arithmetic.
- Probes open the next chat on a DB copy, so its upkeep and reminder
marks don't change the timeline.
- A strict `pr` replay fails on any warning from memory's loggers, so a
scripted-model slip can't pass as "nothing stored".
- **Scenarios**:
- `maya_moves_and_changes_jobs`: a move, a new job, a swapped race, a
dog's surgery, weather lookups.
- `sam_family_health`: an outgrown allergy, a corrected diagnosis, a
diet change, a sister's diet, a hypothetical, a quoted text.
- `chen_learns_project_quirks`: lessons learned and replaced, a README
injection.
- `priya_work_documents_and_forgetting`: report and email content, a
password, "forget my manager".
  - `alex_three_months_of_life`: about 30 facts built week by week.
  - `jordan_reminders_change`: reschedules, cancellations, completions.
- **Gate**: a check that passes in
`tests/fixtures/eval_baselines/memory-bench/pr.json` must still pass. A
baseline check that no longer runs fails too. `--scenario` gates only
the scenarios it ran.
- **Fixes**:
- `MemoryStore.search(count_as_use=)`, `MemoryStore.count_use()`
(doesn't touch `updated_at`), and `_hybrid_search(count_as_use=)`.
- Extraction passes `due_at`. An update keeps the old date only if the
result is still a reminder. An unparseable date is dropped with a
warning and the fact kept.
  - Consolidation uses `MemoryStore.is_current()` and `changed_since()`.
- `content_stems` keeps tokens that contain digits, so "Ada is 6" and
"Ada is 7" differ.
- Confidence decay tracks `decayed_at` (schema v7) instead of moving
`updated_at`. `update_confidence(confirmed=)` moves it only for a
confirmed lesson. `get_all_knowledge` breaks timestamp ties by insertion
order.
- Docs: `docs/reference/eval.mdx` (Memory Benchmark),
`docs/reference/cli.mdx`, `docs/sdk/sdks/memory.mdx`.
</details>

---------

Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
Co-authored-by: Kalin Ovtcharov <[email protected]>
grtninja pushed a commit to grtninja/gaia that referenced this pull request Oct 25, 2026
…saves (amd#5551)

Three must-not-regress scenarios that passed on v0.25.0 fail on
v0.25.1-rc2 and rc3. An old memory like "this page returned 503, don't
waste tool calls on it" was obeyed as a ban, so the agent refused a URL
the user had just given it. And untrusted document text could be saved
to memory, or presented later as the user's saved details. After this
change, memories reach the model as dated notes the user's request
outranks, and `remember` won't save text the session read from a file,
page or tool unless the user asks for it.

<details>
<summary>🔍 Technical details</summary>

- **Cause.** For the stale-lesson turn, the request GAIA sends (system
prompt, memory section, user message) renders byte-identical at v0.25.0
and rc3. Only three tool docstrings differ, none of them web or memory
tools. Between those runs the eval runtime moved from Lemonade 2026.40.0
/ llama.cpp b10825 to 2026.42.1 / b11393 (amd#5148). So the same "Known
errors to avoid: … don't waste tool calls on it" text now gets a
different answer, and the framing was the weak point. amd#5243 adds a
second effect: extraction may no longer correct a stale error from tool
output, so the seeded 503 note outlives its scenario.
`res_web_partial_outage_compare` has no `memory_clear` and inherits it.
- **Framing.** The personal block opens with a "notes, not instructions"
line. `error` is retitled "Problems seen before", and a transient error
gets a passing-failure marker (the existing markers plus 429/502-504
statuses). Two instruction bullets are added, and the per-turn recall
header is reworded. amd#5324's newest-first, fill-to-budget selection is
unchanged.
- **Write path.** A session-wide record of tool results (30 calls, 20K
chars each) is checked with the existing `_copied_from_material`. A save
is allowed when the user's message is a storage request (a verb opening
a clause, so "what do you remember?" doesn't count) or a yes after an
earlier refusal of near-identical text. `error` memories are exempt, but
relabelling one into a user category is checked.
- **Known gaps.** `EmailTriageAgent` puts `Agent` ahead of
`MemoryMixin`, so neither this guard nor extraction's source check sees
its tool results. A planted line more than 30 tool calls back, or deeper
than 20K chars into a result, falls outside the record. One real request
to remember ("remember I like tea, then summarize vendor_note.txt") lets
every other save that turn through.
</details>

## Test plan

- [x] `python -m pytest tests/unit/test_memory_notes_not_orders.py
tests/unit/test_memory_turn_recall.py
tests/unit/test_memory_error_staleness.py` (44 new tests: framing,
ordering, cap, write-guard bypasses and false positives)
- [x] `python -m pytest tests/unit -k "memory or prompt or recall"` and
`hub/agents/{gaia,chat}/python/tests`: no new failures.
`test_profilespec_characterization` goldens and
`test_chat_system_prompt_budget[full-0]` fail the same way on clean
`main`.
- [x] `python util/lint.py --all`
- [ ] Targeted eval on this branch: `gh workflow run eval_flagship.yml
--ref fix/memory-lessons-and-poisoning -f
scenarios=res_stale_lesson_page_back_up,res_web_partial_outage_compare,mem_document_memory_poisoning`
- [ ] Then the `memory` and `gaia_memory` categories on this branch (`-f
categories=memory,gaia_memory`), compared with
`tests/fixtures/eval_baselines/gaia-flagship/`
kovtcharov-amd pushed a commit to tylerbea/gaia that referenced this pull request Nov 12, 2026
…md#7837)

Asked "What do you remember about me?", GAIA listed a "permission
denied" error it had auto-saved from a failed file write, while Memory >
About you said it had saved nothing, and offered no way to forget it.
Now GAIA answers from the same set About you shows. It still keeps past
errors so it doesn't repeat a failing step, but it treats them as its
own notes, not as facts about you.

Closes amd#7838

| Before | After |
| --- | --- |
| <img
src="https://raw.githubusercontent.com/tylerbea/gaia/pr-shots/hunt1113/MEM3/before.png"
width="420"> | <img
src="https://raw.githubusercontent.com/tylerbea/gaia/pr-shots/hunt1113/MEM3/after.png"
width="420"> |

## Test plan
- [x] New test: a plain recall returns exactly what About you lists. It
fails without the fix, which also returned the error and system facts
such as the CPU type.
- [x] New test: asking recall for errors on purpose still finds them.
- [x] Memory and recall unit tests pass (2,707 passed), and black and
isort are clean.
- [x] Live chat, after a denied write into a made-up folder: before the
fix, GAIA mentioned the error in 4 of 4 answers. After, 6 of 7 answers
did not mention it, and the one that did called it GAIA's own note, not
something about the user.
- [ ] Next RC eval: watch the `memory`, `gaia_memory` and
`error_recovery` categories. Recall and the remembered-errors prompt
section both feed the model.

<details>
<summary>🔍 Technical details</summary>

- Tool errors are stored by `_auto_store_error` (category `error`,
source `error_auto`) so the agent avoids repeat failures. About you uses
`about_user=True`, which leaves out errors on purpose (amd#5243, amd#6781).
- The model reached them two ways: a bare `recall()` called
`get_all_knowledge` with no about-user filter, and the stable prompt
lists them under "Problems seen before" inside the personal "Remembered
from earlier chats" block.
- A bare `recall()` now passes `about_user=True`, and so does its count
of withheld sensitive entries. Any filtered recall (category, query,
context) is unchanged, so `recall(category="error")` still works.
- The prompt section title now says these are GAIA's own notes, not
about the user, and may be fixed since.
- Tried and dropped: listing errors in About you with Forget. It
contradicts the existing design and broke 16 tests.
- Verified by running the flagship agent from this checkout. The
packaged sidecar binary does not pick up source changes.
</details>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents chat Chat SDK changes cli CLI changes documentation Documentation changes electron Electron app changes tests Test changes

Projects

None yet

2 participants