@mastra/memory 0.0.0-knowledge-org-scope-20260902233451 → 0.0.0-knowledge-w2-20261007195847

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (146) hide show
  1. package/dist/_types/@internal_ai-sdk-v4/package.json +1 -0
  2. package/dist/docs/SKILL.md +5 -3
  3. package/dist/docs/assets/SOURCE_MAP.json +1 -1
  4. package/dist/docs/references/docs-agents-human-in-the-loop.md +42 -1
  5. package/dist/docs/references/docs-evals-evals-with-memory.md +10 -7
  6. package/dist/docs/references/docs-guides-context-engineering.md +2 -4
  7. package/dist/docs/references/docs-harness-background-tasks.md +31 -25
  8. package/dist/docs/references/docs-harness-goals.md +28 -7
  9. package/dist/docs/references/docs-memory-memory-processors.md +7 -1
  10. package/dist/docs/references/docs-memory-message-history.md +68 -4
  11. package/dist/docs/references/docs-memory-multi-user-threads.md +1 -1
  12. package/dist/docs/references/docs-memory-observational-memory.md +168 -20
  13. package/dist/docs/references/docs-memory-overview.md +6 -6
  14. package/dist/docs/references/docs-memory-semantic-recall.md +35 -1
  15. package/dist/docs/references/docs-storage.md +2 -0
  16. package/dist/docs/references/docs-subagents.md +64 -8
  17. package/dist/docs/references/integrations-channels-github.md +6 -2
  18. package/dist/docs/references/reference-file-based-agents-memory.md +0 -2
  19. package/dist/docs/references/reference-memory-cloneThread.md +4 -2
  20. package/dist/docs/references/reference-memory-copyThread.md +65 -0
  21. package/dist/docs/references/reference-memory-memory-class.md +7 -2
  22. package/dist/docs/references/reference-memory-observational-memory.md +96 -26
  23. package/dist/docs/references/reference-memory-updateThreadResourceId.md +46 -0
  24. package/dist/docs/references/reference-processors-token-limiter-processor.md +15 -10
  25. package/dist/docs/references/reference-vectors-mongodb.md +90 -5
  26. package/dist/hooks.cjs +158 -0
  27. package/dist/hooks.cjs.map +1 -0
  28. package/dist/hooks.d.ts +25 -0
  29. package/dist/hooks.d.ts.map +1 -0
  30. package/dist/hooks.js +156 -0
  31. package/dist/hooks.js.map +1 -0
  32. package/dist/index.cjs +1 -1
  33. package/dist/index.d.ts +106 -13
  34. package/dist/index.d.ts.map +1 -1
  35. package/dist/index.js +1 -1
  36. package/dist/processors/index.cjs +3 -1
  37. package/dist/processors/index.js +2 -2
  38. package/dist/processors/observational-memory/activation-ttl.d.ts +4 -2
  39. package/dist/processors/observational-memory/activation-ttl.d.ts.map +1 -1
  40. package/dist/processors/observational-memory/constants.d.ts +16 -2
  41. package/dist/processors/observational-memory/constants.d.ts.map +1 -1
  42. package/dist/processors/observational-memory/date-utils.d.ts +38 -15
  43. package/dist/processors/observational-memory/date-utils.d.ts.map +1 -1
  44. package/dist/processors/observational-memory/error.d.ts +15 -0
  45. package/dist/processors/observational-memory/error.d.ts.map +1 -0
  46. package/dist/processors/observational-memory/extracted-values.d.ts +1 -0
  47. package/dist/processors/observational-memory/extracted-values.d.ts.map +1 -1
  48. package/dist/processors/observational-memory/extraction-runner.d.ts.map +1 -1
  49. package/dist/processors/observational-memory/extractor.d.ts +10 -0
  50. package/dist/processors/observational-memory/extractor.d.ts.map +1 -1
  51. package/dist/processors/observational-memory/hooks.d.ts +63 -0
  52. package/dist/processors/observational-memory/hooks.d.ts.map +1 -0
  53. package/dist/processors/observational-memory/index.d.ts +2 -2
  54. package/dist/processors/observational-memory/index.d.ts.map +1 -1
  55. package/dist/processors/observational-memory/markers.d.ts +7 -2
  56. package/dist/processors/observational-memory/markers.d.ts.map +1 -1
  57. package/dist/processors/observational-memory/message-utils.d.ts +1 -1
  58. package/dist/processors/observational-memory/message-utils.d.ts.map +1 -1
  59. package/dist/processors/observational-memory/observation-groups.d.ts +3 -1
  60. package/dist/processors/observational-memory/observation-groups.d.ts.map +1 -1
  61. package/dist/processors/observational-memory/observation-strategies/async-buffer.d.ts +1 -1
  62. package/dist/processors/observational-memory/observation-strategies/async-buffer.d.ts.map +1 -1
  63. package/dist/processors/observational-memory/observation-strategies/base.d.ts +7 -2
  64. package/dist/processors/observational-memory/observation-strategies/base.d.ts.map +1 -1
  65. package/dist/processors/observational-memory/observation-strategies/resource-scoped.d.ts +1 -1
  66. package/dist/processors/observational-memory/observation-strategies/resource-scoped.d.ts.map +1 -1
  67. package/dist/processors/observational-memory/observation-strategies/sync.d.ts +1 -1
  68. package/dist/processors/observational-memory/observation-strategies/sync.d.ts.map +1 -1
  69. package/dist/processors/observational-memory/observation-strategies/thread-title.d.ts +15 -0
  70. package/dist/processors/observational-memory/observation-strategies/thread-title.d.ts.map +1 -0
  71. package/dist/processors/observational-memory/observation-strategies/types.d.ts +3 -1
  72. package/dist/processors/observational-memory/observation-strategies/types.d.ts.map +1 -1
  73. package/dist/processors/observational-memory/observation-turn/safe-buffer-prefix.d.ts +35 -0
  74. package/dist/processors/observational-memory/observation-turn/safe-buffer-prefix.d.ts.map +1 -0
  75. package/dist/processors/observational-memory/observation-turn/step.d.ts +2 -2
  76. package/dist/processors/observational-memory/observation-turn/step.d.ts.map +1 -1
  77. package/dist/processors/observational-memory/observation-turn/turn.d.ts +2 -0
  78. package/dist/processors/observational-memory/observation-turn/turn.d.ts.map +1 -1
  79. package/dist/processors/observational-memory/observational-memory.d.ts +31 -14
  80. package/dist/processors/observational-memory/observational-memory.d.ts.map +1 -1
  81. package/dist/processors/observational-memory/observer-agent.d.ts +23 -23
  82. package/dist/processors/observational-memory/observer-agent.d.ts.map +1 -1
  83. package/dist/processors/observational-memory/observer-runner.d.ts +62 -46
  84. package/dist/processors/observational-memory/observer-runner.d.ts.map +1 -1
  85. package/dist/processors/observational-memory/processor.d.ts +14 -1
  86. package/dist/processors/observational-memory/processor.d.ts.map +1 -1
  87. package/dist/processors/observational-memory/reflector-agent.d.ts.map +1 -1
  88. package/dist/processors/observational-memory/reflector-runner.d.ts +6 -2
  89. package/dist/processors/observational-memory/reflector-runner.d.ts.map +1 -1
  90. package/dist/processors/observational-memory/repro-capture.d.ts.map +1 -1
  91. package/dist/processors/observational-memory/retry.d.ts +33 -0
  92. package/dist/processors/observational-memory/retry.d.ts.map +1 -1
  93. package/dist/processors/observational-memory/subconscious/activity.d.ts +3 -3
  94. package/dist/processors/observational-memory/subconscious/activity.d.ts.map +1 -1
  95. package/dist/processors/observational-memory/subconscious/curate.d.ts +3 -3
  96. package/dist/processors/observational-memory/subconscious/curate.d.ts.map +1 -1
  97. package/dist/processors/observational-memory/subconscious/index.d.ts +1 -1
  98. package/dist/processors/observational-memory/subconscious/index.d.ts.map +1 -1
  99. package/dist/processors/observational-memory/subconscious/knowledge-tools.d.ts +12 -6
  100. package/dist/processors/observational-memory/subconscious/knowledge-tools.d.ts.map +1 -1
  101. package/dist/processors/observational-memory/subconscious/knowledge-write-tools.d.ts +12 -5
  102. package/dist/processors/observational-memory/subconscious/knowledge-write-tools.d.ts.map +1 -1
  103. package/dist/processors/observational-memory/subconscious/pinned-state-processor.d.ts +2 -0
  104. package/dist/processors/observational-memory/subconscious/pinned-state-processor.d.ts.map +1 -1
  105. package/dist/processors/observational-memory/subconscious/pinned.d.ts +13 -12
  106. package/dist/processors/observational-memory/subconscious/pinned.d.ts.map +1 -1
  107. package/dist/processors/observational-memory/subconscious/remind-agent.d.ts +2 -2
  108. package/dist/processors/observational-memory/subconscious/remind-agent.d.ts.map +1 -1
  109. package/dist/processors/observational-memory/subconscious/remind-questions.d.ts.map +1 -1
  110. package/dist/processors/observational-memory/subconscious/remind.d.ts.map +1 -1
  111. package/dist/processors/observational-memory/subconscious/semantic-index.d.ts +3 -3
  112. package/dist/processors/observational-memory/subconscious/semantic-index.d.ts.map +1 -1
  113. package/dist/processors/observational-memory/subconscious/types.d.ts +0 -5
  114. package/dist/processors/observational-memory/subconscious/types.d.ts.map +1 -1
  115. package/dist/processors/observational-memory/summarize.d.ts.map +1 -1
  116. package/dist/processors/observational-memory/temporary-memory.d.ts +5 -1
  117. package/dist/processors/observational-memory/temporary-memory.d.ts.map +1 -1
  118. package/dist/processors/observational-memory/token-counter.d.ts +12 -2
  119. package/dist/processors/observational-memory/token-counter.d.ts.map +1 -1
  120. package/dist/processors/observational-memory/tool-argument-helpers.d.ts +10 -0
  121. package/dist/processors/observational-memory/tool-argument-helpers.d.ts.map +1 -0
  122. package/dist/processors/observational-memory/tool-result-helpers.d.ts +1 -1
  123. package/dist/processors/observational-memory/tool-result-helpers.d.ts.map +1 -1
  124. package/dist/processors/observational-memory/tracing.d.ts.map +1 -1
  125. package/dist/processors/observational-memory/transform-hooks.d.ts +15 -0
  126. package/dist/processors/observational-memory/transform-hooks.d.ts.map +1 -0
  127. package/dist/processors/observational-memory/types.d.ts +146 -16
  128. package/dist/processors/observational-memory/types.d.ts.map +1 -1
  129. package/dist/processors/observational-memory/working-memory-extractor.d.ts.map +1 -1
  130. package/dist/{src-BYrxAUzs.js → src-Ai2sAqaI.js} +8827 -5183
  131. package/dist/src-Ai2sAqaI.js.map +1 -0
  132. package/dist/{src-Bewti2w5.cjs → src-rZtm-Bt8.cjs} +8995 -5340
  133. package/dist/src-rZtm-Bt8.cjs.map +1 -0
  134. package/dist/system-reminders.d.ts +3 -0
  135. package/dist/system-reminders.d.ts.map +1 -0
  136. package/dist/tools/om-observations.d.ts +41 -0
  137. package/dist/tools/om-observations.d.ts.map +1 -0
  138. package/dist/tools/om-search-context.d.ts +10 -0
  139. package/dist/tools/om-search-context.d.ts.map +1 -0
  140. package/dist/tools/om-tools.d.ts +38 -5
  141. package/dist/tools/om-tools.d.ts.map +1 -1
  142. package/dist/tools/working-memory.d.ts +1 -0
  143. package/dist/tools/working-memory.d.ts.map +1 -1
  144. package/package.json +25 -15
  145. package/dist/src-BYrxAUzs.js.map +0 -1
  146. package/dist/src-Bewti2w5.cjs.map +0 -1
@@ -0,0 +1 @@
1
+ {"type":"module"}
@@ -3,7 +3,7 @@ name: mastra-memory
3
3
  description: Documentation for @mastra/memory. Use when working with @mastra/memory APIs, configuration, or implementation.
4
4
  metadata:
5
5
  package: "@mastra/memory"
6
- version: "0.0.0-knowledge-org-scope-20260902233451"
6
+ version: "0.0.0-knowledge-w2-20261007195847"
7
7
  ---
8
8
 
9
9
  ## When to use
@@ -20,7 +20,7 @@ Read the individual reference documents for detailed explanations and code examp
20
20
  - [Agent networks](references/docs-agents-networks.md) - Understand deprecated Mastra agent networks, including multi-agent routing, structured output, tool approvals, and migration to supervisor agents.
21
21
  - [Evals with memory](references/docs-evals-evals-with-memory.md) - Run Mastra evals against memory-enabled agents using shared or per-item threads, observational memory, runEvals, and dataset experiments.
22
22
  - [Context engineering](references/docs-guides-context-engineering.md) - Engineer the context Mastra agents receive by combining instructions, inline data, tools, RAG, filesystems, memory, and observational memory.
23
- - [Background tasks](references/docs-harness-background-tasks.md) - Run long-lived Mastra tool calls and subagents as background tasks while streams remain open, with configurable LLM behavior and completion events.
23
+ - [Background tasks](references/docs-harness-background-tasks.md) - Run long-lived Mastra tool calls and subagents as background tasks while streams remain open, with per-call dispositions, cancellation, and completion events.
24
24
  - [Goals](references/docs-harness-goals.md) - Set a durable goal for a Mastra agent so an execution loop evaluates progress and continues working until the objective completes or its run budget ends.
25
25
  - [Memory processors](references/docs-memory-memory-processors.md) - Configure Mastra memory processors to filter, trim, transform, and deduplicate messages before they reach the model while managing context limits.
26
26
  - [Message history](references/docs-memory-message-history.md) - Store and retrieve recent Mastra conversation messages, configure history limits and thread titles, and query threads for chat interfaces.
@@ -53,6 +53,7 @@ Read the individual reference documents for detailed explanations and code examp
53
53
  - [Memory](references/reference-file-based-agents-memory.md) - A file-based agent gets memory from a memory.ts file that default-exports a Memory instance.
54
54
  - [Reference: Cloned thread utilities](references/reference-memory-clone-utilities.md) - Use Mastra Memory clone utilities to create threads derived from an existing conversation, then inspect clone relationships and manage their messages.
55
55
  - [Reference: Memory.cloneThread()](references/reference-memory-cloneThread.md) - The .cloneThread() method creates a copy of an existing conversation thread, including all its messages.
56
+ - [Reference: Memory.copyThread()](references/reference-memory-copyThread.md) - The .copyThread() method copies a conversation thread and its messages inside the storage backend without loading message content into memory.
56
57
  - [Reference: Memory.createThread()](references/reference-memory-createThread.md) - The .createThread() method creates a new conversation thread in the memory system. Each thread represents a distinct conversation or context and can contain multiple messages.
57
58
  - [Reference: Memory.getThreadById()](references/reference-memory-getThreadById.md) - Use Memory.getThreadById() to retrieve a conversation thread by ID, including its resource association, metadata, and stored properties.
58
59
  - [Reference: Memory.listThreads()](references/reference-memory-listThreads.md) - The listThreads() method retrieves threads with pagination support and optional filtering by resourceId, metadata, or both.
@@ -61,9 +62,10 @@ Read the individual reference documents for detailed explanations and code examp
61
62
  - [Reference: Memory.settled()](references/reference-memory-settled.md) - Use Memory.settled() to wait for asynchronous memory work, including working-memory updates and observational memory, before closing storage.
62
63
  - [Reference: summarizeConversation()](references/reference-memory-summarizeConversation.md) - The standalone summarizeConversation() function summarizes a conversation in one shot.
63
64
  - [Reference: Memory.summarizeThread()](references/reference-memory-summarizeThread.md) - Call Memory.summarizeThread() to produce a thread summary in one operation and extract configured structured values from its messages.
65
+ - [Reference: Memory.updateThreadResourceId()](references/reference-memory-updateThreadResourceId.md) - The .updateThreadResourceId() method transfers ownership of a thread to a different resource by reassigning its resourceId.
64
66
  - [Migration: AgentNetwork to .network()](references/reference-migrations-agentnetwork.md) - Migrate deprecated AgentNetwork usage to supervisor agents and the standard Agent.generate() or Agent.stream() APIs in current Mastra releases.
65
67
  - [Memory](references/reference-migrations-upgrade-to-v1-memory.md) - Memory configuration now requires explicit parameters, and default settings have been updated for better performance and predictability.
66
- - [Reference: TokenLimiterProcessor](references/reference-processors-token-limiter-processor.md) - Use TokenLimiterProcessor to constrain message tokens during input, per-step input, or output processing with configurable limits and strategies.
68
+ - [Reference: TokenLimiterProcessor](references/reference-processors-token-limiter-processor.md) - Use TokenLimiterProcessor to constrain message tokens during prompt, input, or output processing with configurable limits and strategies.
67
69
  - [Reference: libSQL vector store](references/reference-vectors-libsql.md) - Configure LibSQLVector for similarity search and metadata filtering with local libSQL, SQLite-compatible vector extensions, or Turso databases.
68
70
  - [Reference: MongoDB vector store](references/reference-vectors-mongodb.md) - The MongoDBVector class provides vector search using MongoDB Vector Search. It enables efficient similarity search and metadata filtering within your MongoDB collections.
69
71
  - [Reference: OracleDB vector store](references/reference-vectors-oracledb.md) - OracleVector stores embeddings in Oracle Database VECTOR columns and exposes them through Mastra's vector interface.
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.0.0-knowledge-org-scope-20260902233451",
2
+ "version": "0.0.0-knowledge-w2-20261007195847",
3
3
  "package": "@mastra/memory",
4
4
  "exports": {},
5
5
  "modules": {
@@ -116,7 +116,44 @@ const stream = await agent.stream('Clean up old records', {
116
116
  })
117
117
  ```
118
118
 
119
- A tool's own `requireApproval` setting takes precedence over the function above. Its rule decides whether that tool needs approval. If the function throws, the call requires approval as a fail-safe.
119
+ The function can be asynchronous. For decisions that depend on the tool name and arguments, use a [classifier](https://mastra.ai/reference/classifier/classifier) to estimate whether the call needs human review:
120
+
121
+ ```typescript
122
+ import { Classifier } from '@mastra/core/classifier'
123
+ import { typeSafeAi } from '@ai-sdk/typesafe-ai'
124
+ import { agent } from './agent'
125
+
126
+ const approvalClassifier = new Classifier({
127
+ id: 'tool-approval-classifier',
128
+ model: typeSafeAi.evaluationModel('jev-latest'),
129
+ questions: {
130
+ requiresApproval: {
131
+ type: 'boolean',
132
+ instructions:
133
+ 'Does this tool call need human approval because it is destructive, irreversible, expensive, or handles sensitive data?',
134
+ },
135
+ },
136
+ })
137
+
138
+ const stream = await agent.stream('Clean up old records', {
139
+ requireToolApproval: async ({ toolName, args }) => {
140
+ const result = await approvalClassifier.evaluate({
141
+ state: {
142
+ toolName,
143
+ argumentNames: Object.keys(args),
144
+ },
145
+ })
146
+
147
+ return result.answers.requiresApproval.probability >= 0.7
148
+ },
149
+ })
150
+ ```
151
+
152
+ The example sends argument names rather than values because the classifier forwards its state to the configured evaluation model. If the decision requires argument values, redact sensitive data first or use an evaluation model and provider that meet the protected tool's data-handling requirements.
153
+
154
+ Returning `true` pauses the tool call for human approval. It doesn't approve or decline the call automatically. Choose a threshold that matches the risk of the tools available to the agent. If this `requireToolApproval` function throws, it defaults to requiring approval.
155
+
156
+ The runtime then combines that result with the tool's `requireApproval` setting. A boolean `true` requires approval, while `false` doesn't disable approval required by `requireToolApproval`. A tool-level `requireApproval` function is authoritative and replaces the combined result for that tool.
120
157
 
121
158
  > **Note:** Function-based `requireToolApproval` is only available on regular `stream()` / `generate()` calls. Durable agents and stored agents persist their options, and a function can't be serialized, so they accept only a boolean. If you pass a function in those contexts it falls back to requiring approval for every tool call.
122
159
 
@@ -370,6 +407,10 @@ const handleResume = async () => {
370
407
  }
371
408
  ```
372
409
 
410
+ When a suspended or approval-gated tool call resumes, the stream emits a `tool-call-resumed` chunk with the same `toolCallId` before the call's `tool-result`. Its `payload.kind` is `'suspension'` or `'approval'`, and the payload repeats the original `args`, `suspendPayload`, and `resumeSchema`. The chunk is only emitted when a real suspension or approval request is cleared.
411
+
412
+ With `@mastra/ai-sdk`, it arrives as a `data-tool-call-suspended` part (or `data-tool-call-approval` part for approvals) with `resumed: true`, which replaces the original part and keeps its payload. Use this signal to mark a question as answered. Don't infer it from the shape of the tool output: when the suspension came from a sub-agent, the output of the delegation call is the sub-agent's result, not your answer.
413
+
373
414
  ## Automatic tool resumption
374
415
 
375
416
  When using tools that call `suspend()`, you can enable automatic resumption so the agent resumes suspended tools based on the user's next message. Set `autoResumeSuspendedTools` to `true` in the agent's default options or per-request:
@@ -10,15 +10,16 @@ Agents that use memory in `thread` scope, including observational memory, requir
10
10
  ObservationalMemory (scope: 'thread') requires a threadId, but none was found in RequestContext or MessageList.
11
11
  ```
12
12
 
13
- This page covers the three working patterns for running Mastra evals against memory-enabled agents, what each path supports, and which one to pick. A complete runnable repro for all three approaches lives in [`examples/evals-with-memory`](https://github.com/mastra-ai/mastra/tree/main/examples/evals-with-memory).
13
+ Choose an approach based on how you want to share memory across eval items. For runnable examples, see [`examples/evals-with-memory`](https://github.com/mastra-ai/mastra/tree/main/examples/evals-with-memory).
14
14
 
15
15
  ## When to use which approach
16
16
 
17
- | Goal | Approach |
18
- | ------------------------------------------------ | ----------------------------------------------------------------------------------------- |
19
- | One shared conversation across every item | [`runEvals` with global `targetOptions.memory`](#shared-thread-with-runevals) |
20
- | One independent thread per item, focused CI loop | [`runEvals` per item](#per-item-threads-with-runevals) |
21
- | Per-item threads driven by a stored `Dataset` | [`dataset.startExperiment` with an inline task](#dataset-experiments-with-an-inline-task) |
17
+ | Goal | Approach |
18
+ | -------------------------------------------------------- | --------------------------------------------------------------------------------------------- |
19
+ | One shared conversation across every item | [`runEvals` with global `targetOptions.memory`](#shared-thread-with-runevals) |
20
+ | One independent thread per item, focused CI loop | [`runEvals` per item](#per-item-threads-with-runevals) |
21
+ | Fresh thread per item in a stored `Dataset` | [`dataset.startExperiment` with a registered agent](https://mastra.ai/docs/evals/experiments) |
22
+ | Explicit thread selection per item in a stored `Dataset` | [`dataset.startExperiment` with an inline task](#dataset-experiments-with-an-inline-task) |
22
23
 
23
24
  Pre-seeding `RequestContext` with `MastraMemory` **isn't** a supported way to drive memory into an agent. Thread resolution reads `args.memory.thread`, `RequestContext.MastraMemory` is populated by `prepare-memory-step` after the agent has already resolved its thread.
24
25
 
@@ -90,7 +91,9 @@ const average = scores.reduce((a, b) => a + b, 0) / scores.length
90
91
 
91
92
  ## Dataset experiments with an inline task
92
93
 
93
- `dataset.startExperiment({ target: agent })` **doesn't** forward a `memory` option to the agent, only `requestContext`. To run a stored dataset against a memory-enabled agent, use an inline `task` function and stash `{ threadId, resourceId }` in each item's `metadata`. The scorer pipeline still runs as normal.
94
+ `dataset.startExperiment()` accepts `targetType` and `targetId` for a registered target, or an inline `task` function. For a registered memory-enabled agent, the runner creates a fresh thread per item by default. See [memory-enabled experiment targets](https://mastra.ai/docs/evals/experiments) for resource isolation and request context options.
95
+
96
+ To choose each item's thread explicitly through `agent.generate()`, use an inline `task` and store `{ threadId, resourceId }` in each item's `metadata`. The scorer pipeline still runs as normal.
94
97
 
95
98
  ```typescript
96
99
  import { randomUUID } from 'node:crypto'
@@ -178,7 +178,7 @@ await assistant.generate('Help me plan the next project milestone.', {
178
178
 
179
179
  The example assumes storage is configured on the registered Mastra instance or directly on `Memory`. `lastMessages` controls how many recent messages Mastra loads from the thread. The default is 10.
180
180
 
181
- Message history works well for shorter conversations where recent turns contain the context the agent needs. For long-running conversations, Mastra recommends [Observational Memory](https://mastra.ai/docs/memory/observational-memory), which keeps recent conversation available and turns older history into a dense observation log.
181
+ Message history works well for shorter conversations where recent turns contain the context the agent needs. Because the `lastMessages` window slides forward on every request, each turn past the limit removes the oldest message from the start of the prompt and invalidates the provider prompt cache. For long-running conversations, Mastra recommends [Observational Memory](https://mastra.ai/docs/memory/observational-memory), which keeps recent conversation available and turns older history into a dense observation log while keeping the prompt prefix stable for caching.
182
182
 
183
183
  ## Observational Memory
184
184
 
@@ -204,14 +204,12 @@ export const assistant = new Agent({
204
204
  })
205
205
  ```
206
206
 
207
- After messages are observed, the model receives the observation log, recent messages that haven't been observed, and a continuation reminder. The raw messages remain stored but no longer occupy the active model context.
207
+ After messages are observed, the model receives the observation log, recent messages that haven't been observed, and a continuation reminder. Because delayed hints may be stale by the time a buffered chunk activates, async buffered observations don't generate continuation hints (`currentTask` or `suggestedResponse`). The raw messages remain stored but no longer occupy the active model context.
208
208
 
209
209
  Observations are added in stable chunks, which helps providers reuse the existing prompt prefix. Observational Memory can also activate buffered observations after a prompt cache is likely to expire or before the agent changes providers.
210
210
 
211
211
  ## Signals
212
212
 
213
- > **Beta:** Signals may change without a major version bump until the API is stable.
214
-
215
213
  [Signals](https://mastra.ai/docs/harness/signals) add messages or system-generated context to a memory-backed thread. Delivery depends on the thread's state: a signal can wake an idle agent or enter an active loop. It can also wait for the next turn or persist without waking the agent.
216
214
 
217
215
  State signals require memory and an existing thread. Notification inbox signals require a storage adapter with notification support.
@@ -44,16 +44,16 @@ The full set of options is listed in the [backgroundTasks configuration referenc
44
44
 
45
45
  ## Run a tool in the background
46
46
 
47
- Enabling the manager doesn't run anything in the background by itself as every tool defaults to foreground execution. Tools opt in at one of two layers:
47
+ Enabling the manager doesn't run anything in the background by itself. Tools become eligible at one of two layers:
48
48
 
49
49
  1. **Tool-level config**: the tool itself declares it as background-eligible.
50
50
  2. **Agent-level config**: the agent declares which of its tools are background-eligible.
51
51
 
52
- Once a tool has opted in, the LLM can optionally include a `_background` field in the tool arguments to override the resolved config for a specific call (timeout, retries, or to flip the call back to foreground).
52
+ Eligible tools default to `deferred` execution. Set `defaultDisposition: 'foreground'` at either layer when eligibility should only give the LLM the option to run a call in the background. The LLM can include a `_background` field in the tool arguments to select `foreground`, `deferred`, or `awaited` execution for a specific call and override its timeout or retries.
53
53
 
54
54
  ### Tool-level
55
55
 
56
- Set `background.enabled: true` on the tool definition. Tools opted in at this layer run in the background whenever called by an agent that has the manager enabled.
56
+ Set `background.enabled: true` on the tool definition. Tools opted in at this layer are eligible for background execution when called by an agent that has the manager enabled. Their configured default disposition determines whether each call runs inline or in the background unless the call includes a `_background` override.
57
57
 
58
58
  ```typescript
59
59
  import { createTool } from '@mastra/core/tools'
@@ -65,6 +65,7 @@ export const researchTool = createTool({
65
65
  inputSchema: z.object({ topic: z.string() }),
66
66
  background: {
67
67
  enabled: true,
68
+ defaultDisposition: 'deferred',
68
69
  timeoutMs: 600_000,
69
70
  maxRetries: 1,
70
71
  },
@@ -104,20 +105,23 @@ When a tool is registered on an agent that has background tasks enabled, the mod
104
105
  ```json
105
106
  {
106
107
  "topic": "solana",
107
- "_background": { "enabled": true, "timeoutMs": 900_000 }
108
+ "_background": { "disposition": "awaited", "timeoutMs": 900000 }
108
109
  }
109
110
  ```
110
111
 
111
- The `_background` override is a _modifier_ on tools the developer has already opted in at the tool or agent layer, it's not a standalone opt-in. If a tool hasn't been opted in, `_background.enabled: true` from the model is ignored and the tool runs in the foreground. This keeps deterministic, foreground-only tools (calculators, lookups, schema validators) from being silently dispatched as tasks.
112
+ The available dispositions are:
112
113
 
113
- ### Resolution order
114
+ - `foreground`: Run the tool synchronously without background-work lifecycle signals.
115
+ - `deferred`: Dispatch the tool and let the agent continue. The task remains attached to the run, and streams using `untilIdle` wait for it to reconcile.
116
+ - `awaited`: Dispatch the tool through the background task manager, but hold the current branch until its authoritative result has been reconciled.
117
+
118
+ For compatibility, `_background.enabled: true` selects `deferred`, and `_background.enabled: false` selects `foreground`. An explicit `disposition` takes precedence over `enabled`.
114
119
 
115
- When a tool call is dispatched, the resolved background config is computed in this priority order:
120
+ The `_background` override only _modifies_ tools the developer has already opted in at the tool or agent layer. If a tool hasn't been opted in, a model-selected background disposition is ignored and the tool runs in the foreground. This keeps deterministic, foreground-only tools (calculators, lookups, schema validators) from being silently dispatched as tasks.
116
121
 
117
- 1. Agent-level `backgroundTasks.tools` entry for the tool.
118
- 2. Tool-level `background` config.
119
- 3. LLM `_background.enabled` override (only used to enable background dispatch when the tool was opted in at one of the layers above).
120
- 4. Manager defaults (`defaultTimeoutMs`, `defaultRetries`).
122
+ ### Resolution order
123
+
124
+ When a tool call is dispatched, agent-level and tool-level settings determine eligibility and fallback values. For an eligible tool, the LLM `_background` fields override the corresponding values for that call. Manager defaults fill timeout and retry values that remain unset. An `_background` field can't enable a tool that's not eligible.
121
125
 
122
126
  If the agent has `backgroundTasks.disabled: true`, every tool call runs synchronously regardless of the layers above.
123
127
 
@@ -204,7 +208,7 @@ const stream = await supervisor.stream('Research AI in education and write an ar
204
208
 
205
209
  ### Inheriting from the subagent
206
210
 
207
- If a subagent isn't listed under the supervisor's `backgroundTasks.tools` but has background-eligible tools of its own (either via tool-level `background.enabled: true` or its own `backgroundTasks.tools` entry) the framework still dispatches the entire subagent invocation as a background task. The supervisor inherits the subagent's intent: the subagent itself becomes the background task, and its inner tools run in the foreground inside the subagent's loop.
211
+ If a subagent isn't listed under the supervisor's `backgroundTasks.tools` but has background-eligible tools of its own (either via tool-level `background.enabled: true` or its own `backgroundTasks.tools` entry) the framework still dispatches the entire subagent invocation as a background task. The supervisor inherits the subagent's intent: the subagent itself becomes the background task, and it can dispatch its eligible ordinary tools in the background inside its loop. Further delegated-agent calls run in the foreground.
208
212
 
209
213
  The background config used for the inherited dispatch (for example `waitTimeoutMs`) is derived from the subagent's own `backgroundTasks` config.
210
214
 
@@ -223,9 +227,11 @@ const researchAgent = new Agent({
223
227
  })
224
228
  ```
225
229
 
226
- When this `researchAgent` is delegated to from a supervisor that has no backgroundTask configuration for the `researchAgent`, the supervisor still dispatches the whole `researchAgent` invocation as a background task, and `deepResearchTool` runs in the foreground inside that invocation, instead of dispatching its own nested background task.
230
+ When this `researchAgent` is delegated to from a supervisor that has no background task configuration for the `researchAgent`, the supervisor still dispatches the whole `researchAgent` invocation as a background task.
231
+
232
+ Mastra supports one nested background-tool level inside a delegated run: a root agent can delegate to a subagent, and that subagent can dispatch an eligible ordinary tool in the background. A second delegated-agent edge runs in the foreground and doesn't receive nested background guidance. This limit is execution-scoped and doesn't mutate the shared subagent configuration.
227
233
 
228
- Use this pattern when you want a subagent to behave consistently in the background regardless of which supervisor invokes it. Use the supervisor-side opt-in (above) when you want to tune background behavior centrally per supervisor.
234
+ Which layer to use depends on where consistency matters: subagent-level configuration travels with the agent, which keeps its background behavior the same under every supervisor, whereas the supervisor-side opt-in above centralizes that tuning in one place. This boundary stops at a single nested delegation level and has no workflow integration.
229
235
 
230
236
  ## Suspending and resuming
231
237
 
@@ -262,7 +268,7 @@ export const reviewTool = createTool({
262
268
  })
263
269
  ```
264
270
 
265
- The first invocation of `execute` sees `resumeData === undefined` and calls `suspend`. After the task is resumed, the runtime restarts the tool with `resumeData` populated. The `if` condition is false, so the tool returns its real result.
271
+ The first invocation of `execute` sees `resumeData === undefined` and calls `suspend`. After the task is resumed, the runtime restarts the tool with `resumeData` populated. The `if` condition is false. The tool returns its real result.
266
272
 
267
273
  To resume the task once an approval arrives:
268
274
 
@@ -315,23 +321,23 @@ export const mastra = new Mastra({
315
321
  Calling `stream()` with no filter returns a stream of every task event in the system. On connection, the stream emits a snapshot of all currently running tasks, then forwards live events as they happen.
316
322
 
317
323
  ```typescript
318
- const bgManager = mastra.backgroundTaskManager
319
- if (!bgManager) throw new Error('Background tasks are not enabled')
324
+ const bgManager = mastra.backgroundTaskManager;
325
+ if (!bgManager) throw new Error('Background tasks are not enabled');
320
326
 
321
- const controller = new AbortController()
322
- const stream = bgManager.stream({ abortSignal: controller.signal })
327
+ const controller = new AbortController();
328
+ const stream = bgManager.stream({ abortSignal: controller.signal });
323
329
 
324
330
  for await (const chunk of stream) {
325
331
  switch (chunk.type) {
326
332
  case 'background-task-running':
327
- console.log('started', chunk.payload.taskId, chunk.payload.toolName)
328
- break
333
+ console.log('started', chunk.payload.taskId, chunk.payload.toolName);
334
+ break;
329
335
  case 'background-task-completed':
330
- console.log('done', chunk.payload.taskId, chunk.payload.result)
331
- break
336
+ console.log('done', chunk.payload.taskId, chunk.payload.result);
337
+ break;
332
338
  case 'background-task-failed':
333
- console.error('failed', chunk.payload.taskId, chunk.payload.error)
334
- break
339
+ console.error('failed', chunk.payload.taskId, chunk.payload.error);
340
+ break;
335
341
  }
336
342
  }
337
343
  ```
@@ -4,9 +4,7 @@
4
4
 
5
5
  # Goals
6
6
 
7
- **Added in:** `@mastra/core@1.42.0`
8
-
9
- > **Beta:** Breaking changes may occur without a major version bump until the API is stable.
7
+ **Added in:** `@mastra/core@1.43.0`
10
8
 
11
9
  A goal is a durable, thread-scoped objective: a standing instruction the agent keeps working toward across loop iterations until a judge model decides it's satisfied or a run budget is exhausted.
12
10
 
@@ -67,11 +65,26 @@ A goal step runs inside the agentic execution loop, right after `isTaskComplete`
67
65
 
68
66
  The step is a no-op for background-task, mid-tool-loop, and working-memory-only iterations, the same gating as `isTaskComplete`.
69
67
 
70
- **The judge model is the activation switch.** If no judge resolves (neither the per-objective override nor the agent's `goal.judge`), the goal step performs no scoring or budget consumption and emits no `goal` chunk.
68
+ Each evaluation emits a typed `goal` stream chunk (`GoalEvaluationPayload`: `objective`, `iteration`, `maxRuns`, `passed`, `status`, `results`, `reason`, `duration`, `timedOut`, `maxRunsReached`, `suppressFeedback`) so a UI can show goal progress mid-run.
69
+
70
+ **The judge model is the activation switch.** If no judge resolves, from either the per-objective override or the agent's `goal.judge`, the goal step performs no scoring or budget consumption and emits no `goal` chunk. The gate covers every scorer: Mastra checks it before selecting a scorer, so a custom `goal.scorer` still needs a judge to resolve.
71
+
72
+ Effective settings resolve as per-objective record value, then agent `goal` config, then a built-in default (`maxRuns` `50` and the default judge prompt).
73
+
74
+ ### Judge and scorer
75
+
76
+ `goal.judge` and `goal.scorer` work at different levels. `goal.scorer` is the evaluation pipeline that produces the score the loop gates on. `goal.judge` is the model the default pipeline calls to reach that score.
71
77
 
72
- Effective settings resolve as per-objective record value → agent `goal` config → built-in default (`maxRuns` `50`, a default judge prompt).
78
+ Omit `scorer` and Mastra builds a default LLM-as-judge scorer, which returns `1` when the objective is achieved and `0` otherwise. Configure it with these settings:
73
79
 
74
- By default the step uses a built-in LLM-as-judge scorer that returns `1` when the objective is achieved and `0` otherwise. Supply your own scorer with `goal.scorer` to customize judging.
80
+ - `goal.judge`: The model that decides whether the objective is met.
81
+ - `goal.prompt`: Extra instructions for the judge. Defaults to the built-in goal judge prompt.
82
+ - `goal.tools`: Read-only verification tools the judge can call before deciding, so it can confirm the work instead of grading the agent's text alone.
83
+ - `goal.maxSteps`: Step budget for the judge's own agentic loop. Defaults to `5`.
84
+
85
+ Pass `goal.scorer` to replace the pipeline with your own [scorer](https://mastra.ai/reference/evals/create-scorer), either a scorer instance or a registered scorer id. The custom scorer brings its own judging, so `goal.prompt`, `goal.tools`, and `goal.maxSteps` no longer apply, and Mastra stops resolving the judge model for judging. A `goal.judge` resolver function still runs, and its return value is discarded.
86
+
87
+ Configure the default scorer with `judge`, `maxRuns`, and `prompt`:
75
88
 
76
89
  ```typescript
77
90
  const worker = new Agent({
@@ -91,7 +104,15 @@ const worker = new Agent({
91
104
  })
92
105
  ```
93
106
 
94
- Each evaluation emits a typed `goal` stream chunk (`GoalEvaluationPayload`: `objective`, `iteration`, `maxRuns`, `passed`, `status`, `results`, `reason`, `duration`, `timedOut`, `maxRunsReached`, `suppressFeedback`) so a UI can show goal progress mid-run.
107
+ To hand the decision to your own scorer, pass it as `scorer` and keep `judge` set, because the activation gate still applies:
108
+
109
+ ```typescript
110
+ goal: {
111
+ judge: 'openai/gpt-5-mini',
112
+ // Replaces the built-in judge pipeline. `prompt`, `tools`, and `maxSteps` no longer apply.
113
+ scorer: 'tests-pass',
114
+ }
115
+ ```
95
116
 
96
117
  ## Managing the objective
97
118
 
@@ -14,6 +14,12 @@ Memory processors are [processors](https://mastra.ai/docs/agents/processors) tha
14
14
 
15
15
  Mastra automatically adds these processors when memory is enabled:
16
16
 
17
+ ### `MemoryInputFilter`
18
+
19
+ Trims client-echoed history before memory loaders run. For an existing thread, it keeps only the current user turn or new tool results. For an empty thread, it keeps the full initial input and removes provider item metadata from assistant parts that could refer to items that don't exist in storage.
20
+
21
+ This processor runs first so `MessageHistory`, `SemanticRecall`, and Observational Memory receive only the new input they need.
22
+
17
23
  ### `MessageHistory`
18
24
 
19
25
  Retrieves message history and persists new messages.
@@ -206,7 +212,7 @@ Understanding the execution order is important when combining guardrails with me
206
212
  [Memory Processors] → [Your inputProcessors]
207
213
  ```
208
214
 
209
- 1. **Memory processors run FIRST**: `WorkingMemory`, `MessageHistory`, `SemanticRecall`
215
+ 1. **Memory processors run FIRST**: `MemoryInputFilter`, then `WorkingMemory`, `MessageHistory`, and `SemanticRecall`
210
216
  2. **Your input processors run AFTER**: guardrails, filters, validators
211
217
 
212
218
  As a result, memory loads message history before your processors can validate or filter the input.
@@ -12,7 +12,9 @@ You can also retrieve message history to display past conversations in your UI.
12
12
 
13
13
  > **Warning:** When you use memory with a client application, send **only the new message** from the client instead of the full conversation history.
14
14
  >
15
- > Sending the full history is redundant because Mastra loads messages from storage, and it can cause message ordering bugs when client-side timestamps conflict with stored timestamps.
15
+ > Sending the full history is redundant because Mastra loads messages from storage. Mastra filters client-echoed history before loading stored messages and uses the stored copy as the base when message IDs match, preserving stored timestamps and provider metadata while retaining new tool results.
16
+ >
17
+ > If you assemble the request input yourself and need it processed exactly as sent, set `retainFullInput: true` on `memory.options` for that call, or in the memory constructor options to apply it agent-wide. This disables the filtering described above. History still loads underneath. Every input message that isn't already stored is saved to the thread, including few-shot examples.
16
18
  >
17
19
  > For an AI SDK example, see [Using Mastra Memory](https://mastra.ai/integrations/agentic-ui/ai-sdk-ui).
18
20
 
@@ -122,6 +124,29 @@ You can use this history in two ways:
122
124
  - **Automatic inclusion**: Mastra automatically includes recent messages in the context window. The default of 10 messages keeps agents grounded in the conversation. Adjust it with `lastMessages` when needed.
123
125
  - [**Manual querying**](#querying): For more control, query threads and messages directly with `recall()`. Use the results to choose which memories enter the context window or to render conversation history in your UI.
124
126
 
127
+ > **Note:** `lastMessages` counts every stored message, including tool calls, tool results, and [signals](https://mastra.ai/docs/harness/signals) of any kind, so a single turn can add several messages to the count. The window also slides forward on every request: once a thread grows past the limit, the oldest message leaves context on each turn, which changes the start of the prompt and invalidates the provider prompt cache. For long-running conversations, use [Observational Memory](https://mastra.ai/docs/memory/observational-memory), which keeps the prompt prefix stable.
128
+
129
+ ### Limit history by tokens
130
+
131
+ Message count is a poor proxy for context size: a tool result can be a few tokens or thousands. Use `messageHistory` to keep recent history within a token budget instead:
132
+
133
+ ```typescript
134
+ export const agent = new Agent({
135
+ id: 'test-agent',
136
+ memory: new Memory({
137
+ options: {
138
+ messageHistory: { maxTokens: 8_000, atMaxRemoveTokens: 2_000 },
139
+ },
140
+ }),
141
+ })
142
+ ```
143
+
144
+ Mastra counts the complete prompt against `maxTokens`, including remembered history, system instructions, context, and the current turn. When the prompt exceeds the budget, Mastra removes the oldest remembered messages until the prompt is at most `maxTokens - atMaxRemoveTokens`. `atMaxRemoveTokens` defaults to 25% of `maxTokens`. Removing history in chunks keeps the prompt prefix stable across several turns, which helps provider prompt caches stay warm.
145
+
146
+ System messages, context, the current turn's input, and the agent's responses are never trimmed. Linked tool calls and results are removed together. If protected content alone exceeds `maxTokens`, Mastra removes all remembered history but keeps the protected content.
147
+
148
+ Trimmed messages stay in storage. During agent runs, Mastra persists a per-thread boundary so they're excluded from later turns. Setting `messageHistory` without `lastMessages` disables the default 10-message cap. Set both to combine a count cap with a token budget. Set `maxTokens` to `0` to disable message history.
149
+
125
150
  > **Tip:** When memory is enabled, [Studio](https://mastra.ai/docs/studio/overview) uses message history to display past conversations in the chat sidebar.
126
151
 
127
152
  ## Thread title generation
@@ -147,6 +172,43 @@ export const supportAgent = new Agent({
147
172
 
148
173
  Title generation runs asynchronously after the agent responds and doesn't affect response time.
149
174
 
175
+ ### Streaming the generated title
176
+
177
+ By default title generation runs in the background and the run's stream doesn't wait for it, so HTTP clients only see the title on their next thread fetch. Set `emitEvent: true` to deliver the title on the run's stream instead: the stream waits for the title and emits a transient `data-thread-title` chunk before `finish`.
178
+
179
+ ```typescript
180
+ import { Agent } from '@mastra/core/agent'
181
+ import { Memory } from '@mastra/memory'
182
+
183
+ export const supportAgent = new Agent({
184
+ id: 'support-agent',
185
+ name: 'Support agent',
186
+ instructions: 'Answer customer support questions.',
187
+ model: 'openai/gpt-5.6-sol',
188
+ memory: new Memory({
189
+ options: {
190
+ generateTitle: {
191
+ emitEvent: true,
192
+ },
193
+ },
194
+ }),
195
+ })
196
+ ```
197
+
198
+ Stream consumers receive the chunk with the persisted title, so a chat UI can rename its thread list entry without polling:
199
+
200
+ ```typescript
201
+ for await (const chunk of stream.fullStream) {
202
+ if (chunk.type === 'data-thread-title') {
203
+ renameThreadInSidebar(chunk.data.threadId, chunk.data.title)
204
+ }
205
+ }
206
+ ```
207
+
208
+ The chunk is transient: it's delivered to stream consumers but never persisted as part of the conversation's messages. Because the stream waits for the title, `emitEvent` delays the stream's `finish` on the turn that generates the title: the first turn of a thread, or a later turn when `minMessages` sets a higher threshold. Leave it off to keep title generation fully non-blocking.
209
+
210
+ > **Note:** `emitEvent` applies to `stream()` runs. `generate()` returns JSON and can't carry the chunk, so it keeps non-blocking title generation. [Durable and evented agents](https://mastra.ai/docs/harness/durable-agents) don't emit this chunk yet. In all of these cases the title is still generated and persisted.
211
+
150
212
  To optimize cost or behavior, provide a smaller [`model`](https://mastra.ai/models) and custom `instructions`:
151
213
 
152
214
  ```typescript
@@ -178,7 +240,7 @@ const agent = mastra.getAgentById('test-agent')
178
240
  const memory = await agent.getMemory()
179
241
  ```
180
242
 
181
- The `Memory` instance gives you access to functions for listing threads and recalling messages, plus cloning conversations, and more.
243
+ Use the `Memory` instance to query stored threads and messages or clone a conversation.
182
244
 
183
245
  ## Querying
184
246
 
@@ -232,7 +294,7 @@ const thread = await memory.getThreadById({ threadId: 'thread-123' })
232
294
 
233
295
  Once you have a thread, use [`recall()`](https://mastra.ai/reference/memory/recall) to retrieve its messages. It supports pagination and [semantic search](https://mastra.ai/docs/memory/semantic-recall), with optional date filtering.
234
296
 
235
- Basic recall returns all messages from a thread:
297
+ Fetch a thread's history without pagination. Recall hides reminder signals by default; pass `hideSignals: false` to include them, `true` to hide all recognized signals, or an array to omit selected types. See [signal visibility and compatibility](https://mastra.ai/reference/memory/recall) for matching rules and precedence.
236
298
 
237
299
  ```typescript
238
300
  const { messages } = await memory.recall({
@@ -343,7 +405,9 @@ const { thread, clonedMessages } = await memory.cloneThread({
343
405
 
344
406
  You can filter cloned messages by count or date range and specify custom thread IDs. Utility methods are also available to inspect clone relationships.
345
407
 
346
- See [`cloneThread()`](https://mastra.ai/reference/memory/cloneThread) and [clone utilities](https://mastra.ai/reference/memory/clone-utilities) for the full API.
408
+ If you don't need the copied messages returned, for example when forking a long thread, use `copyThread()`. It never returns message payloads, and on LibSQL and PostgreSQL the rows are copied inside the database. When semantic recall is enabled, the copied messages are still read back in batches to generate embeddings.
409
+
410
+ See [`cloneThread()`](https://mastra.ai/reference/memory/cloneThread), [`copyThread()`](https://mastra.ai/reference/memory/copyThread), and [clone utilities](https://mastra.ai/reference/memory/clone-utilities) for the full API.
347
411
 
348
412
  ## Deleting messages
349
413
 
@@ -160,7 +160,7 @@ const memory = new Memory({
160
160
 
161
161
  OM requires a storage adapter that supports it: `@mastra/libsql`, `@mastra/pg`, `@mastra/mongodb`, or `@mastra/oracledb`.
162
162
 
163
- > **Note:** If you switch the Observer to a weaker model and see facts collapse to a generic `User`, use [`observation.instruction`](https://mastra.ai/reference/memory/observational-memory) to teach the Observer how to read the `<turn>` tag.
163
+ > **Note:** If you switch the Observer to a less capable model and see facts attributed to a generic `User` instead of individual participants, use [`observation.instruction`](https://mastra.ai/reference/memory/observational-memory) to explain how to interpret the `<turn>` tag.
164
164
 
165
165
  ### With working memory
166
166