npm / @mastra/memory
@mastra/memory
What changed in @mastra/memory 1, from its official release notes, upgrade guides and advisories. Sources checked 2026-10-19.
2 breaking8 new APIs and options6 behavior and defaults10 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli init@mastra/memory 126 changes
Breaking changes 2
A multiplier blockAfter now scales a per-thread messageTokens override instead of the instance threshold.
Merges are rejected with HTTP 400 when the storage adapter does not support atomic merges, rather than silently replacing the record.
New APIs and options 8
Set observationalMemory.observation.observeOnContextOverflow to false to turn off automatic recovery from context overflow.
Pass force: true to observe pending messages regardless of the threshold for that call only.
getStatus() now returns observationBlockAfter and inAsyncObservationBand to expose the observation blocking threshold and async observation band.
Lets applications override the model selected by automatic model resolution for a provider.
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.
Previews the model ID that automatic model selection would pick, for uses such as settings UIs.
Turns the automatically picked model ID into a model, allowing auto resolution to use application credentials and routing.
Accepts mode: 'merge' for HTTP working-memory updates, merging partial updates rather than replacing the record.
Behavior and default changes 6
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.
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.
The token budget now limits previous observations on every observation path; zero omits them, and the default false sends the full previous observations.
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.
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.
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.
Fixes and other changes 10
Long numbers are now counted accurately, so memory and token limits trigger at the right time. Estimates saved on existing messages are recalculated.
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.
Observer, reflector and fallback model lists no longer cause type checking complexity to grow with the number of model IDs.
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.
Observations are kept in event order so outdated state is not recorded as newer than later user instructions.
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.
Semantic recall no longer misses a turn's new user message when background buffering picks it up on the first step.
An empty working-memory result no longer replaces stored working memory; Mastra retries extraction while preserving other extracted values such as the thread title.
When an observational memory error stops a run, the user message and tool results from completed steps are saved first.
Persistence and idle buffering now use the terminal message list accepted by the processor pipeline rather than the list captured by the observation turn.