npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@wolbarg/vercel-ai

v1.0.1

Published

Official Vercel AI SDK middleware for Wolbarg shared memory — recall before generate, remember after.

Readme

@wolbarg/vercel-ai

npm version GitHub License: MIT

Official Vercel AI SDK middleware for Wolbarg shared memory.

Automatically:

  1. Recalls relevant memories before generation
  2. Injects them as a tagged system message (preserves your existing system prompt)
  3. Remembers the conversation after the step completes

Works with generateText, streamText, tool loops, and any AI SDK provider model (OpenAI, Anthropic, Gemini, …).

Requires AI SDK v7+ (LanguageModelV4 middleware).

Install

npm install wolbarg @wolbarg/vercel-ai ai

Peers: wolbarg >= 0.5.4, ai ^7.0.0. Node ≥ 22.

Quick start

import { generateText, wrapLanguageModel } from "ai";
import { openai } from "@ai-sdk/openai";
import { wolbarg, sqlite, openaiEmbedding } from "wolbarg";
import { wolbargMiddleware } from "@wolbarg/vercel-ai";

const memory = wolbarg({
  organization: "my-app",
  storage: sqlite("./memory.db"),
  embedding: openaiEmbedding({
    apiKey: process.env.OPENAI_API_KEY!,
    model: "text-embedding-3-small",
  }),
});
await memory.ready();

const model = wrapLanguageModel({
  model: openai("gpt-4.1-mini"),
  middleware: wolbargMiddleware({
    memory,
    agent: "assistant",
  }),
});

const { text } = await generateText({
  model,
  messages: [{ role: "user", content: "What do I prefer?" }],
});

Or use the convenience helper:

import { createWolbargModel } from "@wolbarg/vercel-ai";

const model = createWolbargModel({
  model: openai("gpt-4.1-mini"),
  memory,
  agent: "assistant",
});

Streaming

import { streamText } from "ai";

const result = streamText({ model, messages });

for await (const chunk of result.textStream) {
  process.stdout.write(chunk);
}

Remember starts when the model emits finish (not only on stream flush), so cancel-after-finish still persists memory. Mid-generation cancel before finish does not remember incomplete turns.

Tools / multi-step

Default remember: "final-step" skips intermediate finishReason.unified === "tool-calls" steps. Recall still runs every step.

Per-request metadata

await generateText({
  model,
  messages,
  providerOptions: {
    wolbarg: {
      sessionId: "s1",
      userId: "u1",
      tags: ["support"],
    },
  },
});

Behavior notes

| Topic | Behavior | | --- | --- | | Recall / remember failures | Soft-fail — never crash model generation (onError / onTelemetry) | | Tools / multi-step | Default remember: "final-step" skips tool-call steps | | Streaming | Remember on finish (+ flush backup); cancel-after-finish is safe | | Multimodal user messages | Text + [attachment:mediaType:filename] placeholders in recall query | | Injected memory | Tagged via providerOptions.wolbarg.injectedMemory + content marker — never re-stored | | Prompt mutation | Caller arrays are never mutated — prompts are cloned |

Docs

https://wolbarg.com/docs/integrations/vercel-ai

License

MIT