-
Notifications
You must be signed in to change notification settings - Fork 274
Description
Problem
The scheduler backend (APScheduler + SQLite + EventBus) is fully functional, but there's no built-in user-facing interface to manage scheduled jobs. The current workaround is having Claude interact with the SQLite database directly via sqlite3 commands (possible since the bot runs on a VPS with CLI access), but this still requires a bot restart after every change and is a workaround rather than a proper solution.
Expected behavior
Users should be able to create, list, and manage scheduled jobs directly from the Telegram chat using a /schedule command.
Current architecture
The JobScheduler class already supports add_job(), remove_job(), and get_jobs(). It persists jobs to the scheduled_jobs SQLite table and loads them on startup. However, the instance is created locally in run_application() and is not injected into bot dependencies, making it inaccessible from command handlers.
Proposed solution
- Inject
JobSchedulerinto bot dependencies alongsideClaudeIntegration,SessionManager, etc. - Add a
ScheduleCommandHandlerregistered for/schedulewith subcommands:/schedule list— show all active jobs/schedule add <name> <cron> <prompt>— create a new job (auto-fillschat_id,working_directory,created_byfrom context)/schedule remove <job_id>— soft-delete a job/schedule pause <job_id>//schedule resume <job_id>— toggleis_active
- Hot-reload: call
JobScheduler.add_job()directly so new jobs are live immediately without bot restart
Auto-populated fields
When creating via /schedule add:
job_id→ auto-generated from name + random suffixtarget_chat_ids→ current chat IDworking_directory→ user's active project directorycreated_by→ user's Telegram ID
Key files
run_application()— exposeJobSchedulerin bot deps- New
ScheduleCommandHandler— command handler for/schedule JobScheduler— minor API adjustments if needed