Scheduled jobs
at and cron persist on the control plane. They keep running after this chat ends. They are not a loop inside a live MCP session. Each job runs in a fresh process and survives MCP session restarts.
Who can schedule: repository owner or write (including agents). Read members cannot. Run capabilities and check can_schedule instead of guessing.
Scheduling does not need Slack HITL. Jobs run as the identity that created them (created_by). They do not become the repository owner. File modes, agent jail, and remaining owner-only ops (sudo, chgrp, custom-hostname publish, and so on) still apply at fire time.
Done looks like
crontab -l (or atq for a one-shot) shows a job id. When the time hits, runs show JOB_ID reports "status": "completed" and needs_attention: false. The script's side effect exists (mail sent, file written, goal finished, hook delivered).
The job id and the run id are the same value. The id that cron or at prints is the id you pass to runs show, crontab -r, and atrm.
Worked example: weekday morning script
You have write access (can_schedule: true). Put a script in the repo, then cron it.
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."
Cron expressions are five fields and run in UTC (no CRON_TZ= prefix). The weekday field counts from Sunday = 1, so 1-5 is Sunday through Thursday and Monday through Friday is 2-6. 0 is rejected. Use day names to avoid the trap: 0 14 * * MON-FRI is 14:00 UTC, Monday through Friday (8:00am America/Denver during MDT, 7:00am during MST). Check the next at date that cron prints. Full table: Run something every morning.
echo 'bash scripts/morning-status.sh' | cron '0 14 * * MON-FRI'
# or: cron '0 14 * * MON-FRI' bash scripts/morning-status.sh
Real output (your id differs):
scheduled cron job 01a159e7-ce2e-73ce-bf6c-e37c90206450 next at 2026-10-21 14:00:00 UTC
crontab -l prints each job as two comment lines plus the schedule line:
# job 01a159e7-ce2e-73ce-bf6c-e37c90206450
# next 2026-10-21T14:00:00+00:00 status pending
0 14 * * MON-FRI bash scripts/morning-status.sh
crontab -l prints nothing (exit 0) when you have no cron jobs. Cron re-schedules the job after each successful run. Edit the script in place; keep one schedule line.
Cancel with crontab -r JOB_ID, which prints cancelled cron job JOB_ID.
The job's working directory is the repository home ($HOME, for example /ryan/home), not the folder you were in when you scheduled it. A test script that ran pwd printed /ryan/home.
One-shot: at
Live CLI takes a sleep-style duration (30, 30s, 5m, 2h, 1d), not wall-clock now + 5m:
echo 'bash scripts/morning-status.sh' | at +5m
scheduled job 01a159e6-23a3-7347-be2e-60df4c45007a at 2026-10-20 15:21:17.059526939 UTC
atq
01a159e6-23a3-7347-be2e-60df4c45007a 2026-10-20T15:21:17.059526+00:00 pending bash scripts/morning-status.sh
atrm JOB_ID
Use at to prove the script before you cron it, or for a single reminder. atrm removes a waiting one-shot. It does not undo a run that already started.
Check a run
runs list --kind scheduled_job is JSON, newest first. A row exists as soon as the job is scheduled ("status": "pending"), so a row alone does not prove it fired. Look at status and finished_at.
runs list --kind scheduled_job --limit 5
runs list --kind scheduled_job --needs-attention
runs show JOB_ID
runs log JOB_ID
Real runs show after an at job fired:
{
"duration_ms": null,
"error_message": null,
"finished_at": "2026-10-20T15:21:05.602518Z",
"http_status": 0,
"kind": "scheduled_job",
"log_prefix": "runs/.../01a159e6-69e2-70b2-b80e-6d9e9c3fdd81/",
"needs_attention": false,
"run_id": "01a159e6-69e2-70b2-b80e-6d9e9c3fdd81",
"source_path": null,
"started_at": "2026-10-20T15:20:35.047255Z",
"status": "completed",
"summary": "hook fire guide-test --json ...",
"trigger_kind": "at",
"trigger_ref": null
}
trigger_kind is at or cron. started_at is when the job was scheduled, not when it fired. runs log can return [] for a job that completed fine; check the side effect (file, mail, hook deliveries) instead.
runs list --kind does not validate the kind. A typo such as --kind cron returns [] with exit 0, so an empty list can mean a wrong flag, not a missing job.
Wake an outside agent: hook fire
A job cannot use another product's connectors (Gmail, QuickBooks, Slack apps, and so on). Have the job POST to that agent instead, for example a Grok Bot routine webhook, and let it do the connector work. Register a named target once, then fire it from cron.
# 1. Store the destination's bearer token, bound to the URL's origin (scheme + host, no path)
secret set --origin https://hooks.example.com "your-bot-token"
# prints ssec_...
# 2. Register the target (owner only)
hook add grok --url https://hooks.example.com/routines/daily --secret ssec_...
# 3. Prove it by hand, then schedule it
hook fire grok --json '{"event":"daily","source":"cron"}'
echo 'hook fire grok --json "{\"event\":\"daily\"}" --idempotency-key "daily-$(date -u +%F)"' | cron '0 14 * * MON-FRI'
Real output from a test target:
Hook `guide-test` created.
url: https://httpbin.org/anything/guide
auth: Authorization (bearer)
secret: ssec_...
Fire with: hook fire guide-test --json '{}'
delivered guide-test status=200 attempts=1 idempotency-key=guide-test-1
hook deliveries guide-test --limit 5
2026-10-20T15:21:05.555303+00:00 guide-test success status=200 attempts=1 key=01a159e6-dfe3-709a-8f8e-d3dbc085d03b
2026-10-20T15:20:26.614621+00:00 guide-test success status=200 attempts=1 key=guide-test-1
The first row above came from an at job running hook fire, so scheduled jobs can fire hooks directly. The script never sees the token; Sails decrypts it on the host and sends Authorization: Bearer <secret>, Content-Type: application/json, and an Idempotency-Key header.
What to know:
- Payload comes from
--jsonor stdin, and defaults to{}. It must be valid JSON. - Firing the same
--idempotency-keyagain after a success returns the earlier delivery and does not POST twice. Without the flag, every fire gets a fresh key. Use a dated key (daily-$(date -u +%F)) when a retried job must not deliver twice. - Timeouts, connect errors, and HTTP 408, 429, and 5xx retry with backoff (4 attempts, 15 seconds each). Other 4xx and any 3xx fail at once. Redirects are never followed.
- The secret's origin must match the hook URL's origin exactly.
http://andhttps://on the same host are different origins. - Loopback, private (RFC1918), link-local, and cluster-internal destinations are rejected, even behind a public-looking hostname.
--scheme rawsends the secret as the header value withoutBearer.--header X-Api-Keychanges the header name.
This is outbound. An outside service starting a Sails goal over HTTP is the inbound webhook command: Start a goal from a webhook.
Who sees which jobs
| Role | Create | List / cancel |
|---|---|---|
| Write (human or agent) | Own jobs | Own jobs |
| Owner | Any | Every job; crontab -r with no id cancels all cron jobs |
| Read | No | No |
Write members cancel with crontab -r JOB_ID or atrm JOB_ID on jobs they created. Owners (or HITL-elevated goals) can cancel anyone's.
For hooks: hook add is owner only. hook update and hook rm are owner or the hook's creator. hook fire needs owner or write. hook list, hook show, and hook deliveries work for any member and never print the plaintext secret.
Commands
cron 'M H D M W' bash scripts/job.sh
echo 'bash scripts/job.sh' | cron 'M H D M W'
crontab -l
crontab -r [JOB_ID]
at +5m bash scripts/job.sh
echo 'bash scripts/job.sh' | at +5m
atq
atrm JOB_ID
runs list [--path P] [--status S] [--kind K] [--needs-attention] [--limit N]
runs show JOB_ID
runs log JOB_ID
capabilities
hook add NAME --url URL --secret ssec_... [--header NAME] [--scheme bearer|raw]
hook update NAME [--url URL] [--secret ssec_...] [--header NAME] [--scheme bearer|raw]
hook list
hook show NAME
hook rm NAME
hook fire NAME [--json PAYLOAD] [--idempotency-key KEY]
hook deliveries [NAME] [--limit N]
| Command / flag | What it does |
|---|---|
cron 'EXPR' ... | Recurring job. Standard 5-field expression (UTC). |
crontab -l | List cron jobs you can manage, with id, next fire time, and status. |
crontab -r JOB_ID | Cancel one cron job. No id: your cron jobs, or all if you are owner. |
at +DURATION | One-shot. Suffixes: 30, 30s, 5m, 2h, 1d. |
atq / atrm | List / cancel waiting one-shots. |
runs list --kind scheduled_job | Fire history, JSON. |
runs show / runs log | Status and timing / event transcript. |
capabilities | JSON; look at can_schedule. |
hook fire NAME | POST JSON to a named outbound target. |
hook deliveries | Recent deliveries, status, attempts, errors. |
There is no --help on these commands. cron with no script, at --help, and crontab --help print their usage inside an error; hook help and runs help print usage directly. There is no --path on cron / at. Cwd is the repository workspace. Scope the work inside the script (goal --path ..., or cd to a folder you can write).
Failure modes
| What you see | What it means | What to do |
|---|---|---|
Hint that write access is required / can_schedule: false | You are a read member | Ask a write member or owner to schedule it |
cron: invalid cron expression '0 25 * * *' ... Hours must be less than 23. ('25' specified.) | Hour out of range (valid hours are 0 through 23) | Fix the hour field |
cron: invalid cron expression '0 3 * *' | Only four fields | Use all five: minute hour day month weekday |
at: invalid schedule time 'now + 5m' (expected +DURATION) | Wall-clock syntax | at +5m |
Job missing from crontab -l | Pipe failed, or someone ran crontab -r | Recreate; do not invent a second name |
Run still pending after fire time | Expression is UTC, or the fire time has not passed | Read the # next line in crontab -l; recheck the 5 fields |
Run completed but no side effect | Script path or cwd is wrong | Use repo-relative bash scripts/...; cd inside the script |
needs_attention: true | attempt_count >= max_attempts | runs show / runs log; fix the script; confirm the line is still in crontab -l |
runs list --kind ... returns [] | Kind typo (it is not validated) | Use --kind scheduled_job |
Script cannot sudo / custom-hostname publish | Job runs as creator, not as owner | Owner runs that part, or elevate a Slack goal for owner-only ops (not for cron itself) |
| Agent jail blocks the folder the script edits | Jail still applies at fire time | agent jail the path, or start goal --path on a writable folder |
hook: secret ssec_... is not allowed for origin https://example.com (allowed: https://httpbin.org) | Secret origin does not match the hook URL | secret set --origin with the hook URL's exact scheme and host, then hook update NAME --secret ssec_... |
hook: Network access denied: private or reserved endpoint: 127.0.0.1 | Destination is loopback or private | Use a public HTTPS endpoint |
hook: hook target already exists: NAME | hook add on a taken name | hook update NAME ... instead |
hook: hook target not found: NAME | Typo, or the hook was removed | hook list |
hook: payload must be JSON: ... | --json or stdin is not valid JSON | Quote the payload; escape inner quotes inside a cron line |
goal: unknown flag --token-budget / --budget | Those flags do not exist on goal | Use --time-budget 30m |
How to: Run something every morning. Starting work from HTTP instead of a clock: Start a goal from a webhook. Secrets and origins: Store a secret.