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

@memfork/vercel-ai

v0.1.1

Published

Vercel AI SDK middleware that gives every model branch-aware, on-chain memory via MemForks

Readme

@memfork/vercel-ai — Vercel AI SDK Middleware

Drop-in middleware for the Vercel AI SDK that gives any model branch-aware, on-chain memory via MemForks.

Before generating: recalls relevant facts from the current branch and injects them as system context.
After generating: commits key decisions on-chain with full provenance.

Install

npm install @memfork/vercel-ai @memfork/core ai

# First-run — provision credentials (zero copy-paste on testnet):
memfork init --quick

Usage

Option A — explicit config

import { withMemForks } from "@memfork/vercel-ai";
import { generateText } from "ai";
import { openai } from "@ai-sdk/openai";

const model = withMemForks(openai("gpt-4o"), {
  treeId:  process.env.MEMFORK_TREE_ID!,
  signer:  process.env.MEMFORK_PRIVATE_KEY!,
  memwal: {
    accountId:   process.env.MEMFORK_MEMWAL_ACCOUNT!,
    delegateKey: process.env.MEMFORK_MEMWAL_KEY!,
  },
  branch: "feature/my-feature",
});

const { text } = await generateText({
  model,
  messages: [{ role: "user", content: "What did we decide about the auth system?" }],
});
// The model sees recalled facts about the auth system from prior sessions.
// After generating, the response is committed on-chain.

Option B — auto-resolve from ~/.memfork/credentials.json

import { createMemForksModel } from "@memfork/vercel-ai";
import { openai } from "@ai-sdk/openai";

const model = await createMemForksModel(openai("gpt-4o"), {
  branch: "feature/my-feature",
});

Branch per user session

import { withMemForks } from "@memfork/vercel-ai";

const model = withMemForks(openai("gpt-4o"), {
  ...config,
  branchFromContext: ({ messages }) => {
    // Map thread/session ID to a branch name
    const threadId = extractThreadId(messages);
    return `session/${threadId}`;
  },
});

How it works

| Phase | What happens | |-------|-------------| | transformParams (before generate) | Recalls top-N facts from the branch, prepends them to the system prompt | | wrapGenerate (after generate) | Fire-and-forget memfork commit anchors the response on-chain | | wrapStream (after stream) | Same commit, triggered when the stream closes |

Recall failures are silent — they never break a generation.
Commit failures are fire-and-forget — they never delay a response.

Options

| Option | Type | Default | Description | |--------|------|---------|-------------| | branch | string | "main" | Git branch to scope memory to | | recallLimit | number | 5 | Max facts to inject. Set 0 to disable recall | | autoCommit | boolean | true | Commit after generating. Set false for read-only mode | | recallThreshold | number | 0.4 | Semantic distance cutoff (lower = stricter) | | branchFromContext | fn | — | Dynamic branch from request messages |

Works with any Vercel AI SDK function

import { generateText, streamText, generateObject } from "ai";

// All three work identically — middleware applies to both generate and stream paths.
const { text }   = await generateText({ model, messages });
const stream     = await streamText({ model, messages });
const { object } = await generateObject({ model, messages, schema });