Scheduled recurring tasks with wall-clock and interval scheduling
Spacebot’s cron system runs scheduled tasks on timers. Each cron job gets a fresh short-lived channel, runs the job’s prompt through the LLM, and delivers the result to a messaging target.
[[cron]]id = "daily-standup"prompt = """Summarize what I worked on today based on my memories and tasks. Include completed tasks, new memories saved, and any blockers."""cron_expr = "0 17 * * 1-5" # 5 PM weekdaysdelivery_target = "discord:123456789"enabled = true[[cron]]id = "morning-briefing"prompt = "Review my calendar and top-priority tasks. Send a brief summary."interval_secs = 86400 # Daily at consistent wall-clock timeactive_hours = [8, 18] # Only fire between 8 AM and 6 PMdelivery_target = "telegram:user_456"timeout_secs = 120
If cron_timezone is not set, wall-clock jobs use the system’s local time, which is often UTC in Docker/containerized environments. Set an explicit timezone to avoid jobs skipping their active window.
Cron executions are logged to the cron_executions table:
CREATE TABLE cron_executions ( id TEXT PRIMARY KEY, cron_id TEXT NOT NULL, started_at TEXT NOT NULL, completed_at TEXT, success INTEGER NOT NULL, summary TEXT);
Cron jobs run in fresh channels with no history. Be explicit about what you want. “Summarize today’s tasks” not “what did I do?”
Set Active Hours
Avoid firing jobs during off-hours. Use active_hours to respect work/life boundaries.
Use Timeouts
Default is 120s. If your job needs more time (e.g., running a full test suite), increase timeout_secs.
Monitor Failures
Check the executions table periodically. If a job is failing repeatedly, the circuit breaker will disable it.
Cron jobs are stateless. The channel created for each execution has no memory of previous runs. If you need continuity, store results as memories or tasks.
[[cron]]id = "task-summary"prompt = "List all tasks in 'in_progress' status and their subtask completion. Include any blockers."cron_expr = "0 9 * * 1-5"delivery_target = "discord:123456789"active_hours = [9, 18]
Weekly Memory Review
[[cron]]id = "weekly-review"prompt = "Recall memories from the past 7 days. Summarize key decisions, learnings, and events."cron_expr = "0 17 * * 5" # Friday 5 PMdelivery_target = "telegram:user_456"timeout_secs = 180
Hourly Health Check
[[cron]]id = "health-check"prompt = "Check if the API is responding. If not, investigate logs and report status."interval_secs = 3600delivery_target = "webhook:https://alerts.example.com/spacebot"
Morning Briefing
[[cron]]id = "morning-briefing"prompt = "Good morning! Here are your high-priority tasks, recent memories, and calendar for today."cron_expr = "0 8 * * 1-5"active_hours = [8, 9] # Only fire during the 8 AM hourdelivery_target = "discord:123456789"