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

@unisonlabs/ai-sdk

v0.1.1

Published

Long-term memory for the Vercel AI SDK, powered by the Unison brain

Readme

@unisonlabs/ai-sdk

Long-term memory for the Vercel AI SDK, powered by the Unison brain.

CI npm License: MIT Stars

InstallQuick startOptionsLow-level clientFor agents


🤖 Reading this as an AI agent? See AGENTS.md — install, auth, and wrapLanguageModel usage in one page.

Before each model call, the middleware recalls relevant memories from your Unison brain and injects them into the system prompt. After the call, the user/assistant turn is persisted back so future calls can reference it — giving any LLM durable, cross-session memory with zero boilerplate.

Install

npm i @unisonlabs/ai-sdk ai

Quick start

import { openai } from '@ai-sdk/openai';
import { generateText, wrapLanguageModel } from 'ai';
import { unisonMemory } from '@unisonlabs/ai-sdk';

const model = wrapLanguageModel({
  model: openai('gpt-4o'),
  middleware: unisonMemory({ sessionId: 'user-123' }),
});

const { text } = await generateText({
  model,
  prompt: 'What projects am I currently working on?',
});

console.log(text);

The middleware automatically:

  1. Calls GET /v1/brain/context with the user's latest message before generating.
  2. Prepends the recalled contextMd to the system prompt (skipped when weakEvidence is true).
  3. POSTs the user + assistant turn to POST /v1/brain/ingest after generating (fire-and-forget).

Options

| Option | Type | Default | Description | |---|---|---|---| | sessionId | string | — | Required. Used as sourceRef for ingested conversations. | | token | string | UNISON_TOKEN env var | Your Unison API token (usk_live_...). | | apiUrl | string | UNISON_API_URL or https://brain.unisonlabs.ai | Unison brain base URL. | | k | number | 5 | Number of memory hits to retrieve. | | recall | boolean | true | Set to false to skip the recall step. | | persist | boolean | true | Set to false to skip the persist step. |

Environment variables

| Variable | Description | |---|---| | UNISON_TOKEN | Unison API token. Overridden by options.token. | | UNISON_API_URL | Unison brain base URL. Overridden by options.apiUrl. |

Low-level client

import { recall, ingestConversation } from '@unisonlabs/ai-sdk';

const result = await recall({
  apiUrl: 'https://brain.unisonlabs.ai',
  token: process.env.UNISON_TOKEN!,
  q: 'What are my ongoing projects?',
  k: 5,
});

if (!result.weakEvidence) {
  console.log(result.contextMd);
}

await ingestConversation({
  apiUrl: 'https://brain.unisonlabs.ai',
  token: process.env.UNISON_TOKEN!,
  sessionId: 'user-123',
  turns: [
    { role: 'user', content: 'Hello' },
    { role: 'assistant', content: 'Hi! How can I help?' },
  ],
});

Agents

See AGENTS.md for the full agent onboarding guide: install, auth, wrapLanguageModel usage, env vars, and contributor commands.

Releasing

Run npm login once to authenticate, then:

bun run release

That's it. The script builds the package, publishes @unisonlabs/ai-sdk to npm (idempotent — skips if the version is already published), and tags + pushes the release commit. Bump the version in package.json before running.

Links

License

MIT — see LICENSE.


Part of the Unison Labs constellation

One brain, every agent. Every repo below reads from and writes to the same Unison brain — no per-tool memory silos.

| Repo | What it does | |---|---| | unison-brain | CLI · SDK · MCP server — the core | | claude-unison | Memory for Claude Code | | cursor-unison | Memory for Cursor | | codex-unison | Memory for OpenAI Codex CLI | | opencode-unison | Memory for OpenCode | | openclaw-unison | Memory for OpenClaw | | pipecat-unison | Memory for Pipecat voice agents | | langchain-unison | LangChain memory, history & retriever | | llama-index-memory-unison | LlamaIndex memory provider | | unison-ai-sdk | Vercel AI SDK memory middleware ← you are here | | unison-mastra | Mastra agent memory provider | | python-sdk | Python SDK for the brain | | install-mcp | One-command MCP installer | | unison-fs | Mount the brain as a filesystem | | backchannel | Async messaging between agents | | Unison-evals | Open memory benchmark suite |