Recurring Tasks in Claude Code: The /loop Skill and Desktop Scheduler
Claude Code's /loop skill schedules prompts and slash commands to run on a recurring interval using cron. It is designed for in-session automation during an active development or debugging session. A separate scheduler in the Claude Desktop application handles tasks that need to persist beyond a single session.
Understanding where each tool's scope ends is what determines which one to reach for.
The /loop skill
Basic syntax
The interval is a number followed by a unit character: m for minutes, h for hours, or d for days. The prompt is any natural language instruction or slash command. The minimum interval is one minute, since the underlying mechanism is cron.
Specifying a shorter interval like 30s rounds up to one minute.
Scheduling a task
Running /loop 1m say hello produces a confirmation like this:
The confirmation includes the job name, cadence, a unique job ID used to manage the task, and the expiration notice. The task runs until it is cancelled, the session ends, or the three-day limit is reached.
Time-based scheduling
The /loop skill also accepts natural language time specifications. A prompt like /loop say hello at 6:30pm causes Claude to ask for clarification:
All times are interpreted using the local machine's time zone, not UTC.
Integrating skills
Any slash command available in Claude Code can be placed inside a /loop. Monitoring a log file during a debugging session is a common use case:
Checking on a long-running background job:
Watching for newly assigned issues during triage:
For tasks that do not need advanced reasoning, switching to Haiku reduces cost and latency:
Managing active jobs
Running show running cron jobs invokes the CronList tool and displays a table of all scheduled tasks in the current session.
Cancelling by job ID:
Cancelling by description:
Claude identifies the matching job and deletes it.
Limitations
Three-day expiration
Every task created with /loop expires after three days.
This is a deliberate safety feature to prevent forgotten tasks from making API calls indefinitely. It also means /loop is not suitable for monitoring tasks that need to keep running past that window.
Session-only persistence
Scheduled tasks are stored in memory for the current session only. Closing the terminal or ending the Claude Code session (ccq --exit) wipes all active loops immediately. A new session starts with no scheduled jobs. This is fundamentally different from a system cron job, which is written to disk and managed by the operating system.
Jitter
To avoid many instances executing at exactly the same second, a small deterministic offset is added to each task's firing time.
Recurring tasks can have a jitter of up to 10% of their period, capped at 15 minutes. An hourly task might fire anywhere between zero and six minutes past the hour. The offset is derived from the task ID, so it is consistent across runs. For most monitoring and automation tasks this is acceptable, but it rules out /loop for anything requiring precise timing.
Persistent scheduling in the Claude Desktop app
For tasks that need to survive reboots and run indefinitely, the Claude Desktop application has a separate Scheduled tasks feature.
Creating a scheduled task
In the Claude Desktop sidebar, select Scheduled, then click + New task.
The configuration modal provides:
- Name and description for easy identification
- Prompt, the core instruction for Claude
- Frequency:
Manual,Hourly,Daily,Weekdays, orWeekly - Under More options: model selection (Opus, Sonnet, or Haiku) and a folder to work in
Tasks created here are not subject to the three-day limit and are saved by the application. They run as long as the computer is on and the Claude Desktop app is running in the background.
Code tab vs. Cowork tab
The Scheduled feature exists in both the Code and Cowork tabs of the desktop app with different capabilities.
Tasks scheduled under the Code tab have access to the local filesystem, suitable for tasks that read files, run scripts, or interact with the local environment.
Tasks scheduled under the Cowork tab run in a sandboxed environment without local filesystem access, suited for tasks that fetch from web APIs or summarize online content.
Final thoughts
/loop in the terminal is for short-term, in-session automation. Use it when you want to delegate repetitive manual checks to Claude while you focus on something else during an active work session. The three-day expiration and session-only persistence are appropriate constraints for this scope.
The desktop scheduler is for long-term, persistent automation: daily briefings, weekly reports, or any task that needs to keep running across reboots and beyond the lifespan of a terminal session.
Both tools are documented in the Claude Code documentation.