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

@timothywalton/aegis-node

v0.1.0

Published

Hardware-agnostic kill switch for autonomous AI agents. Monitors token burn rate, API call rate, and action-loop patterns on an isolated thread; instantly kills the agent process and severs its network access when limits are breached. Zero dependencies.

Readme

Aegis-Node

The autonomous agent blast shield. Hardware-agnostic, zero-dependency kill switch for AI agents.

architecture

npm License


Why this exists

Everyone is shipping agents that read files, execute code, call APIs, and spend money. Almost nobody is shipping the thing that stops them when they hallucinate into a billing-draining loop, a runaway tool-call storm, or an infinite retry spiral.

Aegis-Node is that thing. It runs your agent as a child process, watches it from a separate, isolated thread, and the moment it crosses a hard limit — token burn rate, API call rate, or repeated-action loop — it instantly kills the process tree and severs its network access. No graceful shutdown negotiation. No "let me finish this one thing." Dead.

  • Zero dependencies — pure Node builtins (worker_threads, child_process)
  • Isolated watcher thread — a hung or blocked agent main thread can't prevent a trip
  • Three trip conditions out of the box: token burn rate, API call rate, repeated-action loop detection
  • Instant kill — SIGKILL of the full process group, plus best-effort iptables network sever on Linux
  • Drop-in CLI — wrap any agent command, no code changes required to get baseline protection

Install & run (under 60 seconds)

npx aegis-node --max-tokens-per-min 200000 --max-api-calls-per-min 120 -- python my_agent.py

That's it. Your agent runs exactly as before, but if it blows past 200k tokens/min or 120 API calls/min, Aegis kills it immediately.

For loop detection and token tracking, your agent reports metrics via the programmatic API:

const { AegisNode } = require("aegis-node");

const aegis = new AegisNode({
  command: "python",
  args: ["my_agent.py"],
  limits: {
    maxTokensPerMinute: 200_000,
    maxApiCallsPerMinute: 120,
    maxRepeatedActions: 5,        // same action signature 6+ times in window = loop
    repeatedActionWindowMs: 60_000,
  },
  onTrip: (reason, detail) => {
    console.error("AEGIS TRIPPED:", reason, detail);
    // alert Discord, page on-call, whatever you need
  },
});

aegis.start();

// from your agent's instrumentation / IPC bridge:
aegis.reportTokens(1500);
aegis.reportApiCall("openai.chat.completions");
aegis.reportAction("tool:bash:rm -rf /tmp/x");

How it works

┌─────────────────────────────────────────────┐
│ Main thread (your process)                   │
│  ┌─────────────┐        ┌──────────────────┐│
│  │ AegisNode    │ spawn  │  Agent process    ││
│  │ (controller) ├───────►│  (your AI agent)  ││
│  └──────┬───────┘        └──────────────────┘│
│         │ postMessage           ▲             │
│         ▼                       │ SIGKILL     │
│  ┌──────────────────────┐       │             │
│  │ Watcher (worker_thread)│──────┘             │
│  │ - rolling 60s windows │  + iptables DROP    │
│  │ - trip detection      │    (Linux, best-eff)│
│  └───────────────────────┘                     │
└─────────────────────────────────────────────┘

The watcher runs on its own thread so it keeps evaluating limits even if your main process is busy or blocked. On trip: SIGKILL the entire process group (not just the immediate PID — covers forked subprocesses too), then terminate the watcher.

Trip conditions

| Condition | Trigger | Detail payload | |---|---|---| | TOKEN_BURN_RATE_EXCEEDED | Sum of reportTokens() in trailing 60s > maxTokensPerMinute | { tokensPerMinute, limit } | | API_CALL_RATE_EXCEEDED | Count of reportApiCall() in trailing 60s > maxApiCallsPerMinute | { callsPerMinute, limit } | | REPETITIVE_LOOP_DETECTED | Any action signature repeats > maxRepeatedActions times within repeatedActionWindowMs | { signature, count, limit, windowMs } | | MONITOR_THREAD_ERROR | Watcher thread itself crashed | { message } |

Network namespace isolation (optional, Linux)

For defense-in-depth beyond process kill, pass networkNamespace: true (requires unshare + CAP_NET_ADMIN). The agent runs in its own network namespace from the start — on trip, killing the process tears down the namespace and every socket in it, with no iptables race window.

Roadmap

  • [ ] Unix-socket reporting protocol so non-Node agents (Python, Go, Rust) can report metrics without an SDK
  • [ ] Pluggable trip handlers (Discord webhook, PagerDuty)
  • [ ] Per-tool rate limits (not just global API call rate)
  • [ ] Windows job-object based hard isolation (currently falls back to taskkill)

Pairs with agent-top

agent-top is the live dashboard — "htop for AI agents" — showing token burn rate, $ cost, API call rate, and loop warnings in your terminal. Aegis-Node is the enforcement layer; agent-top is how you watch it work.

npm install aegis-node agent-top

More from ScriptMasterLabs

Building agent-native financial infrastructure: x402 payment rails (proof402-middleware), autonomous trading pipelines with the same circuit-breaker philosophy in production, Pine Script v6 indicator suites, and the NEXUS-402 agent marketplace.

scriptmasterlabs.com/stack · Full architecture map

License

MIT