Short answer: Claude Code has four ways to run on a schedule. Inside a session, there's the /loop command, or you can ask Claude to create a cron task in plain language. On your own machine, you can call claude -p (headless mode) from cron. And in the cloud, there are Claude scheduled tasks (formerly called routines). The first three need your computer, and usually your terminal, to stay on. Cloud scheduled tasks keep running with your laptop closed, but every run starts from a fresh clone, not your own environment. If you want an always-on computer that's set up like your laptop, without managing a server, that's what fl0w is for.
Why I wanted Claude Code on a schedule
When I first started using Claude Code for work, I treated it like a normal chatbot. I'd ask it to search for things and write code. Then I noticed I was typing the same messages over and over again.
At the time, I worked in developer experience. A big part of my job was keeping our user-facing docs in line with every change we made to our SDK. That meant running git pull, seeing what changed, reading the commit history, and scanning our docs for anything that had drifted.
An agent does this well. Honestly, it does it better than I do. It checks the recent commits, actually reads the diffs, and decides what belongs in the changelog. I'm not great at going through every commit, and reading diffs on GitHub is tedious. It's a lot of context, and an agent is better at searching through it.
+-------------------------------+
| New commits + SDK + docs |
+-------------------------------+
|
v
+-------------------------------+
| Agent reviews diffs and drift |
+-------------------------------+
|
v
+-------------------------------+
| Draft changelog + doc updates |
+-------------------------------+
|
v
+-------------------------------+
| Repeat next week on schedule |
+-------------------------------+
I wanted this to run every week without me starting it. Here's what I tried.
Option 1: The /loop slash command
When Ralph loops were the big thing, I assumed /loop did the same. It doesn't. /loop runs a prompt on an interval, like every 5 minutes, so you can keep an eye on something like CI status.
/loop 30m check whether CI passed on my PR and fix anything that failed
You give it an interval (5m, 2h, 1d) and Claude turns it into a cron expression. If you leave the interval out, Claude picks its own delay between runs. A bare /loop runs a built-in maintenance prompt, or your own .claude/loop.md if you've written one.
Limitations
- Claude Code has to be running on your computer. Tasks only fire while the session is open and idle. Close the terminal and the loop stops.
- Recurring tasks expire after 7 days. That's on purpose, so a forgotten loop can't run forever, but it rules out "every Monday, forever."
- No catch-up. If your laptop was asleep at 9am, the 9am run just doesn't happen.
Option 2: Claude Code's built-in cron tools
Claude Code also has built-in cron tools (CronCreate, CronList, CronDelete), so you can just ask it to schedule a task. Describe the schedule in plain language and Claude turns it into a cron expression:
every weekday at 9am, summarize new commits on main and draft changelog entries
remind me at 3pm to push the release branch
Not having to write cron syntax yourself is great. Claude schedules the job in your local timezone and gives you an ID you can use to cancel it later. One session can hold up to 50 of these.
Limitations
These are the same session-scoped tasks that /loop creates, so the same rules apply: Claude Code has to be running on your computer, recurring jobs expire after seven days, and missed runs aren't replayed. /loop and the cron tools are really one feature with two ways to start it.
(If you use the Claude desktop app, Desktop scheduled tasks survive restarts and don't need an open session. Your machine still has to be on, though.)
Option 3: Headless mode (claude -p) plus your own cron
Next I tried Claude's headless command, claude -p. Why run Claude Code headlessly? You have a prompt you've tested once or twice, and you want to run it over and over. Maybe in the background on a schedule, or on a remote computer so your laptop doesn't have to stay open.
It's very configurable. You pass your prompt, whether to skip permission prompts, which tools to auto-allow, and which tools to expose. You can call it from crontab, launchd, systemd, or GitHub Actions like any other command:
# crontab -e: every Monday at 9am
0 9 * * 1 cd ~/code/sdk && claude -p "Review commits since last Monday and draft changelog entries in CHANGELOG.md" \
--permission-mode auto --permission-prompts none --output-format json >> ~/logs/changelog.jsonl 2>&1
The flags that matter for unattended runs:
--allowedTools "Bash,Read,Edit"or--permission-mode auto, so the run isn't stuck waiting on a permission prompt nobody's going to answer.--permission-prompts none, so anything that would prompt gets denied and the run keeps going.--output-format json(orstream-json), so a script can parse the result.--barefor reproducible runs that skip your local hooks, skills, and MCP servers. Bare mode doesn't use your subscription login, so you'll needANTHROPIC_API_KEY.
Limitations
- Writing the command is tedious. The full command in the docs isn't pretty. Unless you write these often, you have to look up what every flag means. An agent can help you get it right, but the result is still brittle.
- The output isn't easy to read. It's JSON in a log file. If you've tested the prompt a couple of times, you probably won't need to read it much.
- Something still has to be on. Cron on a laptop only fires while the laptop is awake. There was a boom of people buying Mac minis for this, but not all of us have a spare computer sitting around. You can also rent a VPS, which I think is a great option: a separate computer, running remotely, that you can SSH into whenever you like.
- You become the sysadmin. Maybe this is a skill issue on my part, but I find it daunting to SSH in, set up port forwarding, and do everything else it takes to run a remote computer. You also have to set up your Claude Code subscription and auth on the box, copy your MCP config and secrets over, and keep those OAuth tokens fresh. Once it's set up, it may well be the best way to run agents remotely. But it's DevOps work, and that's not something I wanted to take on.
Option 4: Claude scheduled tasks (cloud, formerly routines)
The last thing I looked into is what Anthropic used to call routines and now calls scheduled tasks. A cloud scheduled task is a saved prompt plus one or more GitHub repositories plus your claude.ai connectors. It runs in the cloud on a schedule, from an API call, or on GitHub events. You can create one at claude.ai/code/routines, from the desktop app, or by running /schedule from the CLI:
/schedule every Monday at 9am review last week's commits and open a PR updating the changelog
For most people, cloud scheduled tasks are probably the right way to automate Claude Code. A lot of us daily drive Claude Code (I do too), and the connectors and frontier models that come with your Claude plan are real advantages. Scheduled tasks are included in paid plans (Pro and up), so if you already pay for Claude, it's the cheapest way to try this.
Limitations
For my docs job, I wanted the agent to pull two codebases and compare them: look at the changes in the SDK, open a PR in our Mintlify docs repo, and clean up after itself. Locally, I keep both codebases in one folder, side by side.
A scheduled task's remote environment isn't your local environment, and it's hard to customize. You can connect GitHub, but that's about it. Concretely:
- No personal sandbox. Each run clones your repositories fresh and then goes away. The sandbox is short-lived, not a personal VPS. There's no directory that's still there the next run, no folder of notes or screenshots, no scratch repo that isn't on GitHub.
- Not your environment. Your local
~/.claudesetup doesn't come along. MCP servers you added withclaude mcp addaren't in the connector list, so you have to re-add them as claude.ai connectors or commit them in a.mcp.json. Network access is an allowlist by default. - Not built from what you already do. You start from a blank prompt box. There's no "take the session I just ran and schedule it."
- One-hour minimum interval, and it's still a research preview, so limits may change.
The example templates on the routines page are things like "build me a daily digest" or "check on the price of this." Those suit a remote environment that doesn't need any particular setup. Jobs like my docs job don't.
Comparison: every way to schedule Claude Code
| Laptop can be closed | Persistent files between runs | Your local MCP servers and skills | Setup | |
|---|---|---|---|---|
/loop and cron tools | No | Yes (your machine) | Yes | None |
claude -p + cron on your laptop | No | Yes | Yes (unless --bare) | Low |
claude -p + cron on a VPS | Yes | Yes | Only if you copy them over | High (DevOps) |
| Claude cloud scheduled tasks | Yes | No (fresh clone per run) | claude.ai connectors only | Low |
| fl0w workflows | Yes | Yes (personal cloud computer) | Yes, synced automatically | Low |
Option 5: fl0w, a personal cloud computer without the DevOps
fl0w gives you what a VPS gives you: a computer in the cloud that's truly yours. You run agents and automations on it, without the DevOps maintenance or the tunnel setup.
- Every user gets their own sandbox that persists across sessions. It's like having a VPS that we manage for you, so you don't need to deal with SSH or tunneling. Your repos, folders, and files stay where you left them, so an automation that uses two codebases plus a folder of Markdown docs just works.
- You set things up locally and it syncs. Use the CLI to set up your MCP servers, skills, and everything else the way you want them. All of it is encrypted and synced to your cloud computer, and changes go both ways. See MCP servers in the cloud.
- There's a real UI. You get a terminal and a file explorer in the browser. That's hard to get on a VPS without setting up a virtual desktop, which is a whole other can of worms.
- Workflows come from sessions. When you have a session you want to turn into a workflow (think of it as a prompt template), run one slash command:
/generate. See turning a session into an automation. - Trigger it however you want: hourly, daily, weekly, or monthly schedules; a webhook (
POST /api/hooks/workflows/{id}); or a hosted form you can share.
curl -fsSL https://raw.githubusercontent.com/jackmuva/fl0w/main/install.sh | bash
fl0w login
To be clear about the trade-off: fl0w isn't the claude binary. It's its own harness, built for automation and AI workflows, and it borrows heavily from Claude Code and OpenCode. You can still use Claude models with it. If you specifically need Claude Code itself, run it headlessly on a VPS or use Claude's cloud scheduled tasks. But if what you want is the job you've been doing in Claude Code, running every week on a computer that's your own, give fl0w a try. Full setup is in Automating sessions.
FAQ
How do I run Claude Code on a schedule?
Inside a session, use /loop 1h <prompt> or ask Claude to schedule a task in plain language. Both only run while Claude Code is open. For unattended runs, call claude -p from cron on an always-on machine, or create a cloud scheduled task at claude.ai/code/routines or with /schedule.
Can Claude Code run cron jobs?
Yes. Claude Code has built-in CronCreate, CronList, and CronDelete tools and accepts standard 5-field cron expressions. These jobs are tied to the session: they stop when Claude Code exits, and recurring jobs expire after 7 days.
Does /loop keep running after I close the terminal?
No. /loop tasks only fire while the session is running and idle. Backgrounding the session keeps them going, but the machine still has to stay on.
What's the minimum interval for Claude cloud scheduled tasks?
One hour. /loop and local cron tasks can go down to one minute.
Do Claude cloud scheduled tasks have access to my local files?
No. Each run clones your selected GitHub repositories fresh. Local files, uncommitted work, and MCP servers you added with claude mcp add aren't available unless you commit them or add them as claude.ai connectors.