Claude Scheduled Tasks: Automate Recurring Work with Routines
Claude Code's scheduling system gives developers three tiers of automation, from quick in-session polling to cloud-hosted Routines that fire on a schedule, an API call, or a GitHub event. Each tier targets a different level of persistence and access, so you can match the automation approach to how the work actually runs. This guide covers setup for all three options, trigger configuration, notification delivery through Channels, and strategies for persisting output in a shared workspace.
Three Tiers of Scheduling in Claude Code
92% of developers now use AI coding tools in their daily workflow, according to a 2026 developer adoption survey. But using AI and automating with AI are different things. Running a code review prompt every morning is still manual work if you open a terminal and type it yourself each time. Claude Code's scheduled tasks remove that last manual step.
The scheduling system has three tiers, each suited to a different level of persistence and infrastructure access.
/loop runs a prompt on repeat inside an open CLI session. It handles quick checks during active development: polling a deployment, watching a PR for review comments, or monitoring a build. The session must stay open, and tasks expire after seven days.
Desktop scheduled tasks run on your machine through the Claude Code Desktop app. They persist across restarts and fire on their own schedule, but only while the app is open and your computer is awake. Use them when you need access to local files and tools that a cloud environment cannot reach.
Cloud Routines run on Anthropic-managed infrastructure. They keep working when your laptop is closed, support three trigger types (schedule, API, and GitHub events), and produce full sessions you can review later. They are available on Pro, Max, Team, and Enterprise plans.
Here is how the three tiers compare on the dimensions that matter most:
- /loop: runs on your machine, requires an open session, 1-minute minimum interval, session-scoped with 7-day expiry, inherits MCP servers from the current session
- Desktop tasks: runs on your machine, persists across app restarts, 1-minute minimum interval, configurable permissions per task, needs the Desktop app open and computer awake
- Cloud Routines: runs on Anthropic cloud, no machine required, 1-hour minimum interval, supports schedule/API/GitHub triggers, uses MCP connectors configured per routine
The right choice depends on two questions: does the work need local file access, and does it need to run when your machine is off? If you need to read local files, choose /loop or Desktop tasks. If the work must run unattended regardless of your machine state, cloud Routines are the only option that fits.
How to Set Up /loop for Quick Polling
The /loop command repeats a prompt at regular intervals within your current Claude Code session. It is the fast way to set up recurring automation because there is nothing to configure outside the session itself.
The basic syntax combines an interval with a prompt:
/loop 5m check if the deployment finished and report what happened
Supported interval units include s (seconds), m (minutes), h (hours), and d (days), with a minimum effective interval of one minute.
If you skip the interval entirely, Claude picks the timing for you:
/loop check whether CI passed and address any review comments
In this dynamic mode, Claude adjusts the delay after each iteration based on what it observed. It checks more often when a build is running, less often when things are quiet. Each iteration prints the chosen delay and reasoning so you can see the pacing logic.
Running /loop with no prompt at all triggers a built-in maintenance routine. This default behavior continues unfinished work, tends to the current branch's PR (review comments, failed CI, merge conflicts), and runs cleanup passes when nothing is pending. You can replace this default by creating a .claude/loop.md file in your project:
Check the release/next PR. If CI is red, pull the failing log,
diagnose, and push a fix. If review comments arrived, address
each one. If everything is green, say so in one line.
Edits to loop.md take effect on the next iteration, so you can refine instructions while a loop is running.
/loop also accepts other commands as the prompt. Running /loop 20m /review-pr 1234 re-runs a saved skill every 20 minutes, which is useful for babysitting a PR through its review cycle.
A few constraints worth knowing: tasks expire after seven days, they only fire while Claude Code is running and idle, and pressing Esc stops a running loop. If Claude is mid-response when a task comes due, it waits until the current turn finishes. You can also disable the built-in scheduler through an environment variable if you need to suppress all scheduled runs temporarily.
Desktop Scheduled Tasks for Local Automation
Desktop scheduled tasks run on your machine through the Claude Code Desktop app. Unlike /loop, they persist across app restarts and do not require an open conversation to fire.
To create one, click Routines in the Desktop sidebar, then New routine, and choose Local. Configure a name, the instructions Claude should follow (written like any prompt), a working folder, and a schedule. Preset options include Manual (on-demand only), Hourly, Daily, Weekdays, and Weekly. For intervals the picker does not cover, ask Claude in any Desktop session: "schedule a task to run the tests every 6 hours" is enough.
Each task fires in a fresh session, independent of any manual sessions you have open. You get a desktop notification when it starts, and the session appears under a Scheduled section in the sidebar. From there you can review what Claude did, check file changes, or respond to permission prompts.
Timing is approximate. A small deterministic delay of a few minutes staggers API traffic across tasks. Tasks only fire while the Desktop app is open and your computer is awake. If your machine sleeps through a scheduled time, the run is skipped. On wake, Desktop catches up by running exactly one session for the most recently missed time within the last seven days. A daily task that missed six days runs once on wake.
If timing matters, add guardrails to the prompt itself: "Only review today's commits. If it's after 5pm, skip the review and post a summary of what was missed."
Each task has its own permission mode. To avoid stalls from unapproved tool calls, click Run now after creating the task, watch for permission prompts, and select "always allow" for each one. Future runs auto-approve those same tools.
You can toggle tasks between Active and Paused from the detail page, review run history (including skipped runs with explanations), and manage saved permissions. On disk, task prompts live at ~/.claude/scheduled-tasks/<task-name>/SKILL.md as YAML frontmatter plus markdown body.
Enable Keep computer awake in Desktop settings under General to prevent idle sleep from skipping runs. Closing the laptop lid still puts it to sleep. For work that must run unattended, use cloud Routines instead.
Cloud Routines on Anthropic Infrastructure
Cloud Routines are the most capable scheduling tier. They run on Anthropic-managed infrastructure, so they keep working when your laptop is closed, your VPN is off, or your machine is powered down entirely. Each routine is a saved configuration: a prompt, one or more GitHub repositories, a cloud environment, and a set of MCP connectors.
Routines support three trigger types, and you can combine them on a single routine.
Schedule triggers run on a recurring cadence. Pick from presets (hourly, daily, weekdays, weekly) or set a custom cron expression via /schedule update in the CLI. The minimum interval is one hour. One-off schedules fire a routine at a specific future time and auto-disable afterward:
/schedule tomorrow at 9am, summarize yesterday's merged PRs
/schedule in 2 weeks, open a cleanup PR that removes the feature flag
API triggers give each routine a dedicated HTTP endpoint. POST to it with a bearer token and an optional text payload, and a new session starts:
curl -X POST https://api.anthropic.com/v1/claude_code/routines/trig_01ABC.../fire \
-H "Authorization: Bearer sk-ant-oat01-xxxxx" \
-H "anthropic-beta: experimental-cc-routine-2026-04-01" \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d '{"text": "Sentry alert SEN-4521 fired in prod."}'
The response includes a session URL you can open to watch the run in real time or continue the conversation manually.
GitHub triggers start a session when a matching repository event occurs. Supported events include pull request actions (opened, closed, labeled, synchronized) and release actions (created, published). Filters narrow which events fire the routine: match by PR author, title, body, base branch, head branch, labels, draft status, or merge status. A regex filter like .*hotfix.* on the title field sends only hotfix PRs to a focused reviewer.
Create routines from the CLI with /schedule, from the Desktop app under Routines > New routine > Remote, or from the web at claude.ai/code/routines. All three surfaces write to the same account. Use /schedule list to see all routines, /schedule update to change one, and /schedule run to trigger one immediately.
Routines are available on Pro, Max, Team, and Enterprise plans with Claude Code on the web enabled. Team and Enterprise owners can disable them organization-wide from claude.ai/admin-settings/claude-code.
By default, routines push only to branches prefixed with claude/ to prevent accidental modifications to protected branches. Enable Allow unrestricted branch pushes per repository if your review process supports it. Routines run autonomously with no permission prompts during execution. They can use skills committed to the repository, run shell commands, and call any included MCP connectors. Remove connectors the routine does not need to limit its access surface.
Store routine output where your team can find it
Fast.io gives your agents storage with built-in search and MCP access. Upload routine output, share it with a link, and query it with AI. Starts with a 14-day free trial.
How to Get Notifications from Scheduled Results
Scheduled tasks produce output. Someone needs to see it. Channels solve this by pushing events into a running Claude Code session from external platforms, and Claude can reply back through the same channel.
During the research preview, three channel plugins ship with Claude Code: Telegram, Discord, and iMessage. Each works as a two-way bridge. You send a message from your phone, it arrives in the CLI session, Claude responds, and the reply appears back in the chat app. This turns your phone into a remote interface for a session that is running scheduled work.
The setup pattern is consistent for Telegram and Discord:
- Create a bot on the platform (BotFather for Telegram, Developer Portal for Discord)
- Install the plugin in Claude Code:
/plugin install telegram@claude-plugins-official - Configure the bot token:
/telegram:configure <token> - Restart with the channel flag:
claude --channels plugin:telegram@claude-plugins-official - Pair your account by messaging the bot and entering the returned pairing code
iMessage works differently on macOS. It reads your Messages database directly and sends replies through AppleScript, with no bot token required. Grant Full Disk Access to your terminal app, install the plugin, restart with channels, and text yourself to test.
Once configured, Channels pair naturally with session-scoped scheduling. A /loop watching CI can ping you on Discord when a build fails. A Desktop task running a nightly dependency audit can push findings to your Telegram bot. The key constraint is that the session must stay open for channel delivery to work.
For cloud Routines, where there is no persistent local session, use MCP connectors instead. Add Slack, Linear, or another connector when creating the routine, and Claude posts results through those services during execution. You can combine approaches: a routine writes a summary to Slack via connector, while a parallel /loop session with Channels watches for follow-up questions from the team.
Persisting Output in a Claude Cowork Workflow
A Claude cowork workflow generates artifacts on a recurring basis: audit reports, review summaries, dependency lists, generated pull requests. Where that output lands determines whether the rest of your team can actually find and use it.
Cloud Routines produce sessions you can review on claude.ai, but session transcripts are personal to your account. Desktop tasks create commits and PRs in your local repo, but those branches need to be pushed and merged before anyone else sees them. Neither tier provides a shared, persistent home for recurring output by default.
Several options handle this gap. You can write results to a Git repository and open pull requests automatically, which works well for code changes but less so for reports or data files. You can push output to S3 or Google Cloud Storage with a presigned URL. You can dump files to Google Drive or Dropbox.
Fast.io offers a different approach. Its workspaces automatically index uploaded files for semantic search and AI-powered chat through Intelligence Mode. Agents access Fast.io through a MCP server with 19 consolidated tools covering workspace management, file operations, search, and sharing. When a routine finishes its work, it can write the output to a Fast.io workspace where the team sees it immediately through the web UI, a branded share link, or their own MCP queries.
Plans start with a 14-day free trial, with workspaces, monthly credits, and storage scaled to each tier. For a nightly dependency audit running as a cloud Routine, the practical workflow looks like this: the routine scans your repositories, compiles a report, uploads it to a shared workspace via MCP, and the team reviews it the next morning. Because Intelligence Mode indexes the file on upload, anyone can ask questions like "which packages had critical vulnerabilities this week?" without opening the report manually.
When the work outgrows what one person can track, ownership transfer lets an agent build and populate workspaces, then hand control to a human manager while keeping admin access for future automated runs. This handoff pattern makes recurring automation practical at team scale, because the agent keeps writing and the humans keep reviewing without stepping on each other.
Frequently Asked Questions
How do I schedule tasks in Claude?
Claude Code offers three scheduling tiers. Use /loop in the CLI to repeat a prompt at regular intervals within an open session. Create a Desktop scheduled task from the Routines sidebar in the Desktop app for persistent local automation. Or create a cloud Routine at claude.ai/code/routines (or with the /schedule CLI command) to run tasks on Anthropic infrastructure even when your machine is off. Cloud Routines also support API and GitHub event triggers beyond simple schedules.
What are Claude Code routines?
Routines are saved Claude Code configurations that run on Anthropic-managed cloud infrastructure. Each routine consists of a prompt, one or more GitHub repositories, a cloud environment, and optional MCP connectors. You attach one or more triggers (recurring schedule, HTTP API endpoint, or GitHub event) and the routine creates a new session each time a trigger fires. They are available on Pro, Max, Team, and Enterprise plans with Claude Code on the web enabled.
Can Claude run tasks automatically?
Yes. With scheduled tasks, Claude runs prompts without manual intervention. /loop handles quick polling during an active session, Desktop tasks fire on a schedule while the app is open, and cloud Routines run even when your computer is off. Routines can also trigger on HTTP POST requests from deploy scripts or monitoring tools, and on GitHub events like pull request opens and releases.
How do I set up Claude Code cron jobs?
In the CLI, use /loop 5m followed by your prompt for a fixed-interval loop, or run /schedule daily PR review at 9am to create a cloud Routine with a recurring schedule. For custom intervals beyond the presets (like every two hours or the first of each month), use /schedule update to set a specific five-field cron expression. Desktop tasks support Hourly, Daily, Weekdays, and Weekly presets, with custom intervals available by asking Claude in any Desktop session.
What plans support Claude Code routines?
Cloud Routines are available on Pro, Max, Team, and Enterprise plans with Claude Code on the web enabled. Team and Enterprise owners can disable routines for their organization from the admin settings. /loop and Desktop scheduled tasks work on all plans that have access to Claude Code, including when authenticated through third-party providers, though some features like the dynamic interval mode require Anthropic authentication.
Can I trigger a Claude routine from a deploy script?
Yes. Add an API trigger to your routine from the web UI at claude.ai/code/routines. This generates a unique endpoint URL and bearer token. POST to the endpoint from your deploy script, CI pipeline, or monitoring tool with the token in the Authorization header. The request body accepts an optional text field for context like a log snippet or alert body, which Claude receives alongside the routine's saved prompt.
What happens if my laptop is asleep during a scheduled task?
Desktop scheduled tasks skip runs when your computer is asleep. When it wakes, the app catches up by running one session for the most recently missed time within the last seven days. /loop tasks also skip missed runs but do not catch up. Cloud Routines are completely unaffected by your laptop state since they run on Anthropic infrastructure independently of your machine.
How do I get notifications from scheduled task results?
For session-scoped work (/loop and Desktop tasks), install a Telegram, Discord, or iMessage channel plugin and restart Claude Code with the --channels flag. Claude can reply through the channel when a scheduled prompt completes. For cloud Routines that run without a local session, configure MCP connectors like Slack or Linear on the routine itself so Claude posts results to those services during execution.
Related Resources
Store routine output where your team can find it
Fast.io gives your agents storage with built-in search and MCP access. Upload routine output, share it with a link, and query it with AI. Starts with a 14-day free trial.