Fetching from the wire…
Public story · 2026-09-12 · high
New hooks let apps redact messages before they reach the model or get saved, without forking Mastra's memory package.
Why now: The 1.66.0 release notes, current as of September 12, mark the first version with hooks that intercept memory before it's written.
Mastra released version 1.66.0 of its memory package with hooks that redact messages before they reach the model or get saved. Anyone running agents with PII in memory has been asking for this, since the only fix before now was forking the library.
The new beforeObservation and beforeReflection hooks run before a message reaches the model or gets written to storage. AfterObservation and afterReflection run after, for reshaping what's already been recorded.
That ordering matters. Filtering sensitive data out of memory once it's already stored doesn't undo the exposure. A hook that runs before persistence stops the data from being written in the first place.
The same release adds idempotent batch deletion methods, deleteFeedback() and deleteScores(), with optional scoping by organization or resource, working across ClickHouse, DuckDB, and Postgres. Trace queries also gained same-span predicates on model, provider, duration, outcome, identity, and lineage, per the release notes.
Together, the hooks and the batch deletion cover what a compliance request needs: stop new sensitive data from arriving, and remove what's already there. A retry on a failed delete call shouldn't throw or double-count. Teams usually find that out the hard way, after a partial failure already happened.
The release notes don't say whether the hooks apply to messages already stored before the upgrade. Teams with existing PII exposure still need the batch delete path to clean up what's already there.
Each link below shares sources, entities, or timing with this story.
Bounded time ranges, recursive trace/span/score predicates, thread grouping and deterministic cursor pagination, validated and rejected before any storage adapter runs, with implementations in ClickHouse, DuckDB and Postgres. Tenant-scoped trace deletion handles up to 1,000 tr...
One HTTP/SSE API that controls Claude Code, Codex, OpenCode, and Amp inside sandboxes. Solves the fragmentation problem: write one integration, swap agents with a config change. Session persistence to Postgres/ClickHouse. Apache 2.0. (GitHub)
Also: stored agents from the Agents API can run with durable: true with no redeploy, @mastra/rag gained serialize()/GraphRAG.deserialize() so knowledge graphs survive restarts, and sandboxes advertise supportsCheckpoints with filesystem-backed snapshots. (GitHub) A day earlier...
Core 1.55.0 lets Code Mode transports declare requiresSandbox: false, with the new @mastra/isolated-vm package supplying an in-process V8 isolate: no filesystem, network, or process access, reachable only through bridged external_* tools. The quieter fix matters more: the gene...
Mastra (26.6k stars) announced a system where specialized agents triage issues, write and validate code, cut releases, update docs and monitor production, connected to GitHub, Linear and Slack. Install is npm create factory. Adopt it or don't, but the design point transfers: e...
Released September 4. @mastra/evals/vitest exposes runEvals as Vitest tests with expectEvals/expectEval and a per-test score reporter, so agent quality checks run in the same pipeline as unit tests. It also adds reusable sandbox template APIs so a workspace-backed coding agent...
MindPattern daily
One email a day at 7 AM. Sources and a take on every story. Unsubscribe anytime.