showcase/integrations/mastra/qa/observational-memory.md
Observational Memory (OM) is a Mastra Memory feature. As the conversation
grows past a token threshold, Mastra runs an Observer OUT OF BAND that compresses
unobserved messages into structured observations and activates them into the
working context. Mastra streams that background work on the run's fullStream as
data-om-* chunks; the AG-UI Mastra adapter maps them to
mastra-observational-memory activity events, and the demo's custom activity
renderer paints them inline in the chat.
This QA pass covers the OBSERVATION CONTENT quality with a real LLM. The
activity-card LIFECYCLE STRUCTURE (a buffering / running card in-turn, settling
to activation / activated) is already asserted deterministically under aimock by
tests/e2e/observational-memory.spec.ts — see the determinism note at the bottom.
observationalMemoryAgent has OM enabled on its Memory
(options.observationalMemory, scope thread, floor 600/300).getLocalAgents({ observationalMemory: true })./demos/observational-memorydata-testid="om-activity-card") appears
inline in the transcript. Expected phases (one card per OM cycle,
advancing in place):
data-testid="om-observations") is a MEANINGFUL compression of the
conversation (e.g. names the project / trip specifics). Under aimock this
text is a stand-in, so this semantic check is the reason a real key is
required here.mastra-observational-memory activity card.Corrected 2026-07-02 after direct measurement against the sanctioned aimock rig
(showcase up mastra --dev, per-integration Playwright against :3104).
The OM activity-card LIFECYCLE STRUCTURE is deterministic under aimock, so the
Playwright spec (tests/e2e/observational-memory.spec.ts) asserts it:
buffering / running in-turn. This is driven by runtime
token accounting over the fixed-size pill message and does NOT depend on the
Observer LLM response, so it is stable (measured 11/11).activation / activated and the new turn opens a fresh buffering / running
card (measured 5/5). The spec's fourth test asserts this.What aimock does NOT reproduce is the observation SEMANTIC CONTENT: aimock returns
a stand-in for the Observer call rather than a genuine compression of the
conversation, so the om-observations text is not meaningful under replay. That
content quality is what THIS real-LLM QA pass (§2) plus the adapter's own upstream
unit tests cover. In short: structure → e2e (aimock, deterministic); content →
real-LLM QA.