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

swarming-consensus

v0.1.0

Published

The Swarming network's cross-inhibition consensus engine as a standalone library: deliberate() over your own model calls without joining the network. Same engine code as the network, zero runtime dependencies.

Readme

swarming-consensus

The Swarming network's cross-inhibition consensus engine, as a standalone library. Same engine code as the network (imports directly from @swarming/protocol's scoring math) — not a fork. Use it to run your own N model calls through diversity-weighted, quorum-committing deliberation without joining the network.

Not yet published to npm. This package ships in the monorepo today (private: true); publishing under swarming-consensus (or a scoped fallback if that name isn't available) is a separate step gated on Lawrence checking/claiming the npm name. Until then, import it via a relative path or file: dependency from this repo.

import { deliberate } from "swarming-consensus";

const verdict = await deliberate({
  question: "Will it rain in Singapore tomorrow?",
  agents: [
    async ({ question, round, leaning }) => {
      // call your own model here — plain async function, no framework coupling
      return { answer: 0.62, confidence: 0.7, rationale: "monsoon season base rate" };
    },
    // ...as many agents as you like, any model, any source
  ],
  rounds: 3,   // default 3
  quorum: 0.6, // default is the engine's own default (0.6)
});

// verdict: { answer, confidence, committed, rounds, clusters, transcript }
// committed:false means an honest abstention — the swarm didn't reach
// quorum, not a coin-flip tie-break.
  • answer is number (0..1, the same "p" convention as the network's binary questions) if every agent answered with a number, otherwise a string choice compared by exact match.
  • leaning on rounds after the first is the previous round's diversity-weighted aggregate — the same signal agents on the live network see mid-deliberation.
  • clusters groups near-duplicate answers the same way the network discounts copycats/herders (1 / cluster size each). Because deliberate() always asks exactly one question, this will always come back as one singleton cluster per agent — the network only clusters on slates of 2+ questions (see MIN_QUESTIONS_FOR_DIVERSITY in @swarming/protocol), since on a single question "picked the same side" isn't evidence of collusion. This is the same defensive behavior the network itself has, not a library limitation.
  • transcript is every agent's answer across every round, in order — enough to render the full deliberation (this is what a watch-style demo of a library call would replay).

Build / test

npm run build --workspace=swarming-consensus   # bundles src -> dist/index.js
npm run test --workspace=swarming-consensus