unstale

npm / @mastra/memory

@mastra/memory

What changed in @mastra/memory 1, from its official release notes, upgrade guides and advisories. Sources checked 2026-11-30.

23 breaking3 security3 deprecations38 new APIs and options5 performance27 behavior and defaults1 tooling65 fixes and other

See which of these apply to your code, ranked, in your agent:

npx @unstale/cli init

@unstale/cli on npm

@mastra/memory 1165 changes

Breaking changes 23

  • When observational memory manages working memory, the observer must write the section or UNCHANGED; a missing section is recorded as an extraction failure.

    1.41.1release notes

  • Setting experimental_subconscious now throws and directs developers to attach Knowledge to the agent instead.

    1.41.0release notes

  • The Memory knowledge option is removed and throws when set, except that knowledge: false remains accepted.

    1.41.0release notes

  • Knowledge requires scope declarations; runs holding undeclared scopes fail, and an empty declaration declares none.

    1.41.0release notes

  • KnowledgeSemanticIndexCoordinator remains exported for older code to load, but constructing it throws.

    1.41.0release notes

  • Queue and steering APIs accept scopes; queued or steering messages with different scopes start their own run after the current run instead of joining it.

    1.41.0release notes

  • Messages with scopes cannot be queued to a thread owner running in another process; sendMessage rejects, while messages without scopes still join that owner's run.

    1.41.0release notes

  • Subconscious remains exported for older code to load, but constructing it throws.

    1.41.0release notes

  • Knowledge tools are off by default; tools: true enables read and write tools, while tools: { read: true } enables read tools only.

    1.41.0release notes

  • Deleting a thread now also deletes its live event stream from Mastra pubsub, instead of leaving it until expiry or indefinitely.

    1.40.0release notes

  • @mastra/memory now requires @mastra/core 1.80.0 or newer; upgrade core first if your package manager reports a peer conflict.

    1.39.1release notes

  • memory.summarizeThread() now throws when retries are exhausted on empty Observer output instead of returning an empty summary.

    1.39.1release notes

  • Synchronous observation and reflection stop with a cancelled run and leave its messages unobserved for a later cycle; async buffering and background reflection continue, and settled() still waits for them.

    1.39.1release notes

  • Text-only Observer replies, including refusals, are retried like empty replies; after retries run out, failurePolicy decides the turn. Replies containing only other Observer sections remain accepted.

    1.39.1release notes

  • summarizeConversation() now throws when retries are exhausted on empty Observer output instead of returning an empty summary.

    1.39.1release notes

  • Curator messages no longer appear in the parent conversation because the curator keeps its messages on its own thread.

    1.39.0release notes

  • A multiplier blockAfter now scales a per-thread messageTokens override instead of the instance threshold.

    1.37.1release notes

  • Merges are rejected with HTTP 400 when the storage adapter does not support atomic merges, rather than silently replacing the record.

    1.37.0release notes

  • Observational memory no longer sends Observer attachments that the agent recorded as unavailable, while retaining their transcript lines.

    1.36.0release notes

  • On existing threads, memory filters input to new trailing user messages and outcomes for still-pending stored tool calls; unstored messages before the last assistant message are removed.

    1.32.0release notes

  • The observer receives instructions after the conversation, and system reminders and signals are labeled by tag instead of being treated as user statements.

    1.32.0release notes

  • When observeAttachments is omitted, Observational Memory now forwards only images and PDFs; set it to true to forward every attachment type.

    1.28.3release notes

  • The tool now returns immediately with a reply ID and pending status, then delivers answers later as correlated partial and terminal replies.

    1.28.2release notes

Security 3

  • Explains whether a run can reach a scope or page and why; it is host-only and should not be exposed through agent tools or unauthenticated routes.

    1.41.0release notes

  • The dependency was bumped to pick up a fix for a quadratic-time denial of service in its SVG parser.

    1.36.0release notes

  • recall with partIndex now respects retrieval scope and rejects out-of-scope cursors, preventing access to message content outside the configured scope.

    1.31.0release notes

Deprecations 3

  • The 'resource' scope is deprecated and logs a one-time warning; remove scope for the default thread scope and use retrieval or resource-scoped working memory for cross-thread continuity.

    1.33.0release notes

  • Soft-deprecated in favour of messageHistory; remains supported and can be combined with it.

    1.31.0release notes

  • The legacy recall option is deprecated; explicit signal visibility settings take precedence, while omitted exclusions preserve existing history defaults.

    1.30.0release notes

New APIs and options 38

  • Knowledge provides keyword search by default; configuring a vector store and embedder blends keyword and semantic results, with semantic hits checked against run read access before ranking.

    1.41.0release notes

  • Knowledge and its option and result types are exported from @mastra/core/knowledge; attach it to an Agent with knowledge and scopes.

    1.41.0release notes

  • Observations using MongoDB Automated Embedding are indexed under memory_observations_selfembed.

    1.41.0release notes

  • Reports each committed write made through knowledge.getStorage(), including tool writes, by ID for live UIs; pages should be re-read under the viewer's read scope before display.

    1.41.0release notes

  • Returns what holders of specified scopes can read, for host code that reads the store directly.

    1.41.0release notes

  • Scope declarations can include a displayLabel for UIs, and scopeDeclaration returns a declaration's display fields.

    1.41.0release notes

  • Messages can carry scopes; a message with scopes different from the running run waits for it to end, then starts its own run in the same conversation.

    1.41.0release notes

  • Failure markers in streams and persisted messages, and tripwire metadata, now include observer span references and failure classifications when Observational Memory interrupts an agent.

    1.40.0release notes

  • Observational memory's auto model can use request credentials to decide whether to prefer Gemini instead of relying on the server's Google API key.

    1.39.0release notes

  • Core exports embedV4, and Memory and RAG support AI SDK v7 v4 embedding models while preserving v1, v2, and v3 behavior.

    1.39.0release notes

  • Accepts an optional threadId and resourceId scope to wait only for that thread's observational memory background work; without a scope it still waits for all work.

    1.39.0release notes

  • Set observationalMemory.observation.observeOnContextOverflow to false to turn off automatic recovery from context overflow.

    1.38.0release notes

  • Pass force: true to observe pending messages regardless of the threshold for that call only.

    1.38.0release notes

  • getStatus() now returns observationBlockAfter and inAsyncObservationBand to expose the observation blocking threshold and async observation band.

    1.37.1release notes

  • Lets applications override the model selected by automatic model resolution for a provider.

    1.37.0release notes

  • Adds a method to merge partial working-memory updates from application code; PostgreSQL performs deep merges in a row-locked transaction when scope is resource.

    1.37.0release notes

  • Previews the model ID that automatic model selection would pick, for uses such as settings UIs.

    1.37.0release notes

  • Turns the automatically picked model ID into a model, allowing auto resolution to use application credentials and routing.

    1.37.0release notes

  • Accepts mode: 'merge' for HTTP working-memory updates, merging partial updates rather than replacing the record.

    1.37.0release notes

  • Pass an object with provider-specific TTLs and a default to set observational memory idle activation delays for providers whose prompt cache TTL 'auto' can't detect.

    1.36.0release notes

  • Recall can page through original observation groups around a search hit, including groups condensed by reflection and buffered groups not yet activated; existing records need no re-indexing.

    1.35.0release notes

  • Added viewAttachment to the observational memory recall tool. When passed with cursor and partIndex, it shows the attachment itself to the model instead of only describing it.

    1.34.0release notes

  • Allows the agent turn to finish after observation still fails after retries when set to 'continue'; the default is 'abort'.

    1.33.0release notes

  • Sets how many times a failed Observer call is retried; the default is 8.

    1.33.0release notes

  • Allows the agent turn to finish after reflection still fails after retries when set to 'continue'; the default is 'abort'.

    1.33.0release notes

  • Sets how many times a failed Reflector call is retried; the default is 8.

    1.33.0release notes

  • Integrations that build the observations context themselves can use this function to get the context prompt for a scope.

    1.32.0release notes

  • Opt out of filtering by setting this memory option per call on memory.options or agent-wide in the memory constructor options; input is processed as supplied and unstored messages are saved.

    1.32.0release notes

  • Adds token-budgeted conversation history that counts the complete prompt and drops the oldest remembered messages in chunks, while preserving the current turn and persisting a per-thread boundary.

    1.31.0release notes

  • Adds a ready-made beforeObservation hook that replaces Agent Skills tool results with a placeholder while retaining tool calls for Observational Memory.

    1.31.0release notes

  • Copies a thread without returning message content, avoiding loading every message payload into the Node heap.

    1.30.0release notes

  • Callers can hide all recognized stored signal types, include all signals, or select types to omit without changing saved messages or model context.

    1.30.0release notes

  • Transfers a thread and its messages to a different resourceId while preserving the thread's createdAt timestamp; semantic recall vectors are migrated when enabled.

    1.30.0release notes

  • A default storage implementation backs thread resource reassignment for memory storage adapters.

    1.30.0release notes

  • Add an optional flag to skip counting matching messages when totals are unnecessary; it defaults to true, and paginated reads fetch one extra row to determine hasMore.

    1.29.0release notes

  • Add awaited transform hooks before and after observation and reflection to filter or rewrite data before model calls or persistence. Errors fail the cycle before transformed text is committed.

    1.29.0release notes

  • Enable the experimental reminder sidekick on observational memory by configuring experimental_subconscious with a Subconscious instance.

    1.28.2release notes

  • Knowledge nodes across storage adapters can now have an optional bounded description, written through a dedicated curator tool.

    1.28.1release notes

Performance 5

  • PostgreSQL observation tables now receive resource_id and thread_id metadata indexes to prevent observational memory search from scanning the whole vector table; with PgVector disableInit, create the indexes yourself.

    1.40.0release notes

  • Each cycle now embeds and stores only the observation group it adds, rather than re-embedding every earlier group.

    1.40.0release notes

  • Creating observational memory per request no longer causes growing CPU usage and gradual slowdown on Node.js versions before 24.

    1.36.0release notes

  • Thread copying now happens in the database first, with messages read back afterward because the caller requested them; the existing signature and return value remain.

    1.30.0release notes

  • CHANGELOG.md is no longer included in distributed npm files, reducing package size.

    1.28.2release notes

Behavior and default changes 27

  • Messages embedded during an agent run now carry thread metadata, so recall filters on thread attributes can find them.

    1.41.1release notes

  • Observational Memory labels user signals with the sender's name when messages include attributes.name; messages without attributes retain the plain User label.

    1.41.0release notes

  • Enable pinnedContext to deliver pinned pages every turn and add knowledge_pin; it accepts true or maxPins and maxTokens settings.

    1.41.0release notes

  • Agent scopes are plain type:value strings identifying who a run is; what it may read or write is determined by the consumer of those scopes.

    1.41.0release notes

  • When message scopes differ from the running run, sendSignal reports a blocked action with reason scope-mismatch and the run ID.

    1.41.0release notes

  • Observational Memory semantic search works with a vector store that generates embeddings itself, so an embedder is not required; configurations that pass an embedder continue working.

    1.41.0release notes

  • If storing a group's vector fails, the cycle still completes and logs a warning; the group is not retried.

    1.40.0release notes

  • When working memory uses agentManaged: false, instructions now tell agents that memory updates automatically after each response; only readOnly: true indicates they cannot update it.

    1.39.1release notes

  • Empty or whitespace-only Observer replies are retried with backoff up to the configured retry limit; after exhaustion, lastObservedAt stays unchanged and failurePolicy decides how the turn proceeds.

    1.39.1release notes

  • Observer, Reflector, or extraction model calls that produce no output for five minutes are aborted and retried; streaming replies are not cut off by total duration.

    1.39.0release notes

  • Moving a thread to another resource now also moves its observational memory recall entries, so searches under the new resource can find past observations.

    1.39.0release notes

  • When a provider rejects a request for exceeding its context window, Observational Memory observes pending messages and retries once with smaller context. Requires a compatible @mastra/core version.

    1.38.0release notes

  • With async buffering, unobserved messages can grow beyond messageTokens before a step blocks; the default is 1.2, and setting it to 1 preserves synchronous observation at the threshold.

    1.37.1release notes

  • The token budget now limits previous observations on every observation path; zero omits them, and the default false sends the full previous observations.

    1.37.1release notes

  • Buffering, activation, observation, reflection, and config-override writes for a thread or resource run one at a time within a process; due reflections take priority, and stuck writes stop blocking later writes after 60 seconds.

    1.37.1release notes

  • Default Reflector instructions now preserve concrete facts, changes of mind, and explicit statements of not knowing, refusing, or never having done something; custom instructions are still appended.

    1.37.1release notes

  • The model, observation.model, and reflection.model defaults change to 'auto'. Observer and Reflector models resolve independently from the agent's main model on every call; set a concrete model ID to keep a fixed model.

    1.37.0release notes

  • When context remains above the messageTokens threshold, observational memory activates buffered observations and synchronously observes remaining messages to avoid oversized prompts.

    1.36.0release notes

  • With retrieval enabled, agents receive recall guidance from the first turn, including in read-only runs, covering search, paging, source-message confirmation, and how to interpret user statements and reflected groups.

    1.35.0release notes

  • Search results are dated and oldest-first, mark possible gaps between hits, use short references for hits already in agent context, and choose query-relevant excerpts for shortened groups.

    1.35.0release notes

  • Annotates additional date formats with relative time, including dates with times, ranges, month or year dates, and dates with a year inside observations; dates without a year remain unchanged.

    1.33.0release notes

  • Messages that were not observed are retried on a later turn, while a cancelled turn always stops regardless of failure policy.

    1.33.0release notes

  • Retry a temporary provider failure once, independently of maxRetries; a failed extraction does not block the turn.

    1.33.0release notes

  • Thread-scoped observations are described as memory of the current conversation, helping agents reuse IDs, artifacts, and tool results as belonging to that session.

    1.32.0release notes

  • Token-routed models selected with ModelByInputTokens now receive the 100,000-token output default.

    1.31.0release notes

  • Observers retain completed tool-call arguments and outcomes, use bounded structure-aware previews for large arguments, and include arguments in token accounting; the default non-multimodal result-text cap is 5,000 tokens.

    1.31.0release notes

  • Observer and reflector passes now trace as memory operations, appearing as memory: observe and memory: reflect.

    1.28.3release notes

Tooling 1

  • The shipped map now lists public exports by name and points to their type definition and implementation when resolvable, helping tools look up exports.

    1.41.1release notes

Fixes and other changes 65

  • When retrieval is on, reflection now reflects or keeps each observation group whole, preventing stray context markers and observations that cannot be traced to source messages.

    1.41.1release notes

  • Concurrent updates from different threads no longer overwrite each other when working memory uses the default resource scope; the lock is held per Memory instance.

    1.41.1release notes

  • When a run is stopped during observation, the abort now includes its reason instead of only the generic abort message.

    1.41.1release notes

  • Each message now has one vector row per chunk, keyed by message id; saving it again replaces its rows, avoiding duplicate rows that reduce distinct recall results.

    1.41.1release notes

  • Recall now returns visible message content while preserving text and tool part indices, and paging no longer stops early on messages containing only reasoning.

    1.41.0release notes

  • The observations block now closes immediately after the last observation, preventing current-task and suggested-response hints from being read as observations.

    1.41.0release notes

  • With vector retrieval enabled, new observations are now indexed in the vector store.

    1.40.0release notes

  • Recovery moves the rest of a run's response to a new message so a later context overflow in the same run can also be observed and retried.

    1.39.1release notes

  • The continuation hint is now added only after observations have actually replaced messages, preventing it from appearing on threads with no observations.

    1.39.1release notes

  • When a durable turn resumes on another worker, the current user request and delayed tool results remain in the prompt, and completed live background results are preserved when reconciling stored messages.

    1.39.1release notes

  • Token counting and the observer now handle structured errors in failed tool calls stored in conversation history, allowing Observational Memory to continue on later turns.

    1.39.1release notes

  • @mastra/memory now loads in Node ESM without failing to resolve probe-image-size/sync.

    1.39.1release notes

  • Per-request false and { enabled: false } overrides now disable observational memory for that request while preserving message history and subsequent enabled runs.

    1.39.1release notes

  • After the model answers a request that memory has observed, the request leaves the prompt and observations stand in for it for the rest of the run.

    1.39.1release notes

  • Observer sections written on one line are now parsed instead of ignored.

    1.39.1release notes

  • In resource scope, omitted threads no longer have their cursor advanced; their messages can be observed later, and replies naming none of the requested threads are retried.

    1.39.1release notes

  • Working-memory data no longer leaks into recalled history after raw message writes or partial edits; message edits index the visible text retained after the edit.

    1.39.1release notes

  • Gemini 3 turns with working memory no longer fail when continuing after a client tool result; saved tool-call history now replays with the required signature.

    1.39.0release notes

  • Threshold-triggered observations use the step's main model rather than unexpectedly falling back to Gemini; with canUseProvider set and no main model, auto returns a clear error.

    1.39.0release notes

  • Assistant message identity is preserved during observational memory feedback continuations.

    1.39.0release notes

  • The current turn's input messages and latest step output stay in the prompt until the turn ends, preventing observation between steps from removing unread user input or tool results.

    1.39.0release notes

  • A recovering worker starts a new message instead of merging the rest of an agent reply into an already-observed message; malformed observed-message lists no longer crash the turn.

    1.39.0release notes

  • Now waits for buffered reflections to finish writing before it resolves.

    1.39.0release notes

  • In AgentController sessions, reminder checks, memory questions, and follow-ups run on the reminder's own thread so reminders reach the main agent.

    1.39.0release notes

  • Long numbers are now counted accurately, so memory and token limits trigger at the right time. Estimates saved on existing messages are recalculated.

    1.38.0release notes

  • The end marker is written to the message carrying the cycle's start marker, preventing it from disappearing on save or overwriting the agent's streamed response.

    1.37.1release notes

  • Observer, reflector and fallback model lists no longer cause type checking complexity to grow with the number of model IDs.

    1.37.1release notes

  • Concurrent buffering, activation, observation, and reflection no longer lose or duplicate context across processes and durable agent steps; stale work after memory clearing or thread deletion is discarded.

    1.37.1release notes

  • Observations are kept in event order so outdated state is not recorded as newer than later user instructions.

    1.37.1release notes

  • Live scorers now receive every response message across suspend and resume segments under the original runId, including tool calls removed from agent context by observational memory.

    1.37.1release notes

  • Semantic recall no longer misses a turn's new user message when background buffering picks it up on the first step.

    1.37.1release notes

  • An empty working-memory result no longer replaces stored working memory; Mastra retries extraction while preserving other extracted values such as the thread title.

    1.37.1release notes

  • When an observational memory error stops a run, the user message and tool results from completed steps are saved first.

    1.37.0release notes

  • Persistence and idle buffering now use the terminal message list accepted by the processor pipeline rather than the list captured by the observation turn.

    1.37.0release notes

  • When a stored model output is null, observational memory falls back to the actual completed tool result so the Observer, token counting, and recall see it.

    1.36.0release notes

  • Very long lines are truncated and retained, repeated short lines share a bounded budget, and genuinely repetitive output remains rejected.

    1.36.0release notes

  • Failed or partial observer and reflector calls retry from the original prompt, so only complete replies are saved.

    1.36.0release notes

  • Reflection retry attempts are marked as retrying, preventing the agent controller from cancelling a run before a stronger-compression retry finishes.

    1.36.0release notes

  • recall({ vectorSearchString }) and its message writes work with vector stores that generate embeddings themselves, without a configured embedder; thread cloning and resource transfers also preserve semantic-recall vectors.

    1.36.0release notes

  • The recall tool now preserves attachment references, including media type and stored URL or provider file ID, so agents can reuse earlier attachments.

    1.34.0release notes

  • Saving messages no longer leaves a thinking-only step behind after hiding updateWorkingMemory, and the hidden call no longer reappears in later prompts.

    1.33.0release notes

  • Returns 'No working memory data available.' instead of working memory instructions containing 'null' when no working memory has been saved.

    1.33.0release notes

  • Include the Mastra error ID so storage failures identify which operation failed instead of showing only the raw driver message.

    1.33.0release notes

  • A later observation group is parsed and shown in reflections with its own ID and range when an earlier truncated group quoted an observation-group tag inline.

    1.33.0release notes

  • Fixes relative dates being off by a day across time zones and daylight-saving changes, and avoids marking an action dated for the current day as likely already happened.

    1.33.0release notes

  • When observation.manageWorkingMemory is enabled, updates that do not match the configured schema are skipped and the previous working memory is kept.

    1.32.1release notes

  • CommonJS consumers can use memory token counting without ESM loading errors.

    1.31.0release notes

  • Thread deletion waits for in-flight observational-memory work, and completed cycles no longer recreate memory records or leave searchable vectors.

    1.31.0release notes

  • Observer and Reflector agents use the logger configured on the Mastra instance instead of the default ConsoleLogger.

    1.31.0release notes

  • Ended turns are discarded so the next step starts a fresh one, and finalization persists remaining messages instead of failing the agentic loop.

    1.31.0release notes

  • Observer and Reflector temperature defaults are applied only to models known to support temperature; explicit modelSettings.temperature values remain preserved.

    1.31.0release notes

  • Reflected observation ranges are no longer saved in reverse order, and every source range used by a reflected section is preserved.

    1.31.0release notes

  • Observational Memory no longer replaces manually renamed thread titles; explicitly regenerating a title or writing a title with pin false enables automatic title updates.

    1.31.0release notes

  • Idle observation buffers safe completed messages even when the newest unobserved message has an incomplete tool call, avoiding overwriting incoming client tool results with older history.

    1.30.0release notes

  • Errors no longer hide provider diagnostics returned in a string detail field, including Codex rejection messages.

    1.30.0release notes

  • Traces preserve caller thread identity without assigning a session ID for other observability integrations.

    1.30.0release notes

  • Failure events preserve provider error messages, HTTP status codes, and nested causes instead of showing only generic errors.

    1.29.0release notes

  • Fixed a memory tool reliability issue.

    1.28.3release notes

  • Temporary connection errors during observation indexing now recover without duplicating stored observations.

    1.28.3release notes

  • Transient database connection timeouts are retried instead of failing the buffer operation.

    1.28.3release notes

  • Observer and reflector passes no longer report an output-step-processor entity type, avoiding their runtimes being counted as processor overhead in mastra_processor_duration_ms.

    1.28.3release notes

  • Observational memory prompts no longer appear in stored conversation history.

    1.28.2release notes

  • Tool schemas are more compatible with providers that validate tool definitions server-side.

    1.28.2release notes

  • Experimental memory processing has improved reliability and capacity.

    1.28.1release notes

  • The curator tool now accepts name and kind as optional properties, fixing curation failures with Gemini models.

    1.28.1release notes