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

@guardianclaw/voltagent

v0.3.0

Published

AI safety guardrails for VoltAgent: CLAW protocol validation, OWASP protection, and PII detection for autonomous AI agents

Readme

@guardianclaw/voltagent

AI safety guardrails for VoltAgent applications. Implements CLAW protocol validation, OWASP security protection, and PII detection/redaction.

License: MIT

Validated against @voltagent/[email protected] on 2026-04-23.

Features

  • CLAW Protocol: Credibility, Limits, Avoidance, Worth validation gates
  • OWASP Protection: SQL injection, XSS, command injection, SSRF detection
  • PII Detection: Email, phone, SSN, credit card, API keys, and more
  • Streaming Support: Real-time PII redaction for streaming responses
  • VoltAgent Native: Works directly with VoltAgent's guardrail system

Installation

npm install @guardianclaw/voltagent

Quick Start

The simplest way to add GuardianClaw protection to your VoltAgent agent:

import { Agent } from "@voltagent/core";
import { createGuardianClawGuardrails } from "@guardianclaw/voltagent";

// Create guardrails with preset configuration
const { inputGuardrails, outputGuardrails } = createGuardianClawGuardrails({
  level: "strict",
  enablePII: true,
});

// Add to your agent
const agent = new Agent({
  name: "safe-agent",
  inputGuardrails,
  outputGuardrails,
});

Configuration Presets

| Level | Description | |-------|-------------| | permissive | Log only, no blocking. Good for development. | | standard | Block unsafe content, CLAW + OWASP enabled. Recommended for production. | | strict | All validations, block on any issue. For high-security applications. |

Usage Examples

Basic Input Protection

import { createGuardianClawInputGuardrail } from "@guardianclaw/voltagent";

const inputGuard = createGuardianClawInputGuardrail({
  enableCLAW: true,
  enableOWASP: true,
  blockUnsafe: true,
});

const agent = new Agent({
  inputGuardrails: [inputGuard],
});

PII Redaction in Responses

import { createGuardianClawOutputGuardrail } from "@guardianclaw/voltagent";

const outputGuard = createGuardianClawOutputGuardrail({
  enablePII: true,
  redactPII: true,
});

const agent = new Agent({
  outputGuardrails: [outputGuard],
});

// Input: "Contact [email protected] or call 555-123-4567"
// Output: "Contact [EMAIL] or call [PHONE]"

Specialized Guardrails

import {
  createChatGuardrails,
  createAgentGuardrails,
  createPrivacyGuardrails,
} from "@guardianclaw/voltagent";

// For chat applications (jailbreak prevention)
const chatGuards = createChatGuardrails();

// For agent applications (tool call protection)
const agentGuards = createAgentGuardrails();

// For privacy-sensitive applications (full PII protection)
const privacyGuards = createPrivacyGuardrails();

Custom Patterns

const guard = createGuardianClawInputGuardrail({
  customPatterns: [
    {
      pattern: /internal\s+only/i,
      name: "Internal content restriction",
      gate: "limits",
      severity: "high",
    },
  ],
});

CLAW Protocol

The CLAW protocol validates content against four safety gates:

| Gate | Description | Example Violations | |------|-------------|-------------------| | Truth | Factual accuracy | Fake documents, impersonation | | Harm | Potential for harm | Violence, malware, theft | | Scope | Operational boundaries | Jailbreaks, persona switching | | Purpose | Legitimate intent | Purposeless destruction |

OWASP Protection

Detects common security vulnerabilities:

  • SQL Injection
  • Cross-Site Scripting (XSS)
  • Command Injection
  • Path Traversal
  • Server-Side Request Forgery (SSRF)
  • Prompt Injection
  • Sensitive Data Exposure

PII Types Detected

  • Email addresses
  • Phone numbers
  • Social Security Numbers
  • Credit card numbers
  • IP addresses
  • Dates of birth
  • API keys / AWS keys
  • Private keys
  • JWT tokens
  • Passport numbers
  • Driver license numbers

Streaming Support

For streaming responses, use the stream handler:

import { createGuardianClawPIIRedactor } from "@guardianclaw/voltagent";

const piiRedactor = createGuardianClawPIIRedactor({
  enablePII: true,
  piiTypes: ["EMAIL", "PHONE", "SSN"],
});

const guardrail = {
  name: "pii-stream-redactor",
  handler: async (args) => ({ pass: true }),
  streamHandler: piiRedactor,
};

API Reference

Bundle Functions

| Function | Description | |----------|-------------| | createGuardianClawGuardrails(config) | Create complete input/output guardrail bundle | | createChatGuardrails() | Preset for chat applications | | createAgentGuardrails() | Preset for agent applications | | createPrivacyGuardrails() | Preset for privacy-focused applications | | createDevelopmentGuardrails(logger) | Permissive preset for development |

Input Guardrails

| Function | Description | |----------|-------------| | createGuardianClawInputGuardrail(config) | Main input guardrail factory | | createStrictInputGuardrail() | Strict preset | | createPermissiveInputGuardrail(logger) | Log-only preset | | createCLAWOnlyGuardrail() | CLAW validation only | | createOWASPOnlyGuardrail() | OWASP validation only |

Output Guardrails

| Function | Description | |----------|-------------| | createGuardianClawOutputGuardrail(config) | Main output guardrail factory | | createPIIOutputGuardrail(options) | PII-focused output guardrail | | createStrictOutputGuardrail() | Block on any sensitive content | | createPermissiveOutputGuardrail(logger) | Redact only, no blocking |

Streaming Handlers

| Function | Description | |----------|-------------| | createGuardianClawPIIRedactor(config) | Streaming PII redactor | | createStrictStreamingRedactor(config) | Abort on sensitive content | | createPermissiveStreamingRedactor(types) | PII redaction only | | createMonitoringStreamHandler(logger) | Detection without modification |

Validators (Advanced)

| Function | Description | |----------|-------------| | validateCLAW(content, context, patterns) | Run CLAW validation | | validateOWASP(content, checks, patterns) | Run OWASP validation | | detectPII(content, types, patterns) | Detect PII in content | | redactPII(content, types, format) | Redact PII from content | | quickCheck(content) | Fast CLAW check | | quickOWASPCheck(content) | Fast OWASP check | | hasPII(content) | Quick PII detection |

Configuration Options

interface GuardianClawGuardrailConfig {
  // Behavior
  blockUnsafe?: boolean;           // Block unsafe content (default: true)
  logChecks?: boolean;             // Enable logging (default: false)
  logger?: (msg, data) => void;    // Custom logger function

  // Validation modules
  enableCLAW?: boolean;            // Enable CLAW (default: true)
  enableOWASP?: boolean;           // Enable OWASP (default: true)
  enablePII?: boolean;             // Enable PII detection (default: false)

  // CLAW options
  customPatterns?: PatternDefinition[];
  skipActions?: string[];
  minBlockLevel?: RiskLevel;       // 'low' | 'medium' | 'high' | 'critical'

  // OWASP options
  owaspChecks?: OWASPViolationType[];
  customOWASPPatterns?: OWASPPatternDefinition[];

  // PII options
  piiTypes?: PIIType[];
  redactPII?: boolean;
  redactionFormat?: string | ((type, value) => string);

  // Performance
  maxContentLength?: number;       // Max content length (default: 100000)
  timeout?: number;                // Timeout in ms (default: 5000)
}

Requirements

  • Node.js >= 18.0.0
  • VoltAgent >= 0.1.0 (tested with @voltagent/core v1.5.2)

Development

This package depends on @guardianclaw/core which provides the CLAW validation patterns. When developing locally, the dependency is resolved via file:../core in the monorepo structure.

For production npm installations, the core patterns are bundled during the build process. If you're building from source, ensure you have the full monorepo cloned:

git clone https://github.com/guardian-claw/guardianclaw.git
cd guardianclaw
npm install
npm run build -w packages/core
npm run build -w packages/voltagent

Related Packages

Links

License

MIT License (see LICENSE for details)


Built by GuardianClaw Team