Skip to content
eWiki The practical AI reference

How-To Guides

How to Schedule Prompts with Claude Code /loop and Understand Session Limits

Black pyramid-shaped mechanical metronome on a white table beside a curling white ribbon, gray ruler, and black cylinder.

Claude Code scheduled tasks can repeat checks within a CLI session, run locally through Desktop, or execute in the cloud. The right option depends on how long the task must persist and whether your computer or session will remain active.

What Claude Code Scheduled Tasks Are

Claude Code is an agentic coding tool available through the terminal, IDE integrations, the desktop app, and a browser. Its scheduling features can automate recurring checks for deployments, pull requests, integration tests, builds, and similar coding work.

In the CLI, /loop repeats a prompt during the current session. Claude Code also accepts one-time natural-language requests, such as asking for a reminder at a specified time or a later check on integration tests. These are session tasks rather than an always-on external scheduler: whether they run depends on the Claude Code process and its current state.

Black mechanical metronome and silver stopwatch in front of a stack of gray and white books with blue ribbons.

How to Schedule and Stop Prompts with /loop

To run a check every five minutes, enter:

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

This creates a fixed-interval prompt. If you provide a prompt without an interval, Claude can choose the interval. Entering /loop by itself starts the documented maintenance prompt, which continues unfinished conversational work, tends the current branch’s pull request, and performs cleanup when nothing else is pending.

Stopping behavior depends on the loop type. While a self-paced loop is waiting, press Esc to stop it. Ctrl+C can also stop it while Claude is idle, except in an attached background session. Those controls do not cancel a fixed-interval scheduled task; ask Claude to cancel that task instead. An uncanceled loop expires after seven days.

Person arranging small black cylinders in a circle on a white table, with a pen and black mechanical metronome nearby.

Session Limits, Missed Runs, and Restoration

For CLI scheduling, “session limits” concern task lifetime and execution—not subscription quotas or model-token allowances. Session-scoped tasks fire only while Claude Code is running and idle. If an interval passes during a long request, the scheduled prompt runs once after Claude becomes idle; it does not run separately for every missed interval.

Closing the terminal or allowing the session to exit stops these tasks from firing. Backgrounding the session is different: /loop tasks carry into the background session and can continue without a terminal.

When you return with claude --resume or claude --continue, Claude Code restores eligible tasks created with CronCreate. A self-paced /loop is not restored and must be started again. Restored recurring tasks do not replay executions missed while the session was stopped; the next run is the first one due after resumption. Loops also retain the documented seven-day maximum lifetime unless canceled sooner.

Conclusion

Choose the scheduling surface according to where and how long the work must run. CLI /loop is suited to repeated prompts tied to an active or backgrounded Claude Code session. Desktop scheduled tasks run locally with access to local files and tools, but the app must be open and the computer awake. Desktop supports hourly, daily, weekday, weekly, manual, and custom cron schedules; custom schedules cannot run more often than hourly.

Cloud scheduled tasks can use schedule, API, or GitHub-event triggers and can run while your computer is off. Pick the surface that matches your persistence requirements, then begin with one documented recurring check and verify when it runs, stops, or resumes.

Disclosures and limitations

  • This article was prepared with AI assistance from the cited Claude Code documentation sources.
  • The scheduling options are presented as workflow choices, not affiliate purchasing recommendations.

Sources

Improve this guide

Report a problem or suggest the next question

Submissions enter a private editorial queue. They are reviewed and deduplicated before any public update or new page is created.