Skip to content

Scheduled Tasks

Cron-like automation and scheduling patterns

7 min read

You check your deployment status every 30 minutes by switching terminals. Claude can do it for you — poll a URL, parse the response, and alert you when something looks wrong — all without leaving your current session.

Claude Code can run prompts on a schedule without leaving your session. The /loop command and the underlying CronCreate tool let you poll deployments, babysit PRs, check builds, and set reminders — all from the same terminal where you are already working. Tasks are session-scoped, so they vanish when you exit.

Scheduled Task Lifecycle
session scope — tasks vanish on exit /loop 5m run +5m run +10m run +15m exit tasks stop 5 min intervals

The /loop Command

The quickest way to schedule a recurring task is /loop. Give it an interval and a prompt, and Claude starts firing on that cadence.

/loop — Recurring Tasks
$ /loop 5m check if the deployment finished
Scheduled: check if the deployment finished
Interval: every 5 minutes
Task ID: a3f7c912
Next fire: in 5 minutes
I'll check the deployment status every 5 minutes and let you know
when it completes.
$ /loop stop a3f7c912
Cancelled task a3f7c912: check if the deployment finished

The interval can lead or trail the prompt, and it defaults to 10 minutes when omitted:

/loop 5m check if the deployment finished
/loop check the build every 2 hours
/loop check the build # defaults to 10 minutes

Supported time units are s (seconds, rounded up to 1 minute), m (minutes), h (hours), and d (days). Intervals that do not divide evenly into standard cron periods (like 7m) are rounded to the nearest clean interval, and Claude tells you what it picked.

CronCreate Tool

For finer control, use the CronCreate tool directly with a standard 5-field cron expression:

minute hour day-of-month month day-of-week

Cron Expression Quick Reference

ExpressionMeaning
*/5 * * * *Every 5 minutes
0 * * * *Every hour on the hour
0 9 * * *Every day at 9am local
0 9 * * 1-5Weekdays at 9am local
*/15 9-17 * * 1-5Every 15 min during work hours, weekdays
0 */2 * * *Every 2 hours on the hour

All times use your local timezone, not UTC. There is no way to specify a different timezone in the expression itself.

Example — check CI every 15 minutes during work hours on weekdays:

CronCreate: */15 9-17 * * 1-5 check CI pipeline status
Try This

Create a scheduled task in your current session:

In an interactive Claude session, type: /loop 2m tell me the current time and a fun fact

Watch it fire twice, then cancel it. Notice how the task runs in the background of your existing conversation — no separate terminal needed.

Listing and Deleting Tasks

CronList shows every active task, its schedule, and when it will fire next:

CronList / CronDelete
$ CronList
ID Schedule Next Fire Prompt
-------- -------------- ---------------- ---------------------------
a3f7c912 */5 * * * * 2026-03-17 14: 35 check if the deployment finished
c5a1f3e8 */30 * * * * 2026-03-17 14: 50 /review-pr 1234
d8f2a4c1 0 15 17 3 * 2026-03-17 15: 00 push the release branch
3 tasks active (50 max)
$ CronDelete a3f7c912
Cancelled task a3f7c912: check if the deployment finished
2 tasks remaining.

Each task gets an 8-character ID. Pass that ID to CronDelete to cancel it. There is a per-session limit of 50 concurrent tasks.

Looping Over Skills

You can combine /loop with any slash command. Each time the task fires, Claude runs the skill as if you had typed it yourself:

/loop + Skills
$ /loop 20m /review-pr 1234
Scheduled: /review-pr 1234
Interval: every 20 minutes
Task ID: c5a1f3e8
Next fire: in 20 minutes
I'll review PR #1234 every 20 minutes and report any new changes.

This works with any skill — /review-pr, /commit, custom skills you have installed, and so on. It is especially useful for watching a PR during a long review cycle or monitoring a build that takes time to converge.

Session vs Durable Scheduling

When to Use Each Approach

CriteriaSession-Scoped (/loop)External (cron / GitHub Actions)
Survives terminal closeNoYes
Survives machine restartNoYes
Setup effortOne lineCrontab or YAML workflow
Auto-expiry3 daysNever (runs until removed)
Max concurrency50 tasks per sessionOS / CI limits
Best forBabysitting a deploy, watching a PR, remindersNightly reports, health checks, recurring audits
Catch-up on missed firesNo — fires once when idleDepends on scheduler config

For durable scheduling that survives restarts, use system cron calling claude -p in headless mode, or a GitHub Actions workflow with a schedule trigger:

Terminal window
# System cron — runs even if Claude is not open
crontab -e
# */5 * * * * claude -p "check deployment status" --output-format json >> /tmp/deploy-check.log
Session-scoped means ephemeral

Scheduled tasks live inside the running Claude Code process. Closing the terminal, exiting the session, or losing your SSH connection cancels every task instantly. There is no persistence file, no catch-up, and —no-session-persistence has no effect. If you need scheduling that outlasts your terminal, use system cron or GitHub Actions instead.

Seconds round UP to the nearest minute

Cron granularity is 1 minute minimum. If you write /loop 30s check the build, Claude rounds it up to 1 minute and tells you so. There is no sub-minute scheduling. For intervals that do not divide evenly into standard cron slots (like 7m), Claude rounds to the nearest clean interval (e.g., 5 minutes) and reports what it chose.

Tip

Jobs scheduled on the hour (:00) or half-hour (:30) get up to 90 seconds of jitter to prevent thundering-herd effects. Use odd minutes like :03 or :17 to avoid it: CronCreate: 3 9 * * * morning check.

Now Do This

In your next interactive Claude session, try /loop 5m check if there are any new commits on main. Let it run while you work on something else. Scheduled tasks turn Claude from a tool you invoke into an assistant that watches things for you.