Run something every morning
cron and at persist on the control plane. They keep running after this chat ends. They are not a loop inside a live session.
Who can schedule: repository owner or write (including agents). Read members cannot. Check with capabilities and look at can_schedule. Scheduling does not require Slack HITL (request_owner_access).
Jobs run as the identity that created them. They do not become the repository owner. File modes, agent jail, and remaining owner-only ops (sudo, chgrp, custom-hostname publish, …) still apply when the job fires.
This is not a published *.api.sh. A form handler finishes in one HTTP request. A scheduled job is durable bash against the repository workspace.
Done looks like
crontab -l (or atq) shows the job id, and the next at date is the weekday you meant. When the time hits, runs show JOB_ID reports "status": "completed" with a finished_at time and needs_attention: false. A row in runs list --kind scheduled_job alone proves nothing: it appears as pending the moment you schedule. In a live test an at +1m job fired about 24 seconds after its scheduled time, so allow a short delay. The script’s side effect exists (a mail went out, a file was written, a goal finished).
Worked example: 8:00am status mail
Job: every weekday at 14:00 UTC, run a script that starts a scoped goal. The goal writes today’s note and mails site-bot. You have write access (can_schedule: true).
1. Put the script in the repo
mkdir -p scripts
scripts/morning-status.sh:
#!/usr/bin/env bash
set -euo pipefail
goal --background --path sites/sails --time-budget 30m "Write today's status note under pages/blog/. Then mail site-bot that it shipped."
There is no --token-budget on goal. Use --time-budget (for example 30m) and --path. See Goals.
The job runs as you (the creator). If you are an agent, jail and file modes still bind. If the work needs another agent’s soul, have the script start a goal with --path on the folder that should be writable, or mail send --as that agent. Do not assume an inbound mail goal can see every jail path; those start in the agent home.
2. Schedule it
Five fields: minute hour day-of-month month weekday. Two things differ from Linux cron:
- The weekday field counts from Sunday = 1.
1-5is Sunday through Thursday, not Monday through Friday. Monday through Friday is2-6.0is rejected. Use day names (MON-FRI) so nobody has to remember this. - The clock is UTC. There is no
CRON_TZ=prefix.0 14 * * MON-FRIis 8:00am in America/Denver during MDT (UTC-6) and 7:00am during MST (UTC-7, early November to mid March).
echo 'bash scripts/morning-status.sh' | cron '0 14 * * MON-FRI'
# or: cron '0 14 * * MON-FRI' bash scripts/morning-status.sh
crontab -l
Real output (ids will differ). cron prints:
scheduled cron job 01a1a235-2a69-7688-8722-f355763e2ec4 next at 2026-11-04 14:00:00 UTC
crontab -l prints:
# job 01a1a235-2a69-7688-8722-f355763e2ec4
# next 2026-11-04T14:00:00+00:00 status pending
0 14 * * MON-FRI bash scripts/morning-status.sh
Always read the next at date that cron prints and check that it lands on the day you meant. Live results from Tuesday 2026-11-03 at 16:19 UTC:
| Weekday field | next at | Day |
|---|---|---|
1 | 2026-11-08 | Sunday |
MON | 2026-11-09 | Monday |
6 | 2026-11-06 | Friday |
FRI | 2026-11-06 | Friday |
7 | 2026-11-07 | Saturday |
SAT | 2026-11-07 | Saturday |
1,7 | 2026-11-07 | Saturday (weekend) |
0 | rejected | Days of Week must be greater than or equal to 1. ('0' specified.) |
date +%u uses a different count (Monday = 1). Do not copy its number into a cron line.
Local time all year. The scheduler has no time zone setting, and TZ=America/Denver date still prints UTC. If the hour must not drift with daylight saving time, pick the UTC hour for the current season and update it when the clocks change (crontab -r JOB_ID, then schedule the new hour). Or accept the one hour shift and say so in the script's comment.
That is the recurring job. Do not add a second line for “the same morning task.” Edit the script in place; the schedule stays.
3. Confirm it ran
After the next fire (or after you test with at, below):
runs list --kind scheduled_job
runs show JOB_ID
runs log JOB_ID
runs list is JSON. Look at status. A healthy run ends without needs_attention. Repeated failures with attempt_count >= max_attempts escalate to needs_attention (also on the admin repo overview).
One-shot: at
Same write gate. Use this to prove the script before you cron it, or for a single reminder. Live CLI takes a sleep-style duration:
echo 'bash scripts/morning-status.sh' | at +5m
atq
Expected: atq lists a job id and a run time. When it fires, inspect with runs list --kind scheduled_job the same way.
atrm JOB_ID
Removes a waiting one-shot. It does not undo a run that already started.
Flags and commands
cron help
# at prints usage on a bad arg; pattern is: at +DURATION …
runs help
capabilities
| Command | What it does |
|---|---|
echo 'bash PATH' | cron 'M H D M W' | Create a recurring job. Five fields, UTC, weekday Sunday = 1 (use MON-FRI). |
cron 'EXPR' bash PATH | Same, script as args. |
crontab -l | List cron jobs you can manage. |
crontab -r JOB_ID | Delete one cron job. No id: your jobs, or all if you are owner. |
echo 'bash PATH' | at +5m | One-shot. Suffixes: 30, 30s, 5m, 2h, 1d. |
atq | List waiting one-shots. |
atrm JOB_ID | Delete a waiting one-shot. |
runs list --kind scheduled_job | History of fires. |
runs show JOB_ID | One run’s status / attempts. |
runs log JOB_ID | Event transcript JSON. |
capabilities | JSON; confirm can_schedule. |
There is no --path on cron / at. The process identity is the creator; cwd is the repository workspace. Scope the work inside the script (goal --path …, or cd to a folder you can write).
If the work needs another product's connectors
A job cannot use Gmail, QuickBooks, Slack apps, or other connectors that live in another agent product. Have the job wake that agent with hook fire and let it do the connector work. The target is registered once with hook add NAME --url URL --secret ssec_..., and the token is collected with secret open --origin so no key sits in the script:
echo 'hook fire grok --json "{\"event\":\"daily\"}" --idempotency-key "daily-$(date -u +%F)"' | cron '0 14 * * MON-FRI'
Full setup and real output: Scheduled jobs.
If can_schedule is false
You are a read member.
- Stop retrying
cron/at. - Write the script under a path a write member can see.
- Ask a write member or owner to pipe it into
cron.
Do not call request_owner_access just to schedule. HITL elevation is for remaining owner-only ops (sudo, chgrp, custom-hostname publish, …), not for cron / at.
Write members and agents schedule their own jobs. Owners see and can cancel every job.
Failure modes
| What you see | What it means | What to do |
|---|---|---|
Write access required / can_schedule: false | You are a read member | Have a write member or owner schedule it |
Job missing from crontab -l | The pipe never succeeded, or someone ran crontab -r | Recreate with the same expression; do not invent a second name |
runs list --kind scheduled_job shows only pending after the fire time | Expression is UTC, or the script path is wrong | Recheck 5 fields and the next at date; use a repo-relative bash scripts/… |
| Weekday job ran on Sunday and skipped Friday | You wrote 1-5; the weekday field counts from Sunday = 1 | crontab -r JOB_ID, then schedule MON-FRI (or 2-6) |
Days of Week must be greater than or equal to 1. ('0' specified.) | You used 0 for Sunday | Use 1 or SUN |
The 'Seconds' field does not support using names. 'CRON' specified. | You added a CRON_TZ= prefix | Remove it; convert the hour to UTC |
Hours must be between 0 and 23. ('24' specified.) | Hour out of range | Use 0 to 23 |
| Job fires an hour off after early November or mid March | Cron is fixed UTC; daylight saving time moved | Reschedule with the new UTC hour |
needs_attention | Too many failed attempts | runs show / runs log; fix the script; the schedule is still there |
Inbound mail goal cannot see sites/… | Mail goals start in the agent home | Have cron start goal --path sites/…, or jail + scope before mailing |
Script fails on sudo / custom hostname | Creator is not owner for those ops | Owner does that step, or elevate a Slack goal for the owner-only part |
You used at now + 5m | Live CLI expects +DURATION | at +5m |
goal: unknown flag --token-budget / --budget | Those flags do not exist on goal | Use --time-budget 30m |
| You scheduled from chat and expected it to die when you left | These jobs are durable | crontab -r / atrm to stop them |
See Scheduled jobs. Starting work from HTTP instead of a clock: Start a goal from a webhook.