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

@studio-foundation/ralph

v0.3.0-beta.6

Published

RALPH loop engine - Recursive Automated Loop for Persistent Handling

Readme

@studio-foundation/ralph

The retry engine. Execute → validate → retry with escalated feedback → repeat.

RALPH = Recursive Automated Loop for Persistent Handling.

Role

ralph sits between the engine (orchestration) and runner (LLM execution). It knows nothing about LLMs — it takes a generic executor function and a contract, and loops until the output passes or max attempts is reached.

engine → ralph(executor, contract) → success | exhausted
                 ↑
         executor = () => runner.runAgent(...)

Key exports

import { ralph, RalphConfig, RalphResult } from '@studio-foundation/ralph';
import { validateSchema, validateToolCalls, validateRequiredTools, compose } from '@studio-foundation/ralph';
import { exponentialBackoff, fixedDelay, noDelay } from '@studio-foundation/ralph';

const result = await ralph({
  executor: async (context) => runner.runAgent(context),
  validator: compose(
    (r) => validateSchema(r.output, contract),
    (r) => validateToolCalls(r.tool_calls_count, requirements),
  ),
  maxAttempts: 3,
  retryStrategy: exponentialBackoff(1000, 30000),
  onRetry: async (event) => { /* observability hook */ },
  signal: abortController.signal,  // optional — enables cooperative cancellation
});
// result.status: 'success' | 'exhausted' | 'cancelled'

How it works

  1. Calls executor with current context
  2. Validates the output using the validator function (composed validators)
  3. If pass → returns { status: 'success', result, attempts }
  4. If fail → calls onRetry, waits (retry strategy), retries with failure context
  5. If max attempts reached → returns { status: 'exhausted', lastResult, failures, attempts }
  6. If signal is aborted at any point → returns { status: 'cancelled', lastResult?, attempts }

Validators

ralph exports composable validators that the engine uses to build per-stage validation:

| Validator | Purpose | |-----------|---------| | validateSchema(output, contract) | Check required fields are present | | validateToolCalls(count, reqs) | Check minimum tool call count | | validateRequiredTools(calls, reqs) | Check specific tools were called | | validateCountedTools(calls, reqs) | OR semantics — any of these count toward minimum | | compose(...validators) | Combine multiple validators (all must pass) |

Retry strategies

| Strategy | Behavior | |----------|----------| | exponentialBackoff(min, max) | Exponential backoff with jitter | | fixedDelay(ms) | Fixed wait between attempts | | noDelay() | No wait (prompt escalation handled by runner) |

Rules

  • ralph doesn't know runner. The executor is () => Promise<T>. ralph doesn't care what's behind it.
  • ralph doesn't know engine. It takes config, it returns a result. No pipeline state, no events.
  • Validation logic is in exported validators — the engine composes them per stage.