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

nerveflow

v0.1.4

Published

Deterministic control layer for AI workflows

Downloads

525

Readme

Nerveflow

Deterministic control for AI workflows.

Nerveflow defines how your system actually runs, with explicit control flow, visible state, and predictable behavior.

Instead of hiding logic inside prompts or agent loops, Nerveflow makes routing, state, and side effects explicit. Your workflow is a script. Every step is inspectable. Every decision has a place.


What Nerveflow does

  • deterministic execution of workflows
  • explicit event routing (on, emit)
  • persistent, inspectable state (state.*)
  • structured orchestration of agents and tools
  • compact expression support for arithmetic, comparisons, and logical checks

What Nerveflow does not do

  • manage databases or persistence layers
  • define how APIs, files, or images are transported
  • hide behavior inside autonomous agent loops

Those responsibilities belong to your host environment. Nerveflow stays focused on control.


Hello Nerveflow

on external "user_message"
  state.count = state.count + 1
  doubled = state.count * 2
  print "(${state.count}) You said: ${event.value}"
  print "double-count=${doubled}"
end

A workflow is just a script that runs on every event.


Example: simple router

on external "user_message"
  emit("triage", event.value)
end

on "triage"
  result = agent("classifier", event.value, format="json")

  if result.intent == "chat"
    emit("chat_flow", event.value)
  else if result.intent == "search"
    emit("search_flow", event.value)
  else
    emit("fallback", event.value)
  end
end

on "chat_flow"
  reply = agent("chat", event.value)
  emit("user_output", reply)
end

on "search_flow"
  reply = agent("searcher", event.value)
  emit("user_output", reply)
end

on "fallback"
  emit("user_output", "I didn't understand that.")
end

on "user_output"
  output text event.value
end

Routing is explicit. State is explicit. Nothing is hidden inside prompts.


Runtime vs Host

Nerveflow runtime

  • deterministic execution
  • event routing
  • explicit state (state.*)
  • agent / tool orchestration

Host (your app)

  • persistence (files, DB, etc.)
  • APIs and integrations
  • input formats (text, images, files)
  • deployment (CLI, web, backend)

Philosophy & Scope

What Nerveflow focuses on

Nerveflow is intentionally focused on control flow and execution semantics.

It defines:

  • how workflows run
  • how state evolves
  • how decisions are routed

Everything else — integrations, persistence layers, external APIs, multimodal inputs — belongs to the host environment.

What's evolving around it

Additional layers are being built around the core:

  • host integrations (APIs, databases, external systems)
  • persistence adapters (file, DB, distributed state)
  • testing and evaluation tooling for workflows

These evolve without changing how workflows are written.

Because workflows are deterministic and state is explicit, Nerveflow is designed to support reproducible testing and evaluation. Tooling around this is under active development.

Why this approach

If the core is right, everything else can grow around it. If the core is wrong, features won't fix it.

Nerveflow is built by getting the core right first.


Getting started

1. Install

npm install nerveflow

2. Run the example host

cd node_modules/nerveflow/examples/minimal-web-host
npm install
node server.js

Open http://127.0.0.1:4173 in your browser. Write scripts, run them, inspect state and execution events.

3. Use in your code

import { runNextVScript } from 'nerveflow'

const result = await runNextVScript(`
state.count = state.count + 1
remaining = 10 - state.count
output text "count=${state.count}"
output text "remaining=${remaining}"
`, {
  state: { count: 0 },
})

console.log(result.state.count)

Learn more

Expression note: Nerveflow supports +, -, *, /, comparisons, and logical operators directly in workflow expressions. See the language reference for precedence and coercion rules.


Standalone runtime + attach

Run Nerveflow as a dedicated runtime process:

node bin/nerve-runtime.js start examples/mqtt-simple-host --port 4190

Attach from another terminal:

node bin/nerve-attach.js ws://127.0.0.1:4190/api/runtime/ws snapshot
node bin/nerve-attach.js ws://127.0.0.1:4190/api/runtime/ws enqueue user_message hello
node bin/nerve-attach.js ws://127.0.0.1:4190/api/runtime/ws stop

Stream runtime events:

node bin/nerve-attach.js ws://127.0.0.1:4190/api/runtime/ws listen

Start runtime and remote Studio together:

node bin/nerve-dev-remote.js examples/mqtt-simple-host

This launcher auto-opens Studio in your browser when it is ready.

Short form via npm:

npm run dev:remote -- examples/mqtt-simple-host

Use --no-open to suppress browser auto-open.

See the host guide for full details and protocol semantics: Host integration guide.


Run tests

npm test

Status

Nerveflow is a stable, early-stage project focused on the core runtime and workflow model.

The execution model, state handling, and DSL are stable and maturing. Integrations, persistence adapters, and testing tools are evolving around it.


License

MIT