Policy Compliance Checker
Automatically review documents, code, and content for compliance with company policies and regulations.
This workflow checks content against policy documents, legal requirements, and compliance frameworks.
Implementation
1import { relay } from "@relayplane/workflows";23const result = await relay4 .workflow("policy-checker")56 // Step 1: Identify applicable policies7 .step("identify-policies")8 .with("openai:gpt-4o")9 .prompt(`Determine which policies apply to this content:1011Content Type: {{contentType}}12Document: {{documentSummary}}1314Available Policies:15{{policyList}}1617Return list of applicable policies with rationale.`)1819 // Step 2: Check compliance for each policy20 .step("check-compliance")21 .with("anthropic:claude-3.5-sonnet")22 .depends("identify-policies")23 .prompt(`Review content for policy compliance:2425Content:26{{contentToReview}}2728Applicable Policies:29{{identify-policies.output}}3031Policy Documents:32{{policyDocuments}}3334For each policy, check:35- Compliant: yes/no36- Violations found (specific quotes/sections)37- Severity: critical/high/medium/low38- Required remediation3940Be thorough and cite specific policy sections.`)4142 // Step 3: Check regulatory requirements43 .step("regulatory-check")44 .with("anthropic:claude-3.5-sonnet")45 .depends("check-compliance")46 .prompt(`Check regulatory compliance:4748Content: {{contentToReview}}49Industry: {{industry}}50Jurisdictions: {{jurisdictions}}5152Regulations to check:53- GDPR (if EU data involved)54- CCPA (if California users)55- HIPAA (if healthcare data)56- SOC 2 requirements57- Industry-specific regulations5859Identify:60- Regulatory risks61- Required disclosures62- Data handling violations63- Missing compliance elements`)6465 // Step 4: Security and privacy review66 .step("security-review")67 .with("openai:gpt-4o")68 .depends("check-compliance")69 .prompt(`Review for security and privacy issues:7071Content: {{contentToReview}}7273Check for:74- Exposed credentials, API keys, tokens75- PII (personal identifiable information)76- Sensitive internal information77- Security vulnerabilities disclosed78- Unredacted customer data7980Flag any security concerns.`)8182 // Step 5: Generate compliance report83 .step("compliance-report")84 .with("anthropic:claude-3.5-sonnet")85 .depends("check-compliance", "regulatory-check", "security-review")86 .prompt(`Generate compliance review report:8788Policy Compliance: {{check-compliance.output}}89Regulatory Check: {{regulatory-check.output}}90Security Review: {{security-review.output}}9192Format:93# Compliance Review Report9495## ✅ Compliant Areas96- Policies met9798## ⚠️ Violations Found99100### Critical101- Blockers that must be fixed102103### High Priority104- Important issues to address105106### Medium/Low107- Suggestions for improvement108109## 📋 Regulatory Notes110- GDPR/CCPA/HIPAA compliance status111112## 🔒 Security Concerns113- Any sensitive data exposed114115## ✏️ Recommended Actions116- Specific changes needed for compliance117118## 📝 Approval Status119- APPROVED / NEEDS REVISION / REJECTED120121Clear, actionable, cite specific violations.`)122123 .run({124 contentType: "Marketing Email",125 documentSummary: "Promotional email for new product launch",126 contentToReview: emailContent,127 policyList: [128 "Brand Guidelines",129 "Anti-Spam Policy",130 "Claims & Substantiation",131 "Privacy Policy",132 ],133 policyDocuments: await loadPolicies(),134 industry: "SaaS",135 jurisdictions: ["US", "EU"],136 });137138// Block or approve based on results139const report = result.steps["compliance-report"].output;140if (report.includes("REJECTED")) {141 await blockPublication({142 content: emailContent,143 reason: report,144 reviewer: "AI Policy Checker",145 });146} else if (report.includes("APPROVED")) {147 await approvePublication(emailContent);148}Use Cases
1. Code Repository Compliance
1// Check code for license compliance2const codeReview = await relay3 .workflow("policy-checker")4 .run({5 contentType: "Source Code",6 contentToReview: sourceCode,7 policyList: ["Open Source License Policy", "Security Standards"],8 policyDocuments: {9 licenses: "Only MIT, Apache 2.0, BSD licenses allowed...",10 security: "No hardcoded credentials, use environment variables...",11 },12 });2. Marketing Content Review
1// Check blog posts for claims compliance2const contentReview = await relay3 .workflow("policy-checker")4 .run({5 contentType: "Blog Post",6 contentToReview: blogPostMarkdown,7 policyList: [8 "Claims & Substantiation Policy",9 "Brand Guidelines",10 "Competitor Comparison Rules",11 ],12 industry: "FinTech",13 });3. Contract Review
1// Review vendor contracts2const contractReview = await relay3 .workflow("policy-checker")4 .run({5 contentType: "Vendor Contract",6 contentToReview: contractPDF,7 policyList: [8 "Procurement Policy",9 "Data Processing Agreement Requirements",10 "Insurance Requirements",11 ],12 jurisdictions: ["California", "Delaware"],13 });GitHub Pre-commit Hook
1#!/bin/bash2# .git/hooks/pre-commit34# Check committed files for policy compliance5FILES=$(git diff --cached --name-only --diff-filter=ACM)67for FILE in $FILES; do8 # Check for secrets9 if grep -E "(api_key|password|secret)" "$FILE"; then10 echo "❌ Possible secret detected in $FILE"11 echo "Run policy checker before committing"1213 # Run AI policy check14 npx tsx scripts/check-policy.ts "$FILE"15 exit 116 fi17doneSample Output
# Compliance Review Report ## ⚠️ Violations Found ### Critical 1. **Unsubstantiated Claim (Claims Policy §3.2)** - Quote: "Increase revenue by 300% in 30 days" - Issue: No data or case studies to support this claim - Fix: Either provide evidence or change to "up to" with disclaimer 2. **Missing Unsubscribe Link (CAN-SPAM Act)** - Email lacks required unsubscribe mechanism - Fix: Add unsubscribe footer per template ### High Priority 1. **Competitor Disparagement (Marketing Guidelines §5.1)** - Quote: "Unlike competitors who use outdated technology..." - Issue: Generic negative comparison without specifics - Fix: Focus on our benefits, not competitor weaknesses ## 📋 Regulatory Notes - **GDPR**: Compliant (privacy policy linked, consent mechanism present) - **CAN-SPAM**: Non-compliant (missing unsubscribe) ## ✏️ Recommended Actions 1. Remove or substantiate "300% revenue" claim 2. Add required unsubscribe link to footer 3. Reframe competitor comparison positively 4. Legal team review before sending ## 📝 Approval Status **NEEDS REVISION** - Fix critical issues before publishing
Integration Points
- CMS: Check blog posts before publishing
- Email: Verify marketing emails comply with CAN-SPAM
- Code: Pre-commit hooks for license/secret scanning
- Contracts: Review vendor agreements before signature
- HR: Job postings for discrimination/bias
Legal Disclaimer: AI policy checking is a first-pass tool. Always have qualified legal/compliance professionals review critical documents.