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-pii-redaction

v0.2.1

Published

Four-tier PII detection and redaction guardrail for AgentOS

Readme

@framers/agentos-ext-pii-redaction

Four-tier PII detection and redaction for @framers/agentos. Scrubs personally identifiable information from agent inputs and outputs using a layered pipeline: regex recognizers, NER models, entity merging, and a redaction engine.

What it does

Scans every message flowing through the agent for PII (names, addresses, phone numbers, emails, government IDs, payment information, free-form sensitive entities) and redacts matches before the message reaches downstream tools, the LLM, or storage.

The four tiers:

  1. Regex recognizers — fast, deterministic detection of structured PII (phone, email, SSN, credit-card-like patterns)
  2. NER pipeline — model-based detection of unstructured PII (person names, locations, organizations)
  3. Entity merger — deduplicates and resolves overlapping spans across recognizers
  4. Redaction engine — applies the configured masking strategy (replace, hash, tokenize, or remove) per entity type

Install

npm install @framers/agentos-ext-pii-redaction

Peer dependency: @framers/agentos.

Quickstart

import { AgentOS } from '@framers/agentos';
import { createPiiRedactionGuardrail } from '@framers/agentos-ext-pii-redaction';

const agentos = new AgentOS();
await agentos.initialize({
  extensionManifest: {
    packs: [
      {
        factory: () =>
          createPiiRedactionGuardrail({
            categories: ['email', 'phone', 'ssn', 'person', 'credit-card'],
            strategy: 'replace',
          }),
        enabled: true,
      },
    ],
  },
});

Public API

  • PiiDetectionPipeline, EntityMerger, RedactionEngine — composable pipeline pieces
  • PiiRedactionGuardrail — guardrail wiring the pipeline for the AgentOS contract
  • createPiiRedactionGuardrail(options?) — factory returning an ExtensionPack
  • createExtensionPack(context) — auto-discoverable factory used by AgentOS extension auto-pickup
  • recognizers/ — individual recognizer modules

See src/types.ts for PiiRedactionPackOptions.

Examples

  • test/ — redaction fixtures across recognizer types

Lazy loading and optional install

This package is an optional dependency of @framers/agentos-extensions-registry. The registry ships catalog metadata for every extension, but createCuratedManifest() calls import.meta.resolve() per entry and silently skips anything not installed. npm install @framers/agentos-ext-pii-redaction is the gate.

The 110MB BERT NER model does not load at activation. The pack registers a factory under the pii:ner-model key in SharedServiceRegistry and the model file enters the module graph only on the first scan that needs it. Subsequent scans, the streaming guardrail, and both pii_scan / pii_redact tools share the same instance.

The optional LLM-judge tier is gated by requiredSecrets: [{ id: 'anthropic.apiKey', optional: true }]. Without the key, the descriptor is skipped and the rest of the pack activates unchanged.

The streaming guardrail registers with config.canSanitize = true and config.evaluateStreamingChunks = true, so it runs in Phase 1 of the two-phase dispatcher. SANITIZE results chain sequentially through other Phase 1 sanitizers, then the redacted text feeds Phase 2 classifiers in parallel.

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.