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

@waymakerai/aicofounder-policies

v1.0.0

Published

Declarative policy engine for AI guardrails - HIPAA, GDPR, SEC, PCI compliance presets

Downloads

60

Readme

@cofounder/policies

Declarative policy engine for AI guardrails. Ships with battle-tested compliance presets for HIPAA, GDPR, CCPA, SEC, PCI DSS, FERPA, SOX, and general AI safety. Zero runtime dependencies.

Installation

npm install @cofounder/policies

Quick Start

import { PolicyEngine } from '@cofounder/policies';

// Create an engine from presets
const engine = PolicyEngine.fromPresets(['hipaa', 'safety']);

// Evaluate content
const result = engine.evaluate({
  content: 'Patient John Smith, SSN 123-45-6789, was diagnosed with diabetes.',
  model: 'gpt-4o',
  role: 'physician',
  authenticated: true,
  mfa: true,
});

console.log(result.passed);          // false (SSN triggers block)
console.log(result.violations);      // detailed violation objects
console.log(result.redactedContent); // content with PII redacted (if action is redact)

Available Presets

| Preset | Framework | Description | |-------------|-------------|----------------------------------------------------------| | hipaa | HIPAA | All 18 PHI identifiers, audit trails, encryption | | gdpr | GDPR | Data minimization, consent, right to erasure/portability | | ccpa | CCPA/CPRA | Right to know, delete, opt-out, non-discrimination | | sec | SEC | Investment disclaimers, insider trading, anti-fraud | | pci | PCI DSS v4.0 | Cardholder data, CVV/PIN, encryption, access control | | ferpa | FERPA | Student records, directory info, consent | | sox | SOX | Financial reporting, internal controls, record retention | | safety | AI Safety | Harmful content, suicide prevention, child safety | | enterprise| Enterprise | Balanced default: safety + privacy + PII + governance |

import { listPresets, getPreset } from '@cofounder/policies';

console.log(listPresets()); // ['hipaa', 'gdpr', 'ccpa', ...]

const hipaa = getPreset('hipaa');

Policy Composition

Combine multiple policies with different strategies:

import { PolicyEngine, compose, getPreset } from '@cofounder/policies';

// Strictest: block > redact > detect, lower cost limits, intersection of allowed models
const composed = compose(
  [getPreset('hipaa'), getPreset('gdpr'), getPreset('safety')],
  'strictest',
);

// Or use the engine directly
const engine = PolicyEngine.compose(
  [getPreset('hipaa'), getPreset('pci')],
  'strictest',
);

Strategies:

  • strictest (default) - Most restrictive rules win
  • first - First policy wins on conflict
  • last - Last policy wins on conflict

Custom Policies

import { PolicyBuilder, CORE_PII_PATTERNS } from '@cofounder/policies';

const policy = new PolicyBuilder('my-policy', 'My Custom Policy')
  .description('Custom policy for internal use')
  .piiPatterns(CORE_PII_PATTERNS)
  .piiAction('redact')
  .prohibitContent({
    name: 'no-competitors',
    pattern: 'competitor-name',
    flags: 'gi',
    severity: 'medium',
    message: 'Do not mention competitor names',
  })
  .maxCostPerRequest(1.0)
  .allowModels(['gpt-4*', 'claude-*'])
  .requireAuth()
  .allowRoles(['admin', 'developer'])
  .build();

const engine = new PolicyEngine([policy]);

Extending Presets

import { parsePolicy } from '@cofounder/policies';

const policy = parsePolicy({
  metadata: {
    id: 'my-hipaa-plus',
    name: 'HIPAA Plus Custom Rules',
    version: '1.0.0',
    extends: 'hipaa', // inherits all HIPAA rules
  },
  rules: {
    // additional rules are deep-merged on top
    cost: {
      enabled: true,
      maxCostPerRequest: 2.0,
    },
  },
});

Validation

import { validatePolicy } from '@cofounder/policies';

const result = validatePolicy(myPolicyObject);
if (!result.valid) {
  console.error('Validation errors:', result.errors);
}

Evaluation Context

interface EvaluationContext {
  content?: string;           // Text to evaluate
  model?: string;             // Model identifier
  cost?: number;              // Request cost (USD)
  tokens?: number;            // Total token count
  completionTokens?: number;  // Completion token count
  role?: string;              // Caller's role
  authenticated?: boolean;    // Auth status
  mfa?: boolean;              // MFA status
  ip?: string;                // Caller's IP
  dailyCost?: number;         // Accumulated daily cost
  monthlyCost?: number;       // Accumulated monthly cost
}

Rule Categories

  • PII - Regex-based detection of emails, phones, SSNs, credit cards, addresses, and more
  • Content - Prohibited patterns (harmful content) and required patterns (disclaimers)
  • Model - Allow/deny lists with glob matching
  • Cost - Per-request, daily, and monthly cost limits; token limits
  • Data - Retention periods, encryption requirements, consent, purpose limitation
  • Response - Length limits, required/prohibited patterns, JSON validation
  • Access - Role-based access, authentication, MFA, IP allowlists, rate limiting

License

MIT