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

peffle

v0.1.7

Published

Stop an AI agent before it spends your money — local kill switch, spend caps, and approval gates for tool calls

Readme

Peffle

Stop an AI agent before it spends your money.

A local kill switch, spend cap, and human-approval gate for tool calls. No SaaS. No telemetry. One npm install.

Peffle runs inside your agent process. There is no external service required for enforcement.

Demo

Open the demo video · Poster frame

npm license

Repository: github.com/Sai-Vidyut/Peffle · Requires Node.js 18+ (uses a native SQLite binding via better-sqlite3).

Prompt instructions are not enforcement. If an agent can call a tool, the tool call needs a real execution-time boundary.

Try it (from npm)

npm install peffle

Save as spend-cap.mjs and run with node spend-cap.mjs:

import { BudgetExceededError, createPeffle } from "peffle";

const peffle = createPeffle({
  storagePath: ":memory:",
  policy: {
    version: 1,
    defaults: { onNoMatchingRule: "deny" },
    budgets: [{ id: "daily", scope: "global", window: "daily", limit: 10 }],
    actions: [{ id: "spend", match: { action: "charge_card" }, effect: "allow" }],
  },
});

async function charge(dollars) {
  await peffle.guard(
    { agent: { agentId: "shopper" }, action: "charge_card", amount: dollars },
    () => console.log(`CHARGED $${dollars}`)
  );
}

async function main() {
  await charge(8);
  try {
    await charge(5);
  } catch (e) {
    if (e instanceof BudgetExceededError) console.log("BLOCKED", e.message);
  } finally {
    peffle.close();
  }
}

main();

Expected output:

CHARGED $8
BLOCKED Budget exceeded: spent 13 would exceed limit 10

From a git clone (examples and docs live in the repo, not in the npm tarball):

git clone https://github.com/Sai-Vidyut/Peffle.git && cd Peffle
npm install && npm run example

Enforcement rule

Every side effect (spend, send, write, call a paid API) must run inside peffle.guard(request, () => …).

checkPolicy() is a preview only — it does not reserve budget, enforce the kill switch at execution time, or authorize work.

Wrap a tool call

await peffle.guard(
  { agent: { agentId: "my-agent" }, action: "send_email", amount: 1 },
  () => sendEmail()
);

peffle.kill("my-agent"); // block subsequent guarded calls

MCP

Peffle can wrap MCP tool handlers with the same enforcement as guard(). It does not authenticate MCP clients or replace server OAuth.

import { createPeffle } from "peffle";
import { guardTool } from "peffle/mcp";

const peffle = createPeffle({ policyPath: "./peffle.policy.json" });

const sendEmail = guardTool(
  async (args: { to: string }) => ({ ok: true, to: args.to }),
  "send_email",
  { peffle, agentId: "server-agent" }
);

Approval handles are process-local. Peffle guards MCP tool handlers; it does not authenticate MCP clients. Details: docs/mcp-integration.md.

CLI

npx peffle init
npx peffle pending
npx peffle approve <eventId>
npx peffle deny <eventId>
npx peffle kill <agentId>
npx peffle ledger --json

Run npx peffle --help for revoke, revive, status, and storage/policy flags.

When policy says require_approval, guard() throws ApprovalRequiredError with a one-time { eventId, token }. Approve via CLI (or peffle.approve(eventId)), then retry guard() with { approval: { eventId, token } }. The token is never stored in the ledger.

The operator approves the event with npx peffle approve <eventId>, then the agent retries the same request with the redemption token.

Examples (repository)

Policy schema: docs/policy-schema.md.

What this is NOT

  • Not a hosted service (v0.1 is local SQLite)
  • Not OAuth / MCP auth / cryptographic identity
  • Not a payments rail or enterprise IAM
  • No telemetry or network calls in the core library

Trust boundaries: agentId and principal are asserted by your app (not cryptographically verified). Any code path that skips guard() bypasses Peffle. MCP approval handles are process-local and do not survive a server restart.

License

Apache-2.0

If this is useful, star the repo or open an issue: “does this work with X?” That’s how we decide what to build next.