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

@crewhaus/routing-store

v0.3.1

Published

Durable per-(route-key, model) reward scoreboard that makes model_pool routing improve with usage (Section 17)

Readme

@crewhaus/routing-store

The durable reward scoreboard behind agent.model_pool learned routing — the persistence layer that makes model selection improve the more a harness is used (Section 17). Two pieces: a pure computeReward and a file-backed per-(routeKey, model) scoreboard. The PolicyRouter in @crewhaus/model-router reads it through an injected lookup; runtime-core owns the writes.

Reward

computeReward(observation, config?) maps one observed model call to a scalar in [0, 1] — higher is better: successful, cheap, fast. It is pure, side-effect-free, and reproducible from the persisted observation, so the whole learning objective lives here.

  • A failed turn scores 0 outright, regardless of latency or cost — crediting a fast failure on the latency axis would let a frequently-failing model out-score a slower, reliable one.
  • On success, two sub-scores combine (quality is fixed at 1), each in [0, 1]: cost = costRef / (costRef + costUsd) and latency = latRef / (latRef + latencyMs) (0.5 at the reference). The reward is their objective-weighted average; default objective is quality-dominant ({ quality: 0.7, cost: 0.2, latency: 0.1 }).
  • The cost term is dropped and reweighted when costUsd is absent, so a run without cost accounting still learns on quality + latency.

Scoreboard

openScoreboard(rootDir, opts?) opens (or creates) the store at <rootDir>/routing/arms.jsonl and returns { score, record, snapshot, compact, path }:

  • score(routeKey, model) → the arm's rolled-up ArmStats (n, meanReward, varReward, meanLatencyMs, meanCostUsd, costCount) or undefined.
  • record(routeKey, model, reward, obs) folds one observation into the arm and appends it.
  • snapshot() returns every arm, sorted; compact() shrinks an append-heavy store to one aggregate line per arm.

Storage is an append-only JSONL (mode 0600). Each line is either a delta observation or an aggregate snapshot; aggregates fold in memory with Welford's algorithm on load (mean/variance), and compact()'s aggregate lines parallel-combine with any later deltas. Append-only + load-time replay is what makes the store correct under concurrent harness processes: every run only appends its own new observations (atomic small-line writes) and never rewrites another run's data, so two harnesses learning into the same store cannot lose each other's updates. A torn final line from a crashed writer is tolerated.

ScoreReader (just score) is the narrow interface handed to the PolicyRouter, keeping model-router itself fs-free.

CLI

crewhaus route status renders the scoreboard (per-band arms, best-per-bucket starred — what a learned policy exploits); crewhaus route reset wipes it.

Exports

computeReward, DEFAULT_OBJECTIVE, openScoreboard, and the types RouteObservation, RouteObjective, RewardConfig, ArmStats, Scoreboard, ScoreboardOptions, ScoreReader.