cron command manages scheduled tasks that execute agent prompts at specified intervals or cron expressions.
Usage
Subcommands
list
Display all scheduled jobs, including disabled ones.add
Create a new scheduled job.Human-readable job name
Message/prompt to send to the agent
Run every N seconds (interval-based scheduling)Mutually exclusive with
--cronExamples:300- Every 5 minutes3600- Every hour86400- Every day
Cron expression (time-based scheduling)Mutually exclusive with
--everyFormat: minute hour day month weekdayExamples:0 9 * * *- Daily at 9:00 AM*/15 * * * *- Every 15 minutes0 0 * * 0- Weekly on Sunday at midnight
Deliver agent response to a channelRequires
--channel and --to options.Channel to deliver response (telegram, discord, slack)Required when
--deliver is set.Recipient identifier (chat ID, user ID, channel name)Required when
--deliver is set.Format varies by channel:- Telegram: Chat ID (e.g.,
123456789) - Discord: Channel ID (e.g.,
987654321) - Slack: Channel name (e.g.,
#general)
remove
Delete a scheduled job by ID.enable
Enable a disabled job.disable
Disable a job without deleting it.Job Storage
Jobs are stored at:- Location:
~/.weaver/workspace/cron/jobs.json - Format: JSON
- Persistence: Survives gateway restarts
jobs.json:
Execution Context
Jobs execute with:- Session: Unique per job (maintains conversation history)
- Tools: Full agent tool access
- Skills: All loaded skills available
- Workspace: Restricted to workspace if configured
Examples
Cron Expression Reference
| Field | Values | Special |
|---|---|---|
| Minute | 0-59 | * / , - |
| Hour | 0-23 | * / , - |
| Day | 1-31 | * / , - ? L W |
| Month | 1-12 | * / , - |
| Weekday | 0-6 (Sun-Sat) | * / , - ? L # |
0 * * * *- Every hour on the hour*/15 * * * *- Every 15 minutes0 0 * * *- Daily at midnight0 9-17 * * 1-5- Every hour, 9 AM-5 PM, weekdays0 0 1 * *- First day of every month
Exit Codes
| Code | Reason |
|---|---|
| 0 | Success |
| 1 | Invalid arguments |
| 1 | Job not found |
| 1 | Failed to add/update job |
Error Handling
Missing Required Field
Missing Schedule
Invalid Cron Expression
Missing Delivery Config
Job Not Found
Runtime Behavior
Job Execution
Jobs run in the gateway process:- Gateway loads
jobs.jsonon startup - Scheduler calculates next run times
- At scheduled time, job executes:
- Agent processes prompt
- If
deliver: true, sends response to channel - Updates next run time
Missed Executions
If gateway is down during scheduled time:- Interval jobs: Resume on next interval after startup
- Cron jobs: Skip missed execution, wait for next
Delivery Failures
If channel delivery fails:- Error logged
- Job continues scheduling
- Response not retried
Best Practices
Use descriptive names
Use descriptive names
Names appear in logs and help identify jobs:
Test prompts first
Test prompts first
Run prompt with
weaver agent before scheduling:Use appropriate intervals
Use appropriate intervals
Avoid too-frequent jobs that could rate-limit:
- Minimum recommended: 60 seconds
- For most tasks: 300+ seconds
Monitor job logs
Monitor job logs
Check gateway logs for execution results:
Related Commands
weaver gateway- Starts cron serviceweaver agent- Test job prompts