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

@thestackai/zclean

v0.1.1

Published

Automatic zombie process cleaner for AI coding tools (Claude Code, Codex)

Downloads

248

Readme

Stop AI coding tools from eating your RAM.

npm version License: MIT Platform


Quick Demo

AI coding tools spawn child processes — MCP servers, sub-agents, headless browsers, build watchers. When the session ends or crashes, those children don't always exit. They pile up silently, draining RAM until your machine grinds to a halt.

Before

$ zclean

  zclean — scanning for zombie processes...

  Found 12 zombie processes:

    PID 26413  node         367 MB  (orphan, 18h)  was: claude mcp-server
    PID 62830  chrome       200 MB  (orphan, 3h)   was: agent-browser
    PID 26221  npm          142 MB  (orphan, 2d)   was: npm exec task-master-ai
    PID 23096  node         355 MB  (orphan, 6h)   was: claude sub-agent
    ... 8 more

  Total: 12 zombies, ~2.4 GB reclaimable

  Run `zclean --yes` to clean.

After

$ zclean --yes

  zclean — scanning for zombie processes...

  Cleaned 12 zombie processes. Reclaimed ~2.4 GB.

  zclean status:
    Protection: active
    SessionEnd hook: registered
    Hourly scheduler: running

Why zclean?

Claude Code, Codex, and other AI coding tools spawn dozens of child processes per session: MCP servers, sub-agents, headless Chromium instances, esbuild watchers, and more. When the parent session exits — especially on crash or force-quit — these children become orphans.

They keep running. They keep consuming RAM. Your machine gets slower day by day, and you blame the AI tool when the real culprit is zombie processes nobody cleaned up.

zclean fixes this automatically. Install once, forget about it.

Install

npx zclean init

That's it. This command:

  1. Detects your OS (macOS / Linux / Windows)
  2. Registers a Claude Code SessionEnd hook for instant cleanup
  3. Sets up an hourly background scan as a safety net
  4. Creates your config at ~/.zclean/config.json

How it works

Layer 1 — SessionEnd Hook When a Claude Code session ends, zclean immediately cleans up that session's orphaned children. Fast and targeted.

Layer 2 — Hourly Scheduler A lightweight background scan catches anything the hook missed: crash leftovers, Codex orphans, stale browser daemons, and processes from tools that don't support hooks.

Together, these two layers keep your system clean without you ever thinking about it.

Safety

zclean follows one rule: if the parent is alive, don't touch it.

  • Scans are dry-run by default — you see what would be cleaned before anything happens
  • Only targets known AI tool process patterns (MCP servers, agent browsers, sub-agents, build zombies)
  • Whitelist support — protect any process you want to keep
  • Skips tmux/screen sessions, PM2/Forever daemons, Docker containers, VS Code children
  • Re-verifies PID identity before every kill (prevents PID recycling accidents)
  • Logs every action with full command line for manual recovery

Your node server.js running in a terminal tab? Untouched. Your vite dev in tmux? Untouched. Only true orphans from dead AI sessions get cleaned.

Commands

| Command | Description | |---------|-------------| | zclean | Scan for zombies (dry-run, shows what would be cleaned) | | zclean --yes | Scan and clean zombie processes | | zclean init | Install SessionEnd hook + hourly scheduler | | zclean status | Show protection status and cleanup history | | zclean logs | View detailed cleanup log | | zclean config | Show current configuration | | zclean uninstall | Remove all hooks and schedulers |

Configuration

~/.zclean/config.json:

{
  "whitelist": [],
  "maxAge": "24h",
  "memoryThreshold": "500MB",
  "schedule": "hourly",
  "sigterm_timeout": 10,
  "dryRunDefault": true,
  "logRetention": "30d"
}

| Option | Default | Description | |--------|---------|-------------| | whitelist | [] | Process name patterns to never kill | | maxAge | "24h" | Kill orphan node/esbuild only after this age | | memoryThreshold | "500MB" | Flag orphans above this RAM usage regardless of age | | sigterm_timeout | 10 | Seconds to wait after SIGTERM before SIGKILL | | dryRunDefault | true | Manual zclean runs in dry-run mode |

FAQ

Will this kill my running Claude Code session?

No. zclean checks if the parent process is alive. Active sessions and their children are always protected.

What about my vite dev / next dev server?

If you started it in a terminal, tmux, or VS Code — it has a living parent and won't be touched. Only orphaned dev servers (parent process dead for 24h+) are candidates.

Does the hourly scheduler slow my machine?

No. It runs a single process scan (~100ms), cleans if needed, and exits. No persistent daemon.

How do I stop zclean completely?

zclean uninstall
npm uninstall -g zclean

Supported Tools

| Tool | Cleanup Coverage | |------|-----------------| | Claude Code | MCP servers, sub-agents, agent-browser, playwright | | Codex | codex exec, background node workers | | Build tools | esbuild, vite, webpack, next dev (orphaned only) | | MCP servers | Any mcp-server-* pattern | | Runtimes | node, tsx, ts-node, bun, deno, python (AI tool paths only) |

Contributing

See CONTRIBUTING.md for guidelines.

Adding a new process pattern? Edit src/detector/patterns.js and open a PR.

License

MIT — see LICENSE.


Built by whynowlab — the team behind Swing.