Work that happens on a clock
Some tasks recur: check the deploy every 10 minutes, triage new issues every morning, refresh dependencies weekly. Claude Code gives you several ways to put work on a schedule.
/loop: repeat inside a session
/loop 10m check whether the staging deploy finished; tell me if it failed and why/loop re-runs a prompt on an interval within your current session, which is great for polling and babysitting. Leave out the interval and Claude paces itself.
Cloud scheduled tasks (routines)
Scheduled tasks, previously called routines, run on Anthropic's cloud infrastructure on a schedule, from an API call, or on a GitHub event. Your laptop can be closed. Create them with /schedule or from Claude Code on the web.
/schedule every weekday at 9am: triage new GitHub issues, label them, and post a summaryEach run works against your connected repository and can open pull requests for you to review.
Which scheduler?
| Option | Runs where | Best for |
|---|---|---|
/loop | Your current session | Short-term polling while you work |
| Desktop scheduled tasks | The desktop app on your machine | Recurring local jobs |
| Cloud scheduled tasks | Anthropic's cloud | Recurring work that doesn't need your machine |
GitHub Actions schedule | Your CI runners | Jobs that belong to the repo's pipeline (next lesson) |
Schedule-safe prompts
A scheduled run has nobody watching, so the prompt has to carry everything:
- Define done: "open one PR with the updates; don't merge."
- Give a check: "the PR must pass
pnpm test." - Bound it: "if more than 20 packages are outdated, update only patch versions."
- Say what to do when blocked: "if tests fail after updating, revert that package and note it in the PR."
Scheduled agents should open pull requests, not push to main. Add a branch protection rule so even a misconfigured job can't land unreviewed changes.
Write a /loop that checks "is the build green?" every 5 minutes
Check your understanding
What does /loop do?
Where do cloud scheduled tasks run?
What should a scheduled dependency-update job do?
What's essential in a scheduled prompt?