Automate Your Claude Code Workflow: A Practical Guide to Scheduled Tasks

Claude Code scheduled tasks illustration

A little automation goes a long way. If you spend any time monitoring deployments, babysitting long-running builds, checking back on pull requests, or simply reminding yourself to follow up on something later, Claude Code’s scheduled tasks give you a lightweight, session-scoped way to run prompts on a cadence. They let Claude re-run prompts automatically while your session is open, turning repetitive checks into background chores so you can focus on higher-value work.

Why scheduled tasks matter

Scheduled tasks are useful when you want Claude to poll a service, repeat a check, or remind you of something without manually reissuing the same prompt. They are designed for convenience inside an active Claude Code session—ideal for iterating quickly during development or for short-lived automation that doesn’t need robust persistence. If you need durable, always-on scheduling, you should prefer external schedulers (Desktop scheduled tasks, GitHub Actions, etc.). But for everything else, scheduled tasks are fast, simple, and integrated.

Getting started

Scheduled tasks require Claude Code v2.1.72 or later; check your version with claude –version. Tasks are session-scoped: they exist only for the lifetime of the current Claude Code process and stop when the session exits. For a quick recurring job, the bundled /loop skill is the easiest entry point.

Schedule a recurring prompt with /loop

The /loop command sets up a cron job that runs in the background while your session is open. You can include an optional interval or let it default to a sensible cadence.

Example:

  • – /loop 5m check if the deployment finished and tell me what happened

Claude will parse the interval, convert it to a cron expression, schedule the job, and give you a job ID and cadence confirmation.

Interval syntax

Intervals are flexible: you can put them at the start, at the end of the command, or omit them. Supported units are s (seconds), m (minutes), h (hours), and d (days). Seconds are rounded up to minutes because cron has minute granularity; other irregular intervals are rounded to the nearest clean value and Claude will tell you which value it chose.

Preserved interval table (plain-text):

Loop over another command

A scheduled prompt can invoke an existing command or skill, which is handy for re-running packaged workflows. For example:

  • – /loop 20m /review-pr 1234

Each time the job fires, it runs /review-pr 1234 as if you had typed it.

Set a one-time reminder

You can schedule single-fire reminders using natural language instead of /loop. Claude pins the fire time to a specific minute and confirms when it will run.

Examples:

  • – remind me at 3pm to push the release branch
  • – in 45 minutes, check whether the integration tests passed

Manage scheduled tasks

Ask Claude in plain language to list or cancel tasks, or use the underlying cron tools directly. Each scheduled task has an 8-character ID you can pass to CronDelete. A session can hold up to 50 scheduled tasks at once.

Preserved tools table (plain-text):

How scheduled tasks run

The scheduler checks every second for due tasks and enqueues them at low priority. Important runtime details:

  • – A scheduled prompt fires between your turns, not while Claude is mid-response. If Claude is busy when a task becomes due, the prompt waits until the current turn ends.
  • – All times are interpreted in your local timezone: e.g., 0 9 * * * means 9am where you’re running Claude Code, not UTC.

Jitter: why timings vary slightly

To avoid large numbers of sessions calling external APIs at the exact same wall-clock moment, the scheduler adds a deterministic jitter to fire times:

  • – Recurring tasks can be delayed up to 10% of their period, capped at 15 minutes (an hourly job might fire between :00 and :06).
  • – One-shot tasks scheduled at the top or bottom of the hour may fire up to 90 seconds early.

The offset is derived from the task ID, so the same task always gets the same offset. If precise timing matters, pick an odd minute (e.g., 3 9 * * * instead of 0 9 * * *).

Three-day expiry

Recurring tasks automatically expire three days after creation. They run a final time, then delete themselves. If you need a loop to last longer, cancel and recreate it before expiry, or use a more durable scheduler.

Cron expression reference

CronCreate accepts standard 5-field cron expressions (minute hour day-of-month month day-of-week). Fields support wildcards (*), single values (5), steps (*/15), ranges (1-5), and lists (1,15,30). Day-of-week uses 0 or 7 for Sunday through 6 for Saturday. Extended syntaxes like L, W, ?, or name aliases (MON, JAN) are not supported. When both day-of-month and day-of-week are constrained, a date matches if either field matches (vixie-cron semantics).

Preserved cron table (plain-text):

Disable scheduled tasks

If you need to turn off the scheduler entirely, set the environment variable CLAUDE_CODE_DISABLE_CRON=1. This disables the cron tools and stops any already-scheduled tasks from firing.

Limitations and when not to use them

Session-scoped scheduling comes with constraints you must accept:

  • – Tasks only run while the Claude Code session is active. Closing the terminal cancels everything.
  • – No catch-up behavior: if Claude is busy when a job time passes, the job fires once when Claude becomes idle, not once per missed interval.
  • – No persistence across restarts. For unattended, durable cron jobs, use GitHub Actions or Desktop scheduled tasks.

Practical tips and examples

  • – Use /loop for short-lived monitoring during a deployment window (e.g., /loop 5m check deployment status).
  • – Reuse existing commands to avoid duplicating logic: /loop 10m /run-health-check.
  • – Avoid scheduling thousands of very frequent tasks. Keep tasks coarse-grained and rely on external schedulers for heavy-duty automation.
  • – When exact timing matters, avoid :00 and :30 and pick specific odd minutes to sidestep one-shot jitter.

Conclusion

Claude Code’s scheduled tasks are a nimble tool for automating recurring checks and reminders inside an interactive session. They trade durability for convenience—perfect for development workflows and short-term monitoring. Understand the session-scoped nature, the jitter behavior, and the three-day expiry, and you’ll be able to offload routine checks to Claude while staying in control.

Leave a Reply

Your email address will not be published. Required fields are marked *