Claude Code Scheduled Tasks: Why /loop Isn't Enough (and What to Use Instead)
You set up a /loop task in Claude Code. "Check the deployment status every 10 minutes." It works. You go about your day. Results come in. Nice.
Then you close your terminal.
Everything's gone. The loop, the task history, the context. No record it ever existed.
Or maybe you didn't close your terminal. You just left it running for a few days. On day 3, the task silently expired. Claude Code enforces a hard 3-day maximum on all /loop tasks. No configuration, no override. Three days, then it self-destructs.
If you've been here — setting up the same loop for the fourth time this month, or losing tasks because your laptop went to sleep — this post is for you.
What Claude Code's /loop actually is
The /loop command is a session-scoped polling scheduler built into Claude Code. You type something like:
/loop 5m check if the deployment finished
Claude creates an internal cron job that fires every 5 minutes. It's useful for short-term monitoring — watching a deploy, checking test results, polling an API endpoint during a debugging session.
Under the hood, it uses CronCreate to register the task, runs it between your turns (never while Claude is mid-response), and adds deterministic jitter to prevent API overload.
For what it does, it works well.
The problem is what it doesn't do.
The five limitations of /loop
1. Session-scoped — dies with your terminal
Every /loop task lives inside the Claude Code process. Close the terminal tab, exit the session, lose your SSH connection — every task disappears instantly. Nothing is saved to disk. There is no recovery mechanism.
This means your computer must stay awake, your terminal must stay open, and your Claude Code session must stay active. Laptop sleeps? Gone. macOS force-quits the terminal for a system update? Gone.
2. Hard 3-day expiry
All recurring /loop tasks auto-expire after 72 hours. When the expiry hits, the task fires one last time, then deletes itself. You cannot configure this. You cannot extend it.
"Run my test suite every morning at 9am" doesn't mean every morning. It means every morning for 3 days.
3. Nothing persists to disk
/loop tasks are purely in-memory. Restart Claude Code and everything vanishes. There's no schedules.json, no state file, no history. If you want the same schedule after a restart, you re-create it manually.
4. Tasks queue, don't run in parallel
When a /loop task's scheduled time arrives, it doesn't fire immediately. It waits for Claude to be idle. If Claude is processing a long request — a multi-file refactor, a complex debugging session — your "every 5 minutes" task could wait 15+ minutes.
Tasks that miss their window fire once when Claude becomes free. No catch-up runs, no stacking.
5. 50-task hard cap
Claude Code limits you to 50 concurrent scheduled tasks per session. For most developers this is plenty, but it's worth knowing if you're building monitoring-heavy workflows.
What persistent scheduling looks like
Here's what I actually wanted: set up a task once, have it run indefinitely, survive restarts, and send me results on my phone. Actual cron behavior — not session-scoped polling.
That's what we built into Clautel.
Setup in natural language
In Telegram, message your project bot:
/schedule run the test suite and send me a summary every morning at 9am
Claude parses the natural language, generates a cron expression, and shows you a confirmation:
Schedule: daily 9am Cron:
0 9 * * *Task: Run the test suite and send a summary[Confirm] [Cancel]
Tap Confirm. Done. The schedule is saved to disk and starts running.
What makes it different
Persistent across restarts. Schedules are written to ~/.clautel/schedules.json. Restart the daemon, reboot your machine — schedules reload automatically. No re-creation needed.
No terminal required. Clautel runs as a background daemon (or a macOS launchd service). Your terminal doesn't need to be open. Your laptop lid can be closed. The daemon stays alive as long as your machine is awake.
No expiry. Tasks run until you remove them. A daily 9am test run means a daily 9am test run — next week, next month, until you tell it to stop.
Results on your phone. When a scheduled task finishes, the output lands in your Telegram chat. Wake up, open Telegram, your test results from 9am are already there.
Per-project isolation. Each project bot manages its own schedules. Your frontend project's daily lint check doesn't interfere with your backend project's API health monitor.
Management from Telegram
/schedules — list all scheduled tasks for this project
/unschedule <id> — remove a specific schedule
On the manager bot, /schedules shows tasks across all projects — one overview for everything running on your machine.
Side-by-side comparison
Here's how /loop and Clautel's /schedule compare on the things that matter:
Claude Code /loop | Clautel /schedule | |
|---|---|---|
| Persistence | Session-scoped (in-memory only) | Saved to disk, survives restarts |
| Terminal required | Yes, must stay open | No (background daemon) |
| Maximum duration | 3-day hard expiry | No limit |
| Survives reboot | No | Yes (launchd service) |
| Results delivery | Terminal output (must be watching) | Telegram message on phone |
| Missed runs | Fire once when idle, no catch-up | Fires at next scheduled time |
| Setup | CLI only (/loop 5m ...) | Telegram natural language |
| Task management | /loop list, /loop cancel | /schedules, /unschedule |
| Cross-project view | No (single session) | Yes (manager bot overview) |
| Setup location | Must be at your terminal | From your phone, anywhere |
When to use which
Use /loop when you're actively working in Claude Code and want short-term monitoring. "Watch this deploy for the next hour." "Check if the CI passes every 5 minutes." It's built-in, zero setup, and fires within your active session.
Use /schedule when you want something to run tomorrow, next week, and next month without you touching it again. Daily test suites. Weekly dependency audits. Recurring health checks. Anything that should outlive a single terminal session.
They solve different problems. /loop is a session timer. /schedule is cron.
What I'm running right now
Four scheduled tasks across two projects:
- Test suite — daily at 9am. Results in Telegram before I've finished my coffee.
- Dependency audit — every Monday at 10am. Checks for outdated packages and known vulnerabilities.
- Staging health check — every 6 hours. Hits the health endpoint, reports any failures.
- Git commit summary — daily at 6pm. Summarizes the day's commits across the team.
All four were set up from Telegram in about 2 minutes total. I haven't touched any of them since. They just run.
How it works under the hood
When you send /schedule run tests every morning at 9am, here's what happens:
-
Claude Code (via the Agent SDK) parses your natural language into a structured object:
{ cronExpr: "0 9 * * *", humanLabel: "daily 9am", prompt: "Run the test suite and send a summary" }. -
You get a confirmation message with inline keyboard buttons. Tap Confirm.
-
The schedule is saved to
~/.clautel/schedules.jsonwith a unique ID, and anode-crontask is registered in the daemon process. -
When the cron fires, the daemon creates a fresh Claude Code session in the project's working directory, runs the prompt autonomously (with a 25-turn safety limit), and sends the result to your Telegram chat.
-
If the daemon restarts, it reads
schedules.jsonon startup and re-registers all cron tasks. Nothing is lost.
The whole system is about 180 lines of TypeScript. Open source, MIT licensed — you can read it at github.com/AnasNadeem/clautel.
Can Claude Code run while you sleep?
This is the question underneath all of this. And the honest answer depends on what you mean.
With /loop: Only if your terminal stays open, your machine stays awake, and you re-create the task every 3 days. Practically, no.
With claude -p + system cron: Yes, but you're writing shell scripts, managing cron directly, handling output yourself, and you don't get results on your phone. It works but it's manual.
With Clautel's scheduler: Yes. Set it up from Telegram, close your laptop, go to sleep. The daemon fires the task on schedule, runs it through Claude Code, and drops the result in your chat. You wake up and it's there.
The scheduler doesn't replace the deep, multi-hour coding sessions where you're sitting at your desk collaborating with Claude. It handles the repeating tasks you'd otherwise forget — or the ones you'd waste time re-triggering manually every day.
Getting started
npm install -g clautel@latest
clautel setup
clautel start
Then in Telegram:
/schedule check for security vulnerabilities every day at 2pm
7-day free trial. Works on any Claude Code subscription (Pro or Max). $4/mo after trial.