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

@brainstem/reflexes

v0.3.0

Published

> Current seven-reflex APIs, confidence semantics, lifecycle boundaries and defaults are documented in the [integration guide](../../docs/integration/plugin.md). Examples below describe the original minimal integration.

Readme

Current seven-reflex APIs, confidence semantics, lifecycle boundaries and defaults are documented in the integration guide. Examples below describe the original minimal integration.

@brainstem/reflexes

A standalone library of bounded judgment reflexes for coding agents: gate risky tool calls, observe tool results for injected instructions and whether they achieved what was asked, and focus large output down to what's relevant. Bring your own judge model — this package has no hard dependency on any one provider.

Install

npm install @brainstem/reflexes

Usage

import { createReflexes, jevJudge } from "@brainstem/reflexes";

const reflexes = createReflexes({
  judge: jevJudge({ apiKey: process.env.TYPESAFE_API_KEY }),
});

// Gate — should this tool call run automatically?
const gate = await reflexes.gate({
  tool: "bash",
  command: "rm -rf build/",
  task: "clean the build directory before rebuilding",
});
if (gate.action === "deny") throw new Error(gate.reasons.join("; "));
if (gate.action === "ask") {
  /* surface gate.reasons to a human before running the command */
}

// Observe — sanitize + verify a tool result after it runs
const observed = await reflexes.observe({
  task: "clean the build directory before rebuilding",
  source: "tool:bash",
  actionSummary: "rm -rf build/",
  status: "ok",
  truncated: false,
  content: toolOutputText,
});
if (observed.sanitize.action === "block") {
  /* toolOutputText looks like it contains injected instructions */
}

// Focus — cut a large tool result down to what's relevant to the task
const focused = await reflexes.focus({
  task: "find where the rate limiter is configured",
  command: "grep -r rateLimit src/",
  outcome: "ok",
  recentFindings: [],
  content: toolOutputText,
});
console.log(focused.text); // only the sections judged relevant

Bring your own judge

jevJudge uses Jev, a small judge model purpose-built for this kind of bounded decision. If you'd rather use a different model, implement SystemOne yourself, or use genericJudge as a reference implementation against any text-completion function:

import { createReflexes, genericJudge } from "@brainstem/reflexes";

const reflexes = createReflexes({
  judge: genericJudge({
    complete: async (prompt) => {
      const response = await myModelClient.complete(prompt);
      return response.text;
    },
  }),
});

genericJudge synthesizes a fixed confidence: 1 for every answer — it does not have Jev's calibrated confidence. Reflexes that lean on confidence (like Gate's auto/ask/deny thresholds) will behave more conservatively with it.

Policy

Defaults come from policyForTrust(0.3) (from @brainstem/core) — a moderate-trust starting point. Override any top-level section:

createReflexes({
  judge,
  policy: { gate: { autoConfidence: 0.99 } },
});

Policy overrides are shallow-merged — overriding one field of a sub-object requires passing the whole sub-object.

Journaling

By default, createReflexes keeps no record of decisions. Pass journalPath to durably append every decision as NDJSON (via @brainstem/core's journal format), or onDecision for an in-process callback:

createReflexes({
  judge,
  journalPath: "./brainstem-journal.ndjson",
  onDecision: (event) => console.log(`[${event.reflex}] ${event.action}`),
});

What this package does not do

  • No approval UI or lifecycle — Gate's ask outcome is yours to handle.
  • No artifact store — focus's omitted content is not recoverable unless you keep the original yourself.
  • No retries, rate limiting, or circuit breaking beyond what your SystemOne implementation does.

License

MIT — see the repo root LICENSE.