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

@dakera-ai/ai-sdk

v0.1.2

Published

Vercel AI SDK integration for Dakera AI memory — persistent, decay-weighted cross-session memory via language model middleware and tools

Readme

@dakera-ai/ai-sdk

Vercel AI SDK integration for Dakera — a self-hosted memory server that adds persistent, decay-weighted vector recall across sessions. Memories are importance-scored and decay over time, so stale context stops competing with fresh, relevant facts.

It plugs into the AI SDK's two standard extension points — language model middleware and tools — so you can add cross-session memory to any AI SDK app without changing your model or provider code.

Install

npm install @dakera-ai/ai-sdk ai @dakera-ai/dakera zod

Run a Dakera server first (self-hosted, no external dependencies): see dakera-ai/dakera-deploy for the Docker Compose setup (server + MinIO). Point the integration at it with DAKERA_URL (default http://localhost:3000) and DAKERA_API_KEY.

Pattern 1 — Memory middleware (transparent)

createDakeraMemoryMiddleware wraps a model so that relevant memories are recalled and injected as system context before every call, and the new exchange is stored afterwards. No changes to your generation code.

import { generateText, wrapLanguageModel } from "ai";
import { openai } from "@ai-sdk/openai";
import { createDakeraMemoryMiddleware } from "@dakera-ai/ai-sdk";

const model = wrapLanguageModel({
  model: openai("gpt-4o"),
  middleware: createDakeraMemoryMiddleware({
    apiUrl: "http://localhost:3000",
    apiKey: process.env.DAKERA_API_KEY,
    agentId: "user-1234",
  }),
});

// First session
await generateText({ model, prompt: "I'm building a Rust vector database." });

// A later session — the model recalls the earlier context automatically
const { text } = await generateText({ model, prompt: "What am I working on?" });
// → "You're building a Rust vector database."

Under the hood the middleware uses transformParams to prepend recalled memories as a system message, and wrapGenerate to persist the exchange. Storage is best-effort: a memory-server error never breaks generation.

Options

| Option | Default | Description | | --- | --- | --- | | agentId | — | Identifier that scopes stored/recalled memories (required) | | apiUrl | $DAKERA_URL / http://localhost:3000 | Dakera server URL | | apiKey | $DAKERA_API_KEY | Dakera API key (dk-...) | | client | — | A pre-built DakeraClient (overrides apiUrl/apiKey) | | recallK | 5 | Memories to recall per call | | minImportance | 0 | Minimum importance to recall | | importance | 0.7 | Importance assigned to stored memories | | store | true | Store the exchange after generation |

Pattern 2 — Memory tools (model-driven)

createDakeraTools gives the model explicit recallMemory and storeMemory tools, so it decides when to look something up or remember it.

import { generateText } from "ai";
import { openai } from "@ai-sdk/openai";
import { createDakeraTools } from "@dakera-ai/ai-sdk";

const tools = createDakeraTools({ agentId: "user-1234" });

const { text } = await generateText({
  model: openai("gpt-4o"),
  tools,
  maxSteps: 4,
  prompt: "Remember that I prefer metric units, then convert 5 miles to km.",
});

The two patterns compose — use the middleware for automatic continuity and the tools when you want the model to manage memory deliberately.

License

MIT © Dakera