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

agent-spend-guard

v0.1.0-alpha.1

Published

Token budgets and a kill-switch for AI coding agents — reads Claude Code/Cursor usage, prices it, and enforces daily/monthly/per-project USD limits. Read-only, zero dependencies.

Readme

agent-spend-guard

Token budgets + a kill-switch for AI coding agents. Know what you're burning; stop it before the invoice does.

npx agent-spend-guard            # spend vs budgets, right now
npx agent-spend-guard init      # drop a .spend-guard.json to set limits
npx agent-spend-guard check     # exit 1 when over budget — wire into hooks/CI

Read-only. Zero dependencies. Nothing leaves your machine.


Why

2026 is the year the token bill came due: teams blowing entire annual AI budgets by April, "3x over budget" panic, licenses getting revoked. Dashboards tell you what you spent after the fact — nothing indie-sized actually enforces a limit. This does:

  • Meter: parses real usage — Claude Code transcripts (~/.claude/projects) and generic JSON event files from any agent/proxy — and prices it with a built-in (overridable) price table.
  • Budget: daily / monthly / per-project USD ceilings in .spend-guard.json, with a warn threshold (default 80%).
  • Kill-switch: check exits 1 the moment a ceiling is crossed, so a hook or CI gate can stop the agent instead of emailing you next month.

Wiring the kill-switch

Claude Code — stop tool calls when over budget (.claude/settings.json):

{
  "hooks": {
    "PreToolUse": [
      { "matcher": "Bash",
        "hooks": [{ "type": "command", "command": "npx agent-spend-guard check --cwd ." }] }
    ]
  }
}

CI — fail the pipeline before it gets expensive:

npx agent-spend-guard check --strict   # exit 1 on warn too

Config

.spend-guard.json in your project (create with init):

{
  "budgets": {
    "dailyUsd": 25,
    "monthlyUsd": 300,
    "perProjectUsd": { "my-app": 100 },
    "warnAtPct": 0.8
  },
  "prices": {
    "claude-sonnet": { "input": 3, "output": 15 }
  }
}

Prices are USD per million tokens, matched by longest model-id prefix; built-ins cover Claude / GPT / Gemini families with a conservative fallback. They aim to be budget-accurate, not invoice-accurate — override freely.

Commands & options

| | | |---|---| | status (default) | spend summary + budget lines | | check | same, but exit 1 on STOP (with --strict, on WARN too) | | init | write a sample .spend-guard.json | | --usage <file> | add a .jsonl transcript or JSON event array (repeatable) | | --no-user | skip ~/.claude/projects scan (hermetic/CI) | | --json | machine-readable report | | --verbose | per-project breakdown |

Sibling tools (AI dev hygiene suite)

ai-instruct-sync · ai-setup-doctor · mcp-config-sync · agent-skill-scan

Honest limits

Estimates use list prices and parsed transcripts — subscription plans, provider discounts, and non-transcript usage aren't visible to it. The kill-switch stops what's wired through it (hooks/CI); it cannot reach into a provider account.

License

MIT