@tpmjs/tools-retention-policy-draft
Drafts a data retention policy document from data types, retention periods, and justifications. Takes an array of data types with retention requirements and generates a comprehensive markdown policy document suitable for compliance review. Useful for GDPR, CCPA, and other privacy regulations.
Test @tpmjs/tools-retention-policy-draft (retentionPolicyDraft) with AI-powered execution
0/2000 characters
Install this tool and use it with the AI SDK
npm install @tpmjs/tools-retention-policy-draftpnpm add @tpmjs/tools-retention-policy-draftyarn add @tpmjs/tools-retention-policy-draftbun add @tpmjs/tools-retention-policy-draftdeno add npm:@tpmjs/tools-retention-policy-draftimport { retentionPolicyDraft } from '@tpmjs/tools-retention-policy-draft';import { generateText } from 'ai';
import { openai } from '@ai-sdk/openai';
import { retentionPolicyDraft } from '@tpmjs/tools-retention-policy-draft';
const result = await generateText({
model: openai('gpt-4o'),
tools: { retentionPolicyDraft },
prompt: 'Your prompt here...',
});
console.log(result.text);Available configuration options
dataTypesarrayArray of data types with retention requirements
organizationNamestringOrganization name for the policy document (default: "Your Organization")
effectiveDatestringEffective date in ISO 8601 format (default: current date)
Schema extracted: 1/1/2026, 8:18:28 AM
Generates data retention policy documents from data types, retention periods, and justifications for GDPR, CCPA, and other privacy compliance regulations.
npm install @tpmjs/tools-retention-policy-draft
import { retentionPolicyDraft } from '@tpmjs/tools-retention-policy-draft'; const result = await retentionPolicyDraft.execute({ organizationName: 'Acme Corporation', effectiveDate: '2025-01-01', dataTypes: [ { type: 'User Account Data', retentionDays: 2555, // ~7 years justification: 'Required by financial regulations and tax law', category: 'Personal Data', }, { type: 'Application Logs', retentionDays: 90, justification: 'Operational troubleshooting and security monitoring', category: 'Operational', }, { type: 'Payment Records', retentionDays: 2555, justification: 'Required by tax law and payment card industry standards', category: 'Financial', }, { type: 'Marketing Analytics', retentionDays: 730, // 2 years justification: 'Business intelligence and trend analysis', category: 'Analytics', }, { type: 'Customer Support Tickets', retentionDays: 1825, // 5 years justification: 'Customer service quality and dispute resolution', category: 'Operational', }, ], }); console.log(result.policy); // Full markdown policy document console.log(result.summary); // { // totalDataTypes: 5, // averageRetentionDays: 1551, // longestRetention: { type: 'User Account Data', days: 2555 }, // shortestRetention: { type: 'Application Logs', days: 90 }, // categoryCounts: { // 'Personal Data': 1, // 'Operational': 2, // 'Financial': 1, // 'Analytics': 1 // } // }
{ dataTypes: Array<{ type: string; // Data type name retentionDays: number; // Retention period (must be non-negative integer) justification: string; // Business/legal justification category?: string; // Optional category (auto-categorized if omitted) }>; organizationName?: string; // Default: "Your Organization" effectiveDate?: string; // ISO 8601 date, Default: current date }
interface RetentionPolicyDraft { policy: string; // Full markdown policy document dataTypes: DataTypeRetention[]; // Input data with categories summary: { totalDataTypes: number; averageRetentionDays: number; longestRetention: { type: string; days: number }; shortestRetention: { type: string; days: number }; categoryCounts: Record<string, number>; }; metadata: { organizationName: string; effectiveDate: string; generatedAt: string; version: string; }; }
If no category is provided, data types are automatically categorized based on keywords:
The tool generates a complete policy document with:
The tool validates:
dataTypes is a non-empty arraytype, retentionDays, and justificationretentionDays is a non-negative integercategory is a non-empty string if providedeffectiveDate is a valid ISO 8601 date string if providedconst saasPolicy = await retentionPolicyDraft.execute({ organizationName: 'CloudSync Inc.', effectiveDate: '2025-01-01', dataTypes: [ { type: 'Active User Accounts', retentionDays: 0, // Retained while active justification: 'Active business relationship', category: 'Personal Data', }, { type: 'Deleted User Accounts', retentionDays: 30, justification: 'Grace period for account recovery', category: 'Personal Data', }, { type: 'Access Logs', retentionDays: 90, justification: 'Security incident investigation', category: 'Operational', }, { type: 'Billing History', retentionDays: 2555, justification: 'Tax compliance (7 years)', category: 'Financial', }, { type: 'Product Analytics', retentionDays: 730, justification: 'Product development insights', category: 'Analytics', }, ], });
This tool generates draft policies for informational purposes only. The generated document should be reviewed and approved by qualified legal counsel before implementation. Retention periods must comply with applicable laws in your jurisdiction.
MIT
Downloads/month
0
Quality Score