diff --git a/scripts/add-cultural-sensitivity-phase3-reminder.js b/scripts/add-cultural-sensitivity-phase3-reminder.js new file mode 100755 index 00000000..366a8a5c --- /dev/null +++ b/scripts/add-cultural-sensitivity-phase3-reminder.js @@ -0,0 +1,129 @@ +#!/usr/bin/env node + +/** + * Add Daily Cultural Sensitivity Phase 3 Reminder + * + * Creates a DAILY recurring task to remind about Phase 3: + * - Review cultural sensitivity detection performance + * - Analyze false positives/negatives + * - Refine patterns based on real-world usage + * - Update PluralisticDeliberationOrchestrator as needed + * + * This task will appear in session-init DAILY until dismissed or completed. + */ + +const mongoose = require('mongoose'); +const ScheduledTask = require('../src/models/ScheduledTask.model.js'); + +const MONGODB_URI = 'mongodb://localhost:27017/tractatus_dev'; + +async function addPhase3ReminderTask() { + console.log('═══════════════════════════════════════════════════════════'); + console.log(' Adding Cultural Sensitivity Phase 3 Daily Reminder'); + console.log('═══════════════════════════════════════════════════════════'); + console.log(''); + + try { + await mongoose.connect(MONGODB_URI); + + // Start tomorrow at 9am + const dueDate = new Date(); + dueDate.setDate(dueDate.getDate() + 1); + dueDate.setHours(9, 0, 0, 0); + + const task = new ScheduledTask({ + title: 'DAILY: Cultural Sensitivity Phase 3 - Learning & Refinement', + description: `Review cultural sensitivity detection system performance and refine as needed. + +**Daily Review Checklist:** +1. Review audit logs: PluralisticDeliberationOrchestrator cultural_sensitivity_check +2. Identify false positives (flagged but culturally appropriate) +3. Identify false negatives (missed culturally insensitive content) +4. Analyze patterns across media responses and blog posts +5. Update detection patterns in assessCulturalSensitivity() if needed + +**What to Look For:** +- Western-centric language that was APPROPRIATE for the audience +- Indigenous exclusion that was APPROPRIATE for the context +- Culturally insensitive content that was NOT flagged +- New patterns emerging from real-world usage +- Feedback from human reviewers on flagged content + +**Success Metrics:** +- < 10% false positive rate (flagged but appropriate) +- < 5% false negative rate (missed insensitive content) +- Consistent improvement in detection accuracy +- Human reviewer confidence in AI flagging + +**Update Process:** +1. Document findings in docs/governance/CULTURAL_SENSITIVITY_REFINEMENTS.md +2. Update patterns in PluralisticDeliberationOrchestrator.service.js +3. Test new patterns with historical examples +4. Commit changes with rationale +5. Monitor impact in next review cycle + +**Context:** +Phase 1: Detection & flagging (COMPLETED) +Phase 2: UI & workflow (IN PROGRESS) +Phase 3: Learning & refinement (THIS REMINDER) + +User request: "ensure we are reminded of phase 3 daily until further notice"`, + dueDate: dueDate, + priority: 'MEDIUM', + category: 'governance', + recurrence: 'daily', + assignedTo: 'PM', + showInSessionInit: true, + reminderDaysBefore: 0, // Show every day + tags: ['cultural-sensitivity', 'inst-081', 'pluralism', 'learning', 'refinement', 'daily'], + metadata: { + source: 'user-request-2025-10-24', + phase: 'phase_3', + implementation: 'cultural_sensitivity_layer', + instruction: 'inst_081', + review_type: 'performance_analysis' + } + }); + + await task.save(); + + console.log('✓ Daily reminder task created successfully!'); + console.log(''); + console.log('Task Details:'); + console.log(` Title: ${task.title}`); + console.log(` Due: ${task.dueDate.toISOString().split('T')[0]} (and daily thereafter)`); + console.log(` Recurrence: DAILY`); + console.log(` Priority: ${task.priority}`); + console.log(` Category: ${task.category}`); + console.log(''); + console.log('This task will appear in session-init EVERY DAY until:'); + console.log(' • User dismisses it (when Phase 3 complete)'); + console.log(' • User marks it complete'); + console.log(' • User updates recurrence'); + console.log(''); + console.log('📊 View in calendar: http://localhost:9000/admin/calendar.html'); + console.log('📋 View audit logs: http://localhost:9000/admin/audit-analytics.html'); + console.log(''); + console.log('Daily review workflow:'); + console.log(' 1. Check audit logs for cultural_sensitivity_check entries'); + console.log(' 2. Review flagged content with human decision outcomes'); + console.log(' 3. Update patterns if false positives/negatives found'); + console.log(' 4. Document changes in CULTURAL_SENSITIVITY_REFINEMENTS.md'); + console.log(''); + + await mongoose.connection.close(); + process.exit(0); + + } catch (err) { + console.error('Error adding task:', err.message); + await mongoose.connection.close(); + process.exit(1); + } +} + +// Run if called directly +if (require.main === module) { + addPhase3ReminderTask(); +} + +module.exports = { addPhase3ReminderTask };