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

@forwardimpact/libwatchdog

v0.1.0

Published

Guardrail engine for agent teams — count repository activity over a window, compare it against thresholds, and engage an operator latch when the activity breaches them.

Downloads

333

Readme

libwatchdog

Guardrail engine for agent teams — count repository activity over a window, compare it against thresholds, and engage an operator latch when the activity breaches them.

A guardrail engine. It counts activity signals over a window, compares each count against a threshold, and engages an operator latch when any count breaches. Doubt stops the line: a signal the engine cannot read, and a response that cannot cover the window, both breach.

The library names no tenant. The latch variable's name, the threshold, and the window all arrive as arguments.

Seams

| Seam | Contract | | ---- | -------- | | Rule | { id, threshold, probe }. createRule builds one. activityRules builds the four repository-activity rules. | | Probe | async ({ request, repo, defaultBranch, cutoff }) => { count, covered }. It throws when it cannot read. | | Latch | { read, write }. createActionsVariableLatch reads both variable scopes and writes the repository scope. | | Policy | decide(state, { windowMs, now }) => "engage" \| "skip". It yields to a stop already in place and to a human who cleared the latch inside the window. |

The next guardrail adds a rule set and a probe. It adds no second script.

Compose

import {
  activityRules,
  createActionsVariableLatch,
  createRequest,
  decide,
  encodeReason,
  evaluate,
} from "@forwardimpact/libwatchdog";
import { isoTimestamp } from "@forwardimpact/libutil";

const request = createRequest({ token, clock });
const windowMs = 2 * 3600000;

const verdict = await evaluate(activityRules(32), {
  request,
  repo: "owner/repo",
  defaultBranch: "main",
  clock,
  windowMs,
});

if (verdict.engage) {
  const latch = createActionsVariableLatch({
    request,
    repo: "owner/repo",
    name: "MY_KILLSWITCH",
  });
  const state = await latch.read();
  if (decide(state, { windowMs, now: clock.now() }) === "engage") {
    await latch.write(
      encodeReason({
        name: "watchdog",
        breaches: verdict.breaches,
        // The reason records the run, not the moment the window opened.
        at: isoTimestamp(clock.now()),
      }),
    );
  }
}

Guide

Guard an Agent Team's Activity covers the counters, the threshold and the window, the latch contract, the clearing rule, the CI wiring, and the exit codes.