#!/usr/bin/env node /** * Seed Calendar with Initial Tasks * * Migrates tasks from MONTHLY-REVIEW-SCHEDULE.md and adds framework analysis tasks * * Copyright 2025 Tractatus Project * Licensed under Apache License 2.0 */ const mongoose = require('mongoose'); const ScheduledTask = require('../src/models/ScheduledTask.model.js'); const MONGODB_URI = 'mongodb://localhost:27017/tractatus_dev'; /** * Initial tasks to seed */ const tasksToSeed = [ // Framework Analysis Tasks (from user request) { title: 'Research: Auto-Compaction Impact on Claude Code Quality', description: 'Conduct systematic research on how conversation auto-compaction affects Claude\'s code quality. Track metrics pre/post compaction to gather evidence. User specifically requested emphasis on understanding this impact.', dueDate: new Date('2025-11-15T10:00:00'), priority: 'HIGH', category: 'research', recurrence: 'once', documentRef: 'docs/AUTONOMOUS_FRAMEWORK_WORK_2025-10-23.md', assignedTo: 'PM', showInSessionInit: true, reminderDaysBefore: 14, tags: ['framework', 'quality', 'auto-compaction'], metadata: { source: 'user-request-2025-10-23', research_type: 'quality_analysis' } }, { title: 'Research: Evidence for 50 Instruction Limit', description: 'Investigate evidence supporting the 50 active instruction limit. Explore whether context-aware instruction loading (applying rules to individual tasks/prompts) could be more effective than all-instructions-always approach.', dueDate: new Date('2025-11-20T10:00:00'), priority: 'HIGH', category: 'research', recurrence: 'once', documentRef: 'docs/AUTONOMOUS_FRAMEWORK_WORK_2025-10-23.md', assignedTo: 'PM', showInSessionInit: true, reminderDaysBefore: 14, tags: ['framework', 'instructions', 'optimization'], metadata: { source: 'user-request-2025-10-23', research_type: 'architecture_analysis' } }, // From MONTHLY-REVIEW-SCHEDULE.md - November 2025 { title: 'CRITICAL: Privacy-Preserving Analytics Implementation Decision', description: 'DECISION REQUIRED: Choose analytics approach for website. Options: (A) Remove analytics claims from privacy policy, or (B) Implement Plausible Analytics ($9/month, privacy-first). This is a values-sensitive decision requiring human PM approval.', dueDate: new Date('2025-11-01T09:00:00'), priority: 'CRITICAL', category: 'governance', recurrence: 'once', documentRef: 'docs/governance/PRIVACY-PRESERVING-ANALYTICS-PLAN.md', assignedTo: 'PM', showInSessionInit: true, reminderDaysBefore: 7, tags: ['privacy', 'analytics', 'values', 'decision-required'], metadata: { source: 'MONTHLY-REVIEW-SCHEDULE.md', decision_type: 'values-sensitive', deferred_date: '2025-10-11' } }, { title: 'Monthly Review: Tractatus Governance Schedule', description: 'Review MONTHLY-REVIEW-SCHEDULE.md for upcoming decisions, add new scheduled items, move completed reviews to archive section.', dueDate: new Date('2025-11-01T10:00:00'), priority: 'MEDIUM', category: 'governance', recurrence: 'monthly', documentRef: 'docs/governance/MONTHLY-REVIEW-SCHEDULE.md', assignedTo: 'PM', showInSessionInit: true, reminderDaysBefore: 3, tags: ['monthly-review', 'governance'] }, // Recurring Monthly Checks - Framework Health { title: 'Monthly Framework Health Check', description: 'Review framework health metrics: (1) Audit logs for boundary violations, (2) Component activity rates, (3) Instruction history growth patterns, (4) Monitor pressure checkpoints and session failures.', dueDate: new Date('2025-11-05T10:00:00'), priority: 'HIGH', category: 'framework', recurrence: 'monthly', documentRef: 'docs/governance/MONTHLY-REVIEW-SCHEDULE.md', assignedTo: 'PM', showInSessionInit: true, reminderDaysBefore: 2, tags: ['monthly-check', 'framework-health', 'monitoring'] }, // Recurring Monthly Checks - Community Engagement { title: 'Monthly Community Engagement Review', description: 'Review community engagement: (1) Media inquiry queue status, (2) Process pending case study submissions, (3) Check AI-curated blog post suggestions for human approval.', dueDate: new Date('2025-11-10T14:00:00'), priority: 'MEDIUM', category: 'project', recurrence: 'monthly', documentRef: 'docs/governance/MONTHLY-REVIEW-SCHEDULE.md', assignedTo: 'PM', showInSessionInit: true, reminderDaysBefore: 3, tags: ['monthly-check', 'community', 'engagement'] }, // Recurring Monthly Checks - Security & Privacy { title: 'Monthly Security & Privacy Audit', description: 'Security audit: (1) Review server logs for suspicious activity (90-day retention), (2) Verify HTTPS certificate renewals, (3) Check backup integrity, (4) Audit admin access logs.', dueDate: new Date('2025-11-15T09:00:00'), priority: 'HIGH', category: 'security', recurrence: 'monthly', documentRef: 'docs/governance/MONTHLY-REVIEW-SCHEDULE.md', assignedTo: 'PM', showInSessionInit: true, reminderDaysBefore: 5, tags: ['monthly-check', 'security', 'privacy', 'compliance'] }, // Annual Reviews - October 2026 { title: 'ANNUAL REVIEW: Core Values and Principles', description: 'Comprehensive annual evaluation of Tractatus core values and principles. Scope: Assess values relevance, implementation effectiveness, community alignment. Authority: Human PM with community input. Outcome: Updated version or reaffirmation.', dueDate: new Date('2026-10-06T10:00:00'), priority: 'CRITICAL', category: 'governance', recurrence: 'yearly', documentRef: 'docs/governance/TRA-VAL-0001-core-values-principles-v1-0.md', assignedTo: 'PM', showInSessionInit: true, reminderDaysBefore: 30, tags: ['annual-review', 'values', 'governance', 'community'], metadata: { review_type: 'annual', created_date: '2025-10-06', review_cycle: 'yearly' } }, // Calendar System Implementation Completion Task { title: 'Document Autonomous Framework Work in Calendar', description: 'Add reference to AUTONOMOUS_FRAMEWORK_WORK_2025-10-23.md to calendar system. This task tracks the successful completion of autonomous framework improvements (test suite, inst_076) and calendar system implementation.', dueDate: new Date('2025-10-24T12:00:00'), priority: 'MEDIUM', category: 'framework', recurrence: 'once', documentRef: 'docs/AUTONOMOUS_FRAMEWORK_WORK_2025-10-23.md', assignedTo: 'PM', showInSessionInit: true, reminderDaysBefore: 1, tags: ['calendar', 'documentation', 'framework'], metadata: { source: 'calendar-implementation', auto_complete: true } } ]; /** * Main seeding function */ async function seedCalendar() { console.log('━'.repeat(70)); console.log(' šŸ“… Seeding Calendar with Initial Tasks'); console.log('━'.repeat(70)); console.log(''); try { // Connect to MongoDB console.log('Connecting to MongoDB...'); await mongoose.connect(MONGODB_URI); console.log('āœ“ Connected to tractatus_dev'); console.log(''); // Check existing tasks const existingCount = await ScheduledTask.countDocuments(); console.log(`šŸ“Š Current task count: ${existingCount}`); if (existingCount > 0) { const readline = require('readline'); const rl = readline.createInterface({ input: process.stdin, output: process.stdout }); const answer = await new Promise(resolve => { rl.question('\nāš ļø Calendar already has tasks. Add these tasks anyway? (y/n): ', answer => { rl.close(); resolve(answer.toLowerCase()); }); }); if (answer !== 'y' && answer !== 'yes') { console.log('\nāœ— Seeding cancelled by user'); await mongoose.connection.close(); process.exit(0); } } console.log(''); console.log(`Adding ${tasksToSeed.length} tasks to calendar...`); console.log(''); let successCount = 0; let errorCount = 0; for (const taskData of tasksToSeed) { try { const task = new ScheduledTask(taskData); await task.save(); console.log(` āœ“ Added: ${taskData.title.substring(0, 60)}...`); console.log(` Due: ${taskData.dueDate.toLocaleDateString()} | Priority: ${taskData.priority} | ${taskData.category}`); successCount++; } catch (err) { console.log(` āœ— Failed: ${taskData.title.substring(0, 60)}...`); console.log(` Error: ${err.message}`); errorCount++; } } console.log(''); console.log('━'.repeat(70)); console.log(` Seeding Complete: ${successCount} added, ${errorCount} failed`); console.log('━'.repeat(70)); console.log(''); // Show summary by category const summary = await ScheduledTask.aggregate([ { $match: { status: { $in: ['pending', 'overdue'] } } }, { $group: { _id: '$category', count: { $sum: 1 } } }, { $sort: { count: -1 } } ]); console.log('šŸ“Š Active Tasks by Category:'); summary.forEach(item => { console.log(` ${item._id}: ${item.count}`); }); console.log(''); console.log('āœ“ Calendar system ready'); console.log(' View at: http://localhost:9000/admin/calendar.html'); console.log(''); await mongoose.connection.close(); process.exit(0); } catch (err) { console.error(''); console.error('āœ— Seeding failed:', err.message); console.error(''); await mongoose.connection.close(); process.exit(1); } } // Run seeding seedCalendar();