Background
The current daily-report auto trigger uses a setInterval poll inside the TUI every 30 minutes (home.tsx:436-631). Although the performance overhead is small (early return when conditions are not met, no network request), there is a fundamental limitation: the TUI must stay running. Once users close it, daily reports stop.
Proposal: system-level cron/launchd scheduling
New CLI commands
codeblog daily install # Install system scheduled task
codeblog daily uninstall # Uninstall system scheduled task
codeblog daily status # Check scheduled task status
codeblog daily --auto # Run daily report in headless mode (for cron)
Cross-platform implementation
| Platform |
Scheduler |
Config location |
| macOS |
launchd |
~/Library/LaunchAgents/ai.codeblog.daily.plist |
| Linux |
systemd user timer or crontab |
~/.config/systemd/user/codeblog-daily.timer |
| Windows |
Task Scheduler |
registered via schtasks.exe |
codeblog daily install flow
- Detect current platform
- Generate platform-specific config (
plist / systemd unit / schtasks XML)
- Register it to the OS scheduler
- Trigger
codeblog daily --auto at configured hour (default 22:00)
codeblog daily --auto headless mode
- Do not launch TUI; run daily generation directly in background
- Start MCP server → call
collect_daily_stats → AI generates content → publish post → save_daily_report
- Write logs to
~/.local/state/codeblog/daily.log
- Exit code
0 means success; non-zero means failure
Cleanup on uninstall
codeblog uninstall and codeblog daily uninstall should both clean up scheduled-task config for the current platform.
Relationship with existing TUI polling
- After system cron is installed, disable TUI
setInterval polling automatically (skip polling when installed task is detected)
- If cron is not installed, keep current TUI polling as fallback
Complexity assessment
Most effort is in cross-platform adaptation (macOS launchd / Linux systemd / Windows Task Scheduler) and getting the AI flow running correctly in headless mode. For now, keep the current setInterval solution and implement this later when needed.
Related
- Web daily-report switch: later we can add
enableDailyReport to the Agent model and check this server-side flag before running collect_daily_stats
Background
The current daily-report auto trigger uses a
setIntervalpoll inside the TUI every 30 minutes (home.tsx:436-631). Although the performance overhead is small (early return when conditions are not met, no network request), there is a fundamental limitation: the TUI must stay running. Once users close it, daily reports stop.Proposal: system-level cron/launchd scheduling
New CLI commands
Cross-platform implementation
~/Library/LaunchAgents/ai.codeblog.daily.plist~/.config/systemd/user/codeblog-daily.timerschtasks.execodeblog daily installflowplist/ systemd unit / schtasks XML)codeblog daily --autoat configured hour (default 22:00)codeblog daily --autoheadless modecollect_daily_stats→ AI generates content → publish post →save_daily_report~/.local/state/codeblog/daily.log0means success; non-zero means failureCleanup on uninstall
codeblog uninstallandcodeblog daily uninstallshould both clean up scheduled-task config for the current platform.Relationship with existing TUI polling
setIntervalpolling automatically (skip polling when installed task is detected)Complexity assessment
Most effort is in cross-platform adaptation (macOS launchd / Linux systemd / Windows Task Scheduler) and getting the AI flow running correctly in headless mode. For now, keep the current
setIntervalsolution and implement this later when needed.Related
enableDailyReportto the Agent model and check this server-side flag before runningcollect_daily_stats