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

@framers/agentos-ext-grounding-guard

v0.2.1

Published

NLI-based factual grounding verification guardrail for AgentOS

Downloads

1,325

Readme

@framers/agentos-ext-grounding-guard

NLI-based factual grounding verification for @framers/agentos. Extracts claims from agent outputs and verifies each against the supplied source documents using natural-language-inference scoring.

What it does

Extracts each factual claim from an agent response, runs it against retrieval context (or supplied passages) using an NLI model, and reports per-claim entailment scores. Claims below the configured entailment threshold are flagged as ungrounded.

Use it to:

  • Reduce hallucination in RAG agents
  • Enforce a minimum-grounded-claims policy before responses ship
  • Build hallucination-rate dashboards from per-claim scores

Install

npm install @framers/agentos-ext-grounding-guard

Peer dependency: @framers/agentos.

Quickstart

import { AgentOS } from '@framers/agentos';
import { createGroundingGuardrail } from '@framers/agentos-ext-grounding-guard';

const agentos = new AgentOS();
await agentos.initialize({
  extensionManifest: {
    packs: [
      {
        factory: () =>
          createGroundingGuardrail({
            entailmentThreshold: 0.7,
            minGroundedClaims: 0.8,
          }),
        enabled: true,
      },
    ],
  },
});

Public API

  • ClaimExtractor — pulls discrete factual claims from a response
  • GroundingChecker — runs each claim through NLI scoring
  • GroundingGuardrail — guardrail wiring both for the AgentOS contract
  • createGroundingGuardrail(options?) — factory returning an ExtensionPack
  • createExtensionPack(context) — auto-discoverable factory used by AgentOS extension auto-pickup

See src/types.ts for GroundingGuardOptions.

Examples

  • test/ — claim-extraction and entailment scoring fixtures

Lazy loading and optional install

This package is an optional dependency of @framers/agentos-extensions-registry. The registry ships catalog metadata; createCuratedManifest() calls import.meta.resolve() per entry and silently skips anything not installed. npm install @framers/agentos-ext-grounding-guard is the gate.

The NLI entailment pipeline does not load at activation. The pack registers a factory under the grounding:nli-pipeline key in SharedServiceRegistry, and the model file enters the module graph only on the first claim verification. The claim extractor runs first against extracted claims; only claims that pass extraction reach NLI.

GuardrailOutputPayload carries ragSources?: RagRetrievedChunk[] when the response was generated from RAG context. The grounding guardrail uses these as the entailment-source set; without them, the claim extractor still runs but per-claim entailment falls back to whatever passages the host provides.

The guardrail registers with config.evaluateStreamingChunks = false (final-response only) by default, since claim extraction needs full responses. It runs in Phase 2 of the two-phase dispatcher. Below-threshold claims return FLAG by default; configure contradictionAction: 'block' to escalate to BLOCK.

For the full DI model and end-to-end walkthrough, see How extensions stay optional and lazy and the auto-loading guide.

License

Apache 2.0 — see the repo root LICENSE.