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

@metaharness/turn-credit

v0.1.0

Published

Offline recursive turn-level credit assignment for agent trajectories (AgentOPSD, arXiv:2608.05987). Converts sparse terminal outcomes into bounded per-turn weights via recursive belief updates — advisory signals for routing, retry policy, retrieval feedb

Readme

@metaharness/turn-credit

Offline recursive turn-level credit assignment for agent trajectories, after AgentOPSD (arXiv:2608.05987). A terminal success/failure score says nothing about which of 30 actions mattered. This package converts per-turn evidence into a recursively-updated belief in eventual success, and turns marginal belief revisions into bounded per-turn weights that modulate — never reverse — the verifier's terminal decision.

No critic, no extra environment rollouts. The one cost is a single teacher scoring pass per trajectory (produced upstream by the caller — e.g. a RuFlo replay with a RuVector-retrieved skill as privileged context).

The mechanism

B0  = clip(prior, e0, 1-e0)      verifier-grounded prior (e.g. group success rate)
c_k = g*c_{k-1} + e_k            decayed evidence accumulation      (g = 0.95)
B_k = sigmoid(logit(B0) + c_k)   belief in eventual success after turn k
dB_k = B_k - B_{k-1}             marginal belief revision — the credit signal

q_k = sign(A_seq) * dB_k         outcome alignment
z_k = standardize(q_k)           within-trajectory
w_k = clip(1 + b*z_k, 1-b, 1+b)  bounded weight                     (b = 0.5)
m_k = (1-l) + l*w_k              final multiplier; A~_k = A_seq * m_k  (l = 0.5)

Safety invariant: m_k ∈ [1 − λ·b, 1 + λ·b] and strictly positive, so sign(Ã_k) = sign(A_seq) always. Paper defaults bound modulation at ±25%; GOVERNED_DEFAULTS caps it at ±10% for receipt-gated flywheels.

Evidence modes

  • logprob-gap — AgentOPSD proper: summed token-level log-probability gaps between the skill-conditioned and plain pass of the same recorded action.
  • verifier-delta-proxy — EXPERIMENTAL stand-in for hosted models without token probabilities: a structured verifier score delta (with vs. without context). Carried as proxy: true in every credit, receipt, and CLI line it touches.

Usage

import {
  processTrajectory, evidenceFromScorePairs, GOVERNED_DEFAULTS,
  creditByLabel, attributeMutation, toMemoryFeedback, buildCreditReceiptPayload,
} from '@metaharness/turn-credit';

const credit = processTrajectory({
  evidence: evidenceFromScorePairs(pairs),  // one teacher pass, produced upstream
  mode: 'verifier-delta-proxy',
  prior: 0.3,                               // group success rate S/G
  success: true,
  config: GOVERNED_DEFAULTS,                // ±10% bounded reshaping
});

creditByLabel(credit);                      // which tools/routes/retries mattered
attributeMutation(parent, child, 'retryPolicy'); // Darwin: did the mutation earn it?
toMemoryFeedback(credit, retrievedIdsByTurn);    // credit-weighted retrieval feedback
signer.sign(buildCreditReceiptPayload({ credit, verifierVersion, retrievedEvidence, trajectory }));

CLI: metaharness turn-credit process <input.json> [--out credit.json] [--governed], then metaharness turn-credit report <credit.json>.

Honest bounds

  • Advisory only. Outputs feed routing quality labels, retry/tool analysis, retrieval feedback, and mutation attribution. Nothing here updates model weights, and attributeMutation is evidence for a promotion gate, not a gate.
  • The proxy mode is not AgentOPSD. Treat proxy magnitudes as ordinal.
  • The source is a v1 preprint (single model family, no multi-seed CIs). Gate any trust escalation behind your own acceptance run — see ADR-248's acceptance criteria.