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

@monoes/hooks

v1.0.10

Published

Hook type definitions, an in-memory HookRegistry/HookExecutor, and a WorkerManager with 8 on-demand background workers (health/ddd/security/cache/map/audit/consolidate/progress). Not the runtime hook dispatcher — the live path is .claude/helpers/ (CJS han

Readme

@monoes/hooks

npm version license node

A library, not a runtime dispatcher. Provides hook type definitions, an in-memory HookRegistry/HookExecutor for defining handlers, and a WorkerManager with 9 background workers for Monomind.

Part of the Monomind ecosystem.

Architecture: this is not the live hook path

The Claude Code hooks that actually fire on every edit/command/task/session run through the plain CJS handlers in .claude/helpers/ (see .claude/helpers/hook-handler.cjs), wired up via settings.json. That is the authoritative, "live" dispatch system.

This package is bridged in as optional enrichment at a handful of lifecycle events (SessionStart, PreTask, PostTask, PostEdit, SessionEnd, AgentSpawn) when it's installed and built. HookRegistry lets you define handlers the CJS layer can call into, but since each hook event runs in a fresh subprocess, in-memory registrations don't survive across events. What persists is the workers' output: they write JSON metrics files under .monomind/metrics/ that the statusline, router, and doctor read back.

Install

npm install @monoes/hooks

Native module install blocked? The SQLite-backed background workers depend on better-sqlite3. If it fails to load with Could not locate the bindings file, your npm's allowScripts policy blocked its native build — run npm install-scripts approve better-sqlite3 && npm rebuild better-sqlite3.

Quick start

import { HookRegistry, HookExecutor, HookEvent, HookPriority } from '@monoes/hooks';

const registry = new HookRegistry();
const executor = new HookExecutor(registry);

// Register a hook
registry.register(
  HookEvent.PreEdit,
  async (context) => {
    console.log(`Editing: ${context.file?.path}`);
    return { success: true };
  },
  HookPriority.Normal,
  { name: 'log-edits' }
);

// Execute
const result = await executor.preEdit('src/app.ts', 'modify');

Hook events

| Event | When it fires | |-------|---------------| | PreToolUse / PostToolUse | Before/after any tool call | | PreEdit / PostEdit | Before/after file modification | | PreRead / PostRead | Before/after file reads | | PreCommand / PostCommand | Before/after shell commands | | PreTask / PostTask / TaskProgress | Task lifecycle | | SessionStart / SessionEnd / SessionRestore | Session lifecycle | | AgentSpawn / AgentTerminate | Agent lifecycle | | PreRoute / PostRoute | Task routing decisions | | PatternLearned / PatternConsolidated | Pattern learning |

Priorities

| Priority | Value | Use case | |----------|-------|----------| | Critical | 1000 | Security validation | | High | 100 | Pre-processing | | Normal | 50 | Standard hooks | | Low | 10 | Logging, metrics | | Background | 1 | Async, runs last |

Background workers

9 on-demand workers, all registered in WORKER_CONFIGS, each a factory function managed by WorkerManager:

| Worker | Purpose | |--------|---------| | health | Monitor disk, memory, CPU, processes | | ddd | DDD progress → .monomind/metrics/ddd-progress.json | | security | Scan for secrets and vulnerabilities | | cache | Clean temp files, old logs, stale cache | | progress | Track implementation progress | | map | Codebase map → .monomind/metrics/codebase-map.json | | audit | Security audit → .monomind/metrics/security-audit.json | | consolidate | Memory consolidation → .monomind/metrics/consolidation.json | | reflexion | Self-learning from failures — reflects on failed tasks, stores lessons for future retrieval |

The metrics-producing workers run at session start (via the CJS session handler) and are staleness-gated: each only runs when its output file is missing or older than 6 hours, with a hard per-worker timeout so session start is never blocked. WorkerManager can also schedule them on intervals, persist run state to .monomind/metrics/workers-state.json, raise threshold alerts, and export statusline data.

import { WorkerManager, createHealthWorker } from '@monoes/hooks';

const manager = new WorkerManager(process.cwd());
manager.register('health', createHealthWorker(process.cwd()));
const result = await manager.runWorker('health');

What this package does NOT do

Earlier versions carried MCP tool schemas, agent synthesis, observability traces, interrupt checkpoints, statusline generation, and swarm messaging subsystems. None of it was wired into a running server, so it was deleted. The CLI (packages/@monomind/cli/src/mcp-tools/) owns the real MCP tools; this package is just types + registry/executor + workers.

Links

License

MIT