Calendar Generation & Scheduling
Relevant source files
The following files were used as context for generating this wiki page:
- ToBeMigrated/content_calendar/README.md
- backend/services/calendar_generation_datasource_framework/README.md
- ToBeMigrated/content_scheduler/README.md
- backend/services/calendar_generation_datasource_framework/data_processing/README.md
- frontend/src/components/ContentPlanningDashboard/components/CalendarGenerationModal/README.md
- backend/services/calendar_generation_datasource_framework/prompt_chaining/steps/phase3/README.md
The Calendar Generation & Scheduling system is a comprehensive framework designed to create, optimize, and manage AI-powered content plans. It leverages a modular 12-step prompt chaining architecture to transform strategic business goals, audience insights, and content gap analysis into actionable publishing schedules. The system bridges high-level content strategy with daily execution, ensuring that every scheduled post aligns with established content pillars and SEO opportunities.
This module provides enterprise-level scheduling capabilities, including recurring content cycles, platform-specific adaptations, and real-time performance tracking. It integrates directly with existing SEO tools and AI capabilities to provide a seamless workflow from topic ideation to multi-platform distribution.
Sources: ToBeMigrated/content_calendar/README.md, backend/services/calendar_generation_datasource_framework/README.md, ToBeMigrated/content_scheduler/README.md
12-Step Prompt Chaining Framework
The core of the generation process is organized into four distinct phases, totaling 12 steps. This framework ensures that the resulting calendar is data-driven and strategically sound.
Phase 1: Foundation (Steps 1-3)
This phase establishes the strategic baseline by analyzing content strategy, integrating gap analysis, and defining audience/platform strategies. It utilizes the StrategyDataProcessor and GapAnalysisDataProcessor to gather real data from databases and SEO tools.
Phase 2: Structure (Steps 4-6)
Focuses on the mechanical structure of the calendar. It defines the timeline framework, maps content pillar distribution, and develops platform-specific guidelines.
- Step 4: Calendar Framework & Timeline.
- Step 5: Content Pillar Distribution.
- Step 6: Platform-Specific Strategy.
Phase 3: Generation (Steps 7-9)
The actual content creation phase where weekly themes are developed and daily content plans are populated with AI-generated recommendations.
- Step 7: Weekly Theme Development.
- Step 8: Daily Content Planning.
- Step 9: Content Recommendations.
Phase 4: Validation & Optimization (Steps 10-12)
Final refinement phase where the calendar undergoes performance optimization, strategy alignment checks, and final assembly.
- Step 10: Performance Optimization.
- Step 11: Strategy Alignment Validation.
- Step 12: Final Calendar Assembly.
Sources: backend/services/calendar_generation_datasource_framework/README.md, backend/services/calendar_generation_datasource_framework/data_processing/README.md, backend/services/calendar_generation_datasource_framework/prompt_chaining/steps/phase3/README.md
System Architecture & Data Flow
The architecture relies on a modular framework that separates data sourcing, prompt building, and quality validation.
The diagram shows how the Data Source Registry and Quality Gate Manager feed into the Prompt Builder to drive the 12-step generation process.
Sources: backend/services/calendar_generation_datasource_framework/README.md
Data Source Registry
The system manages evolving data through a central DataSourceRegistry. This ensures that as data sources change, the architectural core remains stable. Key sources include:
- Content Strategy Source: Provides business objectives and brand voice.
- Gap Analysis Source: Identifies keyword opportunities and competitor insights.
- Performance Source: Feeds historical metrics into the AI for predictive planning.
Sources: backend/services/calendar_generation_datasource_framework/README.md
Quality Gate Validation
To maintain enterprise standards, the system subjects generated content to a series of Quality Gates. Each gate has specific thresholds (typically 0.8 to 0.9) that must be met for the generation to proceed.
| Quality Gate | Purpose | Validation Criteria |
|---|---|---|
| Content Uniqueness | Prevents duplication | Topic diversity, keyword distribution |
| Content Mix | Ensures variety | Balance of pillar types and themes |
| Chain Context | Validates continuity | Data flow integrity between 12 steps |
| Calendar Structure | Structural integrity | Duration accuracy and framework completeness |
| KPI Integration | Goal alignment | Measurement framework and goal tracking |
Sources: backend/services/calendar_generation_datasource_framework/README.md
Content Scheduler Implementation
The scheduler handles the execution of the generated calendar, supporting both one-time and recurring publishing tasks across various platforms.
The sequence diagram illustrates the lifecycle of a scheduled job, including persistence and recovery mechanisms.
Sources: ToBeMigrated/content_scheduler/README.md
Core Scheduling Features
- APScheduler Integration: Uses APScheduler for reliable task execution.
- Persistence: Jobs are stored via SQLAlchemy to ensure automatic recovery on system restarts.
- Conflict Resolution: Detects and resolves overlapping schedules automatically.
- Optimization Engine: Recommends optimal posting times based on platform-specific audience patterns.
Sources: ToBeMigrated/content_scheduler/README.md
Frontend Generation Modal
The user interface for calendar generation is a specialized 12-step modal that provides real-time transparency during the generation process.
Features
- Live Progress Tracking: Displays the current status of the 12-step chain.
- Educational Panel: Provides context-aware tips for each step (e.g., explaining content pillars in Step 5).
- Data Source Transparency: Lists the real data sources being utilized for the current prompt.
- Quality Score Visualization: Displays scores from the Quality Gate Manager using color-coded chips.
Sources: frontend/src/components/ContentPlanningDashboard/components/CalendarGenerationModal/README.md
Implementation Status
The system is currently divided into active modules and migration-ready placeholders:
- Core Generation: Fully implemented using real AI services (no mock data).
- Scheduler: Implemented with support for Twitter; Facebook and LinkedIn adapters are in development.
- Phase 3 (Step 8/9): Currently utilizing placeholders ready for full AI service integration.
Sources: backend/services/calendar_generation_datasource_framework/prompt_chaining/steps/phase3/README.md, ToBeMigrated/content_scheduler/README.md
The Calendar Generation & Scheduling system provides a robust pipeline from data retrieval to content distribution. By combining a 12-step AI generation framework with a persistent, SQL-backed scheduler and a transparent frontend, it enables consistent, strategically aligned content publishing.