
Security News
Deno Goes the Way of the Dinosaur
Cloudflare is acquiring Deno’s team, which will provide another year of bug fixes and security updates before ending support for the runtime.
@zensation/ai-sdk
Advanced tools
Vercel AI SDK memory middleware: agent memory that recalls before a model call and stores the turn after it. Zero runtime dependencies.
Status: early release. The option shape may still change before 1.0. The memory layers underneath are the ones the ZenBrain paper describes and the benchmarks measure.
ZenBrain as Vercel AI SDK middleware. Recall what is relevant before the model call, store the turn after it. Works with any provider the AI SDK supports, because it never touches the provider.
npm install @zensation/ai-sdk @zensation/core @zensation/adapter-sqlite ai @ai-sdk/openai
This package is ESM. require() loads it on Node 22.12 and later; on Node 22.0–22.11, use import.
import { generateText, wrapLanguageModel } from 'ai';
import { openai } from '@ai-sdk/openai';
import { MemoryCoordinator } from '@zensation/core';
import { SqliteAdapter } from '@zensation/adapter-sqlite';
import { zenbrainMemory } from '@zensation/ai-sdk';
const coordinator = new MemoryCoordinator({
storage: new SqliteAdapter({ filename: './memory.db' }),
});
const model = wrapLanguageModel({
model: openai('gpt-5'),
middleware: zenbrainMemory({ coordinator }),
});
await generateText({ model, prompt: 'Anna moved to Hamburg in March.' });
// A later call, possibly days later, in a different process:
const { text } = await generateText({ model, prompt: 'Where does Anna live?' });
Between the two calls nothing was passed by hand. The second prompt arrives at the model with a system message in front of it:
Relevant memories from earlier sessions:
- Anna moved to Hamburg in March.
The middleware is a plain object; wrapLanguageModel is called by you. Nothing here is
imported from ai at runtime — only its types are. So this package has no runtime
dependencies; its peers ai, @ai-sdk/provider and @zensation/core are the packages your
application already uses (npm 7 and later installs a peer that is missing):
| Package | Runtime dependencies |
|---|---|
@zensation/ai-sdk | 0 |
@zensation/core | 1 (@zensation/algorithms) |
@zensation/algorithms | 0 |
That table is checked in CI on every push against the packed tarballs rather than the source tree.
zenbrainMemory({
coordinator, // required — you own its lifecycle
recall: { // or false to switch searching off
limit: 5, // how many memories to inject
layers: ['semantic', 'core'], // which layers to search
minConfidence: 0.6, // drop anything below this
},
store: { // or false to switch writing off
user: true, // store the user's message (default)
assistant: false, // store the reply too (default off)
context: 'work', // context domain; kept with episodes only
},
header: 'Relevant memories from earlier sessions:',
role: 'system', // or 'user': see "Three defaults worth knowing"
onError: (err, phase) => console.warn(`[zenbrain] ${phase} failed`, err),
});
Memories arrive as a system message. That is the strongest place in the prompt, and it
is also why it needs a decision: whatever a user once said comes back with system authority
when it is recalled. If text you do not trust can reach memory, pass role: 'user'. The
memories then travel as a user message directly before the latest user turn, as context
rather than instruction. store.shouldStore keeps such turns out of memory in the first place.
Replies are not stored by default. A model's answer is derived from the question and
cheap to regenerate; storing both sides doubles the volume and fills semantic memory with
your own model's phrasing. Turn it on with store: { assistant: true } when the answer
carries information the question does not.
Failures are swallowed. If recall or store throws, the call goes through anyway,
unmodified. A memory layer that breaks a chat is worse than one that forgets. Pass
onError to see what is being hidden — without it, failures are silent by design.
Routing on store is automatic, first match wins: wording such as "How to", "Steps:" or "workflow:" makes a procedure, an emotional weight above 0.5 (detected from the text) an episode, anything else a semantic fact. A plain narrated event with little emotion is a fact, and a numbered list without such wording is too. Which layer a memory lands in decides how it is searched; when you consolidate, episodes with an emotional weight above 0.5, among the 100 most recent, become facts. The seven layers and the algorithms behind them are documented in the main README.
Consolidation does not run on its own. Call coordinator.consolidate() on a schedule that
suits your application.
EmbeddingProvider, which is also the
configuration the published benchmarks were measured with.streamText works the same way and passes the stream through untouched:
const result = streamText({
model: wrapLanguageModel({
model: openai('gpt-5'),
middleware: zenbrainMemory({ coordinator, store: { assistant: true } }),
}),
prompt: 'Which theme should I use?',
});
for await (const chunk of result.textStream) process.stdout.write(chunk);
ZenBrain is a seven-layer, neuroscience-derived memory architecture for LLM agents, built in
TypeScript and published under Apache-2.0; @zensation/algorithms and @zensation/core have no third-party
dependencies. The benchmark results, and the
configuration they were measured in, are reported in the paper; the reproduction packages
are on Zenodo.
Works out of the box without an embedding provider — lexical ranking, nothing extra
to install. The paper's measurements used nomic-embed-text as the embedding provider.
@zensation/algorithms · @zensation/core · @zensation/adapter-postgres · @zensation/adapter-sqlite · @zensation/mcp · @zensation/ai-sdkLicense: Apache-2.0
FAQs
Vercel AI SDK memory middleware: agent memory that recalls before a model call and stores the turn after it. Zero runtime dependencies.
The npm package @zensation/ai-sdk receives a total of 0 weekly downloads. As such, @zensation/ai-sdk popularity was classified as not popular.
We found that @zensation/ai-sdk demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.

Security News
Cloudflare is acquiring Deno’s team, which will provide another year of bug fixes and security updates before ending support for the runtime.

Security News
Anthropic’s free OSS Scanner uses Mythos and other Claude models to find open source vulnerabilities and send maintainers reports with proposed fixes.

Security News
On Front Lines’ Early Adopters: CISO podcast, Andrew Becherer shares lessons from Datadog, weighs the long-term costs of AI-built tools, and explains how founders can actually gain a CISO’s trust.